From erlang@REDACTED Fri Aug 1 01:04:07 2008 From: erlang@REDACTED (Dominic Williams) Date: Fri, 01 Aug 2008 01:04:07 +0200 Subject: [erlang-questions] now() seems to produce inconsistent timestamps. In-Reply-To: References: Message-ID: <489244E7.5050705@dominicwilliams.net> Hi Nicholas, Nicholas Schultz-M?ller a ?crit : > Is this a bug or a feature? Does two or more Eshells not > agree on the time when running on the same host??? It's a feature. now() is guaranteed never to return the same value twice, even if you call it from the same shell, process, or whatever, practically instantaneously. E.g. 1> {now(), now()}. {{1217,545379,571066},{1217,545379,571070}} Cheers, Dominic Williams http://dominicwilliams.net ---- From ok@REDACTED Fri Aug 1 01:10:07 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Aug 2008 11:10:07 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> Message-ID: On 31 Jul 2008, at 6:06 pm, Willem de Jong wrote: > Of course, but if the Erlang team creates special, fast support in C > it > would be good if it could be used by as many people as possible. Agreed. But remember, the existence of an EEP is no guarantee whatever that the proposal will ever be accepted. Even the publication of an EEP is simply acceptance by the moderator that the proposal meets the formal criteria and isn't ragingly insane. Rival EEPs addressing the same area are allowed to exist, and are even a good idea. To put it bluntly, there is no way I am ever going to put a SAX-like interface in *my* EEP for JSON. (I am not rejecting the idea that a JSON converter might accept or deliver JSON forms incrementally; the issues there are rather different.) Anyone who thinks differently is not only free to write their own EEP, they are *welcome* to do so. It will be *good* for Erlang if different ideas about how to do things are clearly written up and available for discussion. > > I personally like working with a SAX parser. > See the example below - I quite enjoyed writing it. I'm sure you did, but the example does not in fact work with a SAX parser. It works with an (apparently non-existent) parser that delivers a *data structure*, and it consumes the data structure. If you are going to work with a data structure, why not the very same data structure that you are supposed to be getting? It's like saying "well, I could have a pizza delivered to my door, but instead I'll have all the ingredients delivered in separate deliveries and then I'll make the pizza". > > The question is whether the things that an ESIS/SAX-like interface > let you do are things that people particularly *want* to do with JSON. > I have no idea. > > The point is, that the Erlang team would probably like to implement > only 1 very > fast JSON parser in C. The snag is that you CAN have a "very fast" JSON->term parser, but you CAN'T have a "very fast" JSON->event stream parser, because you have the extra overhead of creating event terms and either calling a handler function (which then has to go to all the trouble of decoding what the parser _knew_) or sending messages to another process (ditto). The people who *want* a JSON form as an Erlang term would be very ill served by a SAX-like interface, and the intrinsic overheads are such that the people who want a SAX-like interface would get little benefit from an implementation in C. > In my opinion, that should be a SAX-like parser, because > it is easy to create DVM output based on SAX output, but pointless > to do it the > other way around. JSON is so simple that producing a term from a sequence of events is scarcely any easier than writing a parser in the first place. Really, the only thing you are spared is handling UTF-8. As for it being pointless to turn DOM (or DVM) into SAX, opinions may vary. I've had good reason to do it several times. I find it telling that all the JSON parsers for Erlang that I've looked at generate terms; not one of them offers a SAX-like interface. Doubtless there are many more that I haven't looked at, so I cannot claim that there are no JSON/SAX parsers for Erlang, or that nobody has a need for one. I certainly can claim that if anyone did want a JSON/SAX parser, it would be quite easy to take one of the existing freely available JSON parsers and modify it to send events instead of building a result. If people were routinely pumping Brobdingnagian JSON messages around the Web, it would be important to use an event stream interface to keep process sizes reasonable. It does not appear that they are. The Agile slogan YAGNI! applies, I think. > A sax parser may create the following events (that is: call its > callback > function with the following arguments, while parsing): > > E = [startDocument,startObject, {key,"menu"}, startObject, {key,"id"}, > {value,"file"}, {key,"popup"}, startObject, {key,"menuitem"}, > startArray,startObject, {key,"value"}, {value,"New"}, > {key,"onclick"}, > {value,"CreateNewDoc()"}, endObject,startObject, {key,"value"}, > {value,"Close"}, {key,"onclick"}, {value,"CloseDoc()"}, endObject, > endArray,endObject,endObject,endObject, endDocument]. > As a data structure, this is far bigger than the simple term would be. It *has* to be more expensive to create this. It becomes clear later in your message that this is not what you really mean: you mean something like json_event_stream_parser(IO_Data, Handler, Initial_State) where Handler :: JSON_Event -> State -> State > Below an example of a callback function to process these events - > this function would be called by the SAX parser when it has > processed another relevant part of the JSON document. The parser > passes the value > returned by the function to the next invocation (second argument of > the function, the first argument is the SAX event). > > dvm(startDocument, _) -> > start; > dvm(startObject, Stack) -> > [[]| Stack]; > dvm(startArray, Stack) -> > [[]| Stack]; > dvm({key, _} = Event, Stack) -> > [Event|Stack]; > dvm({value, Value}, start) -> > {value, Value}; > Technically, the JSON RFC does not allow this. It does seem sensible to handle it though. > > dvm({value, Value}, [{key, Key}, List | T]) -> > [[{Key, Value} | List] | T]; > dvm({value, Value}, [List | T]) -> > [[Value | List] | T]; > dvm(endObject, [List | T]) -> > dvm({value, {lists:reverse(List)}}, T); > dvm(endArray, [List | T]) -> > dvm({value, lists:reverse(List)}, T); > dvm(endDocument, {value, R}) -> > R. > In short, you are proposing that an interface that most Erlang JSON users do not appear to have a need for should be privileged so that an interface that there IS a demonstrated need for can be implemented on top of it much more expensively. I do not find this convincing. That does not matter. Write an EEP of your own. Spell out the details. Put it on the supermarket shelf and see if anyone makes chop suey with it. From dmercer@REDACTED Fri Aug 1 01:16:22 2008 From: dmercer@REDACTED (David Mercer) Date: Thu, 31 Jul 2008 18:16:22 -0500 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: Message-ID: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> I notice keys and values are stored as binaries rather than lists of Unicode code points (Erlang "strings"). Won't this result in different keys and values for the same JSON object encoded in UTF-8 vs. UTF-16? David From nicholassm@REDACTED Fri Aug 1 01:40:33 2008 From: nicholassm@REDACTED (=?ISO-8859-1?Q?Nicholas_Schultz-M=F8ller?=) Date: Fri, 1 Aug 2008 00:40:33 +0100 Subject: [erlang-questions] now() seems to produce inconsistent timestamps. In-Reply-To: <489244E7.5050705@dominicwilliams.net> References: <489244E7.5050705@dominicwilliams.net> Message-ID: I don't agree. As you said, now() is guaranteed to return a new value (which can be used as a unique identifier) on consequtive calls to now() but that is within the same Eshell. Furthermore one now() call occurs before the other and as both Eshells read the same system clock they should also read timestamps with the same ordering. /Nicholas 2008/8/1 Dominic Williams < erlang-dated-1217977451.0d4afa@REDACTED> > Hi Nicholas, > > Nicholas Schultz-M?ller a ?crit : > > Is this a bug or a feature? Does two or more Eshells not >> agree on the time when running on the same host??? >> > > It's a feature. now() is guaranteed never to return the same > value twice, even if you call it from the same shell, > process, or whatever, practically instantaneously. > > E.g. > > 1> {now(), now()}. > {{1217,545379,571066},{1217,545379,571070}} > > > Cheers, > > Dominic Williams > http://dominicwilliams.net > > ---- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Aug 1 01:57:20 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Aug 2008 11:57:20 +1200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <4d08db370807310040n14c502eh9a7b9fcd99562d99@mail.gmail.com> References: <200807301913.09216.als@iinet.net.au> <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> <46F3A11E-ECD8-4549-9137-69561C87B184@cs.otago.ac.nz> <4d08db370807310040n14c502eh9a7b9fcd99562d99@mail.gmail.com> Message-ID: <4D3493BE-3136-4C52-A3D3-DDA31FBBF525@cs.otago.ac.nz> On 31 Jul 2008, at 7:40 pm, Hynek Vychodil wrote: > > 1/2. > 0.5 > > 1 div 2. > 0 > > There is functional difference, True. The difference in this case is in the range of the function, rather than the domain. A better example would have been atom_to_list/1 integer_to_list/1 float_to_list/1 These COULD all be done by one constant_to_list/1 function. > between <- and <= is not functional difference. Wrong. > > There is not [sic.] reason why > > [X || <> <- <<"abc">> ]. > > should not return same [sic.] result as > > > [X || <> <= <<"abc">> ]. > "abc" > Wrong, at least in general. The thing is that a list HAS certain elements whatever pattern one chooses to match against them. A binary or bitstring does not. The number of bits chopped off at each iteration DEPENDS ON THE PATTERN. But the number of list elements chopped off at each iteration does NOT depend on the pattern at all. This is a fundamental difference in the semantics of <- and <=; it is not simply a matter of enumerating list elements in one case and bytes in the other. Arguably the distinction between list element enumeration and tuple element enumeration IS one that could be handled at run time, at least for a sufficiently inefficient implementation, but an *efficient* implementation, you really do need different code. From ok@REDACTED Fri Aug 1 02:09:42 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Aug 2008 12:09:42 +1200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <200807311947.01781.als@iinet.net.au> References: <200807301913.09216.als@iinet.net.au> <200807311947.01781.als@iinet.net.au> Message-ID: <37F47EC0-6F2C-45D0-9F51-2FE563FA62E0@cs.otago.ac.nz> On 31 Jul 2008, at 9:47 pm, Anthony Shipman wrote: > People claim that an advantage of dynamic languages is that you > don't have to > put type annotations on variables. The language operations are, as > far as > possible, polymorphic at run time. In a decent language, not "as far as POSSIBLE", but "as far as USEFUL/REASONABLE". > So you can change the type of a variable > and not have to go through the source updating type declarations > etc. This is > supposed to make for more rapid prototyping. > > But then you get into the details of Erlang and find that there are > effectively type annotations all over the place to help the > compiler. They > don't appear as explicit type annotations, they sneak in in the > punctuation. > > The existing <- vs <= is just as much an error. As noted in a recent posting of mine, there is a fundamental semantic difference between <- and <= . It doesn't even begin to make anything approaching the shadow of sense to exchange one for another. Basically, lists *HAVE* elements, and the pattern in a list generation plays no part in determining what the elements are. But binaries do *NOT* have elements. The pattern in a binary generation *must* be a binary pattern and it is the pattern which determines how the binary is chopped up. One and the same binary might result in 20 iterations using one pattern or 50 using another. I have used programming languages that tried to allow every combination that could possibly be given some twisted sort of sense. I even designed my own once. I learned the hard way that this is NOT a help to the programmer. The things you call "type annotations" and imagine that they are "to help the compiler" are there to help *people*. Do you think that having / do div (as in C and Fortran) would be *good* for programmers? > I would like further > development in Erlang to fix these errors rather than add many more > funny > symbols. Otherwise the language would end up looking like haskell. Nobody is talking about "many more funny symbols". In fact, the thing that seems to have got up the noses of a couple of people appears to be the fact that I chose to use combinations of existing symbols *instead* of inventing a new symbol. Be specific about what are the "errors" you are complaining of. I note that Sun recently donated a fancy machine to the Haskell community because Haskell is particularly good at both concurrency and parallelism these days, and Sun want that on _their_ multicore hardware, thank you! Oddly enough, Haskell is *better* at letting you associate many meanings with the same symbol than Erlang is. From ok@REDACTED Fri Aug 1 02:13:30 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Aug 2008 12:13:30 +1200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <4d08db370807310305m3aacc5b2kd2241c9ec8905aab@mail.gmail.com> References: <200807301913.09216.als@iinet.net.au> <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> <46F3A11E-ECD8-4549-9137-69561C87B184@cs.otago.ac.nz> <4d08db370807310040n14c502eh9a7b9fcd99562d99@mail.gmail.com> <95be1d3b0807310059q5fd47761s2ca5c53f4b71c7d0@mail.gmail.com> <4d08db370807310305m3aacc5b2kd2241c9ec8905aab@mail.gmail.com> Message-ID: <6ADE8D70-4DD7-4A89-88F4-A7077EC90D2E@cs.otago.ac.nz> On 31 Jul 2008, at 10:05 pm, Hynek Vychodil wrote: > I understand it, but I think this is wrong design decision. Compiler > optimization should not impact language design, especially in so > clear functional language as Erlang is. Clearly you do not understand bitstring generators in Erlang. THIS IS NOT A COMPILER OPTIMISATION. Bitstring generators and list generators have fundamentally different semantics. > do_it(L) when is_list(L) -> [X+1, <> <- L]; > do_it(B) when is_binary(B) -> [X+1, <> <- B]. % [X+1, <> <= B] > > should be same as > > do_it(Y) -> [X+1, <> <- Y]. Except in this one specific and not very useful case (iterating over bytes), this cannot possibly work. Bitstring generators are NOT limited to iterating over bytes. From ok@REDACTED Fri Aug 1 02:20:13 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Aug 2008 12:20:13 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> References: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> Message-ID: On 1 Aug 2008, at 11:16 am, David Mercer wrote: > I notice keys and values are stored as binaries rather than lists of > Unicode > code points (Erlang "strings"). Won't this result in different keys > and > values for the same JSON object encoded in UTF-8 vs. UTF-16? No it won't. The EEP *specifically* says that the binaries will *always* use UTF-8, whatever the source or destination encoding. There is a 4th draft which is sitting waiting for moderator approval before going out to the mailing list, because it is 44kB. But this was already in the 1st draft. From erlang-questions_efine@REDACTED Fri Aug 1 03:35:47 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 31 Jul 2008 21:35:47 -0400 Subject: [erlang-questions] now() seems to produce inconsistent timestamps. In-Reply-To: <6c2563b20807311804n50b6fdc6pc60b68a3527da782@mail.gmail.com> References: <489244E7.5050705@dominicwilliams.net> <6c2563b20807311804n50b6fdc6pc60b68a3527da782@mail.gmail.com> Message-ID: <6c2563b20807311835q1e81b3c0u6bbb26b0f8cbcabf@mail.gmail.com> Deep in the bowels of the C code for the Erlang emulator lurks this routine (otp_src_R12B-3/erts/emulator/sys/unix/sys.c): SysHrTime sys_gethrtime(void) { struct timespec ts; long long result; if (*clock_gettime(CLOCK_**MONOTONIC,&ts)* != 0) { erl_exit(1,"Fatal, could not get clock_monotonic value!, " "errno = %d\n", errno); } result = ((long long) ts.tv_sec) * 1000000000LL + ((long long) ts.tv_nsec); return (SysHrTime) result; } This is used on some Unix and Unix-like systems (for example, my Ubuntu Linux system) to get the high-resolution hardware timer, which sets the microseconds part of the value returned by now(). There's a very telling note in the Linux man page for clock_gettime(): The processors in an SMP system do not start all at exactly the same time and therefore the timer registers are typically running at an offset. Some architectures include code that attempts to limit these offsets on bootup. However, the code cannot guarantee to accurately tune the offsets. Glibc con? tains no provisions to deal with these offsets (unlike the Linux Kernel). Typically these offsets are small and therefore the effects may be negligible in most cases. I can't guarantee it, but I imagine this is part of the discrepancy, and that any operating system would have the same challenges because of SMP. In any case, it would be quite a challenge to get two Erlang processes running in different Erlang emulators to be so precisely synchronized that they execute the now() call within 1000 microseconds of each other, even if you could guarantee that each emulator was running on its own CPU. Hope this helps. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drwho102003-erlang@REDACTED Fri Aug 1 08:00:47 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Thu, 31 Jul 2008 23:00:47 -0700 (PDT) Subject: [erlang-questions] how many cpus/cores for linear speed-up have been observed for the latest erlang release ? Message-ID: <15877.22807.qm@web31809.mail.mud.yahoo.com> assuming that the solution is well mapped into a data parallel paradigm (i.e. no sequential bottlenecks, very little inter-process communications, ..etc..). Has anyone saw linear speedups beyond 24 Intel cpus/cores ? Oh yes, has anyone tried to make Erlang take advantages of GPGPU's from Nvidia ? THanks. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From nem@REDACTED Fri Aug 1 10:49:37 2008 From: nem@REDACTED (Geoff Cant) Date: Fri, 01 Aug 2008 10:49:37 +0200 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: (Chris Anderson's message of "Thu, 31 Jul 2008 10:50:14 -0700") References: <4891F293.6050103@entride.com> Message-ID: "Chris Anderson" writes: > On the same note, it would be nice to have a public subversion/git > repository for them - that would take care of browseability and make > it easier to follow development. Some projects work differently from > others, of course... > I find Matthew Foemmel's http://github.com/mfoemmel/erlang-otp/tree git repository to be very handy for browsing the OTP source, working out when features were added (the history goes back to R6B-0) and so on. Erlang/OTP packaging for debian/macports/... is much easier to track against this repository too. Cheers, -- Geoff Cant From golubovsky@REDACTED Fri Aug 1 13:41:09 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Fri, 1 Aug 2008 07:41:09 -0400 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: Joseph, Thanks for your suggestion. I am experimenting with this; probably I'll need to define more callbacks for export_simple (like those in the xmerl_xml module) to get less redundant output. Is it possible to suppress the creation of all this HTML framed stuff (index.html, erlang.png and others)? Thank you, On Wed, Jul 30, 2008 at 10:12 AM, Joseph Wayne Norton wrote: > Dimitry - > > If edoc specs are available, edoc can be used for this purpose. The > outputed xml can be parsed. There might be other (or better approaches). > -- Dimitry Golubovsky Anywhere on the Web From tonyg@REDACTED Fri Aug 1 14:59:24 2008 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Fri, 01 Aug 2008 13:59:24 +0100 Subject: [erlang-questions] json-rpc erlang adding new procedure/ method In-Reply-To: <82fa9e310807281928n7dbf05bdo4e46d870fedb92ee@mail.gmail.com> References: <82fa9e310807281928n7dbf05bdo4e46d870fedb92ee@mail.gmail.com> Message-ID: <489308AC.4080604@lshift.net> Hi Mark, You also need to extend the service description record passed in to rfc4627_jsonrpc:register_service: rfc4627_jsonrpc:register_service (Pid, rfc4627_jsonrpc:service(<<"test">>, <<"urn:uuid:afe1b4b5-23b0-4964-a74a-9168535c96b2">>, <<"1.0">>, [#service_proc{name = <<"test_proc">>, idempotent = true, params = [#service_proc_param{name = <<"value">>, type = <<"str">>}]}, #service_proc{name = <<"new_proc">>, idempotent = true, params = [#service_proc_param{name = <<"value">>, type = <<"str">>}]}])). The service description is used by the Javascript JSON-RPC client to install methods (test_proc, new_proc) on the Javascript object that is proxying for the JSON-RPC service. If a method is not described in the description record, no method stub will be generated for that method on the Javascript side. Regards, Tony mark wrote: > I am trying to get json-rpc working in erlang, and got the > test_jsonrpc_inets example working. from here > http://hg.opensource.lshift.net/erlang-rfc4627/raw-file/tip/doc/index.html > > I am trying to add another procedure new_proc similar to test_proc, > and if I add these two lines to the test_jsonrpc_inets.erl, it does > not work, and it says method not supported on my rpc client. > can you tell me what is the correct way to add another procedure? > thanks > > handle_call({jsonrpc, <<"test_proc">>, _ModData, [Value]}, _From, State) -> > {reply, {result, <<"ErlangServer: ", Value/binary>>}, State}; > handle_call({jsonrpc, <<"new_proc">>, _ModData, [Value]}, _From, State) -> > {reply, {result, <<"NewMessage: ", Value/binary>>}, State}. > > > > error from my json-rpc client. >>>> s.test_proc("hello") > {u'version': u'1.1', u'id': 5, u'result': u'ErlangServer: hello'} >>>> s.new_proc("hello") > {u'version': u'1.1', u'id': 6, u'error': {u'message': u'Procedure not > found', u'code': 404, u'name': u'JSONRPCError', u'error': > [u'http://localhost:5671/rpc/test', u'new_proc']}} > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- [][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211 [][] LShift Ltd | Tel: +44 (0)20 7729 7060 [] [] http://www.lshift.net/ | Email: tonyg@REDACTED From svenolof@REDACTED Fri Aug 1 15:24:23 2008 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Fri, 1 Aug 2008 15:24:23 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <8209f740807241328j1f1d153bl2934cfba16cdaa60@mail.gmail.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <18531.60264.991238.276228@harpo.it.uu.se> <51A4415F-9973-422B-B944-FBA8922D018F@cs.otago.ac.nz> <18532.45624.17663.666648@hamberg.it.uu.se> <4A107132-9887-4734-BA7E-A47CF8EB087F@cs.otago.ac.nz> <18537.11084.466276.492883@harpo.it.uu.se> <8209f740806301210p42550dc0j11b739be44f61a96@mail.gmail.com> <18565.43649.880641.925438@harpo.it.uu.se> <8209f740807231027t385f22afwe10786451c0c6204@mail.gmail.com> <18568.51420.797833.139618@harpo.it.uu.se> <8209f740807241328j1f1d153bl2934cfba16cdaa60@mail.gmail.com> Message-ID: <18579.3719.354070.53873@harpo.it.uu.se> Ulf Wiger writes: > > Ulf Wiger writes: > > > You should also take a look at the presentation that I referred to. Two general comments on the slides: 1) I don't think the comparison with the select operation of Unix is valid. Even without selecive receive, it is easy enough to set up an Erlang process to wait until one out of a number of things happen. 2) One of the problem you are discussing is how to describe concurrent activities within one state machine. UML's mechanism for expressing composite state seems to be close to what is needed here. > > > Just looking at the example in the book, you are making the same > > > mistake as the Nordlander thesis on OHaskell. The POTS system > > > also uses messages to control the switch hardware, and this control > > > is stateful and synchronous. Furthermore, I believe that the MD110 > > > hardware had no way to queue requests, so the control system must > > > take care to issue only one request at a time. OK, I've looked at Nordlander's thesis. In OHaskell, there are two ways of specifying that an object may accept communication; keywords "action" and "request". The second is similar to what in the Erlang world is referred to as synchronous communication. It seems to me that using "request" you would get the same behaviour as send/request pairs in Erlang. > > > > > > The OHaskell example assumed that functions like start_tone() > > > were atomic and non-blocking - they are not. What would go wrong if the implementation of start_tone() and similar functions was non-blocking? > > > > OK, I actually wrote a simple framework to be able to run the > > code. The framework used a process to simulate the hardware and > > naturally there were some receive expressions, for example in > > analyse(). But the function start_tone and other similar functions > > were not blocking. I saw those as being outside the POTS example, so I > > did not comment on them. (The communications followed the simple > > pattern I discussed in the example with the counter program.) > > > > > In my presentation, I also made the number analysis asynchronous, > > > which may seem far-fetched in the limited POTS example, but is quite > > > realistic when one considers modern IP-based telephone. The > > > idea was to convert synchronous requests into explicit asynchronous > > > request-reply pairs, and having at least two such protocols that could > > > interleave. > > > > I noted a slide with the comment "simple main event loop with fifo > > semantics". Seems to be similar to what I am trying to do. > > > > You bring up some interesting issues in your presentation but the code > > you show don't seem to make much use of selective receive. > > Not much, but the vital use of selective receive is in the start_tone() > and similar functions. The key part is that the function blocks and > waits for a specific response to its particular signal, and doesn't > return to the surrounding control loop until it knows whether or > not the operation succeeded. Since selective receive makes this > possible, the top-level control loop is free to assume that start_tone() > is atomic. This particular assumption is illegal in OHaskell, for example. Making start_tone() synchronous is straight-forward using channels. > > I am not sure what you mean by synchronous and unsynchronous. In > > an Erlang context, I thought synchronous meant a communication > > implemented as a send-request pair, but you seem to be making a > > distinction here. Also, aren't all Erlang programs event-based > > (event=message)? > > No, that's the interpretation of synchronous that I meant. > Many programming frameworks do not allow operations > like start_tone() to block, which means that such operations > must be carried out as explicit request-reply pairs, which > become visible in the global state-event matrix. > > The last example in the presentation implements a filtering > event loop, which might be similar to a solution using > channels. I was wondering about that. The filtered event loop (page 24) in your presentation makes assumptions on how states are represented (as tuples of sub-states?) and what messages look like (containing indexes into the state tuples?): event_loop(M, S, Recv) -> receive {From, Event} when element(From, Recv) == [] -> dispatch(From, Event, M, S); {From, Ref, Event} when element(From, Recv) == Ref -> dispatch(From, Event, M, S); {From, Ref, Event} when element(From, Recv) == [] -> dispatch(From, Event, M, S) end. Here, one Erlang process implements several concurrent activities. However, it's unclear how these activities are represented. The preceeding slides give some hint to what is going on, but not the whole story. (From looking at the code, I get the impression that event_loop actually makes heavy use of selective receive, but whether this is the case or not depends of course on the context.) > > > A SIP signaling control system can make as much as 5-10 network- > > > based (or more) requests for one call, for things like billing, > > > admission control, location lookup, resource allocation, etc. > > > All conceptually synchronous, but the SIP signaling is asynchronous. > > > The interleaving of all signals make a global state-event matrix > > > impossibly complicated, so conceptual layering is essential. > > > > This is interesting stuff. I suppose one can't simply split one side > > of a communication into several processes? > > Sure, but that doesn't solve the problem. > > Take the case of admission control. It is triggered by the main > call control state machine, and the continuation depends on > the result of the request. It's prudent to let a separate process > deal with the DIAMETER specifics (which may involve failure > detection and retransmission/rerouting of the request), but > the main state machine must still await the result. If it > sends the request and doesn't selectively wait for the reply, > other signals may arrive that conflict with the outstanding > request. I'm not sure I get this. Waiting for a reply to a particular request using channels is straight-forward. I can see that it might be hairy to break down a side into several processes, but it still seems to be a viable approach. > If I implement a wrapper around the DIAMETER > request-response pair used for admission control, it doesn't affect > the state machine any more than if it were an atomic check of a > locally stored value. I agree with the last sentence, but I don't see how this makes it harder to break down a side into processes. After all, regardless of how the result is computed, you still need to wait for it. Sven-Olof From dmercer@REDACTED Fri Aug 1 16:21:43 2008 From: dmercer@REDACTED (David Mercer) Date: Fri, 1 Aug 2008 09:21:43 -0500 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> Message-ID: <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> Does this signal that the Erlang community is moving away from strings-as-lists to strings-as-binaries? Should we have an option in the JSON functionality to return keys and values as strings-as-lists? Should this be the default? Not advocating, just asking. Cheers, David > -----Original Message----- > From: Richard A. O'Keefe [mailto:ok@REDACTED] > Sent: Thursday, July 31, 2008 19:20 > To: dmercer@REDACTED > Cc: 'Erlang Questions' > Subject: Re: [erlang-questions] json_to_term EEP > > > On 1 Aug 2008, at 11:16 am, David Mercer wrote: > > > I notice keys and values are stored as binaries rather than lists of > > Unicode > > code points (Erlang "strings"). Won't this result in different keys > > and > > values for the same JSON object encoded in UTF-8 vs. UTF-16? > > No it won't. The EEP *specifically* says that the binaries > will *always* use UTF-8, whatever the source or destination > encoding. > > There is a 4th draft which is sitting waiting for moderator > approval before going out to the mailing list, because it is > 44kB. But this was already in the 1st draft. > > > > From gustavo@REDACTED Fri Aug 1 17:33:34 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Fri, 1 Aug 2008 12:33:34 -0300 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> References: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> Message-ID: <643d90130808010833t6700bbc1tcde64d9b3ae8bc86@mail.gmail.com> > Does this signal that the Erlang community is moving away from > strings-as-lists to strings-as-binaries? Should we have an option in the > JSON functionality to return keys and values as strings-as-lists? Should > this be the default? Not advocating, just asking. Note that doing something like this for that specific case would require additional syntax to be able to distinguish a list of ints in JSON from a plain string. Not sure if it was taken in consideration when writing the EEP, but it likely was. -- Gustavo Niemeyer http://niemeyer.net From norton@REDACTED Fri Aug 1 15:12:45 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Fri, 01 Aug 2008 22:12:45 +0900 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: Dimitry - I'm not sure about the other files ... I just ignore them. You probably need to check the edoc source code for suggestions. - Joe On Fri, 01 Aug 2008 20:41:09 +0900, Dimitry Golubovsky wrote: > Joseph, > > Thanks for your suggestion. I am experimenting with this; probably > I'll need to define more callbacks for export_simple (like those in > the xmerl_xml module) to get less redundant output. > > Is it possible to suppress the creation of all this HTML framed stuff > (index.html, erlang.png and others)? > > Thank you, > > On Wed, Jul 30, 2008 at 10:12 AM, Joseph Wayne Norton > wrote: >> Dimitry - >> >> If edoc specs are available, edoc can be used for this purpose. The >> outputed xml can be parsed. There might be other (or better >> approaches). >> > -- norton@REDACTED From jchris@REDACTED Fri Aug 1 20:20:19 2008 From: jchris@REDACTED (Chris Anderson) Date: Fri, 1 Aug 2008 11:20:19 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> Message-ID: On Thu, Jul 31, 2008 at 4:10 PM, Richard A. O'Keefe wrote: > To put it bluntly, there is no way I am ever going to put a SAX-like > interface in *my* EEP for JSON. (I am not rejecting the idea that a > JSON converter might accept or deliver JSON forms incrementally; the > issues there are rather different.) > > Anyone who thinks differently is not only free to write their own > EEP, they are *welcome* to do so. It will be *good* for Erlang if > different ideas about how to do things are clearly written up and > available for discussion. >> > >> I personally like working with a SAX parser. >> See the example below - I quite enjoyed writing it. > Just checked through the Yecc documentation - it looks like the example code I posted has both a DVM and a SAX-like API. It's nice that the same code base can serve both purposes. Now to make it fast! from the Yecc docs: http://www.erlang.org/doc/man/yecc.html ==== It is also possible to make the parser ask for more input tokens when needed if the following call format is used: myparser:parse_and_scan({Function, Args}) myparser:parse_and_scan({Mod, Tokenizer, Args}) The tokenizer Function is either a fun or a tuple {Mod, Tokenizer}. The call apply(Function, Args) or apply({Mod, Tokenizer}, Args) is executed whenever a new token is needed. This, for example, makes it possible to parse from a file, token by token. -- Chris Anderson http://jchris.mfdz.com From kevin@REDACTED Fri Aug 1 21:40:40 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Fri, 1 Aug 2008 15:40:40 -0400 Subject: [erlang-questions] Problem building an OTP release Message-ID: <20C8CECE-FD11-43D8-9B07-7207D2142830@hypotheticalabs.com> I'm trying to put together an OTP release and have run into a snag. I've got what I think is a valid .rel file (attached to this mail) and am using systools to generate the release tarball. After I copy the .rel file and tarball into my releases directory I call release_handler:unpack_release/1 to unapck the release so I can install it. When I call release_handler:unpack_release/1 I get this error message: {error,{enoent,"/repos/prototyping/releases/0.1/vertebra.rel"} where 'vertebra' is the name of my release. And sure enough, when I look in the tarball itself I see that the .rel file is iin releases/ not /release/0.1. I'd appreciate any pointers on what I might be doing wrong. FWIW, this is on OS X 10.5.4 with R12-B3. Thanks, Kevin -------------- next part -------------- A non-text attachment was scrubbed... Name: vertebra.rel Type: application/octet-stream Size: 130 bytes Desc: not available URL: -------------- next part -------------- From w.a.de.jong@REDACTED Fri Aug 1 22:08:33 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 1 Aug 2008 22:08:33 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> Message-ID: <407d9ef80808011308r321f079emec56a6240c1d0cf9@mail.gmail.com> On Fri, Aug 1, 2008 at 1:10 AM, Richard A. O'Keefe wrote: > On 31 Jul 2008, at 6:06 pm, Willem de Jong wrote: > >> I personally like working with a SAX parser. >> See the example below - I quite enjoyed writing it. >> > > I'm sure you did, but the example does not in fact > work with a SAX parser. It works with an (apparently non-existent) > parser that delivers a *data structure*, and it consumes the data > structure. If you are going to work with a data structure, why > not the very same data structure that you are supposed to be getting? > It's like saying "well, I could have a pizza delivered to my door, > but instead I'll have all the ingredients delivered in separate deliveries > and then I'll make the pizza". Or something else, if I want to eat something else. Or, if I am hungry, I can start eating when the first tomato arrives. Or, if I actually want to feed an elephant, I don't have to wory about the pizza fitting through the door. I think I'll just finish the parser that I have, and then see how it compares to other parsers. Regards, Willem. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Aug 2 05:21:41 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 1 Aug 2008 23:21:41 -0400 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing Message-ID: <6c2563b20808012021o2977d92el32350011b7528e7@mail.gmail.com> I am using the inets HTTP client to POST many requests to the same URL. I am finding that even though keep-alive is set, and persistent connections are the default for HTTP 1.1 (which is what I am using), the inets HTTP client is opening a new connection for every http:request(post,...) I send. I verified this by using Wireshark to monitor the TCP/IP traffic. When there is a lot of activity involving multiple clients, this causes ephemeral port exhaustion because of the infamous TIME_WAIT problem. I have already reduced the TCP wait time to 30 seconds and don't want to reduce it more. I read the inets code, and if I understand it correctly, it seems that when a non-idempotent operation such as POST is performed, httpc does not reuse the existing connection (httpc_manager:select_session/4 returns no_connection, which starts a new handler). I am not sure if this is the correct thing to do, because my understanding is that the restriction on non-idempotent operations applies to pipelining, not persistent connections. I can see no reason why one should not be able to do a series of consecutive POSTs on the same socket, as long as one waits for a reply before posting the next request. I'm not sure if this is a bug, a feature, or my misunderstanding, so I am posting to this mailing list in the hope that someone, whose name may or may not be Ingela, can enlighten me and perhaps suggest how I can use inets to do multiple sequential POSTs on a persistent connection. I'm using OTP R12B-3 on Ubuntu Linux 8.04. The http:request call uses all default HTTP and TCP/IP options (i.e. empty lists). Regards, Edwin Fine -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Aug 2 13:29:54 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 2 Aug 2008 13:29:54 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18579.3719.354070.53873@harpo.it.uu.se> References: <18529.883.586609.71953@hamberg.it.uu.se> <18532.45624.17663.666648@hamberg.it.uu.se> <4A107132-9887-4734-BA7E-A47CF8EB087F@cs.otago.ac.nz> <18537.11084.466276.492883@harpo.it.uu.se> <8209f740806301210p42550dc0j11b739be44f61a96@mail.gmail.com> <18565.43649.880641.925438@harpo.it.uu.se> <8209f740807231027t385f22afwe10786451c0c6204@mail.gmail.com> <18568.51420.797833.139618@harpo.it.uu.se> <8209f740807241328j1f1d153bl2934cfba16cdaa60@mail.gmail.com> <18579.3719.354070.53873@harpo.it.uu.se> Message-ID: <8209f740808020429i266d8fau8f2fcc3e343d4f9e@mail.gmail.com> 2008/8/1 Sven-Olof Nystr|m : > Ulf Wiger writes: > > > Ulf Wiger writes: > > > > You should also take a look at the presentation that I referred to. > > Two general comments on the slides: > > 1) I don't think the comparison with the select operation of Unix is > valid. Even without selecive receive, it is easy enough to set up > an Erlang process to wait until one out of a number of things > happen. The key is to be able to be specific about whose messages you want to deal with. Erlang's selective receive lets you do that, as does Unix select(). > 2) One of the problem you are discussing is how to describe > concurrent activities within one state machine. UML's mechanism > for expressing composite state seems to be close to what is > needed here. Not as far as I understand them. The composite state machines allow you to build very complex receive logic, but the message reception semantics is still FIFO, run-to-completion. There is, however, an attribute in UML - 'deferrable event', which allows you to specify that an event should be buffered, rather than discarded, if there is no matching handler in the current state. Not all UML-based tools support this attribute, and it receives very little attention in the specification. The key issue is that if you collect messages from different senders in a single mailbox or message queue, there will be accidental ordering. If your program logic strictly handles messages FIFO, it imposes a requirement that you have to be able to deal with all possible serializations of events - which invariably means that you have to perform some form of buffering in your application. Buffering channels address this problem, of course. The reason why I suggested that you look at the POTS example wasn't that I didn't think you could solve it with channels; it was to give you an *interesting* example in order to assess whether a channel-based solution would be more or less elegant than the traditional erlang version. > OK, I've looked at Nordlander's thesis. > > In OHaskell, there are two ways of specifying that an object may > accept communication; keywords "action" and "request". The second is > similar to what in the Erlang world is referred to as synchronous > communication. It seems to me that using "request" you would get the > same behaviour as send/request pairs in Erlang. Yes, but only when it can be determined at compile-time that the 'server' end cannot block. That's obviously not the case in the POTS example, where the server end is likely another computer. > > > > The OHaskell example assumed that functions like start_tone() > > > > were atomic and non-blocking - they are not. > > What would go wrong if the implementation of start_tone() and similar > functions was non-blocking? That means that your control thread has to yield and possibly accept other events while waiting for the start_tone_reply msg. If, for example, the next event is on_hook, a stop_tone() should be issued, but first, we need to wait for the start_tone_reply. Since the order of start_tone_reply and on_hook is accidental, we are free to process them in any order we choose. Just picking the first message from the pile is a very bad choice. > Making start_tone() synchronous is straight-forward using channels. Yes. The interesting question is whether using channels leads to more or less elegant code, given that it avoids complexity explosion. > > > > I am not sure what you mean by synchronous and unsynchronous. In > > The last example in the presentation implements a filtering > > event loop, which might be similar to a solution using > > channels. > > I was wondering about that. > > The filtered event loop (page 24) in your presentation makes > assumptions on how states are represented (as tuples of sub-states?) > and what messages look like (containing indexes into the state > tuples?): > > event_loop(M, S, Recv) -> > receive > {From, Event} when element(From, Recv) == [] -> > dispatch(From, Event, M, S); > {From, Ref, Event} when element(From, Recv) == Ref -> > dispatch(From, Event, M, S); > {From, Ref, Event} when element(From, Recv) == [] -> > dispatch(From, Event, M, S) > end. > > Here, one Erlang process implements several concurrent activities. > However, it's unclear how these activities are represented. The > preceeding slides give some hint to what is going on, but not the > whole story. It's the same as in the first event-based program, except I've added an argument where the callback module can let the event loop know which messages to ignore. > (From looking at the code, I get the impression that event_loop > actually makes heavy use of selective receive, but whether this is the > case or not depends of course on the context.) Yes, the event loop makes use of Erlang's selective receive. The application logic does not. It simply specifies which senders, or which unique message tag to look for next. To be clear, the application logic cannot get away from performing some form of selective message processing in this problem. It either instruments the logic that picks messages out of the buffer(s), or implements a stack so that it can handle messages out of order. > > Take the case of admission control. It is triggered by the main > > call control state machine, and the continuation depends on > > the result of the request. It's prudent to let a separate process > > deal with the DIAMETER specifics (which may involve failure > > detection and retransmission/rerouting of the request), but > > the main state machine must still await the result. If it > > sends the request and doesn't selectively wait for the reply, > > other signals may arrive that conflict with the outstanding > > request. > > I'm not sure I get this. Waiting for a reply to a particular request > using channels is straight-forward. I can see that it might be hairy > to break down a side into several processes, but it still seems to be > a viable approach. You can solve it using channels, given that you have some way to select which channels to listen to at any given point in time. If you don't, you are right back at the global state-event matrix. This is what UML does in the absense of deferrable event. It uses channels (ports), but message handling is FIFO. > > If I implement a wrapper around the DIAMETER > > request-response pair used for admission control, it doesn't affect > > the state machine any more than if it were an atomic check of a > > locally stored value. > > I agree with the last sentence, but I don't see how this makes it > harder to break down a side into processes. After all, regardless of > how the result is computed, you still need to wait for it. You will still have some form of coordinating state machine. You can break down certain things into processes, but in order to avoid complexity explosion in the main state machine, there has to be a way for it to specify in which order it wants to handle events that have no defined ordering relationship. You can do that using channels. You can also do it using Erlang's selective receive. Either way you decide to solve it, you have to address that problem, or your code will explode. Once you've contained your state-event matrix, you are free to look at the finer points, such as "do channels offer a more elegant solution to this problem than Erlang's selective receive?" I haven't taken a stance in that regard, since I haven't written such code with channels. ROK seems to think that it doesn't give an improvement, based on his experience with ML. BR, Ulf W From johnswolter@REDACTED Sat Aug 2 18:50:14 2008 From: johnswolter@REDACTED (john s wolter) Date: Sat, 2 Aug 2008 12:50:14 -0400 Subject: [erlang-questions] Design tool for erlang software In-Reply-To: References: Message-ID: <24bcf1860808020950y4e2b53e2q140fffeb74ef8b0d@mail.gmail.com> Torben & et. al... This design issue digs into the runtimes for object like systems. We always are creating runtimes that are more traditional designs for the purpose of simulating the necessary object runtime environment. It just keeps buzzing around my head. You have stumbled upon an incomplete area of O-O. Determinate systems are not easy with most current O-O runtimes. UML modeling techniques do not appear to be sufficient for modeling those systems. This link is what may be called the Use Case Maps home of sorts. http://jucmnav.softwareengineering.ca/twiki/bin/view/UCM/WebHome Here's a publications list that dates back to Buhr, Casselman, and Amyot's starting work in the 1990's. The first two having published a book "Use CASE Maps for Object Oriented Systems", with a forward by Ivar Jacobson the creator of Use Cases. This list should give a good historical background on this subject. http://jucmnav.softwareengineering.ca/twiki/bin/view/UCM/UCMVirtualLibraryAllPubs In general I've come to the point of view that Jacobson's Use Case idea appeared to me to be more like a flow chart then object based. Use Case Maps are different in coverage and technique. I have not yet decided where or if they fit the runtime or realtime area. Use Cases have another fork with Larry L. Constantine & Lucy A. D. Lockwood book "Software for Use". This covers more Usage-Centered design issue then system. It does take a look at the issues of Use Cases in design. The usage issue has highlighted problems with Use Cases, namely the flow chart like features. Going a little farther on the usage side of things is Alan Cooper in his book, "the inmates are running the asylum". Its about computerized technology failures and he introduces the idea of Personas. Personas replace the idea of use cases in profiling users from which user interactions designed. An extensive book on this is "The Persona Lifecycle : Keeping People in Mind Throughout Product Design" by John Pruitt and Tamara Adlin. It would be interesting to ask if programs, agents, swarms, equipment, etc could have Personas. A UML approach adapted the work of Brian Selic called Realtime Object Oriented Method, ROOM. This was then commercially surfaced by ObjectTime which was purchased by Rational Software. The ideas and some notation has worked its way into UML. Here's a paper by Selic about ROOM http://www.ibm.com/developerworks/rational/library/content/03July/1000/1155/1155_umlmodeling.pdf Here's a software package that uses ROOM and actors ideas.. http://www.smartdraw.com/tutorials/software/room/tutorial_01.htm Bruce Douglass, yep two 's's, "Doing Hard Time" and "Realtime UML 3d edition" . The last has some ROOM feature discussions. Here's Wikipedia's take on OPM and has a link section at the bottom that will take you to UCM sites..... http://en.wikipedia.org/wiki/Object_Process_Methodology Not to be left out the the design of processes is OPEN Process Framework (OPF) which allows you to construct process rather then using the predesigned Rational Process. OPF was pushed aside in the rush to UML by Microsoft, IBM, et. al., the usual suspects. Ian Gramham's " Requirements Engineering and Rapid Development" book looks into distributed systems modeling. The UCM people know of this work. Also look for Don Firesmith's work in this area. http://www.opfro.org/index.html?Components/WorkProducts/DiagramSet/Requirements/ContextDiagram/ContextDiagram.html~Contents I have not yet spoken to the work done for agents, swarms, and actors which remains important to runtime and realtime distributed system design and implementation. 2008/7/20 Torben Hoffmann > On Thu, Jul 17, 2008 at 9:27 PM, Maxim Treskin wrote: > >> Hello >> >> Is there any design tool spesial for erlang software, escept paper >> sheet and pen? >> UML-designers, like umbrello, is comfortable for object-oriented code, >> not for process-oriented (yes, I know, it is possible). >> So, are you use some designer tools special for erlang code? >> > > As I and others uttered at the Erlang Exchange 2008 the most important > thing to get right is the protocols between the entities of your system so > your first step should be to draw up an architecture diagram and focus on > what the protocols between the entities should be. > > This does not require anything but pen and paper, but a drawing program and > a wiki has worked wonders in my team - makes it easier to share knowledge. > > A design tool that looks promising for Erlang is Object-Process Methodology > (http://www.objectprocess.org/) > I have read the book and after my summer vacation I will start > experimenting with OPM for design of Erlang/OTP systems. > > Cheers, > Torben > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- John S. Wolter President Wolter Works Mailto:johnswolter@REDACTED Desk 1-734-665-1263 Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From raphael-langerhorst@REDACTED Sat Aug 2 22:07:51 2008 From: raphael-langerhorst@REDACTED (Raphael Langerhorst) Date: Sat, 02 Aug 2008 22:07:51 +0200 Subject: [erlang-questions] erl_global_register/3 fails on NetBSD 4.0 - socket configuration? Message-ID: <20080802200751.74790@gmx.net> Hi all, I just registered to this list, so hello everyone. I'm using erl_interface to write C code that I can use in Erlang. The code can be found here: http://raphael.g-system.at/secret/erl/cn.c This happens with R11 and R12B-3 (which is erl_interface-3.5.7). This is on NetBSD. An Erlang shell is started with "erl -sname xyz" on the host "nirvana". After the shell has started, I run the C code. A connection to the erlang node is established (which succeeds), then the c node is published (which succeeds) and finally I want to register the C process to globals with erl_global_register/3 (which fails). However, this last step fails and I have not been able to figure out why. There is one curiousity. If you look at the code, a message loop ist started. Within this message loop I immediately receive the message {rex,yes} which suspiciously looks like a confirmation for registration. So, I think there may be something wrong with the socket settings (see socket setup function) which makes the erl_global_register/3 function miss the response from epmd? What are the settings the socket should have? Anything specific? Do you see any other reason why erl_global_register fails? Many thanks in advance!! Raphael -- Psssst! Schon das coole Video vom GMX MultiMessenger gesehen? Der Eine f?r Alle: http://www.gmx.net/de/go/messenger03 From willi@REDACTED Sun Aug 3 00:38:39 2008 From: willi@REDACTED (willi) Date: Sun, 03 Aug 2008 01:38:39 +0300 Subject: [erlang-questions] erl_global_register/3 fails on NetBSD 4.0 - socket configuration? In-Reply-To: <20080802200751.74790@gmx.net> References: <20080802200751.74790@gmx.net> Message-ID: <1217716719.18623.12.camel@note.home.odessa.ua> Hi Raphael, Some time ago i noticed this misbehavior too. Here is patch for this, it works for me, althought im not sure that this is correct fix. C-Node needs to set DFLAG_DIST_MONITOR while connecting to erlang, otherwise global registration will fail. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Registering-global-name-from-C-node-needs-DFLAG_DIST.patch Type: application/mbox Size: 1127 bytes Desc: not available URL: From golubovsky@REDACTED Sun Aug 3 03:59:41 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sat, 2 Aug 2008 21:59:41 -0400 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: Joseph, Just for the record: it seems that calling edoc:get_doc on each source file, and then calling edoc:layout on what comes from get_doc (2nd element of the tuple) results in running the same callbacks as edoc:application does, but no files are created at all; XML is returned as a string. Thanks. On Fri, Aug 1, 2008 at 9:12 AM, Joseph Wayne Norton wrote: > Dimitry - > > I'm not sure about the other files ... I just ignore them. You probably > need to check the edoc source code for suggestions. > > - Joe > >> Is it possible to suppress the creation of all this HTML framed stuff >> (index.html, erlang.png and others)? -- Dimitry Golubovsky Anywhere on the Web From ok@REDACTED Mon Aug 4 04:23:52 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 4 Aug 2008 14:23:52 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> References: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> Message-ID: <10D9753C-AA1E-4BFA-A40D-3D4E7D461FE8@cs.otago.ac.nz> On 2 Aug 2008, at 2:21 am, David Mercer wrote: > Does this signal that the Erlang community is moving away from > strings-as-lists to strings-as-binaries? Basically, I looked at what other people were doing with JSON->Erlang conversion, and strings-as-binaries seemed to be the most popular choice. Strings as binaries have some advantages. (1) They are MUCH closer in spirit to what people expect strings to be. I've lost count of the number of times people have said in this mailing list "Erlang is no XXXXXXX good because it doesn't have strings." I'm sick of explaining why this is wrong. (2) They _are_ more compact than lists, and if you want to pump data _through_ Erlang, reducing space turnover is a help. This is why I think strings-as-binaries with labels-as-atoms is a good balance; the part you expect to look inside using Erlang is easy to look at, the rest is cheap to hold and pass on. (3) They offer constant-time slicing. With the addition of <<"...">> syntax to Erlang they are almost readable. With Unicode, the major snag is that lists can represent one Unicode character per element, whereas binary matching counts bytes. Regular expressions are coming, and if they can handle UTF-8 binaries we need not worry too much about counting bytes. > Should we have an option in the > JSON functionality to return keys and values as strings-as-lists? This now leads us to the reason WHY other people are mapping JSON strings to Erlang binaries. "ABC" is a legal JSON string. [65,66,67] is a legal JSON "array". If we turned JSON strings into Erlang strings, how would we tell them from "arrays"? At least one of them would have to be flagged somehow. It might be pleasantly symmetric to have [array,65,66,67] [string,65,66,67] [object,......] The thing is, you can't -just- say "let's have strings as lists", you have to do something different with arrays/lists as well. This really doesn't make a good default. From ok@REDACTED Mon Aug 4 04:34:44 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 4 Aug 2008 14:34:44 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> Message-ID: <197173EA-9318-4C33-8538-519D49078197@cs.otago.ac.nz> On 2 Aug 2008, at 6:20 am, Chris Anderson wrote: > Just checked through the Yecc documentation - it looks like the > example code I posted has both a DVM and a SAX-like API. It's nice > that the same code base can serve both purposes. Now to make it fast! > > from the Yecc docs: http://www.erlang.org/doc/man/yecc.html > > ==== > > It is also possible to make the parser ask for more input tokens when > needed if the following call format is used: > > myparser:parse_and_scan({Function, Args}) > myparser:parse_and_scan({Mod, Tokenizer, Args}) > > The tokenizer Function is either a fun or a tuple {Mod, Tokenizer}. > > The call apply(Function, Args) or apply({Mod, Tokenizer}, Args) is > executed whenever a new token is needed. This, for example, makes it > possible to parse from a file, token by token. This is not a SAX-like API. A SAX-like API is one where you do NOT get a data structure as *output*, but instead get a stream of parsing events. Taking Yecc as an example, imagine all your Erlang code being ripped out of a Yecc file, and having to put it inside a giant receive. The interface you are talking about is all about the INPUT of the parser, not the output. And even then it is the opposite of a SAX-like API, because it is a "pull" interface (the token consumer tells the token producer "give me another token"), whereas SAX is a "push" interface ("here is another event, like it or not"). It is agreed that any network system is likely to receive data in chunks so that a JSON->Erlang converter that can accept input in chunks might be useful. From golubovsky@REDACTED Fri Aug 1 20:26:06 2008 From: golubovsky@REDACTED (Dmitry Golubovsky) Date: Fri, 1 Aug 2008 11:26:06 -0700 (PDT) Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: On Jul 30, 10:12?am, "Joseph Wayne Norton" wrote: > If edoc specs are available, edoc can be used for this purpose. ?The ? > outputed xml can be parsed. ?There might be other (or better approaches). What is the current status of TypEr? Might it help to infer (with reasonable approximation) the missing type signatures when edoc specs are not available? Thanks. Dmitry From ingela@REDACTED Mon Aug 4 10:47:21 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 04 Aug 2008 10:47:21 +0200 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: References: Message-ID: <4896C219.6010404@erix.ericsson.se> Hi Edward, a quick look at the HTTP-spec makes me believe you got a valid point. The current http client has gradually evolved from a user contribution and in the processes you may say it was totally rewritten, and we may have missed an aspect here. (E.i. only used persistent connections for pipelined requests). But I do not have all details about this fresh in my memory as this was some time ago. We will have to take deeper look into this. I have put it on the todo-list. There are a few things that has higer priority right now but i hope we can deal with this issue fairly soon. Regards Ingela- Erlang/OTP, Ericsson > I am using the inets HTTP client to POST many requests to the same URL. I am > finding that even though keep-alive is set, and persistent connections are > the default for HTTP 1.1 (which is what I am using), the inets HTTP client > is opening a new connection for every http:request(post,...) I send. I > verified this by using Wireshark to monitor the TCP/IP traffic. When there > is a lot of activity involving multiple clients, this causes ephemeral port > exhaustion because of the infamous TIME_WAIT problem. I have already reduced > the TCP wait time to 30 seconds and don't want to reduce it more. > > I read the inets code, and if I understand it correctly, it seems that when > a non-idempotent operation such as POST is performed, httpc does not reuse > the existing connection (httpc_manager:select_session/4 returns > no_connection, which starts a new handler). I am not sure if this is the > correct thing to do, because my understanding is that the restriction on > non-idempotent operations applies to pipelining, not persistent connections. > I can see no reason why one should not be able to do a series of consecutive > POSTs on the same socket, as long as one waits for a reply before posting > the next request. > > I'm not sure if this is a bug, a feature, or my misunderstanding, so I am > posting to this mailing list in the hope that someone, whose name may or may > not be Ingela, can enlighten me and perhaps suggest how I can use inets to > do multiple sequential POSTs on a persistent connection. > > I'm using OTP R12B-3 on Ubuntu Linux 8.04. The http:request call uses all > default HTTP and TCP/IP options (i.e. empty lists). > > Regards, > Edwin Fine > From erlang-questions_efine@REDACTED Mon Aug 4 16:18:54 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 4 Aug 2008 10:18:54 -0400 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: <4896C219.6010404@erix.ericsson.se> References: <4896C219.6010404@erix.ericsson.se> Message-ID: <6c2563b20808040718w25d9eea0gde398ddeea0d147d@mail.gmail.com> Thanks, Ingela, I look forward to seeing the modifications. Hopefully you can post a patch so I don't have to wait for the next Erlang release. Regards, Edwin On Mon, Aug 4, 2008 at 4:47 AM, Ingela Anderton Andin < ingela@REDACTED> wrote: > Hi Edward, a quick look at the HTTP-spec makes me believe you got a > valid point. > The current http client has gradually evolved from a user contribution > and in the processes > you may say it was totally rewritten, and we may have missed an aspect > here. (E.i. only used > persistent connections for pipelined requests). But I do not > have all details about this fresh in my memory as this was some time > ago. We will have to take > deeper look into this. I have put it on the todo-list. There are a few > things that has > higer priority right now but i hope we can deal with this issue fairly > soon. > > Regards Ingela- Erlang/OTP, Ericsson > > > I am using the inets HTTP client to POST many requests to the same URL. I > am > > finding that even though keep-alive is set, and persistent connections > are > > the default for HTTP 1.1 (which is what I am using), the inets HTTP > client > > is opening a new connection for every http:request(post,...) I send. I > > verified this by using Wireshark to monitor the TCP/IP traffic. When > there > > is a lot of activity involving multiple clients, this causes ephemeral > port > > exhaustion because of the infamous TIME_WAIT problem. I have already > reduced > > the TCP wait time to 30 seconds and don't want to reduce it more. > > > > I read the inets code, and if I understand it correctly, it seems that > when > > a non-idempotent operation such as POST is performed, httpc does not > reuse > > the existing connection (httpc_manager:select_session/4 returns > > no_connection, which starts a new handler). I am not sure if this is the > > correct thing to do, because my understanding is that the restriction on > > non-idempotent operations applies to pipelining, not persistent > connections. > > I can see no reason why one should not be able to do a series of > consecutive > > POSTs on the same socket, as long as one waits for a reply before posting > > the next request. > > > > I'm not sure if this is a bug, a feature, or my misunderstanding, so I am > > posting to this mailing list in the hope that someone, whose name may or > may > > not be Ingela, can enlighten me and perhaps suggest how I can use inets > to > > do multiple sequential POSTs on a persistent connection. > > > > I'm using OTP R12B-3 on Ubuntu Linux 8.04. The http:request call uses all > > default HTTP and TCP/IP options (i.e. empty lists). > > > > Regards, > > Edwin Fine > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard.s.green@REDACTED Mon Aug 4 17:50:14 2008 From: rickard.s.green@REDACTED (Rickard Green) Date: Mon, 04 Aug 2008 17:50:14 +0200 Subject: [erlang-questions] [erlang-bugs] erts_port[].drv_ptr == 0, when erts_port[].status not free In-Reply-To: <20080703155957.GB5148@erix.ericsson.se> References: <1214958245.16472.46.camel@localhost> <20080703155957.GB5148@erix.ericsson.se> Message-ID: <48972536.1040002@ericsson.com> Hi Paul, Thanks for the bug report. The attached patch should fix the problem. This fix will be included in R12B-4. How to apply the patch: $ gtar -zxf otp_src_R12B-3.tar.gz $ gpatch -ZNp0 < OTP-7464.patch patching file otp_src_R12B-3/erts/emulator/beam/io.c $ # Build and install as usual BR, Rickard Green, Erlang/OTP, Ericsson AB. Raimo Niskanen wrote: > Thank you for your bug report. > > We will look into your problem when the concerned developers > comes in after their vacation. > > Can you give us host OS and Erlang release too? > > > > On Tue, Jul 01, 2008 at 07:24:05PM -0500, Paul Fisher wrote: >> We have a system where we run lots of linked-in driver ports that get >> created/used/closed frequently and sometimes very quickly. Today when >> several open_port/2, port_command/2 and port_close/1 cycles happened >> rapid succession, a SIGSEGV occurrect in erl_bif_ddl.c: >> >> Program received signal SIGSEGV, Segmentation fault. >> [Switching to Thread 1125235040 (LWP 12087)] >> 0x0000000000449712 in erl_ddll_try_unload_2 (p=0x2aaaab11fc90, >> name_term=659339, options=46912503328425) at beam/erl_bif_ddll.c:592 >> >> The emulator was run on a Q6600 (quad-core, 2.4Ghz), and started with +A >> 8, >> and the linked-in driver executes the bulk of its work with >> driver_async(). >> There were continuously 8 driver cycles running for 5-10 seconds before >> the >> segfault occurred. >> >> ???(gdb) where >> #0 0x0000000000449712 in erl_ddll_try_unload_2 (p=0x2aaaab11fc90, >> name_term=659339, options=46912503328425) at beam/erl_bif_ddll.c:592 >> #1 0x000000000052337f in process_main () at beam/beam_emu.c:2073 >> #2 0x000000000049c213 in sched_thread_func (vesdp=0x2ae18cb74f98) >> at beam/erl_process.c:741 >> #3 0x00000000005b6818 in thr_wrapper (vtwd=0x7fff1eb77de0) >> at common/ethread.c:474 >> #4 0x00002ae18c530f1a in start_thread () from /lib/libpthread.so.0 >> #5 0x00002ae18c8135d2 in clone () from /lib/libc.so.6 >> #6 0x0000000000000000 in ?? () >> >> So the code at the point of the SIGSEGV @ erl_bif_ddll.c:592 says: >> >> for (j = 0; j < erts_max_ports; j++) { >> => if (!(erts_port[j].status & FREE_PORT_FLAGS) >> && erts_port[j].drv_ptr->handle == dh) { >> >> It appears that the code assumes that if the erts_port array entry being >> evaluated during the search has a valid (non-zero) drv_ptr value, if the >> entry is not marked as free. At the time of the crash, this is clearly >> not >> the case: >> >> (gdb) p j >> $8 = 896 >> >> (gdb) p erts_port[j] >> $7 = {sched = {next = 0x0, prev = 0x0, taskq = 0x0, exe_taskq = 0x0}, >> timeout_task = {counter = 0}, refc = {counter = 2}, lock = 0x81b3c8, >> xports = 0x0, id = 14343, connected = 0, caller = 0, data = 0, bp = >> 0x0, >> nlinks = 0x0, monitors = 0x0, bytes_in = 0, bytes_out = 0, ptimer = >> 0x0, >> tracer_proc = 18446744073709551611, trace_flags = 0, ioq = {size = 0, >> v_start = 0x0, v_end = 0x0, v_head = 0x0, v_tail = 0x0, v_small = {{ >> iov_base = 0x0, iov_len = 0}, {iov_base = 0x0, iov_len = 0}, { >> iov_base = 0x0, iov_len = 0}, {iov_base = 0x0, iov_len = 0}, { >> iov_base = 0x0, iov_len = 0}}, b_start = 0x0, b_end = 0x0, >> b_head = 0x0, b_tail = 0x0, b_small = {0x0, 0x0, 0x0, 0x0, 0x0}}, >> dist_entry = 0x0, name = 0x0, drv_ptr = 0x0, drv_data = 0, suspended = >> 0x0, >> linebuf = 0x0, status = 4096, control_flags = 0, reg = 0x0, >> port_data_lock = 0x0} >> >> (gdb) p erts_port[j].drv_ptr >> $6 = (ErlDrvEntry *) 0x0 >> >> >> So the real questions are: 1) is whether the assumption built into this >> code is correct; and 2) if so, how did we get in the position of >> violating >> it. I'd appreciate some insight into what could be going on here, and >> where I should can start looking. >> >> >> -- >> paul >> >> _______________________________________________ >> erlang-bugs mailing list >> erlang-bugs@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-bugs > -------------- next part -------------- A non-text attachment was scrubbed... Name: OTP-7464.patch Type: text/x-patch Size: 1145 bytes Desc: not available URL: From dmercer@REDACTED Mon Aug 4 19:09:36 2008 From: dmercer@REDACTED (David Mercer) Date: Mon, 4 Aug 2008 12:09:36 -0500 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <10D9753C-AA1E-4BFA-A40D-3D4E7D461FE8@cs.otago.ac.nz> References: <006f01c8f363$734d8070$f21ea8c0@SSI.CORP> <009601c8f3e1$ed7f8e50$f21ea8c0@SSI.CORP> <10D9753C-AA1E-4BFA-A40D-3D4E7D461FE8@cs.otago.ac.nz> Message-ID: <006901c8f654$e013f830$f21ea8c0@SSI.CORP> Thanks for the outstanding explanation. If the Erlang community decides to represent strings as UTF-8-encoded binaries, we should probably add I/O support for that... Cheers, David > -----Original Message----- > From: Richard A. O'Keefe [mailto:ok@REDACTED] > Sent: Sunday, August 03, 2008 21:24 > To: dmercer@REDACTED > Cc: 'Erlang Questions' > Subject: Re: [erlang-questions] json_to_term EEP > > > On 2 Aug 2008, at 2:21 am, David Mercer wrote: > > > Does this signal that the Erlang community is moving away from > > strings-as-lists to strings-as-binaries? > > Basically, I looked at what other people were doing with JSON->Erlang > conversion, and strings-as-binaries seemed to be the most popular > choice. > > Strings as binaries have some advantages. > > (1) They are MUCH closer in spirit to what people expect strings to > be. I've lost count of the number of times people have said in > this mailing list "Erlang is no XXXXXXX good because it doesn't > have strings." I'm sick of explaining why this is wrong. > > (2) They _are_ more compact than lists, and if you want to pump data > _through_ Erlang, reducing space turnover is a help. > This is why I think strings-as-binaries with labels-as-atoms is > a good balance; the part you expect to look inside using Erlang > is easy to look at, the rest is cheap to hold and pass on. > > (3) They offer constant-time slicing. > > With the addition of <<"...">> syntax to Erlang they are almost > readable. > > With Unicode, the major snag is that lists can represent one Unicode > character per element, whereas binary matching counts bytes. Regular > expressions are coming, and if they can handle UTF-8 binaries we need > not worry too much about counting bytes. > > > Should we have an option in the > > JSON functionality to return keys and values as strings-as-lists? > > This now leads us to the reason WHY other people are mapping JSON > strings to Erlang binaries. > "ABC" > is a legal JSON string. > [65,66,67] > is a legal JSON "array". If we turned JSON strings into Erlang > strings, how would we tell them from "arrays"? At least one of them > would have to be flagged somehow. > > It might be pleasantly symmetric to have > [array,65,66,67] > [string,65,66,67] > [object,......] > The thing is, you can't -just- say "let's have strings as lists", > you have to do something different with arrays/lists as well. > > This really doesn't make a good default. From icfp.publicity@REDACTED Mon Aug 4 23:44:16 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Mon, 4 Aug 2008 16:44:16 -0500 Subject: [erlang-questions] ICFP08 Call for Participation Message-ID: <53ff55480808041444h5283a50au4bcd5150897fd65@mail.gmail.com> ===================================================================== Call for Participation The 13th ACM SIGPLAN International Conference on Functional Programming (ICFP 2008) http://www.icfpconference.org/icfp2008 Victoria, BC, Canada, 22-24 September 2008 ===================================================================== ICFP 2008 provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. The conference covers the entire spectrum of work, from practice to theory, including its peripheries. Preliminary program: * http://www.icfpconference.org/icfp2008/schedule.html * Invited speakers: + Butler Lampson, Microsoft Research; Lazy and Speculative Execution in Computer Systems + Olivier Danvy, University of Aarhus; Defunctionalized Interpreters for Higher-Order Languages + Mark Jones, Portland State University; Polymorphism and Page Tables -- Systems Programming From a Functional Programmer's Perspective Schedule including related workshops: * Sep 20: ACM SIGPLAN Workshop on Generic Programming * Sep 20: ACM SIGPLAN Workshop on Mechanizing Metatheory * Sep 20: ACM SIGPLAN Workshop on Scheme and Functional Programming * Sep 21: ACM SIGPLAN Workshop on ML * Sep 21: ACM SIGPLAN Functional and Declarative Programming in Education * Sep 22-24: ICFP08 * Sep 25: ACM SIGPLAN Haskell Symposium * Sep 25: Functional Programming Developer Tracks * Sep 26: Commercial Users of Functional Programming * Sep 27: ACM SIGPLAN Erlang Workshop * Sep 27: Functional Programming Developer Tracks Registration information: * http://www.regmaster.com/conf/icfp2008.html * Early registration deadline: August 20, 2008 Conference hotel accommodation information: * http://www.deltahotels.com/groups/online/VIC/acm.php * Conference rate deadline: August 18, 2008 * Wiki page to coordinate room-sharing: http://www.icfpconference.org/pmwiki/pmwiki.php?n=Main.ICFP08RoomShare Conference organizers: * General Chair: James Hook (Portland State University) * Program Chair: Peter Thiemann (Universit?t Freiburg) * Local Arrangements Chair: George Tzanetakis (University of Victoria) * Workshop Co-Chairs: Michael Sperber (DeinProgramm) and Graham Hutton (University of Nottingham) * Programming Contest Co-Chairs: John Reppy (University of Chicago) and Tim Sheard (Portland State University) * Publicity Chair: Matthew Fluet (Toyota Technological Institute at Chicago) From jmeredith@REDACTED Tue Aug 5 00:07:58 2008 From: jmeredith@REDACTED (Jon Meredith) Date: Mon, 4 Aug 2008 16:07:58 -0600 Subject: [erlang-questions] dbg:tracer() aborts on binary match Message-ID: Hi, I'm writing a small parser for reading log lines. When it didn't do what I expected I tried to use dbg:tracer() to see where it was going wrong and it aborted. Here is the cut down minimal test case. I'm expecting it to match and then try and call parse_headers with Hdr added to the Hdrs list, but instead the VM aborts. Am I doing something wrong/strange? Many thanks, Jon. %% Abort when running dbg:tracer(). %% %% 1> binbug:bug(). %% size_object: matchstate term not allowedAbort trap -module(binbug). -export([bug/0, parse_headers/4]). parse_headers(<<"\\r\\n", T/binary>>, Hdr, Hdrs, Toks) -> parse_headers(T, <<>>, [Hdr | Hdrs], Toks). bug() -> dbg:tracer(), dbg:p(all, call), dbg:tpl(?MODULE, []), parse_headers(<<"\\r\\n]">>, <<"hdr1">>, [], []). From nick@REDACTED Tue Aug 5 00:13:30 2008 From: nick@REDACTED (Nick Gerakines) Date: Mon, 4 Aug 2008 15:13:30 -0700 Subject: [erlang-questions] Erlounge @ Yahoo Message-ID: Yahoo is hosting the next bay-area Erlounge. Please come join us at this social event hosted at Yahoo's main Sunnyvale campus on August 21st, 2008. All Erlang developers and users are welcome to meet each other and talk about what you are doing. There is no set schedule or plan and the event will go from 6:00 pm to 7:00 pm. Some light snacks and (non-alcoholic) drinks will be provided. There are plenty of places to go out for dinner and drinks afterward if people are interested. If you would like to attend please email me at gerakine@REDACTED or IM via jabber at nick@REDACTED with your Name and optionally your interest/company. If you plan on bringing a guest then make note of that as well. I'll need to provide head counts a few days prior to make sure the room/area is arranged properly. Don't hesitate to contact me if you've got any questions or comments. What: Erlounge @ Yahoo! When: Thursday, August 21st 2008 from 6:00 pm to 7:00 pm Where: Yahoo Sunnyvale Campus, 701 1st Ave, Sunnyvale, CA 94089, USA # Nick Gerakines From vladdu55@REDACTED Tue Aug 5 08:59:46 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 5 Aug 2008 08:59:46 +0200 Subject: [erlang-questions] Selective receive issue Message-ID: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> Hi all, I have an example of a receive where I don't seem to be able to use the usual "dump any unrecognized messages" catch-all clause. I think it is also an example where channels could be useful, but the main question is whether I am missing the obvious or not. I have a process that takes {input, Data} messages from its mailbox and processes them (not necessarily one at a time). Flow control is implemented as a pair of 'start'/'stop' messages. The way I implemented the main loop is (simplified) receive start->Running = true, loop(); stop->Running = false, loop() after 0 -> if Running -> process_one_step(), loop(); true -> loop() end end, where the process_one_step() function may call receive {input, Data} -> ... end one or several times (it is configurable by the clients). It seems to me that there is no place where I can put a '_->...;' clause without creating problems. So I'd like to ask if anyone sees another way to structure this that will allow rogue messages to be discarded. ------ A solution that requires an EEP :-) is to introduce an extension to the receive statement that will explicitly keep matched messages in the mailbox. For example receive Pattern -> keep(), loop(); Msg -> process(Msg), loop() end keep() is the extension that says "leave the message in the mailbox and proceed". This way process() will be called with all messages except those matching Pattern Would something like that be useful, or are there already ways to achieve the same effect? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Tue Aug 5 09:27:30 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 5 Aug 2008 09:27:30 +0200 Subject: [erlang-questions] dbg:tracer() aborts on binary match In-Reply-To: References: Message-ID: <4d08db370808050027r4490e568ke21ecdc1d7514c6f@mail.gmail.com> There is wrong escaping off topic. It should be: parse_headers(<<"\r\n", T/binary>>, Hdr, Hdrs, Toks) -> parse_headers(T, <<>>, [Hdr | Hdrs], Toks). bug() -> dbg:tracer(), dbg:p(all, call), dbg:tpl(?MODULE, []), parse_headers(<<"\r\n]">>, <<"hdr1">>, [], []). On Tue, Aug 5, 2008 at 12:07 AM, Jon Meredith wrote: > Hi, > > I'm writing a small parser for reading log lines. When it didn't do > what I expected I tried to use dbg:tracer() to see where it was going > wrong and it aborted. Here is the cut down minimal test case. > > I'm expecting it to match and then try and call parse_headers with Hdr > added to the Hdrs list, but instead the VM aborts. Am I doing > something wrong/strange? > > Many thanks, Jon. > > %% Abort when running dbg:tracer(). > %% > %% 1> binbug:bug(). > %% size_object: matchstate term not allowedAbort trap > > -module(binbug). > -export([bug/0, > parse_headers/4]). > > parse_headers(<<"\\r\\n", T/binary>>, Hdr, Hdrs, Toks) -> > parse_headers(T, <<>>, [Hdr | Hdrs], Toks). > > bug() -> > dbg:tracer(), > dbg:p(all, call), > dbg:tpl(?MODULE, []), > parse_headers(<<"\\r\\n]">>, <<"hdr1">>, [], []). > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Tue Aug 5 10:07:09 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Aug 2008 10:07:09 +0200 Subject: [erlang-questions] [erlang-bugs] dbg:tracer() aborts on binary match In-Reply-To: References: Message-ID: Jon Meredith writes: > Hi, > > I'm writing a small parser for reading log lines. When it didn't do > what I expected I tried to use dbg:tracer() to see where it was going > wrong and it aborted. Here is the cut down minimal test case. Thanks! A correction for this bug will be included in R12B-4. I have attached a patch in case you need a correction before that. /Bjorn -------------- next part -------------- A non-text attachment was scrubbed... Name: bin_syntax_trace.patch Type: text/x-patch Size: 2658 bytes Desc: Correction for binary syntax/trace problem URL: -------------- next part -------------- -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From monch1962@REDACTED Tue Aug 5 10:15:03 2008 From: monch1962@REDACTED (David Mitchell) Date: Tue, 5 Aug 2008 18:15:03 +1000 Subject: [erlang-questions] "Design patterns" for functional languages? Message-ID: G'day all, I'm looking for a good source of "design patterns" information for functional languages: Erlang in particular, but also applicable to OCaml. While I've written a smallish bunch of Erlang apps now and all have gone reasonably well, I'm stuck with the feeling that I'm reinventing some wheels in a less-than-optimal fashion. Google shows up a bunch of sites containing functional design patterns out there, but the ones I've examined don't seem to be particularly ... how can I put this? ... well thought out. Does anyone have a good reference for functional design pattern info, that's both well explained and covers a useful subset of real-life cases? I guess I'm looking for the functional equivalent of the Gang of Four "Design Patterns" book, but focusing on functional languages and preferably free. Regards David Mitchell From tobias.lindahl@REDACTED Tue Aug 5 09:28:39 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Tue, 05 Aug 2008 09:28:39 +0200 Subject: [erlang-questions] dialyzer won't start In-Reply-To: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> References: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> Message-ID: <48980127.6070606@it.uu.se> Hi Tom, and sorry for the late answer. Tom Ayerst wrote: > I have generated a plt file for dialyzer (based on everything except SSL in > the R12B release). I now have a plt file but dialyzer hangs on startup > (well, it may not be hanging but it doesn't do anything for an hour+). > > Is there any way I can investigate this further. Checking the plt file > comes back quickly and says it is ok. > When you say that it hangs on startup, does this mean that it hangs on starting the gui, or it hangs on starting an analysis? If you make your plt available to me (preferably off-list), and also the files (if any) you are analyzing, I can have a look at what is happening. Tobias > Thanks > > Tom > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Tue Aug 5 10:32:05 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 5 Aug 2008 10:32:05 +0200 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: <4d08db370808050132m3ef226bam9a1ea7ec226a3a7e@mail.gmail.com> This is not exactly what you ask for, but may be http://mitpress.mit.edu/sicp/ On Tue, Aug 5, 2008 at 10:15 AM, David Mitchell wrote: > G'day all, > > I'm looking for a good source of "design patterns" information for > functional languages: Erlang in particular, but also applicable to > OCaml. While I've written a smallish bunch of Erlang apps now and all > have gone reasonably well, I'm stuck with the feeling that I'm > reinventing some wheels in a less-than-optimal fashion. > > Google shows up a bunch of sites containing functional design patterns > out there, but the ones I've examined don't seem to be particularly > ... how can I put this? ... well thought out. > > Does anyone have a good reference for functional design pattern info, > that's both well explained and covers a useful subset of real-life > cases? I guess I'm looking for the functional equivalent of the Gang > of Four "Design Patterns" book, but focusing on functional languages > and preferably free. > > Regards > > David Mitchell > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Tue Aug 5 12:05:33 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Aug 2008 12:05:33 +0200 Subject: [erlang-questions] external term format clarification In-Reply-To: References: Message-ID: Paul Mineiro writes: > at > > http://www.erlang.org/doc/apps/erts/erl_ext_dist.html#8 > > the table indicates that the free vars section of the fun_ext encoding is > "4 * len" whereas the text says "len". Thanks for pointing out this error. A better name for "Len" would be "NumFree"; that is, the number of free variables. The size of the free variable section should be "N5"; the size of the section cannot be determined without decoding the free variables. The documentation will be updated in R12B-4. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From C.Grasl@REDACTED Tue Aug 5 14:54:28 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 5 Aug 2008 14:54:28 +0200 Subject: [erlang-questions] Selective receive issue References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CD8B@srvkeyx01.KEYTRONIX.local> Hi, Vlad! Try the following: First the loop: (can be a single registered process (better than passing PIDs around) or a stand alone gen_server (which has certain qualities you might wanna have in your module..)): loop() -> receive {input, Data} -> processInput(Data), loop(); AnyMessage -> store(AnyMessage), loop after 2300 -> timeOutRoutine(), loop() end. Then a loop-state in order to verify the loops' state and to store messages that are not caught by the reseive-pattern: State = [{active, true}, {pending, []}] the adapted loop function and the list-related helperz: loop(State) -> receive activate -> NewState = replaceVariable(State, {active, true}), loop(NewState); deactivate -> NewState = replaceVariable(State, {active, false}), loop(NewState); {input, Data} -> case getValue(State, active) of false -> loop(State); true -> processInput(Data), loop(State) end; AnyMessage -> case getValue(State, active) of false -> loop(State); true -> %% now storing the msg in the loop's state: NewState = replaceVariable(State, {pending, AnyMessage}), loop(State) end after 2300 -> timeOutRoutine(), loop() end. %% getValue getValue([], Key) -> value_not_found; getValue([{Key, Value}, Rest], Key) -> Value; getValue([{_OtherKey, _OtherValue}, Rest], Key) -> getValue(Rest, Key). %% replaceVariable replaceVariable({SuperVarKey, VarList}, {VarKey, NewValue}) -> {SuperVarKey, replaceVariable(VarList, {VarKey, NewValue})}; replaceVariable(VarList, {Key, Value}) -> replaceVariable(VarList, {Key, Value}, []). replaceVariable([], {_VarKey, _NewValue}, _Acc) -> void; replaceVariable([{VarKey, _OldValue} | Rest], {VarKey, NewValue}, Acc) -> lists:append([ lists:append([Acc, [{VarKey, NewValue}]]), Rest]); replaceVariable([{OtherVarKey, OtherValue} | Rest], {VarKey, NewValue}, Acc) -> replaceVariable(Rest, {VarKey, NewValue}, lists:append([Acc, [{OtherVarKey, OtherValue}]])). Obviously there are many ways to Rome, you can also use a dets/ets or mnesia to store wanted/unwanted messages instead of saving it to the loop's state. Or you could use a gen_server instead that has some additional features with a native server state that might suit your needs a lil' better. Best Regards, Christoph Grasl Embedded Software Entwickler KEYTRONIX Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH Ungargasse 64-66/1/109 A-1030 WIEN E-Mail: c.grasl@REDACTED Tel.: +43 (1) 718 06 60 - 323 Mobil: +43 (664) 8556456 WWW: http://www.keytronix.com HG Wien FN 261131t Confidentiality Notice: This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email. -----Urspr?ngliche Nachricht----- Von: erlang-questions-bounces@REDACTED im Auftrag von Vlad Dumitrescu Gesendet: Di 05.08.2008 08:59 An: erlang-questions Betreff: [erlang-questions] Selective receive issue Hi all, I have an example of a receive where I don't seem to be able to use the usual "dump any unrecognized messages" catch-all clause. I think it is also an example where channels could be useful, but the main question is whether I am missing the obvious or not. I have a process that takes {input, Data} messages from its mailbox and processes them (not necessarily one at a time). Flow control is implemented as a pair of 'start'/'stop' messages. The way I implemented the main loop is (simplified) receive start->Running = true, loop(); stop->Running = false, loop() after 0 -> if Running -> process_one_step(), loop(); true -> loop() end end, where the process_one_step() function may call receive {input, Data} -> ... end one or several times (it is configurable by the clients). It seems to me that there is no place where I can put a '_->...;' clause without creating problems. So I'd like to ask if anyone sees another way to structure this that will allow rogue messages to be discarded. ------ A solution that requires an EEP :-) is to introduce an extension to the receive statement that will explicitly keep matched messages in the mailbox. For example receive Pattern -> keep(), loop(); Msg -> process(Msg), loop() end keep() is the extension that says "leave the message in the mailbox and proceed". This way process() will be called with all messages except those matching Pattern Would something like that be useful, or are there already ways to achieve the same effect? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Aug 5 15:11:39 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 5 Aug 2008 15:11:39 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <94C5430AA547F24AA801BA5706F29D2E25CD8B@srvkeyx01.KEYTRONIX.local> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <94C5430AA547F24AA801BA5706F29D2E25CD8B@srvkeyx01.KEYTRONIX.local> Message-ID: <95be1d3b0808050611x74f1d0aard657eb3e44be7cb0@mail.gmail.com> Hi Cristoph! Thanks a lot for the detailed answer! Unfortunately, it doesn't work for me (or at least not without a fundamental redesign). The problem is that the process() function has to have its own receive statement, because it may retrieve any number of messages (matching different patterns) that will be processed at the current step. Of course, this can be solved by buffering messages, but I rather wouldn't do that. It makes the logic much more complex (and it's already not so simple :-) Another alternative would be to wrap this process in another one that will pass on messages that will be recognized and discard any others. Or to completely ignore the issue :-) best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmeredith@REDACTED Tue Aug 5 15:12:42 2008 From: jmeredith@REDACTED (Jon Meredith) Date: Tue, 5 Aug 2008 07:12:42 -0600 Subject: [erlang-questions] dbg:tracer() aborts on binary match In-Reply-To: <4d08db370808050027r4490e568ke21ecdc1d7514c6f@mail.gmail.com> References: <4d08db370808050027r4490e568ke21ecdc1d7514c6f@mail.gmail.com> Message-ID: Hi, Thanks for the response. I'm trying to look for the (unescaped) character string \r\n (0x5c 0x72 0x5c 0x6e) from inside a squid access log with HTTP header information delimited by \r\n. I think I've escaped it correctly. Here's an alternative version with the escaping ambiguity removed. %% Abort when running dbg:tracer(). %% %% 1> binbug:bug(). %% size_object: matchstate term not allowedAbort trap -module(binbug2). -export([bug/0, parse_headers/4]). parse_headers(<<92:8, 114:8, 92:8, 110:8, T/binary>>, Hdr, Hdrs, Toks) -> parse_headers(T, <<>>, [Hdr | Hdrs], Toks). bug() -> dbg:tracer(), dbg:p(all, call), dbg:tpl(?MODULE, []), parse_headers(<<92:8, 114:8, 92:8, 110:8, 10:8>>, <<>>, [], []). Jon On Aug 5, 2008, at 1:27 AM, Hynek Vychodil wrote: > There is wrong escaping off topic. It should be: > > parse_headers(<<"\r\n", T/binary>>, Hdr, Hdrs, Toks) -> > parse_headers(T, <<>>, [Hdr | Hdrs], Toks). > > bug() -> > dbg:tracer(), > dbg:p(all, call), > dbg:tpl(?MODULE, []), > parse_headers(<<"\r\n]">>, <<"hdr1">>, [], []). > > > On Tue, Aug 5, 2008 at 12:07 AM, Jon Meredith > wrote: > Hi, > > I'm writing a small parser for reading log lines. When it didn't do > what I expected I tried to use dbg:tracer() to see where it was going > wrong and it aborted. Here is the cut down minimal test case. > > I'm expecting it to match and then try and call parse_headers with Hdr > added to the Hdrs list, but instead the VM aborts. Am I doing > something wrong/strange? > > Many thanks, Jon. > > %% Abort when running dbg:tracer(). > %% > %% 1> binbug:bug(). > %% size_object: matchstate term not allowedAbort trap > > -module(binbug). > -export([bug/0, > parse_headers/4]). > > parse_headers(<<"\\r\\n", T/binary>>, Hdr, Hdrs, Toks) -> > parse_headers(T, <<>>, [Hdr | Hdrs], Toks). > > bug() -> > dbg:tracer(), > dbg:p(all, call), > dbg:tpl(?MODULE, []), > parse_headers(<<"\\r\\n]">>, <<"hdr1">>, [], []). > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From C.Grasl@REDACTED Tue Aug 5 15:43:53 2008 From: C.Grasl@REDACTED (Grasl Christoph) Date: Tue, 5 Aug 2008 15:43:53 +0200 Subject: [erlang-questions] Selective receive issue References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com><94C5430AA547F24AA801BA5706F29D2E25CD8B@srvkeyx01.KEYTRONIX.local> <95be1d3b0808050611x74f1d0aard657eb3e44be7cb0@mail.gmail.com> Message-ID: <94C5430AA547F24AA801BA5706F29D2E25CD8E@srvkeyx01.KEYTRONIX.local> Hi again! So why not use a second loop in the processInput/2 - funcction and return a state-change to the original loop if desired? loop(State) -> receive activate -> NewState = replaceVariable(State, {active, true}), loop(NewState); deactivate -> NewState = replaceVariable(State, {active, false}), loop(NewState); {input, Data} -> case getValue(State, active) of false -> loop(State); true -> case processInput(Data) of {false, Reason} -> exit(Reason); %% so u know when computation is corrupted {true, NewState} -> loop(NewState) end; AnyMessage -> case getValue(State, active) of false -> loop(State); true -> %% now storing the msg in the loop's state: NewState = replaceVariable(State, {pending, AnyMessage}), loop(State) end after 2300 -> timeOutRoutine(), loop() end. processInput(Data) -> case whereis(secondLoop) of undefined -> Pid = spawn(secondLoop, secondLoop, [Data, self()]), register(secondLoop, Pid); _Pid -> void end, receive {processed, NewState} -> {true, NewState} {false, Reason} -> {false, Reason} after 2300 -> {false, timeout_occured} end. secondLoop(Data, From) -> receive Pattern1 -> NewState = processDataAccordingToPattern(Data, Pattern1), From ! {processed, NewState}; PatternN -> NewState = processDataAccordingToPattern(Data, PatternN), From ! {processed, NewState} after 2300 -> timeOutRoutine(), From ! {false, timeout_occured} end. While the processDataAccordingToPattern-functions return the NewState for the original loop (if desired) In case i missunderstood the requirements of the loop-functionalities and your initial question was left unanswered your are welcome to explain your exact specifications and the process-topology in detail. Best regards, Christoph Grasl Embedded Software Entwickler KEYTRONIX Gesellschaft f?r industrielle Elektronik und Informationstechnologie mbH Ungargasse 64-66/1/109 A-1030 WIEN E-Mail: c.grasl@REDACTED Tel.: +43 (1) 718 06 60 - 323 Mobil: +43 (664) 8556456 WWW: http://www.keytronix.com HG Wien FN 261131t Confidentiality Notice: This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Aug 5 16:18:27 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 5 Aug 2008 16:18:27 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <94C5430AA547F24AA801BA5706F29D2E25CD8E@srvkeyx01.KEYTRONIX.local> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <94C5430AA547F24AA801BA5706F29D2E25CD8B@srvkeyx01.KEYTRONIX.local> <95be1d3b0808050611x74f1d0aard657eb3e44be7cb0@mail.gmail.com> <94C5430AA547F24AA801BA5706F29D2E25CD8E@srvkeyx01.KEYTRONIX.local> Message-ID: <95be1d3b0808050718x3db81af2o682bc4864e3bd4f2@mail.gmail.com> Hi again, This may work, I didn't study it in all detail yet, but it feels like a lot of complexity just to be eliminate unneeded messages. I think I will ignore this for the time being and assume all processes play nice, and will get back at the issue when the main logic is working as it should (which it doesn't yet). I'll let you know how it goes! Thanks for the input!! /Vlad On Tue, Aug 5, 2008 at 15:43, Grasl Christoph wrote: > Hi again! > > So why not use a second loop in the processInput/2 - funcction and > return a state-change to the original loop if desired? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From John-Olof.Bauner@REDACTED Tue Aug 5 16:35:29 2008 From: John-Olof.Bauner@REDACTED (John-Olof Bauner) Date: Tue, 05 Aug 2008 16:35:29 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <8209f740808020429i266d8fau8f2fcc3e343d4f9e@mail.gmail.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <18532.45624.17663.666648@hamberg.it.uu.se> <4A107132-9887-4734-BA7E-A47CF8EB087F@cs.otago.ac.nz> <18537.11084.466276.492883@harpo.it.uu.se> <8209f740806301210p42550dc0j11b739be44f61a96@mail.gmail.com> <18565.43649.880641.925438@harpo.it.uu.se> <8209f740807231027t385f22afwe10786451c0c6204@mail.gmail.com> <18568.51420.797833.139618@harpo.it.uu.se> <8209f740807241328j1f1d153bl2934cfba16cdaa60@mail.gmail.com> <18579.3719.354070.53873@harpo.it.uu.se> <8209f740808020429i266d8fau8f2fcc3e343d4f9e@mail.gmail.com> Message-ID: <48986531.6060307@ericsson.com> Ulf Wiger skrev: > 2008/8/1 Sven-Olof Nystr|m : > >> Ulf Wiger writes: >> > > Ulf Wiger writes: >> >> > > > >> 2) One of the problem you are discussing is how to describe >> concurrent activities within one state machine. UML's mechanism >> for expressing composite state seems to be close to what is >> needed here. >> > > Not as far as I understand them. The composite state machines allow > you to build very complex receive logic, but the message reception > semantics is still FIFO, run-to-completion. > > There is, however, an attribute in UML - 'deferrable event', which allows > you to specify that an event should be buffered, rather than discarded, > if there is no matching handler in the current state. Not all UML-based > tools support this attribute, and it receives very little attention in the > specification. > > The key issue is that if you collect messages from different senders in > a single mailbox or message queue, there will be accidental ordering. > If your program logic strictly handles messages FIFO, it imposes a > requirement that you have to be able to deal with all possible > serializations of events - which invariably means that you have to > perform some form of buffering in your application. > > Buffering channels address this problem, of course. > The reason why I suggested that you look at the POTS example > wasn't that I didn't think you could solve it with channels; it was > to give you an *interesting* example in order to assess whether > a channel-based solution would be more or less elegant than the > traditional erlang version. > > > RoseRT has defer/recall(All) and you can make recall on a port or all. You can choose if you recall from the front. We have a very complex state machine in this technology and it would be very interesting to see how it could be simplified in alternative technology which would be a very good thesis project. BR J-O From erlang-questions_efine@REDACTED Tue Aug 5 17:04:25 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 5 Aug 2008 11:04:25 -0400 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: References: <4896C219.6010404@erix.ericsson.se> <6c2563b20808040718w25d9eea0gde398ddeea0d147d@mail.gmail.com> <6c2563b20808041102r25ef4438y5bbb68dad9e398fa@mail.gmail.com> Message-ID: <6c2563b20808050804n46a70719ge3c61764b69642f5@mail.gmail.com> Chandru, Thanks, that absolutely did the trick! I used the first version; that's all I need. Regards, Edwin On Tue, Aug 5, 2008 at 10:30 AM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > Hi Edwin, > > ibrowse by default tries to open a new connection if it is within the limit > of the number of connections it is allowed. By default it is 10. It starts > pipelining only after all connections in that pool are busy. > > If you want to use the same connection, there are two ways, set the > max_sessions parameter in your request to 1. For example: > > ibrowse:send_req("http://localhost:7796/cgi-bin/erl/ebdc_web/country", [], > post, [], [{max_sessions, 1}]). > > Or, you can do the following. > > {ok, Pid} = ibrowse:spawn_worker_process("localhost", 7796). > ibrowse:send_req_direct(Pid, " > http://localhost:7796/cgi-bin/erl/ebdc_web/country", [], post, [], []). > > The first option is if you don't care which connection it goes over. The > second version is if you want fine grained control on which requests go on > which connection. I hope this helps. > > cheers > Chandru > > 2008/8/4 Edwin Fine > >> Hi Chandru, >> >> Thanks for the tip. I am in fact aware of ibrowse. I tried a version of it >> from Jungerl and it seemed to be doing the same thing. Maybe I have an old >> version (1.4) or I am not setting something up correctly. To duplicate this >> behavior, simply repeat the same ibrowse:send from the Erlang shell a few >> times, while watching the TCP traffic with Ethereal or similar. What I saw >> is different local ports being used each time even though posting to the >> same URL each time. I want the same port (i.e. connection) to be kept open >> and reused to avoid the connect/disconnect overhead. If there's a way to >> circumvent this, I'd like to know how, please. >> >> Regards, >> Edwin >> >> >> On Mon, Aug 4, 2008 at 12:51 PM, Chandru < >> chandrashekhar.mullaparthi@REDACTED> wrote: >> >>> Hi Edwin, >>> >>> 2008/8/4 Edwin Fine >>> >>>> Thanks, Ingela, I look forward to seeing the modifications. Hopefully >>>> you can post a patch so I don't have to wait for the next Erlang release. >>>> >>>> Regards, >>>> Edwin >>>> >>> >>> In case you didn't know, there is an alternative HTTP client called >>> ibrowse. which has a very similar API. You can use that while you wait for a >>> fix. I believe it doesn't impose any such restriction. >>> >>> cheers >>> Chandru >>> >>> PS: I am the author! >>> >> >> >> >> -- >> For every expert there is an equal and opposite expert - Arthur C. Clarke >> > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From berlin.brown@REDACTED Tue Aug 5 17:32:53 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Tue, 5 Aug 2008 08:32:53 -0700 (PDT) Subject: [erlang-questions] Issue starting Yaws in Cygwin Message-ID: <33cf65b2-adae-4a39-b3b8-6f142add16a4@25g2000hsx.googlegroups.com> I am trying to get yaws 1.77 running on cygwin. The instructions seem pretty detailed and up to the point of running, everything worked fine. But when I run I get the following error: $ bin/yaws Eshell V5.6 (abort with ^G) 1> =INFO REPORT==== 5-Aug-2008::11:27:52 === Yaws: Using config file c:/projects/tools/home/src/yaws/run/etc/ yaws.conf 1> =INFO REPORT==== 5-Aug-2008::11:27:52 === application: crypto exited: {shutdown,{crypto_app,start,[normal,[]]}} type: temporary 1> =ERROR REPORT==== 5-Aug-2008::11:27:52 === Failed to start: badarg 1> Most recent version of Erl (most recent download as of 7/20/2008), and Yaws (most recent as of 8/5/2008) I ran this to check if crytpo is available. 1> crypto:module_info(). [{exports,[{stop,0}, {info,0}, {md5,1}, {md5_init,0}, {md5_update,2}, {md5_final,1}, {sha,1}, {sha_init,0}, {sha_update,2}, {sha_final,1}, {md5_mac,2}, {md5_mac_96,2}, {sha_mac,2}, {sha_mac_96,2}, {des_cbc_encrypt,3}, {des_cbc_decrypt,3}, {des_cbc_ivec,1}, {des3_cbc_encrypt,5}, {des_ede3_cbc_encrypt,5}, {des_ede3_cbc_decrypt,5}, {aes_cfb_128_encrypt,3}, {aes_cfb_128_decrypt,3}, {rand_bytes,1}, {rand_bytes,3}, {rand_uniform,...}, {...}|...]}, From rvirding@REDACTED Tue Aug 5 17:39:47 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 5 Aug 2008 17:39:47 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> Message-ID: <3dbc6d1c0808050839i18d1afc5nd2b0aaddbc20e20c@mail.gmail.com> I am sorry I don't quite understand the problem. This is my understanding of the problem: - You can receive 4 different types of messages: 'start', 'stop', {input,Data} and junk. - When you process input you take a known, specific number of {input,Data} messages from the queue, waiting if necessary to get them all. - You want to throw away all unknown (junk) messages. - 'Start'/'stop' messages act as some form of priority switches and if the last of then to arrive was a 'start' when you are ready to process then you will start processing, otherwise you will wait for a 'start' message to start processing. Is this correct or have I misunderstood you? Are there any more rules for the start/stop messages, for example they come in pairs or you count them, or do they just turn the process switch on/off? How long time does the processing take? Not so much in seconds but in expected messages arriving during that period. You will always get race conditions, for example you decide to start processing but before you begin a 'stop' will arrive which you ignore till later. How critical is the "exact" timing of processing the 'start'/'stop' messages? If this is what you mean then I think I may have a solution. Robert 2008/8/5 Vlad Dumitrescu > Hi all, > > I have an example of a receive where I don't seem to be able to use the > usual "dump any unrecognized messages" catch-all clause. I think it is also > an example where channels could be useful, but the main question is whether > I am missing the obvious or not. > > I have a process that takes {input, Data} messages from its mailbox and > processes them (not necessarily one at a time). Flow control is implemented > as a pair of 'start'/'stop' messages. The way I implemented the main loop is > (simplified) > > receive > start->Running = true, loop(); > stop->Running = false, loop() > after 0 -> > if Running -> process_one_step(), loop(); > true -> loop() > end > end, > > where the process_one_step() function may call > > receive > {input, Data} -> ... > end > > one or several times (it is configurable by the clients). > > It seems to me that there is no place where I can put a '_->...;' clause > without creating problems. So I'd like to ask if anyone sees another way to > structure this that will allow rogue messages to be discarded. > > ------ > A solution that requires an EEP :-) is to introduce an extension to the > receive statement that will explicitly keep matched messages in the > mailbox. For example > > receive > Pattern -> keep(), loop(); > Msg -> process(Msg), loop() > end > > keep() is the extension that says "leave the message in the mailbox and > proceed". This way process() will be called with all messages except those > matching Pattern > > Would something like that be useful, or are there already ways to achieve > the same effect? > > best regards, > Vlad > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From berlin.brown@REDACTED Tue Aug 5 18:06:07 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Tue, 5 Aug 2008 09:06:07 -0700 (PDT) Subject: [erlang-questions] Issue starting Yaws in Cygwin In-Reply-To: <33cf65b2-adae-4a39-b3b8-6f142add16a4@25g2000hsx.googlegroups.com> References: <33cf65b2-adae-4a39-b3b8-6f142add16a4@25g2000hsx.googlegroups.com> Message-ID: <395d5f86-a98a-4e48-be45-8a732c9dc4b7@l64g2000hse.googlegroups.com> On Aug 5, 11:32 am, Berlin Brown wrote: > I am trying to get yaws 1.77 running on cygwin. The instructions seem > pretty detailed and up to the point of running, everything worked > fine. But when I run I get the following error: > > $ bin/yaws > Eshell V5.6 (abort with ^G) > 1> > =INFO REPORT==== 5-Aug-2008::11:27:52 === > Yaws: Using config file c:/projects/tools/home/src/yaws/run/etc/ > yaws.conf > 1> > =INFO REPORT==== 5-Aug-2008::11:27:52 === > application: crypto > exited: {shutdown,{crypto_app,start,[normal,[]]}} > type: temporary > 1> > =ERROR REPORT==== 5-Aug-2008::11:27:52 === > Failed to start: badarg > 1> > > Most recent version of Erl (most recent download as of 7/20/2008), > and Yaws (most recent as of 8/5/2008) > > I ran this to check if crytpo is available. > > 1> crypto:module_info(). > [{exports,[{stop,0}, > {info,0}, > {md5,1}, > {md5_init,0}, > {md5_update,2}, > {md5_final,1}, > {sha,1}, > {sha_init,0}, > {sha_update,2}, > {sha_final,1}, > {md5_mac,2}, > {md5_mac_96,2}, > {sha_mac,2}, > {sha_mac_96,2}, > {des_cbc_encrypt,3}, > {des_cbc_decrypt,3}, > {des_cbc_ivec,1}, > {des3_cbc_encrypt,5}, > {des_ede3_cbc_encrypt,5}, > {des_ede3_cbc_decrypt,5}, > {aes_cfb_128_encrypt,3}, > {aes_cfb_128_decrypt,3}, > {rand_bytes,1}, > {rand_bytes,3}, > {rand_uniform,...}, > {...}|...]}, > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions Ok, because the crypto module doesn't seem to be used that much. I went ahead and commented out the bad code. in yaws_ctl.erl. There was probably an API change in Erlang and a mismatch with Yaws. I did 'make' and then 'make install' again. crypto:start() %%crypto:rand_uniform(0, 1 bsl 64) From tty.erlang@REDACTED Tue Aug 5 18:48:41 2008 From: tty.erlang@REDACTED (t ty) Date: Tue, 5 Aug 2008 12:48:41 -0400 Subject: [erlang-questions] 2008 Erlang Workshop: Call for Participation Message-ID: <290b3ba10808050948o43bc97dbpbfcb5ea9adea7241@mail.gmail.com> ===================================================================== Call for Participation The 7th ACM SIGPLAN Erlang Workshop 2008 http://www.erlang.org/workshop/2008/ Victoria, BC, Canada, 27 September 2008 ===================================================================== Registration is now open for the 7th ACM SIGPLAN Erlang Workshop in Victoria, British Columbia, Canada, on September 27. Please see the invitation and workshop program at http://www.erlang.org/workshop/2008/ The workshop is affiliated with the International Conference on Functional Programming http://www.icfpconference.org/icfp2008 Deadline for early registration is August 20. Other events which may be of interests include the Functional Programming Developer Tracks (DEFUN '08) Sept 25 and Commercial Uses of Functional Programming (CUFP) Sept 26. Please feel free to forward this Call for Participation to any other interested mailing-list. From matt@REDACTED Tue Aug 5 18:55:33 2008 From: matt@REDACTED (Matt Kangas) Date: Tue, 5 Aug 2008 12:55:33 -0400 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: David, I see Hynek has already suggested SICP. Another, possibly gentler, book that you may find helpful: "The Little Schemer". Some time ago I rewrote most of the book's code in Erlang as a learning exercise: http://www.p16blog.com/p16/2008/01/erlang-version.html Code: http://p16blog.googlecode.com/svn/trunk/learning_erlang/little.erl I'm still kicking around the idea of fleshing this out into something book-like, but have been too busy otherwise. If you find this code useful or have suggestions for improving it, please let me know! Cheers, --Matt On Tue, Aug 5, 2008 at 4:15 AM, David Mitchell wrote: > G'day all, > > I'm looking for a good source of "design patterns" information for > functional languages: Erlang in particular, but also applicable to > OCaml. While I've written a smallish bunch of Erlang apps now and all > have gone reasonably well, I'm stuck with the feeling that I'm > reinventing some wheels in a less-than-optimal fashion. > > Google shows up a bunch of sites containing functional design patterns > out there, but the ones I've examined don't seem to be particularly > ... how can I put this? ... well thought out. > > Does anyone have a good reference for functional design pattern info, > that's both well explained and covers a useful subset of real-life > cases? I guess I'm looking for the functional equivalent of the Gang > of Four "Design Patterns" book, but focusing on functional languages > and preferably free. > > Regards > > David Mitchell -- Matt Kangas matt@REDACTED From vladdu55@REDACTED Tue Aug 5 20:27:08 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 5 Aug 2008 20:27:08 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <3dbc6d1c0808050839i18d1afc5nd2b0aaddbc20e20c@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <3dbc6d1c0808050839i18d1afc5nd2b0aaddbc20e20c@mail.gmail.com> Message-ID: <95be1d3b0808051127y1ecc14e1m9f99402e02253961@mail.gmail.com> Hi, On Tue, Aug 5, 2008 at 17:39, Robert Virding wrote: > I am sorry I don't quite understand the problem. This is my understanding of > the problem: > - You can receive 4 different types of messages: 'start', 'stop', > {input,Data} and junk. > - You want to throw away all unknown (junk) messages. > - 'Start'/'stop' messages act as some form of priority switches and if the > last of then to arrive was a 'start' when you are ready to process then you > will start processing, otherwise you will wait for a 'start' message to > start processing. Yes to all. > - When you process input you take a known, specific number of {input,Data} > messages from the queue, waiting if necessary to get them all. The number is known, but may differ from one call to another of the processing function. In most cases it will be the same, though. > Is this correct or have I misunderstood you? Are there any more rules for > the start/stop messages, for example they come in pairs or you count them, > or do they just turn the process switch on/off? Just on/off. > How long time does the processing take? Not so much in seconds but in > expected messages arriving during that period. It depends, but even the incoming message stream is regulated in a similar way, so if processing is slow the mailbox won't become too large. > You will always get race conditions, for example you decide to start > processing but before you begin a 'stop' will arrive which you ignore till > later. How critical is the "exact" timing of processing the 'start'/'stop' > messages? It's not critical at all. The start/stop messages act as a soft flow control mechanism, to ensure that the client of the process doesn't get its mailbox flooded. best regards, Vlad > If this is what you mean then I think I may have a solution. From mog-lists@REDACTED Tue Aug 5 20:48:02 2008 From: mog-lists@REDACTED (mog) Date: Tue, 05 Aug 2008 13:48:02 -0500 Subject: [erlang-questions] benchmarks llvm vs gcc Message-ID: <4898A062.7030809@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 So I was curious to see if i could get 5-10% boost out of Erlang r12b3 via llvm built vm, turns out it actually decreases speed a bit in comparison to my gcc. I used the http://shootout.alioth.debian.org for benchmark codes and ran all benchmarks. I would be happy to send all info if anyone is interested. specrtalnorm llvm Erlang 21.745 787.513 2698.601 - --- gcc Erlang 6.736 241.999 885.979 hello llvm Erlang 0.392 17.205 34.390 51.623 68.760 - --- gcc Erlang 0.268 11.061 22.073 33.098 44.083 ~ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.1 (Debian 4.3.1-2) ~ llvm-gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../llvm-gcc4.2-2.2.source/configure --host=i486-linux-gnu --build=i486-linux-gnu --prefix=/usr/lib/llvm/gcc-4.2 --enable-languages=c,c++ --program-prefix=llvm- --enable-llvm=/usr/lib/llvm --enable-threads --disable-nls --disable-shared --disable-multilib --disable-bootstrap Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5546) (LLVM build) Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiYoFwACgkQeq+tARrxhnszDwCgmyKa1Nafjavm/UJDzzrBKwOZ i3cAnRWgOIgNgFHe0HPnvsK6oObx4PVA =60MB -----END PGP SIGNATURE----- From kevin@REDACTED Tue Aug 5 21:42:32 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 5 Aug 2008 15:42:32 -0400 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> I'd put some money down on "Effective Erlang", if anyone ever got around to writing that :) --Kevin On Aug 5, 2008, at 12:55 PM, Matt Kangas wrote: > David, > > I see Hynek has already suggested SICP. Another, possibly gentler, > book that you may find helpful: "The Little Schemer". Some time ago I > rewrote most of the book's code in Erlang as a learning exercise: > > http://www.p16blog.com/p16/2008/01/erlang-version.html > > Code: http://p16blog.googlecode.com/svn/trunk/learning_erlang/little.erl > > I'm still kicking around the idea of fleshing this out into something > book-like, but have been too busy otherwise. If you find this code > useful or have suggestions for improving it, please let me know! > > Cheers, > --Matt > > > On Tue, Aug 5, 2008 at 4:15 AM, David Mitchell > wrote: >> G'day all, >> >> I'm looking for a good source of "design patterns" information for >> functional languages: Erlang in particular, but also applicable to >> OCaml. While I've written a smallish bunch of Erlang apps now and >> all >> have gone reasonably well, I'm stuck with the feeling that I'm >> reinventing some wheels in a less-than-optimal fashion. >> >> Google shows up a bunch of sites containing functional design >> patterns >> out there, but the ones I've examined don't seem to be particularly >> ... how can I put this? ... well thought out. >> >> Does anyone have a good reference for functional design pattern info, >> that's both well explained and covers a useful subset of real-life >> cases? I guess I'm looking for the functional equivalent of the Gang >> of Four "Design Patterns" book, but focusing on functional languages >> and preferably free. >> >> Regards >> >> David Mitchell > > > -- > Matt Kangas > matt@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kevin@REDACTED Tue Aug 5 22:51:41 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 5 Aug 2008 16:51:41 -0400 Subject: [erlang-questions] Working with erl_boot_server Message-ID: <0C0D8F79-FDDB-414F-BAD9-9BBE2DC198C2@hypotheticalabs.com> I've been poking all day at a problem I've run into with erl_boot_server. I've got a set of applications and a boot file which work fine when I use the boot file locally like so: erl -sname foo -pz appfoo/ebin -pz appbar/ebin -boot appboot When I try to use the boot file with erl_boot_server the node crashes with what looks like an inability to load the application module for one of the apps: =CRASH REPORT==== 5-Aug-2008::16:21:19 === crasher: pid: <0.79.0> registered_name: [] exception exit: {bad_return, {{foo_app,start, [normal,[{config_file,"/etc/baz/appfoo.cfg"}]]}, {'EXIT', {undef, [{foo_app,start, [normal, [{config_file,"/etc/baz/appfoo.cfg"}]]}, {application_master,start_it_old,4}]}}}} I've made sure that the node running the boot server has the same code paths as the node I used to test the application locally. I'm pretty sure I've got something configured wrong with code paths or maybe app files but I haven't been able to figure it out yet. Any suggestions on things to investigate (app files, pathing, etc) or pointers to docs on how to use erl_boot_server (besides Joel's blog posts) would be great. Thanks, Kevin From ok@REDACTED Wed Aug 6 01:38:43 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 6 Aug 2008 11:38:43 +1200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> Message-ID: <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> On 5 Aug 2008, at 6:59 pm, Vlad Dumitrescu wrote: > It seems to me that there is no place where I can put a '_->...;' > clause without creating problems. So I'd like to ask if anyone sees > another way to structure this that will allow rogue messages to be > discarded. "Add another process." Present a Haskeller with a problem, and he starts by saying "I'll just define another combinator..." Present an Erlanger with a problem, and he starts by saying "I'm sure we can fix this by adding another process." start_handler(X, Y, Z) -> Pid = spawn(fun () -> real_handler(X, Y, Z) end), spawn(fun() -> guardian(Pid) end). guardian(Pid) -> receive start -> Pid!start ; stop -> Pid!stop ; {input,Data} -> Pid!{input,Data} ; _ -> discard end, guardian(Pid). Now your real process hides behind its guardian; nobody can possibly get a message to it except by sending it to the guardian. > receive > Pattern -> keep(), loop(); > Msg -> process(Msg), loop() > end When you pass the "->", you leave the special mailbox handling mode, so keep() would be a very strange backwards time-travelling function. I think that extra syntax would be needed, along the lines of Pattern [when Guard] [!] -> Body with "!" (reminiscent of message sending) meaning to leave the message in the mailbox. The question is whether enabling a whole new class of serious bugs is better or worse than requiring people to add an extra process. From vladdu55@REDACTED Wed Aug 6 08:44:14 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 6 Aug 2008 08:44:14 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> Message-ID: <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> Hi, On Wed, Aug 6, 2008 at 01:38, Richard A. O'Keefe wrote: > On 5 Aug 2008, at 6:59 pm, Vlad Dumitrescu wrote: > >> It seems to me that there is no place where I can put a '_->...;' clause >> without creating problems. So I'd like to ask if anyone sees another way to >> structure this that will allow rogue messages to be discarded. >> > > "Add another process." > Present a Haskeller with a problem, and he starts by saying > "I'll just define another combinator..." > Present an Erlanger with a problem, and he starts by saying > "I'm sure we can fix this by adding another process." > Yes, thank you. I had considered this myself in a later message in the thread. There is still a problem with that (albeit a small one): if tracing the system with dbg, the traced processes get spurious 'timeout' messages directly, regardless of any proxies trying to protect them. In this case, it's easy to match and discard them, and they are only there in debug mode, but there may be other cases that affect runtime performance. > The question is whether enabling a whole new class of serious > bugs is better or worse than requiring people to add an extra > process. No, it isn't. You probably noticed the smilie -- sometimes it may be useful for a fool to throw a stone in the lake and have the wise ones retrieve it, the result may be a step forward. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From monch1962@REDACTED Wed Aug 6 08:46:08 2008 From: monch1962@REDACTED (David Mitchell) Date: Wed, 6 Aug 2008 16:46:08 +1000 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> Message-ID: Thanks to everyone who's responded. Work's managed to deal me a pretty ugly hand over the past 24 hours - got loads of new stuff to do - so I'll have to put this quest on the backburner for a while. I'm not sure I agree with the statement quoted by Michael that FP doesn't have the shortcomings of OO so GoF-like patterns aren't necessary. I'm sure that, given time and access to a suitable GoF/FP-type mentor, I could reconstruct some of what I've done recently in Erlang, and achieve greater goodness than I have at this point. I've already taken tentative steps down this path in some instances, but I'm finding myself treading what feels like a fine line between building better structured code, and introducing unwanted "cleverness". Being a reformed Perl junkie, I'm very suspicious of "cleverness" in general... Oh well, the journey continues... Regards David Mitchell 2008/8/6 Kevin A. Smith : > I'd put some money down on "Effective Erlang", if anyone ever got around to > writing that :) > > --Kevin > On Aug 5, 2008, at 12:55 PM, Matt Kangas wrote: > >> David, >> >> I see Hynek has already suggested SICP. Another, possibly gentler, >> book that you may find helpful: "The Little Schemer". Some time ago I >> rewrote most of the book's code in Erlang as a learning exercise: >> >> http://www.p16blog.com/p16/2008/01/erlang-version.html >> >> Code: http://p16blog.googlecode.com/svn/trunk/learning_erlang/little.erl >> >> I'm still kicking around the idea of fleshing this out into something >> book-like, but have been too busy otherwise. If you find this code >> useful or have suggestions for improving it, please let me know! >> >> Cheers, >> --Matt >> >> >> On Tue, Aug 5, 2008 at 4:15 AM, David Mitchell >> wrote: >>> >>> G'day all, >>> >>> I'm looking for a good source of "design patterns" information for >>> functional languages: Erlang in particular, but also applicable to >>> OCaml. While I've written a smallish bunch of Erlang apps now and all >>> have gone reasonably well, I'm stuck with the feeling that I'm >>> reinventing some wheels in a less-than-optimal fashion. >>> >>> Google shows up a bunch of sites containing functional design patterns >>> out there, but the ones I've examined don't seem to be particularly >>> ... how can I put this? ... well thought out. >>> >>> Does anyone have a good reference for functional design pattern info, >>> that's both well explained and covers a useful subset of real-life >>> cases? I guess I'm looking for the functional equivalent of the Gang >>> of Four "Design Patterns" book, but focusing on functional languages >>> and preferably free. >>> >>> Regards >>> >>> David Mitchell >> >> >> -- >> Matt Kangas >> matt@REDACTED >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From mats.cronqvist@REDACTED Wed Aug 6 09:51:42 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 06 Aug 2008 09:51:42 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> Message-ID: <4899580E.8030607@gmail.com> Vlad Dumitrescu wrote: > Hi, > > On Wed, Aug 6, 2008 at 01:38, Richard A. O'Keefe > wrote: > > On 5 Aug 2008, at 6:59 pm, Vlad Dumitrescu wrote: > > It seems to me that there is no place where I can put a > '_->...;' clause without creating problems. So I'd like to ask > if anyone sees another way to structure this that will allow > rogue messages to be discarded. > > > "Add another process." > +1 > > There is still a problem with that (albeit a small one): if tracing > the system with dbg, the traced processes get spurious 'timeout' > messages directly, regardless of any proxies trying to protect them. que? if so, surely that's a bug? and a pretty bad one at that. mats From vladdu55@REDACTED Wed Aug 6 09:55:22 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 6 Aug 2008 09:55:22 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <4899580E.8030607@gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> <4899580E.8030607@gmail.com> Message-ID: <95be1d3b0808060055i43ad9561r4a26faaf0e25f550@mail.gmail.com> On Wed, Aug 6, 2008 at 09:51, Mats Cronqvist wrote: > Vlad Dumitrescu wrote: > >> There is still a problem with that (albeit a small one): if tracing the >> system with dbg, the traced processes get spurious 'timeout' messages >> directly, regardless of any proxies trying to protect them. >> > > > que? if so, surely that's a bug? and a pretty bad one at that. > Ok, I will try to look further into that. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Aug 6 10:04:32 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 6 Aug 2008 10:04:32 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808060055i43ad9561r4a26faaf0e25f550@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> <4899580E.8030607@gmail.com> <95be1d3b0808060055i43ad9561r4a26faaf0e25f550@mail.gmail.com> Message-ID: <95be1d3b0808060104j68fe38e0u1c753e324a5cedf4@mail.gmail.com> > > On Wed, Aug 6, 2008 at 09:51, Mats Cronqvist wrote: > >> Vlad Dumitrescu wrote: >> >>> There is still a problem with that (albeit a small one): if tracing the >>> system with dbg, the traced processes get spurious 'timeout' messages >>> directly, regardless of any proxies trying to protect them. >>> >> >> >> que? if so, surely that's a bug? and a pretty bad one at that. > > It isn't a bug, it's just me. I had several bugs and I attributed the effects to the wrong cause, sorry for the noise. The 'timeout' message is of course the way the trace shows that an "after N" clause has been chosen. It feels a little uneasy that the trace printout is indistinguishable from the process having received the atom 'timeout' in a message. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Wed Aug 6 10:26:57 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 06 Aug 2008 10:26:57 +0200 Subject: [erlang-questions] Selective receive issue In-Reply-To: <95be1d3b0808060104j68fe38e0u1c753e324a5cedf4@mail.gmail.com> References: <95be1d3b0808042359s2a93676eqf3fc0afbb2087f94@mail.gmail.com> <0649DEE9-627A-41C7-BD07-6D85EECE7BBA@cs.otago.ac.nz> <95be1d3b0808052344s1cac8a98m1afec4f8f2e9ca40@mail.gmail.com> <4899580E.8030607@gmail.com> <95be1d3b0808060055i43ad9561r4a26faaf0e25f550@mail.gmail.com> <95be1d3b0808060104j68fe38e0u1c753e324a5cedf4@mail.gmail.com> Message-ID: <48996051.1020004@gmail.com> Vlad Dumitrescu wrote: > > On Wed, Aug 6, 2008 at 09:51, Mats Cronqvist > > wrote: > > Vlad Dumitrescu wrote: > > There is still a problem with that (albeit a small one): > if tracing the system with dbg, the traced processes get > spurious 'timeout' messages directly, regardless of any > proxies trying to protect them. > > > > que? if so, surely that's a bug? and a pretty bad one at that. > > > The 'timeout' message is of course the way the trace shows that an > "after N" clause has been chosen. It feels a little uneasy that the > trace printout is indistinguishable from the process having received > the atom 'timeout' in a message. yeah, it would be nice if that behavior (issuing a trace message at "after" clauses) could be turned off. mats From bekesa@REDACTED Wed Aug 6 17:19:55 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Wed, 06 Aug 2008 17:19:55 +0200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) Message-ID: <200808061719.55574.bekesa@sch.bme.hu> Hi, I like the idea of extending comprehensions to tuples, twisting language constructs to being more generic is always a good idea (to think about :-) What I miss is the ability to extend comprehensions by user defined generators, i.e. to be able to iterate over any data structure with a generator. My propose is to introduce a fourth generator: 1, [<-] is for iterating over lists 2, {<-} is for iterating over tuples 3, <<<->> is for iterating over binaries and 4, (<-) for iterating over anything else. In the generator "X (<-) Expr", Expr should evaluate to a function that returns either an empty list or the next element and the continuation fun. There are many possible types, just to mention a few: ---------------- Using tuples: Generator = fun() -> Result Result = [] | {term(),Generator} ---------------- List-like: Generator = fun() -> Result Result = [] | [term()|Generator] ---------------- QLC's TraverseFun type simplified: Generator = fun() -> Objects Objects = [] | [term() | ObjectList] ObjectList = Objects | TraverseFun -------------------- And many others. (I prefer the last.) The standard data types (arrays, sets, dicts, trees, etc) should provide their own iterator functions, and defining custom iterators is very easy. Example: -------------------- term_reader()-> case io:read("Type any term or 'quit' >") of {ok,quit} -> []; {ok,Term} -> [Term|fun term_reader/0] end. -------------------- Real nice would be if we'd extend not only generators, but the generated data as well. So we could, besides lists, tuples and binaries, generate any data structure by feeding the generated elements to a similar fun. However, I can't find any good syntax for that. How do you like the idea? Georgy PS: I know, I know, QLC does the same and much more, but QLC is too heavyweight and you rarely use it because of that. From bekesa@REDACTED Wed Aug 6 17:37:16 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Wed, 06 Aug 2008 17:37:16 +0200 Subject: [erlang-questions] QLC limitation: early evalutation of list expressions Message-ID: <200808061737.16167.bekesa@sch.bme.hu> Hi, In the QLC doc, I read: "The evaluation of a query handle begins by ... Next all list expressions [query handle or a list] are evaluated." So while you can write this in a list comprehension: [ X || N <- ListExpression, X <- ListExpressionUsingN ]. you can't write this in QLC. What is the real reason of this behaviour? Only performance, or something else? Are there any ways to circumvent this, besides writing qlc:append([[X || X <- ListExpressionUsingN] || N <- ListExpression ]). ? Georgy From rvirding@REDACTED Wed Aug 6 18:29:09 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 6 Aug 2008 18:29:09 +0200 Subject: [erlang-questions] EEP 14 -- Guard clarification and extension Message-ID: <3dbc6d1c0808060929v189fd097n62c44f930f00dda8@mail.gmail.com> I definitely approve of this EEP. It is, however, very important that Richard's restrictions as to where a guard match can occur is followed, otherwise we will get real confusion. I would like to extend this to allow a guard match in list comprehensions as well. Same semantics and same restrictions. The EEP description is in http://www.erlang.org/eeps/eep-0014.html Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From gustavo@REDACTED Wed Aug 6 20:10:44 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Wed, 6 Aug 2008 15:10:44 -0300 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <200808061719.55574.bekesa@sch.bme.hu> References: <200808061719.55574.bekesa@sch.bme.hu> Message-ID: <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> (...) > My propose is to introduce a fourth generator: > 1, [<-] is for iterating over lists > 2, {<-} is for iterating over tuples > 3, <<<->> is for iterating over binaries > and > 4, (<-) for iterating over anything else. My personal feeling is that part of the Erlang syntax seems to be optimized to make the compiler simpler/faster rather than the programmer's life. I'm a bit ashamed of saying this here because I don't want to start a silly flame war. I just honestly hope that one of the consequences of the uptake that Erlang seems to be getting is that at some point part of the syntax (punctuation, mostly) is reviewed towards making the programmer's life a bit easier. A few suggestions, to serve as examples: - A single iteration syntax, so that one doesn't have to remember the various flavors and switch the flavor as the variables change; - Optional commas at the end of a list or tuple ({1,2,}) so that one can always put a comma at the end of the line on lists spread through multiple lines; - Allowing the last block to have a semi-colon on if/case/receive/etc. I'm quite new to Erlang, and thus these sound like minor warts that I'm definitely getting used to. So feel free to ignore me. That said, newcomers are able to detect some long standing issues that may prevent further adoption, which isn't obvious to old timers, and that's why I post here. My opinion alone isn't very important, but please watch out if these warts are being mentioned over and over. -- Gustavo Niemeyer http://niemeyer.net From kevin@REDACTED Wed Aug 6 23:15:13 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 6 Aug 2008 14:15:13 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> Message-ID: <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> On Aug 5, 2008, at 11:46 PM, David Mitchell wrote: > I'm not sure I agree with the statement quoted by Michael that FP > doesn't have the shortcomings of OO so GoF-like patterns aren't > necessary. Yeah, functional programming has _different_ patterns, not no patterns. And, in some sense they also highlight shortcomings. For example, functional languages typically do not have lists that you can append to efficiently, so we need the "Accumulate and Reverse" pattern. Erlang doesn't allow you to enumerate the messages a process can receive, so we have a "Hide Message-Passing Behind Functions" pattern. I'm sure others can pitch in with more examples. -kevin From erlang-questions_efine@REDACTED Wed Aug 6 23:20:43 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 6 Aug 2008 17:20:43 -0400 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> Message-ID: <6c2563b20808061420v55718150l3e9950756679f758@mail.gmail.com> Even if the term "design patterns" doesn't fit (and I think it does fit - what is OTP if not a collection of design patterns and architectural patterns?), Erlang certainly has numerous programming idioms and practices that would be extremely useful to beginners and intermediate programmers, if catalogued. Something like what Herb Sutter did for C++ in his Exceptional C++ series. I've often wanted to do this myself but feel like I'm not qualified because I've only learned Erlang/OTP fairly recently. On Wed, Aug 6, 2008 at 2:46 AM, David Mitchell wrote: > Thanks to everyone who's responded. > > Work's managed to deal me a pretty ugly hand over the past 24 hours - > got loads of new stuff to do - so I'll have to put this quest on the > backburner for a while. > > I'm not sure I agree with the statement quoted by Michael that FP > doesn't have the shortcomings of OO so GoF-like patterns aren't > necessary. I'm sure that, given time and access to a suitable > GoF/FP-type mentor, I could reconstruct some of what I've done > recently in Erlang, and achieve greater goodness than I have at this > point. I've already taken tentative steps down this path in some > instances, but I'm finding myself treading what feels like a fine line > between building better structured code, and introducing unwanted > "cleverness". Being a reformed Perl junkie, I'm very suspicious of > "cleverness" in general... > > Oh well, the journey continues... > > Regards > > David Mitchell > > 2008/8/6 Kevin A. Smith : > > I'd put some money down on "Effective Erlang", if anyone ever got around > to > > writing that :) > > > > --Kevin > > On Aug 5, 2008, at 12:55 PM, Matt Kangas wrote: > > > >> David, > >> > >> I see Hynek has already suggested SICP. Another, possibly gentler, > >> book that you may find helpful: "The Little Schemer". Some time ago I > >> rewrote most of the book's code in Erlang as a learning exercise: > >> > >> http://www.p16blog.com/p16/2008/01/erlang-version.html > >> > >> Code: > http://p16blog.googlecode.com/svn/trunk/learning_erlang/little.erl > >> > >> I'm still kicking around the idea of fleshing this out into something > >> book-like, but have been too busy otherwise. If you find this code > >> useful or have suggestions for improving it, please let me know! > >> > >> Cheers, > >> --Matt > >> > >> > >> On Tue, Aug 5, 2008 at 4:15 AM, David Mitchell > >> wrote: > >>> > >>> G'day all, > >>> > >>> I'm looking for a good source of "design patterns" information for > >>> functional languages: Erlang in particular, but also applicable to > >>> OCaml. While I've written a smallish bunch of Erlang apps now and all > >>> have gone reasonably well, I'm stuck with the feeling that I'm > >>> reinventing some wheels in a less-than-optimal fashion. > >>> > >>> Google shows up a bunch of sites containing functional design patterns > >>> out there, but the ones I've examined don't seem to be particularly > >>> ... how can I put this? ... well thought out. > >>> > >>> Does anyone have a good reference for functional design pattern info, > >>> that's both well explained and covers a useful subset of real-life > >>> cases? I guess I'm looking for the functional equivalent of the Gang > >>> of Four "Design Patterns" book, but focusing on functional languages > >>> and preferably free. > >>> > >>> Regards > >>> > >>> David Mitchell > >> > >> > >> -- > >> Matt Kangas > >> matt@REDACTED > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Thu Aug 7 00:03:18 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Wed, 6 Aug 2008 18:03:18 -0400 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> Message-ID: The reference to message passing behind functions is exactly the kind of thing I had in mind in an "Effective Erlang" style book. There are tons of these kinds of practical patterns which could be documented for the benefit of all. --Kevin Sent from my iPhone On Aug 6, 2008, at 5:15 PM, Kevin Scaldeferri wrote: > > On Aug 5, 2008, at 11:46 PM, David Mitchell wrote: > >> I'm not sure I agree with the statement quoted by Michael that FP >> doesn't have the shortcomings of OO so GoF-like patterns aren't >> necessary. > > > Yeah, functional programming has _different_ patterns, not no > patterns. And, in some sense they also highlight shortcomings. > > For example, functional languages typically do not have lists that > you can append to efficiently, so we need the "Accumulate and > Reverse" pattern. > > Erlang doesn't allow you to enumerate the messages a process can > receive, so we have a "Hide Message-Passing Behind Functions" pattern. > > > I'm sure others can pitch in with more examples. > > -kevin From erlangy@REDACTED Thu Aug 7 00:42:32 2008 From: erlangy@REDACTED (ERLANG) Date: Thu, 7 Aug 2008 00:42:32 +0200 Subject: [erlang-questions] scalaris code posted In-Reply-To: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> References: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> Message-ID: <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> Hi guys, I found this interesting framework about scalable, reliable and maximum performance data storage system called "Hypertable" : http://hypertable.org It's based on Google BigTable concept, but it's open source ;-) enjoy reading Y. Le 23 juil. 08 ? 23:07, Joe Armstrong a ?crit : > I just got mail to say the scalaris code is posted > > http://code.google.com/p/scalaris > > I've update my blog > > http://armstrongonsoftware.blogspot.com/2008/06/itching-my-programming-nerve.html > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Thu Aug 7 03:13:41 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 7 Aug 2008 13:13:41 +1200 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> Message-ID: <4FC7318B-B424-4C65-B856-D8F46C7193E5@cs.otago.ac.nz> On 6 Aug 2008, at 6:46 pm, David Mitchell wrote: > I'm not sure I agree with the statement quoted by Michael that FP > doesn't have the shortcomings of OO so GoF-like patterns aren't > necessary. It _is_ fair, however, to say that Lisp and Smalltalk don't have the shortcomings of C++, so that many of the GoF patterns are not needed for them (or are so very obvious that no-one ever thought they needed names). It might be worth reading "Why Functional Programming Matters" by John Hughes. You can find the link in http://www.haskell.org/haskellwiki/Introduction and the rest of the page is probably a good idea anyway. Let's take one example (not in that paper). In C++ there is a "Design Pattern" called "Resource Allocation is Initialisation". What it's really about is resource *release*. The Haskell equivalent is a *function* called "bracket", not a pattern. I'm on the Haskell-Caf? mailing list. People there are into category theory in a big way. Where a Lisp programmer might write a macro, a Haskeller will probably introduce a new kind of Monad Transformer or something. The point is that in either case the common "pattern" will enter your library not as diagrams in a book but as actual reusable code you can call. Just like "behaviours" in Erlang, come to think of it. There are patterns at the level of "idioms", like "tail recursion", "accumulator parameter", "handle message priority with nested receives" and so on. It might be no bad thing to have a list of those. (The Gang of Five saw idioms as a useful pattern level.) From icfp.publicity@REDACTED Thu Aug 7 03:38:16 2008 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Wed, 6 Aug 2008 20:38:16 -0500 Subject: [erlang-questions] DEFUN 2008 (Developer Tracks on Functional Programming): Call for participation Message-ID: <53ff55480808061838p84ffb1ej2532f1657f7e0c77@mail.gmail.com> ACM SIGPLAN 2008 Developer Tracks on Functional Programming http://www.deinprogramm.de/defun-2008/ Victoria, BC, Canada, 25, 27 September, 2008 Held in conjunction with ICFP 2008: http://www.icfpconference.org/icfp2008/ DEFUN 2008 is the event for developers using functional languages: Recognized experts on functional programming technologies share their knowledge and professional skills in talks and tutorials in 10 exciting tracks. Find out how to best make functional programming work in your development project! Acquire new development skills! Learn about other functional languages! The DEFUN program (attached) has tracks with the following types of presentations: - Half-day general language tutorials for specific functional languages, given by recognized experts for the respective languages. - Half-day tutorials on specific techniques or the use of specific technologies in functional programming. - 45-minute "how-to" talks that provide specific information on how to solve specific problems using functional programming. These talks focus on concrete examples, but provide useful information for developers working on different projects or in different contexts. The developer tracks are complementary to ICFP itself (which is for researchers). They are anchored by CUFP, the Haskell Symposium, and the Erlang workshop. Organizers Kathleen Fisher AT&T Labs Simon Peyton Jones Microsoft Research Mike Sperber (co-chair) DeinProgramm Don Stewart (co-chair) Galois PROGRAM: Note: The sessions of a given morning or afternoon are concurrent. The markers (M1, M2, A1, A2, etc.) mark a particular session, and correspond to the designations on the registration forms. Note that the talks M5 together constitute a session. DAY 1 - 25 SEPTEMBER, 2008 MORNING SESSION M1 (Tutorial): Practical Erlang Programming Francesco Cesarini Erlang Training and Consulting M2 (Tutorial): A Gentle Introduction to Functional Information Visualization Jefferson Heard Renaissance Computing Institute, University of North Carolina M3 (Tutorial): JavaScript: from basics to building custom frameworks Sameer Sundresh and Erik Hinterbichler University of Illinois Urbana-Champaign and Pattern Insight, Inc. AFTERNOON SESSION A1 (Tutorial): Erlang DBG and the Trace Biff Tamas Nagy Erlang Training and Consulting A2 (Tutorial): Erlang QuickCheck Tutorial Thomas Arts IT University of Gothenburg and Quviq A3 (Tutorial): Practical and Portable Programming in Scheme Donovan Kolbly TippingPoint Technologies DAY 2 - 27 SEPTEMBER 2008 MORNING SESSION M4 (Tutorial): Real World Haskell Bryan O'Sullivan M5 (Talks): Ten one-liners: handling power series in Haskell Doug McIlroy Dartmouth Incremental multi-level input processing with left-fold enumerator Oleg Kiselyov How we locate wild animals with a functional program Ryan Newton MIT AFTERNOON SESSION A4 (Tutorial): Using QuickCheck and HPC - Obtaining Quality Assurance for Haskell Code Andy Gill Kansas University Koen Claessen Chalmers A5 (Tutorial): Introduction to F# Don Syme and Chris Smith Microsoft Research From ok@REDACTED Thu Aug 7 03:40:12 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 7 Aug 2008 13:40:12 +1200 Subject: [erlang-questions] EEP 14 -- Guard clarification and extension In-Reply-To: <3dbc6d1c0808060929v189fd097n62c44f930f00dda8@mail.gmail.com> References: <3dbc6d1c0808060929v189fd097n62c44f930f00dda8@mail.gmail.com> Message-ID: On 7 Aug 2008, at 4:29 am, Robert Virding wrote: > I definitely approve of this EEP. Purr. > I would like to extend this to allow a guard match in list > comprehensions as well. That's in EEP 12. From ok@REDACTED Thu Aug 7 03:53:41 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 7 Aug 2008 13:53:41 +1200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> Message-ID: On 7 Aug 2008, at 6:10 am, Gustavo Niemeyer wrote: > - Allowing the last block to have a semi-colon on if/case/receive/etc. No, where you want the optional semicolon is the FIRST case. case E0 of ; P1 -> B1 ; ... ; Pn -> Bn end Someone else has already asked for multi-pattern case &c, so case E0 of ; P11 ; P12 -> B1 ; P22 ; P23 -> B2 ... ; Pn -> Bn end Part of what is at stake here is that in Erlang the semicolon is NEVER a terminator. It's an operator. Operators can be prefix as well as infix, so a leading semicolon doesn't spoil the "semicolon is an operator" idea. However, start treating semicolon as a terminator, and you will encourage people to make the mistake of writing semicolons when they mean commas. I know I can make that kind of mistake, which is why I always put semicolons at the beginning of lines and commas at the ends. Concerning [1,2,] and {3,4,}, I am aware that C allows an extra comma in some kinds of list, and I've used that feature. There are at least three situations: (a) You are typing something like this. It is easy to bend any decent text editor so that if you press the ']' or '}' key it will erase a preceding ','. (Doing this in the presence of comments is not so easy, but at least Erlang comments are confined to a single line.) (b) You are editing existing code and want to swap things. The editor I use has "swap terms" commands that leave the punctuation marks where they are and moves what's between them. This is useful in C, Pascal, Fortran, Ada, Eiffel, Prolog, ooh, such a lot of languages as well as Erlang. (c) You are reading someone else's code. I don't believe trailing commas are a help here. My point here is that *some* issues (lists separated by commas, or for that matter semicolons) crop up in lots of languages, so that editor support has much higher payoff than support in specific programming languages. And another point is that if you have a decent editor you don't have to wait for the Erlang community to decide you are right in order to get the same practical benefits you are hoping for. Maybe enough other people agree with you that this change will happen. In the mean time, there is no need for you to suffer. -- If stupidity were a crime, who'd 'scape hanging? From ttmrichter@REDACTED Thu Aug 7 04:17:10 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Thu, 07 Aug 2008 10:17:10 +0800 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> Message-ID: <1218075431.5005.6.camel@isolde> On Wed, 2008-08-06 at 14:15 -0700, Kevin Scaldeferri wrote: > > I'm not sure I agree with the statement quoted by Michael that FP > > doesn't have the shortcomings of OO so GoF-like patterns aren't > > necessary. > Yeah, functional programming has _different_ patterns, not no > patterns. And, in some sense they also highlight shortcomings. > For example, functional languages typically do not have lists that you > can append to efficiently, so we need the "Accumulate and Reverse" > pattern. > Erlang doesn't allow you to enumerate the messages a process can > receive, so we have a "Hide Message-Passing Behind Functions" pattern. These would fall more under the heading of "idioms" than GoF-style patterns in my books (although the latter of the two is in the same grey space I mention below). The equivalent in C++, to contrast to the GoF-style patterns, would be the use of auto_ptr in functions to make up for C++'s lack of decent memory management. Some of the GoF patterns (I'm looking at you here, Singleton!) verge on the idiom level, but in general they're architectural constructs, not coding tricks. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) We should sell bloat credits, the way the government sells pollution credits. Everybody's assigned a certain amount of bloat, and if they go over, they have to purchase bloat credits from some other group that's been more careful. (Bent Hagemark) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From kevin@REDACTED Thu Aug 7 04:14:09 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 6 Aug 2008 19:14:09 -0700 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> Message-ID: <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> On Aug 6, 2008, at 6:53 PM, Richard A. O'Keefe wrote: > (b) You are editing existing code and want to swap things. > > The editor I use has "swap terms" commands that leave the > punctuation marks where they are and moves what's between them. > This is useful in C, Pascal, Fortran, Ada, Eiffel, Prolog, ooh, > such a lot of languages as well as Erlang. There's also the desire to have diffs only display important changes, not insignificant things like the addition or removal of a line terminator/separator. Is this worth changing the language for? Eh, probably not. But if you were designing from scratch, it's one of those nice little things. (Of course, one could also dream for something more sophisticated than the ubiquitous line-oriented diff tools.) -kevin From kevin@REDACTED Thu Aug 7 04:34:53 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 6 Aug 2008 19:34:53 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <1218075431.5005.6.camel@isolde> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> <1218075431.5005.6.camel@isolde> Message-ID: <447C62A4-559D-4964-968A-E7684D8C6711@scaldeferri.com> On Aug 6, 2008, at 7:17 PM, Michael T. Richter wrote: > > These would fall more under the heading of "idioms" than GoF-style > patterns in my books (although the latter of the two is in the same > grey space I mention below). Indeed, it's tough to say exactly what the distinctions are between "idioms", "design patterns", and "best practices". And what is idiom in one language may be a pattern in another. -kevin From jwecker@REDACTED Thu Aug 7 05:18:34 2008 From: jwecker@REDACTED (Joseph Wecker) Date: Wed, 06 Aug 2008 21:18:34 -0600 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <447C62A4-559D-4964-968A-E7684D8C6711@scaldeferri.com> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> <1218075431.5005.6.camel@isolde> <447C62A4-559D-4964-968A-E7684D8C6711@scaldeferri.com> Message-ID: <489A698A.9000205@entride.com> I found the following interesting as applied to Erlang simulations: http://osmirrors.cerias.purdue.edu/pub/FreeBSD/ports/local-distfiles/olgeni/master_thesis_patterns.pdf -Joseph From ttmrichter@REDACTED Thu Aug 7 06:01:44 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Thu, 07 Aug 2008 12:01:44 +0800 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <447C62A4-559D-4964-968A-E7684D8C6711@scaldeferri.com> References: <3D5BCD80-6B7D-4F22-BA17-AEA013A3BE5A@hypotheticalabs.com> <519F4325-F2D0-41D4-9A85-14470F3657E2@scaldeferri.com> <1218075431.5005.6.camel@isolde> <447C62A4-559D-4964-968A-E7684D8C6711@scaldeferri.com> Message-ID: <1218081704.5005.16.camel@isolde> On Wed, 2008-08-06 at 19:34 -0700, Kevin Scaldeferri wrote: > > These would fall more under the heading of "idioms" than GoF-style > > patterns in my books (although the latter of the two is in the same > > grey space I mention below). > Indeed, it's tough to say exactly what the distinctions are between > "idioms", "design patterns", and "best practices". And what is idiom > in one language may be a pattern in another. Well, I guess it's the same as the difference between tactical, operational or strategic command: scope of focus. To me an "idiom" involves a pretty local, narrow focus. The canonical C ++ example is the auto_ptr while the canonical Ruby example would be the ||= initialization trick. A "pattern" on the other hand has broader scope that impacts the way the whole is built and functions. Even the Singleton pattern that I squint at as something that is perhaps not quite a "pattern" in my books impacts several things application-wide (specifically the way one or more objects are made). Another one that I squint at suspiciously -- the Class Factory -- falls too into this. Use of this pattern affects the way everything else that interacts with it has to be coded. This is in no way the case (except for the missing bugs, naturally) when you look at auto_ptr or ||=. As to "best practices" -- I find those to be generally social constructs that impact code, not architectural elements. But yes, I agree fully that an idiom in one language is a pattern in another. The GoF Iterator and Visitor are such beasts. In C++ or Java they're patterns. In Eiffel or Dylan they're idioms. In Haskell they're so trivial you don't think about them as anything special beyond "it's the way you do it". The OP did bring up an interesting point: I have to confess that I now disagree with the reference I sent that said you don't need GoF-style patterns in the functional world. The OTP is a collection of GoF-style patterns for Erlang. It's just way more abstract and sophisticated a pattern and I failed to see the forest for the trees as a result. Monads in Haskell are the same deal, as are the various continuation-passing approaches in various functional languages. I stand, hereby, corrected. -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) Never, ever, ever let systems-level engineers do human interaction design unless they have displayed a proven secondary talent in that area. Their opinion of what represents good human-computer interaction tends to be a bit off-track. (Bruce Tognazzini) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From johnswolter@REDACTED Thu Aug 7 06:39:01 2008 From: johnswolter@REDACTED (john s wolter) Date: Thu, 7 Aug 2008 00:39:01 -0400 Subject: [erlang-questions] scalaris code posted In-Reply-To: <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> References: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> Message-ID: <24bcf1860808062139lc34c76ai15d154cfcc19bfce@mail.gmail.com> Cool. One application of this could be planet scale changing data sets of satellite imaging data. The Chicago commodities companies also are always combing through mountains weather data for chop predictions. Have you heard about Hadoop distributed files system? http://hadoop.apache.org/ http://en.wikipedia.org/wiki/Hadoop On Wed, Aug 6, 2008 at 6:42 PM, ERLANG wrote: > Hi guys, > > I found this interesting framework about scalable, reliable and > maximum performance > data storage system called "Hypertable" : > > http://hypertable.org > > It's based on Google BigTable concept, but it's open source ;-) > > enjoy reading > > Y. > > Le 23 juil. 08 ? 23:07, Joe Armstrong a ?crit : > > > I just got mail to say the scalaris code is posted > > > > http://code.google.com/p/scalaris > > > > I've update my blog > > > > > http://armstrongonsoftware.blogspot.com/2008/06/itching-my-programming-nerve.html > > > > /Joe Armstrong > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- John S. Wolter President Wolter Works Mailto:johnswolter@REDACTED Desk 1-734-665-1263 Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Aug 7 07:19:41 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 7 Aug 2008 17:19:41 +1200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> Message-ID: <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> On 7 Aug 2008, at 2:14 pm, Kevin Scaldeferri wrote: > There's also the desire to have diffs only display important > changes, not insignificant things like the addition or removal of a > line terminator/separator. Is this worth changing the language > for? Eh, probably not. But if you were designing from scratch, > it's one of those nice little things. Suppose you have X ] and you change this to X, Y ] The *number* of diffs does not change, there is only an extra line in the diff. I actually find it useful that this extra line appears, because it gives me a wee bit of context: Y didn't just appear somewhere, it appeared after X. The converse change has the same property: the *number* of diffs doesn't change, it's just that one extra line appears, and I find that extra line helpful. YMMV. From kevin@REDACTED Thu Aug 7 07:27:41 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 6 Aug 2008 22:27:41 -0700 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> Message-ID: <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> On Aug 6, 2008, at 10:19 PM, Richard A. O'Keefe wrote: > On 7 Aug 2008, at 2:14 pm, Kevin Scaldeferri wrote: >> There's also the desire to have diffs only display important >> changes, not insignificant things like the addition or removal of a >> line terminator/separator. Is this worth changing the language >> for? Eh, probably not. But if you were designing from scratch, >> it's one of those nice little things. > > Suppose you have > X > ] > and you change this to > X, > Y > ] > The *number* of diffs does not change, there is only an extra line > in the diff. The point is that you could have changed: X, ] to X, Y, ] and then only one line changed. > > I actually find it useful that this extra line appears, because it > gives me a > wee bit of context: Y didn't just appear somewhere, it appeared > after X. If you want a context diff, ask for a context diff. As I said, this is a pretty minor issue, but it's a minor issue many people will mention. -kevin From erlangy@REDACTED Thu Aug 7 09:16:02 2008 From: erlangy@REDACTED (ERLANG) Date: Thu, 7 Aug 2008 09:16:02 +0200 Subject: [erlang-questions] scalaris code posted In-Reply-To: <24bcf1860808062139lc34c76ai15d154cfcc19bfce@mail.gmail.com> References: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> <24bcf1860808062139lc34c76ai15d154cfcc19bfce@mail.gmail.com> Message-ID: Hi, > Cool. One application of this could be planet scale changing data > sets of satellite imaging data. The Chicago commodities companies > also are always combing through mountains weather data for chop > predictions. > > Have you heard about Hadoop distributed files system? > > http://hadoop.apache.org/ > http://en.wikipedia.org/wiki/Hadoop > We used Hadoop extensively with Nutch (a FullText Search Engine) during the last years. Hadoop, Nutch, and Lucene ... were all imagined by one person : Doug Cutting. To be honest, Hadoop's was really a pain and the performance wasn't as good as we expected ( lot of Java process crash after days of indexation and needed to be fixed manually. That was a challenge for us). Anyway, Hadoop basics are simple and one can come up with an Erlang implementation easily. Y. > On Wed, Aug 6, 2008 at 6:42 PM, ERLANG wrote: > Hi guys, > > I found this interesting framework about scalable, reliable and > maximum performance > data storage system called "Hypertable" : > > http://hypertable.org > > It's based on Google BigTable concept, but it's open source ;-) > > enjoy reading > > Y. > > Le 23 juil. 08 ? 23:07, Joe Armstrong a ?crit : > > > I just got mail to say the scalaris code is posted > > > > http://code.google.com/p/scalaris > > > > I've update my blog > > > > http://armstrongonsoftware.blogspot.com/2008/06/itching-my-programming-nerve.html > > > > /Joe Armstrong > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > John S. Wolter President > Wolter Works > Mailto:johnswolter@REDACTED > Desk 1-734-665-1263 > Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From gustavo@REDACTED Thu Aug 7 13:49:44 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Thu, 7 Aug 2008 08:49:44 -0300 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> Message-ID: <643d90130808070449h65dcab75m7d8d021164b90fc1@mail.gmail.com> Hello Richard, > No, where you want the optional semicolon is the FIRST case. (...) Thanks for presenting your view on these issues. I specially appreciate the POV about the semicolon being an operator. Having the optional semicolon at the front seems to work equally well indeed. > Concerning [1,2,] and {3,4,}, I am aware that C allows an extra > comma in some kinds of list, and I've used that feature. > There are at least three situations: (...) The situation I refer to is indeed swapping entries (copy & paste) and introducing new elements at the end without having to touch the previous line. > you are hoping for. Maybe enough other people agree with you > that this change will happen. Some of it may indeed be automated with a good editor, and some things like unifying comprehensions are a bit trickier. > In the mean time, there is no need for you to suffer. I don't actually suffer too much. Partly because I just get used to it, and partly because things will improve over time one way or the other. In this specific case I'm just adding to the statistics so that the stakeholders here have some data to work with. I'm pretty sure I'm not pointing out anything that they didn't already have in the back of their minds. Thanks for taking the time to bring these details up. -- Gustavo Niemeyer http://niemeyer.net From florian.ebeling@REDACTED Thu Aug 7 15:58:17 2008 From: florian.ebeling@REDACTED (Caspar Florian Ebeling) Date: Thu, 7 Aug 2008 15:58:17 +0200 Subject: [erlang-questions] file:sync problems on Mac OS X Message-ID: <5cbbe4ae0808070658l2f20433bxbc34c61a50928316@mail.gmail.com> Hi, there are problems with the kernel function file:sync/1 on the Mac. It actually does not really syncs out to the disk, because the call does not make guarantees on the Mac. There is a patch mail form Jan Lehnhardt on the patch list, which also references the relevant Mac man pages: http://www.erlang.org/pipermail/erlang-patches/2008-July/000258.html Technically, this is not a bug though, because the file:sync/1 documentation says explicitly, that this call might not have any effects on some systems. The experience from the CouchDB people suggests, though, that the functionality is quite essential when you use any disk persistence you care about, like in databases. The fsync(2) man page from OS X mentions this use case explicitly. What is the take of the OTP team on this? Is there a chance that this will be changed or that this patch from the above mail gets incorporated? Can this be filed as a bug even though currently implemented behaviour is not conflivting with documentation? I had the problem in a rather simple test case, so this is not something that theoretically happens in an esoteric edge case, but quite a real problem, it seams. I'm also a member of the MacPorts project, and there we have a local patch applied to change this, but it would be good to solve this at the right place. (I'm not the erlang maintainer over there, but I currently use it a lot.) Thanks, Florian -- Florian Ebeling florian.ebeling@REDACTED From bjorn@REDACTED Thu Aug 7 16:19:58 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Aug 2008 16:19:58 +0200 Subject: [erlang-questions] file:sync problems on Mac OS X In-Reply-To: <5cbbe4ae0808070658l2f20433bxbc34c61a50928316@mail.gmail.com> References: <5cbbe4ae0808070658l2f20433bxbc34c61a50928316@mail.gmail.com> Message-ID: "Caspar Florian Ebeling" writes: > What is the take of the OTP team on this? Is there a chance that this > will be changed > or that this patch from the above mail gets incorporated? Can this be > filed as a bug > even though currently implemented behaviour is not conflivting with > documentation? We will probably include the patch in R12B-4. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From florian.ebeling@REDACTED Thu Aug 7 16:40:54 2008 From: florian.ebeling@REDACTED (Caspar Florian Ebeling) Date: Thu, 7 Aug 2008 16:40:54 +0200 Subject: [erlang-questions] file:sync problems on Mac OS X In-Reply-To: References: <5cbbe4ae0808070658l2f20433bxbc34c61a50928316@mail.gmail.com> Message-ID: <5cbbe4ae0808070740x4e9d37fbk362d4533a9ddc375@mail.gmail.com> On Thu, Aug 7, 2008 at 4:19 PM, Bjorn Gustavsson wrote: > "Caspar Florian Ebeling" writes: > >> What is the take of the OTP team on this? Is there a chance that this >> will be changed >> or that this patch from the above mail gets incorporated? Can this be >> filed as a bug >> even though currently implemented behaviour is not conflivting with >> documentation? > > We will probably include the patch in R12B-4. Ok, that's really sounds good, thanks. Florian -- Florian Ebeling florian.ebeling@REDACTED From johnswolter@REDACTED Thu Aug 7 16:58:53 2008 From: johnswolter@REDACTED (john s wolter) Date: Thu, 7 Aug 2008 10:58:53 -0400 Subject: [erlang-questions] scalaris code posted In-Reply-To: References: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> <24bcf1860808062139lc34c76ai15d154cfcc19bfce@mail.gmail.com> Message-ID: <24bcf1860808070758l15d1e950q6f1f01b71446881b@mail.gmail.com> Oh, that sounds bad. I'll look into hypertable, maybe I can see someone on a project using it. Most customers always go with what they know, right or Wrong. On Thu, Aug 7, 2008 at 3:16 AM, ERLANG wrote: > Hi, > > Cool. One application of this could be planet scale changing data sets of > satellite imaging data. The Chicago commodities companies also are always > combing through mountains weather data for chop predictions. > > Have you heard about Hadoop distributed files system? > > http://hadoop.apache.org/ > http://en.wikipedia.org/wiki/Hadoop > > > We used Hadoop extensively with Nutch (a FullText Search Engine) during the > last years. > Hadoop, Nutch, and Lucene ... were all imagined by one person : Doug > Cutting. > > To be honest, Hadoop's was really a pain and the performance wasn't as good > as we expected ( > lot of Java process crash after days of indexation and needed to be fixed > manually. That was a challenge for us). > Anyway, Hadoop basics are simple and one can come up with an Erlang > implementation easily. > > Y. > > On Wed, Aug 6, 2008 at 6:42 PM, ERLANG wrote: > >> Hi guys, >> >> I found this interesting framework about scalable, reliable and >> maximum performance >> data storage system called "Hypertable" : >> >> http://hypertable.org >> >> It's based on Google BigTable concept, but it's open source ;-) >> >> enjoy reading >> >> Y. >> >> Le 23 juil. 08 ? 23:07, Joe Armstrong a ?crit : >> >> > I just got mail to say the scalaris code is posted >> > >> > http://code.google.com/p/scalaris >> > >> > I've update my blog >> > >> > >> http://armstrongonsoftware.blogspot.com/2008/06/itching-my-programming-nerve.html >> > >> > /Joe Armstrong >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > John S. Wolter President > Wolter Works > Mailto:johnswolter@REDACTED > Desk 1-734-665-1263 > Cell: 1-734-904-8433 > > > -- John S. Wolter President Wolter Works Mailto:johnswolter@REDACTED Desk 1-734-665-1263 Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrickdlogan@REDACTED Thu Aug 7 19:22:56 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Thu, 7 Aug 2008 10:22:56 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? Message-ID: "The OTP is a collection of GoF-style patterns for Erlang." I think this list, as well as the softwate community as a whole, has lost sight of the original intent of the "patterns movement". The original intent of a "pattern" is the format of the information, more than the information per se. The format should be written in (one of several) pattern styles. The overall presentation of some set of patterns should form a "patterns language". So to say the "OTP is a collection of patterns" is true only in the worst definition of "pattern". A really useful pattern language for OTP would guide the programmer from some initial kind of problem through the application of some patterns that address that problem and associated forces that would direct the programmer through a set of choices and partial solutions, toward an overall solution. And stuff. From kevin@REDACTED Thu Aug 7 19:41:00 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 7 Aug 2008 10:41:00 -0700 Subject: [erlang-questions] scalaris code posted In-Reply-To: <24bcf1860808070758l15d1e950q6f1f01b71446881b@mail.gmail.com> References: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> <9C4EAF77-49E5-42D5-B949-00E3CCD5048E@gmail.com> <24bcf1860808062139lc34c76ai15d154cfcc19bfce@mail.gmail.com> <24bcf1860808070758l15d1e950q6f1f01b71446881b@mail.gmail.com> Message-ID: <277ED4DC-BF00-4F92-BAF0-8693CAF62E09@scaldeferri.com> On Aug 7, 2008, at 7:58 AM, john s wolter wrote: > Oh, that sounds bad. I'll look into hypertable, maybe I can see > someone on a project using it. Most customers always go with what > they know, right or Wrong. > My anecdotal 2c: I went to a couple talks on these projects at OSCON a couple weeks ago. As for Hadoop, the NYT had some great success using Hadoop and EC2/S3 to do a bunch of image processing, and they plan to continue using it. Also Hadoop just pulled ahead on the TB sort challenge, so at least for some tasks it's pretty fast. (BTW, having Hadoop jobs that run continuously for days sounds odd to me. The whole point is to parallelize so you can do in hours or minutes what would have taken days.) Hypertable looks interesting but immature. Nearly every question from the audience was answered, "well, we're still working on that". Hadoop and Hypertable are not competing projects. They provide distinct services. >> Anyway, Hadoop basics are simple and one can come up with an Erlang >> implementation easily. >> Sure, about a million bloggers have written their own "MapReduce". Just remember, the "map" and "reduce" bits are the trivial, uninteresting part. The hard bits are reliability, fault-tolerance, cluster management, performance (i.e. having the right data in the right place at the right time), etc -kevin From devdoer2@REDACTED Thu Aug 7 20:14:24 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 8 Aug 2008 02:14:24 +0800 Subject: [erlang-questions] How to config epmd to listen on another port? Message-ID: HI: I want to config the epmd to listen on another port rather than 4369. I run the command : $/usr/lib/erlang/erts-5.6.1/bin/epmd -kill $/usr/lib/erlang/erts-5.6.1/bin/epmd -port 63123 -daemon It's ok to run the epmd .But when I open the erlang shell, a new epmd instance is running and 4369 is open again .The erlang node still connect to the epmd listening on port 4369. So how can I configure the epmd to make it run on another port? Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From galeal@REDACTED Thu Aug 7 20:32:03 2008 From: galeal@REDACTED (Luke Galea) Date: Thu, 07 Aug 2008 14:32:03 -0400 Subject: [erlang-questions] Mnesia and autogenerated ids Message-ID: <489B3FA3.2050508@ideaforge.org> Hi all, I'm trying to get my head around mnesia. It seems great so far, but I'm struggling with the lack of autogenerated ids to have one table refer to another. I'm on board with having less normalized data requiring fewer tables and thus fewer references.. But when a reference is required, is there no "easy" way to reference another table without using a natural key (like "user_name", etc)? I see that I could have a gen_server that serves up ids.. but is there a better way to do this? It seems an unnecessary bit of complexity to support if everyone ultimately needs to do this. Thanks in advance Luke Galea http://www.ideaforge.org From galeal@REDACTED Thu Aug 7 20:23:10 2008 From: galeal@REDACTED (Luke Galea) Date: Thu, 07 Aug 2008 14:23:10 -0400 Subject: [erlang-questions] Mnesia and autogenerated ids Message-ID: <489B3D8E.9000706@ideaforge.org> Hi all, I'm trying to get my head around mnesia. It seems great so far, but I'm struggling with the lack of autogenerated ids to have one table refer to another. I'm on board with having less normalized data requiring fewer tables and thus fewer references.. But when a reference is required, is there no "easy" way to reference another table without using a natural key (like "user_name", etc)? I see that I could have a gen_server that serves up ids.. but is there a better way to do this? It seems an unnecessary bit of complexity to support if everyone ultimately needs to do this. Thanks in advance Luke Galea http://www.ideaforge.org From galeal@REDACTED Thu Aug 7 20:44:50 2008 From: galeal@REDACTED (Luke Galea) Date: Thu, 07 Aug 2008 14:44:50 -0400 Subject: [erlang-questions] Mnesia and autogenerated ids Message-ID: <489B42A2.6070208@ideaforge.org> Hi all, I'm trying to get my head around mnesia. It seems great so far, but I'm struggling with the lack of autogenerated ids to have one table refer to another. I'm on board with having less normalized data requiring fewer tables and thus fewer references.. But when a reference is required, is there no "easy" way to reference another table without using a natural key (like "user_name", etc)? I see that I could have a gen_server that serves up ids.. but is there a better way to do this? It seems an unnecessary bit of complexity to support if everyone ultimately needs to do this. Thanks in advance Luke Galea http://www.ideaforge.org From sten@REDACTED Thu Aug 7 21:23:41 2008 From: sten@REDACTED (Sten Kvamme) Date: Thu, 7 Aug 2008 21:23:41 +0200 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> I have always considered anti-patterns to be more interesting than patterns. Learning from other peoples mistakes is not limiting the creativity like patterns is doing. Studying patterns and re-doing other peoples solutions is downright boring. The pattern movement started with Christoper Alexander trying to teach less great architects to create quality-without -a-name. The experiment was not successful, the less great architects could not create quality-without -a-name despite the extensive help from Christopher's patterns. /Sten Kvamme On Aug 7, 2008, at 19:22 , Patrick Logan wrote: > "The OTP is a collection of GoF-style patterns for Erlang." > > I think this list, as well as the softwate community as a whole, has > lost sight of the original intent of the "patterns movement". > > The original intent of a "pattern" is the format of the information, > more than the information per se. > > The format should be written in (one of several) pattern styles. The > overall presentation of some set of patterns should form a "patterns > language". > > So to say the "OTP is a collection of patterns" is true only in the > worst definition of "pattern". > > A really useful pattern language for OTP would guide the programmer > from some initial kind of problem through the application of some > patterns that address that problem and associated forces that would > direct the programmer through a set of choices and partial solutions, > toward an overall solution. > > And stuff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From nick@REDACTED Thu Aug 7 21:27:06 2008 From: nick@REDACTED (Nick Gerakines) Date: Thu, 7 Aug 2008 12:27:06 -0700 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: <489B3FA3.2050508@ideaforge.org> References: <489B3FA3.2050508@ideaforge.org> Message-ID: If you don't care about id consistency, as in each id can be completely different and unrelated, then use something like a UUID or hash of time + pid + seed. * http://github.com/travis/erlang-uuid/tree/master I've also seen people do something like this: guid() -> <> = crypto:sha(term_to_binary({make_ref(), now()})), erlang:integer_to_list(I, 16). If you want something like an incrementing integer then your best bet is to create a really simple gen_server module who's state refers to a dets table with records like {Name, Id} (ala [{entries, 3}, {comments, 400}]) where you can do a simple increment op for each. Mnesia also works well: -record(counter, {type, count}). object_counter(Name) -> %% Called from within a transaction [OldRecord] = mnesia:read(counter, Name, write), Count = OldRecord#counter.count + 1, NewRecord = OldRecord#counter{ count = Count }, mnesia:write(NewRecord), Count. # Nick Gerakines On Thu, Aug 7, 2008 at 11:32 AM, Luke Galea wrote: > Hi all, > > I'm trying to get my head around mnesia. It seems great so far, but > I'm struggling with the lack of autogenerated ids to have one table > refer to another. I'm on board with having less normalized data > requiring fewer tables and thus fewer references.. But when a > reference is required, is there no "easy" way to reference another > table without using a natural key (like "user_name", etc)? > > I see that I could have a gen_server that serves up ids.. but is there > a better way to do this? It seems an unnecessary bit of complexity to > support if everyone ultimately needs to do this. > > Thanks in advance > > Luke Galea > http://www.ideaforge.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dnew@REDACTED Thu Aug 7 21:38:16 2008 From: dnew@REDACTED (Darren New) Date: Thu, 07 Aug 2008 12:38:16 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> References: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> Message-ID: <489B4F28.20408@san.rr.com> Sten Kvamme wrote: > Studying patterns and re-doing > other peoples solutions is downright boring. Also, one of the main points for the Design Patterns book is not just to show you the patterns but give them names. Most of the patterns are things that were in wide use (or obvious) before the book was written. But now you can name a class BlargFactory, and people can tell just from the name what the purpose of the class is. -- Darren New / San Diego, CA, USA (PST) Ever notice how people in a zombie movie never already know how to kill zombies? Ask 100 random people in America how to kill someone who has reanimated from the dead in a secret viral weapons lab, and how many do you think already know you need a head-shot? From chsu79@REDACTED Thu Aug 7 21:57:11 2008 From: chsu79@REDACTED (Christian S) Date: Thu, 7 Aug 2008 21:57:11 +0200 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: <489B3FA3.2050508@ideaforge.org> References: <489B3FA3.2050508@ideaforge.org> Message-ID: Here are some previous threads on the same topic. http://www.erlang.org/pipermail/erlang-questions/2007-November/030532.html http://www.erlang.org/pipermail/erlang-questions/2006-June/021252.html http://www.erlang.org/ml-archive/erlang-questions/200508/msg00291.html To summarize, * use {node(), now()} as the least-effort approach * more effort: create a mnesia table {sequences, TableName, Serial} with a row per table, increment numeric id in it for a new id * even more effort, have each node allocate many ids directly, and use them up in subsequent transactions on that node before you get a chunk again. this is to lower total amount of transactions to the sequence table. If you can, there is the possibility to erlang:md5 on some data in that row record, and using the md5 as a unique primary key. On Thu, Aug 7, 2008 at 8:32 PM, Luke Galea wrote: > Hi all, > > I'm trying to get my head around mnesia. It seems great so far, but > I'm struggling with the lack of autogenerated ids to have one table > refer to another. I'm on board with having less normalized data > requiring fewer tables and thus fewer references.. But when a > reference is required, is there no "easy" way to reference another > table without using a natural key (like "user_name", etc)? > > I see that I could have a gen_server that serves up ids.. but is there > a better way to do this? It seems an unnecessary bit of complexity to > support if everyone ultimately needs to do this. > > Thanks in advance > > Luke Galea > http://www.ideaforge.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From galeal@REDACTED Thu Aug 7 22:07:36 2008 From: galeal@REDACTED (Luke Galea) Date: Thu, 07 Aug 2008 16:07:36 -0400 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: References: <489B3FA3.2050508@ideaforge.org> Message-ID: <489B5608.5060707@ideaforge.org> Thanks everyone! I'll try those methods out! Perhaps the mnesia table method can be generalized so everyone else doesn't have to re-implement it? I'm happy to give that a go and report back. From berlin.brown@REDACTED Thu Aug 7 22:13:05 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Thu, 7 Aug 2008 13:13:05 -0700 (PDT) Subject: [erlang-questions] Erlang, Cygwin and issue with crypto:start() library Message-ID: I am trying to connect to mysql and I think I am getting issue because the crypto library is not working properly. Do you guys see anything where I can check if this is working. I am mostly working with Win32, WindowsXP under Cygwin. I am looking in this directory and everything looks ok and in place. The DLL is there? C:\projects\tools\home\opt\erlang\erl5.6\lib\crypto-1.5.1.1 crypto_drv.dll Erlang download as of 7/1/2008 3> erlydb:start(mysql, [{hostname, "localhost"}, {username, "USER"}, {password, "PASSWORD"}, {database, "db"}]). =INFO REPORT==== 7-Aug-2008::16:08:34 === application: crypto exited: {shutdown,{crypto_app,start,[normal,[]]}} type: temporary mysql_conn:620: greeting version "5.0.51a-community" (protocol 10) salt "q./>+Ya ]" caps 41516 serverchar <<8,2,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0>>salt2 "PLkVM_t" =ERROR REPORT==== 7-Aug-2008::16:08:34 === Error in process <0.81.0> with exit value: {badarg,[{ets,lookup, [crypto_server_t able,port]},{crypto,control,2},{mysql_auth,password_new,2}, {mysql_auth,do_new_au th,8},{mysql_conn,mysql_init,5},{mysql_conn,init,9}]} mysql:502: failed starting first MySQL connection handler, exiting ok From sten@REDACTED Thu Aug 7 22:39:10 2008 From: sten@REDACTED (Sten Kvamme) Date: Thu, 7 Aug 2008 22:39:10 +0200 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <489B4F28.20408@san.rr.com> References: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> <489B4F28.20408@san.rr.com> Message-ID: On Aug 7, 2008, at 21:38 , Darren New wrote: > Sten Kvamme wrote: >> Studying patterns and re-doing >> other peoples solutions is downright boring. > > Also, one of the main points for the Design Patterns book is not > just to > show you the patterns but give them names. Yes, good names are very important for source code understanding. And anti-solutions with a name could also be helpful. Think about it, Cut and Paste is an anti-pattern in any language not just in erlang. When you catch yourself cutting and pasing -- from now on you will know you are doing something bad ;-) /S From zambal@REDACTED Thu Aug 7 22:57:49 2008 From: zambal@REDACTED (zambal) Date: Thu, 7 Aug 2008 13:57:49 -0700 (PDT) Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: References: <489B3FA3.2050508@ideaforge.org> Message-ID: On Aug 7, 9:57?pm, "Christian S" wrote: > To summarize, > > ?* use {node(), now()} as the least-effort approach > > ?* more effort: create a mnesia table {sequences, TableName, Serial} > with a row per table, increment numeric id in it for a new id > > ?* even more effort, have each node allocate many ids directly, and > use them up in subsequent transactions on that node before you get a > chunk again. this is to lower total amount of transactions to the > sequence table. > > If you can, there is the possibility to erlang:md5 on some data in > that row record, and using the md5 as a unique primary key. If the only requirement of an ID is to be unique, why would you choose for another method than using now()? Or in other words, what are possible drawbacks of using now() as a unique ID generator? Best, Vincent From ulf@REDACTED Thu Aug 7 23:19:31 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 7 Aug 2008 23:19:31 +0200 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: References: <489B3FA3.2050508@ideaforge.org> Message-ID: <8209f740808071419n713cea9fo4f9a745b797c3f5@mail.gmail.com> 2008/8/7 zambal : > > > If the only requirement of an ID is to be unique, why would you choose > for another method than using now()? > > Or in other words, what are possible drawbacks of using now() as a > unique ID generator? Now is guaranteed to be unique on a given node, while that node is running. Two different nodes can easily* generate the same now() value. That's why {node(), now()} is used. Of course, if the node is restarted and the system clock is altered, you can still have duplication of IDs*. This problem can be addressed by using NTP against a reliable time reference. * Since now() has microsecond resolution, the probability is likely small, unless IDs are created at a fearsome rate. BR, Ulf W From anders.nygren@REDACTED Thu Aug 7 23:39:43 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 7 Aug 2008 16:39:43 -0500 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> <489B4F28.20408@san.rr.com> Message-ID: On Thu, Aug 7, 2008 at 3:39 PM, Sten Kvamme wrote: > > On Aug 7, 2008, at 21:38 , Darren New wrote: > >> Sten Kvamme wrote: >>> Studying patterns and re-doing >>> other peoples solutions is downright boring. >> >> Also, one of the main points for the Design Patterns book is not >> just to >> show you the patterns but give them names. > > Yes, good names are very important for source code understanding. And > anti-solutions with a name could also be helpful. Think about it, Cut > and Paste is an anti-pattern in any language not just in erlang. When > you catch yourself cutting and pasing -- from now on you will know > you are doing something bad ;-) > Sorry, I thought CUT and Paste was the older name for refactoring. :) COPY and Paste, on the other hand is evil. /Anders From raould@REDACTED Thu Aug 7 23:39:50 2008 From: raould@REDACTED (Raoul Duke) Date: Thu, 7 Aug 2008 14:39:50 -0700 Subject: [erlang-questions] error message massage project? Message-ID: <91a2ba3e0808071439k5aa53d7wcf1eeb029cb7edc6@mail.gmail.com> i have no significant fund$, but i'd certainly buy somebody a beer if they worked on making open source erlang error messages more scrutable. any such projects in the works? :-) From kevin@REDACTED Thu Aug 7 23:56:18 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 7 Aug 2008 14:56:18 -0700 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: References: <489B3FA3.2050508@ideaforge.org> Message-ID: <79F33111-D4C2-4B4E-B465-104385B329D1@scaldeferri.com> On Aug 7, 2008, at 1:57 PM, zambal wrote: > If the only requirement of an ID is to be unique, why would you choose > for another method than using now()? > > Or in other words, what are possible drawbacks of using now() as a > unique ID generator? I could imagine security or privacy concerns in some applications. -kevin From kevin@REDACTED Thu Aug 7 23:57:59 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 7 Aug 2008 14:57:59 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> References: <98921200-6AA7-4849-B890-8657755A2E48@kvamme.se> Message-ID: On Aug 7, 2008, at 12:23 PM, Sten Kvamme wrote: > I have always considered anti-patterns to be more interesting than > patterns. Learning from other peoples mistakes is not limiting the > creativity like patterns is doing. Studying patterns and re-doing > other peoples solutions is downright boring. So, why are we programming in Erlang and not C or assembly then? -k From zambal@REDACTED Fri Aug 8 00:36:44 2008 From: zambal@REDACTED (zambal) Date: Thu, 7 Aug 2008 15:36:44 -0700 (PDT) Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: <8209f740808071419n713cea9fo4f9a745b797c3f5@mail.gmail.com> References: <489B3FA3.2050508@ideaforge.org> <8209f740808071419n713cea9fo4f9a745b797c3f5@mail.gmail.com> Message-ID: On Aug 7, 11:19?pm, "Ulf Wiger" wrote: > Now is guaranteed to be unique on a given node, while that node is > running. Two different nodes can easily* generate the same now() > value. That's why {node(), now()} is used. > > Of course, if the node is restarted and the system clock is altered, > you can still have duplication of IDs*. This problem can be addressed > by using NTP against a reliable time reference. Thanks for the explanation. So if you would have one node that is responsible generating new id's and all other nodes in your application query this node, is there any other reason to not use now()? Best, Vincent From monch1962@REDACTED Fri Aug 8 00:53:16 2008 From: monch1962@REDACTED (David Mitchell) Date: Fri, 8 Aug 2008 08:53:16 +1000 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: I think Patrick makes several good points here, as do others in this thread. Maybe the ideal format for an Erlang book on "design patterns" is along the lines of the "Ruby Cookbook", "Perl Cookbook", "Python Cookbook" and probably many other books covering other languages that have been released by O'Reilly. In a nutshell, they're just full of sample code. Each example puts forward a fairly specific problem (e.g. "How do I reverse a string?", "How do I create a UDP server?", "How can I convert an integer to Roman numerals?") that is really just a good example of a much larger set of generic problems. This gets highlighted, then there's a code sample that outlines a "good" solution to the problem, then there's a discussion of how the solution works and what makes it "good". They rarely discuss things in terms of "patterns" or "pattern names", although I seem to recall "Singleton" making an appearance on occasion. Instead, the focus is on letting the reader recognise when they're facing one of these types of generic problems, and giving them an approach to deal with it. Maybe that's what the Erlang "design patterns" book should look like. If there's not a broad set of useful Erlang design patterns, and I'm not sure whether I agree with this or not, a set of cookbook-style examples could be the best approach to take for getting this information around. Hmm, that's about all my brain can handle this early in the morning... So who's up for writing the "Erlang Cookbook"? ;-> Dave M. 2008/8/8 Patrick Logan : > "The OTP is a collection of GoF-style patterns for Erlang." > > I think this list, as well as the softwate community as a whole, has > lost sight of the original intent of the "patterns movement". > > The original intent of a "pattern" is the format of the information, > more than the information per se. > > The format should be written in (one of several) pattern styles. The > overall presentation of some set of patterns should form a "patterns > language". > > So to say the "OTP is a collection of patterns" is true only in the > worst definition of "pattern". > > A really useful pattern language for OTP would guide the programmer > from some initial kind of problem through the application of some > patterns that address that problem and associated forces that would > direct the programmer through a set of choices and partial solutions, > toward an overall solution. > > And stuff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mike@REDACTED Fri Aug 8 01:10:52 2008 From: mike@REDACTED (Mike Nolta) Date: Thu, 7 Aug 2008 19:10:52 -0400 Subject: [erlang-questions] Beginner: "sh: line 0: exec: inet_gethost: not found" Message-ID: Hi, I have what appears to be a trivial problem, but I'm not sure how to fix it. First off, I'm running ubuntu 7.10, and my erlang installation is completely vanilla R12B (download, ./configure, make install). Seems to work fine, aside from the following problem. I'm trying to setup an erlang node which starts on boot. So I followed the instructions in: http://www.erlang.org/doc/embedded/embedded_solaris.html I took the "S75otp.system" file described therein, dropped it in /etc/init.d/, and pointed it at the "/usr/local/lib/erlang/bin/start" file. I made some minor modifications, like changing /usr/bin/ps -> /bin/ps in the init.d file, and changed the log directory. And everything works great. It starts on boot, and I can connect to it from other erlang nodes, even from other machines. But if I look in the erlang.log.N files, it's constantly printing: sh: line 0: exec: inet_gethost: not found over and over again, thousands of times a minute. It's causing a performance hit to my system; some of my other jobs now take twice as long to run. As I understand it, inet_gethost is a port program called by beam. The binary does exist on my system, in/usr/local/lib/erlang/erts-5.6.3/bin/. I don't know if this is relevant, but if I start up an erl session and call inet_gethost_native:gethostbyname(), it works fine. This should be easy to fix, it just looks like a path issue. But I tried putting the erts-5.6.3/bin/ directory in PATH and that didn't fix it. Any advice would be greatly appreciated. Thanks, -Mike From ok@REDACTED Fri Aug 8 01:11:50 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Aug 2008 11:11:50 +1200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> Message-ID: <71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz> On 7 Aug 2008, at 5:27 pm, Kevin Scaldeferri wrote: > The point is that you could have changed: > > X, > ] > to > X, > Y, > ] > > and then only one line changed. That was obvious, and as my reply showed, it was clearly understood. The NUMBER of changes is entirely unaffected. The SIZE of the reported change increases by exactly one line, AND that extra line helps. If you are using context diffs, which is usually a good idea, you probably won't even notice the extra line. Note that the ONLY place that C allows an extra comma is in an initialiser. Suppose for example I have OLD NEW void f( void f( int x int x, char *y ) { ) { ... ... } } I added *one* parameter to the argument list of f(), but *two* lines changed. (For the record, whenever an argument list in C is too long to fit on one line, this is indeed how I lay it out. After years of experiment, I have to say that this seems to be the perfect way to do it. It also works in Java, Pascal, Ada, any free- format language.) It's exactly the same "problem", but do I hear lots of complaints about C because of it? C doesn't allow trailing commas in function calls. C doesn't allow trailing commas in comma expressions. C doesn't allow trailing commas in declarations: extern void f(void), g(void); => extern void f(void), g(void), h(void); One prototype added to the list, two lines changed. It's exactly the same "problem", but do I hear lots of complaints about C because of it? Perl and Python allow trailing commas in tuples, lists, and function calls. In Python, the idiom (x,) for a 1-element tuple is used heavily. Curiously, while trailing commas in lists *are* used, they are very often used like x = ["foo","bar","ugh",] (I've just been trawling through *thousands* of Python files) where the trailing comma does NOT help in the way envisaged. Python is definitely evidence that a language *can* allow trailing commas without collapsing into an evil-smelling heap. Pascal, Ada, Modula-2, Fortran 90 and later, AWK, none of these allow trailing commas. Like C, Java allows trailing commas in array initialisers (JLS 3rd edition, section 10.6), but not elsewhere. I don't hear lots of people complaining about the fact that turning String x, y; into String x, y, z; results in a 1-change 2-line diff instead of a 1-change 1-line diff using Java. And Javascript is another: trailing commas are allowed in arrays and "objects", but not in declarations or calls. > As I said, this is a pretty minor issue, but it's a minor issue many > people will mention. > Why will "many" people be bothered about this in Erlang, when they apparently aren't bothered by it in C or Java or Javascript? Why is the "add one thing -> diff should be one line" idea so important for changes to data constructors but ONLY data constructors? -- If stupidity were a crime, who'd 'scape hanging? From kevin@REDACTED Fri Aug 8 01:54:39 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Thu, 7 Aug 2008 16:54:39 -0700 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: <60519300-5350-43A1-8065-D13B55E70C86@scaldeferri.com> On Aug 7, 2008, at 3:53 PM, David Mitchell wrote: > I think Patrick makes several good points here, as do others in this > thread. > > Maybe the ideal format for an Erlang book on "design patterns" is > along the lines of the "Ruby Cookbook", "Perl Cookbook", "Python > Cookbook" and probably many other books covering other languages that > have been released by O'Reilly. > > ... > > So who's up for writing the "Erlang Cookbook"? ;-> My understanding is that it's well underway, possibly approaching completion. -kevin From ok@REDACTED Fri Aug 8 02:39:10 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Aug 2008 12:39:10 +1200 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: References: Message-ID: <7546D232-E090-4BBF-9EA2-017E174DEA2D@cs.otago.ac.nz> On 8 Aug 2008, at 10:53 am, David Mitchell wrote: > I think Patrick makes several good points here, as do others in this > thread. > > Maybe the ideal format for an Erlang book on "design patterns" is > along the lines of the "Ruby Cookbook", "Perl Cookbook", "Python > Cookbook" and probably many other books covering other languages that > have been released by O'Reilly. Er, we *have* an Erlang cookbook. http://www.trapexit.org/Category:CookBook Certainly it's far from exhaustive, but maybe we could improve it? Perhaps someone might like to add a recipe 'Unique keys' that explains about {now(),node()}. From dnew@REDACTED Fri Aug 8 04:08:17 2008 From: dnew@REDACTED (Darren New) Date: Thu, 07 Aug 2008 19:08:17 -0700 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> <71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz> Message-ID: <489BAA91.4050308@san.rr.com> Richard A. O'Keefe wrote: > It's exactly the same "problem", but do I hear lots of > complaints about C because of it? I gripe about it every time I get it wrong in SQL. My chances of changing C or SQL syntax are low. Perhaps the people who complain are those hoping one could actually *improve* it in more modern languages. > I don't hear lots of people complaining about the fact > that turning > String x, > y; > into String x, > y, > z; > results in a 1-change 2-line diff instead of a > 1-change 1-line diff using Java. Perhaps because people write String x; String y; String z; instead. Or perhaps because a change of this type is always accompanied by usually-numerous related changes elsewhere, while a change in a declaration is often close to stand-alone. > Why will "many" people be bothered about this in Erlang, > when they apparently aren't bothered by it in C or Java > or Javascript? What makes you think they're not? That they're not posting their complaints about Java on an Erlang mailing list? > Why is the "add one thing -> diff should be one line" > idea so important for changes to data constructors but > ONLY data constructors? Because data constructors often stand alone with no further change needed (if you're doing data-driven programming), while changes to method declarations require changes to all the callers as well? If I have a "list of files which should exist before I run this function", I can add files to it without changing the code that runs through the list. If I add "and here's the permissions the files should have", I need to change several places in the code. -- Darren New / San Diego, CA, USA (PST) Ever notice how people in a zombie movie never already know how to kill zombies? Ask 100 random people in America how to kill someone who has reanimated from the dead in a secret viral weapons lab, and how many do you think already know you need a head-shot? From ok@REDACTED Fri Aug 8 05:42:10 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Aug 2008 15:42:10 +1200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <489BAA91.4050308@san.rr.com> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> <71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz> <489BAA91.4050308@san.rr.com> Message-ID: On 8 Aug 2008, at 2:08 pm, Darren New wrote: >> Why will "many" people be bothered about this in Erlang, >> when they apparently aren't bothered by it in C or Java >> or Javascript? > > What makes you think they're not? That they're not posting their > complaints about Java on an Erlang mailing list? This is hardly the only mailing list I am on. I was part of the comp.std.c community for many years. Amongst all the issues raised, this never turned up. > > >> Why is the "add one thing -> diff should be one line" >> idea so important for changes to data constructors but >> ONLY data constructors? > > Because data constructors often stand alone with no further change > needed (if you're doing data-driven programming), while changes to > method declarations require changes to all the callers as well? Good point. But let's remind ourselves what we are talking about. If people write Files = [ 'foo.bar', 'ick.ack' ], ... then there is an issue which allowing trailing commas would solve. If, on the other hand, they write Files = [ 'foo.bar', 'ick.ack'], ... then trailing commas are not going to help. I count about 5000 lines beginning with ] or } in the Erlang sources; about one every 110 lines. "C-like" rather than "Lisp-like" seems to be a common convention for records and -record declarations. You haven't persuaded me, but those numbers have. Erlang/OTP sources => people DO have lots of stuff where trailing commas would be sensible. Python => it doesn't spoil a nice language much to do it. Write an EEP and get it on record then. From silvester.roessner@REDACTED Fri Aug 8 08:16:57 2008 From: silvester.roessner@REDACTED (Roessner, Silvester) Date: Fri, 8 Aug 2008 08:16:57 +0200 Subject: [erlang-questions] Can a port use named pipes or other unnamed piped than the standard ones? Message-ID: <2CEB6DA5040AED4F946351C85FAC87B501F62A80@DEJENSAPP01V1.vision.zeiss.org> Hello, can I open a port so it communicates via a named pipe or an unnamed pipe other than StdIn and StdOut? The documentation says open_port(PortName, PortSettings) -> port() PortName = {spawn, Command} | {fd, In, Out} {fd, In, Out} Allows an Erlang process to access any currently opened file descriptors used by Erlang. The file descriptor In can be used for standard input, and the file descriptor Out for standard output. It is only used for various servers in the Erlang operating system (shell and user). Hence, its use is very limited. But I haven't found details on {fd, In, Out} and how I could open a new fd. Backgroud: We have a legacy Fortran program (called Marez) that opens many files and uses this files as a database. I want to use Erlang to replace this bunch of files by mnesia tables. My intention is to open Marez as a port, send the input that it needs via StdIn and get the answer back from StdOut. Since I also want to substitute all file accesses from Marez by mnesia accesses it would be cool if I could open more pipes than only StdIn, StdOut and StdErr. In this way I could replace in Marez all OPEN file by OPEN pipe. Otherwise I would have to multiplex all these accesses to StdIn and StdOut. mit freundlichen Gr??en / with kind regards Silvester R??ner ------------------------------------------------------------------------------------------------------- Carl Zeiss Vision GmbH Corporate Technology Solution Architect Software Application Development S i l v e s t e r R ? ? n e r phone: +49 7361 591 831 fax: +49 7361 591 498 mailto: silvester.roessner@REDACTED Carl Zeiss Vision GmbH, Turnstr. 27, 73430 Aalen Gesch?ftsf?hrer: Dr. Raymund Heinen, Thomas Radke Sitz der Gesellschaft: 73430 Aalen, Deutschland Amtsgericht Ulm, HRB 501574, USt.-IdNr.: DE 237 102 722 ------------------------------------------------------------------------------------------------------- This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Fri Aug 8 10:34:29 2008 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 8 Aug 2008 10:34:29 +0200 Subject: [erlang-questions] Mnesia and autogenerated ids In-Reply-To: References: <489B3FA3.2050508@ideaforge.org> <8209f740808071419n713cea9fo4f9a745b797c3f5@mail.gmail.com> Message-ID: <8209f740808080134l1586c123x7470a65a6a1d386b@mail.gmail.com> 2008/8/8 zambal : > On Aug 7, 11:19 pm, "Ulf Wiger" wrote: >> Now is guaranteed to be unique on a given node, while that node is >> running. Two different nodes can easily* generate the same now() >> value. That's why {node(), now()} is used. >> >> Of course, if the node is restarted and the system clock is altered, >> you can still have duplication of IDs*. This problem can be addressed >> by using NTP against a reliable time reference. > > Thanks for the explanation. So if you would have one node that is > responsible generating new id's and all other nodes in your > application query this node, is there any other reason to not use > now()? Add the requirement to have a well synchronized system clock. (: Given the right circumstances, now() can work well as a unique id on its own. BR, UIf W From vladdu55@REDACTED Fri Aug 8 11:37:27 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 8 Aug 2008 11:37:27 +0200 Subject: [erlang-questions] [ann] erl-pipes: Hartmann pipelines implementation Message-ID: <95be1d3b0808080237y3d388e6boa7408f6e3b214181@mail.gmail.com> Hi, I managed to put together an implementation of Hartmann pipelines that are an extension to the pipes usually used in your OS of choice (see http://en.wikipedia.org/wiki/Hartmann_pipeline for more details). The code and some documentation (some of it already outdated) is to be found at http://code.google.com/p/erl-pipes/ *Brief description: Pipelines are formed by pipe segments connected to each other, forming a directed graph. Data flows through the pipeline and is transformed along the way. A pipe segment is represented by a process and messages are bearers of the data flow. This allows multi-processor systems to split the load between the CPUs. There is a soft flow control mechanism (meaning that the control signals are not authoritative) that prevents mailboxes to become overflowed. A few pipe segments are defined in pips_builtins. One of the more interesting ones is 'partition' that splits the flow in two, based on a user-supplied predicate. See pipes_test.erl for some examples and a simple benchmark. This brings up the question of performance. Well, since I'm the author, I will be nice and say there's a lot of room for improvement. I've measured worst case runs that were 30x slower than doing this in the old-fashioned way, but I've also had cases where the slowdown factor was 1.4, which is not too bad. I suppose this kind of system would benefit a lot from a shared heap runtime. For this to be easy to use, we will need a simple way to put together the segments. A language to describe the graph that is "input friendly". This is (I think) also a good example where channels might prove useful. All in all, this is just a scratch on the surface. There is a lot to improve and to add. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From B.Candler@REDACTED Fri Aug 8 11:43:04 2008 From: B.Candler@REDACTED (Brian Candler) Date: Fri, 8 Aug 2008 10:43:04 +0100 Subject: [erlang-questions] Problem compiling under CentOS 5 Message-ID: <20080808094303.GA10526@uk.tiscali.com> I've been trying to compile R12B3 under CentOS 5, and compilation aborts at the following point: gcc -g -O2 -I/v/build/otp_src_R12B-3/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o ../priv/bin/i686-pc-linux-gnu/ssl_esock ../priv/obj/i686-pc-linux-gnu/esock.o ../priv/obj/i686-pc-linux-gnu/debuglog.o ../priv/obj/i686-pc-linux-gnu/esock_poll.o ../priv/obj/i686-pc-linux-gnu/esock_osio.o ../priv/obj/i686-pc-linux-gnu/esock_utils.o ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libz.a /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': (.text+0x738): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': (.text+0xf2b): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_getkeycount': (.text+0x1196): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1237): undefined reference to `keyctl_clear' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1269): undefined reference to `keyctl_clear' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x184f): undefined reference to `request_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1887): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x190f): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1945): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1af2): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_initialize': (.text+0x20f8): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_store': (.text+0x2b8f): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': (.text+0x2d1b): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': (.text+0x2d5d): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_start_seq_get': (.text+0x32e5): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_destroy': (.text+0x39a5): undefined reference to `keyctl_unlink' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x1a): undefined reference to `is_selinux_enabled' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x34): undefined reference to `setfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x40): undefined reference to `freecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x77): undefined reference to `is_selinux_enabled' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x97): undefined reference to `getfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x149): undefined reference to `matchpathcon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x160): undefined reference to `setfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x173): undefined reference to `freecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x198): undefined reference to `freecon' collect2: ld returned 1 exit status make[4]: *** [../priv/bin/i686-pc-linux-gnu/ssl_esock] Error 1 make[4]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/v/build/otp_src_R12B-3/lib' make: *** [libs] Error 2 Now, this was already reported by someone else at http://www.erlang.org/pipermail/erlang-questions/2008-July/036345.html The response there(*) was to install the krb5-devel package, but I already had that installed. So I did some poking around. The keyctl_* functions appear to be in -lkeyutils, but that's not present in the linker command line shown above. (Also note: the keyutils-libs-devel package contains /usr/lib/libkeyutils.so but no .a file) 'freecon' appears to be in -lselinux. If you add that you get further errors about functions like 'sepol_policy_kern_vers_max' and 'sepol_policy_file_create' which are in -lsepol. I already had keyutils-libs-devel and libselinux-devel packages installed, so to allow to compile to complete I made a manual frig to lib/ssl/c_src/i686-pc-linux-gnu/Makefile: --- lib/ssl/c_src/i686-pc-linux-gnu/Makefile.orig 2008-08-08 09:19:53.000000000 +0100 +++ lib/ssl/c_src/i686-pc-linux-gnu/Makefile 2008-08-08 10:05:58.000000000 +0100 @@ -133,7 +133,7 @@ CC_R_OPT = SSL_LINK_LIB = $(SSL_LIBDIR)/libssl.a $(SSL_LIBDIR)/libcrypto.a ifeq ($(NEED_KERBEROS),yes) -SSL_LINK_LIB += /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a +SSL_LINK_LIB += /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libkeyutils.so /usr/lib/libselinux.a /usr/lib/libsepol.a endif ifeq ($(NEED_ZLIB),yes) SSL_LINK_LIB += /usr/lib/libz.a After that compilation completed successfully. Presumably some autoconf magic is required to fix this problem properly. Regards, Brian Candler. (*) The other response on the list was to use the pre-built EPEL5 R11B package instead. However I was trying to install R12, because I was trying get erlyweb to run with its prebuilt .beam files. When I try it on another system where I have R11B5 installed (Ubuntu Hardy) I get the following error: beam/beam_load.c(1301): Error loading module erlyweb: use of opcode 136; this emulator supports only up to 129 My best guess from this error is that I need a newer version of erlang. Now I could just recompile erlyweb under R11B5. When I first tried that, erlang itself dumped core: $ make sh make.sh {"init terminating in do_boot",{undef,[{erltl,compile,["src/erlyweb/erlyweb_view.et",[{outdir,"ebin"},debug_info,show_errors,show_warnings]]},{filelib,fold_files2,6},{filelib,fold_files2,6},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *** [all] Error 1 $ make clean rm ebin/*.beam $ make sh make.sh Recompile: src/erlyweb/yaws_headers src/erlyweb/yaws_headers.erl:31: can't find include file "yaws_api.hrl" src/erlyweb/yaws_headers.erl:35: record headers undefined src/erlyweb/yaws_headers.erl:38: record arg undefined src/erlyweb/yaws_headers.erl:38: record headers undefined src/erlyweb/yaws_headers.erl:41: record arg undefined src/erlyweb/yaws_headers.erl:41: record headers undefined src/erlyweb/yaws_headers.erl:44: record arg undefined src/erlyweb/yaws_headers.erl:44: record headers undefined src/erlyweb/yaws_headers.erl:47: record arg undefined src/erlyweb/yaws_headers.erl:47: record headers undefined src/erlyweb/yaws_headers.erl:50: record arg undefined src/erlyweb/yaws_headers.erl:50: record headers undefined src/erlyweb/yaws_headers.erl:53: record arg undefined src/erlyweb/yaws_headers.erl:53: record headers undefined src/erlyweb/yaws_headers.erl:56: record arg undefined src/erlyweb/yaws_headers.erl:56: record headers undefined src/erlyweb/yaws_headers.erl:59: record arg undefined src/erlyweb/yaws_headers.erl:59: record headers undefined src/erlyweb/yaws_headers.erl:62: record arg undefined src/erlyweb/yaws_headers.erl:62: record headers undefined src/erlyweb/yaws_headers.erl:65: record arg undefined src/erlyweb/yaws_headers.erl:65: record headers undefined src/erlyweb/yaws_headers.erl:68: record arg undefined src/erlyweb/yaws_headers.erl:68: record headers undefined src/erlyweb/yaws_headers.erl:71: record arg undefined src/erlyweb/yaws_headers.erl:71: record headers undefined src/erlyweb/yaws_headers.erl:74: record arg undefined src/erlyweb/yaws_headers.erl:74: record headers undefined src/erlyweb/yaws_headers.erl:77: record arg undefined src/erlyweb/yaws_headers.erl:77: record headers undefined src/erlyweb/yaws_headers.erl:80: record arg undefined src/erlyweb/yaws_headers.erl:80: record headers undefined src/erlyweb/yaws_headers.erl:83: record arg undefined src/erlyweb/yaws_headers.erl:83: record headers undefined src/erlyweb/yaws_headers.erl:86: record arg undefined src/erlyweb/yaws_headers.erl:86: record headers undefined src/erlyweb/yaws_headers.erl:89: record arg undefined src/erlyweb/yaws_headers.erl:89: record headers undefined src/erlyweb/yaws_headers.erl:92: record arg undefined src/erlyweb/yaws_headers.erl:92: record headers undefined src/erlyweb/yaws_headers.erl:95: record arg undefined src/erlyweb/yaws_headers.erl:95: record headers undefined src/erlyweb/yaws_headers.erl:98: record arg undefined src/erlyweb/yaws_headers.erl:98: record headers undefined src/erlyweb/yaws_headers.erl:101: record arg undefined src/erlyweb/yaws_headers.erl:101: record headers undefined src/erlyweb/yaws_headers.erl:104: record arg undefined src/erlyweb/yaws_headers.erl:104: record headers undefined src/erlyweb/yaws_headers.erl:107: record arg undefined src/erlyweb/yaws_headers.erl:107: record headers undefined src/erlyweb/yaws_headers.erl:110: record arg undefined src/erlyweb/yaws_headers.erl:110: record headers undefined src/erlyweb/yaws_headers.erl:113: record arg undefined src/erlyweb/yaws_headers.erl:113: record headers undefined src/erlyweb/yaws_headers.erl:116: record arg undefined src/erlyweb/yaws_headers.erl:116: record headers undefined src/erlyweb/yaws_headers.erl:119: record arg undefined src/erlyweb/yaws_headers.erl:119: record headers undefined src/erlyweb/yaws_headers.erl:122: record arg undefined src/erlyweb/yaws_headers.erl:122: record headers undefined src/erlyweb/yaws_headers.erl:125: record arg undefined src/erlyweb/yaws_headers.erl:125: record headers undefined src/erlyweb/yaws_headers.erl:128: record arg undefined src/erlyweb/yaws_headers.erl:128: record headers undefined src/erlyweb/yaws_headers.erl:131: record arg undefined src/erlyweb/yaws_headers.erl:131: record headers undefined src/erlyweb/yaws_headers.erl:134: record arg undefined src/erlyweb/yaws_headers.erl:134: record headers undefined src/erlyweb/yaws_headers.erl:137: record arg undefined src/erlyweb/yaws_headers.erl:137: record headers undefined src/erlyweb/yaws_headers.erl:140: record arg undefined src/erlyweb/yaws_headers.erl:140: record headers undefined src/erlyweb/yaws_headers.erl:143: record arg undefined src/erlyweb/yaws_headers.erl:143: record headers undefined src/erlyweb/yaws_headers.erl:40: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:46: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:52: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:58: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:64: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:70: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:76: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:82: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:88: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:94: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:100: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:106: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:112: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:118: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:124: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:130: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:136: Warning: variable 'Val' is unused src/erlyweb/yaws_headers.erl:142: Warning: variable 'Val' is unused {"init terminating in do_boot",{undef,[{erltl,compile,["src/erlyweb/erlyweb_view.et",[{outdir,"ebin"},debug_info,show_errors,show_warnings]]},{filelib,fold_files2,6},{filelib,fold_files2,6},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *** [all] Error 1 I had already built yaws, and I had symlinked /usr/lib/erlang/lib/yaws-1.77 to /usr/local/lib/yaws where yaws installed itself (under there are ebin, examples, include, priv directories). However erlyweb was still unable to find yaws_api.hrl. Whether that should cause a core dump I don't know. Sticking some absolute paths in src/erlyweb/yaws_arg.erl and src/erlyweb/yaws_headers.erl seemed to fix it. I clearly have a lot to learn about this environment :-) However, making R12B3 compile under CentOS seems to be a useful aim in its own right, so I posted anyway. From devdoer2@REDACTED Fri Aug 8 16:36:40 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 8 Aug 2008 22:36:40 +0800 Subject: [erlang-questions] Why QLC join query failed on transformed table in mnesia? Message-ID: HI: I have two tables :"user" and "product", I found the join query failed when one table is been transformed by function "mensia:transform_table". Here is the record defination: -record(user,{uuid,name,version}). -record(user2,{uuid,name}). -record(product,{uuid,name,price,user}). The user table is first defined as the record "user", then is transformed by mensia:transform_table to the record "user2",after the transformation ,the join query on user table and product table failed and report badrecord exception. The related code lists as below. 1.Here is the record defination: -record(user,{uuid,name,version}). -record(user2,{uuid,name}). -record(product,{uuid,name,price,user}). ---------------------------------------------------------- 2.here is the transform code: upgrade_fun(X)-> #user2{ uuid=X#user.uuid, name=X#user.name }. upgrade_table()-> mnesia:transform_table(user,fun upgrade_fun/1,record_info(fields,user2),user2), -------------------------------------------------------------------- 3. here is my QLC query code: q_product_6()-> do(qlc:q([{Y#user.uuid,Y#user.name }||X<-mnesia:table(product),X#product.price<5,Y<-mnesia:table( user),Y#user.uuid =< 6])). do(Q) -> F = fun() -> qlc:e(Q) end, Val= mnesia:transaction(F), Val. The join query throw the exception: ** exception exit: {aborted,{{badrecord,user}, [{product,'-q_product_6/0-fun-1-',8}, {qlc,collect,1}, {qlc,eval,2}, {mnesia_tm,apply_fun,3}, {mnesia_tm,execute_transaction,5}, {mnesia,wrap_trans,6}, {erl_eval,do_apply,5}, {shell,exprs,6}]}} in function mnesia:wrap_trans/6 Any guys know why? It seems be a bug in QLC. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Fri Aug 8 17:16:48 2008 From: dmercer@REDACTED (David Mercer) Date: Fri, 8 Aug 2008 10:16:48 -0500 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com><71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz><489BAA91.4050308@san.rr.com> Message-ID: <007301c8f969$c7f343b0$f21ea8c0@SSI.CORP> Richard A. O'Keefe wrote: > You haven't persuaded me, but those numbers have. Bravo! I, myself, have gone on record (http://www.erlang.org/pipermail/erlang-questions/2007-August/028516.html) in the past complaining about infix operators (or delimiters) in general. This is in no way at all limited to Erlang; I experience it with every programming language I use (because, alas, I have not worked in LISP in almost 20 years). However, on second thought, my problem is really only with infix operators/delimiters that can take more than two arguments. E.g., I wouldn't have a problem with "+" for addition if we limited it to only two arguments. "A + B" does not create an formatting/aesthetic issue for me as much as allowing "A + B + C" does. (See my post for reasons why I don't like the latter.) If an infix "+" operator only permitted two arguments, then we would have to decide between "(A + B) + C" and "A + (B + C)", which is decidedly inconvenient in this case, since addition is associative. Doubly so, since it is also commutative, and we might want to reorder the arguments. I note, however, to my chagrin, that Erlang isn't alone in not adopting a more LISP-like syntax (cf. C, Java, Algol, PL/I, Ada, Pascal, Basic, Perl, etc. etc.). Should it? Bit late now, and much as it bugs me, I'm still going to write my Erlang in Erlang rather than LFE. At least Erlang offers an alternative syntax, though I don't know whether you would characterize it as being production-ready yet. Cheers, David From dmercer@REDACTED Fri Aug 8 17:24:38 2008 From: dmercer@REDACTED (David Mercer) Date: Fri, 8 Aug 2008 10:24:38 -0500 Subject: [erlang-questions] "Design patterns" for functional languages? In-Reply-To: <7546D232-E090-4BBF-9EA2-017E174DEA2D@cs.otago.ac.nz> References: <7546D232-E090-4BBF-9EA2-017E174DEA2D@cs.otago.ac.nz> Message-ID: <007401c8f96a$dfe51100$f21ea8c0@SSI.CORP> Richard A. O'Keefe wrote: > On 8 Aug 2008, at 10:53 am, David Mitchell wrote: > > > Maybe the ideal format for an Erlang book on "design patterns" is > > along the lines of the "Ruby Cookbook", "Perl Cookbook", "Python > > Cookbook" and probably many other books covering other languages that > > have been released by O'Reilly. > > Er, we *have* an Erlang cookbook. > http://www.trapexit.org/Category:CookBook This is Richard's second post *today* that gets a hearty thumbs-up from me. No, I'm not an O'Keefe fan-boy, though I'll have to look him up next time I'm in Dunedin... :-) > Certainly it's far from exhaustive, but maybe we could improve it? > Perhaps someone might like to add a recipe 'Unique keys' that > explains about {now(),node()}. From w.a.de.jong@REDACTED Fri Aug 8 17:25:38 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 8 Aug 2008 17:25:38 +0200 Subject: [erlang-questions] new json parser Message-ID: <407d9ef80808080825q36a57863m12da3f27e60b6290@mail.gmail.com> Hi all, I have uploaded a json parser to trapexit. ( http://forum.trapexit.org/viewtopic.php?p=44029#44029) More than anything else, the purpose of this parser is to convince Richard O'Keefe that having a json parser with a SAX-like API is a good idea. But fortunately it can also serve more practical purposes. As mentioned, the parser has a SAX-like API. It also has a mechanism to parse input data in blocks - if it reaches the end of the input data, it will call a function to provide the next block. The combination of these properties results in a parser that can process input of arbitrary size, or a stream of data. Included is a handler function that translates the SAX events into the same output format produced by mochijson2. Looks like this: {struct, [{<<"key1">>, <<"value1">>}, {<<"key2">>, 123}]}. Interestingly, the new parser (sax parser combined with handler) is roughly 2x as fast as mochijson2 (On my PC, at least). The parser consists of just 1 file, with some edoc documentation and a couple of very simple examples included. It only works on UTF-8 encoded input (which implies that it can also parse ASCII, of course). Regards, Willem -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Fri Aug 8 18:22:43 2008 From: bob@REDACTED (Bob Ippolito) Date: Fri, 8 Aug 2008 09:22:43 -0700 Subject: [erlang-questions] new json parser In-Reply-To: <407d9ef80808080825q36a57863m12da3f27e60b6290@mail.gmail.com> References: <407d9ef80808080825q36a57863m12da3f27e60b6290@mail.gmail.com> Message-ID: <6a36e7290808080922y66143dbcje88214e48185e1d3@mail.gmail.com> 2008/8/8 Willem de Jong : > Hi all, > > I have uploaded a json parser to trapexit. > (http://forum.trapexit.org/viewtopic.php?p=44029#44029) > > More than anything else, the purpose of this parser is to convince Richard > O'Keefe that having a json parser with a SAX-like API is a good idea. But > fortunately it can also serve more practical purposes. > > As mentioned, the parser has a SAX-like API. It also has a mechanism to > parse input data in blocks - if it reaches the end of the input data, it > will call a function to provide the next block. The combination of these > properties results in a parser that can process input of > arbitrary size, or a stream of data. > > Included is a handler function that translates the SAX events into the same > output format produced by mochijson2. Looks like this: {struct, > [{<<"key1">>, <<"value1">>}, {<<"key2">>, 123}]}. Interestingly, the new > parser (sax parser combined with handler) is roughly 2x as fast as > mochijson2 (On my PC, at least). > > The parser consists of just 1 file, with some edoc documentation and a > couple of very simple examples included. It only works on UTF-8 encoded > input (which implies that it can also parse ASCII, of course). I haven't profiled it but my guess is that yours is faster because it doesn't keep track of the current character/line position in the doc. mochijson2 does it because I like good error messages... :) The second part is that mochijson2 is written such that it is compatible with and performs well in R11B because that's what I was using at the time. I'd have written it differently for R12B which behaves very different with binaries (as far as performance goes). -bob From vances@REDACTED Fri Aug 8 18:56:31 2008 From: vances@REDACTED (Vance Shipley) Date: Fri, 8 Aug 2008 12:56:31 -0400 Subject: [erlang-questions] Unique references Message-ID: <20080808165630.GG155@h216-235-12-173.host.egate.net> I find it odd that in the recent thread about unique references no one has mentioned the native erlang reference data type: http://www.erlang.org/doc/reference_manual/data_types.html#2.5 I have heard it said that a ref() is not as sure to be unique as it should be. If that is the case shouldn't it be fixed? Since it is to be an opaque value it shouldn't break anything if it is changed. (foo)1> make_ref(). #Ref<0.0.0.32> The documentation says: "A reference is a term which is unique in an Erlang runtime system" I believe it is actually unique in a distributed Erlang system as well: (bar)1> global:register_name(bar, self()). yes (foo)2> global:send(bar, R). <5700.37.0> (bar)2> receive R -> R end. #Ref<5737.0.0.62> The "5737" is the node part. The problem with the ref() is that it isn't unique across instances of an erlang runtime system: 1> make_ref(). #Ref<0.0.0.32> 1> make_ref(). #Ref<0.0.0.32> Why don't we just fix this? -Vance From mikpe@REDACTED Fri Aug 8 19:15:43 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 8 Aug 2008 19:15:43 +0200 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <20080808094303.GA10526@uk.tiscali.com> References: <20080808094303.GA10526@uk.tiscali.com> Message-ID: <18588.32575.764247.499426@harpo.it.uu.se> Brian Candler writes: > I've been trying to compile R12B3 under CentOS 5, and compilation aborts at > the following point: > > gcc -g -O2 -I/v/build/otp_src_R12B-3/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o ../priv/bin/i686-pc-linux-gnu/ssl_esock ../priv/obj/i686-pc-linux-gnu/esock.o ../priv/obj/i686-pc-linux-gnu/debuglog.o ../priv/obj/i686-pc-linux-gnu/esock_poll.o ../priv/obj/i686-pc-linux-gnu/esock_osio.o ../priv/obj/i686-pc-linux-gnu/esock_utils.o ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libz.a > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': > (.text+0x738): undefined reference to `keyctl_read_alloc' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': > (.text+0xf2b): undefined reference to `keyctl_read_alloc' etc FWIW, I can build R12B-3 fine on CentOS 5.2 / x86_64. But if I force a 32-bit build (by setting CC when configuring) then I get the same error you got. Looks like a bug in CentOS, maybe inherited from RHEL5. I did notice that the keyutils-libs-devel rpm only existed as an i386 rpm, whereas all other openssl/krb5 stuff existed as both i386 and x86_64 rpms. That may or may not be relevant to this issue. /Mikael From xbmodder@REDACTED Fri Aug 8 20:21:06 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Fri, 8 Aug 2008 11:21:06 -0700 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <18588.32575.764247.499426@harpo.it.uu.se> References: <20080808094303.GA10526@uk.tiscali.com> <18588.32575.764247.499426@harpo.it.uu.se> Message-ID: <7c9d57ea0808081121v39f547dchbd20bb048d94a3c5@mail.gmail.com> Disable kerberos and SSL inside of the build. That'll let it compile. Do you need SSL? On Fri, Aug 8, 2008 at 10:15 AM, Mikael Pettersson wrote: > Brian Candler writes: > > I've been trying to compile R12B3 under CentOS 5, and compilation aborts > at > > the following point: > > > > gcc -g -O2 -I/v/build/otp_src_R12B-3/erts/i686-pc-linux-gnu > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o > ../priv/bin/i686-pc-linux-gnu/ssl_esock > ../priv/obj/i686-pc-linux-gnu/esock.o > ../priv/obj/i686-pc-linux-gnu/debuglog.o > ../priv/obj/i686-pc-linux-gnu/esock_poll.o > ../priv/obj/i686-pc-linux-gnu/esock_osio.o > ../priv/obj/i686-pc-linux-gnu/esock_utils.o > ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o > ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm > /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a > /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a > /usr/lib/libcom_err.a /usr/lib/libz.a > > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': > > (.text+0x738): undefined reference to `keyctl_read_alloc' > > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': > > (.text+0xf2b): undefined reference to `keyctl_read_alloc' > etc > > FWIW, I can build R12B-3 fine on CentOS 5.2 / x86_64. > But if I force a 32-bit build (by setting CC when configuring) > then I get the same error you got. > > Looks like a bug in CentOS, maybe inherited from RHEL5. > > I did notice that the keyutils-libs-devel rpm only existed as > an i386 rpm, whereas all other openssl/krb5 stuff existed as > both i386 and x86_64 rpms. That may or may not be relevant to > this issue. > > /Mikael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From colm.dougan@REDACTED Fri Aug 8 20:32:52 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Fri, 8 Aug 2008 19:32:52 +0100 Subject: [erlang-questions] Slower ets lookups in SMP mode Message-ID: <24d4f39c0808081132q5cedfb2ctb792ba91ff30f8e4@mail.gmail.com> Hi list, I have an application that needs to do intensive ets lookups (hundreds of thousand per second) but since I've moved to SMP mode I've noticed that the performance of these lookups has degraded (approximately 2.5 times slower for a basic benchmark on my hardware) and I'm trying to find ways to optimize this. I understand that the slower performance is to do with the fact that 2 locks are required per ets lookup in SMP mode. I'd appreciate any suggestions on optimizing this. For example, is there an efficient (faster than individual lookups) way to batch ets lookups so that I could lookup (say) 4 keys at once? Any other suggestions? Thanks, Colm From mihai@REDACTED Fri Aug 8 20:38:20 2008 From: mihai@REDACTED (Mihai Balea) Date: Fri, 8 Aug 2008 14:38:20 -0400 Subject: [erlang-questions] Rationale behind ets:lookup_element/3 behavior Message-ID: Hi all, I have been hit by a strange behavior when using ets:lookup_element/3: Normally, when the Key is not found, I would expect that the function would return []. Indeed, this is what happens with ets:lookup/2 . However, ets:lookup_element/3 throws a badarg exception. While this is documented, it seems.... well, inconsistent. Can anybody clue me in as to the rationale behind this behavior? Thanks, Mihai From jonsingler@REDACTED Fri Aug 8 21:35:12 2008 From: jonsingler@REDACTED (Jon Singler) Date: Fri, 8 Aug 2008 15:35:12 -0400 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <18588.32575.764247.499426@harpo.it.uu.se> References: <20080808094303.GA10526@uk.tiscali.com> <18588.32575.764247.499426@harpo.it.uu.se> Message-ID: <79a415f20808081235p4e6759c0rfba279c14ed86318@mail.gmail.com> FWIW, I recently compiled the current Erlang release on CentOS 5. My build does include crypto, meaning I included OpenSSL. I'm not sure if it included Kerberos or not (is that separate from the OpenSSL stuff?). From vladdu55@REDACTED Fri Aug 8 21:58:52 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 8 Aug 2008 21:58:52 +0200 Subject: [erlang-questions] documentation bug, module digraph Message-ID: <95be1d3b0808081258x39e50825r9592a1dfbc386194@mail.gmail.com> Hi, There are some errors in the docs for digraph: add_edge() Tuples on the form ['$e' | N], where N is an integer >= 1, are used for representing the created edges. add_vertex() Tuples on the form ['$v' | N], where N is an integer >= 1, are used for representing the created vertices. * The terms above are lists, not tuples. This may be confusing. * The first edge/vertex gets N==0, not 1 best regards, Vlad From B.Candler@REDACTED Fri Aug 8 22:15:23 2008 From: B.Candler@REDACTED (Brian Candler) Date: Fri, 8 Aug 2008 21:15:23 +0100 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <7c9d57ea0808081121v39f547dchbd20bb048d94a3c5@mail.gmail.com> References: <20080808094303.GA10526@uk.tiscali.com> <18588.32575.764247.499426@harpo.it.uu.se> <7c9d57ea0808081121v39f547dchbd20bb048d94a3c5@mail.gmail.com> Message-ID: <20080808201523.GA30944@uk.tiscali.com> On Fri, Aug 08, 2008 at 11:21:06AM -0700, Sargun Dhillon wrote: > Disable kerberos and SSL inside of the build. That'll let it compile. > Do you need SSL? I'd like to have the ability to run HTTPS. Anyway, I'm back with a pre-built R11 now, having worked out how to recompile erlyweb so it doesn't use the new opcodes. Thanks, Brian. From hroe@REDACTED Fri Aug 8 23:21:20 2008 From: hroe@REDACTED (hroe@REDACTED) Date: Fri, 8 Aug 2008 23:21:20 +0200 Subject: [erlang-questions] undocumented xmerl_scan acc_fun feature Message-ID: <25643728.1218230480315.JavaMail.root@webmail1.groni1> Hi, while experimenting on how to use xmerl, I noticed in http://www.erlang.org/doc/apps/xmerl/xmerl_examples.html a useful feature. Acc = fun(#xmlText{value = " ", pos = P}, Acc, S) -> {Acc, P, S}; % new return format The accumulator returns a triplet including pos = P, which is not documented. It has as effect that the pos = P value is used for the next item parsed from the data. Hth, Herman From jim.mccoy@REDACTED Sat Aug 9 06:20:18 2008 From: jim.mccoy@REDACTED (Jim McCoy) Date: Fri, 8 Aug 2008 21:20:18 -0700 Subject: [erlang-questions] Unique references In-Reply-To: <20080808165630.GG155@h216-235-12-173.host.egate.net> References: <20080808165630.GG155@h216-235-12-173.host.egate.net> Message-ID: On Fri, Aug 8, 2008 at 9:56 AM, Vance Shipley wrote: > [...] > I have heard it said that a ref() is not as sure to be unique as > it should be. If that is the case shouldn't it be fixed? Absolutely. Making refs reasonably unique and non-guessable (and by extension, giving the same property to pids) would be some easy low-hanging fruit in terms of making Erlang a bit more secure. At this point in time how hard is it to attach a bit of randomness to whatever was going to be emitted as a ref and shove the whole thing through md5 or sha1? [Yes, both are suspect for _real_ security, but they are a huge improvement over the current system...] jim From jchris@REDACTED Sat Aug 9 06:51:34 2008 From: jchris@REDACTED (Chris Anderson) Date: Fri, 8 Aug 2008 21:51:34 -0700 Subject: [erlang-questions] new json parser In-Reply-To: <6a36e7290808080922y66143dbcje88214e48185e1d3@mail.gmail.com> References: <407d9ef80808080825q36a57863m12da3f27e60b6290@mail.gmail.com> <6a36e7290808080922y66143dbcje88214e48185e1d3@mail.gmail.com> Message-ID: On Fri, Aug 8, 2008 at 9:22 AM, Bob Ippolito wrote: > 2008/8/8 Willem de Jong : >> Hi all, >> >> I have uploaded a json parser to trapexit. >> (http://forum.trapexit.org/viewtopic.php?p=44029#44029) >> >> Included is a handler function that translates the SAX events into the same >> output format produced by mochijson2. Looks like this: {struct, >> [{<<"key1">>, <<"value1">>}, {<<"key2">>, 123}]}. Interestingly, the new >> parser (sax parser combined with handler) is roughly 2x as fast as >> mochijson2 (On my PC, at least). I added another handler that output the B. term format ( JSON {} => Erlang {[]} ) which turned out to be a 6 character change from Willem's handler. I also added a variation on mochijson's test suite, and profile() function that runs the test suite under fprof. You can profile by json_parser:profile(). The paste is available here: http://gist.github.com/4651 Chris -- Chris Anderson http://jchris.mfdz.com From devdoer2@REDACTED Sat Aug 9 16:15:17 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sat, 9 Aug 2008 22:15:17 +0800 Subject: [erlang-questions] beginner:how to change a tuple's element Message-ID: HI: I want to change a element in one tuple,Eg. change the 3th element in tuple {a,b,c,e} to 'g',the result will be {a,b,g,e}. How can I do it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dizzyd@REDACTED Sat Aug 9 16:31:31 2008 From: dizzyd@REDACTED (Dave Smith) Date: Sat, 9 Aug 2008 08:31:31 -0600 Subject: [erlang-questions] beginner:how to change a tuple's element In-Reply-To: References: Message-ID: setelement/3 is the function you're looking for. D. 2008/8/9 devdoer bird : > HI: > > I want to change a element in one tuple,Eg. change the 3th element in tuple > {a,b,c,e} to 'g',the result will be {a,b,g,e}. > How can I do it? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rvirding@REDACTED Sat Aug 9 17:49:56 2008 From: rvirding@REDACTED (Robert Virding) Date: Sat, 9 Aug 2008 17:49:56 +0200 Subject: [erlang-questions] beginner:how to change a tuple's element In-Reply-To: References: Message-ID: <3dbc6d1c0808090849i2a2aa44fr4368f9250fcccb1f@mail.gmail.com> But remember you are not changing the element in the tuple, you are creating a new tuple which is a copy of the old one except for one new element. The old tuple is still available. N.B. you only make a copy of the top tuple not of its elements. Robert 2008/8/9 Dave Smith > setelement/3 is the function you're looking for. > > D. > > 2008/8/9 devdoer bird : > > HI: > > > > I want to change a element in one tuple,Eg. change the 3th element in > tuple > > {a,b,c,e} to 'g',the result will be {a,b,g,e}. > > How can I do it? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Sat Aug 9 18:02:20 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sun, 10 Aug 2008 00:02:20 +0800 Subject: [erlang-questions] beginner:how to change a tuple's element In-Reply-To: <3dbc6d1c0808090849i2a2aa44fr4368f9250fcccb1f@mail.gmail.com> References: <3dbc6d1c0808090849i2a2aa44fr4368f9250fcccb1f@mail.gmail.com> Message-ID: Thanks. 2008/8/9, Robert Virding : > > But remember you are not changing the element in the tuple, you are > creating a new tuple which is a copy of the old one except for one new > element. The old tuple is still available. N.B. you only make a copy of the > top tuple not of its elements. > > Robert > > 2008/8/9 Dave Smith > >> setelement/3 is the function you're looking for. >> >> D. >> >> 2008/8/9 devdoer bird : >> > HI: >> > >> > I want to change a element in one tuple,Eg. change the 3th element in >> tuple >> > {a,b,c,e} to 'g',the result will be {a,b,g,e}. >> > How can I do it? >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasaro@REDACTED Sat Aug 9 23:11:57 2008 From: lasaro@REDACTED (Lasaro) Date: Sat, 9 Aug 2008 14:11:57 -0700 (PDT) Subject: [erlang-questions] variable unsafe just in macros Message-ID: <8151fdc6-d47b-4b2a-bc80-84d04169866b@p10g2000prf.googlegroups.com> Hi there, I tried to define a debug macro that would work for both single parameters and multiple as follows. -define(debug,true). -ifdef(debug). -define(DEBUG(Msg), case Msg of [] -> io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); [[_|_]=Format, [_|_]=Param] -> io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); [_|_] -> io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); _ -> io:format("{~p@~p:~p} wrong debug call", [?MODULE,?LINE,self()]) end. ). -else. -define(DEBUG(_M), true). -endif. -define(debug,true). -ifdef(debug). deb(Msg)-> case Msg of [] -> io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); [[_|_]=Format, [_|_]=Param] -> io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); [_|_] -> io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); _ -> io:format("{~p@~p:~p} wrong debug call", [?MODULE,?LINE,self()]) end. -define(DEBUG(Msg), deb(Msg)). -else. -define(DEBUG(_M), true). -endif. From lasaro@REDACTED Sat Aug 9 23:11:57 2008 From: lasaro@REDACTED (Lasaro) Date: Sat, 9 Aug 2008 14:11:57 -0700 (PDT) Subject: [erlang-questions] variable unsafe just in macros Message-ID: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> Hi there, I tried to define a debug macro that would work for both single parameters and multiple as follows. -define(debug,true). -ifdef(debug). -define(DEBUG(Msg), case Msg of [] -> io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); [[_|_]=Format, [_|_]=Param] -> io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); [_|_] -> io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); _ -> io:format("{~p@~p:~p} wrong debug call", [?MODULE,?LINE,self()]) end. ). -else. -define(DEBUG(_M), true). -endif. -define(debug,true). -ifdef(debug). deb(Msg)-> case Msg of [] -> io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); [[_|_]=Format, [_|_]=Param] -> io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); [_|_] -> io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); _ -> io:format("{~p@~p:~p} wrong debug call", [?MODULE,?LINE,self()]) end. -define(DEBUG(Msg), deb(Msg)). -else. -define(DEBUG(_M), true). -endif. From lasaro@REDACTED Sat Aug 9 23:31:45 2008 From: lasaro@REDACTED (Lasaro) Date: Sat, 9 Aug 2008 14:31:45 -0700 (PDT) Subject: [erlang-questions] variable unsafe just in macros In-Reply-To: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> References: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> Message-ID: Sorry, I sent the message before it was ready (twice!). The question was why does this definition gives me a "variable 'Param' unsafe in 'case'". -define(debug,true). -ifdef(debug). -define(DEBUG(Msg), case Msg of ? ? ? ? [] -> ? ? ? ? ? ? io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); ? ? ? ? [[_|_]=Format, [_|_]=Param] -> ? ? ? ? ? ? io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); ? ? ? ? [_|_] -> ? ? ? ? ? ? io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); ? ? ? ? _ -> ? ? ? ? ? ? io:format("{~p@~p:~p} wrong debug call", [?MODULE,? LINE,self()]) ? ? end). -else. -define(DEBUG(_M), true). -endif. but this one does not? -define(debug,true). -ifdef(debug). deb(Msg)-> ? ? case Msg of ? ? ? ? [] -> ? ? ? ? ? ? io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); ? ? ? ? [[_|_]=Format, [_|_]=Param] -> ? ? ? ? ? ? io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? LINE,self()|Param]); ? ? ? ? [_|_] -> ? ? ? ? ? ? io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); ? ? ? ? _ -> ? ? ? ? ? ? io:format("{~p@~p:~p} wrong debug call", [?MODULE,? LINE,self()]) ? ? end. -define(DEBUG(Msg), deb(Msg)). -else. -define(DEBUG(_M), true). -endif. Cheers. L?saro From golubovsky@REDACTED Sun Aug 10 06:26:53 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Sun, 10 Aug 2008 00:26:53 -0400 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: Joseph, On Wed, Jul 30, 2008 at 10:12 AM, Joseph Wayne Norton wrote: > Dimitry - > > If edoc specs are available, edoc can be used for this purpose. The > outputed xml can be parsed. There might be other (or better approaches). > This way it works perfectly, thanks for the suggestion. What if edoc specs are not available (developer simply omitted them as they are not mandatory)? In some cases type spec may be written for a function with arity X, but omitted for arity X-1 and same name. There was some static type check tool for Erlang mentioned named TypEr [1]: is it capable to produce such specs? Thank you. [1] http://www.erlang.se/workshop/2005/TypEr_Erlang05.pdf which means that it has been around for some time (since 2005): what is its current status? -- Dimitry Golubovsky Anywhere on the Web From drwho102003-erlang@REDACTED Sun Aug 10 06:59:46 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Sat, 9 Aug 2008 21:59:46 -0700 (PDT) Subject: [erlang-questions] Can we ask this question to a distributed hash ? Message-ID: <914322.70710.qm@web31806.mail.mud.yahoo.com> "Is item X in our distributed hash ?" where the distributed hash exists as a gigantic hash in the RAMs of a bunch of machines ? If Erlang can answer this, how can I write Erlang programs to answer this question ? How can I load this distributed hash with my contents ?? Obviously, each machine can only load a piece of the total contents... Thanks. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From litaocheng@REDACTED Sun Aug 10 08:09:58 2008 From: litaocheng@REDACTED (litao cheng) Date: Sun, 10 Aug 2008 14:09:58 +0800 Subject: [erlang-questions] variable unsafe just in macros In-Reply-To: References: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> Message-ID: in my computer, the two DEBUG macro all work corretly. my erlang otp is R12B-3. 2008/8/10 Lasaro > Sorry, I sent the message before it was ready (twice!). The question > was > why does this definition gives me a "variable 'Param' unsafe in > 'case'". > > -define(debug,true). > > -ifdef(debug). > -define(DEBUG(Msg), > case Msg of > [] -> > io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); > [[_|_]=Format, [_|_]=Param] -> > io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? > LINE,self()|Param]); > [_|_] -> > io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); > _ -> > io:format("{~p@~p:~p} wrong debug call", [?MODULE,? > LINE,self()]) > end). > -else. > -define(DEBUG(_M), true). > -endif. > > but this one does not? > > -define(debug,true). > > -ifdef(debug). > deb(Msg)-> > case Msg of > [] -> > io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); > [[_|_]=Format, [_|_]=Param] -> > io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? > LINE,self()|Param]); > [_|_] -> > io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); > _ -> > io:format("{~p@~p:~p} wrong debug call", [?MODULE,? > LINE,self()]) > end. > > -define(DEBUG(Msg), deb(Msg)). > -else. > -define(DEBUG(_M), true). > -endif. > > Cheers. > L?saro > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Sun Aug 10 09:07:33 2008 From: pguyot@REDACTED (Paul Guyot) Date: Sun, 10 Aug 2008 09:07:33 +0200 Subject: [erlang-questions] Dialyzer and recursive types Message-ID: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> Hello, I'm trying to use dialyzer with a recursive type and I get an error when using the tree type defined in the slides: ---- -module(dialyzer_bug). -export([foo/0]). -type(tree(X) :: {X,tree(X),tree(X)} | nil). -spec(foo/0 :: () -> tree(integer())). foo() -> nil. ---- Checking whether the PLT /Users/paul/.dialyzer_plt is up-to- date... yes Proceeding with analysis... Analysis failed with error: Could not scan the following file(s): [{"/ Users/paul/tmp/dialyzer_bug.beam", [85,110,107,110,111,119,110,32,116, 121,112,101,32,"tree",10]}] Last messages in log cache: ["Reading files and computing callgraph... "] dialyzer: Internal problems were encountered in the analysis. ---- The same error occurs even if the type is not parametrized. ---- -module(dialyzer_bug). -export([foo/0]). -type(tree() :: {integer(),tree(),tree()} | nil). -spec(foo/0 :: () -> tree()). foo() -> nil. ---- Is it a known bug? Or is it a mistake in the way I specify the recursive type? Regards, Paul From vychodil.hynek@REDACTED Sun Aug 10 10:45:34 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sun, 10 Aug 2008 10:45:34 +0200 Subject: [erlang-questions] Can a port use named pipes or other unnamed piped than the standard ones? In-Reply-To: <2CEB6DA5040AED4F946351C85FAC87B501F62A80@DEJENSAPP01V1.vision.zeiss.org> References: <2CEB6DA5040AED4F946351C85FAC87B501F62A80@DEJENSAPP01V1.vision.zeiss.org> Message-ID: <4d08db370808100145v1c2152e5xd5f83170c44572f6@mail.gmail.com> You can make simple shell or other wrappers over named pipes and use it as other ports. 2008/8/8 Roessner, Silvester > Hello, > > can I open a port so it communicates via a named pipe or an unnamed pipe > other than StdIn and StdOut? > > The documentation says > > open_port(PortName, PortSettings) -> port() > > PortName = {spawn, Command} | {fd, In, Out} > > {fd, In, Out} > Allows an Erlang process to access any currently opened file descriptors > used by Erlang. The file descriptor In can be used for standard input, and > the file descriptor Out for standard output. It is only used for various > servers in the Erlang operating system (shell and user). Hence, its use is > very limited. > But I haven't found details on {fd, In, Out} and how I could open a new fd. > > > > Backgroud: > > We have a legacy Fortran program (called Marez) that opens many files and > uses this files as a database. I want to use Erlang to replace this bunch > of files by mnesia tables. > > My intention is to open Marez as a port, send the input that it needs via > StdIn and get the answer back from StdOut. > > Since I also want to substitute all file accesses from Marez by > mnesia accesses it would be cool if I could open more pipes than only StdIn, > StdOut and StdErr. In this way I could replace in Marez all OPEN file by > OPEN pipe. > > Otherwise I would have to multiplex all these accesses to StdIn and StdOut. > > > mit freundlichen Gr??en / with kind regards > > > > Silvester R??ner > > > ------------------------------------------------------------------------------------------------------- > Carl Zeiss Vision GmbH > Corporate Technology > Solution Architect Software Application Development > > S i l v e s t e r R ? ? n e r > > phone: +49 7361 591 831 > fax: +49 7361 591 498 > mailto: > silvester.roessner@REDACTED > > > Carl Zeiss Vision GmbH, Turnstr. 27, 73430 Aalen > Gesch?ftsf?hrer: Dr. Raymund Heinen, Thomas Radke > Sitz der Gesellschaft: 73430 Aalen, Deutschland > Amtsgericht Ulm, HRB 501574, USt.-IdNr.: DE 237 102 722 > > > ------------------------------------------------------------------------------------------------------- > > > This message is intended for a particular addressee only and may contain > business or company secrets. If you have received this email in error, > please contact the sender and delete the message immediately. Any use of > this email, including saving, publishing, copying, replication or forwarding > of the message or the contents is not permitted. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmcknight@REDACTED Fri Aug 8 01:52:27 2008 From: cmcknight@REDACTED (Charles McKnight) Date: Thu, 7 Aug 2008 16:52:27 -0700 Subject: [erlang-questions] Looking for Seattle area Erlang developers Message-ID: <93AE4939-8464-4A1C-A01A-896B54BE3D15@pheonic.com> Greetings all, We're looking for 2-3 Erlang developers for a 4-6 month project in the Seattle area. If you have 2-3 years Erlang development experience and are in the Seattle area, please send resumes to careers@REDACTED Thanks! Chuck From B.Candler@REDACTED Fri Aug 8 18:29:01 2008 From: B.Candler@REDACTED (Brian Candler) Date: Fri, 8 Aug 2008 17:29:01 +0100 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <20080808094303.GA10526@uk.tiscali.com> References: <20080808094303.GA10526@uk.tiscali.com> Message-ID: <20080808162901.GA24956@uk.tiscali.com> On Fri, Aug 08, 2008 at 10:43:04AM +0100, Brian Candler wrote: > I had already built yaws, and I had symlinked /usr/lib/erlang/lib/yaws-1.77 > to /usr/local/lib/yaws where yaws installed itself (under there are ebin, > examples, include, priv directories). However erlyweb was still unable to > find yaws_api.hrl. Whether that should cause a core dump I don't know. For the benefit of the archives, I found two solutions to this. (1) Modify Emakefile, which contains paths to where the yaws headers are expected. Or: (2) Change a couple of erlyweb files to use -include_lib instead of -include, and then install or link yaws to the standard lib dir. --- src/erlyweb/yaws_headers.erl.orig 2008-08-08 10:37:34.000000000 +0100 +++ src/erlyweb/yaws_headers.erl 2008-08-08 14:26:37.000000000 +0100 @@ -28,7 +28,7 @@ authorization/2, other/1, other/2]). --include("yaws_api.hrl"). +-include_lib("yaws/include/yaws_api.hrl"). %% @doc Create a new 'headers' record. new() -> --- src/erlyweb/yaws_arg.erl.orig 2008-08-08 10:37:35.000000000 +0100 +++ src/erlyweb/yaws_arg.erl 2008-08-08 14:26:54.000000000 +0100 @@ -29,7 +29,7 @@ docroot/2, fullpath/1, fullpath/2, cont/1, cont/2, state/1, state/2, pid/1, pid/2, opaque/1, opaque/2, appmod_prepath/1, appmod_prepath/2, pathinfo/1, pathinfo/2]). --include("yaws_api.hrl"). +-include_lib("yaws/include/yaws_api.hrl"). %% @doc Create a new 'arg' record. new() -> Regards, Brian. From lemenkov@REDACTED Sun Aug 10 22:46:16 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Mon, 11 Aug 2008 00:46:16 +0400 Subject: [erlang-questions] Problem compiling under CentOS 5 In-Reply-To: <20080808094303.GA10526@uk.tiscali.com> References: <20080808094303.GA10526@uk.tiscali.com> Message-ID: Hello All! 2008/8/8, Brian Candler : > I've been trying to compile R12B3 under CentOS 5, and compilation aborts at > the following point: > > gcc -g -O2 -I/v/build/otp_src_R12B-3/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o ../priv/bin/i686-pc-linux-gnu/ssl_esock ../priv/obj/i686-pc-linux-gnu/esock.o ../priv/obj/i686-pc-linux-gnu/debuglog.o ../priv/obj/i686-pc-linux-gnu/esock_poll.o ../priv/obj/i686-pc-linux-gnu/esock_osio.o ../priv/obj/i686-pc-linux-gnu/esock_utils.o ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libz.a > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': > (.text+0x738): undefined reference to `keyctl_read_alloc' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': > (.text+0xf2b): undefined reference to `keyctl_read_alloc' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_getkeycount': > (.text+0x1196): undefined reference to `keyctl_read' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': > (.text+0x1237): undefined reference to `keyctl_clear' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': > (.text+0x1269): undefined reference to `keyctl_clear' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': > (.text+0x184f): undefined reference to `request_key' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': > (.text+0x1887): undefined reference to `keyctl_read' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': > (.text+0x190f): undefined reference to `keyctl_search' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': > (.text+0x1945): undefined reference to `add_key' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': > (.text+0x1af2): undefined reference to `keyctl_search' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_initialize': > (.text+0x20f8): undefined reference to `add_key' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_store': > (.text+0x2b8f): undefined reference to `add_key' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': > (.text+0x2d1b): undefined reference to `keyctl_search' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': > (.text+0x2d5d): undefined reference to `add_key' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_start_seq_get': > (.text+0x32e5): undefined reference to `keyctl_read' > /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_destroy': > (.text+0x39a5): undefined reference to `keyctl_unlink' > /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': > (.text+0x1a): undefined reference to `is_selinux_enabled' > /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': > (.text+0x34): undefined reference to `setfscreatecon' > /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': > (.text+0x40): undefined reference to `freecon' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x77): undefined reference to `is_selinux_enabled' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x97): undefined reference to `getfscreatecon' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x149): undefined reference to `matchpathcon' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x160): undefined reference to `setfscreatecon' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x173): undefined reference to `freecon' > /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': > (.text+0x198): undefined reference to `freecon' > collect2: ld returned 1 exit status > make[4]: *** [../priv/bin/i686-pc-linux-gnu/ssl_esock] Error 1 > make[4]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/v/build/otp_src_R12B-3/lib' > make: *** [libs] Error 2 You're right - that's an issue with missing libs in Makefile. See patch in EPEL repository: http://cvs.fedoraproject.org/viewcvs/rpms/erlang/EL-5/otp-ssl_missing_libs.patch?rev=1.1&view=auto BTW I plan to rebuild R12B-3 for EPEL tomorrow (if everything will be OK, it will be pushed to epel-testing repo in a cooule of days). Feel free to contact me directly (or file a bug in redhat's bugzilla if you find something weird). -- With best regards! From lasaro@REDACTED Mon Aug 11 00:54:21 2008 From: lasaro@REDACTED (Lasaro) Date: Sun, 10 Aug 2008 15:54:21 -0700 (PDT) Subject: [erlang-questions] variable unsafe just in macros In-Reply-To: References: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> Message-ID: <8309b6f9-7a8b-4f75-93f0-c10d5a57a44d@t1g2000pra.googlegroups.com> I should have saved the code around the problematic use of the macro. If I manage to reproduce it again, I will send another message. Thanks anyway. On Aug 9, 11:09?pm, "litao cheng" wrote: > in my computer, the two DEBUG ?macro all work corretly. my erlang otp is > R12B-3. > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > 2008/8/10 Lasaro > > > > > Sorry, I sent the message before it was ready (twice!). The question > > was > > why does this definition gives me a "variable 'Param' unsafe in > > 'case'". > > > -define(debug,true). > > > -ifdef(debug). > > -define(DEBUG(Msg), > > case Msg of > > ? ? ? ? ?[] -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); > > ? ? ? ? ?[[_|_]=Format, [_|_]=Param] -> > > ? ? ? ? ? ? ?io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? > > LINE,self()|Param]); > > ? ? ? ? ?[_|_] -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); > > ? ? ? ? ?_ -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p} wrong debug call", [?MODULE,? > > LINE,self()]) > > ? ? ?end). > > -else. > > -define(DEBUG(_M), true). > > -endif. > > > but this one does not? > > > -define(debug,true). > > > -ifdef(debug). > > deb(Msg)-> > > ? ? ?case Msg of > > ? ? ? ? ?[] -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); > > ? ? ? ? ?[[_|_]=Format, [_|_]=Param] -> > > ? ? ? ? ? ? ?io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? > > LINE,self()|Param]); > > ? ? ? ? ?[_|_] -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); > > ? ? ? ? ?_ -> > > ? ? ? ? ? ? ?io:format("{~p@~p:~p} wrong debug call", [?MODULE,? > > LINE,self()]) > > ? ? ?end. > > > -define(DEBUG(Msg), deb(Msg)). > > -else. > > -define(DEBUG(_M), true). > > -endif. > > > Cheers. > > L?saro > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions- Hide quoted text - > > - Show quoted text - From vik@REDACTED Mon Aug 11 06:34:05 2008 From: vik@REDACTED (Vik Olliver) Date: Mon, 11 Aug 2008 16:34:05 +1200 Subject: [erlang-questions] Records: How can I dump the structure of a record? Message-ID: <1218429245.10892.266.camel@localhost> I have a nested record structure which is populated and then put into an mnesia database. I'd like to be able to recursively extract the structure of the record so that I can use it to repopulate another database later (from a backup, manual coding, new install or whatever). Is there a nice way to do this that leaves me with something looking very much like the original structure definitions in ASCII? Vik :v) From erlang-questions_efine@REDACTED Mon Aug 11 07:13:43 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 11 Aug 2008 01:13:43 -0400 Subject: [erlang-questions] Records: How can I dump the structure of a record? In-Reply-To: <1218429245.10892.266.camel@localhost> References: <1218429245.10892.266.camel@localhost> Message-ID: <6c2563b20808102213k5bd8c0fl53f6e38edf41e3ac@mail.gmail.com> A record #recname{data1="X",data2="Y",...} is just a tuple of the form {recname, "X", "Y",...}. Nested records are therefore just nested tuples. You can dump the contents of any Erlang term using term_to_binary and then save that binary to disk. You can then restore the contents using binary_to_term. (xhg1@REDACTED)8> R = {rec1,1,2,{rec2,"A","B",{rec3,[1],[2]},"D","E"},3,4,5}. {rec1,1,2,{rec2,"A","B",{rec3,[1],[2]},"D","E"},3,4,5} (xhg1@REDACTED)9> B = term_to_binary(R). <<131,104,7,100,0,4,114,101,99,49,97,1,97,2,104,6,100,0,4, 114,101,99,50,107,0,1,65,107,0,...>> (xhg1@REDACTED)10> R1 = binary_to_term(B). {rec1,1,2,{rec2,"A","B",{rec3,[1],[2]},"D","E"},3,4,5} Making the tuple look like the original record is something I'd like to see, but I only know of the shell that can do that. The problem is a record is a compile-time construct; the run-time data does not contains the info (except I think if compiled in debug mode, which of course you can't guarantee). Still, it solves your problem from a data point of view. Hope this helps. Ed On Mon, Aug 11, 2008 at 12:34 AM, Vik Olliver wrote: > I have a nested record structure which is populated and then put into an > mnesia database. > > I'd like to be able to recursively extract the structure of the record > so that I can use it to repopulate another database later (from a > backup, manual coding, new install or whatever). > > Is there a nice way to do this that leaves me with something looking > very much like the original structure definitions in ASCII? > > Vik :v) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Mon Aug 11 11:45:12 2008 From: pguyot@REDACTED (Paul Guyot) Date: Mon, 11 Aug 2008 11:45:12 +0200 Subject: [erlang-questions] Dialyzer and try/after In-Reply-To: <489FF10D.10400@kreditor.se> References: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> <489FF10D.10400@kreditor.se> Message-ID: Le 11 ao?t 08 ? 09:58, Tobias Lindahl a ?crit : >> Is it a known bug? Or is it a mistake in the way I specify the >> recursive type? > > It is a known limitation. We have not had the time to implement > recursive types yet, parametrized or not. Unfortunately, I cannot > give you a time estimate for this. Dear Tobias, Thank you very much for your reply! I have yet another issue with dialyzer. It seems that it is too optimistic about the values of variables in an after clause: ---- -module(dialyzer_test). -export([foo/1, bar/1, demo/0]). -type(result() :: {ok, atom()}). -type(result_or_error() :: result() | error). -spec(foo/1::(atom())->result_or_error()). foo(Atom) -> case Atom of error -> error; _ -> {ok, Atom} end. -spec(bar/1::(atom())->atom()). bar(Atom) -> FooResult = foo(Atom), Result = try case FooResult of {ok, Data} -> case foobar(Data) of ok -> ok; SomeError -> throw({barError, SomeError}) end; Error -> throw({barError, Error}) end after case FooResult of {ok, _} -> case foo_finalize(FooResult) of ok -> ignore; FinalizeError -> throw({barError, FinalizeError}) end; _ -> io:format("_ can match.~n") end end, Result. -spec(foobar/1::(atom())->any()). foobar(ok) -> ok; foobar(_) -> error. -spec(foo_finalize/1::(tuple())->any()). foo_finalize({ok, closed}) -> ok; foo_finalize(_) -> error. demo() -> bar(error). ---- > dialyzer -r . Checking whether the PLT /Users/paul/.dialyzer_plt is up-to- date... yes Proceeding with analysis... dialyzer_test.erl:33: The variable _ can never match since previous clauses completely covered the type {'ok',atom()} Unknown functions: done in 0m1.86s done (warnings were emitted) ---- > erl -s dialyzer_test demo Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] [hipe] [kernel-poll:false] _ can match. {"init terminating in do_boot",{{nocatch,{barError,error}}, [{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () ---- Is it a known limitation? Unlike the recursive type, this is a blocker issue as I don't know how to alter the specification to avoid the dialyzer error. And I don't want to start ignoring dialyzer errors, the tool is way too useful. Paul From norton@REDACTED Mon Aug 11 06:46:54 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Mon, 11 Aug 2008 13:46:54 +0900 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: Dimitry - You may also want to look at the dialyzer tool. Beyond that, I don't have any additional suggestions. I would be interested though to hear if you find anything else helpful or related. thanks, On Sun, 10 Aug 2008 13:26:53 +0900, Dimitry Golubovsky wrote: > Joseph, > > On Wed, Jul 30, 2008 at 10:12 AM, Joseph Wayne Norton > wrote: >> Dimitry - >> >> If edoc specs are available, edoc can be used for this purpose. The >> outputed xml can be parsed. There might be other (or better >> approaches). >> > > This way it works perfectly, thanks for the suggestion. What if edoc > specs are not available (developer simply omitted them as they are not > mandatory)? In some cases type spec may be written for a function with > arity X, but omitted for arity X-1 and same name. > > There was some static type check tool for Erlang mentioned named TypEr > [1]: is it capable to produce such specs? > > Thank you. > > [1] http://www.erlang.se/workshop/2005/TypEr_Erlang05.pdf which means > that it has been around for some time (since 2005): what is its > current status? > -- norton@REDACTED From kostis@REDACTED Mon Aug 11 13:23:30 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 11 Aug 2008 14:23:30 +0300 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: <48A02132.8080609@cs.ntua.gr> Dimitry Golubovsky wrote: > Joseph, > > On Wed, Jul 30, 2008 at 10:12 AM, Joseph Wayne Norton > wrote: >> Dimitry - >> >> If edoc specs are available, edoc can be used for this purpose. The >> outputed xml can be parsed. There might be other (or better approaches). >> > > This way it works perfectly, thanks for the suggestion. What if edoc > specs are not available (developer simply omitted them as they are not > mandatory)? In some cases type spec may be written for a function with > arity X, but omitted for arity X-1 and same name. > > There was some static type check tool for Erlang mentioned named TypEr > [1]: is it capable to produce such specs? > > Thank you. > > [1] http://www.erlang.se/workshop/2005/TypEr_Erlang05.pdf which means > that it has been around for some time (since 2005): what is its > current status? Its current status is that it is part of Erlang/OTP R12B-*. Typer. although a separate tool, is really a front-end to dialyzer. It's really simple to use and it does most of what you want it to do. You can use it by the command: typer module.erl which will show the inferred types of all functions of module.erl. For functions with -spec declarations, these declarations are trusted and are output as is. It does not understand @edoc declarations though. Try also: typer --help Comments and suggestions for improvements are welcome. Kostis From dmitriid@REDACTED Mon Aug 11 14:11:25 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 11 Aug 2008 15:11:25 +0300 Subject: [erlang-questions] Naive questions about jinterface Message-ID: I'm trying to get jinterface to erlang and back, but I'm lost a bit. I've followed this excellent introductory article: http://www.theserverside.com/tt/articles/article.tss?l=IntegratingJavaandErlang and everything works as described. However, I can't figure out how to connect to Java servernode from erlang. BTW, is there an article that describes the more advanced stuff like mailboxes, statuses etc.? From artak@REDACTED Mon Aug 11 14:36:09 2008 From: artak@REDACTED (Artak Avetisyan) Date: Mon, 11 Aug 2008 17:36:09 +0500 Subject: [erlang-questions] system_limit and enfile errors when acceptiing/opening connections Message-ID: <48A03239.8010702@smart.am> Dear All We have encountered a strange problem on our erlang-driven web-service, which uses yaws for accepting connections from outer world and http module to send requests to the back office. After several hours of operation the http:request fails with {error, system_limit} and consequently yaws web server shuts down yaws: Failed to accept - terminating: {error,enfile} We are running Erlang R12 on FreeBSD 6.2-RELEASE, the kern.maxfiles limit is 8072 , and kern.maxfileperproc is 7264 per process, while fstat | grep beam | wc shows 1200 (way to low to get emfile or enfile anyway), however the web-service runs normally after a reboot. Is that possible that that {error, enfile} is generated by the beam process itself as a result of {error, system_limit} problem, and is not relayed form the underlying OS? we didn't specify the ERL_MAX_PORTS environment variable, and the length(erlang:ports()) was something around 8000 , while the documentation said that the default max port number is 1024. Seems quite strange to me. Later, when experimenting i have set the ERL_MAX_PORTS to 0, and still erlang:ports() returned > 0 entries, while i expected system_limit error from the first connection opened. I feel that i am missing something badly, and will appreciate any help. ******************** Best regards, Artak Avetisyan Yerevan, Republic of Armenia From vladdu55@REDACTED Mon Aug 11 15:55:13 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 11 Aug 2008 15:55:13 +0200 Subject: [erlang-questions] Naive questions about jinterface In-Reply-To: References: Message-ID: <95be1d3b0808110655t50837ab8x9e89cdd8350888e7@mail.gmail.com> Hi, On Mon, Aug 11, 2008 at 14:11, Dmitrii Dimandt wrote: > I'm trying to get jinterface to erlang and back, but I'm lost a bit. > > I've followed this excellent introductory article: http://www.theserverside.com/tt/articles/article.tss?l=IntegratingJavaandErlang > and everything works as described. > > However, I can't figure out how to connect to Java servernode from > erlang. Java nodes (like C nodes) implement hidden nodes, so they won't be seen in the nodes() list. net_adm:ping/1 should return 'pong' if everything is set up properly (same cookie, etc). > BTW, is there an article that describes the more advanced stuff like > mailboxes, statuses etc.? None that I am aware of. Me, I found the javadoc informative enough. best regards, Vlad From dbyrne@REDACTED Mon Aug 11 16:14:21 2008 From: dbyrne@REDACTED (Dennis Byrne) Date: Mon, 11 Aug 2008 09:14:21 -0500 Subject: [erlang-questions] Naive questions about jinterface In-Reply-To: Message-ID: Hi Dmitrii, The approach taken in the article is one of two ways to go about using jinterface. The other way is covered pretty well by these slides from this years' Erlang eXchange conference. This approach is much more mailbox centric. http://people.apache.org/~dennisbyrne/erlang_exchange/erlang_exchange_jinterface.ppt ____________________________________________ Dennis Byrne ThoughtWorks - Chicago http://notdennisbyrne.blogspot.com/ 312-505-7965 Dmitrii Dimandt Sent by: erlang-questions-bounces@REDACTED 08/11/2008 07:11 AM To EQ cc Subject [erlang-questions] Naive questions about jinterface I'm trying to get jinterface to erlang and back, but I'm lost a bit. I've followed this excellent introductory article: http://www.theserverside.com/tt/articles/article.tss?l=IntegratingJavaandErlang and everything works as described. However, I can't figure out how to connect to Java servernode from erlang. BTW, is there an article that describes the more advanced stuff like mailboxes, statuses etc.? _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From golubovsky@REDACTED Mon Aug 11 16:48:27 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Mon, 11 Aug 2008 10:48:27 -0400 Subject: [erlang-questions] Typer vs. Edoc Message-ID: Kistis, On 8/11/08, Kostis Sagonas wrote: > Typer. although a separate tool, is really a front-end to dialyzer. > > It's really simple to use and it does most of what you want it to do. [skip] > are output as is. It does not understand @edoc declarations though. Any way to put them (edoc-declarations and dialyzer-declarations of types) together? Thank you. -- Dimitry Golubovsky Anywhere on the Web From rgl@REDACTED Mon Aug 11 17:25:26 2008 From: rgl@REDACTED (Rui Lopes) Date: Mon, 11 Aug 2008 16:25:26 +0100 Subject: [erlang-questions] How to use new_ssl in R12? Message-ID: <48A059E6.7020102@ruilopes.com> Hi, I'm trying to use new_ssl to make a simple echo server, but so far, I cannot seem to get it working. Here is a snipped of my code: main() -> application:start(crypto), application:start(ssl), ssl:seed("TODO random here"), {ok, ListenSocket} = ssl:listen(12345, [ {ssl_imp, new}, {verify, 0}, {cacertfile, "ca.pem"}, {certfile, "crt.pem"}, {keyfile, "key.pem"} ]), io:format("ready to accept connections at port 12345 ~p\n", [ListenSocket]), {ok, Socket} = ssl:transport_accept(ListenSocket), io:format("accepted connection from ~p\n", [ssl:peername(Socket)]), ok = ssl:ssl_accept(Socket), io:format("client connection ~p~n", [Socket]), loop(Socket). loop(Socket) -> receive {ssl, Socket, Data} -> io:format("received data: ~p~n", [Data]), ssl:send(Socket, Data), loop(Socket); ... This will open a listen socket at port 12345; after a connection is established, it will echo everything back to the client until the socket is closed. If I comment the {ssl_imp, new} it works as expected, though it does not work with the new implementation, erl just crashes with the message: {"init terminating in do_boot",{{try_clause,{error,esslerrssl}},[{ssl,ssl_accept,2},{echo_ssl,main,0},{init,start_it,1},{init,start_em,1}]}} Before dying, it sends an SSL alert to the client, with the data (as seen in the client console): connection lost: [('SSL routines', 'SSL3_READ_BYTES', 'tlsv1 alert internal error'), ('SSL routines', 'SSL3_READ_BYTES', 'ssl handshake failure')] The code (and dummy certificates, etc) is at: http://ruilopes.com/tmp/echo_ssl/echo_ssl.erl http://ruilopes.com/tmp/echo_ssl/key.pem http://ruilopes.com/tmp/echo_ssl/crt.pem http://ruilopes.com/tmp/echo_ssl/ca.pem The client (written in twisted/python) is at: http://ruilopes.com/tmp/echo_ssl/echo_ssl_client.py Any idea how to make this work? Thanks in advance! Best regards, Rui Lopes From kostis@REDACTED Mon Aug 11 17:33:09 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 11 Aug 2008 18:33:09 +0300 Subject: [erlang-questions] Typer vs. Edoc In-Reply-To: References: Message-ID: <48A05BB5.3090102@cs.ntua.gr> Dimitry Golubovsky wrote: > >> are output as is. It does not understand @edoc declarations though. > > Any way to put them (edoc-declarations and dialyzer-declarations of > types) together? We have discussed about this repeatedly and it is on our TODO list, so I guess that sooner or later an appropriate conversion tool will exist. But there are some issues that need to be resolved first. Also, in my experience the edoc declarations quite often have suffered from code rot, are unreliable and cannot always be converted to correct -spec declarations without some human intervention. Kostis From kostis@REDACTED Mon Aug 11 17:33:39 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 11 Aug 2008 18:33:39 +0300 Subject: [erlang-questions] Typer vs. Edoc In-Reply-To: References: Message-ID: <48A05BD3.9060408@cs.ntua.gr> Dimitry Golubovsky wrote: > >> are output as is. It does not understand @edoc declarations though. > > Any way to put them (edoc-declarations and dialyzer-declarations of > types) together? We have discussed about this repeatedly and it is on our TODO list, so I guess that sooner or later an appropriate conversion tool will exist. But there are some issues that need to be resolved first. Also, in my experience edoc declarations quite often have suffered from code rot, are unreliable and cannot always be converted to correct -spec declarations without some human intervention. Kostis From jesper.louis.andersen@REDACTED Mon Aug 11 19:27:34 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 11 Aug 2008 19:27:34 +0200 Subject: [erlang-questions] system_limit and enfile errors when acceptiing/opening connections In-Reply-To: <48A03239.8010702@smart.am> References: <48A03239.8010702@smart.am> Message-ID: <56a0a2840808111027qca2cb60ifac1ba3adaaec177@mail.gmail.com> On Mon, Aug 11, 2008 at 2:36 PM, Artak Avetisyan wrote: > We are running Erlang R12 on FreeBSD 6.2-RELEASE, the kern.maxfiles > limit is 8072 , and kern.maxfileperproc is 7264 per process, while > fstat | grep beam | wc shows 1200 (way to low to get emfile or enfile > anyway), however the web-service runs normally after a reboot. While the kernel places an upper limit of 8072, the process might be more limited than that. Take the shell-process executing the erl(1) binary and try to run ulimit -n (bash/zsh) or limits (csh/tcsh) which will verify that you are not bumping your head against a somewhat lower limit imposed there. Modulo some spurious extra mappings in fstat(8) you might be hitting a 1024 limit there. From tuncer.ayaz@REDACTED Mon Aug 11 19:43:27 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 11 Aug 2008 19:43:27 +0200 Subject: [erlang-questions] error compiling R12B-3 In-Reply-To: <4ac8254d0807261305w465f410yceb760b72b492c6@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> <82fa9e310807261254y5b979d24m88fa474fdf6784cf@mail.gmail.com> <4ac8254d0807261305w465f410yceb760b72b492c6@mail.gmail.com> Message-ID: <4ac8254d0808111043j7243f7d4nf82a8873dd058e6d@mail.gmail.com> On Sat, Jul 26, 2008 at 10:05 PM, Tuncer Ayaz wrote: > On Sat, Jul 26, 2008 at 9:54 PM, mark wrote: >> http://www.erlang.org/pipermail/erlang-questions/2008-July/036380.html >> this fixed it ! >> thanks > > Sorry for posting the same, just later. > Your message was received at Google Mail almost 8 minutes later than > at erlang.org :(. I hope this is not a common Google Mail free version issue > caused by mail queue prios but I remember reading something like that > a year or two ago on LKML. Just for the record so that I do not erroneously blame the wrong side, it might also be caused by the erlang.org side or both. I didn't want to post this but I could not let my probably wrong statement stay here eternally. Better not speculate too much next time :-) From lestat@REDACTED Mon Aug 11 21:16:48 2008 From: lestat@REDACTED (Tamas Nagy) Date: Mon, 11 Aug 2008 20:16:48 +0100 Subject: [erlang-questions] Mnesia add_table_index behaviour Message-ID: Hi all! Working with mnesia I've encountered something strange. (At least I think it is strange.) I have fairly large table and at some point I figured out that the I heavily depend on a field which is not the key of the table. I've tried to add table index to that field. It works fine until I restart the system, because then - as far as I can tell - the index is rebuilt. So after every restart I have to wait 20-50 minutes. When I added index to tables when it was created no recalculating occourred after restarts. Is this an intended behaviour or a bug or I'm doing something wrong. At least the documentation suggests that adding index to the tables when it is created or with mnesia:add_table_index/2 later on do not have different semantics. Regards, Tamas From jim.mccoy@REDACTED Mon Aug 11 22:10:03 2008 From: jim.mccoy@REDACTED (Jim McCoy) Date: Mon, 11 Aug 2008 13:10:03 -0700 Subject: [erlang-questions] Can we ask this question to a distributed hash ? In-Reply-To: <914322.70710.qm@web31806.mail.mud.yahoo.com> References: <914322.70710.qm@web31806.mail.mud.yahoo.com> Message-ID: 2008/8/9 Eric Ho : > "Is item X in our distributed hash ?" > where the distributed hash exists as a gigantic hash in the RAMs of a bunch > of machines ? Do you want to answer the question with an absolute yes or no, or is a probabalistic answer good enough? If the latter, then you need to do some research into "bloom filters". If your dht supports deletion then you will probably want a counted bloom filter, and if the dht is very large or network bandwidth is constrained you will want to examine compressed bloom filters as well. Jim From atomly-erl@REDACTED Mon Aug 11 23:09:52 2008 From: atomly-erl@REDACTED (atomly) Date: Mon, 11 Aug 2008 17:09:52 -0400 Subject: [erlang-questions] Can we ask this question to a distributed hash ? In-Reply-To: References: <914322.70710.qm@web31806.mail.mud.yahoo.com> Message-ID: <20080811210952.GG53452@atomly.com> [Jim McCoy ] > Do you want to answer the question with an absolute yes or no, or is a > probabalistic answer good enough? > > If the latter, then you need to do some research into "bloom filters". > If your dht supports deletion then you will probably want a counted > bloom filter, and if the dht is very large or network bandwidth is > constrained you will want to examine compressed bloom filters as well. And if you're looking for an implementation of a Bloom Filter in Erlang, you can check out this one: http://code.google.com/p/bloomerl/ -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From matthew@REDACTED Tue Aug 12 00:23:14 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 11 Aug 2008 17:23:14 -0500 Subject: [erlang-questions] xmerl_xpath doesn't handle "//@*" correctly? Message-ID: I have almost zero xpath knowledge, but this seems inconsistent to me: 1> F = fun(S) -> {Doc, _} = xmerl_scan:string(S), length(xmerl_xpath:string("//@*", Doc)) end. #Fun 2> F(""). 1 3> F(""). 1 4> F(" "). 0 Shouldn't "//@*" return 1 attribute for the last case as well? (Using "//*/@*" instead works in all three cases as I expect.) From drwho102003-erlang@REDACTED Tue Aug 12 00:24:26 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Mon, 11 Aug 2008 15:24:26 -0700 (PDT) Subject: [erlang-questions] Can we ask this question to a distributed hash ? In-Reply-To: Message-ID: <752185.32030.qm@web31814.mail.mud.yahoo.com> I'm sorry... Actually, I meant not a dht, but more like a general distributed memory -- i.e. there may be duplicates in it and multiple actors (on different machines) can insert stuff into this memory.? This distributed memory can be configured to be either RAM-only or RAM-and-disk, across all machines. Thanks. -eric --- On Mon, 8/11/08, Jim McCoy wrote: From: Jim McCoy Subject: Re: [erlang-questions] Can we ask this question to a distributed hash ? To: drwho102003-erlang@REDACTED, "Erlang Questions" Date: Monday, August 11, 2008, 1:10 PM 2008/8/9 Eric Ho : > "Is item X in our distributed hash ?" > where the distributed hash exists as a gigantic hash in the RAMs of a bunch > of machines ? Do you want to answer the question with an absolute yes or no, or is a probabalistic answer good enough? If the latter, then you need to do some research into "bloom filters". If your dht supports deletion then you will probably want a counted bloom filter, and if the dht is very large or network bandwidth is constrained you will want to examine compressed bloom filters as well. Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From atomly-erl@REDACTED Tue Aug 12 02:44:27 2008 From: atomly-erl@REDACTED (atomly) Date: Mon, 11 Aug 2008 20:44:27 -0400 Subject: [erlang-questions] Can we ask this question to a distributed hash ? In-Reply-To: <752185.32030.qm@web31814.mail.mud.yahoo.com> References: <752185.32030.qm@web31814.mail.mud.yahoo.com> Message-ID: <20080812004427.GH53452@atomly.com> Well, in that case, I think you'll want to look into Merkle trees: http://en.wikipedia.org/wiki/Merkle_tree I believe there is also an Erlang version somewhere on Google Code. [Eric Ho ] > > I'm sorry... > Actually, I meant not a dht, but more like a general distributed > memory -- i.e. there may be duplicates in it and multiple actors (on > different machines) can insert stuff into this memory. This > distributed memory can be configured to be either RAM-only or > RAM-and-disk, across all machines. > Thanks. > -eric > --- On Mon, 8/11/08, Jim McCoy wrote: > > From: Jim McCoy > Subject: Re: [erlang-questions] Can we ask this question to a > distributed hash ? > To: drwho102003-erlang@REDACTED, "Erlang Questions" > > Date: Monday, August 11, 2008, 1:10 PM > 2008/8/9 Eric Ho : > > "Is > item X in our distributed hash ?" > > where the distributed hash exists as a gigantic hash in the RAMs of a > bunch > > of machines ? > Do you want to answer the question with an absolute yes or no, or is a > probabalistic answer good enough? > If the latter, then you need to do some research into "bloom > filters". > If your dht supports deletion then you will probably want a counted > bloom filter, and if the dht is very large or network bandwidth is > constrained you will want to examine compressed bloom filters as well. > Jim > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From justin@REDACTED Tue Aug 12 02:51:12 2008 From: justin@REDACTED (Justin Sheehy) Date: Mon, 11 Aug 2008 20:51:12 -0400 Subject: [erlang-questions] Can we ask this question to a distributed hash ? In-Reply-To: <20080812004427.GH53452@atomly.com> Message-ID: On 8/11/08 8:44 PM, "atomly" wrote: > Merkle trees: > > http://en.wikipedia.org/wiki/Merkle_tree > > I believe there is also an Erlang version somewhere on Google Code. There is indeed: http://code.google.com/p/distributerl/ (and a minor improvement/bug-fix release will be going up this week) -Justin From ok@REDACTED Tue Aug 12 03:03:55 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 12 Aug 2008 13:03:55 +1200 Subject: [erlang-questions] variable unsafe just in macros In-Reply-To: References: <5184ef7e-181f-481b-864e-9f33f2357d7a@p10g2000prf.googlegroups.com> Message-ID: <55568F6A-72C1-4EED-A373-9350EFEAD71A@cs.otago.ac.nz> On 10 Aug 2008, at 9:31 am, Lasaro wrote: > -define(debug,true). > > -ifdef(debug). > -define(DEBUG(Msg), > case Msg of > [] -> > io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]); > [[_|_]=Format, [_|_]=Param] -> > io:format(lists:append(["{~p@~p:~p} ",Format]), [?MODULE,? > LINE,self()|Param]); > [_|_] -> > io:format("{~p@~p:~p} "++Msg, [?MODULE,?LINE,self()]); > _ -> > io:format("{~p@~p:~p} wrong debug call", [?MODULE,? > LINE,self()]) > end). > -else. > -define(DEBUG(_M), true). > -endif. First observation: lists:append([X,Y]) would be simpler as X++Y. Second observation: where are the comments explaining how this is to be used? Third observation: surely a macro definition did not give you a warning about an unsafe variable? Surely that happened later, when you called it. So we need to see the call as well, but it probably wants to use a variable Param for its own purposes. Simple change: use 'hd' and 'tl' instead of variable names. -define(DEBUG(Message), case Message of [] -> io:format("{~p@~p:~p}", [?MODULE,?LINE,self()]) ; [[_|_], [_|_]] -> io:format("{~p@~p:~p} " ++ hd(Message), [?MODULE,?LINE,self()|hd(tl(Message))]) ; [_|_] -> io:format("{~p@~p:~p " ++ Message, [?MODULE,?LINE,self()]) ; _ -> io:format("{~p@~p:~p wrong debug call", [?MODULE,?LINE,self()]) end). Fourth observation: where's the newline being written? From saleyn@REDACTED Tue Aug 12 03:40:31 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 11 Aug 2008 21:40:31 -0400 Subject: [erlang-questions] capabilities Message-ID: <48A0EA0F.60102@gmail.com> Sorry for polluting the list with a non-Erlang question, but since I know that there are a number of Solaris experts on the list, I though I could get an advice. I may need to port my Erlang Linux-based C port program to Solaris, and the program takes advantage of Linux capabilities (*) CAP_SYS_NICE and CAP_SETUID. Poking around man pages on Solaris didn't help in determining if Solaris has similar features (or if they can be accomplished by some different means). Does anyone know if it's possible for a non-root user (after issuing a setuid() call) to retain ability to impersonate as a different effective user id or adjust process's niceness on the negative side? Serge (*) man 7 capabilities From jeffm@REDACTED Tue Aug 12 04:22:52 2008 From: jeffm@REDACTED (jm) Date: Tue, 12 Aug 2008 12:22:52 +1000 Subject: [erlang-questions] project idea: p2p for large oss mirrors Message-ID: <48A0F3FC.7000102@ghostgun.com> Over the last week I've been attempting to create a large mirror of some of the open source projects out there including debian and ubuntu. This is quite large well over 200GB. So far it's taken me most of a week to do using rsync and it's given me sometime to think about the way this is being done. It strikes me as strange that for large mirrors http, ftp, and rsync with pull scripts which poll on a regular basis still seem to be "best practice" with p2p and other technologies now being available. Here's my rough take on a better way to maintain a large mirror. 1. The primary mirror publishes a public key for mirrors on their web site. 2. You down load the primary mirrors public key and configure what your interested in mirroring. 3. The primary mirror then publishes update notices detailing the new snapshot with a serial number (which could be a date timestamp) along with other metadata which is signed. This could be published via rss or directly into the p2p system. 4. Your mirror verifies this published notice, and assuming it's valid, 5. Though the p2p system downloads the differences updating the mirror in a shadow directory 6. It "flicks the switch" when the mirror reflects the desired state to make the update public for ftp/http/etc usage. 7. Optionally publishes an updated status notice (signed of course) so that the primary and other mirror sites can maintain a list of mirror sites and their status on their own websites. Thought this might make an interesting project for someone looking for a project to do in Erlang but was stuck for ideas on what to do. Jeff. From saleyn@REDACTED Tue Aug 12 04:36:12 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 11 Aug 2008 22:36:12 -0400 Subject: [erlang-questions] large Erlang clusters Message-ID: <48A0F71C.6000105@gmail.com> Does any one have experience running somewhere between 200 and 400 nodes in production? I recall that Erlang distributed layer had a limit of 256 nodes. Is it still the case? I suppose that partitioning the cluster in several global_groups should limit the network load and the number of open file descriptors on each node would be reduced. Are there any other concerns one should be aware of when working with such large clusters. Serge From enhnaran@REDACTED Tue Aug 12 05:13:42 2008 From: enhnaran@REDACTED (Enhnaran Alexander) Date: Tue, 12 Aug 2008 11:13:42 +0800 Subject: [erlang-questions] Question about Erlang project deployment Message-ID: I am now on a project that adopts Erlang as the development language. During the development I encountered a problem, that, we have to build and install Erlang on the server because we are using some third-party library which is written in Erlang, too. But there are more than one server here (maybe up to 100 servers), and it seems not reasonble to download the source code, make, and install Erlang (as well as OTP) on each server; that will be too time-consuming and not efficient. So we decide to make and install Erlang on one machine and copy the binaries (such as /lib, /bin, and so forth) to the other servers. But this brings forth another question: how to transfer these from server to server? And is there any efficient way to manage this? Thanks in advance. Enhnaran -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Tue Aug 12 05:44:53 2008 From: jeffm@REDACTED (jm) Date: Tue, 12 Aug 2008 13:44:53 +1000 Subject: [erlang-questions] Question about Erlang project deployment In-Reply-To: References: Message-ID: <48A10735.2000107@ghostgun.com> Off hand I'd say take a look at rocks cluster linux distribution or similar cluster distribution/management software. If this sort of flexibility is not available take a look at cfengine http://cfengine.org/ which automates sysadmin tasks across a number of machines. Not knowing what contraints your operating under and only having just started to look at cfengine myself I'm only guessing at it's suitability. Having said that I suspect this is the answer to your query. Jeff. Enhnaran Alexander wrote: > I am now on a project that adopts Erlang as the development language. > During the development I encountered a problem, that, we have to build > and install Erlang on the server because we are using some third-party > library which is written in Erlang, too. But there are more than one > server here (maybe up to 100 servers), and it seems not reasonble to > download the source code, make, and install Erlang (as well as OTP) on > each server; that will be too time-consuming and not efficient. So we > decide to make and install Erlang on one machine and copy the binaries > (such as /lib, /bin, and so forth) to the other servers. But this > brings forth another question: how to transfer these from server to > server? And is there any efficient way to manage this? > > Thanks in advance. > > Enhnaran > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From drwho102003-erlang@REDACTED Tue Aug 12 06:29:50 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Mon, 11 Aug 2008 21:29:50 -0700 (PDT) Subject: [erlang-questions] Equiv of Hypertable in Erlang ? In-Reply-To: Message-ID: <492507.4079.qm@web31810.mail.mud.yahoo.com> I'm wondering if there is something equivalent to HyperTable in Erlang. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangy@REDACTED Tue Aug 12 08:32:29 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 08:32:29 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <48A0F71C.6000105@gmail.com> References: <48A0F71C.6000105@gmail.com> Message-ID: <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> Hi guys, Is there any free Amazon S3 and SQS implementation in Erlang ? Thanks Y. From dmitriid@REDACTED Tue Aug 12 09:07:18 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Tue, 12 Aug 2008 10:07:18 +0300 Subject: [erlang-questions] Naive questions about jinterface In-Reply-To: References: Message-ID: <11822625-7C8A-46ED-BEAE-45FC60F7253B@gmail.com> On Aug 11, 2008, at 5:14 PM, Dennis Byrne wrote: > > Hi Dmitrii, > > The approach taken in the article is one of two ways to go about > using jinterface. The other way is covered pretty well by these > slides from this years' Erlang eXchange conference. This approach > is much more mailbox centric. > > http://people.apache.org/~dennisbyrne/erlang_exchange/erlang_exchange_jinterface.ppt Yup, I've seen this one as well. It's excellent in showing how you can implement erlang's features using jinterface, but I'm still a bit lost :) (yeah, yeah, I'm stupid and stupid enough to admit it :) ) So, I've created this java class: import com.ericsson.otp.erlang.*; public class ServerNode { public static void main (String[] _args) throws Exception{ OtpNode self = new OtpNode("jinode@REDACTED", "cookie"); OtpMbox mbox = self.createMbox("jimbox"); OtpErlangObject o; OtpErlangTuple msg; OtpErlangPid from; while (true) { try { o = mbox.receive(); if (o instanceof OtpErlangTuple) { msg = (OtpErlangTuple)o; from = (OtpErlangPid)(msg.elementAt(0)); mbox.send(from,msg.elementAt(1)); } }catch (Exception e) { System.out.println("" + e); } } } } Now it is my understanding that if I start erl with: erl -name clientnode@REDACTED -setcookie cookie I can send messages to the Java node like this: {echo, 'jinode@REDACTED'} ! {self(), msg} However, this message never reaches the java node :( Even though net_adm:ping('jinode@REDACTED') returns pong -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Tue Aug 12 09:11:22 2008 From: pguyot@REDACTED (Paul Guyot) Date: Tue, 12 Aug 2008 09:11:22 +0200 Subject: [erlang-questions] +export_all with cover:compile_beam_directory Message-ID: <5CE68125-E0D7-4874-9D99-AE0314025AFF@kallisys.net> Hello, In a given directory, I have beams compiled with +export_all. However, when I do cover:compile_beam_directory/0, the private functions are no longer accessible from the tests. Is there a way to pass +export_all to compile_beam_directory/0? A quick look at the source suggests that using cover:compile/2 (i.e. compiling from the source) wouldn't work either, since it eventually calls do_compile_beam/2, just like cover:compile_beam_directory/0. Paul From tobias.lindahl@REDACTED Tue Aug 12 09:18:18 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Tue, 12 Aug 2008 09:18:18 +0200 Subject: [erlang-questions] Dialyzer and recursive types In-Reply-To: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> References: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> Message-ID: <48A1393A.3020603@it.uu.se> [Resend since the original didn't make it to the list] Paul Guyot wrote: > Hello, > > I'm trying to use dialyzer with a recursive type and I get an error when > using the tree type defined in the slides: > > ---- > -module(dialyzer_bug). > -export([foo/0]). > -type(tree(X) :: {X,tree(X),tree(X)} | nil). > -spec(foo/0 :: () -> tree(integer())). > foo() -> nil. > ---- > Checking whether the PLT /Users/paul/.dialyzer_plt is up-to-date... yes > Proceeding with analysis... > Analysis failed with error: Could not scan the following file(s): > [{"/Users/paul/tmp/dialyzer_bug.beam", > [85,110,107,110,111,119,110,32,116, > 121,112,101,32,"tree",10]}] > Last messages in log cache: ["Reading files and computing callgraph... "] > > dialyzer: Internal problems were encountered in the analysis. > ---- > > The same error occurs even if the type is not parametrized. > > ---- > -module(dialyzer_bug). > -export([foo/0]). > -type(tree() :: {integer(),tree(),tree()} | nil). > -spec(foo/0 :: () -> tree()). > foo() -> nil. > ---- > > Is it a known bug? Or is it a mistake in the way I specify the recursive > type? It is a known limitation. We have not had the time to implement recursive types yet, parametrized or not. Unfortunately, I cannot give you a time estimate for this. Tobias > > Regards, > > Paul > From vladdu55@REDACTED Tue Aug 12 09:20:43 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 12 Aug 2008 09:20:43 +0200 Subject: [erlang-questions] Naive questions about jinterface In-Reply-To: <11822625-7C8A-46ED-BEAE-45FC60F7253B@gmail.com> References: <11822625-7C8A-46ED-BEAE-45FC60F7253B@gmail.com> Message-ID: <95be1d3b0808120020p210f0078u945b2e817b1c0f07@mail.gmail.com> 2008/8/12 Dmitrii Dimandt : > public class ServerNode { > > public static void main (String[] _args) throws Exception{ > OtpNode self = new OtpNode("jinode@REDACTED", "cookie"); > OtpMbox mbox = self.createMbox("jimbox"); > ...... > > Now it is my understanding that if I start erl with: > erl -name clientnode@REDACTED -setcookie cookie > > I can send messages to the Java node like this: > {echo, 'jinode@REDACTED'} ! {self(), msg} Hi, Shouldn't that be either {jimbox, 'jinode@REDACTED'} ! {self(), msg} or OtpMbox mbox = self.createMbox("echo"); ? best regards, Vlad From dmitriid@REDACTED Tue Aug 12 09:49:17 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Tue, 12 Aug 2008 10:49:17 +0300 Subject: [erlang-questions] Naive questions about jinterface In-Reply-To: <95be1d3b0808120020p210f0078u945b2e817b1c0f07@mail.gmail.com> References: <11822625-7C8A-46ED-BEAE-45FC60F7253B@gmail.com> <95be1d3b0808120020p210f0078u945b2e817b1c0f07@mail.gmail.com> Message-ID: <9C26AAF8-28E7-4571-848A-980F747C20AA@gmail.com> On Aug 12, 2008, at 10:20 AM, Vlad Dumitrescu wrote: > 2008/8/12 Dmitrii Dimandt : >> public class ServerNode { >> >> public static void main (String[] _args) throws Exception{ >> OtpNode self = new OtpNode("jinode@REDACTED", "cookie"); >> OtpMbox mbox = self.createMbox("jimbox"); >> > ...... >> >> Now it is my understanding that if I start erl with: >> erl -name clientnode@REDACTED -setcookie cookie >> >> I can send messages to the Java node like this: >> {echo, 'jinode@REDACTED'} ! {self(), msg} > > Hi, > > Shouldn't that be either > {jimbox, 'jinode@REDACTED'} ! {self(), msg} > or > OtpMbox mbox = self.createMbox("echo"); > ? > Yeah, it should :) I noticed the error after I sent the message. I've double checked my code and I now see I'm a complete idiot :) The message actually reaches the Java node. The response never reaches my client erlang node, but that is a problem in the erlang code. I feel silly :) From bertil.karlsson@REDACTED Tue Aug 12 09:15:01 2008 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 12 Aug 2008 09:15:01 +0200 Subject: [erlang-questions] xmerl_xpath doesn't handle "//@*" correctly? In-Reply-To: References: Message-ID: <48A13875.7030501@ericsson.com> Thanks for this report, I think you are right and we will address this as soon as possible. /Bertil Matthew Dempsky wrote: > I have almost zero xpath knowledge, but this seems inconsistent to me: > > 1> F = fun(S) -> {Doc, _} = xmerl_scan:string(S), > length(xmerl_xpath:string("//@*", Doc)) end. > #Fun > 2> F(""). > 1 > 3> F(""). > 1 > 4> F(" "). > 0 > > Shouldn't "//@*" return 1 attribute for the last case as well? (Using > "//*/@*" instead works in all three cases as I expect.) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From raimo+erlang-questions@REDACTED Tue Aug 12 10:49:35 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 12 Aug 2008 10:49:35 +0200 Subject: [erlang-questions] : error compiling R12B-3 In-Reply-To: <4ac8254d0808111043j7243f7d4nf82a8873dd058e6d@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> <82fa9e310807261254y5b979d24m88fa474fdf6784cf@mail.gmail.com> <4ac8254d0807261305w465f410yceb760b72b492c6@mail.gmail.com> <4ac8254d0808111043j7243f7d4nf82a8873dd058e6d@mail.gmail.com> Message-ID: <20080812084935.GA3559@erix.ericsson.se> On Mon, Aug 11, 2008 at 07:43:27PM +0200, Tuncer Ayaz wrote: > On Sat, Jul 26, 2008 at 10:05 PM, Tuncer Ayaz wrote: > > On Sat, Jul 26, 2008 at 9:54 PM, mark wrote: > >> http://www.erlang.org/pipermail/erlang-questions/2008-July/036380.html > >> this fixed it ! > >> thanks > > > > Sorry for posting the same, just later. > > Your message was received at Google Mail almost 8 minutes later than > > at erlang.org :(. I hope this is not a common Google Mail free version issue > > caused by mail queue prios but I remember reading something like that > > a year or two ago on LKML. > > Just for the record so that I do not erroneously blame the wrong side, it > might also be caused by the erlang.org side or both. I didn't want to > post this but I could not let my probably wrong statement stay here > eternally. > The mail transfer agent at erlang.org is often rather busy since every post has to be delivered to a few thousand addresses, and often some destination MTAs are down. So even for a no-problem destination it might take a few hours to get the post out. Pick some random posts, expand the headers, and watch the Received: headers to see when the post is first received by morgoth.cslab.ericsson.net and compare it to when it after that is first received from morgoth.cslab.ericsson.net by the next MTA. I normally get a 10..30 min delay. > Better not speculate too much next time :-) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From twoggle@REDACTED Tue Aug 12 10:54:00 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 01:54:00 -0700 (PDT) Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> Message-ID: <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> > Is there any free Amazon S3 and SQS implementation in Erlang ? http://code.google.com/p/erlaws/ From erlangy@REDACTED Tue Aug 12 11:05:41 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 11:05:41 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> Message-ID: <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> Hi Tim, Thanks for the pointer. Unfortunatly, I'm not interested by a client interfaces but by a real implementation of Amazon's SQS and S3 concepts in Erlang. cheers Y. Le 12 ao?t 08 ? 10:54, Tim Fletcher a ?crit : >> Is there any free Amazon S3 and SQS implementation in Erlang ? > > http://code.google.com/p/erlaws/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Tue Aug 12 09:58:32 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 12 Aug 2008 09:58:32 +0200 Subject: [erlang-questions] capabilities In-Reply-To: <48A0EA0F.60102@gmail.com> References: <48A0EA0F.60102@gmail.com> Message-ID: <1218527912.4512.40.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, AFAIK Solaris 10 has the concept of privileges, which sounds like Linux (and Posix.1e) capabilities (''real'' capabilities as found in operating systems literature are something different). Unfortunately I only have Solaris 9 and can not help further than that. bengt On Mon, 2008-08-11 at 21:40 -0400, Serge Aleynikov wrote: > Sorry for polluting the list with a non-Erlang question, but since I > know that there are a number of Solaris experts on the list, I though I > could get an advice. > > I may need to port my Erlang Linux-based C port program to Solaris, and > the program takes advantage of Linux capabilities (*) CAP_SYS_NICE and > CAP_SETUID. Poking around man pages on Solaris didn't help in > determining if Solaris has similar features (or if they can be > accomplished by some different means). Does anyone know if it's > possible for a non-root user (after issuing a setuid() call) to retain > ability to impersonate as a different effective user id or adjust > process's niceness on the negative side? > > Serge > > (*) man 7 capabilities > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Tue Aug 12 11:45:38 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2008 11:45:38 +0200 Subject: [erlang-questions] Dialyzer and try/after In-Reply-To: References: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> <489FF10D.10400@kreditor.se> Message-ID: <48A15BC2.5080301@it.uu.se> Paul Guyot wrote: > I have yet another issue with dialyzer. It seems that it is too > optimistic about the values of variables in an after clause: > [...} > Is it a known limitation? > Unlike the recursive type, this is a blocker issue as I don't know > how to alter the specification to avoid the dialyzer error. And I > don't want to start ignoring dialyzer errors, the tool is way too > useful. > > Paul We have identified the problem, which has more to do with how the compiler currently handles the code in the "after" block. We will try to improve this as soon as we can, but we can't guarantee that the fix gets in to the next release of OTP, which I think is due fairly soon. Meanwhile, the workaround is to manually lift the after...end part to a separate function; in your case: ... after do_after(FooResult) end, Result. do_after(FooResult) -> case FooResult of {ok, _} -> case foo_finalize(FooResult) of ok -> ignore; FinalizeError -> throw({barError, FinalizeError}) end; _ -> io:format("_ can match.~n") end Hope this works for you. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From twoggle@REDACTED Tue Aug 12 12:20:01 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 03:20:01 -0700 (PDT) Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> Message-ID: > Thanks for the pointer. Unfortunatly, I'm not interested by a client ? > interfaces but by a real implementation of Amazon's SQS and S3 concepts in Erlang. Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do what you need (instead of SQS), or are you looking for an *exact* clone of the Amazon API? From saleyn@REDACTED Tue Aug 12 12:30:34 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 12 Aug 2008 06:30:34 -0400 Subject: [erlang-questions] capabilities In-Reply-To: <1218527912.4512.40.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <48A0EA0F.60102@gmail.com> <1218527912.4512.40.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <48A1664A.2020203@gmail.com> Thanks Bengt! With your hint I found this link that provides a full answer: http://docs.sun.com/app/docs/doc/816-5175/privileges-5?l=en&a=view Serge Bengt Kleberg wrote: > Greetings, > > AFAIK Solaris 10 has the concept of privileges, which sounds like Linux > (and Posix.1e) capabilities (''real'' capabilities as found in operating > systems literature are something different). Unfortunately I only have > Solaris 9 and can not help further than that. > > > bengt > > On Mon, 2008-08-11 at 21:40 -0400, Serge Aleynikov wrote: >> Sorry for polluting the list with a non-Erlang question, but since I >> know that there are a number of Solaris experts on the list, I though I >> could get an advice. >> >> I may need to port my Erlang Linux-based C port program to Solaris, and >> the program takes advantage of Linux capabilities (*) CAP_SYS_NICE and >> CAP_SETUID. Poking around man pages on Solaris didn't help in >> determining if Solaris has similar features (or if they can be >> accomplished by some different means). Does anyone know if it's >> possible for a non-root user (after issuing a setuid() call) to retain >> ability to impersonate as a different effective user id or adjust >> process's niceness on the negative side? >> >> Serge >> >> (*) man 7 capabilities From erlangy@REDACTED Tue Aug 12 12:38:47 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 12:38:47 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> Message-ID: <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> Hi guys, RappidMQ will do the job for SQS. I've to find something like S3 now ;-) N.B: I don't need exact clones and anything similar will be OK for the task I've to implement cheers Y. Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >> Thanks for the pointer. Unfortunatly, I'm not interested by a client >> interfaces but by a real implementation of Amazon's SQS and S3 >> concepts in Erlang. > > Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do what > you need (instead of SQS), or are you looking for an *exact* clone of > the Amazon API? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jan@REDACTED Tue Aug 12 13:16:22 2008 From: jan@REDACTED (Jan Lehnardt) Date: Tue, 12 Aug 2008 13:16:22 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> Message-ID: On Aug 12, 2008, at 12:38 , ERLANG wrote: > RappidMQ will do the job for SQS. > I've to find something like S3 now ;-) How about CouchDB (http://couchdb.org/) as an approximation? Cheers Jan -- > > > N.B: I don't need exact clones and anything similar will be OK for the > task I've to implement > > cheers > Y. > > Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : > >>> Thanks for the pointer. Unfortunatly, I'm not interested by a client >>> interfaces but by a real implementation of Amazon's SQS and S3 >>> concepts in Erlang. >> >> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do what >> you need (instead of SQS), or are you looking for an *exact* clone of >> the Amazon API? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlangy@REDACTED Tue Aug 12 13:32:29 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 13:32:29 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> Message-ID: <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Hi Jan, Like CouchDB's introduction pointed, it's not a reliable DB like S3. What I'm looking after is a free, simple, and reliable (with replication suport) library to store large number (thousands to million) of very big files (>1gb per file) on secondary storage. Scalaris project is a right candidate but too big in my opinion. I'm simply looking for something simple. Anyway, many thanks. cheers Y. Le 12 ao?t 08 ? 13:16, Jan Lehnardt a ?crit : > > On Aug 12, 2008, at 12:38 , ERLANG wrote: >> RappidMQ will do the job for SQS. >> I've to find something like S3 now ;-) > > How about CouchDB (http://couchdb.org/) as an approximation? > > Cheers > Jan > -- > >> >> >> N.B: I don't need exact clones and anything similar will be OK for >> the >> task I've to implement >> >> cheers >> Y. >> >> Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >> >>>> Thanks for the pointer. Unfortunatly, I'm not interested by a >>>> client >>>> interfaces but by a real implementation of Amazon's SQS and S3 >>>> concepts in Erlang. >>> >>> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do >>> what >>> you need (instead of SQS), or are you looking for an *exact* clone >>> of >>> the Amazon API? >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From jan@REDACTED Tue Aug 12 13:38:52 2008 From: jan@REDACTED (Jan Lehnardt) Date: Tue, 12 Aug 2008 13:38:52 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Message-ID: <47D2A83F-5A09-4CFC-9C25-41502D4A8348@apache.org> On Aug 12, 2008, at 13:32 , ERLANG wrote: > Hi Jan, > > Like CouchDB's introduction pointed, it's not a reliable DB like S3. Reliable is a bendable term. You can certainly make CouchDB reliable with not too much effort. > What I'm looking after is a free, simple, and reliable (with > replication suport) library to store large > number (thousands to million) of very big files (>1gb per file) on > secondary storage. CouchDB does have replication and it can store large numbers of big files. Feel free to send more questions along my way. If it turns out that CouchDB doesn't solve your problem, I don't want to push it onto you :) > Scalaris project is a right candidate but too big in my opinion. > I'm simply looking for something simple. The not-yet available permanent storage would rule out Scalaris for me. I just don't have that much RAM (just teasing, I love Scalaris :) Cheers Jan -- > > > Anyway, many thanks. > > cheers > Y. > > Le 12 ao?t 08 ? 13:16, Jan Lehnardt a ?crit : > >> >> On Aug 12, 2008, at 12:38 , ERLANG wrote: >>> RappidMQ will do the job for SQS. >>> I've to find something like S3 now ;-) >> >> How about CouchDB (http://couchdb.org/) as an approximation? >> >> Cheers >> Jan >> -- >> >>> >>> >>> N.B: I don't need exact clones and anything similar will be OK for >>> the >>> task I've to implement >>> >>> cheers >>> Y. >>> >>> Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >>> >>>>> Thanks for the pointer. Unfortunatly, I'm not interested by a >>>>> client >>>>> interfaces but by a real implementation of Amazon's SQS and S3 >>>>> concepts in Erlang. >>>> >>>> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do >>>> what >>>> you need (instead of SQS), or are you looking for an *exact* >>>> clone of >>>> the Amazon API? >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > > From rtrlists@REDACTED Tue Aug 12 13:50:42 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 12 Aug 2008 12:50:42 +0100 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Message-ID: <6a3ae47e0808120450g3fcabafdk97607547e155dd08@mail.gmail.com> On Tue, Aug 12, 2008 at 12:32 PM, ERLANG wrote: > What I'm looking after is a free, simple, and reliable (with > replication suport) library to store large > number (thousands to million) of very big files (>1gb per file) on > secondary storage. Not quite sure if I'm missing the point, but a filesystem on RAIDed disks would do that, yes? Or did you want replicated and distributed? Robby From erlangy@REDACTED Tue Aug 12 14:06:07 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 14:06:07 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <6a3ae47e0808120450g3fcabafdk97607547e155dd08@mail.gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> <6a3ae47e0808120450g3fcabafdk97607547e155dd08@mail.gmail.com> Message-ID: <0DE65144-4049-4C53-8056-FED5ED8C69A7@gmail.com> Hi Robert, Le 12 ao?t 08 ? 13:50, Robert Raschke a ?crit : > On Tue, Aug 12, 2008 at 12:32 PM, ERLANG wrote: >> What I'm looking after is a free, simple, and reliable (with >> replication suport) library to store large >> number (thousands to million) of very big files (>1gb per file) on >> secondary storage. > > Not quite sure if I'm missing the point, but a filesystem on RAIDed > disks would do that, yes? > > Or did you want replicated and distributed? > I need both if possible. cheers Y. > Robby > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlangy@REDACTED Tue Aug 12 14:07:02 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 14:07:02 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Message-ID: <95C749E8-AEC2-4818-9B02-E9263835CAB3@gmail.com> Hello Norton, > Y - > > How about Mnesia unlimited? > > http://www.wagerlabs.com/blog/2008/06/mnesia-unlimited.html > Excellent pointer. Many thanks. cheers Y. > > On Tue, 12 Aug 2008 20:32:29 +0900, ERLANG wrote: > >> Hi Jan, >> >> Like CouchDB's introduction pointed, it's not a reliable DB like S3. >> >> What I'm looking after is a free, simple, and reliable (with >> replication suport) library to store large >> number (thousands to million) of very big files (>1gb per file) on >> secondary storage. >> >> Scalaris project is a right candidate but too big in my opinion. >> I'm simply looking for something simple. >> >> Anyway, many thanks. >> >> cheers >> Y. >> >> Le 12 ao?t 08 ? 13:16, Jan Lehnardt a ?crit : >> >>> >>> On Aug 12, 2008, at 12:38 , ERLANG wrote: >>>> RappidMQ will do the job for SQS. >>>> I've to find something like S3 now ;-) >>> >>> How about CouchDB (http://couchdb.org/) as an approximation? >>> >>> Cheers >>> Jan >>> -- >>> >>>> >>>> >>>> N.B: I don't need exact clones and anything similar will be OK for >>>> the >>>> task I've to implement >>>> >>>> cheers >>>> Y. >>>> >>>> Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >>>> >>>>>> Thanks for the pointer. Unfortunatly, I'm not interested by a >>>>>> client >>>>>> interfaces but by a real implementation of Amazon's SQS and S3 >>>>>> concepts in Erlang. >>>>> >>>>> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do >>>>> what >>>>> you need (instead of SQS), or are you looking for an *exact* clone >>>>> of >>>>> the Amazon API? >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > norton@REDACTED From erlangy@REDACTED Tue Aug 12 14:15:45 2008 From: erlangy@REDACTED (ERLANG) Date: Tue, 12 Aug 2008 14:15:45 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <47D2A83F-5A09-4CFC-9C25-41502D4A8348@apache.org> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> <47D2A83F-5A09-4CFC-9C25-41502D4A8348@apache.org> Message-ID: Le 12 ao?t 08 ? 13:38, Jan Lehnardt a ?crit : > > On Aug 12, 2008, at 13:32 , ERLANG wrote: > >> Hi Jan, >> >> Like CouchDB's introduction pointed, it's not a reliable DB like S3. > > Reliable is a bendable term. You can certainly make CouchDB reliable > with not > too much effort. > By reliable, I mean performant storage engine which offers data replication, and distribution on multiple nodes as S3 supports. Our data are important, and very expensive to re-compute, so we can't use anything "unreliable" to save them. Actually, we want to move from S3 to something free and well designed. >> What I'm looking after is a free, simple, and reliable (with >> replication suport) library to store large >> number (thousands to million) of very big files (>1gb per file) on >> secondary storage. > > CouchDB does have replication and it can store large numbers of big > files. > > Feel free to send more questions along my way. If it turns out that > CouchDB > doesn't solve your problem, I don't want to push it onto you :) > I'll have a deeper look to CouchDB. Thanks for all guys. cheers Y. > >> Scalaris project is a right candidate but too big in my opinion. >> I'm simply looking for something simple. > > The not-yet available permanent storage would rule out Scalaris for > me. I just > don't have that much RAM (just teasing, I love Scalaris :) > > Cheers > Jan > -- > > >> >> >> Anyway, many thanks. >> >> cheers >> Y. >> >> Le 12 ao?t 08 ? 13:16, Jan Lehnardt a ?crit : >> >>> >>> On Aug 12, 2008, at 12:38 , ERLANG wrote: >>>> RappidMQ will do the job for SQS. >>>> I've to find something like S3 now ;-) >>> >>> How about CouchDB (http://couchdb.org/) as an approximation? >>> >>> Cheers >>> Jan >>> -- >>> >>>> >>>> >>>> N.B: I don't need exact clones and anything similar will be OK >>>> for the >>>> task I've to implement >>>> >>>> cheers >>>> Y. >>>> >>>> Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >>>> >>>>>> Thanks for the pointer. Unfortunatly, I'm not interested by a >>>>>> client >>>>>> interfaces but by a real implementation of Amazon's SQS and S3 >>>>>> concepts in Erlang. >>>>> >>>>> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do >>>>> what >>>>> you need (instead of SQS), or are you looking for an *exact* >>>>> clone of >>>>> the Amazon API? >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>> >> >> > From twoggle@REDACTED Tue Aug 12 15:03:13 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 06:03:13 -0700 (PDT) Subject: [erlang-questions] how: best way to deal with floats in eunit? Message-ID: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> I'm trying to write a test for a function that should return something like [{1, 0.1}], but because a float is being returned the exact value won't always be the same (and so I can't use ?_assertEqual). eunit doesn't appear to have anything built-in that will handle a case like this, and the nested structure makes writing a custom assertion a bit awkward. I can't imagine this is the first time anyone has used floats in eunit... any suggestions as to the best way to tackle this? From twoggle@REDACTED Tue Aug 12 15:07:18 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 06:07:18 -0700 (PDT) Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Message-ID: <23b1436e-cf81-4f2e-8217-5cd473320fe4@j22g2000hsf.googlegroups.com> > What I'm looking after is a free, simple, and reliable (with ? > replication suport) library to store large > number (thousands to million) of very big files (>1gb per file) on ? > secondary storage. Hadoop (http://hadoop.apache.org/core/) would be another candidate, if it doesn't have to be Erlang. From joe@REDACTED Tue Aug 12 15:32:44 2008 From: joe@REDACTED (Joe Williams) Date: Tue, 12 Aug 2008 08:32:44 -0500 Subject: [erlang-questions] Question about Erlang project deployment In-Reply-To: <48A10735.2000107@ghostgun.com> References: <48A10735.2000107@ghostgun.com> Message-ID: <48A190FC.80209@joetify.com> If a clustering solution won't work for you may want to try building a installation package like an RPM or Deb depending on your distribution. In both cases you can setup a server to house any custom installation packages and should to need to install or upgrade you can do this with the proper local configuration (/etc/yum.repos.d/, /etc/apt/sources.list, etc) with just one command (yum install NAME, apt-get install NAME) rather than the normal make, install procedure. It might help keep the packages in sync and the number of keystrokes to a minimum. YUM: http://en.wikipedia.org/wiki/Yellow_dog_Updater,_Modified RPM: http://en.wikipedia.org/wiki/RPM_package Deb: http://en.wikipedia.org/wiki/Deb_(file_format) -joe jm wrote: > Off hand I'd say take a look at rocks cluster linux distribution or > similar cluster distribution/management software. If this sort of > flexibility is not available take a look at cfengine > http://cfengine.org/ which automates sysadmin tasks across a number of > machines. Not knowing what contraints your operating under and only > having just started to look at cfengine myself I'm only guessing at it's > suitability. Having said that I suspect this is the answer to your query. > > > Jeff. > > > Enhnaran Alexander wrote: > >> I am now on a project that adopts Erlang as the development language. >> During the development I encountered a problem, that, we have to build >> and install Erlang on the server because we are using some third-party >> library which is written in Erlang, too. But there are more than one >> server here (maybe up to 100 servers), and it seems not reasonble to >> download the source code, make, and install Erlang (as well as OTP) on >> each server; that will be too time-consuming and not efficient. So we >> decide to make and install Erlang on one machine and copy the binaries >> (such as /lib, /bin, and so forth) to the other servers. But this >> brings forth another question: how to transfer these from server to >> server? And is there any efficient way to manage this? >> >> Thanks in advance. >> >> Enhnaran >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Name: Joseph A. Williams Email: joe@REDACTED From richardc@REDACTED Tue Aug 12 15:58:48 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2008 15:58:48 +0200 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> Message-ID: <48A19718.6050502@it.uu.se> Tim Fletcher wrote: > I'm trying to write a test for a function that should return something > like [{1, 0.1}], but because a float is being returned the exact value > won't always be the same (and so I can't use ?_assertEqual). > > eunit doesn't appear to have anything built-in that will handle a case > like this, and the nested structure makes writing a custom assertion a > bit awkward. > > I can't imagine this is the first time anyone has used floats in > eunit... any suggestions as to the best way to tackle this? I could easily add a special assertion for this, but since I don't work a lot with floating-point data, I'd appreciate some input as regards how such an assertion should work. Is it sufficient to just give a target value and an epsilon such that the expected value should be within [target-epsilon,target+epsilon], or are other variants needed such as relative precision, etc.? If you could have just one form, which would be the most flexible? /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From gustavo@REDACTED Tue Aug 12 16:31:46 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Tue, 12 Aug 2008 11:31:46 -0300 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <48A19718.6050502@it.uu.se> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> Message-ID: <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> Hello Richard, > I could easily add a special assertion for this, but since I don't > work a lot with floating-point data, I'd appreciate some input as > regards how such an assertion should work. Is it sufficient to just > give a target value and an epsilon such that the expected value should > be within [target-epsilon,target+epsilon], or are other variants needed > such as relative precision, etc.? If you could have just one form, > which would be the most flexible? That's exactly how it's done in a few other unittesting frameworks. Here is the one from Twisted's Trial (http://twistedmatrix.com/), for instance: def failUnlessApproximates(self, first, second, tolerance, msg=None): """asserts that C{first} - C{second} > C{tolerance} @param msg: if msg is None, then the failure message will be '%r ~== %r' % (first, second) """ if abs(first - second) > tolerance: raise self.failureException(msg or "%s ~== %s" % (first, second)) return first assertApproximates = failUnlessApproximates -- Gustavo Niemeyer http://niemeyer.net From richardc@REDACTED Tue Aug 12 16:41:31 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2008 16:41:31 +0200 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> Message-ID: <48A1A11B.80902@it.uu.se> Gustavo Niemeyer wrote: > That's exactly how it's done in a few other unittesting frameworks. Yes, I know. My question is: if the "floating-point people" out there could have their say before I implement an approximates-assert, would this be the form they'd prefer before any other? /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From twoggle@REDACTED Tue Aug 12 17:02:03 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 08:02:03 -0700 (PDT) Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <48A1A11B.80902@it.uu.se> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> Message-ID: > Yes, I know. My question is: if the "floating-point people" out there > could have their say before I implement an approximates-assert, would > this be the form they'd prefer before any other? And similarly, would there be a better way to handle my original problem, instead of just unpacking the data structure and using such an assertion? I don't usually deal with floats, so I don't know what the typical approach would be. From gustavo@REDACTED Tue Aug 12 17:02:07 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Tue, 12 Aug 2008 12:02:07 -0300 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <48A1A11B.80902@it.uu.se> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> Message-ID: <643d90130808120802q688fe6ccj600d35488ce045d@mail.gmail.com> >> That's exactly how it's done in a few other unittesting frameworks. > > Yes, I know. My question is: if the "floating-point people" out there > could have their say before I implement an approximates-assert, would > this be the form they'd prefer before any other? What do you mean by the "floating point-people"? Are you looking for the IEEE 754 implementers? I do deal with testing of floating point values very frequently, and you've asked for "some input as regards how such an assertion should work", which was exactly what was provided hoping it'd be useful as a data point. I won't bother next time. -- Gustavo Niemeyer http://niemeyer.net From gustavo@REDACTED Tue Aug 12 17:18:20 2008 From: gustavo@REDACTED (Gustavo Niemeyer) Date: Tue, 12 Aug 2008 12:18:20 -0300 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> Message-ID: <643d90130808120818i522cda29h4805e8613b69f293@mail.gmail.com> Hey Tim, > And similarly, would there be a better way to handle my original > problem, instead of just unpacking the data structure and using such > an assertion? I don't usually deal with floats, so I don't know what > the typical approach would be. The only alternative I can think of would be having some kind of matching feature, similar to that available in ets, which was able to perform loose float comparisons. -- Gustavo Niemeyer http://niemeyer.net From twoggle@REDACTED Tue Aug 12 16:57:23 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 12 Aug 2008 07:57:23 -0700 (PDT) Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> Message-ID: <2d28a060-d2a2-4a91-80a3-4630847056fd@8g2000hse.googlegroups.com> > That's exactly how it's done in a few other unittesting frameworks. > Here is the one from Twisted's Trial (http://twistedmatrix.com/), for > instance: Similarly in Ruby: assert_in_delta(expected_float, actual_float, delta) (Test::Unit) actual_float.should be_close(expected_float, delta) (RSpec) From atomly-erl@REDACTED Tue Aug 12 17:41:39 2008 From: atomly-erl@REDACTED (atomly) Date: Tue, 12 Aug 2008 11:41:39 -0400 Subject: [erlang-questions] Equiv of Hypertable in Erlang ? In-Reply-To: <492507.4079.qm@web31810.mail.mud.yahoo.com> References: <492507.4079.qm@web31810.mail.mud.yahoo.com> Message-ID: <20080812154139.GI53452@atomly.com> [Eric Ho ] > I'm wondering if there is something equivalent to [1]HyperTable in > Erlang. Well, what features of HyperTable are you looking for, exactly? There are a lot of similar projects and I imagine you could even integrate with HyperTable from Erlang. Try checking out Kai/Dynomite (Amazon Dynamo clones in Erlang), CouchDB, bigdata or even Mnesia. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From norton@REDACTED Tue Aug 12 13:39:59 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Tue, 12 Aug 2008 20:39:59 +0900 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> Message-ID: Y - How about Mnesia unlimited? http://www.wagerlabs.com/blog/2008/06/mnesia-unlimited.html On Tue, 12 Aug 2008 20:32:29 +0900, ERLANG wrote: > Hi Jan, > > Like CouchDB's introduction pointed, it's not a reliable DB like S3. > > What I'm looking after is a free, simple, and reliable (with > replication suport) library to store large > number (thousands to million) of very big files (>1gb per file) on > secondary storage. > > Scalaris project is a right candidate but too big in my opinion. > I'm simply looking for something simple. > > Anyway, many thanks. > > cheers > Y. > > Le 12 ao?t 08 ? 13:16, Jan Lehnardt a ?crit : > >> >> On Aug 12, 2008, at 12:38 , ERLANG wrote: >>> RappidMQ will do the job for SQS. >>> I've to find something like S3 now ;-) >> >> How about CouchDB (http://couchdb.org/) as an approximation? >> >> Cheers >> Jan >> -- >> >>> >>> >>> N.B: I don't need exact clones and anything similar will be OK for >>> the >>> task I've to implement >>> >>> cheers >>> Y. >>> >>> Le 12 ao?t 08 ? 12:20, Tim Fletcher a ?crit : >>> >>>>> Thanks for the pointer. Unfortunatly, I'm not interested by a >>>>> client >>>>> interfaces but by a real implementation of Amazon's SQS and S3 >>>>> concepts in Erlang. >>>> >>>> Sorry :) AFAIK there is nothing like that yet. Would RabbitMQ do >>>> what >>>> you need (instead of SQS), or are you looking for an *exact* clone >>>> of >>>> the Amazon API? >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- norton@REDACTED From Marc_Eisenbarth@REDACTED Tue Aug 12 19:54:59 2008 From: Marc_Eisenbarth@REDACTED (Marc Eisenbarth) Date: Tue, 12 Aug 2008 19:54:59 +0200 Subject: [erlang-questions] Low Level Socket Example Message-ID: <20080812175459.232070@gmx.net> hi all! I have been browsing the source code in hopes of learning more about how the network stack works, as implemented by Erlang. At this point, a small example would be extremely helpful. How would I go about opening a socket and sending a single SYN (structured as the first packet in the TCP 3-way handshake) and then stop communications? Since this doesn't follow the standard TCP connect paradigm (single packet, no FIN, etc.), it will be a helpful example for myself. -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser From xbmodder@REDACTED Tue Aug 12 20:28:15 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Tue, 12 Aug 2008 11:28:15 -0700 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: <20080812175459.232070@gmx.net> References: <20080812175459.232070@gmx.net> Message-ID: <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> Why can't you use gen_tcp? Do you really need to implement OS level APIs in Erlang? Erlang really isn't the right language for raw socket manipulation. Try out C. If you really want to get to know the lower layer network protocols, play with Click (modular router). On Tue, Aug 12, 2008 at 10:54 AM, Marc Eisenbarth wrote: > hi all! > > I have been browsing the source code in hopes of learning more about how > the network stack works, as implemented by Erlang. At this point, a small > example would be extremely helpful. How would I go about opening a socket > and sending a single SYN (structured as the first packet in the TCP 3-way > handshake) and then stop communications? Since this doesn't follow the > standard TCP connect paradigm (single packet, no FIN, etc.), it will be a > helpful example for myself. > -- > Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten > Browser-Versionen downloaden: http://www.gmx.net/de/go/browser > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hroe@REDACTED Tue Aug 12 21:01:16 2008 From: hroe@REDACTED (hroe@REDACTED) Date: Tue, 12 Aug 2008 21:01:16 +0200 Subject: [erlang-questions] typo in erl_ddll manual page Message-ID: <7654917.1218567676422.JavaMail.root@webmail2.groni1> Hi, noticed a typo in the erl_ddll manual page at http://erlang.org/doc/man/erl_ddll.html RealoadOption should be ReloadOption Herman From richardc@REDACTED Tue Aug 12 21:22:46 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2008 21:22:46 +0200 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> Message-ID: <48A1E306.4040302@it.uu.se> Tim Fletcher wrote: > And similarly, would there be a better way to handle my original > problem, instead of just unpacking the data structure and using such > an assertion? I don't usually deal with floats, so I don't know what > the typical approach would be. Your example was that you'd get "something like [{1, 0.1}]", but do you only require that e.g. {1, 2, 3} compares equal to {1.0, 2.0, 3.0}, i.e., that the only differences that may occur are due to integer <-> float conversions, or do you need to handle actual computed values, so that {1,2,3} should compare equal to {1.0000001,2.0000001,3.0000001}? In the first case, a simple == comparison on the whole term should be enough. In the latter case you really have to unpack the structure and handle each comparison separately. /Richard From richardc@REDACTED Tue Aug 12 21:49:35 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 12 Aug 2008 21:49:35 +0200 Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <643d90130808120802q688fe6ccj600d35488ce045d@mail.gmail.com> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> <643d90130808120802q688fe6ccj600d35488ce045d@mail.gmail.com> Message-ID: <48A1E94F.3030307@it.uu.se> Gustavo Niemeyer wrote: > What do you mean by the "floating point-people"? Are you looking for the > IEEE 754 implementers? No, just people who know what they want from their floating point operations. In my experience, doing floating-point computations right is always trickier that one would think, and the people who can tell you precisely how and why belong to a rather select priesthood. > I do deal with testing of floating point values very frequently, and you've > asked for "some input as regards how such an assertion should work", > which was exactly what was provided hoping it'd be useful as a data > point. I won't bother next time. Well, I _do_ appreciate input, but if you see it from my perspective, you didn't actually tell me that you _did_ have any real experience with floating point computations - you just pointed me at a single example from another framework, which might or might not have been implemented by someone with even less experience than me. I'm just a bit surprised that most frameworks seem to provide only an absolute error assertion, since I thought the relative error was often a better measure. I suppose I should provide macros for both variants. /Richard From Marc_Eisenbarth@REDACTED Tue Aug 12 21:50:11 2008 From: Marc_Eisenbarth@REDACTED (Marc Eisenbarth) Date: Tue, 12 Aug 2008 21:50:11 +0200 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> References: <20080812175459.232070@gmx.net> <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> Message-ID: <20080812195011.232060@gmx.net> > Why can't you use gen_tcp? Do you really need to implement OS level APIs > in > Erlang? Erlang really isn't the right language for raw socket > manipulation. > Try out C. gen_tcp will do the entire TCP session setup for me, so it's not appropriate for my task. Just because C might be better for this task, doesn't mean it's better for the rest of my program. In fact, there's are at least 2 examples of projects that implement network stacks in Erlang, so at least a few people out there that would disagree with you and instead agree that there is some merit in using Erlang :) -- GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@REDACTED From Marc_Eisenbarth@REDACTED Tue Aug 12 23:19:15 2008 From: Marc_Eisenbarth@REDACTED (Marc Eisenbarth) Date: Tue, 12 Aug 2008 23:19:15 +0200 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: <48A1F688.3090701@gmail.com> References: <20080812175459.232070@gmx.net> <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> <20080812195011.232060@gmx.net> <48A1F688.3090701@gmail.com> Message-ID: <20080812211915.232050@gmx.net> Thank you for the encouragement. At this point I have a copy of a paper by Paris, Gulias, and Valderruten as well as the released source code from a second project by Torbj?rn T?rnkvist. I think this will be plenty of information to digest :) -------- Original-Nachricht -------- > Datum: Tue, 12 Aug 2008 16:46:00 -0400 > Von: Serge Aleynikov > An: Marc Eisenbarth > CC: Sargun Dhillon , erlang-questions@REDACTED > Betreff: Re: [erlang-questions] Low Level Socket Example > If you are interested in learning the details of network protocols, > Erlang could be your friend for the task as a rapid prototyping > framework. You have to be aware though that a TCP stack in Erlang will > not deliver the same performance as the kernel-level stack > implementation. However it is doable as a proof of concept. > > The network driver that comes with Erlang is not suited for this task, > as it serves as a bridge between TCP/SCTP/UDP protocols and the > emulator. So if you really have interest in accessing raw sockets, > you'd need to write a driver in C/C++ to marshal raw packets between > user-level POSIX API and an Erlang process. > > Serge > > Marc Eisenbarth wrote: > >> Why can't you use gen_tcp? Do you really need to implement OS level > APIs > >> in > >> Erlang? Erlang really isn't the right language for raw socket > >> manipulation. > >> Try out C. > > > > gen_tcp will do the entire TCP session setup for me, so it's not > appropriate for my task. Just because C might be better for this task, doesn't > mean it's better for the rest of my program. In fact, there's are at least 2 > examples of projects that implement network stacks in Erlang, so at least a > few people out there that would disagree with you and instead agree that > there is some merit in using Erlang :) -- Psssst! Schon das coole Video vom GMX MultiMessenger gesehen? Der Eine f?r Alle: http://www.gmx.net/de/go/messenger03 From saleyn@REDACTED Tue Aug 12 22:46:00 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 12 Aug 2008 16:46:00 -0400 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: <20080812195011.232060@gmx.net> References: <20080812175459.232070@gmx.net> <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> <20080812195011.232060@gmx.net> Message-ID: <48A1F688.3090701@gmail.com> If you are interested in learning the details of network protocols, Erlang could be your friend for the task as a rapid prototyping framework. You have to be aware though that a TCP stack in Erlang will not deliver the same performance as the kernel-level stack implementation. However it is doable as a proof of concept. The network driver that comes with Erlang is not suited for this task, as it serves as a bridge between TCP/SCTP/UDP protocols and the emulator. So if you really have interest in accessing raw sockets, you'd need to write a driver in C/C++ to marshal raw packets between user-level POSIX API and an Erlang process. Serge Marc Eisenbarth wrote: >> Why can't you use gen_tcp? Do you really need to implement OS level APIs >> in >> Erlang? Erlang really isn't the right language for raw socket >> manipulation. >> Try out C. > > gen_tcp will do the entire TCP session setup for me, so it's not appropriate for my task. Just because C might be better for this task, doesn't mean it's better for the rest of my program. In fact, there's are at least 2 examples of projects that implement network stacks in Erlang, so at least a few people out there that would disagree with you and instead agree that there is some merit in using Erlang :) From trifod@REDACTED Wed Aug 13 03:07:30 2008 From: trifod@REDACTED (Jared Langson) Date: Tue, 12 Aug 2008 21:07:30 -0400 Subject: [erlang-questions] help with smoker's problem Message-ID: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> I decided to solve the smoker's problemto get a feel for the language. Anyways the arbiter (Sally) never reaches the end of her "loop". She stops "looping" after a seemingly random amount. Sometimes once, but I've never seen her go above 300 repititions. Any ideas as to what I am doing wrong? thank you, Jared Langson -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smokers.erl Type: application/octet-stream Size: 5006 bytes Desc: not available URL: From colm.dougan@REDACTED Wed Aug 13 04:34:43 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Wed, 13 Aug 2008 03:34:43 +0100 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> Message-ID: <24d4f39c0808121934i2f9cef62ye24226b4fc06292b@mail.gmail.com> 2008/8/13 Jared Langson : > I decided to solve the smoker's problem to get a feel for the language. > Anyways the arbiter (Sally) never reaches the end of her "loop". She stops > "looping" after a seemingly random amount. Sometimes once, but I've never > seen her go above 300 repititions. Any ideas as to what I am doing wrong? I'm not familiar with this problem, but I see 2 potential issues with your code : 1. In Sally's second "receive" clause, you are sending a message to Mat but then receiving from Paul. Looks like you should be receiving from Mat. 2. The more general problem is that is that you assume that if Tom, Mat or Paul is giving Sally one of their items that they themselves can never be the second smoker. So for example, what happens if Tom is giving you tobacco when Tom is the second smoker? That case is never catered for, AFAICS. You probably want to look at ways to avoid all the repetition in sally(). For example, if you knew what item was associated with the FirstSmoker and SecondSmoker and also who the remaining smoker was you could cut out a lot of similar code You could use something like a dict() to store the running totals for each person. Colm From monch1962@REDACTED Wed Aug 13 06:54:58 2008 From: monch1962@REDACTED (David Mitchell) Date: Wed, 13 Aug 2008 14:54:58 +1000 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: <48A1F688.3090701@gmail.com> References: <20080812175459.232070@gmx.net> <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> <20080812195011.232060@gmx.net> <48A1F688.3090701@gmail.com> Message-ID: If you want a very powerful network toolkit that can do just about anything conceivable, check out Scapy (http://www.secdev.org/projects/scapy/). It's Python, not Erlang, but I doubt that a more capable/extensible/powerful network toolkit exists short of getting into e.g. Linux kernel code and tweaking it. Regards Dave M. 2008/8/13 Serge Aleynikov : > If you are interested in learning the details of network protocols, > Erlang could be your friend for the task as a rapid prototyping > framework. You have to be aware though that a TCP stack in Erlang will > not deliver the same performance as the kernel-level stack > implementation. However it is doable as a proof of concept. > > The network driver that comes with Erlang is not suited for this task, > as it serves as a bridge between TCP/SCTP/UDP protocols and the > emulator. So if you really have interest in accessing raw sockets, > you'd need to write a driver in C/C++ to marshal raw packets between > user-level POSIX API and an Erlang process. > > Serge > > Marc Eisenbarth wrote: >>> Why can't you use gen_tcp? Do you really need to implement OS level APIs >>> in >>> Erlang? Erlang really isn't the right language for raw socket >>> manipulation. >>> Try out C. >> >> gen_tcp will do the entire TCP session setup for me, so it's not appropriate for my task. Just because C might be better for this task, doesn't mean it's better for the rest of my program. In fact, there's are at least 2 examples of projects that implement network stacks in Erlang, so at least a few people out there that would disagree with you and instead agree that there is some merit in using Erlang :) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From pguyot@REDACTED Wed Aug 13 09:18:47 2008 From: pguyot@REDACTED (Paul Guyot) Date: Wed, 13 Aug 2008 09:18:47 +0200 Subject: [erlang-questions] Auto recompilation Message-ID: Hello, Do you know of an auto-recompilation server, i.e. a process that looks for changes in source files and recompiles whatever changed in the background? There is eunit's watcher, but from I gather reading the source, it is not an auto-recompilation server. It is opt-in (you must declare modules to watch), it doesn't recompile and it uses code:purge/1 instead of code:soft_purge/1 (which can kill a process). I've cooked a simple one, but since this is a very small (<200 lines) albeit useful program, I guess there should be a more mature implementation around, but I couldn't find one with a Google search. Paul From pguyot@REDACTED Wed Aug 13 09:20:47 2008 From: pguyot@REDACTED (Paul Guyot) Date: Wed, 13 Aug 2008 09:20:47 +0200 Subject: [erlang-questions] Dialyzer and try/after In-Reply-To: <48A15BC2.5080301@it.uu.se> References: <3FBBDA45-9B19-44D3-99B9-B48E7F10C543@kallisys.net> <489FF10D.10400@kreditor.se> <48A15BC2.5080301@it.uu.se> Message-ID: <5406F68A-19EA-4CE4-BAB1-CEBD57C2BA9E@kallisys.net> Le 12 ao?t 08 ? 11:45, Richard Carlsson a ?crit : > We have identified the problem, which has more to do with how the > compiler currently handles the code in the "after" block. We will > try to improve this as soon as we can, but we can't guarantee that > the fix gets in to the next release of OTP, which I think is due > fairly soon. > > Meanwhile, the workaround is to manually lift the after...end > part to a separate function; in your case: > > ... > after > do_after(FooResult) > end, > Result. > > do_after(FooResult) -> > case FooResult of > {ok, _} -> > case foo_finalize(FooResult) of > ok -> ignore; > FinalizeError -> throw({barError, FinalizeError}) > end; > _ -> > io:format("_ can match.~n") > end > > Hope this works for you. Thanks for your reply. Tobias also mentioned I could introduce a bogus catch clause to avoid the dialyzer warning, which is what I've done with satisfaction, until the bug is fixed upstream :) Paul From vychodil.hynek@REDACTED Wed Aug 13 10:56:17 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 13 Aug 2008 10:56:17 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: Message-ID: <4d08db370808130156p62746034ic503dfb0c56e6401@mail.gmail.com> I cooked another one for myself (a little shorter than yours) but than I decide it is wrong idea. Auto recompilation is good toy but contraindication to reliability. On Wed, Aug 13, 2008 at 9:18 AM, Paul Guyot wrote: > Hello, > > Do you know of an auto-recompilation server, i.e. a process that > looks for changes in source files and recompiles whatever changed in > the background? > > There is eunit's watcher, but from I gather reading the source, it is > not an auto-recompilation server. It is opt-in (you must declare > modules to watch), it doesn't recompile and it uses code:purge/1 > instead of code:soft_purge/1 (which can kill a process). > > I've cooked a simple one, but since this is a very small (<200 lines) > albeit useful program, I guess there should be a more mature > implementation around, but I couldn't find one with a Google search. > > Paul > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Wed Aug 13 11:08:32 2008 From: pguyot@REDACTED (Paul Guyot) Date: Wed, 13 Aug 2008 11:08:32 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: <4d08db370808130156p62746034ic503dfb0c56e6401@mail.gmail.com> References: <4d08db370808130156p62746034ic503dfb0c56e6401@mail.gmail.com> Message-ID: Le 13 ao?t 08 ? 10:56, Hynek Vychodil a ?crit : > I cooked another one for myself (a little shorter than yours) but > than I > decide it is wrong idea. Auto recompilation is good toy but > contraindication > to reliability. Do you mean using auto recompilation in production systems? There seems to be a misunderstanding here, as I'm mentioning auto- recompilation as a development tool, i.e. as a way to avoid stop/ compile/deploy/start cycles during development. Paul From vychodil.hynek@REDACTED Wed Aug 13 13:07:48 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 13 Aug 2008 13:07:48 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: <4d08db370808130156p62746034ic503dfb0c56e6401@mail.gmail.com> Message-ID: <4d08db370808130407s1dd69c73x7d83c6170d340c07@mail.gmail.com> No, I don't mean using it in production system. But anyway automate stop/compile/deploy/start cycle is better way than solve it by auto recompile. It should be controllable. When it is controllable, you can transform stop/compile/deploy/start cycle to compile/upgrade without stop cycle as erlang provide by hot code swap in controlled manner. Do it every time when I press :w or C-x C-s or auto-save is invoked is weird. It should be invoked by pressing another button. On Wed, Aug 13, 2008 at 11:08 AM, Paul Guyot wrote: > Le 13 ao?t 08 ? 10:56, Hynek Vychodil a ?crit : > > I cooked another one for myself (a little shorter than yours) but than I >> decide it is wrong idea. Auto recompilation is good toy but >> contraindication >> to reliability. >> > > > Do you mean using auto recompilation in production systems? There seems to > be a misunderstanding here, as I'm mentioning auto-recompilation as a > development tool, i.e. as a way to avoid stop/compile/deploy/start cycles > during development. > > Paul > > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Wed Aug 13 13:28:58 2008 From: csanto@REDACTED (Corrado Santoro) Date: Wed, 13 Aug 2008 13:28:58 +0200 Subject: [erlang-questions] Reading a string from console without echo Message-ID: <48A2C57A.2060501@diit.unict.it> Hi all, do you know if it is possible to disable echo of characters when using io:read (or a similar routine) in reading from console? --C. -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From bharani_vms@REDACTED Wed Aug 13 14:27:02 2008 From: bharani_vms@REDACTED (Bharani) Date: Wed, 13 Aug 2008 05:27:02 -0700 (PDT) Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 Message-ID: <18962077.post@talk.nabble.com> Hi, I am relatively new to Erlang and i have been playing with ejson for a while. Right now to access nested objects i am using a function like json_find(Json,[]) -> Json; json_find(Json,[H|T])-> {ok,JsonNew}=json:obj_find(H,Json),find(JsonNew,T). get(Json,Key)-> json_find(Json,string:tokens(Key,".")) . so that i can simple say get(,"obj1.obj2.field") is this right way to do or can any one point out best practices Thanks Bharani -- View this message in context: http://www.nabble.com/javascript-.-notation-to-fetch-objects-from-JSON-decode_string-1-tp18962077p18962077.html Sent from the Erlang Questions mailing list archive at Nabble.com. From tbaldridge@REDACTED Wed Aug 13 15:02:16 2008 From: tbaldridge@REDACTED (Timothy Baldridge) Date: Wed, 13 Aug 2008 07:02:16 -0600 Subject: [erlang-questions] Message Passing over the 'Net Message-ID: Greetings, I'm a recent convert to Erlang. I'm still reading up a bit on the language, then I plan on trying out some basic "Hello World" apps before diving into a more complex program. I have a few questions about Erlang's message passing. I understand the basic idea behind message passing in Erlang, and how processes can be distributed to other physical machines. Is there a way to pass messages like this across a rather unsafe medium like the Internet? For instance, I'd like to write a client/server app where users can login to the main server over the Internet. Both ends of the program will be in Erlang. Now I know I could write marshaling routines to pack and unpack the data on either end, and shove the packaged data over TCP/IP, but it would be much nicer if Erlang had a way that was as simple as PID ! message. And secondly, if the above is possible, is it possible to encrypt the communication by piping it through a SSL connection? I'm sure there has to be something like this. Thanks for the help, as a big fan of the Python language, let me say that Erlang's feature set was what made me decide to switch. Python has many bottlenecks, and Erlang, while different, takes care of most of these issues. Thanks, Timothy -- Two wrights don't make a rong, they make an airplane. Or bicycles. From bengt.kleberg@REDACTED Wed Aug 13 16:17:07 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 13 Aug 2008 16:17:07 +0200 Subject: [erlang-questions] Message Passing over the 'Net In-Reply-To: References: Message-ID: <1218637027.11380.15.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Can you get hold of the book "Programming Erlang"? If so, then chapter 10 Distributed Programming will explain the alternatives. bengt On Wed, 2008-08-13 at 07:02 -0600, Timothy Baldridge wrote: > Greetings, > > I'm a recent convert to Erlang. I'm still reading up a bit on the > language, then I plan on trying out some basic "Hello World" apps > before diving into a more complex program. > > I have a few questions about Erlang's message passing. I understand > the basic idea behind message passing in Erlang, and how processes can > be distributed to other physical machines. Is there a way to pass > messages like this across a rather unsafe medium like the Internet? > For instance, I'd like to write a client/server app where users can > login to the main server over the Internet. Both ends of the program > will be in Erlang. Now I know I could write marshaling routines to > pack and unpack the data on either end, and shove the packaged data > over TCP/IP, but it would be much nicer if Erlang had a way that was > as simple as PID ! message. > > And secondly, if the above is possible, is it possible to encrypt the > communication by piping it through a SSL connection? I'm sure there > has to be something like this. > > Thanks for the help, as a big fan of the Python language, let me say > that Erlang's feature set was what made me decide to switch. Python > has many bottlenecks, and Erlang, while different, takes care of most > of these issues. > > Thanks, > > Timothy > From drcabana@REDACTED Wed Aug 13 16:29:45 2008 From: drcabana@REDACTED (David Cabana) Date: Wed, 13 Aug 2008 10:29:45 -0400 Subject: [erlang-questions] Message Passing over the 'Net In-Reply-To: References: Message-ID: <44ed5e0f0808130729r73420034u9eb71df19d27df00@mail.gmail.com> If I recall correctly, Joe's book has an extended example concerning a chat system which touches on sending messages across the internet, and the associated security issues. On Wed, Aug 13, 2008 at 9:02 AM, Timothy Baldridge wrote: > Greetings, > > I'm a recent convert to Erlang. I'm still reading up a bit on the > language, then I plan on trying out some basic "Hello World" apps > before diving into a more complex program. > > I have a few questions about Erlang's message passing. I understand > the basic idea behind message passing in Erlang, and how processes can > be distributed to other physical machines. Is there a way to pass > messages like this across a rather unsafe medium like the Internet? > For instance, I'd like to write a client/server app where users can > login to the main server over the Internet. Both ends of the program > will be in Erlang. Now I know I could write marshaling routines to > pack and unpack the data on either end, and shove the packaged data > over TCP/IP, but it would be much nicer if Erlang had a way that was > as simple as PID ! message. > > And secondly, if the above is possible, is it possible to encrypt the > communication by piping it through a SSL connection? I'm sure there > has to be something like this. > > Thanks for the help, as a big fan of the Python language, let me say > that Erlang's feature set was what made me decide to switch. Python > has many bottlenecks, and Erlang, while different, takes care of most > of these issues. > > Thanks, > > Timothy > > -- > Two wrights don't make a rong, they make an airplane. Or bicycles. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Wed Aug 13 16:54:33 2008 From: dawsdesign@REDACTED (Matthew Williamson) Date: Wed, 13 Aug 2008 10:54:33 -0400 Subject: [erlang-questions] Message Passing over the 'Net In-Reply-To: References: <44ed5e0f0808130729r73420034u9eb71df19d27df00@mail.gmail.com> Message-ID: I believe the dime summary would be: it is not safe. Distributed erlang should be used only in a LAN environment because it goes over plaintext. The way around it is VPN, but that doesn't sound suitable for your case. Something close it would be to use gen_tcp and send messages to the client's local client server. Logically, something like: send message to local broker (gen_server using gen_tcp) that has established tcp connection with server broker (gen_server using gen_tcp), local broker transmits serialized erlang term over internet (can do encryption here), server broker receives message and passes to gen_server which will process the request and use the server broker to reply. This is all indeed in Joe's book, with further detail. 2008/8/13 David Cabana If I recall correctly, Joe's book has an extended example concerning a chat > system which touches on sending messages across the internet, and the > associated security issues. > > > On Wed, Aug 13, 2008 at 9:02 AM, Timothy Baldridge wrote: > >> Greetings, >> >> I'm a recent convert to Erlang. I'm still reading up a bit on the >> language, then I plan on trying out some basic "Hello World" apps >> before diving into a more complex program. >> >> I have a few questions about Erlang's message passing. I understand >> the basic idea behind message passing in Erlang, and how processes can >> be distributed to other physical machines. Is there a way to pass >> messages like this across a rather unsafe medium like the Internet? >> For instance, I'd like to write a client/server app where users can >> login to the main server over the Internet. Both ends of the program >> will be in Erlang. Now I know I could write marshaling routines to >> pack and unpack the data on either end, and shove the packaged data >> over TCP/IP, but it would be much nicer if Erlang had a way that was >> as simple as PID ! message. >> >> And secondly, if the above is possible, is it possible to encrypt the >> communication by piping it through a SSL connection? I'm sure there >> has to be something like this. >> >> Thanks for the help, as a big fan of the Python language, let me say >> that Erlang's feature set was what made me decide to switch. Python >> has many bottlenecks, and Erlang, while different, takes care of most >> of these issues. >> >> Thanks, >> >> Timothy >> >> -- >> Two wrights don't make a rong, they make an airplane. Or bicycles. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Wed Aug 13 16:55:08 2008 From: dawsdesign@REDACTED (Matthew Williamson) Date: Wed, 13 Aug 2008 10:55:08 -0400 Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: References: <18962077.post@talk.nabble.com> Message-ID: Try out the mochiweb json module. It's at http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson.erl. I think all you need to do is call mochijson:decode(JSON) and you get a native erlang data structure. On Wed, Aug 13, 2008 at 8:27 AM, Bharani wrote: > > Hi, > > I am relatively new to Erlang and i have been playing with ejson for a > while. Right now to access nested objects i am using a function like > > json_find(Json,[]) -> Json; > json_find(Json,[H|T])-> {ok,JsonNew}=json:obj_find(H,Json),find(JsonNew,T). > > get(Json,Key)-> > json_find(Json,string:tokens(Key,".")) > . > > so that i can simple say get(,"obj1.obj2.field") > > is this right way to do or can any one point out best practices > > Thanks > Bharani > -- > View this message in context: > http://www.nabble.com/javascript-.-notation-to-fetch-objects-from-JSON-decode_string-1-tp18962077p18962077.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Wed Aug 13 16:56:43 2008 From: dawsdesign@REDACTED (Matthew Williamson) Date: Wed, 13 Aug 2008 10:56:43 -0400 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: <4d08db370808130156p62746034ic503dfb0c56e6401@mail.gmail.com> <4d08db370808130407s1dd69c73x7d83c6170d340c07@mail.gmail.com> Message-ID: If you want all you're beam files in the ebin directory, run `erlc mymodule.erl -o ebin`. Try out my makefile. I think you'll like it. SRCS=src/*.erl BIN=ebin all: # Compile bytecode erlc -I include -pa $(BIN) -o $(BIN) -v $(SRCS) # Compile documentation erl -noshell -eval 'edoc:files(filelib:wildcard("src/*.erl"), [{dir, "doc"}]).' -s init stop clean: rm -f $(BIN)/* On Wed, Aug 13, 2008 at 8:50 AM, Matthew Williamson wrote: > Really I just mean calling erlc on all the files. See erlc(1) (`man erlc`). > Even a bash script would suffice. > > 2008/8/13 Hynek Vychodil > >> No, I don't mean using it in production system. But anyway automate >> stop/compile/deploy/start cycle is better way than solve it by auto >> recompile. It should be controllable. When it is controllable, you can >> transform stop/compile/deploy/start cycle to compile/upgrade without stop >> cycle as erlang provide by hot code swap in controlled manner. Do it every >> time when I press :w or C-x C-s or auto-save is invoked is weird. It should >> be invoked by pressing another button. >> >> On Wed, Aug 13, 2008 at 11:08 AM, Paul Guyot wrote: >> >>> Le 13 ao?t 08 ? 10:56, Hynek Vychodil a ?crit : >>> >>> I cooked another one for myself (a little shorter than yours) but than I >>>> decide it is wrong idea. Auto recompilation is good toy but >>>> contraindication >>>> to reliability. >>>> >>> >>> >>> Do you mean using auto recompilation in production systems? There seems >>> to be a misunderstanding here, as I'm mentioning auto-recompilation as a >>> development tool, i.e. as a way to avoid stop/compile/deploy/start cycles >>> during development. >>> >>> Paul >>> >>> >> >> >> -- >> --Hynek (Pichi) Vychodil >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Wed Aug 13 21:01:22 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Wed, 13 Aug 2008 14:01:22 -0500 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: Message-ID: mochiweb includes a module "reloader" that will monitor any loaded .beam files for changes and automatically reload them and try to run an exported test/0 method if available: http://code.google.com/p/mochiweb/source/browse/trunk/src/reloader.erl I typically edit files in Emacs, run Erlang in a separate terminal (not using any of erlang-mode's integration), run M-x recompile in Emacs to rebuild files, and the Erlang process will detect the new .beams and run our regression tests for the modules. On Wed, Aug 13, 2008 at 2:18 AM, Paul Guyot wrote: > Hello, > > Do you know of an auto-recompilation server, i.e. a process that > looks for changes in source files and recompiles whatever changed in > the background? > > There is eunit's watcher, but from I gather reading the source, it is > not an auto-recompilation server. It is opt-in (you must declare > modules to watch), it doesn't recompile and it uses code:purge/1 > instead of code:soft_purge/1 (which can kill a process). > > I've cooked a simple one, but since this is a very small (<200 lines) > albeit useful program, I guess there should be a more mature > implementation around, but I couldn't find one with a Google search. > > Paul > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dawsdesign@REDACTED Wed Aug 13 22:00:35 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 13 Aug 2008 16:00:35 -0400 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: Message-ID: Good to know. I'm ever impressed by the Mochi libraries :) On Wed, Aug 13, 2008 at 3:01 PM, Matthew Dempsky wrote: > mochiweb includes a module "reloader" that will monitor any loaded > .beam files for changes and automatically reload them and try to run > an exported test/0 method if available: > > http://code.google.com/p/mochiweb/source/browse/trunk/src/reloader.erl > > I typically edit files in Emacs, run Erlang in a separate terminal > (not using any of erlang-mode's integration), run M-x recompile in > Emacs to rebuild files, and the Erlang process will detect the new > .beams and run our regression tests for the modules. > > On Wed, Aug 13, 2008 at 2:18 AM, Paul Guyot wrote: > > Hello, > > > > Do you know of an auto-recompilation server, i.e. a process that > > looks for changes in source files and recompiles whatever changed in > > the background? > > > > There is eunit's watcher, but from I gather reading the source, it is > > not an auto-recompilation server. It is opt-in (you must declare > > modules to watch), it doesn't recompile and it uses code:purge/1 > > instead of code:soft_purge/1 (which can kill a process). > > > > I've cooked a simple one, but since this is a very small (<200 lines) > > albeit useful program, I guess there should be a more mature > > implementation around, but I couldn't find one with a Google search. > > > > Paul > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rec@REDACTED Thu Aug 14 00:14:14 2008 From: rec@REDACTED (Roger Critchlow) Date: Wed, 13 Aug 2008 16:14:14 -0600 Subject: [erlang-questions] missing configure dependency Message-ID: <66d1c98f0808131514x500759cey86ab578f5157c7c7@mail.gmail.com> I've just noticed a few times that the configure script for otp_src_R12B-3 doesn't specify m4 as a dependency in configure.in, however the configured Makefile fails if m4 is not installed. -- rec -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Aug 14 02:33:08 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 14 Aug 2008 12:33:08 +1200 Subject: [erlang-questions] Floating point comparison for tests Message-ID: I've lost the messages that this is a reply to, sorry. This University has been involved in the Programming Contests for quite a while, and I've designed some of the NZPC and one or two of the SPPC problems. As support for the programming contests, I wrote a program that can compare a team's output file with a model answer. Look at http://www.cs.otago.ac.nz/staffpriv/ok/software.htm; it's the 'pcfpcmp' item. Quoting the documentation, it may have to match a floating point number that is in the specified interval. An interval can be [ ] {x | a <= x <= z} [ ) {x | a <= x < z} ( ) {x | a < x < z} ( ] {x | a < x <= z} where a range can be L,U a = L, z = U M*R a = min(M/R,M*R), z = max(M/R,M*R) M+D a = M-D, z = M+D There are in fact times when you might want to make a distinction between (0,1) and [0,1] and so on, despite what some people will tell you about floating point numbers and equality. (An exact 0 may in some cases mean exact disaster, so you may want to check for it...) Certainly the idea of checking anything involving random number generation by offering a tiny epsilon is not in general a sensible one. -- If stupidity were a crime, who'd 'scape hanging? From ok@REDACTED Thu Aug 14 06:12:23 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 14 Aug 2008 16:12:23 +1200 Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: <18962077.post@talk.nabble.com> References: <18962077.post@talk.nabble.com> Message-ID: <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> On 14 Aug 2008, at 12:27 am, Bharani wrote: > so that i can simple say get(,"obj1.obj2.field") > > is this right way to do or can any one point out best practices If you are *given* things like "obj1.obj2.field", this is not a bad way to do it. But what if you have ["foo",{"bar":[1,2,{"ugh":77},4]}] and you want the 77? For the sake of argument, let's suppose you are using a JSON representation where number -> number "string" -> <<"string"> [X1,...,Xn] -> [X'1,...,X'n] {"l1":X1,...,"ln":Xn} -> [{<<"l1">>,X'1},...,{<<"ln">>,X'n}] {} -> [{}] Then the path to the 77 would be [2,<<"bar">>,3,<<"ugh">>] You _can't_ handle this by splitting "2.bar.3.ugh" into tokens, because "2" and "3" are perfectly good field names in JSON. Come to think of it, {"obj1.obj2.field":137} is a perfectly good JSON object; nothing anywhere says that a JSON field label cannot contain dots. From ok@REDACTED Thu Aug 14 07:58:21 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 14 Aug 2008 17:58:21 +1200 Subject: [erlang-questions] Concerning selective receive and channels Message-ID: <1EAAD094-CE69-4BC0-8EB9-ECF8401161EB@cs.otago.ac.nz> We've had a discussion about whether Erlang's selective receive is the jewel in its grown or a wart that should be cured by the application of large quantities of "channels". I thought you might be as amused as I was to discover that there is a programming language with a long history and about as wide a following as Erlang where the analogue of a "channel" is a thing that can also do a selective receive! The language is Smalltalk. The channel analogue is called a "SharedQueue", and the basic operations are aSharedQueue nextPut: aMessage and aMessage := aSharedQueue next. This appears to be inherited from Smalltalk-80; at least both Squeak and VisualWorks Non-commercial have the same class, and some of the code is identical. However, Squeak has added aMessageOrNil := aSharedQueue nextOrNilSuchThat: [:m | ...]. where the code in ... tests to see whether the message is the kind it wants. If there are any such messages, you get the first. If not, you get nil. While VW doesn't have such a method, it adds a subclass of SharedQueue called EventQueue with a sort of negative image: anEventQueue removeEventsDestinedFor: aWindow _discards_ messages of a particular kind. So I'm picking that if we _did_ add channels to Erlang, not too long afterwards we'd find ourselves adding selective receive to them. From ulises.cervino@REDACTED Thu Aug 14 08:23:06 2008 From: ulises.cervino@REDACTED (Ulises) Date: Thu, 14 Aug 2008 07:23:06 +0100 Subject: [erlang-questions] Tips on learning Erlang Message-ID: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> Morning all, I've recently re-discovered Erlang (re-discovered it as I heard about it in '99 and gave it a go very briefly) and I was wondering if more experienced people had learning tips such as exercises, sort-of-hidden documentation, etc. I've recently read an email where this chap had implemented, as part of his own learning experience, the smokers problem. So I did too. That was a nice exercise. Any other tips then? Best, Ulises From zambal@REDACTED Thu Aug 14 09:19:43 2008 From: zambal@REDACTED (zambal) Date: Thu, 14 Aug 2008 00:19:43 -0700 (PDT) Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> Message-ID: <9c2130e0-4046-4f5c-abf0-64021c3aa1ab@25g2000hsx.googlegroups.com> Of course it totally depends on your field of interest, but I learned a lot about Erlang by experimenting with Mnesia. Mnesia is quite a complex module in Erlang, but using it makes you use most of Erlang's (sequential) language features. Best, Vincent On Aug 14, 8:23?am, Ulises wrote: > Morning all, > > I've recently re-discovered Erlang (re-discovered it as I heard about > it in '99 and gave it a go very briefly) and I was wondering if more > experienced people had learning tips such as exercises, sort-of-hidden > documentation, etc. > > I've recently read an email where this chap had implemented, as part > of his own learning experience, the smokers problem. So I did too. > That was a nice exercise. > > Any other tips then? > > Best, > > Ulises > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From xbmodder@REDACTED Thu Aug 14 10:31:00 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Thu, 14 Aug 2008 01:31:00 -0700 Subject: [erlang-questions] Low Level Socket Example In-Reply-To: References: <20080812175459.232070@gmx.net> <7c9d57ea0808121128y486dc225n182c152e2ce0a88f@mail.gmail.com> <20080812195011.232060@gmx.net> <48A1F688.3090701@gmail.com> Message-ID: <7c9d57ea0808140131i75d702c4w7764839922d6fbc4@mail.gmail.com> It would be pretty neat if you could get a working implementation of usermode sockets in Erlang that used Mnesia as a state machine database. That way you use the same socket on two different BEAM instances after a failover. Would you like to post some of your research, or information here? On Tue, Aug 12, 2008 at 9:54 PM, David Mitchell wrote: > If you want a very powerful network toolkit that can do just about > anything conceivable, check out Scapy > (http://www.secdev.org/projects/scapy/). > > It's Python, not Erlang, but I doubt that a more > capable/extensible/powerful network toolkit exists short of getting > into e.g. Linux kernel code and tweaking it. > > Regards > > Dave M. > > 2008/8/13 Serge Aleynikov : >> If you are interested in learning the details of network protocols, >> Erlang could be your friend for the task as a rapid prototyping >> framework. You have to be aware though that a TCP stack in Erlang will >> not deliver the same performance as the kernel-level stack >> implementation. However it is doable as a proof of concept. >> >> The network driver that comes with Erlang is not suited for this task, >> as it serves as a bridge between TCP/SCTP/UDP protocols and the >> emulator. So if you really have interest in accessing raw sockets, >> you'd need to write a driver in C/C++ to marshal raw packets between >> user-level POSIX API and an Erlang process. >> >> Serge >> >> Marc Eisenbarth wrote: >>>> Why can't you use gen_tcp? Do you really need to implement OS level APIs >>>> in >>>> Erlang? Erlang really isn't the right language for raw socket >>>> manipulation. >>>> Try out C. >>> >>> gen_tcp will do the entire TCP session setup for me, so it's not appropriate for my task. Just because C might be better for this task, doesn't mean it's better for the rest of my program. In fact, there's are at least 2 examples of projects that implement network stacks in Erlang, so at least a few people out there that would disagree with you and instead agree that there is some merit in using Erlang :) >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twoggle@REDACTED Thu Aug 14 11:33:07 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 14 Aug 2008 02:33:07 -0700 (PDT) Subject: [erlang-questions] how: best way to deal with floats in eunit? In-Reply-To: <643d90130808120818i522cda29h4805e8613b69f293@mail.gmail.com> References: <4c3bd8b8-0c48-41fe-b1cb-0616a892bafa@k13g2000hse.googlegroups.com> <48A19718.6050502@it.uu.se> <643d90130808120731j553af47dm41d652e5cc94868e@mail.gmail.com> <48A1A11B.80902@it.uu.se> <643d90130808120818i522cda29h4805e8613b69f293@mail.gmail.com> Message-ID: <424e468d-f549-481b-a33c-17809e788062@t54g2000hsg.googlegroups.com> > The only alternative I can think of would be having some kind of matching > feature, similar to that available in ets, which was able to perform loose > float comparisons. Sure, like a match spec. Anything like that would work, but I don't think it's worth implementing (I doubt it would be of much use outside of testing). > Your example was that you'd get "something like [{1, 0.1}]", but do > you only require that e.g. {1, 2, 3} compares equal to {1.0, 2.0, 3.0}, > i.e., that the only differences that may occur are due to integer <-> > float conversions, or do you need to handle actual computed values, so > that {1,2,3} should compare equal to {1.0000001,2.0000001,3.0000001}? The float it a computed value, so the 0.1 would need to be considered equal to 0.100000001490116. But just to make it awkward the first element of the tuple (the 1) must be an integer, so really shouldn't be considered equal to 1.0, or 1.0000001. > In the latter case you really have to unpack the structure and > handle each comparison separately. Yep, that's what i've ended up doing. I think any other way would be a bit ambiguous and/or overcomplicated. > I'm just a bit surprised that most frameworks seem to provide only an > absolute error assertion, since I thought the relative error was often > a better measure. I suppose I should provide macros for both variants. Choice is good, so I would vote for both. But, again, I'm not a "floating point person", or a "test framework expert" :) I've implemented a relative/percentage-based function for my immediate use, but if you could add some assertions to eunit that would be very helpful in the long run. Thanks both. From russell.brown@REDACTED Thu Aug 14 10:27:29 2008 From: russell.brown@REDACTED (Russell Brown) Date: Thu, 14 Aug 2008 09:27:29 +0100 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> Message-ID: I'm learning and I'm finding the Armstrong book to be very enjoyable and useful. http://www.pragprog.com/titles/jaerlang/programming-erlang On 14 Aug 2008, at 07:23, Ulises wrote: > Morning all, > > I've recently re-discovered Erlang (re-discovered it as I heard about > it in '99 and gave it a go very briefly) and I was wondering if more > experienced people had learning tips such as exercises, sort-of-hidden > documentation, etc. > > I've recently read an email where this chap had implemented, as part > of his own learning experience, the smokers problem. So I did too. > That was a nice exercise. > > Any other tips then? > > Best, > > Ulises > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ulises.cervino@REDACTED Thu Aug 14 13:36:56 2008 From: ulises.cervino@REDACTED (Ulises) Date: Thu, 14 Aug 2008 12:36:56 +0100 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> Message-ID: <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> > I'm learning and I'm finding the Armstrong book to be very enjoyable > and useful. http://www.pragprog.com/titles/jaerlang/programming-erlang Well, after food that book is the next thing to buy on my list indeed! :D At the moment I'll have to do with free info :( U From erlangy@REDACTED Thu Aug 14 13:52:42 2008 From: erlangy@REDACTED (ERLANG) Date: Thu, 14 Aug 2008 13:52:42 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <23b1436e-cf81-4f2e-8217-5cd473320fe4@j22g2000hsf.googlegroups.com> References: <48A0F71C.6000105@gmail.com> <3388BD1A-7D9D-4810-BBAC-67743D7FB435@gmail.com> <4464c509-691a-4608-b02b-846156dff8d7@t54g2000hsg.googlegroups.com> <713B1E88-5B05-4004-AC48-72D1433EB230@gmail.com> <1A24FB8F-A38C-4235-932E-A289CCDC741A@gmail.com> <6096CD8E-838F-48DF-9280-D5188288CB06@gmail.com> <23b1436e-cf81-4f2e-8217-5cd473320fe4@j22g2000hsf.googlegroups.com> Message-ID: <5B3C7B57-A4A5-4B2C-936E-888D4963A553@gmail.com> Hi guys, I'd like to share with you some softwares I selected from my actual job. My problem was to use a robust file system for data storage, replication and distribution (like Amazon S3), a messaging system (like Amazon SQS), and computing cloud (like Amazon EC2). A little Amazon if you want. All these, with an open source license if possible. And here is what I choosed : * GlusterFS (equiv. to S3) : http://www.gluster.org/ A cluster file-system capable of scaling to several peta-bytes. It aggregates various storage bricks over Infiniband RDMA or TCP/IP interconnect into one large parallel network file system. GlusterFS is based on a stackable user space design without compromising performance. * Eucalyptus (equiv. to EC2) : http://eucalyptus.cs.ucsb.edu/ Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems - is an open-source software infrastructure for implementing "cloud computing" on clusters. The current interface to EUCALYPTUS is compatible with Amazon's EC2 interface, but the infrastructure is designed to support multiple client-side interfaces. EUCALYPTUS is implemented using commonly available Linux tools and basic Web-service technologies making it easy to install and maintain. * RabbitMQ (equiv. to SQS) : http://www.rabbitmq.com/ The only exception is here. I need to hide the actual APMQ interface behind an SQS one. Not a big deal as RabbitMQ is an awesome piece of code to hack. Hope this help you build rock solid, open source, free of charge Erlang applications. cheers Y. Le 12 ao?t 08 ? 15:07, Tim Fletcher a ?crit : >> What I'm looking after is a free, simple, and reliable (with >> replication suport) library to store large >> number (thousands to million) of very big files (>1gb per file) on >> secondary storage. > > Hadoop (http://hadoop.apache.org/core/) would be another candidate, if > it doesn't have to be Erlang. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Thu Aug 14 14:37:47 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 14 Aug 2008 14:37:47 +0200 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> Message-ID: <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> A lot of joy you can make with http://www.erlang.org/starting.html It is good free starting point ;-) So you can try forge some own issue which try solve for education purpose. For example I created simple iterator module for this purpose. (I have planned public it many months ago but ...) Try make some more practical and it worth you. On Thu, Aug 14, 2008 at 1:36 PM, Ulises wrote: > > I'm learning and I'm finding the Armstrong book to be very enjoyable > > and useful. http://www.pragprog.com/titles/jaerlang/programming-erlang > > Well, after food that book is the next thing to buy on my list indeed! :D > > At the moment I'll have to do with free info :( > > U > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: iterator.erl Type: application/octet-stream Size: 25970 bytes Desc: not available URL: From kevin@REDACTED Thu Aug 14 14:56:23 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 14 Aug 2008 08:56:23 -0400 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> Message-ID: <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> Once I got past the basic syntax and concepts I found these programming exercises to help me expand my knowledge: Project Euler: http://projecteuler.net/ L-99: http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html --Kevin On Aug 14, 2008, at 8:37 AM, Hynek Vychodil wrote: > A lot of joy you can make with http://www.erlang.org/starting.html > It is good free starting point ;-) So you can try forge some own > issue which try solve for education purpose. > For example I created simple iterator module for this purpose. (I > have planned public it many months ago but ...) > Try make some more practical and it worth you. > > On Thu, Aug 14, 2008 at 1:36 PM, Ulises > wrote: > > I'm learning and I'm finding the Armstrong book to be very enjoyable > > and useful. http://www.pragprog.com/titles/jaerlang/programming-erlang > > Well, after food that book is the next thing to buy on my list > indeed! :D > > At the moment I'll have to do with free info :( > > U > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > --Hynek (Pichi) Vychodil > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From kevin@REDACTED Thu Aug 14 14:59:23 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 14 Aug 2008 08:59:23 -0400 Subject: [erlang-questions] Message Passing over the 'Net In-Reply-To: References: Message-ID: <2EF949C7-FD36-4934-BA24-737B83EFB57A@hypotheticalabs.com> If you're willing to patch your Erlang installation, there's this recipe on trapexit.org which illustrates how to make distributed Erlang work over SSL in a firewall-friendly fashion: http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls I've used it in some prototyping code and it seems to work fine. --Kevin On Aug 13, 2008, at 9:02 AM, Timothy Baldridge wrote: > Greetings, > > I'm a recent convert to Erlang. I'm still reading up a bit on the > language, then I plan on trying out some basic "Hello World" apps > before diving into a more complex program. > > I have a few questions about Erlang's message passing. I understand > the basic idea behind message passing in Erlang, and how processes can > be distributed to other physical machines. Is there a way to pass > messages like this across a rather unsafe medium like the Internet? > For instance, I'd like to write a client/server app where users can > login to the main server over the Internet. Both ends of the program > will be in Erlang. Now I know I could write marshaling routines to > pack and unpack the data on either end, and shove the packaged data > over TCP/IP, but it would be much nicer if Erlang had a way that was > as simple as PID ! message. > > And secondly, if the above is possible, is it possible to encrypt the > communication by piping it through a SSL connection? I'm sure there > has to be something like this. > > Thanks for the help, as a big fan of the Python language, let me say > that Erlang's feature set was what made me decide to switch. Python > has many bottlenecks, and Erlang, while different, takes care of most > of these issues. > > Thanks, > > Timothy > > -- > Two wrights don't make a rong, they make an airplane. Or bicycles. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dawsdesign@REDACTED Thu Aug 14 16:21:40 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Thu, 14 Aug 2008 10:21:40 -0400 Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> References: <18962077.post@talk.nabble.com> <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> Message-ID: Pattern matching: 1> Decoded = mochijson:decode(JSON). 2> ["foo",{"bar":[1,2,{"ugh":MYNUMBER}, 4]}] = Decoded. ["foo",{"bar":[1,2,{"ugh":7}, 4]}] 3> MYNUMBER. 7 On Thu, Aug 14, 2008 at 12:12 AM, Richard A. O'Keefe wrote: > On 14 Aug 2008, at 12:27 am, Bharani wrote: > > so that i can simple say get(,"obj1.obj2.field") > > > > is this right way to do or can any one point out best practices > > If you are *given* things like "obj1.obj2.field", this is not a > bad way to do it. But what if you have > ["foo",{"bar":[1,2,{"ugh":77},4]}] > and you want the 77? > > For the sake of argument, let's suppose you are using a JSON > representation where > > number -> number > "string" -> <<"string"> > [X1,...,Xn] -> [X'1,...,X'n] > {"l1":X1,...,"ln":Xn} -> [{<<"l1">>,X'1},...,{<<"ln">>,X'n}] > {} -> [{}] > > Then the path to the 77 would be > [2,<<"bar">>,3,<<"ugh">>] > You _can't_ handle this by splitting "2.bar.3.ugh" into tokens, > because "2" and "3" are perfectly good field names in JSON. > Come to think of it, > {"obj1.obj2.field":137} > is a perfectly good JSON object; nothing anywhere says that a > JSON field label cannot contain dots. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Thu Aug 14 16:29:06 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Thu, 14 Aug 2008 10:29:06 -0400 Subject: [erlang-questions] Message Passing over the 'Net In-Reply-To: <2EF949C7-FD36-4934-BA24-737B83EFB57A@hypotheticalabs.com> References: <2EF949C7-FD36-4934-BA24-737B83EFB57A@hypotheticalabs.com> Message-ID: Yes, I just found that article and was about to reply with it as well. On Thu, Aug 14, 2008 at 8:59 AM, Kevin A. Smith wrote: > If you're willing to patch your Erlang installation, there's this > recipe on trapexit.org which illustrates how to make distributed > Erlang work over SSL in a firewall-friendly fashion: > > http://www.trapexit.org/Distributed_erlang_using_ssl_through_firewalls > > I've used it in some prototyping code and it seems to work fine. > > --Kevin > On Aug 13, 2008, at 9:02 AM, Timothy Baldridge wrote: > > > Greetings, > > > > I'm a recent convert to Erlang. I'm still reading up a bit on the > > language, then I plan on trying out some basic "Hello World" apps > > before diving into a more complex program. > > > > I have a few questions about Erlang's message passing. I understand > > the basic idea behind message passing in Erlang, and how processes can > > be distributed to other physical machines. Is there a way to pass > > messages like this across a rather unsafe medium like the Internet? > > For instance, I'd like to write a client/server app where users can > > login to the main server over the Internet. Both ends of the program > > will be in Erlang. Now I know I could write marshaling routines to > > pack and unpack the data on either end, and shove the packaged data > > over TCP/IP, but it would be much nicer if Erlang had a way that was > > as simple as PID ! message. > > > > And secondly, if the above is possible, is it possible to encrypt the > > communication by piping it through a SSL connection? I'm sure there > > has to be something like this. > > > > Thanks for the help, as a big fan of the Python language, let me say > > that Erlang's feature set was what made me decide to switch. Python > > has many bottlenecks, and Erlang, while different, takes care of most > > of these issues. > > > > Thanks, > > > > Timothy > > > > -- > > Two wrights don't make a rong, they make an airplane. Or bicycles. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Thu Aug 14 16:35:12 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Thu, 14 Aug 2008 10:35:12 -0400 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> Message-ID: L-99 is based off the original P-99, 99 prolog problems. Erlang is also based on prolog. https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/ On Thu, Aug 14, 2008 at 8:56 AM, Kevin A. Smith wrote: > Once I got past the basic syntax and concepts I found these > programming exercises to help me expand my knowledge: > > Project Euler: http://projecteuler.net/ > > L-99: > http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html > > --Kevin > On Aug 14, 2008, at 8:37 AM, Hynek Vychodil wrote: > > > A lot of joy you can make with http://www.erlang.org/starting.html > > It is good free starting point ;-) So you can try forge some own > > issue which try solve for education purpose. > > For example I created simple iterator module for this purpose. (I > > have planned public it many months ago but ...) > > Try make some more practical and it worth you. > > > > On Thu, Aug 14, 2008 at 1:36 PM, Ulises > > wrote: > > > I'm learning and I'm finding the Armstrong book to be very enjoyable > > > and useful. http://www.pragprog.com/titles/jaerlang/programming-erlang > > > > Well, after food that book is the next thing to buy on my list > > indeed! :D > > > > At the moment I'll have to do with free info :( > > > > U > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > -- > > --Hynek (Pichi) Vychodil > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Thu Aug 14 17:08:05 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 14 Aug 2008 17:08:05 +0200 Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: References: <18962077.post@talk.nabble.com> <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> Message-ID: <4d08db370808140808v66519f3bt930b9d0d689b44fd@mail.gmail.com> Weird, JSON variable has not been bound in first statement. Second statement raise illegal expression and so. You have to have got another Erlang than me, isn't it? 2008/8/14 Matt Williamson > Pattern matching: > > 1> Decoded = mochijson:decode(JSON). > 2> ["foo",{"bar":[1,2,{"ugh":MYNUMBER}, 4]}] = Decoded. > ["foo",{"bar":[1,2,{"ugh":7}, 4]}] > 3> MYNUMBER. > 7 > > > > > On Thu, Aug 14, 2008 at 12:12 AM, Richard A. O'Keefe wrote: > >> On 14 Aug 2008, at 12:27 am, Bharani wrote: >> > so that i can simple say get(,"obj1.obj2.field") >> > >> > is this right way to do or can any one point out best practices >> >> If you are *given* things like "obj1.obj2.field", this is not a >> bad way to do it. But what if you have >> ["foo",{"bar":[1,2,{"ugh":77},4]}] >> and you want the 77? >> >> For the sake of argument, let's suppose you are using a JSON >> representation where >> >> number -> number >> "string" -> <<"string"> >> [X1,...,Xn] -> [X'1,...,X'n] >> {"l1":X1,...,"ln":Xn} -> [{<<"l1">>,X'1},...,{<<"ln">>,X'n}] >> {} -> [{}] >> >> Then the path to the 77 would be >> [2,<<"bar">>,3,<<"ugh">>] >> You _can't_ handle this by splitting "2.bar.3.ugh" into tokens, >> because "2" and "3" are perfectly good field names in JSON. >> Come to think of it, >> {"obj1.obj2.field":137} >> is a perfectly good JSON object; nothing anywhere says that a >> JSON field label cannot contain dots. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincent.dephily@REDACTED Thu Aug 14 17:15:50 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Thu, 14 Aug 2008 17:15:50 +0200 Subject: [erlang-questions] gen_server: handle_cast/2 vs handle_info/2 Message-ID: <200808141715.50407.vincent.dephily@mobile-devices.fr> Hi, I've got an app with some gen_servers that use a seemingly random mix of handle_cast/2 and handle_info/2, with no visible reason to choose one over the other. It seems to me they both have the exact same functionality, with probably just a little more overhead int the handle_cast/2 case. Is there a real reason to use one over the other (I control the sender too; my nodes are not all on the same machine but they're all constantly up and chating), or is it just a matter of taste ? -- Vincent de Phily From vincent.dephily@REDACTED Thu Aug 14 17:38:31 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Thu, 14 Aug 2008 17:38:31 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: Message-ID: <200808141738.31618.vincent.dephily@mobile-devices.fr> On Wednesday 13 August 2008 09:18:47 Paul Guyot wrote: > Do you know of an auto-recompilation server, i.e. a process that > looks for changes in source files and recompiles whatever changed in > the background? At one time when working with yaws I got anoyed at this un-web-like workflow, so I wrote my own quick fix. See attached file; you'll want to change the listed folders. -- Vincent de Phily -------------- next part -------------- A non-text attachment was scrubbed... Name: compile_inotify.sh Type: application/x-shellscript Size: 1603 bytes Desc: not available URL: From jpellerin@REDACTED Thu Aug 14 18:08:58 2008 From: jpellerin@REDACTED (jason pellerin) Date: Thu, 14 Aug 2008 12:08:58 -0400 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db Message-ID: <3bb02d620808140908m35dbd56eq773a494686e87f72@mail.gmail.com> I'm interested in using tcerl for a few projects, but I'm running into issues that I don't know how to resolve. The big one is memory use. While I can tune it a bit by decreasing the leaf and non-leaf node caches, tcerl still seems to grab tons of RAM, much more than I was (naively?) expecting. With the two cache params set to 64 each, a db of 7000 40k records takes up almost 400mb of ram. With the default cache params of 1024 and 512, it consumes over 1G. Syncs of a db of this size also take several seconds, which effectively means that I'd never be able to sync, except when shutting down a node. Tcerl folks -- am I doing something wrong? I need to support dbs of about 100,000 records of this size (with a *lot* of reads and writes) with reasonable enough RAM usage that each node can fit onto an EC2 instance with a bunch of other stuff -- realistically, 256M at most. I'd guess that the tokyocabinet hash db would be better suited to our needs, since we don't need ordered_set. But would the RAM use be any different, and do you have near-term plans to add support for the hash db to tcerl? Does anyone have any other suggestions for storage backends to try? Dets unfortunately is much too slow, and mnesia with disc tables too RAM-hungry. Thanks (and thanks for tcerl!) JP From richardc@REDACTED Thu Aug 14 18:24:53 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 14 Aug 2008 18:24:53 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: <200808141738.31618.vincent.dephily@mobile-devices.fr> References: <200808141738.31618.vincent.dephily@mobile-devices.fr> Message-ID: <48A45C55.1020301@it.uu.se> Vincent de Phily wrote: > At one time when working with yaws I got anoyed at this un-web-like workflow, > so I wrote my own quick fix. > > See attached file; you'll want to change the listed folders. Here's another variant: http://thisisnotaprogrammersblog.blogspot.com/2008/07/autobuilding-erlang-using-inotifywait.html /Richard From ulf@REDACTED Thu Aug 14 18:43:12 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 14 Aug 2008 18:43:12 +0200 Subject: [erlang-questions] gen_server: handle_cast/2 vs handle_info/2 In-Reply-To: <200808141715.50407.vincent.dephily@mobile-devices.fr> References: <200808141715.50407.vincent.dephily@mobile-devices.fr> Message-ID: <8209f740808140943u673886e8h6f19a96a17924115@mail.gmail.com> One strategy is to use cast for all application-specific messages, where you control the sender, and catch everything else in handle_info(). BR, Ulf W 2008/8/14 Vincent de Phily : > Hi, > > I've got an app with some gen_servers that use a seemingly random mix of > handle_cast/2 and handle_info/2, with no visible reason to choose one over > the other. > It seems to me they both have the exact same functionality, with probably just > a little more overhead int the handle_cast/2 case. > > Is there a real reason to use one over the other (I control the sender too; my > nodes are not all on the same machine but they're all constantly up and > chating), or is it just a matter of taste ? > -- > Vincent de Phily > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From toby@REDACTED Thu Aug 14 21:42:51 2008 From: toby@REDACTED (Toby Thain) Date: Thu, 14 Aug 2008 16:42:51 -0300 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> Message-ID: <4013A004-BDE3-4BAB-802D-4FBC586BB5A2@telegraphics.com.au> On 14-Aug-08, at 11:35 AM, Matt Williamson wrote: > L-99 is based off the original P-99, 99 prolog problems. Erlang is > also based on prolog. > > https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/ I did think it was a little odd that P98 of the lisp page states: "As a *Prolog* programmer, you are in a better situation: you can have your computer do the work!" :) --Toby -------------- next part -------------- An HTML attachment was scrubbed... URL: From drwho102003-erlang@REDACTED Thu Aug 14 21:04:32 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Thu, 14 Aug 2008 12:04:32 -0700 (PDT) Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl ? Message-ID: <953805.96169.qm@web31811.mail.mud.yahoo.com> Just curious. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpettit@REDACTED Thu Aug 14 22:37:39 2008 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Aug 2008 15:37:39 -0500 (CDT) Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl ? In-Reply-To: <953805.96169.qm@web31811.mail.mud.yahoo.com> References: <953805.96169.qm@web31811.mail.mud.yahoo.com> Message-ID: <54428.192.168.34.15.1218746259.squirrel@squirrelmail.vail> On Thu, August 14, 2008 2:04 pm, Eric Ho wrote: > Just curious. I'm curious, too--what answers did you get on the perl lists? -Rick From paul-trapexit@REDACTED Thu Aug 14 22:51:07 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Thu, 14 Aug 2008 13:51:07 -0700 (PDT) Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: <3bb02d620808140908m35dbd56eq773a494686e87f72@mail.gmail.com> References: <3bb02d620808140908m35dbd56eq773a494686e87f72@mail.gmail.com> Message-ID: We tend to talk about these things here: http://groups.google.com/group/mnesiaex-discuss Anyway, I just open a tcbdb database in the linked-in driver, no special extra memory usage that I'm aware of. I surmised from the docs that tcbdb is built on top of tchdb and stores entire pages in tchdb; so the cache params are actually in terms of pages not records (unlike tchdb). So 64 pages might be alot of your database in cache, especially since your records are kinda big (40kb each?). Actually you may need to play with parameters to avoid being considered a large object, ask the tokyocabinet folks to be sure. Anyway, the cache is implemented in mmap so typically on a 64 bit machine where there is plenty of address space it is harmless, the OS will manage physical memory. In our production system we run with minimal cache (1 leaf/1 non-leaf) and just use the OS page cache, since we are on 32 bit boxes (ec2 c1.medium). Paranthetically, we also set { deflate, true }. We're able to get dozens of tables (fragments) per node in less than a gig this way. If we were on 64 bit boxes I would try cranking up the cache and let tokyocabinet mmap away, since I suspect page faults are faster than constantly doing system calls, but I haven't benchmarked it so I don't know. Re: supporting tchdb, there is no method for positioning a cursor on or after a record in tchdb, so there is no nice way to implement next or prev. I'm holding off implementing tchdb until one materializes. I've asked the tokyocabinet maintainer to add it; last I checked it wasn't there. If it's important to you, contact him! Re: sync times, well a couple of seconds is perhaps not out of line, depending upon the amount of data. As you might already have found, I don't get the durability story of tokyocabinet (http://groups.google.com/group/mnesiaex-discuss/browse_thread/thread/da2ae1da862b01c0) but we use distributed mnesia and have multiple copies of any table so we basically never locally load a table on restart. Good luck! -- p On Thu, 14 Aug 2008, jason pellerin wrote: > I'm interested in using tcerl for a few projects, but I'm running into > issues that I don't know how to resolve. The big one is memory use. > While I can tune it a bit by decreasing the leaf and non-leaf node > caches, tcerl still seems to grab tons of RAM, much more than I was > (naively?) expecting. With the two cache params set to 64 each, a db > of 7000 40k records takes up almost 400mb of ram. With the default > cache params of 1024 and 512, it consumes over 1G. Syncs of a db of > this size also take several seconds, which effectively means that I'd > never be able to sync, except when shutting down a node. > > Tcerl folks -- am I doing something wrong? I need to support dbs of > about 100,000 records of this size (with a *lot* of reads and writes) > with reasonable enough RAM usage that each node can fit onto an EC2 > instance with a bunch of other stuff -- realistically, 256M at most. > I'd guess that the tokyocabinet hash db would be better suited to our > needs, since we don't need ordered_set. But would the RAM use be any > different, and do you have near-term plans to add support for the hash > db to tcerl? > > Does anyone have any other suggestions for storage backends to try? > Dets unfortunately is much too slow, and mnesia with disc tables too > RAM-hungry. > > Thanks (and thanks for tcerl!) > > JP > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > In an artificial world, only extremists live naturally. -- Paul Graham From daveb@REDACTED Thu Aug 14 23:06:07 2008 From: daveb@REDACTED (Dave Bryson) Date: Thu, 14 Aug 2008 16:06:07 -0500 Subject: [erlang-questions] Modify a list of tuples Message-ID: What's the best way to modify a value for a given tuple in the list below? I have a large list with the following type of structure: [ [{a,1},{b,2}], [{b,3},{a,4}] ] I want to preserve the structure of the list and change a value on all the tuples with a given key. So for example, change all the values on the "b" tuple so the result would be: [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] I've tried list comprehension but can't get it to preserve the rest of the list. Thanks in advance! Dave From justin@REDACTED Thu Aug 14 23:15:45 2008 From: justin@REDACTED (Justin Sheehy) Date: Thu, 14 Aug 2008 17:15:45 -0400 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: Message-ID: Dave, Since you tried a list comprehension, here?s one that does what you seem to be asking for: 1> A = [ [{a,1},{b,2}], [{b,3},{a,4}] ]. [[{a,1},{b,2}],[{b,3},{a,4}]] 2> [[{X,case X of b -> changed; _ -> Y end} || {X,Y} <- Z] || Z <- A]. [[{a,1},{b,changed}],[{b,changed},{a,4}]] That might not be the best solution depending on the real problem, of course. -Justin On 8/14/08 5:06 PM, "Dave Bryson" wrote: > What's the best way to modify a value for a given tuple in the list > below? > > I have a large list with the following type of structure: > > [ [{a,1},{b,2}], [{b,3},{a,4}] ] > > I want to preserve the structure of the list and change a value on all > the tuples with a given key. So for example, change all the values on > the "b" tuple so the result would be: > > [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] > > I've tried list comprehension but can't get it to preserve the rest of > the list. > > Thanks in advance! > > Dave > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From Rainer.Hansen@REDACTED Thu Aug 14 23:17:26 2008 From: Rainer.Hansen@REDACTED (Rainer Hansen) Date: Thu, 14 Aug 2008 23:17:26 +0200 Subject: [erlang-questions] Cologne-Bonn-Euskirchen Erlounge? Message-ID: <20080814211726.45410@gmx.net> Is anyone in the Cologne-Bonn-Euskirchen area (Germany) interested in some sort of Erlang related get-together? Rainer -- GMX Kostenlose Spiele: Einfach online spielen und Spa? haben mit Pastry Passion! http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196 From torben.lehoff@REDACTED Thu Aug 14 23:32:27 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Thu, 14 Aug 2008 23:32:27 +0200 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: References: Message-ID: I have not tried this out, but something along the lines of: modify (OuterList) -> lists:map( fun modify_inner/1, OuterList). modify_inner(List) -> lists:map(fun ({b,_}) -> {b,changed}; (AllOthers) -> AllOthers end, List). If each "key" only occurs once in the inner lists you can use modify_inner(List) -> lists:keyreplace(b, 1, List, {b,changed}). Again, as Justin says, it depends on what characteristics you want the function to have. The lists module is always a good place to look, but other libraries in the stdlib such as dict, sets, gb_sets might have something that can help you. It depends on the context for your particular problem. Cheers, Torben On Thu, Aug 14, 2008 at 11:06 PM, Dave Bryson wrote: > What's the best way to modify a value for a given tuple in the list > below? > > I have a large list with the following type of structure: > > [ [{a,1},{b,2}], [{b,3},{a,4}] ] > > I want to preserve the structure of the list and change a value on all > the tuples with a given key. So for example, change all the values on > the "b" tuple so the result would be: > > [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] > > I've tried list comprehension but can't get it to preserve the rest of > the list. > > Thanks in advance! > > Dave > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Thu Aug 14 23:36:23 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 14 Aug 2008 23:36:23 +0200 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: References: Message-ID: <48A4A557.7010209@it.uu.se> Dave Bryson wrote: > What's the best way to modify a value for a given tuple in the list > below? > > I have a large list with the following type of structure: > > [ [{a,1},{b,2}], [{b,3},{a,4}] ] > > I want to preserve the structure of the list and change a value on all > the tuples with a given key. So for example, change all the values on > the "b" tuple so the result would be: > > [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] > > I've tried list comprehension but can't get it to preserve the rest of > the list. Write a list comprehension that applies lists:keymap/3 on each of the sublists. /Richard From richardc@REDACTED Thu Aug 14 23:40:44 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 14 Aug 2008 23:40:44 +0200 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: <48A4A557.7010209@it.uu.se> References: <48A4A557.7010209@it.uu.se> Message-ID: <48A4A65C.3020006@it.uu.se> Richard Carlsson wrote: > Write a list comprehension that applies lists:keymap/3 on each > of the sublists. Sorry, I remembered wrong, keymap/3 doesn't match on the actual key, it just remaps a specific field. (It's not really consistent with the other key* functions in lists.) /Richard From vlm@REDACTED Thu Aug 14 23:43:35 2008 From: vlm@REDACTED (Lev Walkin) Date: Thu, 14 Aug 2008 14:43:35 -0700 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: References: Message-ID: <48A4A707.6040102@lionet.info> Dave Bryson wrote: > What's the best way to modify a value for a given tuple in the list > below? > > I have a large list with the following type of structure: > > [ [{a,1},{b,2}], [{b,3},{a,4}] ] > > I want to preserve the structure of the list and change a value on all > the tuples with a given key. So for example, change all the values on > the "b" tuple so the result would be: > > [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] > > I've tried list comprehension but can't get it to preserve the rest of > the list. (fun(L, Property, Value) -> [T || TS <- L, T <- [ [{K, Value} || {K, V} <- TS, Value <- [case K of Property -> Value; _ -> V end] ] ] ] end)([ [{a,1},{b,2}], [{b,3},{a,4}] ], b, 'CHANGED'). === cut === Eshell V5.6.3 (abort with ^G) 1> (fun(L, Property, Value) -> [T || TS <- L, T <- [[{K, Value} || {K, V} <- TS, Value <- [case K of Property -> Value; _ -> V end]]] ] end)([ [{a,1},{b,2}], [{b,3},{a,4}] ], b, 'CHANGED'). [[{a,1},{b,'CHANGED'}],[{b,'CHANGED'},{a,4}]] 2> === cut === -- vlm From victor.sovetov@REDACTED Fri Aug 15 02:42:25 2008 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Thu, 14 Aug 2008 17:42:25 -0700 (PDT) Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang Message-ID: <18990027.post@talk.nabble.com> It seems that the thing you need is a good distributed filesystem. There are solutions able to serve 1GB/s datastream for hundreds TB storage with installation price ~$1600-2000/TB. Though, you won't be able to use common hardware, it'll require fast interconnect, at least. Sincerely, --Viktor Hi Jan, Like CouchDB's introduction pointed, it's not a reliable DB like S3. What I'm looking after is a free, simple, and reliable (with replication suport) library to store large number (thousands to million) of very big files (>1gb per file) on secondary storage. Scalaris project is a right candidate but too big in my opinion. I'm simply looking for something simple. Anyway, many thanks. cheers Y. -- View this message in context: http://www.nabble.com/large-Erlang-clusters-tp18937196p18990027.html Sent from the Erlang Questions mailing list archive at Nabble.com. From victor.sovetov@REDACTED Fri Aug 15 02:42:49 2008 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Thu, 14 Aug 2008 17:42:49 -0700 (PDT) Subject: [erlang-questions] tcerl memory usage, plans for hash-type db Message-ID: <18989955.post@talk.nabble.com> Jason, If you want to estimate tc memory requirements without Erlang driver attached, you can speak to tokyocabinet Tyrant (http://tokyocabinet.sourceforge.net/tyrantdoc/) with using memcached protocol. At least it will geve an imagination about real cache sizes on your system. Sincerely, --Viktor jason pellerin wrote: > > I'm interested in using tcerl for a few projects, but I'm running into > issues that I don't know how to resolve. The big one is memory use. > While I can tune it a bit by decreasing the leaf and non-leaf node > caches, tcerl still seems to grab tons of RAM, much more than I was > (naively?) expecting. With the two cache params set to 64 each, a db > of 7000 40k records takes up almost 400mb of ram. With the default > cache params of 1024 and 512, it consumes over 1G. Syncs of a db of > this size also take several seconds, which effectively means that I'd > never be able to sync, except when shutting down a node. > > Tcerl folks -- am I doing something wrong? I need to support dbs of > about 100,000 records of this size (with a *lot* of reads and writes) > with reasonable enough RAM usage that each node can fit onto an EC2 > instance with a bunch of other stuff -- realistically, 256M at most. > I'd guess that the tokyocabinet hash db would be better suited to our > needs, since we don't need ordered_set. But would the RAM use be any > different, and do you have near-term plans to add support for the hash > db to tcerl? > > Does anyone have any other suggestions for storage backends to try? > Dets unfortunately is much too slow, and mnesia with disc tables too > RAM-hungry. > > Thanks (and thanks for tcerl!) > > JP > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/tcerl-memory-usage%2C-plans-for-hash-type-db-tp18984873p18989955.html Sent from the Erlang Questions mailing list archive at Nabble.com. From goofyheadedpunk@REDACTED Fri Aug 15 02:59:13 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Thu, 14 Aug 2008 17:59:13 -0700 Subject: [erlang-questions] Deploying applications: proper ERL_LIB setting. Message-ID: <971980cc0808141759x332fc05x6f46c6f9c605831f@mail.gmail.com> Hello all, What is the proper way to set Erlang environment variables in order to run applications? I would like to deploy an OTP structured application but am currently stuck. For reference,\ here's my filesystem layout, with "hatstand" being the application in question: /home/blt |-- lib | `-- hatstand-1.0 -> /home/blt/src/lib/hatstand-1.0/ `-- src `-- hatstand-1.0 |-- Makefile |-- ebin | `-- hatstand_app.app |-- priv `-- src |-- Makefile |-- hatstand.erl |-- hatstand_app.erl `-- hatstand_sup.erl In my bashrc I have "export ERL_LIB=/home/blt/lib/". Upon starting erlang and issuing "application:start(hatstand_app)" I'm greated with "{error,{"no such file or directory","hatst\ and_app.app"}}". In fact, I have no luck starting hatstand unless I give "-pa /home/blt/lib/hatstand-1.0/ebin" as an argument to Erlang. What do I set ERL_LIB to and how do I invoke erl so that application:start(hatstand_app) will not fail? Thanks, Brian From saleyn@REDACTED Fri Aug 15 03:41:04 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 14 Aug 2008 21:41:04 -0400 Subject: [erlang-questions] Deploying applications: proper ERL_LIB setting. In-Reply-To: <971980cc0808141759x332fc05x6f46c6f9c605831f@mail.gmail.com> References: <971980cc0808141759x332fc05x6f46c6f9c605831f@mail.gmail.com> Message-ID: <48A4DEB0.4000803@gmail.com> There is a typo in docs of R12B-3. The env name is ERL_LIBS. Do: export ERL_LIBS=/home/blt/lib Serge. Brian Troutwine wrote: > Hello all, > > What is the proper way to set Erlang environment variables in order to > run applications? I would like to deploy an OTP structured application > but am currently stuck. For reference,\ > here's my filesystem layout, with "hatstand" being the application > in question: > > /home/blt > |-- lib > | `-- hatstand-1.0 -> /home/blt/src/lib/hatstand-1.0/ > `-- src > `-- hatstand-1.0 > |-- Makefile > |-- ebin > | `-- hatstand_app.app > |-- priv > `-- src > |-- Makefile > |-- hatstand.erl > |-- hatstand_app.erl > `-- hatstand_sup.erl > > In my bashrc I have "export ERL_LIB=/home/blt/lib/". Upon starting > erlang and issuing "application:start(hatstand_app)" I'm greated with > "{error,{"no such file or directory","hatst\ > and_app.app"}}". In fact, I have no luck starting hatstand unless I > give "-pa /home/blt/lib/hatstand-1.0/ebin" as an argument to Erlang. > > What do I set ERL_LIB to and how do I invoke erl so that > application:start(hatstand_app) will not fail? > > Thanks, > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From goofyheadedpunk@REDACTED Fri Aug 15 04:04:20 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Thu, 14 Aug 2008 19:04:20 -0700 Subject: [erlang-questions] Deploying applications: proper ERL_LIB setting. In-Reply-To: <48A4DEB0.4000803@gmail.com> References: <971980cc0808141759x332fc05x6f46c6f9c605831f@mail.gmail.com> <48A4DEB0.4000803@gmail.com> Message-ID: <971980cc0808141904v47c5634di5adbe2f507ee9ba3@mail.gmail.com> Thank you. That was indeed the problem. On 8/14/08, Serge Aleynikov wrote: > There is a typo in docs of R12B-3. The env name is ERL_LIBS. Do: > > export ERL_LIBS=/home/blt/lib > > > Serge. > > Brian Troutwine wrote: > > > > > Hello all, > > > > What is the proper way to set Erlang environment variables in order to > > run applications? I would like to deploy an OTP structured application > > but am currently stuck. For reference,\ > > here's my filesystem layout, with "hatstand" being the application > > in question: > > > > /home/blt > > |-- lib > > | `-- hatstand-1.0 -> /home/blt/src/lib/hatstand-1.0/ > > `-- src > > `-- hatstand-1.0 > > |-- Makefile > > |-- ebin > > | `-- hatstand_app.app > > |-- priv > > `-- src > > |-- Makefile > > |-- hatstand.erl > > |-- hatstand_app.erl > > `-- hatstand_sup.erl > > > > In my bashrc I have "export ERL_LIB=/home/blt/lib/". Upon starting > > erlang and issuing "application:start(hatstand_app)" I'm > greated with > > "{error,{"no such file or directory","hatst\ > > and_app.app"}}". In fact, I have no luck starting hatstand unless I > > give "-pa /home/blt/lib/hatstand-1.0/ebin" as an argument > to Erlang. > > > > What do I set ERL_LIB to and how do I invoke erl so that > > application:start(hatstand_app) will not fail? > > > > Thanks, > > Brian > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -- Brian From jonsingler@REDACTED Fri Aug 15 04:09:28 2008 From: jonsingler@REDACTED (Jon Singler) Date: Thu, 14 Aug 2008 22:09:28 -0400 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <18990027.post@talk.nabble.com> References: <18990027.post@talk.nabble.com> Message-ID: <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> > What I'm looking after is a free, simple, and reliable (with > replication suport) library to store large > number (thousands to million) of very big files (>1gb per file) on > secondary storage. What you're looking for doesn't exist and can't exist. You're asking for something "simple" that is also "reliable (with replication support)" for storing huge numbers of huge files. Any system that is the latter cannot possibly be the former. Asking for it to be free as well is really pushing beyond the bounds of reality. Among the non-free alternatives, I doubt that you're going to be able to find anything simpler or more reliable than S3, with a management layer on top. But best of luck to you in your quest :-) From leif+lists.lang.erlang@REDACTED Fri Aug 15 07:01:35 2008 From: leif+lists.lang.erlang@REDACTED (Leif Hedstrom) Date: Thu, 14 Aug 2008 23:01:35 -0600 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: <6c2563b20808012021o2977d92el32350011b7528e7@mail.gmail.com> References: <6c2563b20808012021o2977d92el32350011b7528e7@mail.gmail.com> Message-ID: <48A50DAF.5090405@ogre.com> Edwin Fine wrote: > I read the inets code, and if I understand it correctly, it seems that > when a non-idempotent operation such as POST is performed, httpc does > not reuse the existing connection (httpc_manager:select_session/4 > returns no_connection, which starts a new handler). I am not sure if > this is the correct thing to do, because my understanding is that the > restriction on non-idempotent operations applies to pipelining, not > persistent connections. I can see no reason why one should not be able > to do a series of consecutive POSTs on the same socket, as long as one > waits for a reply before posting the next request. I don't think this is extremely unreasonable, it's basically a defense mechanism to avoid issues with the non-idempotent request putting the server/connection in an undesirable state. The reasoning generally seems to be that a "fresh" connection to the server is less likely to be terminated prematurely (or arbitrarily). Also remember a server always has the right to close a KA connection (particularly after a non-idempotent request). One way to improve on this could be to use the "100-continue" header (Expect: 100-continue) before sending a POST body on a Keep-Alive connection. This obviously introduces more latency, which can negate all benefits of Keep-Alive (or even make it worse). On high latency networks, with many of POSTs on a KA connection, it's probably beneficial even with the overhead of "100-continue" (due to 3-way handshake + TCP congestion control on new connections). Now, I do agree that it seems a little draconian that the library doesn't let the user (developer) make these decisions. I haven't looked at the code at all, but assuming this is what it does, I'm guessing it was done to make sure people don't fall into this pit of nastiness accidentally. It's a reasonable default for sure, but ought to be possible to override, by someone well familiar with the dangers (and how to handle them). Cheers, -- Leif From erlang-questions_efine@REDACTED Fri Aug 15 07:15:10 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 15 Aug 2008 01:15:10 -0400 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: <48A50DAF.5090405@ogre.com> References: <6c2563b20808012021o2977d92el32350011b7528e7@mail.gmail.com> <48A50DAF.5090405@ogre.com> Message-ID: <6c2563b20808142215w6bcf4b64jf650b3c0ead07ce0@mail.gmail.com> Thanks for the tip. Interestingly, the ibrowse library *does* permit the user to specify this behavior, which works very well (so far!) for the use case in which I'm employing it. The HTTP specification seems to say nothing forbidding consecutive post/reply pairs on a KA connection. If the server does close the KA connection after each post/reply, then I guess the behavior will effectively fall back to the usual mechanism of connect/post/reply/disconnect. Maybe it's the time of night, but I can't see how accepting a POST followed by sending a reply to the POST would put a server in a weird state that requires dropping the socket and a reconnect to clear, unless the underlying server code is really poorly written. I dunno. Maybe I'll find out the hard way... On Fri, Aug 15, 2008 at 1:01 AM, Leif Hedstrom < leif+lists.lang.erlang@REDACTED > wrote: > Edwin Fine wrote: > >> I read the inets code, and if I understand it correctly, it seems that >> when a non-idempotent operation such as POST is performed, httpc does not >> reuse the existing connection (httpc_manager:select_session/4 returns >> no_connection, which starts a new handler). I am not sure if this is the >> correct thing to do, because my understanding is that the restriction on >> non-idempotent operations applies to pipelining, not persistent connections. >> I can see no reason why one should not be able to do a series of consecutive >> POSTs on the same socket, as long as one waits for a reply before posting >> the next request. >> > > I don't think this is extremely unreasonable, it's basically a defense > mechanism to avoid issues with the non-idempotent request putting the > server/connection in an undesirable state. The reasoning generally seems to > be that a "fresh" connection to the server is less likely to be terminated > prematurely (or arbitrarily). Also remember a server always has the right to > close a KA connection (particularly after a non-idempotent request). > > One way to improve on this could be to use the "100-continue" header > (Expect: 100-continue) before sending a POST body on a Keep-Alive > connection. This obviously introduces more latency, which can negate all > benefits of Keep-Alive (or even make it worse). On high latency networks, > with many of POSTs on a KA connection, it's probably beneficial even with > the overhead of "100-continue" (due to 3-way handshake + TCP congestion > control on new connections). > > Now, I do agree that it seems a little draconian that the library doesn't > let the user (developer) make these decisions. I haven't looked at the code > at all, but assuming this is what it does, I'm guessing it was done to make > sure people don't fall into this pit of nastiness accidentally. It's a > reasonable default for sure, but ought to be possible to override, by > someone well familiar with the dangers (and how to handle them). > > Cheers, > > -- Leif > > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Fri Aug 15 06:03:56 2008 From: jay@REDACTED (Jay Nelson) Date: Thu, 14 Aug 2008 21:03:56 -0700 Subject: [erlang-questions] Modify a list of tuples Message-ID: Dave Bryson asked: > What's the best way to modify a value for a given tuple > in the list below? > I have a large list with the following type of structure: > [ [{a,1},{b,2}], [{b,3},{a,4}] ] The question you need to ask is whether duplicate keys are allowed in any of the lists. If not, you may be dealing with a list of property lists and can take advantage of the stdlib module 'proplists'. In general, a property list is a stack of key / value pairs, with the most recent value for a given key being the one closest to the beginning of the list. Instead of "modifying" an existing value, push a new property onto each list: set_value(LargeList, Property, NewValue) -> [ [{Property, NewValue} | PList || PList <- LargeList]. The result will then return a proper value when called with proplists:get_value/2. Of course, every list will now have the new property value, not just the ones that previously had it. If you don't want to add the value to every list, use: set_value(LargeList, Property, NewValue) -> [push_unique(Property, NewValue, PList) || PList <- LargeList]. push_unique(Property, NewValue, PList) -> case proplists:is_defined(Property, PList) of true -> [ {Property, NewValue} | PList]; false -> PList end. The first approach has the advantage of requiring no searching, and a very fast push implemented as allocating one new list element. The second requires a lookup on every list, but does not add a value if it is not already present. You have to decide which applies to your situation. If you read the proplists module documentation, you may find that you can still use this approach when there are multiple values for a single key. This approach illustrates a technique that ROK never mentions in his rebuttals to the "a list of numbers does not make a string". If you parse XML into proplists, you can modify or augment the data without searching, and therefore exceed the performance of array-based and dedicated string datatype approaches. Any time you find yourself wanting to "modify" an existing value, stop and think if that is really the best way to accomplish the task using a functional language, because "modification" is not the functional approach. jay From ok@REDACTED Fri Aug 15 08:04:10 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 15 Aug 2008 18:04:10 +1200 Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl ? In-Reply-To: <953805.96169.qm@web31811.mail.mud.yahoo.com> References: <953805.96169.qm@web31811.mail.mud.yahoo.com> Message-ID: <4F28BD77-B18F-42B5-9133-48220495A9BD@cs.otago.ac.nz> On 15 Aug 2008, at 7:04 am, Eric Ho wrote: > Just curious. Since Perl *was* designed to be a text processing language, and Erlang *wasn't*, it's not clear that any benchmarks that have been done tell us much except where the effort needs to go to make it better. For example, R12B-3 includes the prototype regular expression implementation based on PCRE from http://www.erlang.org/eeps/eep-0011.html From ok@REDACTED Fri Aug 15 08:11:35 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 15 Aug 2008 18:11:35 +1200 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: References: Message-ID: <28035C84-4EA4-44E7-A155-F34B2062181F@cs.otago.ac.nz> On 15 Aug 2008, at 9:06 am, Dave Bryson wrote: > What's the best way to modify a value for a given tuple in the list > below? > > I have a large list with the following type of structure: > > [ [{a,1},{b,2}], [{b,3},{a,4}] ] > > I want to preserve the structure of the list and change a value on all > the tuples with a given key. So for example, change all the values on > the "b" tuple so the result would be: > > [ [{a,1},{b,CHANGED}], [{b,CHANGED},{a,4}] ] > > I've tried list comprehension but can't get it to preserve the rest of > the list. I am supposing that your-data = list of (list of (tuple with key and value)) and that you want to copy such a data structure replacing {b, X} by {b, f(X)} for some f. List comprehension is indeed the answer, but you will need two of them, because you have two levels of lists. [ [ case Pair of {b,X} -> {b,f(X)} ; Other -> Other end || Pair <- Pairs ] || Pairs <- Your_Data ] This would certainly be clearer if the 'case' were moved out of the comprehension into another function: update_pair({Key,Value}, Key) -> {Key, f(Value)}; update_pair(Other, _ ) -> Other. ... [[update_pair(Pair, b) || Pair <- Pairs] || Pairs <- Your_Data] From magicloud.magiclouds@REDACTED Fri Aug 15 09:08:54 2008 From: magicloud.magiclouds@REDACTED (Magicloud Magiclouds) Date: Fri, 15 Aug 2008 15:08:54 +0800 Subject: [erlang-questions] Newbie problem with snmpm Message-ID: <48A52B86.8090505@gmail.com> Hi, I am new to Erlang. While I was learning to use snmp, I got some problems. I used snmp:config() to make all the configuration files (only manager, no agent). Then # erl -config sys.config > application:start(snmp). ok > snmpm:which_users(). [magicloud] > snmpm:g("magicloud", {10, 9, 81, 11}, [[1, 3, 6, 1, 4, 1, 388, 6, 2, 10, 1, 29]]). {error,not_found} I am sure that the ip and the OID are correct. So what does "not_found" mean? Thanks. From raimo+erlang-questions@REDACTED Fri Aug 15 10:51:33 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 15 Aug 2008 10:51:33 +0200 Subject: [erlang-questions] Planet Erlang down (again?) Message-ID: <20080815085133.GA29761@erix.ericsson.se> http://www.planeterlang.org gives: Parse error: parse error, unexpected $ in /opt/data/planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.php on line 138 In May, Francesco Cesarini wrote: http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html Has it been up and is down again, or are they still working on it? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dawsdesign@REDACTED Fri Aug 15 11:33:54 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 05:33:54 -0400 Subject: [erlang-questions] Planet Erlang down (again?) In-Reply-To: <20080815085133.GA29761@erix.ericsson.se> References: <20080815085133.GA29761@erix.ericsson.se> Message-ID: Maybe they should use yaws+erlyweb. On Fri, Aug 15, 2008 at 4:51 AM, Raimo Niskanen < raimo+erlang-questions@REDACTED > wrote: > http://www.planeterlang.org gives: > Parse error: parse error, unexpected $ in /opt/data/ > planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.phpon line 138 > > In May, Francesco Cesarini wrote: > http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html > > Has it been up and is down again, or are they still working on it? > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Fri Aug 15 11:34:27 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 05:34:27 -0400 Subject: [erlang-questions] Planet Erlang down (again?) In-Reply-To: References: <20080815085133.GA29761@erix.ericsson.se> Message-ID: Maybe they should use yaws+erlyweb. On Fri, Aug 15, 2008 at 4:51 AM, Raimo Niskanen < raimo+erlang-questions@REDACTED > wrote: > http://www.planeterlang.org gives: > Parse error: parse error, unexpected $ in /opt/data/ > planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.phpon line 138 > > In May, Francesco Cesarini wrote: > http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html > > Has it been up and is down again, or are they still working on it? > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Fri Aug 15 11:36:26 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 05:36:26 -0400 Subject: [erlang-questions] Erlounge NYC? Message-ID: Is anyone planning any get together in NYC in the coming months? I know there was a small one last year and I would really like to do something like that. Even if it's just chatting over a pint. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jc.campagne@REDACTED Fri Aug 15 12:11:12 2008 From: jc.campagne@REDACTED (Jean-Charles Campagne) Date: Fri, 15 Aug 2008 12:11:12 +0200 Subject: [erlang-questions] Dialyser fails on erlsom Message-ID: <76181821-AD34-4D59-832E-3C7451398C54@gmail.com> Hello, Is anyone experiencing issue with dialyzer analysing the erlsom beam ? For instance, I get something like : $ dialyzer --build_plt -r $ERL_TOP/lib/ Could not compute md5 for file: /opt/local/lib/erlang/lib/ erlsom-1.2.1/ebin/erlsom.beam dialyzer: Internal problems were encountered in the analysis. I tried to look around for some info... but no luck... Is this a known issue ? Regards, JCC From tobias.lindahl@REDACTED Fri Aug 15 13:18:13 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Fri, 15 Aug 2008 13:18:13 +0200 Subject: [erlang-questions] Dialyser fails on erlsom In-Reply-To: <76181821-AD34-4D59-832E-3C7451398C54@gmail.com> References: <76181821-AD34-4D59-832E-3C7451398C54@gmail.com> Message-ID: <48A565F5.5060903@kreditor.se> Jean-Charles Campagne wrote: > Hello, > > Is anyone experiencing issue with dialyzer analysing the erlsom beam ? > For instance, I get something like : > > $ dialyzer --build_plt -r $ERL_TOP/lib/ > Could not compute md5 for file: /opt/local/lib/erlang/lib/ > erlsom-1.2.1/ebin/erlsom.beam > dialyzer: Internal problems were encountered in the analysis. > > I tried to look around for some info... but no luck... > Is this a known issue ? I agree that the error message is not very helpful. The md5 is built from the abstract code which is generated when the compile option +debug_info is given. My guess is that the erlsom files are built without this option. If you want to include the erlsom in the analysis it needs to compiled with +debug_info anyway, not just to compute the md5. Tobias > > Regards, > JCC > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dawsdesign@REDACTED Fri Aug 15 13:31:09 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 07:31:09 -0400 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: <48A454D9.9080506@softjar.se> References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> <48A454D9.9080506@softjar.se> Message-ID: Fair enough. On Thu, Aug 14, 2008 at 11:52 AM, Johnny Billquist wrote: > Matt Williamson wrote: > >> L-99 is based off the original P-99, 99 prolog problems. Erlang is also >> based on prolog. >> > > Um... Erlang syntax is inspired by (I hesitate to say based on, but maybe > you could say that) Prolog, but Erlang as a language is not based on Prolog. > Lisp is much closer. > > Johnny > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daveb@REDACTED Fri Aug 15 14:59:00 2008 From: daveb@REDACTED (Dave Bryson) Date: Fri, 15 Aug 2008 07:59:00 -0500 Subject: [erlang-questions] Modify a list of tuples In-Reply-To: <28035C84-4EA4-44E7-A155-F34B2062181F@cs.otago.ac.nz> References: <28035C84-4EA4-44E7-A155-F34B2062181F@cs.otago.ac.nz> Message-ID: Thank you all for the responses! I'm going to experiment with the different approaches. Dave From klacke@REDACTED Fri Aug 15 15:47:16 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 15 Aug 2008 15:47:16 +0200 Subject: [erlang-questions] Reading a string from console without echo In-Reply-To: <48A2C57A.2060501@diit.unict.it> References: <48A2C57A.2060501@diit.unict.it> Message-ID: <48A588E4.1060503@hyber.org> Corrado Santoro wrote: > Hi all, > > do you know if it is possible to disable echo of characters when using > io:read (or a similar routine) in reading from console? > Not possible, you'll have to do some trickery. Either some trickery through a linked in driver. This is non trivial though since the normal IO system must be persuaded to not read those chars as well. Another option is to use the slang contrib from http://jungerl.sourceforge.net/ This has the same problem as a linked in driver though, the normal IO system must be shut down during the read. I don't know from top of my head how to do that easily. /klacke From klacke@REDACTED Fri Aug 15 15:54:29 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 15 Aug 2008 15:54:29 +0200 Subject: [erlang-questions] system_limit and enfile errors when acceptiing/opening connections In-Reply-To: <48A03239.8010702@smart.am> References: <48A03239.8010702@smart.am> Message-ID: <48A58A95.7070804@hyber.org> Artak Avetisyan wrote: > Dear All > > We have encountered a strange problem on our erlang-driven web-service, > which uses yaws for accepting connections from outer world and http Interesting, I've had the enfile problem at http://yaws.hyber.org a number of times as well. My problem was a bittorrent client running havoc (Yeahh ... I know it's a really bad idea to run bittorrent clients on production servers ... ) Apart from that, yaws dies and is restarted by heart if accept() fails with enfile. There has been some discussion on the yaws list what is the appropriate thing to do for yaws if accept() fails. Today it dies - on purpose. /klacke From todd@REDACTED Fri Aug 15 17:14:18 2008 From: todd@REDACTED (Todd Lipcon) Date: Fri, 15 Aug 2008 11:14:18 -0400 Subject: [erlang-questions] disk_log bug? Message-ID: Hi all, I'm using disk_log to log binary data in wrap mode. I'm writing each element of data using disk_log:balog(Log, erlang:iolist_to_binary(Data)). I'm using timer:apply_interval to call disk_log:sync(Log) every couple of seconds. The problem I'm experiencing is that it seems like the disk_log is occasionally overwriting the ends of previous records at 4K byte boundaries. For example, the data in the file looks like: AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBCCCCCCCCCCCCCDD*EEEEEEE where '*' represents a 4K byte boundary in the file. The data marked 'D' is several hundred bytes long but gets truncated at the boundary and overwritten by E. I've logged several gigs of data using this system and only occasionally does a file get in the sort of "mode" where this happens. Once it starts happening, there are hundreds of points in the file that exhibit the problem. After forcing the disk_log to wrap to a new file, the new file does not exhibit the problem. Any thoughts? Platform is beam 5.6.2, R12B-2, Linux 2.6.22 amd64 -Todd -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam@REDACTED Fri Aug 15 17:30:54 2008 From: adam@REDACTED (Adam Lindberg) Date: Fri, 15 Aug 2008 17:30:54 +0200 Subject: [erlang-questions] Planet Erlang down (again?) In-Reply-To: References: <20080815085133.GA29761@erix.ericsson.se> Message-ID: <6344005f0808150830x23dc4898ie615ac66b84db1d7@mail.gmail.com> Planet Erlang is run by Process One, not Erlang Training & Consulting. Trapexit is still up and running. Cheers! Adam 2008/8/15 Matt Williamson : > Maybe they should use yaws+erlyweb. > > On Fri, Aug 15, 2008 at 4:51 AM, Raimo Niskanen > wrote: >> >> http://www.planeterlang.org gives: >> Parse error: parse error, unexpected $ in >> /opt/data/planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.php >> on line 138 >> >> In May, Francesco Cesarini wrote: >> http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html >> >> Has it been up and is down again, or are they still working on it? >> -- >> >> / Raimo Niskanen, Erlang/OTP, Ericsson AB >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jpellerin@REDACTED Fri Aug 15 18:44:55 2008 From: jpellerin@REDACTED (jason pellerin) Date: Fri, 15 Aug 2008 12:44:55 -0400 Subject: [erlang-questions] tcerl memory use, etc Message-ID: <3bb02d620808150944yb991898rc4b8310080f0042d@mail.gmail.com> Viktor wrote: > If you want to estimate tc memory requirements without Erlang driver > attached, you can speak to tokyocabinet Tyrant > (http://tokyocabinet.sourceforge.net/tyrantdoc/) with using memcached > protocol. At least it will geve an imagination about real cache sizes on > your system. Thanks! That proved to be very informative. Tyrant's network performance doesn't come close to matching erlang's, so I can't hit it as hard as I can my actual server, I was able to see the same behavior there as with erlang+tcerl. Basically, tokyocabinet (at least the b+ version) is only fast when you give it more memory than I can afford. So I'm back to dets. With some further experiments, I've found that zipping the record payload results in performance that's good enough for my needs for now. I'll probably give that a whirl with tcerl too, just for comparison. Thanks for your help/insight, everyone. JP From Martin.Logan@REDACTED Fri Aug 15 18:41:50 2008 From: Martin.Logan@REDACTED (Logan, Martin) Date: Fri, 15 Aug 2008 11:41:50 -0500 Subject: [erlang-questions] 64bit compiled beams not running on 32 bit machines Message-ID: <1B67010539493A48B777F49CE49F574B21FAC9@chiresexc04.resource.corp.lcl> In working on Erlware we have run into cases where apps containing only beam object code get published from 64 bit machines and are subsequently installed and run on 32 bit machines (the code is "generic" after all) and so the installer makes no distinction in cases of pure beam code. Well, as it turns out we have seen problems. Does any one know if this is a general problem, is it always unsafe to run 64bit compiled beams on 32bit machines or is it only in special cases, as in code compiled as "native"? If there are special cases is there a way to detect when the problem will arise by programmatically analyzing the beam files? Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From drwho102003-erlang@REDACTED Fri Aug 15 18:32:16 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Fri, 15 Aug 2008 09:32:16 -0700 (PDT) Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl ? In-Reply-To: <4F28BD77-B18F-42B5-9133-48220495A9BD@cs.otago.ac.nz> Message-ID: <600964.65609.qm@web31804.mail.mud.yahoo.com> So how does its regexp's performance as compared to Perl's ? -eric --- On Thu, 8/14/08, Richard A. O'Keefe wrote: From: Richard A. O'Keefe Subject: Re: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl ? To: drwho102003-erlang@REDACTED Cc: erlang-questions@REDACTED Date: Thursday, August 14, 2008, 11:04 PM On 15 Aug 2008, at 7:04 am, Eric Ho wrote: > Just curious. Since Perl *was* designed to be a text processing language, and Erlang *wasn't*, it's not clear that any benchmarks that have been done tell us much except where the effort needs to go to make it better. For example, R12B-3 includes the prototype regular expression implementation based on PCRE from http://www.erlang.org/eeps/eep-0011.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Fri Aug 15 19:03:08 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sat, 16 Aug 2008 01:03:08 +0800 Subject: [erlang-questions] How to get the line number of current executable code? Message-ID: HI: I want to implement a function like "get_current_lineno()/0" to get the current line number of the calling point? Eg. ..... .... io:format("current line is ~w\n",[get_current_lineno()]) ..... the above code will print the line number of the calling point in the source file. How can I do this in erlang? -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Fri Aug 15 20:22:54 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 15 Aug 2008 13:22:54 -0500 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: 2008/8/15 devdoer bird : > HI: > > I want to implement a function like "get_current_lineno()/0" to get the > current line number of the calling point? > Eg. > ..... > .... > io:format("current line is ~w\n",[get_current_lineno()]) > ..... > > the above code will print the line number of the calling point in the source > file. > > How can I do this in erlang? There is a predefined macro ?LINE that does that so io:format("current line is ~w\n",[?LINE]) /Anders > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From devdoer2@REDACTED Fri Aug 15 20:31:42 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sat, 16 Aug 2008 02:31:42 +0800 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: Thanks. How can I do this without macro? I know python supply some tools to determine the line number in run time,like inspect module. 2008/8/16, Anders Nygren : > > 2008/8/15 devdoer bird : > > HI: > > > > I want to implement a function like "get_current_lineno()/0" to get the > > current line number of the calling point? > > Eg. > > ..... > > .... > > io:format("current line is ~w\n",[get_current_lineno()]) > > ..... > > > > the above code will print the line number of the calling point in the > source > > file. > > > > How can I do this in erlang? > > There is a predefined macro ?LINE that does that > so > io:format("current line is ~w\n",[?LINE]) > > /Anders > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Fri Aug 15 21:05:08 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 15 Aug 2008 21:05:08 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: <48A5D364.6070505@it.uu.se> devdoer bird wrote: > How can I do this without macro? I know python supply some tools to > determine the line number in run time,like inspect module. There is currently no support for that in Erlang. /Richard From dawsdesign@REDACTED Fri Aug 15 21:07:49 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 15:07:49 -0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: You should trust the macro. It must use a similar method to Python's because they are both compiled to bytecode and thus there wouldn't *really* be line numbers in either one. 2008/8/15 devdoer bird > Thanks. > > How can I do this without macro? I know python supply some tools to > determine the line number in run time,like inspect module. > > > 2008/8/16, Anders Nygren : >> >> 2008/8/15 devdoer bird : >> > HI: >> > >> > I want to implement a function like "get_current_lineno()/0" to get the >> > current line number of the calling point? >> > Eg. >> > ..... >> > .... >> > io:format("current line is ~w\n",[get_current_lineno()]) >> > ..... >> > >> > the above code will print the line number of the calling point in the >> source >> > file. >> > >> > How can I do this in erlang? >> >> There is a predefined macro ?LINE that does that >> so >> io:format("current line is ~w\n",[?LINE]) >> >> /Anders >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Fri Aug 15 21:08:19 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 15:08:19 -0400 Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl In-Reply-To: References: <4F28BD77-B18F-42B5-9133-48220495A9BD@cs.otago.ac.nz> <600964.65609.qm@web31804.mail.mud.yahoo.com> Message-ID: I hear it sucks. See http://www.erlang.org/pipermail/erlang-questions/2006-August/022596.html for a port driver version which might at least approach Perl's. 2008/8/15 Eric Ho > So how does its regexp's performance as compared to Perl's ? > > > -eric > > --- On *Thu, 8/14/08, Richard A. O'Keefe * wrote: > > From: Richard A. O'Keefe > Subject: Re: [erlang-questions] any performance benchmark comparisions for > text processing between Erlang & Perl ? > To: drwho102003-erlang@REDACTED > Cc: erlang-questions@REDACTED > Date: Thursday, August 14, 2008, 11:04 PM > > On 15 Aug 2008, at 7:04 am, Eric Ho wrote: > > > Just curious. > > Since Perl *was* designed to be a text processing language, > and Erlang *wasn't*, it's not clear that any benchmarks > that have been done tell us much except where the effort > > needs to go to make it better. > > For > example, R12B-3 includes the prototype regular > expression implementation based on PCRE from > http://www.erlang.org/eeps/eep-0011.html > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Fri Aug 15 21:16:57 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 15 Aug 2008 21:16:57 +0200 Subject: [erlang-questions] 64bit compiled beams not running on 32 bit machines In-Reply-To: <1B67010539493A48B777F49CE49F574B21FAC9@chiresexc04.resource.corp.lcl> References: <1B67010539493A48B777F49CE49F574B21FAC9@chiresexc04.resource.corp.lcl> Message-ID: <18597.54825.615970.481143@harpo.it.uu.se> Logan, Martin writes: > In working on Erlware we have run into cases where apps containing only > beam object code get published from 64 bit machines and are subsequently > installed and run on 32 bit machines (the code is "generic" after all) > and so the installer makes no distinction in cases of pure beam code. > Well, as it turns out we have seen problems. What problems? > Does any one know if this > is a general problem, is it always unsafe to run 64bit compiled beams on > 32bit machines or is it only in special cases, as in code compiled as > "native"? Plain native-free beam code should be machine-independent. It is not independent of the BEAM virtual machine version, so unless you take special precautions (BEAM compiler options) you cannot generate the .beam code using BEAM version N and then deploy it with BEAM versions M < N. (Building an Erlang/OTP system relies on being able to use a set of pre-generated .beam files from bootstrap/ with the newly-built virtual machine; this combination is then used to re-generate .beam files for everything under lib/.) Code generated with +native depends on the machine type (x86 vs powerpc vs ...), its word-size (32 or 64-bit), whether it's using the SMP or non-SMP virtual machine, and the version of the BEAM virtual machine. You can only use native code on another machine than the build machine if the other machine is identical to the build machine in all above-mentioned aspects. /Mikael From erlang-questions_efine@REDACTED Fri Aug 15 22:29:50 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 15 Aug 2008 16:29:50 -0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> Something I've wished for in numerous languages over the years is a macro that expands to the current function, something like ?MODULE. I don't suppose there is one lurking somewhere in Erlang...? 2008/8/15 Matt Williamson > You should trust the macro. It must use a similar method to Python's > because they are both compiled to bytecode and thus there wouldn't *really* > be line numbers in either one. > > 2008/8/15 devdoer bird > >> Thanks. >> >> How can I do this without macro? I know python supply some tools to >> determine the line number in run time,like inspect module. >> >> >> 2008/8/16, Anders Nygren : >>> >>> 2008/8/15 devdoer bird : >>> > HI: >>> > >>> > I want to implement a function like "get_current_lineno()/0" to get the >>> > current line number of the calling point? >>> > Eg. >>> > ..... >>> > .... >>> > io:format("current line is ~w\n",[get_current_lineno()]) >>> > ..... >>> > >>> > the above code will print the line number of the calling point in the >>> source >>> > file. >>> > >>> > How can I do this in erlang? >>> >>> There is a predefined macro ?LINE that does that >>> so >>> io:format("current line is ~w\n",[?LINE]) >>> >>> /Anders >>> >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://www.erlang.org/mailman/listinfo/erlang-questions >>> > >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Fri Aug 15 22:45:35 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 15 Aug 2008 15:45:35 -0500 Subject: [erlang-questions] 64bit compiled beams not running on 32 bit machines In-Reply-To: <18597.54825.615970.481143@harpo.it.uu.se> References: <1B67010539493A48B777F49CE49F574B21FAC9@chiresexc04.resource.corp.lcl> <18597.54825.615970.481143@harpo.it.uu.se> Message-ID: On Fri, Aug 15, 2008 at 2:16 PM, Mikael Pettersson wrote: > Logan, Martin writes: > > In working on Erlware we have run into cases where apps containing only > > beam object code get published from 64 bit machines and are subsequently > > installed and run on 32 bit machines (the code is "generic" after all) > > and so the installer makes no distinction in cases of pure beam code. > > Well, as it turns out we have seen problems. > > What problems? The problem that I remember was that hipe itself does not work on a 32 bit system when it has been compiled on a 64 bit system. I.e. I once got from Erlware a hipe that was compiled for 64 bits and I have 32 bit machine. When I tried to compile another module with +native the compilation failed. As far as I understand the hipe application is pure erlang, but there is a .hrl file in hipe that defines the sizes of various object, and these sizes depends on the word size of the machine. I think it was lib/hipe/rtl/hipe_literals.hrl. /Anders > > > Does any one know if this > > is a general problem, is it always unsafe to run 64bit compiled beams on > > 32bit machines or is it only in special cases, as in code compiled as > > "native"? > > Plain native-free beam code should be machine-independent. > It is not independent of the BEAM virtual machine version, > so unless you take special precautions (BEAM compiler options) > you cannot generate the .beam code using BEAM version N and > then deploy it with BEAM versions M < N. > > (Building an Erlang/OTP system relies on being able to use a > set of pre-generated .beam files from bootstrap/ with the > newly-built virtual machine; this combination is then used > to re-generate .beam files for everything under lib/.) > > Code generated with +native depends on the machine type > (x86 vs powerpc vs ...), its word-size (32 or 64-bit), > whether it's using the SMP or non-SMP virtual machine, > and the version of the BEAM virtual machine. > You can only use native code on another machine than the > build machine if the other machine is identical to the > build machine in all above-mentioned aspects. > > /Mikael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf@REDACTED Fri Aug 15 23:06:56 2008 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 15 Aug 2008 23:06:56 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> Message-ID: <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> Why sure, you just do this: -module(m). -export([f/0]). -define(FUNCTION, hd(element(2,element(2,catch erlang:error([]))))). f() -> {current_function, ?FUNCTION}. Eshell V5.5.4 (abort with ^G) 1> c(m). {ok,m} 2> m:f(). {current_function,{m,f,0}} 3> BR, Ulf W ;-) 2008/8/15 Edwin Fine : > Something I've wished for in numerous languages over the years is a macro > that expands to the current function, something like ?MODULE. I don't > suppose there is one lurking somewhere in Erlang...? > > 2008/8/15 Matt Williamson >> >> You should trust the macro. It must use a similar method to Python's >> because they are both compiled to bytecode and thus there wouldn't *really* >> be line numbers in either one. >> >> 2008/8/15 devdoer bird >>> >>> Thanks. >>> >>> How can I do this without macro? I know python supply some tools to >>> determine the line number in run time,like inspect module. >>> >>> >>> 2008/8/16, Anders Nygren : >>>> >>>> 2008/8/15 devdoer bird : >>>> > HI: >>>> > >>>> > I want to implement a function like "get_current_lineno()/0" to get >>>> > the >>>> > current line number of the calling point? >>>> > Eg. >>>> > ..... >>>> > .... >>>> > io:format("current line is ~w\n",[get_current_lineno()]) >>>> > ..... >>>> > >>>> > the above code will print the line number of the calling point in the >>>> > source >>>> > file. >>>> > >>>> > How can I do this in erlang? >>>> >>>> There is a predefined macro ?LINE that does that >>>> so >>>> io:format("current line is ~w\n",[?LINE]) >>>> >>>> /Anders >>>> >>>> > _______________________________________________ >>>> > erlang-questions mailing list >>>> > erlang-questions@REDACTED >>>> > http://www.erlang.org/mailman/listinfo/erlang-questions >>>> > >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > For every expert there is an equal and opposite expert - Arthur C. Clarke > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mikpe@REDACTED Fri Aug 15 23:11:37 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 15 Aug 2008 23:11:37 +0200 Subject: [erlang-questions] 64bit compiled beams not running on 32 bit machines In-Reply-To: References: <1B67010539493A48B777F49CE49F574B21FAC9@chiresexc04.resource.corp.lcl> <18597.54825.615970.481143@harpo.it.uu.se> Message-ID: <18597.61705.795155.398646@harpo.it.uu.se> Anders Nygren writes: > On Fri, Aug 15, 2008 at 2:16 PM, Mikael Pettersson wrote: > > Logan, Martin writes: > > > In working on Erlware we have run into cases where apps containing only > > > beam object code get published from 64 bit machines and are subsequently > > > installed and run on 32 bit machines (the code is "generic" after all) > > > and so the installer makes no distinction in cases of pure beam code. > > > Well, as it turns out we have seen problems. > > > > What problems? > > The problem that I remember was that hipe itself does not work on a 32 bit > system when it has been compiled on a 64 bit system. > I.e. I once got from Erlware a hipe that was compiled for 64 bits and I have 32 > bit machine. When I tried to compile another module with +native the > compilation failed. > > As far as I understand the hipe application is pure erlang, but there > is a .hrl file > in hipe that defines the sizes of various object, and these sizes depends on the > word size of the machine. I think it was lib/hipe/rtl/hipe_literals.hrl. Yes, that .hrl file is how most of the runtime system properties are communicated to the HiPE compiler right now. It unfortunately breaks the "move .beam files to another machine" use case, and should be considered a bug. Thanks for the reminder. I'll see if we can find a way to eliminate this too-early binding mechanism, at least for properties that aren't invariant for a given BEAM VM version. /Mikael From jc.campagne@REDACTED Fri Aug 15 23:31:52 2008 From: jc.campagne@REDACTED (Jean-Charles Campagne) Date: Fri, 15 Aug 2008 23:31:52 +0200 Subject: [erlang-questions] Dialyser fails on erlsom In-Reply-To: <48A565F5.5060903@kreditor.se> References: <76181821-AD34-4D59-832E-3C7451398C54@gmail.com> <48A565F5.5060903@kreditor.se> Message-ID: <1427FE4C-EBE3-486C-A8F3-F1A67F328665@gmail.com> On Aug 15, 2008, at 13:18 , Tobias Lindahl wrote: > Jean-Charles Campagne wrote: >> Hello, >> Is anyone experiencing issue with dialyzer analysing the erlsom >> beam ? >> For instance, I get something like : >> $ dialyzer --build_plt -r $ERL_TOP/lib/ >> Could not compute md5 for file: /opt/local/lib/erlang/lib/ >> erlsom-1.2.1/ebin/erlsom.beam >> dialyzer: Internal problems were encountered in the analysis. >> I tried to look around for some info... but no luck... >> Is this a known issue ? > I agree that the error message is not very helpful. > The md5 is built from the abstract code which is generated when the > compile > option +debug_info is given. My guess is that the erlsom files are > built without > this option. If you want to include the erlsom in the analysis it > needs to > compiled with +debug_info anyway, not just to compute the md5. Thanks for the info Tobias. Indeed I did changed to Makefile appropriately with +debug_info option for compilation and dialyzer suceeded. On Aug 15, 2008, at 12:27 , Kostis Sagonas wrote: > Can you please send me the complete tar ball of erlsom-1.2.1 ? > (I need both the ebin & src dirs) Thanks for your help Kostis, but I guess it's okay now :-) Cheers, JCC From erlang-questions_efine@REDACTED Fri Aug 15 23:48:27 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 15 Aug 2008 17:48:27 -0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> Message-ID: <6c2563b20808151448w270e9de5hd99e58ba10e58002@mail.gmail.com> How cool is that?! Thanks! On Fri, Aug 15, 2008 at 5:06 PM, Ulf Wiger wrote: > Why sure, you just do this: > > -module(m). > -export([f/0]). > > -define(FUNCTION, hd(element(2,element(2,catch erlang:error([]))))). > > f() -> > {current_function, ?FUNCTION}. > > > > Eshell V5.5.4 (abort with ^G) > 1> c(m). > {ok,m} > 2> m:f(). > {current_function,{m,f,0}} > 3> > > BR, > Ulf W ;-) > > 2008/8/15 Edwin Fine : > > Something I've wished for in numerous languages over the years is a macro > > that expands to the current function, something like ?MODULE. I don't > > suppose there is one lurking somewhere in Erlang...? > > > > 2008/8/15 Matt Williamson > >> > >> You should trust the macro. It must use a similar method to Python's > >> because they are both compiled to bytecode and thus there wouldn't > *really* > >> be line numbers in either one. > >> > >> 2008/8/15 devdoer bird > >>> > >>> Thanks. > >>> > >>> How can I do this without macro? I know python supply some tools to > >>> determine the line number in run time,like inspect module. > >>> > >>> > >>> 2008/8/16, Anders Nygren : > >>>> > >>>> 2008/8/15 devdoer bird : > >>>> > HI: > >>>> > > >>>> > I want to implement a function like "get_current_lineno()/0" to get > >>>> > the > >>>> > current line number of the calling point? > >>>> > Eg. > >>>> > ..... > >>>> > .... > >>>> > io:format("current line is ~w\n",[get_current_lineno()]) > >>>> > ..... > >>>> > > >>>> > the above code will print the line number of the calling point in > the > >>>> > source > >>>> > file. > >>>> > > >>>> > How can I do this in erlang? > >>>> > >>>> There is a predefined macro ?LINE that does that > >>>> so > >>>> io:format("current line is ~w\n",[?LINE]) > >>>> > >>>> /Anders > >>>> > >>>> > _______________________________________________ > >>>> > erlang-questions mailing list > >>>> > erlang-questions@REDACTED > >>>> > http://www.erlang.org/mailman/listinfo/erlang-questions > >>>> > > >>> > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > -- > > For every expert there is an equal and opposite expert - Arthur C. Clarke > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From atomly-erl@REDACTED Sat Aug 16 01:31:19 2008 From: atomly-erl@REDACTED (atomly) Date: Fri, 15 Aug 2008 19:31:19 -0400 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> References: <18990027.post@talk.nabble.com> <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> Message-ID: <20080815233119.GM53452@atomly.com> [Jon Singler ] > What you're looking for doesn't exist and can't exist. You're asking > for something "simple" that is also "reliable (with replication > support)" for storing huge numbers of huge files. Any system that is > the latter cannot possibly be the former. Asking for it to be free as > well is really pushing beyond the bounds of reality. I wouldn't say this is true. I mean, you are obviously going to have to make some tradeoffs, but there is a lot of work being done these days to solve almost this exact problem. Dynamo does almost exactly this, for example, and there are several efforts to make open source clones of it. Having said that, I think S3 is perfect for the job. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From atomly-erl@REDACTED Sat Aug 16 02:14:34 2008 From: atomly-erl@REDACTED (atomly) Date: Fri, 15 Aug 2008 20:14:34 -0400 Subject: [erlang-questions] Erlounge NYC? In-Reply-To: References: Message-ID: <20080816001434.GN53452@atomly.com> [Matt Williamson ] > Is anyone planning any get together in NYC in the coming months? I > know there was a small one last year and I would really like to do > something like that. Even if it's just chatting over a pint. I'd be interested. -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From todd@REDACTED Sat Aug 16 03:27:14 2008 From: todd@REDACTED (Todd Lipcon) Date: Fri, 15 Aug 2008 21:27:14 -0400 Subject: [erlang-questions] Erlounge NYC? In-Reply-To: <20080816001434.GN53452@atomly.com> References: <20080816001434.GN53452@atomly.com> Message-ID: A couple of us from Amie Street might be interested as well -Todd On Fri, Aug 15, 2008 at 8:14 PM, atomly wrote: > [Matt Williamson ] > > Is anyone planning any get together in NYC in the coming months? I > > know there was a small one last year and I would really like to do > > something like that. Even if it's just chatting over a pint. > > I'd be interested. > > -- > :: atomly :: > > [ atomly@REDACTED : www.atomly.com ... > [ atomiq records : new york city : +1.917.442.9450 ... > [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Sat Aug 16 05:03:16 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 15 Aug 2008 23:03:16 -0400 Subject: [erlang-questions] Erlounge NYC? In-Reply-To: References: <20080816001434.GN53452@atomly.com> Message-ID: Maybe we should leave this thread open for a bit and perhaps work out a date and location to get together. 2008/8/15 Todd Lipcon > A couple of us from Amie Street might be interested as well > > -Todd > > > On Fri, Aug 15, 2008 at 8:14 PM, atomly wrote: > >> [Matt Williamson ] >> > Is anyone planning any get together in NYC in the coming months? I >> > know there was a small one last year and I would really like to do >> > something like that. Even if it's just chatting over a pint. >> >> I'd be interested. >> >> -- >> :: atomly :: >> >> [ atomly@REDACTED : www.atomly.com ... >> [ atomiq records : new york city : +1.917.442.9450 ... >> [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnswolter@REDACTED Sat Aug 16 05:42:22 2008 From: johnswolter@REDACTED (john s wolter) Date: Fri, 15 Aug 2008 23:42:22 -0400 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> References: <18990027.post@talk.nabble.com> <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> Message-ID: <24bcf1860808152042w3d5d5357n1f9686a6464706aa@mail.gmail.com> Jon, "Pushing beyond the bounds of reality" is just what is needed to handle the web services future. Current ways of scaling data centers and web applications requires a good sized pitch of money. When, not if, these kind of infrastructures are built, mashing-up a new worldwide company's virtual IT infrastructure will be easy. Planet sized problems will have the needed technical resources. Erlang's features or its successors will be of vital help. They give us a a glimpse of Things to Come . Where will it end? Given these capabilities the answer is "Y" of course go ahead. On Thu, Aug 14, 2008 at 10:09 PM, Jon Singler wrote: > > What I'm looking after is a free, simple, and reliable (with > > replication suport) library to store large > > number (thousands to million) of very big files (>1gb per file) on > > secondary storage. > > What you're looking for doesn't exist and can't exist. You're asking > for something "simple" that is also "reliable (with replication > support)" for storing huge numbers of huge files. Any system that is > the latter cannot possibly be the former. Asking for it to be free as > well is really pushing beyond the bounds of reality. > > Among the non-free alternatives, I doubt that you're going to be able > to find anything simpler or more reliable than S3, with a management > layer on top. > > But best of luck to you in your quest :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- John S. Wolter President Wolter Works Mailto:johnswolter@REDACTED Desk 1-734-665-1263 Cell: 1-734-904-8433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangy@REDACTED Sat Aug 16 11:04:23 2008 From: erlangy@REDACTED (ERLANG) Date: Sat, 16 Aug 2008 11:04:23 +0200 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <24bcf1860808152042w3d5d5357n1f9686a6464706aa@mail.gmail.com> References: <18990027.post@talk.nabble.com> <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> <24bcf1860808152042w3d5d5357n1f9686a6464706aa@mail.gmail.com> Message-ID: Hi guys, Our decision to leave Amazon grid computing framework isn't only to save money even that saving money isn't too bad when you've thousands of Amazon medium/big images running 24/7, exchanging huge number of messages per day. Some of our clients simply don't like SaaS stuffs at all. So, we MUST change for them because they want full control on their business data from A to Z (most of time due to confidentiality reasons). Joe Weinman from AT&T wrote a nice post about that: http://www.networkworld.com/community/?q=node/31047 cheers Y. Le 16 ao?t 08 ? 05:42, john s wolter a ?crit : > Jon, > > "Pushing beyond the bounds of reality" is just what is needed to > handle the web services future. Current ways of scaling data > centers and web applications requires a good sized pitch of money. > When, not if, these kind of infrastructures are built, mashing-up a > new worldwide company's virtual IT infrastructure will be easy. > Planet sized problems will have the needed technical resources. > > Erlang's features or its successors will be of vital help. They > give us a a glimpse of Things to Come. Where will it end? Given > these capabilities the answer is "Y" of course go ahead. > > On Thu, Aug 14, 2008 at 10:09 PM, Jon Singler > wrote: > > What I'm looking after is a free, simple, and reliable (with > > replication suport) library to store large > > number (thousands to million) of very big files (>1gb per file) on > > secondary storage. > > What you're looking for doesn't exist and can't exist. You're asking > for something "simple" that is also "reliable (with replication > support)" for storing huge numbers of huge files. Any system that is > the latter cannot possibly be the former. Asking for it to be free as > well is really pushing beyond the bounds of reality. > > Among the non-free alternatives, I doubt that you're going to be able > to find anything simpler or more reliable than S3, with a management > layer on top. > > But best of luck to you in your quest :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > John S. Wolter President > Wolter Works > Mailto:johnswolter@REDACTED > Desk 1-734-665-1263 > Cell: 1-734-904-8433 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Sat Aug 16 15:45:09 2008 From: toby@REDACTED (Toby Thain) Date: Sat, 16 Aug 2008 10:45:09 -0300 Subject: [erlang-questions] Amazon S3 and SQS implemenation in Erlang In-Reply-To: <20080815233119.GM53452@atomly.com> References: <18990027.post@talk.nabble.com> <79a415f20808141909s1a4402d2y3f4e3798cd163028@mail.gmail.com> <20080815233119.GM53452@atomly.com> Message-ID: <05409AB2-5136-466B-86AB-15CA5C6ECF4D@telegraphics.com.au> On 15-Aug-08, at 8:31 PM, atomly wrote: > [Jon Singler ] >> What you're looking for doesn't exist and can't exist. You're asking >> for something "simple" that is also "reliable (with replication >> support)" for storing huge numbers of huge files. Any system that is >> the latter cannot possibly be the former. Asking for it to be free as >> well is really pushing beyond the bounds of reality. > > I wouldn't say this is true. I mean, you are obviously going to > have to > make some tradeoffs, but there is a lot of work being done these > days to > solve almost this exact problem. Dynamo does almost exactly this, Dynamo isn't meant to store large blobs (megabytes, gigabytes); its sweet spot is values of a few KB (iirc - it's a few months since I read the paper). It certainly is 'simple' and elegant. --Toby > for > example, and there are several efforts to make open source clones > of it. > > Having said that, I think S3 is perfect for the job. > > -- > :: atomly :: > > [ atomly@REDACTED : www.atomly.com ... > [ atomiq records : new york city : +1.917.442.9450 ... > [ e-mail atomly-news-subscribe@REDACTED for atomly info and > updates ... > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bgustavsson@REDACTED Sat Aug 16 15:55:06 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Sat, 16 Aug 2008 15:55:06 +0200 Subject: [erlang-questions] any performance benchmark comparisions for text processing between Erlang & Perl In-Reply-To: References: <4F28BD77-B18F-42B5-9133-48220495A9BD@cs.otago.ac.nz> <600964.65609.qm@web31804.mail.mud.yahoo.com> Message-ID: <6672d0160808160655l4246e1cdg16872a7a76fd54f6@mail.gmail.com> 2008/8/15 Matt Williamson > I hear it sucks. See > http://www.erlang.org/pipermail/erlang-questions/2006-August/022596.htmlfor a port driver version which might at least approach Perl's. > Or use the new re module introduced in R12B-3: http://www.erlang.org/doc/man/re.html /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From bbmaj7@REDACTED Sat Aug 16 14:56:32 2008 From: bbmaj7@REDACTED (Richard Andrews) Date: Sat, 16 Aug 2008 05:56:32 -0700 (PDT) Subject: [erlang-questions] AES256 crypto (missing?) in erlang Message-ID: <653793.592.qm@web65514.mail.ac4.yahoo.com> I would like to use 256-bit key AES in erlang. I've had a look at the crypto driver code(*) and ... * 192 and 256-bit keys are not provided for (although openssl supports this) * For the 128-bit case, AES_set_encrypt_key() is called for every block encrypted (inefficient) If you have used 256-bit AES under erlang, what did you do? What are my options? -- [*] I examined R11B5 source but the online crypto application doc for R12B indicates the same behaviour. Win a MacBook Air or iPod touch with Yahoo!7. http://au.docs.yahoo.com/homepageset From ahmed.nawras@REDACTED Sat Aug 16 18:40:08 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Sat, 16 Aug 2008 20:40:08 +0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48A5D364.6070505@it.uu.se> References: <48A5D364.6070505@it.uu.se> Message-ID: Hi Richard, How about if I compiled the source with debugging enabled? Isn't this information supposed to be there (along with function name and other info)? /Ahmed Al-Issaei On Fri, Aug 15, 2008 at 11:05 PM, Richard Carlsson wrote: > devdoer bird wrote: >> How can I do this without macro? I know python supply some tools to >> determine the line number in run time,like inspect module. > > There is currently no support for that in Erlang. > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang-questions_efine@REDACTED Sat Aug 16 19:59:08 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 16 Aug 2008 13:59:08 -0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> Message-ID: <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> Ulf, On second thoughts, although that IS very cool, it would likely be very expensive because it generates and catches an exception. This would matter if it is used to do a lot of logging (which is what I would use it for). What I really would like is a compile-time constant (pre-processor macro). I suppose one could hack epp...? Ed On Fri, Aug 15, 2008 at 5:06 PM, Ulf Wiger wrote: > Why sure, you just do this: > > -module(m). > -export([f/0]). > > -define(FUNCTION, hd(element(2,element(2,catch erlang:error([]))))). > > f() -> > {current_function, ?FUNCTION}. > > > > Eshell V5.5.4 (abort with ^G) > 1> c(m). > {ok,m} > 2> m:f(). > {current_function,{m,f,0}} > 3> > > BR, > Ulf W ;-) > > 2008/8/15 Edwin Fine : > > Something I've wished for in numerous languages over the years is a macro > > that expands to the current function, something like ?MODULE. I don't > > suppose there is one lurking somewhere in Erlang...? > > > > 2008/8/15 Matt Williamson > >> > >> You should trust the macro. It must use a similar method to Python's > >> because they are both compiled to bytecode and thus there wouldn't > *really* > >> be line numbers in either one. > >> > >> 2008/8/15 devdoer bird > >>> > >>> Thanks. > >>> > >>> How can I do this without macro? I know python supply some tools to > >>> determine the line number in run time,like inspect module. > >>> > >>> > >>> 2008/8/16, Anders Nygren : > >>>> > >>>> 2008/8/15 devdoer bird : > >>>> > HI: > >>>> > > >>>> > I want to implement a function like "get_current_lineno()/0" to get > >>>> > the > >>>> > current line number of the calling point? > >>>> > Eg. > >>>> > ..... > >>>> > .... > >>>> > io:format("current line is ~w\n",[get_current_lineno()]) > >>>> > ..... > >>>> > > >>>> > the above code will print the line number of the calling point in > the > >>>> > source > >>>> > file. > >>>> > > >>>> > How can I do this in erlang? > >>>> > >>>> There is a predefined macro ?LINE that does that > >>>> so > >>>> io:format("current line is ~w\n",[?LINE]) > >>>> > >>>> /Anders > >>>> > >>>> > _______________________________________________ > >>>> > erlang-questions mailing list > >>>> > erlang-questions@REDACTED > >>>> > http://www.erlang.org/mailman/listinfo/erlang-questions > >>>> > > >>> > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > -- > > For every expert there is an equal and opposite expert - Arthur C. Clarke > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Sat Aug 16 20:19:12 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 16 Aug 2008 20:19:12 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <48A5D364.6070505@it.uu.se> Message-ID: <48A71A20.3050200@it.uu.se> Ahmed Ali wrote: > Hi Richard, > > How about if I compiled the source with debugging enabled? Isn't this > information supposed to be there (along with function name and other > info)? The problem is that there is no direct line-for-line mapping between the abstract code in the debugging information, and the executing beam code. The beam code does contain the info about the current function, but no line numbers. Using a combination of the two, you could find the line number for the current function, but figuring out the actual line within that function (given the current point in the beam code) could only be approximated using heuristics. If you're actually running in interpreted mode (debugging mode), you do get the current line, but it's a couple of orders of magmitude slower, so you don't want to do that for all your code. I hope some day someone will find the time to make the compiler propagate the line number information into a mapping table that could be included in the beam file at all times, even if the file was not compiled with debugging enabled. That would make it possible to give much nicer stacktraces. /Richard From richardc@REDACTED Sat Aug 16 20:22:22 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 16 Aug 2008 20:22:22 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> Message-ID: <48A71ADE.8050001@it.uu.se> Edwin Fine wrote: > On second thoughts, although that IS very cool, it would likely be very > expensive because it generates and catches an exception. This would > matter if it is used to do a lot of logging (which is what I would use > it for). What I really would like is a compile-time constant > (pre-processor macro). I suppose one could hack epp...? Don't worry about that. Exception handling is not particularly expensive in Erlang. (Certainly not compared to the work of logging.) /Richard From hayeah@REDACTED Sat Aug 16 21:41:01 2008 From: hayeah@REDACTED (Howard Yeh) Date: Sat, 16 Aug 2008 12:41:01 -0700 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <48A5D364.6070505@it.uu.se> <48A71A20.3050200@it.uu.se> Message-ID: On 8/16/08, Richard Carlsson wrote: > If you're actually running in interpreted mode (debugging mode), you > do get the current line, but it's a couple of orders of magmitude > slower, so you don't want to do that for all your code. How do I run the vm in debugging mode? In the AST transformation code for my pet lisp frontend, it's often hard to tell where a pattern match failed, b/c there can be many matches within a single function. It would be /very/ helpful if running in debugging mode gives me the line #. I can live with performance penalty at development time... From victor.sovetov@REDACTED Sat Aug 16 22:48:07 2008 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Sat, 16 Aug 2008 13:48:07 -0700 (PDT) Subject: [erlang-questions] large Erlang clusters Message-ID: <18990220.post@talk.nabble.com> Hi Serge As far as I know you're only limited with the maximum number of sockets which are available on your system and with number of atoms which can be used as node names. We tested 600 nodes cluster, but I honestly can't recall if there were any patches to BEAM to increase mentioned parameters. Sincerely, --Viktor Serge Aleynikov-2 wrote: > > Does any one have experience running somewhere between 200 and 400 nodes > in production? I recall that Erlang distributed layer had a limit of > 256 nodes. Is it still the case? > > I suppose that partitioning the cluster in several global_groups should > limit the network load and the number of open file descriptors on each > node would be reduced. > > Are there any other concerns one should be aware of when working with > such large clusters. > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/large-Erlang-clusters-tp18937196p18990220.html Sent from the Erlang Questions mailing list archive at Nabble.com. From saleyn@REDACTED Sat Aug 16 23:13:06 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 16 Aug 2008 17:13:06 -0400 Subject: [erlang-questions] Edoc error Message-ID: <48A742E2.7020107@gmail.com> There seems to be an error in edoc trying to parse URLs with query string arguments: ---------------- $ cat overview.edoc Test Project @doc Test. ColumnModel configuration ---------------- Error being generated: 3748- fatal: expected_entity_reference_semicolon 2628- fatal: error_scanning_entity_ref overview.edoc: at line 8: error in XML parser: {fatal, {error_scanning_entity_ref, {file,file_name_unknown}, {line,51}, {col,88}}}. edoc: error in doclet 'edoc_doclet': {'EXIT',error}. Apparently it doesn't like the ampersand in the URL. Changing the link to '/docs/?class=ColumnModel' works with no issues. Serge From harveyd@REDACTED Sat Aug 16 23:22:46 2008 From: harveyd@REDACTED (Dale Harvey) Date: Sat, 16 Aug 2008 22:22:46 +0100 Subject: [erlang-questions] Edoc error In-Reply-To: <48A742E2.7020107@gmail.com> References: <48A742E2.7020107@gmail.com> Message-ID: if its looking for valid xml, try using & ? 2008/8/16 Serge Aleynikov > There seems to be an error in edoc trying to parse URLs with query > string arguments: > > ---------------- > $ cat overview.edoc > > Test Project > > @doc Test. > > ColumnModel > configuration > ---------------- > > Error being generated: > > 3748- fatal: expected_entity_reference_semicolon > 2628- fatal: error_scanning_entity_ref > overview.edoc: at line 8: error in XML parser: {fatal, > {error_scanning_entity_ref, > {file,file_name_unknown}, > {line,51}, > {col,88}}}. > edoc: error in doclet 'edoc_doclet': {'EXIT',error}. > > > > Apparently it doesn't like the ampersand in the URL. Changing the link > to '/docs/?class=ColumnModel' works with no issues. > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Sat Aug 16 23:24:12 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 16 Aug 2008 17:24:12 -0400 Subject: [erlang-questions] large Erlang clusters In-Reply-To: <18990220.post@talk.nabble.com> References: <18990220.post@talk.nabble.com> Message-ID: <48A7457C.6000207@gmail.com> I suppose that the problem with the max number of sockets is solved by tweaking session limits (ulimit) and using kernel poll (+K true). As I understand, in a 600 node cluster every node will maintain connections to the rest 599 nodes, and send periodic pings. So, that pinging overhead would be something in the order of 10 events per second per node in this configuration. While the number doesn't seem intimidating I wonder if that overhead becomes noticeable in large network configurations and if there are any other guidelines that help architect such large network clusters to keep background load minimal. Serge Viktor Sovietov wrote: > Hi Serge > > As far as I know you're only limited with the maximum number of sockets > which are available on your system and with number of atoms which can be > used as node names. > We tested 600 nodes cluster, but I honestly can't recall if there were any > patches to BEAM to increase mentioned parameters. > > Sincerely, > > --Viktor > > > Serge Aleynikov-2 wrote: >> Does any one have experience running somewhere between 200 and 400 nodes >> in production? I recall that Erlang distributed layer had a limit of >> 256 nodes. Is it still the case? >> >> I suppose that partitioning the cluster in several global_groups should >> limit the network load and the number of open file descriptors on each >> node would be reduced. >> >> Are there any other concerns one should be aware of when working with >> such large clusters. >> >> Serge >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > From kevin@REDACTED Fri Aug 15 22:35:45 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Fri, 15 Aug 2008 13:35:45 -0700 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: Message-ID: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com> Many languages are compiled to byte code, but able to recover line numbers at run time. I assume they annotate the byte codes with file and line information. Note that this is more powerful than the Erlang macros. For example, Perl's caller() function allows you to inspect the full call stack in this way. -kevin On Aug 15, 2008, at 12:07 PM, Matt Williamson wrote: > You should trust the macro. It must use a similar method to Python's > because they are both compiled to bytecode and thus there wouldn't > *really* be line numbers in either one. > > 2008/8/15 devdoer bird > Thanks. > > How can I do this without macro? I know python supply some tools to > determine the line number in run time,like inspect module. > > > 2008/8/16, Anders Nygren : > 2008/8/15 devdoer bird : > > HI: > > > > I want to implement a function like "get_current_lineno()/0" to > get the > > current line number of the calling point? > > Eg. > > ..... > > .... > > io:format("current line is ~w\n",[get_current_lineno()]) > > ..... > > > > the above code will print the line number of the calling point in > the source > > file. > > > > How can I do this in erlang? > > There is a predefined macro ?LINE that does that > so > io:format("current line is ~w\n",[?LINE]) > > /Anders > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From victor.sovetov@REDACTED Sat Aug 16 23:48:03 2008 From: victor.sovetov@REDACTED (Viktor Sovietov) Date: Sat, 16 Aug 2008 14:48:03 -0700 (PDT) Subject: [erlang-questions] large Erlang clusters In-Reply-To: <48A7457C.6000207@gmail.com> References: <48A0F71C.6000105@gmail.com> <18990220.post@talk.nabble.com> <48A7457C.6000207@gmail.com> Message-ID: <19015411.post@talk.nabble.com> Hi Serge Well, in that experiment we still had some reserve, because we had used beam that been patched to bypass TCP. With having really fast interconnect and no expenses for often kernel calls, we can pay no no attention to background load, but further growth of cluster would require a meddling to Erlang's scalability mechanisms. Sincerely, --Viktor Serge Aleynikov-2 wrote: > > I suppose that the problem with the max number of sockets is solved by > tweaking session limits (ulimit) and using kernel poll (+K true). > > As I understand, in a 600 node cluster every node will maintain > connections to the rest 599 nodes, and send periodic pings. So, that > pinging overhead would be something in the order of 10 events per second > per node in this configuration. While the number doesn't seem > intimidating I wonder if that overhead becomes noticeable in large > network configurations and if there are any other guidelines that help > architect such large network clusters to keep background load minimal. > > Serge > > -- View this message in context: http://www.nabble.com/large-Erlang-clusters-tp18937196p19015411.html Sent from the Erlang Questions mailing list archive at Nabble.com. From saleyn@REDACTED Sun Aug 17 02:34:26 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 16 Aug 2008 20:34:26 -0400 Subject: [erlang-questions] Edoc error In-Reply-To: References: <48A742E2.7020107@gmail.com> Message-ID: <48A77212.9060700@gmail.com> Thanks! Apparently I missed the statement on escaping in 1.11.5 chapter of edoc. :-( Sorry for noise. Dale Harvey wrote: > if its looking for valid xml, try using & ? > > 2008/8/16 Serge Aleynikov > >> There seems to be an error in edoc trying to parse URLs with query >> string arguments: >> >> ---------------- >> $ cat overview.edoc >> >> Test Project >> >> @doc Test. >> >> ColumnModel >> configuration >> ---------------- >> >> Error being generated: >> >> 3748- fatal: expected_entity_reference_semicolon >> 2628- fatal: error_scanning_entity_ref >> overview.edoc: at line 8: error in XML parser: {fatal, >> {error_scanning_entity_ref, >> {file,file_name_unknown}, >> {line,51}, >> {col,88}}}. >> edoc: error in doclet 'edoc_doclet': {'EXIT',error}. >> >> >> >> Apparently it doesn't like the ampersand in the URL. Changing the link >> to '/docs/?class=ColumnModel' works with no issues. >> >> Serge >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From dawsdesign@REDACTED Sun Aug 17 05:00:50 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 16 Aug 2008 23:00:50 -0400 Subject: [erlang-questions] large Erlang clusters In-Reply-To: <48A7457C.6000207@gmail.com> References: <18990220.post@talk.nabble.com> <48A7457C.6000207@gmail.com> Message-ID: If you check out net_ticktime in the kernel_app docs, (you can set it with net_kernel:set_net_ticktime/1,2), you'll see: "Once every TickTime/4 second, all connected nodes are ticked (if anything else has been written to a node) and if nothing has been received from another node within the last four (4) tick times that node is considered to be down..." The default ticktime is 60s, meaning a ping every 15 seconds. On Sat, Aug 16, 2008 at 5:24 PM, Serge Aleynikov wrote: > I suppose that the problem with the max number of sockets is solved by > tweaking session limits (ulimit) and using kernel poll (+K true). > > As I understand, in a 600 node cluster every node will maintain > connections to the rest 599 nodes, and send periodic pings. So, that > pinging overhead would be something in the order of 10 events per second > per node in this configuration. While the number doesn't seem > intimidating I wonder if that overhead becomes noticeable in large > network configurations and if there are any other guidelines that help > architect such large network clusters to keep background load minimal. > > Serge > > Viktor Sovietov wrote: > > Hi Serge > > > > As far as I know you're only limited with the maximum number of sockets > > which are available on your system and with number of atoms which can be > > used as node names. > > We tested 600 nodes cluster, but I honestly can't recall if there were > any > > patches to BEAM to increase mentioned parameters. > > > > Sincerely, > > > > --Viktor > > > > > > Serge Aleynikov-2 wrote: > >> Does any one have experience running somewhere between 200 and 400 nodes > >> in production? I recall that Erlang distributed layer had a limit of > >> 256 nodes. Is it still the case? > >> > >> I suppose that partitioning the cluster in several global_groups should > >> limit the network load and the number of open file descriptors on each > >> node would be reduced. > >> > >> Are there any other concerns one should be aware of when working with > >> such large clusters. > >> > >> Serge > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpeterso@REDACTED Sun Aug 17 05:07:12 2008 From: rpeterso@REDACTED (Ron Peterson) Date: Sat, 16 Aug 2008 23:07:12 -0400 Subject: [erlang-questions] beginner question Message-ID: <20080817030712.GB22329@mtholyoke.edu> When I compile the code below and run it, I get something like the following: 54> scrap:random_tuples( 20, 5 ). [{3,9},{3,9},{3,9},{3,9},{3,9}] I'm sure this is expected behaviour. I'm just not yet familiar enough with erlang to understand it. Why isn't this the same as calling random_tuple a number of times in succession? TIA. set_seed_to_now() -> {A1, A2, A3} = now(), random:seed( A1, A2, A3 ). for( Max, Max, F ) -> [F]; for( I, Max, F ) -> [F|for( I+1, Max, F )]. random_tuple( Max ) -> { random:uniform( Max ), random:uniform( Max ) }. random_tuples( Max, Num ) -> set_seed_to_now(), for( 1, Num, random_tuple( Max ) ). -- Ron Peterson Network & Systems Manager Mount Holyoke College http://www.mtholyoke.edu/~rpeterso - I wish my computer would do what I want it to do - not what I tell it to do. From hokan.stenholm@REDACTED Sun Aug 17 05:37:11 2008 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 17 Aug 2008 05:37:11 +0200 Subject: [erlang-questions] beginner question In-Reply-To: <20080817030712.GB22329@mtholyoke.edu> References: <20080817030712.GB22329@mtholyoke.edu> Message-ID: <48A79CE7.7080204@bredband.net> Ron Peterson wrote: > When I compile the code below and run it, I get something like the > following: > > 54> scrap:random_tuples( 20, 5 ). > [{3,9},{3,9},{3,9},{3,9},{3,9}] > > I'm sure this is expected behaviour. I'm just not yet familiar enough > with erlang to understand it. Why isn't this the same as calling > random_tuple a number of times in succession? > > TIA. > > set_seed_to_now() -> > {A1, A2, A3} = now(), > random:seed( A1, A2, A3 ). > > for( Max, Max, F ) -> > [F]; > for( I, Max, F ) -> > [F|for( I+1, Max, F )]. > > random_tuple( Max ) -> > { random:uniform( Max ), random:uniform( Max ) }. > > random_tuples( Max, Num ) -> > set_seed_to_now(), > for( 1, Num, random_tuple( Max ) ). you probably want to do something like: for( 1, Num, fun() -> random_tuple( Max ) end). and call F in for(...) as F() so that you pass a function to for(...) to run in each iteration, rather than simply passing a precalculated value as you do right now. From richardc@REDACTED Sun Aug 17 10:30:34 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 17 Aug 2008 10:30:34 +0200 Subject: [erlang-questions] [erlang-bugs] Edoc error In-Reply-To: <48A77212.9060700@gmail.com> References: <48A742E2.7020107@gmail.com> <48A77212.9060700@gmail.com> Message-ID: <48A7E1AA.2040808@it.uu.se> It has nothing to do with the edoc wiki expansion; it's just that xmerl takes a legalistic approach to parsing (whereas browsers in general are much more forgiving). The rhs of the attribute is CDATA, which is subject to entity expansion, i.e., you can use enities like " etc. anywhere in the quoted string. Spurious ampersands are not actually allowed - even though they are used to separate fields in a query URL - but browsers tend to leave them as single ampersands if they don't seem to signal an entity (which is helpful if you just want to paste an URL into an HTML page). See http://www.w3.org/TR/html401/appendix/notes.html#h-B.2 (B.2.2) /Richard Serge Aleynikov wrote: > Thanks! Apparently I missed the statement on escaping in 1.11.5 chapter > of edoc. :-( > > Sorry for noise. > > Dale Harvey wrote: >> if its looking for valid xml, try using & ? >> >> 2008/8/16 Serge Aleynikov >> >>> There seems to be an error in edoc trying to parse URLs with query >>> string arguments: >>> >>> ---------------- >>> $ cat overview.edoc >>> >>> Test Project >>> >>> @doc Test. >>> >>> ColumnModel >>> configuration >>> ---------------- >>> >>> Error being generated: >>> >>> 3748- fatal: expected_entity_reference_semicolon >>> 2628- fatal: error_scanning_entity_ref >>> overview.edoc: at line 8: error in XML parser: {fatal, >>> {error_scanning_entity_ref, >>> {file,file_name_unknown}, >>> {line,51}, >>> {col,88}}}. >>> edoc: error in doclet 'edoc_doclet': {'EXIT',error}. >>> >>> >>> >>> Apparently it doesn't like the ampersand in the URL. Changing the link >>> to '/docs/?class=ColumnModel' works with no issues. >>> >>> Serge >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-bugs From richardc@REDACTED Sun Aug 17 10:37:10 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 17 Aug 2008 10:37:10 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <48A5D364.6070505@it.uu.se> <48A71A20.3050200@it.uu.se> Message-ID: <48A7E336.9030805@it.uu.se> Howard Yeh wrote: > How do I run the vm in debugging mode? Not the vm as such, more like a meta-interpreter: http://www.erlang.org/doc/apps/debugger/index.html /Richard From ulf@REDACTED Sun Aug 17 11:19:44 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 17 Aug 2008 11:19:44 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> Message-ID: <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> I should perhaps bring special notation to the smiley at the end of my message. (: Whether or not the solution is cool is surely a matter of taste - but I believe that the one who first came up with it was Mats Cronqvist, the champion of obfuscated Erlang code. (: I'm not sure about *very* expensive. The exception mechanism isn't that heavyweight. At least in the past, there were issues with HiPE, in that exceptions in native code would generate an empty stack trace. I vaguely recall that being fixed now. I agree that a compile-time constant would be much preferred. BR, Ulf W 2008/8/16 Edwin Fine : > Ulf, > > On second thoughts, although that IS very cool, it would likely be very > expensive because it generates and catches an exception. This would matter > if it is used to do a lot of logging (which is what I would use it for). > What I really would like is a compile-time constant (pre-processor macro). I > suppose one could hack epp...? > > Ed > > On Fri, Aug 15, 2008 at 5:06 PM, Ulf Wiger wrote: >> >> Why sure, you just do this: >> >> -module(m). >> -export([f/0]). >> >> -define(FUNCTION, hd(element(2,element(2,catch erlang:error([]))))). >> >> f() -> >> {current_function, ?FUNCTION}. >> >> >> >> Eshell V5.5.4 (abort with ^G) >> 1> c(m). >> {ok,m} >> 2> m:f(). >> {current_function,{m,f,0}} >> 3> >> >> BR, >> Ulf W ;-) >> >> 2008/8/15 Edwin Fine : >> > Something I've wished for in numerous languages over the years is a >> > macro >> > that expands to the current function, something like ?MODULE. I don't >> > suppose there is one lurking somewhere in Erlang...? >> > >> > 2008/8/15 Matt Williamson >> >> >> >> You should trust the macro. It must use a similar method to Python's >> >> because they are both compiled to bytecode and thus there wouldn't >> >> *really* >> >> be line numbers in either one. >> >> >> >> 2008/8/15 devdoer bird >> >>> >> >>> Thanks. >> >>> >> >>> How can I do this without macro? I know python supply some tools to >> >>> determine the line number in run time,like inspect module. >> >>> >> >>> >> >>> 2008/8/16, Anders Nygren : >> >>>> >> >>>> 2008/8/15 devdoer bird : >> >>>> > HI: >> >>>> > >> >>>> > I want to implement a function like "get_current_lineno()/0" to get >> >>>> > the >> >>>> > current line number of the calling point? >> >>>> > Eg. >> >>>> > ..... >> >>>> > .... >> >>>> > io:format("current line is ~w\n",[get_current_lineno()]) >> >>>> > ..... >> >>>> > >> >>>> > the above code will print the line number of the calling point in >> >>>> > the >> >>>> > source >> >>>> > file. >> >>>> > >> >>>> > How can I do this in erlang? >> >>>> >> >>>> There is a predefined macro ?LINE that does that >> >>>> so >> >>>> io:format("current line is ~w\n",[?LINE]) >> >>>> >> >>>> /Anders >> >>>> >> >>>> > _______________________________________________ >> >>>> > erlang-questions mailing list >> >>>> > erlang-questions@REDACTED >> >>>> > http://www.erlang.org/mailman/listinfo/erlang-questions >> >>>> > >> >>> >> >>> >> >>> _______________________________________________ >> >>> erlang-questions mailing list >> >>> erlang-questions@REDACTED >> >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > >> > -- >> > For every expert there is an equal and opposite expert - Arthur C. >> > Clarke >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > > > > -- > For every expert there is an equal and opposite expert - Arthur C. Clarke > From thomasl_erlang@REDACTED Sun Aug 17 12:01:32 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 17 Aug 2008 03:01:32 -0700 (PDT) Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> Message-ID: <480080.30813.qm@web38801.mail.mud.yahoo.com> --- On Sat, 8/16/08, Edwin Fine wrote: > On second thoughts, although that IS very cool, it would > likely be very > expensive because it generates and catches an exception. > This would matter > if it is used to do a lot of logging (which is what I would > use it for). > What I really would like is a compile-time constant > (pre-processor macro). I > suppose one could hack epp...? The basic problem is that epp works on the token level, not the syntax tree level, so when you find ?FUNCTION there is no information about what function you're in. (And figuring it out seems like a thankless job.) One possible hack: expand ?FUNCTION into something that can be recognized and replaced by a later pass. For instance: 1. In epp, replace ?FUNCTION by the syntax tree or tokens of a call to a made-up function, "erlang:current_function()", or some other unique well-known marker. 2. In sys_pre_expand, walk the syntax tree for each function M:F/N, and replace all occurrences of "erlang:current_function()" with {M, F, N}. (As part of expanding away records, etc.) Occurrences of ?FUNCTION outside of functions will have to be handled too, e.g. by an error. Best, Thomas From thomasl_erlang@REDACTED Sun Aug 17 11:51:37 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 17 Aug 2008 02:51:37 -0700 (PDT) Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: Message-ID: <121569.23784.qm@web38801.mail.mud.yahoo.com> --- On Sat, 8/16/08, Howard Yeh wrote: > In the AST transformation code for my pet lisp frontend, > it's often > hard to tell where a pattern match failed, b/c there can > be many > matches within a single function. > > It would be /very/ helpful if running in debugging mode > gives me the > line #. I can live with performance penalty at development > time... I'm not sure if this helps in your case, but if you're satisfied with getting line numbers in your exceptions, try smart_exceptions from jungerl. It's a parse transform, so it works without the debugger. Best, Thomas From saleyn@REDACTED Sun Aug 17 14:22:00 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 17 Aug 2008 08:22:00 -0400 Subject: [erlang-questions] large Erlang clusters In-Reply-To: References: <18990220.post@talk.nabble.com> <48A7457C.6000207@gmail.com> Message-ID: <48A817E8.5090803@gmail.com> Thanks Matt, I am indeed familiar with that net_kernel's setting. My current reasoning for large clusters is as follows. If all inter-node communications are quite busy, this net_kernel's pinging doesn't add any extra overhead for them. However if several busy nodes are also connected to a large number of quiet nodes, they'll have to coop with extra background pinging load. Perhaps that load is not to worry about when the "close to" real-time response is expected of the "busy" nodes, as in case of an I/O busy node signaling select/poll calls will likely happen simultaneously on several file descriptors, with some of them carrying pinging payload. As a result the total number of system calls involved in processing these events wouldn't be as many as if the events were spatially separated. However, since all net_ticktime logic happens in the bytecode, in a busy node it steals CPU cycles from other time-sensitive code, leading to increased latencies. This may also be a constraint if other OS processes on the same host have higher priority then the emulator and the emulator is not allowed to run with SMP mode on so that it doesn't compete with CPU resources of other more critical processes. This background load can be reduced by either bumping up the net_ticktime setting (this is quite tricky if part of nodes are located in one subnet and others are in a more distant network - unfortunately with this feature *all* nodes in the cluster must have the same setting) or making sure that global/net_kernel don't maintain a full mesh of interconnected nodes using global_groups. In the past I used the later approach (together with dist_auto_connect net_kernel's setting) to make Erlang applications work through firewalls. In case of node partitioning applications that take advantage of failover and global registration must be careful not to deal with several global groups as global names may be moved between them during failover. I was hoping to hear in this thread experiences of those currently running large Erlang clusters in production. In my prior Erlang deployments I haven't had cases of more than 30-40 node clusters (where total number of OS processes were much larger than that using ei/tcp to connect to Erlang, but the Erlang applications would not spread over more than 40 hosts). Since now there is a case for running a 400 node cluster (an instance of a VM per host) in a much larger local network (with a growth potential to about 600-700 nodes), I want to make sure that I won't miss something obvious to those who had similar experiences. Regards, Serge Matt Williamson wrote: > If you check out net_ticktime in the kernel_app docs, (you can set it with > net_kernel:set_net_ticktime/1,2), you'll see: > > "Once every TickTime/4 second, all connected nodes are ticked (if anything > else has been written to a node) and if nothing has been received from > another node within the last four (4) tick times that node is considered to > be down..." > > The default ticktime is 60s, meaning a ping every 15 seconds. > > On Sat, Aug 16, 2008 at 5:24 PM, Serge Aleynikov wrote: > >> I suppose that the problem with the max number of sockets is solved by >> tweaking session limits (ulimit) and using kernel poll (+K true). >> >> As I understand, in a 600 node cluster every node will maintain >> connections to the rest 599 nodes, and send periodic pings. So, that >> pinging overhead would be something in the order of 10 events per second >> per node in this configuration. While the number doesn't seem >> intimidating I wonder if that overhead becomes noticeable in large >> network configurations and if there are any other guidelines that help >> architect such large network clusters to keep background load minimal. >> >> Serge >> >> Viktor Sovietov wrote: >>> Hi Serge >>> >>> As far as I know you're only limited with the maximum number of sockets >>> which are available on your system and with number of atoms which can be >>> used as node names. >>> We tested 600 nodes cluster, but I honestly can't recall if there were >> any >>> patches to BEAM to increase mentioned parameters. >>> >>> Sincerely, >>> >>> --Viktor >>> >>> >>> Serge Aleynikov-2 wrote: >>>> Does any one have experience running somewhere between 200 and 400 nodes >>>> in production? I recall that Erlang distributed layer had a limit of >>>> 256 nodes. Is it still the case? >>>> >>>> I suppose that partitioning the cluster in several global_groups should >>>> limit the network load and the number of open file descriptors on each >>>> node would be reduced. >>>> >>>> Are there any other concerns one should be aware of when working with >>>> such large clusters. >>>> >>>> Serge >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From thomasl_erlang@REDACTED Sun Aug 17 14:14:24 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 17 Aug 2008 05:14:24 -0700 (PDT) Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48A71A20.3050200@it.uu.se> Message-ID: <231246.80923.qm@web38806.mail.mud.yahoo.com> --- On Sat, 8/16/08, Richard Carlsson wrote: > I hope some day someone will find the time to make the > compiler > propagate the line number information into a mapping table > that could > be included in the beam file at all times, even if the file > was not > compiled with debugging enabled. That would make it > possible to give > much nicer stacktraces. Indeed. Doing this might be a bit finicky but it's very helpful. The usual scripting language suspects already provide such stack traces, by the way. Best, Thomas From enhnaran@REDACTED Sun Aug 17 16:03:15 2008 From: enhnaran@REDACTED (Enhnaran Alexander) Date: Sun, 17 Aug 2008 22:03:15 +0800 Subject: [erlang-questions] =?windows-1252?q?Error=3A_bad_value_on_output_?= =?windows-1252?q?port_=91tcp=5Finet=27=2E?= Message-ID: Hi, I am now using Thrift, a lightweight, language-independent software stack. I use this to communicate and transfer data between servers on which are deployed system written in different languages. So when I call thrift_client:call(Client, Func, Args) which encapsulates call to gen_server:call(Client, {Client, Func, Args}), with the parameters like this: thrift_client:call(Client, myFunc, [[{data, "f1", "f2", ..., "fn"}]]), it prompts out ERROR REPORT saying "Bad value on output port 'tcp_inet'". I have asked Mr. Google for help and only to find some answers. It is said that a list or binary should be passed in, and if something like a tuple or so is passed as a parameter, then such an error occurs. But I didn't at all pass a tuple or anything but a list, so then why did this take place? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Sun Aug 17 18:27:40 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 17 Aug 2008 12:27:40 -0400 Subject: [erlang-questions] beginner question In-Reply-To: <48A79CE7.7080204@bredband.net> References: <20080817030712.GB22329@mtholyoke.edu> <48A79CE7.7080204@bredband.net> Message-ID: He's right. You are running the function once and passing the return value for every iteration. Your modified program should look like this: -module(scrap). -compile(export_all). set_seed_to_now() -> {A1, A2, A3} = now(), random:seed( A1, A2, A3 ). for( Max, Max, F ) -> [*F()*]; for( I, Max, F ) -> [*F()*|for( I+1, Max, F )]. random_tuple( Max ) -> { random:uniform( Max ), random:uniform( Max ) }. random_tuples( Max, Num ) -> set_seed_to_now(), for( 1, Num, *fun() -> random_tuple( Max ) end* ). On Sat, Aug 16, 2008 at 11:37 PM, H?kan Stenholm < hokan.stenholm@REDACTED> wrote: > Ron Peterson wrote: > > > When I compile the code below and run it, I get something like the > > following: > > > > 54> scrap:random_tuples( 20, 5 ). > > [{3,9},{3,9},{3,9},{3,9},{3,9}] > > > > I'm sure this is expected behaviour. I'm just not yet familiar enough > > with erlang to understand it. Why isn't this the same as calling > > random_tuple a number of times in succession? > > > > TIA. > > > > set_seed_to_now() -> > > {A1, A2, A3} = now(), > > random:seed( A1, A2, A3 ). > > > > for( Max, Max, F ) -> > > [F]; > > for( I, Max, F ) -> > > [F|for( I+1, Max, F )]. > > > > random_tuple( Max ) -> > > { random:uniform( Max ), random:uniform( Max ) }. > > > > random_tuples( Max, Num ) -> > > set_seed_to_now(), > > for( 1, Num, random_tuple( Max ) ). > you probably want to do something like: > > for( 1, Num, fun() -> random_tuple( Max ) end). > > and call F in for(...) as F() so that you pass a function to for(...) > to run in each iteration, rather than simply passing a precalculated > value as you do right now. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Sun Aug 17 18:37:59 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 17 Aug 2008 12:37:59 -0400 Subject: [erlang-questions] large Erlang clusters In-Reply-To: <48A817E8.5090803@gmail.com> References: <18990220.post@talk.nabble.com> <48A7457C.6000207@gmail.com> <48A817E8.5090803@gmail.com> Message-ID: Yes, I regret that I haven't got that sort of experience to share with you. I'd *really *like to hear of some as well, as I'm working on an open project that is using distributed Erlang for all it's inter-node communication. If you want to play it safe, I hear that using a DHT, something like chord < http://en.wikipedia.org/wiki/Chord_(DHT)>, is a proven scalable method. To make a ring, you could still use distributed Erlang if you set connect_allto false and use ets to keep track of neighbors. On Sun, Aug 17, 2008 at 8:22 AM, Serge Aleynikov wrote: > Thanks Matt, I am indeed familiar with that net_kernel's setting. > > My current reasoning for large clusters is as follows. If all inter-node > communications are quite busy, this net_kernel's pinging doesn't add any > extra overhead for them. However if several busy nodes are also connected > to a large number of quiet nodes, they'll have to coop with extra background > pinging load. > > Perhaps that load is not to worry about when the "close to" real-time > response is expected of the "busy" nodes, as in case of an I/O busy node > signaling select/poll calls will likely happen simultaneously on several > file descriptors, with some of them carrying pinging payload. As a result > the total number of system calls involved in processing these events > wouldn't be as many as if the events were spatially separated. However, > since all net_ticktime logic happens in the bytecode, in a busy node it > steals CPU cycles from other time-sensitive code, leading to increased > latencies. This may also be a constraint if other OS processes on the same > host have higher priority then the emulator and the emulator is not allowed > to run with SMP mode on so that it doesn't compete with CPU resources of > other more critical processes. > > This background load can be reduced by either bumping up the net_ticktime > setting (this is quite tricky if part of nodes are located in one subnet and > others are in a more distant network - unfortunately with this feature *all* > nodes in the cluster must have the same setting) or making sure that > global/net_kernel don't maintain a full mesh of interconnected nodes using > global_groups. In the past I used the later approach (together with > dist_auto_connect net_kernel's setting) to make Erlang applications work > through firewalls. In case of node partitioning applications that take > advantage of failover and global registration must be careful not to deal > with several global groups as global names may be moved between them during > failover. > > I was hoping to hear in this thread experiences of those currently running > large Erlang clusters in production. In my prior Erlang deployments I > haven't had cases of more than 30-40 node clusters (where total number of OS > processes were much larger than that using ei/tcp to connect to Erlang, but > the Erlang applications would not spread over more than 40 hosts). Since > now there is a case for running a 400 node cluster (an instance of a VM per > host) in a much larger local network (with a growth potential to about > 600-700 nodes), I want to make sure that I won't miss something obvious to > those who had similar experiences. > > Regards, > > Serge > > > Matt Williamson wrote: > >> If you check out net_ticktime in the kernel_app docs, (you can set it with >> net_kernel:set_net_ticktime/1,2), you'll see: >> >> "Once every TickTime/4 second, all connected nodes are ticked (if anything >> else has been written to a node) and if nothing has been received from >> another node within the last four (4) tick times that node is considered >> to >> be down..." >> >> The default ticktime is 60s, meaning a ping every 15 seconds. >> >> On Sat, Aug 16, 2008 at 5:24 PM, Serge Aleynikov >> wrote: >> >> I suppose that the problem with the max number of sockets is solved by >>> tweaking session limits (ulimit) and using kernel poll (+K true). >>> >>> As I understand, in a 600 node cluster every node will maintain >>> connections to the rest 599 nodes, and send periodic pings. So, that >>> pinging overhead would be something in the order of 10 events per second >>> per node in this configuration. While the number doesn't seem >>> intimidating I wonder if that overhead becomes noticeable in large >>> network configurations and if there are any other guidelines that help >>> architect such large network clusters to keep background load minimal. >>> >>> Serge >>> >>> Viktor Sovietov wrote: >>> >>>> Hi Serge >>>> >>>> As far as I know you're only limited with the maximum number of sockets >>>> which are available on your system and with number of atoms which can be >>>> used as node names. >>>> We tested 600 nodes cluster, but I honestly can't recall if there were >>>> >>> any >>> >>>> patches to BEAM to increase mentioned parameters. >>>> >>>> Sincerely, >>>> >>>> --Viktor >>>> >>>> >>>> Serge Aleynikov-2 wrote: >>>> >>>>> Does any one have experience running somewhere between 200 and 400 >>>>> nodes >>>>> in production? I recall that Erlang distributed layer had a limit of >>>>> 256 nodes. Is it still the case? >>>>> >>>>> I suppose that partitioning the cluster in several global_groups should >>>>> limit the network load and the number of open file descriptors on each >>>>> node would be reduced. >>>>> >>>>> Are there any other concerns one should be aware of when working with >>>>> such large clusters. >>>>> >>>>> Serge >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hayeah@REDACTED Sun Aug 17 19:25:11 2008 From: hayeah@REDACTED (Howard Yeh) Date: Sun, 17 Aug 2008 10:25:11 -0700 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <121569.23784.qm@web38801.mail.mud.yahoo.com> References: <121569.23784.qm@web38801.mail.mud.yahoo.com> Message-ID: On 8/17/08, Thomas Lindgren wrote: > > I'm not sure if this helps in your case, but if you're satisfied with getting line numbers in your exceptions, try smart_exceptions from jungerl. It's a parse transform, so it works without the debugger. > Ah, thanks for the pointer. So you are basically providing a fall through case for M-F-A-line error report whenever there's branching? It sounds like a good way to do it. I've read somebody (Joe?) saying that pattern matchings in erlang are like mini contracts. Early failure from failed match is a good thing. So I am wondering if Thomas's code transfomer is compatible with the Erlang philosophy (I think it is). But I may be missing the obvious. As mentioned, I am playing around with my pet lisp frontend. Having seem Thomas's smart exception, it seems that it makes sense to provide special syntatic support for matching failure. Something like, (case X * : "expected such and such input") The last line is a syntatic sugar for a universal pattern that throws a {badmatch...}, but with M-F-A/line and reason. Ditto with function clauses et al. Robert V. probably wouldn't like it : ) > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From todd@REDACTED Sun Aug 17 22:34:59 2008 From: todd@REDACTED (Todd Lipcon) Date: Sun, 17 Aug 2008 16:34:59 -0400 Subject: [erlang-questions] =?windows-1252?q?Error=3A_bad_value_on_output_?= =?windows-1252?q?port_=91tcp=5Finet=27=2E?= In-Reply-To: References: Message-ID: Hi Enhnaran, My guess is that you're sending the wrong data type for one of the elements in your "data" thrift struct. Can you paste the thrift definition for your 'data' struct along with the actual data you're trying to send? You'll get this error out of thrift if you try to send an atom where you meant to send a binary, for example. -Todd 2008/8/17 Enhnaran Alexander > Hi, > > I am now using Thrift, a lightweight, language-independent software stack. > I use this to communicate and transfer data between servers on which are > deployed system written in different languages. So when I call > thrift_client:call(Client, Func, Args) > which encapsulates call to > gen_server:call(Client, {Client, Func, Args}), > with the parameters like this: > thrift_client:call(Client, myFunc, [[{data, "f1", "f2", ..., > "fn"}]]), > it prompts out ERROR REPORT saying "Bad value on output port 'tcp_inet'". > > I have asked Mr. Google for help and only to find some answers. It is said > that a list or binary should be passed in, and if something like a tuple or > so is passed as a parameter, then such an error occurs. But I didn't at all > pass a tuple or anything but a list, so then why did this take place? > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alpar@REDACTED Sun Aug 17 22:35:55 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Sun, 17 Aug 2008 22:35:55 +0200 Subject: [erlang-questions] OTP question Message-ID: <1219005355.3781.13.camel@piko.site> Hi, I have a fairly basic problem, probably I did a silly mistake. When I stop an application, it does not terminate the supervisor tree. Please find an example in the attachment. It is a minimal application with one supervisor and a server. When I start the application, the supervisor and the server starts nicely: $erl Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> c(test_ser). {ok,test_ser} 2> c(test_sup). {ok,test_sup} 3> c(test_app). {ok,test_app} 4> application:start(test_app). TEST APP START. TEST SUPERVISOR START LINK. TEST SUPERVISOR INIT. TEST SERVER START LINK. TEST SERVER INIT. ok But when I stop it, test_app:stop/1 is executed, but test_sup:terminate/1 and test_server:terminate/2 are not. 5> application:stop(test_app). TEST APP STOP. =INFO REPORT==== 17-Aug-2008::22:27:49 === application: test_app exited: stopped type: temporary ok 6> What do I do wrong? Best regards, Alpar -------------- next part -------------- A non-text attachment was scrubbed... Name: test_ser.erl Type: text/x-erlang Size: 711 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_sup.erl Type: text/x-erlang Size: 428 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_app.erl Type: text/x-erlang Size: 232 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_app.app Type: text/x-matlab Size: 192 bytes Desc: not available URL: From thomasl_erlang@REDACTED Sun Aug 17 21:48:18 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 17 Aug 2008 12:48:18 -0700 (PDT) Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: Message-ID: <545523.56999.qm@web38808.mail.mud.yahoo.com> --- On Sun, 8/17/08, Howard Yeh wrote: > So you are basically providing a fall through case for > M-F-A-line > error report whenever there's branching? It sounds like > a good way to > do it. Basically the transform tries to "elaborate" all the places where an exception can be thrown into providing more information, and the program then throws the new exception when it's encountered. (There are a few cases where the transform misses out: undefined function calls and, I seem to recall, exceptions when building binaries, at the very least.) > I've read somebody (Joe?) saying that pattern matchings > in erlang are > like mini contracts. Early failure from failed match is a > good thing. > So I am wondering if Thomas's code transfomer is > compatible with the > Erlang philosophy (I think it is). But I may be missing the > obvious. All that basic smart_exceptions does is provide more information about the causes of an exception, so I don't think it's incompatible with such a principle. ("The basic transform", you ask? In principle, smart_exceptions also permits you to insert and run arbitrary code at the point of an exception, a bit like Common Lisp's condition handlers. But that's not tested much, and probably a bit too much complication.) Best, Thomas From erlang-questions_efine@REDACTED Sun Aug 17 23:34:36 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 17 Aug 2008 17:34:36 -0400 Subject: [erlang-questions] OTP question In-Reply-To: <1219005355.3781.13.camel@piko.site> References: <1219005355.3781.13.camel@piko.site> Message-ID: <6c2563b20808171434u2f849502if74df091c6c8b233@mail.gmail.com> In test_ser.erl, trap exits: init([]) -> * erlang:process_flag(trap_exit, true), * io:format("TEST SERVER INIT.~n",[]), {ok, []}. Hope this helps, Edwin 2008/8/17 Alp?r J?ttner > Hi, > > I have a fairly basic problem, probably I did a silly mistake. When I > stop an application, it does not terminate the supervisor tree. Please > find an example in the attachment. It is a minimal application with one > supervisor and a server. When I start the application, the supervisor > and the server starts nicely: > > $erl > Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.3 (abort with ^G) > 1> c(test_ser). > {ok,test_ser} > 2> c(test_sup). > {ok,test_sup} > 3> c(test_app). > {ok,test_app} > 4> application:start(test_app). > TEST APP START. > TEST SUPERVISOR START LINK. > TEST SUPERVISOR INIT. > TEST SERVER START LINK. > TEST SERVER INIT. > ok > > But when I stop it, test_app:stop/1 is executed, but > test_sup:terminate/1 and test_server:terminate/2 are not. > > 5> application:stop(test_app). > TEST APP STOP. > > =INFO REPORT==== 17-Aug-2008::22:27:49 === > application: test_app > exited: stopped > type: temporary > ok > 6> > > What do I do wrong? > > Best regards, > Alpar > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From bqt@REDACTED Thu Aug 14 17:52:57 2008 From: bqt@REDACTED (Johnny Billquist) Date: Thu, 14 Aug 2008 17:52:57 +0200 Subject: [erlang-questions] Tips on learning Erlang In-Reply-To: References: <226d73360808132323x1392da0ctbc489fe93893c969@mail.gmail.com> <226d73360808140436i20184d41lcf23952a8a2de08a@mail.gmail.com> <4d08db370808140537l177bc363ud63f9cc27105390@mail.gmail.com> <7075D875-05C8-4B5C-AF90-EDE109A78D98@hypotheticalabs.com> Message-ID: <48A454D9.9080506@softjar.se> Matt Williamson wrote: > L-99 is based off the original P-99, 99 prolog problems. Erlang is also > based on prolog. Um... Erlang syntax is inspired by (I hesitate to say based on, but maybe you could say that) Prolog, but Erlang as a language is not based on Prolog. Lisp is much closer. Johnny From ok@REDACTED Mon Aug 18 01:58:11 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Aug 2008 11:58:11 +1200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <480080.30813.qm@web38801.mail.mud.yahoo.com> References: <480080.30813.qm@web38801.mail.mud.yahoo.com> Message-ID: On 17 Aug 2008, at 10:01 pm, Thomas Lindgren wrote: > The basic problem is that epp works on the token level, not the > syntax tree level, so when you find ?FUNCTION there is no > information about what function you're in. (And figuring it out > seems like a thankless job.) > I note that while __FILE__, __LINE__, __DATE__, __TIME__ and so on are macros in C, __func__ is not. It is a keyword. So the solution that Thomas Lindgren proposes seems good. I would prefer one mechanism that solves several issues, so I suggest that instead of ?FUNCTION the thing to have is ?LOCATION => {File, Line, Module, Function, Arity, Clause_Number} From ok@REDACTED Mon Aug 18 02:46:15 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Aug 2008 12:46:15 +1200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com> Message-ID: <2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz> On 16 Aug 2008, at 8:35 am, Kevin Scaldeferri wrote: > Many languages are compiled to byte code, but able to recover line > numbers at run time. I assume they annotate the byte codes with file > and line information. Note that this is more powerful than the Erlang > macros. For example, Perl's caller() function allows you to inspect > the full call stack in this way. There is a tradeoff. When your compiler does good stuff like constant propagation, inlining, loop unrolling, loop fusion, &c, it gets hard to make 'the line number' mean anything. For example, suppose we had Ns = [sum(L) || L <- Ls], Ds = [length(L) || L <- Ls], Aves = [N/D || {N,D} <- lists:zip(Ns, Ds)] This is the kind of thing the GHC compiler eats for lunch; assuming Ns and Ds are not used anywhere else it turns into the equivalent of Aves = [sum(L)/length(L) || L <- Ls] Which line does this correspond to? ALL of them. (Actually, I believe GHC will take this a stage further, and inline and fuse the sum and length loops as well. In which case we have code within a single "line" coming from several files.) The Erlang compiler isn't that smart. (Yet. A man can dream.) One of the reasons that Perl can give you line numbers is that Perl is to speed what a spent match is to illumination. Debugging information can be bulky. For a non-Erlang example, I tried a small Java file. It has 172 lines, 116 of which count as SLOC. javac -g:none Calls.java => 2583 bytes javac Calls.java => 3035 bytes; 452 bytes of line# javac -g Calls.java => 3283 bytes; 248 bytes of other stuff The Java compiler counted 96 lines it thought worth recording, so that's 4.71 bytes per line. (Clearly they are not bothering to compress this much.) There are about 1380 bytes of actual code, so the line number table is about 1/3 as big as the code. Even assuming that virtual memory is huge and close to free, line number information should be used rarely enough that you don't want to mix it in with the instructions; you want to segregate it somewhere else. The really interesting thing is that javap basically lists the line number mappings backwards. Instead of saying "block [a..z) of byte code corresponds to line L", it says "line L corresponds to byte code starting at x". This suggests a fairly, um, direct mapping from source code to byte code: inlining, loop fusion, loop unrolling, &c are left to the JIT. Now the Erlang compiler isn't as smart as GHC, but it _is_ smarter than that. With inlining and tail recursion optimisation, even the stack trace isn't what it seems. A rather long-winded way of saying TANSTAAFL, I suppose. From ok@REDACTED Mon Aug 18 02:50:24 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Aug 2008 12:50:24 +1200 Subject: [erlang-questions] beginner question In-Reply-To: <20080817030712.GB22329@mtholyoke.edu> References: <20080817030712.GB22329@mtholyoke.edu> Message-ID: On 17 Aug 2008, at 3:07 pm, Ron Peterson wrote: > for( Max, Max, F ) -> > [F]; > for( I, Max, F ) -> > [F|for( I+1, Max, F )]. There are two issues here. First, for(1, 0, F) will crash instead of returning an empty list. Why? Second, you are making a list all of whose elements are the *value* F. With a name like that, you almost certainly wanted for(LB, UB, Fun) -> [Fun() || I <- lists:seq(LB, UB)]. or even for(LB, UB, Fun) -> [Fun(I) || I <- lists:seq(LB, UB)]. Better still, ditch for/3 entirely, and write the list comprehension in place. > > > random_tuple( Max ) -> > { random:uniform( Max ), random:uniform( Max ) }. > > random_tuples( Max, Num ) -> > set_seed_to_now(), > for( 1, Num, random_tuple( Max ) ). This should be random_tuples(Max, Count) -> set_seed_to_now(), [random_tuple(Max) || I <- lists:seq(1, Count)]. -- If stupidity were a crime, who'd 'scape hanging? From dawsdesign@REDACTED Mon Aug 18 05:29:02 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sun, 17 Aug 2008 23:29:02 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 Message-ID: Hi there, I have an OTP app with the following simpledb.rel file: *{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, [{simpledb, "1.0"}, {kernel, "2.11.5"}, {stdlib, "1.14.5"}]}.* And the following simpledb.app file: *{application, simpledb, [{description, "Stores Key, Value pairs."}, {id, "simpledb"}, {vsn, "1.0"}, {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, {mod, {simpledb_app, []}}, {registered, [simpledb_svr]}, {applications, [kernel, stdlib]}]}.* When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get the following error: *{{case_clause, {'EXIT', {function_clause, [{filename,join,[[]]}, {systools_make,add_appl,7}, {systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}]}}}, [{systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}, {erl_eval,do_apply,5}, {escript,code_handler,4}]}* `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. Also if you know why I get the following junk, it would be forever thankful: **WARNING* kernel: Object code (application) out of date *WARNING* kernel: Object code (application_controller) out of date *WARNING* kernel: Object code (application_master) out of date *WARNING* kernel: Object code (application_starter) out of date *WARNING* kernel: Object code (auth) out of date *WARNING* kernel: Object code (code) out of date *WARNING* kernel: Object code (code_aux) out of date *WARNING* kernel: Object code (packages) out of date *WARNING* kernel: Object code (code_server) out of date *WARNING* kernel: Object code (dist_util) out of date *WARNING* kernel: Object code (erl_boot_server) out of date *WARNING* kernel: Object code (erl_distribution) out of date *WARNING* kernel: Object code (erl_prim_loader) out of date *WARNING* kernel: Object code (erl_reply) out of date *WARNING* kernel: Object code (erlang) out of date *WARNING* kernel: Object code (error_handler) out of date *WARNING* kernel: Object code (error_logger) out of date *WARNING* kernel: Object code (file) out of date *WARNING* kernel: Object code (file_server) out of date *WARNING* kernel: Object code (file_io_server) out of date *WARNING* kernel: Object code (prim_file) out of date *WARNING* kernel: Object code (global) out of date *WARNING* kernel: Object code (global_group) out of date *WARNING* kernel: Object code (global_search) out of date *WARNING* kernel: Object code (group) out of date *WARNING* kernel: Object code (heart) out of date *WARNING* kernel: Object code (hipe_unified_loader) out of date *WARNING* kernel: Object code (inet6_tcp) out of date *WARNING* kernel: Object code (inet6_tcp_dist) out of date *WARNING* kernel: Object code (inet6_udp) out of date *WARNING* kernel: Object code (inet_config) out of date *WARNING* kernel: Object code (inet_hosts) out of date *WARNING* kernel: Object code (inet_gethost_native) out of date *WARNING* kernel: Object code (inet_tcp_dist) out of date *WARNING* kernel: Object code (init) out of date *WARNING* kernel: Object code (kernel) out of date *WARNING* kernel: Object code (kernel_config) out of date *WARNING* kernel: Object code (net) out of date *WARNING* kernel: Object code (net_adm) out of date *WARNING* kernel: Object code (net_kernel) out of date *WARNING* kernel: Object code (os) out of date *WARNING* kernel: Object code (ram_file) out of date *WARNING* kernel: Object code (rpc) out of date *WARNING* kernel: Object code (user) out of date *WARNING* kernel: Object code (user_drv) out of date *WARNING* kernel: Object code (user_sup) out of date *WARNING* kernel: Object code (disk_log) out of date *WARNING* kernel: Object code (disk_log_1) out of date *WARNING* kernel: Object code (disk_log_server) out of date *WARNING* kernel: Object code (disk_log_sup) out of date *WARNING* kernel: Object code (dist_ac) out of date *WARNING* kernel: Object code (erl_ddll) out of date *WARNING* kernel: Object code (erl_epmd) out of date *WARNING* kernel: Object code (erts_debug) out of date *WARNING* kernel: Object code (gen_tcp) out of date *WARNING* kernel: Object code (gen_udp) out of date *WARNING* kernel: Object code (gen_sctp) out of date *WARNING* kernel: Object code (prim_inet) out of date *WARNING* kernel: Object code (inet) out of date *WARNING* kernel: Object code (inet_db) out of date *WARNING* kernel: Object code (inet_dns) out of date *WARNING* kernel: Object code (inet_parse) out of date *WARNING* kernel: Object code (inet_res) out of date *WARNING* kernel: Object code (inet_tcp) out of date *WARNING* kernel: Object code (inet_udp) out of date *WARNING* kernel: Object code (inet_sctp) out of date *WARNING* kernel: Object code (pg2) out of date *WARNING* kernel: Object code (seq_trace) out of date *WARNING* kernel: Object code (wrap_log_reader) out of date *WARNING* kernel: Object code (zlib) out of date *WARNING* kernel: Object code (otp_ring0) out of date *WARNING* stdlib: Object code (base64) out of date *WARNING* stdlib: Object code (beam_lib) out of date *WARNING* stdlib: Object code (c) out of date *WARNING* stdlib: Object code (calendar) out of date *WARNING* stdlib: Object code (dets) out of date *WARNING* stdlib: Object code (dets_server) out of date *WARNING* stdlib: Object code (dets_sup) out of date *WARNING* stdlib: Object code (dets_utils) out of date *WARNING* stdlib: Object code (dets_v8) out of date *WARNING* stdlib: Object code (dets_v9) out of date *WARNING* stdlib: Object code (dict) out of date *WARNING* stdlib: Object code (digraph) out of date *WARNING* stdlib: Object code (digraph_utils) out of date *WARNING* stdlib: Object code (edlin) out of date *WARNING* stdlib: Object code (edlin_expand) out of date *WARNING* stdlib: Object code (epp) out of date *WARNING* stdlib: Object code (eval_bits) out of date *WARNING* stdlib: Object code (erl_bits) out of date *WARNING* stdlib: Object code (erl_compile) out of date *WARNING* stdlib: Object code (erl_eval) out of date *WARNING* stdlib: Object code (erl_expand_records) out of date *WARNING* stdlib: Object code (erl_internal) out of date *WARNING* stdlib: Object code (erl_lint) out of date *WARNING* stdlib: Object code (erl_parse) out of date *WARNING* stdlib: Object code (erl_posix_msg) out of date *WARNING* stdlib: Object code (erl_pp) out of date *WARNING* stdlib: Object code (erl_scan) out of date *WARNING* stdlib: Object code (erl_tar) out of date *WARNING* stdlib: Object code (error_logger_file_h) out of date *WARNING* stdlib: Object code (error_logger_tty_h) out of date *WARNING* stdlib: Object code (escript) out of date *WARNING* stdlib: Object code (ets) out of date *WARNING* stdlib: Object code (file_sorter) out of date *WARNING* stdlib: Object code (filelib) out of date *WARNING* stdlib: Object code (filename) out of date *WARNING* stdlib: Object code (gb_trees) out of date *WARNING* stdlib: Object code (gb_sets) out of date *WARNING* stdlib: Object code (gen) out of date *WARNING* stdlib: Object code (gen_event) out of date *WARNING* stdlib: Object code (gen_fsm) out of date *WARNING* stdlib: Object code (gen_server) out of date *WARNING* stdlib: Object code (io) out of date *WARNING* stdlib: Object code (io_lib) out of date *WARNING* stdlib: Object code (io_lib_format) out of date *WARNING* stdlib: Object code (io_lib_fread) out of date *WARNING* stdlib: Object code (io_lib_pretty) out of date *WARNING* stdlib: Object code (lib) out of date *WARNING* stdlib: Object code (lists) out of date *WARNING* stdlib: Object code (log_mf_h) out of date *WARNING* stdlib: Object code (math) out of date *WARNING* stdlib: Object code (ms_transform) out of date *WARNING* stdlib: Object code (orddict) out of date *WARNING* stdlib: Object code (ordsets) out of date *WARNING* stdlib: Object code (otp_internal) out of date *WARNING* stdlib: Object code (pg) out of date *WARNING* stdlib: Object code (pool) out of date *WARNING* stdlib: Object code (proc_lib) out of date *WARNING* stdlib: Object code (proplists) out of date *WARNING* stdlib: Object code (qlc) out of date *WARNING* stdlib: Object code (qlc_pt) out of date *WARNING* stdlib: Object code (queue) out of date *WARNING* stdlib: Object code (random) out of date *WARNING* stdlib: Object code (regexp) out of date *WARNING* stdlib: Object code (sets) out of date *WARNING* stdlib: Object code (shell) out of date *WARNING* stdlib: Object code (shell_default) out of date *WARNING* stdlib: Object code (slave) out of date *WARNING* stdlib: Object code (sofs) out of date *WARNING* stdlib: Object code (string) out of date *WARNING* stdlib: Object code (supervisor) out of date *WARNING* stdlib: Object code (supervisor_bridge) out of date *WARNING* stdlib: Object code (sys) out of date *WARNING* stdlib: Object code (timer) out of date *WARNING* stdlib: Object code (win32reg) out of date *WARNING* stdlib: Object code (zip) out of date* Thanks a lot! Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Mon Aug 18 09:53:51 2008 From: pguyot@REDACTED (Paul Guyot) Date: Mon, 18 Aug 2008 09:53:51 +0200 Subject: [erlang-questions] Dialyzer confused by several clauses? Message-ID: <414B5161-897B-497F-B5DD-9E770C27A07B@kallisys.net> Hello, Updating some code, I realized that dialyzer did not complain about an incorrect specification. Here is a simple code that it accepts: -type(dict() :: any()). -spec(clause/2::(integer(), dict()) -> tuple()). clause(0, Dict) -> case orddict:find(0, Dict) of {ok, Value} -> Value; error -> 0.0 end; clause(Integer, Dict) -> case orddict:find(Integer, Dict) of {ok, Value} -> Value / Integer; error -> 0.0 end. The real contract is: -spec(clause/2::(integer(), dict()) -> float()). An implied contact would be: -spec(clause/2::(integer(), dict()) -> float() | any()). But this contract is certainly incompatible with the code: -spec(clause/2::(integer(), dict()) -> tuple()). Am I doing something wrong or is it a known limitation? Regards, Paul From francesco@REDACTED Mon Aug 18 09:56:04 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 18 Aug 2008 08:56:04 +0100 Subject: [erlang-questions] Planet Erlang down (again?) In-Reply-To: <20080815085133.GA29761@erix.ericsson.se> References: <20080815085133.GA29761@erix.ericsson.se> Message-ID: <48A92B14.4070203@erlang-consulting.com> Hi Raimo, You are confusing planet erlang with trapexit. Trapexit has http://planet.trapexit.org which contains rss feed aggregation where users can add their own feeds. The problems on trapexit were solved a few months ago (They were a result of increasing traffic and failing hard disks). The only glitch on trapexit remaining is the connection with the mailing lists and the forums, something Adam was looking at last week. Francesco -- http://www.erlang-consulting.com Raimo Niskanen wrote: > http://www.planeterlang.org gives: > Parse error: parse error, unexpected $ in /opt/data/planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.php on line 138 > > In May, Francesco Cesarini wrote: > http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html > > Has it been up and is down again, or are they still working on it? > From alpar@REDACTED Mon Aug 18 10:14:13 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Mon, 18 Aug 2008 10:14:13 +0200 Subject: [erlang-questions] OTP question In-Reply-To: <6c2563b20808171434u2f849502if74df091c6c8b233@mail.gmail.com> References: <1219005355.3781.13.camel@piko.site> <6c2563b20808171434u2f849502if74df091c6c8b233@mail.gmail.com> Message-ID: <1219047253.3850.11.camel@piko.site> Hi, > In test_ser.erl, trap exits: Many thanks. Should I set this for the servers only, or the sub-supervisors, too? What is the reason why this isn't the default setting? Best regards, Alpar > > init([]) -> > erlang:process_flag(trap_exit, true), > io:format("TEST SERVER INIT.~n",[]), > {ok, []}. > > Hope this helps, > Edwin > > 2008/8/17 Alp?r J?ttner > Hi, > > I have a fairly basic problem, probably I did a silly mistake. > When I > stop an application, it does not terminate the supervisor > tree. Please > find an example in the attachment. It is a minimal application > with one > supervisor and a server. When I start the application, the > supervisor > and the server starts nicely: > > $erl > Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.6.3 (abort with ^G) > 1> c(test_ser). > {ok,test_ser} > 2> c(test_sup). > {ok,test_sup} > 3> c(test_app). > {ok,test_app} > 4> application:start(test_app). > TEST APP START. > TEST SUPERVISOR START LINK. > TEST SUPERVISOR INIT. > TEST SERVER START LINK. > TEST SERVER INIT. > ok > > But when I stop it, test_app:stop/1 is executed, but > test_sup:terminate/1 and test_server:terminate/2 are not. > > 5> application:stop(test_app). > TEST APP STOP. > > =INFO REPORT==== 17-Aug-2008::22:27:49 === > application: test_app > exited: stopped > type: temporary > ok > 6> > > What do I do wrong? > > Best regards, > Alpar > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > For every expert there is an equal and opposite expert - Arthur C. > Clarke > From lenartlad@REDACTED Mon Aug 18 10:36:19 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Mon, 18 Aug 2008 10:36:19 +0200 Subject: [erlang-questions] OTP question In-Reply-To: <6c2563b20808171434u2f849502if74df091c6c8b233@mail.gmail.com> References: <1219005355.3781.13.camel@piko.site> <6c2563b20808171434u2f849502if74df091c6c8b233@mail.gmail.com> Message-ID: <48A93483.90705@volny.cz> Edwin Fine wrote: > In test_ser.erl, trap exits: > > init([]) -> > * erlang:process_flag(trap_exit, true), > * io:format("TEST SERVER INIT.~n",[]), > {ok, []}. Hello, I would like to clarify that both your supervisor and worker terminated when the application stopped. Only the worker's (gen_server) terminate/2 callback was not called because the termination reason from its parent (the supervisor) was atom shutdown which is different from atom normal. Since the worker didn't trap exit signals, it "crashed". Ladislav Lenart From rvirding@REDACTED Mon Aug 18 10:36:50 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 18 Aug 2008 10:36:50 +0200 Subject: [erlang-questions] eep-0012 (Extensions to comprehensions) In-Reply-To: <007301c8f969$c7f343b0$f21ea8c0@SSI.CORP> References: <200808061719.55574.bekesa@sch.bme.hu> <643d90130808061110r7d1921c3y6f009481cfeb7cd9@mail.gmail.com> <9E494AD7-02AF-49DE-B3D3-A6567498492D@scaldeferri.com> <1D2F0203-5CAF-48F4-90C7-B4E079447AF6@cs.otago.ac.nz> <1C306E31-2EDE-491D-AF58-17489040AAC1@scaldeferri.com> <71646F83-E69F-49A3-94CF-DE4C2D135BAD@cs.otago.ac.nz> <489BAA91.4050308@san.rr.com> <007301c8f969$c7f343b0$f21ea8c0@SSI.CORP> Message-ID: <3dbc6d1c0808180136h60efc06et714e55634d09c0c3@mail.gmail.com> 2008/8/8 David Mercer > > I note, however, to my chagrin, that Erlang isn't alone in not adopting a > more LISP-like syntax (cf. C, Java, Algol, PL/I, Ada, Pascal, Basic, Perl, > etc. etc.). Should it? Bit late now, and much as it bugs me, I'm still > going to write my Erlang in Erlang rather than LFE. At least Erlang offers > an alternative syntax, though I don't know whether you would characterize > it > as being production-ready yet. It's production-ready in the sense that there are no (known) bugs in it and that you can do everything you need to be attuned to vanilla Erlang and coexist seemlessly with it. Most of the lisp features you would want are there as well. What is needed is to fix a few design decisions on the lisp side. Next version hopefully. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobias.lindahl@REDACTED Mon Aug 18 10:44:19 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Mon, 18 Aug 2008 10:44:19 +0200 Subject: [erlang-questions] Dialyzer confused by several clauses? In-Reply-To: <414B5161-897B-497F-B5DD-9E770C27A07B@kallisys.net> References: <414B5161-897B-497F-B5DD-9E770C27A07B@kallisys.net> Message-ID: <48A93663.40202@kreditor.se> Paul, Paul Guyot wrote: > Hello, > > Updating some code, I realized that dialyzer did not complain about an > incorrect specification. > > Here is a simple code that it accepts: > > -type(dict() :: any()). > > -spec(clause/2::(integer(), dict()) -> tuple()). > clause(0, Dict) -> > case orddict:find(0, Dict) of > {ok, Value} -> Value; > error -> 0.0 > end; > clause(Integer, Dict) -> > case orddict:find(Integer, Dict) of > {ok, Value} -> Value / Integer; > error -> 0.0 > end. > > The real contract is: > -spec(clause/2::(integer(), dict()) -> float()). > > An implied contact would be: > -spec(clause/2::(integer(), dict()) -> float() | any()). > > But this contract is certainly incompatible with the code: > -spec(clause/2::(integer(), dict()) -> tuple()). > > Am I doing something wrong or is it a known limitation? The checking in Dialyzer whether a contract is valid is not as sophisticated as it could be. First it finds the success typing of a function and then it compares it with the contract. The default is to complain only if the two are contradicting. In your case the return type in the success typing is any() because of the Value in the first clause (*). Since this does not contradict the tuple() in the contract, Dialyzer is satisfied. The reason for this somewhat liberal reasoning is the principle of sound warnings; if there is a possibility that a contract is correct then Dialyzer gives no warning. However, we could of course lift this restriction by allowing the user to give some option, but this is not present today. There are options for getting more strict warnings about contracts. However, they would not have helped you in this case. The options are --Wunderspecs, --Woverspecs and --Wspecdiffs. Basically these options makes Dialyzer warn when the specs differ from the success typings of functions. They are not on by default since the resulting warnings are a bit confusing at times. Tobias (*) As you say, the type could be written as float() | any(), but unions must be disjoint so this is collapsed to any(). From matthias@REDACTED Mon Aug 18 11:48:03 2008 From: matthias@REDACTED (Matthias Lang) Date: Mon, 18 Aug 2008 11:48:03 +0200 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> Message-ID: <20080818094803.GA22078@contorpis.lisalinda.com> On Tuesday, August 12, Jared Langson wrote: > I decided to solve the smoker's > problemto get > a feel for the language. Others have already commented on how to fix your solution. I hadn't seen the smokers' problem (or, perhaps, forgotten it), so I solved it for fun. It felt pretty pointless---what does "you're not allowed to modify the agent code" mean when you're writing it all from scratch? I chose to interpret it as "the smokers aren't allowed to send each other messages". What does the second constraint mean in Erlang? The solution in wikipedia removes so much of the problem that it becomes almost unrecognisable, e.g. there's nothing called 'paper', 'match' or 'tobacco' in it! Convincing yourself it's correct is hard. Anyway, are there more enjoyable problems for playing with Erlang? Two spring to mind, but they're more suitable once you're reasonably comfortable with the language. They take about a day each. The first is the POTS exercise. This is part of the Erlang course taught at Ericsson (and probably also at Erlang Consulting & Training) If you're lucky, you get an office phone system to play with and you implement its control logic in Erlang. You need to make sure the right phone rings when you dial numbers, you need to take care of conditions like trying to call a phone that's off-hook, and so on. There's also a gs-based simulator, but as far as I know neither the problem spec nor the simulator is available online. Oh well. The second is to implement a lift controller. This problem is fairly well known in the formal methods & SE world, e.g. http://www.soi.wide.ad.jp/class/20060036/materials_for_student/10/14126.pdf http://se.uwaterloo.ca/~dberry/ATRE/ElevatorSRSs/SRS2/SRS2-Vahid-Karimi.pdf you can make it more complicated by having multiple lifts, inventing scheduling strategies and by adding realism, for instance modelling the subtleties of lifts that are in motion near stops---e.g. a lift needs, say, 2 metres of advance warning to stop somewhere. Like the POTS exercise, a graphical simulator makes it more fun. Even with multiple lifts, it's not as "concurrent" as it first seems. Matt From dawsdesign@REDACTED Mon Aug 18 13:40:52 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 07:40:52 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: <8FEAEFBA-0F70-4E63-B5FC-9FC679F9009D@erlang-consulting.com> Message-ID: Sorry for the confusion. systools:make_script/1,2 works, but make_tar doesn't. On Mon, Aug 18, 2008 at 7:28 AM, Martin Carlson < martin@REDACTED> wrote: > Yes you do need the quotes ;) > Martin Carlson > Erlang Training & Consulting > http://www.erlang-consulting.com > > > On 18 Aug 2008, at 11:50, Matt Williamson wrote: > > No, but systools:make_script("simpledb") did :) I believe you need the > quotes. > > On Mon, Aug 18, 2008 at 3:35 AM, Martin Carlson < > martin@REDACTED> wrote: > >> Hi, >> Did the systools:make_script(simpledb) execute correctly? >> >> You might want to try running your erl like erl -pa ../simpledb/ebin >> Then issue systools:make_tar(simpledb). >> There are some issues with paths and apps. >> >> For instance, if you run erl like described above code:priv_dir works, >> while if you run it like erl -pa ebin it does not. >> >> Martin Carlson >> Erlang Training & Consulting >> http://www.erlang-consulting.com >> >> >> On 18 Aug 2008, at 06:29, Matt Williamson wrote: >> >> Hi there, >> >> I have an OTP app with the following simpledb.rel file: >> >> *{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >> [{simpledb, "1.0"}, >> {kernel, "2.11.5"}, >> {stdlib, "1.14.5"}]}.* >> >> And the following simpledb.app file: >> >> *{application, simpledb, >> [{description, "Stores Key, Value pairs."}, >> {id, "simpledb"}, >> {vsn, "1.0"}, >> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >> {mod, {simpledb_app, []}}, >> {registered, [simpledb_svr]}, >> {applications, [kernel, stdlib]}]}.* >> >> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get the >> following error: >> >> *{{case_clause, >> {'EXIT', >> {function_clause, >> [{filename,join,[[]]}, >> {systools_make,add_appl,7}, >> {systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}]}}}, >> [{systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}, >> {erl_eval,do_apply,5}, >> {escript,code_handler,4}]}* >> >> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >> >> Also if you know why I get the following junk, it would be forever >> thankful: >> >> **WARNING* kernel: Object code (application) out of date >> *WARNING* kernel: Object code (application_controller) out of date >> *WARNING* kernel: Object code (application_master) out of date >> *WARNING* kernel: Object code (application_starter) out of date >> *WARNING* kernel: Object code (auth) out of date >> *WARNING* kernel: Object code (code) out of date >> *WARNING* kernel: Object code (code_aux) out of date >> *WARNING* kernel: Object code (packages) out of date >> *WARNING* kernel: Object code (code_server) out of date >> *WARNING* kernel: Object code (dist_util) out of date >> *WARNING* kernel: Object code (erl_boot_server) out of date >> *WARNING* kernel: Object code (erl_distribution) out of date >> *WARNING* kernel: Object code (erl_prim_loader) out of date >> *WARNING* kernel: Object code (erl_reply) out of date >> *WARNING* kernel: Object code (erlang) out of date >> *WARNING* kernel: Object code (error_handler) out of date >> *WARNING* kernel: Object code (error_logger) out of date >> *WARNING* kernel: Object code (file) out of date >> *WARNING* kernel: Object code (file_server) out of date >> *WARNING* kernel: Object code (file_io_server) out of date >> *WARNING* kernel: Object code (prim_file) out of date >> *WARNING* kernel: Object code (global) out of date >> *WARNING* kernel: Object code (global_group) out of date >> *WARNING* kernel: Object code (global_search) out of date >> *WARNING* kernel: Object code (group) out of date >> *WARNING* kernel: Object code (heart) out of date >> *WARNING* kernel: Object code (hipe_unified_loader) out of date >> *WARNING* kernel: Object code (inet6_tcp) out of date >> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >> *WARNING* kernel: Object code (inet6_udp) out of date >> *WARNING* kernel: Object code (inet_config) out of date >> *WARNING* kernel: Object code (inet_hosts) out of date >> *WARNING* kernel: Object code (inet_gethost_native) out of date >> *WARNING* kernel: Object code (inet_tcp_dist) out of date >> *WARNING* kernel: Object code (init) out of date >> *WARNING* kernel: Object code (kernel) out of date >> *WARNING* kernel: Object code (kernel_config) out of date >> *WARNING* kernel: Object code (net) out of date >> *WARNING* kernel: Object code (net_adm) out of date >> *WARNING* kernel: Object code (net_kernel) out of date >> *WARNING* kernel: Object code (os) out of date >> *WARNING* kernel: Object code (ram_file) out of date >> *WARNING* kernel: Object code (rpc) out of date >> *WARNING* kernel: Object code (user) out of date >> *WARNING* kernel: Object code (user_drv) out of date >> *WARNING* kernel: Object code (user_sup) out of date >> *WARNING* kernel: Object code (disk_log) out of date >> *WARNING* kernel: Object code (disk_log_1) out of date >> *WARNING* kernel: Object code (disk_log_server) out of date >> *WARNING* kernel: Object code (disk_log_sup) out of date >> *WARNING* kernel: Object code (dist_ac) out of date >> *WARNING* kernel: Object code (erl_ddll) out of date >> *WARNING* kernel: Object code (erl_epmd) out of date >> *WARNING* kernel: Object code (erts_debug) out of date >> *WARNING* kernel: Object code (gen_tcp) out of date >> *WARNING* kernel: Object code (gen_udp) out of date >> *WARNING* kernel: Object code (gen_sctp) out of date >> *WARNING* kernel: Object code (prim_inet) out of date >> *WARNING* kernel: Object code (inet) out of date >> *WARNING* kernel: Object code (inet_db) out of date >> *WARNING* kernel: Object code (inet_dns) out of date >> *WARNING* kernel: Object code (inet_parse) out of date >> *WARNING* kernel: Object code (inet_res) out of date >> *WARNING* kernel: Object code (inet_tcp) out of date >> *WARNING* kernel: Object code (inet_udp) out of date >> *WARNING* kernel: Object code (inet_sctp) out of date >> *WARNING* kernel: Object code (pg2) out of date >> *WARNING* kernel: Object code (seq_trace) out of date >> *WARNING* kernel: Object code (wrap_log_reader) out of date >> *WARNING* kernel: Object code (zlib) out of date >> *WARNING* kernel: Object code (otp_ring0) out of date >> *WARNING* stdlib: Object code (base64) out of date >> *WARNING* stdlib: Object code (beam_lib) out of date >> *WARNING* stdlib: Object code (c) out of date >> *WARNING* stdlib: Object code (calendar) out of date >> *WARNING* stdlib: Object code (dets) out of date >> *WARNING* stdlib: Object code (dets_server) out of date >> *WARNING* stdlib: Object code (dets_sup) out of date >> *WARNING* stdlib: Object code (dets_utils) out of date >> *WARNING* stdlib: Object code (dets_v8) out of date >> *WARNING* stdlib: Object code (dets_v9) out of date >> *WARNING* stdlib: Object code (dict) out of date >> *WARNING* stdlib: Object code (digraph) out of date >> *WARNING* stdlib: Object code (digraph_utils) out of date >> *WARNING* stdlib: Object code (edlin) out of date >> *WARNING* stdlib: Object code (edlin_expand) out of date >> *WARNING* stdlib: Object code (epp) out of date >> *WARNING* stdlib: Object code (eval_bits) out of date >> *WARNING* stdlib: Object code (erl_bits) out of date >> *WARNING* stdlib: Object code (erl_compile) out of date >> *WARNING* stdlib: Object code (erl_eval) out of date >> *WARNING* stdlib: Object code (erl_expand_records) out of date >> *WARNING* stdlib: Object code (erl_internal) out of date >> *WARNING* stdlib: Object code (erl_lint) out of date >> *WARNING* stdlib: Object code (erl_parse) out of date >> *WARNING* stdlib: Object code (erl_posix_msg) out of date >> *WARNING* stdlib: Object code (erl_pp) out of date >> *WARNING* stdlib: Object code (erl_scan) out of date >> *WARNING* stdlib: Object code (erl_tar) out of date >> *WARNING* stdlib: Object code (error_logger_file_h) out of date >> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >> *WARNING* stdlib: Object code (escript) out of date >> *WARNING* stdlib: Object code (ets) out of date >> *WARNING* stdlib: Object code (file_sorter) out of date >> *WARNING* stdlib: Object code (filelib) out of date >> *WARNING* stdlib: Object code (filename) out of date >> *WARNING* stdlib: Object code (gb_trees) out of date >> *WARNING* stdlib: Object code (gb_sets) out of date >> *WARNING* stdlib: Object code (gen) out of date >> *WARNING* stdlib: Object code (gen_event) out of date >> *WARNING* stdlib: Object code (gen_fsm) out of date >> *WARNING* stdlib: Object code (gen_server) out of date >> *WARNING* stdlib: Object code (io) out of date >> *WARNING* stdlib: Object code (io_lib) out of date >> *WARNING* stdlib: Object code (io_lib_format) out of date >> *WARNING* stdlib: Object code (io_lib_fread) out of date >> *WARNING* stdlib: Object code (io_lib_pretty) out of date >> *WARNING* stdlib: Object code (lib) out of date >> *WARNING* stdlib: Object code (lists) out of date >> *WARNING* stdlib: Object code (log_mf_h) out of date >> *WARNING* stdlib: Object code (math) out of date >> *WARNING* stdlib: Object code (ms_transform) out of date >> *WARNING* stdlib: Object code (orddict) out of date >> *WARNING* stdlib: Object code (ordsets) out of date >> *WARNING* stdlib: Object code (otp_internal) out of date >> *WARNING* stdlib: Object code (pg) out of date >> *WARNING* stdlib: Object code (pool) out of date >> *WARNING* stdlib: Object code (proc_lib) out of date >> *WARNING* stdlib: Object code (proplists) out of date >> *WARNING* stdlib: Object code (qlc) out of date >> *WARNING* stdlib: Object code (qlc_pt) out of date >> *WARNING* stdlib: Object code (queue) out of date >> *WARNING* stdlib: Object code (random) out of date >> *WARNING* stdlib: Object code (regexp) out of date >> *WARNING* stdlib: Object code (sets) out of date >> *WARNING* stdlib: Object code (shell) out of date >> *WARNING* stdlib: Object code (shell_default) out of date >> *WARNING* stdlib: Object code (slave) out of date >> *WARNING* stdlib: Object code (sofs) out of date >> *WARNING* stdlib: Object code (string) out of date >> *WARNING* stdlib: Object code (supervisor) out of date >> *WARNING* stdlib: Object code (supervisor_bridge) out of date >> *WARNING* stdlib: Object code (sys) out of date >> *WARNING* stdlib: Object code (timer) out of date >> *WARNING* stdlib: Object code (win32reg) out of date >> *WARNING* stdlib: Object code (zip) out of date* >> >> >> Thanks a lot! >> >> Matt >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mazen@REDACTED Mon Aug 18 13:50:47 2008 From: mazen@REDACTED (Mazen Harake) Date: Mon, 18 Aug 2008 12:50:47 +0100 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: Message-ID: <48A96217.90806@erlang-consulting.com> Hi Mat, Answers inline... Matt Williamson wrote: > Hi there, > > I have an OTP app with the following simpledb.rel file: > > /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, > [{simpledb, "1.0"}, > {kernel, "2.11.5"}, > {stdlib, "1.14.5"}]}./ > > And the following simpledb.app file: > > /{application, simpledb, > [{description, "Stores Key, Value pairs."}, > {id, "simpledb"}, > {vsn, "1.0"}, > {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, > {mod, {simpledb_app, []}}, > / Why do you have an empty list here? mod specifies modules for application simpledb... and empty list ("") is not a valid module name :) > / {registered, [simpledb_svr]}, > {applications, [kernel, stdlib]}]}./ > > When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get > the following error: > > /{{case_clause, > {'EXIT', > {function_clause, > [{filename,join,[[]]}, > {systools_make,add_appl,7}, > {systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}]}}}, > [{systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}, > {erl_eval,do_apply,5}, > {escript,code_handler,4}]}/ > > `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. > > Also if you know why I get the following junk, it would be forever > thankful: > > /*WARNING* kernel: Object code (application) out of date > *WARNING* kernel: Object code (application_controller) out of date > *WARNING* kernel: Object code (application_master) out of date > *WARNING* kernel: Object code (application_starter) out of date > *WARNING* kernel: Object code (auth) out of date > *WARNING* kernel: Object code (code) out of date > *WARNING* kernel: Object code (code_aux) out of date > *WARNING* kernel: Object code (packages) out of date > *WARNING* kernel: Object code (code_server) out of date > *WARNING* kernel: Object code (dist_util) out of date > *WARNING* kernel: Object code (erl_boot_server) out of date > *WARNING* kernel: Object code (erl_distribution) out of date > *WARNING* kernel: Object code (erl_prim_loader) out of date > *WARNING* kernel: Object code (erl_reply) out of date > *WARNING* kernel: Object code (erlang) out of date > *WARNING* kernel: Object code (error_handler) out of date > *WARNING* kernel: Object code (error_logger) out of date > *WARNING* kernel: Object code (file) out of date > *WARNING* kernel: Object code (file_server) out of date > *WARNING* kernel: Object code (file_io_server) out of date > *WARNING* kernel: Object code (prim_file) out of date > *WARNING* kernel: Object code (global) out of date > *WARNING* kernel: Object code (global_group) out of date > *WARNING* kernel: Object code (global_search) out of date > *WARNING* kernel: Object code (group) out of date > *WARNING* kernel: Object code (heart) out of date > *WARNING* kernel: Object code (hipe_unified_loader) out of date > *WARNING* kernel: Object code (inet6_tcp) out of date > *WARNING* kernel: Object code (inet6_tcp_dist) out of date > *WARNING* kernel: Object code (inet6_udp) out of date > *WARNING* kernel: Object code (inet_config) out of date > *WARNING* kernel: Object code (inet_hosts) out of date > *WARNING* kernel: Object code (inet_gethost_native) out of date > *WARNING* kernel: Object code (inet_tcp_dist) out of date > *WARNING* kernel: Object code (init) out of date > *WARNING* kernel: Object code (kernel) out of date > *WARNING* kernel: Object code (kernel_config) out of date > *WARNING* kernel: Object code (net) out of date > *WARNING* kernel: Object code (net_adm) out of date > *WARNING* kernel: Object code (net_kernel) out of date > *WARNING* kernel: Object code (os) out of date > *WARNING* kernel: Object code (ram_file) out of date > *WARNING* kernel: Object code (rpc) out of date > *WARNING* kernel: Object code (user) out of date > *WARNING* kernel: Object code (user_drv) out of date > *WARNING* kernel: Object code (user_sup) out of date > *WARNING* kernel: Object code (disk_log) out of date > *WARNING* kernel: Object code (disk_log_1) out of date > *WARNING* kernel: Object code (disk_log_server) out of date > *WARNING* kernel: Object code (disk_log_sup) out of date > *WARNING* kernel: Object code (dist_ac) out of date > *WARNING* kernel: Object code (erl_ddll) out of date > *WARNING* kernel: Object code (erl_epmd) out of date > *WARNING* kernel: Object code (erts_debug) out of date > *WARNING* kernel: Object code (gen_tcp) out of date > *WARNING* kernel: Object code (gen_udp) out of date > *WARNING* kernel: Object code (gen_sctp) out of date > *WARNING* kernel: Object code (prim_inet) out of date > *WARNING* kernel: Object code (inet) out of date > *WARNING* kernel: Object code (inet_db) out of date > *WARNING* kernel: Object code (inet_dns) out of date > *WARNING* kernel: Object code (inet_parse) out of date > *WARNING* kernel: Object code (inet_res) out of date > *WARNING* kernel: Object code (inet_tcp) out of date > *WARNING* kernel: Object code (inet_udp) out of date > *WARNING* kernel: Object code (inet_sctp) out of date > *WARNING* kernel: Object code (pg2) out of date > *WARNING* kernel: Object code (seq_trace) out of date > *WARNING* kernel: Object code (wrap_log_reader) out of date > *WARNING* kernel: Object code (zlib) out of date > *WARNING* kernel: Object code (otp_ring0) out of date > *WARNING* stdlib: Object code (base64) out of date > *WARNING* stdlib: Object code (beam_lib) out of date > *WARNING* stdlib: Object code (c) out of date > *WARNING* stdlib: Object code (calendar) out of date > *WARNING* stdlib: Object code (dets) out of date > *WARNING* stdlib: Object code (dets_server) out of date > *WARNING* stdlib: Object code (dets_sup) out of date > *WARNING* stdlib: Object code (dets_utils) out of date > *WARNING* stdlib: Object code (dets_v8) out of date > *WARNING* stdlib: Object code (dets_v9) out of date > *WARNING* stdlib: Object code (dict) out of date > *WARNING* stdlib: Object code (digraph) out of date > *WARNING* stdlib: Object code (digraph_utils) out of date > *WARNING* stdlib: Object code (edlin) out of date > *WARNING* stdlib: Object code (edlin_expand) out of date > *WARNING* stdlib: Object code (epp) out of date > *WARNING* stdlib: Object code (eval_bits) out of date > *WARNING* stdlib: Object code (erl_bits) out of date > *WARNING* stdlib: Object code (erl_compile) out of date > *WARNING* stdlib: Object code (erl_eval) out of date > *WARNING* stdlib: Object code (erl_expand_records) out of date > *WARNING* stdlib: Object code (erl_internal) out of date > *WARNING* stdlib: Object code (erl_lint) out of date > *WARNING* stdlib: Object code (erl_parse) out of date > *WARNING* stdlib: Object code (erl_posix_msg) out of date > *WARNING* stdlib: Object code (erl_pp) out of date > *WARNING* stdlib: Object code (erl_scan) out of date > *WARNING* stdlib: Object code (erl_tar) out of date > *WARNING* stdlib: Object code (error_logger_file_h) out of date > *WARNING* stdlib: Object code (error_logger_tty_h) out of date > *WARNING* stdlib: Object code (escript) out of date > *WARNING* stdlib: Object code (ets) out of date > *WARNING* stdlib: Object code (file_sorter) out of date > *WARNING* stdlib: Object code (filelib) out of date > *WARNING* stdlib: Object code (filename) out of date > *WARNING* stdlib: Object code (gb_trees) out of date > *WARNING* stdlib: Object code (gb_sets) out of date > *WARNING* stdlib: Object code (gen) out of date > *WARNING* stdlib: Object code (gen_event) out of date > *WARNING* stdlib: Object code (gen_fsm) out of date > *WARNING* stdlib: Object code (gen_server) out of date > *WARNING* stdlib: Object code (io) out of date > *WARNING* stdlib: Object code (io_lib) out of date > *WARNING* stdlib: Object code (io_lib_format) out of date > *WARNING* stdlib: Object code (io_lib_fread) out of date > *WARNING* stdlib: Object code (io_lib_pretty) out of date > *WARNING* stdlib: Object code (lib) out of date > *WARNING* stdlib: Object code (lists) out of date > *WARNING* stdlib: Object code (log_mf_h) out of date > *WARNING* stdlib: Object code (math) out of date > *WARNING* stdlib: Object code (ms_transform) out of date > *WARNING* stdlib: Object code (orddict) out of date > *WARNING* stdlib: Object code (ordsets) out of date > *WARNING* stdlib: Object code (otp_internal) out of date > *WARNING* stdlib: Object code (pg) out of date > *WARNING* stdlib: Object code (pool) out of date > *WARNING* stdlib: Object code (proc_lib) out of date > *WARNING* stdlib: Object code (proplists) out of date > *WARNING* stdlib: Object code (qlc) out of date > *WARNING* stdlib: Object code (qlc_pt) out of date > *WARNING* stdlib: Object code (queue) out of date > *WARNING* stdlib: Object code (random) out of date > *WARNING* stdlib: Object code (regexp) out of date > *WARNING* stdlib: Object code (sets) out of date > *WARNING* stdlib: Object code (shell) out of date > *WARNING* stdlib: Object code (shell_default) out of date > *WARNING* stdlib: Object code (slave) out of date > *WARNING* stdlib: Object code (sofs) out of date > *WARNING* stdlib: Object code (string) out of date > *WARNING* stdlib: Object code (supervisor) out of date > *WARNING* stdlib: Object code (supervisor_bridge) out of date > *WARNING* stdlib: Object code (sys) out of date > *WARNING* stdlib: Object code (timer) out of date > *WARNING* stdlib: Object code (win32reg) out of date > *WARNING* stdlib: Object code (zip) out of date/ > > > Thanks a lot! > > Matt > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From mazen@REDACTED Mon Aug 18 13:53:48 2008 From: mazen@REDACTED (Mazen Harake) Date: Mon, 18 Aug 2008 12:53:48 +0100 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: <48A96217.90806@erlang-consulting.com> References: <48A96217.90806@erlang-consulting.com> Message-ID: <48A962CC.9040708@erlang-consulting.com> Sorry all... This is what happens when you read something and answer quickly :( Completly ignore what I just wrote :P /Mazen Mazen Harake wrote: > Hi Mat, > > Answers inline... > > Matt Williamson wrote: > >> Hi there, >> >> I have an OTP app with the following simpledb.rel file: >> >> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >> [{simpledb, "1.0"}, >> {kernel, "2.11.5"}, >> {stdlib, "1.14.5"}]}./ >> >> And the following simpledb.app file: >> >> /{application, simpledb, >> [{description, "Stores Key, Value pairs."}, >> {id, "simpledb"}, >> {vsn, "1.0"}, >> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >> {mod, {simpledb_app, []}}, >> / >> > Why do you have an empty list here? mod specifies modules for > application simpledb... and empty list ("") is not a valid module name :) > >> / {registered, [simpledb_svr]}, >> {applications, [kernel, stdlib]}]}./ >> >> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >> the following error: >> >> /{{case_clause, >> {'EXIT', >> {function_clause, >> [{filename,join,[[]]}, >> {systools_make,add_appl,7}, >> {systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}]}}}, >> [{systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}, >> {erl_eval,do_apply,5}, >> {escript,code_handler,4}]}/ >> >> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >> >> Also if you know why I get the following junk, it would be forever >> thankful: >> >> /*WARNING* kernel: Object code (application) out of date >> *WARNING* kernel: Object code (application_controller) out of date >> *WARNING* kernel: Object code (application_master) out of date >> *WARNING* kernel: Object code (application_starter) out of date >> *WARNING* kernel: Object code (auth) out of date >> *WARNING* kernel: Object code (code) out of date >> *WARNING* kernel: Object code (code_aux) out of date >> *WARNING* kernel: Object code (packages) out of date >> *WARNING* kernel: Object code (code_server) out of date >> *WARNING* kernel: Object code (dist_util) out of date >> *WARNING* kernel: Object code (erl_boot_server) out of date >> *WARNING* kernel: Object code (erl_distribution) out of date >> *WARNING* kernel: Object code (erl_prim_loader) out of date >> *WARNING* kernel: Object code (erl_reply) out of date >> *WARNING* kernel: Object code (erlang) out of date >> *WARNING* kernel: Object code (error_handler) out of date >> *WARNING* kernel: Object code (error_logger) out of date >> *WARNING* kernel: Object code (file) out of date >> *WARNING* kernel: Object code (file_server) out of date >> *WARNING* kernel: Object code (file_io_server) out of date >> *WARNING* kernel: Object code (prim_file) out of date >> *WARNING* kernel: Object code (global) out of date >> *WARNING* kernel: Object code (global_group) out of date >> *WARNING* kernel: Object code (global_search) out of date >> *WARNING* kernel: Object code (group) out of date >> *WARNING* kernel: Object code (heart) out of date >> *WARNING* kernel: Object code (hipe_unified_loader) out of date >> *WARNING* kernel: Object code (inet6_tcp) out of date >> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >> *WARNING* kernel: Object code (inet6_udp) out of date >> *WARNING* kernel: Object code (inet_config) out of date >> *WARNING* kernel: Object code (inet_hosts) out of date >> *WARNING* kernel: Object code (inet_gethost_native) out of date >> *WARNING* kernel: Object code (inet_tcp_dist) out of date >> *WARNING* kernel: Object code (init) out of date >> *WARNING* kernel: Object code (kernel) out of date >> *WARNING* kernel: Object code (kernel_config) out of date >> *WARNING* kernel: Object code (net) out of date >> *WARNING* kernel: Object code (net_adm) out of date >> *WARNING* kernel: Object code (net_kernel) out of date >> *WARNING* kernel: Object code (os) out of date >> *WARNING* kernel: Object code (ram_file) out of date >> *WARNING* kernel: Object code (rpc) out of date >> *WARNING* kernel: Object code (user) out of date >> *WARNING* kernel: Object code (user_drv) out of date >> *WARNING* kernel: Object code (user_sup) out of date >> *WARNING* kernel: Object code (disk_log) out of date >> *WARNING* kernel: Object code (disk_log_1) out of date >> *WARNING* kernel: Object code (disk_log_server) out of date >> *WARNING* kernel: Object code (disk_log_sup) out of date >> *WARNING* kernel: Object code (dist_ac) out of date >> *WARNING* kernel: Object code (erl_ddll) out of date >> *WARNING* kernel: Object code (erl_epmd) out of date >> *WARNING* kernel: Object code (erts_debug) out of date >> *WARNING* kernel: Object code (gen_tcp) out of date >> *WARNING* kernel: Object code (gen_udp) out of date >> *WARNING* kernel: Object code (gen_sctp) out of date >> *WARNING* kernel: Object code (prim_inet) out of date >> *WARNING* kernel: Object code (inet) out of date >> *WARNING* kernel: Object code (inet_db) out of date >> *WARNING* kernel: Object code (inet_dns) out of date >> *WARNING* kernel: Object code (inet_parse) out of date >> *WARNING* kernel: Object code (inet_res) out of date >> *WARNING* kernel: Object code (inet_tcp) out of date >> *WARNING* kernel: Object code (inet_udp) out of date >> *WARNING* kernel: Object code (inet_sctp) out of date >> *WARNING* kernel: Object code (pg2) out of date >> *WARNING* kernel: Object code (seq_trace) out of date >> *WARNING* kernel: Object code (wrap_log_reader) out of date >> *WARNING* kernel: Object code (zlib) out of date >> *WARNING* kernel: Object code (otp_ring0) out of date >> *WARNING* stdlib: Object code (base64) out of date >> *WARNING* stdlib: Object code (beam_lib) out of date >> *WARNING* stdlib: Object code (c) out of date >> *WARNING* stdlib: Object code (calendar) out of date >> *WARNING* stdlib: Object code (dets) out of date >> *WARNING* stdlib: Object code (dets_server) out of date >> *WARNING* stdlib: Object code (dets_sup) out of date >> *WARNING* stdlib: Object code (dets_utils) out of date >> *WARNING* stdlib: Object code (dets_v8) out of date >> *WARNING* stdlib: Object code (dets_v9) out of date >> *WARNING* stdlib: Object code (dict) out of date >> *WARNING* stdlib: Object code (digraph) out of date >> *WARNING* stdlib: Object code (digraph_utils) out of date >> *WARNING* stdlib: Object code (edlin) out of date >> *WARNING* stdlib: Object code (edlin_expand) out of date >> *WARNING* stdlib: Object code (epp) out of date >> *WARNING* stdlib: Object code (eval_bits) out of date >> *WARNING* stdlib: Object code (erl_bits) out of date >> *WARNING* stdlib: Object code (erl_compile) out of date >> *WARNING* stdlib: Object code (erl_eval) out of date >> *WARNING* stdlib: Object code (erl_expand_records) out of date >> *WARNING* stdlib: Object code (erl_internal) out of date >> *WARNING* stdlib: Object code (erl_lint) out of date >> *WARNING* stdlib: Object code (erl_parse) out of date >> *WARNING* stdlib: Object code (erl_posix_msg) out of date >> *WARNING* stdlib: Object code (erl_pp) out of date >> *WARNING* stdlib: Object code (erl_scan) out of date >> *WARNING* stdlib: Object code (erl_tar) out of date >> *WARNING* stdlib: Object code (error_logger_file_h) out of date >> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >> *WARNING* stdlib: Object code (escript) out of date >> *WARNING* stdlib: Object code (ets) out of date >> *WARNING* stdlib: Object code (file_sorter) out of date >> *WARNING* stdlib: Object code (filelib) out of date >> *WARNING* stdlib: Object code (filename) out of date >> *WARNING* stdlib: Object code (gb_trees) out of date >> *WARNING* stdlib: Object code (gb_sets) out of date >> *WARNING* stdlib: Object code (gen) out of date >> *WARNING* stdlib: Object code (gen_event) out of date >> *WARNING* stdlib: Object code (gen_fsm) out of date >> *WARNING* stdlib: Object code (gen_server) out of date >> *WARNING* stdlib: Object code (io) out of date >> *WARNING* stdlib: Object code (io_lib) out of date >> *WARNING* stdlib: Object code (io_lib_format) out of date >> *WARNING* stdlib: Object code (io_lib_fread) out of date >> *WARNING* stdlib: Object code (io_lib_pretty) out of date >> *WARNING* stdlib: Object code (lib) out of date >> *WARNING* stdlib: Object code (lists) out of date >> *WARNING* stdlib: Object code (log_mf_h) out of date >> *WARNING* stdlib: Object code (math) out of date >> *WARNING* stdlib: Object code (ms_transform) out of date >> *WARNING* stdlib: Object code (orddict) out of date >> *WARNING* stdlib: Object code (ordsets) out of date >> *WARNING* stdlib: Object code (otp_internal) out of date >> *WARNING* stdlib: Object code (pg) out of date >> *WARNING* stdlib: Object code (pool) out of date >> *WARNING* stdlib: Object code (proc_lib) out of date >> *WARNING* stdlib: Object code (proplists) out of date >> *WARNING* stdlib: Object code (qlc) out of date >> *WARNING* stdlib: Object code (qlc_pt) out of date >> *WARNING* stdlib: Object code (queue) out of date >> *WARNING* stdlib: Object code (random) out of date >> *WARNING* stdlib: Object code (regexp) out of date >> *WARNING* stdlib: Object code (sets) out of date >> *WARNING* stdlib: Object code (shell) out of date >> *WARNING* stdlib: Object code (shell_default) out of date >> *WARNING* stdlib: Object code (slave) out of date >> *WARNING* stdlib: Object code (sofs) out of date >> *WARNING* stdlib: Object code (string) out of date >> *WARNING* stdlib: Object code (supervisor) out of date >> *WARNING* stdlib: Object code (supervisor_bridge) out of date >> *WARNING* stdlib: Object code (sys) out of date >> *WARNING* stdlib: Object code (timer) out of date >> *WARNING* stdlib: Object code (win32reg) out of date >> *WARNING* stdlib: Object code (zip) out of date/ >> >> >> Thanks a lot! >> >> Matt >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From rvirding@REDACTED Mon Aug 18 13:57:08 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 18 Aug 2008 13:57:08 +0200 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <20080818094803.GA22078@contorpis.lisalinda.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> <20080818094803.GA22078@contorpis.lisalinda.com> Message-ID: <3dbc6d1c0808180457x32b646ccldbe3cfd0fe8d3b93@mail.gmail.com> 2008/8/18 Matthias Lang > > The second is to implement a lift controller. This problem is fairly > well known in the formal methods & SE world, e.g. > > > http://www.soi.wide.ad.jp/class/20060036/materials_for_student/10/14126.pdf > > http://se.uwaterloo.ca/~dberry/ATRE/ElevatorSRSs/SRS2/SRS2-Vahid-Karimi.pdf > > you can make it more complicated by having multiple lifts, inventing > scheduling strategies and by adding realism, for instance modelling > the subtleties of lifts that are in motion near stops---e.g. a lift > needs, say, 2 metres of advance warning to stop somewhere. Like the > POTS exercise, a graphical simulator makes it more fun. Even with > multiple lifts, it's not as "concurrent" as it first seems. In the old Erlang book there is a lift controller example, as well as the telephony example. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Mon Aug 18 14:00:10 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 18 Aug 2008 14:00:10 +0200 Subject: [erlang-questions] : Planet Erlang down (again?) In-Reply-To: <48A92B14.4070203@erlang-consulting.com> References: <20080815085133.GA29761@erix.ericsson.se> <48A92B14.4070203@erlang-consulting.com> Message-ID: <20080818120010.GA4276@erix.ericsson.se> On Mon, Aug 18, 2008 at 08:56:04AM +0100, Francesco Cesarini wrote: > Hi Raimo, > > You are confusing planet erlang with trapexit. Trapexit has > http://planet.trapexit.org which contains rss feed aggregation where > users can add their own feeds. > Thank you for setting me straight. > The problems on trapexit were solved a few months ago (They were a > result of increasing traffic and failing hard disks). The only glitch on > trapexit remaining is the connection with the mailing lists and the > forums, something Adam was looking at last week. Great! > > Francesco > -- > http://www.erlang-consulting.com > > Raimo Niskanen wrote: > > http://www.planeterlang.org gives: > > Parse error: parse error, unexpected $ in /opt/data/planeterlang.org/pligg/templates_c/c_842f806172a29c4ec5ea6ea8175c01bf.php on line 138 > > > > In May, Francesco Cesarini wrote: > > http://www.erlang.org/pipermail/erlang-questions/2008-May/034851.html > > > > Has it been up and is down again, or are they still working on it? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dawsdesign@REDACTED Mon Aug 18 14:02:24 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 08:02:24 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: <48A962CC.9040708@erlang-consulting.com> References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> Message-ID: No problem, I hope someone can help though :) I have two projects with the same problem and I have not seen make_tar run successfully to date. On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake wrote: > Sorry all... This is what happens when you read something and answer > quickly :( > > Completly ignore what I just wrote :P > > /Mazen > > Mazen Harake wrote: > >> Hi Mat, >> >> Answers inline... >> >> Matt Williamson wrote: >> >> >>> Hi there, >>> >>> I have an OTP app with the following simpledb.rel file: >>> >>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>> [{simpledb, "1.0"}, >>> {kernel, "2.11.5"}, >>> {stdlib, "1.14.5"}]}./ >>> >>> And the following simpledb.app file: >>> >>> /{application, simpledb, >>> [{description, "Stores Key, Value pairs."}, >>> {id, "simpledb"}, >>> {vsn, "1.0"}, >>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>> {mod, {simpledb_app, []}}, >>> / >>> >>> >> Why do you have an empty list here? mod specifies modules for application >> simpledb... and empty list ("") is not a valid module name :) >> >> >>> / {registered, [simpledb_svr]}, >>> >>> {applications, [kernel, stdlib]}]}./ >>> >>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get the >>> following error: >>> >>> /{{case_clause, >>> {'EXIT', >>> {function_clause, >>> [{filename,join,[[]]}, >>> {systools_make,add_appl,7}, >>> {systools_make,'-add_applications/5-fun-0-',6}, >>> {lists,foldl,3}, >>> {systools_make,add_applications,5}, >>> {systools_make,mk_tar,6}, >>> {systools_make,mk_tar,5}, >>> {systools_make,make_tar,2}]}}}, >>> [{systools_make,'-add_applications/5-fun-0-',6}, >>> {lists,foldl,3}, >>> {systools_make,add_applications,5}, >>> {systools_make,mk_tar,6}, >>> {systools_make,mk_tar,5}, >>> {systools_make,make_tar,2}, >>> {erl_eval,do_apply,5}, >>> {escript,code_handler,4}]}/ >>> >>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>> >>> Also if you know why I get the following junk, it would be forever >>> thankful: >>> >>> /*WARNING* kernel: Object code (application) out of date >>> *WARNING* kernel: Object code (application_controller) out of date >>> *WARNING* kernel: Object code (application_master) out of date >>> *WARNING* kernel: Object code (application_starter) out of date >>> *WARNING* kernel: Object code (auth) out of date >>> *WARNING* kernel: Object code (code) out of date >>> *WARNING* kernel: Object code (code_aux) out of date >>> *WARNING* kernel: Object code (packages) out of date >>> *WARNING* kernel: Object code (code_server) out of date >>> *WARNING* kernel: Object code (dist_util) out of date >>> *WARNING* kernel: Object code (erl_boot_server) out of date >>> *WARNING* kernel: Object code (erl_distribution) out of date >>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>> *WARNING* kernel: Object code (erl_reply) out of date >>> *WARNING* kernel: Object code (erlang) out of date >>> *WARNING* kernel: Object code (error_handler) out of date >>> *WARNING* kernel: Object code (error_logger) out of date >>> *WARNING* kernel: Object code (file) out of date >>> *WARNING* kernel: Object code (file_server) out of date >>> *WARNING* kernel: Object code (file_io_server) out of date >>> *WARNING* kernel: Object code (prim_file) out of date >>> *WARNING* kernel: Object code (global) out of date >>> *WARNING* kernel: Object code (global_group) out of date >>> *WARNING* kernel: Object code (global_search) out of date >>> *WARNING* kernel: Object code (group) out of date >>> *WARNING* kernel: Object code (heart) out of date >>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>> *WARNING* kernel: Object code (inet6_tcp) out of date >>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>> *WARNING* kernel: Object code (inet6_udp) out of date >>> *WARNING* kernel: Object code (inet_config) out of date >>> *WARNING* kernel: Object code (inet_hosts) out of date >>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>> *WARNING* kernel: Object code (init) out of date >>> *WARNING* kernel: Object code (kernel) out of date >>> *WARNING* kernel: Object code (kernel_config) out of date >>> *WARNING* kernel: Object code (net) out of date >>> *WARNING* kernel: Object code (net_adm) out of date >>> *WARNING* kernel: Object code (net_kernel) out of date >>> *WARNING* kernel: Object code (os) out of date >>> *WARNING* kernel: Object code (ram_file) out of date >>> *WARNING* kernel: Object code (rpc) out of date >>> *WARNING* kernel: Object code (user) out of date >>> *WARNING* kernel: Object code (user_drv) out of date >>> *WARNING* kernel: Object code (user_sup) out of date >>> *WARNING* kernel: Object code (disk_log) out of date >>> *WARNING* kernel: Object code (disk_log_1) out of date >>> *WARNING* kernel: Object code (disk_log_server) out of date >>> *WARNING* kernel: Object code (disk_log_sup) out of date >>> *WARNING* kernel: Object code (dist_ac) out of date >>> *WARNING* kernel: Object code (erl_ddll) out of date >>> *WARNING* kernel: Object code (erl_epmd) out of date >>> *WARNING* kernel: Object code (erts_debug) out of date >>> *WARNING* kernel: Object code (gen_tcp) out of date >>> *WARNING* kernel: Object code (gen_udp) out of date >>> *WARNING* kernel: Object code (gen_sctp) out of date >>> *WARNING* kernel: Object code (prim_inet) out of date >>> *WARNING* kernel: Object code (inet) out of date >>> *WARNING* kernel: Object code (inet_db) out of date >>> *WARNING* kernel: Object code (inet_dns) out of date >>> *WARNING* kernel: Object code (inet_parse) out of date >>> *WARNING* kernel: Object code (inet_res) out of date >>> *WARNING* kernel: Object code (inet_tcp) out of date >>> *WARNING* kernel: Object code (inet_udp) out of date >>> *WARNING* kernel: Object code (inet_sctp) out of date >>> *WARNING* kernel: Object code (pg2) out of date >>> *WARNING* kernel: Object code (seq_trace) out of date >>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>> *WARNING* kernel: Object code (zlib) out of date >>> *WARNING* kernel: Object code (otp_ring0) out of date >>> *WARNING* stdlib: Object code (base64) out of date >>> *WARNING* stdlib: Object code (beam_lib) out of date >>> *WARNING* stdlib: Object code (c) out of date >>> *WARNING* stdlib: Object code (calendar) out of date >>> *WARNING* stdlib: Object code (dets) out of date >>> *WARNING* stdlib: Object code (dets_server) out of date >>> *WARNING* stdlib: Object code (dets_sup) out of date >>> *WARNING* stdlib: Object code (dets_utils) out of date >>> *WARNING* stdlib: Object code (dets_v8) out of date >>> *WARNING* stdlib: Object code (dets_v9) out of date >>> *WARNING* stdlib: Object code (dict) out of date >>> *WARNING* stdlib: Object code (digraph) out of date >>> *WARNING* stdlib: Object code (digraph_utils) out of date >>> *WARNING* stdlib: Object code (edlin) out of date >>> *WARNING* stdlib: Object code (edlin_expand) out of date >>> *WARNING* stdlib: Object code (epp) out of date >>> *WARNING* stdlib: Object code (eval_bits) out of date >>> *WARNING* stdlib: Object code (erl_bits) out of date >>> *WARNING* stdlib: Object code (erl_compile) out of date >>> *WARNING* stdlib: Object code (erl_eval) out of date >>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>> *WARNING* stdlib: Object code (erl_internal) out of date >>> *WARNING* stdlib: Object code (erl_lint) out of date >>> *WARNING* stdlib: Object code (erl_parse) out of date >>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>> *WARNING* stdlib: Object code (erl_pp) out of date >>> *WARNING* stdlib: Object code (erl_scan) out of date >>> *WARNING* stdlib: Object code (erl_tar) out of date >>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>> *WARNING* stdlib: Object code (escript) out of date >>> *WARNING* stdlib: Object code (ets) out of date >>> *WARNING* stdlib: Object code (file_sorter) out of date >>> *WARNING* stdlib: Object code (filelib) out of date >>> *WARNING* stdlib: Object code (filename) out of date >>> *WARNING* stdlib: Object code (gb_trees) out of date >>> *WARNING* stdlib: Object code (gb_sets) out of date >>> *WARNING* stdlib: Object code (gen) out of date >>> *WARNING* stdlib: Object code (gen_event) out of date >>> *WARNING* stdlib: Object code (gen_fsm) out of date >>> *WARNING* stdlib: Object code (gen_server) out of date >>> *WARNING* stdlib: Object code (io) out of date >>> *WARNING* stdlib: Object code (io_lib) out of date >>> *WARNING* stdlib: Object code (io_lib_format) out of date >>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>> *WARNING* stdlib: Object code (lib) out of date >>> *WARNING* stdlib: Object code (lists) out of date >>> *WARNING* stdlib: Object code (log_mf_h) out of date >>> *WARNING* stdlib: Object code (math) out of date >>> *WARNING* stdlib: Object code (ms_transform) out of date >>> *WARNING* stdlib: Object code (orddict) out of date >>> *WARNING* stdlib: Object code (ordsets) out of date >>> *WARNING* stdlib: Object code (otp_internal) out of date >>> *WARNING* stdlib: Object code (pg) out of date >>> *WARNING* stdlib: Object code (pool) out of date >>> *WARNING* stdlib: Object code (proc_lib) out of date >>> *WARNING* stdlib: Object code (proplists) out of date >>> *WARNING* stdlib: Object code (qlc) out of date >>> *WARNING* stdlib: Object code (qlc_pt) out of date >>> *WARNING* stdlib: Object code (queue) out of date >>> *WARNING* stdlib: Object code (random) out of date >>> *WARNING* stdlib: Object code (regexp) out of date >>> *WARNING* stdlib: Object code (sets) out of date >>> *WARNING* stdlib: Object code (shell) out of date >>> *WARNING* stdlib: Object code (shell_default) out of date >>> *WARNING* stdlib: Object code (slave) out of date >>> *WARNING* stdlib: Object code (sofs) out of date >>> *WARNING* stdlib: Object code (string) out of date >>> *WARNING* stdlib: Object code (supervisor) out of date >>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>> *WARNING* stdlib: Object code (sys) out of date >>> *WARNING* stdlib: Object code (timer) out of date >>> *WARNING* stdlib: Object code (win32reg) out of date >>> *WARNING* stdlib: Object code (zip) out of date/ >>> >>> >>> Thanks a lot! >>> >>> Matt >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> >> >> > > > -- > Mazen Harake > Erlang Software Developer and Consultant, > Erlang Training & Consulting, Ltd > > Mobile Phone: +44 (0)795 13 26 317 > Office Phone: +44 (0)207 45 61 020 > Office Address: > 401 London Fruit & Wool Exchange > Brushfield St, London, E1 6EL > United Kingdom > > This email and its attachments may be confidential and are intended solely > for the use of the individual to whom it is addressed. Any views or opinions > expressed are solely those of the author and do not necessarily represent > those of "Erlang Training & Consulting, Ltd". > > If you are not the intended recipient of this email and its attachments, > you must take no action based upon them, nor must you copy or show them to > anyone. Please contact the sender if you believe you have received this > email in error. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Mon Aug 18 14:31:18 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 18 Aug 2008 08:31:18 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> Message-ID: <48A96B96.1090306@gmail.com> This is what you need to do: Suppose your app's directory tree is as follows: simpledb/ simpledb/ebin/simpledb.app simpledb/priv/simpledb.rel $ cd /path/to/your/simpledb $ erl -pa ./ebin 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, code:root_dir()}]). This will create ./priv/simpledb.tar.gz Regarding the WARNINGS - just ignore them. What they mean is that SASL is finding that the mentioned source files have been modified (i.e. their timestamps changed) after they were compiled into beams. Regards, Serge Matt Williamson wrote: > No problem, I hope someone can help though :) > > I have two projects with the same problem and I have not seen make_tar run > successfully to date. > > On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake > wrote: > >> Sorry all... This is what happens when you read something and answer >> quickly :( >> >> Completly ignore what I just wrote :P >> >> /Mazen >> >> Mazen Harake wrote: >> >>> Hi Mat, >>> >>> Answers inline... >>> >>> Matt Williamson wrote: >>> >>> >>>> Hi there, >>>> >>>> I have an OTP app with the following simpledb.rel file: >>>> >>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>> [{simpledb, "1.0"}, >>>> {kernel, "2.11.5"}, >>>> {stdlib, "1.14.5"}]}./ >>>> >>>> And the following simpledb.app file: >>>> >>>> /{application, simpledb, >>>> [{description, "Stores Key, Value pairs."}, >>>> {id, "simpledb"}, >>>> {vsn, "1.0"}, >>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>> {mod, {simpledb_app, []}}, >>>> / >>>> >>>> >>> Why do you have an empty list here? mod specifies modules for application >>> simpledb... and empty list ("") is not a valid module name :) >>> >>> >>>> / {registered, [simpledb_svr]}, >>>> >>>> {applications, [kernel, stdlib]}]}./ >>>> >>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get the >>>> following error: >>>> >>>> /{{case_clause, >>>> {'EXIT', >>>> {function_clause, >>>> [{filename,join,[[]]}, >>>> {systools_make,add_appl,7}, >>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>> {lists,foldl,3}, >>>> {systools_make,add_applications,5}, >>>> {systools_make,mk_tar,6}, >>>> {systools_make,mk_tar,5}, >>>> {systools_make,make_tar,2}]}}}, >>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>> {lists,foldl,3}, >>>> {systools_make,add_applications,5}, >>>> {systools_make,mk_tar,6}, >>>> {systools_make,mk_tar,5}, >>>> {systools_make,make_tar,2}, >>>> {erl_eval,do_apply,5}, >>>> {escript,code_handler,4}]}/ >>>> >>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>> >>>> Also if you know why I get the following junk, it would be forever >>>> thankful: >>>> >>>> /*WARNING* kernel: Object code (application) out of date >>>> *WARNING* kernel: Object code (application_controller) out of date >>>> *WARNING* kernel: Object code (application_master) out of date >>>> *WARNING* kernel: Object code (application_starter) out of date >>>> *WARNING* kernel: Object code (auth) out of date >>>> *WARNING* kernel: Object code (code) out of date >>>> *WARNING* kernel: Object code (code_aux) out of date >>>> *WARNING* kernel: Object code (packages) out of date >>>> *WARNING* kernel: Object code (code_server) out of date >>>> *WARNING* kernel: Object code (dist_util) out of date >>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>> *WARNING* kernel: Object code (erl_reply) out of date >>>> *WARNING* kernel: Object code (erlang) out of date >>>> *WARNING* kernel: Object code (error_handler) out of date >>>> *WARNING* kernel: Object code (error_logger) out of date >>>> *WARNING* kernel: Object code (file) out of date >>>> *WARNING* kernel: Object code (file_server) out of date >>>> *WARNING* kernel: Object code (file_io_server) out of date >>>> *WARNING* kernel: Object code (prim_file) out of date >>>> *WARNING* kernel: Object code (global) out of date >>>> *WARNING* kernel: Object code (global_group) out of date >>>> *WARNING* kernel: Object code (global_search) out of date >>>> *WARNING* kernel: Object code (group) out of date >>>> *WARNING* kernel: Object code (heart) out of date >>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>> *WARNING* kernel: Object code (inet_config) out of date >>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>> *WARNING* kernel: Object code (init) out of date >>>> *WARNING* kernel: Object code (kernel) out of date >>>> *WARNING* kernel: Object code (kernel_config) out of date >>>> *WARNING* kernel: Object code (net) out of date >>>> *WARNING* kernel: Object code (net_adm) out of date >>>> *WARNING* kernel: Object code (net_kernel) out of date >>>> *WARNING* kernel: Object code (os) out of date >>>> *WARNING* kernel: Object code (ram_file) out of date >>>> *WARNING* kernel: Object code (rpc) out of date >>>> *WARNING* kernel: Object code (user) out of date >>>> *WARNING* kernel: Object code (user_drv) out of date >>>> *WARNING* kernel: Object code (user_sup) out of date >>>> *WARNING* kernel: Object code (disk_log) out of date >>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>> *WARNING* kernel: Object code (dist_ac) out of date >>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>> *WARNING* kernel: Object code (erts_debug) out of date >>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>> *WARNING* kernel: Object code (gen_udp) out of date >>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>> *WARNING* kernel: Object code (prim_inet) out of date >>>> *WARNING* kernel: Object code (inet) out of date >>>> *WARNING* kernel: Object code (inet_db) out of date >>>> *WARNING* kernel: Object code (inet_dns) out of date >>>> *WARNING* kernel: Object code (inet_parse) out of date >>>> *WARNING* kernel: Object code (inet_res) out of date >>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>> *WARNING* kernel: Object code (inet_udp) out of date >>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>> *WARNING* kernel: Object code (pg2) out of date >>>> *WARNING* kernel: Object code (seq_trace) out of date >>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>> *WARNING* kernel: Object code (zlib) out of date >>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>> *WARNING* stdlib: Object code (base64) out of date >>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>> *WARNING* stdlib: Object code (c) out of date >>>> *WARNING* stdlib: Object code (calendar) out of date >>>> *WARNING* stdlib: Object code (dets) out of date >>>> *WARNING* stdlib: Object code (dets_server) out of date >>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>> *WARNING* stdlib: Object code (dict) out of date >>>> *WARNING* stdlib: Object code (digraph) out of date >>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>> *WARNING* stdlib: Object code (edlin) out of date >>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>> *WARNING* stdlib: Object code (epp) out of date >>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>> *WARNING* stdlib: Object code (escript) out of date >>>> *WARNING* stdlib: Object code (ets) out of date >>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>> *WARNING* stdlib: Object code (filelib) out of date >>>> *WARNING* stdlib: Object code (filename) out of date >>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>> *WARNING* stdlib: Object code (gen) out of date >>>> *WARNING* stdlib: Object code (gen_event) out of date >>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>> *WARNING* stdlib: Object code (gen_server) out of date >>>> *WARNING* stdlib: Object code (io) out of date >>>> *WARNING* stdlib: Object code (io_lib) out of date >>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>> *WARNING* stdlib: Object code (lib) out of date >>>> *WARNING* stdlib: Object code (lists) out of date >>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>> *WARNING* stdlib: Object code (math) out of date >>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>> *WARNING* stdlib: Object code (orddict) out of date >>>> *WARNING* stdlib: Object code (ordsets) out of date >>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>> *WARNING* stdlib: Object code (pg) out of date >>>> *WARNING* stdlib: Object code (pool) out of date >>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>> *WARNING* stdlib: Object code (proplists) out of date >>>> *WARNING* stdlib: Object code (qlc) out of date >>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>> *WARNING* stdlib: Object code (queue) out of date >>>> *WARNING* stdlib: Object code (random) out of date >>>> *WARNING* stdlib: Object code (regexp) out of date >>>> *WARNING* stdlib: Object code (sets) out of date >>>> *WARNING* stdlib: Object code (shell) out of date >>>> *WARNING* stdlib: Object code (shell_default) out of date >>>> *WARNING* stdlib: Object code (slave) out of date >>>> *WARNING* stdlib: Object code (sofs) out of date >>>> *WARNING* stdlib: Object code (string) out of date >>>> *WARNING* stdlib: Object code (supervisor) out of date >>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>> *WARNING* stdlib: Object code (sys) out of date >>>> *WARNING* stdlib: Object code (timer) out of date >>>> *WARNING* stdlib: Object code (win32reg) out of date >>>> *WARNING* stdlib: Object code (zip) out of date/ >>>> >>>> >>>> Thanks a lot! >>>> >>>> Matt >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >>> >>> >> >> -- >> Mazen Harake >> Erlang Software Developer and Consultant, >> Erlang Training & Consulting, Ltd >> >> Mobile Phone: +44 (0)795 13 26 317 >> Office Phone: +44 (0)207 45 61 020 >> Office Address: >> 401 London Fruit & Wool Exchange >> Brushfield St, London, E1 6EL >> United Kingdom >> >> This email and its attachments may be confidential and are intended solely >> for the use of the individual to whom it is addressed. Any views or opinions >> expressed are solely those of the author and do not necessarily represent >> those of "Erlang Training & Consulting, Ltd". >> >> If you are not the intended recipient of this email and its attachments, >> you must take no action based upon them, nor must you copy or show them to >> anyone. Please contact the sender if you believe you have received this >> email in error. >> >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jonas@REDACTED Mon Aug 18 14:07:18 2008 From: jonas@REDACTED (Jonas Boberg) Date: Mon, 18 Aug 2008 13:07:18 +0100 Subject: [erlang-questions] QuickCheck thesis presentation, 20 August, 18:30 Message-ID: <48A965F6.9070109@erlang-consulting.com> Hi, I will be presenting my thesis at the next Erlang London User Group Meeting on Wednesday, 20 August, at 18:30 This is also a sneak preview of the paper which has been accepted to the 2008 ACM SIGPLAN workshop in Victoria, Canada For more information: http://www.erlang-consulting.com/erlang/events.html Register for the event here: http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Quick%20Check%20Thesis%20Presentation Abstract: Current and future trends for software include increasingly complex requirements on interaction between systems. As a result, the difficulty of system testing increases. Model based testing is a test technique where test cases are generated from a model of the system. In this study we explore model-based testing on the system-level, starting from early development. We apply model-based testing to a sub-system of a message gateway product in order to improve early fault detection. The results are compared to another sub-system that is tested with hand-crafted test cases. Based on our experiences, we present a set of challenges and recommendations for system-level, model-based testing. Early results indicate that model-based testing, starting from early development, significantly increases the number of faults detected during system testing. Regards Jonas Boberg -- Jonas Boberg, jonas@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From dawsdesign@REDACTED Mon Aug 18 14:51:31 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 08:51:31 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: <48A96B96.1090306@gmail.com> References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> <48A96B96.1090306@gmail.com> Message-ID: Hi Serge, Thanks for the help. I made the changes, but I am still getting an error. Here is my directory structure: ~/simpledb /make.escript /ebin/simpledb.app /priv/simpldb.rel After applying the changes I get the following escript which I am using to compile. *#!/usr/bin/env escript %% -*- erlang -*- %% File: make.escript main(_Args) -> make:all(), systools:make_script("./priv/simpledb", [{path, ["ebin"]}, {outdir, "rel"}]), systools:make_tar("./priv/simpledb", [{path, ["ebin"]}, {erts, code:root_dir()}, {outdir, "rel"}, {dirs, [include, doc]}]).* The error I get is: *{{case_clause, {'EXIT', {function_clause, [{filename,join,[[]]}, {systools_make,add_appl,7}, {systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}]}}}, [{systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}, {erl_eval,do_apply,5}, {escript,code_handler,4}]}* make_script/1,2 still works great but make_tar is not. On Mon, Aug 18, 2008 at 8:31 AM, Serge Aleynikov wrote: > This is what you need to do: > > Suppose your app's directory tree is as follows: > simpledb/ > simpledb/ebin/simpledb.app > simpledb/priv/simpledb.rel > > $ cd /path/to/your/simpledb > $ erl -pa ./ebin > 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, > code:root_dir()}]). > > This will create ./priv/simpledb.tar.gz > > Regarding the WARNINGS - just ignore them. What they mean is that SASL is > finding that the mentioned source files have been modified (i.e. their > timestamps changed) after they were compiled into beams. > > Regards, > > Serge > > > Matt Williamson wrote: > >> No problem, I hope someone can help though :) >> >> I have two projects with the same problem and I have not seen make_tar run >> successfully to date. >> >> On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake >> wrote: >> >> Sorry all... This is what happens when you read something and answer >>> quickly :( >>> >>> Completly ignore what I just wrote :P >>> >>> /Mazen >>> >>> Mazen Harake wrote: >>> >>> Hi Mat, >>>> >>>> Answers inline... >>>> >>>> Matt Williamson wrote: >>>> >>>> >>>> Hi there, >>>>> >>>>> I have an OTP app with the following simpledb.rel file: >>>>> >>>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>>> [{simpledb, "1.0"}, >>>>> {kernel, "2.11.5"}, >>>>> {stdlib, "1.14.5"}]}./ >>>>> >>>>> And the following simpledb.app file: >>>>> >>>>> /{application, simpledb, >>>>> [{description, "Stores Key, Value pairs."}, >>>>> {id, "simpledb"}, >>>>> {vsn, "1.0"}, >>>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>>> {mod, {simpledb_app, []}}, >>>>> / >>>>> >>>>> >>>>> Why do you have an empty list here? mod specifies modules for >>>> application >>>> simpledb... and empty list ("") is not a valid module name :) >>>> >>>> >>>> / {registered, [simpledb_svr]}, >>>>> >>>>> {applications, [kernel, stdlib]}]}./ >>>>> >>>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >>>>> the >>>>> following error: >>>>> >>>>> /{{case_clause, >>>>> {'EXIT', >>>>> {function_clause, >>>>> [{filename,join,[[]]}, >>>>> {systools_make,add_appl,7}, >>>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>>> {lists,foldl,3}, >>>>> {systools_make,add_applications,5}, >>>>> {systools_make,mk_tar,6}, >>>>> {systools_make,mk_tar,5}, >>>>> {systools_make,make_tar,2}]}}}, >>>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>>> {lists,foldl,3}, >>>>> {systools_make,add_applications,5}, >>>>> {systools_make,mk_tar,6}, >>>>> {systools_make,mk_tar,5}, >>>>> {systools_make,make_tar,2}, >>>>> {erl_eval,do_apply,5}, >>>>> {escript,code_handler,4}]}/ >>>>> >>>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>>> >>>>> Also if you know why I get the following junk, it would be forever >>>>> thankful: >>>>> >>>>> /*WARNING* kernel: Object code (application) out of date >>>>> *WARNING* kernel: Object code (application_controller) out of date >>>>> *WARNING* kernel: Object code (application_master) out of date >>>>> *WARNING* kernel: Object code (application_starter) out of date >>>>> *WARNING* kernel: Object code (auth) out of date >>>>> *WARNING* kernel: Object code (code) out of date >>>>> *WARNING* kernel: Object code (code_aux) out of date >>>>> *WARNING* kernel: Object code (packages) out of date >>>>> *WARNING* kernel: Object code (code_server) out of date >>>>> *WARNING* kernel: Object code (dist_util) out of date >>>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>>> *WARNING* kernel: Object code (erl_reply) out of date >>>>> *WARNING* kernel: Object code (erlang) out of date >>>>> *WARNING* kernel: Object code (error_handler) out of date >>>>> *WARNING* kernel: Object code (error_logger) out of date >>>>> *WARNING* kernel: Object code (file) out of date >>>>> *WARNING* kernel: Object code (file_server) out of date >>>>> *WARNING* kernel: Object code (file_io_server) out of date >>>>> *WARNING* kernel: Object code (prim_file) out of date >>>>> *WARNING* kernel: Object code (global) out of date >>>>> *WARNING* kernel: Object code (global_group) out of date >>>>> *WARNING* kernel: Object code (global_search) out of date >>>>> *WARNING* kernel: Object code (group) out of date >>>>> *WARNING* kernel: Object code (heart) out of date >>>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>>> *WARNING* kernel: Object code (inet_config) out of date >>>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>>> *WARNING* kernel: Object code (init) out of date >>>>> *WARNING* kernel: Object code (kernel) out of date >>>>> *WARNING* kernel: Object code (kernel_config) out of date >>>>> *WARNING* kernel: Object code (net) out of date >>>>> *WARNING* kernel: Object code (net_adm) out of date >>>>> *WARNING* kernel: Object code (net_kernel) out of date >>>>> *WARNING* kernel: Object code (os) out of date >>>>> *WARNING* kernel: Object code (ram_file) out of date >>>>> *WARNING* kernel: Object code (rpc) out of date >>>>> *WARNING* kernel: Object code (user) out of date >>>>> *WARNING* kernel: Object code (user_drv) out of date >>>>> *WARNING* kernel: Object code (user_sup) out of date >>>>> *WARNING* kernel: Object code (disk_log) out of date >>>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>>> *WARNING* kernel: Object code (dist_ac) out of date >>>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>>> *WARNING* kernel: Object code (erts_debug) out of date >>>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>>> *WARNING* kernel: Object code (gen_udp) out of date >>>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>>> *WARNING* kernel: Object code (prim_inet) out of date >>>>> *WARNING* kernel: Object code (inet) out of date >>>>> *WARNING* kernel: Object code (inet_db) out of date >>>>> *WARNING* kernel: Object code (inet_dns) out of date >>>>> *WARNING* kernel: Object code (inet_parse) out of date >>>>> *WARNING* kernel: Object code (inet_res) out of date >>>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>>> *WARNING* kernel: Object code (inet_udp) out of date >>>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>>> *WARNING* kernel: Object code (pg2) out of date >>>>> *WARNING* kernel: Object code (seq_trace) out of date >>>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>>> *WARNING* kernel: Object code (zlib) out of date >>>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>>> *WARNING* stdlib: Object code (base64) out of date >>>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>>> *WARNING* stdlib: Object code (c) out of date >>>>> *WARNING* stdlib: Object code (calendar) out of date >>>>> *WARNING* stdlib: Object code (dets) out of date >>>>> *WARNING* stdlib: Object code (dets_server) out of date >>>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>>> *WARNING* stdlib: Object code (dict) out of date >>>>> *WARNING* stdlib: Object code (digraph) out of date >>>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>>> *WARNING* stdlib: Object code (edlin) out of date >>>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>>> *WARNING* stdlib: Object code (epp) out of date >>>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>>> *WARNING* stdlib: Object code (escript) out of date >>>>> *WARNING* stdlib: Object code (ets) out of date >>>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>>> *WARNING* stdlib: Object code (filelib) out of date >>>>> *WARNING* stdlib: Object code (filename) out of date >>>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>>> *WARNING* stdlib: Object code (gen) out of date >>>>> *WARNING* stdlib: Object code (gen_event) out of date >>>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>>> *WARNING* stdlib: Object code (gen_server) out of date >>>>> *WARNING* stdlib: Object code (io) out of date >>>>> *WARNING* stdlib: Object code (io_lib) out of date >>>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>>> *WARNING* stdlib: Object code (lib) out of date >>>>> *WARNING* stdlib: Object code (lists) out of date >>>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>>> *WARNING* stdlib: Object code (math) out of date >>>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>>> *WARNING* stdlib: Object code (orddict) out of date >>>>> *WARNING* stdlib: Object code (ordsets) out of date >>>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>>> *WARNING* stdlib: Object code (pg) out of date >>>>> *WARNING* stdlib: Object code (pool) out of date >>>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>>> *WARNING* stdlib: Object code (proplists) out of date >>>>> *WARNING* stdlib: Object code (qlc) out of date >>>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>>> *WARNING* stdlib: Object code (queue) out of date >>>>> *WARNING* stdlib: Object code (random) out of date >>>>> *WARNING* stdlib: Object code (regexp) out of date >>>>> *WARNING* stdlib: Object code (sets) out of date >>>>> *WARNING* stdlib: Object code (shell) out of date >>>>> *WARNING* stdlib: Object code (shell_default) out of date >>>>> *WARNING* stdlib: Object code (slave) out of date >>>>> *WARNING* stdlib: Object code (sofs) out of date >>>>> *WARNING* stdlib: Object code (string) out of date >>>>> *WARNING* stdlib: Object code (supervisor) out of date >>>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>>> *WARNING* stdlib: Object code (sys) out of date >>>>> *WARNING* stdlib: Object code (timer) out of date >>>>> *WARNING* stdlib: Object code (win32reg) out of date >>>>> *WARNING* stdlib: Object code (zip) out of date/ >>>>> >>>>> >>>>> Thanks a lot! >>>>> >>>>> Matt >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> -- >>> Mazen Harake >>> Erlang Software Developer and Consultant, >>> Erlang Training & Consulting, Ltd >>> >>> Mobile Phone: +44 (0)795 13 26 317 >>> Office Phone: +44 (0)207 45 61 020 >>> Office Address: >>> 401 London Fruit & Wool Exchange >>> Brushfield St, London, E1 6EL >>> United Kingdom >>> >>> This email and its attachments may be confidential and are intended >>> solely >>> for the use of the individual to whom it is addressed. Any views or >>> opinions >>> expressed are solely those of the author and do not necessarily represent >>> those of "Erlang Training & Consulting, Ltd". >>> >>> If you are not the intended recipient of this email and its attachments, >>> you must take no action based upon them, nor must you copy or show them >>> to >>> anyone. Please contact the sender if you believe you have received this >>> email in error. >>> >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Mon Aug 18 14:59:18 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 18 Aug 2008 14:59:18 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com> <2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz> Message-ID: <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> 2008/8/18 Richard A. O'Keefe > > On 16 Aug 2008, at 8:35 am, Kevin Scaldeferri wrote: > > There is a tradeoff. > When your compiler does good stuff like constant propagation, > inlining, loop unrolling, loop fusion, &c, it gets hard to make > 'the line number' mean anything. For example, suppose we had > > Ns = [sum(L) || L <- Ls], > Ds = [length(L) || L <- Ls], > Aves = [N/D || {N,D} <- lists:zip(Ns, Ds)] > > This is the kind of thing the GHC compiler eats for lunch; > assuming Ns and Ds are not used anywhere else it turns into > the equivalent of > > Aves = [sum(L)/length(L) || L <- Ls] > > Which line does this correspond to? ALL of them. > (Actually, I believe GHC will take this a stage further, and inline > and fuse the sum and length loops as well. In which case we have > code within a single "line" coming from several files.) > > The Erlang compiler isn't that smart. (Yet. A man can dream.) One problem Erlang would have doing this type of optimisation, which would be wonderful to have, is the handling of side effects and errors. That type of aggressive inlining and fusing would change the order in which side effects occur which means that the code would not be equivalent. Similar for errors. Haskell, being side-effect free, does not have this problem. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Mon Aug 18 15:07:13 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 18 Aug 2008 09:07:13 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> <48A96B96.1090306@gmail.com> Message-ID: <48A97401.9040107@gmail.com> Can you try running it without escript (just like I showed in my last email)? Probably the problem is that systools is having hard time finding simpledb.app or it's modules because "-pa ./ebin" option is missing. Matt Williamson wrote: > Hi Serge, > > Thanks for the help. I made the changes, but I am still getting an error. > > Here is my directory structure: > ~/simpledb > /make.escript > /ebin/simpledb.app > /priv/simpldb.rel > > After applying the changes I get the following escript which I am using to > compile. > > *#!/usr/bin/env escript > %% -*- erlang -*- > %% File: make.escript > > main(_Args) -> > make:all(), > systools:make_script("./priv/simpledb", [{path, ["ebin"]}, > {outdir, "rel"}]), > systools:make_tar("./priv/simpledb", [{path, ["ebin"]}, > {erts, code:root_dir()}, > {outdir, "rel"}, > {dirs, [include, doc]}]).* > > > The error I get is: > *{{case_clause, > {'EXIT', > {function_clause, > [{filename,join,[[]]}, > {systools_make,add_appl,7}, > {systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}]}}}, > [{systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}, > {erl_eval,do_apply,5}, > {escript,code_handler,4}]}* > > make_script/1,2 still works great but make_tar is not. > > On Mon, Aug 18, 2008 at 8:31 AM, Serge Aleynikov wrote: > >> This is what you need to do: >> >> Suppose your app's directory tree is as follows: >> simpledb/ >> simpledb/ebin/simpledb.app >> simpledb/priv/simpledb.rel >> >> $ cd /path/to/your/simpledb >> $ erl -pa ./ebin >> 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, >> code:root_dir()}]). >> >> This will create ./priv/simpledb.tar.gz >> >> Regarding the WARNINGS - just ignore them. What they mean is that SASL is >> finding that the mentioned source files have been modified (i.e. their >> timestamps changed) after they were compiled into beams. >> >> Regards, >> >> Serge >> >> >> Matt Williamson wrote: >> >>> No problem, I hope someone can help though :) >>> >>> I have two projects with the same problem and I have not seen make_tar run >>> successfully to date. >>> >>> On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake >>> wrote: >>> >>> Sorry all... This is what happens when you read something and answer >>>> quickly :( >>>> >>>> Completly ignore what I just wrote :P >>>> >>>> /Mazen >>>> >>>> Mazen Harake wrote: >>>> >>>> Hi Mat, >>>>> Answers inline... >>>>> >>>>> Matt Williamson wrote: >>>>> >>>>> >>>>> Hi there, >>>>>> I have an OTP app with the following simpledb.rel file: >>>>>> >>>>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>>>> [{simpledb, "1.0"}, >>>>>> {kernel, "2.11.5"}, >>>>>> {stdlib, "1.14.5"}]}./ >>>>>> >>>>>> And the following simpledb.app file: >>>>>> >>>>>> /{application, simpledb, >>>>>> [{description, "Stores Key, Value pairs."}, >>>>>> {id, "simpledb"}, >>>>>> {vsn, "1.0"}, >>>>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>>>> {mod, {simpledb_app, []}}, >>>>>> / >>>>>> >>>>>> >>>>>> Why do you have an empty list here? mod specifies modules for >>>>> application >>>>> simpledb... and empty list ("") is not a valid module name :) >>>>> >>>>> >>>>> / {registered, [simpledb_svr]}, >>>>>> {applications, [kernel, stdlib]}]}./ >>>>>> >>>>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >>>>>> the >>>>>> following error: >>>>>> >>>>>> /{{case_clause, >>>>>> {'EXIT', >>>>>> {function_clause, >>>>>> [{filename,join,[[]]}, >>>>>> {systools_make,add_appl,7}, >>>>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>>>> {lists,foldl,3}, >>>>>> {systools_make,add_applications,5}, >>>>>> {systools_make,mk_tar,6}, >>>>>> {systools_make,mk_tar,5}, >>>>>> {systools_make,make_tar,2}]}}}, >>>>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>>>> {lists,foldl,3}, >>>>>> {systools_make,add_applications,5}, >>>>>> {systools_make,mk_tar,6}, >>>>>> {systools_make,mk_tar,5}, >>>>>> {systools_make,make_tar,2}, >>>>>> {erl_eval,do_apply,5}, >>>>>> {escript,code_handler,4}]}/ >>>>>> >>>>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>>>> >>>>>> Also if you know why I get the following junk, it would be forever >>>>>> thankful: >>>>>> >>>>>> /*WARNING* kernel: Object code (application) out of date >>>>>> *WARNING* kernel: Object code (application_controller) out of date >>>>>> *WARNING* kernel: Object code (application_master) out of date >>>>>> *WARNING* kernel: Object code (application_starter) out of date >>>>>> *WARNING* kernel: Object code (auth) out of date >>>>>> *WARNING* kernel: Object code (code) out of date >>>>>> *WARNING* kernel: Object code (code_aux) out of date >>>>>> *WARNING* kernel: Object code (packages) out of date >>>>>> *WARNING* kernel: Object code (code_server) out of date >>>>>> *WARNING* kernel: Object code (dist_util) out of date >>>>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>>>> *WARNING* kernel: Object code (erl_reply) out of date >>>>>> *WARNING* kernel: Object code (erlang) out of date >>>>>> *WARNING* kernel: Object code (error_handler) out of date >>>>>> *WARNING* kernel: Object code (error_logger) out of date >>>>>> *WARNING* kernel: Object code (file) out of date >>>>>> *WARNING* kernel: Object code (file_server) out of date >>>>>> *WARNING* kernel: Object code (file_io_server) out of date >>>>>> *WARNING* kernel: Object code (prim_file) out of date >>>>>> *WARNING* kernel: Object code (global) out of date >>>>>> *WARNING* kernel: Object code (global_group) out of date >>>>>> *WARNING* kernel: Object code (global_search) out of date >>>>>> *WARNING* kernel: Object code (group) out of date >>>>>> *WARNING* kernel: Object code (heart) out of date >>>>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>>>> *WARNING* kernel: Object code (inet_config) out of date >>>>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>>>> *WARNING* kernel: Object code (init) out of date >>>>>> *WARNING* kernel: Object code (kernel) out of date >>>>>> *WARNING* kernel: Object code (kernel_config) out of date >>>>>> *WARNING* kernel: Object code (net) out of date >>>>>> *WARNING* kernel: Object code (net_adm) out of date >>>>>> *WARNING* kernel: Object code (net_kernel) out of date >>>>>> *WARNING* kernel: Object code (os) out of date >>>>>> *WARNING* kernel: Object code (ram_file) out of date >>>>>> *WARNING* kernel: Object code (rpc) out of date >>>>>> *WARNING* kernel: Object code (user) out of date >>>>>> *WARNING* kernel: Object code (user_drv) out of date >>>>>> *WARNING* kernel: Object code (user_sup) out of date >>>>>> *WARNING* kernel: Object code (disk_log) out of date >>>>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>>>> *WARNING* kernel: Object code (dist_ac) out of date >>>>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>>>> *WARNING* kernel: Object code (erts_debug) out of date >>>>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>>>> *WARNING* kernel: Object code (gen_udp) out of date >>>>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>>>> *WARNING* kernel: Object code (prim_inet) out of date >>>>>> *WARNING* kernel: Object code (inet) out of date >>>>>> *WARNING* kernel: Object code (inet_db) out of date >>>>>> *WARNING* kernel: Object code (inet_dns) out of date >>>>>> *WARNING* kernel: Object code (inet_parse) out of date >>>>>> *WARNING* kernel: Object code (inet_res) out of date >>>>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>>>> *WARNING* kernel: Object code (inet_udp) out of date >>>>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>>>> *WARNING* kernel: Object code (pg2) out of date >>>>>> *WARNING* kernel: Object code (seq_trace) out of date >>>>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>>>> *WARNING* kernel: Object code (zlib) out of date >>>>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>>>> *WARNING* stdlib: Object code (base64) out of date >>>>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>>>> *WARNING* stdlib: Object code (c) out of date >>>>>> *WARNING* stdlib: Object code (calendar) out of date >>>>>> *WARNING* stdlib: Object code (dets) out of date >>>>>> *WARNING* stdlib: Object code (dets_server) out of date >>>>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>>>> *WARNING* stdlib: Object code (dict) out of date >>>>>> *WARNING* stdlib: Object code (digraph) out of date >>>>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>>>> *WARNING* stdlib: Object code (edlin) out of date >>>>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>>>> *WARNING* stdlib: Object code (epp) out of date >>>>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>>>> *WARNING* stdlib: Object code (escript) out of date >>>>>> *WARNING* stdlib: Object code (ets) out of date >>>>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>>>> *WARNING* stdlib: Object code (filelib) out of date >>>>>> *WARNING* stdlib: Object code (filename) out of date >>>>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>>>> *WARNING* stdlib: Object code (gen) out of date >>>>>> *WARNING* stdlib: Object code (gen_event) out of date >>>>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>>>> *WARNING* stdlib: Object code (gen_server) out of date >>>>>> *WARNING* stdlib: Object code (io) out of date >>>>>> *WARNING* stdlib: Object code (io_lib) out of date >>>>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>>>> *WARNING* stdlib: Object code (lib) out of date >>>>>> *WARNING* stdlib: Object code (lists) out of date >>>>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>>>> *WARNING* stdlib: Object code (math) out of date >>>>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>>>> *WARNING* stdlib: Object code (orddict) out of date >>>>>> *WARNING* stdlib: Object code (ordsets) out of date >>>>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>>>> *WARNING* stdlib: Object code (pg) out of date >>>>>> *WARNING* stdlib: Object code (pool) out of date >>>>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>>>> *WARNING* stdlib: Object code (proplists) out of date >>>>>> *WARNING* stdlib: Object code (qlc) out of date >>>>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>>>> *WARNING* stdlib: Object code (queue) out of date >>>>>> *WARNING* stdlib: Object code (random) out of date >>>>>> *WARNING* stdlib: Object code (regexp) out of date >>>>>> *WARNING* stdlib: Object code (sets) out of date >>>>>> *WARNING* stdlib: Object code (shell) out of date >>>>>> *WARNING* stdlib: Object code (shell_default) out of date >>>>>> *WARNING* stdlib: Object code (slave) out of date >>>>>> *WARNING* stdlib: Object code (sofs) out of date >>>>>> *WARNING* stdlib: Object code (string) out of date >>>>>> *WARNING* stdlib: Object code (supervisor) out of date >>>>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>>>> *WARNING* stdlib: Object code (sys) out of date >>>>>> *WARNING* stdlib: Object code (timer) out of date >>>>>> *WARNING* stdlib: Object code (win32reg) out of date >>>>>> *WARNING* stdlib: Object code (zip) out of date/ >>>>>> >>>>>> >>>>>> Thanks a lot! >>>>>> >>>>>> Matt >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> -- >>>> Mazen Harake >>>> Erlang Software Developer and Consultant, >>>> Erlang Training & Consulting, Ltd >>>> >>>> Mobile Phone: +44 (0)795 13 26 317 >>>> Office Phone: +44 (0)207 45 61 020 >>>> Office Address: >>>> 401 London Fruit & Wool Exchange >>>> Brushfield St, London, E1 6EL >>>> United Kingdom >>>> >>>> This email and its attachments may be confidential and are intended >>>> solely >>>> for the use of the individual to whom it is addressed. Any views or >>>> opinions >>>> expressed are solely those of the author and do not necessarily represent >>>> those of "Erlang Training & Consulting, Ltd". >>>> >>>> If you are not the intended recipient of this email and its attachments, >>>> you must take no action based upon them, nor must you copy or show them >>>> to >>>> anyone. Please contact the sender if you believe you have received this >>>> email in error. >>>> >>>> >>>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > From dawsdesign@REDACTED Mon Aug 18 15:27:53 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 09:27:53 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: <48A97401.9040107@gmail.com> References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> <48A96B96.1090306@gmail.com> <48A97401.9040107@gmail.com> Message-ID: It worked! What I find weird is that if I run `erl -pa ebin` it gets the same error, but if I run `erl -pa ./ebin` it works. Thank you very much Serge! On Mon, Aug 18, 2008 at 9:07 AM, Serge Aleynikov wrote: > Can you try running it without escript (just like I showed in my last > email)? Probably the problem is that systools is having hard time finding > simpledb.app or it's modules because "-pa ./ebin" option is missing. > > > Matt Williamson wrote: > >> Hi Serge, >> >> Thanks for the help. I made the changes, but I am still getting an error. >> >> Here is my directory structure: >> ~/simpledb >> /make.escript >> /ebin/simpledb.app >> /priv/simpldb.rel >> >> After applying the changes I get the following escript which I am using to >> compile. >> >> *#!/usr/bin/env escript >> %% -*- erlang -*- >> %% File: make.escript >> >> main(_Args) -> >> make:all(), >> systools:make_script("./priv/simpledb", [{path, ["ebin"]}, >> {outdir, "rel"}]), >> systools:make_tar("./priv/simpledb", [{path, ["ebin"]}, >> {erts, code:root_dir()}, >> {outdir, "rel"}, >> {dirs, [include, doc]}]).* >> >> >> The error I get is: >> *{{case_clause, >> {'EXIT', >> {function_clause, >> [{filename,join,[[]]}, >> {systools_make,add_appl,7}, >> {systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}]}}}, >> [{systools_make,'-add_applications/5-fun-0-',6}, >> {lists,foldl,3}, >> {systools_make,add_applications,5}, >> {systools_make,mk_tar,6}, >> {systools_make,mk_tar,5}, >> {systools_make,make_tar,2}, >> {erl_eval,do_apply,5}, >> {escript,code_handler,4}]}* >> >> make_script/1,2 still works great but make_tar is not. >> >> On Mon, Aug 18, 2008 at 8:31 AM, Serge Aleynikov >> wrote: >> >> This is what you need to do: >>> >>> Suppose your app's directory tree is as follows: >>> simpledb/ >>> simpledb/ebin/simpledb.app >>> simpledb/priv/simpledb.rel >>> >>> $ cd /path/to/your/simpledb >>> $ erl -pa ./ebin >>> 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, >>> code:root_dir()}]). >>> >>> This will create ./priv/simpledb.tar.gz >>> >>> Regarding the WARNINGS - just ignore them. What they mean is that SASL >>> is >>> finding that the mentioned source files have been modified (i.e. their >>> timestamps changed) after they were compiled into beams. >>> >>> Regards, >>> >>> Serge >>> >>> >>> Matt Williamson wrote: >>> >>> No problem, I hope someone can help though :) >>>> >>>> I have two projects with the same problem and I have not seen make_tar >>>> run >>>> successfully to date. >>>> >>>> On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake >>>> wrote: >>>> >>>> Sorry all... This is what happens when you read something and answer >>>> >>>>> quickly :( >>>>> >>>>> Completly ignore what I just wrote :P >>>>> >>>>> /Mazen >>>>> >>>>> Mazen Harake wrote: >>>>> >>>>> Hi Mat, >>>>> >>>>>> Answers inline... >>>>>> >>>>>> Matt Williamson wrote: >>>>>> >>>>>> >>>>>> Hi there, >>>>>> >>>>>>> I have an OTP app with the following simpledb.rel file: >>>>>>> >>>>>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>>>>> [{simpledb, "1.0"}, >>>>>>> {kernel, "2.11.5"}, >>>>>>> {stdlib, "1.14.5"}]}./ >>>>>>> >>>>>>> And the following simpledb.app file: >>>>>>> >>>>>>> /{application, simpledb, >>>>>>> [{description, "Stores Key, Value pairs."}, >>>>>>> {id, "simpledb"}, >>>>>>> {vsn, "1.0"}, >>>>>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>>>>> {mod, {simpledb_app, []}}, >>>>>>> / >>>>>>> >>>>>>> >>>>>>> Why do you have an empty list here? mod specifies modules for >>>>>>> >>>>>> application >>>>>> simpledb... and empty list ("") is not a valid module name :) >>>>>> >>>>>> >>>>>> / {registered, [simpledb_svr]}, >>>>>> >>>>>>> {applications, [kernel, stdlib]}]}./ >>>>>>> >>>>>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >>>>>>> the >>>>>>> following error: >>>>>>> >>>>>>> /{{case_clause, >>>>>>> {'EXIT', >>>>>>> {function_clause, >>>>>>> [{filename,join,[[]]}, >>>>>>> {systools_make,add_appl,7}, >>>>>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>>>>> {lists,foldl,3}, >>>>>>> {systools_make,add_applications,5}, >>>>>>> {systools_make,mk_tar,6}, >>>>>>> {systools_make,mk_tar,5}, >>>>>>> {systools_make,make_tar,2}]}}}, >>>>>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>>>>> {lists,foldl,3}, >>>>>>> {systools_make,add_applications,5}, >>>>>>> {systools_make,mk_tar,6}, >>>>>>> {systools_make,mk_tar,5}, >>>>>>> {systools_make,make_tar,2}, >>>>>>> {erl_eval,do_apply,5}, >>>>>>> {escript,code_handler,4}]}/ >>>>>>> >>>>>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>>>>> >>>>>>> Also if you know why I get the following junk, it would be forever >>>>>>> thankful: >>>>>>> >>>>>>> /*WARNING* kernel: Object code (application) out of date >>>>>>> *WARNING* kernel: Object code (application_controller) out of date >>>>>>> *WARNING* kernel: Object code (application_master) out of date >>>>>>> *WARNING* kernel: Object code (application_starter) out of date >>>>>>> *WARNING* kernel: Object code (auth) out of date >>>>>>> *WARNING* kernel: Object code (code) out of date >>>>>>> *WARNING* kernel: Object code (code_aux) out of date >>>>>>> *WARNING* kernel: Object code (packages) out of date >>>>>>> *WARNING* kernel: Object code (code_server) out of date >>>>>>> *WARNING* kernel: Object code (dist_util) out of date >>>>>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>>>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>>>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>>>>> *WARNING* kernel: Object code (erl_reply) out of date >>>>>>> *WARNING* kernel: Object code (erlang) out of date >>>>>>> *WARNING* kernel: Object code (error_handler) out of date >>>>>>> *WARNING* kernel: Object code (error_logger) out of date >>>>>>> *WARNING* kernel: Object code (file) out of date >>>>>>> *WARNING* kernel: Object code (file_server) out of date >>>>>>> *WARNING* kernel: Object code (file_io_server) out of date >>>>>>> *WARNING* kernel: Object code (prim_file) out of date >>>>>>> *WARNING* kernel: Object code (global) out of date >>>>>>> *WARNING* kernel: Object code (global_group) out of date >>>>>>> *WARNING* kernel: Object code (global_search) out of date >>>>>>> *WARNING* kernel: Object code (group) out of date >>>>>>> *WARNING* kernel: Object code (heart) out of date >>>>>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>>>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>>>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>>>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>>>>> *WARNING* kernel: Object code (inet_config) out of date >>>>>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>>>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>>>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>>>>> *WARNING* kernel: Object code (init) out of date >>>>>>> *WARNING* kernel: Object code (kernel) out of date >>>>>>> *WARNING* kernel: Object code (kernel_config) out of date >>>>>>> *WARNING* kernel: Object code (net) out of date >>>>>>> *WARNING* kernel: Object code (net_adm) out of date >>>>>>> *WARNING* kernel: Object code (net_kernel) out of date >>>>>>> *WARNING* kernel: Object code (os) out of date >>>>>>> *WARNING* kernel: Object code (ram_file) out of date >>>>>>> *WARNING* kernel: Object code (rpc) out of date >>>>>>> *WARNING* kernel: Object code (user) out of date >>>>>>> *WARNING* kernel: Object code (user_drv) out of date >>>>>>> *WARNING* kernel: Object code (user_sup) out of date >>>>>>> *WARNING* kernel: Object code (disk_log) out of date >>>>>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>>>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>>>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>>>>> *WARNING* kernel: Object code (dist_ac) out of date >>>>>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>>>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>>>>> *WARNING* kernel: Object code (erts_debug) out of date >>>>>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>>>>> *WARNING* kernel: Object code (gen_udp) out of date >>>>>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>>>>> *WARNING* kernel: Object code (prim_inet) out of date >>>>>>> *WARNING* kernel: Object code (inet) out of date >>>>>>> *WARNING* kernel: Object code (inet_db) out of date >>>>>>> *WARNING* kernel: Object code (inet_dns) out of date >>>>>>> *WARNING* kernel: Object code (inet_parse) out of date >>>>>>> *WARNING* kernel: Object code (inet_res) out of date >>>>>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>>>>> *WARNING* kernel: Object code (inet_udp) out of date >>>>>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>>>>> *WARNING* kernel: Object code (pg2) out of date >>>>>>> *WARNING* kernel: Object code (seq_trace) out of date >>>>>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>>>>> *WARNING* kernel: Object code (zlib) out of date >>>>>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>>>>> *WARNING* stdlib: Object code (base64) out of date >>>>>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>>>>> *WARNING* stdlib: Object code (c) out of date >>>>>>> *WARNING* stdlib: Object code (calendar) out of date >>>>>>> *WARNING* stdlib: Object code (dets) out of date >>>>>>> *WARNING* stdlib: Object code (dets_server) out of date >>>>>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>>>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>>>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>>>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>>>>> *WARNING* stdlib: Object code (dict) out of date >>>>>>> *WARNING* stdlib: Object code (digraph) out of date >>>>>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>>>>> *WARNING* stdlib: Object code (edlin) out of date >>>>>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>>>>> *WARNING* stdlib: Object code (epp) out of date >>>>>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>>>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>>>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>>>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>>>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>>>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>>>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>>>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>>>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>>>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>>>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>>>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>>>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>>>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>>>>> *WARNING* stdlib: Object code (escript) out of date >>>>>>> *WARNING* stdlib: Object code (ets) out of date >>>>>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>>>>> *WARNING* stdlib: Object code (filelib) out of date >>>>>>> *WARNING* stdlib: Object code (filename) out of date >>>>>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>>>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>>>>> *WARNING* stdlib: Object code (gen) out of date >>>>>>> *WARNING* stdlib: Object code (gen_event) out of date >>>>>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>>>>> *WARNING* stdlib: Object code (gen_server) out of date >>>>>>> *WARNING* stdlib: Object code (io) out of date >>>>>>> *WARNING* stdlib: Object code (io_lib) out of date >>>>>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>>>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>>>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>>>>> *WARNING* stdlib: Object code (lib) out of date >>>>>>> *WARNING* stdlib: Object code (lists) out of date >>>>>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>>>>> *WARNING* stdlib: Object code (math) out of date >>>>>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>>>>> *WARNING* stdlib: Object code (orddict) out of date >>>>>>> *WARNING* stdlib: Object code (ordsets) out of date >>>>>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>>>>> *WARNING* stdlib: Object code (pg) out of date >>>>>>> *WARNING* stdlib: Object code (pool) out of date >>>>>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>>>>> *WARNING* stdlib: Object code (proplists) out of date >>>>>>> *WARNING* stdlib: Object code (qlc) out of date >>>>>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>>>>> *WARNING* stdlib: Object code (queue) out of date >>>>>>> *WARNING* stdlib: Object code (random) out of date >>>>>>> *WARNING* stdlib: Object code (regexp) out of date >>>>>>> *WARNING* stdlib: Object code (sets) out of date >>>>>>> *WARNING* stdlib: Object code (shell) out of date >>>>>>> *WARNING* stdlib: Object code (shell_default) out of date >>>>>>> *WARNING* stdlib: Object code (slave) out of date >>>>>>> *WARNING* stdlib: Object code (sofs) out of date >>>>>>> *WARNING* stdlib: Object code (string) out of date >>>>>>> *WARNING* stdlib: Object code (supervisor) out of date >>>>>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>>>>> *WARNING* stdlib: Object code (sys) out of date >>>>>>> *WARNING* stdlib: Object code (timer) out of date >>>>>>> *WARNING* stdlib: Object code (win32reg) out of date >>>>>>> *WARNING* stdlib: Object code (zip) out of date/ >>>>>>> >>>>>>> >>>>>>> Thanks a lot! >>>>>>> >>>>>>> Matt >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> _______________________________________________ >>>>>>> erlang-questions mailing list >>>>>>> erlang-questions@REDACTED >>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>> Mazen Harake >>>>> Erlang Software Developer and Consultant, >>>>> Erlang Training & Consulting, Ltd >>>>> >>>>> Mobile Phone: +44 (0)795 13 26 317 >>>>> Office Phone: +44 (0)207 45 61 020 >>>>> Office Address: >>>>> 401 London Fruit & Wool Exchange >>>>> Brushfield St, London, E1 6EL >>>>> United Kingdom >>>>> >>>>> This email and its attachments may be confidential and are intended >>>>> solely >>>>> for the use of the individual to whom it is addressed. Any views or >>>>> opinions >>>>> expressed are solely those of the author and do not necessarily >>>>> represent >>>>> those of "Erlang Training & Consulting, Ltd". >>>>> >>>>> If you are not the intended recipient of this email and its >>>>> attachments, >>>>> you must take no action based upon them, nor must you copy or show them >>>>> to >>>>> anyone. Please contact the sender if you believe you have received this >>>>> email in error. >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Mon Aug 18 15:30:07 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 09:30:07 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> <48A96B96.1090306@gmail.com> <48A97401.9040107@gmail.com> Message-ID: How can I get this process automated, so I can just run a single command. On Mon, Aug 18, 2008 at 9:27 AM, Matt Williamson wrote: > It worked! What I find weird is that if I run `erl -pa ebin` it gets the > same error, but if I run `erl -pa ./ebin` it works. Thank you very much > Serge! > > > On Mon, Aug 18, 2008 at 9:07 AM, Serge Aleynikov wrote: > >> Can you try running it without escript (just like I showed in my last >> email)? Probably the problem is that systools is having hard time finding >> simpledb.app or it's modules because "-pa ./ebin" option is missing. >> >> >> Matt Williamson wrote: >> >>> Hi Serge, >>> >>> Thanks for the help. I made the changes, but I am still getting an error. >>> >>> Here is my directory structure: >>> ~/simpledb >>> /make.escript >>> /ebin/simpledb.app >>> /priv/simpldb.rel >>> >>> After applying the changes I get the following escript which I am using >>> to >>> compile. >>> >>> *#!/usr/bin/env escript >>> %% -*- erlang -*- >>> %% File: make.escript >>> >>> main(_Args) -> >>> make:all(), >>> systools:make_script("./priv/simpledb", [{path, ["ebin"]}, >>> {outdir, "rel"}]), >>> systools:make_tar("./priv/simpledb", [{path, ["ebin"]}, >>> {erts, code:root_dir()}, >>> {outdir, "rel"}, >>> {dirs, [include, doc]}]).* >>> >>> >>> The error I get is: >>> *{{case_clause, >>> {'EXIT', >>> {function_clause, >>> [{filename,join,[[]]}, >>> {systools_make,add_appl,7}, >>> {systools_make,'-add_applications/5-fun-0-',6}, >>> {lists,foldl,3}, >>> {systools_make,add_applications,5}, >>> {systools_make,mk_tar,6}, >>> {systools_make,mk_tar,5}, >>> {systools_make,make_tar,2}]}}}, >>> [{systools_make,'-add_applications/5-fun-0-',6}, >>> {lists,foldl,3}, >>> {systools_make,add_applications,5}, >>> {systools_make,mk_tar,6}, >>> {systools_make,mk_tar,5}, >>> {systools_make,make_tar,2}, >>> {erl_eval,do_apply,5}, >>> {escript,code_handler,4}]}* >>> >>> make_script/1,2 still works great but make_tar is not. >>> >>> On Mon, Aug 18, 2008 at 8:31 AM, Serge Aleynikov >>> wrote: >>> >>> This is what you need to do: >>>> >>>> Suppose your app's directory tree is as follows: >>>> simpledb/ >>>> simpledb/ebin/simpledb.app >>>> simpledb/priv/simpledb.rel >>>> >>>> $ cd /path/to/your/simpledb >>>> $ erl -pa ./ebin >>>> 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, >>>> code:root_dir()}]). >>>> >>>> This will create ./priv/simpledb.tar.gz >>>> >>>> Regarding the WARNINGS - just ignore them. What they mean is that SASL >>>> is >>>> finding that the mentioned source files have been modified (i.e. their >>>> timestamps changed) after they were compiled into beams. >>>> >>>> Regards, >>>> >>>> Serge >>>> >>>> >>>> Matt Williamson wrote: >>>> >>>> No problem, I hope someone can help though :) >>>>> >>>>> I have two projects with the same problem and I have not seen make_tar >>>>> run >>>>> successfully to date. >>>>> >>>>> On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake >>>>> wrote: >>>>> >>>>> Sorry all... This is what happens when you read something and answer >>>>> >>>>>> quickly :( >>>>>> >>>>>> Completly ignore what I just wrote :P >>>>>> >>>>>> /Mazen >>>>>> >>>>>> Mazen Harake wrote: >>>>>> >>>>>> Hi Mat, >>>>>> >>>>>>> Answers inline... >>>>>>> >>>>>>> Matt Williamson wrote: >>>>>>> >>>>>>> >>>>>>> Hi there, >>>>>>> >>>>>>>> I have an OTP app with the following simpledb.rel file: >>>>>>>> >>>>>>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>>>>>> [{simpledb, "1.0"}, >>>>>>>> {kernel, "2.11.5"}, >>>>>>>> {stdlib, "1.14.5"}]}./ >>>>>>>> >>>>>>>> And the following simpledb.app file: >>>>>>>> >>>>>>>> /{application, simpledb, >>>>>>>> [{description, "Stores Key, Value pairs."}, >>>>>>>> {id, "simpledb"}, >>>>>>>> {vsn, "1.0"}, >>>>>>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>>>>>> {mod, {simpledb_app, []}}, >>>>>>>> / >>>>>>>> >>>>>>>> >>>>>>>> Why do you have an empty list here? mod specifies modules for >>>>>>>> >>>>>>> application >>>>>>> simpledb... and empty list ("") is not a valid module name :) >>>>>>> >>>>>>> >>>>>>> / {registered, [simpledb_svr]}, >>>>>>> >>>>>>>> {applications, [kernel, stdlib]}]}./ >>>>>>>> >>>>>>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >>>>>>>> the >>>>>>>> following error: >>>>>>>> >>>>>>>> /{{case_clause, >>>>>>>> {'EXIT', >>>>>>>> {function_clause, >>>>>>>> [{filename,join,[[]]}, >>>>>>>> {systools_make,add_appl,7}, >>>>>>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>>>>>> {lists,foldl,3}, >>>>>>>> {systools_make,add_applications,5}, >>>>>>>> {systools_make,mk_tar,6}, >>>>>>>> {systools_make,mk_tar,5}, >>>>>>>> {systools_make,make_tar,2}]}}}, >>>>>>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>>>>>> {lists,foldl,3}, >>>>>>>> {systools_make,add_applications,5}, >>>>>>>> {systools_make,mk_tar,6}, >>>>>>>> {systools_make,mk_tar,5}, >>>>>>>> {systools_make,make_tar,2}, >>>>>>>> {erl_eval,do_apply,5}, >>>>>>>> {escript,code_handler,4}]}/ >>>>>>>> >>>>>>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>>>>>> >>>>>>>> Also if you know why I get the following junk, it would be forever >>>>>>>> thankful: >>>>>>>> >>>>>>>> /*WARNING* kernel: Object code (application) out of date >>>>>>>> *WARNING* kernel: Object code (application_controller) out of date >>>>>>>> *WARNING* kernel: Object code (application_master) out of date >>>>>>>> *WARNING* kernel: Object code (application_starter) out of date >>>>>>>> *WARNING* kernel: Object code (auth) out of date >>>>>>>> *WARNING* kernel: Object code (code) out of date >>>>>>>> *WARNING* kernel: Object code (code_aux) out of date >>>>>>>> *WARNING* kernel: Object code (packages) out of date >>>>>>>> *WARNING* kernel: Object code (code_server) out of date >>>>>>>> *WARNING* kernel: Object code (dist_util) out of date >>>>>>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>>>>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>>>>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>>>>>> *WARNING* kernel: Object code (erl_reply) out of date >>>>>>>> *WARNING* kernel: Object code (erlang) out of date >>>>>>>> *WARNING* kernel: Object code (error_handler) out of date >>>>>>>> *WARNING* kernel: Object code (error_logger) out of date >>>>>>>> *WARNING* kernel: Object code (file) out of date >>>>>>>> *WARNING* kernel: Object code (file_server) out of date >>>>>>>> *WARNING* kernel: Object code (file_io_server) out of date >>>>>>>> *WARNING* kernel: Object code (prim_file) out of date >>>>>>>> *WARNING* kernel: Object code (global) out of date >>>>>>>> *WARNING* kernel: Object code (global_group) out of date >>>>>>>> *WARNING* kernel: Object code (global_search) out of date >>>>>>>> *WARNING* kernel: Object code (group) out of date >>>>>>>> *WARNING* kernel: Object code (heart) out of date >>>>>>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>>>>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>>>>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>>>>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>>>>>> *WARNING* kernel: Object code (inet_config) out of date >>>>>>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>>>>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>>>>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>>>>>> *WARNING* kernel: Object code (init) out of date >>>>>>>> *WARNING* kernel: Object code (kernel) out of date >>>>>>>> *WARNING* kernel: Object code (kernel_config) out of date >>>>>>>> *WARNING* kernel: Object code (net) out of date >>>>>>>> *WARNING* kernel: Object code (net_adm) out of date >>>>>>>> *WARNING* kernel: Object code (net_kernel) out of date >>>>>>>> *WARNING* kernel: Object code (os) out of date >>>>>>>> *WARNING* kernel: Object code (ram_file) out of date >>>>>>>> *WARNING* kernel: Object code (rpc) out of date >>>>>>>> *WARNING* kernel: Object code (user) out of date >>>>>>>> *WARNING* kernel: Object code (user_drv) out of date >>>>>>>> *WARNING* kernel: Object code (user_sup) out of date >>>>>>>> *WARNING* kernel: Object code (disk_log) out of date >>>>>>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>>>>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>>>>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>>>>>> *WARNING* kernel: Object code (dist_ac) out of date >>>>>>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>>>>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>>>>>> *WARNING* kernel: Object code (erts_debug) out of date >>>>>>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>>>>>> *WARNING* kernel: Object code (gen_udp) out of date >>>>>>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>>>>>> *WARNING* kernel: Object code (prim_inet) out of date >>>>>>>> *WARNING* kernel: Object code (inet) out of date >>>>>>>> *WARNING* kernel: Object code (inet_db) out of date >>>>>>>> *WARNING* kernel: Object code (inet_dns) out of date >>>>>>>> *WARNING* kernel: Object code (inet_parse) out of date >>>>>>>> *WARNING* kernel: Object code (inet_res) out of date >>>>>>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>>>>>> *WARNING* kernel: Object code (inet_udp) out of date >>>>>>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>>>>>> *WARNING* kernel: Object code (pg2) out of date >>>>>>>> *WARNING* kernel: Object code (seq_trace) out of date >>>>>>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>>>>>> *WARNING* kernel: Object code (zlib) out of date >>>>>>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>>>>>> *WARNING* stdlib: Object code (base64) out of date >>>>>>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>>>>>> *WARNING* stdlib: Object code (c) out of date >>>>>>>> *WARNING* stdlib: Object code (calendar) out of date >>>>>>>> *WARNING* stdlib: Object code (dets) out of date >>>>>>>> *WARNING* stdlib: Object code (dets_server) out of date >>>>>>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>>>>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>>>>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>>>>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>>>>>> *WARNING* stdlib: Object code (dict) out of date >>>>>>>> *WARNING* stdlib: Object code (digraph) out of date >>>>>>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>>>>>> *WARNING* stdlib: Object code (edlin) out of date >>>>>>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>>>>>> *WARNING* stdlib: Object code (epp) out of date >>>>>>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>>>>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>>>>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>>>>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>>>>>> *WARNING* stdlib: Object code (escript) out of date >>>>>>>> *WARNING* stdlib: Object code (ets) out of date >>>>>>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>>>>>> *WARNING* stdlib: Object code (filelib) out of date >>>>>>>> *WARNING* stdlib: Object code (filename) out of date >>>>>>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>>>>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>>>>>> *WARNING* stdlib: Object code (gen) out of date >>>>>>>> *WARNING* stdlib: Object code (gen_event) out of date >>>>>>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>>>>>> *WARNING* stdlib: Object code (gen_server) out of date >>>>>>>> *WARNING* stdlib: Object code (io) out of date >>>>>>>> *WARNING* stdlib: Object code (io_lib) out of date >>>>>>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>>>>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>>>>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>>>>>> *WARNING* stdlib: Object code (lib) out of date >>>>>>>> *WARNING* stdlib: Object code (lists) out of date >>>>>>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>>>>>> *WARNING* stdlib: Object code (math) out of date >>>>>>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>>>>>> *WARNING* stdlib: Object code (orddict) out of date >>>>>>>> *WARNING* stdlib: Object code (ordsets) out of date >>>>>>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>>>>>> *WARNING* stdlib: Object code (pg) out of date >>>>>>>> *WARNING* stdlib: Object code (pool) out of date >>>>>>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>>>>>> *WARNING* stdlib: Object code (proplists) out of date >>>>>>>> *WARNING* stdlib: Object code (qlc) out of date >>>>>>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>>>>>> *WARNING* stdlib: Object code (queue) out of date >>>>>>>> *WARNING* stdlib: Object code (random) out of date >>>>>>>> *WARNING* stdlib: Object code (regexp) out of date >>>>>>>> *WARNING* stdlib: Object code (sets) out of date >>>>>>>> *WARNING* stdlib: Object code (shell) out of date >>>>>>>> *WARNING* stdlib: Object code (shell_default) out of date >>>>>>>> *WARNING* stdlib: Object code (slave) out of date >>>>>>>> *WARNING* stdlib: Object code (sofs) out of date >>>>>>>> *WARNING* stdlib: Object code (string) out of date >>>>>>>> *WARNING* stdlib: Object code (supervisor) out of date >>>>>>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>>>>>> *WARNING* stdlib: Object code (sys) out of date >>>>>>>> *WARNING* stdlib: Object code (timer) out of date >>>>>>>> *WARNING* stdlib: Object code (win32reg) out of date >>>>>>>> *WARNING* stdlib: Object code (zip) out of date/ >>>>>>>> >>>>>>>> >>>>>>>> Thanks a lot! >>>>>>>> >>>>>>>> Matt >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------ >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> erlang-questions mailing list >>>>>>>> erlang-questions@REDACTED >>>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>> Mazen Harake >>>>>> Erlang Software Developer and Consultant, >>>>>> Erlang Training & Consulting, Ltd >>>>>> >>>>>> Mobile Phone: +44 (0)795 13 26 317 >>>>>> Office Phone: +44 (0)207 45 61 020 >>>>>> Office Address: >>>>>> 401 London Fruit & Wool Exchange >>>>>> Brushfield St, London, E1 6EL >>>>>> United Kingdom >>>>>> >>>>>> This email and its attachments may be confidential and are intended >>>>>> solely >>>>>> for the use of the individual to whom it is addressed. Any views or >>>>>> opinions >>>>>> expressed are solely those of the author and do not necessarily >>>>>> represent >>>>>> those of "Erlang Training & Consulting, Ltd". >>>>>> >>>>>> If you are not the intended recipient of this email and its >>>>>> attachments, >>>>>> you must take no action based upon them, nor must you copy or show >>>>>> them >>>>>> to >>>>>> anyone. Please contact the sender if you believe you have received >>>>>> this >>>>>> email in error. >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Mon Aug 18 15:38:08 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 18 Aug 2008 09:38:08 -0400 Subject: [erlang-questions] Need help with systools:make_tar/2 In-Reply-To: References: <48A96217.90806@erlang-consulting.com> <48A962CC.9040708@erlang-consulting.com> <48A96B96.1090306@gmail.com> <48A97401.9040107@gmail.com> Message-ID: <48A97B40.3050101@gmail.com> Write a simple Makefile (using a target like below) and use "make tar" to build. tar: erl -pa ./ebin -eval 'systools:make_tar( .... ).' -init stop -noshell | grep -v "*WARNING*" Matt Williamson wrote: > How can I get this process automated, so I can just run a single command. > > On Mon, Aug 18, 2008 at 9:27 AM, Matt Williamson wrote: > >> It worked! What I find weird is that if I run `erl -pa ebin` it gets the >> same error, but if I run `erl -pa ./ebin` it works. Thank you very much >> Serge! >> >> >> On Mon, Aug 18, 2008 at 9:07 AM, Serge Aleynikov wrote: >> >>> Can you try running it without escript (just like I showed in my last >>> email)? Probably the problem is that systools is having hard time finding >>> simpledb.app or it's modules because "-pa ./ebin" option is missing. >>> >>> >>> Matt Williamson wrote: >>> >>>> Hi Serge, >>>> >>>> Thanks for the help. I made the changes, but I am still getting an error. >>>> >>>> Here is my directory structure: >>>> ~/simpledb >>>> /make.escript >>>> /ebin/simpledb.app >>>> /priv/simpldb.rel >>>> >>>> After applying the changes I get the following escript which I am using >>>> to >>>> compile. >>>> >>>> *#!/usr/bin/env escript >>>> %% -*- erlang -*- >>>> %% File: make.escript >>>> >>>> main(_Args) -> >>>> make:all(), >>>> systools:make_script("./priv/simpledb", [{path, ["ebin"]}, >>>> {outdir, "rel"}]), >>>> systools:make_tar("./priv/simpledb", [{path, ["ebin"]}, >>>> {erts, code:root_dir()}, >>>> {outdir, "rel"}, >>>> {dirs, [include, doc]}]).* >>>> >>>> >>>> The error I get is: >>>> *{{case_clause, >>>> {'EXIT', >>>> {function_clause, >>>> [{filename,join,[[]]}, >>>> {systools_make,add_appl,7}, >>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>> {lists,foldl,3}, >>>> {systools_make,add_applications,5}, >>>> {systools_make,mk_tar,6}, >>>> {systools_make,mk_tar,5}, >>>> {systools_make,make_tar,2}]}}}, >>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>> {lists,foldl,3}, >>>> {systools_make,add_applications,5}, >>>> {systools_make,mk_tar,6}, >>>> {systools_make,mk_tar,5}, >>>> {systools_make,make_tar,2}, >>>> {erl_eval,do_apply,5}, >>>> {escript,code_handler,4}]}* >>>> >>>> make_script/1,2 still works great but make_tar is not. >>>> >>>> On Mon, Aug 18, 2008 at 8:31 AM, Serge Aleynikov >>>> wrote: >>>> >>>> This is what you need to do: >>>>> Suppose your app's directory tree is as follows: >>>>> simpledb/ >>>>> simpledb/ebin/simpledb.app >>>>> simpledb/priv/simpledb.rel >>>>> >>>>> $ cd /path/to/your/simpledb >>>>> $ erl -pa ./ebin >>>>> 1> systools:make_tar("./priv/simpledb", [{dirs, [doc,include]}, {erts, >>>>> code:root_dir()}]). >>>>> >>>>> This will create ./priv/simpledb.tar.gz >>>>> >>>>> Regarding the WARNINGS - just ignore them. What they mean is that SASL >>>>> is >>>>> finding that the mentioned source files have been modified (i.e. their >>>>> timestamps changed) after they were compiled into beams. >>>>> >>>>> Regards, >>>>> >>>>> Serge >>>>> >>>>> >>>>> Matt Williamson wrote: >>>>> >>>>> No problem, I hope someone can help though :) >>>>>> I have two projects with the same problem and I have not seen make_tar >>>>>> run >>>>>> successfully to date. >>>>>> >>>>>> On Mon, Aug 18, 2008 at 7:53 AM, Mazen Harake >>>>>> wrote: >>>>>> >>>>>> Sorry all... This is what happens when you read something and answer >>>>>> >>>>>>> quickly :( >>>>>>> >>>>>>> Completly ignore what I just wrote :P >>>>>>> >>>>>>> /Mazen >>>>>>> >>>>>>> Mazen Harake wrote: >>>>>>> >>>>>>> Hi Mat, >>>>>>> >>>>>>>> Answers inline... >>>>>>>> >>>>>>>> Matt Williamson wrote: >>>>>>>> >>>>>>>> >>>>>>>> Hi there, >>>>>>>> >>>>>>>>> I have an OTP app with the following simpledb.rel file: >>>>>>>>> >>>>>>>>> /{release, {"simpledb", "1.0"}, {erts, "5.5.5"}, >>>>>>>>> [{simpledb, "1.0"}, >>>>>>>>> {kernel, "2.11.5"}, >>>>>>>>> {stdlib, "1.14.5"}]}./ >>>>>>>>> >>>>>>>>> And the following simpledb.app file: >>>>>>>>> >>>>>>>>> /{application, simpledb, >>>>>>>>> [{description, "Stores Key, Value pairs."}, >>>>>>>>> {id, "simpledb"}, >>>>>>>>> {vsn, "1.0"}, >>>>>>>>> {modules, [simpledb_app, simpledb_sup, simpledb_svr]}, >>>>>>>>> {mod, {simpledb_app, []}}, >>>>>>>>> / >>>>>>>>> >>>>>>>>> >>>>>>>>> Why do you have an empty list here? mod specifies modules for >>>>>>>>> >>>>>>>> application >>>>>>>> simpledb... and empty list ("") is not a valid module name :) >>>>>>>> >>>>>>>> >>>>>>>> / {registered, [simpledb_svr]}, >>>>>>>> >>>>>>>>> {applications, [kernel, stdlib]}]}./ >>>>>>>>> >>>>>>>>> When I run `systools:make_tar("simpledb", [{path, ["ebin"]}])` I get >>>>>>>>> the >>>>>>>>> following error: >>>>>>>>> >>>>>>>>> /{{case_clause, >>>>>>>>> {'EXIT', >>>>>>>>> {function_clause, >>>>>>>>> [{filename,join,[[]]}, >>>>>>>>> {systools_make,add_appl,7}, >>>>>>>>> {systools_make,'-add_applications/5-fun-0-',6}, >>>>>>>>> {lists,foldl,3}, >>>>>>>>> {systools_make,add_applications,5}, >>>>>>>>> {systools_make,mk_tar,6}, >>>>>>>>> {systools_make,mk_tar,5}, >>>>>>>>> {systools_make,make_tar,2}]}}}, >>>>>>>>> [{systools_make,'-add_applications/5-fun-0-',6}, >>>>>>>>> {lists,foldl,3}, >>>>>>>>> {systools_make,add_applications,5}, >>>>>>>>> {systools_make,mk_tar,6}, >>>>>>>>> {systools_make,mk_tar,5}, >>>>>>>>> {systools_make,make_tar,2}, >>>>>>>>> {erl_eval,do_apply,5}, >>>>>>>>> {escript,code_handler,4}]}/ >>>>>>>>> >>>>>>>>> `systools:make_script("simpledb", [{path, ["ebin"]}])` works fine. >>>>>>>>> >>>>>>>>> Also if you know why I get the following junk, it would be forever >>>>>>>>> thankful: >>>>>>>>> >>>>>>>>> /*WARNING* kernel: Object code (application) out of date >>>>>>>>> *WARNING* kernel: Object code (application_controller) out of date >>>>>>>>> *WARNING* kernel: Object code (application_master) out of date >>>>>>>>> *WARNING* kernel: Object code (application_starter) out of date >>>>>>>>> *WARNING* kernel: Object code (auth) out of date >>>>>>>>> *WARNING* kernel: Object code (code) out of date >>>>>>>>> *WARNING* kernel: Object code (code_aux) out of date >>>>>>>>> *WARNING* kernel: Object code (packages) out of date >>>>>>>>> *WARNING* kernel: Object code (code_server) out of date >>>>>>>>> *WARNING* kernel: Object code (dist_util) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_boot_server) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_distribution) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_prim_loader) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_reply) out of date >>>>>>>>> *WARNING* kernel: Object code (erlang) out of date >>>>>>>>> *WARNING* kernel: Object code (error_handler) out of date >>>>>>>>> *WARNING* kernel: Object code (error_logger) out of date >>>>>>>>> *WARNING* kernel: Object code (file) out of date >>>>>>>>> *WARNING* kernel: Object code (file_server) out of date >>>>>>>>> *WARNING* kernel: Object code (file_io_server) out of date >>>>>>>>> *WARNING* kernel: Object code (prim_file) out of date >>>>>>>>> *WARNING* kernel: Object code (global) out of date >>>>>>>>> *WARNING* kernel: Object code (global_group) out of date >>>>>>>>> *WARNING* kernel: Object code (global_search) out of date >>>>>>>>> *WARNING* kernel: Object code (group) out of date >>>>>>>>> *WARNING* kernel: Object code (heart) out of date >>>>>>>>> *WARNING* kernel: Object code (hipe_unified_loader) out of date >>>>>>>>> *WARNING* kernel: Object code (inet6_tcp) out of date >>>>>>>>> *WARNING* kernel: Object code (inet6_tcp_dist) out of date >>>>>>>>> *WARNING* kernel: Object code (inet6_udp) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_config) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_hosts) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_gethost_native) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_tcp_dist) out of date >>>>>>>>> *WARNING* kernel: Object code (init) out of date >>>>>>>>> *WARNING* kernel: Object code (kernel) out of date >>>>>>>>> *WARNING* kernel: Object code (kernel_config) out of date >>>>>>>>> *WARNING* kernel: Object code (net) out of date >>>>>>>>> *WARNING* kernel: Object code (net_adm) out of date >>>>>>>>> *WARNING* kernel: Object code (net_kernel) out of date >>>>>>>>> *WARNING* kernel: Object code (os) out of date >>>>>>>>> *WARNING* kernel: Object code (ram_file) out of date >>>>>>>>> *WARNING* kernel: Object code (rpc) out of date >>>>>>>>> *WARNING* kernel: Object code (user) out of date >>>>>>>>> *WARNING* kernel: Object code (user_drv) out of date >>>>>>>>> *WARNING* kernel: Object code (user_sup) out of date >>>>>>>>> *WARNING* kernel: Object code (disk_log) out of date >>>>>>>>> *WARNING* kernel: Object code (disk_log_1) out of date >>>>>>>>> *WARNING* kernel: Object code (disk_log_server) out of date >>>>>>>>> *WARNING* kernel: Object code (disk_log_sup) out of date >>>>>>>>> *WARNING* kernel: Object code (dist_ac) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_ddll) out of date >>>>>>>>> *WARNING* kernel: Object code (erl_epmd) out of date >>>>>>>>> *WARNING* kernel: Object code (erts_debug) out of date >>>>>>>>> *WARNING* kernel: Object code (gen_tcp) out of date >>>>>>>>> *WARNING* kernel: Object code (gen_udp) out of date >>>>>>>>> *WARNING* kernel: Object code (gen_sctp) out of date >>>>>>>>> *WARNING* kernel: Object code (prim_inet) out of date >>>>>>>>> *WARNING* kernel: Object code (inet) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_db) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_dns) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_parse) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_res) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_tcp) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_udp) out of date >>>>>>>>> *WARNING* kernel: Object code (inet_sctp) out of date >>>>>>>>> *WARNING* kernel: Object code (pg2) out of date >>>>>>>>> *WARNING* kernel: Object code (seq_trace) out of date >>>>>>>>> *WARNING* kernel: Object code (wrap_log_reader) out of date >>>>>>>>> *WARNING* kernel: Object code (zlib) out of date >>>>>>>>> *WARNING* kernel: Object code (otp_ring0) out of date >>>>>>>>> *WARNING* stdlib: Object code (base64) out of date >>>>>>>>> *WARNING* stdlib: Object code (beam_lib) out of date >>>>>>>>> *WARNING* stdlib: Object code (c) out of date >>>>>>>>> *WARNING* stdlib: Object code (calendar) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets_server) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets_sup) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets_utils) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets_v8) out of date >>>>>>>>> *WARNING* stdlib: Object code (dets_v9) out of date >>>>>>>>> *WARNING* stdlib: Object code (dict) out of date >>>>>>>>> *WARNING* stdlib: Object code (digraph) out of date >>>>>>>>> *WARNING* stdlib: Object code (digraph_utils) out of date >>>>>>>>> *WARNING* stdlib: Object code (edlin) out of date >>>>>>>>> *WARNING* stdlib: Object code (edlin_expand) out of date >>>>>>>>> *WARNING* stdlib: Object code (epp) out of date >>>>>>>>> *WARNING* stdlib: Object code (eval_bits) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_bits) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_compile) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_eval) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_expand_records) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_internal) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_lint) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_parse) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_posix_msg) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_pp) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_scan) out of date >>>>>>>>> *WARNING* stdlib: Object code (erl_tar) out of date >>>>>>>>> *WARNING* stdlib: Object code (error_logger_file_h) out of date >>>>>>>>> *WARNING* stdlib: Object code (error_logger_tty_h) out of date >>>>>>>>> *WARNING* stdlib: Object code (escript) out of date >>>>>>>>> *WARNING* stdlib: Object code (ets) out of date >>>>>>>>> *WARNING* stdlib: Object code (file_sorter) out of date >>>>>>>>> *WARNING* stdlib: Object code (filelib) out of date >>>>>>>>> *WARNING* stdlib: Object code (filename) out of date >>>>>>>>> *WARNING* stdlib: Object code (gb_trees) out of date >>>>>>>>> *WARNING* stdlib: Object code (gb_sets) out of date >>>>>>>>> *WARNING* stdlib: Object code (gen) out of date >>>>>>>>> *WARNING* stdlib: Object code (gen_event) out of date >>>>>>>>> *WARNING* stdlib: Object code (gen_fsm) out of date >>>>>>>>> *WARNING* stdlib: Object code (gen_server) out of date >>>>>>>>> *WARNING* stdlib: Object code (io) out of date >>>>>>>>> *WARNING* stdlib: Object code (io_lib) out of date >>>>>>>>> *WARNING* stdlib: Object code (io_lib_format) out of date >>>>>>>>> *WARNING* stdlib: Object code (io_lib_fread) out of date >>>>>>>>> *WARNING* stdlib: Object code (io_lib_pretty) out of date >>>>>>>>> *WARNING* stdlib: Object code (lib) out of date >>>>>>>>> *WARNING* stdlib: Object code (lists) out of date >>>>>>>>> *WARNING* stdlib: Object code (log_mf_h) out of date >>>>>>>>> *WARNING* stdlib: Object code (math) out of date >>>>>>>>> *WARNING* stdlib: Object code (ms_transform) out of date >>>>>>>>> *WARNING* stdlib: Object code (orddict) out of date >>>>>>>>> *WARNING* stdlib: Object code (ordsets) out of date >>>>>>>>> *WARNING* stdlib: Object code (otp_internal) out of date >>>>>>>>> *WARNING* stdlib: Object code (pg) out of date >>>>>>>>> *WARNING* stdlib: Object code (pool) out of date >>>>>>>>> *WARNING* stdlib: Object code (proc_lib) out of date >>>>>>>>> *WARNING* stdlib: Object code (proplists) out of date >>>>>>>>> *WARNING* stdlib: Object code (qlc) out of date >>>>>>>>> *WARNING* stdlib: Object code (qlc_pt) out of date >>>>>>>>> *WARNING* stdlib: Object code (queue) out of date >>>>>>>>> *WARNING* stdlib: Object code (random) out of date >>>>>>>>> *WARNING* stdlib: Object code (regexp) out of date >>>>>>>>> *WARNING* stdlib: Object code (sets) out of date >>>>>>>>> *WARNING* stdlib: Object code (shell) out of date >>>>>>>>> *WARNING* stdlib: Object code (shell_default) out of date >>>>>>>>> *WARNING* stdlib: Object code (slave) out of date >>>>>>>>> *WARNING* stdlib: Object code (sofs) out of date >>>>>>>>> *WARNING* stdlib: Object code (string) out of date >>>>>>>>> *WARNING* stdlib: Object code (supervisor) out of date >>>>>>>>> *WARNING* stdlib: Object code (supervisor_bridge) out of date >>>>>>>>> *WARNING* stdlib: Object code (sys) out of date >>>>>>>>> *WARNING* stdlib: Object code (timer) out of date >>>>>>>>> *WARNING* stdlib: Object code (win32reg) out of date >>>>>>>>> *WARNING* stdlib: Object code (zip) out of date/ >>>>>>>>> >>>>>>>>> >>>>>>>>> Thanks a lot! >>>>>>>>> >>>>>>>>> Matt >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> erlang-questions mailing list >>>>>>>>> erlang-questions@REDACTED >>>>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> -- >>>>>>> Mazen Harake >>>>>>> Erlang Software Developer and Consultant, >>>>>>> Erlang Training & Consulting, Ltd >>>>>>> >>>>>>> Mobile Phone: +44 (0)795 13 26 317 >>>>>>> Office Phone: +44 (0)207 45 61 020 >>>>>>> Office Address: >>>>>>> 401 London Fruit & Wool Exchange >>>>>>> Brushfield St, London, E1 6EL >>>>>>> United Kingdom >>>>>>> >>>>>>> This email and its attachments may be confidential and are intended >>>>>>> solely >>>>>>> for the use of the individual to whom it is addressed. Any views or >>>>>>> opinions >>>>>>> expressed are solely those of the author and do not necessarily >>>>>>> represent >>>>>>> those of "Erlang Training & Consulting, Ltd". >>>>>>> >>>>>>> If you are not the intended recipient of this email and its >>>>>>> attachments, >>>>>>> you must take no action based upon them, nor must you copy or show >>>>>>> them >>>>>>> to >>>>>>> anyone. Please contact the sender if you believe you have received >>>>>>> this >>>>>>> email in error. >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>>> > From bekesa@REDACTED Mon Aug 18 16:00:35 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Mon, 18 Aug 2008 16:00:35 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> References: <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> Message-ID: <200808181600.35310.bekesa@sch.bme.hu> > -define(FUNCTION, hd(element(2,element(2,catch erlang:error([]))))). A safer solution (it has no side effects, unlike the above): -define(FUNCTION,element(2,process_info(self(),current_function))). I don't know if it's more expensive or not, but if it does matter, you're doing something wrong. Georgy From hubert@REDACTED Mon Aug 18 17:29:45 2008 From: hubert@REDACTED (Hubert Plociniczak) Date: Mon, 18 Aug 2008 16:29:45 +0100 Subject: [erlang-questions] swap_handler and error_logger_file_h Message-ID: <48A99569.6050109@lshift.net> When application has sasl_error_file_h handler installed it is possible to do gen_event:swap_handler(error_logger, {sasl_report_file_h, swap},{sasl_report_file_h, ["/tmp/foo.log",error]}). However when I try to do: gen_event:swap_handler(error_logger, {error_logger_file_h, swap},{error_logger_file_h, "/tmp/foo.log"}). I get {error,{error,einval}}. I do not want to use error_logger:swap_handler({logfile, "/tmp/bar.log"}) because that doesn't delete the old handler (see gen_event:which_handlers(error_logger) ) and I end up having two error_logger_file_h handlers. Any ideas? Thanks, Hubert From dawsdesign@REDACTED Mon Aug 18 17:33:10 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 11:33:10 -0400 Subject: [erlang-questions] Edoc optional function parameters Message-ID: Hello, In the docs for gen_server, there for example is call/2,3, two signatures for the same base function. How do I use edoc to do something similar? Basically I want one argument to be optional without writing a @spec for each one. Here's what I have now: %%=================================================================== %% API %%=================================================================== %%------------------------------------------------------------------- %% @spec put(Node, Key, Value) -> Result %% Result = {ok, inserted, Key} | {error, notinserted} %% Key = term() %% Value = term() %% Node = node() %% @doc Inserts a Key, Value pair into the server. %%------------------------------------------------------------------- put(Key, Value) -> put(node(), Key, Value). put(Node, Key, Value) -> gen_server:call({simpledb_svr, Node}, {insert, Key, Value}). -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Mon Aug 18 19:18:19 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 18 Aug 2008 19:18:19 +0200 Subject: [erlang-questions] Edoc optional function parameters In-Reply-To: References: Message-ID: <48A9AEDB.3090205@it.uu.se> Matt Williamson wrote: > Hello, > > In the docs for gen_server, there for example is call/2,3, two > signatures for the same base function. How do I use edoc to do something > similar? Basically I want one argument to be optional without writing a > @spec for each one. Here's what I have now: > > %%=================================================================== > %% API > %%=================================================================== > %%------------------------------------------------------------------- > %% @spec put(Node, Key, Value) -> Result > %% Result = {ok, inserted, Key} | {error, notinserted} > %% Key = term() > %% Value = term() > %% Node = node() > %% @doc Inserts a Key, Value pair into the server. > %%------------------------------------------------------------------- > put(Key, Value) -> > put(node(), Key, Value). > > put(Node, Key, Value) -> > gen_server:call({simpledb_svr, Node}, {insert, Key, Value}). You currently need to provide a spec for both, but for put/2, you can write "@equiv put(node(), Key, Value)" instead of the @doc. /Richard From dawsdesign@REDACTED Mon Aug 18 20:06:05 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Mon, 18 Aug 2008 14:06:05 -0400 Subject: [erlang-questions] Edoc optional function parameters In-Reply-To: <48A9AEDB.3090205@it.uu.se> References: <48A9AEDB.3090205@it.uu.se> Message-ID: Thank you. That's good enough. On Mon, Aug 18, 2008 at 1:18 PM, Richard Carlsson wrote: > Matt Williamson wrote: > > Hello, > > > > In the docs for gen_server, there for example is call/2,3, two > > signatures for the same base function. How do I use edoc to do something > > similar? Basically I want one argument to be optional without writing a > > @spec for each one. Here's what I have now: > > > > %%=================================================================== > > %% API > > %%=================================================================== > > %%------------------------------------------------------------------- > > %% @spec put(Node, Key, Value) -> Result > > %% Result = {ok, inserted, Key} | {error, notinserted} > > %% Key = term() > > %% Value = term() > > %% Node = node() > > %% @doc Inserts a Key, Value pair into the server. > > %%------------------------------------------------------------------- > > put(Key, Value) -> > > put(node(), Key, Value). > > > > put(Node, Key, Value) -> > > gen_server:call({simpledb_svr, Node}, {insert, Key, Value}). > > You currently need to provide a spec for both, but for put/2, you > can write "@equiv put(node(), Key, Value)" instead of the @doc. > > /Richard > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Mon Aug 18 21:59:46 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 18 Aug 2008 15:59:46 -0400 Subject: [erlang-questions] max timeout Message-ID: <48A9D4B2.402@gmail.com> I recall this question being asked on the mailing list before, but I can't seem to find that thread. What's the MaxAllowedTimeout that can be specified in the after clause? receive after MaxAllowedTimeout -> ok end. It would be nice if the section 6.10 of the reference manual would include this info. Thanks. Serge From ulf@REDACTED Mon Aug 18 23:18:55 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 18 Aug 2008 23:18:55 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <48A9D4B2.402@gmail.com> References: <48A9D4B2.402@gmail.com> Message-ID: <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> It does: "receive Pattern1 [when GuardSeq1] -> Body1; ...; PatternN [when GuardSeqN] -> BodyN after ExprT -> BodyT end "ExprT should evaluate to an integer. The highest allowed value is 16#ffffffff, that is, the value must fit in 32 bits." BR, Ulf W 2008/8/18 Serge Aleynikov : > I recall this question being asked on the mailing list before, but I > can't seem to find that thread. > > What's the MaxAllowedTimeout that can be specified in the after clause? > > receive > after MaxAllowedTimeout -> > ok > end. > > It would be nice if the section 6.10 of the reference manual would > include this info. > > Thanks. > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From saleyn@REDACTED Tue Aug 19 00:12:56 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Mon, 18 Aug 2008 18:12:56 -0400 Subject: [erlang-questions] max timeout In-Reply-To: <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> Message-ID: <48A9F3E8.7080102@gmail.com> For some reason I have a vague recollection (that may very well be wrong) that when this subject was discussed on the list before the actual timeout number was less then 2^32... I have a case when I need to put a process to sleep for up to a couple of days (e.g. not to run on a weekend) - in practice I am doing a loop sleep with a smaller timeout to compensate for time drifts and clock adjustments, but nevertheless this question came up about a practical upper bound. Serge Ulf Wiger wrote: > It does: > > "receive > Pattern1 [when GuardSeq1] -> > Body1; > ...; > PatternN [when GuardSeqN] -> > BodyN > after > ExprT -> > BodyT > end > > "ExprT should evaluate to an integer. The highest allowed value is > 16#ffffffff, that is, the value must fit in 32 bits." > > BR, > Ulf W > > 2008/8/18 Serge Aleynikov : >> I recall this question being asked on the mailing list before, but I >> can't seem to find that thread. >> >> What's the MaxAllowedTimeout that can be specified in the after clause? >> >> receive >> after MaxAllowedTimeout -> >> ok >> end. >> >> It would be nice if the section 6.10 of the reference manual would >> include this info. >> >> Thanks. >> >> Serge >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From ok@REDACTED Tue Aug 19 02:53:23 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 19 Aug 2008 12:53:23 +1200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com> <2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz> <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> Message-ID: <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> On 19 Aug 2008, at 12:59 am, Robert Virding wrote: > The Erlang compiler isn't that smart. (Yet. A man can dream.) > > One problem Erlang would have doing this type of optimisation, which > would be wonderful to have, is the handling of side effects and > errors. I have also dreamed of a -pure([f/n,...]). directive, such as NU Prolog had. This would make a verifiable claim that the function(s) named would only call functions that are themselves pure, and a promise that if any exception would be raised in a call to such a function it would not matter which exception. However, that seemed off topic. -- If stupidity were a crime, who'd 'scape hanging? From ulises.cervino@REDACTED Tue Aug 19 07:58:53 2008 From: ulises.cervino@REDACTED (Ulises) Date: Tue, 19 Aug 2008 06:58:53 +0100 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <3dbc6d1c0808180457x32b646ccldbe3cfd0fe8d3b93@mail.gmail.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> <20080818094803.GA22078@contorpis.lisalinda.com> <3dbc6d1c0808180457x32b646ccldbe3cfd0fe8d3b93@mail.gmail.com> Message-ID: <226d73360808182258q18f6694dr46c5221ff140b6a0@mail.gmail.com> I know this is not a CS list however I'll dare and post my solution to the smokers problem in Erlang. Could anybody tell me if it's correct? While we're at it, how would you go about checking that a particular solution is actually correct for the problem being solved, i.e. how can I systematically check that my code is _right_? Best, U -------------- next part -------------- A non-text attachment was scrubbed... Name: smokers.erl Type: application/octet-stream Size: 1678 bytes Desc: not available URL: From bharani_vms@REDACTED Tue Aug 19 09:15:58 2008 From: bharani_vms@REDACTED (Bharani) Date: Tue, 19 Aug 2008 00:15:58 -0700 (PDT) Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: References: <18962077.post@talk.nabble.com> <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> Message-ID: <19045429.post@talk.nabble.com> Pattern matching is OK if you have a small string. In my case i am parsing the json returned by Solr ( text search engine built on top of lucene) and the code doesn't look compact if you use the pattern matching syntax. I just wish i could use objects and fields like what javascript does. Then again JSON is for javascript and not Erlang - i am just trying to find out the best approach. Thanks for all your comments -Bharani daws wrote: > > Pattern matching: > > 1> Decoded = mochijson:decode(JSON). > 2> ["foo",{"bar":[1,2,{"ugh":MYNUMBER}, 4]}] = Decoded. > ["foo",{"bar":[1,2,{"ugh":7}, 4]}] > 3> MYNUMBER. > 7 > > > > On Thu, Aug 14, 2008 at 12:12 AM, Richard A. O'Keefe > wrote: > >> On 14 Aug 2008, at 12:27 am, Bharani wrote: >> > so that i can simple say get(,"obj1.obj2.field") >> > >> > is this right way to do or can any one point out best practices >> >> If you are *given* things like "obj1.obj2.field", this is not a >> bad way to do it. But what if you have >> ["foo",{"bar":[1,2,{"ugh":77},4]}] >> and you want the 77? >> >> For the sake of argument, let's suppose you are using a JSON >> representation where >> >> number -> number >> "string" -> <<"string"> >> [X1,...,Xn] -> [X'1,...,X'n] >> {"l1":X1,...,"ln":Xn} -> [{<<"l1">>,X'1},...,{<<"ln">>,X'n}] >> {} -> [{}] >> >> Then the path to the 77 would be >> [2,<<"bar">>,3,<<"ugh">>] >> You _can't_ handle this by splitting "2.bar.3.ugh" into tokens, >> because "2" and "3" are perfectly good field names in JSON. >> Come to think of it, >> {"obj1.obj2.field":137} >> is a perfectly good JSON object; nothing anywhere says that a >> JSON field label cannot contain dots. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > ----- > "The best way to predict the future is to invent it." - Alan Kay > -- View this message in context: http://www.nabble.com/javascript-.-notation-to-fetch-objects-from-JSON-decode_string-1-tp18962077p19045429.html Sent from the Erlang Questions mailing list archive at Nabble.com. From matthias@REDACTED Tue Aug 19 09:42:35 2008 From: matthias@REDACTED (Matthias Lang) Date: Tue, 19 Aug 2008 09:42:35 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <48A9F3E8.7080102@gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> Message-ID: <20080819074235.GA3092@contorpis.lisalinda.com> On Monday, August 18, Serge Aleynikov wrote: > For some reason I have a vague recollection (that may very well be > wrong) that when this subject was discussed on the list before the > actual timeout number was less then 2^32... I have a case when I need > to put a process to sleep for up to a couple of days (e.g. not to run on > a weekend) - in practice I am doing a loop sleep with a smaller timeout > to compensate for time drifts and clock adjustments, but nevertheless > this question came up about a practical upper bound. This may be the thread you remember, it starts here: http://www.erlang.org/pipermail/erlang-questions/2008-February/032609.html Executive summary: In R11B-2, a timeout of 16#ffffFFFF doesn't work as expected on a 32-bit machine. Something changed between R11B-2 and R11B-5 which made it work in the shell, but still not in compiled code. I haven't noticed anything in the release notes saying it's been fixed for real. Matt From ingela@REDACTED Tue Aug 19 10:33:48 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 19 Aug 2008 10:33:48 +0200 Subject: [erlang-questions] inets HTTP client does not persist connections when POSTing In-Reply-To: References: Message-ID: <48AA856C.3000100@erix.ericsson.se> Hi, erlang-questions-request@REDACTED wrote: > Edwin Fine wrote: > >> I read the inets code, and if I understand it correctly, it seems that >> when a non-idempotent operation such as POST is performed, httpc does >> not reuse the existing connection (httpc_manager:select_session/4 >> returns no_connection, which starts a new handler). I am not sure if >> this is the correct thing to do, because my understanding is that that >> >> restriction on non-idempotent operations applies to pipelining, Yes that is correct, and that is what the test is for. The problem is that persistent connections that does not use pipeling seems to have been a missed as a concept. Even though I wrote most of the current code in the http-client it has not been my design from scratch. It has been a gradually improvement and adoption to OTP principals of a user contribution and one of many things that I do. So it seems there is a missing concept here and that we (most probably I ;)) need to do something about it. It is on the todo-list. Regards - Ingela Erlang/OTP, Ericsson >> not >> persistent connections. I can see no reason why one should not be able >> to do a series of consecutive POSTs on the same socket, as long as one >> waits for a reply before posting the next request. >> > > I don't think this is extremely unreasonable, it's basically a defense > mechanism to avoid issues with the non-idempotent request putting the > server/connection in an undesirable state. The reasoning generally seems > to be that a "fresh" connection to the server is less likely to be > terminated prematurely (or arbitrarily). Also remember a server always > has the right to close a KA connection (particularly after a > non-idempotent request). > > One way to improve on this could be to use the "100-continue" header > (Expect: 100-continue) before sending a POST body on a Keep-Alive > connection. This obviously introduces more latency, which can negate all > benefits of Keep-Alive (or even make it worse). On high latency > networks, with many of POSTs on a KA connection, it's probably > beneficial even with the overhead of "100-continue" (due to 3-way > handshake + TCP congestion control on new connections). > > Now, I do agree that it seems a little draconian that the library > doesn't let the user (developer) make these decisions. I haven't looked > at the code at all, but assuming this is what it does, I'm guessing it > was done to make sure people don't fall into this pit of nastiness > accidentally. It's a reasonable default for sure, but ought to be > possible to override, by someone well familiar with the dangers (and > how to handle them). > > From pguyot@REDACTED Tue Aug 19 11:32:20 2008 From: pguyot@REDACTED (Paul Guyot) Date: Tue, 19 Aug 2008 11:32:20 +0200 Subject: [erlang-questions] Dialyzer confused by several clauses? In-Reply-To: <48A93663.40202@kreditor.se> References: <414B5161-897B-497F-B5DD-9E770C27A07B@kallisys.net> <48A93663.40202@kreditor.se> Message-ID: <0B028A88-9FD9-42B1-B8DB-691BE952C25F@kallisys.net> Le 18 ao?t 08 ? 10:44, Tobias Lindahl a ?crit : > The checking in Dialyzer whether a contract is valid is not as > sophisticated as it could be. First it finds the success typing of > a function and then it compares it with the contract. The default > is to complain only if the two are contradicting. > > In your case the return type in the success typing is any() because > of the Value in the first clause (*). Since this does not > contradict the tuple() in the contract, Dialyzer is satisfied. The > reason for this somewhat liberal reasoning is the principle of > sound warnings; if there is a possibility that a contract is > correct then Dialyzer gives no warning. However, we could of course > lift this restriction by allowing the user to give some option, but > this is not present today. > > There are options for getting more strict warnings about contracts. > However, they would not have helped you in this case. The options > are --Wunderspecs, --Woverspecs and --Wspecdiffs. Basically these > options makes Dialyzer warn when the specs differ from the success > typings of functions. They are not on by default since the > resulting warnings are a bit confusing at times. > > Tobias > > (*) As you say, the type could be written as float() | any(), but > unions must be disjoint so this is collapsed to any(). Dear Tobias, Thank you for your reply! And thanks for the hint about the options, which actually detect the specification error. I am somewhat confused by the type arithmetics used by dialyzer, especially with unions. If code is of type any() | float() and specification is of type tuple(), how can it match? In which case would it be correct to match code[any() | x()] with spec[y()]? Paul From tobias.lindahl@REDACTED Tue Aug 19 12:35:42 2008 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Tue, 19 Aug 2008 12:35:42 +0200 Subject: [erlang-questions] Dialyzer confused by several clauses? In-Reply-To: <0B028A88-9FD9-42B1-B8DB-691BE952C25F@kallisys.net> References: <414B5161-897B-497F-B5DD-9E770C27A07B@kallisys.net> <48A93663.40202@kreditor.se> <0B028A88-9FD9-42B1-B8DB-691BE952C25F@kallisys.net> Message-ID: <48AAA1FE.2070209@kreditor.se> Paul Guyot wrote: > Le 18 ao?t 08 ? 10:44, Tobias Lindahl a ?crit : > Dear Tobias, > > Thank you for your reply! And thanks for the hint about the options, > which actually detect the specification error. > > I am somewhat confused by the type arithmetics used by dialyzer, > especially with unions. If code is of type any() | float() and > specification is of type tuple(), how can it match? In which case would > it be correct to match code[any() | x()] with spec[y()]? Perhaps I was a bit unclear about the union type. The type float() | any() is not a valid union. The separate parts of the union must be disjoint, and since float() is a subtype of any() the union is collapsed to any(). Valid unions are for example tuple()|integer(), or 'ok'|{'error',any()}. Invalid unions would be something like byte()|integer(), 'ok'|atom(). Of course, there is nothing wrong with forming these unions, but they will be collapsed to integer() and atom() respectively. When you specify that your function should return tuple(), and dialyzer finds that the function can return any() (because of the collapsed union), dialyzer simply assumes that you know better and accepts the annotation. Note that any() do not contradict tuple(), since tuple() is included in any(). Hope this made things a bit more clear. Best, Tobias > > Paul > From saleyn@REDACTED Tue Aug 19 13:39:53 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 19 Aug 2008 07:39:53 -0400 Subject: [erlang-questions] max timeout In-Reply-To: <20080819074235.GA3092@contorpis.lisalinda.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> Message-ID: <48AAB109.9060808@gmail.com> Matt, thanks, that was the thread! And this was Ulf's statement that seemed to have settled in my memory: "...you cannot use timeout values that are larger than a smallint." http://www.erlang.org/pipermail/erlang-questions/2008-February/032625.html So from that thread and your "executive summary" below, it's still not clear which one is the upper limit for the timeout: 1. 2^32 (this is what's documented, but only seems to work in the shell) 2. 2^32-1 = 49.5 days 3. Erlang's small integers (2^27-1 = 1.5 days) I still claim that the reference manual documentation ch. 6.10 is not accurate and leaves room for questions. Serge Matthias Lang wrote: > On Monday, August 18, Serge Aleynikov wrote: > >> For some reason I have a vague recollection (that may very well be >> wrong) that when this subject was discussed on the list before the >> actual timeout number was less then 2^32... I have a case when I need >> to put a process to sleep for up to a couple of days (e.g. not to run on >> a weekend) - in practice I am doing a loop sleep with a smaller timeout >> to compensate for time drifts and clock adjustments, but nevertheless >> this question came up about a practical upper bound. > > This may be the thread you remember, it starts here: > > http://www.erlang.org/pipermail/erlang-questions/2008-February/032609.html > > Executive summary: In R11B-2, a timeout of 16#ffffFFFF doesn't work as > expected on a 32-bit machine. Something changed between R11B-2 and > R11B-5 which made it work in the shell, but still not in compiled > code. I haven't noticed anything in the release notes saying it's > been fixed for real. > > Matt > From B.Candler@REDACTED Tue Aug 19 14:18:32 2008 From: B.Candler@REDACTED (Brian Candler) Date: Tue, 19 Aug 2008 13:18:32 +0100 Subject: [erlang-questions] (Newbie) extracting value for one key Message-ID: <20080819121832.GA10726@uk.tiscali.com> In Erlang, it seems a list of {key,value} tuples is often returned, e.g. 17> P = process_info(self()). [{current_function,{erl_eval,do_apply,5}}, {initial_call,{erlang,apply,2}}, {status,running}, {message_queue_len,0}, {messages,[]}, {links,[<0.25.0>]}, {dictionary,[]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.24.0>}, {heap_size,610}, {stack_size,28}, {reductions,526}, {garbage_collection,[{fullsweep_after,65535}]}] Question: What's the idiomatic way to extract the value for a particular key? For example, to extract "stack_size" from the above I could write 18> hd([ V || {stack_size,V} <- P ]). 28 but is there a better way to do this? Thanks, Brian. P.S. I found the example at http://www.erlang.org/doc/programming_examples/list_comprehensions.html#3.6 which shows how to factor the comprehension into a function. I also found "element(2, element(2, lists:keysearch(stack_size, 1, P)))." but that's rather verbose. From hans.bolinder@REDACTED Tue Aug 19 14:35:03 2008 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Tue, 19 Aug 2008 14:35:03 +0200 Subject: [erlang-questions] documentation bug, module digraph In-Reply-To: <95be1d3b0808081258x39e50825r9592a1dfbc386194@mail.gmail.com> References: <95be1d3b0808081258x39e50825r9592a1dfbc386194@mail.gmail.com> Message-ID: <18602.48631.733800.164749@gargle.gargle.HOWL> [Vlad Dumitrescu:] > There are some errors in the docs for digraph: > ... Thanks. It will be corrected in R12B-4. Hans Bolinder, Erlang/OTP, Ericsson AB From gleber.p@REDACTED Tue Aug 19 14:38:10 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 19 Aug 2008 14:38:10 +0200 Subject: [erlang-questions] (Newbie) extracting value for one key In-Reply-To: <20080819121832.GA10726@uk.tiscali.com> References: <20080819121832.GA10726@uk.tiscali.com> Message-ID: <14f0e3620808190538g47d3183ela56c5855d46b5360@mail.gmail.com> On Tue, Aug 19, 2008 at 2:18 PM, Brian Candler wrote: > In Erlang, it seems a list of {key,value} tuples is often returned, e.g. > > 17> P = process_info(self()). > [{current_function,{erl_eval,do_apply,5}}, > {initial_call,{erlang,apply,2}}, > {status,running}, > {message_queue_len,0}, > {messages,[]}, > {links,[<0.25.0>]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.24.0>}, > {heap_size,610}, > {stack_size,28}, > {reductions,526}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Question: What's the idiomatic way to extract the value for a particular > key? For example, to extract "stack_size" from the above I could write > > 18> hd([ V || {stack_size,V} <- P ]). > 28 > > but is there a better way to do this? > > Thanks, > > Brian. > > P.S. I found the example at > http://www.erlang.org/doc/programming_examples/list_comprehensions.html#3.6 > which shows how to factor the comprehension into a function. > > I also found "element(2, element(2, lists:keysearch(stack_size, 1, P)))." > but that's rather verbose. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hello, Take a look at module proplists [1], specifically at function get_value/2,3 or lookup/2 (or other in there) 1: man proplists or http://www.erlang.org/doc/man/proplists.html BR -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From ahmed.nawras@REDACTED Tue Aug 19 14:44:06 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 19 Aug 2008 16:44:06 +0400 Subject: [erlang-questions] (Newbie) extracting value for one key In-Reply-To: <20080819121832.GA10726@uk.tiscali.com> References: <20080819121832.GA10726@uk.tiscali.com> Message-ID: Hi, lists:keysearch/3 will do. It returns {value, R}, where R is the result tuple. > lists:keysearch(stack_size, 1, P). will return {value, {stack_size, 28}} BTW, try reading module lists's documentation as it includes a lot of useful functions. / Ahmed Al-Issaei On Tue, Aug 19, 2008 at 4:18 PM, Brian Candler wrote: > In Erlang, it seems a list of {key,value} tuples is often returned, e.g. > > 17> P = process_info(self()). > [{current_function,{erl_eval,do_apply,5}}, > {initial_call,{erlang,apply,2}}, > {status,running}, > {message_queue_len,0}, > {messages,[]}, > {links,[<0.25.0>]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.24.0>}, > {heap_size,610}, > {stack_size,28}, > {reductions,526}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Question: What's the idiomatic way to extract the value for a particular > key? For example, to extract "stack_size" from the above I could write > > 18> hd([ V || {stack_size,V} <- P ]). > 28 > > but is there a better way to do this? > > Thanks, > > Brian. > > P.S. I found the example at > http://www.erlang.org/doc/programming_examples/list_comprehensions.html#3.6 > which shows how to factor the comprehension into a function. > > I also found "element(2, element(2, lists:keysearch(stack_size, 1, P)))." > but that's rather verbose. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From torben.lehoff@REDACTED Tue Aug 19 14:45:00 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 19 Aug 2008 14:45:00 +0200 Subject: [erlang-questions] (Newbie) extracting value for one key In-Reply-To: <20080819121832.GA10726@uk.tiscali.com> References: <20080819121832.GA10726@uk.tiscali.com> Message-ID: http://www.erlang.org/doc/man/proplists.html proplists:get_value(stack_size,P). On Tue, Aug 19, 2008 at 2:18 PM, Brian Candler wrote: > In Erlang, it seems a list of {key,value} tuples is often returned, e.g. > > 17> P = process_info(self()). > [{current_function,{erl_eval,do_apply,5}}, > {initial_call,{erlang,apply,2}}, > {status,running}, > {message_queue_len,0}, > {messages,[]}, > {links,[<0.25.0>]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.24.0>}, > {heap_size,610}, > {stack_size,28}, > {reductions,526}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Question: What's the idiomatic way to extract the value for a particular > key? For example, to extract "stack_size" from the above I could write > > 18> hd([ V || {stack_size,V} <- P ]). > 28 > > but is there a better way to do this? > > Thanks, > > Brian. > > P.S. I found the example at > http://www.erlang.org/doc/programming_examples/list_comprehensions.html#3.6 > which shows how to factor the comprehension into a function. > > I also found "element(2, element(2, lists:keysearch(stack_size, 1, P)))." > but that's rather verbose. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.b.lists@REDACTED Tue Aug 19 14:52:56 2008 From: r.b.lists@REDACTED (Roland Braito) Date: Tue, 19 Aug 2008 14:52:56 +0200 Subject: [erlang-questions] (Newbie) extracting value for one key In-Reply-To: <20080819121832.GA10726@uk.tiscali.com> References: <20080819121832.GA10726@uk.tiscali.com> Message-ID: <20080819125256.90860@gmx.net> Hi! I'd say {value,{stack_size, V}} = lists:keysearch(stack_size,1,P), you can wrap it in some function if that's still too long, i guess... BR -------- Original-Nachricht -------- > Datum: Tue, 19 Aug 2008 13:18:32 +0100 > Von: Brian Candler > An: erlang-questions@REDACTED > Betreff: [erlang-questions] (Newbie) extracting value for one key > In Erlang, it seems a list of {key,value} tuples is often returned, e.g. > > 17> P = process_info(self()). > [{current_function,{erl_eval,do_apply,5}}, > {initial_call,{erlang,apply,2}}, > {status,running}, > {message_queue_len,0}, > {messages,[]}, > {links,[<0.25.0>]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.24.0>}, > {heap_size,610}, > {stack_size,28}, > {reductions,526}, > {garbage_collection,[{fullsweep_after,65535}]}] > > Question: What's the idiomatic way to extract the value for a particular > key? For example, to extract "stack_size" from the above I could write > > 18> hd([ V || {stack_size,V} <- P ]). > 28 > > but is there a better way to do this? > > Thanks, > > Brian. > > P.S. I found the example at > http://www.erlang.org/doc/programming_examples/list_comprehensions.html#3.6 > which shows how to factor the comprehension into a function. > > I also found "element(2, element(2, lists:keysearch(stack_size, 1, P)))." > but that's rather verbose. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Psssst! Schon das coole Video vom GMX MultiMessenger gesehen? Der Eine f?r Alle: http://www.gmx.net/de/go/messenger03 From B.Candler@REDACTED Tue Aug 19 14:55:41 2008 From: B.Candler@REDACTED (Brian Candler) Date: Tue, 19 Aug 2008 13:55:41 +0100 Subject: [erlang-questions] (Newbie) extracting value for one key In-Reply-To: <14f0e3620808190538g47d3183ela56c5855d46b5360@mail.gmail.com> References: <20080819121832.GA10726@uk.tiscali.com> <14f0e3620808190538g47d3183ela56c5855d46b5360@mail.gmail.com> Message-ID: <20080819125541.GA11756@uk.tiscali.com> > Take a look at module proplists [1], specifically at function > get_value/2,3 or lookup/2 (or other in there) > > 1: man proplists or http://www.erlang.org/doc/man/proplists.html Thank you, that was the pointer I needed. Regards, Brian. From colm.dougan@REDACTED Tue Aug 19 15:33:38 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Tue, 19 Aug 2008 14:33:38 +0100 Subject: [erlang-questions] Possible bug after ets:insert exception Message-ID: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Hi, I'm running 12B-3. Below is a console session. Everything worked as expected until "4>" where I unintentionally provided an atom in my insert and I get a bad arg. Again that was expected. What I didn't expect, however, was that from then on the ets table seemed to be in a bad state and couldn't be queried. I realise this is an edge case. Is this a bug? Colm Eshell V5.6.3 (abort with ^G) 1> ets:new(testtable,[set,named_table,private]). testtable 2> ets:insert(testtable, [{foo, 10}]). true 3> ets:tab2list(testtable). [{foo,10}] 4> ets:insert(testtable, bar). ** exception error: bad argument in function ets:insert/2 called as ets:insert(testtable,bar) 5> ets:tab2list(testtable). ** exception error: bad argument in function ets:match_object/2 called as ets:match_object(testtable,'_') in call from ets:tab2list/1 From rtrlists@REDACTED Tue Aug 19 15:57:09 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 19 Aug 2008 14:57:09 +0100 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <6a3ae47e0808190657n42b99405laaae2bad936547b2@mail.gmail.com> On Tue, Aug 19, 2008 at 2:33 PM, Colm Dougan wrote: > Eshell V5.6.3 (abort with ^G) > 1> ets:new(testtable,[set,named_table,private]). > testtable > 2> ets:insert(testtable, [{foo, 10}]). > true > 3> ets:tab2list(testtable). > [{foo,10}] > 4> ets:insert(testtable, bar). > ** exception error: bad argument > in function ets:insert/2 > called as ets:insert(testtable,bar) > 5> ets:tab2list(testtable). > ** exception error: bad argument > in function ets:match_object/2 > called as ets:match_object(testtable,'_') > in call from ets:tab2list/1 I think this is probably due to the shell having crashed in step 4. The restarted shell (a new process) no longer knows about testtable. I have been confused by crashed/restarted shells in the past. But I'm not 100% sure that is what you're seeing. There's been threads about this in the past. Robby From gleber.p@REDACTED Tue Aug 19 16:09:05 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 19 Aug 2008 16:09:05 +0200 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <14f0e3620808190709u1bb18179yafd92aa28eb87e76@mail.gmail.com> On Tue, Aug 19, 2008 at 3:33 PM, Colm Dougan wrote: > Hi, > > I'm running 12B-3. Below is a console session. Everything worked as > expected until "4>" where I unintentionally provided an atom in my > insert and I get a bad arg. Again that was expected. What I didn't > expect, however, was that from then on the ets table seemed to be in a > bad state and couldn't be queried. I realise this is an edge case. > Is this a bug? > > Colm > > Eshell V5.6.3 (abort with ^G) > 1> ets:new(testtable,[set,named_table,private]). > testtable > 2> ets:insert(testtable, [{foo, 10}]). > true > 3> ets:tab2list(testtable). > [{foo,10}] > 4> ets:insert(testtable, bar). > ** exception error: bad argument > in function ets:insert/2 > called as ets:insert(testtable,bar) > 5> ets:tab2list(testtable). > ** exception error: bad argument > in function ets:match_object/2 > called as ets:match_object(testtable,'_') > in call from ets:tab2list/1 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hello, The reason is slightly different. Take a look: Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.2 (abort with ^G) 1> ets:new(testtable,[set,named_table,private]). testtable 2> ets:i(). id name type size mem owner ---------------------------------------------------------------------------- 11 code set 256 10161 code_server ... inet_hosts inet_hosts set 0 279 inet_db testtable testtable set 0 279 <0.30.0> ok 3> self(). <0.30.0> 4> true = false. ** exception error: no match of right hand side value false 5> self(). <0.35.0> 6> ets:i(). id name type size mem owner ---------------------------------------------------------------------------- 11 code set 257 10265 code_server ... inet_hosts inet_hosts set 0 279 inet_db ok 7> When there is an exception in shell, shell process crashes (take a look at result of self/0). Because of that 'testtable' disappears from the system. In "man ets" you can read the following: "When the process terminates, the table is automatically destroyed." BR -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From pfisher@REDACTED Tue Aug 19 15:41:33 2008 From: pfisher@REDACTED (Paul Fisher) Date: Tue, 19 Aug 2008 08:41:33 -0500 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <48AACD8D.5010201@alertlogic.net> Colm Dougan wrote: > I'm running 12B-3. Below is a console session. Everything worked as > expected until "4>" where I unintentionally provided an atom in my > insert and I get a bad arg. Again that was expected. What I didn't > expect, however, was that from then on the ets table seemed to be in a > bad state and couldn't be queried. I realise this is an edge case. > Is this a bug? No, not a bug. What is happening is the shell process which owned the ets table died when the exception was generated and therefore the ets table was cleaned up. This is confusing since the shell appears to keep going after printing out the exception messages, but in fact it is another process. -- paul From bekesa@REDACTED Tue Aug 19 16:24:29 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Tue, 19 Aug 2008 16:24:29 +0200 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <200808191624.29418.bekesa@sch.bme.hu> > Is this a bug? > > 4> ets:insert(testtable, bar). > ** exception error: bad argument > in function ets:insert/2 > called as ets:insert(testtable,bar) > 5> ets:tab2list(testtable). > ** exception error: bad argument > in function ets:match_object/2 > called as ets:match_object(testtable,'_') > in call from ets:tab2list/1 Each ETS table has an owner process. The owner is the process that created the table. The table is automatically deleted when the owner quits. The owner of your table was the shell process which crashed with badarg. The shell automatically created a new shell process for you, but the table was gone with the previous shell process. Georgy From Woolla_T@REDACTED Tue Aug 19 16:17:45 2008 From: Woolla_T@REDACTED (Trevor Woollacott [ MTN - Innovation Centre ]) Date: Tue, 19 Aug 2008 16:17:45 +0200 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <70D00C33FCD1FD4A860DEAC228277C0C048425FA@MTNMAIL1.mtn.co.za> Hi It's not a bug. The shell crashed when you tried to insert the atom (due to the uncaught exception). This is because you started the ETS table from the shell, so the ETS table is linked to that particular shell process. Try: 1> self(). 2> ets:new(testtable,[set,named_table,private]). 3> ets:insert(testtable, bar). 4> self(). You will notice that the shell's pid's are different at (1) and (4). If you put a "catch" in front of the ets:insert at (3) it will catch the exception and the shell will not crash. Regards, Trevor -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Colm Dougan Sent: Tuesday, 19 August 2008 03:34 PM To: erlang-questions@REDACTED Subject: [erlang-questions] Possible bug after ets:insert exception Hi, I'm running 12B-3. Below is a console session. Everything worked as expected until "4>" where I unintentionally provided an atom in my insert and I get a bad arg. Again that was expected. What I didn't expect, however, was that from then on the ets table seemed to be in a bad state and couldn't be queried. I realise this is an edge case. Is this a bug? Colm Eshell V5.6.3 (abort with ^G) 1> ets:new(testtable,[set,named_table,private]). testtable 2> ets:insert(testtable, [{foo, 10}]). true 3> ets:tab2list(testtable). [{foo,10}] 4> ets:insert(testtable, bar). ** exception error: bad argument in function ets:insert/2 called as ets:insert(testtable,bar) 5> ets:tab2list(testtable). ** exception error: bad argument in function ets:match_object/2 called as ets:match_object(testtable,'_') in call from ets:tab2list/1 _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 From Reddy_P@REDACTED Tue Aug 19 16:16:57 2008 From: Reddy_P@REDACTED (Primanathan Reddy [ MTN - Innovation Centre ]) Date: Tue, 19 Aug 2008 16:16:57 +0200 Subject: [erlang-questions] Possible bug after ets:insert exception In-Reply-To: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> References: <24d4f39c0808190633t2ed0e895r2cc3725eb022a88c@mail.gmail.com> Message-ID: <9D5D0FF2FC2E5C47A1A54047C271BE490359DB40@MTNMAIL1.mtn.co.za> Hi Colm It is not a bug. You crashed the shell(Owner of the table) at 4> See Below: 6> ets:tab2list(testtable). [{foo,10}] 7> 7> catch ets:insert(testtable, bar). {'EXIT',{badarg,[{ets,insert,[testtable,bar]}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]}} 8> 8> ets:tab2list(testtable). [{foo,10}] 9> self(). <0.34.0> 10> ets:insert(testtable, bar). =ERROR REPORT==== 19-Aug-2008::16:13:15 === Error in process <0.34.0> with exit value: {badarg,[{ets,insert,[testtable,bar]} ,{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarg,[{ets,insert,[testtable,bar]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** 11> self(). <0.42.0> 12> Regards Primanathan Reddy -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Colm Dougan Sent: Tuesday, 19 August 2008 03:34 PM To: erlang-questions@REDACTED Subject: [erlang-questions] Possible bug after ets:insert exception Hi, I'm running 12B-3. Below is a console session. Everything worked as expected until "4>" where I unintentionally provided an atom in my insert and I get a bad arg. Again that was expected. What I didn't expect, however, was that from then on the ets table seemed to be in a bad state and couldn't be queried. I realise this is an edge case. Is this a bug? Colm Eshell V5.6.3 (abort with ^G) 1> ets:new(testtable,[set,named_table,private]). testtable 2> ets:insert(testtable, [{foo, 10}]). true 3> ets:tab2list(testtable). [{foo,10}] 4> ets:insert(testtable, bar). ** exception error: bad argument in function ets:insert/2 called as ets:insert(testtable,bar) 5> ets:tab2list(testtable). ** exception error: bad argument in function ets:match_object/2 called as ets:match_object(testtable,'_') in call from ets:tab2list/1 _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 From bekesa@REDACTED Tue Aug 19 17:39:22 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Tue, 19 Aug 2008 17:39:22 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> References: <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> Message-ID: <200808191739.22300.bekesa@sch.bme.hu> > -pure([f/n,...]). > directive, such as NU Prolog had. > This would make a verifiable claim that the function(s) named would > only call functions that are themselves pure What happens if a pure function calls a function that is not pure? I mean, the compiler just can't check it. Of course it can check local functions, but a function in another module can not be trusted. It might be pure at the time of compilation, but it might be impure in its next version. It could only be checked in runtime, throwing an exception whenever an impure function is called from a pure one. Georgy From rick.richardson@REDACTED Tue Aug 19 18:46:23 2008 From: rick.richardson@REDACTED (rick) Date: Tue, 19 Aug 2008 09:46:23 -0700 (PDT) Subject: [erlang-questions] Erlounge NYC? Message-ID: On the subject of a seperate thread to discuss this. There is a small, slightly active nyc erlang group: http://groups.google.com/group/nycerlang I am travelling until the end of August, but would love to get together after that. -- Rick From ulf.wiger@REDACTED Tue Aug 19 18:59:47 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 19 Aug 2008 18:59:47 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <200808191739.22300.bekesa@sch.bme.hu> References: <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> <200808191739.22300.bekesa@sch.bme.hu> Message-ID: <48AAFC03.2080002@ericsson.com> Andras Georgy Bekes skrev: >> -pure([f/n,...]). >> directive, such as NU Prolog had. >> This would make a verifiable claim that the function(s) named would >> only call functions that are themselves pure > What happens if a pure function calls a function that is not pure? > > I mean, the compiler just can't check it. Of course it can check local > functions, but a function in another module can not be trusted. It > might be pure at the time of compilation, but it might be impure in its > next version. Yes, so cross-module calls cannot be allowed in a pure function, at least unless we find a way to statically group modules together. BR, Ulf W From dmercer@REDACTED Tue Aug 19 20:30:26 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 19 Aug 2008 13:30:26 -0500 Subject: [erlang-questions] How to get the line number of currentexecutable code? In-Reply-To: <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com><2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz><3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> Message-ID: <013501c90229$a863d780$f21ea8c0@SSI.CORP> Richard A. O'Keefe wrote: > > I have also dreamed of a > -pure([f/n,...]). > directive, such as NU Prolog had. > This would make a verifiable claim that the function(s) named would > only call functions that are themselves pure, and a promise that if > any exception would be raised in a call to such a function it would > not matter which exception. For those of us not well-versed in NU Prolog, what is the benefit of this? Please advise. Thank-you. David From kevin@REDACTED Tue Aug 19 20:50:12 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Tue, 19 Aug 2008 11:50:12 -0700 Subject: [erlang-questions] How to get the line number of currentexecutable code? In-Reply-To: <013501c90229$a863d780$f21ea8c0@SSI.CORP> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com><2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz><3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> <013501c90229$a863d780$f21ea8c0@SSI.CORP> Message-ID: <5DCFF48F-3D0B-4CC0-A2BA-F886353B54DC@scaldeferri.com> On Aug 19, 2008, at 11:30 AM, David Mercer wrote: > Richard A. O'Keefe wrote: >> >> I have also dreamed of a >> -pure([f/n,...]). >> directive, such as NU Prolog had. >> This would make a verifiable claim that the function(s) named would >> only call functions that are themselves pure, and a promise that if >> any exception would be raised in a call to such a function it would >> not matter which exception. > > For those of us not well-versed in NU Prolog, what is the benefit of > this? > Please advise. Thank-you. The compiler can perform optimizations which might otherwise not be possible. For example, various sorts of loop fusion optimizations are provably safe for pure functions. -kevin From nick@REDACTED Tue Aug 19 21:08:41 2008 From: nick@REDACTED (Nick Gerakines) Date: Tue, 19 Aug 2008 12:08:41 -0700 Subject: [erlang-questions] Reminder: Erlounge @ Yahoo Message-ID: Just a reminder that on Thursday, August 21st from 6:00 pm to 8:00 pm there will be an Erlounge at Yahoo's main campus in the Silicon Valley. Come meet fellow Erlang developers and learn more about what people are working on. The actual event will take place in the main cafeteria and drinks and light snacks will be provided. Address: Yahoo's Sunnyvale Campus, 701 1st Ave, Sunnyvale, CA 94089, USA Parking/Campus Map: http://www.flickr.com/photos/sock/2779073340/ Upcoming: http://upcoming.yahoo.com/event/977428 Please contact me, Nick Gerakines , for more information and/or directions. A quick email letting me know that you are coming would be appreciated. So far about 20 people have RSVP'd. # Nick Gerakines From dawsdesign@REDACTED Tue Aug 19 21:32:21 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Tue, 19 Aug 2008 15:32:21 -0400 Subject: [erlang-questions] Erlounge NYC? In-Reply-To: References: Message-ID: Thanks for the tip. On Tue, Aug 19, 2008 at 12:46 PM, rick wrote: > On the subject of a seperate thread to discuss this. > > There is a small, slightly active nyc erlang group: > http://groups.google.com/group/nycerlang > > I am travelling until the end of August, but would love to get > together after that. > > -- Rick > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Aug 20 07:13:34 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 20 Aug 2008 17:13:34 +1200 Subject: [erlang-questions] javascript . notation to fetch objects from JSON decode_string/1 In-Reply-To: <19045429.post@talk.nabble.com> References: <18962077.post@talk.nabble.com> <142379DA-19AA-4248-B222-A50C42CFC41A@cs.otago.ac.nz> <19045429.post@talk.nabble.com> Message-ID: <6066D78C-AD26-4A47-9776-C9499F340B25@cs.otago.ac.nz> On 19 Aug 2008, at 7:15 pm, Bharani wrote: > > Pattern matching is OK if you have a small string. Actually, that's not the main issue. The thing that makes pattern matching less useful with JSON terms is that - there may be more "fields" in an "object" than you were expecting - the order in which the "fields" of an "object" are returned may not be predictable. > Then again > JSON is for javascript and not Erlang - i am just trying to find out > the > best approach. I am currently trying to learn AppleScript. I was enchanted to discover that it uses {1, 2, 3, 4} for a "list" of 4 numbers, and {foo: 1, ping: 2, whatever: 3, stuff: 4} for a "record". Modulo the brackets, JSON makes sense for AppleScript too. What we *really* want to turn JSON "objects" into is what I've called "frames" = what Joe Armstrong called "proper structs", and for those, pattern matching *would* work. Of course large patterns are no more readable than large anythings. From alpar@REDACTED Wed Aug 20 07:26:00 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Wed, 20 Aug 2008 07:26:00 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <48AAB109.9060808@gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> <48AAB109.9060808@gmail.com> Message-ID: <1219209960.3739.1.camel@piko.site> Hi, As I recall, someone noted on that thread that timer:sleep() works well for arbitrarily large numbers. Now I looked at the source and found that this is _not_ true. Strangely enough, all the functions of the timer modules seem to work correctly with large numbers _except_ timer:sleep() which has a definition as simple as this: sleep(T) -> receive after T -> ok end. It might be worth fixing. > 1. 2^32 (this is what's documented, but only seems to work in the shell) > 2. 2^32-1 = 49.5 days > 3. Erlang's small integers (2^27-1 = 1.5 days) 4. timer.erl says this: -define(MAX_TIMEOUT, 16#0800000). Best regards, Alpar From ok@REDACTED Wed Aug 20 07:44:33 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 20 Aug 2008 17:44:33 +1200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <200808191739.22300.bekesa@sch.bme.hu> References: <3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> <200808191739.22300.bekesa@sch.bme.hu> Message-ID: On 20 Aug 2008, at 3:39 am, Andras Georgy Bekes wrote: >> -pure([f/n,...]). >> directive, such as NU Prolog had. >> This would make a verifiable claim that the function(s) named would >> only call functions that are themselves pure > What happens if a pure function calls a function that is not pure? > > I mean, the compiler just can't check it. Yes it can. That's the whole POINT of -pure declarations. The NU Prolog system *could* and *did* check this. > Of course it can check local > functions, but a function in another module can not be trusted. Cannot be trusted? Sure it can. You haven't seen a complete proposal, because I have other maddened grizzly bears to stun, but the idea is that - the meta-data for a module records which exported functions are pure and which are not - when the compiler notes a pure function calling a function from another module, it records a dependency on that function being exported as pure - when a module is loaded, the run time system checks that every function it tries to import as pure from some other module IS pure if that module is already loaded, every module that depends on this one exporting some function(s) as pure is satisfied. If either check fails, the module is not loaded. This takes care of the "another module" issue. The tricky one is higher order functions. I actually came up with this idea back shortly before 'funs' were added to the language, and dropped it when they came in. There are basically two ways out: one is to say that a pure function can't be or call a higher order function, and the other is to use some sort of type system. From ok@REDACTED Wed Aug 20 07:59:49 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 20 Aug 2008 17:59:49 +1200 Subject: [erlang-questions] How to get the line number of currentexecutable code? In-Reply-To: <013501c90229$a863d780$f21ea8c0@SSI.CORP> References: <039CC9D1-4FCF-44EE-A893-9C031D8FA8D0@scaldeferri.com><2AF5E405-861D-4233-B97F-536BF2484BA0@cs.otago.ac.nz><3dbc6d1c0808180559p468a8317w1fea57b982eda52a@mail.gmail.com> <9893A882-EB2F-4C2D-A322-EB01F3EA564D@cs.otago.ac.nz> <013501c90229$a863d780$f21ea8c0@SSI.CORP> Message-ID: <85BE09E2-5936-464F-B541-D45A67C2CD22@cs.otago.ac.nz> On 20 Aug 2008, at 6:30 am, David Mercer wrote: > For those of us not well-versed in NU Prolog, what is the benefit of [-pure] > this? This was implicit in the original context: "Haskell can do heavy duty optimisation that Erlang can't". "Yes, but Haskell is pure, and Erlang isn't." "Yes, but with functions declared to be -pure, Erlang could do better than it does." From bgustavsson@REDACTED Wed Aug 20 11:59:26 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Wed, 20 Aug 2008 11:59:26 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <20080819074235.GA3092@contorpis.lisalinda.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> Message-ID: <6672d0160808200259j7c4098d0ubb74e13b633254b@mail.gmail.com> On Tue, Aug 19, 2008 at 9:42 AM, Matthias Lang wrote: > > This may be the thread you remember, it starts here: > > > http://www.erlang.org/pipermail/erlang-questions/2008-February/032609.html > > Executive summary: In R11B-2, a timeout of 16#ffffFFFF doesn't work as > expected on a 32-bit machine. Something changed between R11B-2 and > R11B-5 which made it work in the shell, but still not in compiled > code. I haven't noticed anything in the release notes saying it's > been fixed for real. > Actually, a value of 16#ffffFFFF sometimes works, sometimes doesn't. It has nothing to do with whether it is executed from the shell or from compiled code. The problem is an integer overflow. We will include a correction in R12B-4. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Wed Aug 20 12:33:51 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 06:33:51 -0400 Subject: [erlang-questions] max timeout In-Reply-To: <1219209960.3739.1.camel@piko.site> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> <48AAB109.9060808@gmail.com> <1219209960.3739.1.camel@piko.site> Message-ID: <48ABF30F.1070803@gmail.com> Alp?r J?ttner wrote: > Hi, > > As I recall, someone noted on that thread that timer:sleep() works well > for arbitrarily large numbers. > > Now I looked at the source and found that this is _not_ true. Strangely > enough, all the functions of the timer modules seem to work correctly > with large numbers _except_ timer:sleep() which has a definition as > simple as this: > > sleep(T) -> > receive > after T -> ok > end. This is the reason why in this thread I was questioning the max timeout of the receive statement as opposed to timer:sleep/1 implemented in bytecode. ;-) > It might be worth fixing. > >> 1. 2^32 (this is what's documented, but only seems to work in the shell) >> 2. 2^32-1 = 49.5 days >> 3. Erlang's small integers (2^27-1 = 1.5 days) > > 4. timer.erl says this: > -define(MAX_TIMEOUT, 16#0800000). Though, if you look at the use of this define in timer.erl, it's there merely to prevent the cleanup loop of already timed-out timers from dealing with bignums, so it doesn't quite tell us about the intended design of the receive statement. Regards, Serge From saleyn@REDACTED Wed Aug 20 12:38:59 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 06:38:59 -0400 Subject: [erlang-questions] max timeout In-Reply-To: <6672d0160808200259j7c4098d0ubb74e13b633254b@mail.gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> <6672d0160808200259j7c4098d0ubb74e13b633254b@mail.gmail.com> Message-ID: <48ABF443.8010108@gmail.com> So, does this mean that #1 below is indeed the right answer and that 'receve after' implementation correctly deals with bignums between 2^27 and 2^32? 1. 2^32 (this is what's documented, but only seems to work in the shell) 2. 2^32-1 = 49.5 days 3. Erlang's small integers (2^27-1 = 1.5 days) Bjorn Gustavsson wrote: > On Tue, Aug 19, 2008 at 9:42 AM, Matthias Lang wrote: > >> This may be the thread you remember, it starts here: >> >> >> http://www.erlang.org/pipermail/erlang-questions/2008-February/032609.html >> >> Executive summary: In R11B-2, a timeout of 16#ffffFFFF doesn't work as >> expected on a 32-bit machine. Something changed between R11B-2 and >> R11B-5 which made it work in the shell, but still not in compiled >> code. I haven't noticed anything in the release notes saying it's >> been fixed for real. >> > > Actually, a value of 16#ffffFFFF sometimes works, sometimes doesn't. It has > nothing to do with whether it is executed from the shell or from compiled > code. > > The problem is an integer overflow. We will include a correction in R12B-4. > > /Bjorn > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From B.Candler@REDACTED Wed Aug 20 12:46:37 2008 From: B.Candler@REDACTED (Brian Candler) Date: Wed, 20 Aug 2008 11:46:37 +0100 Subject: [erlang-questions] Systematic debugging (ssh_sample_cli) Message-ID: <20080820104637.GA13500@uk.tiscali.com> I have been trying to get the ssh_sample_cli application to run. This is with R11B5 from Ubuntu Hardy. I copied the ssh_sample_cli.erl to a local directory, and it appears to compile and start: 1> c(ssh_sample_cli). ./ssh_sample_cli.erl:128: Warning: this expression would cause a 'badarith' exception at run-time {ok,ssh_sample_cli} 2> crypto:start(). ok 3> ssh_sample_cli:listen(2222). {ok,<0.46.0>} 4> However when I try to "ssh -p 2222 localhost help" from another terminal, the client sees the connection drop, and the erlang shell shows =ERROR REPORT==== 20-Aug-2008::11:01:12 === ** Generic server <0.50.0> terminating ** Last message in was {'EXIT',<0.47.0>,{error,eacces}} ** When Server state == {state,server, <0.47.0>, 16, [], [{<0.51.0>,#Ref<0.0.0.213>}], 0, [], [], undefined} ** Reason for termination == ** {error,eacces} I get a similar error if I try the ssh_sshd example from http://www.erlang.org/doc/man/ssh_sshd.html Eshell V5.5.5 (abort with ^G) 1> crypto:start(). ok 2> ssh_sshd:listen(9999, [{system_dir, "."}]). {ok,<0.41.0>} 3> =ERROR REPORT==== 20-Aug-2008::11:06:32 === ** Generic server <0.45.0> terminating ** Last message in was {'EXIT',<0.42.0>,{error,enoent}} ** When Server state == {state,server, <0.42.0>, 16, [], [{<0.46.0>,#Ref<0.0.0.94>}], 0, [{system_dir,"."}], [], undefined} ** Reason for termination == ** {error,enoent} Now, clearly I've missed some step. The eacces/enoent suggests to me that it's something to do with the filesystem. (*) But my question is really this: how should I go about debugging a problem like this in a systematic way? That is, how do I interpret the error messages given above, or get more detail? At the moment I cannot see how to determine which function the error occurred in, nor the filename or line number. If I could see which function raised this error, and/or its arguments and in what context it was called, it would probably be very clear what the problem was. Thanks, Brian. (*) After reading the ssh_sshd documentation more carefully, I see that system_dir is where the ssh host key is expected to be found. I have been able to fix the problem by "ssh-keygen -t dsa -f ssh_host_dsa_key" in the same dir to make a new ssh host key. But I still want to learn how to isolate problems like this systematically, rather than by guesswork. Any pointers to documentation on how to do this would be appreciated. From matthias@REDACTED Wed Aug 20 13:23:54 2008 From: matthias@REDACTED (Matthias Lang) Date: Wed, 20 Aug 2008 13:23:54 +0200 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <226d73360808182258q18f6694dr46c5221ff140b6a0@mail.gmail.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> <20080818094803.GA22078@contorpis.lisalinda.com> <3dbc6d1c0808180457x32b646ccldbe3cfd0fe8d3b93@mail.gmail.com> <226d73360808182258q18f6694dr46c5221ff140b6a0@mail.gmail.com> Message-ID: <20080820112354.GA7881@contorpis.lisalinda.com> On Tuesday, August 19, Ulises wrote: > I know this is not a CS list however I'll dare and post my solution to > the smokers problem in Erlang. Could anybody tell me if it's correct? It looks correct to me*, though you can probably argue forever over whether the two conditions are met or not. Two comments: - If you spawn like this: spawn(fun() -> smoker(tobacco) end) then you don't need to export smoker/1 and thus probably don't need to use export_all. Opinions differ over whether export_all is "usually bad" or not, but most people agree that spawning via funs is a good idea. - Registering processes is something I do sparingly. I would have started the arbiter with a list of smoker PIDs instead of registering the smokers. - Telling the smokers what they're supplying but then not using that atom is suspect. In your solution it doesn't matter, but you'd catch one more potential bug by actually keeping track of ingredients, i.e. * arbiter doesn't just count ingredients, it collects a list of ingredients (you include the Item atom in the message) * The {table_full, self()} message includes the list, i.e. {table_full, Items, self()} * The smoker's receive clause checks that it really has all the items, for instance receive {table_full, Items, Arbiter} -> [] = [match, paper, tobacco] -- [Item|Items], ... Specifically, you would have noticed your tobbacco [sic] typo. > While we're at it, how would you go about checking that a particular > solution is actually correct for the problem being solved, i.e. how > can I systematically check that my code is _right_? You say "systematically", so you're really providing the answer yourself. The field of "formal methods" is where you find all the people who are into systematically checking things. There are various people around who have done that specifically with Erlang, the two active groups I'm aware of are http://www.chalmers.se/cse/EN/research/research-groups/formal-methods/ and http://www.dcs.shef.ac.uk/~qiang/forse/forse.htm Matt * But: my opinion isn't worth much. I'm often rash and careless. I do things like write "Two comments" and then provide three. Thomas Arts once used model checking methods to examine a part of the control system for some hardware I work on. I was completely confident it was bug-free: I wrote it on a day where I turned off my mobile phone and shut the door. And it had a good test suite. And it'd been running in thousands of switches all over the world, in hospitals and in nuclear reactors, for years, and never failed. It's A-grade premium battle-tested code with a gold star. Thomas and his model checker found a bug, of course, otherwise I wouldn't have bothered recounting this. My ego was on life support until I managed to show that the bug, like your tobbacco spelling, didn't matter. ;-) From dawsdesign@REDACTED Wed Aug 20 15:16:23 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 20 Aug 2008 09:16:23 -0400 Subject: [erlang-questions] Need help with simple_one_for_one Message-ID: Hello, I am starting a gen_fsm with supervisor:start_child(erlfs_store_worker_sup, {store_chunk, Chunk}) but I get the following error: {error, {'EXIT', {badarg, [{erlang, apply, [erlfs_store_worker_fsm, start_link, {store_chunk, {chunk, {chunk_meta, {file_meta, "test123", "test.txt", 0, "text/plain", {{0,1,1},{0,0,0}}}, 0, 0, []}, <<"Hello world!">>}}]}, {supervisor,do_start_child_i,3}, {supervisor,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}}} I've been trying to figure it out for a while, but I am having a hard time. Here is the Child Spec in the supervisor (erlfs_store_worker_sup): init(Args) -> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, start_link, []}, temporary, 2000, worker, [erlfs_store_worker_fsm]}, {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulises.cervino@REDACTED Wed Aug 20 15:17:30 2008 From: ulises.cervino@REDACTED (Ulises) Date: Wed, 20 Aug 2008 14:17:30 +0100 Subject: [erlang-questions] help with smoker's problem In-Reply-To: <20080820112354.GA7881@contorpis.lisalinda.com> References: <1e8d59210808121807w4cbdf56ete2cf0a17c788e73@mail.gmail.com> <20080818094803.GA22078@contorpis.lisalinda.com> <3dbc6d1c0808180457x32b646ccldbe3cfd0fe8d3b93@mail.gmail.com> <226d73360808182258q18f6694dr46c5221ff140b6a0@mail.gmail.com> <20080820112354.GA7881@contorpis.lisalinda.com> Message-ID: <226d73360808200617s3bea8dd1t52178a6b8d1adaca@mail.gmail.com> > The field of "formal methods" is where you find all the people who are into > systematically checking things. There are various people around who have > done that specifically with Erlang, the two active groups I'm aware of > are > > http://www.chalmers.se/cse/EN/research/research-groups/formal-methods/ > > and > > http://www.dcs.shef.ac.uk/~qiang/forse/forse.htm Good stuff on the formal methods groups. I did a formal methods course during my undergrad which was quite interesting to say the least. My question however was somewhat mispelled (I can only blame me for that though!). I guess I should've asked if there is any documentation or other kind of info on reading Erlang error messages and the likes (much like one of the last messages by Brian on the SSH thread). I do realise that getting the line of code that produced the error might not be possible to get at all however deciphering the message would already by a big step ahead. On the getting started document all I could see was a message along the lines of "the more you read the more you'll get used to them and the better you'll become at spotting problems". > Thomas Arts once used model checking methods to examine a part of > the control system for some hardware I work on. I was completely > confident it was bug-free: I wrote it on a day where I turned off > my mobile phone and shut the door. And it had a good test > suite. And it'd been running in thousands of switches all over the > world, in hospitals and in nuclear reactors, for years, and never > failed. It's A-grade premium battle-tested code with a gold star. > > Thomas and his model checker found a bug, of course, otherwise > I wouldn't have bothered recounting this. My ego was on life support > until I managed to show that the bug, like your tobbacco spelling, > didn't matter. ;-) Nice war story!!! :) Mine would go along the lines of: one day I tried to solve the smoker's problem in Erlang. I sent the code to the mailing list and a guy spotted at least 2 bugs and a few undesirable coding habits ... all in less than 50 lines of code. Unfortunately my war story doesn't have such a happy ending!!! :D Best and thanks for the info. U From saleyn@REDACTED Wed Aug 20 15:31:10 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 09:31:10 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: Message-ID: <48AC1C9E.9000809@gmail.com> Try starting it as: supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) The simple_one_for_one strategy appends the arguments passed to supervisor:start_child/2 to the list of args specified in the supervisor's spec. Serge Matt Williamson wrote: > Hello, > > I am starting a gen_fsm with supervisor:start_child(erlfs_store_worker_sup, > {store_chunk, Chunk}) but I get the following error: > > {error, > {'EXIT', > {badarg, > [{erlang, > apply, > [erlfs_store_worker_fsm, > start_link, > {store_chunk, > {chunk, > {chunk_meta, > {file_meta, > "test123", > "test.txt", > 0, > "text/plain", > {{0,1,1},{0,0,0}}}, > 0, > 0, > []}, > <<"Hello world!">>}}]}, > {supervisor,do_start_child_i,3}, > {supervisor,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]}}} > > I've been trying to figure it out for a while, but I am having a hard time. > Here is the Child Spec in the supervisor (erlfs_store_worker_sup): > > init(Args) -> > WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, > start_link, []}, > temporary, 2000, worker, [erlfs_store_worker_fsm]}, > {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dawsdesign@REDACTED Wed Aug 20 15:33:48 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 20 Aug 2008 09:33:48 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: <48AC1C9E.9000809@gmail.com> References: <48AC1C9E.9000809@gmail.com> Message-ID: I'm afraid that did not work. I am passing an empty list, and if I execute [] ++ 1 in the shell I get 1. On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov wrote: > Try starting it as: > > supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) > > The simple_one_for_one strategy appends the arguments passed to > supervisor:start_child/2 to the list of args specified in the supervisor's > spec. > > Serge > > Matt Williamson wrote: > >> Hello, >> >> I am starting a gen_fsm with >> supervisor:start_child(erlfs_store_worker_sup, >> {store_chunk, Chunk}) but I get the following error: >> >> {error, >> {'EXIT', >> {badarg, >> [{erlang, >> apply, >> [erlfs_store_worker_fsm, >> start_link, >> {store_chunk, >> {chunk, >> {chunk_meta, >> {file_meta, >> "test123", >> "test.txt", >> 0, >> "text/plain", >> {{0,1,1},{0,0,0}}}, >> 0, >> 0, >> []}, >> <<"Hello world!">>}}]}, >> {supervisor,do_start_child_i,3}, >> {supervisor,handle_call,3}, >> {gen_server,handle_msg,6}, >> {proc_lib,init_p,5}]}}} >> >> I've been trying to figure it out for a while, but I am having a hard >> time. >> Here is the Child Spec in the supervisor (erlfs_store_worker_sup): >> >> init(Args) -> >> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, >> start_link, []}, >> temporary, 2000, worker, [erlfs_store_worker_fsm]}, >> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Wed Aug 20 15:54:34 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 09:54:34 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: <48AC1C9E.9000809@gmail.com> Message-ID: <48AC221A.9050701@gmail.com> What is the arity of erlfs_store_worker_fsm:start_link function? Not quite sure what you mean by [] ++ 1 below. The supervisor:start_child/2 takes a list [term()] as the second parameter. Here's its docs: "If the case of a simple_one_for_one supervisor, the child specification defined in Module:init/1 will be used and ChildSpec should instead be an arbitrary list of terms List. The child process will then be started by appending List to the existing start function arguments, i.e. by calling apply(M, F, A++List) where {M,F,A} is the start function defined in the child specification." Note the A++List part. Matt Williamson wrote: > I'm afraid that did not work. I am passing an empty list, and if I execute > [] ++ 1 in the shell I get 1. > > On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov wrote: > >> Try starting it as: >> >> supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) >> >> The simple_one_for_one strategy appends the arguments passed to >> supervisor:start_child/2 to the list of args specified in the supervisor's >> spec. >> >> Serge >> >> Matt Williamson wrote: >> >>> Hello, >>> >>> I am starting a gen_fsm with >>> supervisor:start_child(erlfs_store_worker_sup, >>> {store_chunk, Chunk}) but I get the following error: >>> >>> {error, >>> {'EXIT', >>> {badarg, >>> [{erlang, >>> apply, >>> [erlfs_store_worker_fsm, >>> start_link, >>> {store_chunk, >>> {chunk, >>> {chunk_meta, >>> {file_meta, >>> "test123", >>> "test.txt", >>> 0, >>> "text/plain", >>> {{0,1,1},{0,0,0}}}, >>> 0, >>> 0, >>> []}, >>> <<"Hello world!">>}}]}, >>> {supervisor,do_start_child_i,3}, >>> {supervisor,handle_call,3}, >>> {gen_server,handle_msg,6}, >>> {proc_lib,init_p,5}]}}} >>> >>> I've been trying to figure it out for a while, but I am having a hard >>> time. >>> Here is the Child Spec in the supervisor (erlfs_store_worker_sup): >>> >>> init(Args) -> >>> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, >>> start_link, []}, >>> temporary, 2000, worker, [erlfs_store_worker_fsm]}, >>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > From dawsdesign@REDACTED Wed Aug 20 17:20:47 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 20 Aug 2008 11:20:47 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> Message-ID: Serge, you are absolutely correct. My apologies. I was wrapping brackets around an element in the tuple instead of the whole tuple. I have a new error which I am looking into. {error, {function_clause, [{erlfs_store_worker_fsm, init, [{store_chunk, {chunk, {chunk_meta, {file_meta, "test123", "test.txt", 0, "text/plain", {{0,1,1},{0,0,0}}}, 0, 0, []}, <<"Hello world!">>}}]}, {gen_fsm,init_it,6}, {proc_lib,init_p,5}]}} On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov wrote: > The error you reported earlier: > > {'EXIT', {badarg, [{erlang, apply, > [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} > > was a clear indication that erlang:apply(M,F,A) was called with A being a > tuple rather than a list. If this still doesn't work after replacing tuple > with a list in the second argument of the supervisor:start_child/2 call, > this means that you probably have other issues in the > erlfs_store_worker_fsm:start_link/1 itself. > > I can't say anything more without seeing a more detailed error report. > > Serge > > > Matt Williamson wrote: > >> Yes, I saw that in the docs. What I was saying is that calling apply(M, F, >> A++List) =:= apply(M, F, List) when A =:= []. >> >> I did try your suggestion anyway with the same results. >> >> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >> wrote: >> >> What is the arity of erlfs_store_worker_fsm:start_link function? >>> >>> Not quite sure what you mean by [] ++ 1 below. >>> >>> The supervisor:start_child/2 takes a list [term()] as the second >>> parameter. >>> Here's its docs: >>> >>> "If the case of a simple_one_for_one supervisor, the child specification >>> defined in Module:init/1 will be used and ChildSpec should instead be an >>> arbitrary list of terms List. The child process will then be started by >>> appending List to the existing start function arguments, i.e. by calling >>> apply(M, F, A++List) where {M,F,A} is the start function defined in the >>> child specification." >>> >>> Note the A++List part. >>> >>> >>> Matt Williamson wrote: >>> >>> I'm afraid that did not work. I am passing an empty list, and if I >>>> execute >>>> [] ++ 1 in the shell I get 1. >>>> >>>> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >>>> wrote: >>>> >>>> Try starting it as: >>>> >>>>> supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) >>>>> >>>>> The simple_one_for_one strategy appends the arguments passed to >>>>> supervisor:start_child/2 to the list of args specified in the >>>>> supervisor's >>>>> spec. >>>>> >>>>> Serge >>>>> >>>>> Matt Williamson wrote: >>>>> >>>>> Hello, >>>>> >>>>>> I am starting a gen_fsm with >>>>>> supervisor:start_child(erlfs_store_worker_sup, >>>>>> {store_chunk, Chunk}) but I get the following error: >>>>>> >>>>>> {error, >>>>>> {'EXIT', >>>>>> {badarg, >>>>>> [{erlang, >>>>>> apply, >>>>>> [erlfs_store_worker_fsm, >>>>>> start_link, >>>>>> {store_chunk, >>>>>> {chunk, >>>>>> {chunk_meta, >>>>>> {file_meta, >>>>>> "test123", >>>>>> "test.txt", >>>>>> 0, >>>>>> "text/plain", >>>>>> {{0,1,1},{0,0,0}}}, >>>>>> 0, >>>>>> 0, >>>>>> []}, >>>>>> <<"Hello world!">>}}]}, >>>>>> {supervisor,do_start_child_i,3}, >>>>>> {supervisor,handle_call,3}, >>>>>> {gen_server,handle_msg,6}, >>>>>> {proc_lib,init_p,5}]}}} >>>>>> >>>>>> I've been trying to figure it out for a while, but I am having a hard >>>>>> time. >>>>>> Here is the Child Spec in the supervisor (erlfs_store_worker_sup): >>>>>> >>>>>> init(Args) -> >>>>>> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, >>>>>> start_link, []}, >>>>>> temporary, 2000, worker, [erlfs_store_worker_fsm]}, >>>>>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>>> >>>>>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Wed Aug 20 18:51:12 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 20 Aug 2008 12:51:12 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: <48AC3289.205@gmail.com> References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> Message-ID: I hate to keep bugging with simple problems, but I'm stuck again. My FSM dosn't seem to be executing its first state. Here is my init function: *init(StartArgs) -> InitialState = case StartArgs of {store_chunk, Chunk} -> io:format("FSM Storing chunk...~n"), {ok, storing_chunk, [Chunk]}; {get_chunk, Args} -> {ok, getting_chunk, Args}; Else -> %% @todo Add error logging here. io:format("Bad arg for FSM: ~p~n", [StartArgs]) end, io:format("FSM Initial State: ~p~n", [InitialState]), InitialState.* storing_chunk/2 is exported and I'm not getting any errors. Here is that function: *storing_chunk(_Event, [Chunk]) -> io:format("STATE: storing_chunk~n"), case erlfs_store_lib:store_chunk() of ok -> {next_state, notifying_tracker, Chunk}; {error, Reason} -> %% @todo Add error logging here. io:format("FSM Stopped: ~p~n", [Reason]), {stop, {file, Reason}, Chunk#chunk.chunk_meta} end.* On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov wrote: > The error you reported earlier: > > {'EXIT', {badarg, [{erlang, apply, > [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} > > was a clear indication that erlang:apply(M,F,A) was called with A being a > tuple rather than a list. If this still doesn't work after replacing tuple > with a list in the second argument of the supervisor:start_child/2 call, > this means that you probably have other issues in the > erlfs_store_worker_fsm:start_link/1 itself. > > I can't say anything more without seeing a more detailed error report. > > Serge > > > Matt Williamson wrote: > >> Yes, I saw that in the docs. What I was saying is that calling apply(M, F, >> A++List) =:= apply(M, F, List) when A =:= []. >> >> I did try your suggestion anyway with the same results. >> >> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >> wrote: >> >> What is the arity of erlfs_store_worker_fsm:start_link function? >>> >>> Not quite sure what you mean by [] ++ 1 below. >>> >>> The supervisor:start_child/2 takes a list [term()] as the second >>> parameter. >>> Here's its docs: >>> >>> "If the case of a simple_one_for_one supervisor, the child specification >>> defined in Module:init/1 will be used and ChildSpec should instead be an >>> arbitrary list of terms List. The child process will then be started by >>> appending List to the existing start function arguments, i.e. by calling >>> apply(M, F, A++List) where {M,F,A} is the start function defined in the >>> child specification." >>> >>> Note the A++List part. >>> >>> >>> Matt Williamson wrote: >>> >>> I'm afraid that did not work. I am passing an empty list, and if I >>>> execute >>>> [] ++ 1 in the shell I get 1. >>>> >>>> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >>>> wrote: >>>> >>>> Try starting it as: >>>> >>>>> supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) >>>>> >>>>> The simple_one_for_one strategy appends the arguments passed to >>>>> supervisor:start_child/2 to the list of args specified in the >>>>> supervisor's >>>>> spec. >>>>> >>>>> Serge >>>>> >>>>> Matt Williamson wrote: >>>>> >>>>> Hello, >>>>> >>>>>> I am starting a gen_fsm with >>>>>> supervisor:start_child(erlfs_store_worker_sup, >>>>>> {store_chunk, Chunk}) but I get the following error: >>>>>> >>>>>> {error, >>>>>> {'EXIT', >>>>>> {badarg, >>>>>> [{erlang, >>>>>> apply, >>>>>> [erlfs_store_worker_fsm, >>>>>> start_link, >>>>>> {store_chunk, >>>>>> {chunk, >>>>>> {chunk_meta, >>>>>> {file_meta, >>>>>> "test123", >>>>>> "test.txt", >>>>>> 0, >>>>>> "text/plain", >>>>>> {{0,1,1},{0,0,0}}}, >>>>>> 0, >>>>>> 0, >>>>>> []}, >>>>>> <<"Hello world!">>}}]}, >>>>>> {supervisor,do_start_child_i,3}, >>>>>> {supervisor,handle_call,3}, >>>>>> {gen_server,handle_msg,6}, >>>>>> {proc_lib,init_p,5}]}}} >>>>>> >>>>>> I've been trying to figure it out for a while, but I am having a hard >>>>>> time. >>>>>> Here is the Child Spec in the supervisor (erlfs_store_worker_sup): >>>>>> >>>>>> init(Args) -> >>>>>> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, >>>>>> start_link, []}, >>>>>> temporary, 2000, worker, [erlfs_store_worker_fsm]}, >>>>>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>>> >>>>>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mazen@REDACTED Wed Aug 20 19:00:51 2008 From: mazen@REDACTED (Mazen Harake) Date: Wed, 20 Aug 2008 18:00:51 +0100 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> Message-ID: <48AC4DC3.7030301@erlang-consulting.com> Hi Matt, Sorry this might be a stupid question but did you send it an event? /Mazen Matt Williamson wrote: > I hate to keep bugging with simple problems, but I'm stuck again. My > FSM dosn't seem to be executing its first state. Here is my init function: > > /init(StartArgs) -> > InitialState = case StartArgs of > {store_chunk, Chunk} -> > io:format("FSM Storing chunk...~n"), > {ok, storing_chunk, [Chunk]}; > {get_chunk, Args} -> > {ok, getting_chunk, Args}; > Else -> > %% @todo Add error logging here. > io:format("Bad arg for FSM: ~p~n", [StartArgs]) > end, > io:format("FSM Initial State: ~p~n", [InitialState]), > InitialState./ > > storing_chunk/2 is exported and I'm not getting any errors. Here is > that function: > > /storing_chunk(_Event, [Chunk]) -> > io:format("STATE: storing_chunk~n"), > case erlfs_store_lib:store_chunk() of > ok -> > {next_state, notifying_tracker, Chunk}; > {error, Reason} -> > %% @todo Add error logging here. > io:format("FSM Stopped: ~p~n", [Reason]), > {stop, {file, Reason}, Chunk#chunk.chunk_meta} > end./ > > On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov > wrote: > > The error you reported earlier: > > {'EXIT', {badarg, [{erlang, apply, > [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} > > was a clear indication that erlang:apply(M,F,A) was called with A > being a tuple rather than a list. If this still doesn't work > after replacing tuple with a list in the second argument of the > supervisor:start_child/2 call, this means that you probably have > other issues in the erlfs_store_worker_fsm:start_link/1 itself. > > I can't say anything more without seeing a more detailed error report. > > Serge > > > Matt Williamson wrote: > > Yes, I saw that in the docs. What I was saying is that calling > apply(M, F, > A++List) =:= apply(M, F, List) when A =:= []. > > I did try your suggestion anyway with the same results. > > On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov > > wrote: > > What is the arity of erlfs_store_worker_fsm:start_link > function? > > Not quite sure what you mean by [] ++ 1 below. > > The supervisor:start_child/2 takes a list [term()] as the > second parameter. > Here's its docs: > > "If the case of a simple_one_for_one supervisor, the child > specification > defined in Module:init/1 will be used and ChildSpec should > instead be an > arbitrary list of terms List. The child process will then > be started by > appending List to the existing start function arguments, > i.e. by calling > apply(M, F, A++List) where {M,F,A} is the start function > defined in the > child specification." > > Note the A++List part. > > > Matt Williamson wrote: > > I'm afraid that did not work. I am passing an empty > list, and if I execute > [] ++ 1 in the shell I get 1. > > On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov > > > wrote: > > Try starting it as: > > supervisor:start_child(erlfs_store_worker_sup, > [{store_chunk, Chunk}]) > > The simple_one_for_one strategy appends the > arguments passed to > supervisor:start_child/2 to the list of args > specified in the > supervisor's > spec. > > Serge > > Matt Williamson wrote: > > Hello, > > I am starting a gen_fsm with > supervisor:start_child(erlfs_store_worker_sup, > {store_chunk, Chunk}) but I get the following > error: > > {error, > {'EXIT', > {badarg, > [{erlang, > apply, > > [erlfs_store_worker_fsm, > start_link, > {store_chunk, > {chunk, > > {chunk_meta, > > {file_meta, > > "test123", > > "test.txt", > 0, > > "text/plain", > > {{0,1,1},{0,0,0}}}, > 0, > 0, > []}, > > <<"Hello world!">>}}]}, > > {supervisor,do_start_child_i,3}, > > {supervisor,handle_call,3}, > > {gen_server,handle_msg,6}, > > {proc_lib,init_p,5}]}}} > > I've been trying to figure it out for a while, > but I am having a hard > time. > Here is the Child Spec in the supervisor > (erlfs_store_worker_sup): > > init(Args) -> > WorkerSpec = {erlfs_store_worker_fsm, > {erlfs_store_worker_fsm, > start_link, []}, > temporary, 2000, worker, > [erlfs_store_worker_fsm]}, > {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From saleyn@REDACTED Wed Aug 20 19:03:47 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 13:03:47 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> Message-ID: <48AC4E73.9000100@gmail.com> In your implementation it's possible that the init/1 call returns: {ok, State, StateData} | ok The second return type is not valid (the Else clause in case statement). (I doubt that this is actually the error you are hitting as if the init function is not called it means that you are not starting gen_fsm correctly via gen_fsm:start_link(Module, Args::list(), [])). Also, before you start debugging processes based on gen behaviors enable SASL so that the error reports are more verbose: erl -boot start_sasl Serge Matt Williamson wrote: > I hate to keep bugging with simple problems, but I'm stuck again. My FSM > dosn't seem to be executing its first state. Here is my init function: > > *init(StartArgs) -> > InitialState = case StartArgs of > {store_chunk, Chunk} -> > io:format("FSM Storing chunk...~n"), > {ok, storing_chunk, [Chunk]}; > {get_chunk, Args} -> > {ok, getting_chunk, Args}; > Else -> > %% @todo Add error logging here. > io:format("Bad arg for FSM: ~p~n", [StartArgs]) > end, > io:format("FSM Initial State: ~p~n", [InitialState]), > InitialState.* > > storing_chunk/2 is exported and I'm not getting any errors. Here is that > function: > > *storing_chunk(_Event, [Chunk]) -> > io:format("STATE: storing_chunk~n"), > case erlfs_store_lib:store_chunk() of > ok -> > {next_state, notifying_tracker, Chunk}; > {error, Reason} -> > %% @todo Add error logging here. > io:format("FSM Stopped: ~p~n", [Reason]), > {stop, {file, Reason}, Chunk#chunk.chunk_meta} > end.* > > On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov wrote: > >> The error you reported earlier: >> >> {'EXIT', {badarg, [{erlang, apply, >> [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} >> >> was a clear indication that erlang:apply(M,F,A) was called with A being a >> tuple rather than a list. If this still doesn't work after replacing tuple >> with a list in the second argument of the supervisor:start_child/2 call, >> this means that you probably have other issues in the >> erlfs_store_worker_fsm:start_link/1 itself. >> >> I can't say anything more without seeing a more detailed error report. >> >> Serge >> >> >> Matt Williamson wrote: >> >>> Yes, I saw that in the docs. What I was saying is that calling apply(M, F, >>> A++List) =:= apply(M, F, List) when A =:= []. >>> >>> I did try your suggestion anyway with the same results. >>> >>> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >>> wrote: >>> >>> What is the arity of erlfs_store_worker_fsm:start_link function? >>>> Not quite sure what you mean by [] ++ 1 below. >>>> >>>> The supervisor:start_child/2 takes a list [term()] as the second >>>> parameter. >>>> Here's its docs: >>>> >>>> "If the case of a simple_one_for_one supervisor, the child specification >>>> defined in Module:init/1 will be used and ChildSpec should instead be an >>>> arbitrary list of terms List. The child process will then be started by >>>> appending List to the existing start function arguments, i.e. by calling >>>> apply(M, F, A++List) where {M,F,A} is the start function defined in the >>>> child specification." >>>> >>>> Note the A++List part. >>>> >>>> >>>> Matt Williamson wrote: >>>> >>>> I'm afraid that did not work. I am passing an empty list, and if I >>>>> execute >>>>> [] ++ 1 in the shell I get 1. >>>>> >>>>> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >>>>> wrote: >>>>> >>>>> Try starting it as: >>>>> >>>>>> supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}]) >>>>>> >>>>>> The simple_one_for_one strategy appends the arguments passed to >>>>>> supervisor:start_child/2 to the list of args specified in the >>>>>> supervisor's >>>>>> spec. >>>>>> >>>>>> Serge >>>>>> >>>>>> Matt Williamson wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>>> I am starting a gen_fsm with >>>>>>> supervisor:start_child(erlfs_store_worker_sup, >>>>>>> {store_chunk, Chunk}) but I get the following error: >>>>>>> >>>>>>> {error, >>>>>>> {'EXIT', >>>>>>> {badarg, >>>>>>> [{erlang, >>>>>>> apply, >>>>>>> [erlfs_store_worker_fsm, >>>>>>> start_link, >>>>>>> {store_chunk, >>>>>>> {chunk, >>>>>>> {chunk_meta, >>>>>>> {file_meta, >>>>>>> "test123", >>>>>>> "test.txt", >>>>>>> 0, >>>>>>> "text/plain", >>>>>>> {{0,1,1},{0,0,0}}}, >>>>>>> 0, >>>>>>> 0, >>>>>>> []}, >>>>>>> <<"Hello world!">>}}]}, >>>>>>> {supervisor,do_start_child_i,3}, >>>>>>> {supervisor,handle_call,3}, >>>>>>> {gen_server,handle_msg,6}, >>>>>>> {proc_lib,init_p,5}]}}} >>>>>>> >>>>>>> I've been trying to figure it out for a while, but I am having a hard >>>>>>> time. >>>>>>> Here is the Child Spec in the supervisor (erlfs_store_worker_sup): >>>>>>> >>>>>>> init(Args) -> >>>>>>> WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm, >>>>>>> start_link, []}, >>>>>>> temporary, 2000, worker, [erlfs_store_worker_fsm]}, >>>>>>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> _______________________________________________ >>>>>>> erlang-questions mailing list >>>>>>> erlang-questions@REDACTED >>>>>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>>>>> >>>>>>> >>>>>>> > From dawsdesign@REDACTED Wed Aug 20 20:01:01 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Wed, 20 Aug 2008 14:01:01 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: <48AC4DC3.7030301@erlang-consulting.com> References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> <48AC4DC3.7030301@erlang-consulting.com> Message-ID: So no. I did not send it any event. Serge, I enabled sasl via application:start/1 but when I ran the function in question I didn't get any output from it. On Wed, Aug 20, 2008 at 1:00 PM, Mazen Harake wrote: > Hi Matt, > > Sorry this might be a stupid question but did you send it an event? > > /Mazen > > Matt Williamson wrote: > >> I hate to keep bugging with simple problems, but I'm stuck again. My FSM >> dosn't seem to be executing its first state. Here is my init function: >> >> /init(StartArgs) -> >> InitialState = case StartArgs of >> {store_chunk, Chunk} -> >> io:format("FSM Storing chunk...~n"), >> {ok, storing_chunk, [Chunk]}; >> {get_chunk, Args} -> >> {ok, getting_chunk, Args}; >> Else -> >> %% @todo Add error logging here. >> io:format("Bad arg for FSM: ~p~n", [StartArgs]) >> end, >> io:format("FSM Initial State: ~p~n", [InitialState]), >> InitialState./ >> >> storing_chunk/2 is exported and I'm not getting any errors. Here is that >> function: >> >> /storing_chunk(_Event, [Chunk]) -> >> io:format("STATE: storing_chunk~n"), >> case erlfs_store_lib:store_chunk() of >> ok -> >> {next_state, notifying_tracker, Chunk}; >> {error, Reason} -> >> %% @todo Add error logging here. >> io:format("FSM Stopped: ~p~n", [Reason]), >> {stop, {file, Reason}, Chunk#chunk.chunk_meta} >> end./ >> >> On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov > saleyn@REDACTED>> wrote: >> >> The error you reported earlier: >> >> {'EXIT', {badarg, [{erlang, apply, >> [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} >> >> was a clear indication that erlang:apply(M,F,A) was called with A >> being a tuple rather than a list. If this still doesn't work >> after replacing tuple with a list in the second argument of the >> supervisor:start_child/2 call, this means that you probably have >> other issues in the erlfs_store_worker_fsm:start_link/1 itself. >> >> I can't say anything more without seeing a more detailed error report. >> >> Serge >> >> >> Matt Williamson wrote: >> >> Yes, I saw that in the docs. What I was saying is that calling >> apply(M, F, >> A++List) =:= apply(M, F, List) when A =:= []. >> >> I did try your suggestion anyway with the same results. >> >> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >> > wrote: >> >> What is the arity of erlfs_store_worker_fsm:start_link >> function? >> >> Not quite sure what you mean by [] ++ 1 below. >> >> The supervisor:start_child/2 takes a list [term()] as the >> second parameter. >> Here's its docs: >> >> "If the case of a simple_one_for_one supervisor, the child >> specification >> defined in Module:init/1 will be used and ChildSpec should >> instead be an >> arbitrary list of terms List. The child process will then >> be started by >> appending List to the existing start function arguments, >> i.e. by calling >> apply(M, F, A++List) where {M,F,A} is the start function >> defined in the >> child specification." >> >> Note the A++List part. >> >> >> Matt Williamson wrote: >> >> I'm afraid that did not work. I am passing an empty >> list, and if I execute >> [] ++ 1 in the shell I get 1. >> >> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >> > >> >> wrote: >> >> Try starting it as: >> >> supervisor:start_child(erlfs_store_worker_sup, >> [{store_chunk, Chunk}]) >> >> The simple_one_for_one strategy appends the >> arguments passed to >> supervisor:start_child/2 to the list of args >> specified in the >> supervisor's >> spec. >> >> Serge >> >> Matt Williamson wrote: >> >> Hello, >> >> I am starting a gen_fsm with >> supervisor:start_child(erlfs_store_worker_sup, >> {store_chunk, Chunk}) but I get the following >> error: >> >> {error, >> {'EXIT', >> {badarg, >> [{erlang, >> apply, >> >> [erlfs_store_worker_fsm, >> start_link, >> {store_chunk, >> {chunk, >> >> {chunk_meta, >> >> {file_meta, >> >> "test123", >> >> "test.txt", >> 0, >> >> "text/plain", >> >> {{0,1,1},{0,0,0}}}, >> 0, >> 0, >> []}, >> >> <<"Hello world!">>}}]}, >> >> {supervisor,do_start_child_i,3}, >> >> {supervisor,handle_call,3}, >> >> {gen_server,handle_msg,6}, >> >> {proc_lib,init_p,5}]}}} >> >> I've been trying to figure it out for a while, >> but I am having a hard >> time. >> Here is the Child Spec in the supervisor >> (erlfs_store_worker_sup): >> >> init(Args) -> >> WorkerSpec = {erlfs_store_worker_fsm, >> {erlfs_store_worker_fsm, >> start_link, []}, >> temporary, 2000, worker, >> [erlfs_store_worker_fsm]}, >> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >> >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -- > Mazen Harake > Erlang Software Developer and Consultant, > Erlang Training & Consulting, Ltd > > Mobile Phone: +44 (0)795 13 26 317 > Office Phone: +44 (0)207 45 61 020 > Office Address: > 401 London Fruit & Wool Exchange > Brushfield St, London, E1 6EL > United Kingdom > > This email and its attachments may be confidential and are intended solely > for the use of the individual to whom it is addressed. Any views or opinions > expressed are solely those of the author and do not necessarily represent > those of "Erlang Training & Consulting, Ltd". > > If you are not the intended recipient of this email and its attachments, > you must take no action based upon them, nor must you copy or show them to > anyone. Please contact the sender if you believe you have received this > email in error. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan@REDACTED Wed Aug 20 20:46:50 2008 From: jan@REDACTED (Jan Lehnardt) Date: Wed, 20 Aug 2008 20:46:50 +0200 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 Message-ID: Dear CouchDB Folks, sorry for the shameless self-promotion: This is a bit of a short notice, and I apologise, but things moved quickly here. I'll be spending three couchy days in London next week. On Tuesday night, that is the 26th, I'll be speaking about CouchDB[1] at Erlang Training and Consulting[2] starting 6:30 pm. And you are all invited! The event is free! You just need to register[3]. If you can't make it and want to grab a cold beverage or anything, just drop me a line. Cheers Jan -- [1] http://www.erlang-consulting.com/erlang/events.html#63 [2] http://www.erlang-consulting.com/ [3] http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Couch%20DB%20at%2010,000%20ft From chsu79@REDACTED Wed Aug 20 23:11:13 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 20 Aug 2008 23:11:13 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged Message-ID: From saleyn@REDACTED Thu Aug 21 00:06:55 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Wed, 20 Aug 2008 18:06:55 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> <48AC4DC3.7030301@erlang-consulting.com> Message-ID: <48AC957F.9050507@gmail.com> After looking at your code for the second time, I see that the init function is wrong - it should be: init([StartArgs]) -> ... Try that. You are not indicating here what the error is, but if it is function_clause, then that's it. Serge Matt Williamson wrote: > So no. I did not send it any event. > Serge, I enabled sasl via application:start/1 but when I ran the function in > question I didn't get any output from it. > > On Wed, Aug 20, 2008 at 1:00 PM, Mazen Harake > wrote: > >> Hi Matt, >> >> Sorry this might be a stupid question but did you send it an event? >> >> /Mazen >> >> Matt Williamson wrote: >> >>> I hate to keep bugging with simple problems, but I'm stuck again. My FSM >>> dosn't seem to be executing its first state. Here is my init function: >>> >>> /init(StartArgs) -> >>> InitialState = case StartArgs of >>> {store_chunk, Chunk} -> >>> io:format("FSM Storing chunk...~n"), >>> {ok, storing_chunk, [Chunk]}; >>> {get_chunk, Args} -> >>> {ok, getting_chunk, Args}; >>> Else -> >>> %% @todo Add error logging here. >>> io:format("Bad arg for FSM: ~p~n", [StartArgs]) >>> end, >>> io:format("FSM Initial State: ~p~n", [InitialState]), >>> InitialState./ >>> >>> storing_chunk/2 is exported and I'm not getting any errors. Here is that >>> function: >>> >>> /storing_chunk(_Event, [Chunk]) -> >>> io:format("STATE: storing_chunk~n"), >>> case erlfs_store_lib:store_chunk() of >>> ok -> >>> {next_state, notifying_tracker, Chunk}; >>> {error, Reason} -> >>> %% @todo Add error logging here. >>> io:format("FSM Stopped: ~p~n", [Reason]), >>> {stop, {file, Reason}, Chunk#chunk.chunk_meta} >>> end./ >>> >>> On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov >> saleyn@REDACTED>> wrote: >>> >>> The error you reported earlier: >>> >>> {'EXIT', {badarg, [{erlang, apply, >>> [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} >>> >>> was a clear indication that erlang:apply(M,F,A) was called with A >>> being a tuple rather than a list. If this still doesn't work >>> after replacing tuple with a list in the second argument of the >>> supervisor:start_child/2 call, this means that you probably have >>> other issues in the erlfs_store_worker_fsm:start_link/1 itself. >>> >>> I can't say anything more without seeing a more detailed error report. >>> >>> Serge >>> >>> >>> Matt Williamson wrote: >>> >>> Yes, I saw that in the docs. What I was saying is that calling >>> apply(M, F, >>> A++List) =:= apply(M, F, List) when A =:= []. >>> >>> I did try your suggestion anyway with the same results. >>> >>> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >>> > wrote: >>> >>> What is the arity of erlfs_store_worker_fsm:start_link >>> function? >>> >>> Not quite sure what you mean by [] ++ 1 below. >>> >>> The supervisor:start_child/2 takes a list [term()] as the >>> second parameter. >>> Here's its docs: >>> >>> "If the case of a simple_one_for_one supervisor, the child >>> specification >>> defined in Module:init/1 will be used and ChildSpec should >>> instead be an >>> arbitrary list of terms List. The child process will then >>> be started by >>> appending List to the existing start function arguments, >>> i.e. by calling >>> apply(M, F, A++List) where {M,F,A} is the start function >>> defined in the >>> child specification." >>> >>> Note the A++List part. >>> >>> >>> Matt Williamson wrote: >>> >>> I'm afraid that did not work. I am passing an empty >>> list, and if I execute >>> [] ++ 1 in the shell I get 1. >>> >>> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >>> > >>> >>> wrote: >>> >>> Try starting it as: >>> >>> supervisor:start_child(erlfs_store_worker_sup, >>> [{store_chunk, Chunk}]) >>> >>> The simple_one_for_one strategy appends the >>> arguments passed to >>> supervisor:start_child/2 to the list of args >>> specified in the >>> supervisor's >>> spec. >>> >>> Serge >>> >>> Matt Williamson wrote: >>> >>> Hello, >>> >>> I am starting a gen_fsm with >>> supervisor:start_child(erlfs_store_worker_sup, >>> {store_chunk, Chunk}) but I get the following >>> error: >>> >>> {error, >>> {'EXIT', >>> {badarg, >>> [{erlang, >>> apply, >>> >>> [erlfs_store_worker_fsm, >>> start_link, >>> {store_chunk, >>> {chunk, >>> >>> {chunk_meta, >>> >>> {file_meta, >>> >>> "test123", >>> >>> "test.txt", >>> 0, >>> >>> "text/plain", >>> >>> {{0,1,1},{0,0,0}}}, >>> 0, >>> 0, >>> []}, >>> >>> <<"Hello world!">>}}]}, >>> >>> {supervisor,do_start_child_i,3}, >>> >>> {supervisor,handle_call,3}, >>> >>> {gen_server,handle_msg,6}, >>> >>> {proc_lib,init_p,5}]}}} >>> >>> I've been trying to figure it out for a while, >>> but I am having a hard >>> time. >>> Here is the Child Spec in the supervisor >>> (erlfs_store_worker_sup): >>> >>> init(Args) -> >>> WorkerSpec = {erlfs_store_worker_fsm, >>> {erlfs_store_worker_fsm, >>> start_link, []}, >>> temporary, 2000, worker, >>> [erlfs_store_worker_fsm]}, >>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> >>> >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> -- >> Mazen Harake >> Erlang Software Developer and Consultant, >> Erlang Training & Consulting, Ltd >> >> Mobile Phone: +44 (0)795 13 26 317 >> Office Phone: +44 (0)207 45 61 020 >> Office Address: >> 401 London Fruit & Wool Exchange >> Brushfield St, London, E1 6EL >> United Kingdom >> >> This email and its attachments may be confidential and are intended solely >> for the use of the individual to whom it is addressed. Any views or opinions >> expressed are solely those of the author and do not necessarily represent >> those of "Erlang Training & Consulting, Ltd". >> >> If you are not the intended recipient of this email and its attachments, >> you must take no action based upon them, nor must you copy or show them to >> anyone. Please contact the sender if you believe you have received this >> email in error. >> >> > From bgustavsson@REDACTED Thu Aug 21 05:45:49 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Thu, 21 Aug 2008 05:45:49 +0200 Subject: [erlang-questions] Fwd: max timeout In-Reply-To: <6672d0160808202033t707b7eedi82ed064d10dcbdb9@mail.gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> <6672d0160808200259j7c4098d0ubb74e13b633254b@mail.gmail.com> <48ABF443.8010108@gmail.com> <6672d0160808202033t707b7eedi82ed064d10dcbdb9@mail.gmail.com> Message-ID: <6672d0160808202045q259d527seb5135bf983d0a4a@mail.gmail.com> I forgot to send the email to the mailing list... ---------- Forwarded message ---------- From: Bjorn Gustavsson Date: Thu, Aug 21, 2008 at 5:33 AM Subject: Re: [erlang-questions] max timeout To: Serge Aleynikov On Wed, Aug 20, 2008 at 12:38 PM, Serge Aleynikov wrote: > So, does this mean that #1 below is indeed the right answer and that > 'receve after' implementation correctly deals with bignums between 2^27 and > 2^32? > No, #2 is the correct answer. > > 1. 2^32 (this is what's documented, but only seems to work in the shell) > Documented where? Note that 2^32 does NOT fit in 32 bits (it is a one followed by 32 zeroes; i.e. 33 bits). 2^32 does not work in the shell for me: 1> receive after (1 bsl 32) -> ok end. ** exception error: bad receive timeout value > 2. 2^32-1 = 49.5 days > Yes, 2^32-1 is equal to 16#ffffFFFF, which is what Reference manual says. 16#ffffFFFF is that largest number that can fit in 32 bits. > > 3. Erlang's small integers (2^27-1 = 1.5 days) > There used to be such limitation, a long time ago. /Bjorn > > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Thu Aug 21 08:30:27 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 21 Aug 2008 14:30:27 +0800 Subject: [erlang-questions] Is it possible to set trigger action on break ponit in erlang debugger? Message-ID: HI: Is there a way to set a trigger function on break ponit in erlang's debugger module? When the break ponit reaches,the registered function will be called .The registerted function can print the local variables, current line number and other more execute context. Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Aug 21 09:08:28 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 21 Aug 2008 09:08:28 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged In-Reply-To: References: Message-ID: <1219302508.4999.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Perhaps it is possible to use another process? Give this process a "context" value, let it monitor the target process. When the monitor message arrives just send the monitor message and the value to the ''original process'' (the one that wanted to monitor in the beginning). bengt On Wed, 2008-08-20 at 23:11 +0200, Christian S wrote: > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Thu Aug 21 10:01:57 2008 From: chsu79@REDACTED (Christian S) Date: Thu, 21 Aug 2008 10:01:57 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged In-Reply-To: <1219302508.4999.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <1219302508.4999.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: > Give this process a "context" value, let it monitor the target process. > When the monitor message arrives just send the monitor message and the > value to the ''original process'' (the one that wanted to monitor in the > beginning). That's *smack-forehead* easy! :) I can also hide the (to me) somewhat ugly looking 'DOWN' message with something more specific. Iz nice! From raimo+erlang-questions@REDACTED Thu Aug 21 10:16:16 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 21 Aug 2008 10:16:16 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged In-Reply-To: References: Message-ID: <20080821081616.GA22518@erix.ericsson.se> Since the process that monitors get the {'DOWN',,,,} message, containing an unique ref, it can just as well keep the context value itself and look it up from the ref. This decreases the size of the messages involved. On Wed, Aug 20, 2008 at 11:11:13PM +0200, Christian S wrote: > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From richardc@REDACTED Thu Aug 21 10:31:33 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 21 Aug 2008 10:31:33 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged In-Reply-To: References: <1219302508.4999.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <48AD27E5.9020203@it.uu.se> Christian S wrote: >> Give this process a "context" value, let it monitor the target process. >> When the monitor message arrives just send the monitor message and the >> value to the ''original process'' (the one that wanted to monitor in the >> beginning). > > That's *smack-forehead* easy! :) > > I can also hide the (to me) somewhat ugly looking 'DOWN' message with > something more specific. Iz nice! Also, you already have the quite specific "ref" associated with the monitor, which you could use as a key in a dict or ets table for the extra information. Or combine the two ideas, having a single process that hides the refs, the 'DOWN' messages, and the table, acting as a "user-friendly monitor service". /Richard From chsu79@REDACTED Thu Aug 21 10:42:43 2008 From: chsu79@REDACTED (Christian S) Date: Thu, 21 Aug 2008 10:42:43 +0200 Subject: [erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged In-Reply-To: <48AD27E5.9020203@it.uu.se> References: <1219302508.4999.5.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> <48AD27E5.9020203@it.uu.se> Message-ID: > Also, you already have the quite specific "ref" associated with the > monitor, which you could use as a key in a dict or ets table for the > extra information. Or combine the two ideas, having a single process > that hides the refs, the 'DOWN' messages, and the table, acting as a > "user-friendly monitor service". Mapping monitor references to context value is the obvious way, I do it over and over again and want to avoid repeating it. Having a single monitor service process might be worthwhile, but it smells like premature optimization compared to a process for each monitor. I'll keep it in mind though, since it would be a reusable component. From dawsdesign@REDACTED Thu Aug 21 11:27:15 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Thu, 21 Aug 2008 05:27:15 -0400 Subject: [erlang-questions] Need help with simple_one_for_one In-Reply-To: <48AC957F.9050507@gmail.com> References: <48AC1C9E.9000809@gmail.com> <48AC221A.9050701@gmail.com> <48AC3289.205@gmail.com> <48AC4DC3.7030301@erlang-consulting.com> <48AC957F.9050507@gmail.com> Message-ID: I didn't indicate an error because there wasn't any. Even with SASL started. My problem is that I didn't realize that FSMs were event based. I did realize they could handle events, but didn't realize that's how they are supposed to be used. I thought that at the end of each state function, it would change state (which it does do) and then call the next state function automatically. Since FSMs don't work like that, I switched to a good old fashioned process with spawn_link and my project is making headway. Thank you both very much for your help! On Wed, Aug 20, 2008 at 6:06 PM, Serge Aleynikov wrote: > After looking at your code for the second time, I see that the init > function is wrong - it should be: > > init([StartArgs]) -> > ... > > Try that. You are not indicating here what the error is, but if it is > function_clause, then that's it. > > Serge > > > Matt Williamson wrote: > >> So no. I did not send it any event. >> Serge, I enabled sasl via application:start/1 but when I ran the function >> in >> question I didn't get any output from it. >> >> On Wed, Aug 20, 2008 at 1:00 PM, Mazen Harake >> wrote: >> >> Hi Matt, >>> >>> Sorry this might be a stupid question but did you send it an event? >>> >>> /Mazen >>> >>> Matt Williamson wrote: >>> >>> I hate to keep bugging with simple problems, but I'm stuck again. My FSM >>>> dosn't seem to be executing its first state. Here is my init function: >>>> >>>> /init(StartArgs) -> >>>> InitialState = case StartArgs of >>>> {store_chunk, Chunk} -> >>>> io:format("FSM Storing chunk...~n"), >>>> {ok, storing_chunk, [Chunk]}; >>>> {get_chunk, Args} -> >>>> {ok, getting_chunk, Args}; >>>> Else -> >>>> %% @todo Add error logging here. >>>> io:format("Bad arg for FSM: ~p~n", [StartArgs]) >>>> end, >>>> io:format("FSM Initial State: ~p~n", [InitialState]), >>>> InitialState./ >>>> >>>> storing_chunk/2 is exported and I'm not getting any errors. Here is that >>>> function: >>>> >>>> /storing_chunk(_Event, [Chunk]) -> >>>> io:format("STATE: storing_chunk~n"), >>>> case erlfs_store_lib:store_chunk() of >>>> ok -> >>>> {next_state, notifying_tracker, Chunk}; >>>> {error, Reason} -> >>>> %% @todo Add error logging here. >>>> io:format("FSM Stopped: ~p~n", [Reason]), >>>> {stop, {file, Reason}, Chunk#chunk.chunk_meta} >>>> end./ >>>> >>>> On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov >>> >>> saleyn@REDACTED>> wrote: >>>> >>>> The error you reported earlier: >>>> >>>> {'EXIT', {badarg, [{erlang, apply, >>>> [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}} >>>> >>>> was a clear indication that erlang:apply(M,F,A) was called with A >>>> being a tuple rather than a list. If this still doesn't work >>>> after replacing tuple with a list in the second argument of the >>>> supervisor:start_child/2 call, this means that you probably have >>>> other issues in the erlfs_store_worker_fsm:start_link/1 itself. >>>> >>>> I can't say anything more without seeing a more detailed error report. >>>> >>>> Serge >>>> >>>> >>>> Matt Williamson wrote: >>>> >>>> Yes, I saw that in the docs. What I was saying is that calling >>>> apply(M, F, >>>> A++List) =:= apply(M, F, List) when A =:= []. >>>> >>>> I did try your suggestion anyway with the same results. >>>> >>>> On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov >>>> > wrote: >>>> >>>> What is the arity of erlfs_store_worker_fsm:start_link >>>> function? >>>> >>>> Not quite sure what you mean by [] ++ 1 below. >>>> >>>> The supervisor:start_child/2 takes a list [term()] as the >>>> second parameter. >>>> Here's its docs: >>>> >>>> "If the case of a simple_one_for_one supervisor, the child >>>> specification >>>> defined in Module:init/1 will be used and ChildSpec should >>>> instead be an >>>> arbitrary list of terms List. The child process will then >>>> be started by >>>> appending List to the existing start function arguments, >>>> i.e. by calling >>>> apply(M, F, A++List) where {M,F,A} is the start function >>>> defined in the >>>> child specification." >>>> >>>> Note the A++List part. >>>> >>>> >>>> Matt Williamson wrote: >>>> >>>> I'm afraid that did not work. I am passing an empty >>>> list, and if I execute >>>> [] ++ 1 in the shell I get 1. >>>> >>>> On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov >>>> > >>>> >>>> wrote: >>>> >>>> Try starting it as: >>>> >>>> supervisor:start_child(erlfs_store_worker_sup, >>>> [{store_chunk, Chunk}]) >>>> >>>> The simple_one_for_one strategy appends the >>>> arguments passed to >>>> supervisor:start_child/2 to the list of args >>>> specified in the >>>> supervisor's >>>> spec. >>>> >>>> Serge >>>> >>>> Matt Williamson wrote: >>>> >>>> Hello, >>>> >>>> I am starting a gen_fsm with >>>> supervisor:start_child(erlfs_store_worker_sup, >>>> {store_chunk, Chunk}) but I get the following >>>> error: >>>> >>>> {error, >>>> {'EXIT', >>>> {badarg, >>>> [{erlang, >>>> apply, >>>> >>>> [erlfs_store_worker_fsm, >>>> start_link, >>>> {store_chunk, >>>> {chunk, >>>> >>>> {chunk_meta, >>>> >>>> {file_meta, >>>> >>>> "test123", >>>> >>>> "test.txt", >>>> 0, >>>> >>>> "text/plain", >>>> >>>> {{0,1,1},{0,0,0}}}, >>>> 0, >>>> 0, >>>> []}, >>>> >>>> <<"Hello world!">>}}]}, >>>> >>>> {supervisor,do_start_child_i,3}, >>>> >>>> {supervisor,handle_call,3}, >>>> >>>> {gen_server,handle_msg,6}, >>>> >>>> {proc_lib,init_p,5}]}}} >>>> >>>> I've been trying to figure it out for a while, >>>> but I am having a hard >>>> time. >>>> Here is the Child Spec in the supervisor >>>> (erlfs_store_worker_sup): >>>> >>>> init(Args) -> >>>> WorkerSpec = {erlfs_store_worker_fsm, >>>> {erlfs_store_worker_fsm, >>>> start_link, []}, >>>> temporary, 2000, worker, >>>> [erlfs_store_worker_fsm]}, >>>> {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}. >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> >>>> >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> -- >>> Mazen Harake >>> Erlang Software Developer and Consultant, >>> Erlang Training & Consulting, Ltd >>> >>> Mobile Phone: +44 (0)795 13 26 317 >>> Office Phone: +44 (0)207 45 61 020 >>> Office Address: >>> 401 London Fruit & Wool Exchange >>> Brushfield St, London, E1 6EL >>> United Kingdom >>> >>> This email and its attachments may be confidential and are intended >>> solely >>> for the use of the individual to whom it is addressed. Any views or >>> opinions >>> expressed are solely those of the author and do not necessarily represent >>> those of "Erlang Training & Consulting, Ltd". >>> >>> If you are not the intended recipient of this email and its attachments, >>> you must take no action based upon them, nor must you copy or show them >>> to >>> anyone. Please contact the sender if you believe you have received this >>> email in error. >>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bekesa@REDACTED Thu Aug 21 12:16:23 2008 From: bekesa@REDACTED (Andras Georgy Bekes) Date: Thu, 21 Aug 2008 12:16:23 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <200808191739.22300.bekesa@sch.bme.hu> Message-ID: <200808211216.23872.bekesa@sch.bme.hu> > - the meta-data for a module records which exported functions are > pure and which are not > - when the compiler notes a pure function calling a function > from another module, it records a dependency on that function > being exported as pure > - when a module is loaded, the run time system checks that > every function it tries to import as pure from some other > module IS pure if that module is already loaded, > every module that depends on this one exporting some > function(s) as pure is satisfied. > If either check fails, the module is not loaded. This is completely against current Erlang practice. Currently if a module A uses module B, noone checks if B contains the used functions or not. Neither at compile time, nor at module load time. I think because the check would make module upgrades way more difficult. Think about a module B using a function AF from module A. In the next version of the modules, the function A:AF is removed and B is not using it any more. Currently you just load the two modules. In the presence of a load-time check, you'd have to load module B first, then A. No problem here. Now think about a module A using B's BF and B using A's AF. When both functions are removed, there is no legal upgrade order. The same problem exists with checked pure functions. Module A using B's pure BF (and expects it to be pure), and B using A's pure AF (and expects it to be pure). In the next version both the functions switch to impure, together with their consumers. There is no legal upgrade order :-( There probably are solutions (simultaneous atomic loading of several modules? using extra transition module versions to make the upgrade possible?), but current module upgrading technology/practice must change radically. Georgy From mikael.kais@REDACTED Thu Aug 21 12:48:18 2008 From: mikael.kais@REDACTED (Mikael Kais) Date: Thu, 21 Aug 2008 12:48:18 +0200 Subject: [erlang-questions] protocol buffer & Erlang Message-ID: Does anyone knows if there is already an implementation of the Google protocol buffer in Erlang ? Thanks, Mikael -------------- next part -------------- An HTML attachment was scrubbed... URL: From twoggle@REDACTED Thu Aug 21 13:35:36 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 21 Aug 2008 04:35:36 -0700 (PDT) Subject: [erlang-questions] protocol buffer & Erlang In-Reply-To: References: Message-ID: <6e0f5359-26ae-49fa-ad60-4f789fe4e9f0@z66g2000hsc.googlegroups.com> > Does anyone ?knows if there is already an implementation of the Google > protocol buffer in Erlang ? I'm (very slowly) working on one here: http://github.com/tim/erlang-protobuf/tree/master And there's another here: http://github.com/bwbuchanan/erl_pb/tree/master From josv@REDACTED Thu Aug 21 13:39:57 2008 From: josv@REDACTED (Jos Visser) Date: Thu, 21 Aug 2008 13:39:57 +0200 Subject: [erlang-questions] protocol buffer & Erlang In-Reply-To: References: Message-ID: <20080821113957.GB11953@Deep-Space-X.local> There were a couple of half-finished implementations on the Google code website last time I looked. I have been looking into writing one as an Erlang starter project, but have not gotten anywhere yet :-) ++Jos.ch On Thu, Aug 21, 2008 at 12:48:18PM +0200 it came to pass that Mikael Kais wrote: > Does anyone knows if there is already an implementation of the Google > protocol buffer in Erlang ? > Thanks, > > Mikael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- What cannot be shunned must be embraced. That is the Path... -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From saleyn@REDACTED Thu Aug 21 13:57:08 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 21 Aug 2008 07:57:08 -0400 Subject: [erlang-questions] Fwd: max timeout In-Reply-To: <6672d0160808202045q259d527seb5135bf983d0a4a@mail.gmail.com> References: <48A9D4B2.402@gmail.com> <8209f740808181418y445c597ft4d52929777da0ebe@mail.gmail.com> <48A9F3E8.7080102@gmail.com> <20080819074235.GA3092@contorpis.lisalinda.com> <6672d0160808200259j7c4098d0ubb74e13b633254b@mail.gmail.com> <48ABF443.8010108@gmail.com> <6672d0160808202033t707b7eedi82ed064d10dcbdb9@mail.gmail.com> <6672d0160808202045q259d527seb5135bf983d0a4a@mail.gmail.com> Message-ID: <48AD5814.5000608@gmail.com> > ---------- Forwarded message ---------- > From: Bjorn Gustavsson > Date: Thu, Aug 21, 2008 at 5:33 AM > Subject: Re: [erlang-questions] max timeout > To: Serge Aleynikov > > On Wed, Aug 20, 2008 at 12:38 PM, Serge Aleynikov wrote: > >> So, does this mean that #1 below is indeed the right answer and that >> 'receve after' implementation correctly deals with bignums between 2^27 and >> 2^32? >> > No, #2 is the correct answer. > >> 1. 2^32 (this is what's documented, but only seems to work in the shell) >> > > Documented where? Note that 2^32 does NOT fit in 32 bits (it is a one > followed by 32 zeroes; i.e. 33 bits). You are absolutely right! Typing message too quickly without thinking is quite embarrassing. :-( What I really should have asked was whether the limit was 0xffffFFFF (2^32-1) or 0x7FFFffff (2^31-1). Though your comment below explained my main concern regarding bignums. >> 3. Erlang's small integers (2^27-1 = 1.5 days) >> > > There used to be such limitation, a long time ago. Thank you very much! Serge From olivier.boudeville@REDACTED Thu Aug 21 15:34:12 2008 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 21 Aug 2008 15:34:12 +0200 Subject: [erlang-questions] Consulting request in France Message-ID: Dear Erlang community, hope you don't mind my posting here. We are planning to request some consulting services in Erlang for one of our home-made tools. The work should take place in France, if possible in French. We are listing the eligible companies to which our requirements will be sent once our internal purchase order will be issued. Should there exist companies/experts potentially interested in that proposal that I have not already contacted, please e-mail me privately so that we know you can notify you. Thanks in advance, best regards, Olivier Boudeville. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau C-052 Office : 33 1 47 65 59 58 / Mobile : 33 6 16 83 37 22 / Fax : 33 1 47 65 34 24 -------------- next part -------------- An HTML attachment was scrubbed... URL: From charleswthompsoniii@REDACTED Thu Aug 21 19:11:32 2008 From: charleswthompsoniii@REDACTED (Charles Thompson) Date: Thu, 21 Aug 2008 10:11:32 -0700 Subject: [erlang-questions] Seattle Erlang User Group? Message-ID: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> Anyone know of an Erlang user group in the Seattle area? If not, I'd like to start one. Best, Charles Newbie Erlang Programmer -- Charles Thompson (360) 941-1762 charleswthompsoniii@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.ayerst@REDACTED Thu Aug 21 21:43:10 2008 From: tom.ayerst@REDACTED (Tom Ayerst) Date: Thu, 21 Aug 2008 20:43:10 +0100 Subject: [erlang-questions] Struggling with the yecc parser tutorial-1 Message-ID: <3c5163930808211243p5db9defdoe651aa5d45ddcbc3@mail.gmail.com> I am trying the parser tutorial off the erlang site and I have fallen at the first hurdle. Should this "just work" and something is set up wrong or do I just need to fix things as I find them? Thanks Tom 1> c(ecc_parse). ./ecc_parse.erl:42: Warning: variable 'Stream' is unused ./ecc_parse.erl:44: Warning: variable 'L' is unused ./ecc_parse.erl:44: Warning: variable 'Stream' is unused ./ecc_parse.erl:50: Warning: function first/1 is unused ./ecc_parse.erl:50: Warning: variable 'H' is unused {ok,ecc_parse} 2> ecc_parse:make(). ecc.yrl:104: Warning: function simplify/1 is unused ecc.yrl:104: Warning: variable 'Tag' is unused ** exception error: undefined function leex:gen/2 in function ecc_parse:make/0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.ayerst@REDACTED Thu Aug 21 21:45:21 2008 From: tom.ayerst@REDACTED (Tom Ayerst) Date: Thu, 21 Aug 2008 20:45:21 +0100 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 In-Reply-To: References: Message-ID: <3c5163930808211245k438e7721l87fc1734f7ccc535@mail.gmail.com> I cannot go but I saw Jan at the Thoughtworks presentation he did and can recommend it if you can make it. Tom 2008/8/20 Jan Lehnardt > Dear CouchDB Folks, > > sorry for the shameless self-promotion: > > This is a bit of a short notice, and I apologise, but things > moved quickly here. > > I'll be spending three couchy days in London next week. On > Tuesday night, that is the 26th, I'll be speaking about CouchDB[1] > at Erlang Training and Consulting[2] starting 6:30 pm. And you are > all invited! > > The event is free! You just need to register[3]. > > If you can't make it and want to grab a cold beverage or anything, > just drop me a line. > > Cheers > Jan > -- > [1] http://www.erlang-consulting.com/erlang/events.html#63 > [2] http://www.erlang-consulting.com/ > [3] > http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Couch%20DB%20at%2010,000%20ft > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian@REDACTED Thu Aug 21 21:20:23 2008 From: ian@REDACTED (ian eyberg) Date: Thu, 21 Aug 2008 14:20:23 -0500 Subject: [erlang-questions] missouri erlounge? Message-ID: <20080821192023.GA4037@localhost> greets- this is a long shot but anyone doing an erlounge in/around Missouri or interested in starting one? probably the closest location would be chicago but that's a tad bit too far for me st. louis/k.c. would be more my pref. -Ian From aconbere@REDACTED Thu Aug 21 22:38:26 2008 From: aconbere@REDACTED (anders conbere) Date: Thu, 21 Aug 2008 13:38:26 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> Message-ID: <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> 2008/8/21 Charles Thompson : > Anyone know of an Erlang user group in the Seattle area? If not, I'd like to > start one. There's the Functional Language Programming Group (SeaFunc) which exists but is not very active. But it might be better to bolster that groups membership then spearhead another low volume group here in seattle. (as a seattlite erlanger I would however be interested). ~ Anders > > Best, > > Charles > Newbie Erlang Programmer > > -- > Charles Thompson > (360) 941-1762 > charleswthompsoniii@REDACTED > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From joe@REDACTED Thu Aug 21 22:40:31 2008 From: joe@REDACTED (Joe Williams) Date: Thu, 21 Aug 2008 15:40:31 -0500 Subject: [erlang-questions] missouri erlounge? In-Reply-To: <20080821192023.GA4037@localhost> References: <20080821192023.GA4037@localhost> Message-ID: <48ADD2BF.7010706@joetify.com> I am in STL and would be interested in getting some people together. -Joe ian eyberg wrote: > greets- > > this is a long shot but anyone doing an erlounge > in/around Missouri or interested in starting one? > probably the closest location would be chicago but > that's a tad bit too far for me > > st. louis/k.c. would be more my pref. > > -Ian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Name: Joseph A. Williams Email: joe@REDACTED From erlang@REDACTED Thu Aug 21 23:35:09 2008 From: erlang@REDACTED (Dominic Williams) Date: Thu, 21 Aug 2008 23:35:09 +0200 Subject: [erlang-questions] Auto recompilation In-Reply-To: References: Message-ID: <48ADDF8D.5050708@dominicwilliams.net> Hi, Paul Guyot a ?crit : > Do you know of an auto-recompilation server, i.e. a > process that looks for changes in source files and > recompiles whatever changed in the background? That is exactly what Extreme Forge does. It also runs your tests. http://extremeforge.net Regards, Dominic Williams http://dominicwilliams.net From colm.dougan@REDACTED Thu Aug 21 23:52:08 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 21 Aug 2008 22:52:08 +0100 Subject: [erlang-questions] Struggling with the yecc parser tutorial-1 In-Reply-To: <3c5163930808211243p5db9defdoe651aa5d45ddcbc3@mail.gmail.com> References: <3c5163930808211243p5db9defdoe651aa5d45ddcbc3@mail.gmail.com> Message-ID: <24d4f39c0808211452g1d4b1b6fr52787b70aa6cbf2@mail.gmail.com> 2008/8/21 Tom Ayerst : > I am trying the parser tutorial off the erlang site and I have fallen at the > first hurdle. Should this "just work" and something is set up wrong or do I > just need to fix things as I find them? It seems that leex.erl is not a standard module but can be downloaded as part of a tgz file containing a bunch of examples. See this thread for more info : http://www.erlang.org/pipermail/erlang-questions/1999-March/000163.html There is also a yecc quick start guide here : http://www.erlang.org/faq/parsing.html Colm From per@REDACTED Fri Aug 22 00:11:22 2008 From: per@REDACTED (Per Hedeland) Date: Fri, 22 Aug 2008 00:11:22 +0200 (CEST) Subject: [erlang-questions] max timeout In-Reply-To: <1219209960.3739.1.camel@piko.site> Message-ID: <200808212211.m7LMBMkF099407@pluto.hedeland.org> Alp?r J?ttner wrote: > >As I recall, someone noted on that thread that timer:sleep() works well >for arbitrarily large numbers. I thought that might have been me:-( - but I see now that I just said "the timer module" and gave an example using timer:send_after/2, so I was almost right... >Now I looked at the source and found that this is _not_ true. Strangely >enough, all the functions of the timer modules seem to work correctly >with large numbers _except_ timer:sleep() which has a definition as >simple as this: > >sleep(T) -> > receive > after T -> ok > end. Ouch. But no-one will ever need to sleep for 50 days or more, right?:-) >It might be worth fixing. And I guess I half-owe the fix - the problem is (as I discovered...) that there may be (is) code, um, "out there", that relies on being able to use timer:sleep/1 without having the timer_server running *or* getting "auto-started". Below is what I believe to be a backwards- compatible fix (against R12B-3), but it's pretty ugly - would probably be better to e.g. define a new function long_sleep/1 or somesuch for the "unlimited" case. --Per Hedeland --- lib/stdlib/src/timer.erl.orig 2007-11-26 19:55:44.000000000 +0100 +++ lib/stdlib/src/timer.erl 2008-08-21 23:00:45.000000000 +0200 @@ -75,9 +75,14 @@ cancel(BRef) -> req(cancel, BRef). -sleep(T) -> - receive - after T -> ok +sleep(Time) -> + case whereis(timer_server) of + undefined -> + receive + after Time -> ok + end; + _ -> + req(sleep, Time) end. %% @@ -176,6 +181,13 @@ {reply, {error, badarg}, [], next_timeout()} end; +handle_call({sleep, Time, Started}, From, Ts) -> + Req = {apply_after, {Time, {gen_server, reply, [From, ok]}}, Started}, + case handle_call(Req, From, Ts) of + {reply, {ok, _}, _, Timeout} -> {noreply, [], Timeout}; + Reply -> Reply + end; + handle_call({cancel, BRef = {_Time, Ref}, _}, _From, Ts) when is_reference(Ref) -> delete_ref(BRef), From erlang-questions_efine@REDACTED Fri Aug 22 00:12:34 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 21 Aug 2008 18:12:34 -0400 Subject: [erlang-questions] Truncation packing Integer into binary: bug or feature? Message-ID: <6c2563b20808211512m24090e2y8ec4677728a897e9@mail.gmail.com> If one packs a large Erlang integer into a binary, and the binary representation of that integer is too large for the number of bytes specified, Erlang silently truncates it (see code below). Is this a bug or a feature? I know that in C, integers overflow silently. I would have thought Erlang would raise a badarg error or something. Or would it negatively impact performance to check for overflow? Is there a place in the docs I did not find that addresses this? I have searched the Erlang documentation, Google and the Erlang mailing list archives for clues and found nothing so far. 1> N=314159265358979323846. *314159265358979323846* 2> B = <>. <<7,213,235,91,91,164,215,198>> 3> <> = B. <<7,213,235,91,91,164,215,198>> 4> N1. *564616105916946374* 5> I'm using R12B-3 on x86_64 Ubuntu. Regards, Edwin Fine -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Fri Aug 22 02:55:54 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 22 Aug 2008 02:55:54 +0200 Subject: [erlang-questions] Struggling with the yecc parser tutorial-1 In-Reply-To: <24d4f39c0808211452g1d4b1b6fr52787b70aa6cbf2@mail.gmail.com> References: <3c5163930808211243p5db9defdoe651aa5d45ddcbc3@mail.gmail.com> <24d4f39c0808211452g1d4b1b6fr52787b70aa6cbf2@mail.gmail.com> Message-ID: <3dbc6d1c0808211755t3e22bf34p3d31cf18a2f60d91@mail.gmail.com> There is quite a good introduction to both leex and yecc at: http://hopper.squarespace.com/blog/2008/5/29/leex-and-yecc.html Also S?bastian Arnaud has packaged leex a bit better at: http://github.com/arnaudsj/leex/tree/master One of these days I will get around to making an "official" package. Robert 2008/8/21 Colm Dougan > 2008/8/21 Tom Ayerst : > > I am trying the parser tutorial off the erlang site and I have fallen at > the > > first hurdle. Should this "just work" and something is set up wrong or > do I > > just need to fix things as I find them? > > It seems that leex.erl is not a standard module but can be downloaded > as part of a tgz file containing a bunch of examples. See this thread > for more info : > > http://www.erlang.org/pipermail/erlang-questions/1999-March/000163.html > > There is also a yecc quick start guide here : > > http://www.erlang.org/faq/parsing.html > > Colm > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monch1962@REDACTED Fri Aug 22 06:11:44 2008 From: monch1962@REDACTED (David Mitchell) Date: Fri, 22 Aug 2008 14:11:44 +1000 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 In-Reply-To: References: Message-ID: G'day Jan, Any chance that your session will be captured on video and made generally available? CouchDB is one of those projects that I'm very interested in, but I don't have an immediate use for it so I'm only across it at a fairly broad level. I'd be interested to find out where you think it's a good or bad choice; I've formed an impression based on what I've read, but would like to see it being discussed in some sort of forum. Also, it's a wee bit hard to get there from Australia, well, unless I want to pay for wife and kids to fly over as well... Regards Dave Mitchell 2008/8/21 Jan Lehnardt : > Dear CouchDB Folks, > > sorry for the shameless self-promotion: > > This is a bit of a short notice, and I apologise, but things > moved quickly here. > > I'll be spending three couchy days in London next week. On > Tuesday night, that is the 26th, I'll be speaking about CouchDB[1] > at Erlang Training and Consulting[2] starting 6:30 pm. And you are > all invited! > > The event is free! You just need to register[3]. > > If you can't make it and want to grab a cold beverage or anything, > just drop me a line. > > Cheers > Jan > -- > [1] http://www.erlang-consulting.com/erlang/events.html#63 > [2] http://www.erlang-consulting.com/ > [3] http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Couch%20DB%20at%2010,000%20ft > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jeffm@REDACTED Fri Aug 22 06:28:30 2008 From: jeffm@REDACTED (jm) Date: Fri, 22 Aug 2008 14:28:30 +1000 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 In-Reply-To: References: Message-ID: <48AE406E.5050009@ghostgun.com> I'm in the same boat minus the wife and kids though. I'd at least like to see the slides from the presentation especially if there's anything about using CouchDB from a developed perspective, ie example code. Jeff. ps. caught the FLOSS podcast about couchdb ( http://twit.tv/floss36 ) David Mitchell wrote: > G'day Jan, > > Any chance that your session will be captured on video and made > generally available? > > CouchDB is one of those projects that I'm very interested in, but I > don't have an immediate use for it so I'm only across it at a fairly > broad level. I'd be interested to find out where you think it's a > good or bad choice; I've formed an impression based on what I've read, > but would like to see it being discussed in some sort of forum. > > Also, it's a wee bit hard to get there from Australia, well, unless I > want to pay for wife and kids to fly over as well... > > Regards > > Dave Mitchell > > From ok@REDACTED Fri Aug 22 06:34:08 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 22 Aug 2008 16:34:08 +1200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <24805_1219321772_m7LCTRN2019470_200808211216.23872.bekesa@sch.bme.hu> References: <200808191739.22300.bekesa@sch.bme.hu> <24805_1219321772_m7LCTRN2019470_200808211216.23872.bekesa@sch.bme.hu> Message-ID: <60A7748B-4A4F-4F98-B4E7-E6DFC4EF9380@cs.otago.ac.nz> On 21 Aug 2008, at 10:16 pm, Andras Georgy Bekes wrote: >> - the meta-data for a module records which exported functions are >> pure and which are not >> - when the compiler notes a pure function calling a function >> from another module, it records a dependency on that function >> being exported as pure >> - when a module is loaded, the run time system checks that >> every function it tries to import as pure from some other >> module IS pure if that module is already loaded, >> every module that depends on this one exporting some >> function(s) as pure is satisfied. >> If either check fails, the module is not loaded. > This is completely against current Erlang practice. (a) That's a very misleading way to put it. It would only be "against" if it in some way opposed or prevented the kinds of things people are doing. Erlang *happens* not to check very much, but this is hardly a core design principle. (b) IT DOESN'T MATTER! For heaven's sake, I was answering a question about an idea I had more than ten years ago, which was abandoned when Erlang got 'funs'. > > Currently if a module A uses module B, noone checks if B contains the > used functions or not. Neither at compile time, nor at module load > time. I think because the check would make module upgrades way more > difficult. First off, you can't do it at compile time because you do not know *which* module called B, or which version of that module, A will eventually be loaded with. That's why it needs to be a load time conversion. Second, haven't we all heard enough about "Version Skew" and "DLL Hell" over the last N years to convince us that making it as easy as possible for people to shoot themselves in the foot is not always a Good Thing? If you have two loaded modules, A and B, and A uses something that B provides, and you replace B with a B' that does not provide that any more, what you have done is NOT an upgrade. What you have done is to convert a working system into a non-working system. If you have a new A' that doesn't need that service from B', then either you need to change A to A' first, or you need to replace both modules *together*. Just at the moment I am vey hot under the collar about "upgrades". Here's my story: I have a Macintosh on my desk. I have to teach 5 introductory programming lectures to first year surveyors. The surveying department insisted on Visual Basic as the programming language. Since their students will mostly be making minor additions to Excel spreadsheets, this almost makes sense. Fortunately, Excel is part of Microsoft Office for the Mac, and last year I was able to develop examples using VBA in Excel on my Mac. This year the system administrators installed Microsoft Office 2008 for Macintosh on my machine. It wasn't until I tried revising my materials for SURV112 that I discovered that Office 2008 does not include VBA any more. Gone. Vanished. All Office 2008 can do with VBA macros is offer to delete them. We're supposed to use AppleScript instead. I've taken the trouble to learn AppleScript, and it is certainly integrated with MacOS in a way that VBA never was. None-the-less, I am ***HOPPING MAD*** that nobody told me when the "upgrade" was done "Oh, by the way, this is going to remove a feature you need for your work; do you really want it?" If my configuration is inconsistent, I d--n well *WANT* to be told about it before the damage is done. I am not arguing against hot loading. What I don't like is *silently* moving to an inconsistent state or a state where functionality I rely on is missing. (I've also lost the ability to print slides, because Acrobat 8 has this weird bug where slide pages after the first are mirror- imaged, and the sysadmins were terrified at the thought of the trouble they've have trying to replace it with an older version. Hopefully Acrobat 9, which they've now installed, fixes this...) > > Now think about a module A using B's BF and B using A's AF. When both > functions are removed, there is no legal upgrade order. Yes there is. It's A+B *together. I am not saying that this is supported *now*, but it could be, and it should be. And for the "block compilation" that people keep mentioning, it will *have* to be, for this very reason. You see, when you say "there is no legal upgrade order", what that *really* means is that "if you replace modules one at a time, there can be unavoidable windows when the system is in an inconsistent state, does not know that, and tries to continue operations anyway." Does that sound like a good idea? Anyrate, to repeat: this was *NOT* a current proposal, otherwise it would have been an EEP, not an off-hand remark in another thread, so it was pointless to criticise it. From stondage123@REDACTED Fri Aug 22 08:12:34 2008 From: stondage123@REDACTED (Andrew Stone) Date: Thu, 21 Aug 2008 23:12:34 -0700 (PDT) Subject: [erlang-questions] Same Name registered in separate global groups Message-ID: <715781.65417.qm@web35908.mail.mud.yahoo.com> I was wondering if it is possible to have the same name registered in multiple global groups on the same distributed erlang network (same cookie). e.g. foo is part of global group 'a' and foo is also part of global group 'b', but occasionally the two groups need to communicate with each other, although the foo on 'a' is never referenced by apps in global group 'b' and vice versa. Only unique names are referenced that way. The problem is that I have 2 IP networks which have identical global names in each network. Yet there is a node on each network that communicates with its corresponding node on the other network to exchange information. These nodes on different networks use unique global names. I want to ensure that each of these nodes that need to communicate to nodes on external IP networks only reference the shared names on it's own network (global group). Is this possible or do I need to make all globally registered names, regardless of group, unique. Hope this was somewhat clear. Thanks, Andrew From raimo+erlang-questions@REDACTED Fri Aug 22 09:24:48 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 22 Aug 2008 09:24:48 +0200 Subject: [erlang-questions] : How to get the line number of current executable code? In-Reply-To: <60A7748B-4A4F-4F98-B4E7-E6DFC4EF9380@cs.otago.ac.nz> References: <200808191739.22300.bekesa@sch.bme.hu> <24805_1219321772_m7LCTRN2019470_200808211216.23872.bekesa@sch.bme.hu> <60A7748B-4A4F-4F98-B4E7-E6DFC4EF9380@cs.otago.ac.nz> Message-ID: <20080822072448.GB14388@erix.ericsson.se> On Fri, Aug 22, 2008 at 04:34:08PM +1200, Richard A. O'Keefe wrote: > > On 21 Aug 2008, at 10:16 pm, Andras Georgy Bekes wrote: > > : : > > > > Now think about a module A using B's BF and B using A's AF. When both > > functions are removed, there is no legal upgrade order. > > Yes there is. It's A+B *together. > I am not saying that this is supported *now*, > but it could be, and it should be. > And for the "block compilation" that people keep mentioning, > it will *have* to be, for this very reason. > > You see, when you say "there is no legal upgrade order", > what that *really* means is that "if you replace modules one > at a time, there can be unavoidable windows when the system > is in an inconsistent state, does not know that, and tries > to continue operations anyway." Does that sound like a good idea? I just want to point out, for the record, that the problem is not completely unsolvable today. This is what the OTP Release Handler does. If you build your system using OTP mechanisms (gen_servers, supervision trees, etc...) the release handler pauses all processes (in their gen_servers) before upgrading all modules belonging to an application, and then lets them continue after the upgrade. It is just not a language feature, and requires discipline. > > : -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vychodil.hynek@REDACTED Fri Aug 22 10:06:43 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 22 Aug 2008 10:06:43 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <200808212211.m7LMBMkF099407@pluto.hedeland.org> References: <1219209960.3739.1.camel@piko.site> <200808212211.m7LMBMkF099407@pluto.hedeland.org> Message-ID: <4d08db370808220106t6ac0561bo5d327a88d67179ec@mail.gmail.com> It should be much more simpler to do it without modify timer_server: sleep(Time) -> case whereis(timer_server) of undefined -> receive after Time -> ok end; _ -> Ref = make_ref(), send_after(Time, Ref), receive Ref -> ok end end. On Fri, Aug 22, 2008 at 12:11 AM, Per Hedeland wrote: > Alp?r J?ttner wrote: > > > >As I recall, someone noted on that thread that timer:sleep() works well > >for arbitrarily large numbers. > > I thought that might have been me:-( - but I see now that I just said > "the timer module" and gave an example using timer:send_after/2, so I > was almost right... > > >Now I looked at the source and found that this is _not_ true. Strangely > >enough, all the functions of the timer modules seem to work correctly > >with large numbers _except_ timer:sleep() which has a definition as > >simple as this: > > > >sleep(T) -> > > receive > > after T -> ok > > end. > > Ouch. But no-one will ever need to sleep for 50 days or more, right?:-) > > >It might be worth fixing. > > And I guess I half-owe the fix - the problem is (as I discovered...) > that there may be (is) code, um, "out there", that relies on being able > to use timer:sleep/1 without having the timer_server running *or* > getting "auto-started". Below is what I believe to be a backwards- > compatible fix (against R12B-3), but it's pretty ugly - would probably > be better to e.g. define a new function long_sleep/1 or somesuch for > the "unlimited" case. > > --Per Hedeland > > --- lib/stdlib/src/timer.erl.orig 2007-11-26 19:55:44.000000000 +0100 > +++ lib/stdlib/src/timer.erl 2008-08-21 23:00:45.000000000 +0200 > @@ -75,9 +75,14 @@ > cancel(BRef) -> > req(cancel, BRef). > > -sleep(T) -> > - receive > - after T -> ok > +sleep(Time) -> > + case whereis(timer_server) of > + undefined -> > + receive > + after Time -> ok > + end; > + _ -> > + req(sleep, Time) > end. > > %% > @@ -176,6 +181,13 @@ > {reply, {error, badarg}, [], next_timeout()} > end; > > +handle_call({sleep, Time, Started}, From, Ts) -> > + Req = {apply_after, {Time, {gen_server, reply, [From, ok]}}, Started}, > + case handle_call(Req, From, Ts) of > + {reply, {ok, _}, _, Timeout} -> {noreply, [], Timeout}; > + Reply -> Reply > + end; > + > handle_call({cancel, BRef = {_Time, Ref}, _}, _From, Ts) > when is_reference(Ref) -> > delete_ref(BRef), > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Fri Aug 22 10:19:18 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 22 Aug 2008 10:19:18 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <4d08db370808220106t6ac0561bo5d327a88d67179ec@mail.gmail.com> References: <1219209960.3739.1.camel@piko.site> <200808212211.m7LMBMkF099407@pluto.hedeland.org> <4d08db370808220106t6ac0561bo5d327a88d67179ec@mail.gmail.com> Message-ID: <4d08db370808220119o1d79ffe8t809e6baaee2db194@mail.gmail.com> Sorry, I haven't done it reliable and as recommended by best practices :-) fixed: sleep(Time) -> case whereis(timer_server) of undefined -> receive after Time -> ok end; _ -> Ref = make_ref(), {ok, _} = send_after(Time, Ref), receive Ref -> ok end end. On Fri, Aug 22, 2008 at 10:06 AM, Hynek Vychodil wrote: > It should be much more simpler to do it without modify timer_server: > > sleep(Time) -> > case whereis(timer_server) of > undefined -> receive after Time -> ok end; > _ -> > Ref = make_ref(), > send_after(Time, Ref), > receive Ref -> ok end > end. > > > On Fri, Aug 22, 2008 at 12:11 AM, Per Hedeland wrote: > >> Alp?r J?ttner wrote: >> > >> >As I recall, someone noted on that thread that timer:sleep() works well >> >for arbitrarily large numbers. >> >> I thought that might have been me:-( - but I see now that I just said >> "the timer module" and gave an example using timer:send_after/2, so I >> was almost right... >> >> >Now I looked at the source and found that this is _not_ true. Strangely >> >enough, all the functions of the timer modules seem to work correctly >> >with large numbers _except_ timer:sleep() which has a definition as >> >simple as this: >> > >> >sleep(T) -> >> > receive >> > after T -> ok >> > end. >> >> Ouch. But no-one will ever need to sleep for 50 days or more, right?:-) >> >> >It might be worth fixing. >> >> And I guess I half-owe the fix - the problem is (as I discovered...) >> that there may be (is) code, um, "out there", that relies on being able >> to use timer:sleep/1 without having the timer_server running *or* >> getting "auto-started". Below is what I believe to be a backwards- >> compatible fix (against R12B-3), but it's pretty ugly - would probably >> be better to e.g. define a new function long_sleep/1 or somesuch for >> the "unlimited" case. >> >> --Per Hedeland >> >> --- lib/stdlib/src/timer.erl.orig 2007-11-26 19:55:44.000000000 >> +0100 >> +++ lib/stdlib/src/timer.erl 2008-08-21 23:00:45.000000000 +0200 >> @@ -75,9 +75,14 @@ >> cancel(BRef) -> >> req(cancel, BRef). >> >> -sleep(T) -> >> - receive >> - after T -> ok >> +sleep(Time) -> >> + case whereis(timer_server) of >> + undefined -> >> + receive >> + after Time -> ok >> + end; >> + _ -> >> + req(sleep, Time) >> end. >> >> %% >> @@ -176,6 +181,13 @@ >> {reply, {error, badarg}, [], next_timeout()} >> end; >> >> +handle_call({sleep, Time, Started}, From, Ts) -> >> + Req = {apply_after, {Time, {gen_server, reply, [From, ok]}}, >> Started}, >> + case handle_call(Req, From, Ts) of >> + {reply, {ok, _}, _, Timeout} -> {noreply, [], Timeout}; >> + Reply -> Reply >> + end; >> + >> handle_call({cancel, BRef = {_Time, Ref}, _}, _From, Ts) >> when is_reference(Ref) -> >> delete_ref(BRef), >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > --Hynek (Pichi) Vychodil > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan@REDACTED Fri Aug 22 10:21:24 2008 From: jan@REDACTED (Jan Lehnardt) Date: Fri, 22 Aug 2008 10:21:24 +0200 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 In-Reply-To: References: Message-ID: <1D4A45AA-D98B-45B3-97AA-D167B27F14A0@apache.org> Heya, I'm not sure about the recording, but I'd guess it is not happening. But there are videos of presentations of me available that cover CouchDB. See: http://wiki.apache.org/couchdb/Presentations Cheers Jan -- On Aug 22, 2008, at 06:11, David Mitchell wrote: > G'day Jan, > > Any chance that your session will be captured on video and made > generally available? > > CouchDB is one of those projects that I'm very interested in, but I > don't have an immediate use for it so I'm only across it at a fairly > broad level. I'd be interested to find out where you think it's a > good or bad choice; I've formed an impression based on what I've read, > but would like to see it being discussed in some sort of forum. > > Also, it's a wee bit hard to get there from Australia, well, unless I > want to pay for wife and kids to fly over as well... > > Regards > > Dave Mitchell > > 2008/8/21 Jan Lehnardt : >> Dear CouchDB Folks, >> >> sorry for the shameless self-promotion: >> >> This is a bit of a short notice, and I apologise, but things >> moved quickly here. >> >> I'll be spending three couchy days in London next week. On >> Tuesday night, that is the 26th, I'll be speaking about CouchDB[1] >> at Erlang Training and Consulting[2] starting 6:30 pm. And you are >> all invited! >> >> The event is free! You just need to register[3]. >> >> If you can't make it and want to grab a cold beverage or anything, >> just drop me a line. >> >> Cheers >> Jan >> -- >> [1] http://www.erlang-consulting.com/erlang/events.html#63 >> [2] http://www.erlang-consulting.com/ >> [3] http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Couch%20DB%20at%2010,000%20ft >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From francesco@REDACTED Fri Aug 22 12:35:49 2008 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 22 Aug 2008 11:35:49 +0100 Subject: [erlang-questions] Open CouchDB Event in London, August 26th, 18:30 In-Reply-To: <1D4A45AA-D98B-45B3-97AA-D167B27F14A0@apache.org> References: <1D4A45AA-D98B-45B3-97AA-D167B27F14A0@apache.org> Message-ID: <48AE9685.6010504@erlang-consulting.com> Great to see such a huge interest in Couch DB! Considering this is the third presentation Jan does in London in 3 months, we were really not expecting such a turnout. We will record the event, but I am not sure when we will manage to make it available online. We have a backlog of events we need to manage. You can also view Jan's presentation at the Erlang eXchange in London last June: http://video.google.com/videoplay?docid=-3714560380544574985&ei=EpWuSJG4MIiYigKD3IH4Aw Regards, Francesco -- http://www.erlang-consulting.com Jan Lehnardt wrote: > Heya, > I'm not sure about the recording, but I'd guess it is not > happening. > > But there are videos of presentations of me available > that cover CouchDB. See: > > http://wiki.apache.org/couchdb/Presentations > > Cheers > Jan > -- > On Aug 22, 2008, at 06:11, David Mitchell wrote: > > >> G'day Jan, >> >> Any chance that your session will be captured on video and made >> generally available? >> >> CouchDB is one of those projects that I'm very interested in, but I >> don't have an immediate use for it so I'm only across it at a fairly >> broad level. I'd be interested to find out where you think it's a >> good or bad choice; I've formed an impression based on what I've read, >> but would like to see it being discussed in some sort of forum. >> >> Also, it's a wee bit hard to get there from Australia, well, unless I >> want to pay for wife and kids to fly over as well... >> >> Regards >> >> Dave Mitchell >> >> 2008/8/21 Jan Lehnardt : >> >>> Dear CouchDB Folks, >>> >>> sorry for the shameless self-promotion: >>> >>> This is a bit of a short notice, and I apologise, but things >>> moved quickly here. >>> >>> I'll be spending three couchy days in London next week. On >>> Tuesday night, that is the 26th, I'll be speaking about CouchDB[1] >>> at Erlang Training and Consulting[2] starting 6:30 pm. And you are >>> all invited! >>> >>> The event is free! You just need to register[3]. >>> >>> If you can't make it and want to grab a cold beverage or anything, >>> just drop me a line. >>> >>> Cheers >>> Jan >>> -- >>> [1] http://www.erlang-consulting.com/erlang/events.html#63 >>> [2] http://www.erlang-consulting.com/ >>> [3] http://www.erlang-consulting.com/erlang/usergroup/erlanglondon/lugregister.html?event=Couch%20DB%20at%2010,000%20ft >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From chsu79@REDACTED Fri Aug 22 13:21:13 2008 From: chsu79@REDACTED (Christian) Date: Fri, 22 Aug 2008 13:21:13 +0200 Subject: [erlang-questions] Truncation packing Integer into binary: bug or feature? In-Reply-To: <6c2563b20808211512m24090e2y8ec4677728a897e9@mail.gmail.com> References: <6c2563b20808211512m24090e2y8ec4677728a897e9@mail.gmail.com> Message-ID: It has been mentioned before on the list. http://www.erlang.org/pipermail/erlang-questions/2007-July/027657.html > Is this a bug or a feature? I know that in C, integers overflow silently. I > would have thought Erlang would raise a badarg error or something. Or would > it negatively impact performance to check for overflow? Is there a place in > the docs I did not find that addresses this? I have searched the Erlang > documentation, Google and the Erlang mailing list archives for clues and > found nothing so far. From klacke@REDACTED Fri Aug 22 13:56:55 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 22 Aug 2008 13:56:55 +0200 Subject: [erlang-questions] demonitor Message-ID: <48AEA987.7050002@hyber.org> I just recently discovered some bugs in the ssh application. basically it's a code like in gen.erl erlang:demonitor(Mref), receive {'DOWN', Mref, _, _, _} -> {ok, Reply} after 0 -> {ok, Reply} end; The flushing wasn't there in the ssh app, and thus the DOWN messages got accumulated and there was a memory leak. (I posted to erlang-patches) Anyway, here is my question. Don't you _always_ want to do that flushing after demonitor. And if so, shouldn't the BIF do that. I bet there is whole lot of code out there which doesn't properly do the flush. /klacke From andreasmk2@REDACTED Fri Aug 22 13:38:19 2008 From: andreasmk2@REDACTED (Andreas Bakurov) Date: Fri, 22 Aug 2008 14:38:19 +0300 Subject: [erlang-questions] Erlounge Athens ? Message-ID: <48AEA52B.5070508@gmail.com> Hello, is anybody interested to organize some Erlang meeting(s) in Athens, Greece ? From raimo+erlang-questions@REDACTED Fri Aug 22 14:47:09 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 22 Aug 2008 14:47:09 +0200 Subject: [erlang-questions] demonitor In-Reply-To: <48AEA987.7050002@hyber.org> References: <48AEA987.7050002@hyber.org> Message-ID: <20080822124709.GA18759@erix.ericsson.se> On Fri, Aug 22, 2008 at 01:56:55PM +0200, Claes Wikstrom wrote: > > I just recently discovered some bugs in the ssh application. > basically it's a code like in gen.erl > > erlang:demonitor(Mref), > receive > {'DOWN', Mref, _, _, _} -> > {ok, Reply} > after 0 -> > {ok, Reply} > end; > You want erlang:demonitor(Mref, [flush]) > > > The flushing wasn't there in the ssh app, and thus the DOWN messages > got accumulated and there was a memory leak. (I posted to erlang-patches) > > Anyway, here is my question. > > Don't you _always_ want to do that flushing after demonitor. And if > so, shouldn't the BIF do that. I bet there is whole lot of code > out there which doesn't properly do the flush. In that case _always_ use erlang:demonitor(Mref, [flush]). We could not change the behaviour of erlang:demonitor/1; backwards compatibility... > > /klacke > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From lenartlad@REDACTED Fri Aug 22 14:53:10 2008 From: lenartlad@REDACTED (Ladislav Lenart) Date: Fri, 22 Aug 2008 14:53:10 +0200 Subject: [erlang-questions] demonitor In-Reply-To: <48AEA987.7050002@hyber.org> References: <48AEA987.7050002@hyber.org> Message-ID: <48AEB6B6.8090300@volny.cz> Claes Wikstrom wrote: > I just recently discovered some bugs in the ssh application. > basically it's a code like in gen.erl > > erlang:demonitor(Mref), > receive > {'DOWN', Mref, _, _, _} -> > {ok, Reply} > after 0 -> > {ok, Reply} > end; > > > > The flushing wasn't there in the ssh app, and thus the DOWN messages > got accumulated and there was a memory leak. (I posted to erlang-patches) > > Anyway, here is my question. > > Don't you _always_ want to do that flushing after demonitor. And if > so, shouldn't the BIF do that. I bet there is whole lot of code > out there which doesn't properly do the flush. Hello, I might be wrong but isn't this a "classical" race condition example? 1. Monitored process terminates. 2. Down message is sent. 3. Monitoring process calls demonitor. 4. Monitoring process flushes its mailbox for a potential down message which is not there yet. 5. Down message arrives and remains in the mailbox "forever". Adding of the receive clause does not solve the original problem, it just makes it happen less often. The proper solution would be to always consume the down message in handle_info/X callback (or such) and do something useful only when the monitoring process is still interested in the event, no? Ladislav Lenart From andreasmk2@REDACTED Fri Aug 22 14:57:34 2008 From: andreasmk2@REDACTED (Andreas Bakurov) Date: Fri, 22 Aug 2008 15:57:34 +0300 Subject: [erlang-questions] Erlounge Athens ? Message-ID: <48AEB7BE.2070704@gmail.com> Hello, is anybody interested to organize some Erlang meeting(s) in Athens, Greece ? From richardc@REDACTED Fri Aug 22 15:19:32 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 22 Aug 2008 15:19:32 +0200 Subject: [erlang-questions] demonitor In-Reply-To: <48AEB6B6.8090300@volny.cz> References: <48AEA987.7050002@hyber.org> <48AEB6B6.8090300@volny.cz> Message-ID: <48AEBCE4.4090803@it.uu.se> Ladislav Lenart wrote: > I might be wrong but isn't this a "classical" race condition example? > > 1. Monitored process terminates. > 2. Down message is sent. > 3. Monitoring process calls demonitor. > 4. Monitoring process flushes its mailbox for a potential down message > which is not there yet. > 5. Down message arrives and remains in the mailbox "forever". > > Adding of the receive clause does not solve the original problem, > it just makes it happen less often. This was once the case, but it is no longer so, as the documentation for demonitor/1 explains: ''Note: Prior to OTP release R11B (erts version 5.5) erlang:demonitor/1 behaved completely asynchronous, i.e., the monitor was active until the "demonitor signal" reached the monitored entity. This had one undesirable effect, though. You could never know when you were guaranteed not to receive a DOWN message due to the monitor. Current behavior can be viewed as two combined operations: asynchronously send a "demonitor signal" to the monitored entity and ignore any future results of the monitor.'' The current behaviour is: ''Once erlang:demonitor(MonitorRef) has returned it is guaranteed that no {'DOWN', MonitorRef, _, _, _} message due to the monitor will be placed in the callers message queue in the future. A {'DOWN', MonitorRef, _, _, _} message might have been placed in the callers message queue prior to the call, though.'' /Richard From colm.dougan@REDACTED Fri Aug 22 15:34:24 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Fri, 22 Aug 2008 14:34:24 +0100 Subject: [erlang-questions] Circular list Message-ID: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> Hi, If I have a list of a fixed size (say 10,000 elements). What is the most efficient way to add a new item to the list and force out the old first element. By most efficient I mostly mean without having to copy the entire list each time, if that is even possible. I'm currently doing a double reverse trick, e.g. : Eshell V5.6.3 (abort with ^G) 1> L1 = ["A", "B", "C", "D", "E"]. ["A","B","C","D","E"] 2> [_ | L2] = L1. ["A","B","C","D","E"] 3> lists:reverse(["F" | lists:reverse(L2)]). ["B","C","D","E","F"] Is there a more efficient way? I tried a benchmark and the reverse seems more costly than I expected. Colm From vychodil.hynek@REDACTED Fri Aug 22 15:44:31 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 22 Aug 2008 15:44:31 +0200 Subject: [erlang-questions] Circular list In-Reply-To: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> References: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> Message-ID: <4d08db370808220644ue56f561ub8e45a6c7574f332@mail.gmail.com> Look at queue module. Copy is performed, but only once if you work only one way. On Fri, Aug 22, 2008 at 3:34 PM, Colm Dougan wrote: > Hi, > > If I have a list of a fixed size (say 10,000 elements). What is the > most efficient way to add a new item to the list and force out the old > first element. By most efficient I mostly mean without having to copy > the entire list each time, if that is even possible. > > I'm currently doing a double reverse trick, e.g. : > > Eshell V5.6.3 (abort with ^G) > 1> L1 = ["A", "B", "C", "D", "E"]. > ["A","B","C","D","E"] > 2> [_ | L2] = L1. > ["A","B","C","D","E"] > 3> lists:reverse(["F" | lists:reverse(L2)]). > ["B","C","D","E","F"] > > Is there a more efficient way? I tried a benchmark and the reverse > seems more costly than I expected. > > Colm > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From bharani_vms@REDACTED Fri Aug 22 16:24:45 2008 From: bharani_vms@REDACTED (Bharani) Date: Fri, 22 Aug 2008 07:24:45 -0700 (PDT) Subject: [erlang-questions] How to cluster mochiweb? Message-ID: <19108320.post@talk.nabble.com> I have come across gen_server_cluster in the cookbook. Is that the way to cluster mochiweb as well? The way i think i "could" work is that 1) Start a global mochiweb that listens on the port X which is visible to the client 2) Start other mochiweb instances but they run as local server on different random port 3) If the global server dies then one of the local server becomes global and binds on the port X -- not sure how this is going to work though Have any one clustered http servers with session replication? (Although i prefer to avoid sessions as much as possible - some time it is just too natural to have it ) Thanks Bharani -- View this message in context: http://www.nabble.com/How-to-cluster-mochiweb--tp19108320p19108320.html Sent from the Erlang Questions mailing list archive at Nabble.com. From erlang-questions_efine@REDACTED Fri Aug 22 19:01:24 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 22 Aug 2008 13:01:24 -0400 Subject: [erlang-questions] Truncation packing Integer into binary: bug or feature? In-Reply-To: References: <6c2563b20808211512m24090e2y8ec4677728a897e9@mail.gmail.com> Message-ID: <6c2563b20808221001w5d51e4eelb5abf3540585b7f@mail.gmail.com> Thanks. I missed that one :( Is that the one and only reference to that issue? I agree that "This behaviour might be surprising and it should probably be mentioned in the reference manual ..." and will raise a request to do exactly that. Regards, Edwin Fine On Fri, Aug 22, 2008 at 7:21 AM, Christian wrote: > It has been mentioned before on the list. > > http://www.erlang.org/pipermail/erlang-questions/2007-July/027657.html > > > Is this a bug or a feature? I know that in C, integers overflow silently. > I > > would have thought Erlang would raise a badarg error or something. Or > would > > it negatively impact performance to check for overflow? Is there a place > in > > the docs I did not find that addresses this? I have searched the Erlang > > documentation, Google and the Erlang mailing list archives for clues and > > found nothing so far. > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Fri Aug 22 19:09:30 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 22 Aug 2008 13:09:30 -0400 Subject: [erlang-questions] Documentation request: integer encoding and truncation Message-ID: <6c2563b20808221009l1e5787f2q5d6c2f868b06c61f@mail.gmail.com> I refer to the following post. I was caught unawares by this apparently undocumented behavior. http://www.erlang.org/pipermail/erlang-questions/2007-July/027657.html May I strongly recommend placing this information (taken from the above post) in the Erlang Reference Manual, in the section on binaries. It may save other people time and confusion. A further question is whether or not this *should* be the behavior. As a language used for writing highly reliable systems, shouldn't this overflow condition be caught? Maybe as an optional run-time flag? Integer Encoding and Truncation <> is equivalent to <<(I band ((1 bsl N) - 1)):N>> That is, if the integer I can not be represented in N bits, the low N bits of the integer is put into the binary. Binaries work in a similar manner e.g. 1> <<1,2>> = << (<<1,2,3>>):2/binary >>. <<1,2>> Regards, Edwin Fine -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Fri Aug 22 19:39:26 2008 From: bob@REDACTED (Bob Ippolito) Date: Fri, 22 Aug 2008 10:39:26 -0700 Subject: [erlang-questions] How to cluster mochiweb? In-Reply-To: <19108320.post@talk.nabble.com> References: <19108320.post@talk.nabble.com> Message-ID: <6a36e7290808221039u3e88b879la10d66176a40f9d2@mail.gmail.com> There isn't really any reason to cluster mochiweb (or any other HTTP server). If you need to share session state amongst a couple machines the web servers don't need to talk to each other, you just need a distributed session store (e.g. mnesia). When you do load balancing/failover the HTTP servers don't need to talk to each other. Whatever is doing the load balancing normally does its own polling to see which servers are alive and send requests to only those. On Fri, Aug 22, 2008 at 7:24 AM, Bharani wrote: > > I have come across gen_server_cluster in the cookbook. Is that the way to > cluster mochiweb as well? > The way i think i "could" work is that > 1) Start a global mochiweb that listens on the port X which is visible to > the client > 2) Start other mochiweb instances but they run as local server on different > random port > 3) If the global server dies then one of the local server becomes global and > binds on the port X -- not sure how this is going to work though > > Have any one clustered http servers with session replication? (Although i > prefer to avoid sessions as much as possible - some time it is just too > natural to have it ) > > Thanks > Bharani > -- > View this message in context: http://www.nabble.com/How-to-cluster-mochiweb--tp19108320p19108320.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From joelr1@REDACTED Fri Aug 22 19:56:46 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Aug 2008 18:56:46 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by erts when kernel poll is enabled Message-ID: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> I believe there's a "bug" in the current implementation of erts_poll_init in erts/emulator/sys/common/erl_poll.c. This bug prevents Erlang from using more than 1024 file descriptors regardless of whether kernel poll is available and used. This happens on Mac OSX Leopard but should affect other platforms as well. This is the relevant chunk of code from erts/emulator/sys/common/ erl_poll.c: #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif ERTS will successfully grab the maximum # of open files from the kernel so long as SYSCONF is present, i.e. max_fds = sysconf(_SC_OPEN_MAX); What happens then is that even if kernell poll is enabled, the maximum number of file descriptors (max_fds) gets clipped to FD_SETSIZE, 1024 on Mac OSX Leopard. The code needs to look like this instead: #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && ! ERTS_POLL_USE_KERNEL_POLL if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif ERTS appears to compile erl_poll.c twice, with and without kernell poll enabled. It then uses erts_poll_init_kp (kpoll) or erts_poll_init_nkp, depending on whether -K true was given. I believe that the lack of && !ERTS_POLL_USE_KERNEL_POLL above is just oversight and no harm is caused by adding it. Thanks, Joel -- wagerlabs.com From keshavan.balasubramanian@REDACTED Fri Aug 22 20:09:08 2008 From: keshavan.balasubramanian@REDACTED (keshavan Balasubramanian) Date: Fri, 22 Aug 2008 23:39:08 +0530 Subject: [erlang-questions] handle_info details for gen_fsm Message-ID: Dear All, In gen_fsm behavior, handle_info() has a parameter SateName. What is the significance of the sate-name here? Does it have anything to do with the handle_info() being executed in the 'StateName' state only? Will the event/message result in calling a function by the name 'StateName', implicitly? Thanks in advance. Best regards, Keshavan From dawsdesign@REDACTED Fri Aug 22 20:39:43 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 22 Aug 2008 14:39:43 -0400 Subject: [erlang-questions] Circular list In-Reply-To: <4d08db370808220644ue56f561ub8e45a6c7574f332@mail.gmail.com> References: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> <4d08db370808220644ue56f561ub8e45a6c7574f332@mail.gmail.com> Message-ID: This should at least be better than a double reverse: 1> L = ["A", "B", "C", "D", "E"]. ["A","B","C","D","E"] 2> [_|L2] = L. ["A","B","C","D","E"] 3> L2 ++ ["F"]. ["B","C","D","E","F"] 2008/8/22 Hynek Vychodil > Look at queue module. Copy is performed, but only once if you work only one > way. > > > On Fri, Aug 22, 2008 at 3:34 PM, Colm Dougan wrote: > >> Hi, >> >> If I have a list of a fixed size (say 10,000 elements). What is the >> most efficient way to add a new item to the list and force out the old >> first element. By most efficient I mostly mean without having to copy >> the entire list each time, if that is even possible. >> >> I'm currently doing a double reverse trick, e.g. : >> >> Eshell V5.6.3 (abort with ^G) >> 1> L1 = ["A", "B", "C", "D", "E"]. >> ["A","B","C","D","E"] >> 2> [_ | L2] = L1. >> ["A","B","C","D","E"] >> 3> lists:reverse(["F" | lists:reverse(L2)]). >> ["B","C","D","E","F"] >> >> Is there a more efficient way? I tried a benchmark and the reverse >> seems more costly than I expected. >> >> Colm >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > --Hynek (Pichi) Vychodil > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Aug 22 20:51:45 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Aug 2008 19:51:45 +0100 Subject: [erlang-questions] fprof analysis: undefined? Message-ID: <1FB90D5C-A2AF-4FE8-AAB2-855658AE8341@gmail.com> Any suggestion on what can be causing this? The whole analysis file is 114Mb so I'm not attaching it. Thanks, Joel --- %% Analysis results: { analysis_options, [{callers, true}, {sort, acc}, {totals, true}, {details, true}]}. % CNT ACC OWN [{ totals , 1312409 , 44411.483, 133824.258}]. %%% {[{undefined , 1 , 44409.043, 0.038}, {undefined , 1 , 39228.071, 0.149}, {undefined , 1 , 39224.308, 0.246}, {undefined , 1 , 39217.345, 0.266}, -- wagerlabs.com From dawsdesign@REDACTED Fri Aug 22 20:58:34 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Fri, 22 Aug 2008 14:58:34 -0400 Subject: [erlang-questions] Erlware dependency issue Message-ID: Sorry if this is the wrong place for it, but I just decided to make my project work with erlware, but when I run `sinan build` I get the following error: *starting run [check_depends] start [sin_depends_check fault!!] dependency_issue Task failed run complete with faults* looking into ~/.sinan/logs/kernel.log shows: =ERROR REPORT==== 21-Aug-2008::21:05:00 === Unable to find version list at /5.6.3/Meta/eunit/. Package probably isn't in any of the available repositories I built erlang from source on ubuntu and installed eunit manually via `faxien install-app eunit` Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Aug 22 21:00:59 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Aug 2008 20:00:59 +0100 Subject: [erlang-questions] fprof unusable? Message-ID: <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> I tried to profile my poker test harness the other day and failed miserably. I had to kill Erlang at the fprof:profile stage, after a couple of days. The Erlang process itself was taking more than 12Gb of real memory, I only have 14Gb and was being killed by swapping. The files generated over two days were huge, e.g. -rw-r--r-- 1 joelr joelr 64672716428 Aug 8 00:39 fprof.dump -rwxr-xr-x 1 joelr joelr 79763809507 Aug 6 14:11 fprof.trace That's 64Gb and 79Gb respectively! fprof uses ETS internally which is kept in physical memory and virtually guarantees that my profiling session was doomed from the start. Any suggestions on how to proceed other than shortening the profiling session? Thanks, Joel -- wagerlabs.com From fritchie@REDACTED Fri Aug 22 21:57:09 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2008 14:57:09 -0500 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: Message of "Thu, 14 Aug 2008 13:51:07 PDT." Message-ID: <46366.1219435029@snookles.snookles.com> Hi, all. Sorry for adding my $0.02 a week or so late. I can claim only observations and comments, since I haven't used TC or mnesia_ext myself. However, I have been helping a colleague who has used both and has been finishing a mnesia_ext backend for Berkeley DB. (Yes, we hope to open source it, but (I made a verb!) no decisions yet, sorry.) Paul Mineiro wrote: pm> Re: sync times, well a couple of seconds is perhaps not out of line, pm> depending upon the amount of data. I have the same difficulty with a Berkeley DB application. A customer is very sensitive about maximum latency of the app: average latency must be under 1/4 second, and absolutely no maximum latency above 1/3 second. Fairly harsh expectations. Berkeley DB's environment can maintain a page cache. All dirty pages (or fractions of pages) are written via "write-ahead" to the transaction log, synchronously by default. But the dirty hash/B-tree page in the cache will not be written to the hash/B-tree file until there is: 1. a cache eviction under pressure 2. a checkpoint (which forces all dirty pages to be written) #1 can't be helped, short of increasing the size of the cache or reducing the number of pages that you modify. #2 is an atomic weapon bomb blast if you have a multi-gigabyte B-tree table file that has tens of thousands (or more) of dirty pages. DB provides a function to flush X percent of dirty pages (DB_ENV->memp_trickle), but if you have a 1GB memory pool and a table using 4KB pages, 1% is still 2,622 pages. You can sleep between such 1% flush incrememnts, but... ... flushing even a "tiny" number of pages like that, with quite random page placement (as far as the file system is concerned), and then a 1/3 second latency ceiling feels very, very low. :-( Sorry about the digression, but if TokyoCabinet has a similar page cache and flushing strategy, then you may be out of luck. TC may have better chances of adding a "flush cache but only flush N pages/sec" feature. That will actually increase the wall-clock time for a full cache flush, but if you've got zillions of dirty pages and you really need a full flush, you don't have much choice. (See "more-background-info" at the end.) pm> As you might already have found, pm> I don't get the durability story of tokyocabinet pm> (http://groups.google.com/group/mnesiaex-discuss/browse_thread/thread/da2ae1da862b01c0) pm> but we use distributed mnesia and have multiple copies of any table pm> so we basically never locally load a table on restart. Paul, if your tables are big enough, then even a load from a remote host will incur lots of disk I/O. Is that a problem you've had to worry about already, or something lurking in the future? I've only taken glimpse at mnesia_ext, but the lack of coordination with Mnesia's transaction manager is A Problem, in my (still naive) opinion. Even if TC's disk structures were 100% crash-safe, aren't there still sync problems between the local txn manager's log and any mnesia_ext backend (as the callbacks exist today)? -Scott Here's some info that I got from a Dan Cutting talk about the Lucene indexer(*). He's talking about seek-based databases (based on B-trees) versus "old-school" merge-sorting (that Lucense uses). Assume: If 10MB/s xfer, 10ms seek, 1% of pages require update in a 1TB database. 100B entries, 10kB pages, 10B entries, 1B pages Then: @ 1 seek per update requires 1000 days! @ 1 seek per page requires 100 days! (assumes multiple updates/page) @ transfer entire db takes 1 day (via sequential read of 1 file) Summary: Updating B-trees will never scale well using Winchester disks. In an interview in ACM Queue (in 2003?), Jim Gray said: "... programmers have to start thinking of the disk as a sequential device rather than a random access device." In a pithier form, I've read folks saying, "Disk is the new tape." (*) Er, it was a summer 2008 presentation to a conference in Helsinki. I forget the name of the conference, but his presentation slides and video are available online (not YouTube/Google Video, but I may be mistaken). From joelr1@REDACTED Fri Aug 22 22:54:05 2008 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Aug 2008 21:54:05 +0100 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: <46366.1219435029@snookles.snookles.com> References: <46366.1219435029@snookles.snookles.com> Message-ID: <7AEAE6E6-F063-417D-87D0-406F3895AC29@gmail.com> On Aug 22, 2008, at 8:57 PM, Scott Lystig Fritchie wrote: > Even if TC's disk structures were 100% crash-safe, aren't there still > sync problems between the local txn manager's log and any mnesia_ext > backend (as the callbacks exist today)? Yes! Mnesia assumes that everything is fine by the time you get to the backend module. If the backend module crashes then Mnesia is not gonna know about it. There's no way of fixing this short of further serious hacking of the Mnesia proper. If you don't care for ets, dets or both then you can actually view Mnesia as just a transaction coordinator. -- wagerlabs.com From tony@REDACTED Fri Aug 22 23:47:07 2008 From: tony@REDACTED (Tony Arcieri) Date: Fri, 22 Aug 2008 15:47:07 -0600 Subject: [erlang-questions] Determining HiPE availability Message-ID: I'm compiling modules at runtime using smerl, and would like to automatically use HiPE if it's available. I needed a way to programmatically determine if HiPE is available. Someone pointed me at erlang:system_info(hipe_architecture) which returns 'undefined' if HiPE is unavailable. However, this doesn't seem to be documented anywhere. Should it be? -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Sat Aug 23 00:47:02 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 23 Aug 2008 00:47:02 +0200 Subject: [erlang-questions] Determining HiPE availability In-Reply-To: References: Message-ID: <18607.16870.670714.52065@harpo.it.uu.se> Tony Arcieri writes: > I'm compiling modules at runtime using smerl, and would like to > automatically use HiPE if it's available. I needed a way to > programmatically determine if HiPE is available. Someone pointed me at > erlang:system_info(hipe_architecture) which returns 'undefined' if HiPE is > unavailable. However, this doesn't seem to be documented anywhere. Should > it be? I don't think so. This is in effect a private interface between the runtime system and the HiPE compiler. It was never meant to be used by anyone else. In particular, I fear that documenting its current behaviour would prevent us from changing the CPU arch names. What does the native flag to the compiler do if HiPE isn't available? (I admit I don't know as I always invoke the HiPE compiler directly). Does the compiler fail or does it silently fall back to generating BEAM code? If it fails you could wrap a call to the compiler with an exception handler which re-tries the call w/o native. If it falls back to BEAM then you shouldn't have to do anything. From fritchie@REDACTED Sat Aug 23 01:04:43 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2008 18:04:43 -0500 Subject: [erlang-questions] fprof unusable? In-Reply-To: Message of "Fri, 22 Aug 2008 20:00:59 BST." <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> Message-ID: <63065.1219446283@snookles.snookles.com> Joel Reymont wrote: jr> Any suggestions on how to proceed other than shortening the jr> profiling session? Joel, I haven't had much luck with using fprof for 100%-CPU-eating workloads for more than 30-60 seconds. In versions up through R11B-5, occasionally I see fprof:analyse() crash after chugging through some fraction of the trace file. {shrug} I haven't used R12B-* enough to say anything useful. Even R12B releases are going to create gigantic trace files like that if you run for a couple of days, it's the nature of the fprof beast, as far as I know. I very frequently use eprof or even cprof first, to get an idea of where to start looking, then try to devise a short (time-wise) and small (# of Erlang processes-wise) that ought to do the same thing, then use fprof on that. The problem is that the "try to devise..." step isn't always feasible, but that's a case-by-case thing. {shrug} -Scott From matthew@REDACTED Sat Aug 23 02:14:18 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 22 Aug 2008 17:14:18 -0700 Subject: [erlang-questions] clipping of max# of file descriptors by erts when kernel poll is enabled In-Reply-To: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> Message-ID: On Fri, Aug 22, 2008 at 10:56 AM, Joel Reymont wrote: > This happens on Mac OSX Leopard but should affect other platforms as > well. Erlang doesn't use poll(2) on OS X, because it's broken for devices (e.g., it never reports readability on /dev/null; see erts/configure's test for "checking for working poll()"). From matthew@REDACTED Sat Aug 23 02:19:24 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 22 Aug 2008 17:19:24 -0700 Subject: [erlang-questions] clipping of max# of file descriptors by erts when kernel poll is enabled In-Reply-To: References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> Message-ID: On Fri, Aug 22, 2008 at 5:14 PM, Matthew Dempsky wrote: > Erlang doesn't use poll(2) on OS X, because it's broken for devices > (e.g., it never reports readability on /dev/null; see erts/configure's > test for "checking for working poll()"). To be more explicit, because poll(2) is broken, Erlang supports select(2) for fallback if kernel poll is disabled at run-time, so it can't support more than FD_SETSIZE files. From tony@REDACTED Sat Aug 23 02:20:11 2008 From: tony@REDACTED (Tony Arcieri) Date: Fri, 22 Aug 2008 18:20:11 -0600 Subject: [erlang-questions] Determining HiPE availability In-Reply-To: <18607.16870.670714.52065@harpo.it.uu.se> References: <18607.16870.670714.52065@harpo.it.uu.se> Message-ID: On Fri, Aug 22, 2008 at 4:47 PM, Mikael Pettersson wrote: > What does the native flag to the compiler do if HiPE isn't available? > It issues a warning but compiles anyway. I suppose I could just always tell it to use HiPE, but I think it's nice to be able to suppress the warnings. -- Tony Arcieri medioh.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Sat Aug 23 02:20:34 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2008 19:20:34 -0500 Subject: [erlang-questions] Call for Contributions: Mnesia best practices In-Reply-To: Message of "Wed, 02 Jul 2008 09:46:21 EDT." <006401c8dc4a$0330ce80$09926b80$@rr.com> Message-ID: <200808230020.m7N0KYDA067545@snookles.snookles.com> There's nothing like replying to a message that's well over a month old. Bob Calco wrote: bc> I'm looking for thoughts from fellow Erlangers about database design bc> & implementation in Mnesia. bc> [...] bc> That kind of thing. I want to put together something of a master bc> knowledge base on this big subject that the community can use both bc> to promote Erlang and to promote Erlang's "best practices" bc> implementation in the important area of serving data to bc> applications. Bob, I think that such a thing would be welcome. I'd contribute from time to time, though I confess I've less time for Open Source work than I prefer. Have you considered a place to host it? I'm a fan of Wiki-style documentation, and TrapExit(*) provides a wiki for documenting exactly this sort of stuff. -Scott (*) http://www.trapexit.org and more specifically, http://www.trapexit.org/Erlang_Wiki From fritchie@REDACTED Sat Aug 23 02:39:30 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 22 Aug 2008 19:39:30 -0500 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: Message of "Tue, 08 Jul 2008 18:04:37 +1200." <909c265f0807072304u324029f0wd7aa634addd22901@mail.gmail.com> Message-ID: <68760.1219451970@snookles.snookles.com> Hi, Fuad. Sorry this is a month and a half late. Recently I came across a tech report from HP Labs that sounded similar, at least in intent, to the problem you were working on back in July. Fuad Tabba wrote: ft> Another thing I've tried is I created a base for the tree; what I ft> mean is that there's a known root, a known node to the left of the ft> root and a known node that's to the right of the root. [...] This sounds like a small scale version of what the HP researchers did, except they applied client-side caching for *all* internal B-tree nodes. A practical scalable distributed B-tree Aguilera and Golab HPL-2007-193 In the event that client caches are stale, the clients can figure that out and get up-to-date copies of the internal nodes. -Scott From golubovsky@REDACTED Sat Aug 23 05:31:50 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Fri, 22 Aug 2008 23:31:50 -0400 Subject: [erlang-questions] How to understand this message from erlc? Message-ID: Hi, I am continuing my Haskell -> Erlang conversion experiments. While compiling an auto-generated Core Erlang file, erlc crashed with the following message: ./hs_test1.core:none: internal error in beam_trim; crash reason: {{case_clause, {'EXIT', {function_clause, [{beam_trim,frame_size,[[],{0,nil}]}, {beam_trim,frame_layout,3}, {beam_trim,trim,3}, {beam_trim,function,1}, {lists,map,2}, {lists,map,2}, {beam_trim,module,2}, {compile,'-select_passes/2-anonymous-2-',2}]}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} The core file is rather large (about 6000 lines of Core Erlang), autogenerated from Haskell Yhc core. Is it possible to get a line number where erlc crashed from this message or any other information to identify the offending case clause? Running erlc with -d -v -Wall did not add anything to the output. I am not attaching the core file because of its size, but may provide it upon request. Is there any limit on the core source size, number of nested constructs, line length, etc? I use R12B-1. Thanks. PS I never had such messages when trying small pieces of test code. This time I am trying "real life" Haskell libraries like TagSoup and Parsec which compile to much larger and more complex code. -- Dimitry Golubovsky Anywhere on the Web From ulf.wiger@REDACTED Sat Aug 23 08:48:46 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 23 Aug 2008 08:48:46 +0200 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: <7AEAE6E6-F063-417D-87D0-406F3895AC29@gmail.com> References: <46366.1219435029@snookles.snookles.com> <7AEAE6E6-F063-417D-87D0-406F3895AC29@gmail.com> Message-ID: <48AFB2CE.3070408@ericsson.com> Joel Reymont skrev: > On Aug 22, 2008, at 8:57 PM, Scott Lystig Fritchie wrote: > >> Even if TC's disk structures were 100% crash-safe, aren't there still >> sync problems between the local txn manager's log and any mnesia_ext >> backend (as the callbacks exist today)? > > > Yes! > > Mnesia assumes that everything is fine by the time you get to the > backend module. If the backend module crashes then Mnesia is not gonna > know about it. In the rdbms implementation of external_copies, the general idea was that if something goes wrong in the backend module, mnesia dumps core. As far as I can tell, you're right about how tcerl works. > There's no way of fixing this short of further serious hacking > of the Mnesia proper. ...or dumping mnesia core at errors. This will happen if the backend module raises an exception. This is arguably better than having (possibly serious) errors go undetected. BR, Ulf W From ulf.wiger@REDACTED Sat Aug 23 08:57:48 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 23 Aug 2008 08:57:48 +0200 Subject: [erlang-questions] How to understand this message from erlc? In-Reply-To: References: Message-ID: <48AFB4EC.8010100@ericsson.com> I don't have anything to say about this particular error, but I'm intrigued by the project itself. What kind of feedback have you received? Any at all? I guess one obstacle to wider adoption is that the York Haskell Compiler isn't finished (sic), but has there been any talk about what the benefit of compiling Haskell to the Erlang runtime would be? And have you formed an intuition about performance aspects? BR, Ulf W Dimitry Golubovsky skrev: > Hi, > > I am continuing my Haskell -> Erlang conversion experiments. > > While compiling an auto-generated Core Erlang file, erlc crashed with > the following message: ... From cyberlync@REDACTED Sat Aug 23 09:00:47 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Sat, 23 Aug 2008 00:00:47 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> Message-ID: I have done several Erlounges in Seattle to varying levels of attendance. I would be game though. On Thu, Aug 21, 2008 at 1:38 PM, anders conbere wrote: > 2008/8/21 Charles Thompson : >> Anyone know of an Erlang user group in the Seattle area? If not, I'd like to >> start one. > > There's the Functional Language Programming Group (SeaFunc) which > exists but is not very active. But it might be better to bolster that > groups membership then spearhead another low volume group here in > seattle. > > (as a seattlite erlanger I would however be interested). > > ~ Anders > >> >> Best, >> >> Charles >> Newbie Erlang Programmer >> >> -- >> Charles Thompson >> (360) 941-1762 >> charleswthompsoniii@REDACTED >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From richardc@REDACTED Sat Aug 23 09:58:46 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 23 Aug 2008 09:58:46 +0200 Subject: [erlang-questions] How to understand this message from erlc? In-Reply-To: References: Message-ID: <48AFC336.3050805@it.uu.se> Dimitry Golubovsky wrote: > ./hs_test1.core:none: internal error in beam_trim; > crash reason: {{case_clause, > {'EXIT', > {function_clause, > [{beam_trim,frame_size,[[],{0,nil}]}, > {beam_trim,frame_layout,3}, > {beam_trim,trim,3}, > {beam_trim,function,1}, > > Is it possible to get a line number where erlc crashed from this > message or any other information to identify the offending case > clause? You have the module and function: beam_trim:frame_size/2 crashed. If you look at lib/compiler/src/beam_trim.erl, it is easy to see that frame_size/2 does not accept an empty list as the first argument, which seems natural - that would mean that there are no instructions in the function it is compiling, not even a return. If you want the line number in the input file, that's another thing, and it can be hard to > Running erlc with -d -v -Wall did not add anything to the output. You could add +core_lint to see if it catches any problems in your generated code. But it is also possible that you have triggered a bug in the backend, in which case it can be quite hard to figure out the actual problem. > I am not attaching the core file because of its size, but may provide > it upon request. If core_lint does not help, you can mail me the core file, but please first try to minimize the Haskell code that triggers the problem. > Is there any limit on the core source size, number of nested > constructs, line length, etc? I use R12B-1. The short answer is no. /Richard From joelr1@REDACTED Sat Aug 23 10:32:44 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 23 Aug 2008 09:32:44 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by erts when kernel poll is enabled In-Reply-To: References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> Message-ID: Just to make sure I delivered my point across... erl_poll.c will be compiled twice, once with ERTS_POLL_USE_KERNEL_POLL and once without, even when kernel poll is present and the build detects it. ERTS should not be clipping max_fds when ERTS_POLL_USE_KERNEL_POLL is defined, not in the "kernel poll" version of erl_poll.c. To make sure there's no clipping when kernel poll is present and detected, the code should look like this: #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && ! ERTS_POLL_USE_KERNEL_POLL if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif I tested it by running erl +Ktrue and erl +Kfalse and it works. The original version clips max_fds regardless of kernel poll. Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Sat Aug 23 10:35:29 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 23 Aug 2008 09:35:29 +0100 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: <48AFB2CE.3070408@ericsson.com> References: <46366.1219435029@snookles.snookles.com> <7AEAE6E6-F063-417D-87D0-406F3895AC29@gmail.com> <48AFB2CE.3070408@ericsson.com> Message-ID: <9791FB6B-8EFA-4458-B7D6-2B338E3EFD43@gmail.com> On Aug 23, 2008, at 7:48 AM, Ulf Wiger (TN/EAB) wrote: >> There's no way of fixing this short of further serious hacking > > of the Mnesia proper. > > ...or dumping mnesia core at errors. This will happen if the > backend module raises an exception. > > This is arguably better than having (possibly serious) errors > go undetected. But the opposite of what is being asked for here :-). The only true way is to hack Mnesia further and integrate backend modules with the transaction manager. -- wagerlabs.com From kenji.rikitake@REDACTED Sat Aug 23 10:16:36 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Sat, 23 Aug 2008 17:16:36 +0900 Subject: [erlang-questions] Erlang R12B3 inet_ssl_dist (SSL distribution) with ssl-3.9? Message-ID: <20080823081636.GA63811@k2r.org> I have been trying many times to start Erlang SSL distribution on R12B3 with ssl-3.9, which hasn't been successful. I'm running Erlang VM on FreeBSD 6.3-RELEASE. The erl -boot /my-path-to/start_ssl says: 1> whereis(ssl_server). undefined Please let me know how to start the SSL distribution on R12B3. Regards, Kenji Rikitake From ulf.wiger@REDACTED Sat Aug 23 12:01:40 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 23 Aug 2008 12:01:40 +0200 Subject: [erlang-questions] tcerl memory usage, plans for hash-type db In-Reply-To: <9791FB6B-8EFA-4458-B7D6-2B338E3EFD43@gmail.com> References: <46366.1219435029@snookles.snookles.com> <7AEAE6E6-F063-417D-87D0-406F3895AC29@gmail.com> <48AFB2CE.3070408@ericsson.com> <9791FB6B-8EFA-4458-B7D6-2B338E3EFD43@gmail.com> Message-ID: <48AFE004.7070807@ericsson.com> Joel Reymont skrev: > > On Aug 23, 2008, at 7:48 AM, Ulf Wiger (TN/EAB) wrote: > >>> There's no way of fixing this short of further serious hacking >> > of the Mnesia proper. >> >> ...or dumping mnesia core at errors. This will happen if the >> backend module raises an exception. >> >> This is arguably better than having (possibly serious) errors >> go undetected. > > > But the opposite of what is being asked for here :-). The only true way > is to hack Mnesia further and integrate backend modules with the > transaction manager. True. This was the main issue with the mnesia_ext approach to adding additional backends. It was relatively easy to implement, but you sacrifice error handling. BR, Ulf W From nick@REDACTED Sat Aug 23 16:33:02 2008 From: nick@REDACTED (Nick Gerakines) Date: Sat, 23 Aug 2008 07:33:02 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> Message-ID: There have been quite a few people interested in setting up Erlounge events. Using something like Upcoming.org is pretty useful for organizing events like this. Of course you don't have to, but it might be a good idea to keep all of these events grouped together. http://upcoming.yahoo.com/group/4910/ Just a thought. # Nick Gerakines On Sat, Aug 23, 2008 at 12:00 AM, Eric Merritt wrote: > I have done several Erlounges in Seattle to varying levels of > attendance. I would be game though. > > On Thu, Aug 21, 2008 at 1:38 PM, anders conbere wrote: >> 2008/8/21 Charles Thompson : >>> Anyone know of an Erlang user group in the Seattle area? If not, I'd like to >>> start one. >> >> There's the Functional Language Programming Group (SeaFunc) which >> exists but is not very active. But it might be better to bolster that >> groups membership then spearhead another low volume group here in >> seattle. >> >> (as a seattlite erlanger I would however be interested). >> >> ~ Anders >> >>> >>> Best, >>> >>> Charles >>> Newbie Erlang Programmer >>> >>> -- >>> Charles Thompson >>> (360) 941-1762 >>> charleswthompsoniii@REDACTED >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From charleswthompsoniii@REDACTED Sat Aug 23 18:50:13 2008 From: charleswthompsoniii@REDACTED (Charles Thompson) Date: Sat, 23 Aug 2008 09:50:13 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> Message-ID: <7db028f30808230950t4e2e94fcjf5efcc38734f4cc0@mail.gmail.com> Eric, Lennart Ohman, one of the principle creators of OTP, is in town and would be willing to chat about Erlang Wednesday (8/27) or Thursday (8/28) night. Do you know a good place to meet up at say 7:30 or 8:00 p.m.? I've got a standby venue in Redmond. But it may be kind of a boring place to meet up. Best, Charles On Sat, Aug 23, 2008 at 12:00 AM, Eric Merritt wrote: > I have done several Erlounges in Seattle to varying levels of > attendance. I would be game though. > > On Thu, Aug 21, 2008 at 1:38 PM, anders conbere > wrote: > > 2008/8/21 Charles Thompson : > >> Anyone know of an Erlang user group in the Seattle area? If not, I'd > like to > >> start one. > > > > There's the Functional Language Programming Group (SeaFunc) which > > exists but is not very active. But it might be better to bolster that > > groups membership then spearhead another low volume group here in > > seattle. > > > > (as a seattlite erlanger I would however be interested). > > > > ~ Anders > > > >> > >> Best, > >> > >> Charles > >> Newbie Erlang Programmer > >> > >> -- > >> Charles Thompson > >> (360) 941-1762 > >> charleswthompsoniii@REDACTED > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- Charles Thompson (360) 941-1762 charleswthompsoniii@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From aconbere@REDACTED Sat Aug 23 19:07:55 2008 From: aconbere@REDACTED (anders conbere) Date: Sat, 23 Aug 2008 10:07:55 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: <7db028f30808230950t4e2e94fcjf5efcc38734f4cc0@mail.gmail.com> References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> <7db028f30808230950t4e2e94fcjf5efcc38734f4cc0@mail.gmail.com> Message-ID: <8ca3fbe80808231007i5508c4ecpee2ddf02abf5ee8c@mail.gmail.com> On Sat, Aug 23, 2008 at 9:50 AM, Charles Thompson wrote: > Eric, > > Lennart Ohman, one of the principle creators of OTP, is in town and would be > willing to chat about Erlang Wednesday (8/27) or Thursday (8/28) night. Do > you know a good place to meet up at say 7:30 or 8:00 p.m.? I've got a > standby venue in Redmond. But it may be kind of a boring place to meet up. There are a couple cool places where you could hold a meeting like this. There are the co-working spaces in Seattle that would work great, As well as rooms in many of the public libraries. It might also be good to shoot an email out to the Functional Programming group as well as Seattle Tech Startups. ~ Anders > > Best, > > Charles > On Sat, Aug 23, 2008 at 12:00 AM, Eric Merritt wrote: >> >> I have done several Erlounges in Seattle to varying levels of >> attendance. I would be game though. >> >> On Thu, Aug 21, 2008 at 1:38 PM, anders conbere >> wrote: >> > 2008/8/21 Charles Thompson : >> >> Anyone know of an Erlang user group in the Seattle area? If not, I'd >> >> like to >> >> start one. >> > >> > There's the Functional Language Programming Group (SeaFunc) which >> > exists but is not very active. But it might be better to bolster that >> > groups membership then spearhead another low volume group here in >> > seattle. >> > >> > (as a seattlite erlanger I would however be interested). >> > >> > ~ Anders >> > >> >> >> >> Best, >> >> >> >> Charles >> >> Newbie Erlang Programmer >> >> >> >> -- >> >> Charles Thompson >> >> (360) 941-1762 >> >> charleswthompsoniii@REDACTED >> >> >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > > -- > Charles Thompson > (360) 941-1762 > charleswthompsoniii@REDACTED > From cyberlync@REDACTED Sat Aug 23 22:50:54 2008 From: cyberlync@REDACTED (Eric Merritt) Date: Sat, 23 Aug 2008 13:50:54 -0700 Subject: [erlang-questions] Seattle Erlang User Group? In-Reply-To: <7db028f30808230950t4e2e94fcjf5efcc38734f4cc0@mail.gmail.com> References: <7db028f30808211011q4681d837m9d4ff5c36044bc99@mail.gmail.com> <8ca3fbe80808211338k5c985a3oc4164b5d5d64eff@mail.gmail.com> <7db028f30808230950t4e2e94fcjf5efcc38734f4cc0@mail.gmail.com> Message-ID: Charles, I always like Barca's in cap hill. In the evening its usually pretty quiet has decent beer and a nice open area to sit. The bad part is parking isn't great at all. If you want to use it we can send an email to get them to reserve the open are a for us. On Sat, Aug 23, 2008 at 9:50 AM, Charles Thompson wrote: > Eric, > > Lennart Ohman, one of the principle creators of OTP, is in town and would be > willing to chat about Erlang Wednesday (8/27) or Thursday (8/28) night. Do > you know a good place to meet up at say 7:30 or 8:00 p.m.? I've got a > standby venue in Redmond. But it may be kind of a boring place to meet up. > > Best, > > Charles > On Sat, Aug 23, 2008 at 12:00 AM, Eric Merritt wrote: >> >> I have done several Erlounges in Seattle to varying levels of >> attendance. I would be game though. >> >> On Thu, Aug 21, 2008 at 1:38 PM, anders conbere >> wrote: >> > 2008/8/21 Charles Thompson : >> >> Anyone know of an Erlang user group in the Seattle area? If not, I'd >> >> like to >> >> start one. >> > >> > There's the Functional Language Programming Group (SeaFunc) which >> > exists but is not very active. But it might be better to bolster that >> > groups membership then spearhead another low volume group here in >> > seattle. >> > >> > (as a seattlite erlanger I would however be interested). >> > >> > ~ Anders >> > >> >> >> >> Best, >> >> >> >> Charles >> >> Newbie Erlang Programmer >> >> >> >> -- >> >> Charles Thompson >> >> (360) 941-1762 >> >> charleswthompsoniii@REDACTED >> >> >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > > -- > Charles Thompson > (360) 941-1762 > charleswthompsoniii@REDACTED > From dawsdesign@REDACTED Sat Aug 23 23:52:12 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 23 Aug 2008 17:52:12 -0400 Subject: [erlang-questions] Erlware dependency issue In-Reply-To: References: Message-ID: Thanks Dave. I have forwarded my question to the erlware list, which I just discovered. Hopefully they can help me. On Sat, Aug 23, 2008 at 10:11 AM, Dave Smith wrote: > My understanding is that sinan actually uses an independent dependency > system right now, so probably what you're seeing is that sinan (not > faxien) doesn't have eunit installed. I'm not quite sure how to fix > it, unfortunately. :( > > I do know that sinan will be dumping it's internal dependency system > in the (hopefully) near future. > > D. > > 2008/8/22 Matt Williamson : > > Sorry if this is the wrong place for it, but I just decided to make my > > project work with erlware, but when I run `sinan build` I get the > following > > error: > > > > starting run > > [check_depends] start > > [sin_depends_check fault!!] dependency_issue > > Task failed > > run complete with faults > > > > looking into ~/.sinan/logs/kernel.log shows: > > > > =ERROR REPORT==== 21-Aug-2008::21:05:00 === > > Unable to find version list at /5.6.3/Meta/eunit/. Package probably isn't > in > > any of the available repositories > > > > I built erlang from source on ubuntu and installed eunit manually via > > `faxien install-app eunit` > > > > Any ideas? > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Sun Aug 24 03:52:14 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 23 Aug 2008 21:52:14 -0400 Subject: [erlang-questions] gen behaviors and global groups Message-ID: <48B0BECE.9030004@gmail.com> Currently when using gen_* behaviors the way to reference a locally/globally registered server is by providing a server name in the form: ServerName = {local,Name} | {global,GlobalName} When the cluster of nodes is partitioned into global groups, there doesn't seem to be a way to instruct a server to do a global name lookup in a specific global group. Unless I am missing something, it looks like the gen behaviors should allow this types of server names: ServerName = {local,Name} | {global,GlobalName} | {{group, Group}, GlobalName} Without this third option one would have to do something like this in order to call a server registered in group G: my_function(Name, Args) -> Group = {group, G}, case global_group:whereis_name(Group, Name) of Pid when is_pid(Pid) -> gen_server:call(Pid, {my_function, Args}); undefined -> {error, noproc} end. Shouldn't gen.erl handle this sort of name lookups automatically? Serge From kenji.rikitake@REDACTED Sun Aug 24 06:03:00 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Sun, 24 Aug 2008 13:03:00 +0900 Subject: [erlang-questions] Erlang R12B3 inet_ssl_dist does not work with ssl-3.9 In-Reply-To: <20080823081636.GA63811@k2r.org> References: <20080823081636.GA63811@k2r.org> Message-ID: <20080824040300.GA78691@k2r.org> I have been trying many times to start Erlang SSL distribution on R12B3 with ssl-3.9, which hasn't been successful. I'm running Erlang VM on FreeBSD 6.3-RELEASE. *** Problems: * 0. ssl-3.9 manual Chapter 5 does not represent the latest implementation. * 1. In creating start_ssl.boot as described in ssl-3.9 manual section 5.2, two warnings remain: content of the start_ssl.rel file: -- begin -- {release, {"OTP APN 181 01","R12B"}, {erts, "5.6.3"}, [{kernel,"2.12.3"}, {stdlib,"1.15.3"}, {ssl,"3.9"}]}. -- end -- after invoking erl (with no option): -- begin -- Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> systools:make_script("start_ssl",[]). *WARNING* ssl: Source code not found: ssl_pkix_oid.erl *WARNING* ssl: Source code not found: 'OTP-PKIX'.erl ok 2> -- end -- To suppress the warning messages, creating symbolic links worked: (cd $ERLANG_TOP/lib/ssl-3.9/src; ln -s ../pkix/OTP-PKIX.erl; ln -s ../pkix/ssk_pkix_old.erl;) * 2. Even after the boot script is built, ssl_server is not registered, which is supposed to be, as described in ssl manual Section 5.2. -- start -- erl -boot /my/directory/start_ssl Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> whereis(ssl_server). undefined 2> c:regs(). ** Registered procs on node nonode@REDACTED ** Name Pid Initial Call Reds Msgs application_controlle <0.5.0> erlang:apply/2 710 0 code_server <0.19.0> erlang:apply/2 80684 0 erl_prim_loader <0.2.0> erlang:apply/2 67923 0 error_logger <0.4.0> gen_event:init_it/6 286 0 file_server_2 <0.18.0> file_server:init/1 17399 0 global_group <0.17.0> global_group:init/1 78 0 global_name_server <0.11.0> global:init/1 67 0 inet_db <0.15.0> inet_db:init/1 165 0 init <0.0.0> otp_ring0:start/2 3522 0 kernel_safe_sup <0.26.0> supervisor:kernel/1 63 0 kernel_sup <0.9.0> supervisor:kernel/1 1319 0 rex <0.10.0> rpc:init/1 46 0 ssl_broker_sup <0.32.0> supervisor:ssl_broker_sup 60 0 ssl_connection_sup <0.34.0> supervisor:ssl_connection 60 0 ssl_manager <0.33.0> ssl_manager:init/1 68 0 ssl_sup <0.31.0> supervisor:ssl_sup/1 265 0 user <0.22.0> group:server/3 47 0 ** Registered ports on node nonode@REDACTED ** Name Id Command ok -- end -- * 3. By reading the source code, I found that ssl_server is no longer registered in ssl-3.9 (see ssl:ensure_old_ssl_started/0). So I tested as follows: erl -boot /my/directory/start_ssl -proto_dist inet_ssl 1: ssl:version() -> {ok,{"3.9","OpenSSL 0.9.7e-p1 25 Oct 2004", "OpenSSL 0.9.7e-p1 25 Oct 2004"}} 2: net_kernel:start([a1]) -> {error,{shutdown,{child,undefined,net_sup_dynamic, {erl_distribution,start_link,[[a1]]}, permanent,1000,supervisor, [erl_distribution]}}} * 4. I added SASL to the boot script (after stdlib and before ssl) to report the errors, and found: -- begin -- Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.33.0>}, {name,alarm_handler}, {mfa,{alarm_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.34.0>}, {name,overload}, {mfa,{overload,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,sasl_sup} started: [{pid,<0.32.0>}, {name,sasl_safe_sup}, {mfa, {supervisor,start_link, [{local,sasl_safe_sup},sasl,safe]}}, {restart_type,permanent}, {shutdown,infinity}, {child_type,supervisor}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,sasl_sup} started: [{pid,<0.35.0>}, {name,release_handler}, {mfa,{release_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === application: sasl started_at: nonode@REDACTED =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,ssl_sup} started: [{pid,<0.41.0>}, {name,ssl_broker_sup}, {mfa,{ssl_broker_sup,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,supervisor}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,ssl_sup} started: [{pid,<0.42.0>}, {name,ssl_manager}, {mfa,{ssl_manager,start_link,[]}}, {restart_type,permanent}, {shutdown,4000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === supervisor: {local,ssl_sup} started: [{pid,<0.43.0>}, {name,ssl_connection}, {mfa,{ssl_connection_sup,start_link,[]}}, {restart_type,permanent}, {shutdown,4000}, {child_type,supervisor}] =PROGRESS REPORT==== 24-Aug-2008::11:38:38 === application: ssl started_at: nonode@REDACTED Eshell V5.6.3 (abort with ^G) 1> ssl:version(). {ok,{"3.9","OpenSSL 0.9.7e-p1 25 Oct 2004", "OpenSSL 0.9.7e-p1 25 Oct 2004"}} 2> =PROGRESS REPORT==== 24-Aug-2008::11:38:48 === supervisor: {local,ssl_sup} started: [{pid,<0.48.0>}, {name,ssl_server}, {mfa,{ssl_server,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] 2> net_kernel:start([a1,shortnames). =PROGRESS REPORT==== 24-Aug-2008::11:39:07 === supervisor: {local,net_sup} started: [{pid,<0.51.0>}, {name,ssl_server_prim}, {mfa,{ssl_server,start_link_prim,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:39:07 === supervisor: {local,net_sup} started: [{pid,<0.52.0>}, {name,erl_epmd}, {mfa,{erl_epmd,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 24-Aug-2008::11:39:07 === supervisor: {local,net_sup} started: [{pid,<0.53.0>}, {name,auth}, {mfa,{auth,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =INFO REPORT==== 24-Aug-2008::11:39:07 === Protocol: "alt_ssl": register error: {normal, {gen_server,call, [ssl_server_prim, {listen,<0.54.0>,{0,0,0,0},0,[],128}, infinity]}} {error,{shutdown,{child,undefined,net_sup_dynamic, {erl_distribution,start_link,[[a1,shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}} 3> =CRASH REPORT==== 24-Aug-2008::11:39:07 === crasher: pid: <0.54.0> registered_name: net_kernel exception exit: {error,badarg} in function gen_server:init_it/6 initial call: gen:init_it(gen_server,<0.50.0>,<0.50.0>, {local,net_kernel}, net_kernel, {a1,shortnames,15000}, []) ancestors: [net_sup,kernel_sup,<0.8.0>] messages: [] links: [<0.50.0>] dictionary: [{longnames,false}] trap_exit: true status: running heap_size: 377 stack_size: 23 reductions: 269 neighbours: =SUPERVISOR REPORT==== 24-Aug-2008::11:39:07 === Supervisor: {local,net_sup} Context: start_error Reason: {'EXIT',nodistribution} Offender: [{pid,undefined}, {name,net_kernel}, {mfa,{net_kernel,start_link,[[a1,shortnames]]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =SUPERVISOR REPORT==== 24-Aug-2008::11:39:07 === Supervisor: {local,net_sup} Context: shutdown_error Reason: normal Offender: [{pid,<0.51.0>}, {name,ssl_server_prim}, {mfa,{ssl_server,start_link_prim,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] 3> c:regs(). ** Registered procs on node nonode@REDACTED ** Name Pid Initial Call Reds Msgs alarm_handler <0.33.0> gen_event:init_it/6 34 0 application_controlle <0.5.0> erlang:apply/2 920 0 code_server <0.19.0> erlang:apply/2 86519 0 erl_prim_loader <0.2.0> erlang:apply/2 76524 0 error_logger <0.4.0> gen_event:init_it/6 19948 0 file_server_2 <0.18.0> file_server:init/1 17537 0 global_group <0.17.0> global_group:init/1 78 0 global_name_server <0.11.0> global:init/1 67 0 inet_db <0.15.0> inet_db:init/1 164 0 init <0.0.0> otp_ring0:start/2 5008 0 kernel_safe_sup <0.26.0> supervisor:kernel/1 63 0 kernel_sup <0.9.0> supervisor:kernel/1 1375 0 overload <0.34.0> overload:init/1 45 0 release_handler <0.35.0> release_handler:init/1 1433 0 rex <0.10.0> rpc:init/1 46 0 sasl_safe_sup <0.32.0> supervisor:sasl/1 200 0 sasl_sup <0.31.0> supervisor:sasl/1 182 0 ssl_broker_sup <0.41.0> supervisor:ssl_broker_sup 60 0 ssl_connection_sup <0.43.0> supervisor:ssl_connection 60 0 ssl_manager <0.42.0> ssl_manager:init/1 68 0 ssl_server <0.48.0> ssl_server:init/1 1248 0 ssl_sup <0.40.0> supervisor:ssl_sup/1 344 0 user <0.22.0> group:server/3 12320 0 ** Registered ports on node nonode@REDACTED ** Name Id Command ok -- end -- *** So far I can't find any workaround for this. I suspect this glitch happened when ssl library internal structure has been changed in ssl-3.9. Please let me know how I can start up inet_ssl_dist on R12B3. Kenji Rikitake From per@REDACTED Sun Aug 24 21:25:44 2008 From: per@REDACTED (Per Hedeland) Date: Sun, 24 Aug 2008 21:25:44 +0200 (CEST) Subject: [erlang-questions] max timeout In-Reply-To: <4d08db370808220119o1d79ffe8t809e6baaee2db194@mail.gmail.com> Message-ID: <200808241925.m7OJPi6h093180@pluto.hedeland.org> "Hynek Vychodil" wrote: > > {ok, _} = send_after(Time, Ref), >> It should be much more simpler to do it without modify timer_server: >> >> sleep(Time) -> >> case whereis(timer_server) of >> undefined -> receive after Time -> ok end; >> _ -> >> Ref = make_ref(), >> send_after(Time, Ref), >> receive Ref -> ok end >> end. Matter of taste perhaps, whether you prefer the absolute minimum of change vs regularity of implementation. One thing that often falls out of the latter is consistency in API, such that you don't end up with one API function doing a badmatch crash on erroneous input, while all the others return {error, badarg}. And of course one could ask why create an unneeded ref, or why require two messages from the server when you only need one, but that's more in the nitpicking area. --Per Hedeland From saleyn@REDACTED Mon Aug 25 01:26:30 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 24 Aug 2008 19:26:30 -0400 Subject: [erlang-questions] gen behaviors and global groups In-Reply-To: <48B0BECE.9030004@gmail.com> References: <48B0BECE.9030004@gmail.com> Message-ID: <48B1EE26.1030002@gmail.com> Little bugfix in my previous posting below: Serge Aleynikov wrote: > Currently when using gen_* behaviors the way to reference a > locally/globally registered server is by providing a server name in the > form: > > ServerName = {local,Name} | {global,GlobalName} > > When the cluster of nodes is partitioned into global groups, there > doesn't seem to be a way to instruct a server to do a global name lookup > in a specific global group. Unless I am missing something, it looks > like the gen behaviors should allow this types of server names: > > ServerName = {local,Name} | {global,GlobalName} | > {{group, Group}, GlobalName} > > Without this third option one would have to do something like this in > order to call a server registered in group G: > my_function({{group, Group}, Name}, Args) -> case global_group:whereis_name(Group, Name) of Pid when is_pid(Pid) -> my_function(Pid, Args); undefined -> {error, noproc} end; my_function(Name, Args) -> gen_server:call(Name, {my_function, Args}). > > Shouldn't gen.erl handle this sort of name lookups automatically? > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yoursurrogategod@REDACTED Mon Aug 25 02:29:39 2008 From: yoursurrogategod@REDACTED (yoursurrogategod@REDACTED) Date: Sun, 24 Aug 2008 17:29:39 -0700 (PDT) Subject: [erlang-questions] Circular list In-Reply-To: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> References: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> Message-ID: <4d8dcf26-146a-4918-88d5-0fe7920e26de@8g2000hse.googlegroups.com> Doing the below is pretty inefficient, as Programming Erlang by Joe Armstrong pg. 64 mentions. List ++ [Foo], I'm curious why doing this doesn't work at all. 4> L3 = [L2|"F"]. [["B","C","D","E"],70] I'm not too keen on how lists work, so this is puzzling to me :) . On Aug 22, 9:34?am, "Colm Dougan" wrote: > Hi, > > If I have a list of a fixed size (say 10,000 elements). ?What is the > most efficient way to add a new item to the list and force out the old > first element. ?By most efficient I mostly mean without having to copy > the entire list each time, if that is even possible. > > I'm currently doing a double reverse trick, e.g. : > > Eshell V5.6.3 ?(abort with ^G) > 1> L1 = ["A", "B", "C", "D", "E"]. > ["A","B","C","D","E"] > 2> [_ | L2] = L1. > ["A","B","C","D","E"] > 3> lists:reverse(["F" | lists:reverse(L2)]). > ["B","C","D","E","F"] > > Is there a more efficient way? ?I tried a benchmark and the reverse > seems more costly than I expected. > > Colm > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From yoursurrogategod@REDACTED Mon Aug 25 02:42:31 2008 From: yoursurrogategod@REDACTED (yoursurrogategod@REDACTED) Date: Sun, 24 Aug 2008 17:42:31 -0700 (PDT) Subject: [erlang-questions] Circular list In-Reply-To: <4d8dcf26-146a-4918-88d5-0fe7920e26de@8g2000hse.googlegroups.com> References: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> <4d8dcf26-146a-4918-88d5-0fe7920e26de@8g2000hse.googlegroups.com> Message-ID: *lol* Finally one of my posts get here ^_^ . Ok, back on topic. Here is a link to the man page about the queue module. http://www.erlang.org/doc/man/queue.html I found this part interesting. All operations has an amortized O(1) running time, except len/1, join/ 2, split/2 and filter/2 that are O(n). To minimize the size of a queue minimizing the amount of garbage built by queue operations, the queues do not contain explicit length information, and that is why len/1 is O(n). If better performance for this particular operation is essential, it is easy for the caller to keep track of the length. Worst case you'll need to tack on a length function that keeps track of a limit. On Aug 24, 8:29?pm, "yoursurrogate...@REDACTED" wrote: > Doing the below is pretty inefficient, as Programming Erlang by Joe > Armstrong pg. 64 mentions. > > List ++ [Foo], > > I'm curious why doing this doesn't work at all. > > 4> L3 = [L2|"F"]. > [["B","C","D","E"],70] > > I'm not too keen on how lists work, so this is puzzling to me :) . > > On Aug 22, 9:34?am, "Colm Dougan" wrote: > > > > > Hi, > > > If I have a list of a fixed size (say 10,000 elements). ?What is the > > most efficient way to add a new item to the list and force out the old > > first element. ?By most efficient I mostly mean without having to copy > > the entire list each time, if that is even possible. > > > I'm currently doing a double reverse trick, e.g. : > > > Eshell V5.6.3 ?(abort with ^G) > > 1> L1 = ["A", "B", "C", "D", "E"]. > > ["A","B","C","D","E"] > > 2> [_ | L2] = L1. > > ["A","B","C","D","E"] > > 3> lists:reverse(["F" | lists:reverse(L2)]). > > ["B","C","D","E","F"] > > > Is there a more efficient way? ?I tried a benchmark and the reverse > > seems more costly than I expected. > > > Colm > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From rpeterso@REDACTED Mon Aug 25 04:33:36 2008 From: rpeterso@REDACTED (Ron Peterson) Date: Sun, 24 Aug 2008 22:33:36 -0400 Subject: [erlang-questions] beginner question In-Reply-To: References: <20080817030712.GB22329@mtholyoke.edu> Message-ID: <20080825023336.GT29574@mtholyoke.edu> 2008-08-17_20:50:24-0400 "Richard A. O'Keefe" : > or even > > for(LB, UB, Fun) -> > [Fun(I) || I <- lists:seq(LB, UB)]. > > Better still, ditch for/3 entirely, and write > the list comprehension in place. (Getting back to this after a few days...) Got it, e.g. random_tuples( Max, Num ) -> set_seed_to_now(), [ random_tuple( Max ) || _ <- lists:seq( 1, Num ) ]. I was playing w/ for/3 mostly as an intellectual excercise. I'm really very new w/ this. Thanks for the help. -- Ron Peterson Network & Systems Manager Mount Holyoke College http://www.mtholyoke.edu/~rpeterso - I wish my computer would do what I want it to do - not what I tell it to do. From mats.cronqvist@REDACTED Mon Aug 25 08:57:44 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 25 Aug 2008 08:57:44 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> Message-ID: <48B257E8.2090106@gmail.com> Ulf Wiger wrote: > I should perhaps bring special notation to the smiley at the > end of my message. (: > > Whether or not the solution is cool is surely a matter of > taste - but I believe that the one who first came up with it > was Mats Cronqvist, the champion of obfuscated Erlang > code. (: > thanks for the endorsement... for the record, i have since moved on to using this: -define(position,[process_info(self(),current_function),{line,?LINE}]). sometimes adding this: proplists:lookup(source,?MODULE:module_info(compile)). mats From bgustavsson@REDACTED Mon Aug 25 09:02:58 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 25 Aug 2008 09:02:58 +0200 Subject: [erlang-questions] How to understand this message from erlc? In-Reply-To: References: Message-ID: <6672d0160808250002o3ccf34ebxbe9eabb3e33bc3dd@mail.gmail.com> > > The core file is rather large (about 6000 lines of Core Erlang), > autogenerated from Haskell Yhc core. > > Is it possible to get a line number where erlc crashed from this > message or any other information to identify the offending case > clause? > You can uncomment the io:fwrite/2 call in the following function at the beginning of beam_trim.erl function({function,Name,Arity,CLabel,Is0}) -> %%ok = io:fwrite("~w: ~p\n", [?LINE,{Name,Arity}]), St = #st{safe=safe_labels(Is0, []),lbl=beam_utils:index_labels(Is0)}, Is = trim(Is0, St, []), {function,Name,Arity,CLabel,Is}. to printout the name of the offending function. > > > I am not attaching the core file because of its size, but may provide > it upon request. > If you can identify the offending function and provide a smaller core file, I can have a look. > > Is there any limit on the core source size, number of nested > constructs, line length, etc? I use R12B-1. > No. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Mon Aug 25 09:18:18 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 25 Aug 2008 09:18:18 +0200 Subject: [erlang-questions] max timeout In-Reply-To: <200808241925.m7OJPi6h093180@pluto.hedeland.org> References: <4d08db370808220119o1d79ffe8t809e6baaee2db194@mail.gmail.com> <200808241925.m7OJPi6h093180@pluto.hedeland.org> Message-ID: <6672d0160808250018u386808bar7971eccbe3da8c3a@mail.gmail.com> On Sun, Aug 24, 2008 at 9:25 PM, Per Hedeland wrote: > "Hynek Vychodil" wrote: > > > > {ok, _} = send_after(Time, Ref), > > >> It should be much more simpler to do it without modify timer_server: > >> > >> sleep(Time) -> > >> case whereis(timer_server) of > >> undefined -> receive after Time -> ok end; > >> _ -> > >> Ref = make_ref(), > >> send_after(Time, Ref), > >> receive Ref -> ok end > >> end. > > Matter of taste perhaps, whether you prefer the absolute minimum of > change vs regularity of implementation. One thing that often falls out > of the latter is consistency in API, such that you don't end up with one > API function doing a badmatch crash on erroneous input, while all the > others return {error, badarg}. And of course one could ask why create an > unneeded ref, or why require two messages from the server when you only > need one, but that's more in the nitpicking area. > We have had problems with the timer server becoming seriously overloaded. See: http://erlang.org/doc/efficiency_guide/commoncaveats.html#3.2 Therefore, I think that the proper way is to do "receive after" in a try/catch, and only call the timer server if the timeout value is invalid. If anyone submits a patch like that, we'll try to include it in R12B-4. /Bjorn > > --Per Hedeland > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Mon Aug 25 09:46:38 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Mon, 25 Aug 2008 09:46:38 +0200 Subject: [erlang-questions] demonitor In-Reply-To: <20080822124709.GA18759@erix.ericsson.se> References: <48AEA987.7050002@hyber.org> <20080822124709.GA18759@erix.ericsson.se> Message-ID: <48B2635E.8080401@hyber.org> Raimo Niskanen wrote: > > In that case _always_ use erlang:demonitor(Mref, [flush]). Great, didn't know it existed. > > We could not change the behaviour of erlang:demonitor/1; > backwards compatibility... > Hmmm... /klacke From ignatios@REDACTED Mon Aug 25 11:47:41 2008 From: ignatios@REDACTED (Ignatios Souvatzis) Date: Mon, 25 Aug 2008 11:47:41 +0200 Subject: [erlang-questions] Cologne-Bonn-Euskirchen Erlounge? In-Reply-To: <20080814211726.45410@gmx.net> References: <20080814211726.45410@gmx.net> Message-ID: <20080825094741.GA24348@cs.uni-bonn.de> On Thu, Aug 14, 2008 at 11:17:26PM +0200, Rainer Hansen wrote: > Is anyone in the Cologne-Bonn-Euskirchen area (Germany) interested in some sort of > Erlang related get-together? yes. -is From andreasmk2@REDACTED Mon Aug 25 12:20:53 2008 From: andreasmk2@REDACTED (Andreas Bakurov) Date: Mon, 25 Aug 2008 13:20:53 +0300 Subject: [erlang-questions] Erlounge Athens ? In-Reply-To: <48AEF5B5.5050605@gmail.com> References: <48AEA52B.5070508@gmail.com> <48AEF5B5.5050605@gmail.com> Message-ID: <48B28785.2070108@gmail.com> It's wonderful, probably we need more people, If you have some proposal of how we can find them it will be very helpful. In case that we not be able to find some satisfactory number of participants , let's make our meeting more general, I propose functional programming meeting or something similar. Regards etc... Andreas Bakurov From raimo+erlang-questions@REDACTED Mon Aug 25 13:08:50 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 25 Aug 2008 13:08:50 +0200 Subject: [erlang-questions] : fprof unusable? In-Reply-To: <63065.1219446283@snookles.snookles.com> References: <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> <63065.1219446283@snookles.snookles.com> Message-ID: <20080825110850.GB29731@erix.ericsson.se> On Fri, Aug 22, 2008 at 06:04:43PM -0500, Scott Lystig Fritchie wrote: > Joel Reymont wrote: > > jr> Any suggestions on how to proceed other than shortening the > jr> profiling session? Nope. See below. > > Joel, I haven't had much luck with using fprof for 100%-CPU-eating > workloads for more than 30-60 seconds. In versions up through R11B-5, > occasionally I see fprof:analyse() crash after chugging through some > fraction of the trace file. {shrug} I haven't used R12B-* enough to > say anything useful. > > Even R12B releases are going to create gigantic trace files like that if > you run for a couple of days, it's the nature of the fprof beast, as far > as I know. > > I very frequently use eprof or even cprof first, to get an idea of where > to start looking, then try to devise a short (time-wise) and small (# of > Erlang processes-wise) that ought to do the same thing, then use fprof > on that. The problem is that the "try to devise..." step isn't always > feasible, but that's a case-by-case thing. {shrug} > Very good advice, indeed! Fprof takes so much CPU load that it is nothing to use on a heavily loaded system other than a not too heavily loaded system under a very short time. It is in the nature of the "trace all analyse later" approach fprof has to use. I have since long thought about some way to augument the call trace with information of whether the call was tail recursive or not, but when the trace point is reached, that information is lost. But any dirty trick would do, I have just not got one yet. > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joelr1@REDACTED Mon Aug 25 14:39:33 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 13:39:33 +0100 Subject: [erlang-questions] : fprof unusable? In-Reply-To: <20080825110850.GB29731@erix.ericsson.se> References: <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> <63065.1219446283@snookles.snookles.com> <20080825110850.GB29731@erix.ericsson.se> Message-ID: <26B73BE3-94F6-4CD5-ABDE-36673A4CC85E@gmail.com> On Aug 25, 2008, at 12:08 PM, Raimo Niskanen wrote: > Fprof takes so much CPU load that it is nothing to use on > a heavily loaded system other than a not too heavily loaded > system under a very short time. FYI, this is just one problem with fprof. My problem is that during the analysis phase fprof uses ETS and basically runs out of memory! -- wagerlabs.com From joe@REDACTED Mon Aug 25 14:52:44 2008 From: joe@REDACTED (Joe Williams) Date: Mon, 25 Aug 2008 07:52:44 -0500 Subject: [erlang-questions] missouri erlounge? In-Reply-To: <48ADD2BF.7010706@joetify.com> References: <20080821192023.GA4037@localhost> <48ADD2BF.7010706@joetify.com> Message-ID: <48B2AB1C.5090400@joetify.com> For anyone that might be interested I have setup a blog (http://erloungestl.org/) with info about Erlounge events in Missouri. Our first meeting will be in St Louis, Sept 11 at 7pm. More info at http://erloungestl.org/2008/08/24/first-erloungestl-meeting-sept-11-7pm/ -Joe Joe Williams wrote: > I am in STL and would be interested in getting some people together. > > -Joe > > > ian eyberg wrote: > >> greets- >> >> this is a long shot but anyone doing an erlounge >> in/around Missouri or interested in starting one? >> probably the closest location would be chicago but >> that's a tad bit too far for me >> >> st. louis/k.c. would be more my pref. >> >> -Ian >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > -- Name: Joseph A. Williams Email: joe@REDACTED From rickard.s.green@REDACTED Mon Aug 25 15:14:18 2008 From: rickard.s.green@REDACTED (Rickard Green S) Date: Mon, 25 Aug 2008 15:14:18 +0200 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> Message-ID: <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> Matthew's answer is correct. If we need to fall back on select() on a filedescriptor that is larger than select() can handle, your modification wont work. BR, Rickard Green, Erlang/OTP, Ericsson AB. -----Ursprungligt meddelande----- Fr?n: erlang-questions-bounces@REDACTED genom Joel Reymont Skickat: l? 2008-08-23 10:32 Till: Matthew Dempsky Kopia: Erlang Questions ?mne: Re: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled Just to make sure I delivered my point across... erl_poll.c will be compiled twice, once with ERTS_POLL_USE_KERNEL_POLL and once without, even when kernel poll is present and the build detects it. ERTS should not be clipping max_fds when ERTS_POLL_USE_KERNEL_POLL is defined, not in the "kernel poll" version of erl_poll.c. To make sure there's no clipping when kernel poll is present and detected, the code should look like this: #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && ! ERTS_POLL_USE_KERNEL_POLL if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif I tested it by running erl +Ktrue and erl +Kfalse and it works. The original version clips max_fds regardless of kernel poll. Thanks, Joel -- wagerlabs.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From ulf.wiger@REDACTED Mon Aug 25 15:33:17 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 25 Aug 2008 15:33:17 +0200 Subject: [erlang-questions] Circular list In-Reply-To: <4d8dcf26-146a-4918-88d5-0fe7920e26de@8g2000hse.googlegroups.com> References: <24d4f39c0808220634l49188cdet690a703606a4861e@mail.gmail.com> <4d8dcf26-146a-4918-88d5-0fe7920e26de@8g2000hse.googlegroups.com> Message-ID: <48B2B49D.8080707@ericsson.com> yoursurrogategod@REDACTED skrev: > Doing the below is pretty inefficient, as Programming Erlang by Joe > Armstrong pg. 64 mentions. > > List ++ [Foo], > > I'm curious why doing this doesn't work at all. > > 4> L3 = [L2|"F"]. > [["B","C","D","E"],70] The pattern [A|B] means "a list with the element A followed by the list B". In this case A = L2 and B = "F". So it *does* work - it's just doesn't do the same thing as ++. ;-) Using [Head|Tail] patterns, the Erlang equivalent to ++ is: '++'([H|T], L2) -> [H|'++'(T, L2)]; '++'([], L2) -> L2. That is, you need to iterate to the end of the first list in order to append another list to it. The '++'(A,B) function above is less efficient than A++B, since the latter is a BIF. One place where you could use [L1|L2], or even [L1,L2] in place of append, is when building an "IO list". When sending a "deep" list through a port, or converting it to a binary, using list_to_binary/1 or iolist_to_binary/1, it is automatically and efficiently flattened. BR, Ulf W > > I'm not too keen on how lists work, so this is puzzling to me :) . > > On Aug 22, 9:34 am, "Colm Dougan" wrote: >> Hi, >> >> If I have a list of a fixed size (say 10,000 elements). What is the >> most efficient way to add a new item to the list and force out the old >> first element. By most efficient I mostly mean without having to copy >> the entire list each time, if that is even possible. >> >> I'm currently doing a double reverse trick, e.g. : >> >> Eshell V5.6.3 (abort with ^G) >> 1> L1 = ["A", "B", "C", "D", "E"]. >> ["A","B","C","D","E"] >> 2> [_ | L2] = L1. >> ["A","B","C","D","E"] >> 3> lists:reverse(["F" | lists:reverse(L2)]). >> ["B","C","D","E","F"] >> >> Is there a more efficient way? I tried a benchmark and the reverse >> seems more costly than I expected. >> >> Colm >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Mon Aug 25 15:50:31 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 14:50:31 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> Message-ID: <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> Rickard, On Aug 25, 2008, at 2:14 PM, Rickard Green S wrote: > Matthew's answer is correct. If we need to fall back on select() on > a filedescriptor that is larger than select() can handle, your > modification wont work. The decision to use select() is made by ERTS during initialization. If kernel poll cannot be used then the version of erl_poll.c compiled without the ERTS_POLL_USE_KERNEL_POLL flag will be used. This version will clip the file descriptors as per the code below. #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && ! ERTS_POLL_USE_KERNEL_POLL if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif The kernel poll version of the same erl_poll.c will determine the maximum number of file descriptors according to the OS kernel configuration, a few lines above the clipping code. This version does NOT need any clipping and adding && !ERTS_POLL_USE_KERNEL_POLL above will ensure this. Again, there's no "fallback on select" at runtime. The decision to make use of select is made depending on platform capabilities at build time and on the +K setting. If erl is told not to use kernel poll while the capability is there, then the code from erl_poll_nkp.o will be used and this code will always clip descriptors. If kernel poll is available and erlang is told to use it then there will be NO fallback to select and NO clipping of descriptors to FD_SETSIZE is needed or wanted. The way to ensure this is to add && ! ERTS_POLL_USE_KERNEL_POLL to the clipping code above. Erlang is supposed to scale and without a fix to the above I cannot scale my supposedly scalable poker server above ~300 users on a single Erlang VM. This plain and obviously SUCKS! With my proposed fix I can scale to thousands of users on a single VM without a problem. I insist that I'm right and the OTP team is wrong. There's a bug in erl_poll.c and the solution is trivial. Please fix the bug! Thanks, Joel -- wagerlabs.com From golubovsky@REDACTED Mon Aug 25 16:40:16 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Mon, 25 Aug 2008 10:40:16 -0400 Subject: [erlang-questions] Indexed element access: array vs. erlang:element Message-ID: Hi, I need an index-based access to elements of a fixed-size array-like structure. Number of elements is expected to be about several thousands. What would be more efficient: to create an array (using the "array" module) or to build a huge tuple and use erlang:element? Thanks. PS I suspect the latter, but how does erlang:element scale on tuples of such size? -- Dimitry Golubovsky Anywhere on the Web From joelr1@REDACTED Mon Aug 25 16:53:00 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 15:53:00 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: Message-ID: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> Why not profile and find out? Please share results when you do! On Aug 25, 2008, at 3:40 PM, Dimitry Golubovsky wrote: > What would be more efficient: to create an array (using the "array" > module) or to build a huge tuple and use erlang:element? > [...] > PS I suspect the latter, but how does erlang:element scale on tuples > of such size? -- wagerlabs.com From golubovsky@REDACTED Mon Aug 25 16:56:43 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Mon, 25 Aug 2008 10:56:43 -0400 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> Message-ID: Joel, If nobody did it before, then I'll do (not earlier than tonight anyway ;) I just believe someone already came across such a common task. Thank you. On 8/25/08, Joel Reymont wrote: > Why not profile and find out? > > Please share results when you do! -- Dimitry Golubovsky Anywhere on the Web From joelr1@REDACTED Mon Aug 25 17:47:13 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 16:47:13 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> Message-ID: <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> On Aug 25, 2008, at 3:56 PM, Dimitry Golubovsky wrote: > Joel, > > If nobody did it before, then I'll do (not earlier than tonight > anyway ;) Here, check out the performance of fixed-size vs extensible array set op. Astounding! --- Mac OSX Leopard 10.5.4 Mac Pro 2x2.8Ghz Quad-Core Intel Xeon, 14Gb 800Mhz DDR2 FB-DIMM Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- threads:0] [kernel-poll:false] %% 10K elements 14> arr:test(). Fixed-size array: get: 1256ns, set: 6667ns Extensible array: get: 1255ns, set: 22ns Tuple: get: 659ns, set: 6ns ok %% 1 million 15> arr:test(1000000). Fixed-size array: get: 121881ns, set: 777067ns Extensible array: get: 120026ns, set: 35ns Tuple: get: 66288ns, set: 40ns ok --- -module(arr). -compile([export_all]). data1(N) -> %% size implies fixed-size array %% but lets be explicit array:new([{size, N}, {default, 0}, {fixed, true}]). data2(N) -> %% extensible array array:new([{size, N}, {default, 0}, {fixed, false}]). data3(N) -> erlang:make_tuple(N, 0). array_set(Array, I, Value) -> %% array indexing starts at 0 array:set(I - 1, Value, Array). tuple_set(Tuple, I, Value) -> %% tuple indexing starts at 1 setelement(I, Tuple, Value). array_get(Array, I) -> array:get(I - 1, Array). tuple_get(Tuple, I) -> element(I, Tuple). get(_, _, 0) -> ok; get(Fun, Data, N) -> Fun(Data, N), get(Fun, Data, N - 1). set(_, _, 0) -> ok; set(Fun, Data, N) -> Data1 = Fun(Data, N, N), set(Fun, Data1, N - 1). test() -> test(10000). test(N) -> %% fixed-size array {G1, _} = timer:tc(arr, get, [{arr, array_get}, data1(N), N]), {S1, _} = timer:tc(arr, set, [{arr, array_set}, data1(N), N]), %% extensible array {G2, _} = timer:tc(arr, get, [{arr, array_get}, data2(N), N]), {S2, _} = timer:tc(arr, set, [{arr, array_get}, data2(N), N]), %% tuple {G3, _} = timer:tc(arr, get, [{arr, tuple_get}, data3(N), N]), {S3, _} = timer:tc(arr, set, [{arr, tuple_get}, data3(N), N]), %% results io:format("Fixed-size array: get: ~8wns, set: ~8wns~n", [G1 , S1]), io:format("Extensible array: get: ~8wns, set: ~8wns~n", [G2 , S2]), io:format("Tuple: get: ~8wns, set: ~8wns~n", [G3 , S3]), ok. -- wagerlabs.com From babo.online@REDACTED Mon Aug 25 18:28:06 2008 From: babo.online@REDACTED (Attila Babo) Date: Mon, 25 Aug 2008 18:28:06 +0200 Subject: [erlang-questions] Erlang R12B3 inet_ssl_dist (SSL distribution) with ssl-3.9? In-Reply-To: <20080823081636.GA63811@k2r.org> References: <20080823081636.GA63811@k2r.org> Message-ID: <597c69660808250928o1699dec6ucbdbeedf503ae663@mail.gmail.com> All you need to start ssl from a boot file is to state ssl as required application in your .app file. Without a proper boot file just start it like application:start(ssl). I hope this helps! From joelr1@REDACTED Mon Aug 25 18:42:55 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 17:42:55 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> Message-ID: <6BDAA77F-2397-4A6B-A1BA-CE23053E3438@gmail.com> There are serious errors in the code I posted but I updated the code here and added gb_trees for kicks: http://www.wagerlabs.com/blog/2008/08/optimizing-erlang-a-death-match-of-arrays-vs-tuples.html#more One of the differences is that I'm using the populated data structure for get operations instead of an empty one. Times are in microseconds as Serge Aleynikov kindly pointed out. Thanks, Joel From golubovsky@REDACTED Mon Aug 25 18:49:07 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Mon, 25 Aug 2008 12:49:07 -0400 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> Message-ID: Joel, Just wondering why set operations are so much faster (except for fixed size arrays)? The result of applying *set operations is not consumed, is it? What if you try to do anything with it (after it is returned from timer:tc)? Could this be some internal laziness, so only function application thunks are indeed formed, but since results are never consumed, it does not expand any further? Or is it some optimization of the same kind, that the compiler sees unconsumed result, and does not really compile anything? Or even something at JIT level? Or am I missing anything ? ;) Thanks. On 8/25/08, Joel Reymont wrote: > > 14> arr:test(). > Fixed-size array: get: 1256ns, set: 6667ns > Extensible array: get: 1255ns, set: 22ns > Tuple: get: 659ns, set: 6ns > ok > > %% 1 million > > 15> arr:test(1000000). > Fixed-size array: get: 121881ns, set: 777067ns > Extensible array: get: 120026ns, set: 35ns > Tuple: get: 66288ns, set: 40ns > ok -- Dimitry Golubovsky Anywhere on the Web From joelr1@REDACTED Mon Aug 25 18:52:39 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 17:52:39 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> Message-ID: <269AE8D1-521F-4842-B4C4-EFE4DC9266BC@gmail.com> On Aug 25, 2008, at 5:49 PM, Dimitry Golubovsky wrote: > The result of applying *set operations is not consumed, is it? What if > you try to do anything with it (after it is returned from timer:tc)? The result of a set operation _is_ consumed on every iteration, it's used to prime the subsequent one. The result of every get operation is thrown away, though! I updated the blog post to state that the times are in microseconds. -- wagerlabs.com From joelr1@REDACTED Mon Aug 25 18:56:04 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 17:56:04 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> Message-ID: <035DDB0A-8F19-4541-90CF-B14A9C0F4551@gmail.com> Also, this is the updated results table from the blog post [1]. %% 10,000 elements 11> arr:test(). Fixed-size array: get: 3364mc, set: 6941mc Extensible array: get: 1mc, set: 23mc Tuple: get: 625mc, set: 209628mc Tree: get: 47700mc, set: 4305mc ok %% 100,000 elements 4> arr:test(100000). Fixed-size array: get: 39017mc, set: 73636mc Extensible array: get: 2mc, set: 36mc Tuple: get: 6290mc, set: 24495846mc Tree: get: 619615mc, set: 52691mc ok [1] http://www.wagerlabs.com/blog/2008/08/optimizing-erlang-a-death-match-of-arrays-vs-tuples.html#more -- wagerlabs.com From vychodil.hynek@REDACTED Mon Aug 25 18:59:40 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 25 Aug 2008 18:59:40 +0200 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> Message-ID: <4d08db370808250959y1a077e6u7befb02dde49bdb4@mail.gmail.com> You have typo in your code. Set on tuple can't be as fast as your measure :) You do get on Extensible array and tuple instead of set and you call this inside set cycle which remove data structure away. It should be: test(N) -> %% fixed-size array {G1, _} = timer:tc(arr, get, [{arr, array_get}, data1(N), N]), {S1, _} = timer:tc(arr, set, [{arr, array_set}, data1(N), N]), %% extensible array {G2, _} = timer:tc(arr, get, [{arr, array_get}, data2(N), N]), {S2, _} = timer:tc(arr, set, [{arr, array_set}, data2(N), N]), % <-- here %% tuple {G3, _} = timer:tc(arr, get, [{arr, tuple_get}, data3(N), N]), {S3, _} = timer:tc(arr, set, [{arr, tuple_set}, data3(N), N]), % <-- here %% results io:format("Fixed-size array: get: ~8wns, set: ~8wns~n", [G1 , S1]), io:format("Extensible array: get: ~8wns, set: ~8wns~n", [G2 , S2]), io:format("Tuple: get: ~8wns, set: ~8wns~n", [G3 , S3]), ok. And you should gain very different result looks like (Debian Linux 2.2GHz Intel C2Duo Erlang/OTP R12B-3): 6> arr:test(). Fixed-size array: get: 8912ns, set: 29114ns Extensible array: get: 8639ns, set: 15065ns Tuple: get: 1244ns, set: 233815ns ok 7> arr:test(100000). Fixed-size array: get: 78370ns, set: 110003ns Extensible array: get: 29618ns, set: 110906ns Tuple: get: 12458ns, set: 27852761ns ok Tuple set is far slower and get is far faster than on array operation as expected. There is possible GC issue why Extensible array is slower than fixed. Try run it in opposite order and you will see. 11> arr:test(100000). Fixed-size array: get: 29036ns, set: 103593ns Extensible array: get: 89132ns, set: 114022ns Tuple: get: 12471ns, set: 28103959ns ok Writing worth benchmark is not as simple as it looks ;-) On Mon, Aug 25, 2008 at 5:47 PM, Joel Reymont wrote: > > On Aug 25, 2008, at 3:56 PM, Dimitry Golubovsky wrote: > > > Joel, > > > > If nobody did it before, then I'll do (not earlier than tonight > > anyway ;) > > > Here, check out the performance of fixed-size vs extensible array set > op. > > Astounding! > > --- > > Mac OSX Leopard 10.5.4 > > Mac Pro 2x2.8Ghz Quad-Core Intel Xeon, 14Gb 800Mhz DDR2 FB-DIMM > > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- > threads:0] [kernel-poll:false] > > %% 10K elements > > 14> arr:test(). > Fixed-size array: get: 1256ns, set: 6667ns > Extensible array: get: 1255ns, set: 22ns > Tuple: get: 659ns, set: 6ns > ok > > %% 1 million > > 15> arr:test(1000000). > Fixed-size array: get: 121881ns, set: 777067ns > Extensible array: get: 120026ns, set: 35ns > Tuple: get: 66288ns, set: 40ns > ok > > --- > > -module(arr). > > -compile([export_all]). > > data1(N) -> > %% size implies fixed-size array > %% but lets be explicit > array:new([{size, N}, {default, 0}, {fixed, true}]). > > data2(N) -> > %% extensible array > array:new([{size, N}, {default, 0}, {fixed, false}]). > > data3(N) -> > erlang:make_tuple(N, 0). > > array_set(Array, I, Value) -> > %% array indexing starts at 0 > array:set(I - 1, Value, Array). > > tuple_set(Tuple, I, Value) -> > %% tuple indexing starts at 1 > setelement(I, Tuple, Value). > > array_get(Array, I) -> > array:get(I - 1, Array). > > tuple_get(Tuple, I) -> > element(I, Tuple). > > get(_, _, 0) -> > ok; > > get(Fun, Data, N) -> > Fun(Data, N), > get(Fun, Data, N - 1). > > set(_, _, 0) -> > ok; > > set(Fun, Data, N) -> > Data1 = Fun(Data, N, N), > set(Fun, Data1, N - 1). > > test() -> > test(10000). > > test(N) -> > %% fixed-size array > {G1, _} = timer:tc(arr, get, [{arr, array_get}, data1(N), N]), > {S1, _} = timer:tc(arr, set, [{arr, array_set}, data1(N), N]), > %% extensible array > {G2, _} = timer:tc(arr, get, [{arr, array_get}, data2(N), N]), > {S2, _} = timer:tc(arr, set, [{arr, array_get}, data2(N), N]), > %% tuple > {G3, _} = timer:tc(arr, get, [{arr, tuple_get}, data3(N), N]), > {S3, _} = timer:tc(arr, set, [{arr, tuple_get}, data3(N), N]), > %% results > io:format("Fixed-size array: get: ~8wns, set: ~8wns~n", [G1 , S1]), > io:format("Extensible array: get: ~8wns, set: ~8wns~n", [G2 , S2]), > io:format("Tuple: get: ~8wns, set: ~8wns~n", [G3 , S3]), > ok. > > > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Mon Aug 25 19:22:01 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 18:22:01 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: <4d08db370808250959y1a077e6u7befb02dde49bdb4@mail.gmail.com> References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> <4d08db370808250959y1a077e6u7befb02dde49bdb4@mail.gmail.com> Message-ID: <2261E568-FACA-42A4-BD1E-54B2C44D3E66@gmail.com> On Aug 25, 2008, at 5:59 PM, Hynek Vychodil wrote: > You have typo in your code. Set on tuple can't be as fast as your > measure :) > You do get on Extensible array and tuple instead of set and you call > this > inside set cycle which remove data structure away. I updated my blog post to remove the typo and re-ran the benchmarks. -- wagerlabs.com From rickard.s.green@REDACTED Mon Aug 25 19:51:08 2008 From: rickard.s.green@REDACTED (Rickard Green S) Date: Mon, 25 Aug 2008 19:51:08 +0200 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> Message-ID: <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> Well, you are wrong. Current implementation will fallback on select() at runtime if kqueue cannot handle the filedescriptor. The current behavior is a necessity not a bug. Introducing your suggested change will introduce a serious bug. BR, Rickard Green, Erlang/OTP, Ericsson AB. ________________________________ Fr?n: Joel Reymont [mailto:joelr1@REDACTED] Skickat: m? 2008-08-25 15:50 Till: Rickard Green S Kopia: Matthew Dempsky; Erlang Questions ?mne: Re: SV: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled Rickard, On Aug 25, 2008, at 2:14 PM, Rickard Green S wrote: > Matthew's answer is correct. If we need to fall back on select() on > a filedescriptor that is larger than select() can handle, your > modification wont work. The decision to use select() is made by ERTS during initialization. If kernel poll cannot be used then the version of erl_poll.c compiled without the ERTS_POLL_USE_KERNEL_POLL flag will be used. This version will clip the file descriptors as per the code below. #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && ! ERTS_POLL_USE_KERNEL_POLL if (max_fds > FD_SETSIZE) max_fds = FD_SETSIZE; #endif The kernel poll version of the same erl_poll.c will determine the maximum number of file descriptors according to the OS kernel configuration, a few lines above the clipping code. This version does NOT need any clipping and adding && !ERTS_POLL_USE_KERNEL_POLL above will ensure this. Again, there's no "fallback on select" at runtime. The decision to make use of select is made depending on platform capabilities at build time and on the +K setting. If erl is told not to use kernel poll while the capability is there, then the code from erl_poll_nkp.o will be used and this code will always clip descriptors. If kernel poll is available and erlang is told to use it then there will be NO fallback to select and NO clipping of descriptors to FD_SETSIZE is needed or wanted. The way to ensure this is to add && ! ERTS_POLL_USE_KERNEL_POLL to the clipping code above. Erlang is supposed to scale and without a fix to the above I cannot scale my supposedly scalable poker server above ~300 users on a single Erlang VM. This plain and obviously SUCKS! With my proposed fix I can scale to thousands of users on a single VM without a problem. I insist that I'm right and the OTP team is wrong. There's a bug in erl_poll.c and the solution is trivial. Please fix the bug! Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Mon Aug 25 19:56:25 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 18:56:25 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> Message-ID: <3E43D359-DF9A-4A75-A0F1-E7BDCE362BE0@gmail.com> Rickard, Where is this in the code? I'm willing to bet that the fallback consists of using the _nkp (non- kernel poll) version of the polling function and that version will be compiled w/o ERTS_POLL_USE_KERNEL_POLL by definition. Is that not so? On Aug 25, 2008, at 6:51 PM, Rickard Green S wrote: > Well, you are wrong. Current implementation will fallback on > select() at runtime if kqueue cannot handle the filedescriptor. > > The current behavior is a necessity not a bug. Introducing your > suggested change will introduce a serious bug. -- wagerlabs.com From joelr1@REDACTED Mon Aug 25 20:12:37 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 19:12:37 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> Message-ID: Rickard, On Aug 25, 2008, at 6:51 PM, Rickard Green S wrote: > Well, you are wrong. Current implementation will fallback on > select() at runtime if kqueue cannot handle the filedescriptor. > > The current behavior is a necessity not a bug. Introducing your > suggested change will introduce a serious bug. I took a closer look at erts_poll.c. The current code does indeed use select as a fallback, but it should not clip descriptors if fallback is not used. Fallback to select is currently implemented thusly #if ERTS_POLL_USE_FALLBACK /* We depend on the wakeup pipe being handled by kernel poll */ if (ps->fds_status[wake_fds[0]].flags & ERTS_POLL_FD_FLG_INFLBCK) fatal_error("%s:%d:create_wakeup_pipe(): Internal error\n", __FILE__, __LINE__); #endif No clipping of descriptors should be done then unless ERTS_POLL_USE_FALLBACK is defined and the ERTS_POLL_FD_FLG_INFLBCK is set in ps->fds_status[...].flags, at least when ERTS_POLL_USE_KERNEL_POLL is defined. Would you agree? You can only have 1024 descriptors with R12B3 on Mac OSX right now since FD_SETSIZE is 1024. ERTS clips descriptors to FD_SETSIZE regardless of whether it needs to fallback or not, even when kernel poll is present and enabled. This is an unwarranted and crippling limitation since I can go to 12k file descriptors on my Mac if I remove the file descriptor clipping. 1k and 12k descriptors make a huge difference for network servers and scalability! Thanks, Joel -- wagerlabs.com From matthew@REDACTED Mon Aug 25 20:24:59 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Mon, 25 Aug 2008 11:24:59 -0700 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> Message-ID: On Mon, Aug 25, 2008 at 11:12 AM, Joel Reymont wrote: > I took a closer look at erts_poll.c. The current code does indeed use select > as a fallback, but it should not clip descriptors if fallback is not used. What should it do with file descriptors >=1024 later when it does fallback to select(2)? > You can only have 1024 descriptors with R12B3 on Mac OSX right now since > FD_SETSIZE is 1024. Fortunately, Linux and BSD support poll(2), and no one uses OS X in server environments. From joelr1@REDACTED Mon Aug 25 20:31:32 2008 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Aug 2008 19:31:32 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> <12DBF02C-A901-4DDD-90BD-7D49DDB5FE24@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8F@esealmw115.eemea.ericsson.se> Message-ID: On Aug 25, 2008, at 7:24 PM, Matthew Dempsky wrote: > no one uses OS X in server environments. Then perhaps they would not care about falling back on select at all? I would rather NOT fall back to select and have the runtime give me an error than be stuck with puny 1024 file descriptors! -- wagerlabs.com From colm.dougan@REDACTED Mon Aug 25 21:21:45 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Mon, 25 Aug 2008 20:21:45 +0100 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: <2261E568-FACA-42A4-BD1E-54B2C44D3E66@gmail.com> References: <3FD11582-0895-46E6-89A1-01CBB97A9CD6@gmail.com> <4F898078-6A08-4F68-BF57-9CA10BCDC198@gmail.com> <4d08db370808250959y1a077e6u7befb02dde49bdb4@mail.gmail.com> <2261E568-FACA-42A4-BD1E-54B2C44D3E66@gmail.com> Message-ID: <24d4f39c0808251221s28c5cf14v6aa926522b993973@mail.gmail.com> On Mon, Aug 25, 2008 at 6:22 PM, Joel Reymont wrote: > > On Aug 25, 2008, at 5:59 PM, Hynek Vychodil wrote: > >> You have typo in your code. Set on tuple can't be as fast as your >> measure :) >> You do get on Extensible array and tuple instead of set and you call >> this >> inside set cycle which remove data structure away. > > I updated my blog post to remove the typo and re-ran the benchmarks. Interesting benchmark. I tried compiling the array API natively and got pretty decent improvements, especially for the array set operations (approx 40% better). . Colm From richardc@REDACTED Mon Aug 25 22:04:20 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 25 Aug 2008 22:04:20 +0200 Subject: [erlang-questions] Indexed element access: array vs. erlang:element In-Reply-To: References: Message-ID: <48B31044.9070708@it.uu.se> Dimitry Golubovsky wrote: > I need an index-based access to elements of a fixed-size array-like > structure. Number of elements is expected to be about several > thousands. > > What would be more efficient: to create an array (using the "array" > module) or to build a huge tuple and use erlang:element? If it's the case of write-once, read-many, you could prepare the data in a list, do list_to_tuple, and then use the tuple for reading. But I'd only do that myself as a last resort, to maximize speed. > PS I suspect the latter, but how does erlang:element scale on tuples > of such size? Just reading elements using erlang:element(N, Tuple) is as fast as it can possibly get - simply a pointer addition and a load. And tuples can be pretty huge. Try e.g. erlang:make_tuple(10000000,0)) - that's 10 million elements. But updating big tuples (copying N words) is much too inefficient; hence the array module, which tries to provide a good balance between read and write access times. /Richard From pguyot@REDACTED Mon Aug 25 22:12:07 2008 From: pguyot@REDACTED (Paul Guyot) Date: Mon, 25 Aug 2008 22:12:07 +0200 Subject: [erlang-questions] erl_ddll and dlclose Message-ID: <004D90F0-2102-4570-AC97-0B171D902EE2@kallisys.net> Hello, I've just noticed that calling unload doesn't actually close the shared library (this is R12-B3, MacOS X, 10.4, PowerPC). Yet, in some situation, it might be desirable to make sure the shared library initializer will be called again. I can observe this behavior with both load/unload and load_driver/ unload_driver. Is there a way to make sure dlclose is called? Paul From erlang-questions_efine@REDACTED Mon Aug 25 23:09:31 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 25 Aug 2008 17:09:31 -0400 Subject: [erlang-questions] erl_ddll and dlclose In-Reply-To: <004D90F0-2102-4570-AC97-0B171D902EE2@kallisys.net> References: <004D90F0-2102-4570-AC97-0B171D902EE2@kallisys.net> Message-ID: <6c2563b20808251409h96cde54m1bfeb77aa2e892@mail.gmail.com> I don't know if this is the case here, but I've run across poorly-behaved software that declares 'C' exit handlers using atexit(), where the exit handlers point to code in a shared library. Closing the shared library then guarantees a crash when the process exits. It's probably safer to just leave the library open. I know, not a perfect solution, but maybe it's the lesser of two evils.. if this is why it is left open. On Mon, Aug 25, 2008 at 4:12 PM, Paul Guyot wrote: > Hello, > > I've just noticed that calling unload doesn't actually close the > shared library (this is R12-B3, MacOS X, 10.4, PowerPC). Yet, in some > situation, it might be desirable to make sure the shared library > initializer will be called again. > > I can observe this behavior with both load/unload and load_driver/ > unload_driver. Is there a way to make sure dlclose is called? > > Paul > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From charleswthompsoniii@REDACTED Mon Aug 25 23:19:03 2008 From: charleswthompsoniii@REDACTED (Charles Thompson) Date: Mon, 25 Aug 2008 14:19:03 -0700 Subject: [erlang-questions] Seattle Erlounge This Week Message-ID: <7db028f30808251419r2efa9a1u992c96573d78048b@mail.gmail.com> Seattle Erlang Devs, In town this week is Lennart Ohman, the principal creator of the OTP framework. Therefore, an Erlounge is clearly in order. Who: Lennart Ohman What: Erlang Language/OTP Redirect When: Thursday, August 28, 2007 Where: Barca, 1510 11th Avenue Seattle, Washington 98122 | 206.325.8263 Why: Spread the Erlang gospel If you're a veteran Erlang developer, a functional programming novice, or even work at Microsoft (just kidding), this will be an excellent opportunity to come learn, discuss, and celebrate the Erlang language. The Venue: This weekend I staked out Barca's, a popular meeting place for Erlang developers. I found out that parking sucks and drinks are expensive--in other words its the quintessential Seattle meeting place. They confirmed our reservation. In the event of an earthquake, plague, or other natural disaster, we'll move Erlounge to the Bellevue Public Library at the same time. Hope to see you there. Oh, and if you plan on showing up, send me a quick email to charleswthompson@REDACTED -- Charles Thompson (360) 941-1762 charleswthompsoniii@REDACTED From charleswthompsoniii@REDACTED Mon Aug 25 23:59:49 2008 From: charleswthompsoniii@REDACTED (Charles Thompson) Date: Mon, 25 Aug 2008 14:59:49 -0700 Subject: [erlang-questions] Seattle Erlounge This Week In-Reply-To: <7db028f30808251419r2efa9a1u992c96573d78048b@mail.gmail.com> References: <7db028f30808251419r2efa9a1u992c96573d78048b@mail.gmail.com> Message-ID: <7db028f30808251459h48ecd82bt9fdbd64f2c58aa7@mail.gmail.com> BTW, Seattle Erlounge kicks off at 7:30 p.m. On Mon, Aug 25, 2008 at 2:19 PM, Charles Thompson wrote: > Seattle Erlang Devs, > > In town this week is Lennart Ohman, the principal creator of the OTP > framework. Therefore, an Erlounge is clearly in order. > > Who: Lennart Ohman > What: Erlang Language/OTP Redirect > When: Thursday, August 28, 2007 > Where: Barca, 1510 11th Avenue Seattle, Washington 98122 | 206.325.8263 > Why: Spread the Erlang gospel > > If you're a veteran Erlang developer, a functional programming novice, > or even work at Microsoft (just kidding), this will be an excellent > opportunity to come learn, discuss, and celebrate the Erlang language. > > The Venue: > This weekend I staked out Barca's, a popular meeting place for Erlang > developers. I found out that parking sucks and drinks are > expensive--in other words its the quintessential Seattle meeting > place. They confirmed our reservation. > > In the event of an earthquake, plague, or other natural disaster, > we'll move Erlounge to the Bellevue Public Library at the same time. > > Hope to see you there. Oh, and if you plan on showing up, send me a > quick email to charleswthompson@REDACTED > -- > Charles Thompson > (360) 941-1762 > charleswthompsoniii@REDACTED > -- Charles Thompson (360) 941-1762 charleswthompsoniii@REDACTED From vik@REDACTED Tue Aug 26 00:08:15 2008 From: vik@REDACTED (Vik Olliver) Date: Tue, 26 Aug 2008 10:08:15 +1200 Subject: [erlang-questions] tv:start() fail Message-ID: <1219702095.19234.131.camel@localhost> I'm connected to a remote server via SSH. I can run X11 apps such as xeyes and they work. But when I load up Erlang and run tv.start(). I do not see the usual interface. No errors are generated so it's hard to tell what is going on. Nothing in remote or local dmesg. Does anyone have any suggestions as to what might stop tv.start() from working without generating an error, or where I might find messages indicating what the problem is? Vik :v) From mog-lists@REDACTED Tue Aug 26 00:47:35 2008 From: mog-lists@REDACTED (mog) Date: Mon, 25 Aug 2008 17:47:35 -0500 Subject: [erlang-questions] tv:start() fail In-Reply-To: <1219702095.19234.131.camel@localhost> References: <1219702095.19234.131.camel@localhost> Message-ID: <20080825224735.GB15651@metalman.digium.internal> On Tue, Aug 26, 2008 at 10:08:15AM +1200, Vik Olliver wrote: > I'm connected to a remote server via SSH. I can run X11 apps such as > xeyes and they work. But when I load up Erlang and run tv.start(). I do > not see the usual interface. No errors are generated so it's hard to > tell what is going on. Nothing in remote or local dmesg. > > Does anyone have any suggestions as to what might stop tv.start() from > working without generating an error, or where I might find messages > indicating what the problem is? > do you have tk.8.3 or 8.4 or whatever you built erlang against? also have you tried other erlang gs apps like , appmon, or etop? Mog -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From aconbere@REDACTED Tue Aug 26 00:56:51 2008 From: aconbere@REDACTED (anders conbere) Date: Mon, 25 Aug 2008 15:56:51 -0700 Subject: [erlang-questions] Seattle Erlounge This Week In-Reply-To: <7db028f30808251419r2efa9a1u992c96573d78048b@mail.gmail.com> References: <7db028f30808251419r2efa9a1u992c96573d78048b@mail.gmail.com> Message-ID: <8ca3fbe80808251556g42be258qf76b5d3d79e75cc2@mail.gmail.com> On Mon, Aug 25, 2008 at 2:19 PM, Charles Thompson wrote: > Seattle Erlang Devs, > > In town this week is Lennart Ohman, the principal creator of the OTP > framework. Therefore, an Erlounge is clearly in order. > > Who: Lennart Ohman > What: Erlang Language/OTP Redirect > When: Thursday, August 28, 2007 > Where: Barca, 1510 11th Avenue Seattle, Washington 98122 | 206.325.8263 > Why: Spread the Erlang gospel > > If you're a veteran Erlang developer, a functional programming novice, > or even work at Microsoft (just kidding), this will be an excellent > opportunity to come learn, discuss, and celebrate the Erlang language. > > The Venue: > This weekend I staked out Barca's, a popular meeting place for Erlang > developers. I found out that parking sucks and drinks are > expensive--in other words its the quintessential Seattle meeting > place. They confirmed our reservation. > > In the event of an earthquake, plague, or other natural disaster, > we'll move Erlounge to the Bellevue Public Library at the same time. > > Hope to see you there. Oh, and if you plan on showing up, send me a > quick email to charleswthompson@REDACTED Awesome! Thanks Charles. ~ Anders (will be there) > -- > Charles Thompson > (360) 941-1762 > charleswthompsoniii@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ahmed.nawras@REDACTED Tue Aug 26 01:34:26 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 26 Aug 2008 03:34:26 +0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48B257E8.2090106@gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> Message-ID: Hi All, This discussion is interesting. Just wanted to know if it is possible to get the function that called current function. Is this possible? Best regards, Ahmed Al-Issaei On Mon, Aug 25, 2008 at 10:57 AM, Mats Cronqvist wrote: > Ulf Wiger wrote: >> I should perhaps bring special notation to the smiley at the >> end of my message. (: >> >> Whether or not the solution is cool is surely a matter of >> taste - but I believe that the one who first came up with it >> was Mats Cronqvist, the champion of obfuscated Erlang >> code. (: >> > thanks for the endorsement... > > for the record, i have since moved on to using this: > -define(position,[process_info(self(),current_function),{line,?LINE}]). > > sometimes adding this: > proplists:lookup(source,?MODULE:module_info(compile)). > > mats > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yoursurrogategod@REDACTED Tue Aug 26 01:53:34 2008 From: yoursurrogategod@REDACTED (yoursurrogategod@REDACTED) Date: Mon, 25 Aug 2008 16:53:34 -0700 (PDT) Subject: [erlang-questions] Using a queue Message-ID: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> I'm trying to use the queue module in Erlang by trying it out in the console. Here is what I tried and here are the results: 34> T1 = queue:new(). {[],[]} 35> queue:in("foo", T1). {["foo"],[]} 36> queue:in("bar", T1). {["bar"],[]} 37> queue:out(T1). {empty,{[],[]}} 38> queue:out(T1). {empty,{[],[]}} 39> queue:out(T1). {empty,{[],[]}} 40> queue:in("foo", T1). {["foo"],[]} 41> queue:out(T1). {empty,{[],[]}} What confuses me here is that I expected foo and bar to be somehow next to one another after inserting bar. Why is it that it's only foo? Also, I have another question. I would like a linked list in Erlang (similar to the STL list class in C++), is there something like that? It would be also nice if the individual elements in the said list could be accessed in a similar fashion as an array :) (don't know if this is possible). From ok@REDACTED Tue Aug 26 02:15:26 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 26 Aug 2008 12:15:26 +1200 Subject: [erlang-questions] Using a queue In-Reply-To: <6173_1219709026_m7Q03hdJ017377_712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> References: <6173_1219709026_m7Q03hdJ017377_712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> Message-ID: <8199FDBD-3FD4-4A17-A3E5-6AB34F03962E@cs.otago.ac.nz> On 26 Aug 2008, at 11:53 am, yoursurrogategod@REDACTED wrote: > I'm trying to use the queue module in Erlang by trying it out in the > console. Here is what I tried and here are the results: > > 34> T1 = queue:new(). > {[],[]} > 35> queue:in("foo", T1). > {["foo"],[]} This says "Make a new value with "foo" added to T1." That's what happened. IT DID NOT IN ANY WAY CHANGE T1. > > 36> queue:in("bar", T1). This says "Make a new value with "bar" added to the old, original, completely unchanged T1." And that's what it did. > > {["bar"],[]} T1 was, and must at all times necessarily remain, empty. > > 37> queue:out(T1). > {empty,{[],[]}} Since T1 was empty, and since variables and values in Erlang do not and cannot change, T1 is still empty. > > What confuses me here is that I expected foo and bar to be somehow > next to one another after inserting bar. What you _meant_ to do was something like Q0 = queue:new(), Q1 = queue:in("foo", Q0), Q2 = queue:in("bar", Q1), ... Erlang data structures are *values*; you can no more *change* a queue value than you can change the number 1. > Also, I have another question. I would like a linked list in Erlang > (similar to the STL list class in C++), is there something like that? The STL list class offers doubly linked lists, which are a MAJOR pain to deal with. Erlang has lists as primitive built-in types: [] is an empty list [H|T] is a list with head H and tail T [A,B,C] is an abbreviation for [A|[B|[C|[]]]] This is all in the old Erlang book and in Joe Armstrong's new book. Both of them are good value. > It would be also nice if the individual elements in the said list > could be accessed in a similar fashion as an array :) (don't know if > this is possible). Why do you want your language to lie to you? Lists aren't arrays and don't act like arrays and if you try to use them like arrays you are likely to end up with really bad performance problems. From colm.dougan@REDACTED Tue Aug 26 02:17:39 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Tue, 26 Aug 2008 01:17:39 +0100 Subject: [erlang-questions] Using a queue In-Reply-To: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> Message-ID: <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> On Tue, Aug 26, 2008 at 12:53 AM, yoursurrogategod@REDACTED wrote: > I'm trying to use the queue module in Erlang by trying it out in the > console. Here is what I tried and here are the results: > > 34> T1 = queue:new(). > {[],[]} > 35> queue:in("foo", T1). > {["foo"],[]} > 36> queue:in("bar", T1). > {["bar"],[]} > > What confuses me here is that I expected foo and bar to be somehow > next to one another after inserting bar. Why is it that it's only foo? You are performing all operations on the original queue, T1. You need to assign the return value of each queue operation to something as this is the new queue. e.g. : Eshell V5.6.1 (abort with ^G) 1> Q1 = queue:new(). {[],[]} 2> Q2 = queue:in("foo", Q1). {["foo"],[]} 3> Q3 = queue:in("bar", Q2). {["bar"],["foo"]} > > Also, I have another question. I would like a linked list in Erlang > (similar to the STL list class in C++), is there something like that? > It would be also nice if the individual elements in the said list > could be accessed in a similar fashion as an array :) (don't know if > this is possible). As far as I know, the closest thing to the stl list in erlang is the built in list type. You can use lists:nth(I, List) to emulate array random access, or just use the 'array' API. Colm From yoursurrogategod@REDACTED Tue Aug 26 02:53:17 2008 From: yoursurrogategod@REDACTED (yoursurrogategod@REDACTED) Date: Mon, 25 Aug 2008 17:53:17 -0700 (PDT) Subject: [erlang-questions] Using a queue In-Reply-To: <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> Message-ID: Ok, based on your suggestions, here is what I have. Eshell V5.5.5 (abort with ^G) 1> Q1 = queue:new(). {[],[]} 2> Q2 = queue:in("foo", Q1). {["foo"],[]} 3> Q3 = queue:in("bar", Q2). {["bar"],["foo"]} 4> Q4 = queue:in("blah", Q3). {["blah","bar"],["foo"]} 5> Q5 = queue:in("stuff", Q4). {["stuff","blah","bar"],["foo"]} 6> Q6 = queue:out(Q5). {{value,"foo"},{["stuff","blah"],["bar"]}} 7> Q7 = queue:in("stuff1", Q6). =ERROR REPORT==== 25-Aug-2008::20:23:40 === Error in process <0.31.0> with exit value: {badarg,[{queue,in, ["stuff1",{{value,"foo"},{["stuff","blah"],["bar"]}}]}, {erl_eval,do_apply,5},{erl_eval,expr,5},{shell,exprs,6}, {shell,eval_loop,3}]} ** exited: {badarg,[{queue,in, ["stuff1", {{value,"foo"},{["stuff","blah"], ["bar"]}}]}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** For some reason, when I tried to add on to Q7 after removing a value, it crashed. One thing that I discovered was when I did > Q6., I got the below: {{value,"foo"},{["stuff","blah"],["bar"]}} I managed to get at the list that contains stuff and blah (which is a little odd). On Aug 25, 8:17?pm, "Colm Dougan" wrote: > On Tue, Aug 26, 2008 at 12:53 AM, yoursurrogate...@REDACTED > > wrote: > > I'm trying to use the queue module in Erlang by trying it out in the > > console. Here is what I tried and here are the results: > > > 34> T1 = queue:new(). > > {[],[]} > > 35> queue:in("foo", T1). > > {["foo"],[]} > > 36> queue:in("bar", T1). > > {["bar"],[]} > > > What confuses me here is that I expected foo and bar to be somehow > > next to one another after inserting bar. Why is it that it's only foo? > > You are performing all operations on the original queue, T1. ?You need > to assign the return value of each queue operation to something as > this is the new queue. > > e.g. : > > Eshell V5.6.1 ?(abort with ^G) > 1> Q1 = queue:new(). > {[],[]} > 2> Q2 = queue:in("foo", Q1). > {["foo"],[]} > 3> Q3 = queue:in("bar", Q2). > {["bar"],["foo"]} > > > > > Also, I have another question. I would like a linked list in Erlang > > (similar to the STL list class in C++), is there something like that? > > It would be also nice if the individual elements in the said list > > could be accessed in a similar fashion as an array :) (don't know if > > this is possible). > > As far as I know, the closest thing to the stl list in erlang is the > built in list type. ?You can use lists:nth(I, List) to emulate array > random access, or just use the 'array' API. > > Colm > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Tue Aug 26 03:05:02 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 26 Aug 2008 03:05:02 +0200 Subject: [erlang-questions] Using a queue In-Reply-To: References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> Message-ID: <3dbc6d1c0808251805m1ed3513r7364c90c5a54e3c8@mail.gmail.com> 2008/8/26 yoursurrogategod@REDACTED > Ok, based on your suggestions, here is what I have. > > Eshell V5.5.5 (abort with ^G) > 1> Q1 = queue:new(). > {[],[]} > 2> Q2 = queue:in("foo", Q1). > {["foo"],[]} > 3> Q3 = queue:in("bar", Q2). > {["bar"],["foo"]} > 4> Q4 = queue:in("blah", Q3). > {["blah","bar"],["foo"]} > 5> Q5 = queue:in("stuff", Q4). > {["stuff","blah","bar"],["foo"]} > 6> Q6 = queue:out(Q5). > {{value,"foo"},{["stuff","blah"],["bar"]}} > 7> Q7 = queue:in("stuff1", Q6). > > =ERROR REPORT==== 25-Aug-2008::20:23:40 === > Error in process <0.31.0> with exit value: {badarg,[{queue,in, > ["stuff1",{{value,"foo"},{["stuff","blah"],["bar"]}}]}, > {erl_eval,do_apply,5},{erl_eval,expr,5},{shell,exprs,6}, > {shell,eval_loop,3}]} > > ** exited: {badarg,[{queue,in, > ["stuff1", > {{value,"foo"},{["stuff","blah"], > ["bar"]}}]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > For some reason, when I tried to add on to Q7 after removing a value, > it crashed. One thing that I discovered was when I did > Q6., I got > the below: > > {{value,"foo"},{["stuff","blah"],["bar"]}} > > I managed to get at the list that contains stuff and blah (which is a > little odd). queue:out returns {{value, Item}, Queue} or {empty, Queue}, i.e. it returns both the value and the remaining queue after the value has been removed. If there was a value it is returned as {value,Value} otherwise 'empty' is returned. Returning multiple values in a tuple is common practice in erlang, actually it is almost the only way to do it. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From colm.dougan@REDACTED Tue Aug 26 03:12:08 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Tue, 26 Aug 2008 02:12:08 +0100 Subject: [erlang-questions] Using a queue In-Reply-To: References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> Message-ID: <24d4f39c0808251812g35774ae9k359e8028baf48ddd@mail.gmail.com> On Tue, Aug 26, 2008 at 1:53 AM, yoursurrogategod@REDACTED wrote: > Ok, based on your suggestions, here is what I have. > > Eshell V5.5.5 (abort with ^G) > 1> Q1 = queue:new(). > {[],[]} > 2> Q2 = queue:in("foo", Q1). > {["foo"],[]} > 3> Q3 = queue:in("bar", Q2). > {["bar"],["foo"]} > 4> Q4 = queue:in("blah", Q3). > {["blah","bar"],["foo"]} > 5> Q5 = queue:in("stuff", Q4). > {["stuff","blah","bar"],["foo"]} > 6> Q6 = queue:out(Q5). > {{value,"foo"},{["stuff","blah"],["bar"]}} > 7> Q7 = queue:in("stuff1", Q6). > > =ERROR REPORT==== 25-Aug-2008::20:23:40 === > Error in process <0.31.0> with exit value: {badarg,[{queue,in, > ["stuff1",{{value,"foo"},{["stuff","blah"],["bar"]}}]}, > {erl_eval,do_apply,5},{erl_eval,expr,5},{shell,exprs,6}, > {shell,eval_loop,3}]} The documentation for queue:out says : "Removes the item at the front of queue Q1. Returns the tuple {{value, Item}, Q2}, where Item is the item removed and Q2 is the resulting queue. If Q1 is empty, the tuple {empty, Q1} is returned." http://www.erlang.org/doc/man/queue.html So : Q6 = queue:out(Q5) Should have been : {Val1, Q6} = queue:out(Q5). Colm From kenji.rikitake@REDACTED Tue Aug 26 04:45:43 2008 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Aug 2008 11:45:43 +0900 Subject: [erlang-questions] Erlang R12B3 inet_ssl_dist (SSL distribution) with ssl-3.9? In-Reply-To: <597c69660808250928o1699dec6ucbdbeedf503ae663@mail.gmail.com> References: <20080823081636.GA63811@k2r.org> <597c69660808250928o1699dec6ucbdbeedf503ae663@mail.gmail.com> Message-ID: <20080826024543.GA29444@k2r.org> Thanks Attila. I'm new to Erlang so your help is appreciated. I've tried the application:start/1 function, but things didn't change. The ssl-3.9/src/ssl_sup.hrl in R12B3 explicity disables the old ssl_server in the boot-time process registration by init([]). I also discovered ssl_esock port driver crashed with SIGSEGV on FreeBSD, when the net_kernel:start tries to listen to an SSL port. Testing this on WinXP SP3 hangs up the Erlang shell and no response returned, while the Ctrl-G intervention worked. I should conclude that at least the manual of ssl module about inet_ssl_dist (Section 5) should be thoroughly revised. So I cross-post this message to erlang-bugs also. Regards, Kenji Rikitake In the message <597c69660808250928o1699dec6ucbdbeedf503ae663@REDACTED> dated Mon, Aug 25, 2008 at 06:27:43PM +0200, Attila Babo writes: > All you need to start ssl from a boot file is to state ssl as required > application in your .app file. Without a proper boot file just start > it like application:start(ssl). I hope this helps! From ok@REDACTED Tue Aug 26 05:19:39 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 26 Aug 2008 15:19:39 +1200 Subject: [erlang-questions] Using a queue In-Reply-To: <17648_1219712605_m7Q13MV3031162_b282b94a-2545-4b88-b4db-2167ba22cfce@a1g2000hsb.googlegroups.com> References: <712a16e2-b15f-4c63-b6ec-7c86c1767179@8g2000hse.googlegroups.com> <24d4f39c0808251717k3a74bdcdu91ebeb1c99b1df6c@mail.gmail.com> <17648_1219712605_m7Q13MV3031162_b282b94a-2545-4b88-b4db-2167ba22cfce@a1g2000hsb.googlegroups.com> Message-ID: On 26 Aug 2008, at 12:53 pm, yoursurrogategod@REDACTED wrote: > 6> Q6 = queue:out(Q5). > {{value,"foo"},{["stuff","blah"],["bar"]}} > 7> Q7 = queue:in("stuff1", Q6). > > =ERROR REPORT==== 25-Aug-2008::20:23:40 === > Error in process <0.31.0> with exit value: {badarg,[{queue,in, > ["stuff1",{{value,"foo"},{["stuff","blah"],["bar"]}}]}, > {erl_eval,do_apply,5},{erl_eval,expr,5},{shell,exprs,6}, > {shell,eval_loop,3}]} Well, yes. Of course. queue:out/1 DOES NOT RETURN A QUEUE. Here's the documentation: out(Q1) -> Result Types: Result = {{value, Item}, Q2} | {empty, Q1} Q1 = Q2 = queue() Removes the item at the front of queue Q1. Returns the tuple {{value, Item}, Q2}, where Item is the item removed and Q2 is the resulting queue. If Q1 is empty, the tuple {empty, Q1} is returned. So you use it like case queue:out(Q5) of {empty,Q6} -> what to do if Q5 is empty ; {{value,Item},Q6} -> what to do if Q5 had a first element Item and remaining elements Q6 end Or, if you know that Q5 is not empty (and are willing to have it treated as an error if it isn't), as {{value,Elem6},Q6} = queue:out(Q5). If, as seems to be the case in your example, you don't actually want Elem6, but simply to remove the first element and throw it away, there is a function in the queue interface that does exactly what you want: Q6 = queue:tail(Q5) (It's in the documentation below 'Okasaki API'.) You could also queue Q6 = queue:drop(Q5) As far as I can see there is no difference between these functions; use whatever you feel is clearer. From cblair1986@REDACTED Tue Aug 26 07:54:46 2008 From: cblair1986@REDACTED (Chris Blair) Date: Tue, 26 Aug 2008 01:54:46 -0400 Subject: [erlang-questions] Ruby-like crypt function? Message-ID: <7c31c1140808252254q503ad4e2s2fa9b3d3cb841537@mail.gmail.com> I'm wondering, perhaps I'm not looking in the right place, but the crypto application, along with the main erlang BIF's, don't seem to have the equivalent of Ruby's String#crypt() method. I've searched a bit, with no luck. Hopefully posting here will lead me in the right direction! Thank you in advance. From bgustavsson@REDACTED Tue Aug 26 08:18:07 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 26 Aug 2008 08:18:07 +0200 Subject: [erlang-questions] [erlang-bugs] Documentation request: integer encoding and truncation In-Reply-To: <6c2563b20808221009l1e5787f2q5d6c2f868b06c61f@mail.gmail.com> References: <6c2563b20808221009l1e5787f2q5d6c2f868b06c61f@mail.gmail.com> Message-ID: <6672d0160808252318s23bae75xfed8fc9ed52fb4f@mail.gmail.com> 2008/8/22 Edwin Fine > I refer to the following post. I was caught unawares by this apparently > undocumented behavior. > > http://www.erlang.org/pipermail/erlang-questions/2007-July/027657.html > > May I strongly recommend placing this information (taken from the above > post) in the Erlang Reference Manual, in the section on binaries. It may > save other people time and confusion. A further question is whether or not > this *should* be the behavior. As a language used for writing highly > reliable systems, shouldn't this overflow condition be caught? Maybe as an > optional run-time flag? > > We consider the behavior to be a feature. I have now added some information about the behavior to the reference manual (to appear in R12B-4). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Aug 26 08:46:21 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 26 Aug 2008 02:46:21 -0400 Subject: [erlang-questions] Integer truncation in binary conversion considered harmful Message-ID: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> Bjorn, Thank you for updating the documentation. However, I strongly disagree that silently truncating integers in conversion to binaries is a feature. The huge number of bugs in C/C++ programming due to overflows in general, and the creation of secure integer libraries to prevent this, should be a strong indicator of the potential harm in allowing this. In "Programming Erlang", Joe Armstrong writes: "Erlang uses arbitrary-sized integers for performing integer arithmetic. In Erlang, integer arithmetic is exact, so you don't have to worry about arithmetic overflows or not being able to represent an integer in a cer- tain word size." But as soon as you convert to binary, that protection is lost and you *do*have to worry about integer overflows. Erlang is designed for programming fault-tolerant systems, yet this "feature" actually contributes to potential faults. The compiler and run-time should be there to help us, not hinder us. How difficult could it be to add *optional* run-time checking to detect this condition without a serious risk of adverse effects on the correctness of Erlang run-time execution? On Tue, Aug 26, 2008 at 2:18 AM, Bjorn Gustavsson wrote: > 2008/8/22 Edwin Fine > >> I refer to the following post. I was caught unawares by this apparently >> undocumented behavior. >> >> http://www.erlang.org/pipermail/erlang-questions/2007-July/027657.html >> >> May I strongly recommend placing this information (taken from the above >> post) in the Erlang Reference Manual, in the section on binaries. It may >> save other people time and confusion. A further question is whether or not >> this *should* be the behavior. As a language used for writing highly >> reliable systems, shouldn't this overflow condition be caught? Maybe as an >> optional run-time flag? >> >> > We consider the behavior to be a feature. > > I have now added some information about the behavior to the reference > manual (to appear in R12B-4). > > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Tue Aug 26 08:58:08 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 26 Aug 2008 08:58:08 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> Message-ID: <48B3A980.10209@it.uu.se> Ahmed Ali wrote: > Hi All, > > This discussion is interesting. Just wanted to know if it is possible > to get the function that called current function. Is this possible? The only way of doing that is to force an exception, and then look at the stack trace. Something like this: Trace = try throw(oops) catch oops -> erlang:get_stacktrace() end However, due to tail call optimization in Erlang, you will not see any functions in the list that were visited on the way but were exited through a tail call. /Richard From bengt.kleberg@REDACTED Tue Aug 26 08:58:22 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 26 Aug 2008 08:58:22 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> Message-ID: <1219733902.4363.35.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Building upon the suggestion made by Ulf Wiger this would probably work (possible reasons for not working includes, but are not limited to, tail calls): -define(FUNCTION_THAT_CALLED, lists:nth(2, element(2,element(2,catch erlang:error([]))))). bengt On Tue, 2008-08-26 at 03:34 +0400, Ahmed Ali wrote: > Hi All, > > This discussion is interesting. Just wanted to know if it is possible > to get the function that called current function. Is this possible? > > Best regards, > > Ahmed Al-Issaei > > On Mon, Aug 25, 2008 at 10:57 AM, Mats Cronqvist > wrote: > > Ulf Wiger wrote: > >> I should perhaps bring special notation to the smiley at the > >> end of my message. (: > >> > >> Whether or not the solution is cool is surely a matter of > >> taste - but I believe that the one who first came up with it > >> was Mats Cronqvist, the champion of obfuscated Erlang > >> code. (: > >> > > thanks for the endorsement... > > > > for the record, i have since moved on to using this: > > -define(position,[process_info(self(),current_function),{line,?LINE}]). > > > > sometimes adding this: > > proplists:lookup(source,?MODULE:module_info(compile)). > > > > mats > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From imre@REDACTED Tue Aug 26 08:56:20 2008 From: imre@REDACTED (Imre Palik) Date: Tue, 26 Aug 2008 09:56:20 +0300 Subject: [erlang-questions] Limits on integer size Message-ID: <3BE6DBA1F3BE9D4798255806113D56540F7378CD23@utx-exchange.utx.local> Hi, I tried to generate some test data in the following way: -module(test_gen). -export([run/0]). loop(0) -> void; loop(I) -> HN = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, io:format("~w ~w~n", [random:uniform(HN), random:uniform(HN)]), loop(I - 1). run() -> loop(10). But the result is this: 16> test_gen:run(). ** exception error: bad argument in an arithmetic expression in function random:uniform/1 in call from test_gen:loop/1 But if I decrease the size of HN to let's say 100 digits, then it works without any problem. Could somebody tell me the limitations that I have with integers in erlang? Is it possible to tune these somehow (config file, environment variable, etc.)? Thx. ImRe P.S.: I am running Erlag 5.6.3 on windows From john.hughes@REDACTED Tue Aug 26 09:01:18 2008 From: john.hughes@REDACTED (John Hughes) Date: Tue, 26 Aug 2008 09:01:18 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 15, Issue 86 In-Reply-To: References: Message-ID: <905F1D9C80474375887B5AAE26D1E530@HallDesktop> > > Ok, based on your suggestions, here is what I have. > > Eshell V5.5.5 (abort with ^G) > 1> Q1 = queue:new(). > {[],[]} > 2> Q2 = queue:in("foo", Q1). > {["foo"],[]} > 3> Q3 = queue:in("bar", Q2). > {["bar"],["foo"]} > 4> Q4 = queue:in("blah", Q3). > {["blah","bar"],["foo"]} > 5> Q5 = queue:in("stuff", Q4). > {["stuff","blah","bar"],["foo"]} > 6> Q6 = queue:out(Q5). > {{value,"foo"},{["stuff","blah"],["bar"]}} If you look at the value of Q6, you'll see it's different in structure from the previous queues you created. And indeed, it's not a queue. The documentation says: out(Q1) -> Result Types: Result = {{value, Item}, Q2} | {empty, Q1} Q1 = Q2 = queue() Removes the head item from the queue Q1. Returns the tuple {{value, Item}, Q2}, where Item is the item removed and Q2 is the new queue. If Q1 is empty, the tuple {empty, Q1} is returned. queue:out(Q) removes an element from the queue, but because it cannot *modify* the original queue (no side-effects, remember?), then it must return *both* the element it removed, and the remainder of the queue, as its result. That's what happened above: you removed "foo" (in the first component of the result), and the remaining queue contains "stuff", "blah" and "bar" (in the second component). The reason that the first component is {value,"foo"} and not just "foo" is that the queue might have been empty, in which case no element can be removed. queue:out returns empty as the element in that case. Of course, the queue might actually contain the atom empty as one of its elements. To ensure that this case can't be confused with an empty queue, queue:out tags real queue elements with the value tag, as you see above--so if we did remove an element empty from a queue, then the first component of the result would be {value,empty}, not empty. So, if you want to remove an element from a queue (and you know for sure that the queue is not empty), then instead of Q6 = queue:out(Q5). you should write {{value,X},Q6} = queue:out(Q5). Then X will be bound to the element ("foo" in this case), and the code below will work. What the error report means, by the way, is that you passed a bad argument to queue:in--and it was the pair {{value,"foo"}...}, which was expected to be a queue, but wasn't. > 7> Q7 = queue:in("stuff1", Q6). > > =ERROR REPORT==== 25-Aug-2008::20:23:40 === > Error in process <0.31.0> with exit value: {badarg,[{queue,in, > ["stuff1",{{value,"foo"},{["stuff","blah"],["bar"]}}]}, > {erl_eval,do_apply,5},{erl_eval,expr,5},{shell,exprs,6}, > {shell,eval_loop,3}]} > > ** exited: {badarg,[{queue,in, > ["stuff1", > {{value,"foo"},{["stuff","blah"], > ["bar"]}}]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > By the way, the queue representations used by the queue module are always pairs of lists of elements, so if you see something different, you know it's not a queue. John From bgustavsson@REDACTED Tue Aug 26 09:18:23 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 26 Aug 2008 09:18:23 +0200 Subject: [erlang-questions] Limits on integer size In-Reply-To: <3BE6DBA1F3BE9D4798255806113D56540F7378CD23@utx-exchange.utx.local> References: <3BE6DBA1F3BE9D4798255806113D56540F7378CD23@utx-exchange.utx.local> Message-ID: <6672d0160808260018t621aa75ch933b528125de20b@mail.gmail.com> On Tue, Aug 26, 2008 at 8:56 AM, Imre Palik wrote: > > But if I decrease the size of HN to let's say 100 digits, then it works > without any problem. > Could somebody tell me the limitations that I have with integers in erlang? > Is it possible to tune these somehow (config file, environment variable, > etc.)? > The problem is not integer limits, but floating point limits. random:uniform(N) first generates a floating point number between 0 and 1, then multiplies it by N. The result is too big to be represented as a floating point number. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Tue Aug 26 09:24:02 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 26 Aug 2008 09:24:02 +0200 Subject: [erlang-questions] Integer truncation in binary conversion considered harmful In-Reply-To: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> References: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> Message-ID: <6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> On Tue, Aug 26, 2008 at 8:46 AM, Edwin Fine wrote: > How difficult could it be to add *optional* run-time checking to detect > this condition without a serious risk of adverse effects on the correctness > of Erlang run-time execution? > If checking is turned on for the entire run-time system, library code that depends on the truncation could fail. I think it would be better to add optional support in the compiler to turn on checks (either for an entire module, or for individual segments of a binary). If someone writes an EEP, we will consider implementing it. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Aug 26 09:54:15 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 26 Aug 2008 03:54:15 -0400 Subject: [erlang-questions] Integer truncation in binary conversion considered harmful In-Reply-To: <6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> References: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> <6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> Message-ID: <6c2563b20808260054r5e41b427lbfc182dca0b5caa9@mail.gmail.com> Bjorn, That would work, too, although it could be considered that libraries that depend on the truncation behavior may in fact unwittingly be harboring truncation bugs, and might be better served by explicitly truncating the integer down to size prior to converting to binary. Perhaps a truncate(Integer, NumBytes) BIF could be provided. Still, being able to turn on range checking for a specific binary conversion (-pragma(range-check), anyone?) or a module might be a very nice compromise feature. I'll look into what it takes to write an EEP and submit one if I think I can get it right ;-) Regards, Ed On Tue, Aug 26, 2008 at 3:24 AM, Bjorn Gustavsson wrote: > On Tue, Aug 26, 2008 at 8:46 AM, Edwin Fine < > erlang-questions_efine@REDACTED> wrote: > >> How difficult could it be to add *optional* run-time checking to detect >> this condition without a serious risk of adverse effects on the correctness >> of Erlang run-time execution? >> > > If checking is turned on for the entire run-time system, library code that > depends on the truncation could fail. > > I think it would be better to add optional support in the compiler to turn > on checks (either for an entire module, or for individual segments of > a binary). > > If someone writes an EEP, we will consider implementing it. > > /Bjorn > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Tue Aug 26 10:18:24 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 26 Aug 2008 10:18:24 +0200 Subject: [erlang-questions] : : fprof unusable? In-Reply-To: <26B73BE3-94F6-4CD5-ABDE-36673A4CC85E@gmail.com> References: <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> <63065.1219446283@snookles.snookles.com> <20080825110850.GB29731@erix.ericsson.se> <26B73BE3-94F6-4CD5-ABDE-36673A4CC85E@gmail.com> Message-ID: <20080826081824.GB22978@erix.ericsson.se> On Mon, Aug 25, 2008 at 01:39:33PM +0100, Joel Reymont wrote: > > On Aug 25, 2008, at 12:08 PM, Raimo Niskanen wrote: > > >Fprof takes so much CPU load that it is nothing to use on > >a heavily loaded system other than a not too heavily loaded > >system under a very short time. > > > FYI, this is just one problem with fprof. My problem is that during > the analysis phase fprof uses ETS and basically runs out of memory! Yes, it is also a consequence of the "trace all and analyse later" approach. There is too much data to analyse, too many process stacks to follow, too many functions to watch. Are you claiming it runs out of memory because it uses ETS? The counters has to be kept somewhere, in a hash table -like data structure. > > -- > wagerlabs.com > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kostis@REDACTED Tue Aug 26 10:26:53 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 26 Aug 2008 11:26:53 +0300 Subject: [erlang-questions] Determining HiPE availability In-Reply-To: References: Message-ID: <48B3BE4D.7050903@cs.ntua.gr> Tony Arcieri wrote: > I'm compiling modules at runtime using smerl, and would like to > automatically use HiPE if it's available. I needed a way to > programmatically determine if HiPE is available. Someone pointed me at > erlang:system_info(hipe_architecture) which returns 'undefined' if HiPE > is unavailable. However, this doesn't seem to be documented anywhere. > Should it be? I am also not sure whether this should be documented, but I think it is pretty safe to assume that erlang:system_info(hipe_architecture) will, for a long time to come, continue to return 'undefined' if HiPE is unavailable. In that sense, I think it is OK to use it. But I would not recommend matching on the rest of the values that this BIF returns. Kostis From imre@REDACTED Tue Aug 26 10:26:26 2008 From: imre@REDACTED (Imre Palik) Date: Tue, 26 Aug 2008 11:26:26 +0300 Subject: [erlang-questions] Limits on integer size Message-ID: <3BE6DBA1F3BE9D4798255806113D56540F7378CD25@utx-exchange.utx.local> From: "Bjorn Gustavsson" > > > > But if I decrease the size of HN to let's say 100 digits, then it works > > without any problem. > > Could somebody tell me the limitations that I have with integers in erlang? > > Is it possible to tune these somehow (config file, environment variable, > > etc.)? > > > > The problem is not integer limits, but floating point limits. > > random:uniform(N) first generates a floating point number between 0 and 1, > then multiplies it by N. The result is too big to be represented > as a floating point number. Does this also means, that even with a range where it seems to work, some values will never be returned, because of the gaps in the floating point representation? How many bits of randomness can I expect with a call to random:uniform(N)? ImRe From mats.cronqvist@REDACTED Tue Aug 26 10:54:50 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 26 Aug 2008 10:54:50 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48B3A980.10209@it.uu.se> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> <48B3A980.10209@it.uu.se> Message-ID: <48B3C4DA.1070503@gmail.com> Richard Carlsson wrote: > Ahmed Ali wrote: > >> Hi All, >> >> This discussion is interesting. Just wanted to know if it is possible >> to get the function that called current function. Is this possible? >> > > The only way of doing that is to force an exception, and then look > at the stack trace. there is no way to reliably get the name of the calling function. it is true that the stack sometimes contain the name of the calling function. it is not true that the only way to inspect the stack is by forcing an exception. i'm too lazy to write actual code, but try this in the shell; (r12@REDACTED)41> {_,BT}=erlang:process_info(self(),backtrace). (r12@REDACTED)42> S=fun(B,{_,[_,{F,L}|_]})-> <<_:F/binary,R:L/binary,_/binary>> =B, R end. (r12@REDACTED)43> S(BT,re:run(BT,"Return addr\\s[0-9a-z]+\\s\\(([^\\s]*)")). <<"erl_eval:expr/5">> clear as the day! mats From richardc@REDACTED Tue Aug 26 11:15:38 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 26 Aug 2008 11:15:38 +0200 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48B3C4DA.1070503@gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> <48B3A980.10209@it.uu.se> <48B3C4DA.1070503@gmail.com> Message-ID: <48B3C9BA.6020502@it.uu.se> Mats Cronqvist wrote: > it is not true that the only way to inspect the stack is by forcing an > exception. > > i'm too lazy to write actual code, but try this in the shell; > > (r12@REDACTED)41> {_,BT}=erlang:process_info(self(),backtrace). > (r12@REDACTED)42> S=fun(B,{_,[_,{F,L}|_]})-> > <<_:F/binary,R:L/binary,_/binary>> =B, R end. > (r12@REDACTED)43> S(BT,re:run(BT,"Return > addr\\s[0-9a-z]+\\s\\(([^\\s]*)")). > <<"erl_eval:expr/5">> Ugh! I didn't know that flag to process_info existed, but I'm happy to see that Mats' talent for sniffing out the dark corners of Erlang and using them for unspeakable deeds is as strong as ever. /Richard From twoggle@REDACTED Tue Aug 26 13:20:14 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 26 Aug 2008 04:20:14 -0700 (PDT) Subject: [erlang-questions] how: documentation patches? Message-ID: I'd like to submit a fairly small documentation patch, but I'm not sure how/where... What should I patch against? The man pages? Where should I post the patch? The erlang-patches list? From twoggle@REDACTED Tue Aug 26 13:30:47 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 26 Aug 2008 04:30:47 -0700 (PDT) Subject: [erlang-questions] Ruby-like crypt function? In-Reply-To: <7c31c1140808252254q503ad4e2s2fa9b3d3cb841537@mail.gmail.com> References: <7c31c1140808252254q503ad4e2s2fa9b3d3cb841537@mail.gmail.com> Message-ID: <4d3cb816-4f0c-4221-8007-22172145dd77@w1g2000prk.googlegroups.com> > I'm wondering, perhaps I'm not looking in the right place, but the > crypto application, along with the main erlang BIF's, don't seem to > have the equivalent of Ruby's String#crypt() method. I've searched a > bit, with no luck. Hopefully posting here will lead me in the right > direction! There isn't an exact equivalent (that i'm aware of), but String#crypt uses DES/MD5 internally, which the crypto module does support. From kenneth.lundin@REDACTED Tue Aug 26 15:04:00 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 26 Aug 2008 15:04:00 +0200 Subject: [erlang-questions] how: documentation patches? In-Reply-To: References: Message-ID: Hi Tim, For now you can supply you patch to erlang-patches and just informally point to the spot in a man-page or the html version of the man page and write the text you suggest to replace it with, don't bother the formatting, we will have to handle the patch manually anyway. In the upcoming R12B-4 we will provide the documentation source in XML for some applications. So starting from that release you will be able to make a documentation patch against the real source. /Kenneth Erlang/OTP team , Ericsson On Tue, Aug 26, 2008 at 1:20 PM, Tim Fletcher wrote: > I'd like to submit a fairly small documentation patch, but I'm not > sure how/where... > > What should I patch against? The man pages? > > Where should I post the patch? The erlang-patches list? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twoggle@REDACTED Tue Aug 26 16:21:40 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 26 Aug 2008 07:21:40 -0700 (PDT) Subject: [erlang-questions] how: documentation patches? In-Reply-To: References: Message-ID: > For now you can supply you patch to erlang-patches and > just informally point to the spot in a man-page or the html version of > the man page and write the text you suggest to replace it with Thanks. Just sent the details to there: http://www.erlang.org/pipermail/erlang-patches/2008-August/000286.html > In the upcoming R12B-4 we will provide the documentation source in XML for some > applications. So starting from that release you will be able to make a > documentation patch against the real source. That should be easier than trying to explain in words :) From tbaldridge@REDACTED Tue Aug 26 16:30:45 2008 From: tbaldridge@REDACTED (Timothy Baldridge) Date: Tue, 26 Aug 2008 09:30:45 -0500 Subject: [erlang-questions] Erlang Module installation Message-ID: I'm new to Erlang, and I'm trying to use ESDL. I have it ESDL installed to /opt/local/lib/erlang/lib/esdl-0.96.0626/ (the default). But when I go to include ESDL in my .erl file I have to put it like like this -include(/opt/local/lib/erlang/lib/esdl-0.96.0626/include/sdl.hrl) otherwise it doesn't work (can't find the file). So I finally just used the absolute paths as mentioned above. But then it complains that it "sh: line 0: exec: sdl_driver: not found". What's the proper way to install a erlang module and to include it in a project. Is there a way to setup a search path? In Python it looks first in the current directory then in the site-packages directory of the Python install dir. Can anyone help me out? Timothy -- Two wrights don't make a rong, they make an airplane. Or bicycles. From joelr1@REDACTED Tue Aug 26 16:51:59 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 26 Aug 2008 15:51:59 +0100 Subject: [erlang-questions] : : fprof unusable? In-Reply-To: <20080826081824.GB22978@erix.ericsson.se> References: <83739267-36F0-4DD6-B464-1D8ECFBAFD46@gmail.com> <63065.1219446283@snookles.snookles.com> <20080825110850.GB29731@erix.ericsson.se> <26B73BE3-94F6-4CD5-ABDE-36673A4CC85E@gmail.com> <20080826081824.GB22978@erix.ericsson.se> Message-ID: On Aug 26, 2008, at 9:18 AM, Raimo Niskanen wrote: > Are you claiming it runs out of memory because it uses ETS? > The counters has to be kept somewhere, in a hash table -like > data structure. I'm thinking that the analysis phase may benefit from using a combination of disk and ram to avoid running out of memory. You could keep the hashtable-like structure in a disc_only_copies table but that would be too slow for the average use of fprof. -- wagerlabs.com From trevorw@REDACTED Tue Aug 26 17:36:13 2008 From: trevorw@REDACTED (Trevor Woollacott) Date: Tue, 26 Aug 2008 17:36:13 +0200 Subject: [erlang-questions] Erlang Module installation References: Message-ID: <006a01c90791$7d0f0b00$626bd90a@mtn.co.za> To include ESDL in your .erl file this should work: -include_lib("esdl/include/sdl.hrl"). ----- Original Message ----- From: "Timothy Baldridge" To: Sent: Tuesday, August 26, 2008 4:30 PM Subject: [erlang-questions] Erlang Module installation > I'm new to Erlang, and I'm trying to use ESDL. I have it ESDL > installed to /opt/local/lib/erlang/lib/esdl-0.96.0626/ (the default). > But when I go to include ESDL in my .erl file I have to put it like > like > this -include(/opt/local/lib/erlang/lib/esdl-0.96.0626/include/sdl.hrl) > otherwise it doesn't work (can't find the file). So I finally just > used the absolute paths as mentioned above. But then it complains that > it "sh: line 0: exec: sdl_driver: not found". What's the proper way to > install a erlang module and to include it in a project. Is there a way > to setup a search path? In Python it looks first in the current > directory then in the site-packages directory of the Python install > dir. > > Can anyone help me out? > > Timothy > > -- > Two wrights don't make a rong, they make an airplane. Or bicycles. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Tue Aug 26 19:58:52 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 26 Aug 2008 18:58:52 +0100 Subject: [erlang-questions] internal dialyzer error Message-ID: What does this mean? dialyzer -c . --src --build_plt {dialyzer_error,[65,110,97,108,121,115,105,115,32,109,117, 115,116,32,98,101,32,100,111,110,101,32,111,110,32,98,121, 116,101,32,99,111,100,101,32,105,110,32,97,110,97,108,121, 115,105,115,32,109,111,100,101,32,"plt_build"]} [{dialyzer_options,check_output_plt,1}, {dialyzer_options,postprocess_opts,1}, {dialyzer_options,build,1}, {dialyzer_cl_parse,cl,1}, {dialyzer_cl_parse,start,0}, {dialyzer,plain_cl,0}, {init,start_it,1}, {init,start_em,1}] dialyzer: Internal problems were encountered in the analysis. %% from beam dialyzer -c . --build_plt Could not compute md5 for file: /Users/joelr/Work/openpoker/server/src/ betting.beam dialyzer: Internal problems were encountered in the analysis. Thanks, Joel -- wagerlabs.com From dmercer@REDACTED Tue Aug 26 20:24:33 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 26 Aug 2008 13:24:33 -0500 Subject: [erlang-questions] Documentation Question Message-ID: <9A6F467FF30C4D00AB5D1B5A92B944B8@SSI.CORP> When documentation says something like, "This chapter should be read in conjunction with app(4) and application(3)," what do the numbers in parentheses mean? Is this referring me to the module documentation for app and application, and the numbers are to be ignored? Or are these somehow related to the man section in Unix, and maybe the (3) is the module documentation and (4) means something else? Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue Aug 26 20:56:59 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 26 Aug 2008 21:56:59 +0300 Subject: [erlang-questions] internal dialyzer error In-Reply-To: References: Message-ID: <48B451FB.4050204@cs.ntua.gr> Joel Reymont wrote: > What does this mean? > > dialyzer -c . --src --build_plt > > {dialyzer_error,[65,110,97,108,121,115,105,115,32,109,117, > 115,116,32,98,101,32,100,111,110,101,32,111,110,32,98,121, > 116,101,32,99,111,100,101,32,105,110,32,97,110,97,108,121, > 115,105,115,32,109,111,100,101,32,"plt_build"]} > [{dialyzer_options,check_output_plt,1}, > {dialyzer_options,postprocess_opts,1}, > {dialyzer_options,build,1}, > {dialyzer_cl_parse,cl,1}, > {dialyzer_cl_parse,start,0}, > {dialyzer,plain_cl,0}, > {init,start_it,1}, > {init,start_em,1}] > > dialyzer: Internal problems were encountered in the analysis. You can use the following: io:format("~s\n", [[65,110,97,108,121,115,105,115,32,109,117,115,116,32,98,101,32,100,111,110,101,32,111,110,32,98,121,116,101,32,99,111,100,101,32,105,110,32,97,110,97,108,121,115,105,115,32,109,111,100,101,32,"plt_build"]]). Analysis must be done on byte code in analysis mode plt_build > %% from beam > > dialyzer -c . --build_plt > > Could not compute md5 for file: /Users/joelr/Work/openpoker/server/src/ > betting.beam This means that the betting.beam file does not contain abstract code. If you want to build a PLT with it, you need to compile the file with +debug_info. Kostis PS. Please try to submit a proper bug reports: minimally include info about OTP version and platform used. From rpettit@REDACTED Tue Aug 26 21:00:02 2008 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 26 Aug 2008 14:00:02 -0500 (CDT) Subject: [erlang-questions] Documentation Question In-Reply-To: <9A6F467FF30C4D00AB5D1B5A92B944B8@SSI.CORP> References: <9A6F467FF30C4D00AB5D1B5A92B944B8@SSI.CORP> Message-ID: <59797.192.168.129.36.1219777202.squirrel@squirrelmail.vail> On Tue, August 26, 2008 1:24 pm, David Mercer wrote: > When documentation says something like, "This chapter should be read in > conjunction with app(4) and application(3)," what do the numbers in > parentheses mean? [snip] They refer to man page sections. For example, suppose you want the the man page for snmp: prompt> erl -man snmp On my system this presents me with the man page for the "Interface functions to the SNMP toolkit", found in section 3. I could have also found this by doing: prompt> erl -man 3 snmp Now let's suppose I don't want the man page on the SNMP toolkit API, but rather the SNMP application itself--that can be found in section 6 of the manual like so: prompt> erl -man 6 snmp This is handled very much the way UNIX man pages are handled--broken down into sections. Hope that helps, -Rick From ahmed.nawras@REDACTED Tue Aug 26 21:05:10 2008 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 26 Aug 2008 23:05:10 +0400 Subject: [erlang-questions] How to get the line number of current executable code? In-Reply-To: <48B3C4DA.1070503@gmail.com> References: <6c2563b20808151329x59d23125yb49ac5014bb338@mail.gmail.com> <8209f740808151406u4e6740c7md2a9fc33c26040c0@mail.gmail.com> <6c2563b20808161059o4472935dqa81b0f56a53dd97c@mail.gmail.com> <8209f740808170219g975e39cw9c32165e44313115@mail.gmail.com> <48B257E8.2090106@gmail.com> <48B3A980.10209@it.uu.se> <48B3C4DA.1070503@gmail.com> Message-ID: Hi Mats, I've seen process_display(Pid, backtrace) but never thought to use it this way. Thanks for the insight. Best regards, Ahmed Al-Issaei On Tue, Aug 26, 2008 at 12:54 PM, Mats Cronqvist wrote: > Richard Carlsson wrote: >> >> Ahmed Ali wrote: >> >>> >>> Hi All, >>> >>> This discussion is interesting. Just wanted to know if it is possible >>> to get the function that called current function. Is this possible? >>> >> >> The only way of doing that is to force an exception, and then look >> at the stack trace. > > there is no way to reliably get the name of the calling function. > it is true that the stack sometimes contain the name of the calling > function. > it is not true that the only way to inspect the stack is by forcing an > exception. > > i'm too lazy to write actual code, but try this in the shell; > > (r12@REDACTED)41> {_,BT}=erlang:process_info(self(),backtrace). > (r12@REDACTED)42> S=fun(B,{_,[_,{F,L}|_]})-> > <<_:F/binary,R:L/binary,_/binary>> =B, R end. > (r12@REDACTED)43> S(BT,re:run(BT,"Return addr\\s[0-9a-z]+\\s\\(([^\\s]*)")). > <<"erl_eval:expr/5">> > > clear as the day! > > mats > From joelr1@REDACTED Tue Aug 26 21:48:15 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 26 Aug 2008 20:48:15 +0100 Subject: [erlang-questions] internal dialyzer error In-Reply-To: <48B451FB.4050204@cs.ntua.gr> References: <48B451FB.4050204@cs.ntua.gr> Message-ID: <87716ADE-A3D5-4BD1-B8DF-04E4E072B801@gmail.com> > PS. Please try to submit a proper bug reports: minimally include info > about OTP version and platform used. My apologies, Kostis! Another question ... What does it mean when dialyzer says that this function has no local return? test() -> test3(), test4(), test5(), test6(), test7(), test8(), test9(), test10(), test11(), test12(), ok. Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Tue Aug 26 22:02:16 2008 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 26 Aug 2008 21:02:16 +0100 Subject: [erlang-questions] internal dialyzer error In-Reply-To: <87716ADE-A3D5-4BD1-B8DF-04E4E072B801@gmail.com> References: <48B451FB.4050204@cs.ntua.gr> <87716ADE-A3D5-4BD1-B8DF-04E4E072B801@gmail.com> Message-ID: <1101CB68-6691-4FC8-B3C8-F0C6D30B17D9@gmail.com> I figured it out. dialyzer cannot see that test12/0 returns and so it complains that test/0 does not return. On Aug 26, 2008, at 8:48 PM, Joel Reymont wrote: >> What does it mean when dialyzer says that this function has no >> local return? > > test() -> > test3(), > test4(), > test5(), > test6(), > test7(), > test8(), > test9(), > test10(), > test11(), > test12(), > ok. -- wagerlabs.com From kostis@REDACTED Tue Aug 26 22:55:25 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 26 Aug 2008 23:55:25 +0300 Subject: [erlang-questions] internal dialyzer error In-Reply-To: <87716ADE-A3D5-4BD1-B8DF-04E4E072B801@gmail.com> References: <48B451FB.4050204@cs.ntua.gr> <87716ADE-A3D5-4BD1-B8DF-04E4E072B801@gmail.com> Message-ID: <48B46DBD.7070500@cs.ntua.gr> Joel Reymont wrote: > > What does it mean when dialyzer says that this function has no local > return? > > test() -> > test3(), > test4(), > test5(), > test6(), > test7(), > test8(), > test9(), > test10(), > test11(), > test12(), > ok. It means that Dialyzer has figured out that the 'ok' will never be returned by this function because one of test3 .. test12 does not return (i.e. either loops, exits or throws an exception). Kostis From karol.skocik@REDACTED Tue Aug 26 23:10:50 2008 From: karol.skocik@REDACTED (karol skocik) Date: Tue, 26 Aug 2008 23:10:50 +0200 Subject: [erlang-questions] [BUG] in inets/http_uri.erl Message-ID: Hi, there is a bug in inets/http_uri.erl in function parse_uri_rest, which first looks for '/' and then for '?' to get hostname and query params. This is not very good since some requests can have '/' after '?', which messes up the hostname. Example: (netskin@REDACTED)15> http_uri:parse("http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"). {http,[],"ec2.amazonaws.com",80,"/", "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} which is ok, hostname is "ec2.amazonaws.com", but now: (netskin@REDACTED)29> http_uri:parse("http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). {http,[], "ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0", 80, "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", []} here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow access to, with '/'. This results to {error, nxdomain} from http:request. Karol From gleber.p@REDACTED Tue Aug 26 23:23:11 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 26 Aug 2008 23:23:11 +0200 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: References: Message-ID: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> On Tue, Aug 26, 2008 at 11:10 PM, karol skocik wrote: > Hi, > there is a bug in inets/http_uri.erl in function parse_uri_rest, > which first looks for '/' and then for '?' to get hostname and query > params. > This is not very good since some requests can have '/' after '?', > which messes up the hostname. > Example: > > (netskin@REDACTED)15> > http_uri:parse(" > http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D > "). > {http,[],"ec2.amazonaws.com",80,"/", > > "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} > > which is ok, hostname is "ec2.amazonaws.com", but now: > > (netskin@REDACTED)29> > http_uri:parse(" > http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D > "). > {http,[], > " > ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0 > ", > 80, > > "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", > []} > > here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow > access to, with '/'. This results to {error, nxdomain} from > http:request. > > Karol > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > According to RFC [1] these URLs are incorrect. Hostname and url-path have to be separated with "/". Hence there is no bug here 1: http://www.ietf.org/rfc/rfc1738.txt P.S. Karol, sorry for previous incomplete mail, I've hit "Send" by mistake... -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong -------------- next part -------------- An HTML attachment was scrubbed... URL: From karol.skocik@REDACTED Tue Aug 26 23:41:56 2008 From: karol.skocik@REDACTED (karol skocik) Date: Tue, 26 Aug 2008 23:41:56 +0200 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> References: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> Message-ID: Well, ok, I am no URI expert. They might be correct, but the fact is that python http client can work with them and do ec2 AuthorizeSecurityGroupIngress requests, and they unfortunately have '/' as a part of the parameter value. The question is, what to do about that. Erlang already has an HTTPOption 'relaxed' in http:request. This case might be a good candidate for inclusion in the bag along with other irregularities allowed with 'relaxed' option. Cheers, Karol On Tue, Aug 26, 2008 at 11:23 PM, Gleb Peregud wrote: > On Tue, Aug 26, 2008 at 11:10 PM, karol skocik > wrote: >> >> Hi, >> there is a bug in inets/http_uri.erl in function parse_uri_rest, >> which first looks for '/' and then for '?' to get hostname and query >> params. >> This is not very good since some requests can have '/' after '?', >> which messes up the hostname. >> Example: >> >> (netskin@REDACTED)15> >> >> http_uri:parse("http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"). >> {http,[],"ec2.amazonaws.com",80,"/", >> >> "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} >> >> which is ok, hostname is "ec2.amazonaws.com", but now: >> >> (netskin@REDACTED)29> >> >> http_uri:parse("http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). >> {http,[], >> >> "ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0", >> 80, >> >> "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", >> []} >> >> here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow >> access to, with '/'. This results to {error, nxdomain} from >> http:request. >> >> Karol >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > According to RFC [1] these URLs are incorrect. Hostname and url-path have to > be separated with "/". Hence there is no bug here > > 1: http://www.ietf.org/rfc/rfc1738.txt > > P.S. Karol, sorry for previous incomplete mail, I've hit "Send" by > mistake... > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > From gleber.p@REDACTED Tue Aug 26 23:54:49 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 26 Aug 2008 23:54:49 +0200 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: References: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> Message-ID: <14f0e3620808261454i2ac5055ayebb51799cfce0290@mail.gmail.com> According to RFC. An HTTP URL takes the form: http://:/? ... Within the and components, "/", ";", "?" are reserved. and Octets must be encoded if they have no corresponding graphic character within the US-ASCII coded character set, if the use of the corresponding character is unsafe, or if the corresponding character is reserved for some other interpretation within the particular URL scheme. This means that this URL is definitely incorrect. The "/" in are not encoded. And there is no "/" separating and . If the latter is corrected http_uri will work as expected: 3> http_uri:parse("http://ec2.amazonaws.com/?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). {http,[],"ec2.amazonaws.com",80,"/", "?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"} Are you able to correct these URIs/URLs in your system (by adding separating "/" beetween and )? If yes, your problem is solved BR On Tue, Aug 26, 2008 at 11:41 PM, karol skocik wrote: > > Well, ok, I am no URI expert. They might be correct, but the fact is > that python http client can work with them and do ec2 > AuthorizeSecurityGroupIngress requests, and they unfortunately have > '/' as a part of the parameter value. The question is, what to do > about that. Erlang already has an HTTPOption 'relaxed' in > http:request. This case might be a good candidate for inclusion in the > bag along with other irregularities allowed with 'relaxed' option. > > Cheers, > Karol > > On Tue, Aug 26, 2008 at 11:23 PM, Gleb Peregud wrote: > > On Tue, Aug 26, 2008 at 11:10 PM, karol skocik > > wrote: > >> > >> Hi, > >> there is a bug in inets/http_uri.erl in function parse_uri_rest, > >> which first looks for '/' and then for '?' to get hostname and query > >> params. > >> This is not very good since some requests can have '/' after '?', > >> which messes up the hostname. > >> Example: > >> > >> (netskin@REDACTED)15> > >> > >> http_uri:parse("http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"). > >> {http,[],"ec2.amazonaws.com",80,"/", > >> > >> "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} > >> > >> which is ok, hostname is "ec2.amazonaws.com", but now: > >> > >> (netskin@REDACTED)29> > >> > >> http_uri:parse("http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). > >> {http,[], > >> > >> "ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0", > >> 80, > >> > >> "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", > >> []} > >> > >> here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow > >> access to, with '/'. This results to {error, nxdomain} from > >> http:request. > >> > >> Karol > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > According to RFC [1] these URLs are incorrect. Hostname and url-path have to > > be separated with "/". Hence there is no bug here > > > > 1: http://www.ietf.org/rfc/rfc1738.txt > > > > P.S. Karol, sorry for previous incomplete mail, I've hit "Send" by > > mistake... > > > > -- > > Gleb Peregud > > http://gleber.pl/ > > > > Every minute is to be grasped. > > Time waits for nobody. > > -- Inscription on a Zen Gong > > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From karol.skocik@REDACTED Wed Aug 27 00:10:37 2008 From: karol.skocik@REDACTED (karol skocik) Date: Wed, 27 Aug 2008 00:10:37 +0200 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: <14f0e3620808261454i2ac5055ayebb51799cfce0290@mail.gmail.com> References: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> <14f0e3620808261454i2ac5055ayebb51799cfce0290@mail.gmail.com> Message-ID: I have tried to encode '/' in the CidrIp parameter, but then the signature computed on the amazon side did not match, which is a PITA. I have solved the problem with exporting handle_request/6 from inets/http and calling it directly, avoiding http_uri:parse_uri_rest. That's not very pretty however, I would prefer to use exported http:request but it won't work. When I construct that what http_uri:parse_uri_rest should do (being relaxed to this amazon bug in their ec2 API) everything works fine. Karol On Tue, Aug 26, 2008 at 11:54 PM, Gleb Peregud wrote: > According to RFC. > > An HTTP URL takes the form: > http://:/? > ... > Within the and components, "/", ";", "?" are > reserved. > > and > > Octets must be encoded if they have no corresponding graphic > character within the US-ASCII coded character set, if the use of the > corresponding character is unsafe, or if the corresponding character > is reserved for some other interpretation within the particular URL > scheme. > > This means that this URL is definitely incorrect. The "/" in > are not encoded. And there is no "/" separating > and . If the latter is corrected http_uri will work as expected: > > 3> http_uri:parse("http://ec2.amazonaws.com/?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). > {http,[],"ec2.amazonaws.com",80,"/", > "?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"} > > Are you able to correct these URIs/URLs in your system (by adding > separating "/" beetween and )? If yes, your problem is > solved > > BR > > On Tue, Aug 26, 2008 at 11:41 PM, karol skocik wrote: >> >> Well, ok, I am no URI expert. They might be correct, but the fact is >> that python http client can work with them and do ec2 >> AuthorizeSecurityGroupIngress requests, and they unfortunately have >> '/' as a part of the parameter value. The question is, what to do >> about that. Erlang already has an HTTPOption 'relaxed' in >> http:request. This case might be a good candidate for inclusion in the >> bag along with other irregularities allowed with 'relaxed' option. >> >> Cheers, >> Karol >> >> On Tue, Aug 26, 2008 at 11:23 PM, Gleb Peregud wrote: >> > On Tue, Aug 26, 2008 at 11:10 PM, karol skocik >> > wrote: >> >> >> >> Hi, >> >> there is a bug in inets/http_uri.erl in function parse_uri_rest, >> >> which first looks for '/' and then for '?' to get hostname and query >> >> params. >> >> This is not very good since some requests can have '/' after '?', >> >> which messes up the hostname. >> >> Example: >> >> >> >> (netskin@REDACTED)15> >> >> >> >> http_uri:parse("http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"). >> >> {http,[],"ec2.amazonaws.com",80,"/", >> >> >> >> "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} >> >> >> >> which is ok, hostname is "ec2.amazonaws.com", but now: >> >> >> >> (netskin@REDACTED)29> >> >> >> >> http_uri:parse("http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D"). >> >> {http,[], >> >> >> >> "ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0", >> >> 80, >> >> >> >> "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", >> >> []} >> >> >> >> here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow >> >> access to, with '/'. This results to {error, nxdomain} from >> >> http:request. >> >> >> >> Karol >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > According to RFC [1] these URLs are incorrect. Hostname and url-path have to >> > be separated with "/". Hence there is no bug here >> > >> > 1: http://www.ietf.org/rfc/rfc1738.txt >> > >> > P.S. Karol, sorry for previous incomplete mail, I've hit "Send" by >> > mistake... >> > >> > -- >> > Gleb Peregud >> > http://gleber.pl/ >> > >> > Every minute is to be grasped. >> > Time waits for nobody. >> > -- Inscription on a Zen Gong >> > > > > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > From juanjo@REDACTED Wed Aug 27 00:44:22 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 26 Aug 2008 19:44:22 -0300 Subject: [erlang-questions] Erlang STOMP client Message-ID: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> Does anybody know if there is an Erlang STOMP client available? I've seen that RabbitMQ has a STOMP adapter but what I need is a client library. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Aug 27 04:58:13 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 27 Aug 2008 14:58:13 +1200 Subject: [erlang-questions] Integer truncation in binary conversion considered harmful In-Reply-To: <18088_1219736056_m7Q7Y9lR018396_6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> References: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> <18088_1219736056_m7Q7Y9lR018396_6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> Message-ID: <351137C8-CC35-4C87-9F1D-F40BA7E0ED31@cs.otago.ac.nz> On 26 Aug 2008, at 7:24 pm, Bjorn Gustavsson wrote: > If someone writes an EEP, we will consider implementing it. Done. From erlang-questions_efine@REDACTED Wed Aug 27 06:46:46 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 27 Aug 2008 00:46:46 -0400 Subject: [erlang-questions] Integer truncation in binary conversion considered harmful In-Reply-To: <351137C8-CC35-4C87-9F1D-F40BA7E0ED31@cs.otago.ac.nz> References: <6c2563b20808252346k5800142bjb64ffbdacceefec5@mail.gmail.com> <18088_1219736056_m7Q7Y9lR018396_6672d0160808260024j75f1129eo5a3fa04b3d11e3be@mail.gmail.com> <351137C8-CC35-4C87-9F1D-F40BA7E0ED31@cs.otago.ac.nz> Message-ID: <6c2563b20808262146v66906222j4d8315780c8bd3e1@mail.gmail.com> Awesome EEP, Richard. Thanks so much for showing me (intentionally or otherwise) how it's done. Maybe I can do some of my own in future now that I have a model! Thanks also for immediately grokking the value of having such a run-time check. Disclaimer: This is Sincere Praise and Appreciation, not Loathsome Toadying and Brown-Nosing. Regards, Edwin Fine On Tue, Aug 26, 2008 at 10:58 PM, Richard A. O'Keefe wrote: > On 26 Aug 2008, at 7:24 pm, Bjorn Gustavsson wrote: > >> If someone writes an EEP, we will consider implementing it. >> > > Done. > > > > > > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Aug 27 06:47:21 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 27 Aug 2008 16:47:21 +1200 Subject: [erlang-questions] Please criticise these principles Message-ID: <8A5BD119-29F6-4F76-927E-AD79994C5241@cs.otago.ac.nz> I've just been looking at ISO/EIC DTR 13211-5:2007 "Prolog Multi-threading predicates". This is a proposed addition to the ISO Prolog standard, whose declared aim is "to promote the portability of multi-threaded Prolog applications". As I read through it, I felt sicker and sicker and sicker. If any of you are parents, you may know the feeling when a child is being naughty and seems to be going out of his/her way to do things that are OBVIOUSLY to his/her detriment. I've boiled my reactions down to "here is a short list of design principles, every single one of which is violated by the proposal." Before sending them off to the ISO Prolog crowd, I thought I'd ask the opinion of Erlangers, especially Joe Armstrong, should he happen to read this. I concede that debugging tools may need to do all sorts of things that are otherwise risky. There are quite a few predicates in the 'erlang' module that are labelled as "debugging only". What I'm talking about is *core* facilities to be used in *normal* code that is meant to be portable and reliable. Some principles for simpler safer threading. ============================================ 1. No omniscient users. Users shall not be required to provide information, such as space allocation or tuning parameters, the values of which they cannot determine. Applicability: consider a list cell. In NU Prolog, a list cell holding a single character could be as little as 1 byte (on a 32-bit machine). On some systems, a list cell could be 4 words, which on a 64-bit system would be 32 bytes. While it is imaginable that a user might know how many list cells a thread would need, it is not possible for them to say how many BYTES will be needed and if they did give a number it would not be portable. This means that while a user *could* give an initial heap size for a thread, they could *not* give a *fixed* size that would suit all systems. 2. No distinction between indistinguishables. A specification shall not mandate distinct responses to situations that user programs cannot distinguish. Application: sending a message to a process. Case 1 Case 2 T+1 Pid is alive Pid is alive T+2 Pid dies Pid ! Message T+3 Pid ! Message Pid dies The ISO draft requires case 1 to produce a runtime exception in the send call. In case 2, Pid dies and there is no send call to be blamed, so there is no such exception. 3. No breaches of encapsulation. If process A wants process B to do something, it should ASK. It should not FORCE process B to perform some action. Application 1: the ISO draft includes an operation to kill any process. There are mutexes. There are global variables of a kind. If you kill a process that is holding some mutexes, all those mutexes are released. This means that all the data protected by those mutexes is now in an unknown state and you dare not use it for the rest of the program's existence. Application 2: the ISO draft includes an operation thread_signal(Thread, Goal) which causes Thread to be interrupted at the next opportunity and forced to call Goal. The goal can do anything, including unlocking a mutex that the Thread is holding (and after the interrupt, mistakenly believes it is still holding). 4. No unprotected shared mutable variables. While some thread has the power to write a variable, it is VERIFIED that no other thread has the power to read or write that variable. Application 1: Prolog has an analogue of Erlang process dictionaries, but it is global. [More precisely, it is partitioned into named pieces each of while is local to a *module*, but the pieces are global to *threads.*] While SWI Prolog offers thread-local mutable data, the ISO draft includes no such thing. It's as if Erlang offered only global ETS tables accessed without locks. While mutexes (but oddly, not reader/writer locks) are present in the ISO draft, there is no *intrinsic* connection between any mutable table and any mutex. Application 2: the draft introduces three kinds of IPC data: thread IDs, mutex IDs, and message queue IDs. There are three name-spaces for 'aliases', rather like the Erlang registry for process ids. These things are in effect mutable variables. There are operations to create and destroy threads, mutexes, and message queues. Although there are no operations for rebinding aliases, this can happen: create a thingy and give it the alias 'fred' create a thread that refers to 'fred' destroy the thingy create another thingy and give it the alias 'fred' So the other thread *thinks* it knows what 'fred' refers to, but it is wrong. As an example, there is a 'thread_join(Thread, Result)' operation which waits for the Thread to complete and then picks up its Result; if Thread is an alias, this could wait for the wrong thread. 5. No intrinsically unreliable information flows. There should be no query operations that give you information that you would have to be crazy to use. In particular, if you want some information about a thread, you should ASK it [so this may be a version of principle 3] and then you know that the information should be interpreted with reference to that specific synchronisation point. Application: the ISO draft provides some operations of which it says "almost any usage of these ... is unsafe". These relate to finding the 'instantaneous' state of IPC objects. Because these are 'direct' queries that do not involve any explicit synchronisation, the point in the lifetime of the other thread that they refer to is entirely unknown. You cannot expect these values to apply "now" (whatever that means) and you cannot tell at _what_ point in the past of the other thread they do relate to. 6. No zombies. When a process dies, a death notice should be sent to its family and friends, if any, but the process itself should disappear completely. Application: because the thread_join/2 operation merely _exists_ in the interface, at least the full exit or exception status of a process must be kept around as long as there is a live copy of its Pid anywhere in a process or the global data base, in case someone should wait for it. The term given to thread_exit/1 could be arbitrarily large. There is no way to promise that you won't use thread_join. In effect this is a mandatory space leak. While Erlang doesn't perfectly conform to these principles (the process registry being a particularly painful example), you can program *as if* it did. And if you think I would prefer multi-threading in Prolog to look as much as possible like Erlang, why yes, I would. I would like that very much. What got me looking at this was someone asking me to review a paper about how to implement thread_cancel/1, the operation that kills any thread. The paper claims that "The ability to cancel a thread is useful for application development and is critical to Prolog embeddability." and I found myself saying "but the ability to cancel a thread is like the ability to apply a chainsaw to your own neck! It's an incredibly easy way to violate system integrity." What's really frightening is that if I hadn't been exposed to Erlang, my previous exposure to Ada and Occam and Concurrent Pascal, nice though they are, might not have been enough to stop me reading the DTR and going "yeah, this looks like a fairly straightforward layer over pthreads, nice job" instead of "yuck". THANK YOU JOE! -- If stupidity were a crime, who'd 'scape hanging? From keith.irwin@REDACTED Wed Aug 27 08:01:56 2008 From: keith.irwin@REDACTED (Keith Irwin) Date: Tue, 26 Aug 2008 23:01:56 -0700 Subject: [erlang-questions] Erlang STOMP client In-Reply-To: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> References: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> Message-ID: <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> 2008/8/26 Juan Jose Comellas > Does anybody know if there is an Erlang STOMP client available? I've seen > that RabbitMQ has a STOMP adapter but what I need is a client library. > Here's a project: http://code.google.com/p/erlstomp/ Keith > > Thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Aug 27 10:54:35 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 27 Aug 2008 10:54:35 +0200 Subject: [erlang-questions] Please criticise these principles In-Reply-To: <8A5BD119-29F6-4F76-927E-AD79994C5241@cs.otago.ac.nz> References: <8A5BD119-29F6-4F76-927E-AD79994C5241@cs.otago.ac.nz> Message-ID: <9b08084c0808270154t61d1fc9fx7d0328bcbb4adc84@mail.gmail.com> Hi Richard I've added my comments in-line /Joe On Wed, Aug 27, 2008 at 6:47 AM, Richard A. O'Keefe wrote: > ... nt. > > I've boiled my reactions down to "here is a short list > of design principles, every single one of which is > violated by the proposal." Before sending them off to > the ISO Prolog crowd, I thought I'd ask the opinion of > Erlangers, especially Joe Armstrong, should he happen > to read this. I'm reading with bated breath. (btw I still love Prolog - Robert Virding has implemented a Prolog in Erlang with run Nrev at 100 KLips (on the nrev benchmark) I've found the old Erlang in prolog emulator, so soon we should be able to implement erlang-in-prolog-in-erlang :-) > > I concede that debugging tools may need to do all sorts > of things that are otherwise risky. There are quite a > few predicates in the 'erlang' module that are labelled > as "debugging only". What I'm talking about is *core* > facilities to be used in *normal* code that is meant to > be portable and reliable. > Absolutly - things like erlang:display/1 are *very* useful for debugging the I/O code but should never be used in production programs. > > > Some principles for simpler safer threading. > ============================================ > > > 1. No omniscient users. > > Users shall not be required to provide information, > such as space allocation or tuning parameters, the > values of which they cannot determine. > > Applicability: consider a list cell. In NU Prolog, > a list cell holding a single character could be as > little as 1 byte (on a 32-bit machine). On some > systems, a list cell could be 4 words, which on a > 64-bit system would be 32 bytes. While it is > imaginable that a user might know how many list cells > a thread would need, it is not possible for them to > say how many BYTES will be needed and if they did > give a number it would not be portable. This means > that while a user *could* give an initial heap size > for a thread, they could *not* give a *fixed* size > that would suit all systems. Agree > 2. No distinction between indistinguishables. > > A specification shall not mandate distinct responses > to situations that user programs cannot distinguish. > > Application: sending a message to a process. > Case 1 Case 2 > T+1 Pid is alive Pid is alive > T+2 Pid dies Pid ! Message > T+3 Pid ! Message Pid dies > The ISO draft requires case 1 to produce a runtime > exception in the send call. In case 2, Pid dies > and there is no send call to be blamed, so there is > no such exception. Impossible. Suppose Pid is on a remote machine. You cannot distiguish communication failure, with machine failure. So you cannot implement this. The Erlang Tao says if you want to know if a message was received then send a reply and wait for it. Even if you send a message and it is received there is no guarantee of "liveness" the receiver might receive the message and go into an infinite loop. This is why we invented the link mechanism. > 3. No breaches of encapsulation. > > If process A wants process B to do something, it should > ASK. It should not FORCE process B to perform some action. Yes > Application 1: the ISO draft includes an operation to > kill any process. There are mutexes. There are global > variables of a kind. If you kill a process that is > holding some mutexes, all those mutexes are released. > This means that all the data protected by those mutexes > is now in an unknown state and you dare not use it for > the rest of the program's existence. Madness > > Application 2: the ISO draft includes an operation > thread_signal(Thread, Goal) which causes Thread to be > interrupted at the next opportunity and forced to call > Goal. The goal can do anything, including unlocking a > mutex that the Thread is holding (and after the > interrupt, mistakenly believes it is still holding). Daft > 4. No unprotected shared mutable variables. > > While some thread has the power to write a variable, > it is VERIFIED that no other thread has the power to > read or write that variable. I have always thought that there should not be shared variables AT ALL. You can't actually share a variable, it's a violation of causality - think rays of light, electrons running along wires, think time, failures. The problem is not the mutexes, it's the shared state. Since you shouldn't have shared state, then you shouldn't need mutexes to protect the shared state. Erlang programmers have happlily been writing distributed and concurrent programs for twenty years without the use of mutexes - they are just NOT needed. Now deep under the covers, where no user should be lurking, there are some ets tables - *which were added to implement large data bases* - (solving the "we can't copy the entire universe problem" - the correct way to use ets tables is not to use them - but use them via the mnesia transactions (a form of transaction memory) - if you really know what you are doing you can disregard this advice. > > Application 1: Prolog has an analogue of Erlang process > dictionaries, but it is global. [More precisely, it is > partitioned into named pieces each of while is local to > a *module*, but the pieces are global to *threads.*] > While SWI Prolog offers thread-local mutable data, the > ISO draft includes no such thing. It's as if Erlang > offered only global ETS tables accessed without locks. > While mutexes (but oddly, not reader/writer locks) are > present in the ISO draft, there is no *intrinsic* > connection between any mutable table and any mutex. This will lead to many horrific errors. > Application 2: the draft introduces three kinds of IPC > data: thread IDs, mutex IDs, and message queue IDs. > There are three name-spaces for 'aliases', rather like > the Erlang registry for process ids. These things are > in effect mutable variables. There are operations to > create and destroy threads, mutexes, and message queues. > Although there are no operations for rebinding aliases, > this can happen: > create a thingy and give it the alias 'fred' > create a thread that refers to 'fred' > destroy the thingy > create another thingy and give it the alias 'fred' > So the other thread *thinks* it knows what 'fred' refers > to, but it is wrong. As an example, there is a > 'thread_join(Thread, Result)' operation which waits for > the Thread to complete and then picks up its Result; if > Thread is an alias, this could wait for the wrong thread. Not good > > 5. No intrinsically unreliable information flows. > > There should be no query operations that give you > information that you would have to be crazy to use. > In particular, if you want some information about a > thread, you should ASK it [so this may be a version > of principle 3] and then you know that the information > should be interpreted with reference to that specific > synchronisation point. yes > Application: the ISO draft provides some operations > of which it says "almost any usage of these ... is > unsafe". These relate to finding the 'instantaneous' > state of IPC objects. Because these are 'direct' > queries that do not involve any explicit synchronisation, > the point in the lifetime of the other thread that they > refer to is entirely unknown. You cannot expect these > values to apply "now" (whatever that means) and you > cannot tell at _what_ point in the past of the other> thread they do relate to. UUgh - impossible - there is no "instantaneous" state of a remote object. Light takes finite time to propagate through the ether. Think special relativity - I guess the ISO standards committee members are not ex physicists :-) > > 6. No zombies. > > When a process dies, a death notice should be sent to > its family and friends, if any, but the process itself > should disappear completely. yes > > Application: because the thread_join/2 operation > merely _exists_ in the interface, at least the full > exit or exception status of a process must be kept > around as long as there is a live copy of its Pid > anywhere in a process or the global data base, in > case someone should wait for it. The term given to > thread_exit/1 could be arbitrarily large. There is > no way to promise that you won't use thread_join. > In effect this is a mandatory space leak. > > > While Erlang doesn't perfectly conform to these principles > (the process registry being a particularly painful example), > you can program *as if* it did. And if you think I would > prefer multi-threading in Prolog to look as much as possible > like Erlang, why yes, I would. I would like that very much. > > What got me looking at this was someone asking me to review > a paper about how to implement thread_cancel/1, the operation > that kills any thread. The paper claims that > > "The ability to cancel a thread is useful for > application development and is critical to > Prolog embeddability." > > and I found myself saying "but the ability to cancel a > thread is like the ability to apply a chainsaw to your > own neck! It's an incredibly easy way to violate > system integrity." > > What's really frightening is that if I hadn't been exposed to > Erlang, my previous exposure to Ada and Occam and Concurrent > Pascal, nice though they are, might not have been enough to > stop me reading the DTR and going "yeah, this looks like a > fairly straightforward layer over pthreads, nice job" instead > of "yuck". THANK YOU JOE! Concurrency isn't a "nice layer over pthreads" - the most important thing is isolation - anything that mucks up isolation is a mistake. If my computer crashes (the one I'm typing on NOW) crashes I hope that this will not crash your computer. So it should be with threads. /Joe > -- > If stupidity were a crime, who'd 'scape hanging? > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From eduardof08@REDACTED Wed Aug 27 12:36:56 2008 From: eduardof08@REDACTED (eduardo f) Date: Wed, 27 Aug 2008 07:36:56 -0300 Subject: [erlang-questions] Erlang and DICOM Message-ID: <6107556d0808270336w6cdae75dnd75b4102783c34fd@mail.gmail.com> Hi, I'm evaluating Digital imaging server's implementations and the chance to develop a DICOM server in Erlang. Does someone in the community have experience in this field with Erlang? Thanks, Eduardo Figoli -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Aug 27 17:01:00 2008 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 27 Aug 2008 16:01:00 +0100 Subject: [erlang-questions] Field name to tuple element number at compile time Message-ID: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> Suppose I have -record(foo, { bar, baz }). I understand that I can do record_info(fields, foo) and get a list of fields at compile time. Is there a way to translate bar into 2 at compile time as well? Thanks, Joel -- wagerlabs.com From colm.dougan@REDACTED Wed Aug 27 17:14:03 2008 From: colm.dougan@REDACTED (Colm Dougan) Date: Wed, 27 Aug 2008 16:14:03 +0100 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> Message-ID: <24d4f39c0808270814y2bfd7d4fg81ea9cb318cac10f@mail.gmail.com> On Wed, Aug 27, 2008 at 4:01 PM, Joel Reymont wrote: > Suppose I have -record(foo, { bar, baz }). I understand that I can do > record_info(fields, foo) and get a list of fields at compile time. > > Is there a way to translate bar into 2 at compile time as well? I think #foo.bar does what you want. Colm From bengt.kleberg@REDACTED Wed Aug 27 17:14:28 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 27 Aug 2008 17:14:28 +0200 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> Message-ID: <1219850068.31746.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Do you mean like this: #foo.bar bengt On Wed, 2008-08-27 at 16:01 +0100, Joel Reymont wrote: > Suppose I have -record(foo, { bar, baz }). I understand that I can do > record_info(fields, foo) and get a list of fields at compile time. > > Is there a way to translate bar into 2 at compile time as well? > > Thanks, Joel > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Wed Aug 27 17:16:40 2008 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 27 Aug 2008 16:16:40 +0100 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> Message-ID: <226D6414-5CCF-4C05-90F9-35C883ACBE82@gmail.com> #foo.bar, or generally #rec_name.field does it. This is perfectly valid: -module(x). -compile([export_all]). -record(foo, {bar, baz}). t() -> #foo.bar. On Aug 27, 2008, at 4:01 PM, Joel Reymont wrote: > Suppose I have -record(foo, { bar, baz }). I understand that I can > do record_info(fields, foo) and get a list of fields at compile time. > > Is there a way to translate bar into 2 at compile time as well? -- wagerlabs.com From joelr1@REDACTED Wed Aug 27 17:29:18 2008 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 27 Aug 2008 16:29:18 +0100 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <1219850068.31746.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> <1219850068.31746.6.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Message-ID: <99042036-545E-4091-BB82-505622D1C9E2@gmail.com> On Aug 27, 2008, at 4:14 PM, Bengt Kleberg wrote: > Greetings, > > Do you mean like this: > > #foo.bar Yes, thanks to everyone who took the time to reply! I'm still looking for a more elegant way to write the following db:find({inplay, GID, ID1, '_'}, #inplay.amount)) without incurring a penalty for building the match pattern at runtime, while _also_ saving on typing inplay twice. -- wagerlabs.com From mark.geib@REDACTED Wed Aug 27 17:38:49 2008 From: mark.geib@REDACTED (Mark Geib) Date: Wed, 27 Aug 2008 09:38:49 -0600 Subject: [erlang-questions] equivalent to global:register() for JInterface API ?? Message-ID: <48B57509.1080508@echostar.com> I need a java node to be reachable from some erlang processes and I want to do the equivalent of a global register to register a mailbox in the java node. Then the erlang code can send messages to that mailbox. Is this possible.?? I am fairly new to erlang, and only just started with JInterface. -- Principal Engineer Cheyenne Software Engineering mark.geib@REDACTED / 35-215 From mark.geib@REDACTED Wed Aug 27 17:48:51 2008 From: mark.geib@REDACTED (Mark Geib) Date: Wed, 27 Aug 2008 09:48:51 -0600 Subject: [erlang-questions] equivalent to global:register() for JInterface API ?? Message-ID: <48B57763.5020505@echostar.com> I need a java node to be reachable from some erlang processes and I want to do the equivalent of a global register to register a mailbox in the java node. Then the erlang code can send messages to that mailbox. Is this possible.?? I am fairly new to erlang, and only just started with JInterface. Thanks in advance. Mark. -- Principal Engineer Cheyenne Software Engineering mark.geib@REDACTED / 35-215 From btolputt@REDACTED Wed Aug 27 00:15:42 2008 From: btolputt@REDACTED (Benjamin Tolputt) Date: Wed, 27 Aug 2008 08:15:42 +1000 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> References: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> Message-ID: <48B4808E.4090005@bigpond.net.au> An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Aug 27 18:50:21 2008 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 27 Aug 2008 17:50:21 +0100 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <20080827130709.9a66nm2804g8w4oo@webcentremail.webcentre.ca> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> <99042036-545E-4091-BB82-505622D1C9E2@gmail.com> <20080827130709.9a66nm2804g8w4oo@webcentremail.webcentre.ca> Message-ID: <1E844EAA-9B92-4A19-8CAB-295C7A79FBF1@gmail.com> On Aug 27, 2008, at 5:07 PM, Sean Rasmussen wrote: > Not sure if it's more elegant, but - if I understand your intent - I > would > have gone with: > > mnesia:match_object(#inplay{amount=100,_='_'}) >> >> db:find({inplay, GID, ID1, '_'}, #inplay.amount)) Sean, the two are equivalent since db:find uses match_object + element(N, Result). I'm just nitpicking since I have to say inplay twice in a row. Ignore me. -- wagerlabs.com From juanjo@REDACTED Wed Aug 27 19:19:11 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Wed, 27 Aug 2008 14:19:11 -0300 Subject: [erlang-questions] Erlang STOMP client In-Reply-To: <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> References: <1c3be50f0808261544p1fee1f4fs1789d082ddabac3a@mail.gmail.com> <8aff81590808262301s5b40a90dyeaa84d0be25c5dbe@mail.gmail.com> Message-ID: <1c3be50f0808271019n3a09d7aelc059ba2f1ae817b5@mail.gmail.com> Yes, but there's nothing in it. I also checked its launchpad.net project and it was also empty. The only project I've found with actual code in it is Stomperl, on: http://code.google.com/p/stomperl/ The problem is that is a bit lacking in example code and/or documentation. 2008/8/27 Keith Irwin > 2008/8/26 Juan Jose Comellas > >> Does anybody know if there is an Erlang STOMP client available? I've seen >> that RabbitMQ has a STOMP adapter but what I need is a client library. >> > > Here's a project: > > http://code.google.com/p/erlstomp/ > > Keith > > >> >> Thanks. >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbyrne@REDACTED Wed Aug 27 19:55:19 2008 From: dbyrne@REDACTED (Dennis Byrne) Date: Wed, 27 Aug 2008 12:55:19 -0500 Subject: [erlang-questions] equivalent to global:register() for JInterface API ?? Message-ID: An HTML attachment was scrubbed... URL: From sean@REDACTED Wed Aug 27 18:07:09 2008 From: sean@REDACTED (Sean Rasmussen) Date: Wed, 27 Aug 2008 13:07:09 -0300 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <99042036-545E-4091-BB82-505622D1C9E2@gmail.com> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> <99042036-545E-4091-BB82-505622D1C9E2@gmail.com> Message-ID: <20080827130709.9a66nm2804g8w4oo@webcentremail.webcentre.ca> Hi Joel, Not sure if it's more elegant, but - if I understand your intent - I would have gone with: mnesia:match_object(#inplay{amount=100,_='_'}) Regards, Sean Quoting Joel Reymont : > On Aug 27, 2008, at 4:14 PM, Bengt Kleberg wrote: > >> Greetings, >> >> Do you mean like this: >> >> #foo.bar > > > Yes, thanks to everyone who took the time to reply! > > I'm still looking for a more elegant way to write the following > > db:find({inplay, GID, ID1, '_'}, #inplay.amount)) > > without incurring a penalty for building the match pattern at runtime, > while _also_ saving on typing inplay twice. > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From erlang-questions_efine@REDACTED Wed Aug 27 21:59:25 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 27 Aug 2008 15:59:25 -0400 Subject: [erlang-questions] [BUG] in inets/http_uri.erl In-Reply-To: <48B4808E.4090005@bigpond.net.au> References: <14f0e3620808261423k3aefc2eeh34a8dbc6e7a9480c@mail.gmail.com> <48B4808E.4090005@bigpond.net.au> Message-ID: <6c2563b20808271259q9f166eat50f2392335aa9766@mail.gmail.com> I love standards - there are SO many of them ;-) 2008/8/26 Benjamin Tolputt > Hi, > > Whilst the RFC is pretty explicit on this, most other languages & libraries > can handle this "problem". I often come across URI/URL strings that include > another URL in parameters and hence generally have a '/' after the '?'. > Given all browsers I have used (the primary users of HTTP) and most other > libraries I have come across handle this correctly - I would suggest this is > something that Erlang would do better to have as well (even if through some > "relaxed" interface). It would not be hard to find other areas of the > library that go beyond the RFC because the rest of the world does, it's the > nature of an actively developed system after all. > > --Ben > > > Gleb Peregud wrote: > > On Tue, Aug 26, 2008 at 11:10 PM, karol skocik wrote: > >> Hi, >> there is a bug in inets/http_uri.erl in function parse_uri_rest, >> which first looks for '/' and then for '?' to get hostname and query >> params. >> This is not very good since some requests can have '/' after '?', >> which messes up the hostname. >> Example: >> >> (netskin@REDACTED)15> >> http_uri:parse(" >> http://ec2.amazonaws.com?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D >> "). >> {http,[],"ec2.amazonaws.com",80,"/", >> >> "?Action=DescribeInstances&AWSAccessKeyId=XXX&SignatureVersion=1&Timestamp=2008-08-26T20:22:24&Version=2007-08-29&Signature=z%2FVynmrFTFe4dHtJlsPifSRtTLw%3D"} >> >> which is ok, hostname is "ec2.amazonaws.com", but now: >> >> (netskin@REDACTED)29> >> http_uri:parse(" >> http://ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D >> "). >> {http,[], >> " >> ec2.amazonaws.com?Action=AuthorizeSecurityGroupIngress&AWSAccessKeyId=XXX&CidrIp=0.0.0.0 >> ", >> 80, >> >> "/6&FromPort=0&GroupName=test&IpProtocol=tcp&SignatureVersion=1&Timestamp=2008-08-26T19:41:13&ToPort=65535&Version=2007-08-29&Signature=ClTihgpBO3%2BsMIlEDRem9AcZ6%2F0%3D", >> []} >> >> here, parameter CidrIp=0.0.0.0/6 denotes ip range you want to allow >> access to, with '/'. This results to {error, nxdomain} from >> http:request. >> >> Karol >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > According to RFC [1] these URLs are incorrect. Hostname and url-path have > to be separated with "/". Hence there is no bug here > > 1: http://www.ietf.org/rfc/rfc1738.txt > > P.S. Karol, sorry for previous incomplete mail, I've hit "Send" by > mistake... > > -- > Gleb Peregud > http://gleber.pl/ > > Every minute is to be grasped. > Time waits for nobody. > -- Inscription on a Zen Gong > > ------------------------------ > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Wed Aug 27 17:14:08 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Thu, 28 Aug 2008 00:14:08 +0900 Subject: [erlang-questions] Field name to tuple element number at compile time In-Reply-To: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> References: <5E12EE93-334C-48A1-A237-9B6E789D9660@gmail.com> Message-ID: Joel - The following should work: #foo.bar - Joe N. On Thu, 28 Aug 2008 00:01:00 +0900, Joel Reymont wrote: > Suppose I have -record(foo, { bar, baz }). I understand that I can do > record_info(fields, foo) and get a list of fields at compile time. > > Is there a way to translate bar into 2 at compile time as well? > > Thanks, Joel > > -- > wagerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- norton@REDACTED From Bill.McKeeman@REDACTED Thu Aug 28 01:03:19 2008 From: Bill.McKeeman@REDACTED (Bill McKeeman) Date: Wed, 27 Aug 2008 19:03:19 -0400 Subject: [erlang-questions] order-preserving send? Message-ID: Simple newbie question. Suppose I have a process id U, and send two messages U ! Message1. U ! Message2. Is there a guarantee that the messages will be received in the order they were sent? Second question: How could I find out without asking here? /s/ Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: From atomly-erl@REDACTED Thu Aug 28 01:31:59 2008 From: atomly-erl@REDACTED (atomly) Date: Wed, 27 Aug 2008 19:31:59 -0400 Subject: [erlang-questions] order-preserving send? In-Reply-To: References: Message-ID: <20080827233159.GB16945@atomly.com> [Bill McKeeman ] > > Simple newbie question. Suppose I have a process id U, and send two > messages > > > U ! Message1. > > U ! Message2. > > > Is there a guarantee that the messages will be received in the order > they were sent? No. There's not even a guarantee that both (or either) messages will be received. > Second question: How could I find out without asking here? I recommend starting with: http://www.erlang.org/starting.html http://www.erlang.org/course/course.html http://www.erlang.org/doc/ http://www.erlang.org/doc/pdf/ And, the best resource of all: http://www.pragprog.com/titles/jaerlang/programming-erlang -- :: atomly :: [ atomly@REDACTED : www.atomly.com ... [ atomiq records : new york city : +1.917.442.9450 ... [ e-mail atomly-news-subscribe@REDACTED for atomly info and updates ... From mark@REDACTED Thu Aug 28 02:13:54 2008 From: mark@REDACTED (Mark Scandariato) Date: Wed, 27 Aug 2008 20:13:54 -0400 Subject: [erlang-questions] order-preserving send? In-Reply-To: References: Message-ID: Try the FAQ: http://www.erlang.org/faq/academic.html#10.9 2008/8/27 Bill McKeeman > Simple newbie question. Suppose I have a process id U, and send two > messages > > > > U ! Message1. > > U ! Message2. > > > > Is there a guarantee that the messages will be received in the order they > were sent? > > > > Second question: How could I find out without asking here? > > > > /s/ Bill > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Thu Aug 28 01:57:36 2008 From: matthias@REDACTED (Matthias Lang) Date: Thu, 28 Aug 2008 01:57:36 +0200 Subject: [erlang-questions] order-preserving send? In-Reply-To: <20080827233159.GB16945@atomly.com> References: <20080827233159.GB16945@atomly.com> Message-ID: <20080827235736.GA5923@contorpis.lisalinda.com> On Wednesday, August 27, atomly wrote: > [Bill McKeeman ] > > > > Simple newbie question. Suppose I have a process id U, and send two > > messages > > > > > > U ! Message1. > > > > U ! Message2. > > > > > > Is there a guarantee that the messages will be received in the order > > they were sent? > > No. There's not even a guarantee that both (or either) messages will be > received. That misleading and, for practical purposes, wrong. >From the FAQ: | 10.9 Is the order of message reception guaranteed? | | Yes, but only within one process. | | If there is a live process and you send it message A and then message | B, it's guaranteed that if message B arrived, message A arrived before | it. | | On the other hand, imagine processes P, Q and R. P sends message A to | Q, and then message B to R. There is no guarantee that A arrives | before B. (Distributed Erlang would have a pretty tough time if this | was required!) The next question is also relevant: http://www.erlang.org/faq/academic.html#10.10 Matt From Bill.McKeeman@REDACTED Thu Aug 28 04:22:44 2008 From: Bill.McKeeman@REDACTED (Bill McKeeman) Date: Wed, 27 Aug 2008 22:22:44 -0400 Subject: [erlang-questions] comments on erlang course Message-ID: Suggestion for http://www.erlang.org/course/course.html I am a newbie, so I am seeing this tutorial fresh for the last time. Here are my comments, most of which are suggestions for improvement. I am guessing the owner of the html above will see this 'question'. /s/ Bill McKeeman Sequential Programming Integers Note . extended precision (perhaps as an example). Atoms Note . some atoms are reserved. Variables can start with _. Should mention "don't care" _. Complex Data Structures hyphenation typos (3) Module System There is no double/2: misleading example Function Syntax Instead of ..., use body1; body2; ... Function Syntax Note . The last expression in the body is the function value Examples of Guards Armstrong recommends =:= Shell Commands Use X or Var, not both for f(X). By the way, if U is a process id, does f(U) create an orphan? Concurrent Programming Simple Message Passing B ! foo. receive foo-> actions end. is a simpler example. self() does not need to be in both. Client Server Model Note . The client will wait for the reply. Use of Timeouts typo iin, typo miliseconds Error Handling Exit Signals propogate through Links typo eventuall Robust Systems can be made by Layering typo ocuring typo deper Advanced Topics Throughout--- use of ` when ' is intended. Hard to read. Port Protocols Typo he instead of The Last Call Optimization. I do not see why the tail recursion server(Data1) cannot be placed after the end of receive. There are other errors also. I recommend -module(foo). -export([server/1]). server(Data) -> receive {From, Info} -> Data1 = process_info(From, Info, Data); {From, Ref, Query} -> {Reply, Data1} = process_query(From, Query, Data), From ! {Ref, Reply} end, server(Data1). process_info(_,_,_) -> 1. process_query(_,_,_) -> {2,3}. Process Dictionary typo diction instead of dictionary typo referencial instead of referential Obtaining System Information typo dic tionary -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Aug 28 06:56:52 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 28 Aug 2008 16:56:52 +1200 Subject: [erlang-questions] Please criticise these principles In-Reply-To: <11727_1219827280_m7R8sbTU024437_9b08084c0808270154t61d1fc9fx7d0328bcbb4adc84@mail.gmail.com> References: <8A5BD119-29F6-4F76-927E-AD79994C5241@cs.otago.ac.nz> <11727_1219827280_m7R8sbTU024437_9b08084c0808270154t61d1fc9fx7d0328bcbb4adc84@mail.gmail.com> Message-ID: <176A6F18-B1B5-40C5-B7A0-50269E5702D0@cs.otago.ac.nz> Joe Armstrong replied to my request for criticism. >> >> 2. No distinction between indistinguishables. >> >> A specification shall not mandate distinct responses >> to situations that user programs cannot distinguish. >> > Impossible. Suppose Pid is on a remote machine. You cannot distiguish > communication failure, with machine failure. So you cannot implement > this. There is one fundamental difference between what you were thinking of when implementing Erlang and what the ISO DTR authors were thinking of when they came up with their design. You were thinking "I have to implement distributed concurrent systems. What kind of language would give me a fighting chance at getting such programs right (or right _enough_)?" They were thinking "How can we adapt the model of multiple threads in a single address space to Prolog". It is an _essential_ characteristic of the ISO DTR that it is not and cannot (without major hassle) be distributed. It probably never occurred to the authors that a concurrent Prolog-like language *could* be distributed over a cluster or NOW just as easily as running in a single UNIX or Windows process. I suspect they were thinking of "distribution" as "a problem solved by sockets" and "concurrency" as a separate "problem solved by threads". >> 4. No unprotected shared mutable variables. >> >> While some thread has the power to write a variable, >> it is VERIFIED that no other thread has the power to >> read or write that variable. > > I have always thought that there should not be shared variables AT > ALL. Of course I agree. In fact that principle is a little sneaky. It's such an obvious thing to agree to (and it is basic to the way Concurrent Pascal, Ada, and Occam work) that I hoped people would agree before they realised that banning shared variables entirely is by far the easiest way to do the verification in Prolog. > > Erlang programmers have happlily been writing distributed and > concurrent programs > for twenty years without the use of mutexes - they are just NOT > needed. When I was writing that message, I was trying to figure out a way to work the phrase "astonished delight" into it, as in "When you consider with what astonished delight programmers have found that concurrent programming in Erlang and Haskell are easier than they imagined possible, it would be a great shame for Prolog to adopt an approach famed for the opposite." I'm also of the view that if you have possibly unreliable components co-operating on shared data of some sort (such as a data base) you will find yourself wanting transactions sooner or later. It will be interesting to see how the new Sun machines work out (if only rich old Uncle Nemo would order me one for Christmas; to bad I have no rich old Uncle Nemo) with their hardware support for STM. > > Concurrency isn't a "nice layer over pthreads" - the most important > thing > is isolation - anything that mucks up isolation is a mistake. That needs to go in the list, I think. Somewhere near the top. -- If stupidity were a crime, who'd 'scape hanging? From kenneth.lundin@REDACTED Thu Aug 28 09:13:12 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 28 Aug 2008 09:13:12 +0200 Subject: [erlang-questions] comments on erlang course In-Reply-To: References: Message-ID: Hi and thanks for the comments, I will take a look and make some corrections to the course. It has been around for about 10 years and these are the first comments I have seen. As an alternative I recommend reading the "Getting Started" document in the official Erlang/OTP documentation. You find it on-line here http://erlang.org/doc/getting_started/part_frame.html /Kenneth Erlang7OTP team, Ericssona 2008/8/28 Bill McKeeman : > Suggestion for http://www.erlang.org/course/course.html > > > > I am a newbie, so I am seeing this tutorial fresh for the last time. > > Here are my comments, most of which are suggestions for improvement. > > I am guessing the owner of the html above will see this 'question'. > > > > /s/ Bill McKeeman > > > > Sequential Programming > > > > Integers Note > > . extended precision (perhaps as an example). > > Atoms Note > > . some atoms are reserved. > > Variables can start with _. Should mention "don't care" _. > > Complex Data Structures hyphenation typos (3) > > Module System There is no double/2: misleading example > > Function Syntax Instead of ..., use body1; body2; ... > > Function Syntax Note > > . The last expression in the body is the function value > > Examples of Guards Armstrong recommends =:= > > Shell Commands Use X or Var, not both for f(X). > > > > By the way, if U is a process id, does f(U) create an orphan? > > > > Concurrent Programming > > > > Simple Message Passing > > B ! foo. receive > > foo-> > > actions > > end. > > is a simpler example. self() does not need to be in both. > > > > Client Server Model Note > > . The client will wait for the reply. > > > > Use of Timeouts typo iin, typo miliseconds > > > > Error Handling > > Exit Signals propogate through Links typo eventuall > > Robust Systems can be made by Layering typo ocuring typo deper > > > > Advanced Topics > > Throughout--- use of ` when ' is intended. Hard to read. > > Port Protocols Typo he instead of The > > Last Call Optimization. I do not see why the tail recursion > > server(Data1) cannot be placed after the end of receive. > > There are other errors also. I recommend > > > > -module(foo). > > -export([server/1]). > > > > server(Data) -> > > receive > > {From, Info} -> > > Data1 = process_info(From, Info, Data); > > {From, Ref, Query} -> > > {Reply, Data1} = process_query(From, Query, Data), > > From ! {Ref, Reply} > > end, > > server(Data1). > > process_info(_,_,_) -> 1. > > process_query(_,_,_) -> {2,3}. > > > > Process Dictionary typo diction instead of dictionary > > typo referencial instead of referential > > > > Obtaining System Information typo dic tionary > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From christian.czura@REDACTED Thu Aug 28 09:46:27 2008 From: christian.czura@REDACTED (Christian Czura) Date: Thu, 28 Aug 2008 09:46:27 +0200 Subject: [erlang-questions] Looking for examples of interaction between gen_server and gen_fsm Message-ID: Hi, it's a little bit hard for me to grasp how to plug together gen_servers and gen_fsms that belong to the same service or operation. For example, Joe shows[1] how to abstract away the protocol of a webserver, so you end up having three processes[2]: server <-> some_protocol <-> tcp/udp I would write the server-process as a gen_server and the protocol-process as a gen_fsm. Now I wonder how/where to start the protocol-process from the server: Would I start it from the server's init function and save its pid in the server's state? Or would I start both the server and the protocol-process via the supervisor / supervision strategy? If so, how does the server know about the protocol-process? It's obvious that the protocol-process's pid needs to be passed along somehow to the server. You might have noticed that I'm not sure when to use a supervision strategy or when to spawn a process from within a process that is supervised. That is because I don't know how/if it's possible in a supervision strategy to pass along the pid of one process to another. {M,F,A} in the childspec comes to mind, but how do I get the pid of another process in the same childspec, and is this the right way of doing things? If you know any other helpful code example, feel free to post the link. :-) Links: [1]: http://www.sics.se/~joe/tutorials/web_server/web_server.html [2]: http://www.sics.se/~joe/tutorials/web_server/web_server.jpg Thanks, Chris From saleyn@REDACTED Thu Aug 28 13:50:42 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 28 Aug 2008 07:50:42 -0400 Subject: [erlang-questions] gen behaviors and global groups In-Reply-To: <48B1EE26.1030002@gmail.com> References: <48B0BECE.9030004@gmail.com> <48B1EE26.1030002@gmail.com> Message-ID: <48B69112.7010700@gmail.com> Since I haven't seen any follow-up on this question, I'd like to rephrase it. Is there any drawback in applying the attached patch that would allow all gen behaviors to specify registered names in given global groups? Serge Serge Aleynikov wrote: > Little bugfix in my previous posting below: > > Serge Aleynikov wrote: >> Currently when using gen_* behaviors the way to reference a >> locally/globally registered server is by providing a server name in the >> form: >> >> ServerName = {local,Name} | {global,GlobalName} >> >> When the cluster of nodes is partitioned into global groups, there >> doesn't seem to be a way to instruct a server to do a global name lookup >> in a specific global group. Unless I am missing something, it looks >> like the gen behaviors should allow this types of server names: >> >> ServerName = {local,Name} | {global,GlobalName} | >> {{group, Group}, GlobalName} >> >> Without this third option one would have to do something like this in >> order to call a server registered in group G: >> > > my_function({{group, Group}, Name}, Args) -> > case global_group:whereis_name(Group, Name) of > Pid when is_pid(Pid) -> > my_function(Pid, Args); > undefined -> > {error, noproc} > end; > my_function(Name, Args) -> > gen_server:call(Name, {my_function, Args}). > >> Shouldn't gen.erl handle this sort of name lookups automatically? >> >> Serge -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: gen.erl.diff URL: From gleber.p@REDACTED Thu Aug 28 14:20:58 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 28 Aug 2008 14:20:58 +0200 Subject: [erlang-questions] gen behaviors and global groups In-Reply-To: <48B69112.7010700@gmail.com> References: <48B0BECE.9030004@gmail.com> <48B1EE26.1030002@gmail.com> <48B69112.7010700@gmail.com> Message-ID: <14f0e3620808280520v46d2d01cp6e2d7589604f1ed1@mail.gmail.com> 2008/8/28 Serge Aleynikov : > Since I haven't seen any follow-up on this question, I'd like to rephrase > it. Is there any drawback in applying the attached patch that would allow > all gen behaviors to specify registered names in given global groups? > > Serge > > Serge Aleynikov wrote: >> >> Little bugfix in my previous posting below: >> >> Serge Aleynikov wrote: >>> >>> Currently when using gen_* behaviors the way to reference a >>> locally/globally registered server is by providing a server name in the >>> form: >>> >>> ServerName = {local,Name} | {global,GlobalName} >>> >>> When the cluster of nodes is partitioned into global groups, there >>> doesn't seem to be a way to instruct a server to do a global name lookup in >>> a specific global group. Unless I am missing something, it looks like the >>> gen behaviors should allow this types of server names: >>> >>> ServerName = {local,Name} | {global,GlobalName} | >>> {{group, Group}, GlobalName} >>> >>> Without this third option one would have to do something like this in >>> order to call a server registered in group G: >>> >> >> my_function({{group, Group}, Name}, Args) -> >> case global_group:whereis_name(Group, Name) of >> Pid when is_pid(Pid) -> >> my_function(Pid, Args); >> undefined -> >> {error, noproc} >> end; >> my_function(Name, Args) -> >> gen_server:call(Name, {my_function, Args}). >> >>> Shouldn't gen.erl handle this sort of name lookups automatically? >>> >>> Serge > > > ???--- lib/stdlib/src/gen.erl.orig Tue Jun 10 19:16:04 2008 UTC > +++ lib/stdlib/src/gen.erl Thu Aug 28 11:42:18 2008 UTC > @@ -36,12 +36,14 @@ > %% start(GenMod, LinkP, Name, Mod, Args, Options) > %% start_link(Mod, Args, Options) > %% start_link(Name, Mod, Args, Options) where: > -%% Name = {local, atom()} | {global, atom()} > +%% Name = {local, atom()} | {global, atom()} | > +%% {global_group, atom()} | {global_group, Where, atom()} > %% Mod = atom(), callback module implementing the 'real' fsm > %% Args = term(), init arguments (to Mod:init/1) > %% Options = [{debug, [Flag]}] > %% Flag = trace | log | {logfile, File} | statistics | debug > %% (debug == log && statistics) > +%% Where = {node, node()} | {group, atom()} > %% Returns: {ok, Pid} | > %% {error, {already_started, Pid}} | > %% {error, Reason} > @@ -140,19 +142,21 @@ > call({global, _Name}=Process, Label, Request, Timeout) > when Timeout =:= infinity; > is_integer(Timeout), Timeout >= 0 -> > - case where(Process) of > - Pid when is_pid(Pid) -> > - Node = node(Pid), > - try do_call(Pid, Label, Request, Timeout) > - catch > - exit:{nodedown, Node} -> > - %% A nodedown not yet detected by global, > - %% pretend that it was. > - exit(noproc) > - end; > - undefined -> > - exit(noproc) > - end; > + do_global_call(Process, Label, Request, Timeout); > + > +%% Global group by name > +call({global_group, _Name}=Process, Label, Request, Timeout) > + when Timeout =:= infinity; > + is_integer(Timeout), Timeout >= 0 -> > + do_global_call(Process, Label, Request, Timeout); > + > +%% Call by name registered on the specified node or in the > +%% specified global group > +call({global_group, _Where, _Name}=Process, Label, Request, Timeout) > + when Timeout =:= infinity; > + is_integer(Timeout), Timeout >= 0 -> > + do_global_call(Process, Label, Request, Timeout); > + > %% Local by name in disguise > call({Name, Node}, Label, Request, Timeout) > when Node =:= node(), Timeout =:= infinity; > @@ -169,6 +173,21 @@ > do_call(Process, Label, Request, Timeout) > end. > > +do_global_call(Process, Label, Request, Timeout) -> > + case where(Process) of > + Pid when is_pid(Pid) -> > + Node = node(Pid), > + try do_call(Pid, Label, Request, Timeout) > + catch > + exit:{nodedown, Node} -> > + %% A nodedown not yet detected by global, > + %% pretend that it was. > + exit(noproc) > + end; > + undefined -> > + exit(noproc) > + end. > + > do_call(Process, Label, Request, Timeout) -> > %% We trust the arguments to be correct, i.e > %% Process is either a local or remote pid, > @@ -257,11 +276,15 @@ > %%%----------------------------------------------------------------- > %%% Misc. functions. > %%%----------------------------------------------------------------- > +where({local, Name}) -> whereis(Name); > where({global, Name}) -> global:safe_whereis_name(Name); > -where({local, Name}) -> whereis(Name). > +where({global_group, Name}) -> global_group:whereis_name(Name); > +where({global_group, Where, Name}) -> global_group:whereis_name(Where, > Name). > > +name({local, Name}) -> Name; > name({global, Name}) -> Name; > -name({local, Name}) -> Name. > +name({global_group, Name}) -> Name; > +name({global_group, _Where, Name}) -> Name. > > name_register({local, Name} = LN) -> > try register(Name, self()) of > @@ -271,6 +294,13 @@ > {false, where(LN)} > end; > name_register({global, Name} = GN) -> > + name_register_global(GN, Name); > +name_register({global_group, Name} = GN) -> > + name_register_global(GN, Name); > +name_register({global_group, _Where, Name} = GN) -> > + name_register_global(GN, Name). > + > +name_register_global(GN, Name) -> > case global:register_name(Name, self()) of > yes -> true; > no -> {false, where(GN)} > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Hi, It doesn't seem to take care about gen_server:enter_loop/2,3,4. From man: Module, Options and ServerName have the same meanings as when calling gen_server:start[_link]/3,4. However, if ServerName is specified, the process must have been registered accordingly before this function is called. and Failure: If the calling process was not started by a proc_lib start function, or if it is not registered according to ServerName. BR -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From hanssv@REDACTED Thu Aug 28 15:56:39 2008 From: hanssv@REDACTED (Hans Svensson) Date: Thu, 28 Aug 2008 15:56:39 +0200 Subject: [erlang-questions] order-preserving send? In-Reply-To: <20080827235736.GA5923@contorpis.lisalinda.com> References: <20080827233159.GB16945@atomly.com> <20080827235736.GA5923@contorpis.lisalinda.com> Message-ID: <48B6AE97.4030402@cs.chalmers.se> Matthias Lang wrote: > On Wednesday, August 27, atomly wrote: >> [Bill McKeeman ] >>> Simple newbie question. Suppose I have a process id U, and send two >>> messages >>> >>> >>> U ! Message1. >>> >>> U ! Message2. >>> >>> >>> Is there a guarantee that the messages will be received in the order >>> they were sent? >> No. There's not even a guarantee that both (or either) messages will be >> received. > > That misleading and, for practical purposes, wrong. > >>From the FAQ: > > | 10.9 Is the order of message reception guaranteed? > | > | Yes, but only within one process. > | > | If there is a live process and you send it message A and then message > | B, it's guaranteed that if message B arrived, message A arrived before > | it. > | That is however not true (in the distributed case), it is possible to drop A and then later receive B. The paper 'Programming Distributed Erlang Applications: Pitfalls and Recipes' describes this situation as well as some other quirks: http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf > | On the other hand, imagine processes P, Q and R. P sends message A to > | Q, and then message B to R. There is no guarantee that A arrives > | before B. (Distributed Erlang would have a pretty tough time if this > | was required!) > That is actually guaranteed in the local (non-distributed) case, then A is actually *always* delivered before B. But as mentioned it doesn't hold in the distributed setting. > The next question is also relevant: > > http://www.erlang.org/faq/academic.html#10.10 > /Hans From bengt.kleberg@REDACTED Thu Aug 28 16:09:17 2008 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 28 Aug 2008 16:09:17 +0200 Subject: [erlang-questions] order-preserving send? In-Reply-To: <48B6AE97.4030402@cs.chalmers.se> References: <20080827233159.GB16945@atomly.com> <20080827235736.GA5923@contorpis.lisalinda.com> <48B6AE97.4030402@cs.chalmers.se> Message-ID: <1219932557.23851.21.camel@seasc0642.dyn.rnd.as.sw.ericsson.se> Greetings, Perhaps it would be better if the FAQ sentence below is changed to: "If there is a live process and you send it message A and then message B, it's guaranteed that if both messages arrived, message A arrived before B." bengt > On Thu, 2008-08-28 at 15:56 +0200, Hans Svensson wrote: > Matthias Lang wrote: > > On Wednesday, August 27, atomly wrote: > >> [Bill McKeeman ] > >>> Simple newbie question. Suppose I have a process id U, and send two > >>> messages > >>> > >>> > >>> U ! Message1. > >>> > >>> U ! Message2. > >>> > >>> > >>> Is there a guarantee that the messages will be received in the order > >>> they were sent? > >> No. There's not even a guarantee that both (or either) messages will be > >> received. > > > > That misleading and, for practical purposes, wrong. > > > >>From the FAQ: > > > > | 10.9 Is the order of message reception guaranteed? > > | > > | Yes, but only within one process. > > | > > | If there is a live process and you send it message A and then message > > | B, it's guaranteed that if message B arrived, message A arrived before > > | it. > > | > > That is however not true (in the distributed case), it is possible to > drop A and then later receive B. The paper 'Programming Distributed > Erlang Applications: Pitfalls and Recipes' describes this situation as > well as some other quirks: > > http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf > > > | On the other hand, imagine processes P, Q and R. P sends message A to > > | Q, and then message B to R. There is no guarantee that A arrives > > | before B. (Distributed Erlang would have a pretty tough time if this > > | was required!) > > > > That is actually guaranteed in the local (non-distributed) case, then A > is actually *always* delivered before B. But as mentioned it doesn't > hold in the distributed setting. > > > The next question is also relevant: > > > > http://www.erlang.org/faq/academic.html#10.10 > > > > > /Hans > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dawsdesign@REDACTED Thu Aug 28 19:47:36 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Thu, 28 Aug 2008 13:47:36 -0400 Subject: [erlang-questions] Looking for examples of interaction between gen_server and gen_fsm In-Reply-To: References: Message-ID: The gen_server can start a tcp server and then call gen_fsm:start_link/3 in the init callback and put the PID from the result {ok, PID} in state. As things come through the tcp in gen_server, you can use gen_fsm:sync_send_event/3 to send the event to the gen_fsm and it will reply to tell the gen_server what to do and the gen_fsm will keep track of state. If the gen_fsm dies, the gen_server will be restarted as well, unless you put process_flag(trap_exit, true) in the init callback. On Thu, Aug 28, 2008 at 3:46 AM, Christian Czura wrote: > Hi, > it's a little bit hard for me to grasp how to plug together gen_servers > and gen_fsms that belong to the same service or operation. > > For example, Joe shows[1] how to abstract away the protocol of a > webserver, so you end up having three processes[2]: > server <-> some_protocol <-> tcp/udp > I would write the server-process as a gen_server and the > protocol-process as a gen_fsm. > > Now I wonder how/where to start the protocol-process from the server: > Would I start it from the server's init function and save its pid in the > server's state? > > Or would I start both the server and the protocol-process via the > supervisor / supervision strategy? > If so, how does the server know about the protocol-process? It's obvious > that the protocol-process's pid needs to be passed along somehow to the > server. > > You might have noticed that I'm not sure when to use a supervision > strategy or when to spawn a process from within a process that is > supervised. That is because I don't know how/if it's possible in a > supervision strategy to pass along the pid of one process to another. > {M,F,A} in the childspec comes to mind, but how do I get the pid of > another process in the same childspec, and is this the right way of > doing things? > > If you know any other helpful code example, feel free to post the link. :-) > > Links: > [1]: http://www.sics.se/~joe/tutorials/web_server/web_server.html > [2]: http://www.sics.se/~joe/tutorials/web_server/web_server.jpg > > Thanks, > Chris > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Aug 28 20:47:25 2008 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 28 Aug 2008 20:47:25 +0200 Subject: [erlang-questions] term_to_binary and record improvements Message-ID: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> I got to thinking about records and structs, and this lead me to think about the behaviour of term_to_binary .. term_to_binary has a misfeature that would cause problems in implementing dynamic records. term_to_binary does not efficiently encode shared data structures. This is best illustrated by an example: Consider this -module(test3). -compile(export_all). test() -> Big = lists:duplicate(1000,a), X = {Big}, Y = {Big,Big,Big,Big}, {sizeOf(Big),sizeOf(X), sizeOf(Y)}. sizeOf(T) -> size(term_to_binary(T)). Look what happens when we run this: 1> c(test3). {ok,test3} 2> test3:test(). {4007,4009,16027} The third number in this tuple surprises me. I had expected it to be 12 bytes larger than 4009. Internally Y is a pointer to four words (an arity tag, with value 4), then 4 identical pointers. But the fact that sizeOf(Y) is four times sizeOf(X) means that shared sub-structures in Erlang terms do not become shared in the binary representation of the term. Since term_to_binary and binary_to_term are *extremely* useful and I use them all the time it seems that it would be a great win to change the internal representation to allow shared data structures. Why do I want this? I was thinking about the "record problem" - records are syntactic sugar for tuples. If we say -record(person, {name, age}). X = #person{name="fred", age=30} Then at run-time we create a tuple {person, "fred", 30} Unfortunately, we loose the record field information at run-time, thus we can't say X.name (to access the name field of X), but have to say X#person.name in our code AND we have to have the record definition available at compile time. An "easy" fix to this would be to *change* the run-time representation of tuples. Suppose the run-time representation of the above record was {person, [name,age], "fred", 30} - if this were the case then the fields of the tuple would be self-describing and we could let the compiler turn X.name into a function call lookup(X, name). When we update a tuple X1 = X#person{name="sue"} we are really just doing X1 = setelement(3, X, "sue"). So if X was {person, [name,age], "fred", 30} then X1 will be {person, [name,age], "sue", 30} The additional heap space for X1 is 5 words (for the new tuple) + the space to store "sue" (perhaps not even this, since I think it's a shared program literal) The point is that the second argument of X1 is just a pointer copy (internally) so even if the X1 looks long when printed it is space efficient in heap storage. It seems to me that by changing the internal representation of an instance of a record(foo, {tag1,tag2,tag3}) From {foo, Val1, Val2, Val3} to {foo, [tag1,tag2,tag3], Val1, Val2, Val3} Would be a step in the right direction in solving the record problem. The problem is that long lists of records will have a space inefficent representation if converted to binaries with term_to_binary Comments? /Joe Armstrong From hayeah@REDACTED Thu Aug 28 21:29:23 2008 From: hayeah@REDACTED (Howard Yeh) Date: Thu, 28 Aug 2008 12:29:23 -0700 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> References: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> Message-ID: That term_to_binary doesn't share structure leads to surprising behaviour in the io subsystem as well (at least for somebody new to erlang). I was writing a toy interpreter that passes the environment around. Function definitions are just closures kept in the environment. It has superlexical scoping (so redefinition isn't visible to previous definisions). Then the io system goes into loop when printing the environment for bigger programs. The problem is obvious (in retrospect). The environment of closures contains closures that close over previous environment of closures. So even though functions just print to, # the message to io system never finishes copying the recursive structure. This "failure" makes sense within the context of what Erlang stands for. But it is very strange for the printing of a fairly standard functional structure to fail to print. Another use I've been thinking for shared-structure-aware term-to-binary is a pretty way for having versioned data. Since Erlang already has a bunch of functional datastructures, it would be very cool to be able to save versions of some data in a list, then just save that list in Mnesia as versioning history w/o complete copying. On 8/28/08, Joe Armstrong wrote: > I got to thinking about records and structs, and this lead me to > think about the behaviour of term_to_binary .. > > term_to_binary has a misfeature that would cause problems in > implementing dynamic records. > > term_to_binary does not efficiently encode shared data > structures. This is best illustrated by an example: > > Consider this > > -module(test3). > -compile(export_all). > > test() -> > Big = lists:duplicate(1000,a), > X = {Big}, > Y = {Big,Big,Big,Big}, > {sizeOf(Big),sizeOf(X), sizeOf(Y)}. > > sizeOf(T) -> size(term_to_binary(T)). > > > Look what happens when we run this: > > 1> c(test3). > {ok,test3} > 2> test3:test(). > {4007,4009,16027} > > The third number in this tuple surprises me. I had expected it to be > 12 bytes larger than 4009. Internally Y is a pointer to four words (an > arity tag, with value 4), then 4 identical pointers. But the fact that > sizeOf(Y) is four times sizeOf(X) means that shared sub-structures in > Erlang terms do not become shared in the binary representation of the > term. > > Since term_to_binary and binary_to_term are *extremely* useful and I > use them all the time it seems that it would be a great win to change > the internal representation to allow shared data structures. > > Why do I want this? > > I was thinking about the "record problem" - records are syntactic > sugar for tuples. > > If we say > > -record(person, {name, age}). > X = #person{name="fred", age=30} > > Then at run-time we create a tuple {person, "fred", 30} > > Unfortunately, we loose the record field information at run-time, > thus we can't say X.name (to access the name field of X), but have to > say X#person.name in our code AND we have to have the record > definition available at compile time. > > An "easy" fix to this would be to *change* the run-time > representation of tuples. > > Suppose the run-time representation of the above record was > {person, [name,age], "fred", 30} - if this were the case then the > fields of the tuple would be self-describing and we could let the > compiler turn X.name into a function call lookup(X, name). > > When we update a tuple > > X1 = X#person{name="sue"} we are really just doing > > X1 = setelement(3, X, "sue"). > > So if X was {person, [name,age], "fred", 30} > then X1 will be {person, [name,age], "sue", 30} > > The additional heap space for X1 is 5 words (for the new tuple) + > the space to store "sue" (perhaps not even this, since I think it's a > shared program literal) > > The point is that the second argument of X1 is just a pointer copy > (internally) so even if the X1 looks long when printed it is space efficient > in heap storage. > > It seems to me that by changing the internal representation of an > instance of a record(foo, {tag1,tag2,tag3}) > > From {foo, Val1, Val2, Val3} to > > {foo, [tag1,tag2,tag3], Val1, Val2, Val3} > > Would be a step in the right direction in solving the record > problem. > > The problem is that long lists of records will have a space inefficent > representation if converted to binaries with term_to_binary > > Comments? > > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Thu Aug 28 21:35:53 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 28 Aug 2008 21:35:53 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> References: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> Message-ID: <48B6FE19.20904@ericsson.com> Loss of sharing happens not only in term_to_binary() but also when passing the data in a message. See e.g. http://www.erlang.org/pipermail/erlang-bugs/2007-November/000488.html http://www.erlang.org/pipermail/erlang-questions/2005-November/017924.html We've also observed this when replicating call states between processors. The copies take up more space than the originals (not terribly much, since there wasn't that much sharing to begin with.) But as has been demonstrated, loss of sharing is a potential killer in some cases, and there aren't always workarounds. BR, Ulf W Joe Armstrong skrev: > I got to thinking about records and structs, and this lead me to > think about the behaviour of term_to_binary .. > > term_to_binary has a misfeature that would cause problems in > implementing dynamic records. > > term_to_binary does not efficiently encode shared data > structures. This is best illustrated by an example: > > Consider this > > -module(test3). > -compile(export_all). > > test() -> > Big = lists:duplicate(1000,a), > X = {Big}, > Y = {Big,Big,Big,Big}, > {sizeOf(Big),sizeOf(X), sizeOf(Y)}. > > sizeOf(T) -> size(term_to_binary(T)). > > > Look what happens when we run this: > > 1> c(test3). > {ok,test3} > 2> test3:test(). > {4007,4009,16027} > > The third number in this tuple surprises me. I had expected it to be > 12 bytes larger than 4009. Internally Y is a pointer to four words (an > arity tag, with value 4), then 4 identical pointers. But the fact that > sizeOf(Y) is four times sizeOf(X) means that shared sub-structures in > Erlang terms do not become shared in the binary representation of the > term. ... From pfisher@REDACTED Thu Aug 28 20:48:09 2008 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 28 Aug 2008 13:48:09 -0500 Subject: [erlang-questions] Proper way to build 64-bit R12B-3 on solaris10/opensolaris Message-ID: <48B6F2E9.9060402@alertlogic.net> What is the supported way to build a 64-bit R12B-3 on Solaris 10/OpenSolaris? I'm asking because I have gotten a version to work, by specifying CC='gcc -m64' LD=$CC when configuring, and then fixing up the @DED_LD@ things in the common_test rx driver by hand. This has worked fine for a large variety of things including our own linked-in drivers. Unfortunately today I discovered that they way the the crypto_drv gets built it does not work correctly doesn't load. Any direction on the "right way" to build 64-bit version for solaris, or what others have done would be appreciated. -- paul From josv@REDACTED Thu Aug 28 22:07:30 2008 From: josv@REDACTED (Jos Visser) Date: Thu, 28 Aug 2008 22:07:30 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> References: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> Message-ID: <20080828200730.GE3055@Deep-Space-X.local> It seems to me that your mail contains two proposals: 1) A better way of working with records in Erlang 2) A more efficient way to encode an Erlang term into a binary, which might be needed to make 1) work efficiently. ad 1) I am *very* new to Erlang, and the way Erlang approaches records surprised me a bit, but I can appreciate it as a pragmatic solution to a real-world problem. Your solution would allow accessing record fields without explicitly specifying the type of the record at every access, at the cost of storing (a pointer to) required type information in every tuple-that-is-actually-a-record. I see three obvious drawbacks to this: - It opens up the possibility of "hacky" code, with people constructing records in novel and dynamic ways. On the other hand, that is what dynamically typed languages are for, and real programmers can write assembler in any language. - It is slightly less space efficient, but probably negligible. - It breaks backward compatibility, although you can probably implement this in the compiler/VM by analyzing the tuple and deciding on whether we are dealing with a new or an old-style record-tuple. Which sort of prompts the question what the original problem is that you're trying to solve and whether this is worth it. An advantage that I see is that it would allow for more generic code, for instance referencing to X.name, which would work for every record which has a field called "name", without having to specify the type information. This could be used to implement some sort of "inheritance" in records. You might want to extend the record definition language to make this possible. ad 2) A more space efficient binary for a term is Good(tm). It's just a matter of contract: What is the contract between term_to_binary and its user? If the only contract is that a binary that is unmodified can be exploded into a term again, then the more space efficient binary is just a better implementation of the BIF. However if people expect to be able to pick a binary apart, change it, and then explode it into a term again then the new implementation would break the contract, and a term_to_binary2 is called for with an updated contract. My 2 eurocent. ++Jos.ch On Thu, Aug 28, 2008 at 08:47:25PM +0200 it came to pass that Joe Armstrong wrote: > I got to thinking about records and structs, and this lead me to > think about the behaviour of term_to_binary .. > > term_to_binary has a misfeature that would cause problems in > implementing dynamic records. > > term_to_binary does not efficiently encode shared data > structures. This is best illustrated by an example: > > Consider this > > -module(test3). > -compile(export_all). > > test() -> > Big = lists:duplicate(1000,a), > X = {Big}, > Y = {Big,Big,Big,Big}, > {sizeOf(Big),sizeOf(X), sizeOf(Y)}. > > sizeOf(T) -> size(term_to_binary(T)). > > > Look what happens when we run this: > > 1> c(test3). > {ok,test3} > 2> test3:test(). > {4007,4009,16027} > > The third number in this tuple surprises me. I had expected it to be > 12 bytes larger than 4009. Internally Y is a pointer to four words (an > arity tag, with value 4), then 4 identical pointers. But the fact that > sizeOf(Y) is four times sizeOf(X) means that shared sub-structures in > Erlang terms do not become shared in the binary representation of the > term. > > Since term_to_binary and binary_to_term are *extremely* useful and I > use them all the time it seems that it would be a great win to change > the internal representation to allow shared data structures. > > Why do I want this? > > I was thinking about the "record problem" - records are syntactic > sugar for tuples. > > If we say > > -record(person, {name, age}). > X = #person{name="fred", age=30} > > Then at run-time we create a tuple {person, "fred", 30} > > Unfortunately, we loose the record field information at run-time, > thus we can't say X.name (to access the name field of X), but have to > say X#person.name in our code AND we have to have the record > definition available at compile time. > > An "easy" fix to this would be to *change* the run-time > representation of tuples. > > Suppose the run-time representation of the above record was > {person, [name,age], "fred", 30} - if this were the case then the > fields of the tuple would be self-describing and we could let the > compiler turn X.name into a function call lookup(X, name). > > When we update a tuple > > X1 = X#person{name="sue"} we are really just doing > > X1 = setelement(3, X, "sue"). > > So if X was {person, [name,age], "fred", 30} > then X1 will be {person, [name,age], "sue", 30} > > The additional heap space for X1 is 5 words (for the new tuple) + > the space to store "sue" (perhaps not even this, since I think it's a > shared program literal) > > The point is that the second argument of X1 is just a pointer copy > (internally) so even if the X1 looks long when printed it is space efficient > in heap storage. > > It seems to me that by changing the internal representation of an > instance of a record(foo, {tag1,tag2,tag3}) > > From {foo, Val1, Val2, Val3} to > > {foo, [tag1,tag2,tag3], Val1, Val2, Val3} > > Would be a step in the right direction in solving the record > problem. > > The problem is that long lists of records will have a space inefficent > representation if converted to binaries with term_to_binary > > Comments? > > /Joe Armstrong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- What cannot be shunned must be embraced. That is the Path... -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available URL: From anders.nygren@REDACTED Thu Aug 28 22:20:30 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 28 Aug 2008 15:20:30 -0500 Subject: [erlang-questions] Proper way to build 64-bit R12B-3 on solaris10/opensolaris In-Reply-To: <48B6F2E9.9060402@alertlogic.net> References: <48B6F2E9.9060402@alertlogic.net> Message-ID: On Thu, Aug 28, 2008 at 1:48 PM, Paul Fisher wrote: > What is the supported way to build a 64-bit R12B-3 on Solaris > 10/OpenSolaris? > > I'm asking because I have gotten a version to work, by specifying > CC='gcc -m64' LD=$CC when configuring, and then fixing up the @DED_LD@ > things in the common_test rx driver by hand. This has worked fine for a > large variety of things including our own linked-in drivers. > Unfortunately today I discovered that they way the the crypto_drv gets > built it does not work correctly doesn't load. > > Any direction on the "right way" to build 64-bit version for solaris, or > what others have done would be appreciated. > I had a similar problem with Solaris 9 some time ago, I solved it by upgrading to newer version of gcc. /Anders > > -- > paul > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From avbalu@REDACTED Thu Aug 28 23:24:52 2008 From: avbalu@REDACTED (Balu Balasubramanian) Date: Thu, 28 Aug 2008 21:24:52 +0000 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: References: Message-ID: Hi, Is Erlang a suitable language for implementing L2/3 control protocols like Spanning Tree, OSPF etc.? Has anyone tried it? Any thoughts? Insights? Thanks Balu _________________________________________________________________ See what people are saying about Windows Live. Check out featured posts. http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From xbmodder@REDACTED Fri Aug 29 01:37:29 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Thu, 28 Aug 2008 16:37:29 -0700 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: References: Message-ID: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> Kind of funny that you're asking this. I''ve been working on a BGPd in Erlang/OTP for a while. Erlang is perfectly suitable, if not optimal for such tasks. The issue with Layer 2 protocols is that they are typically implemented at the hardware level as they directly affect layer upper layer latency. Additionally, they are on tiny, embedded devices. Layer 3 protocols are heavily multithreaded, and require reliability. The Erlang "let it fail" approach doesn't work -the greatest- here, but with a few violations of the "let it fail" protocol Erlang is great. Regarding OSPFd/RIP (other (broad/multi)cast IGPs) the gen_udp module doesn't implement multicast last time I checked. Unless this has changed you'll need to write an external port driver for this purpose. We'd love to hear your attempts at routing protocols in Erlang. 2008/8/28 Balu Balasubramanian : > Hi, > > Is Erlang a suitable language for implementing L2/3 control protocols like > Spanning Tree, OSPF etc.? > > Has anyone tried it? Any thoughts? Insights? > > Thanks > Balu > > ________________________________ > See what people are saying about Windows Live. Check out featured posts. > Check It Out! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From saleyn@REDACTED Fri Aug 29 03:39:53 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 28 Aug 2008 21:39:53 -0400 Subject: [erlang-questions] gen behaviors and global groups In-Reply-To: <14f0e3620808280520v46d2d01cp6e2d7589604f1ed1@mail.gmail.com> References: <48B0BECE.9030004@gmail.com> <48B1EE26.1030002@gmail.com> <48B69112.7010700@gmail.com> <14f0e3620808280520v46d2d01cp6e2d7589604f1ed1@mail.gmail.com> Message-ID: <48B75369.4060300@gmail.com> You are right - both gen_{fsm,server} have enter_loop/5 and get_proc_name/1 that require very similar patching. Though the original question still stands. I take a guess that perhaps global groups where introduced later, and the implementation of gen behaviors wasn't brought up to speed to include this feature. If that's the case, perhaps the implementation can be safely adjusted as it shouldn't break any legacy code, yet be quite useful for large deployments. Serge Gleb Peregud wrote: > 2008/8/28 Serge Aleynikov : >> Since I haven't seen any follow-up on this question, I'd like to rephrase >> it. Is there any drawback in applying the attached patch that would allow >> all gen behaviors to specify registered names in given global groups? >> >> Serge >> > > Hi, > > It doesn't seem to take care about gen_server:enter_loop/2,3,4. From man: > > Module, Options and ServerName have the same meanings as when calling > gen_server:start[_link]/3,4. However, if ServerName is specified, the > process must have been registered accordingly before this function is > called. > > and > > Failure: If the calling process was not started by a proc_lib start > function, or if it is not registered according to ServerName. > > BR From ok@REDACTED Fri Aug 29 04:57:50 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 29 Aug 2008 14:57:50 +1200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> Message-ID: <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> On 29 Aug 2008, at 6:47 am, Joe Armstrong wrote: > Suppose the run-time representation of the above record was > {person, [name,age], "fred", 30} - if this were the case then the > fields of the tuple would be self-describing and we could let the > compiler turn X.name into a function call lookup(X, name). In my "frames" proposal, the representation is _effectively_ {{person,age,name}, 30, "fred"} with {person,age,name} shared. This means that the size of a "frame" is the same as the size of the corresponding "record", provided that the "descriptor" {person,age,name} is shared, as it usually can be. I note that the external term format is half-way to what we want: it does have provision for 'caching' things and referring back to them later, only this is limited to atoms. There are at least three possibilities: (1) Don't preserve any sharing at all, other than atoms. [Present situation.] (2) Build a hash table based on the *identity* (= address) of terms in a first pass, and use that in a second pass. [This preserves existing sharing.] (3) Build a hash table based on the *equality* (= values) of terms in a first pass, and use that in a second pass. [This may introduce new sharing.] I note that UBF also allows this kind of compression, which will obviously not surprise Joe! I've long wondered why it wasn't done; records or no records it looks like a good idea. Question: in existing Erlang use, which is more important, speed of generating a binary encoding for a term, or how big it is (which relates to how quickly it can be sent across a network and how fast it can be decoded, amongst other things). From ok@REDACTED Fri Aug 29 05:15:24 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 29 Aug 2008 15:15:24 +1200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <2114_1219954764_m7SKJLfI009797_20080828200730.GE3055@Deep-Space-X.local> References: <9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <2114_1219954764_m7SKJLfI009797_20080828200730.GE3055@Deep-Space-X.local> Message-ID: <140EDD12-C238-42F8-927F-32EEAB0B0176@cs.otago.ac.nz> On 29 Aug 2008, at 8:07 am, Jos Visser wrote: > - It opens up the possibility of "hacky" code, with people > constructing > records in novel and dynamic ways. On the other hand, that is what > dynamically typed languages are for, and real programmers can write > assembler in any language. This possibility already exists in, for example, - ECMAScript (JavaScript) - AppleScript - Perl - Python - TCL - LiFE - IBM Prolog ... Psi-terms in LiFE (and the analogue in IBM Prolog) correspond very closely to the "feature structures" used in unification-based approaches to natural language processing. Basically, any dynamically typed programming language that gives you hash tables as values you can pass around is going to give you this feature. (So add Common Lisp and ANSI Smalltalk to the list as well. > > > - It is slightly less space efficient, but probably negligible. I don't know why Joe split the descriptor into two separate parts; backwards compatibility, maybe? The representation described in my "frames" paper requires space for the descriptor (which is basically a sorted tuple of field names), but that is usually one fixed shared copy per construction site, and then each actual "frame" requires EXACTLY the same amount of space as the corresponding "record". Only if you create a "frame" in "novel and dynamic ways" is there any space overhead, and then not always. > > > - It breaks backward compatibility, although you can probably > implement > this in the compiler/VM by analyzing the tuple and deciding on > whether > we are dealing with a new or an old-style record-tuple. If is_record/[2,3] were changed to match, there need be no effect on well written source code at all. With my approach, which requires sorting the fields by name, #. would change value; Having the whole descriptor as a single tuple means that you can easily tell the difference between an old-style record and a new-style one, should you wish to. (Actually, in the "frames" proposal, frames are like tuples but have a new tag, so they are actually a proper type.) > Which sort of prompts the question what the original problem is that > you're trying to solve and whether this is worth it. An advantage > that I > see is that it would allow for more generic code, for instance > referencing to X.name, which would work for every record which has a > field called "name", without having to specify the type information. > This > could be used to implement some sort of "inheritance" in records. You > might want to extend the record definition language to make this > possible. Half the point is that "the record definition language" becomes completely unnecessary. The other half is that updates become easier: adding a new field to a record in one place doesn't break every other place that uses it. Having records be a proper type also means that they can always be printed *as* records. From erlang-questions_efine@REDACTED Fri Aug 29 05:23:20 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 28 Aug 2008 23:23:20 -0400 Subject: [erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp() Message-ID: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> I just stumbled across this and found it so useful that I thought other Erlang newbies might, too. This info is in fact in the erlang-questions archives, but quite rare (< 10 results that I could find). I've always used io:format("~p\n", [X]) to print X in the shell when X is a largish term that the shell truncates. Using io:format for this is a pain in the rear, especially for lazy typists like me. > mnesia:start(), X = mnesia:system_info(all). [{access_module,mnesia}, {auto_repair,true}, ++++ .... rows deleted for brevity ... {schema_location,opt_disc}, * {schema_version,...}, {...}|...] %% Arghhh!!!! * Instead of using io:format, one can use the shell record print command (rp). It works for any term and requires minimal typing. >rp(X). [{access_module,mnesia}, {auto_repair,true}, ++++ .... rows deleted for brevity ... {schema_location,opt_disc}, * {schema_version,{2,0}},* {subscribers,[<0.37.0>]}, {tables,[schema]}, {transaction_commits,2}, {transaction_failures,0}, {transaction_log_writes,0}, {transaction_restarts,0}, {transactions,[]}, {use_dir,false}, {core_dir,false}, {no_table_loaders,2}, {dc_dump_limit,4}, {version,"4.4.3"}] -------------- next part -------------- An HTML attachment was scrubbed... URL: From mog-lists@REDACTED Fri Aug 29 07:03:05 2008 From: mog-lists@REDACTED (mog) Date: Fri, 29 Aug 2008 00:03:05 -0500 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> References: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> Message-ID: <20080829050305.GA13907@metalman.digium.internal> On Thu, Aug 28, 2008 at 04:37:29PM -0700, Sargun Dhillon wrote: > protocol Erlang is great. Regarding OSPFd/RIP (other (broad/multi)cast > IGPs) the gen_udp module doesn't implement multicast last time I > checked. Unless this has changed you'll need to write an external port > driver for this purpose. > We'd love to hear your attempts at routing protocols in Erlang. I can't speak to the rest of this email but multicast support is available in erlang as of r11b3 i know for sure probably earlier. Mog -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From gphilip.newsgroups@REDACTED Fri Aug 29 07:22:56 2008 From: gphilip.newsgroups@REDACTED (Geevarghese Philip) Date: Fri, 29 Aug 2008 10:52:56 +0530 Subject: [erlang-questions] Undirected graph Library in Erlang Message-ID: Hi, Is there a library for undirected graphs available in Erlang? Thanks, Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Fri Aug 29 08:26:23 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 29 Aug 2008 08:26:23 +0200 Subject: [erlang-questions] Undirected graph Library in Erlang In-Reply-To: References: Message-ID: <48B7968F.4070106@ericsson.com> Geevarghese Philip skrev: > Hi, > > Is there a library for undirected graphs available in Erlang? > > Thanks, > Philip Drawing or data representation? I guess you could use digraph for representation, depending on what it is that you want to do. You can either add edges in both directions, or stipulate that edges are always directed from e.g. smaller to bigger vertices (relying on the fact that term ordering in Erlang is always consistent). This would mean that to find all edges for a particular vertice, you'd have to check both in_edges and out_edges. Incidentally, the function digraph:edges(Graph, Vertice) does just that. For drawing, a pretty popular choice of tool seems to be GraphViz, but if you really want a graph layout program written in Erlang, perhaps Hans Nilsson's ancient user contrib could get you started: http://www.erlang.org/contrib/graph_draw-0.0.tgz (I don't know how it fares with undirected graphs in particular, but I've understood that the really hard part of drawing graphs is the layout bit.) BR, Ulf W From richardc@REDACTED Fri Aug 29 08:51:53 2008 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 29 Aug 2008 08:51:53 +0200 Subject: [erlang-questions] Undirected graph Library in Erlang In-Reply-To: References: Message-ID: <48B79C89.9080408@it.uu.se> Geevarghese Philip wrote: > Hi, > > Is there a library for undirected graphs available in Erlang? You could probably implement everything you need as a simple layer on top of the digraph and digraph_utils modules. See http://www.erlang.org/doc/apps/stdlib/index.html /Richard From gphilip.newsgroups@REDACTED Fri Aug 29 09:22:35 2008 From: gphilip.newsgroups@REDACTED (Geevarghese Philip) Date: Fri, 29 Aug 2008 12:52:35 +0530 Subject: [erlang-questions] Undirected graph Library in Erlang In-Reply-To: <48B79C89.9080408@it.uu.se> References: <48B79C89.9080408@it.uu.se> Message-ID: On Fri, Aug 29, 2008 at 12:21 PM, Richard Carlsson wrote: > Geevarghese Philip wrote: > > > Is there a library for undirected graphs available in Erlang? > > You could probably implement everything you need as a simple layer > on top of the digraph and digraph_utils modules. > See http://www.erlang.org/doc/apps/stdlib/index.html Ulf, Richard, Thanks. Data representation is the need. I have started to write a wrapper on top of the digraph_* modules, as you suggested. Thanks, Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Fri Aug 29 09:35:44 2008 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 29 Aug 2008 09:35:44 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> Message-ID: <9b08084c0808290035y5d37af25qfb8f1397ede83ec0@mail.gmail.com> On Fri, Aug 29, 2008 at 4:57 AM, Richard A. O'Keefe wrote: > > On 29 Aug 2008, at 6:47 am, Joe Armstrong wrote: >> >> Suppose the run-time representation of the above record was >> {person, [name,age], "fred", 30} - if this were the case then the >> fields of the tuple would be self-describing and we could let the >> compiler turn X.name into a function call lookup(X, name). > > In my "frames" proposal, the representation is _effectively_ > {{person,age,name}, 30, "fred"} > with {person,age,name} shared. > This means that the size of a "frame" is the same as the > size of the corresponding "record", provided that the > "descriptor" {person,age,name} is shared, as it usually can be. > > I note that the external term format is half-way to what we > want: it does have provision for 'caching' things and referring > back to them later, only this is limited to atoms. > > There are at least three possibilities: > > (1) Don't preserve any sharing at all, other than atoms. > [Present situation.] > > (2) Build a hash table based on the *identity* (= address) of > terms in a first pass, and use that in a second pass. > [This preserves existing sharing.] But you don't need to *internally* a tuple {Big,Big,Big} is a pointer to a tuple on heap which is four words, the first word is {arity,3}, then the next three words are identical pointers to Big. The code for tuple_to_list should therefore look very much like the code for garbing a process heap onto a new heap. Just for fun I'll write term_to_binary in Erlang and also make a new version that shares (in Erlang) - unless somebody has already written this > > (3) Build a hash table based on the *equality* (= values) of > terms in a first pass, and use that in a second pass. > [This may introduce new sharing.] > > I note that UBF also allows this kind of compression, which will > obviously not surprise Joe! I've long wondered why it wasn't > done; records or no records it looks like a good idea. Actually we could use UBF as the external format! For compatibility we could write term_to_new_binary and the inverse > Question: in existing Erlang use, which is more important, > speed of generating a binary encoding for a term, or how big > it is (which relates to how quickly it can be sent across a > network and how fast it can be decoded, amongst other things). I'm think we can make it smaller and faster ... /Joe > > > > > From raimo+erlang-questions@REDACTED Fri Aug 29 09:47:39 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 29 Aug 2008 09:47:39 +0200 Subject: [erlang-questions] : order-preserving send? In-Reply-To: <48B6AE97.4030402@cs.chalmers.se> References: <20080827233159.GB16945@atomly.com> <20080827235736.GA5923@contorpis.lisalinda.com> <48B6AE97.4030402@cs.chalmers.se> Message-ID: <20080829074739.GB19532@erix.ericsson.se> On Thu, Aug 28, 2008 at 03:56:39PM +0200, Hans Svensson wrote: > Matthias Lang wrote: : : > > > > That misleading and, for practical purposes, wrong. > > > >>From the FAQ: > > > > | 10.9 Is the order of message reception guaranteed? > > | > > | Yes, but only within one process. > > | > > | If there is a live process and you send it message A and then message > > | B, it's guaranteed that if message B arrived, message A arrived before > > | it. > > | > > That is however not true (in the distributed case), it is possible to > drop A and then later receive B. The paper 'Programming Distributed > Erlang Applications: Pitfalls and Recipes' describes this situation as > well as some other quirks: I'd say it is true enough. Since for this to happen, the receiving node has to be restarted 2 (or was it 3) times to wrap the node incarnation counter, and Erlang was designed under the assumption that the distributed application must detect the first node restart anyway and handle it. Plus, it is a new receiving process that receives B. A went to the old receiver. The horrible situation where you send A, B, C to a reciever and B vanishes can not happen. The receiver gets all before a certain point or all after. You are supposed to use links or monitors if you are interested in the other side's death. > > http://www.cs.chalmers.se/~hanssv/doc/ew07-dist.pdf > > > | On the other hand, imagine processes P, Q and R. P sends message A to > > | Q, and then message B to R. There is no guarantee that A arrives > > | before B. (Distributed Erlang would have a pretty tough time if this > > | was required!) > > > > That is actually guaranteed in the local (non-distributed) case, then A > is actually *always* delivered before B. But as mentioned it doesn't > hold in the distributed setting. > > > The next question is also relevant: > > > > http://www.erlang.org/faq/academic.html#10.10 > > > > > /Hans > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Fri Aug 29 10:03:57 2008 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 29 Aug 2008 10:03:57 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> Message-ID: <48B7AD6D.7070705@ericsson.com> Richard A. O'Keefe skrev: > > Question: in existing Erlang use, which is more important, > speed of generating a binary encoding for a term, or how big > it is (which relates to how quickly it can be sent across a > network and how fast it can be decoded, amongst other things). Having a sharing-preserving term_to_binary() would be a start, but as long as local message passing doesn't preserve sharing (neither does spawn()), we would need some big fat warning labels on the deliberate use of sharing in data structures. Come to think of it, we need those warning labels even today. There are very few corners in Erlang where a seemingly innocent code modification can cause havoc, but accidental serialization of a complex data structure is one of them. I can say from experience, as can John Hughes, that it's no fun at all when a seemingly well-working program suddenly blows up, rendering your computer useless for minutes while it tries to allocate an enormous glob of memory. In both cases, sharing was deliberately used, and in both cases the fact that the data structure is flattened when sent to another local process came as a surprise. In my case, a subtle mistake (inheriting the whole record in a fun, instead of just a single attribute) caused the blowup. In John's case, there was truly a need to pass the data to another process, but no way to do it without causing memory explosion. BEAM already has the ability to do sharing-preserving copy: the garbage collector obviously does it. But the feature is not available to the lowly Erlang programmer. BR, Ulf W From bgustavsson@REDACTED Fri Aug 29 10:38:27 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 29 Aug 2008 10:38:27 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <48B7AD6D.7070705@ericsson.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> Message-ID: <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> On Fri, Aug 29, 2008 at 10:03 AM, Ulf Wiger (TN/EAB) wrote: > > BEAM already has the ability to do sharing-preserving copy: > the garbage collector obviously does it. But the feature is > not available to the lowly Erlang programmer. > It is easy to preserve sharing if you are allowed to destroy the source term (as in the garbage collector). Preserving sharing when copying a term (i.e. not destroying the source term) is harder and WILL be slower compared to not preserve sharing. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Fri Aug 29 11:22:09 2008 From: chsu79@REDACTED (Christian) Date: Fri, 29 Aug 2008 11:22:09 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <9b08084c0808290035y5d37af25qfb8f1397ede83ec0@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <9b08084c0808290035y5d37af25qfb8f1397ede83ec0@mail.gmail.com> Message-ID: >> Question: in existing Erlang use, which is more important, >> speed of generating a binary encoding for a term, or how big >> it is (which relates to how quickly it can be sent across a >> network and how fast it can be decoded, amongst other things). > > I'm think we can make it smaller and faster ... And if it is not possible to get both, there is the erlang:term_to_binary/2 where an option could be provided to be explicit on how powerful sharing-detection one wants (as per the list Richard A. O'Keefe provided for example). Maximal sharing detection could be useful for dets-tables where the explosion also matters, and where maximal detection still takes much less time than the actual writing to disk. (another semi-related issue is to optimize the size of atoms occuring in several places in the same dets file) Personally I'm having trouble seeing how one can get smaller AND faster term_to_binary, but i see how a smaller result from it could make binary_to_term faster (and needing to allocate less). That is, faster binary_to_term at the cost of slower term_to_binary. From ulf@REDACTED Fri Aug 29 11:25:57 2008 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 29 Aug 2008 11:25:57 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> Message-ID: <8209f740808290225l72322b83h51aaa6569120f1e8@mail.gmail.com> 2008/8/29 Bjorn Gustavsson : > > Preserving sharing when copying a term (i.e. not destroying > the source term) is harder and WILL be slower compared to > not preserve sharing. > > /Bjorn I'm not surprised. Otherwise, I'm sure you'd have made message passing sharing-preserving long ago. ;-) BR, Ulf W From nthauvin@REDACTED Fri Aug 29 11:47:53 2008 From: nthauvin@REDACTED (Nicolas Thauvin) Date: Fri, 29 Aug 2008 11:47:53 +0200 Subject: [erlang-questions] Some mnesia oddity Message-ID: Hi folks, We found a strange mnesia behavior here... Some mnesia:write operations after a mnesia:delete_object seem to not have the expected result when executed in the same transaction. See attached example file: 1 - We fill a test_table 2 - In the same transaction, we read all records, delete them, and write them back (do not ask why :)) 3 - Surprise! Only a subset of them can be read afterwards Same result in R11 and R12. It works if the delete_object and write operations are in separate transactions... But who knows what can happen between them... Can someone explain this? Thanks, -- Nicolas Thauvin -------------- next part -------------- A non-text attachment was scrubbed... Name: oddity.erl Type: application/octet-stream Size: 1418 bytes Desc: not available URL: From kenneth.lundin@REDACTED Fri Aug 29 11:54:55 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 29 Aug 2008 11:54:55 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <48B7AD6D.7070705@ericsson.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> Message-ID: Hi, We have discussed if we should implement sharing of data structures while copying and when creating the external representation. Our thoughts goes like this: - The lack of sharing has never been brought up as a significant problem for telecom and other com or HA products built with erlang. Therefore we have not prioritized a solution for this. - Keeping the sharing while copying has impact on: - Message passing - insertion in ets-tables - the external format for Erlang terms among other things used in the Erlang distribution and produced by term_to_binary. A sharing preserving solution for the cases above will be more costly than the current implementation since it is not possibly to destroy the source term as can be done in the GC case. Because of the negative impact on performance in cases where there is no sharing or need for sharing, which definitely is the dominating case we don't think it is feasible to implement and use a sharing solution as default for the cases above. What could be done is to offer functions for the programmer to specifically use sharing, for example by variants or new options to the send, ets:insert and term_to_binary BIF's We would also need to add and support new tags in the external format and fix some compatibility issues like not sending the new external format to old Erlang nodes. A significant amount of work in total. Currently this is not one of the most prioritized items on our development list. But there might be possibilities to change that if someone has strong arguments, financing etc. /Regards Kenneth, Erlang/OTP team, Ericsson On Fri, Aug 29, 2008 at 10:03 AM, Ulf Wiger (TN/EAB) wrote: > Richard A. O'Keefe skrev: >> >> Question: in existing Erlang use, which is more important, >> speed of generating a binary encoding for a term, or how big >> it is (which relates to how quickly it can be sent across a >> network and how fast it can be decoded, amongst other things). > > Having a sharing-preserving term_to_binary() would be a start, > but as long as local message passing doesn't preserve sharing > (neither does spawn()), we would need some big fat warning > labels on the deliberate use of sharing in data structures. > > Come to think of it, we need those warning labels even today. > > There are very few corners in Erlang where a seemingly > innocent code modification can cause havoc, but accidental > serialization of a complex data structure is one of them. > > I can say from experience, as can John Hughes, that it's no > fun at all when a seemingly well-working program suddenly > blows up, rendering your computer useless for minutes while > it tries to allocate an enormous glob of memory. > > In both cases, sharing was deliberately used, and in both > cases the fact that the data structure is flattened when > sent to another local process came as a surprise. In my > case, a subtle mistake (inheriting the whole record in a > fun, instead of just a single attribute) caused the blowup. > In John's case, there was truly a need to pass the data to > another process, but no way to do it without causing memory > explosion. > > BEAM already has the ability to do sharing-preserving copy: > the garbage collector obviously does it. But the feature is > not available to the lowly Erlang programmer. > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Fri Aug 29 12:07:03 2008 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 29 Aug 2008 12:07:03 +0200 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> Message-ID: <9b08084c0808290307p21c7c648nc9341543a3a9aec@mail.gmail.com> 2008/8/29 Bjorn Gustavsson : > On Fri, Aug 29, 2008 at 10:03 AM, Ulf Wiger (TN/EAB) > wrote: >> >> BEAM already has the ability to do sharing-preserving copy: >> the garbage collector obviously does it. But the feature is >> not available to the lowly Erlang programmer. > > It is easy to preserve sharing if you are allowed to destroy the source term > (as in the garbage collector). > > Preserving sharing when copying a term (i.e. not destroying the source term) > is harder and > WILL be slower compared to not preserve sharing. So exactly why is it slower? - I assume you'd need two passes - and have to toggle some "this word has been moved" bit in the original term (is this correct) on the plus side the output term will be smaller so have better cache behavior. Traversing a term twice should be no problem for a small term, since it is small it will be fast - but for a large term will take a long time, but here the cache advantages could help. Only the programmer knows if a term shares much data, so we could have two bifs term_to_shared_binary and term_to_binary both of which can be unpacked with binary_to_term. Both are declaratively correct, but the hint will help performance. Would this be a solution? - if so we could then implement records with slightly more complex data structures. ie #foo{name,age} might internally be the tuple {{'foo-name-age',[name,age]}, Name, Age} (or something in line with Richard's proposal http://www.erlang.org/pipermail/erlang-questions/2005-September/017199.html /Joe > > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chandrashekhar.mullaparthi@REDACTED Fri Aug 29 13:02:12 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 29 Aug 2008 12:02:12 +0100 Subject: [erlang-questions] Some mnesia oddity In-Reply-To: References: Message-ID: 2008/8/29 Nicolas Thauvin > Hi folks, > > We found a strange mnesia behavior here... > > Some mnesia:write operations after a mnesia:delete_object seem to not have > the expected result when executed in the same transaction. > > See attached example file: > 1 - We fill a test_table > 2 - In the same transaction, we read all records, delete them, and write > them back (do not ask why :)) > 3 - Surprise! Only a subset of them can be read afterwards > > Same result in R11 and R12. > > It works if the delete_object and write operations are in separate > transactions... But who knows what can happen between them... > > According to the mnesia documentation, I don't think this is a valid invocation of mnesia:delete_object/1 (though why it sort of works is a mystery). The following change to the fun makes it behave as you expect it to. 32c32,34 < ok = mnesia:delete_object(Wild_pattern), --- > lists:foreach(fun(X) -> > ok = mnesia:delete_object(X) > end, Records), cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Fri Aug 29 13:20:07 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 29 Aug 2008 13:20:07 +0200 Subject: [erlang-questions] Some mnesia oddity In-Reply-To: References: Message-ID: <48B7DB67.7010608@erix.ericsson.se> Chandru wrote: > > 2008/8/29 Nicolas Thauvin > > > Hi folks, > > We found a strange mnesia behavior here... > > Some mnesia:write operations after a mnesia:delete_object seem to > not have the expected result when executed in the same transaction. > > See attached example file: > 1 - We fill a test_table > 2 - In the same transaction, we read all records, delete them, and > write them back (do not ask why :)) > 3 - Surprise! Only a subset of them can be read afterwards > > Same result in R11 and R12. > > It works if the delete_object and write operations are in separate > transactions... But who knows what can happen between them... > > > According to the mnesia documentation, I don't think this is a valid > invocation of mnesia:delete_object/1 (though why it sort of works is a > mystery). I was just checking it out and came to the same conclusion. It is not valid, but I agree about the mystery..will fix as soon as possible. Thanks /Dan > > The following change to the fun makes it behave as you expect it to. > > 32c32,34 > < ok = mnesia:delete_object(Wild_pattern), > --- > > lists:foreach(fun(X) -> > > ok = mnesia:delete_object(X) > > end, Records), > > cheers > Chandru > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From golubovsky@REDACTED Fri Aug 29 14:08:18 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Fri, 29 Aug 2008 08:08:18 -0400 Subject: [erlang-questions] elrc "implementation limit"? Message-ID: Hi, Given this Erlang module: http://code.haskell.org/yc2erl/erlang/yc2erl.erl and a file it includes (precompiled from an external source): http://code.haskell.org/yc2erl/erlang/unitable.hrl erlc gave this error message after several minutes of compilation (CPU at 99%, but size in memory remained stable): ============================================= [dima@REDACTED hugs_yc]$ erlc yc2erl.erl yc2erl: function char_block/0+7: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {move,{x,0},{y,2558}} ============================================= This is basically the same "large indexable structure" I asked couple days ago about (how to get the most efficient indexed access). If compilation of such a large tuple fails, what is the other way to build such a structure into a program (other than reading it from an external file)? Thanks. PS Implementation of the same in C (Hugs, GHC) and Javascript had no problems at all. See e. g. http://darcs.haskell.org/hugs98/src/unitable.c, http://darcs.haskell.org/libraries/base/cbits/WCsubst.c, http://darcs.haskell.org/yhc/src/translator/js/lib/javascript/JUCD.js How to compile such thing in Erlang? -- Dimitry Golubovsky Anywhere on the Web From bgustavsson@REDACTED Fri Aug 29 14:34:51 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 29 Aug 2008 14:34:51 +0200 Subject: [erlang-questions] elrc "implementation limit"? In-Reply-To: References: Message-ID: <6672d0160808290534k12ba94c5p34b5555472b0e2a9@mail.gmail.com> On Fri, Aug 29, 2008 at 2:08 PM, Dimitry Golubovsky wrote: > Hi, > > This is basically the same "large indexable structure" I asked couple > days ago about (how to get the most efficient indexed access). > > If compilation of such a large tuple fails, what is the other way to > build such a structure into a program (other than reading it from an > external file)? > Either add the following line to your module -compile(inline). (inlining is not default in the Erlang compiler or manually inline all of the prop() functions into char_block(). Either way, the tuple will become a literal tuple, which the compiler will not have any problem with. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniele.varrazzo@REDACTED Fri Aug 29 14:50:52 2008 From: daniele.varrazzo@REDACTED (Daniele Varrazzo) Date: Fri, 29 Aug 2008 14:50:52 +0200 Subject: [erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp() In-Reply-To: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> References: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> Message-ID: <15bf30d20808290550o7267916y978f68d319d04c53@mail.gmail.com> 2008/8/29 Edwin Fine : > I just stumbled across this and found it so useful that I thought other > Erlang newbies might, too. This info is in fact in the erlang-questions > archives, but quite rare (< 10 results that I could find). If you find this tip useful (it is), you may want to add it to the Erlang wiki: http://www.trapexit.org/Erlang_Wiki for instance as an HowTo. -- Daniele From erlang-questions_efine@REDACTED Fri Aug 29 16:35:35 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 29 Aug 2008 10:35:35 -0400 Subject: [erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp() In-Reply-To: <15bf30d20808290550o7267916y978f68d319d04c53@mail.gmail.com> References: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> <15bf30d20808290550o7267916y978f68d319d04c53@mail.gmail.com> Message-ID: <6c2563b20808290735q73905ef7l26ffbecd726fdd54@mail.gmail.com> Thanks for the suggestion. I added it (with great difficulty - it took 20 minutes to do) to the trap_exit Wiki. Here's the link: http://www.trapexit.org/Print_Untruncated_Terms_In_The_Shell The difficulties came from timeouts and getting messages like this: Erlang Community has a problem *Sorry! This site is experiencing technical difficulties.* Try waiting a few minutes and reloading. (Can't contact the database server: Unknown error (localhost:3500)) It's ironic that a Wiki about Erlang uses PHP and probably MySql and has performance and reliability problems. Too bad trapexit can't use Erlang to power the Wiki, but perhaps there aren't suitable Erlang Wiki tools available. On Fri, Aug 29, 2008 at 8:50 AM, Daniele Varrazzo < daniele.varrazzo@REDACTED> wrote: > 2008/8/29 Edwin Fine : > > I just stumbled across this and found it so useful that I thought other > > Erlang newbies might, too. This info is in fact in the erlang-questions > > archives, but quite rare (< 10 results that I could find). > > If you find this tip useful (it is), you may want to add it to the Erlang > wiki: > > http://www.trapexit.org/Erlang_Wiki > > for instance as an HowTo. > > -- Daniele > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Fri Aug 29 16:36:46 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Fri, 29 Aug 2008 17:36:46 +0300 Subject: [erlang-questions] Erlang + SMTP + TLS/SSL Message-ID: <003048E2-7BA3-434A-8FD4-A91B3718580B@gmail.com> Does anyone know of an erlang library that can send mail through smtp with TLS/SSL enabled (like through gmail). I'm currently using http://www.lshift.net/~tonyg/erlang-smtp/ (http://www.lshift.net/blog/2007/12/28/erlang-smtp-code-updated ), and it's super easy to use and works :) I'd like to have some TLS as well, though Thank you From mazen@REDACTED Fri Aug 29 17:43:37 2008 From: mazen@REDACTED (Mazen Harake) Date: Fri, 29 Aug 2008 16:43:37 +0100 Subject: [erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp() In-Reply-To: <6c2563b20808290735q73905ef7l26ffbecd726fdd54@mail.gmail.com> References: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> <15bf30d20808290550o7267916y978f68d319d04c53@mail.gmail.com> <6c2563b20808290735q73905ef7l26ffbecd726fdd54@mail.gmail.com> Message-ID: <48B81929.2080305@erlang-consulting.com> Believe me you are not the first to comment on this :) Our intention has been to go down that road eventually AFAIK but it has simply been a lack of resources... First step was a major overhaul which was done a year ago where we gave trapexit a huge facelift + some tuning. Until then I guess we will have to live with LAMP until we replace it with perhaps LYCE (Linux, Yaws, CouchDB, Erlang-web) :) /Mazen Edwin Fine wrote: > Thanks for the suggestion. I added it (with great difficulty - it took > 20 minutes to do) to the trap_exit Wiki. Here's the link: > > http://www.trapexit.org/Print_Untruncated_Terms_In_The_Shell > > The difficulties came from timeouts and getting messages like this: > > > Erlang Community has a problem > > *Sorry! This site is experiencing technical difficulties.* > > Try waiting a few minutes and reloading. > > (Can't contact the database server: Unknown error (localhost:3500)) > > > It's ironic that a Wiki about Erlang uses PHP and probably MySql and > has performance and reliability problems. Too bad trapexit can't use > Erlang to power the Wiki, but perhaps there aren't suitable Erlang > Wiki tools available. > > On Fri, Aug 29, 2008 at 8:50 AM, Daniele Varrazzo > > wrote: > > 2008/8/29 Edwin Fine >: > > I just stumbled across this and found it so useful that I > thought other > > Erlang newbies might, too. This info is in fact in the > erlang-questions > > archives, but quite rare (< 10 results that I could find). > > If you find this tip useful (it is), you may want to add it to the > Erlang wiki: > > http://www.trapexit.org/Erlang_Wiki > > for instance as an HowTo. > > -- Daniele > > > > > -- > For every expert there is an equal and opposite expert - Arthur C. Clarke > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From erlang-questions_efine@REDACTED Fri Aug 29 19:27:56 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 29 Aug 2008 13:27:56 -0400 Subject: [erlang-questions] [HOWTO] For newbies: print any term without ellipsis in shell using rp() In-Reply-To: <48B81929.2080305@erlang-consulting.com> References: <6c2563b20808282023n155ac824hc72d5d14c5c46d2d@mail.gmail.com> <15bf30d20808290550o7267916y978f68d319d04c53@mail.gmail.com> <6c2563b20808290735q73905ef7l26ffbecd726fdd54@mail.gmail.com> <48B81929.2080305@erlang-consulting.com> Message-ID: <6c2563b20808291027s6fb2d424ic75609eb22b17056@mail.gmail.com> Forgive me for saying so, but speaking it out loud, LAMP sounds much nicer than LYCE - which would YOU rather have? ;-) Seriously, though, I understand the lack of resources. It's just one of those cases where "the shoemaker's children go barefoot". On Fri, Aug 29, 2008 at 11:43 AM, Mazen Harake wrote: > > Believe me you are not the first to comment on this :) > > Our intention has been to go down that road eventually AFAIK but it has > simply been a lack of resources... First step was a major overhaul which was > done a year ago where we gave trapexit a huge facelift + some tuning. > > Until then I guess we will have to live with LAMP until we replace it with > perhaps LYCE (Linux, Yaws, CouchDB, Erlang-web) :) > > /Mazen > > Edwin Fine wrote: > >> Thanks for the suggestion. I added it (with great difficulty - it took 20 >> minutes to do) to the trap_exit Wiki. Here's the link: >> >> http://www.trapexit.org/Print_Untruncated_Terms_In_The_Shell >> >> The difficulties came from timeouts and getting messages like this: >> >> >> Erlang Community has a problem >> >> *Sorry! This site is experiencing technical difficulties.* >> >> Try waiting a few minutes and reloading. >> >> (Can't contact the database server: Unknown error (localhost:3500)) >> >> >> It's ironic that a Wiki about Erlang uses PHP and probably MySql and has >> performance and reliability problems. Too bad trapexit can't use Erlang to >> power the Wiki, but perhaps there aren't suitable Erlang Wiki tools >> available. >> >> On Fri, Aug 29, 2008 at 8:50 AM, Daniele Varrazzo < >> daniele.varrazzo@REDACTED > wrote: >> >> 2008/8/29 Edwin Fine > >: >> > I just stumbled across this and found it so useful that I >> thought other >> > Erlang newbies might, too. This info is in fact in the >> erlang-questions >> > archives, but quite rare (< 10 results that I could find). >> >> If you find this tip useful (it is), you may want to add it to the >> Erlang wiki: >> >> http://www.trapexit.org/Erlang_Wiki >> >> for instance as an HowTo. >> >> -- Daniele >> >> >> >> >> -- >> For every expert there is an equal and opposite expert - Arthur C. Clarke >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -- > Mazen Harake > Erlang Software Developer and Consultant, > Erlang Training & Consulting, Ltd > > Mobile Phone: +44 (0)795 13 26 317 > Office Phone: +44 (0)207 45 61 020 > Office Address: > 401 London Fruit & Wool Exchange > Brushfield St, London, E1 6EL > United Kingdom > > This email and its attachments may be confidential and are intended solely > for the use of the individual to whom it is addressed. Any views or opinions > expressed are solely those of the author and do not necessarily represent > those of "Erlang Training & Consulting, Ltd". > > If you are not the intended recipient of this email and its attachments, > you must take no action based upon them, nor must you copy or show them to > anyone. Please contact the sender if you believe you have received this > email in error. > > > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Fri Aug 29 20:10:13 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 29 Aug 2008 11:10:13 -0700 Subject: [erlang-questions] term_to_binary and record improvements In-Reply-To: <9b08084c0808290307p21c7c648nc9341543a3a9aec@mail.gmail.com> References: <27926_1219950001_m7SIxwgG006779_9b08084c0808281147u2c7d1ad5lb6df718e9b440d47@mail.gmail.com> <4CC5FE1B-AC71-4B35-B399-DC56EC003B08@cs.otago.ac.nz> <48B7AD6D.7070705@ericsson.com> <6672d0160808290138l62d80086j6a5e78c8f0b6ffb4@mail.gmail.com> <9b08084c0808290307p21c7c648nc9341543a3a9aec@mail.gmail.com> Message-ID: On Fri, Aug 29, 2008 at 3:07 AM, Joe Armstrong wrote: > Only the programmer knows if a term shares much data, so we could have > two bifs term_to_shared_binary and term_to_binary both of which can be unpacked > with binary_to_term. term_to_binary/2 already exists to take a list of options. From dawsdesign@REDACTED Sat Aug 30 14:11:51 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 30 Aug 2008 08:11:51 -0400 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? Message-ID: Let's say I have a typical release directory like so: /myrel |- lib/ |- app1/ |- src/ |- ebin/ |- include/ |- doc/ |- app2/... |- app3/... How would I include a single module, which can be called by modules in all of the applications? The only two ways I can think of is make it into an app (I personally think that's overkill because I just want to call a function in the module) or make a symlink, which won't work in windows. -------------- next part -------------- An HTML attachment was scrubbed... URL: From harveyd@REDACTED Sat Aug 30 14:22:21 2008 From: harveyd@REDACTED (Dale Harvey) Date: Sat, 30 Aug 2008 13:22:21 +0100 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: References: Message-ID: you only need to write a .app file from http://erlang.org/doc/design_principles/applications.html#7 The contents of a minimal .app file for a library application libapp looks like this: {application, libapp, []}. (I think the docs might be misleading though, I got errors using the minimal, this is what I use {application, appname, [ {description, "Description"}, {vsn, "1.0"}, {modules,[]}, {registered,[]}, {applications, [kernel, stdlib]} ]}. then have systools find that app file when generating the .rel 2008/8/30 Matt Williamson > Let's say I have a typical release directory like so: > > /myrel > |- lib/ > |- app1/ > |- src/ > |- ebin/ > |- include/ > |- doc/ > |- app2/... > |- app3/... > > How would I include a single module, which can be called by modules in all > of the applications? The only two ways I can think of is make it into an app > (I personally think that's overkill because I just want to call a function > in the module) or make a symlink, which won't work in windows. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Sat Aug 30 17:27:07 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 30 Aug 2008 11:27:07 -0400 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: References: Message-ID: I don't think you are answering the question very directly. Are you saying that I should include the module in the list of modules for each app file? On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey wrote: > you only need to write a .app file > from http://erlang.org/doc/design_principles/applications.html#7 > > The contents of a minimal .app file for a library application libapp looks > like this: > > {application, libapp, []}. > > (I think the docs might be misleading though, I got errors using the > minimal, > this is what I use > > {application, appname, [ > {description, "Description"}, > {vsn, "1.0"}, > {modules,[]}, > {registered,[]}, > {applications, [kernel, stdlib]} > ]}. > > then have systools find that app file when generating the .rel > > 2008/8/30 Matt Williamson > >> Let's say I have a typical release directory like so: >> >> /myrel >> |- lib/ >> |- app1/ >> |- src/ >> |- ebin/ >> |- include/ >> |- doc/ >> |- app2/... >> |- app3/... >> >> How would I include a single module, which can be called by modules in all >> of the applications? The only two ways I can think of is make it into an app >> (I personally think that's overkill because I just want to call a function >> in the module) or make a symlink, which won't work in windows. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawsdesign@REDACTED Sat Aug 30 17:28:56 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 30 Aug 2008 11:28:56 -0400 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: References: Message-ID: To make things clear. My goal is to share a library module across multiple application in a release, but I'm not quite sure how to go about it. On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey wrote: > you only need to write a .app file > from http://erlang.org/doc/design_principles/applications.html#7 > > The contents of a minimal .app file for a library application libapp looks > like this: > > {application, libapp, []}. > > (I think the docs might be misleading though, I got errors using the > minimal, > this is what I use > > {application, appname, [ > {description, "Description"}, > {vsn, "1.0"}, > {modules,[]}, > {registered,[]}, > {applications, [kernel, stdlib]} > ]}. > > then have systools find that app file when generating the .rel > > 2008/8/30 Matt Williamson > >> Let's say I have a typical release directory like so: >> >> /myrel >> |- lib/ >> |- app1/ >> |- src/ >> |- ebin/ >> |- include/ >> |- doc/ >> |- app2/... >> |- app3/... >> >> How would I include a single module, which can be called by modules in all >> of the applications? The only two ways I can think of is make it into an app >> (I personally think that's overkill because I just want to call a function >> in the module) or make a symlink, which won't work in windows. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mazen@REDACTED Sat Aug 30 17:45:27 2008 From: mazen@REDACTED (Mazen Harake) Date: Sat, 30 Aug 2008 16:45:27 +0100 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: References: Message-ID: <48B96B17.7010103@erlang-consulting.com> You should do as you already suggested... make a library application. It is not overkill, it is good practice. If you add it to your rel-file and use OTP release handling with that then the library will always be part of your release. This is a good thing /Mazen Matt Williamson wrote: > To make things clear. My goal is to share a library module across > multiple application in a release, but I'm not quite sure how to go > about it. > > On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey > wrote: > > you only need to write a .app file > from http://erlang.org/doc/design_principles/applications.html#7 > > The contents of a minimal .app file for a library application > libapp looks like this: > > {application, libapp, []}. > > > (I think the docs might be misleading though, I got errors using > the minimal, > this is what I use > > {application, appname, [ > {description, "Description"}, > {vsn, "1.0"}, > {modules,[]}, > {registered,[]}, > {applications, [kernel, stdlib]} > ]}. > > then have systools find that app file when generating the .rel > > 2008/8/30 Matt Williamson > > > Let's say I have a typical release directory like so: > > /myrel > |- lib/ > |- app1/ > |- src/ > |- ebin/ > |- include/ > |- doc/ > |- app2/... > |- app3/... > > How would I include a single module, which can be called by > modules in all of the applications? The only two ways I can > think of is make it into an app (I personally think that's > overkill because I just want to call a function in the module) > or make a symlink, which won't work in windows. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Mazen Harake Erlang Software Developer and Consultant, Erlang Training & Consulting, Ltd Mobile Phone: +44 (0)795 13 26 317 Office Phone: +44 (0)207 45 61 020 Office Address: 401 London Fruit & Wool Exchange Brushfield St, London, E1 6EL United Kingdom This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of "Erlang Training & Consulting, Ltd". If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error. From harveyd@REDACTED Sat Aug 30 17:59:46 2008 From: harveyd@REDACTED (Dale Harvey) Date: Sat, 30 Aug 2008 16:59:46 +0100 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: <48B96B17.7010103@erlang-consulting.com> References: <48B96B17.7010103@erlang-consulting.com> Message-ID: Yes sorry, I was saying create an application for the single module /myrel |- lib/ |- singlemodule-1.0/ |- src/ |- mymodule.erl |- ebin/ |- singlemodule.app |- app2/... |- app3/... with singlemodule.app looking like {application, singlemodule, [ {description, "Description"}, {vsn, "1.0"}, {modules,[mymodule]}, {registered,[]}, {applications, [kernel, stdlib]} ]}. You dont need supervisors / servers to start and stop etc, it just makes sure theres no name conflicts and that its in the path 2008/8/30 Mazen Harake > You should do as you already suggested... make a library application. It > is not overkill, it is good practice. If you add it to your rel-file and > use OTP release handling with that then the library will always be part > of your release. This is a good thing > /Mazen > > Matt Williamson wrote: > > To make things clear. My goal is to share a library module across > > multiple application in a release, but I'm not quite sure how to go > > about it. > > > > On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey > > wrote: > > > > you only need to write a .app file > > from http://erlang.org/doc/design_principles/applications.html#7 > > > > The contents of a minimal .app file for a library application > > libapp looks like this: > > > > {application, libapp, []}. > > > > > > (I think the docs might be misleading though, I got errors using > > the minimal, > > this is what I use > > > > {application, appname, [ > > {description, "Description"}, > > {vsn, "1.0"}, > > {modules,[]}, > > {registered,[]}, > > {applications, [kernel, stdlib]} > > ]}. > > > > then have systools find that app file when generating the .rel > > > > 2008/8/30 Matt Williamson > > > > > > Let's say I have a typical release directory like so: > > > > /myrel > > |- lib/ > > |- app1/ > > |- src/ > > |- ebin/ > > |- include/ > > |- doc/ > > |- app2/... > > |- app3/... > > > > How would I include a single module, which can be called by > > modules in all of the applications? The only two ways I can > > think of is make it into an app (I personally think that's > > overkill because I just want to call a function in the module) > > or make a symlink, which won't work in windows. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > Mazen Harake > Erlang Software Developer and Consultant, > Erlang Training & Consulting, Ltd > > Mobile Phone: +44 (0)795 13 26 317 > Office Phone: +44 (0)207 45 61 020 > Office Address: > 401 London Fruit & Wool Exchange > Brushfield St, London, E1 6EL > United Kingdom > > This email and its attachments may be confidential and are intended solely > for the use of the individual to whom it is addressed. Any views or opinions > expressed are solely those of the author and do not necessarily represent > those of "Erlang Training & Consulting, Ltd". > > If you are not the intended recipient of this email and its attachments, > you must take no action based upon them, nor must you copy or show them to > anyone. Please contact the sender if you believe you have received this > email in error. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Aug 30 18:02:04 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 30 Aug 2008 18:02:04 +0200 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: References: Message-ID: <8209f740808300902l71c73d2ewa2497bee3198ac8e@mail.gmail.com> The only thing you need to do is to make sure the module is included in *some* application that is always loaded, no matter which configuration you happen to run. A module may not be listed in the 'modules' attribute of more than one application. Once loaded, the module can be called from any other module. The only aspects that are affected by which application a module belongs to are: - its place in the supervision hierarchy and ts group leader, if it starts processes. - environment variables (application:get_env(Key)) when the application name is not provided. You'll want to consider your application dependencies. Creating a new library applciation is much better than introducing an unclear dependency. BR, Ulf W 2008/8/30 Matt Williamson : > I don't think you are answering the question very directly. Are you saying > that I should include the module in the list of modules for each app file? > > On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey wrote: >> >> you only need to write a .app file >> from http://erlang.org/doc/design_principles/applications.html#7 >> >> The contents of a minimal .app file for a library application libapp looks >> like this: >> >> {application, libapp, []}. >> >> (I think the docs might be misleading though, I got errors using the >> minimal, >> this is what I use >> >> {application, appname, [ >> {description, "Description"}, >> {vsn, "1.0"}, >> {modules,[]}, >> {registered,[]}, >> {applications, [kernel, stdlib]} >> ]}. >> >> then have systools find that app file when generating the .rel >> >> 2008/8/30 Matt Williamson >>> >>> Let's say I have a typical release directory like so: >>> >>> /myrel >>> |- lib/ >>> |- app1/ >>> |- src/ >>> |- ebin/ >>> |- include/ >>> |- doc/ >>> |- app2/... >>> |- app3/... >>> >>> How would I include a single module, which can be called by modules in >>> all of the applications? The only two ways I can think of is make it into an >>> app (I personally think that's overkill because I just want to call a >>> function in the module) or make a symlink, which won't work in windows. >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dawsdesign@REDACTED Sat Aug 30 18:29:39 2008 From: dawsdesign@REDACTED (Matt Williamson) Date: Sat, 30 Aug 2008 12:29:39 -0400 Subject: [erlang-questions] How do I include a library across muiltple apps in a release? In-Reply-To: <8209f740808300902l71c73d2ewa2497bee3198ac8e@mail.gmail.com> References: <8209f740808300902l71c73d2ewa2497bee3198ac8e@mail.gmail.com> Message-ID: Thank you all for the advice. I will make a new application for it :) On Sat, Aug 30, 2008 at 12:02 PM, Ulf Wiger wrote: > The only thing you need to do is to make sure the module is > included in *some* application that is always loaded, no > matter which configuration you happen to run. > > A module may not be listed in the 'modules' attribute of > more than one application. > > Once loaded, the module can be called from any other module. > The only aspects that are affected by which application a module > belongs to are: > > - its place in the supervision hierarchy and ts group leader, > if it starts processes. > - environment variables (application:get_env(Key)) when the > application name is not provided. > > You'll want to consider your application dependencies. > Creating a new library applciation is much better than introducing > an unclear dependency. > > BR, > Ulf W > > 2008/8/30 Matt Williamson : > > I don't think you are answering the question very directly. Are you > saying > > that I should include the module in the list of modules for each app > file? > > > > On Sat, Aug 30, 2008 at 8:22 AM, Dale Harvey wrote: > >> > >> you only need to write a .app file > >> from http://erlang.org/doc/design_principles/applications.html#7 > >> > >> The contents of a minimal .app file for a library application libapp > looks > >> like this: > >> > >> {application, libapp, []}. > >> > >> (I think the docs might be misleading though, I got errors using the > >> minimal, > >> this is what I use > >> > >> {application, appname, [ > >> {description, "Description"}, > >> {vsn, "1.0"}, > >> {modules,[]}, > >> {registered,[]}, > >> {applications, [kernel, stdlib]} > >> ]}. > >> > >> then have systools find that app file when generating the .rel > >> > >> 2008/8/30 Matt Williamson > >>> > >>> Let's say I have a typical release directory like so: > >>> > >>> /myrel > >>> |- lib/ > >>> |- app1/ > >>> |- src/ > >>> |- ebin/ > >>> |- include/ > >>> |- doc/ > >>> |- app2/... > >>> |- app3/... > >>> > >>> How would I include a single module, which can be called by modules in > >>> all of the applications? The only two ways I can think of is make it > into an > >>> app (I personally think that's overkill because I just want to call a > >>> function in the module) or make a symlink, which won't work in windows. > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Sun Aug 31 00:47:05 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 30 Aug 2008 23:47:05 +0100 Subject: [erlang-questions] fprof.dump: what is CP? Message-ID: What does CP stand for in the following fprof dump? {trace_ts,<7839.37.0>,in, {fprof,apply_start_stop,4}, {1220,133658,589577}} {trace_ts,<7839.37.0>,call, {mb,test,3}, {cp,{fprof,apply_start_stop,4}}, {1220,133658,589592}} Is it Swedish for caller function or is it an abbreviation for something else? Thanks, Joel -- wagerlabs.com From joelr1@REDACTED Sun Aug 31 01:33:15 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 31 Aug 2008 00:33:15 +0100 Subject: [erlang-questions] emulator crash when using fprof in verbose mode Message-ID: <16A109F7-CE7C-417B-A2A2-CDD2533221DC@gmail.com> How do I troubleshoot and fix this? Thanks, Joel --- Mac OSX 10.5.4, 2x2.8Ghz Quad Xeon Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:8] [async- threads:0] [kernel-poll:true] fprof:apply(mb, test, [localhost, 3000, N], [{file, "/db2/mb.trace"}, verbose ]). No SMP: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000200cf1b52 0x00007fffffe00f38 in ?? () (gdb) where #0 0x00007fffffe00f38 in ?? () #1 0x000000010973608e in ?? () #2 0x000000010006050e in processes_bif_engine (p=0x109736090, res_accp=0x100678dda, mbp=0x2) at beam/erl_process.c:4579 #3 0x000000010006050e in processes_bif_engine (p=0x109736090, res_accp=0x100678dda, mbp=0x2) at beam/erl_process.c:4579 SMP: size_object: matchstate term not allowed Program received signal SIGABRT, Aborted. 0x00007fff80db55c6 in select$DARWIN_EXTSN () (gdb) where #0 0x00007fff80db55c6 in select$DARWIN_EXTSN () #1 0x00000001000e4530 in erts_sys_main_thread () at sys/unix/sys.c:2864 #2 0x000000010001bf3b in erl_start (argc=15, argv=) at beam/erl_init.c:1038 The error is reported by size_object in erts/emulator/beam/copy.c, particularly this bit: case BIN_MATCHSTATE_SUBTAG: erl_exit(ERTS_ABORT_EXIT, "size_object: matchstate term not allowed"); -- wagerlabs.com From xbmodder@REDACTED Sun Aug 31 01:46:25 2008 From: xbmodder@REDACTED (Sargun Dhillon) Date: Sat, 30 Aug 2008 16:46:25 -0700 Subject: [erlang-questions] Switching and Routing protocols In-Reply-To: <20080829050305.GA13907@metalman.digium.internal> References: <7c9d57ea0808281637w1f209ec3r43559bee004de86f@mail.gmail.com> <20080829050305.GA13907@metalman.digium.internal> Message-ID: <7c9d57ea0808301646q5cbfb4fcka23c0f9044b83ee2@mail.gmail.com> Apparently gen_udp does support multicast, but it isn't in the documentation. Does anyone know where one may find documentation regarding multicasting with gen_udp? 2008/8/28 mog : > On Thu, Aug 28, 2008 at 04:37:29PM -0700, Sargun Dhillon wrote: >> protocol Erlang is great. Regarding OSPFd/RIP (other (broad/multi)cast >> IGPs) the gen_udp module doesn't implement multicast last time I >> checked. Unless this has changed you'll need to write an external port >> driver for this purpose. >> We'd love to hear your attempts at routing protocols in Erlang. > > I can't speak to the rest of this email but multicast support is available in erlang as of r11b3 i know for sure probably earlier. > > Mog > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAki3gwkACgkQeq+tARrxhnthiwCff+r9R7kH8O/pUp7gLVJHRqKo > P5AAoKC9/n0nVkUaRZe3jhzr3Y0vBrq0 > =rrPM > -----END PGP SIGNATURE----- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From joelr1@REDACTED Sun Aug 31 10:48:09 2008 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 31 Aug 2008 09:48:09 +0100 Subject: [erlang-questions] printing of Eterm's from gdb Message-ID: How can I print out Eterm's from within gdb? (gdb) where #0 size_object (obj=4380267240) at beam/copy.c:157 (gdb) p obj $8 = 4380267240 (gdb) p erts_printf_eterm_func $6 = (int (*)(fmtfn_t, void *, long unsigned int, long int)) 0x100059760 (gdb) p erts_printf $7 = {int (const char *)} 0x100132d90 Thanks, Joel -- wagerlabs.com From eranga.erl@REDACTED Sun Aug 31 21:22:45 2008 From: eranga.erl@REDACTED (Eranga Udesh) Date: Mon, 1 Sep 2008 00:52:45 +0530 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores Message-ID: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> Hi, I recently installed a new Erlang release 12B-3 on a 8 core (2 x 4 core Intel Zeon) HP DL 580 G5 machine running RH Linux 5.1. However this gives misterious errors in process handling. The observations are as below. 1. The Erlang node occassionally getting killed by heart. Reason for termination "heart-beat time-out". Sometimes after a couple of hours but sometimes in few minutes. Pls note this is without any workload on this Erl node. All the server cores are 98% free. 2. I started without heart and ran 2 recursive functons, 1 spawned and 1 in the Emulator prompt. This function outputs time every 1 second. When this issue occurs,the output stops. Which means the recursive functions stop working. Since heart is not started, Erl node is not getting restarted. 2.1. If I leave the Erl node for sometime, the sometimes things comes back to normal (tested for after 15-20 mins. othertimes never recovered). The outputs starts again. 2.2. I can do net:ping/1 from another Erl node. If I do a RPC call from another Erl node, it works. However if I run a recursive function, it runs once and getting stuck. The RPC call waits till timeout. 2.3 When this occurs, the connections from other Erl nodes are getting connection timeout and connection removes. However, like said above I can still do net:ping/1 and connect. If no activity done, again timeouts a little later. 2.4 I used etop to check whats going on. I hav a SCTP based application running and if a SCTP message comes, it's getting handled without any problem. I can see the recursive functions running and waiting and timer:sleep(1000) clause, but there's no increment in "Reductions" counter or no time output. 3. I have multiple Erlang releases running in this server. All of them face this issue, but not all at once. Their issue comes in different times and no pattern could observe. Even pure Mnesia DB Erl nodes face the same issue. 4. I tried with SMP enabled/disabled, different +S , but nothing works. 5. I tried with RH Linux 5.0/5.1, Erlang 12B-2/12B-3 but still the same. 6. The same Erl release in a different HP 4 core machine in same RH Linux works fine. Is there anybody who faced/face similar issues? What could be the cause for this? If there's any other debug dumps I should take, let me know. I tried everything and spent about a week, without any luck. I urgently need to find and fix the issue. Any advice is valuable. Thanks, - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From jchris@REDACTED Sun Aug 31 21:39:17 2008 From: jchris@REDACTED (Chris Anderson) Date: Sun, 31 Aug 2008 12:39:17 -0700 Subject: [erlang-questions] NYC CouchDB meetup / talk Message-ID: New York Couchers / Erlangers, (Pardon the cross-post) I'll be in Brooklyn from September 14th to the 20th, so if anyone would like to meetup for a beer to talk about CouchDB, I'd be thrilled. I'd also be happy to give a talk about CouchDB from a user's perspective, or to talk about the CouchDB internals. (I'm still learning Erlang in depth, but I know the CouchDB codebase pretty well at this point.) In any case, I'd love to meet with some NYC Erlangers / CouchDB users. I've seen some talk about getting an NYC Erlounge off the ground, I'd be really excited to attend that if it happens when I'm in town. Chris -- Chris Anderson http://jchris.mfdz.com From erlang-questions_efine@REDACTED Sun Aug 31 22:08:57 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 31 Aug 2008 16:08:57 -0400 Subject: [erlang-questions] Erl getting stuck in SMP with 8 cores In-Reply-To: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> References: <912a3c160808311222uec8bed1qd63f5f594465769e@mail.gmail.com> Message-ID: <6c2563b20808311308u4db39997jae41c107195c449c@mail.gmail.com> Eranga, You didn't say whether or not you had built the Erlang releases from source. If not, it might be a good idea to try that on the target system (./configure; make clean; make). If so, which compiler are you using? I won't ask all the obvious non-Erlang questions like, do you have the latest firmware for the machine, latest patches for RH 5.1, have you run a full hardware/memory test suite (maybe the machine is flaky), have you stopped all other non-critical processes and applications (maybe there's a rogue real-time process?) etc. You also didn't say if you were running 32-bit or 64-bit Linux. 2008/8/31 Eranga Udesh > Hi, > > I recently installed a new Erlang release 12B-3 on a 8 core (2 x 4 core > Intel Zeon) HP DL 580 G5 machine running RH Linux 5.1. However this gives > misterious errors in process handling. The observations are as below. > > 1. The Erlang node occassionally getting killed by heart. Reason for > termination "heart-beat time-out". Sometimes after a couple of hours but > sometimes in few minutes. Pls note this is without any workload on this Erl > node. All the server cores are 98% free. > > 2. I started without heart and ran 2 recursive functons, 1 spawned and 1 in > the Emulator prompt. This function outputs time every 1 second. When this > issue occurs,the output stops. Which means the recursive functions stop > working. Since heart is not started, Erl node is not getting restarted. > > 2.1. If I leave the Erl node for sometime, the sometimes things comes back > to normal (tested for after 15-20 mins. othertimes never recovered). The > outputs starts again. > > 2.2. I can do net:ping/1 from another Erl node. If I do a RPC call from > another Erl node, it works. However if I run a recursive function, it runs > once and getting stuck. The RPC call waits till timeout. > > 2.3 When this occurs, the connections from other Erl nodes are getting > connection timeout and connection removes. However, like said above I can > still do net:ping/1 and connect. If no activity done, again timeouts a > little later. > > 2.4 I used etop to check whats going on. I hav a SCTP based application > running and if a SCTP message comes, it's getting handled without any > problem. I can see the recursive functions running and waiting and > timer:sleep(1000) clause, but there's no increment in "Reductions" counter > or no time output. > > 3. I have multiple Erlang releases running in this server. All of them face > this issue, but not all at once. Their issue comes in different times and no > pattern could observe. Even pure Mnesia DB Erl nodes face the same issue. > > 4. I tried with SMP enabled/disabled, different +S , but nothing > works. > > 5. I tried with RH Linux 5.0/5.1, Erlang 12B-2/12B-3 but still the same. > > 6. The same Erl release in a different HP 4 core machine in same RH Linux > works fine. > > Is there anybody who faced/face similar issues? What could be the cause for > this? If there's any other debug dumps I should take, let me know. I tried > everything and spent about a week, without any luck. I urgently need to find > and fix the issue. > > Any advice is valuable. > > Thanks, > - Eranga > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- For every expert there is an equal and opposite expert - Arthur C. Clarke -------------- next part -------------- An HTML attachment was scrubbed... URL: From dot@REDACTED Wed Aug 27 17:15:45 2008 From: dot@REDACTED (Tony Finch) Date: Wed, 27 Aug 2008 16:15:45 +0100 Subject: [erlang-questions] clipping of max# of file descriptors by ertswhen kernel poll is enabled In-Reply-To: <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> References: <91F4D93C-115D-45E1-A11A-F7AFBA81E01F@gmail.com> <1E5CB28D9F205A4CA167F2173F2C693401260C8D@esealmw115.eemea.ericsson.se> Message-ID: On Mon, 25 Aug 2008, Rickard Green S wrote: > Matthew's answer is correct. If we need to fall back on select() on a > filedescriptor that is larger than select() can handle, your > modification wont work. Note that on Mac OS X 10.4 and later, you can #define FD_SETSIZE to whatever value you want at compile time. In fact, you can allocate fd sets dynamically so long as they are big enough to hold the largest file descriptor you are using. See the comment just above the definition of FD_SETSIZE in /usr/include/sys/select.h. This is also true for other BSDs. Tony. -- f.anthony.n.finch http://dotat.at/ HEBRIDES BAILEY: WESTERLY OR SOUTHWESTERLY 5 OR 6, BECOMING VARIABLE 3 OR 4 IN NORTH. MODERATE OR ROUGH. RAIN OR DRIZZLE. MODERATE OR GOOD, OCCASIONALLY POOR.