From stonecypher@REDACTED Tue Jul 1 01:05:24 2008 From: stonecypher@REDACTED (John Haugeland) Date: Mon, 30 Jun 2008 17:05:24 -0600 Subject: [erlang-questions] erlang-questions Digest, Vol 13, Issue 126 In-Reply-To: References: Message-ID: <8f24f4b10806301605r2ac7e6d9jaa7d4be6a4c362a1@mail.gmail.com> > We (collectively) promised to help Alexander - I promised to provide him with a > rendering engine (in Erlang) for the wikipedia markup language. > > Before I start hacking has anybody done this before? You're going to find this an extremely hard sell - I ran the idea past the Wikipedians almost two years ago, with a semi-functional proof of concept, and was basically booed out of the IRC channel on grounds that erlang/mnesia don't have the kind of penetration that PHP/mysql do. Also, it's my opinion that none of the currently available webservers (httpd module, yaws, etc) are appropriately oriented towards near-nonexistence (there's absolutely no reason for a site meant to replace Wikipedia to need on-disk configuration or indeed any form of disk access, provided mnesia access). Of course, I'm in the middle of repairing that. Still, good luck. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Jul 1 01:53:37 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 1 Jul 2008 01:53:37 +0200 Subject: [erlang-questions] Treating data from open_port as an io_device() In-Reply-To: <530345950806301307j23357e7cud9b2e47d2e0082d8@mail.gmail.com> References: <530345950806301307j23357e7cud9b2e47d2e0082d8@mail.gmail.com> Message-ID: <3dbc6d1c0806301653y4b33cce3od5281a78b858b14b@mail.gmail.com> It is not difficult. An i/o server needs only handle 3 or 4 messages from user code to be able to handle the whole interface from the io module. Only the one which does input is mildly difficult. The whole thing is rather simple actually. I am in the middle of writing a document which describes some of the more basic parts of Erlang and the rationale behind them. I/o will be one part. I can understand rewriting the io system to make it more efficient, but not really to make it easier to implement servers in. All that is missing is just some documentation. I'll gladly help you actually as I feel that this is something which is lacking. Robert On 30/06/2008, Tom Werner wrote: > Can anyone recommend a way to treat the output from an open_port call as an > io_device() instead of as chunks of data that are delivered to the port's > controlling process and fetched via receive? > > What I want is to use file:read/2 to read from the external process. The > reason is that data going TO the process already has 4 byte length headers > on it, so I can't use {packet, 4}. The data coming FROM the process also has > the headers so I'll need to do length header management myself which is > difficult (and inefficient) when dealing with chunked data. > > Alternatively, is there a way to just create an in-memory io_device() that I > can use as a fifo? Then I could write the chunked data to the fifo and read > off the other side. I tried using a posix fifo file but file:open/2 will not > open it because of {error,eisdir}. It looks like I can open the fifo as a > port but that leaves me with the same exact problem. > > I've looked all over the docs and asked in #erlang but I've seen no way to > create a simple pipe that I can use for this purpose! > > Tom Preston-Werner > github.com/mojombo > From daniele.varrazzo@REDACTED Tue Jul 1 02:02:56 2008 From: daniele.varrazzo@REDACTED (Daniele Varrazzo) Date: Tue, 01 Jul 2008 01:02:56 +0100 Subject: [erlang-questions] wkipedia rendering engine In-Reply-To: <9b08084c0806300423g4269b1c4v8822a9184cf86878@mail.gmail.com> References: <9b08084c0806300239t59378f45nded85601087358d6@mail.gmail.com> <9b08084c0806300423g4269b1c4v8822a9184cf86878@mail.gmail.com> Message-ID: <48697430.1020000@gmail.com> Joe Armstrong ha scritto: > Is there a REST interface so that I can retreive the latest version of > the MetaWiki markup for a specific page with, for example, > a wget command. Yes, there is: curl "http://en.wikipedia.org/w/index.php?title=Erlang_%28programming_language%29&action=raw" It is the same URL users can use to interactively edit the page, but with a different "action". -- Daniele From ok@REDACTED Tue Jul 1 05:33:27 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 1 Jul 2008 15:33:27 +1200 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> Message-ID: <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> The problem we are discussing is processes B, C, D hold information X, Y, Z respectively; process A wants a coherent snapshot of X, Y,Z. There are actually two slightly different cases depending on A needs "X Y Z as of *now*" (A, B, C, and D must all synchronise), or A needs "X Y Z as of *some* time in the recent past" (B, C, and D must all synchronise but can then send the information to A without waiting for A to receive it). I like this problem because it is simple yet subtle. One way that it is subtle is that in "multithread" programming most people STILL think in terms of a single absolute time shared by all threads. (After all, there _is_ such a thing, the system clock. And yes, it's not exactly true, but it's close enough to make people _think_ it's true.) But when you start thinking about Erlang and especially *distributed* Erlang, you start realising that "now" is a pretty fuzzy concept. To me, the easiest approach to *think* was A sends "tell me X" to B, "tell me Y" to C, and "tell me Z" to D in any order, then does three receives in any order to collect the results, then sends "thanks" to B, C, and D in any order. B receives "tell me X" from A, computes X, sends "here is X" to A, then waits for "thanks" from A. C and D are just like B. This has 9 messages compared, but it is symmetric, and it is actually pretty close to the locking technique (to "lock" a process, send it a message asking it to wait, receive its acceptance, and then send it a message telling it to proceed). This extends to any number of processes E, F, G, ... and none of the processes except A has to know about any of the others. On 30 Jun 2008, at 6:45 pm, Erik Reitsma proposed a scheme that doesn't actually need any functions to be sent around (which is nice if you are doing distribution): A sends "I need X Y and Z, ask C and D for Y and Z" to B then waits. B sends "A needs Y and Z, ask D for Z, here is X" to C. B then waits for the go-ahead. C sends "A needs Z, here are X and Y" to D, then waits. D sends "here are X Y and Z" to A. If a four-way synchronisation is wanted, D waits. If a three-way is wanted, it doesn't. A receives X, Y, and Z. It sends "go ahead" to B and C (and to D if four-way is wanted). This is 7 messages if the "NOW" reading with four-way synchronisation is wanted, or 6 if the "some time in the recent past" reading with three-way synchronisation is wanted. Since B, C, and D have to be told that their information is needed and A has to receive the results, four messages are needed. Can it be done in fewer than 7 (or 6) messages? Are there other readings of the requirements that I've missed? How do/should we think about these problems? Pace Dijkstra, I'm afraid that I came up with the schemes above in a very anthropomorphic CRC-card-ish way: who knows what? who needs to know what? can the message count be reduced if I ask someone to do something for me? plus a sort of intuitive idea that to get N processes to synchronise, get all but 1 of them waiting for something There has to be a tutorial, perhaps even a textbook, waiting to be written about "how to think about messages". From ok@REDACTED Tue Jul 1 05:37:18 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 1 Jul 2008 15:37:18 +1200 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <4d08db370806300149x70ac8c15q135efc8b992d3070@mail.gmail.com> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <4d08db370806300149x70ac8c15q135efc8b992d3070@mail.gmail.com> Message-ID: <40D2FCB6-9CED-42ED-A999-49BE3B0ED819@cs.otago.ac.nz> On 30 Jun 2008, at 8:49 pm, Hynek Vychodil wrote: > Change your design from pull to push. > Make servers which collect data and do something instead "request" > data or actions. I wondered about mentioning that too, because if B C D send their information to A you only need three messages. However, this creates two problems: - the original poster appeared to want a *consistent snapshot* of the information from B C D, which seems to require synchronisation - A might not be interested in X Y Z much of the time; some sort of flow control scheme is needed to stop B C D telling A stuff it doesn't want to know and can't cope with. One would really need to take a look at the whole system, as Hynek Vychodil suggests. From ok@REDACTED Tue Jul 1 05:41:35 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 1 Jul 2008 15:41:35 +1200 Subject: [erlang-questions] Project volunteers In-Reply-To: <9b08084c0806300250l382304edlf9b279800fb855d0@mail.gmail.com> References: <9b08084c0806300250l382304edlf9b279800fb855d0@mail.gmail.com> Message-ID: <9A0D3DCA-741D-40AF-A64D-FF7BEBAA899A@cs.otago.ac.nz> On 30 Jun 2008, at 9:50 pm, Joe Armstrong wrote: > Make an offline stand-alone version of the wikipedia for places > without internet access. We have the Wikipedia data as part of the INEX project. Much of the volume is images, I believe. I don't understand why an offline version wouldn't just be a snapshot of the data converted to (X)HTML + images to be used with any web browser one fancies. The two interesting bits might be - compression; space = time = battery use - searching (but there are N free IR systems out there, notably Zettair) From erlang-questions_efine@REDACTED Tue Jul 1 05:42:51 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 30 Jun 2008 23:42:51 -0400 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> Message-ID: <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> Richard, I'm new to Erlang and FP, and I want to learn from my mistakes or misunderstandings. Please could you critique the suggestion I sent in regarding this problem? The fact that nobody commented means either that it was (a) totally naive and not worthy of comment (or to spare my feelings), or (b) such a good idea that all were rendered speechless with admiration. Somehow the probability of (b) seems rather low. So... where did I go wrong? Regards, Edwin FIne On Mon, Jun 30, 2008 at 11:33 PM, Richard A. O'Keefe wrote: > The problem we are discussing is > processes B, C, D hold information X, Y, Z respectively; > process A wants a coherent snapshot of X, Y,Z. > > There are actually two slightly different cases depending on > A needs "X Y Z as of *now*" (A, B, C, and D must all > synchronise), or A needs "X Y Z as of *some* time in the > recent past" (B, C, and D must all synchronise but can then > send the information to A without waiting for A to receive it). > > I like this problem because it is simple yet subtle. > One way that it is subtle is that in "multithread" programming > most people STILL think in terms of a single absolute time > shared by all threads. (After all, there _is_ such a thing, > the system clock. And yes, it's not exactly true, but it's > close enough to make people _think_ it's true.) But when you > start thinking about Erlang and especially *distributed* > Erlang, you start realising that "now" is a pretty fuzzy > concept. > > To me, the easiest approach to *think* was > > A sends "tell me X" to B, "tell me Y" to C, > and "tell me Z" to D in any order, > then does three receives in any order to > collect the results, then > sends "thanks" to B, C, and D in any order. > > B receives "tell me X" from A, computes X, > sends "here is X" to A, then waits for > "thanks" from A. > > C and D are just like B. > > This has 9 messages compared, but it is symmetric, and it is > actually pretty close to the locking technique (to "lock" a > process, send it a message asking it to wait, receive its > acceptance, and then send it a message telling it to proceed). > This extends to any number of processes E, F, G, ... and none > of the processes except A has to know about any of the others. > > On 30 Jun 2008, at 6:45 pm, Erik Reitsma proposed a scheme > that doesn't actually need any functions to be sent around > (which is nice if you are doing distribution): > > A sends "I need X Y and Z, ask C and D for Y and Z" > to B then waits. > B sends "A needs Y and Z, ask D for Z, here is X" > to C. B then waits for the go-ahead. > C sends "A needs Z, here are X and Y" to D, > then waits. > D sends "here are X Y and Z" to A. > If a four-way synchronisation is wanted, D waits. > If a three-way is wanted, it doesn't. > A receives X, Y, and Z. It sends "go ahead" to B > and C (and to D if four-way is wanted). > > This is 7 messages if the "NOW" reading with four-way > synchronisation is wanted, or 6 if the "some time in the > recent past" reading with three-way synchronisation is > wanted. Since B, C, and D have to be told that their > information is needed and A has to receive the results, > four messages are needed. > > Can it be done in fewer than 7 (or 6) messages? > Are there other readings of the requirements that I've missed? > How do/should we think about these problems? > > Pace Dijkstra, I'm afraid that I came up with the schemes > above in a very anthropomorphic CRC-card-ish way: > who knows what? > who needs to know what? > can the message count be reduced if I ask > someone to do something for me? > plus a sort of intuitive idea that > to get N processes to synchronise, get all > but 1 of them waiting for something > > There has to be a tutorial, perhaps even a textbook, waiting > to be written about "how to think about messages". > > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Jul 1 06:48:35 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 1 Jul 2008 16:48:35 +1200 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> Message-ID: On 1 Jul 2008, at 3:42 pm, Edwin Fine wrote: > Richard, > > I'm new to Erlang and FP, and I want to learn from my mistakes or > misunderstandings. Please could you critique the suggestion I sent > in regarding this problem? The fact that nobody commented means > either that it was (a) totally naive and not worthy of comment (or > to spare my feelings), or (b) such a good idea that all were > rendered speechless with admiration. Somehow the probability of (b) > seems rather low. So... where did I go wrong? Let's recapitulate. If I've found the right message, Edwin Fine had three suggestions: ? Create a gen_fsm that controls all the collections. The collections could be ETS tables or gen_servers wrapping ETS tables. Under normal use, messages are sent to the fsm to update the collections individually. When the time comes to require consistency across the collections, send a message to the fsm to get the collective state data. The fsm goes into a different state while it gathers the data. This state would reject requests to update the collections (or wait until the state changes), although reads would still be allowed. On getting the result, the state changes back to allow updates again. ? Create a memory-only Mnesia table for each collection, and use Mnesia transactions to get the multiple values atomically. ? Change the architecture of the current lock-oriented program to make better use of Erlang's features. From bottom to top: - The last one doesn't really answer the orignal poster's question. At least, imagining myself in the OP's shoes, I would not find that answer informative. Change it HOW? WHICH features? In what way better? - The second one might well be the right thing to do in a production system. However, someone who is still struggling with how to use messages probably doesn't want to be told to learn another huge great thing, and might well get the impression that message passing wasn't much good after all. - As for the first one, it seemed to me that in order to do that, you'd pretty much have to solve the original problem anyway, plus you would have to come to grips with behaviours, callbacks, gen_fsm, and a lot of stuff which is practically very very useful, but not something to be understood in five minutes. I suppose I can summarise it as "You gave OTP answers to what I saw as an Erlang question". I may well be completely mistaken about where the OP was coming from, but I understood the question to be specifically a question "how can the OP solve this problem directly using message passing." OTP answers are very often precisely the right answers, so don't stop giving them. From tchamila@REDACTED Tue Jul 1 07:01:50 2008 From: tchamila@REDACTED (chamila piyasena) Date: Tue, 1 Jul 2008 10:31:50 +0530 Subject: [erlang-questions] improving the performance of regexp(regular expressions) Message-ID: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> Hi all, Is there a new implementation of regexp.erl or can anyone suggest a way to improve the performance of the functionalities given in the regexp.erl without using regexp library written in C. cheers chamila -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue Jul 1 08:01:40 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 1 Jul 2008 08:01:40 +0200 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> Message-ID: <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> 2008/7/1 chamila piyasena : > Hi all, > Is there a new implementation of regexp.erl or can anyone suggest a way to > improve the performance of the functionalities given in the regexp.erl > without using regexp library written in C. Seriously: Consider something else than regular expressions if it is possible. Some languages, most notably perl has used regular expressions extensively and thus has a pretty fast implementation of them. But usually you can easily write code without them. Maybe you can read the data in a more structured format, maybe you can pre-process the data into a simpler format or maybe you can skip parts of the data. Rather than trying to brute-force yourself through the mouse-hole, use the door in the wall ;) Regular expressions have their uses, but they indeed also have their abuses. From erlang@REDACTED Tue Jul 1 09:04:34 2008 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 1 Jul 2008 09:04:34 +0200 Subject: [erlang-questions] wkipedia rendering engine In-Reply-To: <48697430.1020000@gmail.com> References: <9b08084c0806300239t59378f45nded85601087358d6@mail.gmail.com> <9b08084c0806300423g4269b1c4v8822a9184cf86878@mail.gmail.com> <48697430.1020000@gmail.com> Message-ID: <9b08084c0807010004j47d25f2ao8c70ee0ca67659d9@mail.gmail.com> Brilliant - looking at this page I guess {{Infobox ...}} is a macro Can I retrieve the macro definition with a REST query? Thanks /Joe On Tue, Jul 1, 2008 at 2:02 AM, Daniele Varrazzo wrote: > Joe Armstrong ha scritto: > >> Is there a REST interface so that I can retreive the latest version of >> the MetaWiki markup for a specific page with, for example, >> a wget command. > > Yes, there is: > > curl > "http://en.wikipedia.org/w/index.php?title=Erlang_%28programming_language%29&action=raw" > > It is the same URL users can use to interactively edit the page, but with a > different "action". > > -- Daniele > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From watson.timothy@REDACTED Tue Jul 1 09:06:43 2008 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 1 Jul 2008 08:06:43 +0100 Subject: [erlang-questions] Question about message passing paradigm Message-ID: <8fa878b90807010006i32869be2u282efb25e44e71ee@mail.gmail.com> Hi Edwin, I'm quite fresh around here too and I agree, someone definitely needs to write up some common patterns for the paradigm. I also suggested a locking solution using selective receive, but being a little tired, I managed to post it with the wrong subject line. Twice. Still, it wasn't really a solution, but a discussion about the applicability of selective receive - I can't see another way of doing this. My concern with the approach is that there is no way for a process to "safely lock itself" unless it can trap exists from the process trying to "acquire the lock," as it were. If A starts communicating with B and asks B to stay in a particular state until it [A] is ready, then A had better broadcast it's death if anything goes wrong so that B can "unlock itself," for want of a better description. The more processes are involved, the more interesting that gets. My original solution was to lock each container process against a specific value (key) and continue to serve reads while blocking writes. My solution doesn't however, deal with process failures very well! Here's a quick stab: loop(State, LockList) -> %% ... some interesting code... receive { SenderPid, acquire, ItemId } -> case get_item(ItemId, LockList) of { acquired, Response } -> SenderPid ! { { acquired, ok }, Response } ; _ -> SenderPid ! error end, loop(State, [ ItemId | LockList ]) ; { SenderPid, read, ItemId } -> SenderPid ! { { read, ok }, get_item_readonly(ItemId) }, loop(State, LockList) ; { SenderPid, write, { ItemId, Value } } -> { acquired, Response } = get_item(ItemId, LockList), Write = write_item(ItemId, Value), SenderPid ! { { write, ok }, Write } end. Obviously I've imagined some code in get_item that checks the lock list before a successful acquire, etc. This solution is non blocking for reads, but in the event that you try and get a write (i.e, acquire) a locked item, the process dies with a pattern matching failure (based on the assumption that get_item will return an 'error' atom or something like that, on failure). This is hardly a solution, but I wanted to look at the selective receive bit. What happens if the process who "acquired" item X dies and doesn't notify you!? X sort of "goes missing,", which is hardly ideal. In your example, where the individual processes actually block until released, a fatal error in the lock owner will deadlock the system. You could always check the sender pid against your linked nodes and link to it if it's not already in there. Personally, I don't like this approach though - it all feels like a kludge. I like the idea of changing from a pull to a push design (mentioned earlier), as this whole locking multiple processes feels horrible. Think about a typical (Joe forgive me) OO implementation in java or some such. The number 1 rule is don't call into some other object while holding a lock, as you've no idea what might happen and you might end up deadlocked. This question raises the same questions for me - do I really want these distributed locks cropping up all over the place? If data consistency is really that important, then maybe we should find a better way to accumulate the data we need to perform a given operation. As another contrived example, I can't imagine that if in the process of say, selling broadband, you need to fist check the network inventory, then provision an engineer and finally set up a billing record against a customer account, that you'd want to deal with the locking protocol in this way. Say the network inventory and engineer availability rosters are in different parts of the system, which you need to call via some RPC (say they're not actual Erlang nodes, but some java application that you hit over HTTP), or maybe just in a database or whatever. I would've thought that the safest way to do this with pessimistic locking is surely to lock the whole provisioning activity (e.g., upon receiving the initial call) - this might entail exposing the provisioning process as a gen_server and performing the locking there (this might even happen implicitly, if you use the synchronous 'call' function instead of the async 'cast') or something like that. This is going to have a bad effect on your liveliness, naturally, but that's life. A course grained lock is safer, but less lively. A lock that doesn't deal with error conditions sounds bad though. Hopefully someone with a bit more experience will chime in here and point out the obvious to us new folk!? ...... Cheers, Tim Watson > ------------------------------ > > Message: 7 > Date: Mon, 30 Jun 2008 23:42:51 -0400 > From: "Edwin Fine" > Subject: Re: [erlang-questions] Question about message passing > paradigm > To: "Richard A. O'Keefe" > Cc: Mike T , erlang-questions@REDACTED > Message-ID: > <6c2563b20806302042q2605badie220bd1acb7d72b3@REDACTED> > Content-Type: text/plain; charset="utf-8" > > Richard, > > I'm new to Erlang and FP, and I want to learn from my mistakes or > misunderstandings. Please could you critique the suggestion I sent in > regarding this problem? The fact that nobody commented means either that it > was (a) totally naive and not worthy of comment (or to spare my feelings), > or (b) such a good idea that all were rendered speechless with admiration. > Somehow the probability of (b) seems rather low. So... where did I go wrong? > > Regards, > Edwin FIne > > On Mon, Jun 30, 2008 at 11:33 PM, Richard A. O'Keefe > wrote: > >> The problem we are discussing is >> processes B, C, D hold information X, Y, Z respectively; >> process A wants a coherent snapshot of X, Y,Z. >> >> There are actually two slightly different cases depending on >> A needs "X Y Z as of *now*" (A, B, C, and D must all >> synchronise), or A needs "X Y Z as of *some* time in the >> recent past" (B, C, and D must all synchronise but can then >> send the information to A without waiting for A to receive it). >> >> I like this problem because it is simple yet subtle. >> One way that it is subtle is that in "multithread" programming >> most people STILL think in terms of a single absolute time >> shared by all threads. (After all, there _is_ such a thing, >> the system clock. And yes, it's not exactly true, but it's >> close enough to make people _think_ it's true.) But when you >> start thinking about Erlang and especially *distributed* >> Erlang, you start realising that "now" is a pretty fuzzy >> concept. >> >> To me, the easiest approach to *think* was >> >> A sends "tell me X" to B, "tell me Y" to C, >> and "tell me Z" to D in any order, >> then does three receives in any order to >> collect the results, then >> sends "thanks" to B, C, and D in any order. >> >> B receives "tell me X" from A, computes X, >> sends "here is X" to A, then waits for >> "thanks" from A. >> >> C and D are just like B. >> >> This has 9 messages compared, but it is symmetric, and it is >> actually pretty close to the locking technique (to "lock" a >> process, send it a message asking it to wait, receive its >> acceptance, and then send it a message telling it to proceed). >> This extends to any number of processes E, F, G, ... and none >> of the processes except A has to know about any of the others. >> >> On 30 Jun 2008, at 6:45 pm, Erik Reitsma proposed a scheme >> that doesn't actually need any functions to be sent around >> (which is nice if you are doing distribution): >> >> A sends "I need X Y and Z, ask C and D for Y and Z" >> to B then waits. >> B sends "A needs Y and Z, ask D for Z, here is X" >> to C. B then waits for the go-ahead. >> C sends "A needs Z, here are X and Y" to D, >> then waits. >> D sends "here are X Y and Z" to A. >> If a four-way synchronisation is wanted, D waits. >> If a three-way is wanted, it doesn't. >> A receives X, Y, and Z. It sends "go ahead" to B >> and C (and to D if four-way is wanted). >> >> This is 7 messages if the "NOW" reading with four-way >> synchronisation is wanted, or 6 if the "some time in the >> recent past" reading with three-way synchronisation is >> wanted. Since B, C, and D have to be told that their >> information is needed and A has to receive the results, >> four messages are needed. >> >> Can it be done in fewer than 7 (or 6) messages? >> Are there other readings of the requirements that I've missed? >> How do/should we think about these problems? >> >> Pace Dijkstra, I'm afraid that I came up with the schemes >> above in a very anthropomorphic CRC-card-ish way: >> who knows what? >> who needs to know what? >> can the message count be reduced if I ask >> someone to do something for me? >> plus a sort of intuitive idea that >> to get N processes to synchronise, get all >> but 1 of them waiting for something >> >> There has to be a tutorial, perhaps even a textbook, waiting >> to be written about "how to think about messages". >> >> >> >> > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://www.erlang.org/pipermail/erlang-questions/attachments/20080630/5455b955/attachment.html > > ------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > End of erlang-questions Digest, Vol 14, Issue 1 > *********************************************** > From erlang-questions_efine@REDACTED Tue Jul 1 09:37:20 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 1 Jul 2008 03:37:20 -0400 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> Message-ID: <6c2563b20807010037v41675855g22ce1ed6bdc36c07@mail.gmail.com> Thank you for a very interesting and informative analysis. I must admit that I tend to lump together Erlang/OTP as "Erlang" and see solutions in that context. In a way, I feel as if using Erlang "standalone" without OTP is very roughly analogous to using C++ without the STL: it can be done, but why on earth would one want to? I agree that the last answer didn't answer much. What I was trying to say is that the architecture should perhaps be redesigned to fit a Functional Programming/Message Passing paradigm and infrastructure, but I couldn't suggest precisely how because there was almost no information about the original architecture. So in retrospect I wound up saying nothing useful. As a final note, let me say that I was thrown in to the deep end in Erlang by having to learn Erlang and OTP concurrently (pun intended) because I had to create a production system in a short period of time. This is why it's a bit hard for me to separate the two. Thanks again for clearly identifying the core issues, as you usually seem to do. One last thing: I read the Ethics of Belief after poring over one of your posts recently, and was exceptionally impressed with the gentleman's writing and philosophy, with which I strongly agree. In that regard, I'd like to misquote John Stuart Mill, namely, "A foolish *certainty* is the hobgoblin of little minds". (Actually, I think my version is a slight improvement ;) I am unfortunately seeing the mechanism of insufficiently examined beliefs at work today, resulting in the persecution of a friend of mine by way of (the almost totally belief-based) Shaken Baby Syndrome. So the essay really resonated deeply with me. I daresay William K. Clifford would have had a lot to say about this. I wish he were still alive to do so. Bertrand Russel too. On Tue, Jul 1, 2008 at 12:48 AM, Richard A. O'Keefe wrote: > > On 1 Jul 2008, at 3:42 pm, Edwin Fine wrote: > >> Richard, >> >> I'm new to Erlang and FP, and I want to learn from my mistakes or >> misunderstandings. Please could you critique the suggestion I sent in >> regarding this problem? The fact that nobody commented means either that it >> was (a) totally naive and not worthy of comment (or to spare my feelings), >> or (b) such a good idea that all were rendered speechless with admiration. >> Somehow the probability of (b) seems rather low. So... where did I go wrong? >> > > Let's recapitulate. If I've found the right message, > Edwin Fine had three suggestions: > > ? Create a gen_fsm that controls all the collections. > The collections could be ETS tables or gen_servers wrapping ETS > tables. > Under normal use, messages are sent to the fsm to update the > collections > individually. When the time comes to require consistency across > the > collections, send a message to the fsm to get the collective state > data. > The fsm goes into a different state while it gathers the data. > This state would reject requests to update the collections (or > wait until > the state changes), although reads would still be allowed. > On getting the result, the state changes back to allow updates > again. > ? Create a memory-only Mnesia table for each collection, and use > Mnesia > transactions to get the multiple values atomically. > ? Change the architecture of the current lock-oriented program to > make > better use of Erlang's features. > > From bottom to top: > - The last one doesn't really answer the orignal poster's question. > At least, imagining myself in the OP's shoes, I would not find that > answer informative. Change it HOW? WHICH features? In what way better? > > - The second one might well be the right thing to do in a production > system. However, someone who is still struggling with how to use > messages > probably doesn't want to be told to learn another huge great thing, and > might well get the impression that message passing wasn't much good > after all. > > - As for the first one, it seemed to me that in order to do that, you'd > pretty much have to solve the original problem anyway, plus you would > have to come to grips with behaviours, callbacks, gen_fsm, and a lot of > stuff which is practically very very useful, but not something to be > understood in five minutes. > > I suppose I can summarise it as "You gave OTP answers to what I saw as > an Erlang question". I may well be completely mistaken about where the > OP was coming from, but I understood the question to be specifically a > question "how can the OP solve this problem directly using message > passing." > OTP answers are very often precisely the right answers, so don't stop > giving them. > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreengels@REDACTED Tue Jul 1 10:16:52 2008 From: andreengels@REDACTED (Andre Engels) Date: Tue, 1 Jul 2008 10:16:52 +0200 Subject: [erlang-questions] wkipedia rendering engine In-Reply-To: <9b08084c0807010004j47d25f2ao8c70ee0ca67659d9@mail.gmail.com> References: <9b08084c0806300239t59378f45nded85601087358d6@mail.gmail.com> <9b08084c0806300423g4269b1c4v8822a9184cf86878@mail.gmail.com> <48697430.1020000@gmail.com> <9b08084c0807010004j47d25f2ao8c70ee0ca67659d9@mail.gmail.com> Message-ID: <6faf39c90807010116w7d90a4c3t9f85164b41083f13@mail.gmail.com> On Tue, Jul 1, 2008 at 9:04 AM, Joe Armstrong wrote: > Brilliant - looking at this page I guess {{Infobox ...}} is a macro > > Can I retrieve the macro definition with a REST query? Yes, those macros (in Wikipedia they're called templates) are Wiki pages themselves. The content of {{Infobox something}} can be found at the page [[Template:Infobox something]]. If there is "something = foobar" in the template call, replace {{{something}}} by foobar in the template. -- Andre Engels, andreengels@REDACTED ICQ: 6260644 -- Skype: a_engels From rtrlists@REDACTED Tue Jul 1 10:17:07 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 1 Jul 2008 09:17:07 +0100 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> Message-ID: <6a3ae47e0807010117w7ae37b8bi781cd6dde9899fcb@mail.gmail.com> Some programmers when faced with a problem think, "I know, I'll use a regular expression." Now they have two problems. - Anonymous From vladdu55@REDACTED Tue Jul 1 10:53:00 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 1 Jul 2008 10:53:00 +0200 Subject: [erlang-questions] user_sup process suddenly dies Message-ID: <95be1d3b0807010153y3c2aeb3bt9ff50f73f086c449@mail.gmail.com> Hi all, I'm going through tens of megabytes of trace logs to try to figure out why the process running user_sup is terminating with a reason of 'shutdown'. I have trace logs from a working system, so I can diff, but it's still tedious. So I thought I would check if there is any shortcut, i.e. if someone knows where to look. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Tue Jul 1 11:04:17 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 1 Jul 2008 11:04:17 +0200 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> Message-ID: Hi, Even if I agree with the other answerers that the need to use regular expressions is often an indication that the algorithm can be improved and maybe changed to not use regular expressions at all It is worth mentioning that in the R12B-3 release there is a fast implementation of regular expressions in the re module. The regular expressions are built-in in the virtual machine and it is implemented in C. The API is still to be considered as experimental but the functionality is there and it is fast and ready to use. /Kenneth Erlang/OTP team , Ericsson 2008/7/1 chamila piyasena : > Hi all, > Is there a new implementation of regexp.erl or can anyone suggest a way to > improve the performance of the functionalities given in the regexp.erl > without using regexp library written in C. > > > > > cheers > chamila > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Tue Jul 1 11:17:52 2008 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 1 Jul 2008 10:17:52 +0100 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <6c2563b20807010108r64f2bad1h2a488b764e57724f@mail.gmail.com> References: <8fa878b90807010006i32869be2u282efb25e44e71ee@mail.gmail.com> <6c2563b20807010108r64f2bad1h2a488b764e57724f@mail.gmail.com> Message-ID: <8fa878b90807010217x6e18fcadpe686d7278a5a55b0@mail.gmail.com> Hi Edwin, I hadn't thought of using timeouts like this, but yes, it sounds like a viable idea. I guess my concern(s) about liveliness still stand, but Richards use of a last minute collection strategy seems to address that quite well. I'd try to avoid this kind of locking protocol if at all possible though, refactoring towards a push based design (as per Richard and Hynek Vychodil's discussion elsewhere on this thread), but where this is just the art of the possible, it seems good to me. Cheers, Tim 2008/7/1 Edwin Fine : > Well, Richard's response to my question (and the OP's question) was most > enlightening. > > I believe that deadlocks can be dealt with quite easily by the judicious > choice of timeouts. For example, in the suggestions I posted involving the > use of a gen_fsm behavior, it would be relatively trivial to add a timeout > that reverts the state back to "unlocked" should the set of operations not > be complete within a reasonable period of time. Indeed, I think Joe had an > example of that in the book, or else the gen_fsm documentation does, showing > a gen_fsm used to hold the combination to a safe. After a period of time, if > digits are entered the safe is not unlocked, the state reverts to "locked" > again and it has to start from scratch. > > Richard's idea of sending individual queries which don't allow the receiver > to handle any other queries until it gets an ACK could also be protected by > timeouts. > > In this way, I don't think the broadcasting of deaths would be necessary: if > a process is not "unlocked" in a reasonable amount of time, it unlocks > itself. This covers a multitude of sins: process death, network death, > programmer death (well, maybe not :). > > As Richard aptly pointed out, I tend to see solutions in a framework of > Erlang/OTP, not pure Erlang the language. So if using a gen_fsm behavior, > erlang:send_after() is perfect for this timeout strategy. > > For example: > > try > A = thing_a:get_value(), > B = thing_b:get_value(), > C = thing_c:get_value(), > {ok, {A, B, C}} > catch > Cls:Exc -> {error, {Cls, Exc}} > after > thing_c:release(), > thing_b:release(), > thing_a:release() > end. > > Even if the node running the above code crashes, if timeouts exist in > thing_a, thing_b, and thing_c, they will unlock themselves regardless of if > release() is called. Of course, you could get a spurious old release() > coming in after a timeout occurred, messing up the next transaction, but you > could deal with that by using a common ref to correlate the three. If a > stale release came in with the wrong ref, it would be ignored. > > I dunno. Too simplistic? Thoughts? > > Edwin > > On Tue, Jul 1, 2008 at 3:06 AM, Tim Watson wrote: >> >> Hi Edwin, >> >> I'm quite fresh around here too and I agree, someone definitely needs >> to write up some common patterns for the paradigm. I also suggested a >> locking solution using selective receive, but being a little tired, I >> managed to post it with the wrong subject line. Twice. >> >> Still, it wasn't really a solution, but a discussion about the >> applicability of selective receive - I can't see another way of doing >> this. My concern with the approach is that there is no way for a >> process to "safely lock itself" unless it can trap exists from the >> process trying to "acquire the lock," as it were. If A starts >> communicating with B and asks B to stay in a particular state until it >> [A] is ready, then A had better broadcast it's death if anything goes >> wrong so that B can "unlock itself," for want of a better description. >> The more processes are involved, the more interesting that gets. My >> original solution was to lock each container process against a >> specific value (key) and continue to serve reads while blocking >> writes. My solution doesn't however, deal with process failures very >> well! Here's a quick stab: >> >> loop(State, LockList) -> >> %% ... some interesting code... >> receive >> { SenderPid, acquire, ItemId } -> >> case get_item(ItemId, LockList) of >> { acquired, Response } -> SenderPid ! { { acquired, ok >> }, Response } >> ; _ -> SenderPid ! error >> end, >> loop(State, [ ItemId | LockList ]) >> ; { SenderPid, read, ItemId } -> >> SenderPid ! { { read, ok }, get_item_readonly(ItemId) }, >> loop(State, LockList) >> ; { SenderPid, write, { ItemId, Value } } -> >> { acquired, Response } = get_item(ItemId, LockList), >> Write = write_item(ItemId, Value), >> SenderPid ! { { write, ok }, Write } >> end. >> >> Obviously I've imagined some code in get_item that checks the lock >> list before a successful acquire, etc. This solution is non blocking >> for reads, but in the event that you try and get a write (i.e, >> acquire) a locked item, the process dies with a pattern matching >> failure (based on the assumption that get_item will return an 'error' >> atom or something like that, on failure). This is hardly a solution, >> but I wanted to look at the selective receive bit. What happens if the >> process who "acquired" item X dies and doesn't notify you!? X sort of >> "goes missing,", which is hardly ideal. In your example, where the >> individual processes actually block until released, a fatal error in >> the lock owner will deadlock the system. >> >> You could always check the sender pid against your linked nodes and >> link to it if it's not already in there. Personally, I don't like this >> approach though - it all feels like a kludge. I like the idea of >> changing from a pull to a push design (mentioned earlier), as this >> whole locking multiple processes feels horrible. Think about a typical >> (Joe forgive me) OO implementation in java or some such. The number 1 >> rule is don't call into some other object while holding a lock, as >> you've no idea what might happen and you might end up deadlocked. This >> question raises the same questions for me - do I really want these >> distributed locks cropping up all over the place? If data consistency >> is really that important, then maybe we should find a better way to >> accumulate the data we need to perform a given operation. >> >> As another contrived example, I can't imagine that if in the process >> of say, selling broadband, you need to fist check the network >> inventory, then provision an engineer and finally set up a billing >> record against a customer account, that you'd want to deal with the >> locking protocol in this way. Say the network inventory and engineer >> availability rosters are in different parts of the system, which you >> need to call via some RPC (say they're not actual Erlang nodes, but >> some java application that you hit over HTTP), or maybe just in a >> database or whatever. I would've thought that the safest way to do >> this with pessimistic locking is surely to lock the whole provisioning >> activity (e.g., upon receiving the initial call) - this might entail >> exposing the provisioning process as a gen_server and performing the >> locking there (this might even happen implicitly, if you use the >> synchronous 'call' function instead of the async 'cast') or something >> like that. This is going to have a bad effect on your liveliness, >> naturally, but that's life. A course grained lock is safer, but less >> lively. A lock that doesn't deal with error conditions sounds bad >> though. >> >> Hopefully someone with a bit more experience will chime in here and >> point out the obvious to us new folk!? ...... >> >> Cheers, >> >> Tim Watson >> >> >> > ------------------------------ >> > >> > Message: 7 >> > Date: Mon, 30 Jun 2008 23:42:51 -0400 >> > From: "Edwin Fine" >> > Subject: Re: [erlang-questions] Question about message passing >> > paradigm >> > To: "Richard A. O'Keefe" >> > Cc: Mike T , erlang-questions@REDACTED >> > Message-ID: >> > <6c2563b20806302042q2605badie220bd1acb7d72b3@REDACTED> >> > Content-Type: text/plain; charset="utf-8" >> > >> > Richard, >> > >> > I'm new to Erlang and FP, and I want to learn from my mistakes or >> > misunderstandings. Please could you critique the suggestion I sent in >> > regarding this problem? The fact that nobody commented means either that >> > it >> > was (a) totally naive and not worthy of comment (or to spare my >> > feelings), >> > or (b) such a good idea that all were rendered speechless with >> > admiration. >> > Somehow the probability of (b) seems rather low. So... where did I go >> > wrong? >> > >> > Regards, >> > Edwin FIne >> > >> > On Mon, Jun 30, 2008 at 11:33 PM, Richard A. O'Keefe >> > wrote: >> > >> >> The problem we are discussing is >> >> processes B, C, D hold information X, Y, Z respectively; >> >> process A wants a coherent snapshot of X, Y,Z. >> >> >> >> There are actually two slightly different cases depending on >> >> A needs "X Y Z as of *now*" (A, B, C, and D must all >> >> synchronise), or A needs "X Y Z as of *some* time in the >> >> recent past" (B, C, and D must all synchronise but can then >> >> send the information to A without waiting for A to receive it). >> >> >> >> I like this problem because it is simple yet subtle. >> >> One way that it is subtle is that in "multithread" programming >> >> most people STILL think in terms of a single absolute time >> >> shared by all threads. (After all, there _is_ such a thing, >> >> the system clock. And yes, it's not exactly true, but it's >> >> close enough to make people _think_ it's true.) But when you >> >> start thinking about Erlang and especially *distributed* >> >> Erlang, you start realising that "now" is a pretty fuzzy >> >> concept. >> >> >> >> To me, the easiest approach to *think* was >> >> >> >> A sends "tell me X" to B, "tell me Y" to C, >> >> and "tell me Z" to D in any order, >> >> then does three receives in any order to >> >> collect the results, then >> >> sends "thanks" to B, C, and D in any order. >> >> >> >> B receives "tell me X" from A, computes X, >> >> sends "here is X" to A, then waits for >> >> "thanks" from A. >> >> >> >> C and D are just like B. >> >> >> >> This has 9 messages compared, but it is symmetric, and it is >> >> actually pretty close to the locking technique (to "lock" a >> >> process, send it a message asking it to wait, receive its >> >> acceptance, and then send it a message telling it to proceed). >> >> This extends to any number of processes E, F, G, ... and none >> >> of the processes except A has to know about any of the others. >> >> >> >> On 30 Jun 2008, at 6:45 pm, Erik Reitsma proposed a scheme >> >> that doesn't actually need any functions to be sent around >> >> (which is nice if you are doing distribution): >> >> >> >> A sends "I need X Y and Z, ask C and D for Y and Z" >> >> to B then waits. >> >> B sends "A needs Y and Z, ask D for Z, here is X" >> >> to C. B then waits for the go-ahead. >> >> C sends "A needs Z, here are X and Y" to D, >> >> then waits. >> >> D sends "here are X Y and Z" to A. >> >> If a four-way synchronisation is wanted, D waits. >> >> If a three-way is wanted, it doesn't. >> >> A receives X, Y, and Z. It sends "go ahead" to B >> >> and C (and to D if four-way is wanted). >> >> >> >> This is 7 messages if the "NOW" reading with four-way >> >> synchronisation is wanted, or 6 if the "some time in the >> >> recent past" reading with three-way synchronisation is >> >> wanted. Since B, C, and D have to be told that their >> >> information is needed and A has to receive the results, >> >> four messages are needed. >> >> >> >> Can it be done in fewer than 7 (or 6) messages? >> >> Are there other readings of the requirements that I've missed? >> >> How do/should we think about these problems? >> >> >> >> Pace Dijkstra, I'm afraid that I came up with the schemes >> >> above in a very anthropomorphic CRC-card-ish way: >> >> who knows what? >> >> who needs to know what? >> >> can the message count be reduced if I ask >> >> someone to do something for me? >> >> plus a sort of intuitive idea that >> >> to get N processes to synchronise, get all >> >> but 1 of them waiting for something >> >> >> >> There has to be a tutorial, perhaps even a textbook, waiting >> >> to be written about "how to think about messages". >> >> >> >> >> >> >> >> >> > >> > >> > -- >> > The great enemy of the truth is very often not the lie -- deliberate, >> > contrived and dishonest, but the myth, persistent, persuasive, and >> > unrealistic. Belief in myths allows the comfort of opinion without the >> > discomfort of thought. >> > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) >> > -------------- next part -------------- >> > An HTML attachment was scrubbed... >> > URL: >> > http://www.erlang.org/pipermail/erlang-questions/attachments/20080630/5455b955/attachment.html >> > >> > ------------------------------ >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > End of erlang-questions Digest, Vol 14, Issue 1 >> > *********************************************** >> > >> > > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) From notnorwegian@REDACTED Tue Jul 1 11:13:49 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 09:13:49 +0000 (GMT) Subject: [erlang-questions] .emacs file, where? Message-ID: <16792.11173.qm@web27904.mail.ukl.yahoo.com> Hi Im new to emacs. Where do I find the .emacs-file? It is not in my emacs filder and neither desktop search or google desktop search can find it. if i have to create it, where should it be placed? Best regards __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From olopierpa@REDACTED Tue Jul 1 12:27:42 2008 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Tue, 1 Jul 2008 12:27:42 +0200 Subject: [erlang-questions] .emacs file, where? In-Reply-To: <16792.11173.qm@web27904.mail.ukl.yahoo.com> References: <16792.11173.qm@web27904.mail.ukl.yahoo.com> Message-ID: <7352e43a0807010327n7a828234xe66399aa0785bc5a@mail.gmail.com> On 7/1/08, not norwegian swede wrote: > > Hi > > Im new to emacs. Where do I find the .emacs-file? > > It is not in my emacs filder and neither desktop search or google desktop > search can find it. > > if i have to create it, where should it be placed? In the directory which is the value of the environment variable HOME, i.e. - Type C-x C-f (the command find-file) - delete the proposed path - type in it's place $HOME and the enter key. You will be shown the directory where emacs expects to find the .emacs file. P. -------------- next part -------------- An HTML attachment was scrubbed... URL: From notnorwegian@REDACTED Tue Jul 1 12:10:58 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 10:10:58 +0000 (GMT) Subject: [erlang-questions] new file in emacs? Message-ID: <40345.56897.qm@web27905.mail.ukl.yahoo.com> When i want to create a new erlang-file in emacs how do i do? right now i have to open textpad, create a new file and save it and then open it through emacs because there is no way to create a new file from emacs it seems. this is really annoying. __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From notnorwegian@REDACTED Tue Jul 1 12:12:00 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 10:12:00 +0000 (GMT) Subject: [erlang-questions] new file in emacs? Message-ID: <840968.520.qm@web27901.mail.ukl.yahoo.com> When i want to create a new erlang-file in emacs how do i do? right now i have to open textpad, create a new file and save it and then open it through emacs because there is no way to create a new file from within emacs it seems. just visit new file and open file, no create new file. ___________________________________________________ S?k efter k?rleken! Hitta din tvillingsj?l p? Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Tue Jul 1 13:18:01 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 1 Jul 2008 07:18:01 -0400 Subject: [erlang-questions] .emacs file, where? In-Reply-To: <16792.11173.qm@web27904.mail.ukl.yahoo.com> References: <16792.11173.qm@web27904.mail.ukl.yahoo.com> Message-ID: <9F59ECDB-9397-41A0-A3F2-362A2EF14B69@hypotheticalabs.com> What version of Emacs (XEmacs, plain Emacs, Aquamacs, etc) are you using? What operating system are you on? We need this information to help. --Kevin On Jul 1, 2008, at 5:13 AM, not norwegian swede wrote: > Hi > > Im new to emacs. Where do I find the .emacs-file? > > It is not in my emacs filder and neither desktop search or google > desktop search can find it. > > if i have to create it, where should it be placed? > > Best regards > > S?k efter k?rleken! > Hitta din tvillingsj?l p? Yahoo! Dejting: http://se.meetic.yahoo.net > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Tue Jul 1 13:20:10 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 1 Jul 2008 13:20:10 +0200 Subject: [erlang-questions] new file in emacs? In-Reply-To: <840968.520.qm@web27901.mail.ukl.yahoo.com> References: <840968.520.qm@web27901.mail.ukl.yahoo.com> Message-ID: <14f0e3620807010420t35ad0e98ha927b6dd6e7360a1@mail.gmail.com> 1) type C-f C-f 2) type filename of the created file 3) type C-x C-s 2008/7/1 not norwegian swede : > When i want to create a new erlang-file in emacs how do i do? > right now i have to open textpad, create a new file and save it and then > open it through emacs because there is no way to create a new file from > within emacs it seems. > just visit new file and open file, no create new file. > > ________________________________ > Ta semester! - s?k efter resor hos Kelkoo. > J?mf?r pris p? flygbiljetter och hotellrum: > http://www.kelkoo.se/c-169901-resor-biljetter.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From kevin@REDACTED Tue Jul 1 13:21:10 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Tue, 1 Jul 2008 07:21:10 -0400 Subject: [erlang-questions] new file in emacs? In-Reply-To: <40345.56897.qm@web27905.mail.ukl.yahoo.com> References: <40345.56897.qm@web27905.mail.ukl.yahoo.com> Message-ID: The short answer: C-x C-f (read that as Ctrl-x Ctrl-f) The longer answer is you need to go through the Emacs tutorial. It will help you get acquainted with many of Emacs' features, including creating new files. You can start the tutorial by typing C-h t. --Kevin On Jul 1, 2008, at 6:10 AM, not norwegian swede wrote: > When i want to create a new erlang-file in emacs how do i do? > right now i have to open textpad, create a new file and save it and > then open it through emacs because there is no way to create a new > file from emacs it seems. this is really annoying. > > S?k efter k?rleken! > Hitta din tvillingsj?l p? Yahoo! Dejting: http://se.meetic.yahoo.net > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From notnorwegian@REDACTED Tue Jul 1 12:48:12 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 10:48:12 +0000 (GMT) Subject: [erlang-questions] .emacs file, where? In-Reply-To: <7352e43a0807010327n7a828234xe66399aa0785bc5a@mail.gmail.com> Message-ID: <695324.9092.qm@web27902.mail.ukl.yahoo.com> thanks i get: c:/Users/saftarn/AppData/Roaming but there is no .emacs file. should i create it then? what should it be called? c:/Users/saftarn/AppData/Roaming/.emacs ? then i put (setq load-path (cons "C:/Program Files/erl/lib/tools-/emacs" load-path)) (setq erlang-root-dir "C:/Program Files/erl") (setq exec-path (cons "C:/Program Files/erl/bin" exec-path)) (require 'erlang-start)in it? is the erlang shell then running from within emacs? --- Den tis 2008-07-01 skrev Pierpaolo Bernardi : Fr?n: Pierpaolo Bernardi ?mne: Re: [erlang-questions] .emacs file, where? Till: notnorwegian@REDACTED Kopia: erlang-questions@REDACTED Datum: tisdag 1 juli 2008 12.27 On 7/1/08, not norwegian swede wrote: Hi Im new to emacs. Where do I find the .emacs-file? It is not in my emacs filder and neither desktop search or google desktop search can find it. if i have to create it, where should it be placed? ? In the directory which is the value of the environment variable HOME, i.e. ? - Type C-x C-f (the command find-file) - delete the proposed path - type in it's place $HOME and the enter key. ? You will be shown the directory where emacs expects to find the .emacs file. ? P. ? __________________________________________________________ L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 -------------- next part -------------- An HTML attachment was scrubbed... URL: From pingu22@REDACTED Tue Jul 1 14:00:25 2008 From: pingu22@REDACTED (=?ISO-8859-1?Q?Gon=E7alo_Duarte?=) Date: Tue, 1 Jul 2008 13:00:25 +0100 Subject: [erlang-questions] Error building Erlang Message-ID: <9c1ec4f40807010500t79e16f04k49fa95fa0d347b8@mail.gmail.com> Hi, I'm trying to install Erlang in a centOS 5 but I'm getting the following errors when I run make /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+0x1ae5): 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' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x1bd): 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 `/Instalacoes/otp_src_R12B-3/lib/ssl/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/Instalacoes/otp_src_R12B-3/lib/ssl/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/Instalacoes/otp_src_R12B-3/lib/ssl' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/Instalacoes/otp_src_R12B-3/lib' make: *** [libs] Error 2 Does anyone knows what could be causing this? -- Gon?alo Duarte ----------------------- A humanidade est? a perder os seus maiores g?nios...Arist?teles faleceu... Newton bateu as botas... Einstein morreu... e eu n?o me estou a sentir l? muito bem... -------------- next part -------------- An HTML attachment was scrubbed... URL: From lemenkov@REDACTED Tue Jul 1 14:12:07 2008 From: lemenkov@REDACTED (Peter Lemenkov) Date: Tue, 1 Jul 2008 16:12:07 +0400 Subject: [erlang-questions] Error building Erlang In-Reply-To: <9c1ec4f40807010500t79e16f04k49fa95fa0d347b8@mail.gmail.com> References: <9c1ec4f40807010500t79e16f04k49fa95fa0d347b8@mail.gmail.com> Message-ID: Hello! 2008/7/1 Gon?alo Duarte : > Hi, > > I'm trying to install Erlang in a centOS 5 but I'm getting the following > errors when I run make [skipped] > Does anyone knows what could be causing this? krb5-devel is missing. BTW why you decided to rebuild erlang by yourself instead of using one from EPEL-repository? You need R12B-x? -- With best regards! From richardc@REDACTED Tue Jul 1 14:30:22 2008 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 01 Jul 2008 14:30:22 +0200 Subject: [erlang-questions] new file in emacs? In-Reply-To: <40345.56897.qm@web27905.mail.ukl.yahoo.com> References: <40345.56897.qm@web27905.mail.ukl.yahoo.com> Message-ID: <486A235E.50505@it.uu.se> not norwegian swede wrote: > When i want to create a new erlang-file in emacs how do i do? > right now i have to open textpad, create a new file and save it and then > open it through emacs because there is no way to create a new file from > emacs it seems. this is really annoying. C-x C-f creates a new buffer (if it does not already exist) for editing a file (Emacs will ask for the file name). The file does not have to exist already. After editing, you just do C-x C-s to save. If you already have a buffer that you have written text into (eg., the "*scratch*" buffer), you can do C-x C-w to save it. /Richard From ulf@REDACTED Tue Jul 1 14:44:21 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 1 Jul 2008 14:44:21 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 13, Issue 126 In-Reply-To: <8f24f4b10806301605r2ac7e6d9jaa7d4be6a4c362a1@mail.gmail.com> References: <8f24f4b10806301605r2ac7e6d9jaa7d4be6a4c362a1@mail.gmail.com> Message-ID: <8209f740807010544k18e32bd0tc30698012a538dd6@mail.gmail.com> 2008/7/1 John Haugeland : >> We (collectively) promised to help Alexander - I promised to provide him >> with a >> rendering engine (in Erlang) for the wikipedia markup language. >> >> Before I start hacking has anybody done this before? > > You're going to find this an extremely hard sell - I ran the idea past the > Wikipedians almost two years ago, with a semi-functional proof of concept, > and was basically booed out of the IRC channel on grounds that erlang/mnesia > don't have the kind of penetration that PHP/mysql do. But surely, as a Wiki user, I couldn't care less what language is used to convert my wikitext to HTML? If there were a wikipedia-compatible wiki library available to the Erlang programmer, I could imagine all sorts of situations where wikitext could be embedded. Since wikipedia has become ubiquitous, writing a wikitext parsing library in any language ought to be fairly risk free - I don't envision any major changes in either syntax or display semantics. BR, Ulf W From notnorwegian@REDACTED Tue Jul 1 13:54:23 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 11:54:23 +0000 (GMT) Subject: [erlang-questions] .emacs file, where? In-Reply-To: <486A1965.1090209@kplusk.com> Message-ID: <423851.2344.qm@web27908.mail.ukl.yahoo.com> what do you mean with: the path "~/.emacs" ?c:/Users/saftarn/AppData/Roaming/ ? thats what i get when i ask where $home is. so should i have a file c:/Users/saftarn/AppData/Roaming/.emacs exactly like that? in Roaming I have a folder ".emacs.d", it shouldnt be placed in there? --- Den tis 2008-07-01 skrev Peter Donner : Fr?n: Peter Donner ?mne: Re: [erlang-questions] .emacs file, where? Till: notnorwegian@REDACTED Datum: tisdag 1 juli 2008 13.47 not norwegian swede schrieb: > Hi > > Im new to emacs. Where do I find the .emacs-file? > > It is not in my emacs filder and neither desktop search or google desktop search can find it. > > if i have to create it, where should it be placed? > > Best regards > Hit C-x - C-f and then enter the path "~/.emacs" then you're in the right location (C-x C-s to save). The file doesn't exist in a fresh Emacs install, it has to be created in your Home-Directory. Have fun with Emacs :-) -- Peter __________________________________________________________ L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 -------------- next part -------------- An HTML attachment was scrubbed... URL: From circularfunc@REDACTED Tue Jul 1 14:31:22 2008 From: circularfunc@REDACTED (Circular Function) Date: Tue, 1 Jul 2008 12:31:22 +0000 (GMT) Subject: [erlang-questions] what does when do here? fib(1200000) so slow, erlang cant handle big numbers? Message-ID: <138792.71516.qm@web28314.mail.ukl.yahoo.com> what does when N>0 do here? seems like no difference. and would you consider this good idiomatic erlang(ofc there is an even faster one that i found, posted at the end)? also, this is linear right? so why does fib(1200000) never finsih? erlang cant handle such big numbers? because 12000 is pretty much instant and 120000 takes a second or so. fib_i(A, _B, 0) -> A; fib_i(A, B, N) when N > 0 -> fib_i(B, A + B, N - 1). fib(N) -> fib_i(0, 1, N). fib_i(A, _B, 0) -> A; fib_i(A, B, N)? -> fib_i(B, A + B, N - 1). fib(N) -> fib_i(0, 1, N). fibo3(0, _, Pair) -> Pair; fibo3(N, {Fib1, Fib2}, Pair) when N rem 2 == 0 -> ??? SquareFib1 = Fib1*Fib1, ??? fibo3(N div 2, {2*Fib1*Fib2 - SquareFib1, SquareFib1 + Fib2*Fib2}, Pair); fibo3(N, {FibA1, FibA2}=Pair, {FibB1, FibB2}) -> ??? fibo3(N-1, Pair, {FibA1*FibB2 + FibB1*(FibA2 - FibA1), FibA1*FibB1 + FibA2*FibB2}). __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From notnorwegian@REDACTED Tue Jul 1 14:07:28 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 12:07:28 +0000 (GMT) Subject: [erlang-questions] .emacs file, where? In-Reply-To: <486A1BC6.2070203@kplusk.com> Message-ID: <124978.65914.qm@web27907.mail.ukl.yahoo.com> ok i get an error after copying exaclty what is on this link: http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html is there anysignificance to this: `c:/Users/saftarn/AppData/Roaming/.emacs': the backquote and then normal one. i use " " just like in the example(just copied it obv). and how do i start with --debug-init? ("C:\\emacs-22.2\\bin\\emacs.exe") Loading encoded-kb...done An error has occurred while loading `c:/Users/saftarn/AppData/Roaming/.emacs': File error: Cannot open load file, erlang-start To ensure normal operation, you should investigate and remove the cause of the error in your initialization file.? Start Emacs with the `--debug-init' option to view a complete error backtrace. For information about GNU Emacs and the GNU system, type C-h C-a. --- Den tis 2008-07-01 skrev Peter Donner : Fr?n: Peter Donner ?mne: Re: [erlang-questions] .emacs file, where? Till: notnorwegian@REDACTED Kopia: erlang-questions@REDACTED Datum: tisdag 1 juli 2008 13.57 not norwegian swede schrieb: > what do you mean with: > the path "~/.emacs" ?c:/Users/saftarn/AppData/Roaming/ Yes, '~' ist the short version for your home directory. The long path is: c:/Users/saftarn/AppData/Roaming/.emacs -- Peter __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From circularfunc@REDACTED Tue Jul 1 14:40:50 2008 From: circularfunc@REDACTED (Circular Function) Date: Tue, 1 Jul 2008 12:40:50 +0000 (GMT) Subject: [erlang-questions] compile buffer, cant execute func in emacs shell Message-ID: <874707.54841.qm@web28305.mail.ukl.yahoo.com> Eshell V5.6.2? (abort with ^G) 1> fibo(12). ** exception error: undefined function shell_default:fibo/1 2> fibonacci:fibo(12). ** exception error: undefined function fibonacci:fibo/1 3> this works in the shell so there is nothing wrong with the function. if i compile a buffer in emacs with erlangmode it starts the repl/shell but i cant seem to access the functions in the file. -module(fibonacci). -export([fib/1,fibo/1, fibo2/1, fibo3/1]). fib_i(A, _B, 0) -> A; fib_i(A, B, N) when N > 0 -> fib_i(B, A + B, N - 1). fib(N) -> fib_i(0, 1, N). fibo(0) -> 0 ; fibo(1) -> 1 ; fibo(N) when N > 0 -> fibo(N-1) + fibo(N-2) . fibo2_tr( 0, Result, _Next) -> Result ;? %% last recursion output fibo2_tr( Iter, Result, Next) when Iter > 0 -> fibo2_tr( Iter -1, Next, Result + Next) . fibo2( N) -> fibo2_tr( N, 0, 1) . fibo3(N) -> ??? {Fib, _} = fibo3(N, {1, 1}, {0, 1}), ??? Fib. fibo3(0, _, Pair) -> Pair; fibo3(N, {Fib1, Fib2}, Pair) when N rem 2 == 0 -> ??? SquareFib1 = Fib1*Fib1, ??? fibo3(N div 2, {2*Fib1*Fib2 - SquareFib1, SquareFib1 + Fib2*Fib2}, Pair); fibo3(N, {FibA1, FibA2}=Pair, {FibB1, FibB2}) -> ??? fibo3(N-1, Pair, {FibA1*FibB2 + FibB1*(FibA2 - FibA1), FibA1*FibB1 + FibA2*FibB2}). ___________________________________________________ S?k efter k?rleken! Hitta din tvillingsj?l p? Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 -------------- next part -------------- An HTML attachment was scrubbed... URL: From p.donner@REDACTED Tue Jul 1 13:57:58 2008 From: p.donner@REDACTED (Peter Donner) Date: Tue, 01 Jul 2008 13:57:58 +0200 Subject: [erlang-questions] .emacs file, where? In-Reply-To: <423851.2344.qm@web27908.mail.ukl.yahoo.com> References: <423851.2344.qm@web27908.mail.ukl.yahoo.com> Message-ID: <486A1BC6.2070203@kplusk.com> not norwegian swede schrieb: > what do you mean with: > the path "~/.emacs" ?c:/Users/saftarn/AppData/Roaming/ Yes, '~' ist the short version for your home directory. The long path is: c:/Users/saftarn/AppData/Roaming/.emacs -- Peter From tty.erlang@REDACTED Tue Jul 1 15:23:08 2008 From: tty.erlang@REDACTED (t ty) Date: Tue, 1 Jul 2008 09:23:08 -0400 Subject: [erlang-questions] what does when do here? fib(1200000) so slow, erlang cant handle big numbers? In-Reply-To: <138792.71516.qm@web28314.mail.ukl.yahoo.com> References: <138792.71516.qm@web28314.mail.ukl.yahoo.com> Message-ID: <290b3ba10807010623ye23c6b0jc0fd04b930e3433a@mail.gmail.com> What would happen if you didn't have the 'when N > 0' and you call using fib(-1) ? 2008/7/1 Circular Function : > what does when N>0 do here? seems like no difference. > and would you consider this good idiomatic erlang(ofc there is an even > faster one that i found, posted at the end)? > From pingu22@REDACTED Tue Jul 1 15:38:20 2008 From: pingu22@REDACTED (=?ISO-8859-1?Q?Gon=E7alo_Duarte?=) Date: Tue, 1 Jul 2008 14:38:20 +0100 Subject: [erlang-questions] Error building Erlang In-Reply-To: References: <9c1ec4f40807010500t79e16f04k49fa95fa0d347b8@mail.gmail.com> Message-ID: <9c1ec4f40807010638l6c13585fvb8e8a0fb8673ad2e@mail.gmail.com> 2008/7/1 Peter Lemenkov : > Hello! > > 2008/7/1 Gon?alo Duarte : > > Hi, > > > > I'm trying to install Erlang in a centOS 5 but I'm getting the following > > errors when I run make > > [skipped] > > > Does anyone knows what could be causing this? > > krb5-devel is missing. > > BTW why you decided to rebuild erlang by yourself instead of using one > from EPEL-repository? You need R12B-x? > -- > With best regards! > I don't know if I need R12B-x... I'm installing ejabberd from source and it needs erlang so I downloaded that version. Do I need that? Thanks. -- Gon?alo Duarte ----------------------- A humanidade est? a perder os seus maiores g?nios...Arist?teles faleceu... Newton bateu as botas... Einstein morreu... e eu n?o me estou a sentir l? muito bem... -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Tue Jul 1 15:38:59 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 1 Jul 2008 09:38:59 -0400 Subject: [erlang-questions] what does when do here? fib(1200000) so slow, erlang cant handle big numbers? In-Reply-To: <138792.71516.qm@web28314.mail.ukl.yahoo.com> References: <138792.71516.qm@web28314.mail.ukl.yahoo.com> Message-ID: <6c2563b20807010638w15ec2624sffe6c77ad6591f78@mail.gmail.com> It finishes on my system in 46 seconds. It produces a number that is 250785 digits long. That's a humungous, massive, mind-bogglingly large number. A googol (10^100) only has 100 digits. This is 2500x the size of a googol. I would *guess* that although the *algorithm* is linear, you are hitting a non-linearity in the large number representation in Erlang, maybe due to GC or memory growth. I dunno. I mean, you are adding together two massive numbers over and over towards the end. The N > 0 prevents infinite recursion if you call fib(-1). 2008/7/1 Circular Function : > what does when N>0 do here? seems like no difference. > and would you consider this good idiomatic erlang(ofc there is an even > faster one that i found, posted at the end)? > > also, this is linear right? so why does fib(1200000) never finsih? erlang > cant handle such big numbers? because 12000 is pretty much instant and > 120000 takes a second or so. > > fib_i(A, _B, 0) -> A; > fib_i(A, B, N) when N > 0 -> fib_i(B, A + B, N - 1). > fib(N) -> fib_i(0, 1, N). > > fib_i(A, _B, 0) -> A; > fib_i(A, B, N) -> fib_i(B, A + B, N - 1). > fib(N) -> fib_i(0, 1, N). > > > > > > > fibo3(0, _, Pair) -> Pair; > fibo3(N, {Fib1, Fib2}, Pair) when N rem 2 == 0 -> > SquareFib1 = Fib1*Fib1, > fibo3(N div 2, {2*Fib1*Fib2 - SquareFib1, SquareFib1 + Fib2*Fib2}, > Pair); > fibo3(N, {FibA1, FibA2}=Pair, {FibB1, FibB2}) -> > fibo3(N-1, Pair, {FibA1*FibB2 + FibB1*(FibA2 - FibA1), FibA1*FibB1 + > FibA2*FibB2}). > ------------------------------ > Ta semester! - s?k efter resor hos Kelkoo. > J?mf?r pris p? flygbiljetter och hotellrum: > http://www.kelkoo.se/c-169901-resor-biljetter.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pingu22@REDACTED Tue Jul 1 16:03:34 2008 From: pingu22@REDACTED (=?ISO-8859-1?Q?Gon=E7alo_Duarte?=) Date: Tue, 1 Jul 2008 15:03:34 +0100 Subject: [erlang-questions] Error building Erlang In-Reply-To: References: <9c1ec4f40807010500t79e16f04k49fa95fa0d347b8@mail.gmail.com> Message-ID: <9c1ec4f40807010703s29d9587cp19fded546557ebb1@mail.gmail.com> Thank you. I got it from EPEL-repository. 2008/7/1 Peter Lemenkov : > Hello! > > 2008/7/1 Gon?alo Duarte : > > Hi, > > > > I'm trying to install Erlang in a centOS 5 but I'm getting the following > > errors when I run make > > [skipped] > > > Does anyone knows what could be causing this? > > krb5-devel is missing. > > BTW why you decided to rebuild erlang by yourself instead of using one > from EPEL-repository? You need R12B-x? > -- > With best regards! > -- Gon?alo Duarte ----------------------- A humanidade est? a perder os seus maiores g?nios...Arist?teles faleceu... Newton bateu as botas... Einstein morreu... e eu n?o me estou a sentir l? muito bem... -------------- next part -------------- An HTML attachment was scrubbed... URL: From alpar@REDACTED Tue Jul 1 15:42:43 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Tue, 01 Jul 2008 14:42:43 +0100 Subject: [erlang-questions] what does when do here? fib(1200000) so slow, erlang cant handle big numbers? In-Reply-To: <138792.71516.qm@web28314.mail.ukl.yahoo.com> References: <138792.71516.qm@web28314.mail.ukl.yahoo.com> Message-ID: <1214919763.13909.9.camel@piko.site> On my computer fib(1200000) finishes correctly in around 100 seconds. Remember, that Fibonacci calculation is not linear because you must do linear number of operations, but on huge numbers. So your algorithm is in fact O(n^2), therefore you should expect 100 times higher running time for a 10 times bigger input. Regards, Alpar On Tue, 2008-07-01 at 12:31 +0000, Circular Function wrote: > what does when N>0 do here? seems like no difference. > and would you consider this good idiomatic erlang(ofc there is an even > faster one that i found, posted at the end)? > > also, this is linear right? so why does fib(1200000) never finsih? > erlang cant handle such big numbers? because 12000 is pretty much > instant and 120000 takes a second or so. > > fib_i(A, _B, 0) -> A; > fib_i(A, B, N) when N > 0 -> fib_i(B, A + B, N - 1). > fib(N) -> fib_i(0, 1, N). > > fib_i(A, _B, 0) -> A; > fib_i(A, B, N) -> fib_i(B, A + B, N - 1). > fib(N) -> fib_i(0, 1, N). From jesper.louis.andersen@REDACTED Tue Jul 1 16:06:55 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 1 Jul 2008 16:06:55 +0200 Subject: [erlang-questions] what does when do here? fib(1200000) so slow, erlang cant handle big numbers? In-Reply-To: <6c2563b20807010638w15ec2624sffe6c77ad6591f78@mail.gmail.com> References: <138792.71516.qm@web28314.mail.ukl.yahoo.com> <6c2563b20807010638w15ec2624sffe6c77ad6591f78@mail.gmail.com> Message-ID: <56a0a2840807010706o1298d249w9e951dd457a2adb1@mail.gmail.com> 2008/7/1 Edwin Fine : >The N > 0 prevents infinite recursion if you call fib(-1). It is much more powerful than that, as it also fails calls like fib(0.5) though it does so after a considerable amount of time. One could imagine moving the guard to the fib/1 call rather than having it on fib_i/3 with the possibility that the VM has to check it each time (I don't know what the VM does here, specifically). A check on is_integer/1 could eliminate the wait time as well. From notnorwegian@REDACTED Tue Jul 1 15:21:16 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Tue, 1 Jul 2008 13:21:16 +0000 (GMT) Subject: [erlang-questions] split windows side by side in emacs? Message-ID: <804848.70667.qm@web27903.mail.ukl.yahoo.com> how can i split windows side by side in emacs? not like this: buffer --------- buffer but: b | b u | u f? | f f? | f e | e r? | r and c-x c-f is find file for me in windows. how do i create anew one? __________________________________________________________ Ta semester! - s?k efter resor hos Kelkoo. J?mf?r pris p? flygbiljetter och hotellrum h?r: http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914052 -------------- next part -------------- An HTML attachment was scrubbed... URL: From stonecypher@REDACTED Tue Jul 1 16:22:57 2008 From: stonecypher@REDACTED (John Haugeland) Date: Tue, 1 Jul 2008 08:22:57 -0600 Subject: [erlang-questions] erlang-questions Digest, Vol 13, Issue 126 In-Reply-To: <8209f740807010544k18e32bd0tc30698012a538dd6@mail.gmail.com> References: <8f24f4b10806301605r2ac7e6d9jaa7d4be6a4c362a1@mail.gmail.com> <8209f740807010544k18e32bd0tc30698012a538dd6@mail.gmail.com> Message-ID: <8f24f4b10807010722t5c7ad6f8o38106ca0d800c066@mail.gmail.com> > > > You're going to find this an extremely hard sell - I ran the idea past > the > > Wikipedians almost two years ago, with a semi-functional proof of > concept, > > and was basically booed out of the IRC channel on grounds that > erlang/mnesia > > don't have the kind of penetration that PHP/mysql do. > > But surely, as a Wiki user, I couldn't care less what language is used > to convert my wikitext to HTML? The users don't make technical decisions. In context the discussion was of a wikipedia that scaled; that said (to me, maybe inappropriately) that they wanted to replace the real backend. Unfortunately, the wikipedia backend is maintained by people who have a very hard time considering new technologies, no matter what the value. > If there were a wikipedia-compatible wiki library available > to the Erlang programmer, I could imagine all sorts of situations where > wikitext > could be embedded. > I find this very curious. Discounting maintaining actual wikipedia, for what would you use a wikitext parsing library? (Sorry for the double send, Mr. Wiger, the first one wasn't meant to go to you personally alone.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From juanjo@REDACTED Tue Jul 1 16:36:47 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 1 Jul 2008 11:36:47 -0300 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> Message-ID: <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> An does anybody know what would it take to make this feature official/supported? It is really useful in some cases. On Sun, Jun 29, 2008 at 6:34 PM, Ulf Wiger wrote: > That's an example of parameterized modules, which is an experimental > and unsupported feature in Erlang. > > > http://www.planeterlang.org/story.php?title=The_black_art_of_Erlangs_parameterized_modules > http://www.erlang.se/workshop/2003/paper/p29-carlsson.pdf > > BR, > Ulf W > > 2008/6/29 Tom Ayerst : > > Is was looking at the mochiweb code and I saw some oddities. > > > > firstly the module statement: > > -module(mochiweb_request, [Socket, Method, RawPath, Version, Headers]). > > > > In the use of mochiweb I can see things like Req:get(method). > > > > This looks more like an object method call, is this new? I cannot see an > > docs about it. > > > > Thanks for any info. > > > > Tom Ayerst > > > > In the example Req ={mochiweb_request,#Port<0.142>,'GET', > > "/", > > {1,1}, > > {9, > > {"host", > > {'Host',"127.0.0.1:8888"}, > > {"accept", > > {'Accept', > > > > "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, > > nil, > > {"accept-language", > > {'Accept-Language', > > "en-gb,en;q=0.5"}, > > {"accept-encoding", > > {'Accept-Encoding', > > "gzip,deflate"}, > > {"accept-charset", > > {'Accept-Charset', > > > > "ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, > > nil,nil}, > > nil}, > > {"connection", > > > {'Connection',"keep-alive"}, > > {"cache-control", > > > > {'Cache-Control',"max-age=0"}, > > nil,nil}, > > nil}}}, > > {"user-agent", > > {'User-Agent', > > "Mozilla/5.0 (Windows; U; > > Windows NT 6.0; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0"}, > > {"keep-alive", > > {'Keep-Alive',"300"}, > > nil,nil}, > > nil}}}} > > > > _______________________________________________ > > 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 raimo+erlang-questions@REDACTED Tue Jul 1 16:45:31 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 1 Jul 2008 16:45:31 +0200 Subject: [erlang-questions] split windows side by side in emacs? In-Reply-To: <804848.70667.qm@web27903.mail.ukl.yahoo.com> References: <804848.70667.qm@web27903.mail.ukl.yahoo.com> Message-ID: <20080701144531.GC8043@erix.ericsson.se> On Tue, Jul 01, 2008 at 01:21:16PM +0000, not norwegian swede wrote: > how can i split windows side by side in emacs? Try C-h b then change buffer an search for "window" with C-s w i n d o w C-s C-s ... Or even C-h ? then b And the answer is: C-x 3 Try these also: C-x 2 C-x 1 C-x 3 C-x 0 > > not like this: > > buffer > > --------- > > buffer > > > > but: > > b | b > > u | u > > f? | f > > f? | f > > e | e > > r? | r > > > > and c-x c-f is find file for me in windows. how do i create anew one? > > > > > __________________________________________________________ > Ta semester! - s?k efter resor hos Kelkoo. > J?mf?r pris p? flygbiljetter och hotellrum h?r: > http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914052 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From chsu79@REDACTED Tue Jul 1 16:59:40 2008 From: chsu79@REDACTED (Christian S) Date: Tue, 1 Jul 2008 16:59:40 +0200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> Message-ID: 2008/7/1 Juan Jose Comellas : > An does anybody know what would it take to make this feature > official/supported? It is really useful in some cases. Can you provide examples of how it is useful? From patrickdlogan@REDACTED Tue Jul 1 17:03:54 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Tue, 1 Jul 2008 08:03:54 -0700 Subject: [erlang-questions] Question about message passing paradigm Message-ID: Responding to a thread on the erlang-questions list... Begin quote================================= The problem we are discussing is processes B, C, D hold information X, Y, Z respectively; process A wants a coherent snapshot of X, Y,Z. There are actually two slightly different cases depending on A needs "X Y Z as of *now*" (A, B, C, and D must all synchronise), or A needs "X Y Z as of *some* time in the recent past" (B, C, and D must all synchronise but can then send the information to A without waiting for A to receive it). I like this problem because it is simple yet subtle. One way that it is subtle is that in "multithread" programming most people STILL think in terms of a single absolute time shared by all threads. (After all, there _is_ such a thing, the system clock. And yes, it's not exactly true, but it's close enough to make people _think_ it's true.) But when you start thinking about Erlang and especially *distributed* Erlang, you start realising that "now" is a pretty fuzzy concept. End quote=================================== Yes, the problem seems simple yet subtle. The downside is there are many unwritten constraints (or not) on any specific problem that could lead the solution alternatives one way or another. Unless you want to really dig into those, then the cost/benefit of one solution or another could be more or less off. e.g. why not coordinate through an in-memory database? This could be reasonable, or not. We don't know enough. Why not schedule the source processes to send a message on a periodic or scheduled basis? This could be reasonable, or not, and cut down the message traffic, which seemed to be a concern. Why is sending fewer than N messages a concern? Why does one process have to collect the information? How much information? How tight is the deadline? Is "now" an actual timestamp or just some unknown point in time that a request has been received? How close to "now" do the other "nows" have to be with respect to each other? Can you widen that window if it would decrease the effort to build? If synchronization across the processes is needed then is an "eventually consistent" approach reasonable if it lowers the effort to build? Interesting stuff, but challenging to talk about in when the details are too abstract. From patrickdlogan@REDACTED Tue Jul 1 17:24:26 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Tue, 1 Jul 2008 08:24:26 -0700 Subject: [erlang-questions] split windows side by side in emacs? Message-ID: "how can i split windows side by side in emacs?" c-x 3 (obviously! :-) Actually the way to find this is to run the "apropos" command... c-h a And then type in "split" or something and it will tell you the command "split-window-horizontally" is bound to the c-x 3 key combination. "and c-x c-f is find file for me in windows. how do i create anew one?" Not sure what you want, but c-x 4 f is bound to find-file-other-window. From tuncer.ayaz@REDACTED Tue Jul 1 18:47:37 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 1 Jul 2008 18:47:37 +0200 Subject: [erlang-questions] split windows side by side in emacs? In-Reply-To: <20080701144531.GC8043@erix.ericsson.se> References: <804848.70667.qm@web27903.mail.ukl.yahoo.com> <20080701144531.GC8043@erix.ericsson.se> Message-ID: <4ac8254d0807010947v2ebc0530we2672aa685f99298@mail.gmail.com> On Tue, Jul 1, 2008 at 4:45 PM, Raimo Niskanen wrote: > On Tue, Jul 01, 2008 at 01:21:16PM +0000, not norwegian swede wrote: >> how can i split windows side by side in emacs? > > Try C-h b > then change buffer an search for "window" with > C-s w i n d o w C-s C-s ... > > Or even C-h ? then b > > And the answer is: C-x 3 > > Try these also: > C-x 2 > C-x 1 > C-x 3 > C-x 0 I don't want erlang-questions to be an Emacs Help channel but as many voices are already active in this discussion I might chime in with mentioning that if you use split buffers/windows it's cool to set some bindings for easily navigating up/down/left/right: (windmove-default-keybindings 'meta) (global-set-key [M-left] 'windmove-left) ; move to left windnow (global-set-key [M-right] 'windmove-right) ; move to right window (global-set-key [M-up] 'windmove-up) ; move to upper window (global-set-key [M-down] 'windmove-down) ; move to downer window the bound keys might of course not suit everyone's settings depending on what else one has configured. >> >> not like this: >> >> buffer >> >> --------- >> >> buffer >> >> >> >> but: >> >> b | b >> >> u | u >> >> f | f >> >> f | f >> >> e | e >> >> r | r >> >> >> >> and c-x c-f is find file for me in windows. how do i create anew one? >> >> >> >> >> __________________________________________________________ >> Ta semester! - s?k efter resor hos Kelkoo. >> J?mf?r pris p? flygbiljetter och hotellrum h?r: >> http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914052 >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Tue Jul 1 19:33:54 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Jul 2008 10:33:54 -0700 (PDT) Subject: [erlang-questions] split windows side by side in emacs? In-Reply-To: <804848.70667.qm@web27903.mail.ukl.yahoo.com> Message-ID: <871520.82099.qm@web38801.mail.mud.yahoo.com> M-x apropos "split window" M-x split-window-horizontally This is getting a bit beyond the scope of this mailing list, isn't it? Perhaps there is a more appropriate forum. Best, Thomas --- On Tue, 7/1/08, not norwegian swede wrote: > From: not norwegian swede > Subject: [erlang-questions] split windows side by side in emacs? > To: erlang-questions@REDACTED > Date: Tuesday, July 1, 2008, 3:21 PM > how can i split windows side by side in emacs? > > not like this: > > buffer > > --------- > > buffer > > > > but: > > b | b > > u | u > > f? | f > > f? | f > > e | e > > r? | r > > > > and c-x c-f is find file for me in windows. how do i create > anew one? > > > > > > __________________________________________________________ > Ta semester! - s?k efter resor hos Kelkoo. > J?mf?r pris p? flygbiljetter och hotellrum h?r: > http://www.kelkoo.se/c-169901-resor-biljetter.html?partnerId=96914052_______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From fess-erlang@REDACTED Tue Jul 1 19:46:53 2008 From: fess-erlang@REDACTED (fess) Date: Tue, 1 Jul 2008 10:46:53 -0700 Subject: [erlang-questions] split windows side by side in emacs? In-Reply-To: <871520.82099.qm@web38801.mail.mud.yahoo.com> References: <871520.82099.qm@web38801.mail.mud.yahoo.com> Message-ID: <1449D9E4-7B38-423D-817C-4A82F3DC2CE7@fess.org> On Jul 1, 2008, at 10:33 AM, Thomas Lindgren wrote: > This is getting a bit beyond the scope of this mailing list, isn't > it? Perhaps there is a more appropriate forum. oh, I was thinking, it's a good thing that emacs is the official IDE of erlang, otherwise someone might consider this thread off topic. *grin* :w :q --fess From anupam.kapoor@REDACTED Tue Jul 1 19:54:06 2008 From: anupam.kapoor@REDACTED (Anupam Kapoor) Date: Tue, 1 Jul 2008 23:24:06 +0530 Subject: [erlang-questions] re moving nth element from a list In-Reply-To: <6B7EE60C-C5F2-49AE-BDE1-EB88EA5FC0EB@cs.otago.ac.nz> References: <18092530.post@talk.nabble.com> <5FDA9E63-CCAA-4BA3-BC87-576DF2DE324C@cs.otago.ac.nz> <87skv283tb.fsf@seldon.divitas.com> <87y74t93hi.fsf@seldon.divitas.com> <6B7EE60C-C5F2-49AE-BDE1-EB88EA5FC0EB@cs.otago.ac.nz> Message-ID: On Thu, Jun 26, 2008 at 9:36 AM, Richard A. O'Keefe wrote: > > On 25 Jun 2008, at 11:08 pm, Anupam Kapoor wrote: >> >> ,---- >> | Eh? The vector cross product is only defined for 3-dimensional space, >> `---- >> it is defined for n-dimensional vectors too. > > WEDGE product is defined for n-dimensional vectors > (basically the antisymmetric part of the tensor product), > but CROSS product is not. but does'nt grassmann algebra extend the canonical cross-product to R^n ? > Since this is the operation you wanted 'remove the kth element > from a list' for, what exactly is it that you are calling a > cross product? ^^^^^^^ well, the way i have it implemented is to remove the i'th element from the vector, take an appropriately formed product of the remaining elements and repeat. sorry for the late reply, i was kind of busy moving to a new place. kind regards anupam -- In the beginning was the lambda, and the lambda was with Emacs, and Emacs was the lambda. From thomasl_erlang@REDACTED Tue Jul 1 20:25:50 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Jul 2008 11:25:50 -0700 (PDT) Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18529.883.586609.71953@hamberg.it.uu.se> Message-ID: <742534.21229.qm@web38801.mail.mud.yahoo.com> --- On Tue, 6/24/08, Sven-Olof Nystr|m wrote: > From: Sven-Olof Nystr|m > Subject: [erlang-questions] Ideas for a new Erlang > To: erlang-questions@REDACTED > Date: Tuesday, June 24, 2008, 4:23 PM > Hello everyone, > > I have written down some thoughts and ideas on the future > development > of Erlang. > > Main topics: > > - some notes on implementation and backward compatibility > > - an alternative to Erlang's selective receive > > - a simple language mechanism to allow function in-lining > across > module boundaries > > - a new mechanism for introducing local variables with a > more cleanly > defined semantics > > - a mini-language to allow the efficent implementation of > low-level > algorithms A quick, possibly shallow, read of your proposals. Selective receive and channels: There seem to be two arguments against selective receive. First, that it is hard to understand. That's not my experience. Also, as I recall, Concurrent ML and its channels yielded some horribly convoluted examples when trying to write POTS. Thus, such gains from channels seem quite unclear to me. Second, that selective receive can be inefficient. But is it _inherently_ inefficient, or just suffering from a lack of attention to some cases? Could better implementation techniques solve this? (Regarding channels: changing how receive works seems so fundamental that the path of least resistance might be to just switch to Concurrent ML.) Linked modules: a difficult issue in practice. I have thought about how to do this in the context of optimization for quite some time, but one should note that hot code loading is a feature that trumps quite a lot of others in practice. Also, what do we really mean when we write "-linked_module(m)."? To what does 'm' refer, for example? (I'll happily agree that records are an abomination.) Variable bindings: these currently leave something to be desired -- computing what variables are bound or used and when they stop living in a function is far too messy. But I'm not convinced that the idea of either exporting expression values or bindings is what we need. A number of features of Erlang have been introduced pell-mell and then could never be retracted (records; three nearly-identical sorts of guard operators; two identical forms of guards, etc). A fresh version of Erlang would do well in pruning back a lot of these and just putting back the ones with a point. (The next erlang might first of all have a nice, preinstalled way of revising the language :-) Finally, the discussion needs some compelling examples. Would we really get substantially better code over what we have today? Demonstrate. Best, Thomas PS. As an aside, Dr Nystr|m, isn't it time to join the age of unicode? :-) From toby@REDACTED Tue Jul 1 20:54:20 2008 From: toby@REDACTED (Toby Thain) Date: Tue, 1 Jul 2008 15:54:20 -0300 Subject: [erlang-questions] wkipedia rendering engine In-Reply-To: <9b08084c0806300358h2478968cie3566ca7f7c99e59@mail.gmail.com> References: <9b08084c0806300239t59378f45nded85601087358d6@mail.gmail.com> <6faf39c90806300338x5a7b9c20ha77ca939559196ea@mail.gmail.com> <9b08084c0806300358h2478968cie3566ca7f7c99e59@mail.gmail.com> Message-ID: <02A29444-256C-491F-95DB-6CF1D866474F@telegraphics.com.au> On 30-Jun-08, at 7:58 AM, Joe Armstrong wrote: > On Mon, Jun 30, 2008 at 12:38 PM, Andre Engels > wrote: >> On Mon, Jun 30, 2008 at 11:39 AM, Joe Armstrong >> wrote: >> >>> We (collectively) promised to help Alexander - I promised to >>> provide him with a >>> rendering engine (in Erlang) for the wikipedia markup language. >>> > > Thanks - I didn't know the name of the format - seems like the > processof parsing is > reasonably easy -- see > > http://www.mediawiki.org/wiki/Markup_spec#The_Markup_Language > > > It seems pretty amazing that there is no formal specifiation of the > grammar of the markup language and that this > is decided *after* there are a few quadzillion pages of markup > text :-) Not only that, there are now a quadzillion wiki markup languages, all flawed in one way or another... ONE DAY there will be a standard. --Toby > > /J > >>> Before I start hacking has anybody done this before? >> >> What exactly do you mean by a 'rendering engine'? Translating the >> markup language (its name is Mediawiki, by the way) to something >> else? >> >> It's not a trivial task you have set yourself. There are some >> elements >> that are quite complex, for example the fact that '' is italics and >> ''' is bold. Notice the difference between: >> >> '''this is bold''' >> >> '''this is italic, starting with a ' '' >> >> '''this is bold '' and this part italic as well ''''' >> >> Also deciding on what point of the analysis to expand {{templates}} >> can lead the same code to get very different results. >> >> -- >> Andre Engels, andreengels@REDACTED >> ICQ: 6260644 -- Skype: a_engels >> > > > > -- > fra@REDACTED; ingvar.akesson@REDACTED > > [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. > De vill ju ?nd? l?sa min e-post.] > > [A copy of this mail has been sent to > FRA for monitoring purposes. FRA wants to read all my e-mail and have > been allowed to do by the Swedish parliment - in violation of article > 12 of the UN Universal Declaration of Human Rights] > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From klacke@REDACTED Tue Jul 1 22:20:36 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 01 Jul 2008 22:20:36 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <485B0E06.8080804@lionet.info> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> Message-ID: <486A9194.4020804@hyber.org> Lev Walkin wrote: > Second, you can create a linked-in driver which sends a message > back to a corresponding server. This allows you to intercept signals > directly instead of relying on some external notificator. > Mind you not in the signalhandler though - that will break major havoc with the runtime. There is no good way as far as I know to have a sighandler in Erlang. Only possible solution I see is to 1. Have a socket setup from the driver to the beam (over loopback) 2. in the sighandler write some data on the socket. /klacke From vlm@REDACTED Tue Jul 1 22:44:52 2008 From: vlm@REDACTED (Lev Walkin) Date: Tue, 01 Jul 2008 13:44:52 -0700 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <486A9194.4020804@hyber.org> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> Message-ID: <486A9744.2010102@lionet.info> Claes Wikstr?m wrote: > Lev Walkin wrote: > >> Second, you can create a linked-in driver which sends a message >> back to a corresponding server. This allows you to intercept signals >> directly instead of relying on some external notificator. >> > > Mind you not in the signalhandler though - that will break major > havoc with the runtime. There is no good way as far as I know to > have a sighandler in Erlang. > > Only possible solution I see is to > > 1. Have a socket setup from the driver to the beam (over loopback) > 2. in the sighandler write some data on the socket. Just to clarify, my idea was: 1. create a linked-in driver which does the following a) establishes a signal handler b) creates a pipe(2) c) registers one end of the pipe with erlang runtime to get proper FD activity notifications 2. in the signal handler, write a byte into the other end of the pre-established pipe(2). 3. in the main body of the linked-in driver, send some message to erlang when Erlang VM notifies it about FD activity. I haven't done it though, so there might be something wrong I don't see yet. -- Lev From juanjo@REDACTED Tue Jul 1 22:59:52 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 1 Jul 2008 17:59:52 -0300 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> Message-ID: <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> The good thing about this feature is that it provides a way to have an "encapsulated" record replacement. I have a library that I have built that acts as a client to FreeSWITCH (an open source telephony switch). I'm connected to FS over a socket where I get telephony events in an HTTP-like text protocol. These events have lots of fields (sometimes over 50) so it's necessary to keep their information in records. The problem is that some of these events share some fields. To avoid code duplication I use one function to parse common fields and another one to parse event-specifc data. To make this work I keep the channel data in a record and in a field of this record I keep another record with the event-specific data. For example, whenever a channel is answered or hung up I get an event. As these two events are related to a channel, they share some fields, which I keep in an fs_channel_event record. This record has a field called 'extra' where I keep another record with the fields that are not common. These are a simplified version of the records: % Generic channel event. -record(fs_channel_event, { name, provider, timestamp, channel_id, channel_state, answer_state, call_direction, %% Field where we keep a fs_channel_answer_event or a %% fs_channel_hangup_event. extra }). % Channel answer event. -record(fs_channel_answer_event, { read_codec_name, read_codec_rate, write_codec_name, write_codec_rate }). % Channel hangup event. -record(fs_channel_hangup_event, { hangup_cause }). The code that receives the events is unnecessary cumbersome because it needs to work with a record within a record. If this was encapsulated within a parameterized module, it would become much cleaner. On Tue, Jul 1, 2008 at 11:59 AM, Christian S wrote: > 2008/7/1 Juan Jose Comellas : > > An does anybody know what would it take to make this feature > > official/supported? It is really useful in some cases. > > Can you provide examples of how it is useful? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Tue Jul 1 23:17:05 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 01 Jul 2008 23:17:05 +0200 Subject: [erlang-questions] http:request/5 returns econnrefused for localhost In-Reply-To: <20080624094811.GB4827@cs.uni-bonn.de> References: <6c2563b20806231808r18fffaabu8120134b4ba1da30@mail.gmail.com> <5CA9B9A5-C9EB-4E17-9D63-8C2D18834DEE@apache.org> <20080624094811.GB4827@cs.uni-bonn.de> Message-ID: <486A9ED1.1000202@hyber.org> Ignatios Souvatzis wrote: > On Tue, Jun 24, 2008 at 08:43:35AM +0200, Jan Lehnardt wrote: > >> We have seen the same issue with CouchDB. What we found out >> is that in our case localhost was not only resolving to 127.0.0.1 (IPv4) >> but also ::1 (IPv6) and that http:request() would try to connect to >> ::1 where no service was listening. >> >> Try disabling IPv6 networking to verify this. > > Uhm... the fix would be to enable IPv6 in his Yaws. After all, it's easy; > the IPv6 support in Erlang is pretty good. > Has anybody tried Yaws with IPv6 - I haven't /klacke From klacke@REDACTED Tue Jul 1 23:36:35 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 01 Jul 2008 23:36:35 +0200 Subject: [erlang-questions] Extraordinarily long garbage collection with R12B-2 In-Reply-To: References: Message-ID: <486AA363.8050503@hyber.org> David Lutz wrote: > > =INFO REPORT==== 2008-06-29 02:02:41 UTC === > Long GC in <0.13094.0>: [{timeout,4294967}, > {old_heap_block_size,610}, > {heap_block_size,987}, > {mbuf_size,0}, > {stack_size,10}, > {old_heap_size,173}, > {heap_size,425}] > ProcessRegisteredName: [] > Are the numbers above from prior to GC or after ? Anyone knows ??? /klacke From klacke@REDACTED Tue Jul 1 23:19:41 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 01 Jul 2008 23:19:41 +0200 Subject: [erlang-questions] R12B-3 doesn't compile with glibc-2.8 In-Reply-To: <18528.49558.25252.107132@harpo.it.uu.se> References: <1214297845.4085.10.camel@piko.site> <18528.49558.25252.107132@harpo.it.uu.se> Message-ID: <486A9F6D.1060303@hyber.org> Mikael Pettersson wrote: > Alp?r J?ttner writes: > > Hi, > > > > There is a line > > > > #if __GLIBC__ == 2 && (__GLIBC_MINOR__ >= 3 && __GLIBC_MINOR__ <= 7) > > > > in otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c, which causes a > > compilation error with glibc-2.8. > > Can I safely change the 7 to 8 in this line? > > Yes. Since we've been doing this exact change for the past ... like 3 years it seems like a good idea to throw in a 9, a 10 and an 11 as well :-) /klacke From klacke@REDACTED Tue Jul 1 23:14:30 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Tue, 01 Jul 2008 23:14:30 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <486A9744.2010102@lionet.info> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> <486A9744.2010102@lionet.info> Message-ID: <486A9E36.7020209@hyber.org> Lev Walkin wrote: > Claes Wikstr?m wrote: >> Lev Walkin wrote: >> >>> Second, you can create a linked-in driver which sends a message >>> back to a corresponding server. This allows you to intercept signals >>> directly instead of relying on some external notificator. >>> >> >> Mind you not in the signalhandler though - that will break major >> havoc with the runtime. There is no good way as far as I know to >> have a sighandler in Erlang. >> >> Only possible solution I see is to >> >> 1. Have a socket setup from the driver to the beam (over loopback) >> 2. in the sighandler write some data on the socket. > > Just to clarify, my idea was: > > 1. create a linked-in driver which does the following > a) establishes a signal handler > b) creates a pipe(2) > c) registers one end of the pipe with erlang runtime > to get proper FD activity notifications > > 2. in the signal handler, write a byte into the other end > of the pre-established pipe(2). > > 3. in the main body of the linked-in driver, send some message > to erlang when Erlang VM notifies it about FD activity. > Same idea - it'll work just fine. /klacke From mikpe@REDACTED Wed Jul 2 01:00:14 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 2 Jul 2008 01:00:14 +0200 Subject: [erlang-questions] R12B-3 doesn't compile with glibc-2.8 In-Reply-To: <486A9F6D.1060303@hyber.org> References: <1214297845.4085.10.camel@piko.site> <18528.49558.25252.107132@harpo.it.uu.se> <486A9F6D.1060303@hyber.org> Message-ID: <18538.46846.486644.851019@harpo.it.uu.se> Claes Wikstr?m writes: > Mikael Pettersson wrote: > > Alp?r J?ttner writes: > > > Hi, > > > > > > There is a line > > > > > > #if __GLIBC__ == 2 && (__GLIBC_MINOR__ >= 3 && __GLIBC_MINOR__ <= 7) > > > > > > in otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c, which causes a > > > compilation error with glibc-2.8. > > > Can I safely change the 7 to 8 in this line? > > > > Yes. > > Since we've been doing this exact change for the past ... like 3 years > it seems like a good idea to throw in a 9, a 10 and an 11 as > well :-) The check will be simplified to "glibc >= 2.3". The reasons for the check and the rationale for the simplification was posted in a reply to a bug report from the Gentoo people, but that reply may have gone to erlang-bugs not erlang-questions. /Mikael From chsu79@REDACTED Wed Jul 2 01:23:16 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 2 Jul 2008 01:23:16 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <486A9194.4020804@hyber.org> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> Message-ID: I found this linux-specific api some time ago: http://linux.die.net/man/2/signalfd http://lwn.net/Articles/225714/ PS. I've never used it. From chsu79@REDACTED Wed Jul 2 02:06:50 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 2 Jul 2008 02:06:50 +0200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> Message-ID: 2008/7/1 Juan Jose Comellas : > The good thing about this feature is that it provides a way to have an > "encapsulated" record replacement. > The code that receives the events is unnecessary cumbersome because it needs > to work with a record within a record. If this was encapsulated within a > parameterized module, it would become much cleaner. Nested records are not nice, no. For the record: make_stuff() -> #fs_channel_event{extra=#fs_channel_answer_event{write_codec_name=rot13}}. set_stuff(Ex) -> Ex2 = Ex#fs_channel_event{extra=(Ex#fs_channel_event.extra)#fs_channel_answer_event{read_codec_name=leetspeak}}. So the verbose syntax to do the above is what you want to avoid. Did you consider using an approach like the following instead? AnswerEvent = {#fs_channel_event{}, #fs_answer_event{}} HangupEvent = {#fs_channel_event{}, #fs_hangup_event{}} It's easy to deconstruct a tuple in pattern matching. You dont get the nesting above. make_stuff() -> {#fs_channel_event{}, #fs_channel_answer_event{write_codec_name=rot13}}. set_stuff({A, B}) -> {A, B#fs_channel_answer_event{read_codec_name=leetspeak}}. From ok@REDACTED Wed Jul 2 02:20:57 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 2 Jul 2008 12:20:57 +1200 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <6c2563b20807010037v41675855g22ce1ed6bdc36c07@mail.gmail.com> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> <6c2563b20807010037v41675855g22ce1ed6bdc36c07@mail.gmail.com> Message-ID: On 1 Jul 2008, at 7:37 pm, Edwin Fine wrote: > Thank you for a very interesting and informative analysis. I must > admit that I tend to lump together Erlang/OTP as "Erlang" and see > solutions in that context. In a way, I feel as if using Erlang > "standalone" without OTP is very roughly analogous to using C++ > without the STL: it can be done, but why on earth would one want to? Because the STL - is still not fully portable between compilers; in theory it should not be, but it takes you into deep template territory where compilers have incompatible bugs (though they are improving) - is in my experience less efficient than home-brew code (the STL relies, like Haskell, on *serious* optimisation which compilers do not always do) - gets you some of the most incomprehensible compiler error messages (un)imaginable when you make mistakes, which you always do, because - it is unpleasantly complex to use (this will, I hope, be remedied in C0x, at least if I can trust Stroustrup's summary of what's going to be there). None of these applies to OTP, but the argument that - it is another large and complex body of material to master on top of something itself unfamiliar. does apply to both. I have a colleague who has done serious commercial software development in C++ and flatly refuses to have anything to do with the STL (see reasons above). Let's take the current example and see if we can squeeze a bit more out of it. Tim Watson pointed out that there is an issue about "locking" and failing processes. My take on this is "let it crash": when processes are coupled like this they should be as a rule be linked and if one dies, all should die. The OTP behaviours take care of that kind of thing, which is why *once you have grasped the basics* you should try them before rolling your own. What's really interesting here is that the original system was written in terms of threads and locking. Have you looked at thread interfaces lately? [Single Unix Specification version 3] pthread_mutex_lock(&mutex) pthread_mutex_unlock(&mutex) There are four kinds of mutex in POSIX threads: PTHREAD_MUTEX_NORMAL recursive locking deadlocks unlocking a mutex that is already unlocked or that is locked by another => undefined PTHREAD_MUTEX_ERRORCHECK these conditions return an error code PTHREAD_MUTEX_RECURSIVE recursive locking works unlocking a mutex that is already unlocked or that is locked by another => error code PTHREAD_MUTEX_DEFAULT same as PTHREAD_MUTEX_NORMAL Anything else All behaviour undefined [Solaris 2.10] If (1) _POSIX_THREAD_PRIO_INHERIT is defined (2) the mutex was initialised with protocol attribute PTHREAD_PRIO_INHERIT (3) the mutex was initialised with robustness attribute PTHREAD_MUTEX_ROBUST_NP (4) the last holder of the lock crashed then (A) an attempt to lock the mutex will 'fail' with the error code EOWNERDEAD (B) but in fact the attempt will have succeeded (C) it is up to the *new* owner of the lock to try to clean up the state (D) if it can, it calls pthread_mutex_consistent_np (E) if it crashes, the next locker will get the same error code and the same chance to recover (F) if it can't, it should unlock the mutex, and future lockers will get a *different* error code (ENOTRECOVERABLE). (G) it is possible to call pthread_mutex_consistent_np on mutexes that aren't held or didn't need recovery and the behaviour is undefined If a mutex with the default PTHREAD_MUTEX_STALLED_NP robustness value is held by a thread that dies, future locks are "blocked in an unspecified manner". What this means in practice I'm not sure. If you reckon the Solaris 2.10 treatment of crashed lock holders is a mess, perhaps you can point me to something better in SUSv3. I can't find anything in SUSv3 to say _what_ happens when a lock owner crashes. (And don't get me onto the subject of cancellation points.) What kind of building block is _this_ for building reliable systems? Message passing plus linking is so much easier to have justified confidence in that pthreads and TBB start to look like extremely sick jokes. > One last thing: I read the Ethics of Belief after poring > over one of your posts recently, and was exceptionally impressed > with the gentleman's writing and philosophy, with which I strongly > agree. In that regard, I'd like to misquote John Stuart Mill, > namely, "A foolish certainty is the hobgoblin of little minds". > (Actually, I think my version is a slight improvement ;) I am > unfortunately seeing the mechanism of insufficiently examined > beliefs at work today, resulting in the persecution of a friend of > mine by way of (the almost totally belief-based) Shaken Baby > Syndrome. So the essay really resonated deeply with me. I daresay > William K. Clifford would have had a lot to say about this. I wish > he were still alive to do so. Bertrand Russel too. Clifford takes a really good idea and pushes it beyond the bounds of reason; he manages, presumably without intending to, to make any belief in science ethically unjustifiable. Specifically and in Clifford's day topically, Clifford's rule about believing other people meant that it would have been *bad* for anyone to believe in Natural Selection. I encountered Clifford's paper in a book by DeMarco and someone else about risk management in software engineering. I find the idea that Shaken Baby is still credited deeply upsetting; please convey my sympathy and good wishes to your friend. From ok@REDACTED Wed Jul 2 03:11:58 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 2 Jul 2008 13:11:58 +1200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> Message-ID: <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> On 2 Jul 2008, at 8:59 am, Juan Jose Comellas wrote: -record(fs_channel_event, {..lots..,extra}). -record(fs_channel_answer_event, {..several..}). -record(fs_channel_hangup_event, {..several..}). > The code that receives the events is unnecessary cumbersome because > it needs to work with a record within a record. If this was > encapsulated within a parameterized module, it would become much > cleaner. I don't quite see how it would, unless, no, you _couldn't_ be thinking of making a module instance for each channel? It's certainly not clear that so heavy a sledgehammer is needed for this nut. Can you provide an example of the 'unnecessarily cumbersome code' so we can see if it can be clarified another way? From erlang-questions_efine@REDACTED Wed Jul 2 03:58:26 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Tue, 1 Jul 2008 21:58:26 -0400 Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> <6c2563b20807010037v41675855g22ce1ed6bdc36c07@mail.gmail.com> Message-ID: <6c2563b20807011858w402b59bs30da2809a6ec5c56@mail.gmail.com> On Tue, Jul 1, 2008 at 8:20 PM, Richard A. O'Keefe wrote: > > On 1 Jul 2008, at 7:37 pm, Edwin Fine wrote: > >> Thank you for a very interesting and informative analysis. I must admit >> that I tend to lump together Erlang/OTP as "Erlang" and see solutions in >> that context. In a way, I feel as if using Erlang "standalone" without OTP >> is very roughly analogous to using C++ without the STL: it can be done, but >> why on earth would one want to? >> > > Because the STL > - is still not fully portable between compilers; > in theory it should not be, but it takes you into > deep template territory where compilers have > incompatible bugs (though they are improving) > - is in my experience less efficient than home-brew > code (the STL relies, like Haskell, on *serious* > optimisation which compilers do not always do) > - gets you some of the most incomprehensible > compiler error messages (un)imaginable when you > make mistakes, which you always do, because > - it is unpleasantly complex to use (this will, I > hope, be remedied in C0x, at least if I can > trust Stroustrup's summary of what's going to be > there). > Maybe after using it for a long time, it's doesn't seem that complicated. At least, not compared to C++ itself. C++ itself is IMHO horribly complex and arguably a language to be used only by C++ experts. Just writing exception-safe code alone can be dreadfully difficult, never mind the powerful yet labyrinthine maze that is called templates. I've now used the STL extensively for many years, and it has a large advantage in that it is more or less supported by all compliant compilers (and "free" as in beer). It pretty much does the trick. Initially, the ability of various compilers to handle templates was pretty bad and inconsistent so I rolled my own portable libraries. I had to write a significant amount of commercial C++ code that had to be ported across OS/390, HP/UX, Windows, Solaris, AIX, and Linux, so I have a feel for the issues involved. I found it amusing that Andrei Alexandrescu could write syntactically valid template code that no C++ compilers could parse at that time. After a while, though, the effort of maintaining (testing, documenting, fixing) all that code across all those systems became too much and I used the STL exclusively after that. I had to choose a lowest common denominator approach and avoid doing anything really fancy, but it was still worth it. The STL was efficient enough for most purposes. In the IT department of a large telco where I worked for some years, trying to improve quality and establish standards, the code was so inefficient that the benefits of using the STL far outweighed any efficiency concerns. They didn't even compile the code with optimization when it went into production, so the overhead of those templates must have been quite significant, yet it didn't even register on the radar compared to the big concerns (like, actually getting the code to work, and getting the developers to understand why it's slow to do a linear lookup in a vector of 100,000 items, in a loop that iterates 50,000 times). When you're in the trenches, you are grateful for anything that works as advertised most of the time. Gladly, I am out of the C++ business right now and happily learning the Erlang world, which is a joy in comparison. > None of these applies to OTP, but the argument that > > - it is another large and complex body of material > to master on top of something itself unfamiliar. > > does apply to both. Agreed. > I have a colleague who has done > serious commercial software development in C++ and > flatly refuses to have anything to do with the STL > (see reasons above). I did, too, until a few years ago (see above). > > > Let's take the current example and see if we can squeeze a > bit more out of it. Tim Watson pointed out that there is > an issue about "locking" and failing processes. My take > on this is "let it crash": when processes are coupled like > this they should be as a rule be linked and if one dies, > all should die. The OTP behaviours take care of that kind > of thing, which is why *once you have grasped the basics* > you should try them before rolling your own. What's really > interesting here is that the original system was written in > terms of threads and locking. Have you looked at thread > interfaces lately? Unfortunately, I have worked a significant amount with pthreads, Java threads, Windows threads, and OS/2 threads, and consider that skill set to be in the same domain as C++: for experts (as opposed to the "average" developer found in IT shops and who knows how many software companies) only. The fact that we are now seeing multicore processors and are being exhorted to write more thread-bearing code makes me shudder. I suspect that most of the readers of this newsgroup are highly skilled developers, hopefully working for great companies, and I wonder if they have been exposed to the horrors of the "average" developer (as evidenced in "The Daily WTF" and similar web sites). I hope I am not coming across conceited; I'm not like that at all. It is just that I have spent 25 years working hard to be as good a software guy (for want of a better description) as possible, and for my troubles have almost always been put in a position where I have had to teach and mentor the "average" developer (and fix literally millions of lines of code, usualy C++). My experience (and others I am sure will have differences of opinion) is that the level of the average developer is trending steeply downwards as developers become a globalized commodity ("resource") and compete more on price than on ability. These days, I find it rare to see halfway decent code written in ANY language, and the thought of zillions of lines of thread-bearing C++ and Java software being let loose on the world by people who can't even spell O(N^2) scares the heck out of me. Sorry if I am ranting a bit. > [Single Unix Specification version 3] > > pthread_mutex_lock(&mutex) > pthread_mutex_unlock(&mutex) > > There are four kinds of mutex in POSIX threads: > PTHREAD_MUTEX_NORMAL > recursive locking deadlocks > unlocking a mutex that is already unlocked > or that is locked by another => undefined > PTHREAD_MUTEX_ERRORCHECK > these conditions return an error code > PTHREAD_MUTEX_RECURSIVE > recursive locking works > unlocking a mutex that is already unlocked > or that is locked by another => error code > PTHREAD_MUTEX_DEFAULT > same as PTHREAD_MUTEX_NORMAL > Anything else > All behaviour undefined > > [Solaris 2.10] > If > (1) _POSIX_THREAD_PRIO_INHERIT is defined > (2) the mutex was initialised with protocol > attribute PTHREAD_PRIO_INHERIT > (3) the mutex was initialised with robustness > attribute PTHREAD_MUTEX_ROBUST_NP > (4) the last holder of the lock crashed > then > (A) an attempt to lock the mutex will 'fail' > with the error code EOWNERDEAD > (B) but in fact the attempt will have succeeded > (C) it is up to the *new* owner of the lock to > try to clean up the state > (D) if it can, it calls pthread_mutex_consistent_np > (E) if it crashes, the next locker will get the > same error code and the same chance to recover > (F) if it can't, it should unlock the mutex, and > future lockers will get a *different* error code > (ENOTRECOVERABLE). > (G) it is possible to call pthread_mutex_consistent_np > on mutexes that aren't held or didn't need > recovery and the behaviour is undefined > > If a mutex with the default PTHREAD_MUTEX_STALLED_NP > robustness value is held by a thread that dies, > future locks are "blocked in an unspecified manner". > What this means in practice I'm not sure. > > If you reckon the Solaris 2.10 treatment of crashed > lock holders is a mess, perhaps you can point me to > something better in SUSv3. I can't find anything in > SUSv3 to say _what_ happens when a lock owner crashes. > (And don't get me onto the subject of cancellation points.) > > > What kind of building block is _this_ for building > reliable systems? > One made of clay and straw and baked in the sun. > > Message passing plus linking is so much easier to > have justified confidence in that pthreads and TBB start > to look like extremely sick jokes. > I couldn't agree with you more. One thing that amazed me about Erlang is how, once I had figured out how to write something, it Just Worked (TM). I fell in love. > > > One last thing: I read the Ethics of Belief after poring over >> one of your posts recently, and was exceptionally impressed with the >> gentleman's writing and philosophy, with which I strongly agree. In that >> regard, I'd like to misquote John Stuart Mill, namely, "A foolish certainty >> is the hobgoblin of little minds". (Actually, I think my version is a slight >> improvement ;) I am unfortunately seeing the mechanism of insufficiently >> examined beliefs at work today, resulting in the persecution of a friend of >> mine by way of (the almost totally belief-based) Shaken Baby Syndrome. So >> the essay really resonated deeply with me. I daresay William K. Clifford >> would have had a lot to say about this. I wish he were still alive to do so. >> Bertrand Russel too. >> > > Clifford takes a really good idea and pushes it beyond the > bounds > of reason; he manages, presumably without intending to, to make any belief > in > science ethically unjustifiable. Specifically and in Clifford's day > topically, > Clifford's rule about believing other people meant that it would have been > *bad* > for anyone to believe in Natural Selection. I encountered Clifford's paper > in > a book by DeMarco and someone else about risk management in software > engineering. > I find the idea that Shaken Baby is still credited deeply upsetting; please > convey > my sympathy and good wishes to your friend. > > I won't go off-topic after this, but I just wanted to write two things: (a) Shaken Baby is sadly alive and persecuting parents and child carers in the USA, Australia and England. (b) After reading dozens of papers on the SBS myth, I mean syndrome, and seeing the terrible cost to innocent families due to junk science, I rather lean toward being too much a "Cliffordite" than too little. This is particularly true after I read of scientific bias and just plain fraud (all that lovely research money is so enticing). I actually took Clifford's advice by following up on as many references as I could find in peer-reviewed papers, and I was appalled at how, in many cases, results were used selectively from these papers to back up shaky claims and make them look solidly research-based. These days I am almost reluctant to accept the evidence of my own eyes, having learned how deeply subjective "reality" is, and how what is up today is down tomorrow. Galileo and many others were persecuted for being "heretical" and later shown to be correct. Great "laws" of nature (classical relativity -> special relativity -> general relativity -> quantum mechanics -> string theory -> ??) were challenged and either overturned or radically transformed by those brave and noble enough to endure scorn and criticism. Heretics were burned at the stake not that long ago; are we humans really any different now? Yes, I like Clifford. Rather be too critical than not critical enough, even if it risks making beliefs in science ethically unjustifiable: in the days of the Internet and easy claims of anything, and people who will believe almost any plausible claims, we need to be more vigilant than ever. -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Jul 2 04:36:24 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 2 Jul 2008 14:36:24 +1200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18537.11084.466276.492883@harpo.it.uu.se> References: <18529.883.586609.71953@hamberg.it.uu.se> <18530.17062.650561.451935@hamberg.it.uu.se> <95be1d3b0806251417y33ff2e5br7597757656ce259e@mail.gmail.com> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <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> Message-ID: On 1 Jul 2008, at 6:51 am, Sven-Olof Nystr|m wrote: > > But an Erlang process is always willing to accept messages. Unlike an > Ada process (say) there is no way an Erlang process can prevent > another process from sending it a message. The process can choose not > to look at it, but that's another matter. I would say that - a MAILBOX is always willing to accept any message - a PROCESS is only willing to accept a message when it is executing a 'receive' construct that will match it. Back when I first invented abstract patterns, I pointed out that the fact that they are limited in the same way that all matches and guards are limited means that it would be safe and useful to let a process install an abstract pattern as a filter, so that any message that didn't match the abstract pattern would never go into the mailbox. (In particular, the abstract pattern can be executed by the *sender* if it's on the same node; an abstract pattern cannot crash or affect the process dictionary or send other messages &c. So local rejected messages would never even be copied, let alone added to a mailbox.) I think that the distinction between what the mailbox does and what the process does is too important to blur by (mis)calling "addition to a mailbox" "acceptance by a process". By the way, the bounded buffer example can obviously be "rescued" thus: producer(Buffer) -> .... Buffer ! {put,self(),Item}, receive {ok,Buffer} -> ok end, producer(Buffer). consumer(Buffer) -> Buffer ! {get,self()}, receive {ok,Buffer,Item} -> ok end, .... buffer(Pool, Left) -> receive {put,Producer,Item} when Left > 0 -> Producer ! {ok,Buffer}, buffer(Pool ++ [Item], Left - 1) ; {get,Consumer} when Pool =/= [] -> Consumer ! {ok,Buffer,hd(Pool)}, buffer(tl(Pool), Left + 1) end. Assuming that this is part of a system where only the producer and consumer can refer to Buffer, this is the traditional bounded buffer. The argument that the mailbox (but NOT the process) is always willing to accept more messages has no force between the senders won't *send* more messages; the buffer's mailbox will have at most one 'put' and and most one 'get' at any one time. The substantive point, that the *process* (not the mailbox) is willing to accept different messages at different times remains. This is a nice illustration of why mailbox length is often not a problem: the need for a response means that the mailbox is bounded in size by the number of processes that might send messages. In effect, the responses are a form of flow control. > So your argument is: Concurrent ML tried something similar. > It did not work out. It worked out in the sense that the design was implementable, was implemented, was used, and is still available in SML/NJ and Mlton. It also worked out in the sense that *simple* problems don't look too bad. The point is that things which would still be pretty straightforward in Erlang with its 'receive' quickly become very complex in CML. Interestingly, the Limbo programming language has CML-like channels, but without all the extra stuff in CML. (For example, CML has both channels and mailboxes.) http://www.vitanuova.com/inferno/papers/limbo.html 4.2.5 chan of is a type. ch <-= msg is a send. 8.2.9 <- ch is a receive <- ch_array is multi-receive For example, msg = <- ch receives a message from one channel. (ix, msg) = <- ch_array receives an (index, message) pair where the index says which element of the channel array the message came from. 8.4.3 ch <-= msg blocks if no process is reading from ch. 9.8 alt {... msg = <- ch => stmt; ... ch <- = msg => stmt; } is like an Occam ALT. Let me quote section 12.4 in full. 12.4 Buffered channels Limbo channels are unbuffered; a sender blocks until there is a receiver. This example shows a way to make a buffered channel of strings from an unbuffered channel. It is written as a module whose bufchan function takes a chan of string and a size as argument, and returns a new channel; it creates an asynchronous task that accepts input from the argument channel and saves up to size strings, meanwhile trying to send them to its user. implement Bufchan; Bufchan: module { bufchan: fn(c: chan of string, size: int): chan of string; }; xfer(oldchan, newchan: chan of string, size: int) { temp := array[size] of string; fp := 0; # first string in buffer n := 0; # number of strings in buffer dummy := chan of string; sendch, recvch: chan of string; s: string; for (;;) { sendch = recvch = dummy; if (n > 0) sendch = newchan; if (n < size) recvch = oldchan; alt { s = <-recvch => temp[(fp+n)%size] = s; n++; sendch <- = temp[fp] => temp[fp++] = nil; n--; if (fp>=size) fp -= size; } } } bufchan(oldchan: chan of string, size: int): chan of string { newchan := chan of string; spawn xfer(oldchan, newchan, size); return newchan; } The module is somewhat specialized, but it illustrates useful programming techniques. The most interesting occurs in xfer, which does the work. The problem xfer faces is that it doesn't want to receive input when its buffer is full, nor to try to send when it has nothing to transmit. The solution here is to use a dummy channel on which nothing is ever sent or received; in the alt statement, that channel substitutes for the real input channel when the buffer is full, and for the output channel when the buffer is empty. [snipped] This is "real" bounded buffer. Note the trick: you need three channels, one of them a dummy that will never be used. If you don't want a particular alternative to really be there, make that one wait for a communication that can never happen. To me this is much harder to understand than a guarded 'select' in Ada or 'alt' in Occam, because what's _really_ going on is hidden under a layer of what I can only call obfuscation. > > So we agree that it's *not* an implementation of bounded buffers???? Why do you harp on this one note? Idunno, you strip things to the bone to make a point concisely, and someone makes a federal case out of your kindness. From now on, please do not refer to the stripped down example, but only to the full producer/buffer/consumer example, which contains material not relevant to the state-dependent-reception POINT. > > Since I came up with the channel concept, I've been looking for some > convincing example of an Erlang program that could be implemented > using selective receive, but was not possible to implement using > channels (or where the solution with channels was more complex). Try looking in the Erlang sources. There are plenty of simple cases there, true. But there are also plenty of cases where many channels would be needed, making the solution with channels look a lot more complex to me. It may be that we have different ideas of what counts as a 'more complex' solution. If this thread is not to degenerate into something out of Dr Suess (was it the West-going something and the East-going something else or was it North and South?) we really need to see some concrete cases FROM THE PROPOSER. The proposal in the document I was responding to does not contain any multi-receive, and it's not clear that one can be programmed from the operations that are in the document. I don't know any message- based language that doesn't have some analogue of an Occam 'ALT'/ Limbo 'alt'/Ada 'select', and that document doesn't include one, so it's clearly incomplete that way as well. So we need to see a functionally complete proposal (in order to judge how complex the proposed replacement for 'receive' is in itself) *AND* some examples of rewritten Erlang code to judge how complex the replacement is in use. For the statement > I've been looking for some > convincing example of an Erlang program that could be implemented > using selective receive, but was not possible to implement using > channels (or where the solution with channels was more complex). to have any force, there must already BE a number of examples which have been so rewritten. So let's see them. Once again, I am no fan of Erlang syntax and I certainly do not advocate it staying put forever. Who wouldn't be happy about the bit syntax? Who wouldn't really like to have something like Joe Armstrong's "proper structs" (or my very slight variant of his idea)? It's just that I'll take a lot of persuading that the feature of Erlang which suddenly made concurrent programming look really easy should be replaced by something I've seen before and been disappointed by. From talmage.news@REDACTED Wed Jul 2 06:27:56 2008 From: talmage.news@REDACTED (Talmge) Date: Tue, 1 Jul 2008 21:27:56 -0700 (PDT) Subject: [erlang-questions] Question about message passing paradigm In-Reply-To: <6c2563b20807011858w402b59bs30da2809a6ec5c56@mail.gmail.com> References: <6e7d53010806282206s4fc36dcei9f99107f4ee6ac30@mail.gmail.com> <6c2563b20806290342o2da73957t15cbbc5123e7dcc2@mail.gmail.com> <110BA8ACEE682C479D0B008B6BE4AEB10696E92A@esealmw107.eemea.ericsson.se> <81E73DEA-CEDC-4D69-8179-C03C01D49E09@cs.otago.ac.nz> <6c2563b20806302042q2605badie220bd1acb7d72b3@mail.gmail.com> <6c2563b20807010037v41675855g22ce1ed6bdc36c07@mail.gmail.com> <6c2563b20807011858w402b59bs30da2809a6ec5c56@mail.gmail.com> Message-ID: <57ca1e7a-93c5-4f5c-a543-e28866ed10a2@h1g2000prh.googlegroups.com> First of all: Wow, I never expected this much of a response. I need some time to sort through the replies and will reply when I have more time. I just wanted to write this short reply and say thank you to everyone for being willing to help a newbie into this area. Mike On Jul 1, 6:58 pm, "Edwin Fine" wrote: > On Tue, Jul 1, 2008 at 8:20 PM, Richard A. O'Keefe > wrote: > > > > > > > On 1 Jul 2008, at 7:37 pm, Edwin Fine wrote: > > >> Thank you for a very interesting and informative analysis. I must admit > >> that I tend to lump together Erlang/OTP as "Erlang" and see solutions in > >> that context. In a way, I feel as if using Erlang "standalone" without OTP > >> is very roughly analogous to using C++ without the STL: it can be done, but > >> why on earth would one want to? > > > Because the STL > > - is still not fully portable between compilers; > > in theory it should not be, but it takes you into > > deep template territory where compilers have > > incompatible bugs (though they are improving) > > - is in my experience less efficient than home-brew > > code (the STL relies, like Haskell, on *serious* > > optimisation which compilers do not always do) > > - gets you some of the most incomprehensible > > compiler error messages (un)imaginable when you > > make mistakes, which you always do, because > > - it is unpleasantly complex to use (this will, I > > hope, be remedied in C0x, at least if I can > > trust Stroustrup's summary of what's going to be > > there). > > Maybe after using it for a long time, it's doesn't seem that complicated. At > least, not compared to C++ itself. C++ itself is IMHO horribly complex and > arguably a language to be used only by C++ experts. Just writing > exception-safe code alone can be dreadfully difficult, never mind the > powerful yet labyrinthine maze that is called templates. I've now used the > STL extensively for many years, and it has a large advantage in that it is > more or less supported by all compliant compilers (and "free" as in beer). > It pretty much does the trick. Initially, the ability of various compilers > to handle templates was pretty bad and inconsistent so I rolled my own > portable libraries. I had to write a significant amount of commercial C++ > code that had to be ported across OS/390, HP/UX, Windows, Solaris, AIX, and > Linux, so I have a feel for the issues involved. I found it amusing that > Andrei Alexandrescu could write syntactically valid template code that no > C++ compilers could parse at that time. After a while, though, the effort of > maintaining (testing, documenting, fixing) all that code across all those > systems became too much and I used the STL exclusively after that. I had to > choose a lowest common denominator approach and avoid doing anything really > fancy, but it was still worth it. > The STL was efficient enough for most purposes. In the IT department of a > large telco where I worked for some years, trying to improve quality and > establish standards, the code was so inefficient that the benefits of using > the STL far outweighed any efficiency concerns. They didn't even compile the > code with optimization when it went into production, so the overhead of > those templates must have been quite significant, yet it didn't even > register on the radar compared to the big concerns (like, actually getting > the code to work, and getting the developers to understand why it's slow to > do a linear lookup in a vector of 100,000 items, in a loop that iterates > 50,000 times). When you're in the trenches, you are grateful for anything > that works as advertised most of the time. Gladly, I am out of the C++ > business right now and happily learning the Erlang world, which is a joy in > comparison. > > > None of these applies to OTP, but the argument that > > > - it is another large and complex body of material > > to master on top of something itself unfamiliar. > > > does apply to both. > > Agreed. > > > I have a colleague who has done > > serious commercial software development in C++ and > > flatly refuses to have anything to do with the STL > > (see reasons above). > > I did, too, until a few years ago (see above). > > > > > Let's take the current example and see if we can squeeze a > > bit more out of it. Tim Watson pointed out that there is > > an issue about "locking" and failing processes. My take > > on this is "let it crash": when processes are coupled like > > this they should be as a rule be linked and if one dies, > > all should die. The OTP behaviours take care of that kind > > of thing, which is why *once you have grasped the basics* > > you should try them before rolling your own. What's really > > interesting here is that the original system was written in > > terms of threads and locking. Have you looked at thread > > interfaces lately? > > Unfortunately, I have worked a significant amount with pthreads, Java > threads, Windows threads, and OS/2 threads, and consider that skill set to > be in the same domain as C++: for experts (as opposed to the "average" > developer found in IT shops and who knows how many software companies) only. > The fact that we are now seeing multicore processors and are being exhorted > to write more thread-bearing code makes me shudder. I suspect that most of > the readers of this newsgroup are highly skilled developers, hopefully > working for great companies, and I wonder if they have been exposed to the > horrors of the "average" developer (as evidenced in "The Daily WTF" and > similar web sites). I hope I am not coming across conceited; I'm not like > that at all. It is just that I have spent 25 years working hard to be as > good a software guy (for want of a better description) as possible, and for > my troubles have almost always been put in a position where I have had to > teach and mentor the "average" developer (and fix literally millions of > lines of code, usualy C++). My experience (and others I am sure will have > differences of opinion) is that the level of the average developer is > trending steeply downwards as developers become a globalized commodity > ("resource") and compete more on price than on ability. These days, I find > it rare to see halfway decent code written in ANY language, and the thought > of zillions of lines of thread-bearing C++ and Java software being let loose > on the world by people who can't even spell O(N^2) scares the heck out of > me. Sorry if I am ranting a bit. > > > > > [Single Unix Specification version 3] > > > pthread_mutex_lock(&mutex) > > pthread_mutex_unlock(&mutex) > > > There are four kinds of mutex in POSIX threads: > > PTHREAD_MUTEX_NORMAL > > recursive locking deadlocks > > unlocking a mutex that is already unlocked > > or that is locked by another => undefined > > PTHREAD_MUTEX_ERRORCHECK > > these conditions return an error code > > PTHREAD_MUTEX_RECURSIVE > > recursive locking works > > unlocking a mutex that is already unlocked > > or that is locked by another => error code > > PTHREAD_MUTEX_DEFAULT > > same as PTHREAD_MUTEX_NORMAL > > Anything else > > All behaviour undefined > > > [Solaris 2.10] > > If > > (1) _POSIX_THREAD_PRIO_INHERIT is defined > > (2) the mutex was initialised with protocol > > attribute PTHREAD_PRIO_INHERIT > > (3) the mutex was initialised with robustness > > attribute PTHREAD_MUTEX_ROBUST_NP > > (4) the last holder of the lock crashed > > then > > (A) an attempt to lock the mutex will 'fail' > > with the error code EOWNERDEAD > > (B) but in fact the attempt will have succeeded > > (C) it is up to the *new* owner of the lock to > > try to clean up the state > > (D) if it can, it calls pthread_mutex_consistent_np > > (E) if it crashes, the next locker will get the > > same error code and the same chance to recover > > (F) if it can't, it should unlock the mutex, and > > future lockers will get a *different* error code > > (ENOTRECOVERABLE). > > (G) it is possible to call pthread_mutex_consistent_np > > on mutexes that aren't held or didn't need > > recovery and the behaviour is undefined > > > If a mutex with the default PTHREAD_MUTEX_STALLED_NP > > robustness value is held by a thread that dies, > > future locks are "blocked in an unspecified manner". > > What this means in practice I'm not sure. > > > If you reckon the Solaris 2.10 treatment of crashed > > lock holders is a mess, perhaps you can point me to > > something better in SUSv3. I can't find anything in > > SUSv3 to say _what_ happens when a lock owner crashes. > > (And don't get me onto the subject of cancellation points.) > > > What kind of building block is _this_ for building > > reliable systems? > > One made of clay and straw and baked in the sun. > > > > > Message passing plus linking is so much easier to > > have justified confidence in that pthreads and TBB start > > to look like extremely sick jokes. > > I couldn't agree with you more. One thing that amazed me about Erlang is > how, once I had figured out how to write something, it Just Worked (TM). I > fell in love. > > > > > One last thing: I read the Ethics of Belief after poring over > >> one of your posts recently, and was exceptionally impressed with the > >> gentleman's writing and philosophy, with which I strongly agree. In that > >> regard, I'd like to misquote John Stuart Mill, namely, "A foolish certainty > >> is the hobgoblin of little minds". (Actually, I think my version is a slight > >> improvement ;) I am unfortunately seeing the mechanism of insufficiently > >> examined beliefs at work today, resulting in the persecution of a friend of > >> mine by way of (the almost totally belief-based) Shaken Baby Syndrome. So > >> the essay really resonated deeply with me. I daresay William K. Clifford > >> would have had a lot to say about this. I wish he were still alive to do so. > >> Bertrand Russel too. > > > Clifford takes a really good idea and pushes it beyond the > > bounds > > of reason; he manages, presumably without intending to, to make any belief > > in > > science ethically unjustifiable. Specifically and in Clifford's day > > topically, > > Clifford's rule about believing other people meant that it would have been > > *bad* > > for anyone to believe in Natural Selection. I encountered Clifford's paper > > in > > a book by DeMarco and someone else about risk management in software > > engineering. > > I find the idea that Shaken Baby is still credited deeply upsetting; please > > convey > > my sympathy and good wishes to your friend. > > ... > > read more ? > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From dl-erlang@REDACTED Wed Jul 2 07:32:08 2008 From: dl-erlang@REDACTED (David Lutz) Date: Tue, 1 Jul 2008 22:32:08 -0700 Subject: [erlang-questions] Extraordinarily long garbage collection with R12B-2 In-Reply-To: References: Message-ID: <52AB44F0-716B-41EA-905A-4E7798D5DABC@dlutz.net> A follow up with a bit more info below. D.L. On Jun 29, 2008, at 7:11 PM, David Lutz wrote: > I am still pretty much an erlang newbie, so hopefully I am missing > something obvious. > > We have an program that was running OK with R11B-4, but now is > experiencing incredibly long garbage collection times under load with > R12B-2. The application is serving network requests, many clients > connecting only for a short period, request/response style. We have > erlang:system_monitor/2 set up to deliver messages if GC takes more > than 1000ms. With R11B-4 we almost never saw this. With R12B-2 it > happens fairly regularly and the timeouts are really long, most of the > reports are for timeout of 4294967. Occasionally a slightly smaller > timeout will be reported, but always well over 4000000. The long GC > happens in both our long running gen_server processes and our > ephemeral worker processes. Obviously our clients experience timeouts > and other connection errors while this long GC is happening. OK, after a further research, it turns out that our client issues were caused by a different problem. In fact it would appear that these long_gc messages are completely spurious. I see no evidence that any GC took any appreciable amount of time. One thing that I noticed a bit later is the timeout value is (2^32)/1000 on our 32bit hosts, however we are getting the same reports on our 64bit hosts with a timeout value of (2^64)/1000. This looks suspiciously like a counter/ timer in the VM is having rollover issues. > Below is small clip from our log file showing the long GC reports. > Has anybody seen this issue before? Why would R12B-2 behave so much > different that R11B-4 in this respect? What steps can I try to > pinpoint the issue? > > Thanks, > D.L. > > =INFO REPORT==== 2008-06-29 02:02:41 UTC === > Long GC in <0.13094.0>: [{timeout,4294967}, > {old_heap_block_size,610}, > {heap_block_size,987}, > {mbuf_size,0}, > {stack_size,10}, > {old_heap_size,173}, > {heap_size,425}] > ProcessRegisteredName: [] > > =INFO REPORT==== 2008-06-29 02:02:43 UTC === > Long GC in <0.59.0>: [{timeout,4295024}, > {old_heap_block_size,377}, > {heap_block_size,610}, > {mbuf_size,0}, > {stack_size,26}, > {old_heap_size,118}, > {heap_size,7}] > ProcessRegisteredName: {registered_name,XXX} From erlang@REDACTED Wed Jul 2 10:05:10 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 2 Jul 2008 10:05:10 +0200 Subject: [erlang-questions] Project volunteers In-Reply-To: <9b08084c0806300250l382304edlf9b279800fb855d0@mail.gmail.com> References: <9b08084c0806300250l382304edlf9b279800fb855d0@mail.gmail.com> Message-ID: <9b08084c0807020105l4f5537bct4557ad440539bf7b@mail.gmail.com> I've been thinking. I think what I'd like to do it follow the approach described in http://users.softlab.ece.ntua.gr/~ttsiod/buildWikipediaOffline.html doing as much as possible in Erlang. This will be a good test of my Erlang toolset. Then I'll rewrite the rendering pipeline. Then I'd like to play with coutchDB to store the index and derived dataset obtained by parsing the page dumps. The *real* wikipedia has a complex data model described at http://www.mediawiki.org/wiki/Manual:Database_layout It would be very interesting to see what this looks like in a schema-free Key->TypedTuple data store. This problem is interesting to me - because the data volumes are large and the content is reasonable quality. Cheers /Joe Armstrong On Mon, Jun 30, 2008 at 11:50 AM, Joe Armstrong wrote: > Hi Guys, > > I've been at the erlang exchange and come back with a headful of ideas. > > I have an idea for a fun project. > > Make an offline stand-alone version of the wikipedia for places > without internet access. > Distribute to the world. > > I thought to use the following: > > - erlang > - coutchDB > - mochiWeb > > Jobs to do: > > - convert wikipedia dumps (mySQL format) to coutchDB > - make rendering engine to convert wiki text to HTML > - compress data dumps to make entiore wikipedia as small as possible > - shoehorn into a low-power "one laptop for every child" computer > - make distruibution package > - release manager (set up groups) > - write documentation > > > /Joe Armstrong > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From notnorwegian@REDACTED Wed Jul 2 10:33:00 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Wed, 2 Jul 2008 08:33:00 +0000 (GMT) Subject: [erlang-questions] conses in erlang? Message-ID: <829031.63474.qm@web27904.mail.ukl.yahoo.com> can i use conses in erlang? like in scheme, then i only need one function. is the range func in erlang ood erlang-style or is there a better way to do it? (define (seq a b) ??? (if (< a b) ??????? (cons a (seq (+ a 1) b)) ??????? '())) -module(test). -export([range/2]). ????? range(Start, End) when Start < End, is_integer(Start), is_integer(End) -> ??? seq(Start, End, []). seq(Start, End, List) -> ??? if Start =< End -> ??? ??? seq(Start + 1, End, List ++ [Start]); ??? true -> ??? List end. ___________________________________________________ S?k efter k?rleken! Hitta din tvillingsj?l p? Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 -------------- next part -------------- An HTML attachment was scrubbed... URL: From notnorwegian@REDACTED Wed Jul 2 10:38:11 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Wed, 2 Jul 2008 08:38:11 +0000 (GMT) Subject: [erlang-questions] is_integer should always be used? Message-ID: <754804.50791.qm@web27903.mail.ukl.yahoo.com> when programming erlang, should i always use is_integer if a float will make the function crash? i havent used so much exception-prevention in erlang and it seems the language needs a lot of extra code stuck it in ebcause of this. if some one passes a float to a function that only takes integers, should i catch that exception or should i let the program crash? ___________________________________________________ S?k efter k?rleken! Hitta din tvillingsj?l p? Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Jul 2 10:54:22 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 2 Jul 2008 10:54:22 +0200 Subject: [erlang-questions] conses in erlang? In-Reply-To: <829031.63474.qm@web27904.mail.ukl.yahoo.com> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> Message-ID: You have the operator [End|Acc] to cons End on to the list Acc. See below. Preferably, you implement seq from the end to the start. seq(Start, End) -> seq(Start, End, []). seq(Start, End, Acc) when Start =< End -> seq(Start, End-1, [End|Acc]); seq(_, _, Acc) -> Acc. From vlm@REDACTED Wed Jul 2 11:03:51 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 02 Jul 2008 02:03:51 -0700 Subject: [erlang-questions] conses in erlang? In-Reply-To: <829031.63474.qm@web27904.mail.ukl.yahoo.com> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> Message-ID: <486B4477.5020803@lionet.info> not norwegian swede wrote: > can i use conses in erlang? > like in scheme, then i only need one function. is the range func in > erlang ood erlang-style or is there a better way to do it? > > (define (seq a b) > (if (< a b) > (cons a (seq (+ a 1) b)) > '())) > > -module(test). > -export([range/2]). > > range(Start, End) when Start < End, is_integer(Start), is_integer(End) -> > seq(Start, End, []). > > seq(Start, End, List) -> > if Start =< End -> > seq(Start + 1, End, List ++ [Start]); > true -> > List > end. seq(Start, End) when is_integer(Start), is_intger(End) -> seq(End, Start, []). seq(End, Start, Acc) when Start >= End -> seq(End - 1, Start, [End|Acc]); seq(_End, _Start, Acc) -> Acc. this approach also has a linear complexity, instead of being O(N^2) in your cas. -- vlm From vlm@REDACTED Wed Jul 2 11:06:01 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 02 Jul 2008 02:06:01 -0700 Subject: [erlang-questions] is_integer should always be used? In-Reply-To: <754804.50791.qm@web27903.mail.ukl.yahoo.com> References: <754804.50791.qm@web27903.mail.ukl.yahoo.com> Message-ID: <486B44F9.6020900@lionet.info> not norwegian swede wrote: > when programming erlang, should i always use is_integer if a float > will make the function crash? > > i havent used so much exception-prevention in erlang and it seems the > language needs a lot of extra code stuck it in ebcause of this. > > if some one passes a float to a function that only takes integers, > should i catch that exception or should i let the program crash? is_integer() is likely to make a program crash, if there are no suitable alternatives. so, if passing a float _always_ makes the program crash, then it does not matter where it crashes much most of the time. however, it may constitute a good documentation artifact to have an is_integer() guard around, just to warn the future readers of your code about function's acceptable domain. -- vlm From gleber.p@REDACTED Wed Jul 2 12:34:25 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 2 Jul 2008 12:34:25 +0200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> Message-ID: <14f0e3620807020334h197430ahf45fe36c7db0f88f@mail.gmail.com> On Wed, Jul 2, 2008 at 3:11 AM, Richard A. O'Keefe wrote: > > On 2 Jul 2008, at 8:59 am, Juan Jose Comellas wrote: > > -record(fs_channel_event, {..lots..,extra}). > -record(fs_channel_answer_event, {..several..}). > -record(fs_channel_hangup_event, {..several..}). > >> The code that receives the events is unnecessary cumbersome because >> it needs to work with a record within a record. If this was >> encapsulated within a parameterized module, it would become much >> cleaner. > > I don't quite see how it would, unless, no, you _couldn't_ > be thinking of making a module instance for each channel? > > It's certainly not clear that so heavy a sledgehammer is > needed for this nut. Can you provide an example of the > 'unnecessarily cumbersome code' so we can see if it can > be clarified another way? Is it so heavyweight? Aren't parametrized modules instances just a tuples of type {Mod, Param1, Param2, ...}? Or is calling of functions from such module too expensive? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From notnorwegian@REDACTED Wed Jul 2 12:42:12 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Wed, 2 Jul 2008 10:42:12 +0000 (GMT) Subject: [erlang-questions] calling func with predef params? In-Reply-To: <486B51B7.2040406@lionet.info> Message-ID: <897628.41228.qm@web27903.mail.ukl.yahoo.com> how do i call do_get? -module(test_iserve_app). -export([do_get/2]). -include("iserve.hrl"). do_get(#req{} = Req, Args) -> ??? {200, [], <<" ? Welcome to iserve ? Hello ">>}. __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Jul 2 12:53:39 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 2 Jul 2008 12:53:39 +0200 Subject: [erlang-questions] calling func with predef params? In-Reply-To: <897628.41228.qm@web27903.mail.ukl.yahoo.com> References: <486B51B7.2040406@lionet.info> <897628.41228.qm@web27903.mail.ukl.yahoo.com> Message-ID: <14f0e3620807020353t3e1186f0p91b22a9f0e333d1d@mail.gmail.com> These are not predefined parameters. It is pattern matching inside function parameters definition. After expansion of #req{} by preprocessor it is equal to (assuming that record req has 3 fields, because i don't know exact number): {req, _, _, _} = Req Take a look at manual: http://www.erlang.org/doc/programming_examples/records.html#1.7 2008/7/2 not norwegian swede : > how do i call do_get? > > -module(test_iserve_app). > -export([do_get/2]). > -include("iserve.hrl"). > > do_get(#req{} = Req, Args) -> > {200, [], <<" Transitional//EN\"> > > > Welcome to iserve > > > Hello > > ">>}. > > ________________________________ > S?k efter k?rleken! > Hitta din tvillingsj?l p? Yahoo! Dejting: http://se.meetic.yahoo.net > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From richardc@REDACTED Wed Jul 2 15:40:02 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 02 Jul 2008 15:40:02 +0200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <14f0e3620807020334h197430ahf45fe36c7db0f88f@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> <14f0e3620807020334h197430ahf45fe36c7db0f88f@mail.gmail.com> Message-ID: <486B8532.8070308@it.uu.se> Gleb Peregud wrote: > On Wed, Jul 2, 2008 at 3:11 AM, Richard A. O'Keefe wrote: >> It's certainly not clear that so heavy a sledgehammer is >> needed for this nut. Can you provide an example of the >> 'unnecessarily cumbersome code' so we can see if it can >> be clarified another way? > > Is it so heavyweight? Aren't parametrized modules instances just a > tuples of type {Mod, Param1, Param2, ...}? Or is calling of functions > from such module too expensive? The representation currently uses tuples, but should be regarded as unknown. If this is made a documented feature, a new opaque 'module' datatype will be added. (This is analogous to how funs were added, several years ago.) The heaviness of the solution in this case is not the calls via a module instance (which are pretty efficient, much like funs), but the need to write a separate module and instantiate it, just to make it easier to work with nested records. You may still be right that it actually makes a nicer solution, but we've seen to little actual code examples to be able to tell if this is really the case or if it could be done better even without abstract modules. /Richard C From bobcalco@REDACTED Wed Jul 2 15:46:21 2008 From: bobcalco@REDACTED (Bob Calco) Date: Wed, 2 Jul 2008 09:46:21 -0400 Subject: [erlang-questions] Call for Contributions: Mnesia best practices Message-ID: <006401c8dc4a$0330ce80$09926b80$@rr.com> Everyone: I'm looking for thoughts from fellow Erlangers about database design & implementation in Mnesia. With a heavy SQL background I, like many relatively new Erlang folks I'm sure, have a tendency to think in terms of the capabilities of traditional RDBMSs, and to try to normalize every data model with which I come into contact. I'm also used to letting administrators deal with most database operations and issues, whereas with Mnesia the programmer has basically supreme control (both to do some really cool and flexible things, and to do some really dumb things). So the question is generic, not intended to solve a specific problem. I have some ideas and will contribute separately. The question is: What is the best advice you could give a data architect about designing and implementing a database in Mnesia from scratch? Examples of the kinds of issues I'd like to see folks address: * How to create an optimal data model for performance (vs. reporting, comparing the SQL way to the Mnesia way). This question is really about normalization in Mnesia vs. SQL, and tricks like storing whole records in table fields. * How to partition data between subsystems, without losing the illusion they're all one big happy system. * How to handle complex clustering and failover scenarios. * How to handle calculation-intensive databases (for example, stock databases that need to constantly recalculate certain attributes for the purposes of sorting, searching) * How to handle complex domain relationships. For example, let's say you are writing a CRM tool and want to store each "person" in the database. But each person can also be a colleague, or a client, or an incidental character (contact person at some organization). E.e, What do you do when there is inheritance in your domain model? * What are some current pitfalls or "weak spots" of Mnesia that ought to be avoided, however tempting they might be? * How to implement the various callbacks, and what kinds outside of those described in the Mnesia documentation, have been found most useful in practice? That kind of thing. I want to put together something of a master knowledge base on this big subject that the community can use both to promote Erlang and to promote Erlang's "best practices" implementation in the important area of serving data to applications. /Bob From erlang-questions_efine@REDACTED Wed Jul 2 16:25:20 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 2 Jul 2008 10:25:20 -0400 Subject: [erlang-questions] conses in erlang? In-Reply-To: <486B4477.5020803@lionet.info> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> <486B4477.5020803@lionet.info> Message-ID: <6c2563b20807020725l681d3b4dg376812a480d9ac29@mail.gmail.com> Not knowing how new (or not) to Erlang the OP might be, I just wanted to make sure that the OP is aware of the existence of lists:seq/2, even if it's stating the obvious. On Wed, Jul 2, 2008 at 5:03 AM, Lev Walkin wrote: > not norwegian swede wrote: > > can i use conses in erlang? > > like in scheme, then i only need one function. is the range func in > > erlang ood erlang-style or is there a better way to do it? > > > > (define (seq a b) > > (if (< a b) > > (cons a (seq (+ a 1) b)) > > '())) > > > > -module(test). > > -export([range/2]). > > > > range(Start, End) when Start < End, is_integer(Start), is_integer(End) -> > > seq(Start, End, []). > > > > seq(Start, End, List) -> > > if Start =< End -> > > seq(Start + 1, End, List ++ [Start]); > > true -> > > List > > end. > > > seq(Start, End) when is_integer(Start), is_intger(End) -> > seq(End, Start, []). > > seq(End, Start, Acc) when Start >= End -> > seq(End - 1, Start, [End|Acc]); > seq(_End, _Start, Acc) -> Acc. > > > this approach also has a linear complexity, instead of being O(N^2) > in your cas. > > -- > vlm > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.lamb@REDACTED Wed Jul 2 17:41:10 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 2 Jul 2008 17:41:10 +0200 Subject: [erlang-questions] Environment variables in applications Message-ID: <2942EA69-3570-4B38-9380-9947993A66E5@rodanotech.ch> Hello, I am writing an OTP application which will create a Mnesia database if needed (will check upon init if schema exists on that node). Since I can't give a path in the mnesia:create_schema(node()) function, from the documentation I read that it takes the environment variable "dir" so I hoped I could pass it in my application file such as this: {application,cs_foundations, [ {description, "Foundations for handling roles and studies"}, {vsn,"1.0.0"}, {modules, [sasl,cs_guuid,cs_mnesia]}, {registered, [cs_guuid,cs_mnesia,cs_foundations_sup]}, {applications, [kernel,stdlib,sasl]}, {env,[]}, {mod, {cs_foundations_app,[]}}, {start_phases, []}, {env, [{core_dir, "/Users/alamb/Data/Mnesia"},{dir, "/Users/alamb/ Data/Mnesia"}]} ] }. Unfortunately, it doesn't seem to work. Any workaround? Thanks, Alex From chsu79@REDACTED Wed Jul 2 17:58:50 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 2 Jul 2008 17:58:50 +0200 Subject: [erlang-questions] Call for Contributions: Mnesia best practices In-Reply-To: <006401c8dc4a$0330ce80$09926b80$@rr.com> References: <006401c8dc4a$0330ce80$09926b80$@rr.com> Message-ID: Now, this is not exactly mnesia, but google application engine's datastore which is based off google bigtable. HOWever, they do present some problems, their causes, and strategies for handling scalability when you have a distributed database.. http://sites.google.com/site/io/building-scalable-web-applications-with-google-app-engine The other google io presentatiosn over at http://sites.google.com/site/io/ on datastore are also worth to see. Also a comment: > * How to partition data between subsystems, without losing the illusion > they're all one big happy system. They are not one big happy system. The illusion must be forgotten and reality must be faced. Things like: Stop doing joins. Instead begin to duplicate data, so it is available directly on first access. Or: Send the code to execute where the data is, instead of sending the data to the machine that has the code. Look at the hoops they go through to implement efficient statistics-counters in the video. ACID properties are a costly luxury, now you have to start conserve your use of it, find when almost or eventual consistency is enough and use that fact. Yes, database programming just got trickier, but if your write-transactions takes 10ms and must wait in a single line, then you can only do 100 of them per second. If that is orders of magnitude less than you need, then it is time to hack around it. Also a word of caution: These strategies are for enormous scalability. You only need them if you already know what problems you're facing with your current overstrained rdbm solution. It takes time to implement these hacks for distributed databases, because the hacks use application specific knowledge that only you can know, because it is your application. From alexander.lamb@REDACTED Wed Jul 2 18:09:27 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Wed, 2 Jul 2008 18:09:27 +0200 Subject: [erlang-questions] Environment variables in applications Message-ID: Ok, I have the env entry twice, but even removing the empty one, I now get the environment variables "dir" and "core_dir" in my program, but mnesia does not seem to take them into account. Alex Le 2 juil. 08 ? 17:41, Alexander Lamb a ?crit : > Hello, > > I am writing an OTP application which will create a Mnesia database if > needed (will check upon init if schema exists on that node). > > Since I can't give a path in the mnesia:create_schema(node()) > function, from the documentation I read that it takes the environment > variable "dir" so I hoped I could pass it in my application file such > as this: > > {application,cs_foundations, > [ > {description, "Foundations for handling roles and studies"}, > {vsn,"1.0.0"}, > {modules, [sasl,cs_guuid,cs_mnesia]}, > {registered, [cs_guuid,cs_mnesia,cs_foundations_sup]}, > {applications, [kernel,stdlib,sasl]}, > {env,[]}, > {mod, {cs_foundations_app,[]}}, > {start_phases, []}, > {env, [{core_dir, "/Users/alamb/Data/Mnesia"},{dir, "/Users/alamb/ > Data/Mnesia"}]} > ] > }. > > Unfortunately, it doesn't seem to work. Any workaround? > > Thanks, > > Alex > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From pfisher@REDACTED Wed Jul 2 18:37:19 2008 From: pfisher@REDACTED (Paul Fisher) Date: Wed, 02 Jul 2008 11:37:19 -0500 Subject: [erlang-questions] Environment variables in applications In-Reply-To: <2942EA69-3570-4B38-9380-9947993A66E5@rodanotech.ch> References: <2942EA69-3570-4B38-9380-9947993A66E5@rodanotech.ch> Message-ID: <1215016639.16472.53.camel@localhost> On Wed, 2008-07-02 at 17:41 +0200, Alexander Lamb wrote: > Hello, > > I am writing an OTP application which will create a Mnesia database if > needed (will check upon init if schema exists on that node). > > Since I can't give a path in the mnesia:create_schema(node()) > function, from the documentation I read that it takes the environment > variable "dir" so I hoped I could pass it in my application file such > as this: It needs to be set as an attribute of the mnesia application and not your application which uses mnesia: $ erl -mnesia dir \"/Users/alamb/Data/Mnesia\" -- paul From notnorwegian@REDACTED Wed Jul 2 23:40:30 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Wed, 2 Jul 2008 21:40:30 +0000 (GMT) Subject: [erlang-questions] erlang = the future? In-Reply-To: <14f0e3620807020334h197430ahf45fe36c7db0f88f@mail.gmail.com> Message-ID: <11864.97714.qm@web27901.mail.ukl.yahoo.com> http://arstechnica.com/news.ars/post/20080702-intel-an-expensive-many-core-future-is-ahead-of-us.html is it just me or could erlang be the future? or in some modified form. i mean if there is so much to gain and erlang does it so well while other languages are awful at it. im glad im learning erlang :) __________________________________________________________ L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 -------------- next part -------------- An HTML attachment was scrubbed... URL: From juanjo@REDACTED Thu Jul 3 00:13:07 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Wed, 2 Jul 2008 19:13:07 -0300 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> Message-ID: <1c3be50f0807021513j54e3053ey9fbe8bc68e536d19@mail.gmail.com> Yes, that's also an option and in fact I am already doing it, because the event message also has all the information corresponding to a channel, and I keep this information as a separate tuple. The main benefit I see with parameterized modules is that I would be able to expose a generic interface for channel events and freely change the underlying representation without having to modify the modules that use them. It's not a huge benefit, but I would certainly use this feature if I had some certainty that it could suddenly disappear from the next version of Erlang. On Tue, Jul 1, 2008 at 9:06 PM, Christian S wrote: > 2008/7/1 Juan Jose Comellas : > > The good thing about this feature is that it provides a way to have an > > "encapsulated" record replacement. > > > The code that receives the events is unnecessary cumbersome because it > needs > > to work with a record within a record. If this was encapsulated within a > > parameterized module, it would become much cleaner. > > Nested records are not nice, no. For the record: > > make_stuff() -> > #fs_channel_event{extra=#fs_channel_answer_event{write_codec_name=rot13}}. > set_stuff(Ex) -> > Ex2 = > Ex#fs_channel_event{extra=(Ex#fs_channel_event.extra)#fs_channel_answer_event{read_codec_name=leetspeak}}. > > So the verbose syntax to do the above is what you want to avoid. > > > > Did you consider using an approach like the following instead? > > AnswerEvent = {#fs_channel_event{}, #fs_answer_event{}} > HangupEvent = {#fs_channel_event{}, #fs_hangup_event{}} > > It's easy to deconstruct a tuple in pattern matching. You dont get the > nesting above. > > make_stuff() -> > {#fs_channel_event{}, #fs_channel_answer_event{write_codec_name=rot13}}. > set_stuff({A, B}) -> > {A, B#fs_channel_answer_event{read_codec_name=leetspeak}}. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From juanjo@REDACTED Thu Jul 3 00:29:33 2008 From: juanjo@REDACTED (Juan Jose Comellas) Date: Wed, 2 Jul 2008 19:29:33 -0300 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <5E4B2A95-DCDA-494E-B345-5E2098743B94@cs.otago.ac.nz> Message-ID: <1c3be50f0807021529o4484b8d3xad2251539d4bdd44@mail.gmail.com> In this case I would not necessarily create a module per type of event, but even if I did, I don't see it as a problem. Each event has several functions associated to them that that are part of the event interface. This functionality, coupled with behaviours could even provide something like the concept of an abstract class. I would probably do what Mochiweb does for the accessors of an HTTP request (src/mochiweb_request.erl int the mochiweb package). The mochiweb_request:get/1 function looks like this: get(socket) -> Socket; get(method) -> Method; get(raw_path) -> RawPath; get(version) -> Version; get(headers) -> Headers; get(peer) -> case inet:peername(Socket) of {ok, {Addr={10, _, _, _}, _Port}} -> case get_header_value("x-forwarded-for") of undefined -> inet_parse:ntoa(Addr); Hosts -> string:strip(lists:last(string:tokens(Hosts, ","))) end; {ok, {{127, 0, 0, 1}, _Port}} -> case get_header_value("x-forwarded-for") of undefined -> "127.0.0.1"; Hosts -> string:strip(lists:last(string:tokens(Hosts, ","))) end; {ok, {Addr, _Port}} -> inet_parse:ntoa(Addr) end; [...] This makes it really easy to deal with the data contained in a request, and you never have to worry about how it is stored in the tuple. My only issue with the current syntax is that the variables from the parameterized module seem "magical", as you can't tell where they came from by just looking at the function. On Tue, Jul 1, 2008 at 10:11 PM, Richard A. O'Keefe wrote: > > On 2 Jul 2008, at 8:59 am, Juan Jose Comellas wrote: > > -record(fs_channel_event, {..lots..,extra}). > -record(fs_channel_answer_event, {..several..}). > -record(fs_channel_hangup_event, {..several..}). > > The code that receives the events is unnecessary cumbersome because it >> needs to work with a record within a record. If this was encapsulated within >> a parameterized module, it would become much cleaner. >> > > I don't quite see how it would, unless, no, you _couldn't_ > be thinking of making a module instance for each channel? > > It's certainly not clear that so heavy a sledgehammer is > needed for this nut. Can you provide an example of the > 'unnecessarily cumbersome code' so we can see if it can > be clarified another way? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From notnorwegian@REDACTED Thu Jul 3 00:35:54 2008 From: notnorwegian@REDACTED (maestro) Date: Wed, 2 Jul 2008 15:35:54 -0700 (PDT) Subject: [erlang-questions] Erlang = the future? Message-ID: <1152496a-520c-4880-acdd-135e06504b1c@25g2000hsx.googlegroups.com> http://arstechnica.com/news.ars/post/20080702-intel-an-expensive-many-core-future-is-ahead-of-us.html is it just me or could erlang be the future? or in some modified form. i mean if there is so much to gain and erlang does it so well while other languages are awful at it. im glad im learning erlang :) From taavi@REDACTED Thu Jul 3 01:19:29 2008 From: taavi@REDACTED (Taavi Talvik) Date: Thu, 3 Jul 2008 02:19:29 +0300 Subject: [erlang-questions] Call for Contributions: Mnesia best practices In-Reply-To: <006401c8dc4a$0330ce80$09926b80$@rr.com> References: <006401c8dc4a$0330ce80$09926b80$@rr.com> Message-ID: <2D92AA94-A4FF-4AA7-9C8E-A9756C75749D@uninet.ee> On Jul 2, 2008, at 4:46 PM, Bob Calco wrote: > I'm looking for thoughts from fellow Erlangers about database design & > implementation in Mnesia. With a heavy SQL background I, like many > relatively new Erlang folks I'm sure, have a tendency to think in > terms of > the capabilities of traditional RDBMSs, and to try to normalize > every data > model with which I come into contact. uninformed comments.. > The question is: What is the best advice you could give a data > architect > about designing and implementing a database in Mnesia from scratch? > Examples > of the kinds of issues I'd like to see folks address: First of all. Mnesia is not actually fully fledged relational database. It is simple key-value thingy with some query capabilities thrown in. On the other hand it is really well distributed. > * How to create an optimal data model for performance (vs. reporting, > comparing the SQL way to the Mnesia way). This question is really > about > normalization in Mnesia vs. SQL, and tricks like storing whole > records in > table fields. There is no silver bullet;) Look at application requirements - for queries used 80% of time is wise to give special attention. And not ownly on database level. Probably much more on application level - should something to be cached, precomputed, distirbuted etc.. > * How to partition data between subsystems, without losing the > illusion > they're all one big happy system. What? Why should application see partitioning? Hide partitioning from consumer with some middleman. Look for classic example of map -> pmap evolution http://www.erlang.org/ml-archive/erlang-questions/200606/msg00187.html > * How to handle complex clustering and failover scenarios Programming reliable systems: http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf Failures will happen - just fail fast and recover fast enough;) > * How to handle calculation-intensive databases (for example, stock > databases that need to constantly recalculate certain attributes for > the > purposes of sorting, searching) Real time? Historical? Process per requesting user? > * How to handle complex domain relationships. For example, let's say > you are > writing a CRM tool and want to store each "person" in the database. > But each > person can also be a colleague, or a client, or an incidental > character > (contact person at some organization). E.e, What do you do when > there is > inheritance in your domain model? Ask from "person" who he is? I.e. create separate process/server/ distributed application and ask via some protocol. Model each entity as process, which knows all messages which can be asked from him. > * What are some current pitfalls or "weak spots" of Mnesia that > ought to be > avoided, however tempting they might be? No "generic" solution for recovering partitioned network. Recovery time after crash. HUGE datasets No nice tools like oracle enterprise manager low level, no referential constraints - i.e. it is not fully fledged RDBMS best regards, taavi From ok@REDACTED Thu Jul 3 02:41:13 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 3 Jul 2008 12:41:13 +1200 Subject: [erlang-questions] conses in erlang? In-Reply-To: <829031.63474.qm@web27904.mail.ukl.yahoo.com> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> Message-ID: <213211FD-38B8-447E-A5E0-3B7B10134A0C@cs.otago.ac.nz> On 2 Jul 2008, at 8:33 pm, not norwegian swede wrote: > can i use conses in erlang? [ H | T ] in Erlang is precisely the same thing as (cons H T) in Scheme. > > like in scheme, then i only need one function. > is the range func in erlang ood erlang-style or is there a better > way to do it? I'm having trouble understanding "range func" and "ood erlang-style". Is that OOD (Object-Oriented Development) or (g)ood? > > (define (seq a b) > (if (< a b) > (cons a (seq (+ a 1) b)) > '())) It is good Scheme style to provide comments. The missing comment here seems to be ;; (seq start end) => (start start+1 ... end-1) ;; that is, the integer interval [start,end). That's a good definition in Scheme because Scheme uses 0 origin indexing and uses a [start,end) convention for slices. In Scheme I might have written (define (seq Start End) (do ((I (- End 1) (- I 1)) (R '() (cons I R))) ((< I Start) R))) Testing the two versions gave me a real shock: the "do" version worked just fine, but the body-recursive version actually crashed the SCM 5b3 system I was testing in. > > > -module(test). > -export([range/2]). > > range(Start, End) when Start < End, is_integer(Start), > is_integer(End) -> > seq(Start, End, []). > > seq(Start, End, List) -> > if Start =< End -> > seq(Start + 1, End, List ++ [Start]); > true -> > List > end. The seq/3 function here uses an 'if'; I believe that Erlang style prefers clause guards to ifs. So range(Start, End) when is_integer(Start), is_integer(End) -> seq(Start, End, []). seq(Start, End, List) when Start <= End -> seq(Start + 1, End, List ++ [Start]); seq(_, _, List) -> List. There is an important difference between your Scheme code and your Erlang code: they do not compute the same result. Your range(1, 4) => [1,2,3,4] whereas (seq 1 4) => (1 2 3). Since Erlang uses 1 origin and (sadly) prefers to use intervals [L,U] rather than [L,U), this is probably what you meant, but it is definitely important enough to include a comment to that effect. The next thing is that Erlang lists are *EXACTLY* like Scheme lists. (More precisely, like R6RS lists, which are by default immutable.) And L1 ++ L2 is how Erlang expresses (append L1 L2). When you are taught Scheme, you are taught to add new elements at the LEFT end of a list (because that is O(1)) instead of the right end (because that is O(n)). [X] ++ L is OK, because it's [X | L] (Scheme `(,X ,@REDACTED)). L ++ [X] is very seldom a good thing to do. A recursive version that agrees with your Scheme version, except for including the upper bound in the result, is range(Start, End) when is_integer(Start), is_integer(End) -> count_up(Start, End). count_up(Start, End) when Start <= End -> [Start | count_up(Start+1, End)]; count_up(_, _) -> []. A tail recursive version like my "do" version is range(Start, End) when is_integer(Start), is_integer(End) -> count_down(Start, End, []). count_down(Start, End, List) when Start <= End -> count_down(Start, End-1, [End|List]); count_down(_, _, List) -> List. From ok@REDACTED Thu Jul 3 02:50:46 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 3 Jul 2008 12:50:46 +1200 Subject: [erlang-questions] is_integer should always be used? In-Reply-To: <754804.50791.qm@web27903.mail.ukl.yahoo.com> References: <754804.50791.qm@web27903.mail.ukl.yahoo.com> Message-ID: On 2 Jul 2008, at 8:38 pm, not norwegian swede wrote: > when programming erlang, should i always use is_integer if a float > will make the function crash? Think about WHY you want to use it. Do you want to make the function crash? But you've said it will anyway. To make the crash report more helpful? Could be useful. To improve the results from the Dialyzer? Are you using it? What does it say? To express your intentions? Best of all. > > > i havent used so much exception-prevention in erlang and it seems > the language needs a lot of extra code stuck it in ebcause of this. Erlang doesn't need any more error detection code than other languages. Some of what might have been type declarations in other languages might show up as executable tests, but on the whole, Erlang tends to use if anything less. > > if some one passes a float to a function that only takes integers, > should i catch that exception or should i let the program crash? Do read Joe Armstrong's thesis. It is plain language with clear ideas and explains the Erlang design philosophy. Part of that philosophy is "let it crash". To really understand that, read the thesis. But here I'll say that you should only catch an exception if there is something useful you can DO about it. If you can figure out what to do after an exception, why didn't you write the code to do that in the first place? Generally speaking, exceptions should be handled some upper level that doesn't care too much about the details of what went wrong (except for logging) but DOES know what it can do instead. From mats.cronqvist@REDACTED Thu Jul 3 10:00:09 2008 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 03 Jul 2008 10:00:09 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18532.54192.651817.522964@hamberg.it.uu.se> References: <18529.883.586609.71953@hamberg.it.uu.se> <18530.17062.650561.451935@hamberg.it.uu.se> <95be1d3b0806251417y33ff2e5br7597757656ce259e@mail.gmail.com> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <18531.60264.991238.276228@harpo.it.uu.se> <4864B150.7060303@gmail.com> <18532.54192.651817.522964@hamberg.it.uu.se> Message-ID: <486C8709.1080804@gmail.com> Sven-Olof Nystr|m wrote: > Mats Cronqvist writes: > > > Selective receive is complex and unnecessary. > > > > > over the years i've worked with perhaps 300 erlang programmers, > > pretty much all of which have been less accomplished computer scientists > > than Sven-Olof. and there are many things in Erlang that they've found > > complex, unnecessary, or both. the syntax, higher order functions, list > > comprehensions, recursion, bignums... pretty much everything in Erlang/OTP. > > everything, that is, except two things; selective receive and hot code > > loading. i can't think of anyone that has found these two things complex > > and unnecessary. > > I guess we'll have to differ on that point. > > I've met many people, who even after having quite a bit of experience > with Erlang had trouble answering simple questions such as: if a > receive matches many patterns, say > > receive > {foo, X} -> ... ; > {bar, Y} -> ... > end > > and there are messages in the mailbox matching both patterns, which > clause and which message is selected? so selective receive is complex, because you've met people who cannot immediately answer trivia questions about it? sounds pretty weak. let me suggest that the people you refer to simply used receive, and since it did what they expected, they never had to look up the description of the semantics. that is, it is the opposite of complex. > > now Sven-Olof is obviously entitled to his opinion > > thanks :-) ...even when it's wrong. what i don't understand is why you spend all this energy trying to change the language in this way. there are already lots of languages that are easy to reason about and has no users... mats From notnorwegian@REDACTED Thu Jul 3 11:04:01 2008 From: notnorwegian@REDACTED (not norwegian swede) Date: Thu, 3 Jul 2008 09:04:01 +0000 (GMT) Subject: [erlang-questions] help with message-passing syntax Message-ID: <845834.39149.qm@web27901.mail.ukl.yahoo.com> im using: http://www.erlang.org/doc/reference_manual/part_frame.html but cant really figure it out. i didnt expect this to work but compiled anyway: 2> c("c:/Program Files/erl5.6.2/usr/serec", [{outdir, "c:/Program Files/erl5.6.2/usr/"}]). c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer/1 undefined c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer2/1 undefined c:/Program Files/erl5.6.2/usr/serec.erl:23: premature end error 3> obv this is just a toy program but say I have a function that squares the integers of a list from 1 to the send parameter. so i want to send a message to that function. -module(serec). -export([seq/2,squarer/1,squarer2/1]). ??????? ? seq(Start, End) -> seq(Start, End, []). seq(Start, End, Acc) when Start =< End -> ?? seq(Start, End-1, [End|Acc]); seq(_, _, Acc) -> ?? Acc. squarer(X) -> ??? receive ?? ?Pattern [when Pattern > 7] -> ?? ???? [X*X || X <- [seq(1, 7]]; ??? end squarer2(X) -> ??? receive ?? ?when X > 7 -> [X*X || X <- [seq(1, 7]]; ??? end squarer(X) ! 2+6 __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Thu Jul 3 11:31:23 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 3 Jul 2008 11:31:23 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <486C8709.1080804@gmail.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <18530.17062.650561.451935@hamberg.it.uu.se> <95be1d3b0806251417y33ff2e5br7597757656ce259e@mail.gmail.com> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <18531.60264.991238.276228@harpo.it.uu.se> <4864B150.7060303@gmail.com> <18532.54192.651817.522964@hamberg.it.uu.se> <486C8709.1080804@gmail.com> Message-ID: <4d08db370807030231o1d5df0eah216f506d1519f86a@mail.gmail.com> On Thu, Jul 3, 2008 at 10:00 AM, Mats Cronqvist wrote: > Sven-Olof Nystr|m wrote: > > Mats Cronqvist writes: > > > > Selective receive is complex and unnecessary. > > > > > > > over the years i've worked with perhaps 300 erlang programmers, > > > pretty much all of which have been less accomplished computer > scientists > > > than Sven-Olof. and there are many things in Erlang that they've found > > > complex, unnecessary, or both. the syntax, higher order functions, > list > > > comprehensions, recursion, bignums... pretty much everything in > Erlang/OTP. > > > everything, that is, except two things; selective receive and hot > code > > > loading. i can't think of anyone that has found these two things > complex > > > and unnecessary. > > > > I guess we'll have to differ on that point. > > > > I've met many people, who even after having quite a bit of experience > > with Erlang had trouble answering simple questions such as: if a > > receive matches many patterns, say > > > > receive > > {foo, X} -> ... ; > > {bar, Y} -> ... > > end > > > > and there are messages in the mailbox matching both patterns, which > > clause and which message is selected? > > so selective receive is complex, because you've met people who cannot > immediately answer trivia questions about it? sounds pretty weak. > let me suggest that the people you refer to simply used receive, and > since it did what they expected, they never had to look up the > description of the semantics. that is, it is the opposite of complex. > I agree with you. Selective receive is very familiar for me. I do it every day. Every day messages comes to my mailbox and every day I do selective receive. Every day mails arrives to my mail box, mails from people what I love, ones from people what I like, ones from people what I hate, ones important, ones not important and spam. Every day I do exactly same think as Erlang do. I give mail by mail and check it against patterns and do something with it immediately, or push it to some queue or storage, or ignore (don't receive and leave untouched in mailbox). May be not it is efficient but very familiar to me. I don't know how to handle with channels. May be because I'm not plumber :-) I love Erlang because it do thinks very familiar to me, not only mail box handling but almost everything. For example recursion. How little baby learn count think. On start you know count in nothing. Take first think and increase counter by one and do this step again until all thinks done, than return result. length(L) -> length(L, 0). length([_|R], N) -> length(R, N+1); length([], N) -> N. Little baby use similar algorithm for tidy up mess. tidy_up([OneThing|RestOfMess]) -> tidy_up(OneThink), tidy_up(RestOfMess); tidy_up([]) -> hurray; tidy_up(Any) -> store_in_proper_place(Any). Selective receive is familiar for me in same manner, It is recursive and simple too. (Notice that this algorithm works properly on deep list too.) > > > > now Sven-Olof is obviously entitled to his opinion > > > > thanks :-) > ...even when it's wrong. > > what i don't understand is why you spend all this energy trying to > change the language in this way. there are already lots of languages > that are easy to reason about and has no users... > > mats > _______________________________________________ > 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 bqt@REDACTED Thu Jul 3 11:35:35 2008 From: bqt@REDACTED (Johnny Billquist) Date: Thu, 03 Jul 2008 11:35:35 +0200 Subject: [erlang-questions] conses in erlang? In-Reply-To: <213211FD-38B8-447E-A5E0-3B7B10134A0C@cs.otago.ac.nz> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> <213211FD-38B8-447E-A5E0-3B7B10134A0C@cs.otago.ac.nz> Message-ID: <486C9D67.5040107@softjar.se> Richard A. O'Keefe skrev: > On 2 Jul 2008, at 8:33 pm, not norwegian swede wrote: >> can i use conses in erlang? > > [ H | T ] in Erlang is precisely the same thing as (cons H T) in Scheme. But it's totally the same as a cons in Lisp. But maybe they are similar enough for pm's needs to not require any further discussion? Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt@REDACTED || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol From bqt@REDACTED Thu Jul 3 13:11:36 2008 From: bqt@REDACTED (Johnny Billquist) Date: Thu, 03 Jul 2008 13:11:36 +0200 Subject: [erlang-questions] conses in erlang? In-Reply-To: <486C9D67.5040107@softjar.se> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> <213211FD-38B8-447E-A5E0-3B7B10134A0C@cs.otago.ac.nz> <486C9D67.5040107@softjar.se> Message-ID: <486CB3E8.4010104@softjar.se> Johnny Billquist wrote: > Richard A. O'Keefe skrev: >> On 2 Jul 2008, at 8:33 pm, not norwegian swede wrote: >>> can i use conses in erlang? >> [ H | T ] in Erlang is precisely the same thing as (cons H T) in Scheme. > > But it's totally the same as a cons in Lisp. Argh! I meant to say that it's *not* entirely the same thing as a cons in Lisp (my memory of Scheme is rusty, so I can't say for sure how a cons in Scheme works). > But maybe they are similar enough for pm's needs to not require any further > discussion? Johnny From zerthurd@REDACTED Thu Jul 3 13:23:56 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Thu, 3 Jul 2008 18:23:56 +0700 Subject: [erlang-questions] program.conf modification Message-ID: Hello When I write my program using application behaviour, I use config-file, specified by erl -config program.conf. Is there any standard way to modify it with erlang code? I.e. something alike: Config = [{parm1, value1}, {parm2, value2}], some_module:store_config(program, Config). This code stores composed configuration to program.conf. May be is there other way to do something like this? Thank you -- Maxim Treskin From thomasl_erlang@REDACTED Thu Jul 3 13:56:39 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 3 Jul 2008 04:56:39 -0700 (PDT) Subject: [erlang-questions] Announce: etorrent 0.8 In-Reply-To: <56a0a2840806280644n4f9df152v7ad42e353adffcd5@mail.gmail.com> Message-ID: <605629.24123.qm@web38803.mail.mud.yahoo.com> --- On Sat, 6/28/08, Jesper Louis Andersen wrote: > etorrent is a bittorrent client written entirely in Erlang. Cool! Best, Thomas From alpar@REDACTED Thu Jul 3 14:16:40 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 03 Jul 2008 13:16:40 +0100 Subject: [erlang-questions] Reference counting instead of GC? Message-ID: <1215087400.4589.56.camel@piko.site> Hi, Did anyone consider replacing the garbage collection with reference counting in the Erlang emulator? How difficult would it be to do? Probably, it isn't worth changing in general, but reference counting has some advantages which are important in some special use cases: * Per process memory pools is not necessary. * Message passing (of large data) will be more efficient as messages don't have to be physically copied. * There is no need for garbage collection. GC is for example a major pitfall in hard real time systems (see e.g. http://www.erlang.se/workshop/2007/proceedings/05nicosi.pdf ) Here are the drawbacks I can see now: * Higher memory overhead. * However the memory is less fragmented, so we get back something in return. * It is said to be slower. I'm not absolutely convinced about it though. * In general, the highest problem with reference counting is that in case of cross/circular referencing, dead objects will be left in the memory. However, this cannot happen in Erlang due to the immutability of the data. Regards, Alpar From adam@REDACTED Thu Jul 3 14:54:16 2008 From: adam@REDACTED (Adam Lindberg) Date: Thu, 3 Jul 2008 14:54:16 +0200 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> Message-ID: <6344005f0807030554mfdba8f9h5b662c337a142732@mail.gmail.com> On Tue, Jul 1, 2008 at 11:04, Kenneth Lundin wrote: > Even if I agree with the other answerers that the need to use regular > expressions is often an indication > that the algorithm can be improved and maybe changed to not use > regular expressions at all It is worth mentioning that > in the R12B-3 release there is a fast implementation of regular > expressions in the re module. Off-topic: Well, yours is the first post trying to answer the question asked in the first place. It's very bad when a user asks a question and only gets feedback like "your way of doing it sucks." Cheers! Adam From jan@REDACTED Thu Jul 3 16:09:12 2008 From: jan@REDACTED (Jan Lehnardt) Date: Thu, 3 Jul 2008 16:09:12 +0200 Subject: [erlang-questions] CouchDB - An Erlang Project Message-ID: Dear Erlang Community, I'd like to tell you about a project that you might have heard about, but don't know a lot about: Enter CouchDB. CouchDB is written an Erlang (why would I write otherwise), but not very well established in the Erlang community. I'd like to change this fact with the help of this email. I went to the Erlang eXchange last week only to discover that when I tell you guys about CouchDB, you get very enthusiastic. Now, not all of you were in London and I'd like you to give a chance to get enthusiastic, or at least interested. (Sounds a bit like I would make a decent sales person, not bad for a programmer...) CouchDB is a distributed document database written in less then 7k lines of pure Erlang (with a bit of C mixed in). Here's the pitch: Most data is not inherently relational, yet relational databases are often the default when it comes to storing data. The downside is that an RDBMS is hard to learn and use upfront and hard to scale later. You have been working with non-relational databases for decades, you know that they are easier to use and easier to scale. CouchDB's main API is RESTful. It talks HTTP natively. This helps to reduce the learning curve further since everybody knows HTTP and all our tools support HTTP. All you need to talk to CouchDB is a browser! CouchDB stores data in the JSON format (through the API and in Erlang terms internally). It targets not only Erlang developers but everybody and JSON allows it to read and write everybody's data. CouchDB is built for concurrency. It stores data in an ACID compliant MVCC data store. It supports any number of parallel read and serialised write access. The data storage module is optimised to reduce hard-drive head seeks on reads and writes. It never overwrites data that is safe on disk and as a result, when it reports a write operation to be finished, the database files are guaranteed to be consistent on disk. If it crashes or if the hardware goes away, CouchDB just restarts later and is up and running without the need to run any lengthy consistency checks. To make sense of the no-schema data you can store with CouchDB, it support views. A map-reduce powered mechanism that allows you to filter, collate and aggregate your data that can be massively parallelised. A single-node database is no good in the modern computing world. To mitigate this problem CouchDB comes with a world-class replication system (that is influenced by the Lotus Notes database, but don't tell anybody!). Replication solves the general problem of data synchronisation. Be it for fault tolerance, load balancing or distributed- (and offline-) work environments. It comes with automatic conflict detection and resolution. Pretty awesome. Finally, CouchDB is free software released under the BSD-like Apache 2.0 license. See http://incubator.apache.org/couchdb/docs/overview.html for a more complete overview of what CouchDB wants to be. A lot of things are working today and are working well, but it still misses a few crucial features. Maybe you can jump aboard and help out? If you do, get in touch. -- Thanks for listening, this was a long read and I apologise, but I couldn't find less words to tell the same. To wrap this up: You guys seem to be running an awesome party, can we join? Cheers Jan -- PS: You can find CouchDB at http://couchdb.org/ and you can even follow it on Twitter at http://twitter.com/CouchDB From csanto@REDACTED Thu Jul 3 16:23:34 2008 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 03 Jul 2008 16:23:34 +0200 Subject: [erlang-questions] Small Erlang VM Message-ID: <486CE0E6.2010706@diit.unict.it> Dear all, I would like to have an erlang VM onto a small embedded system, that is an ARM7 machine, with 256K of flash and 64K or RAM. I have in mind something like the BEAM emulator and only a minimal subset of libraries and OTP system. Could anyone have some suggestions or pointers for such an idea? Thanks. All the best, --Corrado -- ================================================================== 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 thomasl_erlang@REDACTED Thu Jul 3 16:41:35 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 3 Jul 2008 07:41:35 -0700 (PDT) Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <1215087400.4589.56.camel@piko.site> Message-ID: <451975.67076.qm@web38806.mail.mud.yahoo.com> --- On Thu, 7/3/08, Alp?r J?ttner wrote: > Did anyone consider replacing the garbage collection with > reference > counting in the Erlang emulator? How difficult would it be > to do? Good luck :-) However, note that the hipe guys have over the years proposed garbage collectors with most of the good properties you mention. (Cf the "shared" and "hybrid" emulators. E.g., "erl -hybrid".) Also note that simple reference counting does not guarantee real time collection or bounded or even short pauses. Consider the case when you drop a big term: a reference counting implementation must decrement the reference counts of all subterms (recursively), while a copying collector won't even visit the dead data. Because the dead term can have arbitrary size, the pause while it is traversed is not bounded. (But you may be thinking of more sophisticated variants than that.) Best, Thomas From richardc@REDACTED Thu Jul 3 16:46:39 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 03 Jul 2008 16:46:39 +0200 Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <1215087400.4589.56.camel@piko.site> References: <1215087400.4589.56.camel@piko.site> Message-ID: <486CE64F.9030902@it.uu.se> Alp?r J?ttner wrote: > Hi, > > Did anyone consider replacing the garbage collection with reference > counting in the Erlang emulator? How difficult would it be to do? Perhaps not "difficult", but lots of tedious and error-prone work. > Probably, it isn't worth changing in general, but reference counting has > some advantages which are important in some special use cases: > > * Per process memory pools is not necessary. > * Message passing (of large data) will be more efficient as > messages don't have to be physically copied. > * There is no need for garbage collection. GC is for example a > major pitfall in hard real time systems (see e.g. > http://www.erlang.se/workshop/2007/proceedings/05nicosi.pdf ) > > Here are the drawbacks I can see now: > > * Higher memory overhead. > * However the memory is less fragmented, so we get back > something in return. > * It is said to be slower. I'm not absolutely convinced about it > though. > * In general, the highest problem with reference counting is that > in case of cross/circular referencing, dead objects will be left > in the memory. However, this cannot happen in Erlang due to the > immutability of the data. Reference counting would most certainly both be slower and use more memory, in the cases where it matters the most for Erlang: lists and tuples, floats, small binaries, and large pids and refs. On the other hand, large binaries are already handled by reference counting in the BEAM, so you already have the advantages that you list, for big objects. /Richard From dmercer@REDACTED Thu Jul 3 17:01:41 2008 From: dmercer@REDACTED (David Mercer) Date: Thu, 3 Jul 2008 10:01:41 -0500 Subject: [erlang-questions] is_integer should always be used? In-Reply-To: References: <754804.50791.qm@web27903.mail.ukl.yahoo.com> Message-ID: <002901c8dd1d$b47e8640$f21ea8c0@SSI.CORP> On Wednesday, July 02, 2008 at 19:51, Richard A. O'Keefe wrote: > On 2 Jul 2008, at 8:38 pm, not norwegian swede wrote: > > when programming erlang, should i always use is_integer if a float > > will make the function crash? > > Think about WHY you want to use it. > Do you want to make the function crash? But you've said it will anyway. > To make the crash report more helpful? Could be useful. > To improve the results from the Dialyzer? Are you using it? What > does it say? > To express your intentions? Best of all. I tend to use the is_integer guard on exported functions that expect an integer because: 1. Have been told Dialyzer will do better with it. 2. It does express my intention better. 3. There might be compiler optimizations that can be done if the compiler knows the argument is an integer. Similar to what you see in Common Lisp. Also, however, I do not use the guard on nonexported functions, because I don't need the check being done more than once. This is kind of in conflict with #3, but my reasoning is that there is overhead to the check, and any sufficiently smart compiler can figure out that only integers come in as the argument based on a Dialyzer-like check, so there should be no need to incur the overhead again. My guess is that there are not, as yet, any compiler optimizations done on integers, but my hope is that there will be in the future. In the meantime, I've still got reasons 1 and 2. Is my reasoning sound, or just fantasy? Cheers, David From dmercer@REDACTED Thu Jul 3 17:04:22 2008 From: dmercer@REDACTED (David Mercer) Date: Thu, 3 Jul 2008 10:04:22 -0500 Subject: [erlang-questions] help with message-passing syntax In-Reply-To: <845834.39149.qm@web27901.mail.ukl.yahoo.com> References: <845834.39149.qm@web27901.mail.ukl.yahoo.com> Message-ID: <002a01c8dd1e$141c5e60$f21ea8c0@SSI.CORP> You don?t send messages to functions, you send them to processes. Also, you?re missing periods after the squarer and squarer2 functions (after the ends), which accounts for two of the compiler errors. _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of not norwegian swede Sent: Thursday, July 03, 2008 04:04 To: erlang-questions@REDACTED Subject: [erlang-questions] help with message-passing syntax im using: http://www.erlang.org/doc/reference_manual/part_frame.html but cant really figure it out. i didnt expect this to work but compiled anyway: 2> c("c:/Program Files/erl5.6.2/usr/serec", [{outdir, "c:/Program Files/erl5.6.2/usr/"}]). c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer/1 undefined c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer2/1 undefined c:/Program Files/erl5.6.2/usr/serec.erl:23: premature end error 3> obv this is just a toy program but say I have a function that squares the integers of a list from 1 to the send parameter. so i want to send a message to that function. -module(serec). -export([seq/2,squarer/1,squarer2/1]). seq(Start, End) -> seq(Start, End, []). seq(Start, End, Acc) when Start =< End -> seq(Start, End-1, [End|Acc]); seq(_, _, Acc) -> Acc. squarer(X) -> receive Pattern [when Pattern > 7] -> [X*X || X <- [seq(1, 7]]; end squarer2(X) -> receive when X > 7 -> [X*X || X <- [seq(1, 7]]; end squarer(X) ! 2+6 _____ L?na pengar utan s?kerhet. S?k och j?mf?r l?n hos Kelkoo. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pfisher@REDACTED Thu Jul 3 17:12:27 2008 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 03 Jul 2008 10:12:27 -0500 Subject: [erlang-questions] erts design information/experts around? Message-ID: <1215097947.6659.22.camel@localhost> I sent the following note to erlang-bugs two days ago and have not seen anyone comment. > 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 > ?This is not the first email about runtime internals that I have sent which has gone without comment, and so I am wondering if the people with detailed knowledge of the runtime do not follow these lists. Is there a better place/way to get in contact? (What I am really looking for is a discussion of the overall internals design of the smp runtime structures, so that I can get a jump start on fixing these types of thing myself.) thanks in advance, -- paul From kostis@REDACTED Thu Jul 3 17:24:32 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 03 Jul 2008 18:24:32 +0300 Subject: [erlang-questions] is_integer should always be used? In-Reply-To: <002901c8dd1d$b47e8640$f21ea8c0@SSI.CORP> References: <754804.50791.qm@web27903.mail.ukl.yahoo.com> <002901c8dd1d$b47e8640$f21ea8c0@SSI.CORP> Message-ID: <486CEF30.1050906@cs.ntua.gr> David Mercer wrote: > On Wednesday, July 02, 2008 at 19:51, Richard A. O'Keefe wrote: >> On 2 Jul 2008, at 8:38 pm, not norwegian swede wrote: >>> when programming erlang, should i always use is_integer if a float >>> will make the function crash? >> Think about WHY you want to use it. >> Do you want to make the function crash? But you've said it will anyway. >> To make the crash report more helpful? Could be useful. >> To improve the results from the Dialyzer? Are you using it? What >> does it say? >> To express your intentions? Best of all. > > I tend to use the is_integer guard on exported functions that expect an > integer because: > > 1. Have been told Dialyzer will do better with it. > > 2. It does express my intention better. > > 3. There might be compiler optimizations that can be done if the compiler > knows the argument is an integer. Similar to what you see in Common Lisp. > > Also, however, I do not use the guard on nonexported functions, because I > don't need the check being done more than once. This is kind of in conflict > with #3, but my reasoning is that there is overhead to the check, and any > sufficiently smart compiler can figure out that only integers come in as the > argument based on a Dialyzer-like check, so there should be no need to incur > the overhead again. I want to second the arguments given by David. His programming attitude towards the use of guards is worth understanding and following. > My guess is that there are not, as yet, any compiler optimizations done on > integers, but my hope is that there will be in the future. Well, in the native code compiler, there are some optimizations for integers, especially integers which can be proven to be within a bounded range. Kostis From vychodil.hynek@REDACTED Thu Jul 3 17:47:51 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 3 Jul 2008 17:47:51 +0200 Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <1215087400.4589.56.camel@piko.site> References: <1215087400.4589.56.camel@piko.site> Message-ID: <4d08db370807030847q291e4545x595003dd901ef72@mail.gmail.com> Message don't copy for example Termite (http://toute.ca/) and this is of course faster for big messages. But there is many good reasons why Erlang is as is. Counting GC is in some cases slower than generating GC especially on multi core. For example, when you do walking tree, in current GC schema you can copy after 1000 reduces small resulting tree and during those reduction you don't GC anything. Contrary counting GC every change of tree and each GC step can take unpredictable different long time. Current GC occurs once after longer period and depend only on size off current data. In result it is faster on single core. There is more fun with multi core. When processes share data (don't copy message), counter for each structure can be accessed by many processes running possibly on many CPU cores. CPU cache don't work well in this case and operation is slow. So counting GC is slow in concurrent environment. Counting GC is not as good as looks in first sight. When there is possibility to pack big messages into binary which is not copied, you are able solve pitfalls of Erlang implementation. And share anything between processes also impact reliability, of course. I don't believe change GC is good idea except you want just try it. On Thu, Jul 3, 2008 at 2:16 PM, Alp?r J?ttner wrote: > Hi, > > Did anyone consider replacing the garbage collection with reference > counting in the Erlang emulator? How difficult would it be to do? > > Probably, it isn't worth changing in general, but reference counting has > some advantages which are important in some special use cases: > > * Per process memory pools is not necessary. > * Message passing (of large data) will be more efficient as > messages don't have to be physically copied. > * There is no need for garbage collection. GC is for example a > major pitfall in hard real time systems (see e.g. > http://www.erlang.se/workshop/2007/proceedings/05nicosi.pdf ) > > Here are the drawbacks I can see now: > > * Higher memory overhead. > * However the memory is less fragmented, so we get back > something in return. > * It is said to be slower. I'm not absolutely convinced about it > though. > * In general, the highest problem with reference counting is that > in case of cross/circular referencing, dead objects will be left > in the memory. However, this cannot happen in Erlang due to the > immutability of the data. > > Regards, > Alpar > > > _______________________________________________ > 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 thomasl_erlang@REDACTED Thu Jul 3 17:51:14 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 3 Jul 2008 08:51:14 -0700 (PDT) Subject: [erlang-questions] how: info on how to traverse abstract format trees? In-Reply-To: <79854fe0-10a0-4cd6-990f-d9f7d38af651@27g2000hsf.googlegroups.com> Message-ID: <183192.87774.qm@web38801.mail.mud.yahoo.com> --- On Tue, 6/24/08, Tim Fletcher wrote: > I'm just checking to see if there might be some > recommended/documented > way of doing such a traversal. Trying to work it out from > parse > transform code directly is a bit intimidating (which is why > frabjous > is very appealing). Personally, I've always tended to write my own, among other things because the appropriate traversal differs depending on what you want to do. But the erlang distribution itself includes a few hints: * erl_id_trans.erl contains a skeleton parse transform * The syntax_tools application provides some stuff you may like * I think the abstract forms format is documented somewhere too Best, Thomas From raimo+erlang-questions@REDACTED Thu Jul 3 17:53:03 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 3 Jul 2008 17:53:03 +0200 Subject: [erlang-questions] erts design information/experts around? In-Reply-To: <1215097947.6659.22.camel@localhost> References: <1215097947.6659.22.camel@localhost> Message-ID: <20080703155303.GA5148@erix.ericsson.se> On Thu, Jul 03, 2008 at 10:12:27AM -0500, Paul Fisher wrote: > I sent the following note to erlang-bugs two days ago and have not seen > anyone comment. > > > 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 > > > > ???This is not the first email about runtime internals that I have sent > which has gone without comment, and so I am wondering if the people with > detailed knowledge of the runtime do not follow these lists. > They are on vacation. We would need both the experts on SMP and the experts on Windows debugging. Were it on Unix we would have requested a core dump, but on Windows I do not know if there is such a thing, or if there has to be a VisualStudio 8 installation plus source code on the failing machine. The experts on Windows debugging would know. > Is there a better place/way to get in contact? (What I am really > looking for is a discussion of the overall internals design of the smp > runtime structures, so that I can get a jump start on fixing these types > of thing myself.) Erlang-questions is a good place. Here there are lots of smart guys that not all read erlang-bugs and may have a clue. > > thanks in advance, > > > -- > paul > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mikpe@REDACTED Thu Jul 3 17:57:33 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 3 Jul 2008 17:57:33 +0200 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <486CE0E6.2010706@diit.unict.it> References: <486CE0E6.2010706@diit.unict.it> Message-ID: <18540.63213.648673.758044@harpo.it.uu.se> Corrado Santoro writes: > Dear all, > > I would like to have an erlang VM onto a small embedded system, that is > an ARM7 machine, with 256K of flash and 64K or RAM. I have in mind > something like the BEAM emulator and only a minimal subset of libraries > and OTP system. Forget about BEAM, for a system this small you need to design the entire compiler/VM/interpreter from scratch for small space. I assume the ARM7 has Thumb(-1) but not Thumb-2? > Could anyone have some suggestions or pointers for such an idea? Off the top of my head: - stack-based VM with implicit operands, easy to compile to and quite compact - high-level VM instructions - don't do excessive special-casing of simple instructions, that eats a lot of code space - configurable set of BIFs and libraries - maybe consider dropping some high-level language features, like live code upgrades - if you're _really_ pressed for space, drop flonums (dropping bignums might be difficult if your implementation uses fixnums, but could save a lot of code space; for an embedded system you might be better off with a plain 32-bit integer type with overflow detection rather than sub-32-bit fixnums plus bignums, although the language wouldn't quite be Erlang) - build the application into the VM, so you can store the compiled Erlang code in flash rather than RAM, leaving RAM used only for dynamically allocated data Google. Look for ACM's PLDI and various functional programming conference proceedings, and maybe ASPLOS as well. OOPSLA is a load of crap nowadays, but older ones can have interesting implementation papers. I've seen some papers on small Scheme systems from Guy Feeley's students that be interesting. For GC consider some mark-sweep variation with compaction, as copying collectors use more address space. From pfisher@REDACTED Thu Jul 3 18:11:31 2008 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 03 Jul 2008 11:11:31 -0500 Subject: [erlang-questions] erts design information/experts around? In-Reply-To: <20080703155303.GA5148@erix.ericsson.se> References: <1215097947.6659.22.camel@localhost> <20080703155303.GA5148@erix.ericsson.se> Message-ID: <1215101491.6659.41.camel@localhost> On Thu, 2008-07-03 at 17:53 +0200, Raimo Niskanen wrote: > On Thu, Jul 03, 2008 at 10:12:27AM -0500, Paul Fisher wrote: > > I sent the following note to erlang-bugs two days ago and have not seen > > anyone comment. > > > > > 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 > > > > > > > ???This is not the first email about runtime internals that I have sent > > which has gone without comment, and so I am wondering if the people with > > detailed knowledge of the runtime do not follow these lists. > > > > They are on vacation. We would need both the experts on > SMP and the experts on Windows debugging. Vacation explains it, thx! My fault, this is R12B-3 on 64-bit Intel Linux (debian etch). Also happens on R12B-2 in the same way. > > Is there a better place/way to get in contact? (What I am really > > looking for is a discussion of the overall internals design of the smp > > runtime structures, so that I can get a jump start on fixing these types > > of thing myself.) > > Erlang-questions is a good place. Here there are lots of > smart guys that not all read erlang-bugs and may > have a clue. In the hopes that someone on the list can give some insight into the invariants maintained by the runtime while managing port instances, I had the following question(s) about the erts_ports[] array maintained by the runtime: 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. ?So two question: 1) is whether the assumption built into this code is correct? 2) if so, is there missing synchronization that allows violating these assumptions?. I'd appreciate some insight into what could be going on here, and where I should start looking. -- paul From csanto@REDACTED Thu Jul 3 18:35:14 2008 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 03 Jul 2008 18:35:14 +0200 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <18540.63213.648673.758044@harpo.it.uu.se> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> Message-ID: <486CFFC2.50104@diit.unict.it> Mikael Pettersson wrote: > Forget about BEAM, for a system this small you need to design > the entire compiler/VM/interpreter from scratch for small space. I was quite sure that I had to design the VM from scratch, but my idea was not to do the same for the compiler; I would like to start from the .beam file and write the interpreter, but, as far as I know, an official specification of .beam and of the instruction set does not exist. In any case, I'll follow your suggestions. Thanks! --Corrado -- ================================================================== 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 rtrlists@REDACTED Thu Jul 3 18:48:31 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 3 Jul 2008 17:48:31 +0100 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <486CFFC2.50104@diit.unict.it> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> Message-ID: <6a3ae47e0807030948h751f6f06occ98dc2b33c2c7b0@mail.gmail.com> Hmm, are you sure you meant Kilo in your mem sizes? The ARM7 sounds likely to be used more in the Mega category (iPod etc.). Robby From erlang-questions_efine@REDACTED Thu Jul 3 18:52:58 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 3 Jul 2008 12:52:58 -0400 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <486CFFC2.50104@diit.unict.it> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> Message-ID: <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> I understand why you would want to use Erlang, but instead of writing an entire interpreter with all the complexity that entails, would you consider using another language that is very good in extremely resource-restricted environments? FORTH comes to mind. If you just want to Get Things Done, that is; if you are constrained to use Erlang, that's a different matter. On Thu, Jul 3, 2008 at 12:35 PM, Corrado Santoro wrote: > Mikael Pettersson wrote: > > Forget about BEAM, for a system this small you need to design > > the entire compiler/VM/interpreter from scratch for small space. > I was quite sure that I had to design the VM from scratch, but my idea > was not to do the same for the compiler; I would like to start from the > .beam file and write the interpreter, but, as far as I know, an official > specification of .beam and of the instruction set does not exist. > > In any case, I'll follow your suggestions. > > Thanks! > > --Corrado > > -- > ================================================================== > 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 > ================================================================== > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Thu Jul 3 19:35:01 2008 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 03 Jul 2008 19:35:01 +0200 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <6a3ae47e0807030948h751f6f06occ98dc2b33c2c7b0@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6a3ae47e0807030948h751f6f06occ98dc2b33c2c7b0@mail.gmail.com> Message-ID: <486D0DC5.2030302@diit.unict.it> Robert Raschke wrote: > Hmm, are you sure you meant Kilo in your mem sizes? The ARM7 sounds > likely to be used more in the Mega category (iPod etc.). Yes, kilo kilo... I'm talking about the NXT Processor of the Lego Mindstorm robotic kit; there is a Java VM (leJOS) and I'm using it, but I wonder if I could do the same thing with Erlang :-) --Corrado -- ================================================================== 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 alpar@REDACTED Thu Jul 3 23:49:46 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 03 Jul 2008 22:49:46 +0100 Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <451975.67076.qm@web38806.mail.mud.yahoo.com> References: <451975.67076.qm@web38806.mail.mud.yahoo.com> Message-ID: <1215121786.3695.50.camel@piko.site> On Thu, 2008-07-03 at 07:41 -0700, Thomas Lindgren wrote: > Good luck :-) However, note that the hipe guys have over the years > proposed garbage collectors with most of the good properties you > mention. (Cf the "shared" and "hybrid" emulators. E.g., "erl > -hybrid".) Could you tell me where can I find some info about these modes? The erl manual doesn't even list the -shared and the -hybrid switches. > Also note that simple reference counting does not guarantee real time > collection or bounded or even short pauses. Consider the case when you > drop a big term: a reference counting implementation must decrement > the reference counts of all subterms (recursively), while a copying > collector won't even visit the dead data. > Because the dead term can > have arbitrary size, the pause while it is traversed is not bounded. Yes but at least it is a deterministic and predictable time you can calculate with. > (But you may be thinking of more sophisticated variants than that.) Yes indeed, the process of dropping the unused terms can be safely interrupted. In fact, my idea was to have a special (low priority) process in the emulator taking care of the unused terms. In this way the dropping of big data could be automatically postponed if there are "more urgent" things to do. Best regards, Alpar From alpar@REDACTED Fri Jul 4 00:03:44 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 03 Jul 2008 23:03:44 +0100 Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <4d08db370807030847q291e4545x595003dd901ef72@mail.gmail.com> References: <1215087400.4589.56.camel@piko.site> <4d08db370807030847q291e4545x595003dd901ef72@mail.gmail.com> Message-ID: <1215122624.3695.62.camel@piko.site> On Thu, 2008-07-03 at 17:47 +0200, Hynek Vychodil wrote: > Message don't copy for example Termite (http://toute.ca/) and this is > of course faster for big messages. But there is many good reasons why > Erlang is as is. >[...] >I don't believe change GC is good idea except you want just try it. I didn't want to suggest replacing GC in the mainstream erlang. However I have a feeling that the reference counting approach has some considerable advantages in some _special_ applications, for example * when an erlang(-like) system is operated on very low capacity hardware and/or * for hard real time applications. Best regards, Alpar From erlang@REDACTED Fri Jul 4 00:11:36 2008 From: erlang@REDACTED (Dominic Williams) Date: Fri, 04 Jul 2008 00:11:36 +0200 Subject: [erlang-questions] is_integer should always be used? In-Reply-To: <754804.50791.qm@web27903.mail.ukl.yahoo.com> References: <754804.50791.qm@web27903.mail.ukl.yahoo.com> Message-ID: <486D4E98.3070701@dominicwilliams.net> not norwegian swede a ?crit : > when programming erlang, should i always use is_integer > if a float will make the function crash? I think not. I think guards should not be used for type checking, but used to write different clauses, when you want to handle floats and ints differently. Of course, I use test-driven programming, so I don't need type checking for correctness. And the tests I write are better at expressing how I intend the function to be used than a mere guard. And adding a guard for optimisation's sake would be premature, without profiling. So, as a general rule, I let it crash, I don't use a guard. > i havent used so much exception-prevention in erlang and > it seems the language needs a lot of extra code stuck it > in ebcause of this. You must not be coding in Erlang the same way as I. I have never had as little exception-handling code as when I code in Erlang. Regards, Dominic Williams http://dominicwilliams.net From alpar@REDACTED Fri Jul 4 00:22:13 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 03 Jul 2008 23:22:13 +0100 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> Message-ID: <1215123733.3695.78.camel@piko.site> On Thu, 2008-07-03 at 12:52 -0400, Edwin Fine wrote: > I understand why you would want to use Erlang, but instead of writing > an entire interpreter with all the complexity that entails, would you > consider using another language that is very good in extremely > resource-restricted environments? FORTH comes to mind. If you just > want to Get Things Done, that is; I don't think so. For example I'm working on a controlling application which could probably run on the weakest possible hardware, but would be a great struggle to implement in any sequential programming language (because I need the various timers and complex scheduling of action and handing of events). For these kinds of tasks, Erlang fits extremely well. I think a lightweight version of the erlang emulator could find a lot of applications in this area. Best regards, Alpar From thomasl_erlang@REDACTED Fri Jul 4 01:13:45 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 3 Jul 2008 16:13:45 -0700 (PDT) Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <1215121786.3695.50.camel@piko.site> Message-ID: <457169.23067.qm@web38803.mail.mud.yahoo.com> --- On Thu, 7/3/08, Alp?r J?ttner wrote: > Could you tell me where can I find some info about these > modes? The erl > manual doesn't even list the -shared and the -hybrid > switches. The authors are probably the ultimate sources. I don't know of any official documentation. > In fact, my idea was to have a special (low priority) > process in the > emulator taking care of the unused terms. In this way the > dropping of > big data could be automatically postponed if there are > "more urgent" > things to do. You will still get a form of priority inversion if the collector can't keep up with the mutator. But best of luck with your project, it sounds like an interesting topic to attack. Best, Thomas From roger.larsson@REDACTED Fri Jul 4 02:07:53 2008 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 4 Jul 2008 02:07:53 +0200 Subject: [erlang-questions] Small Erlang VM [for Lego NXT] In-Reply-To: <18540.63213.648673.758044@harpo.it.uu.se> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> Message-ID: <200807040207.54774.roger.larsson@e-gatan.se> I have also been looking into running Erlang on a NXT brick... It would be extra cool since Erlang was Danish mathematician http://en.wikipedia.org/wiki/Agner_Krarup_Erlang On Thursday 03 July 2008, Mikael Pettersson wrote: > Corrado Santoro writes: > > Dear all, > > > > I would like to have an erlang VM onto a small embedded system, that is > > an ARM7 machine, with 256K of flash and 64K or RAM. I have in mind > > something like the BEAM emulator and only a minimal subset of libraries > > and OTP system. > > Forget about BEAM, for a system this small you need to design > the entire compiler/VM/interpreter from scratch for small space. > > I assume the ARM7 has Thumb(-1) but not Thumb-2? It is a AT91SAM7S256. I find no reference to Thumb-2. > > > Could anyone have some suggestions or pointers for such an idea? > > Off the top of my head: > - stack-based VM with implicit operands, easy to compile > to and quite compact Yes, but it is important to remember that the programs that will run on the NXT brick is a lot smaller in itself than most Erlang programs. I would say thousands lines of code rather than millions, short lists - lengths of ten. Number of processes probably less than ten too... But Corrado Santoro might have actual application sizes for this type of applications. Target VM could even be an improved variant of the current NXT VM! Download "MINDSTORMS NXT Executable File Specification.pdf" from http://mindstorms.lego.com/Overview/nxtreme.aspx OK, no perfect fit to Erlang, but on the other hand you might see what is necessary to fit a VM on the NXT brick... [No registers, static data - could be used as registers, and dynamic arrays] Could the hipe code generator [otp_src_*/lib/hipe] be used for this by adding such an architecture? But probably it is better to generate from Core Erlang (cerl) then from icode/rtl as we do not want registers anyway... > - high-level VM instructions Some high-level VM constructs are compiled by hipe - to few? cerl is better here too. > - don't do excessive special-casing of simple instructions, > that eats a lot of code space > - configurable set of BIFs and libraries Not only set of libraries, configurable function lists of each library... Can Compiler/dialyzer produce a list of used libraries and functions, recursively? Then this could be done automagically - regenerate all modules whose lists differs, not generating unlisted functions. > - maybe consider dropping some high-level language features, > like live code upgrades Probably, since this would require a flash file system, to be able to "replace" an old module with a new bigger one - it would be cool! > - build the application into the VM, so you can store the compiled > Erlang code in flash rather than RAM, leaving RAM used only for > dynamically allocated data Could be done from a flash file system too - as done by the NXT today. /RogerL From rvirding@REDACTED Fri Jul 4 02:19:20 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 4 Jul 2008 02:19:20 +0200 Subject: [erlang-questions] Reference counting instead of GC? In-Reply-To: <1215121786.3695.50.camel@piko.site> References: <451975.67076.qm@web38806.mail.mud.yahoo.com> <1215121786.3695.50.camel@piko.site> Message-ID: <3dbc6d1c0807031719k6c3bef5xc177b749a168d4c6@mail.gmail.com> Many years ago I did an Erlang implementation based on a reference counting GC (it *is* gc even if not a mark-sweep or copying). Some comments based on that work (no specific order): - It worked very well and was reasonably efficient. - One interesting property was that it reclaimed data *fast* so the memory footprint was relatively small. - Even though each object may be larger as there is only one copy then memory usage is often less than for a copying collector. - Freeing large unused structures is no problems, there well-known are simple techniques for doing that in a non-blocking way. - My work was done on a uni-processor so I have no experience with doing it on a multi-core. I have seen that there are papers written on the subject but I have not studied them. - To get speed you have to be cunning at all levels so it is difficult to just take the BEAM and hack in a different GC, especially one which is so different. - The biggest problem is probably the sheer work involved in doing enough of an implementation to test it. As mentioned in previous comment you have to redo basically all memory allocation everywhere. - Erlang is suited for reference counting as it has no circular structures, well it has a few circular references but they are only in well-known places so no real problems. - It was a fun memory system. Seeing all the reference counts drop to 0 at the end of a run was very satisfying. :-) - Shared memory between processes at the *implementation level* is no problem as the application never sees it, it can only make copies. I really liked it, one of these days I will do another. Robert On 03/07/2008, Alp?r J?ttner wrote: > On Thu, 2008-07-03 at 07:41 -0700, Thomas Lindgren wrote: > >> Good luck :-) However, note that the hipe guys have over the years >> proposed garbage collectors with most of the good properties you >> mention. (Cf the "shared" and "hybrid" emulators. E.g., "erl >> -hybrid".) > > Could you tell me where can I find some info about these modes? The erl > manual doesn't even list the -shared and the -hybrid switches. > >> Also note that simple reference counting does not guarantee real time >> collection or bounded or even short pauses. Consider the case when you >> drop a big term: a reference counting implementation must decrement >> the reference counts of all subterms (recursively), while a copying >> collector won't even visit the dead data. >> Because the dead term can >> have arbitrary size, the pause while it is traversed is not bounded. > > Yes but at least it is a deterministic and predictable time you can > calculate with. > >> (But you may be thinking of more sophisticated variants than that.) > > Yes indeed, the process of dropping the unused terms can be safely > interrupted. > > In fact, my idea was to have a special (low priority) process in the > emulator taking care of the unused terms. In this way the dropping of > big data could be automatically postponed if there are "more urgent" > things to do. > > Best regards, > Alpar > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From litaocheng@REDACTED Fri Jul 4 03:55:39 2008 From: litaocheng@REDACTED (litao cheng) Date: Fri, 4 Jul 2008 09:55:39 +0800 Subject: [erlang-questions] help with message-passing syntax In-Reply-To: <845834.39149.qm@web27901.mail.ukl.yahoo.com> References: <845834.39149.qm@web27901.mail.ukl.yahoo.com> Message-ID: I'm sorry, you code has so many errors. I think you'd better look at the book , and the erlang referance manual. the fllow code snips is my code, but I don't know If it's your need. I hope it's useful for you: %%%%%%%%%%%%%%%%%%%%%% -module(serec). -export([start/0, get_squarer/2]). seq(Start, End) -> seq(Start, End, []). seq(Start, End, Acc) when Start =< End -> seq(Start, End-1, [End|Acc]); seq(_, _, Acc) -> Acc. squarer() -> receive {From, N} when N > 7 -> From ! {self(), [X*X || X <- seq(1, 7)]}, squarer(); {From, N} -> From ! {self(), [X*X || X <- seq(1, N)]}, squarer(); Other -> Other end. %% @spec squarer() -> Pid %% @doc create the squarer process start() -> spawn(fun squarer/0). %% @spec get_squarer(Pid, N) -> Result %% @doc get the result form squarer process get_squarer(Pid, N) when is_pid(Pid) -> Pid ! {self(), N}, receive {Pid, Result} -> Result; Other -> Other end. %%%%%%%%%%%%%%%%%%% usage: 4> c(serec). {ok,serec} 5> Pid = serec:start(). <0.49.0> 6> serec:get_squarer(Pid, 3). [1,4,9] 7> serec:get_squarer(Pid, 4). [1,4,9,16] 8> serec:get_squarer(Pid, 5). [1,4,9,16,25] 9> serec:get_squarer(Pid, 10). [1,4,9,16,25,36,49] 2008/7/3 not norwegian swede : > im using: > http://www.erlang.org/doc/reference_manual/part_frame.html > but cant really figure it out. i didnt expect this to work but compiled > anyway: > 2> c("c:/Program Files/erl5.6.2/usr/serec", [{outdir, "c:/Program > Files/erl5.6.2/usr/"}]). > c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer/1 undefined > c:/Program Files/erl5.6.2/usr/serec.erl:2: function squarer2/1 undefined > c:/Program Files/erl5.6.2/usr/serec.erl:23: premature end > error > 3> > > > obv this is just a toy program but say I have a function that squares the > integers of a list from 1 to the send parameter. > so i want to send a message to that function. > > > -module(serec). > -export([seq/2,squarer/1,squarer2/1]). > > seq(Start, End) -> seq(Start, End, []). > > seq(Start, End, Acc) when Start =< End -> > seq(Start, End-1, [End|Acc]); > seq(_, _, Acc) -> > Acc. > > squarer(X) -> > receive > Pattern [when Pattern > 7] -> > [X*X || X <- [seq(1, 7]]; > end > > squarer2(X) -> > receive > when X > 7 -> [X*X || X <- [seq(1, 7]]; > end > > squarer(X) ! 2+6 > > > ------------------------------ > L?na pengar utan s?kerhet. > S?k och j?mf?r l?n hos Kelkoo. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Jul 4 04:15:53 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Jul 2008 14:15:53 +1200 Subject: [erlang-questions] help with message-passing syntax In-Reply-To: <845834.39149.qm@web27901.mail.ukl.yahoo.com> References: <845834.39149.qm@web27901.mail.ukl.yahoo.com> Message-ID: On 3 Jul 2008, at 9:04 pm, not norwegian swede wrote: > squarer(X) -> > receive > Pattern [when Pattern > 7] -> > [X*X || X <- [seq(1, 7]]; > end Why the square brackets around the guard? You are receiving Pattern, and checking it, but then you do nothing with it! Pattern is a bad name because it tells us nothing whatever about the kind of messages you are expecting to receive. You have an argument X, and then you appear to be trying to bind a *different* X in the list comprehension. Your list comprehension [X*X || X <- [seq(1, 7)]] has an extra pair of square brackets, for no apparent reason. The list [seq(1, 7)]] has only one element, so X will be bound (just once) to [1,2,3,4,5,6,7]. However, [1,2,3,4,5,6,7]*[1,2,3,4,5,6,7] is not understood. Presumably you meant [X*X || X <- seq(1, 7)] However, having computed the list [1,4,9,...,49], what do you want to do with it? I would expect a squaring process to be something like squarer(Destination) -> receive Number -> Destination ! (Number * Number), squarer(Destination) end. > squarer2(X) -> > receive > when X > 7 -> [X*X || X <- [seq(1, 7]]; > end This has two of the same defects as the previous version: X used as argument and as list element pattern, extra brackets around seq(1, 7). It adds a new one: there is no pattern in your 'receive' saying _what_ you want to receive or letting you remember what it is. > > > squarer(X) ! 2+6 This will call the *FUNCTION* squarer, in the expectation that it will return a process ID. The function squarer() will enter the 'receive', and wait forever for a message. I think you mean something like this: destination() -> receive stop -> ok ; Number -> io:write(Number), io:nl(), destination() end. squarer(Destination) -> receive stop -> Destination ! stop ; Number -> Destination ! (Number * Number), squarer(Destination) end. sender(Squarer, Numbers) -> [Squarer ! Number || Number <- Numbers], Squarer ! stop. example() -> Destination = spawn(fun () -> destination() end), Squarer = spawn(fun () -> squarer(Destination) end), sender(Squarer, seq(1, 7)). (Tested.) > From ok@REDACTED Fri Jul 4 04:19:06 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Jul 2008 14:19:06 +1200 Subject: [erlang-questions] conses in erlang? In-Reply-To: <486CB3E8.4010104@softjar.se> References: <829031.63474.qm@web27904.mail.ukl.yahoo.com> <213211FD-38B8-447E-A5E0-3B7B10134A0C@cs.otago.ac.nz> <486C9D67.5040107@softjar.se> <486CB3E8.4010104@softjar.se> Message-ID: On 3 Jul 2008, at 11:11 pm, Johnny Billquist wrote: > Johnny Billquist wrote: >> Richard A. O'Keefe skrev: >>> On 2 Jul 2008, at 8:33 pm, not norwegian swede wrote: >>>> can i use conses in erlang? >>> [ H | T ] in Erlang is precisely the same thing as (cons H T) in >>> Scheme. >> But it's totally the same as a cons in Lisp. > > Argh! I meant to say that it's *not* entirely the same thing as a > cons in Lisp (my memory of Scheme is rusty, so I can't say for sure > how a cons in Scheme works). That's why I said it's precisely the same thing as cons in SCHEME. In the R6RS specification of Scheme, set-car! and set-cdr! are no longer part of the core language; they are in an optional module. From mikpe@REDACTED Fri Jul 4 04:22:11 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 4 Jul 2008 04:22:11 +0200 Subject: [erlang-questions] Small Erlang VM [for Lego NXT] In-Reply-To: <200807040207.54774.roger.larsson@e-gatan.se> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <200807040207.54774.roger.larsson@e-gatan.se> Message-ID: <18541.35155.616486.928829@harpo.it.uu.se> Roger Larsson writes: > Target VM could even be an improved variant of the current NXT VM! > Download "MINDSTORMS NXT Executable File Specification.pdf" from > http://mindstorms.lego.com/Overview/nxtreme.aspx > OK, no perfect fit to Erlang, but on the other hand you might see what is > necessary to fit a VM on the NXT brick... > [No registers, static data - could be used as registers, and dynamic arrays] > > Could the hipe code generator [otp_src_*/lib/hipe] be used for this by adding > such an architecture? The HW is ARM. HiPE has supported ARMv5 for several years now. I run that natively reasonably often on my XScale boxes. (Though right now my ARM boxes are busy building a glibc upgrade. Yes I build everything native, cross-compilation is for lame wankers.) > But probably it is better to generate from Core Erlang (cerl) then from > icode/rtl as we do not want registers anyway... BEAM, ICode, and RTL are all heavily register-oriented. The difference between them is that RTL is machine level, while BEAM and ICode are imaginary Erlang-level assembly languages. BEAM differs from ICode only in that ICode is the common entry point into the HiPE compiler, and previously the system could generate either BEAM or JAM VM code, both of which would be translated to ICode before HiPE took over. >From (Core) Erlang to a stack VM would be easy, then to a compact byte-coded interpreter would also be easy. > > - high-level VM instructions > Some high-level VM constructs are compiled by hipe - to few? > cerl is better here too. By high-level VM insns in this context I mean insns that would occur during compilation to a high-level VM, but which do not currently occur because the VM is too low level == requires too many insns for simple or common operations. BEAM actually is a quite low-level VM in terms of that kinds of operations it offers. It _is_ suitable to translation to native code or optimised direct-threaded code (what most Erlang users run), but it isn't suited to a compact VM code representation. > > - build the application into the VM, so you can store the compiled > > Erlang code in flash rather than RAM, leaving RAM used only for > > dynamically allocated data > Could be done from a flash file system too - as done by the NXT today. Only as an optimisation. If you want to really exploit the difference between static and dynamic data (as would be necessary to fit a system in 64KB of RAM), you need to describe such differences at compile-time. And that IMO requires a different VM. Not that I care that much. 64KB of RAM is so restrictive that I only consider this an academic exercise. 1MB RAM would be a different story; a couple of 100 KBs of flash plus 1MB RAM should be enough for a fairly competent Erlang system. From monch1962@REDACTED Fri Jul 4 04:33:06 2008 From: monch1962@REDACTED (David Mitchell) Date: Fri, 4 Jul 2008 12:33:06 +1000 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> Message-ID: Others are probably going to say this as well, but my experience with Erlang is that it isn't great for regex. It's great for a lot of other things, but not regex (yet!). Pre-R12B-3, I had a lot of success using pattern matches in situations where my initial reaction was to use regex. While it was a bit more code, it was a lot easier to comprehend than regex code and, through using a layer of fun() calls, it ran blazingly fast. For the specific project, I had to do a lot of (pattern matching|regex) *and* have it run as quickly as possible; from a coding perspective, what I lost in having to put together a bunch of pattern matches (in place of what would have been a single regex in e.g. Perl), I got back many times over in terms of performance in the finished product. Now that R12B-3 is here, I'll probably look at the re changes, but I've now got some experience that tells me that regex isn't the be-all and end-all of data parsing solutions. If you've got the chance, you might find it's worth looking at what you can do with pattern matching in place of regex. Regards Dave M. 2008/7/1 Jesper Louis Andersen : > 2008/7/1 chamila piyasena : >> Hi all, >> Is there a new implementation of regexp.erl or can anyone suggest a way to >> improve the performance of the functionalities given in the regexp.erl >> without using regexp library written in C. > > Seriously: Consider something else than regular expressions if it is > possible. Some languages, most notably perl has used regular > expressions extensively and thus has a pretty fast implementation of > them. But usually you can easily write code without them. Maybe you > can read the data in a more structured format, maybe you can > pre-process the data into a simpler format or maybe you can skip parts > of the data. > > Rather than trying to brute-force yourself through the mouse-hole, use > the door in the wall ;) > > Regular expressions have their uses, but they indeed also have their abuses. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From p.donner@REDACTED Tue Jul 1 16:46:04 2008 From: p.donner@REDACTED (Peter Donner) Date: Tue, 01 Jul 2008 16:46:04 +0200 Subject: [erlang-questions] split windows side by side in emacs? In-Reply-To: <804848.70667.qm@web27903.mail.ukl.yahoo.com> References: <804848.70667.qm@web27903.mail.ukl.yahoo.com> Message-ID: <486A432C.8010001@kplusk.com> not norwegian swede schrieb: > how can i split windows side by side in emacs? > > C-x 3 C-h b gives help... From ok@REDACTED Fri Jul 4 05:02:17 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Jul 2008 15:02:17 +1200 Subject: [erlang-questions] Small Erlang VM [for Lego NXT] In-Reply-To: <18541.35155.616486.928829@harpo.it.uu.se> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <200807040207.54774.roger.larsson@e-gatan.se> <18541.35155.616486.928829@harpo.it.uu.se> Message-ID: <2F18BF3C-2E20-413C-8744-1CF379F450EE@cs.otago.ac.nz> I remember asking in this very mailing list, was it last year, about optimising an Erlang system for small cores. Since the Erlang-on-FPGA project appears to have been abandoned, it's a pity that the code has not been released. I note that the PDP-11, with its 64 kB address space, had a Prolog system, a Lisp, and a Pop-2. Erlang on a smart card (or NXT) would not be unreasonable. From erlang-questions_efine@REDACTED Fri Jul 4 05:16:10 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 3 Jul 2008 23:16:10 -0400 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <1215123733.3695.78.camel@piko.site> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> <1215123733.3695.78.camel@piko.site> Message-ID: <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> Good luck!! Who knows, maybe you will create a "picoErlang" :) On Thu, Jul 3, 2008 at 6:22 PM, Alp?r J?ttner wrote: > On Thu, 2008-07-03 at 12:52 -0400, Edwin Fine wrote: > > I understand why you would want to use Erlang, but instead of writing > > an entire interpreter with all the complexity that entails, would you > > consider using another language that is very good in extremely > > resource-restricted environments? FORTH comes to mind. If you just > > want to Get Things Done, that is; > > I don't think so. For example I'm working on a controlling application > which could probably run on the weakest possible hardware, but would be > a great struggle to implement in any sequential programming language > (because I need the various timers and complex scheduling of action and > handing of events). > > For these kinds of tasks, Erlang fits extremely well. I think a > lightweight version of the erlang emulator could find a lot of > applications in this area. > > Best regards, > Alpar > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Jul 4 06:50:50 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Jul 2008 16:50:50 +1200 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: <1c3be50f0807021513j54e3053ey9fbe8bc68e536d19@mail.gmail.com> References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <1c3be50f0807021513j54e3053ey9fbe8bc68e536d19@mail.gmail.com> Message-ID: On 3 Jul 2008, at 10:13 am, Juan Jose Comellas wrote: > Nested records are not nice, no. For the record: > > make_stuff() -> > > #fs_channel_event > {extra=#fs_channel_answer_event{write_codec_name=rot13}}. Let's tidy this a bit: make_stuff() -> Extra = #fs_channel_answer_event{write_codec_name = rot13}, #fs_channel_event{extra = Extra}. The thing that makes this tricky to read is that the detail is hidden amongst the other stuff. So define a function: fs_channel_answer_with_write_codec(Write_Codec_Name) -> #fs_channel_event{ extra = #fs_channel_answer_event{ write_codec_name = Write_Codec_Name}}. and make_stuff() becomes make_stuff() -> fs_channel_answer_with_write_codec(rot13). > set_stuff(Ex) -> > Ex2 = > Ex > #fs_channel_event > {extra > = > (Ex > #fs_channel_event > .extra)#fs_channel_answer_event{read_codec_name=leetspeak}}. Let's tidy that a bit again. set_stuff(Event = #fs_channel_event{extra = Extra}) -> Extra1 = Extra#fs_channel_answer_event{read_codec_name = leetspeak}, Event#fs_channel_event{extra = Extra1}. It's not the nested *records* that are the problem, but the nested *expressions*. Oh, and the sheer length of Erlang field references, due to the need to include the record name as well as the field name. Again, I'd define a function set_fs_channel_answer_read_codec( Event = #fs_channel_event{extra = Extra}, Read_Codec_Name ) -> Event#fs_channel_event{ extra = Extra#fs_channel_answer_event{ read_codec_name = Read_Codec_Name}}. set_stuff(Event) -> set_fs_channel_answer_read_codec(Event, leetspeak). With abstract patterns, you could be defining "records" that happened to be nested *tuples*, but with they'd be treated in the source code as flat. > Did you consider using an approach like the following instead? > > AnswerEvent = {#fs_channel_event{}, #fs_answer_event{}} > HangupEvent = {#fs_channel_event{}, #fs_hangup_event{}} > > It's easy to deconstruct a tuple in pattern matching. You dont get the > nesting above. > > make_stuff() -> > {#fs_channel_event{}, > #fs_channel_answer_event{write_codec_name=rot13}}. > set_stuff({A, B}) -> > {A, B#fs_channel_answer_event{read_codec_name=leetspeak}}. You _do_ get nesting, it's just that the outer record is anonymous. I'm not saying it's a bad thing or a bad idea, but it's important to keep the difference between eliminating nesting *structures* and eliminating nested *names* straight. What's really needed here is not parametric modules but abstract patterns. From ok@REDACTED Fri Jul 4 08:35:12 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Jul 2008 18:35:12 +1200 Subject: [erlang-questions] PADS and Erlang Message-ID: <71986E7E-5C48-49DE-8DF7-7D762B3CC138@cs.otago.ac.nz> I'm currently slogging my way through the PADS manual and papers. PADS is a toolkit for Processing Ad-hoc Data Streams, that is for stuff like web logs, termcap, anything that's more complex than you could comfortably process with AWK but less standardised than XML. PADS/C takes a data description and generates C code that you can call to parse a data stream, either all at once or some at a time. You get a converter to XML and a crude tabulator/statistics tool for free with this. The input language is somewhere between a grammar and C data declarations. PADS/ML does the same kind of thing, with a slightly different but semantically similar input language that looks more like ML. Sadly, the ML in question is not SML, but OCaml. I am as fond of high speed as the next hacker, but fond as I am of SML, I've never been able to stomach OCaml syntax. Some of the applications of PADS are clearly in Erlang's general area: one of the running examples is some AT&T phone logs which are really very very large (so that you would have to be either a lunatic or a disc salesman to suggest converting them to [textual] XML). It might be interesting to speculate on the relationship between PADS (or "Data Description Languages" in general) and Erlang. I'm not sure that a PADS/Erlang would be much use, because you can probably get most of the way with the binary matching syntax parsing binaries. The word is _speculate_! -- "I don't want to discuss evidence." -- Richard Dawkins, in an interview with Rupert Sheldrake. (Fortean times 232, p55.) From sean.hinde@REDACTED Fri Jul 4 13:10:47 2008 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 4 Jul 2008 12:10:47 +0100 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <1c3be50f0807021513j54e3053ey9fbe8bc68e536d19@mail.gmail.com> Message-ID: On 4 Jul 2008, at 05:50, Richard A. O'Keefe wrote: > > What's really needed here is not parametric modules but > abstract patterns. I very much like your abstract patterns proposal - always have since I first saw your paper. Did you ever implement sufficient of the abstract patterns feature that people could try it out? Maybe it is time for an EEP and a prototype. Sean From saleyn@REDACTED Fri Jul 4 13:37:19 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 04 Jul 2008 07:37:19 -0400 Subject: [erlang-questions] New module syntax and semantics? In-Reply-To: References: <3c5163930806291356k1ef3560dp67cd20aabbcc7b51@mail.gmail.com> <8209f740806291434k40e7a53ex544c1c681319be94@mail.gmail.com> <1c3be50f0807010736q3d3ead9bs9b45bf47a98b9e8d@mail.gmail.com> <1c3be50f0807011359t367af297ja92f659f8fadf830@mail.gmail.com> <1c3be50f0807021513j54e3053ey9fbe8bc68e536d19@mail.gmail.com> Message-ID: <486E0B6F.8000807@gmail.com> Please count my vote in favor of abstract patterns as well. It would be a very valuable addition to the language. Serge Sean Hinde wrote: > On 4 Jul 2008, at 05:50, Richard A. O'Keefe wrote: >> What's really needed here is not parametric modules but >> abstract patterns. > > I very much like your abstract patterns proposal - always have since I > first saw your paper. > > Did you ever implement sufficient of the abstract patterns feature > that people could try it out? > > Maybe it is time for an EEP and a prototype. > > Sean > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dnew@REDACTED Fri Jul 4 17:53:33 2008 From: dnew@REDACTED (Darren New) Date: Fri, 04 Jul 2008 08:53:33 -0700 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> Message-ID: <486E477D.2030704@san.rr.com> David Mitchell wrote: > Pre-R12B-3, I had a lot of success using pattern matches in situations > where my initial reaction was to use regex. The place where a regex really shines is when it's generated at runtime. A regex literal can be replaced by code. A regex read from a configuration file is much harder to replace with code (altho less so in Erlang than some other languages). A regex read from the keyboard is almost impossible to replace with code. Sort of like XML - if you don't have CDATA that makes sense when you strip out all the , chances are you're using the wrong tool. -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. From kevin@REDACTED Fri Jul 4 19:50:58 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Fri, 4 Jul 2008 10:50:58 -0700 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <486E477D.2030704@san.rr.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> <486E477D.2030704@san.rr.com> Message-ID: <4533A9B8-064D-42CB-9225-4FDE49F22E94@scaldeferri.com> On Jul 4, 2008, at 8:53 AM, Darren New wrote: > David Mitchell wrote: >> Pre-R12B-3, I had a lot of success using pattern matches in >> situations >> where my initial reaction was to use regex. > > The place where a regex really shines is when it's generated at > runtime. > A regex literal can be replaced by code. A regex read from a > configuration file is much harder to replace with code (altho less > so in > Erlang than some other languages). A regex read from the keyboard is > almost impossible to replace with code. I think you're misinterpreting regexes. A regex _is_ code. Code in a specialized, limited-purpose, extremely concise, occasionally obscure/ obfuscated language, but code nonetheless. -kevin From tom.ayerst@REDACTED Fri Jul 4 22:39:07 2008 From: tom.ayerst@REDACTED (Tom Ayerst) Date: Fri, 4 Jul 2008 21:39:07 +0100 Subject: [erlang-questions] Trouble with OTP Message-ID: <3c5163930807041339x5ef195f2ve0a4fbfef08931e2@mail.gmail.com> Hi, I am running Kevin Smith's Mochiweb OTP example ( http://weblog.hypotheticalabs.com/?p=226) but I cannot get it to start. Could anyone give me some hints on interpreting the error messages? I am running it on Windows. I am not very familiar with debugging OTP yet. Thanks Tom $ erl -boot file_server-1 =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.32.0>}, {name,alarm_handler}, {mfa,{alarm_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.33.0>}, {name,overload}, {mfa,{overload,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === supervisor: {local,sasl_sup} started: [{pid,<0.31.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==== 4-Jul-2008::20:07:13 === supervisor: {local,sasl_sup} started: [{pid,<0.34.0>}, {name,release_handler}, {mfa,{release_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === application: sasl started_at: nonode@REDACTED =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === application: sasl started_at: nonode@REDACTED =CRASH REPORT==== 4-Jul-2008::20:07:13 === crasher: pid: <0.37.0> registered_name: [] exception exit: {bad_return, {{mime_typer_app,start,[normal,[]]}, {'EXIT', {undef, [{mime_typer_app,start,[normal,[]]}, {application_master,start_it_old,4}]}}}} in function application_master:init/4 initial call: application_master:init(<0.5.0>,<0.36.0>, {appl_data,mime_typer, [mime_typer], undefined, {mime_typer_app,[]}, [mime_typer,mime_typer_app], [],infinity,infinity}, normal) ancestors: [<0.36.0>] messages: [{'EXIT',<0.38.0>,normal}] links: [<0.36.0>,<0.5.0>] dictionary: [] trap_exit: true status: running heap_size: 377 stack_size: 23 reductions: 88 neighbours: =INFO REPORT==== 4-Jul-2008::20:07:13 === application: mime_typer exited: {bad_return, {{mime_typer_app,start,[normal,[]]}, {'EXIT', {undef, [{mime_typer_app,start,[normal,[]]}, {application_master,start_it_old,4}]}}}} type: permanent {"Kernel pid terminated",application_controller,"{application_start_failure,mime_typer,{bad_return,{{mime_typer_app,start,[normal,[]]},{'EXIT',{undef,[{mime_typer_app,start,[normal,[]]},{application_master,start_it_old,4}]}}}}}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_start_failure,mime_typer,{bad_return,{{mime_typer_app,start,[normal,[]]},{'EXIT',{undef,[{mime_typer_app,start,[normal,[]]},{application_ -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo.polvorin@REDACTED Fri Jul 4 23:16:58 2008 From: pablo.polvorin@REDACTED (Pablo Polvorin) Date: Fri, 4 Jul 2008 18:16:58 -0300 Subject: [erlang-questions] Trouble with OTP In-Reply-To: <3c5163930807041339x5ef195f2ve0a4fbfef08931e2@mail.gmail.com> References: <3c5163930807041339x5ef195f2ve0a4fbfef08931e2@mail.gmail.com> Message-ID: <1ffe809c0807041416g29adf460wb454e403bf431e63@mail.gmail.com> Hi Tom, {'EXIT', {undef, [{mime_typer_app,start,[normal,[]]} looks like the interpreter can't find that function (mime_type_app:start/2 ). The function is defined in the source, so probably your code path is wrong and doesn't include the .beam files that you have compiled. try with erl -pa DIR where DIR is the directory where your compiled .beam files reside. hope this helps 2008/7/4 Tom Ayerst : > Hi, > > I am running Kevin Smith's Mochiweb OTP example ( > http://weblog.hypotheticalabs.com/?p=226) but I cannot get it to start. > Could anyone give me some hints on interpreting the error messages? I am > running it on Windows. I am not very familiar with debugging OTP yet. > > Thanks > > Tom > > $ erl -boot file_server-1 > > =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === > supervisor: {local,sasl_safe_sup} > started: [{pid,<0.32.0>}, > {name,alarm_handler}, > {mfa,{alarm_handler,start_link,[]}}, > {restart_type,permanent}, > {shutdown,2000}, > {child_type,worker}] > > =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === > supervisor: {local,sasl_safe_sup} > started: [{pid,<0.33.0>}, > {name,overload}, > {mfa,{overload,start_link,[]}}, > {restart_type,permanent}, > {shutdown,2000}, > {child_type,worker}] > > =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === > supervisor: {local,sasl_sup} > started: [{pid,<0.31.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==== 4-Jul-2008::20:07:13 === > supervisor: {local,sasl_sup} > started: [{pid,<0.34.0>}, > {name,release_handler}, > {mfa,{release_handler,start_link,[]}}, > {restart_type,permanent}, > {shutdown,2000}, > {child_type,worker}] > > =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === > application: sasl > started_at: nonode@REDACTED > > =PROGRESS REPORT==== 4-Jul-2008::20:07:13 === > application: sasl > started_at: nonode@REDACTED > > =CRASH REPORT==== 4-Jul-2008::20:07:13 === > crasher: > pid: <0.37.0> > registered_name: [] > exception exit: {bad_return, > {{mime_typer_app,start,[normal,[]]}, > {'EXIT', > {undef, > [{mime_typer_app,start,[normal,[]]}, > {application_master,start_it_old,4}]}}}} > in function application_master:init/4 > initial call: application_master:init(<0.5.0>,<0.36.0>, > {appl_data,mime_typer, > [mime_typer], > undefined, > {mime_typer_app,[]}, > [mime_typer,mime_typer_app], > [],infinity,infinity}, > normal) > ancestors: [<0.36.0>] > messages: [{'EXIT',<0.38.0>,normal}] > links: [<0.36.0>,<0.5.0>] > dictionary: [] > trap_exit: true > status: running > heap_size: 377 > stack_size: 23 > reductions: 88 > neighbours: > > =INFO REPORT==== 4-Jul-2008::20:07:13 === > application: mime_typer > exited: {bad_return, > {{mime_typer_app,start,[normal,[]]}, > {'EXIT', > {undef, > [{mime_typer_app,start,[normal,[]]}, > {application_master,start_it_old,4}]}}}} > type: permanent > {"Kernel pid > terminated",application_controller,"{application_start_failure,mime_typer,{bad_return,{{mime_typer_app,start,[normal,[]]},{'EXIT',{undef,[{mime_typer_app,start,[normal,[]]},{application_master,start_it_old,4}]}}}}}"} > > Crash dump was written to: erl_crash.dump > Kernel pid terminated (application_controller) > ({application_start_failure,mime_typer,{bad_return,{{mime_typer_app,start,[normal,[]]},{'EXIT',{undef,[{mime_typer_app,start,[normal,[]]},{application_ > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- -- pablo http://ppolv.wordpress.com ---- -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Fri Jul 4 23:20:12 2008 From: matthias@REDACTED (Matthias Lang) Date: Fri, 4 Jul 2008 23:20:12 +0200 Subject: [erlang-questions] Trouble with OTP In-Reply-To: <3c5163930807041339x5ef195f2ve0a4fbfef08931e2@mail.gmail.com> References: <3c5163930807041339x5ef195f2ve0a4fbfef08931e2@mail.gmail.com> Message-ID: <20080704212012.GA3688@contorpis.lisalinda.com> On Friday, July 04, Tom Ayerst wrote: > I am running Kevin Smith's Mochiweb OTP example ( > http://weblog.hypotheticalabs.com/?p=226) but I cannot get it to start. > Could anyone give me some hints on interpreting the error messages? I am > running it on Windows. I am not very familiar with debugging OTP yet. I know nothing about mochiweb specifically, but > {'EXIT', > {undef, > [{mime_typer_app,start,[normal,[]]}, > {application_master,start_it_old,4}]}}}} this means that the function mime_typer_app:start(normal, []) couldn't be called. Without knowing anything about your level of experience, my stab-in-the-dark guess would be that you haven't compiled the code. Another likely reason would be a broken code path. Try code:get_path(). A less likely but possible reason is that you can't compile the code because of a broken or outdated erlang install. Matt From vss@REDACTED Sat Jul 5 02:14:31 2008 From: vss@REDACTED (Vlad Skvortsov) Date: Fri, 04 Jul 2008 17:14:31 -0700 Subject: [erlang-questions] wkipedia rendering engine In-Reply-To: <9b08084c0806300353s5c03cdbeh9b02d96990980e86@mail.gmail.com> References: <9b08084c0806300239t59378f45nded85601087358d6@mail.gmail.com> <6faf39c90806300338x5a7b9c20ha77ca939559196ea@mail.gmail.com> <9b08084c0806300353s5c03cdbeh9b02d96990980e86@mail.gmail.com> Message-ID: <486EBCE7.6030509@73rus.com> Joe Armstrong wrote: >>> We (collectively) promised to help Alexander - I promised to provide him with a >>> rendering engine (in Erlang) for the wikipedia markup language. >>> >>> Before I start hacking has anybody done this before? >>> >> What exactly do you mean by a 'rendering engine'? Translating the >> markup language (its name is Mediawiki, by the way) to something else? >> > > I want a number of functions > > mediaWiki_to_rtf(bin()) -> rtf(). > rtf_to_html(rtf()) -> html(). > rtf_to_pdf(rtf()) -> pdf() > > etc. where rtf(), html() pdf() are abstract datav types representing > (abstracted) rich text, html, and pdf() etc. > > The rendering engine is a wrapper round these routines to display ther > result in a browser or generate PDF etc. > From my experience it is very hard to convert mediaWiki format to an AST. Well, it's pretty easy to get 80% working, but the rest 20% are really tough. I wasn't even able to find a renderer which would be compatible with MediaWiki; most of them use simple regexp substitutions which work ok "most of the time". It was a year ago, though; may be things have changed. >> It's not a trivial task you have set yourself. There are some elements >> that are quite complex, for example the fact that '' is italics and >> ''' is bold. Notice the difference between: >> >> '''this is bold''' >> >> '''this is italic, starting with a ' '' >> >> '''this is bold '' and this part italic as well ''''' >> >> > > This is almost trivial :-) > It seems so until you get into gory details of templates, tables, math formulas and the like. We ended up in screenscraping with a few heuristics to handle most common cases. The requirements had to be relaxed significantly. -- Vlad Skvortsov, vss@REDACTED, http://vss.73rus.com From dnew@REDACTED Sat Jul 5 02:18:46 2008 From: dnew@REDACTED (Darren New) Date: Fri, 04 Jul 2008 17:18:46 -0700 Subject: [erlang-questions] improving the performance of regexp(regular expressions) In-Reply-To: <4533A9B8-064D-42CB-9225-4FDE49F22E94@scaldeferri.com> References: <552d666a0806302201v5332b15cnc2e6224b87e1f068@mail.gmail.com> <56a0a2840806302301y3327dd58vdf481a2463352d72@mail.gmail.com> <486E477D.2030704@san.rr.com> <4533A9B8-064D-42CB-9225-4FDE49F22E94@scaldeferri.com> Message-ID: <486EBDE6.50401@san.rr.com> Kevin Scaldeferri wrote: > I think you're misinterpreting regexes. A regex _is_ code. Fair enough, if you want to pick nits. :-) I look at it as more of a mathematical expression (or perhaps executable specification) than actual code, since it isn't Turing complete. (Of course, some of the things people call "regular expressions" aren't, either, just to close off that line of nits. ;-) -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. From ulf@REDACTED Sat Jul 5 14:53:55 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 5 Jul 2008 14:53:55 +0200 Subject: [erlang-questions] PADS and Erlang In-Reply-To: <71986E7E-5C48-49DE-8DF7-7D762B3CC138@cs.otago.ac.nz> References: <71986E7E-5C48-49DE-8DF7-7D762B3CC138@cs.otago.ac.nz> Message-ID: <8209f740807050553p376029fbsbba27ec7921ee76f@mail.gmail.com> Very nice to hear. I've been quite interested in PADS since I heard Kathleen Fisher present it a few years ago, but I've limited myself to mentioning it on occasion, hoping that someone else would find it interesting too. (-: BR, Ulf W 2008/7/4 Richard A. O'Keefe : > I'm currently slogging my way through the PADS manual and papers. > PADS is a toolkit for Processing Ad-hoc Data Streams, that is > for stuff like web logs, termcap, anything that's more complex > than you could comfortably process with AWK but less standardised > than XML. > > PADS/C takes a data description and generates C code that you can > call to parse a data stream, either all at once or some at a time. > You get a converter to XML and a crude tabulator/statistics tool > for free with this. The input language is somewhere between a > grammar and C data declarations. > > PADS/ML does the same kind of thing, with a slightly different > but semantically similar input language that looks more like ML. > Sadly, the ML in question is not SML, but OCaml. I am as fond > of high speed as the next hacker, but fond as I am of SML, I've > never been able to stomach OCaml syntax. > > Some of the applications of PADS are clearly in Erlang's general > area: one of the running examples is some AT&T phone logs which > are really very very large (so that you would have to be either > a lunatic or a disc salesman to suggest converting them to > [textual] XML). > > It might be interesting to speculate on the relationship between > PADS (or "Data Description Languages" in general) and Erlang. > I'm not sure that a PADS/Erlang would be much use, because you > can probably get most of the way with the binary matching syntax > parsing binaries. > > The word is _speculate_! > > -- > "I don't want to discuss evidence." -- Richard Dawkins, in an > interview with Rupert Sheldrake. (Fortean times 232, p55.) > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From justin@REDACTED Sat Jul 5 17:59:49 2008 From: justin@REDACTED (Justin Sheehy) Date: Sat, 5 Jul 2008 11:59:49 -0400 Subject: [erlang-questions] Question about message passing paradigm Message-ID: <4D6B10FF-A170-4A48-B05E-F282CE7FC4EF@iago.org> Richard A. O'Keefe wrote: > There are actually two slightly different cases depending on > A needs "X Y Z as of *now*" (A, B, C, and D must all > synchronise), or A needs "X Y Z as of *some* time in the > recent past" (B, C, and D must all synchronise but can then > send the information to A without waiting for A to receive it). As you discovered, the only way to feel like you can solve this as described is to cause all of the processes involved to block until all processing is completed. This, of course, leads to all sorts of problems if any of the processes runs into trouble partway through. In a more truly concurrent system, there is really no useful meaning for "now" in a global sense. When a principal sends you a message, all you really get to know is that the message was sent before you received it. You can build up more useful details than that, but you can't ever get all the way to "now" without removing concurrency -- e.g. by making everyone block. -Justin From johnswolter@REDACTED Sat Jul 5 18:43:49 2008 From: johnswolter@REDACTED (john s wolter) Date: Sat, 5 Jul 2008 12:43:49 -0400 Subject: [erlang-questions] Small Erlang VM [for Lego NXT] Message-ID: <24bcf1860807050943s175438bdkd8496993cdb0b52d@mail.gmail.com> I dropped by the erlang-questions archive because I was wondering if I could use Erlang for distributed embedded controllers and I found this thread. I am looking to simplify my multi-controller programming as I can not keep all the distributed coordination factors in my mind, it is more than I can do. Many critical real-time systems now have many controllers that communicate and coordinate to accomplish a goal. It is not unusual to see five to 10 micros in a critical real-time system. I've looked a agent systems and swarms but those are really for much larger applications then controlling machines. My thought was to simplify the underlying software core and concentrate on the application level. Erlang at first blush appears to have some built-in features that could simplify machine control problems. I've worked on these kind of systems for a long time, the Erlang community may have an underlying concept that would be of great help. Is there a active group or organization working on embedded real-time Erlang applications? -- 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 joseph.stewart@REDACTED Sat Jul 5 19:07:23 2008 From: joseph.stewart@REDACTED (Joseph Stewart) Date: Sat, 5 Jul 2008 13:07:23 -0400 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> <1215123733.3695.78.camel@piko.site> <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> Message-ID: <2781f020807051007p74b8f7a6oae441a18f50ef11d@mail.gmail.com> Don't know if this helps, but there's a project leveraging the concurrency in the Occam-pi language by running a transputer interpreter on the Lego Mindstorm NXT and RCX(!!). More details at: http://www.transterpreter.org/ I'm a fairly new follower of this mailing list. Has the topic of transputers come up before? My understanding of the transputer architecture (and by consequence the transterpreter) is that it's stack-based rather than register-based... so performance may suffer compared to the Erlang VM. -joe If it ain't broke, break it. How else are you going to figure out how it works? 2008/7/3 Edwin Fine : > Good luck!! Who knows, maybe you will create a "picoErlang" :) > > On Thu, Jul 3, 2008 at 6:22 PM, Alp?r J?ttner wrote: > >> On Thu, 2008-07-03 at 12:52 -0400, Edwin Fine wrote: >> > I understand why you would want to use Erlang, but instead of writing >> > an entire interpreter with all the complexity that entails, would you >> > consider using another language that is very good in extremely >> > resource-restricted environments? FORTH comes to mind. If you just >> > want to Get Things Done, that is; >> >> I don't think so. For example I'm working on a controlling application >> which could probably run on the weakest possible hardware, but would be >> a great struggle to implement in any sequential programming language >> (because I need the various timers and complex scheduling of action and >> handing of events). >> >> For these kinds of tasks, Erlang fits extremely well. I think a >> lightweight version of the erlang emulator could find a lot of >> applications in this area. >> >> Best regards, >> Alpar >> >> >> > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > > _______________________________________________ > 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 Jul 5 20:36:29 2008 From: johnswolter@REDACTED (john s wolter) Date: Sat, 5 Jul 2008 14:36:29 -0400 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <24bcf1860807051134s2b89d68ah364efe72b364d87e@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> <1215123733.3695.78.camel@piko.site> <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> <2781f020807051007p74b8f7a6oae441a18f50ef11d@mail.gmail.com> <24bcf1860807051134s2b89d68ah364efe72b364d87e@mail.gmail.com> Message-ID: <24bcf1860807051136v6fce9abay7f6ee3d6ff4a3f32@mail.gmail.com> Joseph, These all sound like good informational leads. Considering the age of OCCAM I'd look to contrast it with Erlang as to whether Erlang offers newer features. Many considerations would go into development environment selection. As I look back over the last two decades the distributed and hard real-time control issue has been an ongoing for me and industry. Today because of all the gadgets and sytems, this marketplace is huge. Add to this the desire to be transparently interconnected locally and worldwide there appears to be an opportunity. [Tangent Alert -- Here's a radical statement that should be a separate discussion thread. Right now I think all the Object-Oriented language systems need an underlying runtime that is transparently current with a messaging infrastructure. It may be that Erlang or the likes would be the way to provide that. O-O needs a automatically distributed place(s) for object instances to run. Bertrand Meyer in his book "Object-Oriented Software Construction" has a couple of chapter dedicated to runtime issues. He does a fine job of linking O-O design needs to actual runtime behaviors needed. Maybe all the distributed O-O runtimes at the core, should be based on Erlang like features.] Don't know if this helps, but there's a project leveraging the concurrency > in the Occam-pi language by running a transputer interpreter on the Lego > Mindstorm NXT and RCX(!!). > > More details at: > http://www.transterpreter.org/ The OCCAM came out of the Transputer developments of INMOS in the early 1980's. I looked at it as a solution to distributed control at that time. I have a complete copy of the original data books for the processor and as I recall I believe I have a microprocessor set in my chip collection. They are almost 23 years old. I'm a fairly new follower of this mailing > list. Has the topic of transputers come up before? My understanding of the > transputer architecture (and by consequence the transterpreter) is that it's > stack-based rather than register-based... so performance may suffer compared > to the Erlang VM. Here's the Wikipedia link about Transputers for those interested, http://en.wikipedia.org/wiki/Transputer . Here is one about OCCAM, http://en.wikipedia.org/wiki/Occam_programming_language . It would be interesting to see some comparisons of concurrent languages. Here's Wikipedia's short article which is interesting in that it lists many different languages. http://en.wikipedia.org/wiki/Concurrent_programming Intel created another specialized microprocessor that had messaging and features to support object-oriented environments. It was the iAPX-432, it was a commercial failure. Here is the Wikipedia link, http://en.wikipedia.org/wiki/Intel_iAPX_432 I think I also have a data book set and a chip set of this. It appears to me that Erlang could find an important application range for use in hard real-time systems. > Good luck!! Who knows, maybe you will create a "picoErlang" :) >> >> On Thu, Jul 3, 2008 at 6:22 PM, Alp?r J?ttner wrote: >> >>> On Thu, 2008-07-03 at 12:52 -0400, Edwin Fine wrote: >>> > I understand why you would want to use Erlang, but instead of writing >>> > an entire interpreter with all the complexity that entails, would you >>> > consider using another language that is very good in extremely >>> > resource-restricted environments? FORTH comes to mind. If you just >>> > want to Get Things Done, that is; >>> >>> I don't think so. For example I'm working on a controlling application >>> which could probably run on the weakest possible hardware, but would be >>> a great struggle to implement in any sequential programming language >>> (because I need the various timers and complex scheduling of action and >>> handing of events). >>> >>> For these kinds of tasks, Erlang fits extremely well. I think a >>> lightweight version of the erlang emulator could find a lot of >>> applications in this area. >>> >>> Best regards, >>> Alpar >>> >>> >>> >> >> >> -- >> The great enemy of the truth is very often not the lie -- deliberate, >> contrived and dishonest, but the myth, persistent, persuasive, and >> unrealistic. Belief in myths allows the comfort of opinion without the >> discomfort of thought. >> John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) >> >> _______________________________________________ >> 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 raould@REDACTED Sat Jul 5 20:52:50 2008 From: raould@REDACTED (Raoul Duke) Date: Sat, 5 Jul 2008 11:52:50 -0700 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <24bcf1860807051136v6fce9abay7f6ee3d6ff4a3f32@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> <1215123733.3695.78.camel@piko.site> <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> <2781f020807051007p74b8f7a6oae441a18f50ef11d@mail.gmail.com> <24bcf1860807051134s2b89d68ah364efe72b364d87e@mail.gmail.com> <24bcf1860807051136v6fce9abay7f6ee3d6ff4a3f32@mail.gmail.com> Message-ID: <91a2ba3e0807051152m2a0584d2nb186e9841ff7b42a@mail.gmail.com> > way to provide that. O-O needs a automatically distributed place(s) for > object instances to run. also look at http://www.mozart-oz.org/ which recently updated the distribution mechanism used. From johnswolter@REDACTED Sat Jul 5 22:55:30 2008 From: johnswolter@REDACTED (john s wolter) Date: Sat, 5 Jul 2008 16:55:30 -0400 Subject: [erlang-questions] Small Erlang VM In-Reply-To: <91a2ba3e0807051152m2a0584d2nb186e9841ff7b42a@mail.gmail.com> References: <486CE0E6.2010706@diit.unict.it> <18540.63213.648673.758044@harpo.it.uu.se> <486CFFC2.50104@diit.unict.it> <6c2563b20807030952s62053c25y1d093952d683c8c3@mail.gmail.com> <1215123733.3695.78.camel@piko.site> <6c2563b20807032016k4abc1bd9ydea57abc4f2eedcd@mail.gmail.com> <2781f020807051007p74b8f7a6oae441a18f50ef11d@mail.gmail.com> <24bcf1860807051134s2b89d68ah364efe72b364d87e@mail.gmail.com> <24bcf1860807051136v6fce9abay7f6ee3d6ff4a3f32@mail.gmail.com> <91a2ba3e0807051152m2a0584d2nb186e9841ff7b42a@mail.gmail.com> Message-ID: <24bcf1860807051355v2be5e070q4ae7ea4ce5e8edd4@mail.gmail.com> Raoul, Thanks for the heads-up. As I recall about Mozart it is more a soft-realtime system. I'm starting to get the idea after looking around that no one open system has yet focused on the distributed realtime control problem as of yet. I've more searches ahead. On Sat, Jul 5, 2008 at 2:52 PM, Raoul Duke wrote: > > way to provide that. O-O needs a automatically distributed place(s) for > > object instances to run. > > also look at http://www.mozart-oz.org/ which recently updated the > distribution mechanism used. > _______________________________________________ > 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 toby@REDACTED Sat Jul 5 23:50:59 2008 From: toby@REDACTED (Toby Thain) Date: Sat, 5 Jul 2008 18:50:59 -0300 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang Message-ID: Hi list, I stumbled on this simple 'puzzle'[0] posted some years ago on comp.lang.tcl (originally to an Icon mailing list). After solving it in Icon[1] and SQL[2] I decided to see what an Erlang solution would look like. I'm posting here firstly because other people's solutions would be interesting, and also I'd like to see how my own solution[3] could be improved. Any takers over the weekend? :-) --Toby [0] http://groups.google.com/group/comp.lang.tcl/msg/8846d9f7491ba0ba [1] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/vn.icn [2] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/Makefile [3] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/erlang/ From richardc@REDACTED Sun Jul 6 14:17:45 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 06 Jul 2008 14:17:45 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: References: Message-ID: <4870B7E9.7030705@it.uu.se> Toby Thain wrote: > Hi list, > > I stumbled on this simple 'puzzle'[0] posted some years ago on > comp.lang.tcl (originally to an Icon mailing list). > > After solving it in Icon[1] and SQL[2] I decided to see what an > Erlang solution would look like. I'm posting here firstly because > other people's solutions would be interesting, and also I'd like to > see how my own solution[3] could be improved. > > Any takers over the weekend? :-) > > --Toby > > [0] http://groups.google.com/group/comp.lang.tcl/msg/8846d9f7491ba0ba > [1] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/vn.icn > [2] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/Makefile > [3] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/erlang/ Here's my version. Note that it's often better to think in terms of stages of list processing (mapreduce etc.), instead of inserting and looking up in dictionaries. I tag each generated pair with the E element, just to make the list easier to work with later. /Richard -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: solve.erl URL: From toby@REDACTED Sun Jul 6 21:52:21 2008 From: toby@REDACTED (Toby Thain) Date: Sun, 6 Jul 2008 16:52:21 -0300 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <4870B7E9.7030705@it.uu.se> References: <4870B7E9.7030705@it.uu.se> Message-ID: On 6-Jul-08, at 9:17 AM, Richard Carlsson wrote: > Toby Thain wrote: >> Hi list, >> I stumbled on this simple 'puzzle'[0] ... >> [0] http://groups.google.com/group/comp.lang.tcl/msg/8846d9f7491ba0ba ... > %% File: solve.erl > %% @author Richard Carlsson Wonderful, that's just the kind of brain-melting variation I was after. Those who can't get enough of this puzzle, there's another thread about it: http://groups.google.ca/group/comp.lang.apl/browse_thread/thread/ 8a1abe807d1eda3c/ From erlang-questions_efine@REDACTED Sun Jul 6 23:14:53 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 6 Jul 2008 17:14:53 -0400 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <4870B7E9.7030705@it.uu.se> References: <4870B7E9.7030705@it.uu.se> Message-ID: <6c2563b20807061414w4d0dd6eaq9057de070822672d@mail.gmail.com> Richard, Lovely solution! It's stuff like this that helps newcomers to Erlang like myself to learn how to write better Erlang. I'm curious, though; what is the reason for writing Qs = [integer_to_list(S) || S <- [X*X || X <- lists:seq(32,99)]] instead of Qs = [integer_to_list(X*X) || X <- lists:seq(32,99)] ? 2008/7/6 Richard Carlsson : > Toby Thain wrote: > >> Hi list, >> >> I stumbled on this simple 'puzzle'[0] posted some years ago on >> comp.lang.tcl (originally to an Icon mailing list). >> >> After solving it in Icon[1] and SQL[2] I decided to see what an Erlang >> solution would look like. I'm posting here firstly because other people's >> solutions would be interesting, and also I'd like to see how my own >> solution[3] could be improved. >> >> Any takers over the weekend? :-) >> >> --Toby >> >> [0] http://groups.google.com/group/comp.lang.tcl/msg/8846d9f7491ba0ba >> [1] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/vn.icn >> [2] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/Makefile >> [3] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/erlang/ >> > > Here's my version. Note that it's often better to think in terms of > stages of list processing (mapreduce etc.), instead of inserting and > looking up in dictionaries. I tag each generated pair with the E > element, just to make the list easier to work with later. > > /Richard > > %% File: solve.erl > %% @author Richard Carlsson > > -module(solve). > -export([it/0]). > > %% Problem: VIER and NEUN are 4-digit squares; determine distinct V, I, > %% E, R, N, and U, such that there is a unique solution (VIER,NEUN) for > %% some particular E. > > it() -> > Qs = [integer_to_list(S) || S <- [X*X || X <- lists:seq(32,99)]], > Ps = [{E,{Vr,Nn}} || [N,E,_U,N]=Nn <- Qs, [_V,_I,E1,_R]=Vr <- Qs, > E =:= E1, > length(ordsets:from_list(Nn++Vr)) =:= 6], > D = lists:foldl(fun ({E,_}, D) -> dict:update_counter(E,1,D) end, > dict:new(), Ps), > [P || {E,1} <- dict:to_list(D), {E1,P} <- Ps, E=:=E1]. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Sun Jul 6 23:39:30 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 06 Jul 2008 23:39:30 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <6c2563b20807061414w4d0dd6eaq9057de070822672d@mail.gmail.com> References: <4870B7E9.7030705@it.uu.se> <6c2563b20807061414w4d0dd6eaq9057de070822672d@mail.gmail.com> Message-ID: <48713B92.9070609@it.uu.se> Edwin Fine wrote: > Richard, > > Lovely solution! It's stuff like this that helps newcomers to Erlang > like myself to learn how to write better Erlang. > > I'm curious, though; what is the reason for writing > > Qs = [integer_to_list(S) || S <- [X*X || X <- lists:seq(32,99)]] > > instead of > > Qs = [integer_to_list(X*X) || X <- lists:seq(32,99)] None whatsoever. The person responsible should be keelhauled. Oh, right... Sorry. It's just a remnant of a refactoring. I started out working on lists on the form [S div 1000, ..., S rem 10], but realized that I could just use the lists of character codes instead. But I didn't tidy up after changing to integer_to_list(S). Improved version attached. /Richard -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: solve.erl URL: From matthias@REDACTED Mon Jul 7 00:25:22 2008 From: matthias@REDACTED (Matthias Lang) Date: Mon, 7 Jul 2008 00:25:22 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: References: Message-ID: <20080706222522.GA5067@contorpis.lisalinda.com> On Saturday, July 05, Toby Thain wrote: > I stumbled on this simple 'puzzle'[0] posted some years ago on > comp.lang.tcl (originally to an Icon mailing list). After reading the description four times, I still wasn't completely sure what 'uniquely determines' means, but ploughed ahead, assuming it'd become obvious when I saw the solutions, which it did. I wrote the solution below before looking at the other solutions, but was coward enough to peek at Richard's much shorter one before posting. The obvious advantage of my solution is that I understand it ;-) Matt -------------------- -module(sq). -export([go/0]). go() -> All = all_answers(), Unique_viers = [ Vier || {Vier, _} <- All, length([X || {X, _} <- All, X == Vier]) == 1], Unique_neuns = [ Neun || {_, Neun} <- All, length([X || {_, X} <- All, X == Neun]) == 1], [ {Vier, Neun} || {Vier, Neun} <- All, lists:member(Vier, Unique_viers), lists:member(Neun, Unique_neuns)]. all_answers() -> [ {{V,I,E1,R}, {N,E2,U,N}} || {V,I,E1,R} <- possible_viers(), {N,E2,U,N} <- possible_neuns(), E1 == E2, all_unique([V,I,R,N,U])]. square_digits() -> Squares = [ X * X || X <- lists:seq(30, 100)], [ {X div 1000, (X div 100) rem 10, (X div 10) rem 10, X rem 10} || X <- Squares]. possible_neuns() -> [ X || X = {N,E,U,N} <- square_digits(), all_unique([N,E,U])]. possible_viers() -> [ X || X = {V,I,E,R} <- square_digits(), all_unique([V,I,E,R])]. all_unique([]) -> true; all_unique([H|T]) -> not lists:member(H, T) andalso all_unique(T). From fuad@REDACTED Mon Jul 7 01:31:34 2008 From: fuad@REDACTED (Fuad Tabba) Date: Mon, 7 Jul 2008 11:31:34 +1200 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure Message-ID: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> Hi, A while back I posted a question asking how to write a scalable shared data structure in Erlang; it can be anything really but I decided to go with a binary search tree (bst) since it's a simple data structure that should scale well with load (as long as it's balanced). Anyway, I finished writing the code, which I'm assuming (read: hoping) is correct. :) What I found though is that it's not scaling at all. By that I mean that as the number of threads/processes accessing the bst increases, throughput doesn't improve by as much. I've implemented the nodes as processes, and all operations on the tree are relayed to the node that needs to do something about it. The code for this implementation can be found here:- http://www.cs.auckland.ac.nz/~fuad/cbst.erl I did my tests on a Sun Fire V880 with 8 900-MHz UltraSPARC-III processors and 16 GBs of main memory; running Solaris 10 and Erlang (BEAM) 5.6.3. My tests consisted of randomly creating and populating a tree that has a key range of 0-1000; and then performing at random (uniform distribution) either an insert(), delete() or a contains() done 100,000 times. I would vary the number of threads from 1 to 8, and the load (100,000 operations) would be divided by the number of processors available. I also performed the tests where the only operation performed is a contains() operation (designated by 1:0:0), or 8 contains() operations, 1 insert() and 1 delete() (8:1:1), or an equal mix of all three (1:1:1). In a perfect world, 2 threads would do the job in half the time 1 thread would, but of course nothing is perfect. So as a baseline I performed another test whereby each thread would just call a function (repeated for a number of times) that does nothing but return true, to see how well that scales (in the graph: Best Scalability). This used the same functions to distribute the load, except that randOperation() would only return true rather than do anything useful. Anyway, you can find the graph (where the results are normalized to the wall time for one processor) at:- http://www.cs.auckland.ac.nz/~fuad/bst-scale.png (the lower the lines goes, better the scalability) and the raw data (showing the wall time in ms) at:- http://www.cs.auckland.ac.nz/~fuad/bst-scale.csv As you can see, my data structure isn't scaling well at all regardless of the kind of workload it has. I would expect it to scale well since the tree should be kind of balanced. In C I would know how to write an implementation where at least contains() scales well; writing something where tree modification scales is a bit more difficult but should be doable. However, I am new to Erlang and I can't really reason about all the issues well enough to pull off a similar implementation. In a nutshell my question is; what am I doing wrong? Is there a better way to have a place that stores shared data in a scalable manner? Thanks, /Fuad -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Mon Jul 7 02:10:32 2008 From: toby@REDACTED (Toby Thain) Date: Sun, 6 Jul 2008 21:10:32 -0300 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <20080706222522.GA5067@contorpis.lisalinda.com> References: <20080706222522.GA5067@contorpis.lisalinda.com> Message-ID: <3B99C9CA-F8F1-42D5-8678-CED0BC60BE6F@telegraphics.com.au> On 6-Jul-08, at 7:25 PM, Matthias Lang wrote: > On Saturday, July 05, Toby Thain wrote: > >> I stumbled on this simple 'puzzle'[0] posted some years ago on >> comp.lang.tcl (originally to an Icon mailing list). > > After reading the description four times, I still wasn't completely > sure what 'uniquely determines' means, but ploughed ahead, assuming > it'd become obvious when I saw the solutions, which it did. I didn't find the wording very clear either :) Tried to reword it but abandoned the effort. I notice Richard restated it in comments. --Toby From erlang-questions_efine@REDACTED Mon Jul 7 06:23:55 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Mon, 7 Jul 2008 00:23:55 -0400 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <48713B92.9070609@it.uu.se> References: <4870B7E9.7030705@it.uu.se> <6c2563b20807061414w4d0dd6eaq9057de070822672d@mail.gmail.com> <48713B92.9070609@it.uu.se> Message-ID: <6c2563b20807062123o79dc9070lf60431a85fdc951a@mail.gmail.com> On Sun, Jul 6, 2008 at 5:39 PM, Richard Carlsson wrote: > Edwin Fine wrote: > >> Richard, >> >> Lovely solution! It's stuff like this that helps newcomers to Erlang like >> myself to learn how to write better Erlang. >> >> I'm curious, though; what is the reason for writing >> >> Qs = [integer_to_list(S) || S <- [X*X || X <- lists:seq(32,99)]] >> >> instead of >> >> Qs = [integer_to_list(X*X) || X <- lists:seq(32,99)] >> > > None whatsoever. The person responsible should be keelhauled. > Oh, right... Sorry. > > It's just a remnant of a refactoring. I started out working on > lists on the form [S div 1000, ..., S rem 10], but realized that > I could just use the lists of character codes instead. But I > didn't tidy up after changing to integer_to_list(S). Improved > version attached. Oh, thank goodness!! I thought it was some expert optimization or technique that I just couldn't understand :) > /Richard > > %% File: solve.erl > %% @author Richard Carlsson > > -module(solve). > -export([it/0]). > > %% Problem: VIER and NEUN are 4-digit squares; determine distinct V, I, > %% E, R, N, and U, such that (given the choice of E) there exists a > %% unique solution (VIER,NEUN). > > it() -> > Qs = [integer_to_list(X*X) || X <- lists:seq(32,99)], > Ps = [{E,{Vr,Nn}} || [N,E,_U,N]=Nn <- Qs, [_V,_I,E1,_R]=Vr <- Qs, > E =:= E1, > length(ordsets:from_list(Nn++Vr)) =:= 6], > D = lists:foldl(fun ({E,_}, D) -> dict:update_counter(E,1,D) end, > dict:new(), Ps), > [P || {E,1} <- dict:to_list(D), {E1,P} <- Ps, E=:=E1]. > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Jul 7 10:22:08 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Jul 2008 09:22:08 +0100 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> Message-ID: <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> Hi Fuad, a shared data structure is going to be the major limiting factor of your parallelisation. Are you aware of Amdahl's Law (e.g., http://home.wlu.edu/~whaleyt/classes/parallel/topics/amdahl.html)? I must admit I have not read your code. But at least all the writes to your shared data structure have to be serial in order to ensure its integrity. So that is an immediate limiting factor. You cannot get faster than all the serialised writes to your structure. One of the easiest shared data structures you can use is a database. It'll handle all the horrible details of transactions for you. In Erlang, you can have a look at Mnesia for that. Robby From bharani_vms@REDACTED Mon Jul 7 10:39:32 2008 From: bharani_vms@REDACTED (Bharani) Date: Mon, 7 Jul 2008 01:39:32 -0700 (PDT) Subject: [erlang-questions] tcerldrv-1.2.5b build error Message-ID: <18255420.post@talk.nabble.com> First of all Thanks for a great work on porting tc to erlang. I am trying to get the tcerl to work but got a build error with the C driver. I did install the tc 1.2.5 from source. here is what i get make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' make[2]: Nothing to be done for `all-am'. make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' Making all in src make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' make all-recursive make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' make[3]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT tcbdberl.lo -MD -MP -MF .deps/tcbdberl.Tpo -c -o tcbdberl.lo tcbdberl.c gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT tcbdberl.lo -MD -MP -MF .deps/tcbdberl.Tpo -c tcbdberl.c -fPIC -DPIC -o .libs/tcbdberl.o In file included from tcbdbfrom.h:5, from tcbdberl.c:13: tcbdbtypes.h:13: warning: parameter has incomplete type make[3]: *** [tcbdberl.lo] Error 1 make[3]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' make: *** [all-recursive] Error 1 - Bharani -- View this message in context: http://www.nabble.com/tcerldrv-1.2.5b-build-error-tp18255420p18255420.html Sent from the Erlang Questions mailing list archive at Nabble.com. From richardc@REDACTED Mon Jul 7 10:52:09 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 07 Jul 2008 10:52:09 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <3B99C9CA-F8F1-42D5-8678-CED0BC60BE6F@telegraphics.com.au> References: <20080706222522.GA5067@contorpis.lisalinda.com> <3B99C9CA-F8F1-42D5-8678-CED0BC60BE6F@telegraphics.com.au> Message-ID: <4871D939.7060504@it.uu.se> Toby Thain wrote: > On 6-Jul-08, at 7:25 PM, Matthias Lang wrote: >> After reading the description four times, I still wasn't completely >> sure what 'uniquely determines' means, but ploughed ahead, assuming >> it'd become obvious when I saw the solutions, which it did. > > I didn't find the wording very clear either :) Tried to reword it but > abandoned the effort. I notice Richard restated it in comments. I also found that the greatest snag was understanding the exact specification of the problem. I eventually had to peek at the Icon solution to see what it was generating. /Richard From fuad@REDACTED Mon Jul 7 11:00:51 2008 From: fuad@REDACTED (Fuad Tabba) Date: Mon, 7 Jul 2008 21:00:51 +1200 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> Message-ID: <909c265f0807070200t66c55416ofa9a980485b3e174@mail.gmail.com> Thanks Robert, Yes I am familiar with Amdahl's law. That said, it's not true that all writes need to be serialized; it's a binary tree, and unless the modifications happen to be to the same node, there's no reason why they need to be serialized. A database would solve the problem kinda; but that's like using a steamroller to crack a nut. What I'm looking for a lightweight option that could temporarily store data shared between threads, and would scale well as the number of threads accessing/modifying this structure increases. I know how to solve this problem in C (writing a concurrent binary search tree that scales well), but since I'm new to Erlang I was unsuccessful trying to solve this problem in Erlang. Thanks again, /Fuad On Mon, Jul 7, 2008 at 8:22 PM, Robert Raschke wrote: > Hi Fuad, > > a shared data structure is going to be the major limiting factor of > your parallelisation. Are you aware of Amdahl's Law (e.g., > http://home.wlu.edu/~whaleyt/classes/parallel/topics/amdahl.html > )? > > I must admit I have not read your code. But at least all the writes to > your shared data structure have to be serial in order to ensure its > integrity. So that is an immediate limiting factor. You cannot get > faster than all the serialised writes to your structure. > > One of the easiest shared data structures you can use is a database. > It'll handle all the horrible details of transactions for you. In > Erlang, you can have a look at Mnesia for that. > > Robby > _______________________________________________ > 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 Mon Jul 7 11:30:18 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 7 Jul 2008 11:30:18 +0200 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> Message-ID: <4d08db370807070230n75395973j2da1484d9bb481cb@mail.gmail.com> I peeped to your code briefly and it looks good. It can be wrote little simpler but looks correct for this proof purpose. Just to be sure, did you tried to start erl with different number of schedulers e.g. +S parameter or only changed number of client threads? I also think, your tree is may be too small. 2008/7/7 Fuad Tabba : > Hi, > > A while back I posted a question asking how to write a scalable shared data > structure in Erlang; it can be anything really but I decided to go with a > binary search tree (bst) since it's a simple data structure that should > scale well with load (as long as it's balanced). > > Anyway, I finished writing the code, which I'm assuming (read: hoping) is > correct. :) What I found though is that it's not scaling at all. By that I > mean that as the number of threads/processes accessing the bst increases, > throughput doesn't improve by as much. > > I've implemented the nodes as processes, and all operations on the tree are > relayed to the node that needs to do something about it. The code for this > implementation can be found here:- > http://www.cs.auckland.ac.nz/~fuad/cbst.erl > > I did my tests on a Sun Fire V880 with 8 900-MHz UltraSPARC-III processors > and 16 GBs of main memory; running Solaris 10 and Erlang (BEAM) 5.6.3. > > My tests consisted of randomly creating and populating a tree that has a > key range of 0-1000; and then performing at random (uniform distribution) > either an insert(), delete() or a contains() done 100,000 times. I would > vary the number of threads from 1 to 8, and the load (100,000 operations) > would be divided by the number of processors available. I also performed the > tests where the only operation performed is a contains() operation > (designated by 1:0:0), or 8 contains() operations, 1 insert() and 1 delete() > (8:1:1), or an equal mix of all three (1:1:1). > > In a perfect world, 2 threads would do the job in half the time 1 thread > would, but of course nothing is perfect. So as a baseline I performed > another test whereby each thread would just call a function (repeated for a > number of times) that does nothing but return true, to see how well that > scales (in the graph: Best Scalability). This used the same functions to > distribute the load, except that randOperation() would only return true > rather than do anything useful. > > Anyway, you can find the graph (where the results are normalized to the > wall time for one processor) at:- > http://www.cs.auckland.ac.nz/~fuad/bst-scale.png(the lower the lines goes, better the scalability) > > and the raw data (showing the wall time in ms) at:- > http://www.cs.auckland.ac.nz/~fuad/bst-scale.csv > > > As you can see, my data structure isn't scaling well at all regardless of > the kind of workload it has. I would expect it to scale well since the tree > should be kind of balanced. In C I would know how to write an implementation > where at least contains() scales well; writing something where tree > modification scales is a bit more difficult but should be doable. However, I > am new to Erlang and I can't really reason about all the issues well enough > to pull off a similar implementation. > > In a nutshell my question is; what am I doing wrong? Is there a better way > to have a place that stores shared data in a scalable manner? > > Thanks, > /Fuad > _______________________________________________ > 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 rtrlists@REDACTED Mon Jul 7 11:58:44 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 7 Jul 2008 10:58:44 +0100 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <909c265f0807070200t66c55416ofa9a980485b3e174@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> <909c265f0807070200t66c55416ofa9a980485b3e174@mail.gmail.com> Message-ID: <6a3ae47e0807070258k5f5c4afdjbff09927e3cab2d7@mail.gmail.com> Hi Fuad, On 7/7/08, Fuad Tabba wrote: > Thanks Robert, > > Yes I am familiar with Amdahl's law. That said, it's not true that all > writes need to be serialized; it's a binary tree, and unless the > modifications happen to be to the same node, there's no reason why they need > to be serialized. > > A database would solve the problem kinda; but that's like using a > steamroller to crack a nut. What I'm looking for a lightweight option that > could temporarily store data shared between threads, and would scale well as > the number of threads accessing/modifying this structure increases. I know > how to solve this problem in C (writing a concurrent binary search tree that > scales well), but since I'm new to Erlang I was unsuccessful trying to solve > this problem in Erlang. OK, I see. So, if I read your code correctly, your rpcInserts() and rpcDeletes() return quick, because your request is trickling down the tree on its own. Its the rpcContains() that need to wait for a proper result. It might be interesting to test the individual operations on their own, and then combinations thereof. That might give a quicker insight into what is causing the lack of speedup. My (uneducated) hunch is that the rpcContains() calls are where your "threads" are getting stuck (due in part to all the inserts and deletes clogging up the tree). Very unscientific, sorry. Robby From pfisher@REDACTED Mon Jul 7 13:35:51 2008 From: pfisher@REDACTED (Paul Fisher) Date: Mon, 07 Jul 2008 06:35:51 -0500 Subject: [erlang-questions] status of inets httpd and chunked support? Message-ID: <1215430551.7421.7.camel@localhost> I'm working with inets httpd using a mod_esi module which calls deliver/2 multiple times before returning from the callback/3 function in order to send the response back to the client incrementally. Reading the code in mod_esi quickly hints that this calling pattern should produced chunked response segments being sent to an http 1.1 client. I have not been able to get this working for FF3, with the browser choosing to close the connection before the entire result set is received. If i use wget (which connects as an http 1.0 client), or I supply the disable chunked attribute to inets httpd, the transfer works correctly. Are there known issues with inets httpd and chunked response transport? -- paul From kimmo@REDACTED Mon Jul 7 14:39:41 2008 From: kimmo@REDACTED (=?ISO-8859-1?Q?Kimmo_Gl=E4borg?=) Date: Mon, 7 Jul 2008 14:39:41 +0200 Subject: [erlang-questions] Force HTTP to HTTPS in Yaws Message-ID: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> Hi all, I'm new to the Erlang community and more from a systems administrative background rather than the programming side. Not sure if this would be the right place to post the question but let's see :) How can I configure Yaws to force https? Like I would like any user that loads the site in http, to be redirected to https. (I already have the https environment running & working). Regards Kimmo Gl?borg http://www.linkedin.com/in/glaborg From michal@REDACTED Mon Jul 7 15:38:47 2008 From: michal@REDACTED (Michal Slaski) Date: Mon, 7 Jul 2008 15:38:47 +0200 Subject: [erlang-questions] Force HTTP to HTTPS in Yaws In-Reply-To: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> References: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> Message-ID: <84d062da0807070638t5d6305f8t8bf41970bddbc186@mail.gmail.com> Hi Kimmo, > How can I configure Yaws to force https? Like I would like any user > that loads the > site in http, to be redirected to https. One way of doing it would be to change your yaws.conf file to have two docroot directories. One for http and the other one for https. https-docroot would be the one you are currently using. http-docroot would contain index.yaws file only which would always redirect to https. It could look like this (listing of index.yaws): out(A) -> {redirect,"https://localhost/"}. Change the above with your domain. This will however break any functionality that was available through http. Hope this helps, Michal -- Michal Slaski http://www.erlang-consulting.com From kevin@REDACTED Mon Jul 7 18:04:08 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Mon, 7 Jul 2008 09:04:08 -0700 Subject: [erlang-questions] tcerldrv-1.2.5b build error In-Reply-To: <18255420.post@talk.nabble.com> References: <18255420.post@talk.nabble.com> Message-ID: What gcc are you using? I hit some similar problems with gcc3, but they don't occur with gcc4. (But, also, I thought that Paul fixed all the gcc3 build issues; or at least the ones for my specific version.) -kevin On Jul 7, 2008, at 1:39 AM, Bharani wrote: > > First of all Thanks for a great work on porting tc to erlang. > > I am trying to get the tcerl to work but got a build error with the C > driver. I did install the tc 1.2.5 from source. > > here is what i get > > > make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' > make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' > make[2]: Nothing to be done for `all-am'. > make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' > make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' > Making all in src > make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' > make all-recursive > make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' > make[3]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' > /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. > -I/usr/local/include -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I > /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer- > arith > -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT > tcbdberl.lo > -MD -MP -MF .deps/tcbdberl.Tpo -c -o tcbdberl.lo tcbdberl.c > gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I > /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I > /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer- > arith > -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT > tcbdberl.lo -MD > -MP -MF .deps/tcbdberl.Tpo -c tcbdberl.c -fPIC -DPIC -o .libs/ > tcbdberl.o > In file included from tcbdbfrom.h:5, > from tcbdberl.c:13: > tcbdbtypes.h:13: warning: parameter has incomplete type > make[3]: *** [tcbdberl.lo] Error 1 > make[3]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' > make[1]: *** [all] Error 2 > make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' > make: *** [all-recursive] Error 1 > > > - Bharani > > -- > View this message in context: http://www.nabble.com/tcerldrv-1.2.5b-build-error-tp18255420p18255420.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 dot@REDACTED Mon Jul 7 19:36:30 2008 From: dot@REDACTED (Tony Finch) Date: Mon, 7 Jul 2008 18:36:30 +0100 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <486A9194.4020804@hyber.org> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> Message-ID: On Tue, 1 Jul 2008, Claes Wikstr?m wrote: > > Only possible solution I see is to > > 1. Have a socket setup from the driver to the beam (over loopback) > 2. in the sighandler write some data on the socket. Some of my friends recommend this technique for C programs too, so that it becomes possible to select() for signals in the same way as other events. Tony. -- f.anthony.n.finch http://dotat.at/ FISHER: SOUTHEASTERLY BECOMING CYCLONIC 4 OR 5, INCREASING 6 OR 7 IN NORTH. MODERATE OR ROUGH. SQUALLY SHOWERS. MODERATE OR GOOD. From arnaudsj@REDACTED Mon Jul 7 21:25:49 2008 From: arnaudsj@REDACTED (=?UTF-8?Q?S=C3=A9bastien_Arnaud?=) Date: Mon, 7 Jul 2008 14:25:49 -0500 Subject: [erlang-questions] Preferred Platform for Erlang? Message-ID: <99fdce3b0807071225pd2a487ai95e943543b38c132@mail.gmail.com> Hi All, I have been diving into the magical world of Erlang over the past 6 months and as I am getting ready to write and deploy my first OTP application, I was actually wondering if there was a preferred platform for Erlang? I am going to be implementing a calculation intensive application so any speed-up would be appreciated! Basically, I have been developing on OS X and deploying on Linux (AMD64, with Hipe enabled) but wondered if Solaris would yield better performance for Erlang since I had read many places that Solaris was heavily used during Erlang's coming of age. If there is no clear answer, is there a well-accepted erlang benchmark that can be used to test various configurations/platforms and compare the results? BTW keep up the good work Erlang team, it's been a refreshing and fun experience so far to learn Erlang. Cheers! S?bastien -------------- next part -------------- An HTML attachment was scrubbed... URL: From bqt@REDACTED Mon Jul 7 22:02:33 2008 From: bqt@REDACTED (Johnny Billquist) Date: Mon, 07 Jul 2008 22:02:33 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> Message-ID: <48727659.9030600@softjar.se> Tony Finch wrote: > On Tue, 1 Jul 2008, Claes Wikstr?m wrote: >> Only possible solution I see is to >> >> 1. Have a socket setup from the driver to the beam (over loopback) >> 2. in the sighandler write some data on the socket. > > Some of my friends recommend this technique for C programs too, so that it > becomes possible to select() for signals in the same way as other events. Why not check for EINTR as the possible reason for -1 as returned from select()? Even if you have a signal handler, the select() will return -1 when a signal occurs. Johnny From dot@REDACTED Mon Jul 7 23:25:24 2008 From: dot@REDACTED (Tony Finch) Date: Mon, 7 Jul 2008 22:25:24 +0100 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <48727659.9030600@softjar.se> References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> <48727659.9030600@softjar.se> Message-ID: On Mon, 7 Jul 2008, Johnny Billquist wrote: > Tony Finch wrote: > > On Tue, 1 Jul 2008, Claes Wikstr?m wrote: > > > > > > 1. Have a socket setup from the driver to the beam (over loopback) > > > 2. in the sighandler write some data on the socket. > > > > Some of my friends recommend this technique for C programs too, so that it > > becomes possible to select() for signals in the same way as other events. > > Why not check for EINTR as the possible reason for -1 as returned from > select()? Even if you have a signal handler, the select() will return -1 > when a signal occurs. Which signal? Tony. -- f.anthony.n.finch http://dotat.at/ SOUTHEAST ICELAND: NORTHEASTERLY 5 OR 6, OCCASIONALLY 7 IN SOUTHEAST. MODERATE, OCCASIONALLY ROUGH IN SOUTHEAST. FAIR. MODERATE OR GOOD. From masterofquestions@REDACTED Tue Jul 8 00:08:33 2008 From: masterofquestions@REDACTED (db) Date: Mon, 7 Jul 2008 18:08:33 -0400 Subject: [erlang-questions] list_to_binary vs iolist_to_binary Message-ID: <1218d6a50807071508m129e4e4emb0b06f8820e2f40d@mail.gmail.com> I have a sql query as a list and need to convert it to binary. Both function seems to take iolist as an argument and returns a binary() type. Only difference I see is that iolist_to_binary also takes in binary as an argument. Is that the only different? -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From masterofquestions@REDACTED Tue Jul 8 00:16:46 2008 From: masterofquestions@REDACTED (db) Date: Mon, 7 Jul 2008 18:16:46 -0400 Subject: [erlang-questions] cacherl memcached app startup problem question In-Reply-To: <14f0e3620806200738y65a7439fwde1ed4d4fb98e63a@mail.gmail.com> References: <1218d6a50805301550u50ddc883l4e07607c2e70f760@mail.gmail.com> <14f0e3620806200738y65a7439fwde1ed4d4fb98e63a@mail.gmail.com> Message-ID: <1218d6a50807071516l695f5679of510eff337b9b92a@mail.gmail.com> Does cacherl data get distributed among more than one mnesia nodes so that when one of the nodes go down, you still have your complete data and no data is lost? -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From fuad@REDACTED Tue Jul 8 01:20:56 2008 From: fuad@REDACTED (Fuad Tabba) Date: Tue, 8 Jul 2008 11:20:56 +1200 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <6a3ae47e0807070258k5f5c4afdjbff09927e3cab2d7@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> <909c265f0807070200t66c55416ofa9a980485b3e174@mail.gmail.com> <6a3ae47e0807070258k5f5c4afdjbff09927e3cab2d7@mail.gmail.com> Message-ID: <909c265f0807071620o6e6cd810w9a0c70e5e7acfc6e@mail.gmail.com> Thanks Robert and Hynek. Hynek; playing around with the number of scheduler threads (+S) or asynchronous threads (surprisingly) does not significantly alter the results. As for the tree size, on average it should be around 500 nodes, assuming it's balanced this gives us a bst that's roughly 8 nodes deep. A tree this big should scale well with 8 processors. Moreover, I'd expect a tree this big to scale almost perfectly going from 1 to 2 processors; especially if the ratio of lookups (contains()), that don't modify the data structure, is high. However, all I'm seeing is minor improvements. Moreover, increasing the size of the tree from 1000 to 10000 does improve scalability a bit, but not by all that much either. Robert; I think you're referring to an earlier version of my code, where I don't wait for the results of an insert or a delete. The lastest one ( http://www.cs.auckland.ac.nz/~fuad/cbst.erl), the final node inserted/deleted does inform the client whether the operation was successful or not. I can't confirm, but on a big enough tree stacking shouldn't be an issue since each node will probably only relay its request. But then again you're right, deeper analyses seems to be in order before I could make such statements with any kind of certainty. That said, I feel that this solution doesn't seem to be the best one. I'm sure other Erlang programmers must have had to solve a similar problem, maintaining shared data between different threads in a scalable way. Thanks again, /Fuad On Mon, Jul 7, 2008 at 9:58 PM, Robert Raschke wrote: > Hi Fuad, > > On 7/7/08, Fuad Tabba wrote: > > Thanks Robert, > > > > Yes I am familiar with Amdahl's law. That said, it's not true that all > > writes need to be serialized; it's a binary tree, and unless the > > modifications happen to be to the same node, there's no reason why they > need > > to be serialized. > > > > A database would solve the problem kinda; but that's like using a > > steamroller to crack a nut. What I'm looking for a lightweight option > that > > could temporarily store data shared between threads, and would scale well > as > > the number of threads accessing/modifying this structure increases. I > know > > how to solve this problem in C (writing a concurrent binary search tree > that > > scales well), but since I'm new to Erlang I was unsuccessful trying to > solve > > this problem in Erlang. > > OK, I see. > > So, if I read your code correctly, your rpcInserts() and rpcDeletes() > return quick, because your request is trickling down the tree on its > own. Its the rpcContains() that need to wait for a proper result. > > It might be interesting to test the individual operations on their > own, and then combinations thereof. That might give a quicker insight > into what is causing the lack of speedup. My (uneducated) hunch is > that the rpcContains() calls are where your "threads" are getting > stuck (due in part to all the inserts and deletes clogging up the > tree). > > Very unscientific, sorry. > > Robby > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bqt@REDACTED Tue Jul 8 02:00:58 2008 From: bqt@REDACTED (Johnny Billquist) Date: Tue, 08 Jul 2008 02:00:58 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: References: <24d4f39c0806190905w1d628859x2efcc47b2ca972c4@mail.gmail.com> <24d4f39c0806191828t52e8b2fbvbfd02512ce3990d6@mail.gmail.com> <485B0E06.8080804@lionet.info> <486A9194.4020804@hyber.org> <48727659.9030600@softjar.se> Message-ID: <4872AE3A.7030306@softjar.se> Tony Finch wrote: > On Mon, 7 Jul 2008, Johnny Billquist wrote: >> Tony Finch wrote: >>> On Tue, 1 Jul 2008, Claes Wikstr?m wrote: >>>> 1. Have a socket setup from the driver to the beam (over loopback) >>>> 2. in the sighandler write some data on the socket. >>> Some of my friends recommend this technique for C programs too, so that it >>> becomes possible to select() for signals in the same way as other events. >> Why not check for EINTR as the possible reason for -1 as returned from >> select()? Even if you have a signal handler, the select() will return -1 >> when a signal occurs. > > Which signal? > > Tony. Any signal. You'll have to write some other code to help figure out exactly which signal occured. Johnny From ok@REDACTED Tue Jul 8 03:47:09 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 8 Jul 2008 13:47:09 +1200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: References: Message-ID: <85106589-A909-4AE7-A7FC-30A979F9336C@cs.otago.ac.nz> An answer to the puzzle _could_ be something as simple as io:format("VIER = 6241, NEUN = 9409\n") *Some* amount of human judgement will be needed to convert the problem specification to executable code. For example, one way to find candidates is to enumerate integers in a certain range, square them, and check whether the squares have a suitable digit pattern. But what range of integers? Looking at it, _we_ see that the range need not be any more than 32..99, but given that, the rest is pretty much trivial. (sqrt(VIER) = 79, sqrt(NEUN) = 97, which is quite pretty.) You can get a short list for NEUN thus: neun_candidates() -> [{N,E,U,NEUN} || X <- lists:seq(32, 99), NEUN <- [X*X], [N,E,U,N] <- [integer_to_list(NEUN)], N /= E, N /= U, E /= U]. which returns the list [{$1,$5,$2,1521}, {$1,$6,$8,1681}, {$4,$6,$2,4624}, {$5,$6,$2,5625}, {$9,$4,$0,9409}]. The code for vier_candidates() is similar. Pasting them together is just vier_neun_candidates() -> A = vier_candidates(), B = neun_candidates(), [{VIER,NEUN} || {V,I,E,R,VIER} <- A, {N,E,U, NUEN} <- B, % some testing goes here ]. Then it's simply a matter of checking the last condition answer() -> C <- vier_neun_candidates(), [{VIER,NEUN} || {VIER,NEUN} <- C, X <- [[OOPS || {VIER,OOPS} <- C, OOPS /= NEUN]], X == [], Y <- [[JUNK || {JUNK,NEUN} <- C, JUNK /= VIER]], Y == []]. Finishing the details left for anyone interested. One comment I _will_ make is that there is a rather pointless restriction in Erlang syntax: the generator of a list comprehension *may* include "X <- [expr]" but may *not* include "X = expr", which means exactly the same thing. neun_candidates() -> [{N,E,U,NEUN} || X <- lists:seq(32, 99), NEUN = X*X, [N,E,U,N] = integer_to_list(NEUN), N /= E, N /= U, E /= U]. would have been much clearer. More precisely, Erlang *does* allow these expressions BUT WITH THE WRONG MEANING! A qualifier that is = should SUCCEED or FAIL, and if it succeeds, the value it returns is quite irrelevant and should by NO means be restricted to 'true' or 'false'. Another way to hack around this is to rewrite Pat = Expr as (Pat = Expr, true) but that has the wrong semantics too, because when the value of Expr doesn't match Pat, we simply want that iteration of the list comprehension to fail, not to produce an exception in the whole thing. What could break if this part of Erlang syntax were fixed? Let us suppose that nobody writes list comprehensions containing Nonvar = Expr because they could and should be rewritten to use == or =:=. Would _ = Expr make sense? No, because it would be equivalent to Expr. Would X = Expr make sense? No, because it would be equivalent to Expr, X = true and what would be the point of that? It really is past time that something was done about this. If the current badly broken semantics cannot be changed, then at least a compile-time warning for any list comprehension containing Pat = Expr that it is almost certainly incorrect would be helpful. From alain.odea@REDACTED Tue Jul 8 03:59:10 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Mon, 7 Jul 2008 23:29:10 -0230 Subject: [erlang-questions] What do you think of my Erlang Contextual Code Completion Library? Message-ID: <9F19A3E0-99EB-41B9-99DA-A631B844ED2A@gmail.com> I have written a library of Erlang modules that make it easier to write Erlang code completion plug-ins/bundles/extensions for editors and IDEs. It includes a reference implementation that integrates with TextMate. This article on my blog describes how the completion library works and includes a usage example. http://concise-software.blogspot.com/2008/07/erlang-contextual-code-completion.html The erlang_code_completion project on GitHub holds the code base and development history: http://github.com/AlainODea/erlang_code_completion/tree/master What do you think of my Erlang Contextual Code Completion Library? From gleber.p@REDACTED Tue Jul 8 07:19:44 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 8 Jul 2008 07:19:44 +0200 Subject: [erlang-questions] cacherl memcached app startup problem question In-Reply-To: <1218d6a50807071516l695f5679of510eff337b9b92a@mail.gmail.com> References: <1218d6a50805301550u50ddc883l4e07607c2e70f760@mail.gmail.com> <14f0e3620806200738y65a7439fwde1ed4d4fb98e63a@mail.gmail.com> <1218d6a50807071516l695f5679of510eff337b9b92a@mail.gmail.com> Message-ID: <14f0e3620807072219h4e106f44x8b71a44a5926290b@mail.gmail.com> Yes, it is distributed, but it is not automatic - you have to tweak it a little bit. I'll try to write a little tutorial about it when i'll be in front of my computer On 7/8/08, db wrote: > Does cacherl data get distributed among more than one mnesia nodes so > that when one of the nodes go down, you still have your complete data > and no data is lost? > > > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > -- Sent from Gmail for mobile | mobile.google.com Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From fuad@REDACTED Tue Jul 8 08:04:37 2008 From: fuad@REDACTED (Fuad Tabba) Date: Tue, 8 Jul 2008 18:04:37 +1200 Subject: [erlang-questions] Problems Writing a Scalable Shared Data Structure In-Reply-To: <909c265f0807071620o6e6cd810w9a0c70e5e7acfc6e@mail.gmail.com> References: <909c265f0807061631r70a8b808y4fd1dc126f377d16@mail.gmail.com> <6a3ae47e0807070122r78dc0fb5h80fca47179236031@mail.gmail.com> <909c265f0807070200t66c55416ofa9a980485b3e174@mail.gmail.com> <6a3ae47e0807070258k5f5c4afdjbff09927e3cab2d7@mail.gmail.com> <909c265f0807071620o6e6cd810w9a0c70e5e7acfc6e@mail.gmail.com> Message-ID: <909c265f0807072304u324029f0wd7aa634addd22901@mail.gmail.com> Adding some observations; I've tried disabling smp all together (on the 8 core machine), and ironically the tests run more than twice as fast with smp disabled. It's probably a cache-locality thing, since the tests are small therefore all the data could easily fit in one processor's cache. The thing is though, I do not get the same effect using +S 1, performance doesn't vary all that much... Another thing I've tried is I created a base for the tree; what I mean is that there's a known root, a known node to the left of the root and a known node that's to the right of the root. These nodes are always there. Whenever the insert/delete/contains functions are called, rather than send the request to the Root, they send it to one of those three depending on the value of the key. To make a long story short, this didn't help either (even going from 1 to 2 threads), which might imply that contention at the root isn't the bottleneck in my case. /Fuad On Tue, Jul 8, 2008 at 11:20 AM, Fuad Tabba wrote: > Thanks Robert and Hynek. > > Hynek; playing around with the number of scheduler threads (+S) or > asynchronous threads (surprisingly) does not significantly alter the > results. As for the tree size, on average it should be around 500 nodes, > assuming it's balanced this gives us a bst that's roughly 8 nodes deep. A > tree this big should scale well with 8 processors. Moreover, I'd expect a > tree this big to scale almost perfectly going from 1 to 2 processors; > especially if the ratio of lookups (contains()), that don't modify the data > structure, is high. However, all I'm seeing is minor improvements. Moreover, > increasing the size of the tree from 1000 to 10000 does improve scalability > a bit, but not by all that much either. > > Robert; I think you're referring to an earlier version of my code, where I > don't wait for the results of an insert or a delete. The lastest one ( > http://www.cs.auckland.ac.nz/~fuad/cbst.erl), > the final node inserted/deleted does inform the client whether the operation > was successful or not. I can't confirm, but on a big enough tree stacking > shouldn't be an issue since each node will probably only relay its request. > But then again you're right, deeper analyses seems to be in order before I > could make such statements with any kind of certainty. > > That said, I feel that this solution doesn't seem to be the best one. I'm > sure other Erlang programmers must have had to solve a similar problem, > maintaining shared data between different threads in a scalable way. > > Thanks again, > /Fuad > > On Mon, Jul 7, 2008 at 9:58 PM, Robert Raschke > wrote: > >> Hi Fuad, >> >> On 7/7/08, Fuad Tabba wrote: >> > Thanks Robert, >> > >> > Yes I am familiar with Amdahl's law. That said, it's not true that all >> > writes need to be serialized; it's a binary tree, and unless the >> > modifications happen to be to the same node, there's no reason why they >> need >> > to be serialized. >> > >> > A database would solve the problem kinda; but that's like using a >> > steamroller to crack a nut. What I'm looking for a lightweight option >> that >> > could temporarily store data shared between threads, and would scale >> well as >> > the number of threads accessing/modifying this structure increases. I >> know >> > how to solve this problem in C (writing a concurrent binary search tree >> that >> > scales well), but since I'm new to Erlang I was unsuccessful trying to >> solve >> > this problem in Erlang. >> >> OK, I see. >> >> So, if I read your code correctly, your rpcInserts() and rpcDeletes() >> return quick, because your request is trickling down the tree on its >> own. Its the rpcContains() that need to wait for a proper result. >> >> It might be interesting to test the individual operations on their >> own, and then combinations thereof. That might give a quicker insight >> into what is causing the lack of speedup. My (uneducated) hunch is >> that the rpcContains() calls are where your "threads" are getting >> stuck (due in part to all the inserts and deletes clogging up the >> tree). >> >> Very unscientific, sorry. >> >> Robby >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tchamila@REDACTED Tue Jul 8 08:31:42 2008 From: tchamila@REDACTED (chamila piyasena) Date: Tue, 8 Jul 2008 12:01:42 +0530 Subject: [erlang-questions] a C API for Erlang Message-ID: <552d666a0807072331i43be960fgd19fcbbbc116b87f@mail.gmail.com> Hi, Can we use C fucntions within Erlang code without using the message passing techniqes specified in interoperability document and Does Erlang has a native C API ? cheers, Chamila -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam@REDACTED Tue Jul 8 08:52:16 2008 From: adam@REDACTED (Adam Lindberg) Date: Tue, 8 Jul 2008 08:52:16 +0200 Subject: [erlang-questions] list_to_binary vs iolist_to_binary In-Reply-To: <1218d6a50807071508m129e4e4emb0b06f8820e2f40d@mail.gmail.com> References: <1218d6a50807071508m129e4e4emb0b06f8820e2f40d@mail.gmail.com> Message-ID: <6344005f0807072352i73a38377r782fddacead5117e@mail.gmail.com> Well, an IO list can basically be any mix of lists (deep) and binaries, and thus only one binary in one of its simpler forms. I suppose it is for convenience purposes so that you don't have to know whether your IO list is only a binary or a deeper list. Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Tue, Jul 8, 2008 at 00:08, db wrote: > I have a sql query as a list and need to convert it to binary. Both > function seems to take iolist as an argument and returns a binary() > type. Only difference I see is that iolist_to_binary also takes in > binary as an argument. Is that the only different? > > -- > rk > > That which we persist in doing becomes easier for us to do; not that > the nature of the thing itself is changed, but that our power to do is > increased. > -Ralph Waldo Emerson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rapsey@REDACTED Tue Jul 8 09:41:04 2008 From: rapsey@REDACTED (Rapsey) Date: Tue, 8 Jul 2008 09:41:04 +0200 Subject: [erlang-questions] a C API for Erlang In-Reply-To: <552d666a0807072331i43be960fgd19fcbbbc116b87f@mail.gmail.com> References: <552d666a0807072331i43be960fgd19fcbbbc116b87f@mail.gmail.com> Message-ID: <97619b170807080041t4f4f376do2d0de3146509200a@mail.gmail.com> C code is kept at a distance from Erlang, because it is not trusted to be reliable (it could bring the entire erlang runtime down with it if there is a problem). There is no native C API. Sergej 2008/7/8 chamila piyasena : > Hi, > > Can we use C fucntions within Erlang code without using the message passing > techniqes specified in interoperability document and > Does Erlang has a native C API ? > > cheers, > Chamila > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kimmo@REDACTED Tue Jul 8 09:46:41 2008 From: kimmo@REDACTED (=?ISO-8859-1?Q?Kimmo_Gl=E4borg?=) Date: Tue, 8 Jul 2008 09:46:41 +0200 Subject: [erlang-questions] Force HTTP to HTTPS in Yaws In-Reply-To: <84d062da0807070638t5d6305f8t8bf41970bddbc186@mail.gmail.com> References: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> <84d062da0807070638t5d6305f8t8bf41970bddbc186@mail.gmail.com> Message-ID: <91AD8385-2841-4ABF-8634-296658604B4F@glaborg.com> >> How can I configure Yaws to force https? Like I would like any user >> that loads the >> site in http, to be redirected to https. > > One way of doing it would be to change your yaws.conf file to have two > docroot directories. One for http and the other one for https. > https-docroot would be the one you are currently using. http-docroot > would contain index.yaws file only which would always redirect to > https. It could look like this (listing of index.yaws): > > > out(A) -> > {redirect,"https://localhost/"}. > > > Change the above with your domain. This will however break any > functionality that was available through http. Thanks Michal! I probably would like to keep the http environment working aswell. Isn't there a way to configure this in the Yaws config environment? (I believe this is just a setting, both in IIS and Apache for example..) // kimmo From chsu79@REDACTED Tue Jul 8 10:01:20 2008 From: chsu79@REDACTED (Christian S) Date: Tue, 8 Jul 2008 10:01:20 +0200 Subject: [erlang-questions] fyi: Google protocol buffers Message-ID: http://code.google.com/apis/protocolbuffers/docs/overview.html "Protocol buffers are now Google's lingua franca for data ? at time of writing, there are 48,162 different message types defined in the Google code tree across 12,183 .proto files. They're used both in RPC systems and for persistent storage of data in a variety of storage systems." They're using it over XML, which I find noble (apparently XML has too much overhead even if you have thousands of machines, who would have known?), but protocol buffers it is no UBF. :-) From vychodil.hynek@REDACTED Tue Jul 8 10:13:22 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 8 Jul 2008 10:13:22 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <85106589-A909-4AE7-A7FC-30A979F9336C@cs.otago.ac.nz> References: <85106589-A909-4AE7-A7FC-30A979F9336C@cs.otago.ac.nz> Message-ID: <4d08db370807080113y5f3365b4ra778da0a53fcaeb0@mail.gmail.com> On Tue, Jul 8, 2008 at 3:47 AM, Richard A. O'Keefe wrote: > An answer to the puzzle _could_ be something as simple as > > io:format("VIER = 6241, NEUN = 9409\n") > > *Some* amount of human judgement will be needed to convert > the problem specification to executable code. For example, > one way to find candidates is to enumerate integers in a > certain range, square them, and check whether the squares > have a suitable digit pattern. But what range of integers? > Looking at it, _we_ see that the range need not be any more > than 32..99, but given that, the rest is pretty much > trivial. (sqrt(VIER) = 79, sqrt(NEUN) = 97, which is quite > pretty.) You can get a short list for NEUN thus: > > neun_candidates() -> > [{N,E,U,NEUN} || > X <- lists:seq(32, 99), > NEUN <- [X*X], > [N,E,U,N] <- [integer_to_list(NEUN)], > N /= E, N /= U, E /= U]. > which returns the list > [{$1,$5,$2,1521}, {$1,$6,$8,1681}, {$4,$6,$2,4624}, > {$5,$6,$2,5625}, {$9,$4,$0,9409}]. > The code for vier_candidates() is similar. > Pasting them together is just > > vier_neun_candidates() -> > A = vier_candidates(), > B = neun_candidates(), > [{VIER,NEUN} || > {V,I,E,R,VIER} <- A, > {N,E,U, NUEN} <- B, > % some testing goes here > ]. > > Then it's simply a matter of checking the last condition > > answer() -> > C <- vier_neun_candidates(), > [{VIER,NEUN} || > {VIER,NEUN} <- C, > X <- [[OOPS || {VIER,OOPS} <- C, OOPS /= NEUN]], > X == [], > Y <- [[JUNK || {JUNK,NEUN} <- C, JUNK /= VIER]], > Y == []]. > > Finishing the details left for anyone interested. > One comment I _will_ make is that there is a rather pointless > restriction in Erlang syntax: the generator of a list > comprehension *may* include "X <- [expr]" but may *not* > include "X = expr", which means exactly the same thing. > > neun_candidates() -> > [{N,E,U,NEUN} || > X <- lists:seq(32, 99), > NEUN = X*X, > [N,E,U,N] = integer_to_list(NEUN), > N /= E, N /= U, E /= U]. neun_candidates() -> [{N,E,U,NEUN} || X <- lists:seq(32, 99), begin NEUN = X*X, [N,E,U,N1] = integer_to_list(NEUN), N =:= N1 andalso N /= E andalso N /= U andalso E /= U end]. > > would have been much clearer. > > More precisely, Erlang *does* allow these expressions > BUT WITH THE WRONG MEANING! A qualifier that is > = > should SUCCEED or FAIL, and if it succeeds, the > value it returns is quite irrelevant and should by NO > means be restricted to 'true' or 'false'. > > Another way to hack around this is to rewrite > Pat = Expr > as (Pat = Expr, true) > but that has the wrong semantics too, because when > the value of Expr doesn't match Pat, we simply want > that iteration of the list comprehension to fail, > not to produce an exception in the whole thing. > > What could break if this part of Erlang syntax were fixed? > Let us suppose that nobody writes list comprehensions > containing > Nonvar = Expr > because they could and should be rewritten to use == or > =:=. Would > _ = Expr > make sense? No, because it would be equivalent to > Expr. > Would > X = Expr > make sense? No, because it would be equivalent to > Expr, X = true > and what would be the point of that? > > It really is past time that something was done about this. > If the current badly broken semantics cannot be changed, > then at least a compile-time warning for any list > comprehension containing Pat = Expr that it is almost > certainly incorrect would be helpful. > > > > > > _______________________________________________ > 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 Tue Jul 8 11:07:13 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 8 Jul 2008 11:07:13 +0200 Subject: [erlang-questions] Sunday puzzle - trying to improve my Erlang In-Reply-To: <85106589-A909-4AE7-A7FC-30A979F9336C@cs.otago.ac.nz> References: <85106589-A909-4AE7-A7FC-30A979F9336C@cs.otago.ac.nz> Message-ID: <4d08db370807080207v2810be3gcce7ebf5cfec8165@mail.gmail.com> On Tue, Jul 8, 2008 at 3:47 AM, Richard A. O'Keefe wrote: > An answer to the puzzle _could_ be something as simple as > > io:format("VIER = 6241, NEUN = 9409\n") > begin Qs = [integer_to_list(S) || S <- [X*X || X <- lists:seq(32,99)]], Ps = [{E,{Vr,Nn}} || [N,E,_U,N]=Nn <- Qs, [_V,_I, E1, _R] = Vr <-Qs, E=:=E1, length(ordsets:from_list(Nn++Vr)) =:= 6], D = lists:foldl(fun ({E,_}, D) -> dict:update_counter(E,1,D) end, dict:new(), Ps), [{VIER, NEUN}] = [P || {E,1} <- dict:to_list(D), {E1,P} <- Ps, E=:=E1], io:format("Neun: ~s, Vier: ~s~n", [NEUN, VIER]) end. Neun: 9409, Vier: 6241 ok > *Some* amount of human judgement will be needed to convert > the problem specification to executable code. For example, > one way to find candidates is to enumerate integers in a > certain range, square them, and check whether the squares > have a suitable digit pattern. But what range of integers? > Looking at it, _we_ see that the range need not be any more > than 32..99, but given that, the rest is pretty much > trivial. (sqrt(VIER) = 79, sqrt(NEUN) = 97, which is quite > pretty.) You can get a short list for NEUN thus: > > neun_candidates() -> > [{N,E,U,NEUN} || > X <- lists:seq(32, 99), > NEUN <- [X*X], > [N,E,U,N] <- [integer_to_list(NEUN)], > N /= E, N /= U, E /= U]. > which returns the list > [{$1,$5,$2,1521}, {$1,$6,$8,1681}, {$4,$6,$2,4624}, > {$5,$6,$2,5625}, {$9,$4,$0,9409}]. > The code for vier_candidates() is similar. > Pasting them together is just > > vier_neun_candidates() -> > A = vier_candidates(), > B = neun_candidates(), > [{VIER,NEUN} || > {V,I,E,R,VIER} <- A, > {N,E,U, NUEN} <- B, > % some testing goes here > ]. > > Then it's simply a matter of checking the last condition > > answer() -> > C <- vier_neun_candidates(), > [{VIER,NEUN} || > {VIER,NEUN} <- C, > X <- [[OOPS || {VIER,OOPS} <- C, OOPS /= NEUN]], > X == [], > Y <- [[JUNK || {JUNK,NEUN} <- C, JUNK /= VIER]], > Y == []]. > > Finishing the details left for anyone interested. > One comment I _will_ make is that there is a rather pointless > restriction in Erlang syntax: the generator of a list > comprehension *may* include "X <- [expr]" but may *not* > include "X = expr", which means exactly the same thing. > > neun_candidates() -> > [{N,E,U,NEUN} || > X <- lists:seq(32, 99), > NEUN = X*X, > [N,E,U,N] = integer_to_list(NEUN), > N /= E, N /= U, E /= U]. > > would have been much clearer. > > More precisely, Erlang *does* allow these expressions > BUT WITH THE WRONG MEANING! A qualifier that is > = > should SUCCEED or FAIL, and if it succeeds, the > value it returns is quite irrelevant and should by NO > means be restricted to 'true' or 'false'. > > Another way to hack around this is to rewrite > Pat = Expr > as (Pat = Expr, true) > but that has the wrong semantics too, because when > the value of Expr doesn't match Pat, we simply want > that iteration of the list comprehension to fail, > not to produce an exception in the whole thing. > > What could break if this part of Erlang syntax were fixed? > Let us suppose that nobody writes list comprehensions > containing > Nonvar = Expr > because they could and should be rewritten to use == or > =:=. Would > _ = Expr > make sense? No, because it would be equivalent to > Expr. > Would > X = Expr > make sense? No, because it would be equivalent to > Expr, X = true > and what would be the point of that? > > It really is past time that something was done about this. > If the current badly broken semantics cannot be changed, > then at least a compile-time warning for any list > comprehension containing Pat = Expr that it is almost > certainly incorrect would be helpful. > > > > > > _______________________________________________ > 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 adam@REDACTED Tue Jul 8 12:53:19 2008 From: adam@REDACTED (Adam Lindberg) Date: Tue, 8 Jul 2008 12:53:19 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: <6344005f0807080353wfbb5380i27e41b101c280598@mail.gmail.com> How dose this relate to, say, JSON? I have little experience in JSON but I imagined that is is sort of the task JSON was designed for, i.e. information serialization. ... ?_? Here I'm answering my own question, this is taken from the Protocol Buffers Google Group: ------------------------------------------------------------------------------- From: "Kenton Varda" Date: Mon, 7 Jul 2008 20:02:27 -0700 Local: Tues, Jul 8 2008 5:02 am Subject: Re: json? On Mon, Jul 7, 2008 at 7:07 PM, tommy wrote: > What are the advantages of protocol buffers over JSON? Two things, mainly: 1) Protocol Buffers are smaller and -- assuming you are not just using exec() to parse your JSON -- faster to parse. 2) Protocol Buffers give you nice auto-generated, type-safe classes to manipulate your message types. With JSON you just get a string->string map. On the other hand, in a dynamically-typed language there might not be a huge difference. Disadvantages include: 1) Cannot just use exec() to parse; you need a parsing library. 2) Not human-readable (unless you use the TextFormat class, but then you don't get the efficiency benefits). Note that it would make sense to write some code -- similar to what TextFormat does -- which encodes and decodes protocol messages in JSON format using protobuf reflection. This shouldn't be very hard, especially if you start by copying the TextFormat code. We might include such a thing in a future release. ------------------------------------------------------------------------------- Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Tue, Jul 8, 2008 at 10:01, Christian S wrote: > http://code.google.com/apis/protocolbuffers/docs/overview.html > > "Protocol buffers are now Google's lingua franca for data ? at time of > writing, there are 48,162 different message types defined in the > Google code tree across 12,183 .proto files. They're used both in RPC > systems and for persistent storage of data in a variety of storage > systems." > > They're using it over XML, which I find noble (apparently XML has too > much overhead even if you have thousands of machines, who would have > known?), but protocol buffers it is no UBF. :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alain.odea@REDACTED Tue Jul 8 13:42:22 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Tue, 8 Jul 2008 09:12:22 -0230 Subject: [erlang-questions] a C API for Erlang In-Reply-To: <97619b170807080041t4f4f376do2d0de3146509200a@mail.gmail.com> References: <552d666a0807072331i43be960fgd19fcbbbc116b87f@mail.gmail.com> <97619b170807080041t4f4f376do2d0de3146509200a@mail.gmail.com> Message-ID: <728e3ef50807080442l3cfbe4cpe306d57cf94d5c4a@mail.gmail.com> If you really do want to call C directly you need to create a Linked-in Driver. The Erlang Driver Toolkit [EDTK] http://www.snookles.com/erlang/edtk/ looks like a good way to do this. Make sure the C code is thoroughly tested and free of side effects insofar as is possible. 2008/7/8 Rapsey : > C code is kept at a distance from Erlang, because it is not trusted to be > reliable (it could bring the entire erlang runtime down with it if there is > a problem). There is no native C API. > > > Sergej > > 2008/7/8 chamila piyasena : >> >> Hi, >> >> Can we use C fucntions within Erlang code without using the message >> passing techniqes specified in interoperability document and >> Does Erlang has a native C API ? >> cheers, >> Chamila >> >> >> >> _______________________________________________ >> 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 bharani_vms@REDACTED Tue Jul 8 14:01:38 2008 From: bharani_vms@REDACTED (Bharani) Date: Tue, 8 Jul 2008 05:01:38 -0700 (PDT) Subject: [erlang-questions] tcerldrv-1.2.5b build error In-Reply-To: References: <18255420.post@talk.nabble.com> Message-ID: <18337491.post@talk.nabble.com> Thanks ! using gcc4 fixed the problem. I got a clean build of driver and the tcerl erlang code. However when i tried to create the table (as shown in step4 of http://code.google.com/p/tcerl/wiki/Example ) i got an error mnesia:create_table (testtab, [ { type, { external, ordered_set, tcbdbtab } }, { external_copies, [ node () ] }, { user_properties, [ { deflate, true }, { bucket_array_size, 10000 } ] } ]). {aborted,{no_exists,{testtab,cstruct}}} i have added tcerl and mnesiaex to the path and if i look at the Mnesia.nonode@REDACTED directory i see -rw-rw-r-- 1 erlang erlang 156 Jul 8 17:32 DECISION_TAB.LOG -rw-rw-r-- 1 erlang erlang 95 Jul 8 18:03 LATEST.LOG -rw-rw-r-- 1 erlang erlang 8328 Jul 8 17:14 schema.DAT is there anything else i am missing? Thanks Bharani Kevin Scaldeferri wrote: > > What gcc are you using? I hit some similar problems with gcc3, but > they don't occur with gcc4. (But, also, I thought that Paul fixed all > the gcc3 build issues; or at least the ones for my specific version.) > > > -kevin > > > On Jul 7, 2008, at 1:39 AM, Bharani wrote: > >> >> First of all Thanks for a great work on porting tc to erlang. >> >> I am trying to get the tcerl to work but got a build error with the C >> driver. I did install the tc 1.2.5 from source. >> >> here is what i get >> >> >> make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' >> make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' >> make[2]: Nothing to be done for `all-am'. >> make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' >> make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/fw-pkgin' >> Making all in src >> make[1]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' >> make all-recursive >> make[2]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' >> make[3]: Entering directory `/home/erlang/tcerldrv-1.2.5b/src' >> /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. >> -I/usr/local/include -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I >> /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer- >> arith >> -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT >> tcbdberl.lo >> -MD -MP -MF .deps/tcbdberl.Tpo -c -o tcbdberl.lo tcbdberl.c >> gcc -DHAVE_CONFIG_H -I. -I/usr/local/include -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/include -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/legacy -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/misc/ -I >> /usr/local/lib/erlang/lib/erl_interface-3.5.6/src/decode -I >> /usr/local/lib/erlang/erts-5.6.2/include -W -Wall -Werror -Wpointer- >> arith >> -Wcast-align -Wwrite-strings -Wmissing-prototypes -g -O2 -MT >> tcbdberl.lo -MD >> -MP -MF .deps/tcbdberl.Tpo -c tcbdberl.c -fPIC -DPIC -o .libs/ >> tcbdberl.o >> In file included from tcbdbfrom.h:5, >> from tcbdberl.c:13: >> tcbdbtypes.h:13: warning: parameter has incomplete type >> make[3]: *** [tcbdberl.lo] Error 1 >> make[3]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' >> make[2]: *** [all-recursive] Error 1 >> make[2]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' >> make[1]: *** [all] Error 2 >> make[1]: Leaving directory `/home/erlang/tcerldrv-1.2.5b/src' >> make: *** [all-recursive] Error 1 >> >> >> - Bharani >> >> -- >> View this message in context: >> http://www.nabble.com/tcerldrv-1.2.5b-build-error-tp18255420p18255420.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 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/tcerldrv-1.2.5b-build-error-tp18255420p18337491.html Sent from the Erlang Questions mailing list archive at Nabble.com. From kruegger@REDACTED Tue Jul 8 17:05:36 2008 From: kruegger@REDACTED (Stephen Han) Date: Tue, 8 Jul 2008 08:05:36 -0700 Subject: [erlang-questions] Erlang beam memory question Message-ID: <86f1f5350807080805r3c09d2abw672e731f32eb0252@mail.gmail.com> Hi If I do the 'top' then the beam is using Size: 302M RSS: 302M SHARE: 1716 However, when I do the erlang:memory() [{total,13418553}, {processes,3778222}, {processes_used,3386662}, {system,9640331}, {atom,590253}, {atom_used,580770}, {binary,218737}, {code,6708906}, {ets,834788}] It is showing different number? Why there is such a discrepancies? I am running Yaws on OTP r10b-9. I do see the issue once i do stress testing using tool to generate about 500 user sessions. regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue Jul 8 17:19:44 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 8 Jul 2008 17:19:44 +0200 Subject: [erlang-questions] Bug using negative numbers to crypto:rand_uniform? Message-ID: <56a0a2840807080819n41886e4bp42c5d5ef0cbe31e5@mail.gmail.com> Hi, I've tried the following in R11B-5 and had people check it in R12B (subrevision unknown) as well: Calls of the form crypto:rand_uniform(Lo, Hi). Where Lo and Hi are negative integers fail due to some wrap-around somewhere: (x@REDACTED)12> crypto:rand_uniform(-10, -5). 250 The documentation states: rand_uniform(Lo, Hi) -> N Types: Lo, Hi, N = Mpint | integer() Mpint = binary() Generate a random number N, Lo =< N < Hi. Uses the crypto library pseudo-random number generator. The arguments (and result) can be either erlang integers or binary multi-precision integers. --- Which doesn't mention anything about negative integer() values. Other interesting test cases are combinations of negative and positive numbers and where Lo > Hi etc. It is rather easy to work around, but either the documentation or the implementation should be changed to solve the problem in my humble opinion. Finally: Should this go to erlang-bugs@ intead? Or is that I just can't read the documentation? From fig@REDACTED Tue Jul 8 20:19:43 2008 From: fig@REDACTED (Michael FIG) Date: Tue, 8 Jul 2008 12:19:43 -0600 (CST) Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <4872AE3A.7030306@softjar.se> Message-ID: <29419007.302201215541183765.JavaMail.root@zimbra> Hi, ----- "Johnny Billquist" wrote: > Tony Finch wrote: > > On Mon, 7 Jul 2008, Johnny Billquist wrote: > >> Tony Finch wrote: > >>> On Tue, 1 Jul 2008, Claes Wikstr?m wrote: > >>>> 1. Have a socket setup from the driver to the beam (over loopback) > >>>> 2. in the sighandler write some data on the socket. > >>> Some of my friends recommend this technique for C programs too, so > >>> that it becomes possible to select() for signals in the same way > >>> as other events. > >> Why not check for EINTR as the possible reason for -1 as returned > >> from select()? Even if you have a signal handler, the select() will > >> return -1 when a signal occurs. > > > > Which signal? > > Any signal. > You'll have to write some other code to help figure out exactly which > signal occured. I think that's the point Tony was trying to make: "some other code" is simply writing the signal's number as a byte into the pipe, so that when you select and read, you can get the signal number. That way, you can cope with a flurry of signals before they start getting lost. If you haven't actually tried to write that "some other code", you probably don't know that it's impossible to get working reliably. That's because your idea does not solve the inherent race condition. What if the signal arrives while the code is doing something other than select(2) (i.e. processing the results of a prior select)? See http://cr.yp.to/docs/selfpipe.html for the history of the "self-pipe trick". -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From mog-lists@REDACTED Tue Jul 8 23:46:08 2008 From: mog-lists@REDACTED (mog) Date: Tue, 08 Jul 2008 16:46:08 -0500 Subject: [erlang-questions] Force HTTP to HTTPS in Yaws In-Reply-To: <91AD8385-2841-4ABF-8634-296658604B4F@glaborg.com> References: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> <84d062da0807070638t5d6305f8t8bf41970bddbc186@mail.gmail.com> <91AD8385-2841-4ABF-8634-296658604B4F@glaborg.com> Message-ID: <4873E020.40704@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kimmo Gl?borg wrote: |>> How can I configure Yaws to force https? Like I would like any user |>> that loads the |>> site in http, to be redirected to https. |> One way of doing it would be to change your yaws.conf file to have two |> docroot directories. One for http and the other one for https. |> https-docroot would be the one you are currently using. http-docroot |> would contain index.yaws file only which would always redirect to |> https. It could look like this (listing of index.yaws): |> |> |> out(A) -> |> {redirect,"https://localhost/"}. |> |> |> Change the above with your domain. This will however break any |> functionality that was available through http. | | Thanks Michal! I probably would like to keep the http environment | working aswell. | Isn't there a way to configure this in the Yaws config environment? (I | believe this is | just a setting, both in IIS and Apache for example..) | | // kimmo | _______________________________________________ | erlang-questions mailing list | erlang-questions@REDACTED | http://www.erlang.org/mailman/listinfo/erlang-questions its pretty easy to get it going the way you want here is https redirect i wrote once %%%http_redirect.erl%%%----------------------------------------------------- - -module(http_redirect). - -include("/usr/local/lib/yaws/include/yaws_api.hrl"). - -export([out/1]). ~ Path = Args#arg.server_path, ~ Redirect = lists:append("https://www.YOURDOMAINHERE.com", Path), ~ {redirect, Redirect}. %%%yaws.conf------------------------------------------------------- ..... ~ port = 80 ~ listen = 0.0.0.0 ~ appmods = <"/", http_redirect> ~ docroot = /usr/local/var/yaws/ebin ..... %%%%%----------- hope this helps mog mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIc+Aeeq+tARrxhnsRAt7PAKCOKRc7nOEuCJt4tyQ7q2GIAJS2ngCdGUxm ibGbptmFI0sOAIc7i6sYypQ= =pjFt -----END PGP SIGNATURE----- From bqt@REDACTED Wed Jul 9 00:18:28 2008 From: bqt@REDACTED (Johnny Billquist) Date: Wed, 09 Jul 2008 00:18:28 +0200 Subject: [erlang-questions] Signal handling (TERM, INT etc) In-Reply-To: <29419007.302201215541183765.JavaMail.root@zimbra> References: <29419007.302201215541183765.JavaMail.root@zimbra> Message-ID: <4873E7B4.1060205@softjar.se> Michael FIG skrev: > Hi, > > ----- "Johnny Billquist" wrote: >> Tony Finch wrote: >>> On Mon, 7 Jul 2008, Johnny Billquist wrote: >>>> Tony Finch wrote: >>>>> On Tue, 1 Jul 2008, Claes Wikstr?m wrote: >>>>>> 1. Have a socket setup from the driver to the beam (over loopback) >>>>>> 2. in the sighandler write some data on the socket. >>>>> Some of my friends recommend this technique for C programs too, so >>>>> that it becomes possible to select() for signals in the same way >>>>> as other events. >>>> Why not check for EINTR as the possible reason for -1 as returned >>>> from select()? Even if you have a signal handler, the select() will >>>> return -1 when a signal occurs. >>> Which signal? >> Any signal. >> You'll have to write some other code to help figure out exactly which >> signal occured. > > I think that's the point Tony was trying to make: "some other code" is simply writing the signal's number as a byte into the pipe, so that when you select and read, you can get the signal number. That way, you can cope with a flurry of signals before they start getting lost. If you haven't actually tried to write that "some other code", you probably don't know that it's impossible to get working reliably. > > That's because your idea does not solve the inherent race condition. What if the signal arrives while the code is doing something other than select(2) (i.e. processing the results of a prior select)? > > See http://cr.yp.to/docs/selfpipe.html for the history of the "self-pipe trick". I don't think this might be the place to dive into the deep end of signal handling in Unix. (It is, after all, an Erlang list). Suffice to say that I know of the potential problems. Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt@REDACTED || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol From shehan@REDACTED Wed Jul 9 04:51:28 2008 From: shehan@REDACTED (shehan) Date: Wed, 9 Jul 2008 08:21:28 +0530 Subject: [erlang-questions] Erlang beam memory question In-Reply-To: <86f1f5350807080805r3c09d2abw672e731f32eb0252@mail.gmail.com> Message-ID: <20080709025631.A29FB19DC22B@mail.wavenet.lk> Use etop to measure memory usage accurately. Ex: /usr/local/lib/erlang/lib/observer-0.9.7.4/priv/bin/etop -node -setcookie -tracing off -lines 30 -sort memory _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Stephen Han Sent: Tuesday, July 08, 2008 8:36 PM To: - Erlang Questions Subject: [erlang-questions] Erlang beam memory question Hi If I do the 'top' then the beam is using Size: 302M RSS: 302M SHARE: 1716 However, when I do the erlang:memory() [{total,13418553}, {processes,3778222}, {processes_used,3386662}, {system,9640331}, {atom,590253}, {atom_used,580770}, {binary,218737}, {code,6708906}, {ets,834788}] It is showing different number? Why there is such a discrepancies? I am running Yaws on OTP r10b-9. I do see the issue once i do stress testing using tool to generate about 500 user sessions. regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Wed Jul 9 08:55:59 2008 From: jeffm@REDACTED (jm) Date: Wed, 09 Jul 2008 16:55:59 +1000 Subject: [erlang-questions] Error 403 for planeterlang.org Message-ID: <487460FF.5010805@ghostgun.com> Attempting to access http://www.planeterlang.org/ I recieve Error 403 www.planeterlang.org mer 09 jui 2008 08:37:31 CEST Apache/2.0.53 (Linux/SUSE) from the 203.221.x.x range (Australia). I tried to email the address in the error message but this bounces. If someone on this list maintains, or can contact the maintainer, of this site: any chance of having this fixed? much appreciated. Jeff. From adam@REDACTED Wed Jul 9 09:00:03 2008 From: adam@REDACTED (Adam Lindberg) Date: Wed, 9 Jul 2008 09:00:03 +0200 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <487460FF.5010805@ghostgun.com> References: <487460FF.5010805@ghostgun.com> Message-ID: <6344005f0807090000u367f4ddfpf896d95a42a48e36@mail.gmail.com> Works For Me? From Sweden, that is. Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Wed, Jul 9, 2008 at 08:55, jm wrote: > Attempting to access http://www.planeterlang.org/ I recieve > > Error 403 > www.planeterlang.org > mer 09 jui 2008 08:37:31 CEST > Apache/2.0.53 (Linux/SUSE) > > > from the 203.221.x.x range (Australia). I tried to email the address in > the error message but this bounces. If someone on this list maintains, > or can contact the maintainer, of this site: any chance of having this > fixed? > > much appreciated. > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jeffm@REDACTED Wed Jul 9 09:07:30 2008 From: jeffm@REDACTED (jm) Date: Wed, 09 Jul 2008 17:07:30 +1000 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <6344005f0807090000u367f4ddfpf896d95a42a48e36@mail.gmail.com> References: <487460FF.5010805@ghostgun.com> <6344005f0807090000u367f4ddfpf896d95a42a48e36@mail.gmail.com> Message-ID: <487463B2.6000902@ghostgun.com> Adam Lindberg wrote: > Works For Me? > > From Sweden, that is. > Yet another reason to move to Sweden :-). Jeff. From Bruce@REDACTED Wed Jul 9 09:18:45 2008 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Wed, 09 Jul 2008 19:18:45 +1200 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <487460FF.5010805@ghostgun.com> References: <487460FF.5010805@ghostgun.com> Message-ID: <48746655.9020405@Fitzsimons.org> jm wrote: > Attempting to access http://www.planeterlang.org/ I recieve > > Error 403 > www.planeterlang.org > mer 09 jui 2008 08:37:31 CEST > Apache/2.0.53 (Linux/SUSE) > > > from the 203.221.x.x range (Australia). I tried to email the address in > the error message but this bounces. If someone on this list maintains, > or can contact the maintainer, of this site: any chance of having this > fixed? > Hi Jim, I believe, being in Australasia, we're being tarred with a large brush and blocked due to previous bouts of spam originating from parts of Asia. I'm in New Zealand and have the same problem, despite a few requests to unblock my range. (203.97.x.x) It makes planeterlang rather less than useful, and I've thought about starting a competing, less feature-rich, planet'o'erlang for the rest of us. But it would be nicer for everyone if a different, let me say less aggressive, way of solving the problem was found. Regards, Bruce From adam@REDACTED Wed Jul 9 09:37:29 2008 From: adam@REDACTED (Adam Lindberg) Date: Wed, 9 Jul 2008 09:37:29 +0200 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <48746655.9020405@Fitzsimons.org> References: <487460FF.5010805@ghostgun.com> <48746655.9020405@Fitzsimons.org> Message-ID: <6344005f0807090037l52bcd7caif9bedf24ede4f2ad@mail.gmail.com> There's always http://planet.trapexit.org And also, couldn't you just aggregate the feed from planeterlang.org to a RSS reader or a planet of your own (hosted where it has access to planeterlang.org of course)? Cheers! Adam -- Adam Lindberg http://www.erlang-consulting.com On Wed, Jul 9, 2008 at 09:18, Bruce Fitzsimons wrote: > jm wrote: >> Attempting to access http://www.planeterlang.org/ I recieve >> >> Error 403 >> www.planeterlang.org >> mer 09 jui 2008 08:37:31 CEST >> Apache/2.0.53 (Linux/SUSE) >> >> >> from the 203.221.x.x range (Australia). I tried to email the address in >> the error message but this bounces. If someone on this list maintains, >> or can contact the maintainer, of this site: any chance of having this >> fixed? >> > Hi Jim, > > I believe, being in Australasia, we're being tarred with a large brush > and blocked due to previous bouts of spam originating from parts of > Asia. I'm in New Zealand and have the same problem, despite a few > requests to unblock my range. (203.97.x.x) > > It makes planeterlang rather less than useful, and I've thought about > starting a competing, less feature-rich, planet'o'erlang for the rest of > us. But it would be nicer for everyone if a different, let me say less > aggressive, way of solving the problem was found. > > Regards, > Bruce > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From harveyd@REDACTED Wed Jul 9 10:18:03 2008 From: harveyd@REDACTED (Dale Harvey) Date: Wed, 9 Jul 2008 09:18:03 +0100 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <6344005f0807090037l52bcd7caif9bedf24ede4f2ad@mail.gmail.com> References: <487460FF.5010805@ghostgun.com> <48746655.9020405@Fitzsimons.org> <6344005f0807090037l52bcd7caif9bedf24ede4f2ad@mail.gmail.com> Message-ID: I have also been getting 403's from http://www.planeterlang.org/ for a few months now (London) 2008/7/9 Adam Lindberg : > There's always http://planet.trapexit.org > > And also, couldn't you just aggregate the feed from planeterlang.org > to a RSS reader or a planet of your own (hosted where it has access to > planeterlang.org of course)? > > Cheers! > Adam > -- > Adam Lindberg > http://www.erlang-consulting.com > > On Wed, Jul 9, 2008 at 09:18, Bruce Fitzsimons > wrote: > > jm wrote: > >> Attempting to access http://www.planeterlang.org/ I recieve > >> > >> Error 403 > >> www.planeterlang.org > >> mer 09 jui 2008 08:37:31 CEST > >> Apache/2.0.53 (Linux/SUSE) > >> > >> > >> from the 203.221.x.x range (Australia). I tried to email the address in > >> the error message but this bounces. If someone on this list maintains, > >> or can contact the maintainer, of this site: any chance of having this > >> fixed? > >> > > Hi Jim, > > > > I believe, being in Australasia, we're being tarred with a large brush > > and blocked due to previous bouts of spam originating from parts of > > Asia. I'm in New Zealand and have the same problem, despite a few > > requests to unblock my range. (203.97.x.x) > > > > It makes planeterlang rather less than useful, and I've thought about > > starting a competing, less feature-rich, planet'o'erlang for the rest of > > us. But it would be nicer for everyone if a different, let me say less > > aggressive, way of solving the problem was found. > > > > Regards, > > Bruce > > > > _______________________________________________ > > 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 vincent.dephily@REDACTED Wed Jul 9 10:30:56 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Wed, 9 Jul 2008 10:30:56 +0200 Subject: [erlang-questions] http:request() - can only do one async query ? Message-ID: <200807091030.57553.vincent.dephily@mobile-devices.fr> Hi list, I want to do asynchronous http requests using the inets module (that's the best tool for the job, is it ?), but only the first one seems to work : $ erl Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] [async-threads:0] Eshell V5.6.3 (abort with ^G) 1> inets:start(). ok 2> {ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.72>} 3> receive Rcv -> Rcv after 5000 -> timeout end. {http,{#Ref<0.0.0.72>, {{"HTTP/1.1",200,"OK"}, [{"connection","Keep-Alive"}, {"date","Tue, 08 Jul 2008 18:09:21 GMT"}, {"server","Apache"}, {"content-length","1053"}, {"content-type","text/html; charset=UTF-8"}, {"keep-alive","timeout=15, max=100"}], <<">}}} 4> f(Ref),{ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.89>} 5> receive Rcv -> Rcv after 5000 -> timeout end. timeout 6> Works fine with synchronous requests, but I really dont want to use that. What am I missing ? -- Vincent de Phily From gleber.p@REDACTED Wed Jul 9 10:35:41 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 9 Jul 2008 10:35:41 +0200 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: References: <487460FF.5010805@ghostgun.com> <48746655.9020405@Fitzsimons.org> <6344005f0807090037l52bcd7caif9bedf24ede4f2ad@mail.gmail.com> Message-ID: <14f0e3620807090135wdfefa6ajd64a4fe2ddb933b4@mail.gmail.com> Works for me. Poland, Warsaw 2008/7/9 Dale Harvey : > I have also been getting 403's from http://www.planeterlang.org/ > for a few months now (London) > > > 2008/7/9 Adam Lindberg : >> >> There's always http://planet.trapexit.org >> >> And also, couldn't you just aggregate the feed from planeterlang.org >> to a RSS reader or a planet of your own (hosted where it has access to >> planeterlang.org of course)? >> >> Cheers! >> Adam >> -- >> Adam Lindberg >> http://www.erlang-consulting.com >> >> On Wed, Jul 9, 2008 at 09:18, Bruce Fitzsimons >> wrote: >> > jm wrote: >> >> Attempting to access http://www.planeterlang.org/ I recieve >> >> >> >> Error 403 >> >> www.planeterlang.org >> >> mer 09 jui 2008 08:37:31 CEST >> >> Apache/2.0.53 (Linux/SUSE) >> >> >> >> >> >> from the 203.221.x.x range (Australia). I tried to email the address in >> >> the error message but this bounces. If someone on this list maintains, >> >> or can contact the maintainer, of this site: any chance of having this >> >> fixed? >> >> >> > Hi Jim, >> > >> > I believe, being in Australasia, we're being tarred with a large brush >> > and blocked due to previous bouts of spam originating from parts of >> > Asia. I'm in New Zealand and have the same problem, despite a few >> > requests to unblock my range. (203.97.x.x) >> > >> > It makes planeterlang rather less than useful, and I've thought about >> > starting a competing, less feature-rich, planet'o'erlang for the rest of >> > us. But it would be nicer for everyone if a different, let me say less >> > aggressive, way of solving the problem was found. >> > >> > Regards, >> > Bruce >> > >> > _______________________________________________ >> > 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 > -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From rtrlists@REDACTED Wed Jul 9 10:40:20 2008 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 9 Jul 2008 09:40:20 +0100 Subject: [erlang-questions] http:request() - can only do one async query ? In-Reply-To: <200807091030.57553.vincent.dephily@mobile-devices.fr> References: <200807091030.57553.vincent.dephily@mobile-devices.fr> Message-ID: <6a3ae47e0807090140j4524ca49r768f9200e3fccd26@mail.gmail.com> On 7/9/08, Vincent de Phily wrote: > Hi list, > > I want to do asynchronous http requests using the inets module (that's the > best tool for the job, is it ?), but only the first one seems to work : > > $ erl > Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] > [async-threads:0] > > Eshell V5.6.3 (abort with ^G) > 1> inets:start(). > ok > 2> {ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). > {ok,#Ref<0.0.0.72>} > 3> receive Rcv -> Rcv after 5000 -> timeout end. > {http,{#Ref<0.0.0.72>, > {{"HTTP/1.1",200,"OK"}, > [{"connection","Keep-Alive"}, > {"date","Tue, 08 Jul 2008 18:09:21 GMT"}, > {"server","Apache"}, > {"content-length","1053"}, > {"content-type","text/html; charset=UTF-8"}, > {"keep-alive","timeout=15, max=100"}], > <<">}}} > 4> f(Ref),{ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, > false}]). > {ok,#Ref<0.0.0.89>} > 5> receive Rcv -> Rcv after 5000 -> timeout end. > timeout > 6> > You also need to forget Rcv. Robby From vincent.dephily@REDACTED Wed Jul 9 10:52:02 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Wed, 9 Jul 2008 10:52:02 +0200 Subject: [erlang-questions] http:request() - can only do one async query ? In-Reply-To: <6a3ae47e0807090140j4524ca49r768f9200e3fccd26@mail.gmail.com> References: <200807091030.57553.vincent.dephily@mobile-devices.fr> <6a3ae47e0807090140j4524ca49r768f9200e3fccd26@mail.gmail.com> Message-ID: <200807091052.02175.vincent.dephily@mobile-devices.fr> On Wednesday 09 July 2008 10:40:20 Robert Raschke wrote: > You also need to forget Rcv. Gah ! I hoped it was something obvious that'd make me feel stupid ;) Thanks. -- Vincent de Phily From nicola.lugato@REDACTED Wed Jul 9 11:04:28 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Wed, 9 Jul 2008 11:04:28 +0200 Subject: [erlang-questions] SSL: SSL_set_verify callback Message-ID: <59bbf6e10807090204o3af06460q22aaadf29ac9cf02@mail.gmail.com> Hello, i'm considering porting some code of mine to erlang. It's a network server that uses SSL. It makes use of the callback that you can specify on SSL_set_verify (and similar) to check if a peer is allowed to connect, based on data in its certificate. (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) I've checked the documentation of the SSL application in Erlang ( http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find a way to supply such a callback. Is it possible? This is a fundamental feature of my server so it would be a blocking problem. Thanks, Nicola -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincent.dephily@REDACTED Tue Jul 8 20:21:30 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Tue, 8 Jul 2008 20:21:30 +0200 Subject: [erlang-questions] http:request() - can only do one async query ? Message-ID: <200807082021.30684.vincent.dephily@mobile-devices.fr> Hi list, I want to do asynchronous http requests using the inets module (that's the best tool for the job, is it ?), but only the first one seems to work : $ erl Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] [async-threads:0] Eshell V5.6.3 (abort with ^G) 1> inets:start(). ok 2> {ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.72>} 3> receive Rcv -> Rcv after 5000 -> timeout end. {http,{#Ref<0.0.0.72>, {{"HTTP/1.1",200,"OK"}, [{"connection","Keep-Alive"}, {"date","Tue, 08 Jul 2008 18:09:21 GMT"}, {"server","Apache"}, {"content-length","1053"}, {"content-type","text/html; charset=UTF-8"}, {"keep-alive","timeout=15, max=100"}], <<">}}} 4> f(Ref),{ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.89>} 5> receive Rcv -> Rcv after 5000 -> timeout end. timeout 6> Works fine with synchronous requests, but I really dont want to use that. What am I missing ? -- Vincent de Phily From vincent.dephily@REDACTED Tue Jul 8 21:45:50 2008 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Tue, 8 Jul 2008 21:45:50 +0200 Subject: [erlang-questions] http:request() - can only do one async query ? Message-ID: <200807082145.50910.vincent.dephily@mobile-devices.fr> Hi list, I want to do asynchronous http requests using the inets module (that's the best tool for the job, is it ?), but only the first one seems to work : $ erl Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:2] [async-threads:0] Eshell V5.6.3 (abort with ^G) 1> inets:start(). ok 2> {ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.72>} 3> receive Rcv -> Rcv after 5000 -> timeout end. {http,{#Ref<0.0.0.72>, {{"HTTP/1.1",200,"OK"}, [{"connection","Keep-Alive"}, {"date","Tue, 08 Jul 2008 18:09:21 GMT"}, {"server","Apache"}, {"content-length","1053"}, {"content-type","text/html; charset=UTF-8"}, {"keep-alive","timeout=15, max=100"}], <<">}}} 4> f(Ref),{ok, Ref} = http:request(get, {"http://foobar", []}, [], [{sync, false}]). {ok,#Ref<0.0.0.89>} 5> receive Rcv -> Rcv after 5000 -> timeout end. timeout 6> Works fine with synchronous requests, but I really dont want to use that. What am I missing ? -- Vincent de Phily From christophe.romain@REDACTED Wed Jul 9 11:48:42 2008 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 9 Jul 2008 11:48:42 +0200 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <48746655.9020405@Fitzsimons.org> References: <487460FF.5010805@ghostgun.com> <48746655.9020405@Fitzsimons.org> Message-ID: <0ABB5D92-0EC9-4F3A-8FCA-52901FBFC5F0@process-one.net> Hi your range from australia has been unlocked. we are actually investigating less aggressive solutions to prevent spamming. best regards. From jeffm@REDACTED Wed Jul 9 11:55:38 2008 From: jeffm@REDACTED (jm) Date: Wed, 09 Jul 2008 19:55:38 +1000 Subject: [erlang-questions] Error 403 for planeterlang.org In-Reply-To: <0ABB5D92-0EC9-4F3A-8FCA-52901FBFC5F0@process-one.net> References: <487460FF.5010805@ghostgun.com> <48746655.9020405@Fitzsimons.org> <0ABB5D92-0EC9-4F3A-8FCA-52901FBFC5F0@process-one.net> Message-ID: <48748B1A.6070704@ghostgun.com> Thanks, seems to be working now. Much appreciated. Jeff. Christophe Romain wrote: > Hi > > your range from australia has been unlocked. > we are actually investigating less aggressive solutions to prevent > spamming. > > best regards. From cthulahoops@REDACTED Wed Jul 9 12:57:36 2008 From: cthulahoops@REDACTED (Adam Kelly) Date: Wed, 9 Jul 2008 11:57:36 +0100 Subject: [erlang-questions] http:request() - can only do one async query ? In-Reply-To: <200807082021.30684.vincent.dephily@mobile-devices.fr> References: <200807082021.30684.vincent.dephily@mobile-devices.fr> Message-ID: <8d1798e90807090357wee33b7em9557a1917eec91bc@mail.gmail.com> 2008/7/8 Vincent de Phily : > 5> receive Rcv -> Rcv after 5000 -> timeout end. > timeout Rcv is already bound to the result of the first http request, so the receive doesn't match the response from the second request. If you throw in a f(Rcv) it should work fine. The flush() shell built in is very useful for testing this kind of thing. Adam. From torben.lehoff@REDACTED Wed Jul 9 16:19:15 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 9 Jul 2008 16:19:15 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: Nice, but I must be getting old, cynical or blind to the somehow obvious novelty in this. Or maybe it is all of the above... Anyway, I read through the documentation they have on this and it seems like it is a re-invention of ASN.1 when it comes to encoding and decoding of the messages you define the .proto files. One can read more about ASN.1 @ http://asn1.elibel.tm.fr/tools/tutorial/ I have only used 15 minutes to read about it, but I think I can spot an ASN.1 clone when I see one... ;-) Or maybe a person brighter than me (there are bundles of these around) can explain why this approach is so much better than ASN.1?!?! Cheers, Torben p.s. Any intentional or unintentional harshness in this mail is directed towards the creators of protocol buffers. Nothing but good wipes towards Christian. On Tue, Jul 8, 2008 at 10:01 AM, Christian S wrote: > http://code.google.com/apis/protocolbuffers/docs/overview.html > > "Protocol buffers are now Google's lingua franca for data ? at time of > writing, there are 48,162 different message types defined in the > Google code tree across 12,183 .proto files. They're used both in RPC > systems and for persistent storage of data in a variety of storage > systems." > > They're using it over XML, which I find noble (apparently XML has too > much overhead even if you have thousands of machines, who would have > known?), but protocol buffers it is no UBF. :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Jul 9 16:34:17 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 9 Jul 2008 16:34:17 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: > Or maybe a person brighter than me (there are bundles of these around) can > explain why this approach is so much better than ASN.1?!?! I have this theory that ASN.1 is too complex (or at least hard to understand), otherwise it would be used much more. It really is a killer feature to be simple (KISS and all that), but not simplistic. From vances@REDACTED Wed Jul 9 17:34:26 2008 From: vances@REDACTED (Vance Shipley) Date: Wed, 9 Jul 2008 11:34:26 -0400 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: <20080709153426.GI136@h216-235-12-174.host.egate.net> On Wed, Jul 09, 2008 at 04:34:17PM +0200, Christian S wrote: } I have this theory that ASN.1 is too complex (or at least hard to } understand), otherwise it would be used much more. For me ASN.1 represents an era which was the pinacle of protocol design. There is a parallel with the telephone industry which had it's pinacle era in the early nineties with complete digital transmission (TDM) and signaling (ISUP/ISDN). At that point quality in all aspects was at an all time high. Competition brought in less sophisticated approaches (e.g. VoIP) and quality suffered dramtically. } It really is a killer feature to be simple (KISS and all that), but } not simplistic. It's about democratizing technology. In the era of ASN.1 it took an engineer to do anything with one of these protocols. By comparison a text based protocol such as HTTP makes it seem that anyone could understand it. It's more approachable. With the introduction of SIP suddenly the field of telecommunications signaling is no longer the domain of engineers but is accessable to the layman. The unfortunate result however is a dramatic loss of sophistication. Things are adhoc instead of well engineered. ASN.1 gave me a headache when I started learning it however it is so effecient and simple to use that I miss working with it. -Vance [sadly dealing with SIP/SOAP/etc.] From johnswolter@REDACTED Wed Jul 9 17:40:33 2008 From: johnswolter@REDACTED (john s wolter) Date: Wed, 9 Jul 2008 11:40:33 -0400 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> Torben & Christian, The Google protocol is similar to ASN.1, see the Wikipedia ASN.1 links below which include an XML mapping link. I'm wondering as Google's documentation mentions, why the XML version is so much slower in the Internet's already slow context. The .proto approach can't be that much faster considering the time consumption of other processes in the chain of events. It could be a Google specific issue. Note however, this message handling kind of backend application is perfect for Erlang. Here's Wikepedia's page on ASN.1... http://en.wikipedia.org/wiki/ASN.1 Let me throw into the discussion some additional references and mention BEEP, Blocks Extensible Exchange Protocol. BEEP is more a well defined protocol helper. Lastly just to expand this discussion, within web services API's there is this trend towards RESTful interface design to backend programs. Google is using RESTful like interfaces to many of its web services. The RESTful URI mapping is a natural application for Erlang. My take on RESTful now is that it is a wrapper to object API's. Using Bertrand Meyer's words about objects, it is a wapper of runtime object features. A web server, on message arrival, passes a URI [object] to a router that maps the URI message to object's features. The claim is RESTful design is web URI consistent and thus better. I have not decided upon this yet. I remembered BEEP from a few years ago as I was developing an online marketplace that needed secure and targeted protocol to the problem space. BEEP. BEEP covers what a network messaging protocol needs to cover. A kind of Meta requirements definition document gathered in one place. BEEP's definition is here.. http://tools.ietf.org/html/rfc3080 , ...and the TCP mapping here... http://tools.ietf.org/html/rfc3081 Here's the BEEP web site... http://beepcore.org/ An IBM DeveloperWorks article from 2001... http://www-128.ibm.com/developerworks/webservices/library/x-beep/ 2008/7/9 Torben Hoffmann : > Nice, but I must be getting old, cynical or blind to the somehow obvious > novelty in this. > Or maybe it is all of the above... > > Anyway, I read through the documentation they have on this and it seems > like it is a re-invention of ASN.1 when it comes to encoding and decoding of > the messages you define the .proto files. > > One can read more about ASN.1 @ http://asn1.elibel.tm.fr/tools/tutorial/ > > I have only used 15 minutes to read about it, but I think I can spot an > ASN.1 clone when I see one... ;-) > > Or maybe a person brighter than me (there are bundles of these around) can > explain why this approach is so much better than ASN.1?!?! > > Cheers, > Torben > > p.s. Any intentional or unintentional harshness in this mail is directed > towards the creators of protocol buffers. Nothing but good wipes towards > Christian. > > On Tue, Jul 8, 2008 at 10:01 AM, Christian S wrote: > >> http://code.google.com/apis/protocolbuffers/docs/overview.html >> >> "Protocol buffers are now Google's lingua franca for data ? at time of >> writing, there are 48,162 different message types defined in the >> Google code tree across 12,183 .proto files. They're used both in RPC >> systems and for persistent storage of data in a variety of storage >> systems." >> >> They're using it over XML, which I find noble (apparently XML has too >> much overhead even if you have thousands of machines, who would have >> known?), but protocol buffers it is no UBF. :-) >> _______________________________________________ >> 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 dbt@REDACTED Wed Jul 9 18:08:41 2008 From: dbt@REDACTED (David Terrell) Date: Wed, 9 Jul 2008 11:08:41 -0500 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> References: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> Message-ID: <20080709160840.GB29792@sphinx.chicagopeoplez.org> On Wed, Jul 09, 2008 at 11:40:33AM -0400, john s wolter wrote: > Torben & Christian, > > The Google protocol is similar to ASN.1, see the Wikipedia ASN.1 links below > which include an XML mapping link. I'm wondering as Google's documentation > mentions, why the XML version is so much slower in the Internet's already > slow context. The .proto approach can't be that much faster considering the > time consumption of other processes in the chain of events. It could be a > Google specific issue. Note however, this message handling kind of backend > application is perfect for Erlang. Remember, this is an internal communication protocol, not external. There's a lot of emphasis on pre-shared bits (the .proto files) and latency and being able to handle 100mbit+ of traffic efficiently matters (it does not matter to a single machine on the internet, generally speaking). -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From johnswolter@REDACTED Wed Jul 9 18:29:21 2008 From: johnswolter@REDACTED (john s wolter) Date: Wed, 9 Jul 2008 12:29:21 -0400 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <20080709153426.GI136@h216-235-12-174.host.egate.net> References: <20080709153426.GI136@h216-235-12-174.host.egate.net> Message-ID: <24bcf1860807090929w31f8128bob7a55ac24b0f2e7b@mail.gmail.com> Vance, Don't be so harsh about VoIP as its simplicity is generating a whole range of useful applications. There is a war going on out there to hold off VoIP. VoIP is having problems with the old phone companies and cable providers who are blocking where possible or reducing its effectiveness. An former FCC lobbyist is the FCC chair, many rulings have hurt VoIP deployments. The last century telephone companies use their long standing monopoly positions to keep VoIP out. That accounts in some part for well known VoIP sound pauses. I've found the VoIP sound quality way above the POTS network. Search the issue "net neutrality" for some insight. As an example, a VoIP phone system put the U.S. Bond Trading market back in operation within a few days after the 9-11 attacks. The POTS network could not do that in that time frame. When I call a friend in California who has a VoIP service I can hear street traffic in the background. When calling this same person on a POTS line I don't hear that traffic. Based on the flexibility, programmability, and the accessibility of SIP we will see some new ways of thinking about communications in a way the old telephone companies will not do voluntarily. Learn more about the improvement SIP represents at http://www.pulver.com. Its run by Jeff pulver who is to say the least a real promoter of VoIP benefits. On Wed, Jul 9, 2008 at 11:34 AM, Vance Shipley wrote: > On Wed, Jul 09, 2008 at 04:34:17PM +0200, Christian S wrote: > } I have this theory that ASN.1 is too complex (or at least hard to > } understand), otherwise it would be used much more. > > For me ASN.1 represents an era which was the pinacle of > protocol design. There is a parallel with the telephone > industry which had it's pinacle era in the early nineties > with complete digital transmission (TDM) and signaling > (ISUP/ISDN). At that point quality in all aspects was at > an all time high. Competition brought in less sophisticated > approaches (e.g. VoIP) and quality suffered dramtically. > > } It really is a killer feature to be simple (KISS and all that), but > } not simplistic. > > It's about democratizing technology. In the era of ASN.1 > it took an engineer to do anything with one of these protocols. > By comparison a text based protocol such as HTTP makes it > seem that anyone could understand it. It's more approachable. > With the introduction of SIP suddenly the field of telecommunications > signaling is no longer the domain of engineers but is accessable > to the layman. The unfortunate result however is a dramatic loss > of sophistication. Things are adhoc instead of well engineered. > > ASN.1 gave me a headache when I started learning it however it > is so effecient and simple to use that I miss working with it. > > -Vance [sadly dealing with SIP/SOAP/etc.] > _______________________________________________ > 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 kevin@REDACTED Wed Jul 9 18:36:57 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 9 Jul 2008 09:36:57 -0700 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: <7366F6B9-A0B8-4ED0-B1AC-AFC3499594B7@scaldeferri.com> On Jul 9, 2008, at 7:19 AM, Torben Hoffmann wrote: > Or maybe a person brighter than me (there are bundles of these > around) can explain why this approach is so much better than ASN.1?!?! ASN.1 is old and does not contain the word "Google". ;-) -k From dnew@REDACTED Wed Jul 9 18:48:06 2008 From: dnew@REDACTED (Darren New) Date: Wed, 09 Jul 2008 09:48:06 -0700 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> References: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> Message-ID: <4874EBC6.6060400@san.rr.com> john s wolter wrote: > The Google protocol is similar to ASN.1, I see many protocols developed that are reinventions of "committee" protocols that are "simpler" because they throw away a bunch of things that only some people in the committee wanted. Of course, in this case, there's no real problem with Google inventing something that exactly addresses their needs. I just dread the day when a dozen people implement it and we start seeing Proto-wrapped-in-XML-over-SOAP or some such nonsense. As long as you're only using it between your own components, there's no real need to stick with a standard. > Let me throw into the discussion some additional references and mention > BEEP, Blocks Extensible Exchange Protocol. BEEP is more a well defined > protocol helper. Where ASN.1, Google's proto, and XML are all presentation-layer specifications, BEEP is a session-layer specification. > Lastly just to expand this discussion, within web services API's there > is this trend towards RESTful interface design to backend programs. Sadly, there's far more RESTful interface design than actual REST interface design. You lose much of the ability to use existing libraries and such when your design is only RESTful instead of actually being REST. Name three companies publishing "RESTful" services that all use the same authentication mechanism, for example. :-) > BEEP covers what a network messaging protocol needs to cover. Dr. Rose described it as "getting all that stuff out of the way so your IETF meeting doesn't spend 90% of the time on the stuff that's the same in every protocol and 10% of the time on the stuff specific to your meeting." -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. From johnswolter@REDACTED Wed Jul 9 20:04:33 2008 From: johnswolter@REDACTED (john s wolter) Date: Wed, 9 Jul 2008 14:04:33 -0400 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <4874EBC6.6060400@san.rr.com> References: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> <4874EBC6.6060400@san.rr.com> Message-ID: <24bcf1860807091104i5af5d391kf4433f8a0ca68a2e@mail.gmail.com> Darren, I see many protocols developed that are reinventions of "committee" > protocols that are "simpler" because they throw away a bunch of things > that only some people in the committee wanted. > Still, somehow the Internet muddles ahead. Where ASN.1, Google's proto, and XML are all presentation-layer > specifications, BEEP is a session-layer specification. I was thinking in a broad sense of getting my application working. As you mention the others are presentation-layers. Sadly, there's far more RESTful interface design than actual REST > interface design. You lose much of the ability to use existing libraries > and such when your design is only RESTful instead of actually being REST. > > Name three companies publishing "RESTful" services that all use the same > authentication mechanism, for example. :-) I've read the statements but have yet to try a REST[ful] application. I can see some page mashups usage but have yet to see an web services application that gets me interested. The URI router also has overhead. I see you are trying to contrast RESTful and REST. Is there more you might say to highlight the difference between the two terms from your point of viewing this. > BEEP covers what a network messaging protocol needs to cover. > > Dr. Rose described it as "getting all that stuff out of the way so your > IETF meeting doesn't spend 90% of the time on the stuff that's the same > in every protocol and 10% of the time on the stuff specific to your > meeting." Good point about committees. -- 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 nicola.lugato@REDACTED Wed Jul 9 21:16:45 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Wed, 9 Jul 2008 21:16:45 +0200 Subject: [erlang-questions] SSL: SSL_set_verify callback In-Reply-To: <4875062F.3050607@free.fr> References: <59bbf6e10807090204o3af06460q22aaadf29ac9cf02@mail.gmail.com> <4875062F.3050607@free.fr> Message-ID: <59bbf6e10807091216u45f11428o2dacb511205c08a6@mail.gmail.com> Hi igwan, that's exacly what i have to do, testing the hash of the certificate against a database, but i need to block them at the accept phase, not after connection. Thanks. On Wed, Jul 9, 2008 at 8:40 PM, igwan wrote: > Hi, > > I don't know if it fits your goals exactly but you could use > ssl:peercert(Socket) when connection is established and drop it if > appropriate. I used this to match (a MD5 of) the client's certificate > against a list of permitted users in database. > > igwan > > Nicola Lugato wrote : > > Hello, >> i'm considering porting some code of mine to erlang. It's a network >> server that uses SSL. >> It makes use of the callback that you can specify on SSL_set_verify (and >> similar) to check if a peer is allowed to connect, based on data in its >> certificate. >> >> (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) >> >> I've checked the documentation of the SSL application in Erlang ( >> http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find a way >> to supply such a callback. Is it possible? >> This is a fundamental feature of my server so it would be a blocking >> problem. >> >> Thanks, Nicola >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dnew@REDACTED Wed Jul 9 21:30:03 2008 From: dnew@REDACTED (Darren New) Date: Wed, 09 Jul 2008 12:30:03 -0700 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <24bcf1860807091104i5af5d391kf4433f8a0ca68a2e@mail.gmail.com> References: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> <4874EBC6.6060400@san.rr.com> <24bcf1860807091104i5af5d391kf4433f8a0ca68a2e@mail.gmail.com> Message-ID: <487511BB.90903@san.rr.com> john s wolter wrote: > Darren, > > I see many protocols developed that are reinventions of "committee" > protocols that are "simpler" because they throw away a bunch of things > that only some people in the committee wanted. > > > Still, somehow the Internet muddles ahead. Indeed. (For that matter, this happens repeatedly in the internet, too. HTTP throws away a bunch of stuff FTP does, only to reinvent it later. OpenVPN throws away a bunch of stuff IPSec does, and will probably need to reinvent it, etc.) I wasn't really making a value judgement. > Where ASN.1, Google's proto, and XML are all presentation-layer > specifications, BEEP is a session-layer specification. > > I was thinking in a broad sense of getting my application working. As > you mention the others are presentation-layers. Yes. I was simply clarifying / expanding upon your statements for the benefit of anyone who might be interested (or not) based on a quick summary as to what it actually *is*. :-) > I've read the statements but have yet to try a REST[ful] application. > I can see some page mashups usage but have yet to see an web services > application that gets me interested. The URI router also has overhead. I've done a lot of work with the Amazon restful applications. CouchDB is the first application that actually looks like it's trying to be REST instead of just trying to be "not SOAP". :-) > I see you are trying to contrast RESTful and REST. Is there more you > might say to highlight the difference between the two terms from your > point of viewing this. If your application doesn't work with caching, or your URIs don't point to data objects, or if those data objects don't have URIs/URLs referring to other data objects, or you store state at the server, or you have information in the body of the message saying the format you need instead of in the Accept-* headers, or your authentication isn't baed on the HTTP authentications, you're restful instead of REST. For example, Amazon's S3 interface requires that every access have certain headers hashed in a certain order, with an extra header added to the request to present that hash. You can't just use HTTP's normal authentication mechanisms. There's no http://darren:mypassword@REDACTED/mybucket/mydata URL to access my data. Instead, *if* you want to do this, you have to do calculations outside your HTTP library and tack stuff on the end of the URL with query arguments to authenticate, and then that (as far as I remember) only works with GET. Once you get the result back from a bucket listing, there's nothing in the XML therein to tell you what is data you can fetch. Nothing looks like a URL. If I handed you the body of a search result without the documentation of what fields mean what, you wouldn't be able to find anything based on that. When you set the permissions on an object, "all users" and "all users with an amazon account" are represented as URIs, but individual users are not. If you want to say "the user whose email address is me@REDACTED can read this", you don't include any mailto:. If you want to say "the user who Amazon knows as 1384719384", there's no scheme or anything else there either. Those are examples of the differences. Compare with the stuff CouchDB supports, and you'll see the differences. -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. From igwan@REDACTED Wed Jul 9 20:40:47 2008 From: igwan@REDACTED (igwan) Date: Wed, 09 Jul 2008 20:40:47 +0200 Subject: [erlang-questions] SSL: SSL_set_verify callback In-Reply-To: <59bbf6e10807090204o3af06460q22aaadf29ac9cf02@mail.gmail.com> References: <59bbf6e10807090204o3af06460q22aaadf29ac9cf02@mail.gmail.com> Message-ID: <4875062F.3050607@free.fr> Hi, I don't know if it fits your goals exactly but you could use ssl:peercert(Socket) when connection is established and drop it if appropriate. I used this to match (a MD5 of) the client's certificate against a list of permitted users in database. igwan Nicola Lugato wrote : > Hello, > i'm considering porting some code of mine to erlang. It's a network > server that uses SSL. > It makes use of the callback that you can specify on SSL_set_verify > (and similar) to check if a peer is allowed to connect, based on data > in its certificate. > > (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) > > I've checked the documentation of the SSL application in Erlang > (http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find a > way to supply such a callback. Is it possible? > This is a fundamental feature of my server so it would be a blocking > problem. > > Thanks, Nicola From 0x6e6562@REDACTED Wed Jul 9 21:55:41 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Wed, 9 Jul 2008 14:55:41 -0500 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: Message-ID: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> 2008/7/9 Torben Hoffmann : > Anyway, I read through the documentation they have on this and it seems like > it is a re-invention of ASN.1 when it comes to encoding and decoding of the > messages you define the .proto files. I agree with this view, but would like to point out that whilst Erlang has the luxury of having a good quality standards compliant open source implementation of ASN.1, this is not necessarily the case for lots of other languages, which is precisely the point of using a message protocol. So if you want to use encode/decode ASN.1 in a different language, you might have to pay for the toolkit or there might not be a toolkit at all. One advantage that PB may have is the google hype, meaning that it might gather enough momentum for people to be implementing PB in lots of different languages which of course increases the usefulness of the protocol. I am considering writing a implementation for Erlang, but don't want to duplicate any efforts from anybody else....so is anybody writing one or thinking about writing one? Ben From dbt@REDACTED Wed Jul 9 22:19:10 2008 From: dbt@REDACTED (David Terrell) Date: Wed, 9 Jul 2008 15:19:10 -0500 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> Message-ID: <20080709201910.GC29792@sphinx.chicagopeoplez.org> On Wed, Jul 09, 2008 at 02:55:41PM -0500, Ben Hood wrote: > I am considering writing a implementation for Erlang, but don't want > to duplicate any efforts from anybody else....so is anybody writing > one or thinking about writing one? Yes. -- David Terrell dbt@REDACTED ((meatspace)) http://meat.net/ From erlangy@REDACTED Wed Jul 9 22:41:21 2008 From: erlangy@REDACTED (ERLANG) Date: Wed, 9 Jul 2008 22:41:21 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <20080709201910.GC29792@sphinx.chicagopeoplez.org> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> Message-ID: Hi guys, Well, it's cool to see all this interest to Google Protocol Buffers. But why not spend some time on more interesting idea : a C full (UBF A/ B/C), open implementation of UBF? Universal Binary Format (UBF) is really worth a try: http://www.sics.se/~joe/ubf/site/home.html Y. Le 9 juil. 08 ? 22:19, David Terrell a ?crit : > On Wed, Jul 09, 2008 at 02:55:41PM -0500, Ben Hood wrote: >> I am considering writing a implementation for Erlang, but don't want >> to duplicate any efforts from anybody else....so is anybody writing >> one or thinking about writing one? > > Yes. > > -- > David Terrell > dbt@REDACTED > ((meatspace)) http://meat.net/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From 0x6e6562@REDACTED Wed Jul 9 22:45:54 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Wed, 9 Jul 2008 15:45:54 -0500 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <20080709201910.GC29792@sphinx.chicagopeoplez.org> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> Message-ID: <269388e30807091345q7538cfe6j880f489ccf6d6ed8@mail.gmail.com> David, On Wed, Jul 9, 2008 at 3:19 PM, David Terrell wrote: > Yes. Do you have any more detailed plans? Have you already started coding? Ben From 0x6e6562@REDACTED Wed Jul 9 22:52:05 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Wed, 9 Jul 2008 15:52:05 -0500 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> Message-ID: <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> On Wed, Jul 9, 2008 at 3:41 PM, ERLANG wrote: > But why not spend some time on more interesting idea : a C full (UBF A/B/C), > open implementation of UBF? > Universal Binary Format (UBF) is really worth a try: I looked at UBF a long time ago and I thought it was a very interesting idea. What I was wondering is why there seems to have been so little apparent interest in this (i.e. why hasn't it transitioned from the POC). As I said earlier in the thread, I don't think that Google's idea is particularly new. The advantage I see in terms of integrating Erlang with other languages is that there seems to be a budding community of people writing implementations in other languages. I think this would be a good thing to piggyback off. Ben From mog-lists@REDACTED Wed Jul 9 23:53:50 2008 From: mog-lists@REDACTED (mog) Date: Wed, 09 Jul 2008 16:53:50 -0500 Subject: [erlang-questions] mnesia memory leak? Message-ID: <4875336E.8080705@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi I am working with mnesia in my app and after several hours of running it seems that my memory usage has gone over 1 gig. At first I thought this was a bug in my code that interfaces with mnesia, but upon looking at my tables they are all reasonably small, however, ets:i() reveals 745 mnesia_transient_decision set 5940587 95901642 mnesia_recover upon googling around i found that this seems to be a known issue? What is the proper way to deal with this? I also found the following http://yanovsky.agenstvo.com/?p=31 <- he appears to have the same issue i do, and provides easy test code to expose the issue. Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIdTNteq+tARrxhnsRAn30AJ95N8A9U2eDsvxy21ZKQlk7xApPIgCbByG1 FyEkFizCg3QSk0O1wdX4maI= =7Ju2 -----END PGP SIGNATURE----- From mog-lists@REDACTED Thu Jul 10 00:21:02 2008 From: mog-lists@REDACTED (mog) Date: Wed, 09 Jul 2008 17:21:02 -0500 Subject: [erlang-questions] mnesia memory leak? In-Reply-To: <4875336E.8080705@rldn.net> References: <4875336E.8080705@rldn.net> Message-ID: <487539CE.9040900@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 mog wrote: | Hi | I am working with mnesia in my app and after several hours of running it seems that my memory usage has gone over 1 gig. At first I thought this was a bug in my code that interfaces with mnesia, but upon looking at my tables they are all reasonably small, however, ets:i() reveals | 745 mnesia_transient_decision set 5940587 95901642 mnesia_recover | | upon googling around i found that this seems to be a known issue? What is the proper way to deal with this? I also found the following http://yanovsky.agenstvo.com/?p=31 <- he appears to have the same issue i do, and provides easy test code to expose the issue. | | Mog sorry to reply to my own message but i thought seeing as how this want documented anywhere i could see and to double check this is an appropriate way to fix my problem. mnesia_recovery:allow_garb(), mnesia_recovery:start_garb(). that seems to clean up my memory problem. I guess I shouldn't have said memory leak exactly, just seems mnesia doesn't want to free memory while under load, and given that my app has constant load that isn't really an option for me. Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIdTnNeq+tARrxhnsRAhm2AJ9jphA1ofOyYSqqcdep3cLUeru/NwCgoZU0 mx4dCDn1GhWBaprzyit+dPg= =KMU3 -----END PGP SIGNATURE----- From chsu79@REDACTED Thu Jul 10 01:42:33 2008 From: chsu79@REDACTED (Christian S) Date: Thu, 10 Jul 2008 01:42:33 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> Message-ID: > I looked at UBF a long time ago and I thought it was a very > interesting idea. What I was wondering is why there seems to have been > so little apparent interest in this (i.e. why hasn't it transitioned > from the POC). As long as we are a bit cynical in this thread, I'll share some of my cynism. I think UBF has got no attention because the skill (in the bottom 95% of programmers) at using parser generators and parsing is low, people go as far as splitting text on a delimiter character (or regexp pattern), they maybe do this further on the results, but that's it. If more is needed, they bring in XML, because DOM parsers doesnt intimidated the ego the same way a tool you dont know will do. UBF, the transport format, can only really be appreciated if you know and directly see that it is easy to implement (comparingly). If you can see that it is very feature competent, that it has very un-muddled data types, the plain list, the tuple, integers, strings, symbols, 8bit binary blobs (without silly base64 tricks). There is no XML schema on top to bring you elementary data types that all machine-to-machine transport _will_ need. UBF, the protocol contract language, can only really be appreciated if you get to the next level of understanding publicly exposed protocols, implementing them, maintaining them, documenting them, designing them. So much about programming against an interface is "can i say this right now?", or, "what do i need to say before what i really want?". You dont see many interfaces targeting this kind of specification, all you get is that they're going to throw IllegalStateException if the programmer bothered to check premises explicitly, otherwise you will likely get a NullPointerException and no guarantees about how valid the internal state of the object is now. Sorry for my rant. ... ranting is too much fun. From ok@REDACTED Thu Jul 10 03:15:09 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 10 Jul 2008 13:15:09 +1200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> References: <24bcf1860807090840m61dfe142j21e74b404669bfac@mail.gmail.com> Message-ID: I spent last night reading the Google Protocol Buffer documentation, including the wire format. I really like the use of variable byte encoding for integers. One thing that puzzled me was this: if I have a stream of bytes coming into a program, and that stream of bytes encodes a stream of Messages, how do I determine how long the next Message is? If a Message appears inside another Message, it is encoded as a byte string (length|string) . But the examples they give of stand-alone messages just encode the fields one after another. Do you just have to _know_? The Java interface struck me as far more complex than necessary, but then, most things in Java strike me as far more complex than necessary. From johnswolter@REDACTED Thu Jul 10 04:58:54 2008 From: johnswolter@REDACTED (john s wolter) Date: Wed, 9 Jul 2008 22:58:54 -0400 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> Message-ID: <24bcf1860807091958r5877064w2f03734345d2c416@mail.gmail.com> Just to continue on Christian's comment, I see his point as a knowledge distribution and use issue. Doctors don't know everything about Medical Science for example. The trend to to find ways to distribute all the useful knowledge for your by the unintended and uninformed. As more of computer science is may easily accessible and automated more people will venture farther into that realm. Saying it another way, people in the 21st century will put knowledge to use as needed. The world has generated piles of knowledge that the masses, if you will, are going to pick from to get work done. If that means learning about parsers they will. If that means using a menu driven programming utility, that's how it will be accomplished. I use these words, the knowledge distribution system needs to be improved. Books and traditional learning such as classes are an obstacle to quick learning for the job your working now. Google search gets what is needed now. An example of this that is a distance off the subject of this list is Joomla. It is a content management system that uses templates and menu driven choices to create a web site. You can setup an effective web commerce site with a distinctive look in a short time with a list of features. Those in the know will create the tools for the gold miners. The gold miners will do the actual dirt digging. Think of this system as a way to keep your job. On Wed, Jul 9, 2008 at 7:42 PM, Christian S wrote: > > I looked at UBF a long time ago and I thought it was a very > > interesting idea. What I was wondering is why there seems to have been > > so little apparent interest in this (i.e. why hasn't it transitioned > > from the POC). > > As long as we are a bit cynical in this thread, I'll share some of my > cynism. > > I think UBF has got no attention because the skill (in the bottom 95% > of programmers) at using parser generators and parsing is low, people > go as far as splitting text on a delimiter character (or regexp > pattern), they maybe do this further on the results, but that's it. If > more is needed, they bring in XML, because DOM parsers doesnt > intimidated the ego the same way a tool you dont know will do. > > UBF, the transport format, can only really be appreciated if you know > and directly see that it is easy to implement (comparingly). If you > can see that it is very feature competent, that it has very un-muddled > data types, the plain list, the tuple, integers, strings, symbols, > 8bit binary blobs (without silly base64 tricks). There is no XML > schema on top to bring you elementary data types that all > machine-to-machine transport _will_ need. > > UBF, the protocol contract language, can only really be appreciated if > you get to the next level of understanding publicly exposed protocols, > implementing them, maintaining them, documenting them, designing them. > So much about programming against an interface is "can i say this > right now?", or, "what do i need to say before what i really want?". > You dont see many interfaces targeting this kind of specification, all > you get is that they're going to throw IllegalStateException if the > programmer bothered to check premises explicitly, otherwise you will > likely get a NullPointerException and no guarantees about how valid > the internal state of the object is now. > > > Sorry for my rant. ... ranting is too much fun. > _______________________________________________ > 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 Jul 10 06:27:58 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 10 Jul 2008 16:27:58 +1200 Subject: [erlang-questions] What happens after you submit an EEP? Message-ID: <10C0CC2F-4B37-4314-991B-06EAA1623821@cs.otago.ac.nz> I submitted a new EEP yesterday, and another one just now. What is the process from here on? From fuad@REDACTED Thu Jul 10 07:29:02 2008 From: fuad@REDACTED (Fuad Tabba) Date: Thu, 10 Jul 2008 17:29:02 +1200 Subject: [erlang-questions] A Scalable Binary Search Tree Based Structure Message-ID: <909c265f0807092229u387a7b90s8b09d98ae0fe6103@mail.gmail.com> Not sure if anyone will find this interesting, but I'm posting it here anyway :) I believe I finally managed to create the structure I wanted to. The main problem that I was having is that I was still thinking in C (or sequential languages), so what I wanted to do was build a single binary search tree (bst) that scales well. What I realized though, is that rather than doing that, I should create N bsts where N is proportional to the number of processors available in the system. So what I'm doing now is spawn a number of threads (servers), each thread is responsible for a bst that covers a range of keys, and whenever an operation is performed, the client sends it to the particular server that's responsible for the tree in that range. If this doesn't make sense, then maybe my code will make it clearer:- http://www.cs.auckland.ac.nz/~fuad/dbst.erl(code needs better error handling, general tidying up) The main problem with this implementation though is that if the distribution of the keys isn't uniform within the expected range, it won't perform well. But I guess that is a problem with non-balanced bsts in general. That said, this solution turned out to be simpler than other solutions I've attempted, performs better in the single-threaded case, and scales pretty well. Here's a link to a graph that shows how well this scales on an 8 core machine:- http://www.cs.auckland.ac.nz/~fuad/bst-scale2.png Compare with my previous attempt:- http://www.cs.auckland.ac.nz/~fuad/bst-scale.png Can't really ask for better than that. What I need to do now is figure out a way to balance the load somehow when it's not uniform. Thanks to all of you who've given me feedback. This is definitely an interesting learning experience, a different way of thinking. Cheers, /Fuad -------------- next part -------------- An HTML attachment was scrubbed... URL: From hydo@REDACTED Wed Jul 9 22:40:13 2008 From: hydo@REDACTED (Clint Moore) Date: Wed, 09 Jul 2008 13:40:13 -0700 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <20080709201910.GC29792@sphinx.chicagopeoplez.org> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> Message-ID: On Jul 9, 2008, at 1:19 PM, David Terrell wrote: > On Wed, Jul 09, 2008 at 02:55:41PM -0500, Ben Hood wrote: >> I am considering writing a implementation for Erlang, but don't want >> to duplicate any efforts from anybody else....so is anybody writing >> one or thinking about writing one? > > Yes. Well that answered that. From dgud@REDACTED Thu Jul 10 08:47:19 2008 From: dgud@REDACTED (Dan Gudmundsson) Date: Thu, 10 Jul 2008 08:47:19 +0200 Subject: [erlang-questions] mnesia memory leak? In-Reply-To: <487539CE.9040900@rldn.net> References: <4875336E.8080705@rldn.net> <487539CE.9040900@rldn.net> Message-ID: <4875B077.5070800@erix.ericsson.se> Hmm the problem in R12 is that it doesn't garbage collect if there is no log to be dumped when the node uses disk, i.e. no transactions to disk tables are being done. Here is the patch that will make it to the next release. /Dan Patch: mnesia_dumper.erl 116,122c116,117 < case mnesia_monitor:use_dir() of < true -> < dumped; < _ -> < mnesia_recover:allow_garb(), < dumped < end; --- > mnesia_recover:allow_garb(), > dumped; mnesia_recover.erl 106,111c106,119 < Old = val(previous_transient_decisions), < Next = create_transient_decision(), < {Prev, ReallyOld} = sublist([Curr | Old], 10, []), < [?ets_delete_table(Tab) || Tab <- ReallyOld], < set(previous_transient_decisions, Prev), < set(latest_transient_decision, Next). --- > %% Don't garb small tables, they are created on every > %% dump_log and may be small (empty) for schema transactions > %% which are dumped twice > case ets:info(Curr, size) > 20 of > true -> > Old = val(previous_transient_decisions), > Next = create_transient_decision(), > {Prev, ReallyOld} = sublist([Curr | Old], 10, []), > [?ets_delete_table(Tab) || Tab <- ReallyOld], > set(previous_transient_decisions, Prev), > set(latest_transient_decision, Next); > false -> > ignore > end. mog wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > mog wrote: > | Hi > | I am working with mnesia in my app and after several hours of running > it seems that my memory usage has gone over 1 gig. At first I thought > this was a bug in my code that interfaces with mnesia, but upon looking > at my tables they are all reasonably small, however, ets:i() reveals > | 745 mnesia_transient_decision set 5940587 95901642 > mnesia_recover > | > | upon googling around i found that this seems to be a known issue? > What is the proper way to deal with this? I also found the following > http://yanovsky.agenstvo.com/?p=31 <- he appears to have the same issue > i do, and provides easy test code to expose the issue. > | > | Mog > sorry to reply to my own message but i thought seeing as how this want > documented anywhere i could see and to double check this is an > appropriate way to fix my problem. > > mnesia_recovery:allow_garb(), > mnesia_recovery:start_garb(). > > that seems to clean up my memory problem. I guess I shouldn't have said > memory leak exactly, just seems mnesia doesn't want to free memory while > under load, and given that my app has constant load that isn't really an > option for me. > > Mog > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFIdTnNeq+tARrxhnsRAhm2AJ9jphA1ofOyYSqqcdep3cLUeru/NwCgoZU0 > mx4dCDn1GhWBaprzyit+dPg= > =KMU3 > -----END PGP SIGNATURE----- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Thu Jul 10 09:28:40 2008 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 10 Jul 2008 09:28:40 +0200 Subject: [erlang-questions] What happens after you submit an EEP? In-Reply-To: <10C0CC2F-4B37-4314-991B-06EAA1623821@cs.otago.ac.nz> References: <10C0CC2F-4B37-4314-991B-06EAA1623821@cs.otago.ac.nz> Message-ID: <20080710072840.GA23520@erix.ericsson.se> On Thu, Jul 10, 2008 at 04:27:58PM +1200, Richard A. O'Keefe wrote: > I submitted a new EEP yesterday, and another one just now. > What is the process from here on? I am sorry we have not seen any of them. As I read http://www.erlang.org/eep.html and http://www.erlang.org/eeps/eep-0001.html I notice it is not crystal clear that the mail address eeps@REDACTED is one of the erlang.org mailing lists http://www.erlang.org/faq.html, and as all the other lists, also stated at http://www.erlang.org/mailman/listinfo/eeps it is a closed list so you have to be a member to post. The process from here on is otherwise as described in: http://www.erlang.org/eeps/eep-0001.html, EEP Work flow: : : The EEP champion then emails the EEP editor with a proposed title and a rough, but fleshed out, draft of the EEP. This draft must be written in EEP style as described below. If the EEP editor approves, he will assign the EEP a number, label it as Standards Track or Process, give it status "Draft", and create and check-in the initial draft of the EEP. The EEP editor will not unreasonably deny a EEP. Reasons for denying EEP status include duplication of effort, being technically unsound, not providing proper motivation or addressing backwards compatibility, or not in keeping with the Erlang philosophy. If a pre-EEP is rejected, the author may elect to take the pre-EEP to the erlang-questions@REDACTED mailing list to help flesh it out, gain feedback and consensus from the community at large, and improve the EEP for re-submission. The author of the EEP is then responsible for posting the EEP to the community forums, and marshaling community support for it. As updates are necessary, the EEP author can check in new versions if they have SVN commit permissions, or can email new EEP versions to the EEP editor for committing. : : > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From buricchio@REDACTED Thu Jul 10 10:32:16 2008 From: buricchio@REDACTED (andrey-google) Date: Thu, 10 Jul 2008 11:32:16 +0300 Subject: [erlang-questions] mnesia memory leak? In-Reply-To: <4875B077.5070800@erix.ericsson.se> References: <4875336E.8080705@rldn.net> <487539CE.9040900@rldn.net> <4875B077.5070800@erix.ericsson.se> Message-ID: <1718968700.20080710113216@gmail.com> That's very good news. Thanks a lot to Mog and Dan. dvader From alexander.lamb@REDACTED Thu Jul 10 10:41:29 2008 From: alexander.lamb@REDACTED (Alexander Lamb) Date: Thu, 10 Jul 2008 10:41:29 +0200 Subject: [erlang-questions] Basic Erlang case question Message-ID: Hello List, Here is a very simple code to search if a supplied password is correct or not: F1 = fun() -> mnesia:match_object(systems, #system_info{full_attribute = {System_Name,admin_password}, _ = '_'}, read) end, case Password of [] -> MD5_Password = []; _Any -> MD5_Password = erlang:md5(Password) end, case mnesia:transaction(F1) of {atomic, []} -> {error, unknown_system}; {atomic, [#system_info{data = MD5_Password}]} -> {ok, password}; {atomic, _} -> {error, bad_password}; {aborted, Reason} -> {error, Reason} end Basically, if supplied Password is empty, the MD5_Password must be empty. If not, I encrypt the Password to compare it with stored version. My problem is that it compiles with a warning: ./cs_systems.erl:173: Warning: variable 'MD5_Password' exported from 'case' (line 167) Why? Obviously I am trying to match the password in the record I found with the password I supply. Thanks, Alex From vychodil.hynek@REDACTED Thu Jul 10 10:55:31 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 10 Jul 2008 10:55:31 +0200 Subject: [erlang-questions] Basic Erlang case question In-Reply-To: References: Message-ID: <4d08db370807100155h4d30228eqf2343a38d2277adb@mail.gmail.com> It is only warning. You must be sure that all your branches bound variable or in very rare case you know what you are doing. On Thu, Jul 10, 2008 at 10:41 AM, Alexander Lamb wrote: > Hello List, > > Here is a very simple code to search if a supplied password is correct > or not: > > F1 = fun() -> mnesia:match_object(systems, > #system_info{full_attribute = {System_Name,admin_password}, _ = '_'}, > read) end, > case Password of > [] -> MD5_Password = []; > _Any -> MD5_Password = > erlang:md5(Password) > end, % It will remove warning message. MD5_Password = case Password of [] -> []; _ -> erlang:md5(Password) end, > > case mnesia:transaction(F1) of > {atomic, []} > -> {error, unknown_system}; > {atomic, [#system_info{data = > MD5_Password}]} -> {ok, password}; > {atomic, _} > -> {error, bad_password}; > {aborted, Reason} > -> {error, Reason} > end > > > > Basically, if supplied Password is empty, the MD5_Password must be > empty. If not, I encrypt the Password to compare it with stored version. > > My problem is that it compiles with a warning: > > ./cs_systems.erl:173: Warning: variable 'MD5_Password' exported from > 'case' (line 167) > > Why? Obviously I am trying to match the password in the record I found > with the password I supply. > > Thanks, > > Alex > > _______________________________________________ > 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 vlm@REDACTED Thu Jul 10 11:11:57 2008 From: vlm@REDACTED (Lev Walkin) Date: Thu, 10 Jul 2008 02:11:57 -0700 Subject: [erlang-questions] Basic Erlang case question In-Reply-To: References: Message-ID: <4875D25D.1070409@lionet.info> Alexander Lamb wrote: > Hello List, > > Here is a very simple code to search if a supplied password is correct > or not: > > F1 = fun() -> mnesia:match_object(systems, > #system_info{full_attribute = {System_Name,admin_password}, _ = '_'}, > read) end, > case Password of > [] -> MD5_Password = []; > _Any -> MD5_Password = erlang:md5(Password) > end, > case mnesia:transaction(F1) of > {atomic, []} -> {error, unknown_system}; > {atomic, [#system_info{data = MD5_Password}]} -> {ok, password}; > {atomic, _} -> {error, bad_password}; > {aborted, Reason} -> {error, Reason} > end > > > > Basically, if supplied Password is empty, the MD5_Password must be > empty. If not, I encrypt the Password to compare it with stored version. > > My problem is that it compiles with a warning: > > ./cs_systems.erl:173: Warning: variable 'MD5_Password' exported from > 'case' (line 167) > > Why? Obviously I am trying to match the password in the record I found > with the password I supply. This Erlang "feature" of leaking identifiers out of "case" is something to be avoided, like goto's in imperative languages. Instead of doing case Foo of Bar -> Password = f1(Bar); Baz -> Password = f2(Baz) end do this: Password = case Foo of Bar -> f1(Bar); Baz -> f2(Baz) end In your case, HashedPassword = case Password of [] -> [] Value -> erlang:md5(Value) end -- vlm From erlangy@REDACTED Thu Jul 10 12:37:15 2008 From: erlangy@REDACTED (yerl yerl) Date: Thu, 10 Jul 2008 12:37:15 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> Message-ID: <71a91c2f0807100337t5f534842n7141f0ea59dbd6ce@mail.gmail.com> I agree perfectly with yours arguments. Another (killer) advantage to have a C UBF implementation is that any high level language (Perl, Python, Ruby, OCaml ...) could easily reuse it with glue engine like SWIG. So back to my wish : anyone to start the work on full C implementation of UBF with me? Y. On Thu, Jul 10, 2008 at 1:42 AM, Christian S wrote: > > I looked at UBF a long time ago and I thought it was a very > > interesting idea. What I was wondering is why there seems to have been > > so little apparent interest in this (i.e. why hasn't it transitioned > > from the POC). > > As long as we are a bit cynical in this thread, I'll share some of my > cynism. > > I think UBF has got no attention because the skill (in the bottom 95% > of programmers) at using parser generators and parsing is low, people > go as far as splitting text on a delimiter character (or regexp > pattern), they maybe do this further on the results, but that's it. If > more is needed, they bring in XML, because DOM parsers doesnt > intimidated the ego the same way a tool you dont know will do. > > UBF, the transport format, can only really be appreciated if you know > and directly see that it is easy to implement (comparingly). If you > can see that it is very feature competent, that it has very un-muddled > data types, the plain list, the tuple, integers, strings, symbols, > 8bit binary blobs (without silly base64 tricks). There is no XML > schema on top to bring you elementary data types that all > machine-to-machine transport _will_ need. > > UBF, the protocol contract language, can only really be appreciated if > you get to the next level of understanding publicly exposed protocols, > implementing them, maintaining them, documenting them, designing them. > So much about programming against an interface is "can i say this > right now?", or, "what do i need to say before what i really want?". > You dont see many interfaces targeting this kind of specification, all > you get is that they're going to throw IllegalStateException if the > programmer bothered to check premises explicitly, otherwise you will > likely get a NullPointerException and no guarantees about how valid > the internal state of the object is now. > > > Sorry for my rant. ... ranting is too much fun. > _______________________________________________ > 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 Jul 10 12:51:08 2008 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 10 Jul 2008 12:51:08 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> Message-ID: <9b08084c0807100351m50c5e43td24c32d7a7c40888@mail.gmail.com> On Wed, Jul 9, 2008 at 10:52 PM, Ben Hood <0x6e6562@REDACTED> wrote: > On Wed, Jul 9, 2008 at 3:41 PM, ERLANG wrote: >> But why not spend some time on more interesting idea : a C full (UBF A/B/C), >> open implementation of UBF? >> Universal Binary Format (UBF) is really worth a try: > > I looked at UBF a long time ago and I thought it was a very > interesting idea. What I was wondering is why there seems to have been > so little apparent interest in this (i.e. why hasn't it transitioned > from the POC). I started posting a reply to this - but it became a blog entry see: http://armstrongonsoftware.blogspot.com/2008/07/ubf-and-vm-opcocde-design.html /Joe Armstrong > > As I said earlier in the thread, I don't think that Google's idea is > particularly new. > > The advantage I see in terms of integrating Erlang with other > languages is that there seems to be a budding community of people > writing implementations in other languages. I think this would be a > good thing to piggyback off. > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From saleyn@REDACTED Thu Jul 10 13:05:03 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 10 Jul 2008 07:05:03 -0400 Subject: [erlang-questions] Basic Erlang case question In-Reply-To: References: Message-ID: <4875ECDF.5090405@gmail.com> The compiler warns you about the potential risk of an unsafe variable. Aside from rewriting the case clause as Lev & Hynek suggested, you can use a guard expression with a distinct variable name: case mnesia:transaction(F1) of ... {atomic, [#system_info{data = MD5}]} when MD5 =:= MD5_Password -> {ok, password}; ... end Note that the warning is not specific to the use of a record in pattern match - you'd get the same warning if you did: case mnesia:transaction(F1) of ... MD5_Password -> {ok, password}; ... end Here's a tricky part - if you define some other use of MD5_Password between the first case statement and the second, the warning in your original code would go away. It looks like when the variable exported from the case clause is used elsewhere as a rhs in pattern match then its safe to use it on lhs as well. Serge Alexander Lamb wrote: > Hello List, > > Here is a very simple code to search if a supplied password is correct > or not: > > F1 = fun() -> mnesia:match_object(systems, > #system_info{full_attribute = {System_Name,admin_password}, _ = '_'}, > read) end, > case Password of > [] -> MD5_Password = []; > _Any -> MD5_Password = erlang:md5(Password) > end, > case mnesia:transaction(F1) of > {atomic, []} -> {error, unknown_system}; > {atomic, [#system_info{data = MD5_Password}]} -> {ok, password}; > {atomic, _} -> {error, bad_password}; > {aborted, Reason} -> {error, Reason} > end > > > > Basically, if supplied Password is empty, the MD5_Password must be > empty. If not, I encrypt the Password to compare it with stored version. > > My problem is that it compiles with a warning: > > ./cs_systems.erl:173: Warning: variable 'MD5_Password' exported from > 'case' (line 167) > > Why? Obviously I am trying to match the password in the record I found > with the password I supply. > > Thanks, > > Alex > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tonyg@REDACTED Thu Jul 10 13:14:33 2008 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Thu, 10 Jul 2008 12:14:33 +0100 Subject: [erlang-questions] UBF (was Re: fyi: Google protocol buffers) In-Reply-To: <71a91c2f0807100337t5f534842n7141f0ea59dbd6ce@mail.gmail.com> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> <71a91c2f0807100337t5f534842n7141f0ea59dbd6ce@mail.gmail.com> Message-ID: <4875EF19.6000307@lshift.net> Hello, yerl yerl wrote: > So back to my wish : anyone to start the work on full C implementation > of UBF with me? I wrote one some years ago: http://www.eighty-twenty.org/~tonyg/Darcs/ubf/ It includes implementations of UBF-A for * C * Scheme (MzScheme, SISC) * Python * Erlang (Joe's implementation) It also includes unit tests for the above. I have some dusty Scheme code for UBF-B and UBF-C floating around somewhere, too, but it's not really high-quality enough to be used. Let me know if you'd like me to dig it out. Regards, Tony -- [][][] 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 richardc@REDACTED Thu Jul 10 13:59:46 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 10 Jul 2008 13:59:46 +0200 Subject: [erlang-questions] Basic Erlang case question In-Reply-To: <4875ECDF.5090405@gmail.com> References: <4875ECDF.5090405@gmail.com> Message-ID: <4875F9B2.9070403@it.uu.se> Serge Aleynikov wrote: > Here's a tricky part - if you define some other use of MD5_Password > between the first case statement and the second, the warning in your > original code would go away. It looks like when the variable exported > from the case clause is used elsewhere as a rhs in pattern match then > its safe to use it on lhs as well. Yes, the warning is limited to this particular case, since it is the one which typically could be a programming mistake: f(...) -> case ... of {..., X, ...} -> ...; ... {..., X, ...} -> ... end, ... ... case ... of {..., X, ...} -> ...; ... {..., X, ...} -> ... end. where X is intended to be a "local" temp variable, but due to some copy-and-pasting or other reason, X is then used again in a pattern further down (might be easy to miss if the function is large). The variable export is a language feature (like it or not) and it would be annoying to warn for other, probably intentional uses, so this is a compromise. /Richard From erlangy@REDACTED Thu Jul 10 14:58:38 2008 From: erlangy@REDACTED (yerl yerl) Date: Thu, 10 Jul 2008 14:58:38 +0200 Subject: [erlang-questions] UBF (was Re: fyi: Google protocol buffers) In-Reply-To: <4875EF19.6000307@lshift.net> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> <71a91c2f0807100337t5f534842n7141f0ea59dbd6ce@mail.gmail.com> <4875EF19.6000307@lshift.net> Message-ID: <71a91c2f0807100558s42ef9d0atdff8048d2c72beb1@mail.gmail.com> Hi Tony, Thanks for sharing. It'll be good starting point for me. cheers Y. On Thu, Jul 10, 2008 at 1:14 PM, Tony Garnock-Jones wrote: > Hello, > > yerl yerl wrote: > >> So back to my wish : anyone to start the work on full C implementation of >> UBF with me? >> > > I wrote one some years ago: > > http://www.eighty-twenty.org/~tonyg/Darcs/ubf/ > > It includes implementations of UBF-A for > > * C > * Scheme (MzScheme, SISC) > * Python > * Erlang (Joe's implementation) > > It also includes unit tests for the above. > > I have some dusty Scheme code for UBF-B and UBF-C floating around > somewhere, too, but it's not really high-quality enough to be used. Let me > know if you'd like me to dig it out. > > Regards, > Tony > -- > [][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211 > [][] LShift Ltd | Tel: +44 (0)20 7729 7060 > [] [] http://www.lshift.net/ | Email: tonyg@REDACTED > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam@REDACTED Thu Jul 10 16:32:35 2008 From: adam@REDACTED (Adam Lindberg) Date: Thu, 10 Jul 2008 16:32:35 +0200 Subject: [erlang-questions] Indias Twitter "clone" sounds built on Erlang, but is not Message-ID: <6344005f0807100732l5efd8d47r30680bee9da8147@mail.gmail.com> Just read this interesting piece on Twitter vs GupShup (the de-facto micro blogging service in India): http://anand.typepad.com/datawocky/2008/06/indias-sms-gupshup-has-3x-the-usage-of-twitter-and-no-downtime.html >From the article: > I'll let the numbers speak for themselves: > > - * Users:* Twitter (1+ million), SMS GupShup (7 million) > - *Messages per day: *Twitter (3 million); SMS GupShup (10+ million) > > This passage struck me as sounding like it is built on Erlang, or at least Erlang principles (my emphasis): > GupShup also uses an object architecture (called the "objectpool") which > allows each task to be componentized and run separately - this helps > immensely with *reliability* (can automatically handle machine failure) > and *scalability* (can scale dynamically to handle increased load). The > objectpool model allows each module to be run as *multiple parallel > instances* - each of them doing a part of the work. They can be run on *different > machines*, can be *started/stopped independently*, without affecting each > other. So the "receiver", the "sender", and the "ad server" all run as > multiple instances. As traffic scales, they can just add more hardware -- no > re-architecting. If one machine fails, the instance is restarted on a > different machine. Sounds like a perfect fit for Erlang. Should be less lines of code too, I presume. Would it be faster, though? Cheers! Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick.richardson@REDACTED Thu Jul 10 21:18:32 2008 From: rick.richardson@REDACTED (Rick R) Date: Thu, 10 Jul 2008 15:18:32 -0400 Subject: [erlang-questions] Indias Twitter "clone" sounds built on Erlang, but is not In-Reply-To: <6344005f0807100732l5efd8d47r30680bee9da8147@mail.gmail.com> References: <6344005f0807100732l5efd8d47r30680bee9da8147@mail.gmail.com> Message-ID: <9810b81b0807101218h1309c504vab911991cf78f877@mail.gmail.com> Sounds like it was built using one of Gemstone's ubiquitous object frameworks (easier to say than their buzzword laden description). (kind of) described here: http://www.vimeo.com/1147409 2008/7/10 Adam Lindberg : > Just read this interesting piece on Twitter vs GupShup (the de-facto micro > blogging service in India): > > http://anand.typepad.com/datawocky/2008/06/indias-sms-gupshup-has-3x-the-usage-of-twitter-and-no-downtime.html > > From the article: > >> I'll let the numbers speak for themselves: >> >> - * Users:* Twitter (1+ million), SMS GupShup (7 million) >> - *Messages per day: *Twitter (3 million); SMS GupShup (10+ million) >> >> > This passage struck me as sounding like it is built on Erlang, or at least > Erlang principles (my emphasis): > >> GupShup also uses an object architecture (called the "objectpool") which >> allows each task to be componentized and run separately - this helps >> immensely with *reliability* (can automatically handle machine failure) >> and *scalability* (can scale dynamically to handle increased load). The >> objectpool model allows each module to be run as *multiple parallel >> instances* - each of them doing a part of the work. They can be run on *different >> machines*, can be *started/stopped independently*, without affecting each >> other. So the "receiver", the "sender", and the "ad server" all run as >> multiple instances. As traffic scales, they can just add more hardware -- no >> re-architecting. If one machine fails, the instance is restarted on a >> different machine. > > > Sounds like a perfect fit for Erlang. Should be less lines of code too, I > presume. Would it be faster, though? > > Cheers! > Adam > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From smparkes@REDACTED Thu Jul 10 23:47:08 2008 From: smparkes@REDACTED (Steven Parkes) Date: Thu, 10 Jul 2008 14:47:08 -0700 Subject: [erlang-questions] Actor BoF at OSCON? (was RE: Erlang at OSCON2008) In-Reply-To: References: Message-ID: <1AE39DB8DA5D44FF8ED49253F2EB65E4@windows.esseff.org> For those going to OSCON, this has been confirmed: http://en.oreilly.com/oscon2008/public/schedule/detail/4872 See you there. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Patrick Logan Sent: Saturday, June 21, 2008 11:18 AM To: Erlang Questions Subject: Re: [erlang-questions] Actor BoF at OSCON? (was RE: Erlang at OSCON2008) "I've been toying with the idea of submitting a proposal for an Actor BoF (birds-of-a-feather), sharing experiences among the different actor/actor-like languages and libraries out there ..." I would be interested in something like this, or even concurrent and distributed programming generally. -Patrick _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From masterofquestions@REDACTED Thu Jul 10 23:49:43 2008 From: masterofquestions@REDACTED (db) Date: Thu, 10 Jul 2008 17:49:43 -0400 Subject: [erlang-questions] cacherl memcached app startup problem question In-Reply-To: <14f0e3620807072219h4e106f44x8b71a44a5926290b@mail.gmail.com> References: <1218d6a50805301550u50ddc883l4e07607c2e70f760@mail.gmail.com> <14f0e3620806200738y65a7439fwde1ed4d4fb98e63a@mail.gmail.com> <1218d6a50807071516l695f5679of510eff337b9b92a@mail.gmail.com> <14f0e3620807072219h4e106f44x8b71a44a5926290b@mail.gmail.com> Message-ID: <1218d6a50807101449i71a4918cjbbddabf698a929ff@mail.gmail.com> does cacherl support 64bit integer in its incr() function? -- rk That which we persist in doing becomes easier for us to do; not that the nature of the thing itself is changed, but that our power to do is increased. -Ralph Waldo Emerson From wglozer@REDACTED Fri Jul 11 01:07:12 2008 From: wglozer@REDACTED (Will) Date: Thu, 10 Jul 2008 16:07:12 -0700 Subject: [erlang-questions] [Bug] xmerl causes emulator crash Message-ID: Hello, The attached test case causes xmerl to allocate several gigs of memory and eventually crashes the emulator. Thanks, Will -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: crash_xmerl.erl Type: application/octet-stream Size: 693 bytes Desc: not available URL: From alain.odea@REDACTED Fri Jul 11 01:11:53 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Thu, 10 Jul 2008 20:41:53 -0230 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? Message-ID: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> It looks like the list-serv for erlang-questions is leaving Reply-To blank instead of setting or overriding it to be "erlang-questions@REDACTED " as I would expect. This has lead me on multiple occasions to reply to the poster directly instead of replying to the thread. I find it very confusing. Is erlang-questions setting Reply-To properly? From saleyn@REDACTED Fri Jul 11 03:22:53 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 10 Jul 2008 21:22:53 -0400 Subject: [erlang-questions] ei patch to handle NEW_FLOAT_EXT Message-ID: <4876B5ED.7010402@gmail.com> Ever since the emulator support of the compact IEEE 754 double encoding in external binary format was introduced I've been patiently waiting for ei to support this feature. Finally I gave up and implemented this myself as I recently needed to marshal lots of doubles between Erlang and C++ and size of the binary stream did matter. Attached is a patch for R12B-2 that implements this feature. The only thing I wasn't sure about was whether backward compatibility of ei_{encode,decode}_double() is truly required. It exists in the emulator, where the new functionality is controlled by term_to_binary(Term, [{minor_version, 1}]), and is essential indeed, but is it really needed for ei? In order to be properly backward compatible, it would likely require to introduce yet another pair of functions, such as: int ei_encode_double_new(char *buf, int *index, double p) int ei_x_encode_double_new(ei_x_buff* x, const void *p, long len) which gets a little messy as there are already a fair amount of ei functions. Since the internals of the external binary format are hidden behind the facade of: int ei_encode_double(char *buf, int *index, double p) int ei_decode_double(const char *buf, int *index, double *p) Perhaps retaining the compatibility of lower-level implementation is not that crucial? In the patch the old functionality is controlled by setting USE_OLD_FLOAT_ENCODER macro, but this is left discretionary to the OTP team. Regards, Serge -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ei.R12B-2.patch URL: From vlm@REDACTED Fri Jul 11 03:29:07 2008 From: vlm@REDACTED (Lev Walkin) Date: Thu, 10 Jul 2008 18:29:07 -0700 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> Message-ID: <4876B763.1090302@lionet.info> http://www.unicom.com/pw/reply-to-harmful.html Alain O'Dea wrote: > It looks like the list-serv for erlang-questions is leaving Reply-To > blank instead of setting or overriding it to be "erlang-questions@REDACTED > " as I would expect. This has lead me on multiple occasions to reply > to the poster directly instead of replying to the thread. I find it > very confusing. > > Is erlang-questions setting Reply-To properly? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From justin@REDACTED Fri Jul 11 03:42:57 2008 From: justin@REDACTED (Justin Sheehy) Date: Thu, 10 Jul 2008 21:42:57 -0400 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> Message-ID: On Jul 10, 2008, at 7:11 PM, Alain O'Dea wrote: > Is erlang-questions setting Reply-To properly? Yes. Your mail client should allow you to choose who you are replying to. -Justin From egil@REDACTED Fri Jul 11 11:59:38 2008 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 11 Jul 2008 11:59:38 +0200 Subject: [erlang-questions] [erlang-patches] ei patch to handle NEW_FLOAT_EXT In-Reply-To: <4876B5ED.7010402@gmail.com> References: <4876B5ED.7010402@gmail.com> Message-ID: <48772F0A.1000703@erix.ericsson.se> Hi Serge, Thank you for sending a patch and underlining this problem. Compatibility is a problem, and I am not sure yet if this is the solution. I will look into the matter. *adding it to my todo list* Regards, Bj?rn-Egil Erlang/OTP Serge Aleynikov wrote: > Ever since the emulator support of the compact IEEE 754 double encoding > in external binary format was introduced I've been patiently waiting for > ei to support this feature. Finally I gave up and implemented this > myself as I recently needed to marshal lots of doubles between Erlang > and C++ and size of the binary stream did matter. > > Attached is a patch for R12B-2 that implements this feature. The only > thing I wasn't sure about was whether backward compatibility of > ei_{encode,decode}_double() is truly required. It exists in the > emulator, where the new functionality is controlled by > term_to_binary(Term, [{minor_version, 1}]), and is essential indeed, but > is it really needed for ei? In order to be properly backward > compatible, it would likely require to introduce yet another pair of > functions, such as: > > int ei_encode_double_new(char *buf, int *index, double p) > int ei_x_encode_double_new(ei_x_buff* x, const void *p, long len) > > which gets a little messy as there are already a fair amount of ei > functions. > > Since the internals of the external binary format are hidden behind the > facade of: > > int ei_encode_double(char *buf, int *index, double p) > int ei_decode_double(const char *buf, int *index, double *p) > > Perhaps retaining the compatibility of lower-level implementation is not > that crucial? In the patch the old functionality is controlled by > setting USE_OLD_FLOAT_ENCODER macro, but this is left discretionary to > the OTP team. > > Regards, > > Serge > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches From saleyn@REDACTED Fri Jul 11 13:01:52 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 11 Jul 2008 07:01:52 -0400 Subject: [erlang-questions] [erlang-patches] ei patch to handle NEW_FLOAT_EXT In-Reply-To: <48772F0A.1000703@erix.ericsson.se> References: <4876B5ED.7010402@gmail.com> <48772F0A.1000703@erix.ericsson.se> Message-ID: <48773DA0.5000702@gmail.com> Another thought that crossed my mind on the ei's low-level old style decoding compatibility of doubles was to control it via introducing ei_init() with some global flags controlling fine-grain behavior as opposed to introducing more functions of ei_encode_double family. Serge Bj?rn-Egil Dahlberg wrote: > Hi Serge, > > Thank you for sending a patch and underlining this problem. > > Compatibility is a problem, and I am not sure yet if this is the solution. > > I will look into the matter. *adding it to my todo list* > > Regards, > Bj?rn-Egil > Erlang/OTP > > Serge Aleynikov wrote: >> Ever since the emulator support of the compact IEEE 754 double >> encoding in external binary format was introduced I've been patiently >> waiting for ei to support this feature. Finally I gave up and >> implemented this myself as I recently needed to marshal lots of >> doubles between Erlang and C++ and size of the binary stream did matter. >> >> Attached is a patch for R12B-2 that implements this feature. The only >> thing I wasn't sure about was whether backward compatibility of >> ei_{encode,decode}_double() is truly required. It exists in the >> emulator, where the new functionality is controlled by >> term_to_binary(Term, [{minor_version, 1}]), and is essential indeed, >> but is it really needed for ei? In order to be properly backward >> compatible, it would likely require to introduce yet another pair of >> functions, such as: >> >> int ei_encode_double_new(char *buf, int *index, double p) >> int ei_x_encode_double_new(ei_x_buff* x, const void *p, long len) >> >> which gets a little messy as there are already a fair amount of ei >> functions. >> >> Since the internals of the external binary format are hidden behind >> the facade of: >> >> int ei_encode_double(char *buf, int *index, double p) >> int ei_decode_double(const char *buf, int *index, double *p) >> >> Perhaps retaining the compatibility of lower-level implementation is >> not that crucial? In the patch the old functionality is controlled by >> setting USE_OLD_FLOAT_ENCODER macro, but this is left discretionary to >> the OTP team. >> >> Regards, >> >> Serge >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> erlang-patches mailing list >> erlang-patches@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-patches > > From nicola.lugato@REDACTED Fri Jul 11 15:33:50 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Fri, 11 Jul 2008 15:33:50 +0200 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). Message-ID: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> Hello, i was wandering if a module for interfacing sqlite exists.. I searched on google but no useful results came out. Also, supposing i have a C library (a shared object or dll), how can i write a binding for it for erlang? Thanks, Nicola From gleber.p@REDACTED Fri Jul 11 15:44:25 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 11 Jul 2008 15:44:25 +0200 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). In-Reply-To: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> References: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> Message-ID: <14f0e3620807110644v492b3ca8q6b8ab7da09cec113@mail.gmail.com> On Fri, Jul 11, 2008 at 3:33 PM, Nicola Lugato wrote: > Hello, i was wandering if a module for interfacing sqlite exists.. I > searched on google but no useful results came out. > Also, supposing i have a C library (a shared object or dll), how can i > write a binding for it for erlang? > > Thanks, Nicola Hello, May you describe for what purposes are you going to use SqlLite with Erlang? Maybe Mnesia will be enough? >From Mnesia reference manual: > Listed below are some of the most important and attractive capabilities, Mnesia provides: > * A relational/object hybrid data model which is suitable for telecommunications applications. > * A specifically designed DBMS query language, QLC (as an add-on library). > * Persistence. Tables may be coherently kept on disc as well as in main memory. > * Replication. Tables may be replicated at several nodes. > * Atomic transactions. A series of table manipulation operations can be grouped into a single atomic transaction. > * Location transparency. Programs can be written without knowledge of the actual location of data. > * Extremely fast real time data searches. For further details take a look at: http://www.erlang.org/doc/apps/mnesia/index.html I have no experience in writing bindings for Erlang, hence i'll leave this part for more experienced erlang hackers. Best regards, -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From tty.erlang@REDACTED Fri Jul 11 16:01:19 2008 From: tty.erlang@REDACTED (t ty) Date: Fri, 11 Jul 2008 10:01:19 -0400 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). In-Reply-To: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> References: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> Message-ID: <290b3ba10807110701p6721e4f1if3523bafd7b426cd@mail.gmail.com> I am working on one :) Just haven't had the time to put in docs. I can send you what I have if you are willing to put up with it. t On Fri, Jul 11, 2008 at 9:33 AM, Nicola Lugato wrote: > Hello, i was wandering if a module for interfacing sqlite exists.. I > searched on google but no useful results came out. > Also, supposing i have a C library (a shared object or dll), how can i > write a binding for it for erlang? > > Thanks, Nicola > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From florian.ebeling@REDACTED Fri Jul 11 16:26:23 2008 From: florian.ebeling@REDACTED (Caspar Florian Ebeling) Date: Fri, 11 Jul 2008 16:26:23 +0200 Subject: [erlang-questions] Construct parameter dynamically, sometimes illegal? Message-ID: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> I'm really a bit confused about cases when it is not possible to pass parameters which were created dynamically. An example: this does not work, {ok, File} = file:open("writebench.data.erl", [write, binary, raw, {delayed_write, math:pow(2, 12), 1000}] but this does, {ok, File} = file:open("writebench.data.erl", [write, binary, raw, {delayed_write, 65536, 1000}] Shouldn't that evaluate to exactly the same thing? Florian -- Florian Ebeling florian.ebeling@REDACTED From takeru.inoue@REDACTED Fri Jul 11 16:29:16 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Fri, 11 Jul 2008 23:29:16 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo Message-ID: Dear Erlang Community, I'd like to tell you about a project called Kai. Kai is a distributed hashtable like Amazon's Dynamo. Dynamo is described in its original paper, as a highly available key-value storage system that some of Amazon's core services use to provide an "always-on" experience. Kai implements well-known memcache API, and you can access to Kai with your favorite programming language. Kai is hosted on sourceforge.net, where detailed information is found. http://kai.wiki.sourceforge.net/ Also, source code can be downloaded. http://sourceforge.net/project/showfiles.php?group_id=228337 If you are interested in Kai, read Getting Started and try it. http://kai.wiki.sourceforge.net/getting+started Regards, -- Takeru INOUE From mog-lists@REDACTED Fri Jul 11 16:40:44 2008 From: mog-lists@REDACTED (mog) Date: Fri, 11 Jul 2008 09:40:44 -0500 Subject: [erlang-questions] Construct parameter dynamically, sometimes illegal? In-Reply-To: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> References: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> Message-ID: <487770EC.1000304@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Caspar Florian Ebeling wrote: | I'm really a bit confused about cases when it is not possible to | pass parameters which were created dynamically. An example: | this does not work, | | {ok, File} = file:open("writebench.data.erl", | [write, binary, raw, {delayed_write, math:pow(2, 12), 1000}] math:pow(Int) -> Float, so that will be the wrong type for that function, if you have a function that returns an int I am sure it will work, or if you surround it in a round or trunc it will work fine. Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkh3cOUACgkQeq+tARrxhnuPGgCgnxkhOwGC58N3qv6i2ClAztf2 x+gAoJ/IbPoWlsQ1yt0Y3O5yMKVL6Jd7 =nq+2 -----END PGP SIGNATURE----- From nicola.lugato@REDACTED Fri Jul 11 16:46:27 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Fri, 11 Jul 2008 16:46:27 +0200 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). In-Reply-To: <14f0e3620807110644v492b3ca8q6b8ab7da09cec113@mail.gmail.com> References: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> <14f0e3620807110644v492b3ca8q6b8ab7da09cec113@mail.gmail.com> Message-ID: <59bbf6e10807110746ma82c8b7mf4c9b56cac6d8e42@mail.gmail.com> > May you describe for what purposes are you going to use SqlLite with > Erlang? Maybe Mnesia will be enough? Hello! Yes Mnesia probably will be more than enought but i'm porting some code to erlang that already uses sqlite with already filled actual db files. It's not a big problem losing them but i was checking since sqlite is a db i like very much :) From nicola.lugato@REDACTED Fri Jul 11 16:50:29 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Fri, 11 Jul 2008 16:50:29 +0200 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). In-Reply-To: <290b3ba10807110701p6721e4f1if3523bafd7b426cd@mail.gmail.com> References: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> <290b3ba10807110701p6721e4f1if3523bafd7b426cd@mail.gmail.com> Message-ID: <59bbf6e10807110750s65fe8732l14724248c856f35c@mail.gmail.com> Sure i'll be glad to look at it, but consider i'm quite new to erlang. I hope i'll also be able to understand how to interface to a c library On Fri, Jul 11, 2008 at 4:01 PM, t ty wrote: > I am working on one :) Just haven't had the time to put in docs. I > can send you what I have if you are willing to put up with it. > > t > > On Fri, Jul 11, 2008 at 9:33 AM, Nicola Lugato wrote: >> Hello, i was wandering if a module for interfacing sqlite exists.. I >> searched on google but no useful results came out. >> Also, supposing i have a C library (a shared object or dll), how can i >> write a binding for it for erlang? >> >> Thanks, Nicola >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From florian.ebeling@REDACTED Fri Jul 11 16:49:26 2008 From: florian.ebeling@REDACTED (Caspar Florian Ebeling) Date: Fri, 11 Jul 2008 16:49:26 +0200 Subject: [erlang-questions] Construct parameter dynamically, sometimes illegal? In-Reply-To: <487770EC.1000304@rldn.net> References: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> <487770EC.1000304@rldn.net> Message-ID: <5cbbe4ae0807110749u401ebe82h13c4dcd1bf62e213@mail.gmail.com> > | pass parameters which were created dynamically. An example: > | this does not work, > | > | {ok, File} = file:open("writebench.data.erl", > | [write, binary, raw, {delayed_write, math:pow(2, 12), > 1000}] > math:pow(Int) -> Float, so that will be the wrong type for that function, if > you have a function that returns an int I am sure it will work, or if you > surround it in a round or trunc it will work fine. oh, of course, you're right. Thanks. Florian -- Florian Ebeling florian.ebeling@REDACTED From vychodil.hynek@REDACTED Fri Jul 11 16:59:11 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 11 Jul 2008 16:59:11 +0200 Subject: [erlang-questions] Construct parameter dynamically, sometimes illegal? In-Reply-To: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> References: <5cbbe4ae0807110726y7a44bca4h72ed70a80ed5441a@mail.gmail.com> Message-ID: <4d08db370807110759r210fc2b3h18ab11d28146b7fe@mail.gmail.com> {ok, File} = file:open("writebench.data.erl", [write, binary, raw, {delayed_write, 1 bsl 12, 1000}] will work :) On Fri, Jul 11, 2008 at 4:26 PM, Caspar Florian Ebeling < florian.ebeling@REDACTED> wrote: > I'm really a bit confused about cases when it is not possible to > pass parameters which were created dynamically. An example: > this does not work, > > {ok, File} = file:open("writebench.data.erl", > [write, binary, raw, {delayed_write, math:pow(2, > 12), 1000}] > > but this does, > > {ok, File} = file:open("writebench.data.erl", > [write, binary, raw, {delayed_write, 65536, > 1000}] > > Shouldn't that evaluate to exactly the same thing? > > Florian > > -- > Florian Ebeling > florian.ebeling@REDACTED > _______________________________________________ > 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 erlang@REDACTED Fri Jul 11 17:00:25 2008 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 11 Jul 2008 17:00:25 +0200 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: <9b08084c0807110800p109971dr4fe6a4e4a3c2e3ef@mail.gmail.com> Amazing - This is the *third* Key-Value store written in Erlang I have learned about in two weeks. The other two were a Key Value store (based on chord + paxos) see http://www.erlang-exchange.com/alexander-reinefeld And the couchDB stuff (see http://erlang-exchange.com/jan-lehnardt) You missed a link to your slides http://www.slideshare.net/takemaru/kai-an-open-source-implementation-of-amazons-dynamo-472179/ So now we have *three* reliable key-value stores. /Joe Armstrong On Fri, Jul 11, 2008 at 4:29 PM, Takeru INOUE wrote: > Dear Erlang Community, > > I'd like to tell you about a project called Kai. > > Kai is a distributed hashtable like Amazon's Dynamo. > Dynamo is described in its original paper, as a highly available > key-value storage system that some of Amazon's core services use to > provide an "always-on" experience. > Kai implements well-known memcache API, and you can access to Kai with > your favorite programming language. > > Kai is hosted on sourceforge.net, where detailed information is found. > > http://kai.wiki.sourceforge.net/ > > Also, source code can be downloaded. > > http://sourceforge.net/project/showfiles.php?group_id=228337 > > If you are interested in Kai, read Getting Started and try it. > > http://kai.wiki.sourceforge.net/getting+started > > Regards, > > -- > Takeru INOUE > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From olivier.boudeville@REDACTED Fri Jul 11 17:26:29 2008 From: olivier.boudeville@REDACTED (Olivier Boudeville) Date: Fri, 11 Jul 2008 17:26:29 +0200 Subject: [erlang-questions] TV displaying of Mnesia tables Message-ID: <48777BA5.5030007@online.fr> Hi, when using the TV application to display a Mnesia table, wouldn't it be useful to have an option to name the head of columns from the corresponding field names in the table record, instead of using the number of the field in the record ? I.e. if displaying a table based on: -record(my_record, {field_A,field_B}). TV columns could be named 'field_A' and 'field_B' instead of '2' and '3' ? Thanks in advance for any information, best regards, Olivier Boudeville. From tty.erlang@REDACTED Fri Jul 11 17:19:41 2008 From: tty.erlang@REDACTED (t ty) Date: Fri, 11 Jul 2008 11:19:41 -0400 Subject: [erlang-questions] sqlite interface module (and interfacing C libraries in general). In-Reply-To: <59bbf6e10807110750s65fe8732l14724248c856f35c@mail.gmail.com> References: <59bbf6e10807110633g53c38435g9c5a74c14873d86d@mail.gmail.com> <290b3ba10807110701p6721e4f1if3523bafd7b426cd@mail.gmail.com> <59bbf6e10807110750s65fe8732l14724248c856f35c@mail.gmail.com> Message-ID: <290b3ba10807110819t1872f4f4l774af2a43762cb0f@mail.gmail.com> Tested on MacOS 10.5.x The sqlite_test gives some example usage. As fall back you can always do sqlite:sql_exec/2 which makes a direct sqlite3_exec call. Remember to put sqlite/priv into your path or it won't be able to find sqlite_port. My general motivation is to use sqlite as the simple SQL dbase for reports. There are too many in-house reporting tools which assumes an SQL interface of some sort. Plus I find sqlite far easier to setup compared to mysql/postgress etc. Tee On Fri, Jul 11, 2008 at 10:50 AM, Nicola Lugato wrote: > Sure i'll be glad to look at it, but consider i'm quite new to erlang. > I hope i'll also be able to understand how to interface to a c library > > On Fri, Jul 11, 2008 at 4:01 PM, t ty wrote: >> I am working on one :) Just haven't had the time to put in docs. I >> can send you what I have if you are willing to put up with it. >> >> t >> >> On Fri, Jul 11, 2008 at 9:33 AM, Nicola Lugato wrote: >>> Hello, i was wandering if a module for interfacing sqlite exists.. I >>> searched on google but no useful results came out. >>> Also, supposing i have a C library (a shared object or dll), how can i >>> write a binding for it for erlang? >>> >>> Thanks, Nicola >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: sqllite.tar.gz Type: application/x-gzip Size: 31388 bytes Desc: not available URL: From dmercer@REDACTED Fri Jul 11 17:58:38 2008 From: dmercer@REDACTED (David Mercer) Date: Fri, 11 Jul 2008 10:58:38 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers Message-ID: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) written in Erlang, and I want it to work through hardware failures; I need at least two of them. The problem is, clients are connecting to the primary's IP address, so when it fails, client connections are refused instead of being rerouted to the secondary. What is the Erlang approach to solving this? My thought is that you have the secondary detect the failure and send the appropriate commands to the network to redirect traffic for the primary server's IP address to the secondary. That's my idea, but I don't really know if this is the appropriate solution, nor how to implement something like this in Erlang. Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From mog-lists@REDACTED Fri Jul 11 18:24:23 2008 From: mog-lists@REDACTED (mog) Date: Fri, 11 Jul 2008 11:24:23 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> References: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Message-ID: <48778937.9060103@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I think you should look into carp, vrrp, or http://www.linuxvirtualserver.org/ they allow you to have two machines share the same ip for for tcp/ip or udp connections, they also allow for failover support like you want. Just frontend your erlang nodes with this. Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkh3iSoACgkQeq+tARrxhnv9ggCeNi5S6RcHmp3zVZtZKyPMARdo yd0AnR4WCtgtFS8oioZDUwnKfEtxgjwn =n9z9 -----END PGP SIGNATURE----- From tty.erlang@REDACTED Fri Jul 11 18:29:28 2008 From: tty.erlang@REDACTED (t ty) Date: Fri, 11 Jul 2008 12:29:28 -0400 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> References: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Message-ID: <290b3ba10807110929h19b7eff3y760502e059efbd4b@mail.gmail.com> There isn't any unless your hardware / OS allows for socket migration. Some IBM mainframes are suppose to allow it and there has been research Linux kernel patches for it. Never tried them personally though. Love to be told/proven wrong especially if it is a cheap solution :) t 2008/7/11 David Mercer : > Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) written in > Erlang, and I want it to work through hardware failures; I need at least two > of them. The problem is, clients are connecting to the primary's IP > address, so when it fails, client connections are refused instead of being > rerouted to the secondary. What is the Erlang approach to solving this? > > > > My thought is that you have the secondary detect the failure and send the > appropriate commands to the network to redirect traffic for the primary > server's IP address to the secondary. That's my idea, but I don't really > know if this is the appropriate solution, nor how to implement something > like this in Erlang. > > > > Please advise. Thank-you. > > > > David Mercer > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dbt@REDACTED Fri Jul 11 18:56:04 2008 From: dbt@REDACTED (David Terrell) Date: Fri, 11 Jul 2008 11:56:04 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> References: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Message-ID: <487790A4.9020809@meat.net> David Mercer wrote: > Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) > written in Erlang, and I want it to work through hardware failures; I > need at least two of them. The problem is, clients are connecting to > the primary?s IP address, so when it fails, client connections are > refused instead of being rerouted to the secondary. What is the Erlang > approach to solving this? > > > > My thought is that you have the secondary detect the failure and send > the appropriate commands to the network to redirect traffic for the > primary server?s IP address to the secondary. That?s my idea, but I > don?t really know if this is the appropriate solution, nor how to > implement something like this in Erlang. OpenBSD's packet filter, called PF, has a tool called CARP to do just this. You can read more on this here: http://www.openbsd.org/faq/pf/carp.html -- David Terrell dbt@REDACTED (SMTP or XMPP) http://meat.net/ From erlangy@REDACTED Fri Jul 11 19:01:58 2008 From: erlangy@REDACTED (ERLANG) Date: Fri, 11 Jul 2008 19:01:58 +0200 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: Hi Takeru, First of all thanks for sharing this excellent piece of code. Is there any persistency backend to "Kai" or is it just a memory cache engine? cheers Y. Le 11 juil. 08 ? 16:29, Takeru INOUE a ?crit : > Dear Erlang Community, > > I'd like to tell you about a project called Kai. > > Kai is a distributed hashtable like Amazon's Dynamo. > Dynamo is described in its original paper, as a highly available > key-value storage system that some of Amazon's core services use to > provide an "always-on" experience. > Kai implements well-known memcache API, and you can access to Kai with > your favorite programming language. > > Kai is hosted on sourceforge.net, where detailed information is found. > > http://kai.wiki.sourceforge.net/ > > Also, source code can be downloaded. > > http://sourceforge.net/project/showfiles.php?group_id=228337 > > If you are interested in Kai, read Getting Started and try it. > > http://kai.wiki.sourceforge.net/getting+started > > Regards, > > -- > Takeru INOUE > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From r.kelsall@REDACTED Fri Jul 11 19:24:19 2008 From: r.kelsall@REDACTED (Richard Kelsall) Date: Fri, 11 Jul 2008 18:24:19 +0100 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> References: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Message-ID: <48779743.9060306@millstream.com> David Mercer wrote: > Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) > written in Erlang, and I want it to work through hardware failures; I > need at least two of them. The problem is, clients are connecting to > the primary?s IP address, so when it fails, client connections are > refused instead of being rerouted to the secondary. What is the Erlang > approach to solving this? > > My thought is that you have the secondary detect the failure and send > the appropriate commands to the network to redirect traffic for the > primary server?s IP address to the secondary. That?s my idea, but I > don?t really know if this is the appropriate solution, nor how to > implement something like this in Erlang. Just to add that you can also play games at the DNS level to send web requests to different IP addresses. These sorts of things : http://www.tylek.org/?p=23 http://www.akadia.com/services/dns_round_robin.html Others will have much better knowledge than me though. Richard. From lloy0076@REDACTED Thu Jul 10 04:13:17 2008 From: lloy0076@REDACTED (David Lloyd) Date: Thu, 10 Jul 2008 11:43:17 +0930 Subject: [erlang-questions] "Cast" in gen_server et al Message-ID: <4875703D.20104@adam.com.au> Hi There, From what I can tell, "cast(Name, Request)" means: "Send the message to the server with name Name with the request Request and return Ok.". I think one would use it to just send requests to the server if you didn't want to bother about receiving any response. Hence, I would assume that it's named "cast" in the sense of "cast a spell at" rather than in "cast a pointer to an integer"? DSL From theczintheroc2007@REDACTED Fri Jul 11 21:19:44 2008 From: theczintheroc2007@REDACTED (Colin Z) Date: Fri, 11 Jul 2008 15:19:44 -0400 Subject: [erlang-questions] Need some OTP design advice Message-ID: I need some advice on part of an application I'm writing. Basically I've got a gen_server that is responsible for processing command records sent to it via casts. It just uses an mnesia DB to map command codes to logic modules (so, it's kind of like a scripting system). I'm running into problems when there's a typo in the DB (ie: the module specified in the DB doesn't actually exist) or when there's an error in the logic module. It will cause my gen_server to crash. If it crashes too often it'll bring down the application obviously. handle_cast( {queue_command, ?CMD_VAR}, State ) -> Command = mnesia:dirty_read(?STATE.commandDB, list_to_atom(?CMD.command)), case Command of [] -> io:fwrite("Could not find command `~p`~n",[?CMD.command]), ok ; [#command{module=Module}] -> case gen_command:validate(Module, ?CMD_VAR) of ok -> gen_command:do(Module, ?CMD_VAR), ok ; denied -> ok end end, {noreply, State} ; If it finds the command code in the DB it will call the logic module's validate() method to see if it's allowed, then calls do(). (I'm doing some magic with the macros there, but it's just convenience for working with records.) The gen_command module just does this: do(CallbackModule, ?CMD_VAR) -> CallbackModule:do(?CMD_VAR) . Should I be doing a try...catch in gen_command to keep the gen_server from crashing, or is my design just way off to begin with? Or maybe I should be letting the server crash and just change the supervision tree so it can crash as many times as it wants? -------------- next part -------------- An HTML attachment was scrubbed... URL: From alain.odea@REDACTED Fri Jul 11 22:05:33 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Fri, 11 Jul 2008 17:35:33 -0230 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <4876B763.1090302@lionet.info> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> Message-ID: Interesting article. Thank you Lev. I had not realized the side- effects were so severe, but upon review they make perfect sense. I will use Reply All and maybe even get at the admins of other lists to remove this reply-to munging. On 10-Jul-08, at 10:59 PM, Lev Walkin wrote: > > > http://www.unicom.com/pw/reply-to-harmful.html > > > Alain O'Dea wrote: >> It looks like the list-serv for erlang-questions is leaving Reply- >> To blank instead of setting or overriding it to be "erlang-questions@REDACTED >> " as I would expect. This has lead me on multiple occasions to >> reply to the poster directly instead of replying to the thread. I >> find it very confusing. >> Is erlang-questions setting Reply-To properly? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > From johnswolter@REDACTED Fri Jul 11 22:30:24 2008 From: johnswolter@REDACTED (john s wolter) Date: Fri, 11 Jul 2008 16:30:24 -0400 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> Takeru, Thanks for the Kai link, I had not seen that myself and will add that to my links. I have some additional links to Distributed Hash Table, DHT, information and projects. The pages also refer to other projects and sites. This is Wikipedia's take on DHT for those who may not be familiar. http://en.wikipedia.org/wiki/Distributed_hash_table OpenDHT is a publicly accessible distributed hash table (DHT) *service*. http://opendht.org/ Bamboo is a either based on Pastry, a re-engineering of the Pastry protocols, or an entirely new DHT http://bamboo-dht.org/ SIPPEER: A Session Initiation Protocol (SIP)-based Peer-to-Peer Internet Telephony Client Adaptor. More from the VoIP world. http://www1.cs.columbia.edu/~kns10/publication/sip-p2p-design.pdf The fallacies of distributed computing which should make you think. A PDF at the bottom of the article has much detail. http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing What got me going on Erlang was distributed OS's, planet scale event monitoring systems, multi-agent software, swarms, PSO's, non-stop applications, the overused cloud-computing metaphor, and grids. Whew, I need to sit down. Wait a minute, I am sitting down. On Fri, Jul 11, 2008 at 1:01 PM, ERLANG wrote: > Hi Takeru, > > First of all thanks for sharing this excellent piece of code. > Is there any persistency backend to "Kai" or is it just a memory cache > engine? > > cheers > Y. > > Le 11 juil. 08 ? 16:29, Takeru INOUE a ?crit : > > > Dear Erlang Community, > > > > I'd like to tell you about a project called Kai. > > > > Kai is a distributed hashtable like Amazon's Dynamo. > > Dynamo is described in its original paper, as a highly available > > key-value storage system that some of Amazon's core services use to > > provide an "always-on" experience. > > Kai implements well-known memcache API, and you can access to Kai with > > your favorite programming language. > > > > Kai is hosted on sourceforge.net, where detailed information is found. > > > > http://kai.wiki.sourceforge.net/ > > > > Also, source code can be downloaded. > > > > http://sourceforge.net/project/showfiles.php?group_id=228337 > > > > If you are interested in Kai, read Getting Started and try it. > > > > http://kai.wiki.sourceforge.net/getting+started > > > > Regards, > > > > -- > > Takeru INOUE > > _______________________________________________ > > 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 raould@REDACTED Fri Jul 11 22:44:39 2008 From: raould@REDACTED (Raoul Duke) Date: Fri, 11 Jul 2008 13:44:39 -0700 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> References: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> Message-ID: <91a2ba3e0807111344h6722fd09pe02ecc7095114916@mail.gmail.com> >> > Kai implements well-known memcache API, and you can access to Kai with >> > your favorite programming language. neat! looks like ever more folks are having making memcache compatible servers e.g. the experimental http://liftweb.net/index.php/High-performance_apps_in_Scala_(actord). From mpharrison@REDACTED Fri Jul 11 23:52:37 2008 From: mpharrison@REDACTED (Matthew Harrison) Date: Fri, 11 Jul 2008 22:52:37 +0100 Subject: [erlang-questions] gs contrib mandel - bad flicker when try to resize (Win XP) Message-ID: <4f13f3560807111452o4da66c78g7196fe71c0150a4c@mail.gmail.com> Hi, new to erlang (R12B-3), and trying all the toys. When I run mandel (in the gs contribs) it is sometimes very unsmooth in rendering (is the calculation grabbing all the cpu and not allowing rendering to get a look-in?) Also re-size flickers quite badly and is a bit hit and miss. Am I missing something or could this be a bug? The gs examples all seem to behave themselves, but don't seem to be as wildly parallel. Best rgds, Matthew. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 12 00:14:33 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Fri, 11 Jul 2008 18:14:33 -0400 Subject: [erlang-questions] "Cast" in gen_server et al In-Reply-To: <4875703D.20104@adam.com.au> References: <4875703D.20104@adam.com.au> Message-ID: <6c2563b20807111514k495d4babv6941089139993ed8@mail.gmail.com> The sense that I get is that it is like "cast" in "broadcast", except that it's not being "cast broadly", so it's just "cast". To take the metaphor further, it works roughly like a radio signal that is broadcast: the receiver does not reply. Just like you said :) On Wed, Jul 9, 2008 at 10:13 PM, David Lloyd wrote: > > Hi There, > > From what I can tell, "cast(Name, Request)" means: > > "Send the message to the server with name Name with the request Request > and return Ok.". > > I think one would use it to just send requests to the server if you > didn't want to bother about receiving any response. > > Hence, I would assume that it's named "cast" in the sense of "cast a > spell at" rather than in "cast a pointer to an integer"? > > DSL > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Sat Jul 12 00:32:16 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Sat, 12 Jul 2008 00:32:16 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <20080709153426.GI136@h216-235-12-174.host.egate.net> References: <20080709153426.GI136@h216-235-12-174.host.egate.net> Message-ID: <4877DF70.8090802@hyber.org> Vance Shipley wrote: > > ASN.1 gave me a headache when I started learning it however it > is so effecient and simple to use that I miss working with it. > > One word - ASN.1 macros /klacke From paul-trapexit@REDACTED Sat Jul 12 01:40:17 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 11 Jul 2008 16:40:17 -0700 (PDT) Subject: [erlang-questions] mnesia slow startup In-Reply-To: References: Message-ID: Hi. I'm responding to my own message for search engines to help out the next guy. There were two key things we did to improve things: * avoiding unnecessary schema transactions. instead of counting on mnesia:create_table/2, mnesia:add_table_copy/3 etc. to be idempotent, we short-circuit them via a mnesia:table_info/2 check first. also we avoid calling mnesia:change_config (extra_db_nodes, Nodes) unless the nodeset has really changed. * -mnesia no_table_loaders 100 : this greatly reduced the time it took to transfer the data to a restarting node. so that got restart times down from about 4 hours to 4 minutes. -- p On Wed, 25 Jun 2008, Paul Mineiro wrote: > hello. > > we've been scaling our cluster and we're currently at 24 nodes. lately > we've noticed that when a node crashes (by running out of memory, oops, > software defect), that restarting mnesia on that node takes a while. by > "restarting that node", btw, i mean getting through things like > mnesia_controller:try_merge_schema/1 . when we at say 4 nodes we never > really noticed this. > > today we literally went to lunch after a node failed and wasn't > (finishing) starting up, figuring a full stomach would lubricate > cognition. we came back and it had resolved itself. hurray for > laziness! > > however there are still some questions: > > * i'm having a hard time getting some visibility into what is causing a > particular schema transaction(s) to be blocked. any tricks here? > > * is it expected that certain transactional protocols scale badly with > the number of nodes? > > any feedback would be appreciated. thanks! > > -- p > > In an artificial world, only extremists live naturally. > > -- Paul Graham > In an artificial world, only extremists live naturally. -- Paul Graham From takeru.inoue@REDACTED Sat Jul 12 02:05:30 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sat, 12 Jul 2008 09:05:30 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <9b08084c0807110800p109971dr4fe6a4e4a3c2e3ef@mail.gmail.com> References: <9b08084c0807110800p109971dr4fe6a4e4a3c2e3ef@mail.gmail.com> Message-ID: Hi Joe, Thank you for introducing our slides. I'm also amazing. Reliable and scalable key-value stores are now desired, I think. On Sat, Jul 12, 2008 at 12:00 AM, Joe Armstrong wrote: > Amazing - > > This is the *third* Key-Value store written in Erlang I have learned > about in two weeks. > > The other two were a Key Value store (based on chord + paxos) > see http://www.erlang-exchange.com/alexander-reinefeld > > And the couchDB stuff (see http://erlang-exchange.com/jan-lehnardt) > > You missed a link to your slides > http://www.slideshare.net/takemaru/kai-an-open-source-implementation-of-amazons-dynamo-472179/ > > So now we have *three* reliable key-value stores. > > /Joe Armstrong > > > > On Fri, Jul 11, 2008 at 4:29 PM, Takeru INOUE wrote: >> Dear Erlang Community, >> >> I'd like to tell you about a project called Kai. >> >> Kai is a distributed hashtable like Amazon's Dynamo. >> Dynamo is described in its original paper, as a highly available >> key-value storage system that some of Amazon's core services use to >> provide an "always-on" experience. >> Kai implements well-known memcache API, and you can access to Kai with >> your favorite programming language. >> >> Kai is hosted on sourceforge.net, where detailed information is found. >> >> http://kai.wiki.sourceforge.net/ >> >> Also, source code can be downloaded. >> >> http://sourceforge.net/project/showfiles.php?group_id=228337 >> >> If you are interested in Kai, read Getting Started and try it. >> >> http://kai.wiki.sourceforge.net/getting+started >> >> Regards, >> >> -- >> Takeru INOUE >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > fra@REDACTED; ingvar.akesson@REDACTED > > [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. > De vill ju ?nd? l?sa min e-post.] > > [A copy of this mail has been sent to > FRA for monitoring purposes. FRA wants to read all my e-mail and have > been allowed to do by the Swedish parliment - in violation of article > 12 of the UN Universal Declaration of Human Rights] > -- Takeru INOUE From takeru.inoue@REDACTED Sat Jul 12 02:06:23 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sat, 12 Jul 2008 09:06:23 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: Hi erlangy, > First of all thanks for sharing this excellent piece of code. > Is there any persistency backend to "Kai" or is it just a memory cache > engine? Amazon's Dynamo, which inspires our Kai, is not a cache, but a reliable data store. In Dynamo, all key-value paris are replicated among the cluster nodes for reliability. The number of replicas are automatically kept even if some nodes are getting unavailable. BDB or MySQL is utilized as persistent storage. Amazon uses Dynamo to store important information, such as shopping carts. While Kai implements memcache API, it is not a cacne and stores key-value pairs with some replicas like Dynamo. We currently uses ets only, but dets or mnesia will be supported in the near future. > cheers > Y. > > Le 11 juil. 08 ? 16:29, Takeru INOUE a ?crit : > >> Dear Erlang Community, >> >> I'd like to tell you about a project called Kai. >> >> Kai is a distributed hashtable like Amazon's Dynamo. >> Dynamo is described in its original paper, as a highly available >> key-value storage system that some of Amazon's core services use to >> provide an "always-on" experience. >> Kai implements well-known memcache API, and you can access to Kai with >> your favorite programming language. >> >> Kai is hosted on sourceforge.net, where detailed information is found. >> >> http://kai.wiki.sourceforge.net/ >> >> Also, source code can be downloaded. >> >> http://sourceforge.net/project/showfiles.php?group_id=228337 >> >> If you are interested in Kai, read Getting Started and try it. >> >> http://kai.wiki.sourceforge.net/getting+started >> >> Regards, >> >> -- >> Takeru INOUE >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > -- Takeru INOUE From takeru.inoue@REDACTED Sat Jul 12 02:07:02 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sat, 12 Jul 2008 09:07:02 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> References: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> Message-ID: Hi John, Thank you for introducing many related links. We will add them to our Wiki. On Sat, Jul 12, 2008 at 5:30 AM, john s wolter wrote: > Takeru, > > Thanks for the Kai link, I had not seen that myself and will add that to my > links. I have some additional links to Distributed Hash Table, DHT, > information and projects. The pages also refer to other projects and sites. > > This is Wikipedia's take on DHT for those who may not be familiar. > http://en.wikipedia.org/wiki/Distributed_hash_table > > OpenDHT is a publicly accessible distributed hash table (DHT) service. > http://opendht.org/ > > Bamboo is a either based on Pastry, a re-engineering of the Pastry > protocols, or an entirely new DHT > http://bamboo-dht.org/ > > SIPPEER: A Session Initiation Protocol (SIP)-based Peer-to-Peer Internet > Telephony Client Adaptor. More from the VoIP world. > http://www1.cs.columbia.edu/~kns10/publication/sip-p2p-design.pdf > > The fallacies of distributed computing which should make you think. A PDF > at the bottom of the article has much detail. > http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing > > What got me going on Erlang was distributed OS's, planet scale event > monitoring systems, multi-agent software, swarms, PSO's, non-stop > applications, the overused cloud-computing metaphor, and grids. Whew, I > need to sit down. Wait a minute, I am sitting down. > > On Fri, Jul 11, 2008 at 1:01 PM, ERLANG wrote: >> >> Hi Takeru, >> >> First of all thanks for sharing this excellent piece of code. >> Is there any persistency backend to "Kai" or is it just a memory cache >> engine? >> >> cheers >> Y. >> >> Le 11 juil. 08 ? 16:29, Takeru INOUE a ?crit : >> >> > Dear Erlang Community, >> > >> > I'd like to tell you about a project called Kai. >> > >> > Kai is a distributed hashtable like Amazon's Dynamo. >> > Dynamo is described in its original paper, as a highly available >> > key-value storage system that some of Amazon's core services use to >> > provide an "always-on" experience. >> > Kai implements well-known memcache API, and you can access to Kai with >> > your favorite programming language. >> > >> > Kai is hosted on sourceforge.net, where detailed information is found. >> > >> > http://kai.wiki.sourceforge.net/ >> > >> > Also, source code can be downloaded. >> > >> > http://sourceforge.net/project/showfiles.php?group_id=228337 >> > >> > If you are interested in Kai, read Getting Started and try it. >> > >> > http://kai.wiki.sourceforge.net/getting+started >> > >> > Regards, >> > >> > -- >> > Takeru INOUE >> > _______________________________________________ >> > 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 -- Takeru INOUE From takeru.inoue@REDACTED Sat Jul 12 02:19:20 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sat, 12 Jul 2008 09:19:20 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <91a2ba3e0807111344h6722fd09pe02ecc7095114916@mail.gmail.com> References: <24bcf1860807111330n22fdf583t1e9b2a97aaea067d@mail.gmail.com> <91a2ba3e0807111344h6722fd09pe02ecc7095114916@mail.gmail.com> Message-ID: > neat! looks like ever more folks are having making memcache compatible > servers e.g. the experimental > http://liftweb.net/index.php/High-performance_apps_in_Scala_(actord). Thanks, I didn't know this interesting project. This actord seems to focus on performance. Its reliability depends on storage system like BDB, and data partitioning is done by clients like memcache. In our Kai, replication and partitioning are done by Kai nodes. The number of replicas are automatically kept among Kai nodes, even if some nodes are getting unavailable. This mechanism leads to high scalability and reliability. While targets are little bit different, it is very interesting for us. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Takeru INOUE From jeffm@REDACTED Sat Jul 12 07:07:57 2008 From: jeffm@REDACTED (jm) Date: Sat, 12 Jul 2008 15:07:57 +1000 Subject: [erlang-questions] erts inside a larger C program Message-ID: <48783C2D.1070804@ghostgun.com> Is there any papers/article/web pages or other explainations floating around which explains the internals of the erlang virtual machine? Specifically the threading and anything about how it interacts with the OS and outside world. I'm interested in putting erlang inside a C++ based application. This appilcation will use a number of libraries and I'm trying to work out how these will interact with erlang's runtime system. I've managed to track down bits and pieces in the code, eg otp_src_R12B-3/erts/emulator/beam/, but haven't had a chance to work my way through it. As this is a daunting task to begin with any help on where/how to start is what I'm looking for. And, I realise that this mean that the C code crashing will crash erlang, but as the application has crashed there is no further need for the erlang environment. Jeff. From vychodil.hynek@REDACTED Sat Jul 12 09:14:29 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 12 Jul 2008 09:14:29 +0200 Subject: [erlang-questions] Need some OTP design advice In-Reply-To: References: Message-ID: <4d08db370807120014j64cbcd0fjeae8ffd8ce9ac2fb@mail.gmail.com> Look on try command. 2008/7/11 Colin Z : > I need some advice on part of an application I'm writing. > > Basically I've got a gen_server that is responsible for processing command > records sent to it via casts. > > It just uses an mnesia DB to map command codes to logic modules (so, it's > kind of like a scripting system). > > I'm running into problems when there's a typo in the DB (ie: the module > specified in the DB doesn't actually exist) or when there's an error in the > logic module. It will cause my gen_server to crash. If it crashes too often > it'll bring down the application obviously. > > handle_cast( {queue_command, ?CMD_VAR}, State ) -> > > Command = mnesia:dirty_read(?STATE.commandDB, > list_to_atom(?CMD.command)), > > case Command of > [] -> > io:fwrite("Could not find command `~p`~n",[?CMD.command]), > ok > ; > [#command{module=Module}] -> > case gen_command:validate(Module, ?CMD_VAR) of > ok -> > gen_command:do(Module, ?CMD_VAR), > ok > ; > denied -> > ok > end > end, > {noreply, State} > ; > > If it finds the command code in the DB it will call the logic module's > validate() method to see if it's allowed, then calls do(). (I'm doing some > magic with the macros there, but it's just convenience for working with > records.) > > The gen_command module just does this: > > do(CallbackModule, ?CMD_VAR) -> > CallbackModule:do(?CMD_VAR) > . > > > Should I be doing a try...catch in gen_command to keep the gen_server from > crashing, or is my design just way off to begin with? Or maybe I should be > letting the server crash and just change the supervision tree so it can > crash as many times as it wants? > > _______________________________________________ > 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 Sat Jul 12 09:32:52 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 12 Jul 2008 09:32:52 +0200 Subject: [erlang-questions] erts inside a larger C program In-Reply-To: <48783C2D.1070804@ghostgun.com> References: <48783C2D.1070804@ghostgun.com> Message-ID: <4d08db370807120032k15d2f494q418bef7c73c99eda@mail.gmail.com> Is there any reason why your application can't work as erlang node through ei interface instead be "inside"? Performance, shared memory? On Sat, Jul 12, 2008 at 7:07 AM, jm wrote: > Is there any papers/article/web pages or other explainations floating > around which explains the internals of the erlang virtual machine? > Specifically the threading and anything about how it interacts with the > OS and outside world. I'm interested in putting erlang inside a C++ > based application. This appilcation will use a number of libraries and > I'm trying to work out how these will interact with erlang's runtime > system. I've managed to track down bits and pieces in the code, eg > otp_src_R12B-3/erts/emulator/beam/, but haven't had a chance to work my > way through it. As this is a daunting task to begin with any help on > where/how to start is what I'm looking for. > > And, I realise that this mean that the C code crashing will crash > erlang, but as the application has crashed there is no further need for > the erlang environment. > > Jeff. > _______________________________________________ > 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 erlangy@REDACTED Thu Jul 10 11:48:53 2008 From: erlangy@REDACTED (ERLANG) Date: Thu, 10 Jul 2008 11:48:53 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> Message-ID: <2F26C774-9CFD-4303-BDA6-3517E875275B@gmail.com> Hi, Perfectly agree with you Christian. So, my question again. Any guys interested to do that ? cheers Y. Le 10 juil. 08 ? 01:42, Christian S a ?crit : >> I looked at UBF a long time ago and I thought it was a very >> interesting idea. What I was wondering is why there seems to have >> been >> so little apparent interest in this (i.e. why hasn't it transitioned >> from the POC). > > As long as we are a bit cynical in this thread, I'll share some of > my cynism. > > I think UBF has got no attention because the skill (in the bottom 95% > of programmers) at using parser generators and parsing is low, people > go as far as splitting text on a delimiter character (or regexp > pattern), they maybe do this further on the results, but that's it. If > more is needed, they bring in XML, because DOM parsers doesnt > intimidated the ego the same way a tool you dont know will do. > > UBF, the transport format, can only really be appreciated if you know > and directly see that it is easy to implement (comparingly). If you > can see that it is very feature competent, that it has very un-muddled > data types, the plain list, the tuple, integers, strings, symbols, > 8bit binary blobs (without silly base64 tricks). There is no XML > schema on top to bring you elementary data types that all > machine-to-machine transport _will_ need. > > UBF, the protocol contract language, can only really be appreciated if > you get to the next level of understanding publicly exposed protocols, > implementing them, maintaining them, documenting them, designing them. > So much about programming against an interface is "can i say this > right now?", or, "what do i need to say before what i really want?". > You dont see many interfaces targeting this kind of specification, all > you get is that they're going to throw IllegalStateException if the > programmer bothered to check premises explicitly, otherwise you will > likely get a NullPointerException and no guarantees about how valid > the internal state of the object is now. > > > Sorry for my rant. ... ranting is too much fun. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vlm@REDACTED Sat Jul 12 13:48:34 2008 From: vlm@REDACTED (Lev Walkin) Date: Sat, 12 Jul 2008 04:48:34 -0700 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <4877DF70.8090802@hyber.org> References: <20080709153426.GI136@h216-235-12-174.host.egate.net> <4877DF70.8090802@hyber.org> Message-ID: <48789A12.1000303@lionet.info> Claes Wikstrom wrote: > Vance Shipley wrote: > >> ASN.1 gave me a headache when I started learning it however it >> is so effecient and simple to use that I miss working with it. >> >> > > One word - ASN.1 macros There are no ASN.1 macros anymore. For 14 years already, or so, the standard has no mention of them. They're replaced with Information Object Classes, which is much more internally consistent headache. -- Lev Walkin vlm@REDACTED From chsu79@REDACTED Sat Jul 12 13:51:02 2008 From: chsu79@REDACTED (Christian S) Date: Sat, 12 Jul 2008 13:51:02 +0200 Subject: [erlang-questions] fyi: Google protocol buffers In-Reply-To: <2F26C774-9CFD-4303-BDA6-3517E875275B@gmail.com> References: <269388e30807091255h7820512ahc2a508ef061d7dbf@mail.gmail.com> <20080709201910.GC29792@sphinx.chicagopeoplez.org> <269388e30807091352h35b9778dwececb9e3a60adcb8@mail.gmail.com> <2F26C774-9CFD-4303-BDA6-3517E875275B@gmail.com> Message-ID: On Thu, Jul 10, 2008 at 11:48 AM, ERLANG wrote: > Hi, > > Perfectly agree with you Christian. > So, my question again. Any guys interested to do that ? > > cheers > Y. Oh the irony: I see more use in extending something like http://code.google.com/p/googerl/ to support more/all of google's apis. Yeah, XML. :| If I want to serialize some terms in erlang I'll always have term_to_binary. If I want to talk with other languages, i would prefer ubf, but likely i would end up with json. Or XML if I dont have any saying. From vlm@REDACTED Sat Jul 12 13:51:13 2008 From: vlm@REDACTED (Lev Walkin) Date: Sat, 12 Jul 2008 04:51:13 -0700 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: <48789AB1.3030301@lionet.info> Takeru INOUE wrote: > Hi erlangy, > >> First of all thanks for sharing this excellent piece of code. >> Is there any persistency backend to "Kai" or is it just a memory cache >> engine? > > Amazon's Dynamo, which inspires our Kai, is not a cache, but a > reliable data store. > In Dynamo, all key-value paris are replicated among the cluster nodes > for reliability. > The number of replicas are automatically kept even if some nodes are > getting unavailable. > BDB or MySQL is utilized as persistent storage. > Amazon uses Dynamo to store important information, such as shopping carts. > > While Kai implements memcache API, it is not a cacne and stores > key-value pairs with some replicas like Dynamo. > We currently uses ets only, but dets or mnesia will be supported in > the near future. Takeru, is it true that Kai has 2gigs limitation of ets? If yes, the claim that "Scales infinitely" is false. >> cheers >> Y. >> >> Le 11 juil. 08 ? 16:29, Takeru INOUE a ?crit : >> >>> Dear Erlang Community, >>> >>> I'd like to tell you about a project called Kai. >>> >>> Kai is a distributed hashtable like Amazon's Dynamo. >>> Dynamo is described in its original paper, as a highly available >>> key-value storage system that some of Amazon's core services use to >>> provide an "always-on" experience. >>> Kai implements well-known memcache API, and you can access to Kai with >>> your favorite programming language. >>> >>> Kai is hosted on sourceforge.net, where detailed information is found. >>> >>> http://kai.wiki.sourceforge.net/ >>> >>> Also, source code can be downloaded. >>> >>> http://sourceforge.net/project/showfiles.php?group_id=228337 >>> >>> If you are interested in Kai, read Getting Started and try it. >>> >>> http://kai.wiki.sourceforge.net/getting+started >>> >>> Regards, >>> >>> -- >>> Takeru INOUE >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From apnmbx-public@REDACTED Sat Jul 12 13:09:12 2008 From: apnmbx-public@REDACTED (Ashok P. Nadkarni) Date: Sat, 12 Jul 2008 16:39:12 +0530 Subject: [erlang-questions] Noob gen_server questions Message-ID: <487890D8.5000003@yahoo.com> Just started learning Erlang and OTP and had a couple of questions about gen_server behaviours. I want to have a gen_server process that is actually a dispatcher that passes on the call to another process that does the actual work and generates the result. So mymodule:handle_call will return {noreply, NewState} and the worker process will at some later point send the result back to the client. The question is - how can the latter be accomplished? I presume the gen_server:reply() cannot be used from a different process. Is there a better way to accomplish my goal - not to block a gen_server from accepting new requests when a particular request can potentially take a long time. Thanks /Ashok From richardc@REDACTED Sat Jul 12 14:18:59 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 12 Jul 2008 14:18:59 +0200 Subject: [erlang-questions] erts inside a larger C program In-Reply-To: <48783C2D.1070804@ghostgun.com> References: <48783C2D.1070804@ghostgun.com> Message-ID: <4878A133.409@it.uu.se> jm wrote: > Is there any papers/article/web pages or other explainations floating > around which explains the internals of the erlang virtual machine? > Specifically the threading and anything about how it interacts with the > OS and outside world. No, nothing so specific. You might get some hints from the papers written by the HiPE group: http://www.it.uu.se/research/group/hipe/. I also found this nice litte blog entry: http://erlangdotnet.net/2007/09/inside-beam-erlang-virtual-machine.html /Richard From vlm@REDACTED Sat Jul 12 14:25:00 2008 From: vlm@REDACTED (Lev Walkin) Date: Sat, 12 Jul 2008 05:25:00 -0700 Subject: [erlang-questions] Noob gen_server questions In-Reply-To: <487890D8.5000003@yahoo.com> References: <487890D8.5000003@yahoo.com> Message-ID: <4878A29C.20508@lionet.info> Ashok P. Nadkarni wrote: > Just started learning Erlang and OTP and had a couple of questions about > gen_server behaviours. > > I want to have a gen_server process that is actually a dispatcher that > passes on the call to another process that does the actual work and > generates the result. So mymodule:handle_call will return {noreply, > NewState} and the worker process will at some later point send the > result back to the client. The question is - how can the latter be > accomplished? I presume the gen_server:reply() cannot be used from a > different process. Presumption's wrong. It can be used from a different process. > Is there a better way to accomplish my goal - not to block a gen_server > from accepting new requests when a particular request can potentially > take a long time. This is the best way. That is, to forward the From to a different process. -- Lev Walkin vlm@REDACTED From chsu79@REDACTED Sat Jul 12 14:28:25 2008 From: chsu79@REDACTED (Christian S) Date: Sat, 12 Jul 2008 14:28:25 +0200 Subject: [erlang-questions] Noob gen_server questions In-Reply-To: <487890D8.5000003@yahoo.com> References: <487890D8.5000003@yahoo.com> Message-ID: > accomplished? I presume the gen_server:reply() cannot be used from a > different process. You can use gen_server:reply() from a different process. Simple load-balancing can be done by having handle_call return no_reply, and have it cast requests on to workers that ultimately call gen_server:reply on the From value passed on to them. From justin@REDACTED Sat Jul 12 14:47:01 2008 From: justin@REDACTED (Justin Sheehy) Date: Sat, 12 Jul 2008 08:47:01 -0400 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <48789AB1.3030301@lionet.info> References: <48789AB1.3030301@lionet.info> Message-ID: <99876260-9798-4568-8700-CCFF7B491127@iago.org> Lev, On Jul 12, 2008, at 7:51 AM, Lev Walkin wrote: > is it true that Kai has 2gigs limitation of ets? If yes, the > claim that "Scales infinitely" is false. That's an incorrect conclusion. The capacity would be (capacity per node) X (number of nodes) In a system like this you could add capacity by adding more nodes, not only by making each node bigger. -Justin From ulf@REDACTED Sat Jul 12 15:15:23 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 12 Jul 2008 15:15:23 +0200 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <99876260-9798-4568-8700-CCFF7B491127@iago.org> References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> Message-ID: <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> Using 64-bit Erlang, ets is by no means limited to 2 GB (actually, it isn't in 32-bit erlang either. Dets is, however. The limitation for ets in 32-bit Erlang is the 4 GB address space.) See e.g. http://www1.erlang.org/pipermail/erlang-questions/2005-November/017728.html BR, Ulf W 2008/7/12 Justin Sheehy : > Lev, > > On Jul 12, 2008, at 7:51 AM, Lev Walkin wrote: > >> is it true that Kai has 2gigs limitation of ets? If yes, the >> claim that "Scales infinitely" is false. > > That's an incorrect conclusion. The capacity would be > (capacity per node) X (number of nodes) > > In a system like this you could add capacity by adding > more nodes, not only by making each node bigger. > > -Justin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From takeru.inoue@REDACTED Sat Jul 12 17:59:39 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sun, 13 Jul 2008 00:59:39 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <99876260-9798-4568-8700-CCFF7B491127@iago.org> References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> Message-ID: >> is it true that Kai has 2gigs limitation of ets? If yes, the >> claim that "Scales infinitely" is false. > > That's an incorrect conclusion. The capacity would be > (capacity per node) X (number of nodes) > > In a system like this you could add capacity by adding > more nodes, not only by making each node bigger. Yes, by adding more nodes, the capacity can be expanded. However, this limitation might be restriction in some cases. We're planning to use multiple tables in a single node, and alleviate the limitation. > -Justin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Takeru INOUE From justin@REDACTED Sat Jul 12 18:44:52 2008 From: justin@REDACTED (Justin Sheehy) Date: Sat, 12 Jul 2008 12:44:52 -0400 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> Message-ID: On Jul 12, 2008, at 11:59 AM, Takeru INOUE wrote: > Yes, by adding more nodes, the capacity can be expanded. > > However, this limitation might be restriction in some cases. > We're planning to use multiple tables in a single node, and alleviate > the limitation. That might be helpful, but until you do that you can always just run multiple nodes on one host. -Justin From mark.geib@REDACTED Sat Jul 12 18:59:01 2008 From: mark.geib@REDACTED (Mark Geib) Date: Sat, 12 Jul 2008 10:59:01 -0600 Subject: [erlang-questions] gen_tcp:send() very expensive Message-ID: <4878E2D5.6080606@echostar.com> I am new to erlang and writing a program to replace an existing Java program that accepts multiple network tcp connections, upto about 400, and then also excepts 'receive' connections from clients, again in the hundrends.. The Java code then re-distributes all the messages from all the 'source' connections to all the connected clients. The Java program is running at about 35% of the machines cpu. When I tried my first cut of replacing this with erlang I was surprised to find that the erlang program rapidly consumed the machine and quickly stopped functioning... SO, I have been investigating and find that the erlang message passing is VERY efficient, but the actual sending of the message to all the connected clients is a HUGE cpu consumer. In my test case I am generating about 2000 message / second and without sending the tcp messages uses about 10% of the test machine. With one client connecting the cpu usage increases to nearly 100%. Is this expected, or is there an option I need to set improve efficiency of the network writing. The message sizes vary from 2 - 2000 bytes. Sorry for the long post. Mark. -- Principal Engineer Cheyenne Software Engineering mark.geib@REDACTED / 35-215 From takeru.inoue@REDACTED Sat Jul 12 19:23:18 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sun, 13 Jul 2008 02:23:18 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> Message-ID: >> Yes, by adding more nodes, the capacity can be expanded. >> >> However, this limitation might be restriction in some cases. >> We're planning to use multiple tables in a single node, and alleviate >> the limitation. > > That might be helpful, but until you do that you can always just run > multiple nodes on one host. Kai is still in the early stage, and we're now struggling with many issues. Sorry for the inconvenience. > -Justin > > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Kai-users mailing list > Kai-users@REDACTED > https://lists.sourceforge.net/lists/listinfo/kai-users > -- Takeru INOUE From justin@REDACTED Sat Jul 12 19:29:07 2008 From: justin@REDACTED (Justin Sheehy) Date: Sat, 12 Jul 2008 13:29:07 -0400 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> Message-ID: <09A9F6C4-E84D-4E08-AAD3-B5466F6EEF18@iago.org> On Jul 12, 2008, at 1:23 PM, Takeru INOUE wrote: > Kai is still in the early stage, and we're now struggling with many > issues. > Sorry for the inconvenience. I didn't mean my comment as negative criticism of Kai, but rather just a suggestion for a workaround. It's a nice first release -- there's no need for any apology. In fact, I may help you out with some of those issues sometime soon. -Justin From rapsey@REDACTED Sat Jul 12 19:30:18 2008 From: rapsey@REDACTED (Rapsey) Date: Sat, 12 Jul 2008 19:30:18 +0200 Subject: [erlang-questions] gen_tcp:send() very expensive In-Reply-To: <4878E2D5.6080606@echostar.com> References: <4878E2D5.6080606@echostar.com> Message-ID: <97619b170807121030h28ba96cdra24b256408f216fb@mail.gmail.com> There has been a discussion on this very topic a while ago. You should check the archives. My only solution to this problem was to cut down on the number of gen_tcp:send calls. Buffer the data for a bit and then send it all at once. Sergej On Sat, Jul 12, 2008 at 6:59 PM, Mark Geib wrote: > I am new to erlang and writing a program to replace an existing Java > program that accepts multiple network tcp connections, upto about 400, > and then also excepts 'receive' connections from clients, again in the > hundrends.. The Java code then re-distributes all the messages from all > the 'source' connections to all the connected clients. > > The Java program is running at about 35% of the machines cpu. When I > tried my first cut of replacing this with erlang I was surprised to find > that the erlang program rapidly consumed the machine and quickly stopped > functioning... > > SO, I have been investigating and find that the erlang message passing > is VERY efficient, but the actual sending of the message to all the > connected clients is a HUGE cpu consumer. In my test case I am > generating about 2000 message / second and without sending the tcp > messages uses about 10% of the test machine. With one client connecting > the cpu usage increases to nearly 100%. > > Is this expected, or is there an option I need to set improve efficiency > of the network writing. The message sizes vary from 2 - 2000 bytes. > > Sorry for the long post. > > Mark. > -- > Principal Engineer > Cheyenne Software Engineering > mark.geib@REDACTED / 35-215 > > _______________________________________________ > 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-questions_efine@REDACTED Sat Jul 12 20:10:35 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 12 Jul 2008 14:10:35 -0400 Subject: [erlang-questions] gen_tcp:send() very expensive In-Reply-To: <4878E2D5.6080606@echostar.com> References: <4878E2D5.6080606@echostar.com> Message-ID: <6c2563b20807121110o3857ca3dv94fa703d6921346e@mail.gmail.com> It would help if you posted the hardware and software systems and versions (CPU, memory, OS, Erlang) you are using. Are you running everything on one machine? What speed of LAN are you using? In terms of the architecture, are the TCP/IP connections persistent between client and the system sending the messages, or is there a connect for each message (obvious, I know, but still). Is there a message-level protocol? A 2-byte message does not seem long enough to involved a protocol, but perhaps I misunderstand. In an application I am working on, I used Apache JMeter (Java app) running 50 clients on a Windows computer, and managed to send an aggregate of around 675 500-byte XML messages per second (and get an XML response to each message) to a system running Erlang R12B-3 (Linux 64-bit), and the CPU usage on the Linux system was about 25%. The Erlang application's CPU usage was about 60 - 75% within the VM (using appmon). On thing I had to be sure of is that I was using the Erlang run-time flag '+K true' to use kernel poll on Linux. I also had to tweak some Windows registry values to get better TCP/IP performance. If you are using Erlang on Windows then I all I can say is that I am not sure that's the best platform for it. Finally, I found that the way I sent messages from Erlang made a huge difference to performance and CPU usage. Use a TCP/IP sniffer tool (e.g. Wireshark) to see the size of the frames that come from your Erlang system. If they are small, then you are probably somehow preventing Erlang from buffering up the different fragments of data to reduce the number of actual TCP/IP transmissions done. That happened to me, and I saw dismal performance. What I did to fix that was to ensure that every message to be sent on TCP/IP was spawned into its own Erlang process, passing in an open socket. (Remember that process creation in Erlang is extremely fast and has very low overhead - of the order of sending an Erlang message). The sniffer then showed that instead of sending a zillion tiny frames, it was now sending much fewer, larger ones. For example, many frames were 56 bytes long. After making the send asynchronous, the frames were close to 1400 bytes. I think the improvement resulted because I was feeding the socket in a sort of sequential way by waiting for the gen_tcp:send() to return ok, then fetching the next message to send. I believe that doing this prevented Erlang's networking layer from buffering the send data. When I spawned a process to send, I was no longer waiting for the ok before sending the next message to the same socket. Someone else who had this issue actually buffered them up himself, but I think my approach also works. Maybe spawning the sends is akin to buffering them up. Either way, the principle is the same. Other than that, there are many TCP/IP parameters that can be modified both on Windows and in Erlang, and these can make a big difference to the performance depending on the situation. Hope this helps. On Sat, Jul 12, 2008 at 12:59 PM, Mark Geib wrote: > I am new to erlang and writing a program to replace an existing Java > program that accepts multiple network tcp connections, upto about 400, > and then also excepts 'receive' connections from clients, again in the > hundrends.. The Java code then re-distributes all the messages from all > the 'source' connections to all the connected clients. > > The Java program is running at about 35% of the machines cpu. When I > tried my first cut of replacing this with erlang I was surprised to find > that the erlang program rapidly consumed the machine and quickly stopped > functioning... > > SO, I have been investigating and find that the erlang message passing > is VERY efficient, but the actual sending of the message to all the > connected clients is a HUGE cpu consumer. In my test case I am > generating about 2000 message / second and without sending the tcp > messages uses about 10% of the test machine. With one client connecting > the cpu usage increases to nearly 100%. > > Is this expected, or is there an option I need to set improve efficiency > of the network writing. The message sizes vary from 2 - 2000 bytes. > > Sorry for the long post. > > Mark. > -- > Principal Engineer > Cheyenne Software Engineering > mark.geib@REDACTED / 35-215 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 12 20:24:01 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 12 Jul 2008 14:24:01 -0400 Subject: [erlang-questions] How to search the Erlang Questions archives Message-ID: <6c2563b20807121124j540ee0e6p54ca61b7d1572af1@mail.gmail.com> A very similar question (and answers to it) appeared recently on this mailing list. To search the list: 1. Go to http://www.erlang.org/faq.html. 2. Enter "Forwarding call gen_server" in the Google Search text box. 3. Select the "erlang-questions" radio button and press the Goole Search button. Hope this helps. On Sat, Jul 12, 2008 at 8:28 AM, Christian S wrote: > > accomplished? I presume the gen_server:reply() cannot be used from a > > different process. > > You can use gen_server:reply() from a different process. > > Simple load-balancing can be done by having handle_call return > no_reply, and have it cast requests on to workers that ultimately call > gen_server:reply on the From value passed on to them. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul-trapexit@REDACTED Sat Jul 12 20:34:44 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 12 Jul 2008 11:34:44 -0700 (PDT) Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> Message-ID: We wrote a dets clone based upon tokyocabinet that does not have the file size limitation, if kai needs scalable disk-based storage. http://code.google.com/p/tcerl/ -- p On Sat, 12 Jul 2008, Ulf Wiger wrote: > Using 64-bit Erlang, ets is by no means limited to 2 GB > (actually, it isn't in 32-bit erlang either. Dets is, however. > The limitation for ets in 32-bit Erlang is the 4 GB address > space.) > > See e.g. > http://www1.erlang.org/pipermail/erlang-questions/2005-November/017728.html > > BR, > Ulf W > > 2008/7/12 Justin Sheehy : > > Lev, > > > > On Jul 12, 2008, at 7:51 AM, Lev Walkin wrote: > > > >> is it true that Kai has 2gigs limitation of ets? If yes, the > >> claim that "Scales infinitely" is false. > > > > That's an incorrect conclusion. The capacity would be > > (capacity per node) X (number of nodes) > > > > In a system like this you could add capacity by adding > > more nodes, not only by making each node bigger. > > > > -Justin > > > > > > _______________________________________________ > > 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 > In an artificial world, only extremists live naturally. -- Paul Graham From paul-trapexit@REDACTED Sat Jul 12 21:46:27 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 12 Jul 2008 12:46:27 -0700 (PDT) Subject: [erlang-questions] memory impact of increasing dump_log_time_threshold / dump_log_write_threshold Message-ID: i (might) want to increase mnesia's dump_log_time_threshold and/or dump_log_write_threshold. however my intuition says that, since writes go to a write-ahead log first and then later to permanent storage (even dirty_writes!), that there might be some in-memory representation of pending writes prior to the log behind dumped. so: are there memory usage ramifications to increasing the time between mnesia's log dumps? -- p In an artificial world, only extremists live naturally. -- Paul Graham From jan@REDACTED Sat Jul 12 22:25:43 2008 From: jan@REDACTED (Jan Lehnardt) Date: Sat, 12 Jul 2008 21:25:43 +0100 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: <137EF930-BD21-497D-9D36-E174DE5396A7@apache.org> Hello, On Jul 11, 2008, at 15:29 , Takeru INOUE wrote: > I'd like to tell you about a project called Kai. We are extremely interested in these kind of systems. We, that are the CouchDB developers, sort of tackle the same problem space, only from the other direction. Where Kai and Alexander Reinefeld (& co)'s work focus on the distribution & fault tolerance, CouchDB aims to be an attractive data store first. It is meant as an alternative to the often wrongly (as in wrong tool for the job) used RDBMSes. So CouchDB can be used standalone but we are planning to have a fault tolerance layer on top of CouchDB that deals with disappearing nodes and all that. It would be really really cool if we could collaborate on this. CouchDB comes with an HTTP interface, so is accessible equally easy from all languages, including Erlang, but it is not tied to Erlang. Since such high availability systems are attractive for homogenous environments, a well-known API is a good idea and you certainly made a good choice with the memcache API. Is the interest in merging our systems mutual? If there anything is you would like to know, do not hesitate to contact me (here or in private if preferred). Keep up the good work! Cheers Jan -- > Kai is a distributed hashtable like Amazon's Dynamo. > Dynamo is described in its original paper, as a highly available > key-value storage system that some of Amazon's core services use to > provide an "always-on" experience. > Kai implements well-known memcache API, and you can access to Kai with > your favorite programming language. > > Kai is hosted on sourceforge.net, where detailed information is found. > > http://kai.wiki.sourceforge.net/ > > Also, source code can be downloaded. > > http://sourceforge.net/project/showfiles.php?group_id=228337 > > If you are interested in Kai, read Getting Started and try it. > > http://kai.wiki.sourceforge.net/getting+started > > Regards, > > -- > Takeru INOUE > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From takeru.inoue@REDACTED Sun Jul 13 04:48:22 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sun, 13 Jul 2008 11:48:22 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <09A9F6C4-E84D-4E08-AAD3-B5466F6EEF18@iago.org> References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> <09A9F6C4-E84D-4E08-AAD3-B5466F6EEF18@iago.org> Message-ID: >> Kai is still in the early stage, and we're now struggling with many >> issues. >> Sorry for the inconvenience. > > I didn't mean my comment as negative criticism of Kai, but rather just a > suggestion for a workaround. It's a nice first release -- there's no > need for any > apology. In fact, I may help you out with some of those issues > sometime soon. Oh, great! Thanks, we're expecting any help. > -Justin > > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Kai-users mailing list > Kai-users@REDACTED > https://lists.sourceforge.net/lists/listinfo/kai-users > -- Takeru INOUE From takeru.inoue@REDACTED Sun Jul 13 04:48:45 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sun, 13 Jul 2008 11:48:45 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> Message-ID: We know TokyoCabinet well, because it's developed in Japan. I think that TokyoCabinet has good performance in paralell access. Is paralell access allowed in tcerl? On Sun, Jul 13, 2008 at 3:34 AM, Paul Mineiro wrote: > We wrote a dets clone based upon tokyocabinet that does not have the file > size limitation, if kai needs scalable disk-based storage. > > http://code.google.com/p/tcerl/ > > -- p > > > On Sat, 12 Jul 2008, Ulf Wiger wrote: > >> Using 64-bit Erlang, ets is by no means limited to 2 GB >> (actually, it isn't in 32-bit erlang either. Dets is, however. >> The limitation for ets in 32-bit Erlang is the 4 GB address >> space.) >> >> See e.g. >> http://www1.erlang.org/pipermail/erlang-questions/2005-November/017728.html >> >> BR, >> Ulf W >> >> 2008/7/12 Justin Sheehy : >> > Lev, >> > >> > On Jul 12, 2008, at 7:51 AM, Lev Walkin wrote: >> > >> >> is it true that Kai has 2gigs limitation of ets? If yes, the >> >> claim that "Scales infinitely" is false. >> > >> > That's an incorrect conclusion. The capacity would be >> > (capacity per node) X (number of nodes) >> > >> > In a system like this you could add capacity by adding >> > more nodes, not only by making each node bigger. >> > >> > -Justin >> > >> > >> > _______________________________________________ >> > 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 >> > > In an artificial world, only extremists live naturally. > > -- Paul Graham > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Takeru INOUE From takeru.inoue@REDACTED Sun Jul 13 04:50:01 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Sun, 13 Jul 2008 11:50:01 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: <137EF930-BD21-497D-9D36-E174DE5396A7@apache.org> References: <137EF930-BD21-497D-9D36-E174DE5396A7@apache.org> Message-ID: > We are extremely interested in these kind of systems. > We, that are the CouchDB developers, sort of tackle > the same problem space, only from the other direction. > > Where Kai and Alexander Reinefeld (& co)'s work focus > on the distribution & fault tolerance, CouchDB aims to be > an attractive data store first. It is meant as an alternative > to the often wrongly (as in wrong tool for the job) used > RDBMSes. So CouchDB can be used standalone but > we are planning to have a fault tolerance layer on top > of CouchDB that deals with disappearing nodes and > all that. It would be really really cool if we could > collaborate on this. > > CouchDB comes with an HTTP interface, so is > accessible equally easy from all languages, > including Erlang, but it is not tied to Erlang. Since > such high availability systems are attractive for > homogenous environments, a well-known API > is a good idea and you certainly made a good > choice with the memcache API. CouchDB is getting well known in Japan, especially its sophisticated RESTful interface. This is because Yohei, who supervised a translation of "RESTful Web Services", is intrigued with CouchDB. > Is the interest in merging our systems mutual? This is interesting suggestion. We're now focusing on reliability and scalability, and keeping its interface simple; get(key) and put(key, value). But more complicated queries like CouchDB can be our future work, and it seems exciting. Of course, you can merge our code into CouchDB freely, since Kai is based on Apache License 2.0. > If there anything is you would like to know, do > not hesitate to contact me (here or in private if > preferred). > > Keep up the good work! > > Cheers > Jan > -- > > >> Kai is a distributed hashtable like Amazon's Dynamo. >> Dynamo is described in its original paper, as a highly available >> key-value storage system that some of Amazon's core services use to >> provide an "always-on" experience. >> Kai implements well-known memcache API, and you can access to Kai with >> your favorite programming language. >> >> Kai is hosted on sourceforge.net, where detailed information is found. >> >> http://kai.wiki.sourceforge.net/ >> >> Also, source code can be downloaded. >> >> http://sourceforge.net/project/showfiles.php?group_id=228337 >> >> If you are interested in Kai, read Getting Started and try it. >> >> http://kai.wiki.sourceforge.net/getting+started >> >> Regards, >> >> -- >> Takeru INOUE >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -- Takeru INOUE From justin@REDACTED Sun Jul 13 13:01:41 2008 From: justin@REDACTED (Justin Sheehy) Date: Sun, 13 Jul 2008 07:01:41 -0400 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo Message-ID: On Jul 12, 2008, at 10:50 PM, Takeru INOUE wrote: >> Is the interest in merging our systems mutual? > This is interesting suggestion. > We're now focusing on reliability and scalability, and keeping its > interface simple; get(key) and put(key, value). > But more complicated queries like CouchDB can be our future work, and > it seems exciting. I am also very interested in this suggestion, and can offer some help. When my team was beginning its current (not yet released) work, CouchDB was just seeing the light of day. I was intrigued, and discussed it with Damien as he was the sole developer at the time. I decided that while it was very interesting and I'd keep my eye on it, our operational needs for redundancy, scalability, and availability were not going to be high priorities in CouchDB anytime soon. As a result, we rolled our own internal solution to our storage problems. We are prepared to contribute some of the core missing pieces of Kai, which might cause this merge to happen sooner. For instance, we have working Erlang/OTP implementations of Lamport vector clocks, Merkle trees, and more. We are happy to provide these under the Apache License 2.0; it will just take a little bit of packaging as they have not been given away before. Over time, we would be happy to provide more contributions, as it would be very nice for a superset of our business needs to be supplied by an open source project we could use. We'll make some of the aforementioned code available soon in any case. If there is a real desire by the two projects to discuss merging sometime soon, we could also help with some of the needs that I am certain such a merger will have. -Justin From justin@REDACTED Sun Jul 13 13:07:44 2008 From: justin@REDACTED (Justin Sheehy) Date: Sun, 13 Jul 2008 07:07:44 -0400 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo Message-ID: On Jul 12, 2008, at 10:50 PM, Takeru INOUE wrote: > We're now focusing on reliability and scalability, and keeping its > interface simple; get(key) and put(key, value). > But more complicated queries like CouchDB can be our future work, and > it seems exciting. If you are to begin to have some of the same features as Dynamo such as write-availability via object versioning, the interface will have to get a little bit richer to indicate ancestor objects in put requests. Also, to get real value out of your R and W parameters you will need to move away from setting them globally for a whole cluster and instead make them per-request parameters. This is intended not as negative criticism of Kai but rather as pointers to some future changes you are likely to need in any case which will force you to think more about the client interface. Best, -Justin From jan@REDACTED Sun Jul 13 15:48:28 2008 From: jan@REDACTED (Jan Lehnardt) Date: Sun, 13 Jul 2008 15:48:28 +0200 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <137EF930-BD21-497D-9D36-E174DE5396A7@apache.org> Message-ID: > CouchDB is getting well known in Japan, especially its sophisticated > RESTful interface. > This is because Yohei, who supervised a translation of "RESTful Web > Services", is intrigued with CouchDB. Wow, this is cool :) Thanks for the info. >> Is the interest in merging our systems mutual? > > This is interesting suggestion. > We're now focusing on reliability and scalability, and keeping its > interface simple; get(key) and put(key, value). > But more complicated queries like CouchDB can be our future work, and > it seems exciting. With CouchDB we have such an easy interface, so connecting should be trivial: GET /database/key == get(key) PUT /database/key value (in the PUT request body) == put(key, value) CouchDB also has more API calls for querying and all that, but that could be independent of the fault tolerance layer you provide. At least at first, to make things easier. > Of course, you can merge our code into CouchDB freely, since Kai is > based on Apache License 2.0. We are not very keen on just taking some code that we'd then have to maintain ourselves (or we are just lazy :). The truth is though, that a database system is enough work in itself and if we could make our systems interoperable both our teams would benefit and have less work to do. It'd be great if we can work together. I'll forward this mail to the CouchDB developer list and will keep an eye on the Kai lists as well. Cheers Jan -- >> If there anything is you would like to know, do >> not hesitate to contact me (here or in private if >> preferred). >> >> Keep up the good work! >> >> Cheers >> Jan >> -- >> >> >>> Kai is a distributed hashtable like Amazon's Dynamo. >>> Dynamo is described in its original paper, as a highly available >>> key-value storage system that some of Amazon's core services use to >>> provide an "always-on" experience. >>> Kai implements well-known memcache API, and you can access to Kai >>> with >>> your favorite programming language. >>> >>> Kai is hosted on sourceforge.net, where detailed information is >>> found. >>> >>> http://kai.wiki.sourceforge.net/ >>> >>> Also, source code can be downloaded. >>> >>> http://sourceforge.net/project/showfiles.php?group_id=228337 >>> >>> If you are interested in Kai, read Getting Started and try it. >>> >>> http://kai.wiki.sourceforge.net/getting+started >>> >>> Regards, >>> >>> -- >>> Takeru INOUE >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> > > > > -- > Takeru INOUE > -------------- next part -------------- An HTML attachment was scrubbed... URL: From takeru.inoue@REDACTED Sun Jul 13 18:13:56 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 01:13:56 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: >>> Is the interest in merging our systems mutual? > >> This is interesting suggestion. >> We're now focusing on reliability and scalability, and keeping its >> interface simple; get(key) and put(key, value). >> But more complicated queries like CouchDB can be our future work, and >> it seems exciting. > > I am also very interested in this suggestion, and can offer some help. > > When my team was beginning its current (not yet released) work, CouchDB was > just seeing the light of day. I was intrigued, and discussed it with Damien > as he was the sole developer at the time. I decided that while it was very > interesting and I'd keep my eye on it, our operational needs for redundancy, > scalability, and availability were not going to be high priorities in > CouchDB anytime soon. As a result, we rolled our own internal solution to > our storage problems. > > We are prepared to contribute some of the core missing pieces of Kai, which > might cause this merge to happen sooner. For instance, we have working > Erlang/OTP implementations of Lamport vector clocks, Merkle trees, and more. > We are happy to provide these under the Apache License 2.0; it will just > take a little bit of packaging as they have not been given away before. What good news! We were seeking vector clocks and Merkle tree. > Over time, we would be happy to provide more contributions, as it would be > very nice for a superset of our business needs to be supplied by an open > source project we could use. > > We'll make some of the aforementioned code available soon in any case. If > there is a real desire by the two projects to discuss merging sometime soon, > we could also help with some of the needs that I am certain such a merger > will have. Thank you for the suggestion. But I don't know whether it is better to merge two projects, because current goals of the projects are a little bit different and systems will be complicated if merging. This is not as negative criticism, but I think that it is hard to merge the projects until both projects are getting stable (at least Kai is not stable :). Of course, I'd like to discuss elemental technologies, such as reliability and vector clocks. > -Justin > > > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Kai-users mailing list > Kai-users@REDACTED > https://lists.sourceforge.net/lists/listinfo/kai-users > -- Takeru INOUE From takeru.inoue@REDACTED Sun Jul 13 18:14:28 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 01:14:28 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: > If you are to begin to have some of the same features as Dynamo such as > write-availability via object versioning, the interface will have to get a > little bit richer to indicate ancestor objects in put requests. Yes. To represent some version information, Kai will support 'cas' of memcache API. With 'cas', a kind of version can be put in the request and response. This realizes optimistic lock. > Also, to get real value out of your R and W parameters you will need to move > away from setting them globally for a whole cluster and instead make them > per-request parameters. Good point. In the current implementation, parameters like R and W are configured per node basis. However, these parameters must be shared in the whole system. It's better to exchange the parameters before joining the system. > This is intended not as negative criticism of Kai but rather as pointers to > some future changes you are likely to need in any case which will force you > to think more about the client interface. > > Best, > > -Justin > > > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Kai-users mailing list > Kai-users@REDACTED > https://lists.sourceforge.net/lists/listinfo/kai-users > -- Takeru INOUE From takeru.inoue@REDACTED Sun Jul 13 18:15:58 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 01:15:58 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <137EF930-BD21-497D-9D36-E174DE5396A7@apache.org> Message-ID: As I mentioned in the reply to Justin, I'd like to discuss element technology such as reliability and vector clocks. I subscribed CouchDB developer list :-) On Sun, Jul 13, 2008 at 10:48 PM, Jan Lehnardt wrote: > CouchDB is getting well known in Japan, especially its sophisticated > RESTful interface. > This is because Yohei, who supervised a translation of "RESTful Web > Services", is intrigued with CouchDB. > > Wow, this is cool :) Thanks for the info. > > Is the interest in merging our systems mutual? > > This is interesting suggestion. > We're now focusing on reliability and scalability, and keeping its > interface simple; get(key) and put(key, value). > But more complicated queries like CouchDB can be our future work, and > it seems exciting. > > With CouchDB we have such an easy interface, so connecting should > be trivial: > GET /database/key == get(key) > PUT /database/key > value (in the PUT request body) == put(key, value) > CouchDB also has more API calls for querying and all that, > but that could be independent of the fault tolerance layer > you provide. At least at first, to make things easier. > > Of course, you can merge our code into CouchDB freely, since Kai is > based on Apache License 2.0. > > We are not very keen on just taking some code that we'd then have > to maintain ourselves (or we are just lazy :). The truth is though, that > a database system is enough work in itself and if we could make our > systems interoperable both our teams would benefit and have less > work to do. > It'd be great if we can work together. I'll forward this mail to the > CouchDB developer list and will keep an eye on the Kai lists as > well. > Cheers > Jan > -- > > If there anything is you would like to know, do > > not hesitate to contact me (here or in private if > > preferred). > > Keep up the good work! > > Cheers > > Jan > > -- > > > Kai is a distributed hashtable like Amazon's Dynamo. > > Dynamo is described in its original paper, as a highly available > > key-value storage system that some of Amazon's core services use to > > provide an "always-on" experience. > > Kai implements well-known memcache API, and you can access to Kai with > > your favorite programming language. > > Kai is hosted on sourceforge.net, where detailed information is found. > > http://kai.wiki.sourceforge.net/ > > Also, source code can be downloaded. > > http://sourceforge.net/project/showfiles.php?group_id=228337 > > If you are interested in Kai, read Getting Started and try it. > > http://kai.wiki.sourceforge.net/getting+started > > Regards, > > -- > > Takeru INOUE > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > -- > Takeru INOUE > > > -- Takeru INOUE From justin@REDACTED Sun Jul 13 19:31:20 2008 From: justin@REDACTED (Justin Sheehy) Date: Sun, 13 Jul 2008 13:31:20 -0400 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: Message-ID: On 7/13/08 12:14 PM, "Takeru INOUE" wrote: >> Also, to get real value out of your R and W parameters you will need to move >> away from setting them globally for a whole cluster and instead make them >> per-request parameters. > > Good point. > In the current implementation, parameters like R and W are configured > per node basis. > However, these parameters must be shared in the whole system. > It's better to exchange the parameters before joining the system. Actually, no. I meant somewhat the opposite. You want N to be shared across the system, but to be able to specify R or W on a per-request basis from each client. This way you can leave some of the CAP balancing to the specific application use. -Justin From justin@REDACTED Sun Jul 13 19:34:11 2008 From: justin@REDACTED (Justin Sheehy) Date: Sun, 13 Jul 2008 13:34:11 -0400 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: Message-ID: On 7/13/08 12:13 PM, "Takeru INOUE" wrote: > What good news! > We were seeking vector clocks and Merkle tree. I'll certainly let you know as soon as I have prepared a release, which should not take much work. The code already exists, it is just a matter of packaging and licensing. > But I don't know whether it is better to merge two projects, because > current goals of the projects are a little bit different and systems > will be complicated if merging. > This is not as negative criticism, but I think that it is hard to > merge the projects until both projects are getting stable (at least > Kai is not stable :). Of course. On that topic I was partially responding agreeably to Jan's idea and partially speculating about the future. > I'd like to discuss elemental technologies, such as > reliability and vector clocks I'm happy to discuss these any time. I have now joined the kai mailing lists -- but only the English versions. It looks like most of the conversation happens on the -jp lists, which I am sadly unable to read. -Justin From paul-trapexit@REDACTED Sun Jul 13 22:27:16 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sun, 13 Jul 2008 13:27:16 -0700 (PDT) Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> Message-ID: On Mon, 14 Jul 2008, Takeru INOUE wrote: > Thank you for detailed explanation. > I understand that tcerl has no disadvantage against dets in architectural point. > Don't you have any benchmark results? tcerl appears faster than dets on simple benchmarks (e.g., random inserts and deletes of random small (e.g, size (erlang:term_to_binary (X)) < 32) erlang terms), until the scale of the data gets to the point that the O (log N) loses to the O (1), which occurs around the 10 million record point, after which dets becomes progressively better at equality lookup. i say appears because i don't put much stock in such benchmarks, they never seem to correspond to actual usage. it was more for me to make sure i didn't do something horribly inefficient in the driver. our main motivation for tcerl was ordered_set on disk. we didn't have any particular performance difficulty with dets for equality queries, and the file size problem never really bothered us since we heavily use fragmented tables for availability and load balancing anyway. we just do alot of range queries in our particular application. > To make installation easy, we're planning to support dets or mnesia first. > But I'd like to support tcerl as next step for better performance. well, if you target mnesia, you can then use tcerl via the mnesia storage API extension. http://code.google.com/p/mnesiaex/ -- p From tpot@REDACTED Mon Jul 14 01:11:57 2008 From: tpot@REDACTED (Tim Potter) Date: Mon, 14 Jul 2008 09:11:57 +1000 Subject: [erlang-questions] System V IPC under Erlang? Message-ID: <1215990717.10289.5.camel@tigerella> Hi everyone. Before I go ahead and write my own port to System V IPC commands, does anyone know of an existing library that can access the POSIX System V IPC calls? Googling "erlang" and anything message related brings up a lot of hits. (-: (It wouldn't be my first choice for implementing inter-process communication but unfortunately I'm stuck with it now). Regards, Tim. From jeffm@REDACTED Mon Jul 14 02:56:03 2008 From: jeffm@REDACTED (jm) Date: Mon, 14 Jul 2008 10:56:03 +1000 Subject: [erlang-questions] erts inside a larger C program In-Reply-To: <4d08db370807120032k15d2f494q418bef7c73c99eda@mail.gmail.com> References: <48783C2D.1070804@ghostgun.com> <4d08db370807120032k15d2f494q418bef7c73c99eda@mail.gmail.com> Message-ID: <487AA423.6080607@ghostgun.com> This is my fall back position. The trouble with this is the coordination needed. If the GUI crashes the backend will still be running. There's also the problem of running with sockets exposed on multi-user machine. I suppose, just tinking aloud for a moment, the way to approach this is to start erlang and then have erlang execute an external program as a port and then this external program provides the GUI. Any scripts that the GUI wishes to execute would be sent to erlang executed as a monitored process and the results sent back to the GUI. If the GUI crashes erlang can catch it, possible do some diagnostics, and, if appropriate, execute a simple GUI to notify the user of the reason. Jeff. Hynek Vychodil wrote: > Is there any reason why your application can't work as erlang node > through ei interface instead be "inside"? Performance, shared memory? > From jeffm@REDACTED Mon Jul 14 02:56:05 2008 From: jeffm@REDACTED (jm) Date: Mon, 14 Jul 2008 10:56:05 +1000 Subject: [erlang-questions] erts inside a larger C program In-Reply-To: <4878A133.409@it.uu.se> References: <48783C2D.1070804@ghostgun.com> <4878A133.409@it.uu.se> Message-ID: <487AA425.9090708@ghostgun.com> Richard Carlsson wrote: > jm wrote: >> Is there any papers/article/web pages or other explainations floating >> around which explains the internals of the erlang virtual machine? >> Specifically the threading and anything about how it interacts with >> the OS and outside world. > > No, nothing so specific. You might get some hints from the papers > written by the HiPE group: http://www.it.uu.se/research/group/hipe/. > > I also found this nice litte blog entry: > http://erlangdotnet.net/2007/09/inside-beam-erlang-virtual-machine.html Found this one already. The Hipe group looks interesting. Lots of stuff. It may take me a bit of time to work out where to begin. Looking at the surface at least this materal could also be of interest to anyone thinking of developing a small erlang virtual machine for embedding in smaller memory footprint devices. Jeff. From dmitriid@REDACTED Mon Jul 14 08:40:27 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 14 Jul 2008 09:40:27 +0300 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> Message-ID: <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> On Jul 11, 2008, at 11:05 PM, Alain O'Dea wrote: > Interesting article. Thank you Lev. I had not realized the side- > effects were so severe, but upon review they make perfect sense. I > will use Reply All and maybe even get at the admins of other lists to > remove this reply-to munging. > Also try these: Reply-to considered useful: http://www.metasystema.net/essays/reply-to.mhtml Reply-to still considered harmful, really: http://woozle.org/~neale/papers/reply-to-still-harmful.html :) > On 10-Jul-08, at 10:59 PM, Lev Walkin wrote: > >> >> >> http://www.unicom.com/pw/reply-to-harmful.html >> >> >> Alain O'Dea wrote: >>> It looks like the list-serv for erlang-questions is leaving Reply- >>> To blank instead of setting or overriding it to be "erlang-questions@REDACTED >>> " as I would expect. This has lead me on multiple occasions to >>> reply to the poster directly instead of replying to the thread. I >>> find it very confusing. >>> Is erlang-questions setting Reply-To properly? >>> _______________________________________________ >>> 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 ok@REDACTED Mon Jul 14 08:41:21 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 14 Jul 2008 18:41:21 +1200 Subject: [erlang-questions] Current term representation? Message-ID: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> I have the Erlang sources and have a rough idea where to look, but life's a bit too short to reconstruct what someone already knows: What is the current term representation in Erlang? In particular, how are funs represented? Provided that a fun calls everything but built in functions through explicit module:calls, is it now safe to send a fun to another node? to save a fun in a data base and use it in a later session? -- "I don't want to discuss evidence." -- Richard Dawkins, in an interview with Rupert Sheldrake. (Fortean times 232, p55.) From jongretar@REDACTED Mon Jul 14 10:54:46 2008 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Mon, 14 Jul 2008 08:54:46 +0000 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> Message-ID: <4ecde87b0807140154y6e2a5cqed21c636ea06b092@mail.gmail.com> I actually still prefer Reply-To being set.The "Reply to all method" is flawed and in 99% of cases it forces extra work to do a simple thing. The simple fact is on almost all mail clients(every single one I have tried) this has the effect that you reply to the mail list and 99% that is exactly what you want to happen. Using "Reply to all" adds multiple addresses and I need to clear the senders email address because otherwise he would get duplicate emails. Which I think is just impolite plain and simple. After clearing the original senders email then one has to move the only email address you really want(namely erlang-questions@REDACTED) from CC to TO. The effect is that in some cases it takes even longer to muddle around with the email address field than writing the email itself. The simple fact is that most people expect to write to the list when hiting reply. It's what usually happens on most mailing lists. On Mon, Jul 14, 2008 at 6:40 AM, Dmitrii Dimandt wrote: > > On Jul 11, 2008, at 11:05 PM, Alain O'Dea wrote: > > > Interesting article. Thank you Lev. I had not realized the side- > > effects were so severe, but upon review they make perfect sense. I > > will use Reply All and maybe even get at the admins of other lists to > > remove this reply-to munging. > > > > > Also try these: > > Reply-to considered useful: > http://www.metasystema.net/essays/reply-to.mhtml > > Reply-to still considered harmful, really: > http://woozle.org/~neale/papers/reply-to-still-harmful.html > > > :) > > > > > > On 10-Jul-08, at 10:59 PM, Lev Walkin wrote: > > > >> > >> > >> http://www.unicom.com/pw/reply-to-harmful.html > >> > >> > >> Alain O'Dea wrote: > >>> It looks like the list-serv for erlang-questions is leaving Reply- > >>> To blank instead of setting or overriding it to be " > erlang-questions@REDACTED > >>> " as I would expect. This has lead me on multiple occasions to > >>> reply to the poster directly instead of replying to the thread. I > >>> find it very confusing. > >>> Is erlang-questions setting Reply-To properly? > >>> _______________________________________________ > >>> 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From camuig@REDACTED Mon Jul 14 10:59:07 2008 From: camuig@REDACTED (camui) Date: Mon, 14 Jul 2008 12:59:07 +0400 Subject: [erlang-questions] Problem with connection via ODBC Message-ID: <3df44f150807140159q129b297fyaf48f5da3e115b6a@mail.gmail.com> Dear Erlang Team! I have a problem with connection to the remote database via ODBC in Erlang. 1> odbc:connect("DSN=pg", [{scrollable_cursors, off}]). {error,{{badmatch,{error,eafnosupport}}, [{odbc,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}} The database is located on another machine in the local network. I have tried to connect to this database in the OpenOffice Base (using ODBC) and there are no problems. And I had not any troubles with connection in Erlang on the machine where database is located. May you help me, please? Andrey. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Jul 14 11:14:40 2008 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 14 Jul 2008 11:14:40 +0200 Subject: [erlang-questions] Problem with connection via ODBC In-Reply-To: <3df44f150807140159q129b297fyaf48f5da3e115b6a@mail.gmail.com> References: <3df44f150807140159q129b297fyaf48f5da3e115b6a@mail.gmail.com> Message-ID: <14f0e3620807140214g150cbbe3j5bf096f6c4334f8a@mail.gmail.com> 2008/7/14 camui : > Dear Erlang Team! > > I have a problem with connection to the remote database via ODBC in Erlang. > > 1> odbc:connect("DSN=pg", [{scrollable_cursors, off}]). > {error,{{badmatch,{error,eafnosupport}}, > [{odbc,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}} > > The database is located on another machine in the local network. > I have tried to connect to this database in the OpenOffice Base (using ODBC) > and there are no problems. And I had not any troubles with connection in > Erlang on the machine where database is located. > > May you help me, please? > > Andrey. Hi, Quick search about "eafnosupport" (which, as can be read from this error log, is the error "code") reveals: "This is an error you get when you try to connect(2) or bind(2) a socket to an address where that address doesn't make sense. " and "Either way the programmer screwed up." So it may be bug in ODBC or i are using it in a wrong way :) -- Gleb Peregud http://gleber.pl/ Every minute is to be grasped. Time waits for nobody. -- Inscription on a Zen Gong From s.egner@REDACTED Mon Jul 14 11:35:56 2008 From: s.egner@REDACTED (Sebastian Egner) Date: Mon, 14 Jul 2008 11:35:56 +0200 Subject: [erlang-questions] Erlang on Windows NT4 Message-ID: <487B1DFC.5050001@specs.de> Hello, As the release notes for Erts 5.6.1 report under Section 1.4.1 "Improvements and New Features", Windows NT4 is not supported any longer by Erlang/OTP, i.e. from R12B incl. Indeed, trying to install Erlang/OTP R12B-3 on a Windows-NT4 system reports: "The procedure entry point GetLongPathNameW could not be located in the dynamic link library KERNEL32.dll", without any indication that this Windows OS is not supported, and no Erlang VM can be run. Is this a bug, or does the NSIS installer simply not test for the version of the operating system? More important, however, is my related question: *Are there any plans to support Windows NT4 again in the future?* Let me briefly explain the background of this question: In November 2007 our company (SPECS GmbH) decided to invest in Erlang as a future platform for controlling our products, which are serious machines (up to 2.5 M$) for studying the physical properties of solid surfaces. Our current software is a huge thing in Visual C++ 6.0, glued together with CORBA and the Windows Registry. So far, our findings of using Erlang/OTP are extremely encouraging. We have been able to interface with other parts of the software using CORBA and Erlinterface with very little effort, and could write a layered system of drivers for ion guns, x-ray guns, etc. in a very convenient and efficient fashion. (For the GUI we use Java/SWT.) Unfortunately, our customers usually retire their old desktop PCs to their laboratories, and expect our software to run on these platforms. In addition, we have lots of customers in countries where people cannot afford to follow Microsoft's pace of product introduction, and generally do not upgrade their PCs every year. Using a non-Microsoft OS is also not an option, because our customers use other software with severe Microsoft lock-in for interpreting their experimental data. Now if R11B-5 will be the last version to support Windows NT4, we have a very serious problem with Erlang/OTP---in particular, because two significant bugs ('ic' generating unusable code and Erlinterface not being able to communicate 0.0 correctly) that I had reported in R11B-5 are only fixed in R12B, which came out 5-Dec-2007 and doesn't run on NT4 anymore (as I was surprised to learn today). What advice would you give me on this situation? Sebastian P.S. Excuse me if you had this discussion already, and are tired of it being iterated at such a late point in time. -- Dr. Sebastian Egner Head of Software & Electronics Development SPECS GmbH Voltastr. 5 13355 Berlin Germany Phone: +49 (0)30 46 78 24 - 9210 Fax: +49 (0)30 46 42 083 E-Mail: s.egner@REDACTED Please visit www.specs.de SPECS - YOUR COMPETENT PARTNER IN SURFACE ANALYSIS ---------------------------------------------------- SPECS Gesellschaft f?r Oberfl?chenanalytik und Computertechnologie mbH, CEO: Reinhard Lembke Registered Office: Berlin Companies Commercial Register No.: 93 HRB 21390 Register Court: Charlottenburg ----------------------------------------------------- This e-mail contains confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. From jongretar@REDACTED Mon Jul 14 12:09:30 2008 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Mon, 14 Jul 2008 10:09:30 +0000 Subject: [erlang-questions] Erlang on Windows NT4 In-Reply-To: <487B1DFC.5050001@specs.de> References: <487B1DFC.5050001@specs.de> Message-ID: <4ecde87b0807140309x57104f02m9161c2ca5b806a98@mail.gmail.com> I think it's not realistic to expect an OS that has not been sold for 10 years to be supported. Simply getting it somewhere to test it is a major problem. As is getting hardware old enough so that NT4 runs.No new software runs on NT4 and I highly reccomend that you stop supporting it too. On Mon, Jul 14, 2008 at 9:35 AM, Sebastian Egner wrote: > Hello, > > As the release notes for Erts 5.6.1 report under Section 1.4.1 > "Improvements and New Features", > Windows NT4 is not supported any longer by Erlang/OTP, i.e. from R12B incl. > > Indeed, trying to install Erlang/OTP R12B-3 on a Windows-NT4 system > reports: > > "The procedure entry point GetLongPathNameW could not be located in > the dynamic link library KERNEL32.dll", > > without any indication that this Windows OS is not supported, and no > Erlang VM can be run. > > Is this a bug, or does the NSIS installer simply not test for the > version of the operating system? > > > More important, however, is my related question: > > *Are there any plans to support Windows NT4 again in the future?* > > Let me briefly explain the background of this question: In November 2007 > our company (SPECS GmbH) > decided to invest in Erlang as a future platform for controlling our > products, which are serious machines (up > to 2.5 M$) for studying the physical properties of solid surfaces. Our > current software is a huge thing in Visual > C++ 6.0, glued together with CORBA and the Windows Registry. So far, our > findings of using Erlang/OTP are > extremely encouraging. We have been able to interface with other parts > of the software using CORBA and > Erlinterface with very little effort, and could write a layered system > of drivers for ion guns, x-ray guns, etc. in > a very convenient and efficient fashion. (For the GUI we use Java/SWT.) > > Unfortunately, our customers usually retire their old desktop PCs to > their laboratories, and expect our > software to run on these platforms. In addition, we have lots of > customers in countries where people > cannot afford to follow Microsoft's pace of product introduction, and > generally do not upgrade their > PCs every year. Using a non-Microsoft OS is also not an option, because > our customers use other > software with severe Microsoft lock-in for interpreting their > experimental data. > > Now if R11B-5 will be the last version to support Windows NT4, we have a > very serious problem with > Erlang/OTP---in particular, because two significant bugs ('ic' > generating unusable code and Erlinterface > not being able to communicate 0.0 correctly) that I had reported in > R11B-5 are only fixed in R12B, > which came out 5-Dec-2007 and doesn't run on NT4 anymore (as I was > surprised to learn today). > > What advice would you give me on this situation? > > Sebastian > > P.S. Excuse me if you had this discussion already, and are tired of it > being iterated at such a late point in time. > > -- > > Dr. Sebastian Egner > Head of Software & > Electronics Development > > SPECS GmbH > Voltastr. 5 > 13355 Berlin > Germany > > Phone: +49 (0)30 46 78 24 - 9210 > Fax: +49 (0)30 46 42 083 > E-Mail: s.egner@REDACTED > > Please visit www.specs.de > > SPECS - YOUR COMPETENT PARTNER IN SURFACE ANALYSIS > ---------------------------------------------------- > SPECS Gesellschaft f?r Oberfl?chenanalytik und > Computertechnologie mbH, CEO: Reinhard Lembke > Registered Office: Berlin > Companies Commercial Register No.: 93 HRB 21390 > Register Court: Charlottenburg > ----------------------------------------------------- > This e-mail contains confidential and/or privileged > information. If you are not the intended recipient > (or have received this e-mail in error) please notify > the sender immediately and delete this e-mail. Any > unauthorized copying, disclosure or distribution of > the material in this e-mail is strictly forbidden. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From doug.mansell@REDACTED Mon Jul 14 12:24:31 2008 From: doug.mansell@REDACTED (doug mansell) Date: Mon, 14 Jul 2008 12:24:31 +0200 Subject: [erlang-questions] [erlang-bugs] Erlang on Windows NT4 In-Reply-To: <487B1DFC.5050001@specs.de> References: <487B1DFC.5050001@specs.de> Message-ID: On Mon, Jul 14, 2008 at 11:35 AM, Sebastian Egner wrote: > Now if R11B-5 will be the last version to support Windows NT4, we have a > very serious problem with > Erlang/OTP---in particular, because two significant bugs ('ic' > generating unusable code and Erlinterface > not being able to communicate 0.0 correctly) that I had reported in > R11B-5 are only fixed in R12B, > which came out 5-Dec-2007 and doesn't run on NT4 anymore (as I was > surprised to learn today). > > What advice would you give me on this situation? Look into how you would patch R12B to avoid the use of GetLongPathName. Or... try taking the ic app from R12B back to R11B - that should be easy enough to try. I've never used Erlinterface, so can't offer advice with that. doug From jachym.holecek@REDACTED Mon Jul 14 15:04:41 2008 From: jachym.holecek@REDACTED (Jachym Holecek) Date: Mon, 14 Jul 2008 15:04:41 +0200 Subject: [erlang-questions] [PATCH] compiler 'log' option Message-ID: Hello, the attached patch (against R12B3) adds compiler 'log' option that causes compiler to dump detailed info about all compile passes to ${source}.log. This is useful if you want to track code transforms (which in turn is useful when one wants to learn about compiler internals). The output file is , of course, file:consult()able. I'm aware the compiler already has options to dump some specific passes (short-circuiting compilation as a side-effect), what I was after was a complete log of all transformations during full build cycle. I guess this could be of use to some people out there... -- Jachym PS: I wanted to patch the documentation as well, but I don't know what's the primary source thereof? -------------- next part -------------- A non-text attachment was scrubbed... Name: compile.erl.diff Type: application/octet-stream Size: 2700 bytes Desc: not available URL: From s.egner@REDACTED Mon Jul 14 15:57:35 2008 From: s.egner@REDACTED (Sebastian Egner) Date: Mon, 14 Jul 2008 15:57:35 +0200 Subject: [erlang-questions] Erlang on Windows NT4 In-Reply-To: References: <487B1DFC.5050001@specs.de> Message-ID: <487B5B4F.5040508@specs.de> Hello Niclas, > * "If an inherited function name begun with a capital letter the > generated stub/skeleton oe_tc/1 function was incorrect." This is the one you kindly fixed for me. :-) > > * "Insufficient buffer allocated when passing wide strings using the > C backend on a 64-bit architecture." No problem with that... > I assume that the latter doesn't affect you. The last time we e-mailed > (Oct 2007) it concerned if IC support recursive types, which it > doesn't. Have you been in touch with someone else regarding, for > example, IC/Erl_interface? I just looked it up. The bug was in Jinterface, not in Erl_interface (sorry for the mistake). My original posting to erlang-bugs was in Digest Vol 77, Issue 1, and the person with whom I was in touch is Raimo Niskanen. Sebastian. From takeru.inoue@REDACTED Mon Jul 14 16:08:51 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 23:08:51 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: >> In the current implementation, parameters like R and W are configured >> per node basis. >> However, these parameters must be shared in the whole system. >> It's better to exchange the parameters before joining the system. > > Actually, no. I meant somewhat the opposite. > > You want N to be shared across the system, but to be able to specify R or W > on a per-request basis from each client. This way you can leave some of the > CAP balancing to the specific application use. I had no idea to specify R or W per a request and there seems to be technical difficulties, but is attractive for some application. I'll add it to our TODO list. Thanks. > -Justin > > > -- Takeru INOUE From takeru.inoue@REDACTED Mon Jul 14 16:09:26 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 23:09:26 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: >> What good news! >> We were seeking vector clocks and Merkle tree. > > I'll certainly let you know as soon as I have prepared a release, which > should not take much work. The code already exists, it is just a matter of > packaging and licensing. Thanks a lot. We're looking forward to hearing good news. >> But I don't know whether it is better to merge two projects, because >> current goals of the projects are a little bit different and systems >> will be complicated if merging. >> This is not as negative criticism, but I think that it is hard to >> merge the projects until both projects are getting stable (at least >> Kai is not stable :). > > Of course. On that topic I was partially responding agreeably to Jan's idea > and partially speculating about the future. > >> I'd like to discuss elemental technologies, such as >> reliability and vector clocks > > I'm happy to discuss these any time. I have now joined the kai mailing > lists -- but only the English versions. It looks like most of the > conversation happens on the -jp lists, which I am sadly unable to read. This is because all developers are Japanese. I guess that most of discussions are in Japanese in the meantime, but I'll translate and forward it to English lists when big news come. > -Justin > > > -- Takeru INOUE From takeru.inoue@REDACTED Mon Jul 14 16:09:52 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Mon, 14 Jul 2008 23:09:52 +0900 Subject: [erlang-questions] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: <48789AB1.3030301@lionet.info> <99876260-9798-4568-8700-CCFF7B491127@iago.org> <8209f740807120615p14099e52p66f6e183780fb165@mail.gmail.com> Message-ID: >> Thank you for detailed explanation. >> I understand that tcerl has no disadvantage against dets in architectural point. >> Don't you have any benchmark results? > > tcerl appears faster than dets on simple benchmarks (e.g., random inserts > and deletes of random small (e.g, size (erlang:term_to_binary (X)) < 32) > erlang terms), until the scale of the data gets to the point that the O > (log N) loses to the O (1), which occurs around the 10 million record > point, after which dets becomes progressively better at equality lookup. i > say appears because i don't put much stock in such benchmarks, they never > seem to correspond to actual usage. it was more for me to make sure i > didn't do something horribly inefficient in the driver. > > our main motivation for tcerl was ordered_set on disk. we didn't have any > particular performance difficulty with dets for equality queries, and the > file size problem never really bothered us since we heavily use fragmented > tables for availability and load balancing anyway. we just do alot of > range queries in our particular application. I understood performance characteristics of dets and tecrl. These discussions are quite helpful for us. >> To make installation easy, we're planning to support dets or mnesia first. >> But I'd like to support tcerl as next step for better performance. > > well, if you target mnesia, you can then use tcerl via the mnesia storage > API extension. > > http://code.google.com/p/mnesiaex/ Cool, tecrl has mnesia API. > -- p > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Takeru INOUE From sverker@REDACTED Mon Jul 14 16:20:53 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 14 Jul 2008 16:20:53 +0200 Subject: [erlang-questions] Are you using {packet, http} ? Message-ID: <487B60C5.4030800@erix.ericsson.se> A message from the OTP team: There is an undocumented socket packet mode that provides HTTP parsing. We are planning to make this packet mode official and possibly also change the format of the tuples returned in this mode. One current big user is the web server Yaws. We would like to know of other applications using this HTTP mode and what kind of impact such an incompatible change would have. A socket using {packet, http} returns tuples like this in *passive* mode: {ok, {http_request, ...}} {ok, {http_response, ...}} {ok, {http_header, ...}} and tuples like this in *active* mode: {http_request, Socket, ...} {http_response, Socket, ...} {http_header, Socket, ...} The proposed change would only affect the active mode like this: {http, Socket, {http_request, ...}} {http, Socket, {http_response, ...}} {http, Socket, {http_header, ...}} The purpose is to make the inner tuples look the same regardless of how they were received. This would simplify both the implementation and the documentation as well as any applications using both receive modes. Applications only using http in passive mode (like Yaws) will not be affected. Am I stirring up any worried http-users out there? /Sverker, Erlang/OTP Ericsson From hans.huebner@REDACTED Mon Jul 14 16:41:29 2008 From: hans.huebner@REDACTED (Hans Huebner) Date: Mon, 14 Jul 2008 16:41:29 +0200 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> Message-ID: On Mon, Jul 14, 2008 at 16:20, Sverker Eriksson wrote: > A message from the OTP team: > > There is an undocumented socket packet mode that provides HTTP parsing. [...] > Am I stirring up any worried http-users out there? I am currently looking into Erlang because I need a web server front end that multiplexes many external connections to one HTTP backend server on a single persistent HTTP/1.1 connection. I was about to ask in this list if there are any http client and server libraries that I could use, and if I understand your message correctly, the HTTP packet modes are just what I need. So: I can't be stirred up, but I'd really like to play around with this, so if you can point me to source code or anything else that might help me understand of to put sockets into HTTP packet mode, I'd greatly appreciate it. Thanks, Hans From justin@REDACTED Mon Jul 14 16:52:08 2008 From: justin@REDACTED (Justin Sheehy) Date: Mon, 14 Jul 2008 10:52:08 -0400 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> Message-ID: Sverker, Mochiweb also uses the undocumented http mode for sockets. I think (offhand, without checking) that it uses it in passive mode and wouldn't care about the change, but you may want to get one of the mochiweb developers would need to chime in as an authoritative voice. But as a heavy user of mochiweb I wanted to make sure that you were aware of it as another implementation relying on this. I'm very glad you're making it official. It's a great feature. Thanks! -Justin On 7/14/08 10:20 AM, "Sverker Eriksson" wrote: > A message from the OTP team: > > There is an undocumented socket packet mode that provides HTTP parsing. > We are planning to make this packet mode official and possibly also > change the format of the tuples returned in this mode. One current big > user is the web server Yaws. We would like to know of other applications > using this HTTP mode and what kind of impact such an incompatible change > would have. > > A socket using {packet, http} returns tuples like this in *passive* mode: > > {ok, {http_request, ...}} > {ok, {http_response, ...}} > {ok, {http_header, ...}} > > > and tuples like this in *active* mode: > > {http_request, Socket, ...} > {http_response, Socket, ...} > {http_header, Socket, ...} > > > The proposed change would only affect the active mode like this: > > {http, Socket, {http_request, ...}} > {http, Socket, {http_response, ...}} > {http, Socket, {http_header, ...}} > > > The purpose is to make the inner tuples look the same regardless of how > they were received. This would simplify both the implementation and the > documentation as well as any applications using both receive modes. > Applications only using http in passive mode (like Yaws) will not be > affected. > > Am I stirring up any worried http-users out there? > > /Sverker, Erlang/OTP Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chsu79@REDACTED Mon Jul 14 17:07:39 2008 From: chsu79@REDACTED (Christian S) Date: Mon, 14 Jul 2008 17:07:39 +0200 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> Message-ID: > Am I stirring up any worried http-users out there? I checked "iserve", it does passive http sockets. If it does active once somewhere that is a very simple change anyway. From r.kelsall@REDACTED Mon Jul 14 17:23:09 2008 From: r.kelsall@REDACTED (Richard Kelsall) Date: Mon, 14 Jul 2008 16:23:09 +0100 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <487B6F5D.5080708@millstream.com> Sverker Eriksson wrote: > There is an undocumented socket packet mode that provides HTTP parsing. > We are planning to make this packet mode official and possibly also > change the format of the tuples returned in this mode. ... > Am I stirring up any worried http-users out there? This is great. Thank you. I am not using it yet but have played around with the simple program here : http://www.trapexit.org/A_fast_web_server_demonstrating_some_undocumented_Erlang_features that I think uses it : "The notable thing about this code is the use of undocumented socket options to set up the initial state of connections made to the web server port. {backlog, 30} specifies the length of the OS accept queue. {packet, http} puts the socket into http mode. ..." I hope to get round to using this program at some point. I vote in favour of any improvements you want to make. Richard. From bob@REDACTED Mon Jul 14 18:54:59 2008 From: bob@REDACTED (Bob Ippolito) Date: Mon, 14 Jul 2008 09:54:59 -0700 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <6a36e7290807140954x90ac78fp136fb76ea8ffe378@mail.gmail.com> mochiweb does indeed use {packet, http} only in passive mode. On Mon, Jul 14, 2008 at 7:52 AM, Justin Sheehy wrote: > Sverker, > > Mochiweb also uses the undocumented http mode for sockets. > > I think (offhand, without checking) that it uses it in passive mode and > wouldn't care about the change, but you may want to get one of the mochiweb > developers would need to chime in as an authoritative voice. But as a heavy > user of mochiweb I wanted to make sure that you were aware of it as another > implementation relying on this. > > I'm very glad you're making it official. It's a great feature. > > Thanks! > > -Justin > > > > On 7/14/08 10:20 AM, "Sverker Eriksson" wrote: > >> A message from the OTP team: >> >> There is an undocumented socket packet mode that provides HTTP parsing. >> We are planning to make this packet mode official and possibly also >> change the format of the tuples returned in this mode. One current big >> user is the web server Yaws. We would like to know of other applications >> using this HTTP mode and what kind of impact such an incompatible change >> would have. >> >> A socket using {packet, http} returns tuples like this in *passive* mode: >> >> {ok, {http_request, ...}} >> {ok, {http_response, ...}} >> {ok, {http_header, ...}} >> >> >> and tuples like this in *active* mode: >> >> {http_request, Socket, ...} >> {http_response, Socket, ...} >> {http_header, Socket, ...} >> >> >> The proposed change would only affect the active mode like this: >> >> {http, Socket, {http_request, ...}} >> {http, Socket, {http_response, ...}} >> {http, Socket, {http_header, ...}} >> >> >> The purpose is to make the inner tuples look the same regardless of how >> they were received. This would simplify both the implementation and the >> documentation as well as any applications using both receive modes. >> Applications only using http in passive mode (like Yaws) will not be >> affected. >> >> Am I stirring up any worried http-users out there? >> >> /Sverker, Erlang/OTP Ericsson >> >> _______________________________________________ >> 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 toby@REDACTED Mon Jul 14 19:22:03 2008 From: toby@REDACTED (Toby Thain) Date: Mon, 14 Jul 2008 14:22:03 -0300 Subject: [erlang-questions] [erlang-bugs] Erlang on Windows NT4 In-Reply-To: <487B1DFC.5050001@specs.de> References: <487B1DFC.5050001@specs.de> Message-ID: <6BC376B6-590B-40AB-B08E-055E389E61AF@telegraphics.com.au> On 14-Jul-08, at 6:35 AM, Sebastian Egner wrote: > ... > *Are there any plans to support Windows NT4 again in the future?* > > Let me briefly explain the background of this question: ... > software with severe Microsoft lock-in for interpreting their > experimental data. You certainly have my sympathy. > > Now if R11B-5 will be the last version to support Windows NT4, we > have a > very serious problem with > Erlang/OTP---in particular, because two significant bugs ('ic' > generating unusable code and Erlinterface > not being able to communicate 0.0 correctly) that I had reported in > R11B-5 are only fixed in R12B, > which came out 5-Dec-2007 and doesn't run on NT4 anymore (as I was > surprised to learn today). > > What advice would you give me on this situation? Paid support should achieve what you need? --Toby > > Sebastian > From richardc@REDACTED Mon Jul 14 20:23:27 2008 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 14 Jul 2008 20:23:27 +0200 Subject: [erlang-questions] Current term representation? In-Reply-To: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> References: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> Message-ID: <487B999F.2090504@it.uu.se> Richard A. O'Keefe wrote: > I have the Erlang sources and have a rough idea where to > look, but life's a bit too short to reconstruct what someone > already knows: > > What is the current term representation in Erlang? Look in the file erts/emulator/beam/erl_term.h for the tag scheme; the comments are fairly detailed. > In particular, how are funs represented? Actual fun-objects are created by the C function new_fun() in the file erts/emulator/beam/beam_emu.c. The definition of the struct ErlFunThing is found in the file erts/emulator/beam/erl_fun.h. > Provided that a fun calls everything but built in functions > through explicit module:calls, is it now safe to send a fun > to another node? to save a fun in a data base and use it in > a later session? The new 'fun Module:Function/Arity' funs are purely symbolic representations and are always safe to store and pass around. The "normal" kind of funs, however, are always associated with the module in which they occurred syntactically - they contain a pointer to code in a particular (loaded) version of that module (the version that some process was running in when it created that fun-instance object). - If a version of a module is unloaded from the system, then any process that holds pointers to that code (be it funs or return addresses on the process' stack) will be killed to avoid dangling pointers. - It is always "safe" to send a fun to another node if it is not actually called by code on that node. If it gets sent back to the original node, all information should be preserved so that it can be applied locally again, as if it had just gone through binary_to_term(term_to_binary(Fun)). - If it is called by code running on the remote node, then it depends on whether or not the exact matching module exists also on that node. The details of what a "match" is are a bit fuzzy. This is a rather dark corner of Erlang's semantics, and is bogged down with historical reasons and issues of backwards compatibility when communicating between nodes that do not run the same version of the runtime system. - In general, if a fun-object is recreated from a binary representation when no matching version of the parent module exists on the local system, (I think that) what happens is that the fun is made to point to a stub that will cause an error if the fun is ever called. Hence, passing it around should remain safe, but if you dig out an ancient fun from an ETS table, you will not be able to call it. (Bj?rn G. should know the details, but I think he's on vacation.) /Richard Carlsson -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From nicola.lugato@REDACTED Mon Jul 14 20:36:45 2008 From: nicola.lugato@REDACTED (Nicola Lugato) Date: Mon, 14 Jul 2008 20:36:45 +0200 Subject: [erlang-questions] SSL: SSL_set_verify callback In-Reply-To: <59bbf6e10807091216u45f11428o2dacb511205c08a6@mail.gmail.com> References: <59bbf6e10807090204o3af06460q22aaadf29ac9cf02@mail.gmail.com> <4875062F.3050607@free.fr> <59bbf6e10807091216u45f11428o2dacb511205c08a6@mail.gmail.com> Message-ID: <59bbf6e10807141136j7c5aa88bqfb638db6a737081b@mail.gmail.com> igwan, how do you accept generic connections? i'm making some tests but even with verify=0 it search the cacert file and reject any attempt with the following error: ** exited: {{badmatch,{error,'unknown:0'}}, [{client_server,start,1}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** On Wed, Jul 9, 2008 at 9:16 PM, Nicola Lugato wrote: > Hi igwan, > that's exacly what i have to do, testing the hash of the certificate against > a database, but i need to block them at the accept phase, not after > connection. > Thanks. > > On Wed, Jul 9, 2008 at 8:40 PM, igwan wrote: >> >> Hi, >> >> I don't know if it fits your goals exactly but you could use >> ssl:peercert(Socket) when connection is established and drop it if >> appropriate. I used this to match (a MD5 of) the client's certificate >> against a list of permitted users in database. >> >> igwan >> >> Nicola Lugato wrote : >>> >>> Hello, >>> i'm considering porting some code of mine to erlang. It's a network >>> server that uses SSL. >>> It makes use of the callback that you can specify on SSL_set_verify (and >>> similar) to check if a peer is allowed to connect, based on data in its >>> certificate. >>> >>> (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) >>> >>> I've checked the documentation of the SSL application in Erlang >>> (http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find a way >>> to supply such a callback. Is it possible? >>> This is a fundamental feature of my server so it would be a blocking >>> problem. >>> >>> Thanks, Nicola >> > > From klacke@REDACTED Mon Jul 14 20:45:13 2008 From: klacke@REDACTED (=?ISO-8859-1?Q?Claes_Wikstr=F6m?=) Date: Mon, 14 Jul 2008 20:45:13 +0200 Subject: [erlang-questions] Force HTTP to HTTPS in Yaws In-Reply-To: <4873E020.40704@rldn.net> References: <837D7894-C34F-41D6-8AE0-43D570CA2EFB@glaborg.com> <84d062da0807070638t5d6305f8t8bf41970bddbc186@mail.gmail.com> <91AD8385-2841-4ABF-8634-296658604B4F@glaborg.com> <4873E020.40704@rldn.net> Message-ID: <487B9EB9.9020106@hyber.org> mog wrote: > | Isn't there a way to configure this in the Yaws config environment? (I > | believe this is > | just a setting, both in IIS and Apache for example..) Check man page for yaws.conf /klacke From valentin@REDACTED Mon Jul 14 20:33:37 2008 From: valentin@REDACTED (Valentin Micic) Date: Mon, 14 Jul 2008 20:33:37 +0200 Subject: [erlang-questions] Are you using {packet, http} ? References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <003401c8e5e0$23c7a2a0$6501a8c0@moneymaker2> I'm so glad taht I haven't been aware of this before. So glad that I am now ;-). V. PS Hope that {active, once} will be supported as per usual. ----- Original Message ----- From: "Sverker Eriksson" To: "erlang-questions" Sent: Monday, July 14, 2008 4:20 PM Subject: [erlang-questions] Are you using {packet, http} ? >A message from the OTP team: > > There is an undocumented socket packet mode that provides HTTP parsing. > We are planning to make this packet mode official and possibly also > change the format of the tuples returned in this mode. One current big > user is the web server Yaws. We would like to know of other applications > using this HTTP mode and what kind of impact such an incompatible change > would have. > > A socket using {packet, http} returns tuples like this in *passive* mode: > > {ok, {http_request, ...}} > {ok, {http_response, ...}} > {ok, {http_header, ...}} > > > and tuples like this in *active* mode: > > {http_request, Socket, ...} > {http_response, Socket, ...} > {http_header, Socket, ...} > > > The proposed change would only affect the active mode like this: > > {http, Socket, {http_request, ...}} > {http, Socket, {http_response, ...}} > {http, Socket, {http_header, ...}} > > > The purpose is to make the inner tuples look the same regardless of how > they were received. This would simplify both the implementation and the > documentation as well as any applications using both receive modes. > Applications only using http in passive mode (like Yaws) will not be > affected. > > Am I stirring up any worried http-users out there? > > /Sverker, Erlang/OTP Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From 0x6e6562@REDACTED Mon Jul 14 23:38:05 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Mon, 14 Jul 2008 22:38:05 +0100 Subject: [erlang-questions] Erlang implementation In-Reply-To: <8db62546-ac8d-4c17-b819-413aeab73a56@y38g2000hsy.googlegroups.com> References: <269388e30807081538q46537eake2e7d2b627a16452@mail.gmail.com> <8db62546-ac8d-4c17-b819-413aeab73a56@y38g2000hsy.googlegroups.com> Message-ID: <269388e30807141438h5549d287q412493fa77e3d590@mail.gmail.com> On Mon, Jul 14, 2008 at 5:00 PM, Tim Fletcher wrote: > >> If not, is anybody contemplating doing this before I start looking into this? > > I had a quick stab last week, but only just got around to tidying up > my code. > > Still incomplete, but it's a start: http://github.com/tim/erlang-protobuf/tree/master That's exactly reason why I let it go for a while because I was so sure that somebody would be working on it :-) BTW, I see you've made a few design decisions about how to build a proto compiler. Did you think it was going to be easier to write a parser in Erlang rather than re-target the C++ compiler for Erlang? Also, I see you've decide against using a parser generator - was there a reason why? Ben From samuel.tesla@REDACTED Tue Jul 15 00:05:23 2008 From: samuel.tesla@REDACTED (Samuel Tesla) Date: Mon, 14 Jul 2008 17:05:23 -0500 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <4ecde87b0807140154y6e2a5cqed21c636ea06b092@mail.gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> <4ecde87b0807140154y6e2a5cqed21c636ea06b092@mail.gmail.com> Message-ID: <5756CC69-4470-4DA7-8618-AD2681A1764B@gmail.com> Last I checked most mailing list software does not send a message to a recipient if they were already in the To:, Cc:, or Bcc: header. Or, at least most lists can be configured to have that behavior. I'd be interested to know if you received two copies of this message, as I hit "Reply All" in my mailer (Apple's Mail.app). -- Samuel On Jul 14, 2008, at 3:54 AM, Jon Gretar Borgthorsson wrote: > I actually still prefer Reply-To being set. > The "Reply to all method" is flawed and in 99% of cases it forces > extra work to do a simple thing. > The simple fact is on almost all mail clients(every single one I > have tried) this has the effect that you reply to the mail list and > 99% that is exactly what you want to happen. > Using "Reply to all" adds multiple addresses and I need to clear the > senders email address because otherwise he would get duplicate > emails. Which I think is just impolite plain and simple. After > clearing the original senders email then one has to move the only > email address you really want(namely erlang-questions@REDACTED) > from CC to TO. > > The effect is that in some cases it takes even longer to muddle > around with the email address field than writing the email itself. > > The simple fact is that most people expect to write to the list when > hiting reply. It's what usually happens on most mailing lists. > > On Mon, Jul 14, 2008 at 6:40 AM, Dmitrii Dimandt > wrote: > > On Jul 11, 2008, at 11:05 PM, Alain O'Dea wrote: > > > Interesting article. Thank you Lev. I had not realized the side- > > effects were so severe, but upon review they make perfect sense. I > > will use Reply All and maybe even get at the admins of other lists > to > > remove this reply-to munging. > > > > > Also try these: > > Reply-to considered useful: > http://www.metasystema.net/essays/reply-to.mhtml > > Reply-to still considered harmful, really: > http://woozle.org/~neale/papers/reply-to-still-harmful.html > > > :) > > > > > > On 10-Jul-08, at 10:59 PM, Lev Walkin wrote: > > > >> > >> > >> http://www.unicom.com/pw/reply-to-harmful.html > >> > >> > >> Alain O'Dea wrote: > >>> It looks like the list-serv for erlang-questions is leaving Reply- > >>> To blank instead of setting or overriding it to be "erlang-questions@REDACTED > >>> " as I would expect. This has lead me on multiple occasions to > >>> reply to the poster directly instead of replying to the thread. I > >>> find it very confusing. > >>> Is erlang-questions setting Reply-To properly? > >>> _______________________________________________ > >>> 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 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From alain.odea@REDACTED Tue Jul 15 02:14:44 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Mon, 14 Jul 2008 21:44:44 -0230 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <5756CC69-4470-4DA7-8618-AD2681A1764B@gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> <4ecde87b0807140154y6e2a5cqed21c636ea06b092@mail.gmail.com> <5756CC69-4470-4DA7-8618-AD2681A1764B@gmail.com> Message-ID: <4509F7B2-EE9D-477F-A55B-EAB39B34A0FA@gmail.com> No duplicates here. I'm sold on this. It is much better in retrospect. Command-Shift-R gives me Reply All on Apple Mail. I imagine a similarly simple shortcut exists in Evolution, KMail and Outlook. Not sure about Webmail, but you can subscribe to erlang-questions through Google Groups and avoid that aspect entirely. On 14-Jul-08, at 7:35 PM, Samuel Tesla wrote: > Last I checked most mailing list software does not send a message to > a recipient if they were already in the To:, Cc:, or Bcc: header. > Or, at least most lists can be configured to have that behavior. > > I'd be interested to know if you received two copies of this > message, as I hit "Reply All" in my mailer (Apple's Mail.app). > > -- Samuel > > On Jul 14, 2008, at 3:54 AM, Jon Gretar Borgthorsson wrote: > >> I actually still prefer Reply-To being set. >> The "Reply to all method" is flawed and in 99% of cases it forces >> extra work to do a simple thing. >> The simple fact is on almost all mail clients(every single one I >> have tried) this has the effect that you reply to the mail list and >> 99% that is exactly what you want to happen. >> Using "Reply to all" adds multiple addresses and I need to clear >> the senders email address because otherwise he would get duplicate >> emails. Which I think is just impolite plain and simple. After >> clearing the original senders email then one has to move the only >> email address you really want(namely erlang-questions@REDACTED) >> from CC to TO. >> >> The effect is that in some cases it takes even longer to muddle >> around with the email address field than writing the email itself. >> >> The simple fact is that most people expect to write to the list >> when hiting reply. It's what usually happens on most mailing lists. >> >> On Mon, Jul 14, 2008 at 6:40 AM, Dmitrii Dimandt >> wrote: >> >> On Jul 11, 2008, at 11:05 PM, Alain O'Dea wrote: >> >> > Interesting article. Thank you Lev. I had not realized the side- >> > effects were so severe, but upon review they make perfect sense. I >> > will use Reply All and maybe even get at the admins of other >> lists to >> > remove this reply-to munging. >> > >> >> >> Also try these: >> >> Reply-to considered useful: >> http://www.metasystema.net/essays/reply-to.mhtml >> >> Reply-to still considered harmful, really: >> http://woozle.org/~neale/papers/reply-to-still-harmful.html >> >> >> :) >> >> >> >> >> > On 10-Jul-08, at 10:59 PM, Lev Walkin wrote: >> > >> >> >> >> >> >> http://www.unicom.com/pw/reply-to-harmful.html >> >> >> >> >> >> Alain O'Dea wrote: >> >>> It looks like the list-serv for erlang-questions is leaving >> Reply- >> >>> To blank instead of setting or overriding it to be "erlang-questions@REDACTED >> >>> " as I would expect. This has lead me on multiple occasions to >> >>> reply to the poster directly instead of replying to the >> thread. I >> >>> find it very confusing. >> >>> Is erlang-questions setting Reply-To properly? >> >>> _______________________________________________ >> >>> 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 >> >> _______________________________________________ >> 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 macfisherman@REDACTED Tue Jul 15 02:57:58 2008 From: macfisherman@REDACTED (Jeff Macdonald) Date: Mon, 14 Jul 2008 20:57:58 -0400 Subject: [erlang-questions] Is erlang-questions setting Reply-To properly? In-Reply-To: <5756CC69-4470-4DA7-8618-AD2681A1764B@gmail.com> References: <21B51B25-C1CC-4350-90F3-0DE39976B05A@gmail.com> <4876B763.1090302@lionet.info> <29B7966F-3F9A-4279-B655-485D7C267C0C@gmail.com> <4ecde87b0807140154y6e2a5cqed21c636ea06b092@mail.gmail.com> <5756CC69-4470-4DA7-8618-AD2681A1764B@gmail.com> Message-ID: <45ae90370807141757j38115c17h46e3f0cfe4b58e78@mail.gmail.com> 2008/7/14 Samuel Tesla : > Last I checked most mailing list software does not send a message to a > recipient if they were already in the To:, Cc:, or Bcc: header. Or, at least > most lists can be configured to have that behavior. I _really_ wish that was a universal feature. It is nice this list does it. -- Jeff Macdonald Ayer, MA From ok@REDACTED Tue Jul 15 03:08:31 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 15 Jul 2008 13:08:31 +1200 Subject: [erlang-questions] Current term representation? In-Reply-To: <487B999F.2090504@it.uu.se> References: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> <487B999F.2090504@it.uu.se> Message-ID: <289FB224-03E0-4078-A835-5436F1837486@cs.otago.ac.nz> On 15 Jul 2008, at 6:23 am, Richard Carlsson wrote: > Look in the file erts/emulator/beam/erl_term.h for the tag > scheme; the comments are fairly detailed. I was aware of that file, but there is a lot of detail not explained, and there's one detail I have a hard time believing. Can it really be true that empty tuples {} are heap allocated "boxed" objects? > > > > In particular, how are funs represented? > > The definition of the struct ErlFunThing is found in the file > erts/emulator/beam/erl_fun.h. Thanks. I'd missed that one. As for the rest, it's what I _thought_ was the case, but I was hoping I was wrong. From tpot@REDACTED Tue Jul 15 04:17:32 2008 From: tpot@REDACTED (Tim Potter) Date: Tue, 15 Jul 2008 12:17:32 +1000 Subject: [erlang-questions] System V IPC under Erlang? In-Reply-To: <1215990717.10289.5.camel@tigerella> References: <1215990717.10289.5.camel@tigerella> Message-ID: <1216088252.9540.47.camel@tigerella> On Mon, 2008-07-14 at 09:11 +1000, Tim Potter wrote: > Hi everyone. Before I go ahead and write my own port to System V IPC > commands, does anyone know of an existing library that can access the > POSIX System V IPC calls? Googling "erlang" and anything message > related brings up a lot of hits. (-: > > (It wouldn't be my first choice for implementing inter-process > communication but unfortunately I'm stuck with it now). *crickets* Well, I've been meaning to figure out how to write driver processes anyway. So far writing an Erlang driver is very different from writing extensions to other languages like Perl and Python. Once it sunk in that there's a single message queue to communicate to the port driver process it all became much easier to understand. Tim. From camuig@REDACTED Tue Jul 15 07:15:03 2008 From: camuig@REDACTED (camui) Date: Tue, 15 Jul 2008 09:15:03 +0400 Subject: [erlang-questions] Problem with connection via ODBC In-Reply-To: <14f0e3620807140214g150cbbe3j5bf096f6c4334f8a@mail.gmail.com> References: <3df44f150807140159q129b297fyaf48f5da3e115b6a@mail.gmail.com> <14f0e3620807140214g150cbbe3j5bf096f6c4334f8a@mail.gmail.com> Message-ID: <3df44f150807142215re1450d8l5b5856974760d52e@mail.gmail.com> I have some doubt in that this is bug in ODBC, because I have no trouble with connection to the database from another applications (such as OpenOffice). This applications also use ODBC. 2008/7/14, Gleb Peregud : > > 2008/7/14 camui : > > > Dear Erlang Team! > > > > I have a problem with connection to the remote database via ODBC in > Erlang. > > > > 1> odbc:connect("DSN=pg", [{scrollable_cursors, off}]). > > {error,{{badmatch,{error,eafnosupport}}, > > [{odbc,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}} > > > > The database is located on another machine in the local network. > > I have tried to connect to this database in the OpenOffice Base (using > ODBC) > > and there are no problems. And I had not any troubles with connection in > > Erlang on the machine where database is located. > > > > May you help me, please? > > > > Andrey. > > > Hi, > > Quick search about "eafnosupport" (which, as can be read from this > error log, is the error "code") reveals: > > "This is an error you get when you try to connect(2) or bind(2) a > socket to an address where that address doesn't make sense. " > > and > > "Either way the programmer screwed up." > > So it may be bug in ODBC or i are using it in a wrong way :) > > > -- > 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 mikpe@REDACTED Tue Jul 15 10:56:22 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 15 Jul 2008 10:56:22 +0200 Subject: [erlang-questions] Current term representation? In-Reply-To: <289FB224-03E0-4078-A835-5436F1837486@cs.otago.ac.nz> References: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> <487B999F.2090504@it.uu.se> <289FB224-03E0-4078-A835-5436F1837486@cs.otago.ac.nz> Message-ID: <18556.26166.689862.600896@harpo.it.uu.se> Richard A. O'Keefe writes: > On 15 Jul 2008, at 6:23 am, Richard Carlsson wrote: > > Look in the file erts/emulator/beam/erl_term.h for the tag > > scheme; the comments are fairly detailed. > > I was aware of that file, but there is a lot of detail not > explained, and there's one detail I have a hard time believing. > Can it really be true that empty tuples {} are heap allocated > "boxed" objects? Yes. They always have been, ever before the "new" tag scheme. It's my impression that they're not common enough in Erlang to warrant an immediate type tag, unlike say SML which makes heavier use of empty tuples. Also, adding a special case to the tuple representation would no doubt complicate the runtime system's C code, or at least require a very careful audit. > > > In particular, how are funs represented? > > > > The definition of the struct ErlFunThing is found in the file > > erts/emulator/beam/erl_fun.h. > > Thanks. I'd missed that one. > > As for the rest, it's what I _thought_ was the case, but I was > hoping I was wrong. By "the rest" do you mean terms in general or just funs? If terms in general, what were you hoping to be wrong? From florian.ebeling@REDACTED Tue Jul 15 11:14:03 2008 From: florian.ebeling@REDACTED (Caspar Florian Ebeling) Date: Tue, 15 Jul 2008 11:14:03 +0200 Subject: [erlang-questions] erlang server process, how to stop it? Message-ID: <5cbbe4ae0807150214w723d4d77v225846785bae5161@mail.gmail.com> When I start an erlang process as a server, in the unix sense, what is the preferred way to stop it? I have an application callback module now, and I would like to have it perform shutdown handlers as well, but when I send an SIGTERM, erl goes away with an exit code != 0 and no handlers being invoked. Should I go over an -sname and do something pseudo-distrubuted to achieve that? Florian -- Florian Ebeling florian.ebeling@REDACTED From surindar.shanthi@REDACTED Tue Jul 15 12:08:53 2008 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Tue, 15 Jul 2008 15:38:53 +0530 Subject: [erlang-questions] Erlang ODBC with Postgres In-Reply-To: References: Message-ID: <42ea5fb60807150308k51148aa1kdb826c63d6750afc@mail.gmail.com> Dear Eugen Yu, In the mail thread, Eduardo has given the solution... Please go through the following link for more ideas.... http://www.erlang.org/pipermail/erlang-questions/2007-March/025606.html In my SQL DB, I have used NVARCHAR datatype. This type is not suppotred in Erlang ODBC. So, I have changed the type to VARCHAR which is supported in Erlang ODBC. Thus the problem is solved. Hope this helps. On Mon, Jul 14, 2008 at 3:59 AM, Eugen Hon Wai Yu wrote: > Hello Surindar, > > I have read your thread on the Erlang mailing list. > You have had some problem accessing a posgresql using the odbc module of > erlang. > Can you tell me how you solved the problem? > I am also trying to use a erlang's odbc module to access data of a postgres > server. > There is no problem with the integer however I cannot read string. > This is what I did: > > 1) Create schema > > odbc:start(), > {ok, Ref} = odbc:connect("DSN=MyDataSource", [{scrollable_cursors, off}]), > odbc:sql_query(Ref, > "CREATE TABLE EMPLOYEE (NR integer, FIRSTNAME > varchar(20), LASTNAME varchar(20), GENDER char(1),PRIMARY KEY(NR))"), > odbc:sql_query(Ref, "INSERT INTO EMPLOYEE VALUES(1, 'Jane', 'Doe', 'F')"), > odbc:stop(). > > With the squirrel jdbc client I can see that the schema has been created > and there is one row in it. > > 2) Now I try to read the data > > odbc:start(), > {ok, Ref} = odbc:connect("DSN=MyDataSource", [{scrollable_cursors, off}]), > X = odbc:sql_query(Ref, "SELECT FIRSTNAME FROM EMPLOYEE"), > odbc:disconnect(Ref), > odbc:stop(), > X. > > And I get is the infamous error: > {error,"Column type not supported"} > With the NR column there is no problem, but the other three columns return > the same error message. > Can you tell me how you have solved the problem? > > Alternatively please tell me if you know any other methods to access a > posgresql database. > Thanks for your attention. > Best regards > - Eugen Yu > > -- Thanks & Regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Mon Jul 14 17:07:30 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Tue, 15 Jul 2008 00:07:30 +0900 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: References: <487B60C5.4030800@erix.ericsson.se> Message-ID: Just in case you haven't seen this article on trapexit. Please see here: http://www.trapexit.org/A_fast_web_server_demonstrating_some_undocumented_Erlang_features On Mon, 14 Jul 2008 23:41:29 +0900, Hans Huebner wrote: > On Mon, Jul 14, 2008 at 16:20, Sverker Eriksson > wrote: >> A message from the OTP team: >> >> There is an undocumented socket packet mode that provides HTTP parsing. > [...] >> Am I stirring up any worried http-users out there? > > I am currently looking into Erlang because I need a web server front > end that multiplexes many external connections to one HTTP backend > server on a single persistent HTTP/1.1 connection. I was about to ask > in this list if there are any http client and server libraries that I > could use, and if I understand your message correctly, the HTTP packet > modes are just what I need. So: I can't be stirred up, but I'd > really like to play around with this, so if you can point me to source > code or anything else that might help me understand of to put sockets > into HTTP packet mode, I'd greatly appreciate it. > > Thanks, > Hans > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- norton@REDACTED From twoggle@REDACTED Tue Jul 15 13:52:25 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 15 Jul 2008 04:52:25 -0700 (PDT) Subject: [erlang-questions] Erlang implementation In-Reply-To: <269388e30807141438h5549d287q412493fa77e3d590@mail.gmail.com> References: <269388e30807081538q46537eake2e7d2b627a16452@mail.gmail.com> <8db62546-ac8d-4c17-b819-413aeab73a56@y38g2000hsy.googlegroups.com> <269388e30807141438h5549d287q412493fa77e3d590@mail.gmail.com> Message-ID: > BTW, I see you've made a few design decisions about how to build a > proto compiler. Quite possibly bad ones; i'm open to criticism/suggestions. > Did you think it was going to be easier to write a parser in Erlang > rather than re-target the C++ compiler for Erlang? I (gladly) have no experience with C++, so yes, the Erlang route is easier for me. > Also, I see you've decide against using a parser generator - was there > a reason why? Generally just a(nother) personal preference; I enjoy writing parsers more than I do messing around with grammars and generators. However, I didn't consciously make that decision in this case, so I might give yecc a try. From saleyn@REDACTED Tue Jul 15 13:28:03 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 15 Jul 2008 07:28:03 -0400 Subject: [erlang-questions] erlang server process, how to stop it? In-Reply-To: <5cbbe4ae0807150214w723d4d77v225846785bae5161@mail.gmail.com> References: <5cbbe4ae0807150214w723d4d77v225846785bae5161@mail.gmail.com> Message-ID: <487C89C3.4040203@gmail.com> I use a convenient erl_call utility under lib/erl_interface*/bin (I wish it was symlinked or placed under the bin folder) to shutdown a running node: erl_call -n $NODENAME -a 'init stop' Note that if this is run not on the same host as the node or if the $NODENAME is started with a custom COOKIE as an argument, you must supply the same cookie to erl_call. Serge Caspar Florian Ebeling wrote: > When I start an erlang process as a server, in the > unix sense, what is the preferred way to stop it? > I have an application callback module now, and > I would like to have it perform shutdown handlers > as well, but when I send an SIGTERM, erl > goes away with an exit code != 0 and no handlers > being invoked. > > Should I go over an -sname and do something > pseudo-distrubuted to achieve that? > > Florian From andrew.unit@REDACTED Tue Jul 15 15:46:11 2008 From: andrew.unit@REDACTED (Andrew Harris) Date: Tue, 15 Jul 2008 09:46:11 -0400 Subject: [erlang-questions] reducing size of erlang Message-ID: Hello, I'm new to erlang, but not new to functional programming. I am trying to compile erlang for the gumstix platform. I think I've got it compiled OK, but the bin/ and lib/ directories that are generated from make install are really big. I have read a few things on removing debugging info by adding an argument to each makefile in lib/, but this seems really tedious and I'm not sure how or where in the makefile to do this. I'm wondering if there is a command I can pass to configure or something that will remove the debugging info from the erlang build. Also, I'm building R10B-10 because this is the version I see some info on the web about how to build for a new platform. any help is appreciated, -andrew From matthias@REDACTED Tue Jul 15 19:47:33 2008 From: matthias@REDACTED (Matthias Lang) Date: Tue, 15 Jul 2008 19:47:33 +0200 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: Message-ID: <20080715174733.GA5396@contorpis.lisalinda.com> On Tuesday, July 15, Andrew Harris wrote: > I'm new to erlang, but not new to functional programming. I am > trying to compile erlang for the gumstix platform. I think I've got > it compiled OK, but the bin/ and lib/ directories that are generated > from make install are really big. I have read a few things on > removing debugging info by adding an argument to each makefile in > lib/, but this seems really tedious and I'm not sure how or where in > the makefile to do this. I'm wondering if there is a command I can > pass to configure or something that will remove the debugging info > from the erlang build. Also, I'm building R10B-10 because this is the > version I see some info on the web about how to build for a new > platform. Getting a basic, small Erlang down to 3MB is fairly straightforward. Is 3MB "really big". I don't know, you didn't give me any clues about what you were aiming for. 1. Add the +compressed and +slim flags to the build 2. Throw out all libraries you don't need. 3. Throw out all binaries you don't need. 4. Strip the remaining binaries. #1 is easily done by applying the attached patch (for R11, but the idea is the same) to a clean source tree. Clean means "before you run 'configure'". #2 is a bit more of a chore. "Really tedious", maybe. If you can muster the will to do it, a quick way is to zap all libraries _apart_ from: erlang/lib/erlang/lib/stdlib erlang/lib/erlang/lib/kernel erlang/lib/erlang/lib/sasl #3 is up to you. Chances are you don't need the dialyzer, epmd, erlc, beam.hybrid #4 should be obvious. You can, of course, do more for a bit more effort. But it sounded like you were struggling to make it from the couch to the fridge ;-) Matt -------------- next part -------------- --- otp.mk.in.orig 2007-01-16 00:05:19.000000000 +0100 +++ otp.mk.in 2007-01-16 00:06:22.000000000 +0100 @@ -69,21 +69,7 @@ # Erlang language section # ---------------------------------------------------- EMULATOR = beam -ifeq ($(findstring vxworks,$(TARGET)),vxworks) -# VxWorks object files should be compressed. -# Other object files should have debug_info. - ERL_COMPILE_FLAGS += +compressed -else - ifeq ($(findstring ose_ppc750,$(TARGET)),ose_ppc750) - ERL_COMPILE_FLAGS += +compressed - else - ifdef BOOTSTRAP - ERL_COMPILE_FLAGS += +slim - else - ERL_COMPILE_FLAGS += +debug_info - endif - endif -endif +ERL_COMPILE_FLAGS += +compressed +slim ERLC_WFLAGS = -W ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS) ERL = erl -boot start_clean From dmercer@REDACTED Tue Jul 15 21:00:39 2008 From: dmercer@REDACTED (David Mercer) Date: Tue, 15 Jul 2008 14:00:39 -0500 Subject: [erlang-questions] reducing size of erlang In-Reply-To: <20080715174733.GA5396@contorpis.lisalinda.com> References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: <00be01c8e6ad$1e140ba0$f21ea8c0@SSI.CORP> It was worth reading your whole post just to get to that last line... :-) > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Matthias Lang > Sent: Tuesday, July 15, 2008 12:48 > To: Andrew Harris > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] reducing size of erlang > > On Tuesday, July 15, Andrew Harris wrote: > > > I'm new to erlang, but not new to functional programming. I am > > trying to compile erlang for the gumstix platform. I think I've got > > it compiled OK, but the bin/ and lib/ directories that are generated > > from make install are really big. I have read a few things on > > removing debugging info by adding an argument to each makefile in > > lib/, but this seems really tedious and I'm not sure how or where in > > the makefile to do this. I'm wondering if there is a command I can > > pass to configure or something that will remove the debugging info > > from the erlang build. Also, I'm building R10B-10 because this is the > > version I see some info on the web about how to build for a new > > platform. > > Getting a basic, small Erlang down to 3MB is fairly straightforward. > Is 3MB "really big". I don't know, you didn't give me any clues about > what you were aiming for. > > 1. Add the +compressed and +slim flags to the build > 2. Throw out all libraries you don't need. > 3. Throw out all binaries you don't need. > 4. Strip the remaining binaries. > > #1 is easily done by applying the attached patch (for R11, but the idea > is the same) to a clean source tree. Clean means "before you run > 'configure'". > > #2 is a bit more of a chore. "Really tedious", maybe. If you can muster > the will to do it, a quick way is to zap all libraries _apart_ from: > > erlang/lib/erlang/lib/stdlib > erlang/lib/erlang/lib/kernel > erlang/lib/erlang/lib/sasl > > #3 is up to you. Chances are you don't need the dialyzer, epmd, erlc, > beam.hybrid > > #4 should be obvious. > > You can, of course, do more for a bit more effort. But it sounded like > you were struggling to make it from the couch to the fridge ;-) > > Matt From theczintheroc2007@REDACTED Tue Jul 15 22:30:25 2008 From: theczintheroc2007@REDACTED (Colin Z) Date: Tue, 15 Jul 2008 16:30:25 -0400 Subject: [erlang-questions] Big distributed project architecture Message-ID: Just looking for some input from people that may have worked on really big, scaled out applications in the past. The project is a stereotypical wanna-be game/MMO server. I've got a decent prototype working on a single box, but now I'm starting to put thought into distribution, scalability, etc. In particular I'm wondering how big scaled out applications handle their tons of user connections. Is it typical for applications like this to have their clients connected to a single box/node whose job is just to read data off the socket, decode it, and forward data/messages/commands/whatever to other boxes that handle specific things like logging in, hosting "shards" of the game, etc? Or is there some other technique that's commonly used? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vik@REDACTED Tue Jul 15 23:24:33 2008 From: vik@REDACTED (Vik Olliver) Date: Wed, 16 Jul 2008 09:24:33 +1200 Subject: [erlang-questions] Big distributed project architecture In-Reply-To: References: Message-ID: <1216157073.5634.40.camel@localhost> On Tue, 2008-07-15 at 16:30 -0400, Colin Z wrote: > In particular I'm wondering how big scaled out applications handle > their tons of user connections. Is it typical for applications like > this to have their clients connected to a single box/node whose job is > just to read data off the socket, decode it, and forward > data/messages/commands/whatever to other boxes that handle specific > things like logging in, hosting "shards" of the game, etc? > > Or is there some other technique that's commonly used? Load balancing across multiple servers. I've used nginx for it. Vik :v) From johnswolter@REDACTED Tue Jul 15 23:29:12 2008 From: johnswolter@REDACTED (john s wolter) Date: Tue, 15 Jul 2008 17:29:12 -0400 Subject: [erlang-questions] Big distributed project architecture In-Reply-To: References: Message-ID: <24bcf1860807151429j667e4641jbc6434b03c1d2d4a@mail.gmail.com> Colin, Game development is pressing the outer limits of computer science to build real examples of distributed and virtualized systems. Erlang is a definite language candidate for game cores. Problems inside the data centers as well as outside need some new approaches. Let me point you in the direction of some books that offer articles some which cover your interests. from Charles River Media "Game Programming Gems 4, 5, 6, 7" and... "Massively Multiplayer Game Development 1, 2" The early titles may be available in a library near to you. Both of these books have articles about issues of distributed architecture and networking. I recall articles about time coordination, distributed game world abstraction and synchronization, and an example of a simple distributed hash tables. 2008/7/15 Colin Z : > Just looking for some input from people that may have worked on really big, > scaled out applications in the past. > > The project is a stereotypical wanna-be game/MMO server. > > I've got a decent prototype working on a single box, but now I'm starting > to put thought into distribution, scalability, etc. > > In particular I'm wondering how big scaled out applications handle their > tons of user connections. Is it typical for applications like this to have > their clients connected to a single box/node whose job is just to read data > off the socket, decode it, and forward data/messages/commands/whatever to > other boxes that handle specific things like logging in, hosting "shards" of > the game, etc? > > Or is there some other technique that's commonly used? > > > > > _______________________________________________ > 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 andrew.unit@REDACTED Wed Jul 16 01:48:46 2008 From: andrew.unit@REDACTED (Andrew Harris) Date: Tue, 15 Jul 2008 19:48:46 -0400 Subject: [erlang-questions] reducing size of erlang In-Reply-To: <20080715174733.GA5396@contorpis.lisalinda.com> References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: Hi Matt, > Getting a basic, small Erlang down to 3MB is fairly straightforward. > Is 3MB "really big". I don't know, you didn't give me any clues about > what you were aiming for. > > 1. Add the +compressed and +slim flags to the build > 2. Throw out all libraries you don't need. > 3. Throw out all binaries you don't need. > 4. Strip the remaining binaries. > > #1 is easily done by applying the attached patch (for R11, but the idea > is the same) to a clean source tree. Clean means "before you run 'configure'". Thanks for the useful information. I was able to save around 30MB, going from 70MB to around 40MB! It fits on the gumstix now. I am stuck now on a problem that I'm not sure about. I'm wondering if I might not have cross compiled correctly? I updated the directory path in bin/erl to point to the correct place. Could it be that there are other symbolic links I should fix? root@REDACTED:~/cross-compiled/bin$ ./erl (no error logger present) error: beam/beam_load.c(1097): Error loading module error_handler: use of opcode 124; this emulator supports only up to 115 {"init terminating in do_boot",{'cannot load',error_handler,{error,badfile}}} Crash dump was written to: erl_crash.dump init terminating in do_boot () root@REDACTED:~/cross-compiled/bin$ -andrew From ok@REDACTED Wed Jul 16 01:54:37 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 16 Jul 2008 11:54:37 +1200 Subject: [erlang-questions] Current term representation? In-Reply-To: <18556.26166.689862.600896@harpo.it.uu.se> References: <051418BB-1690-447C-B501-5DD2AB7FD791@cs.otago.ac.nz> <487B999F.2090504@it.uu.se> <289FB224-03E0-4078-A835-5436F1837486@cs.otago.ac.nz> <18556.26166.689862.600896@harpo.it.uu.se> Message-ID: <7B980541-EFC6-4551-9FD1-2B2BA8D5B7B2@cs.otago.ac.nz> On 15 Jul 2008, at 8:56 pm, Mikael Pettersson wrote: > By "the rest" do you mean terms in general or just funs? > If terms in general, what were you hoping to be wrong? I meant the rest of the information specifically about funs. Nobody, least of all me, was suggesting a special tag for empty tuples, merely that they could fit into one of the immediate classes. It does mean that if you want to represent the equivalent of Haskell's (Maybe [t]), that is an optional list, where an empty list not the same as no list, then {} | list(T) is not a good choice; it is better to use an atom, e.g., undefined | list(T). It will take less memory, be quicker to match, and clearer to read. -- If stupidity were a crime, who'd 'scape hanging? From sean.hinde@REDACTED Wed Jul 16 02:05:48 2008 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 16 Jul 2008 01:05:48 +0100 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <6AC08BD4-7F1F-4845-B2B9-D2BDEB27D0DB@gmail.com> The tutorial can be updated easily enough if needs be. Sean On 14 Jul 2008, at 16:07, Joseph Wayne Norton wrote: > Just in case you haven't seen this article on trapexit. Please see > here: > > http://www.trapexit.org/A_fast_web_server_demonstrating_some_undocumented_Erlang_features > > On Mon, 14 Jul 2008 23:41:29 +0900, Hans Huebner > > wrote: > >> On Mon, Jul 14, 2008 at 16:20, Sverker Eriksson >> wrote: >>> A message from the OTP team: >>> >>> There is an undocumented socket packet mode that provides HTTP >>> parsing. >> [...] >>> Am I stirring up any worried http-users out there? >> >> I am currently looking into Erlang because I need a web server front >> end that multiplexes many external connections to one HTTP backend >> server on a single persistent HTTP/1.1 connection. I was about to >> ask >> in this list if there are any http client and server libraries that I >> could use, and if I understand your message correctly, the HTTP >> packet >> modes are just what I need. So: I can't be stirred up, but I'd >> really like to play around with this, so if you can point me to >> source >> code or anything else that might help me understand of to put sockets >> into HTTP packet mode, I'd greatly appreciate it. >> >> Thanks, >> Hans >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > norton@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From justin@REDACTED Wed Jul 16 02:12:09 2008 From: justin@REDACTED (Justin Sheehy) Date: Tue, 15 Jul 2008 20:12:09 -0400 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: Message-ID: On 7/14/08 10:09 AM, "Takeru INOUE" wrote: >>> What good news! >>> We were seeking vector clocks and Merkle tree. >> >> I'll certainly let you know as soon as I have prepared a release, which >> should not take much work. The code already exists, it is just a matter of >> packaging and licensing. > > Thanks a lot. > We're looking forward to hearing good news. Here is the first part of your good news. I have put up the vector clocks module here: http://code.google.com/p/vclock/ Vector clocks become much more useful once you also have Merkle trees. I will package up and release an implementation of those soon as well. However, since vector clocks can be useful on their own and I was able to get this part out more quickly, I thought I'd give you something incremental to look at. It is not a large amount of code, but we have found it quite handy. Best, -Justin From anders.nygren@REDACTED Wed Jul 16 02:37:12 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 15 Jul 2008 19:37:12 -0500 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: On Tue, Jul 15, 2008 at 6:48 PM, Andrew Harris wrote: > Hi Matt, > >> Getting a basic, small Erlang down to 3MB is fairly straightforward. >> Is 3MB "really big". I don't know, you didn't give me any clues about >> what you were aiming for. >> >> 1. Add the +compressed and +slim flags to the build >> 2. Throw out all libraries you don't need. >> 3. Throw out all binaries you don't need. >> 4. Strip the remaining binaries. >> >> #1 is easily done by applying the attached patch (for R11, but the idea >> is the same) to a clean source tree. Clean means "before you run 'configure'". > > Thanks for the useful information. I was able to save around 30MB, > going from 70MB to around 40MB! It fits on the gumstix now. I am > stuck now on a problem that I'm not sure about. I'm wondering if I > might not have cross compiled correctly? I updated the directory path > in bin/erl to point to the correct place. Could it be that there are > other symbolic links I should fix? > > root@REDACTED:~/cross-compiled/bin$ ./erl > (no error logger present) error: beam/beam_load.c(1097): Error loading > module error_handler: > use of opcode 124; this emulator supports only up to 115 > > {"init terminating in do_boot",{'cannot load',error_handler,{error,badfile}}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > root@REDACTED:~/cross-compiled/bin$ > Looks like You have mixed files from different releases. So error_handler.beam is compiled for a newer version of the emulator than what You have installed. /Anders > > -andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mog-lists@REDACTED Wed Jul 16 03:26:55 2008 From: mog-lists@REDACTED (mog) Date: Tue, 15 Jul 2008 20:26:55 -0500 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: <487D4E5F.3080701@rldn.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 | | Thanks for the useful information. I was able to save around 30MB, | going from 70MB to around 40MB! It fits on the gumstix now. I am | stuck now on a problem that I'm not sure about. I'm wondering if I | might not have cross compiled correctly? I updated the directory path | in bin/erl to point to the correct place. Could it be that there are | other symbolic links I should fix? congrats on getting it down so small, but I'm curious as to why you didn't try Debian port of gumstix or the Debian arm port of Erlang? Seems like it would be easiest way to get started from their you could build your own Erlang image and shrink it some more? Mog -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkh9TlgACgkQeq+tARrxhnus4ACgm/ECZ/im5YBa2dWa4VudnKkh DD4AnjO7Q/FsAQkLkPy31SV5e4YHaDjI =/rZb -----END PGP SIGNATURE----- From andrew.unit@REDACTED Wed Jul 16 05:06:42 2008 From: andrew.unit@REDACTED (Andrew Harris) Date: Tue, 15 Jul 2008 23:06:42 -0400 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: Hi Anders, On Tue, Jul 15, 2008 at 8:37 PM, Anders Nygren wrote: > > Looks like You have mixed files from different releases. > So error_handler.beam is compiled for a newer version of the emulator > than what You have installed. > Thanks for the suggestion. It's odd. I went ahead and compiled R10B-10 natively (not cross compiling) using the following three lines: ./configure --prefix=/tmp/cross-compiled --without-ssl --without-java --disable-hipe make noboot make install I did that as a test to just practice building the code. It seems to have built fine, but I get the same error that I had emailed before... it seems cross compiling had nothing to do with it. andrewha@REDACTED:/tmp/cross-compiled/bin$ ./erl (no error logger present) error: beam/beam_load.c(1097): Error loading module error_handler: use of opcode 124; this emulator supports only up to 115 {"init terminating in do_boot",{'cannot load',error_handler,{error,badfile}}} Crash dump was written to: erl_crash.dump init terminating in do_boot () andrewha@REDACTED:/tmp/cross-compiled/bin$ I don't quite understand your statement that I'm building for a different version; I've just untarred the distribution into a fresh directory and done the configure and make instructions above. Could there be some interference between this build and the erlang I've already got installed? I use Ubuntu and installed erlang from the package manager; I thought it was necessary. Maybe that's causing the problem you refer to? thanks, -andrew From anders.nygren@REDACTED Wed Jul 16 06:17:44 2008 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 15 Jul 2008 23:17:44 -0500 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: On Tue, Jul 15, 2008 at 10:06 PM, Andrew Harris wrote: > Hi Anders, > > On Tue, Jul 15, 2008 at 8:37 PM, Anders Nygren wrote: >> >> Looks like You have mixed files from different releases. >> So error_handler.beam is compiled for a newer version of the emulator >> than what You have installed. >> > > Thanks for the suggestion. It's odd. I went ahead and compiled > R10B-10 natively (not cross compiling) using the following three > lines: > > ./configure --prefix=/tmp/cross-compiled --without-ssl --without-java > --disable-hipe > make noboot > make install > > I did that as a test to just practice building the code. It seems to > have built fine, but I get the same error that I had emailed before... > it seems cross compiling had nothing to do with it. > > andrewha@REDACTED:/tmp/cross-compiled/bin$ ./erl > (no error logger present) error: beam/beam_load.c(1097): Error loading > module error_handler: > use of opcode 124; this emulator supports only up to 115 > > {"init terminating in do_boot",{'cannot load',error_handler,{error,badfile}}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > andrewha@REDACTED:/tmp/cross-compiled/bin$ > > I don't quite understand your statement that I'm building for a > different version; I've just untarred the distribution into a fresh > directory and done the configure and make instructions above. > > Could there be some interference between this build and the erlang > I've already got installed? I use Ubuntu and installed erlang from > the package manager; I thought it was necessary. Maybe that's causing > the problem you refer to? Hi I have now tested building R10B-10 the same way as You did, and I get a different error. make fails with ( cd /usr/local/src/otp/otp_src_R10B-10/erts/start_scripts/tmp && \ erlc -W -I/usr/local/src/otp/otp_src_R10B-10/lib/kernel/ebin -I/usr/local/src/otp/otp_src_R10B-10/lib/stdlib/ebin -I/usr/local/src/otp/otp_src_R10B-10/lib/sasl/ebin -o /usr/local/src/otp/otp_src_R10B-10/erts/start_scripts/start_clean.script /usr/local/src/otp/otp_src_R10B-10/erts/start_scripts/start_clean.rel ) stdlib: No valid version ("1.13.12") of .app file found. Found file "/usr/local/lib/erlang/lib/stdlib-1.15.2/ebin/stdlib.app" with version "1.15.2" which shows that it only finds the stdlib from my R12B-2 installation. Checking one of the newly compiled beam files in the R10B-10 tree shows that it is compiled with the compiler from R12B-2. So it seems like it is not possible to build, (at least R10B-10), when there is a newer version also installed. So try removing the ubuntu installed version of erlang and try builing again. /Anders > > thanks, > -andrew > From zerthurd@REDACTED Wed Jul 16 06:53:52 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 16 Jul 2008 08:53:52 +0400 Subject: [erlang-questions] Megaco: dd/ce ds - must be quoted string Message-ID: Hello In RFC-3525 we can read about DTMF detection package - dd. It has digit map completion event 'ce' with parameter DigitString 'ds': === DigitString ParameterID: ds (0x0001) Type: string of digit map symbols (possibly empty) returned as a quotedString === However, when I send message with this event across megaco stack in OTP, it transmited like this: dd/ce{ds=1234567} not like this: dd/ce{ds="1234567"} In this time I put some changes in megaco_text_tokens.hrl in macros classify_char: $" -> safe_char; Then I compose digitmap with doublequotes and send it to stack. I think it is bad idea, can you help me? -- Maxim Treskin From matthias@REDACTED Wed Jul 16 08:28:52 2008 From: matthias@REDACTED (Matthias Lang) Date: Wed, 16 Jul 2008 08:28:52 +0200 Subject: [erlang-questions] reducing size of erlang In-Reply-To: <487D4E5F.3080701@rldn.net> References: <20080715174733.GA5396@contorpis.lisalinda.com> <487D4E5F.3080701@rldn.net> Message-ID: <20080716062852.GB3419@contorpis.lisalinda.com> On Tuesday, July 15, mog wrote: > congrats on getting it down so small, but I'm curious as to why you > didn't try Debian port of gumstix or the Debian arm port of Erlang? > Seems like it would be easiest way to get started from their you could > build your own Erlang image and shrink it some more? I realise the question isn't really aimed at me. One reason to avoid "just using Debian" is that you have to be sure that Debian's toolchain is compatible with your hardware. E.g. the Debian powerPC section does _not_ work on the MPC860 powerPC CPU because of different cache line lengths. The symptoms are random crashes and memory corruption. The above isn't intended as "Debian ARM won't work on gumstix". I don't know if it does or doesn't. It's intended as "make sure you understand the differences, if any, between the gumstix toolchain and the debian maintainer's toolchain". If in doubt, build it yourself. Matt From matthias@REDACTED Wed Jul 16 08:02:00 2008 From: matthias@REDACTED (Matthias Lang) Date: Wed, 16 Jul 2008 08:02:00 +0200 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> Message-ID: <20080716060200.GA3419@contorpis.lisalinda.com> On Tuesday, July 15, Andrew Harris wrote: > Thanks for the useful information. I was able to save around 30MB, > going from 70MB to around 40MB! It fits on the gumstix now. If 40MB is good enough for you, great. But you can get much smaller than that if you want. > I'm wondering if I might not have cross compiled correctly? ... > root@REDACTED:~/cross-compiled/bin$ ./erl > (no error logger present) error: beam/beam_load.c(1097): Error loading > module error_handler: > use of opcode 124; this emulator supports only up to 115 I'll second Anders' diagnosis---it's exactly what happens when you've used a newer version of Erlang to compile the beams. The clean way out of that is to delete* every copy of erlang on your machine and then start again with the R10 tarball. Build it natively once (and install) and then, in a fresh directory, do your cross compile. Then you have zero chance of getting confusing things happening. You can check that everything went as planned just by looking at the .beam file sizes, e.g. ~ >ll /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam ... 10408 ... /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam ~ >ll /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam .. 2753 /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam So, about 10k for a 'normal' string.beam and about 3k when slimmed. Matt * There are less destructive ways of achieving the same thing. From tchamila@REDACTED Wed Jul 16 10:29:40 2008 From: tchamila@REDACTED (chamila piyasena) Date: Wed, 16 Jul 2008 13:59:40 +0530 Subject: [erlang-questions] question about the behavior of {packet, http} Message-ID: <552d666a0807160129j57164dcdw88a53bc819612fe1@mail.gmail.com> hi, Are we getting the whole http reqest or response in one time when using {packet, http} rather than divided in to several packets as in {packet, 0} ? cheers, Chamila http://chamilar.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Jul 16 12:22:04 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 16 Jul 2008 12:22:04 +0200 Subject: [erlang-questions] reducing size of erlang In-Reply-To: <20080716060200.GA3419@contorpis.lisalinda.com> References: <20080715174733.GA5396@contorpis.lisalinda.com> <20080716060200.GA3419@contorpis.lisalinda.com> Message-ID: <9b08084c0807160322u3d1fe87bgb78858aaae2308ea@mail.gmail.com> Stripping erlang to a minimal subset is something I have done several times. For a long time my goal was under 1.44 MB (= a floppy) I suspect this is no longer possible. read (for example) http://www.sics.se/~joe/bluetail/sae_r7b/sae.html also google "sae erlang" - for hints and tips on how to do this. If you start erlang and evaluate code:all_loaded() you'll see which modules get loaded - then just write a program to fetch all the beam files for these modules compress them and store them in a single file. With a little work you should be able to reduce the system to half a dozen files occupying < 5 MBs - you can also mess around with code.erl to change the loading mechanism. /Joe Armstrong On Wed, Jul 16, 2008 at 8:02 AM, Matthias Lang wrote: > On Tuesday, July 15, Andrew Harris wrote: > >> Thanks for the useful information. I was able to save around 30MB, >> going from 70MB to around 40MB! It fits on the gumstix now. > > If 40MB is good enough for you, great. But you can get much smaller than > that if you want. > >> I'm wondering if I might not have cross compiled correctly? > ... >> root@REDACTED:~/cross-compiled/bin$ ./erl >> (no error logger present) error: beam/beam_load.c(1097): Error loading >> module error_handler: >> use of opcode 124; this emulator supports only up to 115 > > I'll second Anders' diagnosis---it's exactly what happens when you've > used a newer version of Erlang to compile the beams. The clean way out > of that is to delete* every copy of erlang on your machine and then > start again with the R10 tarball. Build it natively once (and install) > and then, in a fresh directory, do your cross compile. Then you > have zero chance of getting confusing things happening. > > You can check that everything went as planned just by looking at the > .beam file sizes, e.g. > > ~ >ll /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam > ... 10408 ... /usr/local/src/otp_src_R11B-2/lib/stdlib/ebin/string.beam > ~ >ll /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam > .. 2753 /home/matthias/gth1_build/opt/erlang/lib/erlang/lib/stdlib-1.12.8/ebin/string.beam > > So, about 10k for a 'normal' string.beam and about 3k when slimmed. > > Matt > > * There are less destructive ways of achieving the same thing. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From psa@REDACTED Wed Jul 16 12:34:37 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Wed, 16 Jul 2008 11:34:37 +0100 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <487DCEBD.5050108@di.uminho.pt> Sverker Eriksson wrote: > A message from the OTP team: > > There is an undocumented socket packet mode that provides HTTP parsing. > We are planning to make this packet mode official and possibly also > change the format of the tuples returned in this mode. One current big Nice! I use {active, once}, but will have no problem changing the code to adapt to the new message format. As you are making it official, here is something you may consider as well, if not now, maybe for a future version: supporting the "binary" option. As it is now, the binary option is ignored (at least when returning the path and headers, which is almost all that matters in the most common case, "GET"). This means that several lists of chars will be created which (specially in 64 bit architectures) may use several KBytes per request, just for the headers. If binaries were returned, memory consumption would be better and it would make less pressure on GC (I guess). Considering that pattern matching on binaries in nice and efficient nowadays, it would be an interesting feature. A possibility would be the implementation to return sub-binaries pointing to the single block in the memory in the common case when the request arrives in a single TCP packet. It would be very efficient. The programmer would have to be aware of the implications, and not get hold of sub-binaries. But I see this as a minor issue. Headers are typically either ignored or acted upon to decide something and discarded soon afterwards, not stored for the long term (is this true?). In any case chosing "binary" is optional anyway, we can always choose getting lists. Regards, Paulo From takeru.inoue@REDACTED Wed Jul 16 14:02:33 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Wed, 16 Jul 2008 21:02:33 +0900 Subject: [erlang-questions] [Kai-users] Kai - An Open Source Implementation of Amazon's Dynamo In-Reply-To: References: Message-ID: Thank you so much. I tried vclock.erl and found it works correctly. We will build it into our code. We're preparing some useful codes. I'll post it to this list when it's done. On Wed, Jul 16, 2008 at 9:12 AM, Justin Sheehy wrote: > On 7/14/08 10:09 AM, "Takeru INOUE" wrote: > >>>> What good news! >>>> We were seeking vector clocks and Merkle tree. >>> >>> I'll certainly let you know as soon as I have prepared a release, which >>> should not take much work. The code already exists, it is just a matter of >>> packaging and licensing. >> >> Thanks a lot. >> We're looking forward to hearing good news. > > Here is the first part of your good news. > > I have put up the vector clocks module here: > > http://code.google.com/p/vclock/ > > Vector clocks become much more useful once you also have Merkle trees. I > will package up and release an implementation of those soon as well. > > However, since vector clocks can be useful on their own and I was able to > get this part out more quickly, I thought I'd give you something incremental > to look at. It is not a large amount of code, but we have found it quite > handy. > > Best, > > -Justin > > > -- Takeru INOUE From dmercer@REDACTED Wed Jul 16 16:17:20 2008 From: dmercer@REDACTED (David Mercer) Date: Wed, 16 Jul 2008 09:17:20 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers Message-ID: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> I must admit, I am disappointed that there is no Erlang solution. This seems like a basic building block to fault-tolerant systems. So, I am going to toy with my idea of having the secondary detect the failure and send the appropriate commands to the network to redirect traffic for the primary server's IP address to the secondary. Am thinking there must be some DHCP commands to reassign the IP address. Before I begin, does anyone see any obvious flaws in my thinking. I am not a networking expert. Thanks. David _____ From: David Mercer [mailto:dmercer@REDACTED] Sent: Friday, July 11, 2008 10:59 To: 'erlang-questions@REDACTED' Subject: Fault-Tolerant TCP/IP Servers Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) written in Erlang, and I want it to work through hardware failures; I need at least two of them. The problem is, clients are connecting to the primary's IP address, so when it fails, client connections are refused instead of being rerouted to the secondary. What is the Erlang approach to solving this? My thought is that you have the secondary detect the failure and send the appropriate commands to the network to redirect traffic for the primary server's IP address to the secondary. That's my idea, but I don't really know if this is the appropriate solution, nor how to implement something like this in Erlang. Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick.richardson@REDACTED Wed Jul 16 16:35:03 2008 From: rick.richardson@REDACTED (Rick R) Date: Wed, 16 Jul 2008 10:35:03 -0400 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> Message-ID: <9810b81b0807160735g55d15637ld962ca6ffce2f146@mail.gmail.com> You mentioned TCP/IP, but is SCTP an option? If so, your problem is solved automatically and (almost) instantly via SCTP's multi-homing. 2008/7/16 David Mercer : > I must admit, I am disappointed that there is no Erlang solution. This > seems like a basic building block to fault-tolerant systems. So, I am going > to toy with my idea of having the secondary detect the failure and send the > appropriate commands to the network to redirect traffic for the primary > server's IP address to the secondary. Am thinking there must be some DHCP > commands to reassign the IP address. Before I begin, does anyone see any > obvious flaws in my thinking. I am not a networking expert. Thanks. > > > > David > > > ------------------------------ > > *From:* David Mercer [mailto:dmercer@REDACTED] > *Sent:* Friday, July 11, 2008 10:59 > *To:* 'erlang-questions@REDACTED' > *Subject:* Fault-Tolerant TCP/IP Servers > > > > Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) written > in Erlang, and I want it to work through hardware failures; I need at least > two of them. The problem is, clients are connecting to the primary's IP > address, so when it fails, client connections are refused instead of being > rerouted to the secondary. What is the Erlang approach to solving this? > > > > My thought is that you have the secondary detect the failure and send the > appropriate commands to the network to redirect traffic for the primary > server's IP address to the secondary. That's my idea, but I don't really > know if this is the appropriate solution, nor how to implement something > like this in Erlang. > > > > Please advise. Thank-you. > > > > David Mercer > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From jongretar@REDACTED Wed Jul 16 17:11:39 2008 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Wed, 16 Jul 2008 15:11:39 +0000 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> Message-ID: <4ecde87b0807160811m31c75855r951f22ddee0da44e@mail.gmail.com> Usually people do not do this on a software level. It's highly unusual and I'm going to be brave and state that it's completely the incorrect way do do this. It just simply increases the possibility of major security issues when you start giving your programs full access to system resources. It's not an erlang thing. You really should not do this in any programming language. You have 2 choices. Use a High Availability tool like Linux-HA. In an Active/Passive environment you usually have the computers with their own ip address but then another IP address that can freely travel between the computer as their secondary address. Or you can set up an Active/Active system that allows you not only fault tolerance but load balancing as well. The downside to that is that you need the third computer as a load balancer or preferably a load balancing appliance. And I highly recommend talking to a networking expert. It's no use being the world best programmer if the whole thing fails then on the network level. 2008/7/16 David Mercer : > I must admit, I am disappointed that there is no Erlang solution. This > seems like a basic building block to fault-tolerant systems. So, I am going > to toy with my idea of having the secondary detect the failure and send the > appropriate commands to the network to redirect traffic for the primary > server's IP address to the secondary. Am thinking there must be some DHCP > commands to reassign the IP address. Before I begin, does anyone see any > obvious flaws in my thinking. I am not a networking expert. Thanks. > > > > David > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Wed Jul 16 17:11:39 2008 From: dmercer@REDACTED (David Mercer) Date: Wed, 16 Jul 2008 10:11:39 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <9810b81b0807160735g55d15637ld962ca6ffce2f146@mail.gmail.com> References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> <9810b81b0807160735g55d15637ld962ca6ffce2f146@mail.gmail.com> Message-ID: <011101c8e756$40134eb0$f21ea8c0@SSI.CORP> No, TCP/IP is used for the message stream I am thinking of. Basically, the client opens a TCP/IP connection to the server, and then sends HL7 messages (a message format used in the healthcare industry) over the connection, delimited by beginning- and end-of-message control codes. If the connection is closed (e.g., server fails), the client will attempt to reconnect. My thought is that if the secondary can remap the network so that connections to that IP address are now routed to it, the reconnect would automatically go to the secondary. _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Rick R Sent: Wednesday, July 16, 2008 09:35 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fault-Tolerant TCP/IP Servers You mentioned TCP/IP, but is SCTP an option? If so, your problem is solved automatically and (almost) instantly via SCTP's multi-homing. 2008/7/16 David Mercer : I must admit, I am disappointed that there is no Erlang solution. This seems like a basic building block to fault-tolerant systems. So, I am going to toy with my idea of having the secondary detect the failure and send the appropriate commands to the network to redirect traffic for the primary server's IP address to the secondary. Am thinking there must be some DHCP commands to reassign the IP address. Before I begin, does anyone see any obvious flaws in my thinking. I am not a networking expert. Thanks. David _____ From: David Mercer [mailto:dmercer@REDACTED] Sent: Friday, July 11, 2008 10:59 To: 'erlang-questions@REDACTED' Subject: Fault-Tolerant TCP/IP Servers Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) written in Erlang, and I want it to work through hardware failures; I need at least two of them. The problem is, clients are connecting to the primary's IP address, so when it fails, client connections are refused instead of being rerouted to the secondary. What is the Erlang approach to solving this? My thought is that you have the secondary detect the failure and send the appropriate commands to the network to redirect traffic for the primary server's IP address to the secondary. That's my idea, but I don't really know if this is the appropriate solution, nor how to implement something like this in Erlang. Please advise. Thank-you. David Mercer _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From vik@REDACTED Wed Jul 16 17:22:49 2008 From: vik@REDACTED (Vik Olliver) Date: Thu, 17 Jul 2008 03:22:49 +1200 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <4ecde87b0807160811m31c75855r951f22ddee0da44e@mail.gmail.com> References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> <4ecde87b0807160811m31c75855r951f22ddee0da44e@mail.gmail.com> Message-ID: <1216221769.15648.56.camel@localhost> On Wed, 2008-07-16 at 15:11 +0000, Jon Gretar Borgthorsson wrote: > Or you can set up an Active/Active system that allows you not only > fault tolerance but load balancing as well. The downside to that is > that you need the third computer as a load balancer or preferably a > load balancing appliance. This can be done by using the firewall as your 3rd computer. For fault tolerance of course, that reads firewalls :) Vik :v) From holger@REDACTED Wed Jul 16 17:23:40 2008 From: holger@REDACTED (Holger Hoffstaette) Date: Wed, 16 Jul 2008 17:23:40 +0200 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> Message-ID: On Wed, 16 Jul 2008 09:17:20 -0500, David Mercer wrote: > I must admit, I am disappointed that there is no Erlang solution. This This has really nothing to do with Erlang or any other language; it is just plain a problem with how client-side network addressing works in TCP. As long as the physical server host/port is exposed directly, you either need fault-tolerant clients with backup addresses and migration logic built in etc. (this is btw. much more difficult than it sounds), or an intermediary between client and server. One for Linux is e.g. HAProxy (http://haproxy.1wt.eu/) though there are others, both free and commercial, with different advantages and disadvantes. > seems like a basic building block to fault-tolerant systems. So, I am It is, but the problem can be attacked on the application level or as an infrastructure concern, and both approaches can lead to very different solutions (like Rick R's suggestion to use SCTP instead of TCP). Holger From zerthurd@REDACTED Wed Jul 16 17:24:16 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 16 Jul 2008 19:24:16 +0400 Subject: [erlang-questions] Megaco: dd/ce ds - must be quoted string In-Reply-To: <487DE271.40200@erix.ericsson.se> References: <487DE271.40200@erix.ericsson.se> Message-ID: Thank you for reply, Micael I have this problem *only* with one vendor. Its softswitch rejects my message, if I not doublequoted it. With other vendors I have not that problem. I cannot point them on this fact, because this correct, according to rfc-3525. So, it needs to make some changes in megaco-stack of OTP. I can send my patch, but it is too ugly, I think, it is just temporary workaround. On 16/07/2008, Micael Karlberg wrote: > Hi, > > 'ds' is encoded as Value, which means that the string > you want to encode will not be quoted (in this case). > This is clearly not according to the standard, but on > the other hand one can't help but wonder why this has > not been detected before now (the megaco app has been > used in commercial products for 8 years). I am guessing > that many implementations are "forgiving". > > > Is this a problem for you? I mean, does "the other side" > reject the message? > > Regards, > /BMK -- Maxim Treskin From bian@REDACTED Wed Jul 16 17:51:38 2008 From: bian@REDACTED (Xingdong Bian) Date: Wed, 16 Jul 2008 16:51:38 +0100 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 Message-ID: Hi Any one has the same issues with me? When i install the Erlang/OTP on the SUSE 11 for 12B-3: it says the gcc compiler is not supported, asks me to change another version of the gcc compiler 11B-5, 12B-0,1,2: ./configure is fine then make with error: ================================== obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses - L../lib/internal/i686-pc-linux-gnu /home/bian/downloads/otp_src_R12B-2/ erts/obj/i686-pc-linux-gnu/libz.a -lethread -lpthread - lerts_internal_r -lrt obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function `my_sigaction': /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:220: undefined reference to `INIT' /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:230: undefined reference to `__next_sigaction' obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function `hipe_signal_init': /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:305: undefined reference to `INIT' obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function `my_sigaction': /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:220: undefined reference to `INIT' /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:230: undefined reference to `__next_sigaction' /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:220: undefined reference to `INIT' /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ hipe_x86_signal.c:230: undefined reference to `__next_sigaction' collect2: ld returned 1 exit status make[3]: *** [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux- gnu/beam.smp] Error 1 make[3]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts/ emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts/ emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' make: *** [emulator] Error 2 ================================== when i disable the hipe with ./configure --disable-hipe I still get error: ================================== make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' cd lib && \ ERL_TOP=/home/bian/erlang/otp_src_R12B-1 PATH=/home/bian/erlang/ otp_src_R12B-1/bootstrap/bin:${PATH} \ make opt SECONDARY_BOOTSTRAP=true make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/ parsetools' === Entering application parsetools make[3]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/ parsetools/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/ parsetools/src' === Skipping subdir doc/src, it is missing === Leaving application parsetools make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/ parsetools' make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/asn1/ src' make[2]: Nothing to be done for `opt'. make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/asn1/ src' make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' Makefile:35: warning: overriding commands for target `docs' /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: ignoring old commands for target `docs' === Entering application hipe make[3]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe/ rtl' /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals -e > hipe_literals.hrl erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin hipe_rtl_arch.erl make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault make[3]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe/ rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' make: *** [secondary_bootstrap_build] Error 2 ================================== The above two error texts from different version installation, but for all 11b-5, 12b-0,1,2 the error is the same. Any one has any idea? Thanks Xingdong -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed Jul 16 18:07:25 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 16 Jul 2008 18:07:25 +0200 Subject: [erlang-questions] [ANNOUNCE] etorrent v0.9 Message-ID: <56a0a2840807160907s27886b3bn6b01675b324d9fc2@mail.gmail.com> Hi! I am happy to announce etorrent v0.9, another beta-release of a bittorrent client for Erlang. Many improvements have happened in the source code and the new version works better than the old one. While we have added functionality, the number of code lines is pretty stable because many things could be shaved away. ohloh.net reports some 3400 lines of code in this release, not counting comments. You will find that this release acts much better than v0.8. We begun attacking the parts of the bittorrent protocol that are not specified, but absolutely necessary if one wants adequate performance from the client. The ETA for v1.0 is currently unknown. It will take more time than the transition v0.8 --> v0.9 though. And finally the shameless plug: I need a half-time job around the Copenhagen area in Denmark. And of course, an Erlang (or another functional programming) job would be preferred. Mail me, and we might be able to cook something up. Main web page: http://code.google.com/p/etorrent/ Git repository: http://repo.or.cz/w/etorrent.git NEWS: Version 0.9: This is yet another Tech. Preview release. The torrent client works to the point where it can be used to download things, but it have not seen much testing yet and there are numerous places it can be improved still. Yet, there are so many changes, that it warrants a new release. The current regressions revolve around a high CPU usage at times. We expect to tackle this problem next with some profiling. We also expect to tackle fast resume support as the main "new thing". And some 10 things in the issue tracker and the TODO lists for the next release. I don't expect it to follow as fast as this one. One development methodology change worth mentioning: the git repository now uses several branches laid out as described in doc/git.txt. Tracking the 'master' branch ought to provide you with a system that is stable at all times, while tracking the 'next' branch gives you the 'cooking pot' of new things that ought to be tested. We'll try to keep 'next' stable, though it may have problems at times. Changes: - There is a set of new commands for viewing what is currently cooking in the torrent client. etorrent:l/0, etorrent:s/1, etorrent:h/0. Implemented with help from Tuncer Ayaz. - Changed build infrastructure. No more autoconf. It simplifies the build structure considerably. Introduce the use of EMakefile for building the erlang parts of the system. Reinstate all make targets and add a 'tags' target for building a TAGS file. - etorrent now correctly handles the 'min_interval' tracker response parameter. It is not strictly part of the spec, but everybody uses it. - Add support for installing etorrent. A shell-script, etorrentctl, is provided to control the etorrent daemon. The installer, while overly simple, has not seen much testing as of yet and may not work. It will be tested before v1.0. - etorrent no longer pre-fills files it want to download with junk. It uses the semantics of fseek() to make a file of the right size initially. - several ETS restructurings has brought the memory use down. Before, etorrent would take some 660 megabytes of memory running 20 torrents. Now it is more like 50-80 megabytes for 20 torrents. More can be shaved but this is a good start. Also, memory usage still occasionally spikes because we are doing nothing in certain situations to limit it. - New choking/unchoking algorithm, based on a combination of BitTornado/BitTorrent/Transmission. This is not the smartest one can do, but it follows the spec more or less precisely. - Event Publisher. A gen_event OTP behaviour one can subscribe to and get information about the system. A logfile subscriber is there by default. - Rate calculation optimizations. etorrent now uses a running average over a period of up to 20 seconds to measure the rate of a peer. This yields a more fair measurement of individual peers so we claim the best peers. While here, change the sockets to be passive for now. It bumps the CPU-usage, but makes the rate calculation more precise. There are several optimizations possible revolving around passive/active sockets. - Robustize the supervisor tree. etorrent is now less likely to die due to a crash somewhere in the tree. It is not entirely safe yet, but it will be during the next releases. From rodahummont@REDACTED Wed Jul 16 17:27:22 2008 From: rodahummont@REDACTED (Rodrigo Ahumada) Date: Wed, 16 Jul 2008 11:27:22 -0400 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> References: <004f01c8e36e$fc0394e0$f21ea8c0@SSI.CORP> Message-ID: <487E135A.2070906@yahoo.com.ar> David Mercer escribi?: > Say I have a TCP/IP server (e.g., a web server, FTP server, etc.) > written in Erlang, and I want it to work through hardware failures; I > need at least two of them. The problem is, clients are connecting to > the primary?s IP address, so when it fails, client connections are > refused instead of being rerouted to the secondary. What is the Erlang > approach to solving this? > > > > My thought is that you have the secondary detect the failure and send > the appropriate commands to the network to redirect traffic for the > primary server?s IP address to the secondary. That?s my idea, but I > don?t really know if this is the appropriate solution, nor how to > implement something like this in Erlang. i think you want something like CARP-PFSync from OpenBSD. The problem is that CARP is only to have a shared IP, it does nothing with TCP connections running in the box. OpenBSD pfsync is also a kernel system, and is aware of CARP, that's way it can detect when a CARP master is down, and also is in the kernel managing TCP and firewal connections, so it can do failover on TCP. I don't know if there is some kernel notification of changes in CARP configuration to userspace program... if there is one, you could build a failover erlang server around that. (i think there is one: http://www.openbsd.org/cgi-bin/man.cgi?query=ifstated&sektion=8 ) excuse my english __________________________________________________ Pregunt?. Respond?. Descubr?. Todo lo que quer?as saber, y lo que ni imaginabas, est? en Yahoo! Respuestas (Beta). ?Probalo ya! http://www.yahoo.com.ar/respuestas From dbt@REDACTED Wed Jul 16 19:43:54 2008 From: dbt@REDACTED (David Terrell) Date: Wed, 16 Jul 2008 12:43:54 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> Message-ID: <487E335A.5030309@meat.net> If you control (or can test) the client application, see if you can simply point your DNS to multiple addresses (sometimes called round robin DNS). This puts the retry all server logic in the client app, but it doesn't require extra mechanics like firewall/sync. If it doesn't properly try all addresses in the DNS, then I second the recommendation to use OpenBSD CARP+PFSync. Holger Hoffstaette wrote: > On Wed, 16 Jul 2008 09:17:20 -0500, David Mercer wrote: > >> I must admit, I am disappointed that there is no Erlang solution. This > > This has really nothing to do with Erlang or any other language; it is > just plain a problem with how client-side network addressing works in > TCP. As long as the physical server host/port is exposed directly, you > either need fault-tolerant clients with backup addresses and migration > logic built in etc. (this is btw. much more difficult than it sounds), or > an intermediary between client and server. One for Linux is e.g. HAProxy > (http://haproxy.1wt.eu/) though there are others, both free and > commercial, with different advantages and disadvantes. > >> seems like a basic building block to fault-tolerant systems. So, I am > > It is, but the problem can be attacked on the application level or as an > infrastructure concern, and both approaches can lead to very different > solutions (like Rick R's suggestion to use SCTP instead of TCP). > > Holger > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang-questions_efine@REDACTED Wed Jul 16 21:03:17 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 16 Jul 2008 15:03:17 -0400 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: References: Message-ID: <6c2563b20807161203i72945fc1mff62ce6c04475e52@mail.gmail.com> Have you tried make clean;./configure ? 2008/7/16 Xingdong Bian : > Hi > > Any one has the same issues with me? > When i install the Erlang/OTP on the SUSE 11 for > 12B-3: > it says the gcc compiler is not supported, asks me to change another > version of the gcc compiler > > 11B-5, 12B-0,1,2: > ./configure is fine > then make with error: > ================================== > obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses > -L../lib/internal/i686-pc-linux-gnu > /home/bian/downloads/otp_src_R12B-2/erts/obj/i686-pc-linux-gnu/libz.a > -lethread -lpthread -lerts_internal_r -lrt > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `hipe_signal_init': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:305: > undefined reference to `INIT' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** > [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux-gnu/beam.smp] Error > 1 > make[3]: Leaving directory > `/home/bian/downloads/otp_src_R12B-2/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory > `/home/bian/downloads/otp_src_R12B-2/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' > make: *** [emulator] Error 2 > ================================== > > > when i disable the hipe with > ./configure --disable-hipe > I still get error: > > ================================== > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > cd lib && \ > ERL_TOP=/home/bian/erlang/otp_src_R12B-1 > PATH=/home/bian/erlang/otp_src_R12B-1/bootstrap/bin:${PATH} \ > make opt SECONDARY_BOOTSTRAP=true > make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' > make[2]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' > === Entering application parsetools > make[3]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' > make[3]: Nothing to be done for `opt'. > make[3]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' > === Skipping subdir doc/src, it is missing > === Leaving application parsetools > make[2]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' > make[2]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' > make[2]: Nothing to be done for `opt'. > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' > make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > Makefile:35: warning: overriding commands for target `docs' > /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: ignoring > old commands for target `docs' > === Entering application hipe > make[3]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' > /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals -e > > hipe_literals.hrl > erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin > hipe_rtl_arch.erl > make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault > make[3]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' > make: *** [secondary_bootstrap_build] Error 2 > > ================================== > > > The above two error texts from different version installation, but for all > 11b-5, 12b-0,1,2 the error is the same. > > Any one has any idea? > > Thanks > Xingdong > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.kwiecinski@REDACTED Wed Jul 16 22:50:42 2008 From: daniel.kwiecinski@REDACTED (Daniel Kwiecinski) Date: Wed, 16 Jul 2008 21:50:42 +0100 Subject: [erlang-questions] How to parse whole module? Message-ID: Hi folks, How can I obtain the abstract form of the whole module source code? Using something like this: eval(SourceCode,Environ) -> {ok,Scanned,_} = erl_scan:string(SourceCode), {ok,Parsed} = erl_parse:parse_exprs(Scanned), erl_eval:exprs(Parsed,Environ). works only for single forms not for a whole module. Ideally what I need is kind of compiler switch (similar to -S) resulting in emitting AST and AST after applied any parse_transforms. Thank you in advance. -- Kind Regards, Daniel Kwiecinski -------------- next part -------------- An HTML attachment was scrubbed... URL: From monika.m.moser@REDACTED Wed Jul 16 23:09:49 2008 From: monika.m.moser@REDACTED (Monika Moser) Date: Wed, 16 Jul 2008 23:09:49 +0200 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: <6c2563b20807161203i72945fc1mff62ce6c04475e52@mail.gmail.com> References: <6c2563b20807161203i72945fc1mff62ce6c04475e52@mail.gmail.com> Message-ID: 2008/7/16 Edwin Fine : > Have you tried > > make clean;./configure > > ? > > 2008/7/16 Xingdong Bian : > >> Hi >> >> Any one has the same issues with me? >> When i install the Erlang/OTP on the SUSE 11 for >> 12B-3: >> it says the gcc compiler is not supported, asks me to change another >> version of the gcc compiler >> >> 11B-5, 12B-0,1,2: >> ./configure is fine >> then make with error: >> ================================== >> obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses >> -L../lib/internal/i686-pc-linux-gnu >> /home/bian/downloads/otp_src_R12B-2/erts/obj/i686-pc-linux-gnu/libz.a >> -lethread -lpthread -lerts_internal_r -lrt >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `hipe_signal_init': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:305: >> undefined reference to `INIT' >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> collect2: ld returned 1 exit status >> make[3]: *** >> [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux-gnu/beam.smp] Error >> 1 >> make[3]: Leaving directory >> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory >> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >> make[1]: *** [smp] Error 2 >> make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' >> make: *** [emulator] Error 2 >> ================================== >> > Hi, if I remember correctly it has to do with the glibc version. With your SUSE installation the minor version of glibc should be higher than 7. In file /otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c there is a check for __GLIBC_MINOR__ <= 7. Just remove that check in line 37 and it should work. However I did that one month ago ... thus I hope to this was everything I had to do to get erlang running. Cheers, Monika > >> >> when i disable the hipe with >> ./configure --disable-hipe >> I still get error: >> >> ================================== >> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >> cd lib && \ >> ERL_TOP=/home/bian/erlang/otp_src_R12B-1 >> PATH=/home/bian/erlang/otp_src_R12B-1/bootstrap/bin:${PATH} \ >> make opt SECONDARY_BOOTSTRAP=true >> make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' >> make[2]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >> === Entering application parsetools >> make[3]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >> make[3]: Nothing to be done for `opt'. >> make[3]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >> === Skipping subdir doc/src, it is missing >> === Leaving application parsetools >> make[2]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >> make[2]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >> make[2]: Nothing to be done for `opt'. >> make[2]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >> make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >> Makefile:35: warning: overriding commands for target `docs' >> /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: ignoring >> old commands for target `docs' >> === Entering application hipe >> make[3]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >> /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals -e >> > hipe_literals.hrl >> erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin >> hipe_rtl_arch.erl >> make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault >> make[3]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >> make[1]: *** [opt] Error 2 >> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' >> make: *** [secondary_bootstrap_build] Error 2 >> >> ================================== >> >> >> The above two error texts from different version installation, but for all >> 11b-5, 12b-0,1,2 the error is the same. >> >> Any one has any idea? >> >> Thanks >> Xingdong >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > _______________________________________________ > 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-questions_efine@REDACTED Wed Jul 16 23:40:37 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 16 Jul 2008 17:40:37 -0400 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: <9CECDCC9-9DF1-4EC9-B7F8-B74DFECCC8A0@erlang-consulting.com> References: <6c2563b20807161203i72945fc1mff62ce6c04475e52@mail.gmail.com> <9CECDCC9-9DF1-4EC9-B7F8-B74DFECCC8A0@erlang-consulting.com> Message-ID: <6c2563b20807161440w674b96cau460bee8f6ccc0cba@mail.gmail.com> Deleting the whole folder and untaring it again is not always the same as doing a make clean. There are often precompiled files in an Erlang distribution to save you time when building it. I *think* these are all .beam files so it theoretically should not make a difference. But... I once had a great deal of trouble building Erlang for OpenSuse until I started right from the beginning and THEN did a ./configure; make clean; make Hope this helps. On Wed, Jul 16, 2008 at 5:00 PM, Xingdong Bian wrote: > hi, > Yeah i just delete the whole folder and untar it again. > > Xingdong > > On 16 Jul 2008, at 20:03, Edwin Fine wrote: > > Have you tried > > make clean;./configure > > ? > > 2008/7/16 Xingdong Bian : > >> Hi >> >> Any one has the same issues with me? >> When i install the Erlang/OTP on the SUSE 11 for >> 12B-3: >> it says the gcc compiler is not supported, asks me to change another >> version of the gcc compiler >> >> 11B-5, 12B-0,1,2: >> ./configure is fine >> then make with error: >> ================================== >> obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses >> -L../lib/internal/i686-pc-linux-gnu >> /home/bian/downloads/otp_src_R12B-2/erts/obj/i686-pc-linux-gnu/libz.a >> -lethread -lpthread -lerts_internal_r -lrt >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `hipe_signal_init': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:305: >> undefined reference to `INIT' >> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> collect2: ld returned 1 exit status >> make[3]: *** >> [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux-gnu/beam.smp] Error >> 1 >> make[3]: Leaving directory >> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory >> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >> make[1]: *** [smp] Error 2 >> make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' >> make: *** [emulator] Error 2 >> ================================== >> >> >> when i disable the hipe with >> ./configure --disable-hipe >> I still get error: >> >> ================================== >> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >> cd lib && \ >> ERL_TOP=/home/bian/erlang/otp_src_R12B-1 >> PATH=/home/bian/erlang/otp_src_R12B-1/bootstrap/bin:${PATH} \ >> make opt SECONDARY_BOOTSTRAP=true >> make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' >> make[2]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >> === Entering application parsetools >> make[3]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >> make[3]: Nothing to be done for `opt'. >> make[3]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >> === Skipping subdir doc/src, it is missing >> === Leaving application parsetools >> make[2]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >> make[2]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >> make[2]: Nothing to be done for `opt'. >> make[2]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >> make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >> Makefile:35: warning: overriding commands for target `docs' >> /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: ignoring >> old commands for target `docs' >> === Entering application hipe >> make[3]: Entering directory >> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >> /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals -e >> > hipe_literals.hrl >> erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin >> hipe_rtl_arch.erl >> make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault >> make[3]: Leaving directory >> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >> make[1]: *** [opt] Error 2 >> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' >> make: *** [secondary_bootstrap_build] Error 2 >> >> ================================== >> >> >> The above two error texts from different version installation, but for all >> 11b-5, 12b-0,1,2 the error is the same. >> >> Any one has any idea? >> >> Thanks >> Xingdong >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Wed Jul 16 23:44:22 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 17 Jul 2008 05:44:22 +0800 Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia Message-ID: Hi: I can use transform_table to upgrade the table schema in mnesia. Eg.The version 1 of user record's defination is -record(user_v1,{uuid,name}) I want to upgrade the user table to version 2 -record(user_v2,{uuid,name,email}). I can use transform_table like this: transform_table(user,fun({user_v1,Uuid,Name})->#user_v2{uuid=Uuid,name=Name,email=""} end,record_info(fields,user_v2),user_v2). My question is 1. while the upgrade is in in progress, is the user record I read either the version 1 or the version 2 ?That is I can't be sure one user record's current version. 2. while the upgrade is in progress,will the modify of the old user record be lost? 3. If the 1 and 2 are true,how can I code two handle them? Shall I have to have two versions of process code to handle this situation ,like: process_one_user(UserRecord)-> case of current_version(UserRecord) of v1-> do something; v2->do something end end Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbt@REDACTED Thu Jul 17 00:40:21 2008 From: dbt@REDACTED (David Terrell) Date: Wed, 16 Jul 2008 17:40:21 -0500 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <6c2563b20807161231p43cb14cfv825bdec2fa6a9f07@mail.gmail.com> References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> <487E335A.5030309@meat.net> <6c2563b20807161231p43cb14cfv825bdec2fa6a9f07@mail.gmail.com> Message-ID: <487E78D5.6020709@meat.net> Edwin Fine wrote: > The thing is, if you are trying to create a truly fault-tolerant system, > especially a 24x7 type of application, you have to have redundancy > everywhere, not just in the back-end servers. If you put a FreeBSD > system as a cheap load balancer in front of your multiple Erlang > systems, it's a single point of failure. > > How far do you want to go? Do you want 99.9% availability, or 99.99999%? > There's a HUGE difference between the two. How much unplanned downtime > can you afford? > > In a large-scale industrial-strength (e.g. telecomms) solution, each > server in the farm would have dual power supplies, dual hard disks for > the OS, multiple network cards, and an on-board processor for remote > hardware-level control; the network would be a SAN where the application > software and data sit, redundant LAN/switched fabric segments with > dual-pathed redundant fiber-channel switches; everything would be on > UPS, and the UPS would be on a backup generator; and so on. > > It all depends how much you have to spend, and how much it would cost > financially (or in human terms) if the system went down. If you are > betting the company's existence on it, you need as solid a solution as > you can afford. If you can't afford a solid solution, you take your best > shot and pray. It's a tradeoff. > > Is a dedicated hardware server load balancer with built-in redundancy > out of the question? Some sort of Cisco appliance, for example. That > might be the cheapest and most effective solution for the bucks. > > On Wed, Jul 16, 2008 at 1:43 PM, David Terrell > wrote: > > If you control (or can test) the client application, see if you can > simply point your DNS to multiple addresses (sometimes called round > robin DNS). This puts the retry all server logic in the client app, but > it doesn't require extra mechanics like firewall/sync. > > If it doesn't properly try all addresses in the DNS, then I second the > recommendation to use OpenBSD CARP+PFSync. OpenBSD Carp + PF Sync _is_ a redundant firewall. If you make your firewall redundant and redirect to multiple internal servers, making each machine fault tolerant is just duplication of effort. However, the writer was just trying to find a solution to the network layer. From mikpe@REDACTED Thu Jul 17 02:19:38 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 17 Jul 2008 02:19:38 +0200 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: References: Message-ID: <18558.36890.465144.237784@harpo.it.uu.se> Xingdong Bian writes: > Hi > > Any one has the same issues with me? > When i install the Erlang/OTP on the SUSE 11 for > 12B-3: > it says the gcc compiler is not supported, asks me to change another > version of the gcc compiler gcc-4.3.0 is known to be broken. So SuSE 11 ships that? I'm not impressed. > 11B-5, 12B-0,1,2: > ./configure is fine > then make with error: > ================================== > obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses - > L../lib/internal/i686-pc-linux-gnu /home/bian/downloads/otp_src_R12B-2/ > erts/obj/i686-pc-linux-gnu/libz.a -lethread -lpthread - > lerts_internal_r -lrt > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `hipe_signal_init': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:305: undefined reference to `INIT' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/ > hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux- > gnu/beam.smp] Error 1 > make[3]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts/ > emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts/ > emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' > make: *** [emulator] Error 2 > ================================== > > > when i disable the hipe with > ./configure --disable-hipe > I still get error: > > ================================== > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > cd lib && \ > ERL_TOP=/home/bian/erlang/otp_src_R12B-1 PATH=/home/bian/erlang/ > otp_src_R12B-1/bootstrap/bin:${PATH} \ > make opt SECONDARY_BOOTSTRAP=true > make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' > make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/ > parsetools' > === Entering application parsetools > make[3]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/ > parsetools/src' > make[3]: Nothing to be done for `opt'. > make[3]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/ > parsetools/src' > === Skipping subdir doc/src, it is missing > === Leaving application parsetools > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/ > parsetools' > make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/asn1/ > src' > make[2]: Nothing to be done for `opt'. > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/asn1/ > src' > make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > Makefile:35: warning: overriding commands for target `docs' > /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: > ignoring old commands for target `docs' > === Entering application hipe > make[3]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe/ > rtl' > /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals > -e > hipe_literals.hrl > erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin > hipe_rtl_arch.erl > make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault > make[3]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe/ > rtl' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' > make: *** [secondary_bootstrap_build] Error 2 > > ================================== > > > The above two error texts from different version installation, but for > all 11b-5, 12b-0,1,2 the error is the same. > > Any one has any idea? Always start building Erlang/OTP from a freshly unpacked tarball. When changing ./configure options, always remove the entire tree and start from a fresh one. From roger.larsson@REDACTED Thu Jul 17 08:49:55 2008 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 17 Jul 2008 08:49:55 +0200 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: <18558.36890.465144.237784@harpo.it.uu.se> References: <18558.36890.465144.237784@harpo.it.uu.se> Message-ID: <200807170849.55320.roger.larsson@e-gatan.se> On Thursday 17 July 2008, Mikael Pettersson wrote: > Xingdong Bian writes: > > Hi > > > > Any one has the same issues with me? > > When i install the Erlang/OTP on the SUSE 11 for > > 12B-3: > > it says the gcc compiler is not supported, asks me to change another > > version of the gcc compiler > > gcc-4.3.0 is known to be broken. So SuSE 11 ships that? I'm not impressed. > No, SuSE does not ship 4.3.0 they ship a prerelease of 4.3.1 :~> gcc --version gcc (SUSE Linux) 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] I have not tried to compile yet myself. /RogerL From erlang@REDACTED Thu Jul 17 09:21:05 2008 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 17 Jul 2008 09:21:05 +0200 Subject: [erlang-questions] How to parse whole module? In-Reply-To: References: Message-ID: <9b08084c0807170021k24c2e1c8oa98590e12f71dda6@mail.gmail.com> epp:parse_file("foo.erl", "", ""). /Joe 2008/7/16 Daniel Kwiecinski : > Hi folks, > > How can I obtain the abstract form of the whole module source code? > Using something like this: > > eval(SourceCode,Environ) -> > {ok,Scanned,_} = erl_scan:string(SourceCode), > > {ok,Parsed} = erl_parse:parse_exprs(Scanned), > erl_eval:exprs(Parsed,Environ). > > works only for single forms not for a whole module. Ideally what I need is > kind of compiler switch (similar to -S) resulting in emitting AST and AST > after applied any parse_transforms. > Thank you in advance. > > -- > Kind Regards, > Daniel Kwiecinski > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- fra@REDACTED; ingvar.akesson@REDACTED [Kopia av detta meddelande skickas till FRA f?r ?vervaknings?ndam?l. De vill ju ?nd? l?sa min e-post.] [A copy of this mail has been sent to FRA for monitoring purposes. FRA wants to read all my e-mail and have been allowed to do by the Swedish parliment - in violation of article 12 of the UN Universal Declaration of Human Rights] From alpar@REDACTED Thu Jul 17 10:33:07 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Thu, 17 Jul 2008 09:33:07 +0100 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: References: Message-ID: <1216283587.3985.11.camel@piko.site> Hi, There are two issues to be solved for installing erlang on openSuse 11. 1. The wrong gcc version. Probably the easiest solution is to add the GCC software repository (http://download.opensuse.org/repositories/devel%3a/tools% 3a/gcc/openSUSE_11.0) to the package manager and upgrade your compiler. 2. Too new glibc version. This is a silly mistake in the erlang source. To solve it you must change a single line in it. See e.g. this: http://www.erlang.org/pipermail/erlang-questions/2008-July/036380.html Best regards, Alpar On Wed, 2008-07-16 at 16:51 +0100, Xingdong Bian wrote: > Hi > > > Any one has the same issues with me? > When i install the Erlang/OTP on the SUSE 11 for > 12B-3: > it says the gcc compiler is not supported, asks me to change another > version of the gcc compiler > > 11B-5, 12B-0,1,2: > ./configure is fine > then make with error: > ================================== > obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses > -L../lib/internal/i686-pc-linux-gnu /home/bian/downloads/otp_src_R12B-2/erts/obj/i686-pc-linux-gnu/libz.a -lethread -lpthread -lerts_internal_r -lrt > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `hipe_signal_init': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:305: undefined reference to `INIT' > obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' > /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** > [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux-gnu/beam.smp] > Error 1 > make[3]: Leaving directory > `/home/bian/downloads/otp_src_R12B-2/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory > `/home/bian/downloads/otp_src_R12B-2/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' > make: *** [emulator] Error 2 > ================================== > > > when i disable the hipe with > ./configure --disable-hipe > I still get error: > > ================================== > make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' > cd lib && \ > ERL_TOP=/home/bian/erlang/otp_src_R12B-1 > PATH=/home/bian/erlang/otp_src_R12B-1/bootstrap/bin:${PATH} \ > make opt SECONDARY_BOOTSTRAP=true > make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' > make[2]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' > === Entering application parsetools > make[3]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' > make[3]: Nothing to be done for `opt'. > make[3]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' > === Skipping subdir doc/src, it is missing > === Leaving application parsetools > make[2]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' > make[2]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' > make[2]: Nothing to be done for `opt'. > make[2]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' > make[2]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > Makefile:35: warning: overriding commands for target `docs' > /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: > ignoring old commands for target `docs' > === Entering application hipe > make[3]: Entering directory > `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' > /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals > -e > hipe_literals.hrl > erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin > hipe_rtl_arch.erl > make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault > make[3]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory > `/home/bian/erlang/otp_src_R12B-1/lib/hipe' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' > make: *** [secondary_bootstrap_build] Error 2 > > ================================== > > > The above two error texts from different version installation, but for > all 11b-5, 12b-0,1,2 the error is the same. > > Any one has any idea? > > Thanks > Xingdong > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From hakan@REDACTED Thu Jul 17 11:15:22 2008 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 17 Jul 2008 11:15:22 +0200 (CEST) Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: On Thu, 17 Jul 2008, devdoer bird wrote: db> Hi: db> I can use transform_table to upgrade the table schema in mnesia. db> db> Eg.The version 1 of user record's defination is db> db> -record(user_v1,{uuid,name}) db> db> I want to upgrade the user table to version 2 db> db> -record(user_v2,{uuid,name,email}). db> db> I can use transform_table like this: db> db> transform_table(user,fun({user_v1,Uuid,Name})->#user_v2{uuid=Uuid,name=Name,email=""} db> end,record_info(fields,user_v2),user_v2). db> db> My question is db> 1. while the upgrade is in in progress, is the user record I read either db> the version 1 or the version 2 ?That is I can't be sure one user record's db> current version. db> 2. while the upgrade is in progress,will the modify of the old user record db> be lost? It will differ per module and process. During the upgrade you may have some processes that are using the old module and some are using the new module. If this is an issue, you need to perform a more advanced upgrade procedure that first suspends the processes, then loads the new code and finaly resumes the processes. db> 3. If the 1 and 2 are true,how can I code two handle them? Shall I have to db> have two versions of process code to handle this situation ,like: db> process_one_user(UserRecord)-> db> case of current_version(UserRecord) of db> v1-> do something; db> v2->do something db> end db> end One way of getting better control of this, is to change the name of the record. Then it will be easy to test which "version" of the record that you are using. See also mnesia:transform_table/4. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson -------------- next part -------------- _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From mikpe@REDACTED Thu Jul 17 11:47:28 2008 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 17 Jul 2008 11:47:28 +0200 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: <200807170849.55320.roger.larsson@e-gatan.se> References: <18558.36890.465144.237784@harpo.it.uu.se> <200807170849.55320.roger.larsson@e-gatan.se> Message-ID: <18559.5424.617276.189615@harpo.it.uu.se> Roger Larsson writes: > On Thursday 17 July 2008, Mikael Pettersson wrote: > > Xingdong Bian writes: > > > Hi > > > > > > Any one has the same issues with me? > > > When i install the Erlang/OTP on the SUSE 11 for > > > 12B-3: > > > it says the gcc compiler is not supported, asks me to change another > > > version of the gcc compiler > > > > gcc-4.3.0 is known to be broken. So SuSE 11 ships that? I'm not impressed. > > > > No, SuSE does not ship 4.3.0 they ship a prerelease of 4.3.1 > > :~> gcc --version > gcc (SUSE Linux) 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] That one's still broken. The fix for the Erlang-breaking bug (gcc PR36339) was committed to the gcc-4.3 branch on May 27. From nem@REDACTED Thu Jul 17 12:23:52 2008 From: nem@REDACTED (Geoff Cant) Date: Thu, 17 Jul 2008 12:23:52 +0200 Subject: [erlang-questions] Fault-Tolerant TCP/IP Servers In-Reply-To: <011101c8e756$40134eb0$f21ea8c0@SSI.CORP> (David Mercer's message of "Wed, 16 Jul 2008 10:11:39 -0500") References: <00fe01c8e74e$a9b73280$f21ea8c0@SSI.CORP> <9810b81b0807160735g55d15637ld962ca6ffce2f146@mail.gmail.com> <011101c8e756$40134eb0$f21ea8c0@SSI.CORP> Message-ID: "David Mercer" writes: > No, TCP/IP is used for the message stream I am thinking of. Basically, the > client opens a TCP/IP connection to the server, and then sends HL7 messages > (a message format used in the healthcare industry) over the connection, > delimited by beginning- and end-of-message control codes. If the connection > is closed (e.g., server fails), the client will attempt to reconnect. My > thought is that if the secondary can remap the network so that connections > to that IP address are now routed to it, the reconnect would automatically > go to the secondary. Yup - this is relatively straightforward with linux/openbsd. You want one virtual ip address associated with the master until it fails, at which time the slave takes over the ip address. The clients will see the server go down, but it'll be back up as far as they can tell very quickly (master/slave failover). As other posters mentioned, the technology to use is VRRP (virtual router redundancy protocol - cisco proprietary but supported under linux with keepalived) or CARP (common address redundancy protocol) on *bsd. I believe there was even an erlang only solution: * http://www1.erlang.org/ml-archive/erlang-questions/200212/msg00049.html * http://www.nabble.com/-erlang-questions--Setting-virtual-IP-via-Erlang-td7732623.html#a7750568 I don't know if anyone generalised this into a distributed OTP app that takes over the IP address when the application is started on a node (and given that OTP has all the machinery to work out which nodes to start things on, monitors them for failure and restarts on new nodes, the only thing this app would have to do is take over the address). Hope some of those pointers help. Cheers, --Geoff Cant From sgolovan@REDACTED Thu Jul 17 13:47:02 2008 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 17 Jul 2008 15:47:02 +0400 Subject: [erlang-questions] Sockets leak in ssl_esock Message-ID: Hi! Appears that ssl_esock leaks sockets in case when a remote server drops an already established connection. The following output was obtained by enabling debug in ssl_esock: Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> ssl:start(). ok 2> ssl:connect("localhost",636,[]). fd = 4 Local proxy listen socket: fd = 4, port = 39302 ==========LOOP============= MASKS SET FOR FD: Before poll/select: 1 descriptor (total 4) [CONNECT_CMD] intref = 1, lipstring = 0.0.0.0 lport = 0, fipstring = 127.0.0.1 fport = 636, flags = fd = 5 fd = 5 -> WAIT_CONNECT fd = 5 ==========LOOP============= MASKS SET FOR FD: 5 (write) Before poll/select: 2 descriptors (total 5) ----------------------------------- WAIT_CONNECT fd = 5 -> SSL_CONNECT ==========LOOP============= MASKS SET FOR FD: 5 (write) Before poll/select: 2 descriptors (total 5) ----------------------------------- SSL_CONNECT fd = 5 ==========LOOP============= MASKS SET FOR FD: 5 (read) Before poll/select: 2 descriptors (total 5) ----------------------------------- SSL_CONNECT fd = 5 ==========LOOP============= MASKS SET FOR FD: 5 (read) Before poll/select: 2 descriptors (total 5) ----------------------------------- SSL_CONNECT fd = 5 -> CONNECTED ==========LOOP============= MASKS SET FOR FD: Before poll/select: 2 descriptors (total 5) ----------------------------------- [PROXY_LISTEN_SOCK] conn accepted: proxyfd = 6, peer port = 41525 Error calling accept() CONNECTED[PROXY_JOIN_CMD] fd = 5 portnum = 41525 {ok,{sslsocket,5,<0.43.0>}} 3> ----------------------------------------------------------------------------------------------- (Here connection is established successfully.) lsof shows the following: ssl_esock 4313 sergei 4u IPv4 12163520 TCP 127.0.0.1:39302 (LISTEN) ssl_esock 4313 sergei 5u IPv4 12163527 TCP 127.0.0.1:59963->127.0.0.1:ldaps (ESTABLISHED) ssl_esock 4313 sergei 6u IPv4 12163530 TCP 127.0.0.1:39302->127.0.0.1:41525 (ESTABLISHED) ----------------------------------------------------------------------------------------------- -> JOINED ==========LOOP============= MASKS SET FOR FD: 6 (read) 5 (read) Before poll/select: 2 descriptors (total 6) 3> ----------------------------------- JOINED: read from ssl fd = 5 read from fd = 5, cc = 0 SSL eof ==========LOOP============= MASKS SET FOR FD: 6 (read) Before poll/select: 2 descriptors (total 6) ----------------------------------- JOINED: reading from proxy, proxyfd = 6 read from proxyfd = 6, cc = 0 ----------------------------------------------------------------------------------------------- (Here I've shutdown the remote server.) ----------------------------------------------------------------------------------------------- proxy eof or error -> DEFUNCT ==========LOOP============= MASKS SET FOR FD: Before poll/select: 2 descriptors (total 6) ----------------------------------------------------------------------------------------------- lsof shows the following: ssl_esock 4313 sergei 4u IPv4 12163520 TCP 127.0.0.1:39302 (LISTEN) ssl_esock 4313 sergei 5u sock 0,5 12163527 can't identify protocol ssl_esock 4313 sergei 6u sock 0,5 12163530 can't identify protocol Note the two last sockets. They are stuck forever (until ssl_esock is running). Is this a known bug? Is there a way to fix it? Cheers! -- Sergei Golovan From devdoer2@REDACTED Thu Jul 17 14:20:11 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 17 Jul 2008 20:20:11 +0800 Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: 2008/7/17, Hakan Mattsson : > > On Thu, 17 Jul 2008, devdoer bird wrote: > > db> Hi: > db> I can use transform_table to upgrade the table schema in mnesia. > db> > db> Eg.The version 1 of user record's defination is > db> > db> -record(user_v1,{uuid,name}) > db> > db> I want to upgrade the user table to version 2 > db> > db> -record(user_v2,{uuid,name,email}). > db> > db> I can use transform_table like this: > db> > > db> transform_table(user,fun({user_v1,Uuid,Name})->#user_v2{uuid=Uuid,name=Name,email=""} > db> end,record_info(fields,user_v2),user_v2). > db> > db> My question is > db> 1. while the upgrade is in in progress, is the user record I > read either > db> the version 1 or the version 2 ?That is I can't be sure one user > record's > db> current version. > db> 2. while the upgrade is in progress,will the modify of the old user > record > db> be lost? > > It will differ per module and process. During the upgrade you may have > some processes that are using the old module and some are using the > new module. If this is an issue, you need to perform a more advanced > upgrade procedure that first suspends the processes, then loads the > new code and finaly resumes the processes. I can't understand. Won't one process read either version 1 or version 2? Eg. there're 5 user records of version 1 intially, when I do transform_table,there may be 3 user records of version 1,and 2 user records of version 2 if the transform_table operation is not finished yet. db> 3. If the 1 and 2 are true,how can I code two handle them? Shall I have > to > db> have two versions of process code to handle this situation ,like: > db> process_one_user(UserRecord)-> > db> case of current_version(UserRecord) of > db> v1-> do something; > db> v2->do something > db> end > db> end > > One way of getting better control of this, is to change the name of the > record. > Then it will be easy to test which "version" of the record that you are > using. > See also mnesia:transform_table/4. If I do so,many codes rely on the original record name will be changed, and I have to code in if-else style in many place .Am I right? /H?kan > --- > H?kan Mattsson (uabhams) > Erlang/OTP, Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.egner@REDACTED Thu Jul 17 15:21:32 2008 From: s.egner@REDACTED (Sebastian Egner) Date: Thu, 17 Jul 2008 15:21:32 +0200 Subject: [erlang-questions] Erlang on Windows NT4 Message-ID: <487F475C.2050506@specs.de> Hello, Thank you for all the comments! For what it's worth, I found out that the NT4 compatibility issue is not related to Erlang/OTP specifically, but rather an general byproduct of Microsoft terminating support for NT4 in Visual C++ 8: http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/2435c3ab-f732-467e-8224-5f4e3f12c10b/ http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html In short, when the system loads the VC8 runtime lib MSVCR80.DLL, it tries to resolve a reference to the function GetLongPathNameW in KERNEL32.DLL, which NT4 doesn't have. The beauty of it is that this reference seems to be the only reason for most VC8 application not to run on NT4! People have reported successfully running non-unicode VC8 applications by using custom-compiled versions of MSVCR80.DLL without the call to GetLongPathNameW. This means, short of ERTS being ported back to VC 6.0, there is no hope of an 'official' version of ERTS supporting NT4, because Microsoft's licence will prevent Ericsson to include a patched runtime lib in the redistributable VC package. (Unless I am mistaken and there is a legal way of supporting NT with VC8.) Experimentally trying out R12B-3 with a patched version of MSVCR80.DLL (Start emacs, load MSVCR80.DLL, replace "GetLongPathNameW" by "GetModuleHandleA" (= 16 chars and linkable), save.), and creating a proper 'erl.ini' (which the installer could not do due to an acute lack of working VMs at the time), I am informed by the VM: C:\Program Files\erl5.6.3\erts-5.6.3\bin>erl Windows version not supported (min required: winnt 5.0) So this clarifies the bug-report of my first email: Yes, Erlang/OTP R12B-3 does check the OS version and refuses to run on NT4. However, the check is executed in an Erlang VM, which won't start in the first place, throwing an error message that takes an expert to interpret. You could consider checking the OS version in the NSIS installer itself, e.g. using the function GetWindowsVersion: http://nsis.sourceforge.net/Get_Windows_version and deactivate the check from the VM (erts\emulator\sys\win32\sys.c: check_supported_os_version()). Kind regards, Sebastian From hakan@REDACTED Thu Jul 17 15:33:20 2008 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 17 Jul 2008 15:33:20 +0200 (CEST) Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: On Thu, 17 Jul 2008, devdoer bird wrote: db> 2008/7/17, Hakan Mattsson : db> > db> > On Thu, 17 Jul 2008, devdoer bird wrote: db> > db> My question is db> > db> 1. while the upgrade is in in progress, is the user record I read db> > db> either the version 1 or the version 2 ? That is I can't be sure db> > db> one user record's current version. db> > db> 2. while the upgrade is in progress,will the modify of the old user db> > db> record be lost? db> > db> > It will differ per module and process. During the upgrade you may have db> > some processes that are using the old module and some are using the db> > new module. If this is an issue, you need to perform a more advanced db> > upgrade procedure that first suspends the processes, then loads the db> > new code and finally resumes the processes. db> db> I can't understand. Won't one process read either version 1 or version 2? db> Eg. there're 5 user records of version 1 intially, when I do db> transform_table,there may db> be 3 user records of version 1,and 2 user records of version 2 if the db> transform_table operation is not finished yet. mnesia:transform_table/2 grabs a table lock. If you are using transactions you need to wait for the transform to complete before you can access the table. If you are performing dirty access during the mnesia:transform_table/2 operation, reading of some records will result in version 1 and others will result in version 2. Dirty updates may be overwritten by mnesia:transform_table/2. Then you have the issue of which version of your code that is running. During the code upgrade, some processes will run version 1 of a module (using version 1 of the record definition) while others will run version 2 of the module (using version 2 of the record definition). db> > db> 3. If the 1 and 2 are true,how can I code two handle them? db> > db> Shall I have to have two versions of process code to handle db> > db> this situation ,like: db> > db> process_one_user(UserRecord)-> db> > db> case of current_version(UserRecord) of db> > db> v1-> do something; db> > db> v2->do something db> > db> end db> > db> end db> > db> > One way of getting better control of this, is to change the name db> > of the record. Then it will be easy to test which "version" of db> > the record that you are using. See also mnesia:transform_table/4. db> db> If I do so,many codes rely on the original record name will be db> changed, and I have to code in if-else style in many place . db> Am I right? Yes. If the change affects too many modules, that approach is impractical. An other way of handling it is to have wrapper functions for all reading operations in Mnesia. If the wrapper detects a record with version 1 it could transform it into version 2. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson From devdoer2@REDACTED Thu Jul 17 15:49:34 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 17 Jul 2008 21:49:34 +0800 Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: 2008/7/17, Hakan Mattsson : > > On Thu, 17 Jul 2008, devdoer bird wrote: > > db> 2008/7/17, Hakan Mattsson : > db> > > db> > On Thu, 17 Jul 2008, devdoer bird wrote: > db> > db> My question is > db> > db> 1. while the upgrade is in in progress, is the user record I read > db> > db> either the version 1 or the version 2 ? That is I can't be sure > db> > db> one user record's current version. > db> > db> 2. while the upgrade is in progress,will the modify of the old > user > db> > db> record be lost? > db> > > db> > It will differ per module and process. During the upgrade you may > have > db> > some processes that are using the old module and some are using the > db> > new module. If this is an issue, you need to perform a more advanced > db> > upgrade procedure that first suspends the processes, then loads the > db> > new code and finally resumes the processes. > db> > db> I can't understand. Won't one process read either version 1 or version > 2? > db> Eg. there're 5 user records of version 1 intially, when I do > db> transform_table,there may > db> be 3 user records of version 1,and 2 user records of version 2 if the > db> transform_table operation is not finished yet. > > mnesia:transform_table/2 grabs a table lock. If you are using > transactions you need to wait for the transform to complete before you > can access the table. > > If you are performing dirty access during the mnesia:transform_table/2 > operation, reading of some records will result in version 1 and others > will result in version 2. Dirty updates may be overwritten by > mnesia:transform_table/2. > > Then you have the issue of which version of your code that is > running. During the code upgrade, some processes will run version 1 of > a module (using version 1 of the record definition) while others will > run version 2 of the module (using version 2 of the record definition). Thanks a lot.I still has one question .If the transform_table grabs the table lock,then how does the mnesia support the hot-upgrade table operation? Because the transform table grabs table lock,the cocurrent write opertion will be blocked until the tranform_table is done. db> > db> 3. If the 1 and 2 are true,how can I code two handle them? > db> > db> Shall I have to have two versions of process code to handle > db> > db> this situation ,like: > db> > db> process_one_user(UserRecord)-> > db> > db> case of current_version(UserRecord) of > db> > db> v1-> do something; > db> > db> v2->do something > db> > db> end > db> > db> end > db> > > db> > One way of getting better control of this, is to change the name > db> > of the record. Then it will be easy to test which "version" of > db> > the record that you are using. See also mnesia:transform_table/4. > db> > db> If I do so,many codes rely on the original record name will be > db> changed, and I have to code in if-else style in many place . > db> Am I right? > > Yes. If the change affects too many modules, that approach is impractical. > > An other way of handling it is to have wrapper functions for all > reading operations in Mnesia. If the wrapper detects a record with > version 1 it could transform it into version 2. > > /H?kan > --- > H?kan Mattsson (uabhams) > Erlang/OTP, Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnswolter@REDACTED Thu Jul 17 16:32:31 2008 From: johnswolter@REDACTED (john s wolter) Date: Thu, 17 Jul 2008 10:32:31 -0400 Subject: [erlang-questions] Install Erlang/OTP on SUSE 11 In-Reply-To: <6c2563b20807161440w674b96cau460bee8f6ccc0cba@mail.gmail.com> References: <6c2563b20807161203i72945fc1mff62ce6c04475e52@mail.gmail.com> <9CECDCC9-9DF1-4EC9-B7F8-B74DFECCC8A0@erlang-consulting.com> <6c2563b20807161440w674b96cau460bee8f6ccc0cba@mail.gmail.com> Message-ID: <24bcf1860807170732x3c1a5fc4w2732f3975a6a4638@mail.gmail.com> If anyone knows about identifiable problems in the OpenSUSE.org distribution please take a moment to report them. Their fix history has been good once a problem has been reported. They use OpenSUSE as a basis for their commercial distributions so they are well motivated to repair problems. 2008/7/16 Edwin Fine : > Deleting the whole folder and untaring it again is not always the same as > doing a make clean. There are often precompiled files in an Erlang > distribution to save you time when building it. I *think* these are all > .beam files so it theoretically should not make a difference. But... I once > had a great deal of trouble building Erlang for OpenSuse until I started > right from the beginning and THEN did a ./configure; make clean; make > > Hope this helps. > > On Wed, Jul 16, 2008 at 5:00 PM, Xingdong Bian > wrote: > >> hi, >> Yeah i just delete the whole folder and untar it again. >> >> Xingdong >> >> On 16 Jul 2008, at 20:03, Edwin Fine wrote: >> >> Have you tried >> >> make clean;./configure >> >> ? >> >> 2008/7/16 Xingdong Bian : >> >>> Hi >>> >>> Any one has the same issues with me? >>> When i install the Erlang/OTP on the SUSE 11 for >>> 12B-3: >>> it says the gcc compiler is not supported, asks me to change another >>> version of the gcc compiler >>> >>> 11B-5, 12B-0,1,2: >>> ./configure is fine >>> then make with error: >>> ================================== >>> obj/i686-pc-linux-gnu/opt/smp/ttsl_drv.o -lutil -ldl -lm -lncurses >>> -L../lib/internal/i686-pc-linux-gnu >>> /home/bian/downloads/otp_src_R12B-2/erts/obj/i686-pc-linux-gnu/libz.a >>> -lethread -lpthread -lerts_internal_r -lrt >>> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >>> `my_sigaction': >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >>> undefined reference to `INIT' >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >>> undefined reference to `__next_sigaction' >>> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >>> `hipe_signal_init': >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:305: >>> undefined reference to `INIT' >>> obj/i686-pc-linux-gnu/opt/smp/hipe_x86_signal.o: In function >>> `my_sigaction': >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >>> undefined reference to `INIT' >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >>> undefined reference to `__next_sigaction' >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:220: >>> undefined reference to `INIT' >>> /home/bian/downloads/otp_src_R12B-2/erts/emulator/hipe/hipe_x86_signal.c:230: >>> undefined reference to `__next_sigaction' >>> collect2: ld returned 1 exit status >>> make[3]: *** >>> [/home/bian/downloads/otp_src_R12B-2/bin/i686-pc-linux-gnu/beam.smp] Error >>> 1 >>> make[3]: Leaving directory >>> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >>> make[2]: *** [opt] Error 2 >>> make[2]: Leaving directory >>> `/home/bian/downloads/otp_src_R12B-2/erts/emulator' >>> make[1]: *** [smp] Error 2 >>> make[1]: Leaving directory `/home/bian/downloads/otp_src_R12B-2/erts' >>> make: *** [emulator] Error 2 >>> ================================== >>> >>> >>> when i disable the hipe with >>> ./configure --disable-hipe >>> I still get error: >>> >>> ================================== >>> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >>> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1' >>> cd lib && \ >>> ERL_TOP=/home/bian/erlang/otp_src_R12B-1 >>> PATH=/home/bian/erlang/otp_src_R12B-1/bootstrap/bin:${PATH} \ >>> make opt SECONDARY_BOOTSTRAP=true >>> make[1]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib' >>> make[2]: Entering directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >>> === Entering application parsetools >>> make[3]: Entering directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >>> make[3]: Nothing to be done for `opt'. >>> make[3]: Leaving directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools/src' >>> === Skipping subdir doc/src, it is missing >>> === Leaving application parsetools >>> make[2]: Leaving directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/parsetools' >>> make[2]: Entering directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >>> make[2]: Nothing to be done for `opt'. >>> make[2]: Leaving directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/asn1/src' >>> make[2]: Entering directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >>> Makefile:35: warning: overriding commands for target `docs' >>> /home/bian/erlang/otp_src_R12B-1/make/otp_subdir.mk:28: warning: >>> ignoring old commands for target `docs' >>> === Entering application hipe >>> make[3]: Entering directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >>> /home/bian/erlang/otp_src_R12B-1/bin/i686-pc-linux-gnu/hipe_mkliterals -e >>> > hipe_literals.hrl >>> erlc -W +debug_info +warn_obsolete_guard +inline -o../ebin >>> hipe_rtl_arch.erl >>> make[3]: *** [../ebin/hipe_rtl_arch.beam] Segmentation fault >>> make[3]: Leaving directory >>> `/home/bian/erlang/otp_src_R12B-1/lib/hipe/rtl' >>> make[2]: *** [opt] Error 2 >>> make[2]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib/hipe' >>> make[1]: *** [opt] Error 2 >>> make[1]: Leaving directory `/home/bian/erlang/otp_src_R12B-1/lib' >>> make: *** [secondary_bootstrap_build] Error 2 >>> >>> ================================== >>> >>> >>> The above two error texts from different version installation, but for >>> all 11b-5, 12b-0,1,2 the error is the same. >>> >>> Any one has any idea? >>> >>> Thanks >>> Xingdong >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> >> -- >> The great enemy of the truth is very often not the lie -- deliberate, >> contrived and dishonest, but the myth, persistent, persuasive, and >> unrealistic. Belief in myths allows the comfort of opinion without the >> discomfort of thought. >> John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) >> >> >> > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > > _______________________________________________ > 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 nick@REDACTED Thu Jul 17 16:40:09 2008 From: nick@REDACTED (Niclas Eklund) Date: Thu, 17 Jul 2008 16:40:09 +0200 (CEST) Subject: [erlang-questions] Erlang on Windows NT4 In-Reply-To: <487B5B4F.5040508@specs.de> References: <487B1DFC.5050001@specs.de> <487B5B4F.5040508@specs.de> Message-ID: Hello! You should be able to use R12B IC for R11B. However, the IC C-backend may encounter problems since some runtime libraries are probably not available for Windows NT. Since the distribution protocol hasn't been changed between R11B and R12B, Jinterface can probably also be used for R11B (assuming that a working JDK version is available for NT). But, I'm affraid that this isn't a long term solution since you might need other patches that isn't compliant with R11B. Best regards, Niclas Erlang/OTP On Mon, 14 Jul 2008, Sebastian Egner wrote: > Hello Niclas, > >> * "If an inherited function name begun with a capital letter the generated >> stub/skeleton oe_tc/1 function was incorrect." > This is the one you kindly fixed for me. :-) >> >> * "Insufficient buffer allocated when passing wide strings using the C >> backend on a 64-bit architecture." > No problem with that... >> I assume that the latter doesn't affect you. The last time we e-mailed (Oct >> 2007) it concerned if IC support recursive types, which it doesn't. Have >> you been in touch with someone else regarding, for example, >> IC/Erl_interface? > I just looked it up. The bug was in Jinterface, not in Erl_interface (sorry > for the mistake). My original posting to erlang-bugs was in Digest Vol 77, > Issue 1, > and the person with whom I was in touch is Raimo Niskanen. > > Sebastian. > From erlang-questions_efine@REDACTED Thu Jul 17 17:57:43 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 17 Jul 2008 11:57:43 -0400 Subject: [erlang-questions] [erlang-bugs] Erlang on Windows NT4 In-Reply-To: <487F475C.2050506@specs.de> References: <487F475C.2050506@specs.de> Message-ID: <6c2563b20807170857n17411f07o594fc31bf7c7b75f@mail.gmail.com> Couldn't you create a new "compatibility" DLL, that implements or stubs "GetLongPathNameW"? Then if you link in that DLL to the Erlang NT4 build, the call will resolve at run time. This is much less dirty, and if Erlang adds it in as an NT4 compatibility patch, everyone will be happy. On Thu, Jul 17, 2008 at 9:21 AM, Sebastian Egner wrote: > Hello, > > Thank you for all the comments! > > For what it's worth, I found out that the NT4 compatibility issue is not > related to Erlang/OTP specifically, but rather an general byproduct of > Microsoft terminating support for NT4 in Visual C++ 8: > > > > http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/2435c3ab-f732-467e-8224-5f4e3f12c10b/ > > > > http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html > > In short, when the system loads the VC8 runtime lib MSVCR80.DLL, it > tries to resolve a reference to the function GetLongPathNameW in > KERNEL32.DLL, which NT4 doesn't have. The beauty of it is that this > reference seems to be the only reason for most VC8 application not to > run on NT4! People have reported successfully running non-unicode VC8 > applications by using custom-compiled versions of MSVCR80.DLL without > the call to GetLongPathNameW. > > This means, short of ERTS being ported back to VC 6.0, there is no hope > of an 'official' version of ERTS supporting NT4, because Microsoft's > licence will prevent Ericsson to include a patched runtime lib in the > redistributable VC package. (Unless I am mistaken and there is a legal > way of supporting NT with VC8.) > > Experimentally trying out R12B-3 with a patched version of MSVCR80.DLL > (Start emacs, load MSVCR80.DLL, > replace "GetLongPathNameW" by "GetModuleHandleA" (= 16 chars and > linkable), save.), and creating a proper 'erl.ini' (which the > installer could not do due to an acute lack of working VMs at the time), > I am informed by the VM: > > C:\Program Files\erl5.6.3\erts-5.6.3\bin>erl > Windows version not supported (min required: winnt 5.0) > > So this clarifies the bug-report of my first email: > > Yes, Erlang/OTP R12B-3 does check the OS version and refuses to run on > NT4. However, the check is executed in an Erlang VM, which won't start > in the first place, throwing an error message that takes an expert to > interpret. > > You could consider checking the OS version in the NSIS installer itself, > e.g. using the function GetWindowsVersion: > > http://nsis.sourceforge.net/Get_Windows_version > > and deactivate the check from the VM (erts\emulator\sys\win32\sys.c: > check_supported_os_version()). > > Kind regards, > > Sebastian > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-bugs > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Thu Jul 17 20:20:30 2008 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 17 Jul 2008 22:20:30 +0400 Subject: [erlang-questions] Sockets leak in ssl_esock In-Reply-To: References: Message-ID: On 7/17/08, Sergei Golovan wrote: > Hi! > > Appears that ssl_esock leaks sockets in case when a remote server > drops an already established connection Looks like I was too fast in reporting this. Simply closing the socket after it's closed by a remote side works fine. -- Sergei Golovan From erlang-questions_efine@REDACTED Thu Jul 17 21:16:28 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 17 Jul 2008 15:16:28 -0400 Subject: [erlang-questions] edoc: cross-referencing standard Erlang functions Message-ID: <6c2563b20807171216j1b96d3eat52b41d69fcb6701a@mail.gmail.com> I am documenting an application using edoc, and I want to cross-reference a function in a standard Erlang application, say, //stdlib/gen_server:start_link/3, without hard-coding a URL like file:///usr/local/lib/erlang/lib/stdlib-1.15.3/doc/html/gen_server.html#start_link-3. When I do this in edoc using the syntax //Application/Module:Function/Arity, it cross references gen_server within my application's directory, so the generated link does not work. I saw a reference to using edoc-info files, but couldn't find more detailed information other than edoc would use all edoc-info files on the path. I could find very few edoc-info files in the Erlang distro. I got the impression that all the existing Erlang docs would have to be generated using edoc to generate the appropriate edoc-info files, but they aren't. I looked at the edoc docs and source code for 0.7.6 with no further enlightenment. Is there some way to do this in edoc that I've missed? -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Thu Jul 17 21:27:27 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Thu, 17 Jul 2008 23:27:27 +0400 Subject: [erlang-questions] Design tool for erlang software Message-ID: 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? -- Maxim Treskin From justin@REDACTED Thu Jul 17 21:41:32 2008 From: justin@REDACTED (Justin Sheehy) Date: Thu, 17 Jul 2008 15:41:32 -0400 Subject: [erlang-questions] Design tool for erlang software In-Reply-To: Message-ID: On 7/17/08 3:27 PM, "Maxim Treskin" wrote: > Is there any design tool spesial for erlang software, escept paper > sheet and pen? (X)Emacs seems to work pretty well. -Justin From rapsey@REDACTED Thu Jul 17 22:25:06 2008 From: rapsey@REDACTED (Rapsey) Date: Thu, 17 Jul 2008 22:25:06 +0200 Subject: [erlang-questions] Design tool for erlang software In-Reply-To: References: Message-ID: <97619b170807171325re95de7aw38b1ea58fa6856e0@mail.gmail.com> Not that I am aware of. I don't really think it is needed. Designing the system in detail before writing the code is a necessity of object oriented programming. In my experience, it is quite possible to grow Erlang programs as you go along. Sergej 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? > > -- > Maxim Treskin > _______________________________________________ > 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-questions_efine@REDACTED Fri Jul 18 00:44:27 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 17 Jul 2008 18:44:27 -0400 Subject: [erlang-questions] edoc: cross-referencing standard Erlang functions In-Reply-To: <6c2563b20807171216j1b96d3eat52b41d69fcb6701a@mail.gmail.com> References: <6c2563b20807171216j1b96d3eat52b41d69fcb6701a@mail.gmail.com> Message-ID: <6c2563b20807171544n553ff164yef212c08a7497ccf@mail.gmail.com> I am replying to my own question. I did some more looking through the edoc code. It appears that the edoc documentation provided with the Erlang distribution uses some JavaScript tricks to make cross-app references work properly. There's a file named erlresolvelinks.js in the $ERLANG_HOME/doc directory. It appears to have been generated by a program, and maps the names of applications and modules to the correct documentation file. erlresolvelinks.js provides a single function named erlhref, which is called as follows: javascript:erlhref(ups, appName, htmlFile); Example: {@link //kernel/file:read_file/1} in a .erl file corresponds to javascript:erlhref('../../../../', 'kernel', 'file.html#read_file-1'); in the the generated Erlang HTML for that .erl file - but not using the edoc that comes with the standard Erlang/OTP distribution (I am using R12B-3). I searched the entire R12B-3 source distro and did not find the word "erlhref" in any of its files. ~/erlang/otp_src_R12B-3$ find . | xargs grep erlhref ~/erlang/otp_src_R12B-3$ I searched the installed release, just in case: /usr/local/lib/erlang$ find . -name "*.html" -prune -o -print | xargs grep erlhref ./doc/erlresolvelinks.js:function erlhref(ups, app, rest) { /usr/local/lib/erlang$ I added the option [{app_default, "/usr/local/lib/erlang/lib"}] to the call to edoc:application/3, but the generated cross references did not contain the version of the application and were therefore incorrect. Example: In edoc, //stdlib/gen_server:code_change/3 generates the link file:///usr/local/lib/erlang/lib/stdlib/doc/gen_server.html#code_change-3, which is incorrect (it should have been stdlib-1.15.3). I don't know how the OTP team generated the Erlang docs, but it would be nice if I could have access to the same features. Any ideas on this? On Thu, Jul 17, 2008 at 3:16 PM, Edwin Fine wrote: > I am documenting an application using edoc, and I want to cross-reference > a function in a standard Erlang application, say, > //stdlib/gen_server:start_link/3, without hard-coding a URL like > file:///usr/local/lib/erlang/lib/stdlib-1.15.3/doc/html/gen_server.html#start_link-3. > > When I do this in edoc using the syntax > //Application/Module:Function/Arity, it cross references gen_server within > my application's directory, so the generated link does not work. I saw a > reference to using edoc-info files, but couldn't find more detailed > information other than edoc would use all edoc-info files on the path. I > could find very few edoc-info files in the Erlang distro. I got the > impression that all the existing Erlang docs would have to be generated > using edoc to generate the appropriate edoc-info files, but they aren't. > > I looked at the edoc docs and source code for 0.7.6 with no further > enlightenment. > > Is there some way to do this in edoc that I've missed? > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From litaocheng@REDACTED Fri Jul 18 06:19:13 2008 From: litaocheng@REDACTED (litao cheng) Date: Fri, 18 Jul 2008 12:19:13 +0800 Subject: [erlang-questions] compile error with bits unit syntax Message-ID: hi, all. when I read this paper: Programming Efficiently with Binaries and Bit Strings http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf, I encounter a compile error, the code snipes is a example to parse the IS 683-PRL protocol: decode(<>) -> [Chan || <> <- Chans]. the compiler says: bit type mismatch (unit) between 11 and 1 I read the erlang reference mannual, the bits unit default is 1, I think the unit can be set, why this compile error occur? thank you! my erlang emulator is 5.6.3(R12B-3). -------------- next part -------------- An HTML attachment was scrubbed... URL: From ttmrichter@REDACTED Fri Jul 18 08:59:05 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Fri, 18 Jul 2008 14:59:05 +0800 Subject: [erlang-questions] ERTS external term format questions. Message-ID: <1216364346.32463.13.camel@isolde> For testing purposes I need to be able to generate every type of the External Term Format. I've been able to do this for every type except REFERENCE_EXT (the system always gives me a NEW_REFERENCE_EXT) and FUN_EXT (the system always gives me a NEW_FUN_EXT). How would I go about making the run-time generate the older forms from terms? -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) I have to wonder why people think that when they can't manage local personnel within easy strangling and shooting distance, then they can manage personnel thousands of miles away that have different languages, cultures, and business rules. (Joe Celko) -------------- next part -------------- An HTML attachment was scrubbed... URL: From tchamila@REDACTED Fri Jul 18 09:17:13 2008 From: tchamila@REDACTED (chamila piyasena) Date: Fri, 18 Jul 2008 12:47:13 +0530 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487DCEBD.5050108@di.uminho.pt> References: <487B60C5.4030800@erix.ericsson.se> <487DCEBD.5050108@di.uminho.pt> Message-ID: <552d666a0807180017o31377755he40fed6686a07c64@mail.gmail.com> I also have a similar problem as Paulo. By using this can we get the original binary of the http message or should we have to create the original message using the details in the reciving tuples? cheers, chamila http://chamilar.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan@REDACTED Fri Jul 18 10:00:36 2008 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 18 Jul 2008 10:00:36 +0200 (CEST) Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: On Thu, 17 Jul 2008, devdoer bird wrote: db> Thanks a lot.I still has one question .If the transform_table grabs db> the table lock,then how does the mnesia support the hot-upgrade table db> operation? Because the transform table grabs table lock,the cocurrent db> write opertion will be blocked until the tranform_table is done. The "normal" usage of mnesia:transform_table/4 is to give a fun as argument. The fun will then be used by Mnesia to perform the actual transformation of each record within a transaction. But you do also have the option to use 'ignore' instead of a fun. Then the mnesia:transform_table/4 function will only perform the schema transformation, leaving all records in the table in the old format. When the mnesia:transform_table/4 function returns, the table lock is released and you can iterate over the table yourself in order to perform the transformation of each record. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson From csanto@REDACTED Fri Jul 18 14:03:33 2008 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 18 Jul 2008 14:03:33 +0200 Subject: [erlang-questions] yaws_soap_lib question Message-ID: <48808695.9090901@diit.unict.it> Hi all, I'm a SOAP/SW newbie and I'm trying to use yaws as a client for a web service. This is what happens after I initialize the model and try to call a service. 19> yaws_soap_lib:call(M, "add", [1, 2]). =ERROR REPORT==== 18-Jul-2008::13:59:49 === Error in process <0.60.0> with exit value: {{nocatch,{error,"Struct doesn't match model: recordtype not expected: p:add"}},[{erlsom_write,findAlternative,4},{erlsom_write,processSubType,5},{erlsom_write,processElementValues,7},{erlsom_write,struct2xml,6... The wsdl file has been generated from a Java interface using java2wsl. This is the java interface: public interface Test { public int add (int x, int y); } I've generated the WSDL (which is attached to this message) using DOCUMENT and LITERAL encodig. Any suggestions?? thanks. --Corrado -- ================================================================== 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 ================================================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: test.wsdl Type: text/xml Size: 2032 bytes Desc: not available URL: From sverker@REDACTED Fri Jul 18 16:26:31 2008 From: sverker@REDACTED (Sverker Eriksson) Date: Fri, 18 Jul 2008 16:26:31 +0200 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487DCEBD.5050108@di.uminho.pt> References: <487B60C5.4030800@erix.ericsson.se> <487DCEBD.5050108@di.uminho.pt> Message-ID: <4880A817.3060504@erix.ericsson.se> Paulo S?rgio Almeida wrote: > As you are making it official, here is something you may consider as > well, if not now, maybe for a future version: supporting the "binary" > option. As it is now, the binary option is ignored [...] I suppose you mean to return the same http-tuples but with binaries instead of lists for the string values. One problem here is backward compatibility (again). At least Yaws is already using the combination [binary,{packet,http}]. We could of course argue our right to change an undocumented feature, but is it worth it? Maybe a new {packet, http_bin} is a future solution even though using the binary option could be more elegant. /Sverker, Erlang/OTP Ericsson From psa@REDACTED Fri Jul 18 17:59:25 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Fri, 18 Jul 2008 16:59:25 +0100 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <4880A817.3060504@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> <487DCEBD.5050108@di.uminho.pt> <4880A817.3060504@erix.ericsson.se> Message-ID: <4880BDDD.3020208@di.uminho.pt> Hi, Sverker Eriksson wrote: > I suppose you mean to return the same http-tuples but with binaries > instead of lists for the string values. Yes. > One problem here is backward compatibility (again). At least Yaws is > already using the combination [binary,{packet,http}]. We could of course Looks like it is in just a couple of places. In the others it uses plain {packet, http} without binary, or it uses binary in others after switching to raw or line mode. It should be simple to change. But perhaps Claes can answer that. > argue our right to change an undocumented feature, but is it worth it? The point is that I think having the possibility is useful. And if we are to fix it, it is now (that it is becoming official) or never. Regards, Paulo > Maybe a new {packet, http_bin} is a future solution even though using > the binary option could be more elegant. > > > /Sverker, Erlang/OTP Ericsson > From aconbere@REDACTED Fri Jul 18 21:41:55 2008 From: aconbere@REDACTED (anders conbere) Date: Fri, 18 Jul 2008 12:41:55 -0700 Subject: [erlang-questions] Dealing with code paths and software releases? Message-ID: <8ca3fbe80807181241m7065a1fbqfc5fbb1e24a47828@mail.gmail.com> What's the lists advice for dealing with pathing in erlang? I've been struggling to find a solutions I like. Adding the paths in the code feels gross since we're installing on heterogeneous systems where the paths might not be perfectly the same. .erlang files are hard to create for systems that run the services under many users. I could write bash files that add the paths via -pa pulling from a config file, but that seems a bit much. What are people's strategies for dealing with this system with no global include path :) ~ Anders From w.a.de.jong@REDACTED Fri Jul 18 21:43:22 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Fri, 18 Jul 2008 21:43:22 +0200 Subject: [erlang-questions] yaws_soap_lib question In-Reply-To: <48808695.9090901@diit.unict.it> References: <48808695.9090901@diit.unict.it> Message-ID: <407d9ef80807181243r42243c06kba5318b891d213c@mail.gmail.com> Hi Corrado, There are two variants of yaws_soap_lib:call() : 1 where you pass the arguments as a list, and one where you pass it a list of records. You have been using the first variant. This is just a rather simplistic wrapper around the 2nd variant: it is translated to yaws_soap_lib:call(.., Operation, [{list_to_atom(Operation, [], }], ...). It only works of the soap body has 1 'part', and if the name of this part is identical to the name of the operation. In your test, neither is true. You could try to call the service as: yaws_soap_lib:call(M, "add", [], [{'p:in0', [], 1}, {'p:in1', [], 2}]). or (after creating record definitions with yaws_soap_lib:write_hrl()): yaws_soap_lib:call(M, "add", [], [#'p:in0'{'in0' = 1}, #'p:in1'{'in1' = 2}]). With the version of yaws_soap_lib on my PC, this works. It may not work with the software in the distribution, because I have made several changes to fix various issues. Let me know if it doesn't work, I'll send you a new version of the code. Note: for a simple service like your test the records don't make much sense, but in my experience soap services often take a fairly complex XML as argument, and in such cases the records are convenient (I think, anyway). Note 2: It is unfortunate that nobody takes care of the yaws soap code... Personally I don't manage to take care of the improvements and the maintenance that the server side actually requires. It is not my area of expertise, I don't know how to test this kind of stuff efficiently, I don't understand the source code control system etc., and I don't have the time to change all that. For the client side it is a bit easier, since this only depends on erlsom. I think I'll include a new version of the soap client with the next version of erlsom (whenever that may be...). Regards, Willem 2008/7/18 Corrado Santoro : > Hi all, > > I'm a SOAP/SW newbie and I'm trying to use yaws as a client for a web > service. > > This is what happens after I initialize the model and try to call a > service. > > 19> yaws_soap_lib:call(M, "add", [1, 2]). > > =ERROR REPORT==== 18-Jul-2008::13:59:49 === > Error in process <0.60.0> with exit value: {{nocatch,{error,"Struct doesn't > match model: recordtype not expected: > p:add"}},[{erlsom_write,findAlternative,4},{erlsom_write,processSubType,5},{erlsom_write,processElementValues,7},{erlsom_write,struct2xml,6... > > The wsdl file has been generated from a Java interface using java2wsl. This > is the java interface: > > public interface Test { > public int add (int x, int y); > } > > > I've generated the WSDL (which is attached to this message) using DOCUMENT > and LITERAL encodig. > > Any suggestions?? > > thanks. > --Corrado > > > -- > ================================================================== > 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 > ================================================================== > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbudworth@REDACTED Sat Jul 19 01:10:56 2008 From: dbudworth@REDACTED (David Budworth) Date: Fri, 18 Jul 2008 18:10:56 -0500 Subject: [erlang-questions] proper way for a gen_server to self-terminate? Message-ID: <2e23d1d20807181610w7e7f6810n8c311924a0d68895@mail.gmail.com> I've been wrestling with creating a proper gen* structure is also a listening socket server, and I got most everything down except one thing. i have a supervisor (Sup) to keep track of connection handler (gen_server) processes. This supervisor has no children at init time. in my (non-gen*) acceptor process, I accept a socket, then do: supervisor:start_child(Sup,{clientspec marked as temporary}) that child process(handler) is then handed the Socket and the acceptor process gives control to the handler. if I do supervisor:which_children(Sup) i see it there, and it's doing it's thing (handle_info({tcp,Socket,<>})) now, when the remote side drops the socket, I get the {tcp_closed,Socket} info message and want to stop my gen_server. if I return (from handle_info): {stop,normal,State} the pid dies, but the supervisor:which_children still shows it as registered, but the pid is now listed as undefined. seems like it saw it die, just didn't remove it from the child list. if I cal supervisor:delete_child(Sup,self()) before returning {stop,normal,State} from handle_info I get a norpc error. is there a proper way to have a supervisor with dynamic gen_server children that suicide? thanks, -david -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Sat Jul 19 04:26:18 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sat, 19 Jul 2008 10:26:18 +0800 Subject: [erlang-questions] Accessing two versions of records when doing transform_table in mnesia In-Reply-To: References: Message-ID: 2008/7/18, Hakan Mattsson : > > On Thu, 17 Jul 2008, devdoer bird wrote: > > db> Thanks a lot.I still has one question .If the transform_table grabs > db> the table lock,then how does the mnesia support the hot-upgrade table > db> operation? Because the transform table grabs table lock,the cocurrent > db> write opertion will be blocked until the tranform_table is done. > > The "normal" usage of mnesia:transform_table/4 is to give a fun as > argument. The fun will then be used by Mnesia to perform the actual > transformation of each record within a transaction. > > But you do also have the option to use 'ignore' instead of a fun. > Then the mnesia:transform_table/4 function will only perform the > schema transformation, leaving all records in the table in the old > format. When the mnesia:transform_table/4 function returns, the table > lock is released and you can iterate over the table yourself in order > to perform the transformation of each record. OK.Thanks.In this way,I should program in if-else way to determine whether current record is in old format or in new transformed format while transforming. After the transform is done,I also shoulddelete the if-else code to read the all records in new format . /H?kan > --- > H?kan Mattsson (uabhams) > Erlang/OTP, Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 19 07:10:14 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 01:10:14 -0400 Subject: [erlang-questions] edoc hack to cross-reference standard Erlang OTP docs Message-ID: <6c2563b20807182210s560b1f84qe3170de51fdc42f8@mail.gmail.com> I have hacked together a modification to edoc_lib.erl that takes the list of directories returned by code:get_path() and adds the corresponding HTML directories to the list of apps that edoc will create cross-reference links for. This seems to work well for my needs, which are explained in the earlier posts I made. I don't claim that my hack is production ready or works in all situations, but it could be a basis to modify edoc if someone, who may or may not be named Richard, likes the approach. I've attached the edoc_lib.erl source code, which is from R12B-3, in case anyone who builds Erlang from source wants to try it out. On Thu, Jul 17, 2008 at 6:44 PM, Edwin Fine wrote: > I am replying to my own question. > > I did some more looking through the edoc code. It appears that the edoc > documentation provided with the Erlang distribution uses some JavaScript > tricks to make cross-app references work properly. There's a file named > erlresolvelinks.js in the $ERLANG_HOME/doc directory. It appears to have > been generated by a program, and maps the names of applications and modules > to the correct documentation file. erlresolvelinks.js provides a single > function named erlhref, which is called as follows: > > javascript:erlhref(ups, appName, htmlFile); > > Example: > > {@link //kernel/file:read_file/1} in a .erl file corresponds to javascript:erlhref('../../../../', > 'kernel', 'file.html#read_file-1'); > in the the generated Erlang HTML for that .erl file - but not using the > edoc that comes with the standard Erlang/OTP distribution (I am using > R12B-3). > > I searched the entire R12B-3 source distro and did not find the word > "erlhref" in any of its files. > > ~/erlang/otp_src_R12B-3$ find . | xargs grep erlhref > ~/erlang/otp_src_R12B-3$ > > I searched the installed release, just in case: > > /usr/local/lib/erlang$ find . -name "*.html" -prune -o -print | xargs grep > erlhref > ./doc/erlresolvelinks.js:function erlhref(ups, app, rest) { > /usr/local/lib/erlang$ > > I added the option [{app_default, "/usr/local/lib/erlang/lib"}] to the > call to edoc:application/3, but the generated cross references did not > contain the version of the application and were therefore incorrect. > > Example: > > In edoc, //stdlib/gen_server:code_change/3 generates the link > file:///usr/local/lib/erlang/lib/stdlib/doc/gen_server.html#code_change-3, > which is incorrect (it should have been stdlib-1.15.3). > > I don't know how the OTP team generated the Erlang docs, but it would be > nice if I could have access to the same features. > > Any ideas on this? > > > On Thu, Jul 17, 2008 at 3:16 PM, Edwin Fine < > erlang-questions_efine@REDACTED> wrote: > >> I am documenting an application using edoc, and I want to cross-reference >> a function in a standard Erlang application, say, >> //stdlib/gen_server:start_link/3, without hard-coding a URL like >> file:///usr/local/lib/erlang/lib/stdlib-1.15.3/doc/html/gen_server.html#start_link-3. >> >> When I do this in edoc using the syntax >> //Application/Module:Function/Arity, it cross references gen_server >> within my application's directory, so the generated link does not work. I >> saw a reference to using edoc-info files, but couldn't find more detailed >> information other than edoc would use all edoc-info files on the path. I >> could find very few edoc-info files in the Erlang distro. I got the >> impression that all the existing Erlang docs would have to be generated >> using edoc to generate the appropriate edoc-info files, but they aren't. >> >> I looked at the edoc docs and source code for 0.7.6 with no further >> enlightenment. >> >> Is there some way to do this in edoc that I've missed? >> >> -- >> The great enemy of the truth is very often not the lie -- deliberate, >> contrived and dishonest, but the myth, persistent, persuasive, and >> unrealistic. Belief in myths allows the comfort of opinion without the >> discomfort of thought. >> John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > > > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: edoc_lib_mod.tar.gz Type: application/x-gzip Size: 9120 bytes Desc: not available URL: From sean@REDACTED Sat Jul 19 15:26:36 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 09:26:36 -0400 Subject: [erlang-questions] Reading, Learning, Confused Message-ID: by a small bit of example code in Programming Erlang related to guards and short circuit booleans: f(X) when (X == 0) or (1/X > 2) -> ... g(X) when (X == 0) orelse ( 1/X > 2) -> ... The guard in f(X) fails when X is zero but succeeds in g(X) Can someone explain why? From vlm@REDACTED Sat Jul 19 15:50:06 2008 From: vlm@REDACTED (Lev Walkin) Date: Sat, 19 Jul 2008 06:50:06 -0700 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: Message-ID: <4881F10E.9080601@lionet.info> Sean Allen wrote: > by a small bit of example code in Programming Erlang related to guards > and short circuit booleans: > > f(X) when (X == 0) or (1/X > 2) -> > ... > > g(X) when (X == 0) orelse ( 1/X > 2) -> > ... > > The guard in f(X) fails when X is zero but succeeds in g(X) > > Can someone explain why? Sean, The thing is, "or" does not short-circuit evaluation when left side succeeds, whereas "orelse" does. Same short-circuit logic is behind the differences between "and" and "andalso". Actually, the very book you read explains these differences and warns about caveats a couple pages later (or earlier). Don't stop reading. -- vlm From sean@REDACTED Sat Jul 19 16:21:08 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 10:21:08 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <4881F10E.9080601@lionet.info> References: <4881F10E.9080601@lionet.info> Message-ID: On Jul 19, 2008, at 9:50 AM, Lev Walkin wrote: > Sean Allen wrote: >> by a small bit of example code in Programming Erlang related to >> guards and short circuit booleans: >> f(X) when (X == 0) or (1/X > 2) -> >> ... >> g(X) when (X == 0) orelse ( 1/X > 2) -> >> ... >> The guard in f(X) fails when X is zero but succeeds in g(X) >> Can someone explain why? > > > Sean, > > The thing is, "or" does not short-circuit evaluation when left side > succeeds, whereas "orelse" does. Same short-circuit logic is > behind the differences between "and" and "andalso". > > Actually, the very book you read explains these differences and warns > about caveats a couple pages later (or earlier). Don't stop reading. Actually its about 49 pages later where short circuit booleans are discussed and 37 pages for boolean expressions. *). How is ' f(X) when (X == 0) or (1/X > 2)' and or if it fails for 0? What is the difference at that point between and/or. I cant find anything really detailed on that. Is or equivalent to , and orelse equiv to ;? That is the only way this makes any sense to me. Except that well -- page 94... boolean expressions: 3> true or false true 4> (2 > 1 ) or ( 3 > 4 ) true makes sense. still cant wrap my head around given the above... why.... f(X) when (X == 0) or (1/X > 2) fails. does it fail because it would be a divide by zero? if yes, why does this also fail with divide by zero? (X == 0) orelse (1/X > 2) and why wouldnt the g(X) guard fail? and lord so confused... why are both of these true then: 1> X=1. 1 2> ( X == 1 ) or ( 1/X > 2 ). true 3> ( X == 1 ) orelse ( 1/X > 2 ). true the above... that makes sense to me. those guards... totally lost. TOTALLY. From alpar@REDACTED Sat Jul 19 16:31:12 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Sat, 19 Jul 2008 15:31:12 +0100 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <4881F10E.9080601@lionet.info> References: <4881F10E.9080601@lionet.info> Message-ID: <1216477872.4651.4.camel@piko.site> Btw. the Erlang Reference Manual says that As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are allowed in guards. In guards, however, evaluation is always short-circuited since guard tests are known to be free of side effects. ?(?Section 6.14, Short-Circuit Boolean Expressions) Something is wrong here, isn;t it? Regards, Alpar On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > Sean Allen wrote: > > by a small bit of example code in Programming Erlang related to guards > > and short circuit booleans: > > > > f(X) when (X == 0) or (1/X > 2) -> > > ... > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > ... > > > > The guard in f(X) fails when X is zero but succeeds in g(X) > > > > Can someone explain why? > > > Sean, > > The thing is, "or" does not short-circuit evaluation when left side > succeeds, whereas "orelse" does. Same short-circuit logic is > behind the differences between "and" and "andalso". > > Actually, the very book you read explains these differences and warns > about caveats a couple pages later (or earlier). Don't stop reading. > From erlang-questions_efine@REDACTED Sat Jul 19 16:47:04 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 10:47:04 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: <4881F10E.9080601@lionet.info> Message-ID: <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> You are getting twisted in knots. 1> X =0. 0 2> (X == 0) orelse (1/X > 2). true 3> f(). ok 4> X = 1. 1 5> (X == 0) orelse (1/X > 2). false 8> f(). 9> X = 0. 0 10> (X == 0) or (1/X > 2). ** exception error: bad argument in an arithmetic expression in operator '/'/2 called as 1 / 0 So the orelse construct works as advertised. It will not evaluate any expressions after the first false condition and prevents divide by zero. -module(guard). -compile([export_all]). test(X) when (X == 0) orelse (1/X > 2) -> true; test(_) -> false. 1> c(guard). {ok,guard} 2> guard:test(0). true 3> guard:test(0.0). true 4> guard:test(0.5). false 5> guard:test(0.4). true Hope this helps. On Sat, Jul 19, 2008 at 10:21 AM, Sean Allen wrote: > > On Jul 19, 2008, at 9:50 AM, Lev Walkin wrote: > > > Sean Allen wrote: > >> by a small bit of example code in Programming Erlang related to > >> guards and short circuit booleans: > >> f(X) when (X == 0) or (1/X > 2) -> > >> ... > >> g(X) when (X == 0) orelse ( 1/X > 2) -> > >> ... > >> The guard in f(X) fails when X is zero but succeeds in g(X) > >> Can someone explain why? > > > > > > Sean, > > > > The thing is, "or" does not short-circuit evaluation when left side > > succeeds, whereas "orelse" does. Same short-circuit logic is > > behind the differences between "and" and "andalso". > > > > Actually, the very book you read explains these differences and warns > > about caveats a couple pages later (or earlier). Don't stop reading. > > Actually its about 49 pages later where short circuit booleans are > discussed > and 37 pages for boolean expressions. *). > > How is ' f(X) when (X == 0) or (1/X > 2)' and or if it fails for 0? > What is the difference at that point between and/or. I cant find > anything really > detailed on that. > > Is or equivalent to , and orelse equiv to ;? > > That is the only way this makes any sense to me. Except that well > > -- > > page 94... boolean expressions: > > 3> true or false > true > 4> (2 > 1 ) or ( 3 > 4 ) > true > > makes sense. > > still cant wrap my head around given the above... why.... > > f(X) when (X == 0) or (1/X > 2) > > fails. > > does it fail because it would be a divide by zero? > > if yes, why does this also fail with divide by zero? > > (X == 0) orelse (1/X > 2) > > and why wouldnt the g(X) guard fail? > > and lord so confused... why are both of these true then: > > 1> X=1. > 1 > 2> ( X == 1 ) or ( 1/X > 2 ). > true > 3> ( X == 1 ) orelse ( 1/X > 2 ). > true > > the above... that makes sense to me. those guards... > totally lost. TOTALLY. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 19 16:50:03 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 10:50:03 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> Message-ID: <6c2563b20807190750n79fdfeces4ae4157dee240d18@mail.gmail.com> I meant "orelse" will not evaluate any expressions after the first TRUE condition and in this example, prevents divide by zero. You also could have written the test as (X =/= 0) andalso (1/X > 2) On Sat, Jul 19, 2008 at 10:47 AM, Edwin Fine wrote: > You are getting twisted in knots. > > 1> X =0. > 0 > 2> (X == 0) orelse (1/X > 2). > true > 3> f(). > ok > 4> X = 1. > 1 > 5> (X == 0) orelse (1/X > 2). > false > 8> f(). > 9> X = 0. > 0 > 10> (X == 0) or (1/X > 2). > ** exception error: bad argument in an arithmetic expression > in operator '/'/2 > called as 1 / 0 > > So the orelse construct works as advertised. It will not evaluate any > expressions after the first false condition and prevents divide by zero. > > -module(guard). > -compile([export_all]). > > test(X) when (X == 0) orelse (1/X > 2) -> > true; > test(_) -> > false. > 1> c(guard). > {ok,guard} > 2> guard:test(0). > true > 3> guard:test(0.0). > true > 4> guard:test(0.5). > false > 5> guard:test(0.4). > true > > Hope this helps. > > > > On Sat, Jul 19, 2008 at 10:21 AM, Sean Allen > wrote: > >> >> On Jul 19, 2008, at 9:50 AM, Lev Walkin wrote: >> >> > Sean Allen wrote: >> >> by a small bit of example code in Programming Erlang related to >> >> guards and short circuit booleans: >> >> f(X) when (X == 0) or (1/X > 2) -> >> >> ... >> >> g(X) when (X == 0) orelse ( 1/X > 2) -> >> >> ... >> >> The guard in f(X) fails when X is zero but succeeds in g(X) >> >> Can someone explain why? >> > >> > >> > Sean, >> > >> > The thing is, "or" does not short-circuit evaluation when left side >> > succeeds, whereas "orelse" does. Same short-circuit logic is >> > behind the differences between "and" and "andalso". >> > >> > Actually, the very book you read explains these differences and warns >> > about caveats a couple pages later (or earlier). Don't stop reading. >> >> Actually its about 49 pages later where short circuit booleans are >> discussed >> and 37 pages for boolean expressions. *). >> >> How is ' f(X) when (X == 0) or (1/X > 2)' and or if it fails for 0? >> What is the difference at that point between and/or. I cant find >> anything really >> detailed on that. >> >> Is or equivalent to , and orelse equiv to ;? >> >> That is the only way this makes any sense to me. Except that well >> >> -- >> >> page 94... boolean expressions: >> >> 3> true or false >> true >> 4> (2 > 1 ) or ( 3 > 4 ) >> true >> >> makes sense. >> >> still cant wrap my head around given the above... why.... >> >> f(X) when (X == 0) or (1/X > 2) >> >> fails. >> >> does it fail because it would be a divide by zero? >> >> if yes, why does this also fail with divide by zero? >> >> (X == 0) orelse (1/X > 2) >> >> and why wouldnt the g(X) guard fail? >> >> and lord so confused... why are both of these true then: >> >> 1> X=1. >> 1 >> 2> ( X == 1 ) or ( 1/X > 2 ). >> true >> 3> ( X == 1 ) orelse ( 1/X > 2 ). >> true >> >> the above... that makes sense to me. those guards... >> totally lost. TOTALLY. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Sat Jul 19 16:51:12 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 10:51:12 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> Message-ID: <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> On Jul 19, 2008, at 10:47 AM, Edwin Fine wrote: > You are getting twisted in knots. > > 1> X =0. > 0 > 2> (X == 0) orelse (1/X > 2). > true > 3> f(). > ok > 4> X = 1. > 1 > 5> (X == 0) orelse (1/X > 2). > false > 8> f(). > 9> X = 0. > 0 > 10> (X == 0) or (1/X > 2). > ** exception error: bad argument in an arithmetic expression > in operator '/'/2 > called as 1 / 0 > > So the orelse construct works as advertised. It will not evaluate > any expressions after the first false condition and prevents divide > by zero. i need to reinstall because orelse doesnt for me. it works the exact same or. but assuming i get a working install the reason in the example that or fails is because of the divide by zero correct? which raises a new question... why does or evaluate all the conditions? what purpose does that serve? when would you use or instead of orelse? From erlang-questions_efine@REDACTED Sat Jul 19 16:52:45 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 10:52:45 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216477872.4651.4.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> Message-ID: <6c2563b20807190752i7779fd21r4e4dafc97eb5f5b7@mail.gmail.com> -module(guard). -compile([export_all]). test(X) when X == 0; 1/X > 2 -> true; test(_) -> false. 6> c(guard). {ok,guard} 7> guard:test(0). true 8> guard:test(0.4). true 9> guard:test(0.6). false 10> On Sat, Jul 19, 2008 at 10:31 AM, Alp?r J?ttner wrote: > Btw. the Erlang Reference Manual says that > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > allowed in guards. In guards, however, evaluation is always > short-circuited since guard tests are known to be free of side > effects. > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > Something is wrong here, isn;t it? > > Regards, > Alpar > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > > Sean Allen wrote: > > > by a small bit of example code in Programming Erlang related to guards > > > and short circuit booleans: > > > > > > f(X) when (X == 0) or (1/X > 2) -> > > > ... > > > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > > ... > > > > > > The guard in f(X) fails when X is zero but succeeds in g(X) > > > > > > Can someone explain why? > > > > > > Sean, > > > > The thing is, "or" does not short-circuit evaluation when left side > > succeeds, whereas "orelse" does. Same short-circuit logic is > > behind the differences between "and" and "andalso". > > > > Actually, the very book you read explains these differences and warns > > about caveats a couple pages later (or earlier). Don't stop reading. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 19 16:55:28 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 10:55:28 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> Message-ID: <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> I cannot imagine of any situation where or and orelse work the same and reinstalling changes that. Please could you paste your exact code and shell session, showing the problem? Also, which version of Erlang are you using? On Sat, Jul 19, 2008 at 10:51 AM, Sean Allen wrote: > > On Jul 19, 2008, at 10:47 AM, Edwin Fine wrote: > > You are getting twisted in knots. >> >> 1> X =0. >> 0 >> 2> (X == 0) orelse (1/X > 2). >> true >> 3> f(). >> ok >> 4> X = 1. >> 1 >> 5> (X == 0) orelse (1/X > 2). >> false >> 8> f(). >> 9> X = 0. >> 0 >> 10> (X == 0) or (1/X > 2). >> ** exception error: bad argument in an arithmetic expression >> in operator '/'/2 >> called as 1 / 0 >> >> So the orelse construct works as advertised. It will not evaluate any >> expressions after the first false condition and prevents divide by zero. >> > > i need to reinstall because orelse doesnt for me. it works the exact same > or. > > but assuming i get a working install the reason in the example that or > fails is because of the divide by zero correct? > > which raises a new question... > > why does or evaluate all the conditions? what purpose does that serve? when > would you use or instead of orelse? > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Sat Jul 19 16:59:34 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 10:59:34 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> Message-ID: <43D17C3E-9390-4E02-8328-9BD1DB44FE3A@monkeysnatchbanana.com> well i am reinstalling now but this was still around in the term... mac os x if that makes a difference. Eshell V5.5.5 (abort with ^G) 1> X = 0. 0 2> (X == 0 ) or (1/X > 2). =ERROR REPORT==== 19-Jul-2008::10:15:21 === Error in process <0.30.0> with exit value: {badarith,[{erlang,'/', [1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5}, {shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarith,[{erlang,'/',[1,0]}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** 3> (X == 0 ) orelse (1/X > 2). =ERROR REPORT==== 19-Jul-2008::10:15:50 === Error in process <0.33.0> with exit value: {badarith,[{erlang,'/', [1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5}, {shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarith,[{erlang,'/',[1,0]}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** will be done installing new copy soon... we see what happens then. On Jul 19, 2008, at 10:55 AM, Edwin Fine wrote: > I cannot imagine of any situation where or and orelse work the same > and reinstalling changes that. Please could you paste your exact > code and shell session, showing the problem? Also, which version of > Erlang are you using? > From erlang-questions_efine@REDACTED Sat Jul 19 17:03:24 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 11:03:24 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <43D17C3E-9390-4E02-8328-9BD1DB44FE3A@monkeysnatchbanana.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> <43D17C3E-9390-4E02-8328-9BD1DB44FE3A@monkeysnatchbanana.com> Message-ID: <6c2563b20807190803v998c54kcc04d4ea177b8bf7@mail.gmail.com> Can you install Erlang V5.6.3 (R12B-3)? You are running 5.5.5. On Sat, Jul 19, 2008 at 10:59 AM, Sean Allen wrote: > well i am reinstalling now but this was still around in the term... mac os > x if that makes a difference. > > Eshell V5.5.5 (abort with ^G) > 1> X = 0. > 0 > 2> (X == 0 ) or (1/X > 2). > > =ERROR REPORT==== 19-Jul-2008::10:15:21 === > Error in process <0.30.0> with exit value: > {badarith,[{erlang,'/',[1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {badarith,[{erlang,'/',[1,0]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > 3> (X == 0 ) orelse (1/X > 2). > > =ERROR REPORT==== 19-Jul-2008::10:15:50 === > Error in process <0.33.0> with exit value: > {badarith,[{erlang,'/',[1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {badarith,[{erlang,'/',[1,0]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > will be done installing new copy soon... we see what happens then. > > > > On Jul 19, 2008, at 10:55 AM, Edwin Fine wrote: > > I cannot imagine of any situation where or and orelse work the same and >> reinstalling changes that. Please could you paste your exact code and shell >> session, showing the problem? Also, which version of Erlang are you using? >> >> > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Sat Jul 19 17:05:14 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 11:05:14 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> Message-ID: <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> On Jul 19, 2008, at 10:55 AM, Edwin Fine wrote: > I cannot imagine of any situation where or and orelse work the same > and reinstalling changes that. Please could you paste your exact > code and shell session, showing the problem? Also, which version of > Erlang are you using? ok i reinstalled and: Eshell V5.5.5 (abort with ^G) 1> X = 0. 0 2> (X == 0 ) or (1/X > 2). =ERROR REPORT==== 19-Jul-2008::11:02:12 === Error in process <0.30.0> with exit value: {badarith,[{erlang,'/', [1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5}, {shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarith,[{erlang,'/',[1,0]}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** 3> (X == 0 ) orelse (1/X > 2). true which makes a lot more sense. i have no idea why or and orelse where the same before. which leaves the question ( after answering a lot of confusion )... why would you want to use or instead of orelse ? From erlang-questions_efine@REDACTED Sat Jul 19 17:10:50 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 11:10:50 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> Message-ID: <6c2563b20807190810x7ce8327eld1717c7119d49130@mail.gmail.com> Sean, I think it's historical. "orelse" and "andalso" were added to the language later. I would also be inclined to use the short-circuit ones, but I don't find myself writing a lot of code that uses "and" and "or" anyway. I might have written your example as f(X) when X == 0; 1/X < 2 -> which gets evaluated from left to right. On Sat, Jul 19, 2008 at 11:05 AM, Sean Allen wrote: > > On Jul 19, 2008, at 10:55 AM, Edwin Fine wrote: > > I cannot imagine of any situation where or and orelse work the same and >> reinstalling changes that. Please could you paste your exact code and shell >> session, showing the problem? Also, which version of Erlang are you using? >> > > ok i reinstalled and: > > Eshell V5.5.5 (abort with ^G) > 1> X = 0. > 0 > 2> (X == 0 ) or (1/X > 2). > > =ERROR REPORT==== 19-Jul-2008::11:02:12 === > Error in process <0.30.0> with exit value: > {badarith,[{erlang,'/',[1,0]},{erl_eval,do_apply,5},{erl_eval,expr,5},{erl_eval,expr,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {badarith,[{erlang,'/',[1,0]}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > 3> (X == 0 ) orelse (1/X > 2). > true > > > which makes a lot more sense. i have no idea why or and orelse where the > same before. > > which leaves the question ( after answering a lot of confusion )... > > why would you want to use > > or > > instead of > > orelse > > ? > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From alpar@REDACTED Sat Jul 19 17:22:57 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Sat, 19 Jul 2008 16:22:57 +0100 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216477872.4651.4.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> Message-ID: <1216480977.4651.14.camel@piko.site> > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > allowed in guards. In guards, however, evaluation is always > short-circuited since guard tests are known to be free of side > effects. > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > Something is wrong here, isn;t it? I mean * What does the word "however" mean here? Does it mean that if they are not in a guard, orelse/andelse might be non short-circuited? * How does the freedom from side effects are related to the short-circuited evaluation? Regards, Alpar > > Regards, > Alpar > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > > Sean Allen wrote: > > > by a small bit of example code in Programming Erlang related to guards > > > and short circuit booleans: > > > > > > f(X) when (X == 0) or (1/X > 2) -> > > > ... > > > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > > ... > > > > > > The guard in f(X) fails when X is zero but succeeds in g(X) > > > > > > Can someone explain why? > > > > > > Sean, > > > > The thing is, "or" does not short-circuit evaluation when left side > > succeeds, whereas "orelse" does. Same short-circuit logic is > > behind the differences between "and" and "andalso". > > > > Actually, the very book you read explains these differences and warns > > about caveats a couple pages later (or earlier). Don't stop reading. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From sean@REDACTED Sat Jul 19 17:23:49 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 11:23:49 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190810x7ce8327eld1717c7119d49130@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> <6c2563b20807190810x7ce8327eld1717c7119d49130@mail.gmail.com> Message-ID: On Jul 19, 2008, at 11:10 AM, Edwin Fine wrote: > Sean, > > I think it's historical. "orelse" and "andalso" were added to the > language later. I would also be inclined to use the short-circuit > ones, but I don't find myself writing a lot of code that uses "and" > and "or" anyway. I might have written your example as > > f(X) when X == 0; 1/X < 2 -> > > which gets evaluated from left to right. that makes sense thanks. so, something got fubar in the version i had installed.... and suddenly things make much more sense. i'll upgrade if i move past the learning point or hit something that doesnt work right again. thanks for the help and info. sorry that a large chunk of it was the result of a bad erlang shell. From erlang-questions_efine@REDACTED Sat Jul 19 17:27:13 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 11:27:13 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> <6c2563b20807190810x7ce8327eld1717c7119d49130@mail.gmail.com> Message-ID: <6c2563b20807190827i4afbad3enaed8c6eaa5e1556a@mail.gmail.com> I am amazed that the shell could have "sort of" worked and got fixed by a reinstall. Well, live and learn. Good luck with your learning. On Sat, Jul 19, 2008 at 11:23 AM, Sean Allen wrote: > > On Jul 19, 2008, at 11:10 AM, Edwin Fine wrote: > > Sean, >> >> I think it's historical. "orelse" and "andalso" were added to the language >> later. I would also be inclined to use the short-circuit ones, but I don't >> find myself writing a lot of code that uses "and" and "or" anyway. I might >> have written your example as >> >> f(X) when X == 0; 1/X < 2 -> >> >> which gets evaluated from left to right. >> > > that makes sense thanks. > > so, something got fubar in the version i had installed.... and suddenly > things make much more sense. > i'll upgrade if i move past the learning point or hit something that doesnt > work right again. > > thanks for the help and info. > sorry that a large chunk of it was the result of a bad erlang shell. > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 19 18:11:26 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 12:11:26 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216480977.4651.14.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> Message-ID: <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> I interpret those words as follows: As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are allowed in guards. Please note that evaluation is always short-circuited in guards. This is because guard tests are known to be free of side effects. If a guard condition is free of side-effects, that means that in a sequence of guards, it is guaranteed that leaving out the evaluation of one or more guards will not change the state of the program. For example, let's say that user-defined functions were allowed in guards. f(X) -> put(x, X), true. g() -> put(x, true), put(y,"g() was called"), true. h() -> get(x). test(X) when f(X), g(), h() -> ok. % Will not compile - illegal Erlang What will get(x) and get(y) return after test(X) is run? Will it make a difference to the result if guards are not short-circuited? Non-short-circuited guards: test(true): f(true) sets x to true, g() sets x to true, y to the string. End result: x is true, y is "g() was called". test(false): f(false) sets x to false, g() sets x to true. End result: x is true, y is "g() was called". Short-circuited guards with side-effects: test(true): f(true) sets x to true, g() sets x to true, y to the string. End result: x is true, y is "g() was called". test(false): f(false) sets x to false, g() is not evaluated. End result: x is false, y is undefined. So skipping a guard test if it has a side effect can change the state of the whole program, which would make short-circuit evaluation impossible. But because no guard tests can have side-effects, the state of the program cannot be changed if one or more guard tests are not evaluated. Hope this makes sense. On Sat, Jul 19, 2008 at 11:22 AM, Alp?r J?ttner wrote: > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > > allowed in guards. In guards, however, evaluation is always > > short-circuited since guard tests are known to be free of side > > effects. > > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > > > Something is wrong here, isn;t it? > > I mean > > * What does the word "however" mean here? Does it mean that if > they are not in a guard, orelse/andelse might be non > short-circuited? > * How does the freedom from side effects are related to the > short-circuited evaluation? > > Regards, > Alpar > > > > > Regards, > > Alpar > > > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > > > Sean Allen wrote: > > > > by a small bit of example code in Programming Erlang related to > guards > > > > and short circuit booleans: > > > > > > > > f(X) when (X == 0) or (1/X > 2) -> > > > > ... > > > > > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > > > ... > > > > > > > > The guard in f(X) fails when X is zero but succeeds in g(X) > > > > > > > > Can someone explain why? > > > > > > > > > Sean, > > > > > > The thing is, "or" does not short-circuit evaluation when left side > > > succeeds, whereas "orelse" does. Same short-circuit logic is > > > behind the differences between "and" and "andalso". > > > > > > Actually, the very book you read explains these differences and warns > > > about caveats a couple pages later (or earlier). Don't stop reading. > > > > > > > _______________________________________________ > > 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 great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Sat Jul 19 18:13:39 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 12:13:39 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> Message-ID: <6c2563b20807190913x5909f3bamc00c25fc1ac87f5b@mail.gmail.com> Oops - meant to write f(X) -> put(x, X), X. On Sat, Jul 19, 2008 at 12:11 PM, Edwin Fine wrote: > I interpret those words as follows: > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are allowed in > guards. Please note that evaluation is always short-circuited in guards. > This is because guard tests are known to be free of side effects. If a > guard condition is free of side-effects, that means that in a sequence of > guards, it is guaranteed that leaving out the evaluation of one or more > guards will not change the state of the program. For example, let's say that > user-defined functions were allowed in guards. > > f(X) -> put(x, X), true. > g() -> put(x, true), put(y,"g() was called"), true. > h() -> get(x). > test(X) when f(X), g(), h() -> ok. % Will not compile - illegal Erlang > > What will get(x) and get(y) return after test(X) is run? Will it make a > difference to the result if guards are not short-circuited? > > Non-short-circuited guards: > test(true): f(true) sets x to true, g() sets x to true, y to the string. > End result: x is true, y is "g() was called". > test(false): f(false) sets x to false, g() sets x to true. End result: x is > true, y is "g() was called". > > Short-circuited guards with side-effects: > test(true): f(true) sets x to true, g() sets x to true, y to the string. > End result: x is true, y is "g() was called". > test(false): f(false) sets x to false, g() is not evaluated. End result: x > is false, y is undefined. > > So skipping a guard test if it has a side effect can change the state of > the whole program, which would make short-circuit evaluation impossible. But > because no guard tests can have side-effects, the state of the program > cannot be changed if one or more guard tests are not evaluated. > > Hope this makes sense. > > > > > On Sat, Jul 19, 2008 at 11:22 AM, Alp?r J?ttner wrote: > >> > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are >> > allowed in guards. In guards, however, evaluation is always >> > short-circuited since guard tests are known to be free of side >> > effects. >> > ?(?Section 6.14, Short-Circuit Boolean Expressions) >> > >> > Something is wrong here, isn;t it? >> >> I mean >> >> * What does the word "however" mean here? Does it mean that if >> they are not in a guard, orelse/andelse might be non >> short-circuited? >> * How does the freedom from side effects are related to the >> short-circuited evaluation? >> >> Regards, >> Alpar >> >> > >> > Regards, >> > Alpar >> > >> > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: >> > > Sean Allen wrote: >> > > > by a small bit of example code in Programming Erlang related to >> guards >> > > > and short circuit booleans: >> > > > >> > > > f(X) when (X == 0) or (1/X > 2) -> >> > > > ... >> > > > >> > > > g(X) when (X == 0) orelse ( 1/X > 2) -> >> > > > ... >> > > > >> > > > The guard in f(X) fails when X is zero but succeeds in g(X) >> > > > >> > > > Can someone explain why? >> > > >> > > >> > > Sean, >> > > >> > > The thing is, "or" does not short-circuit evaluation when left side >> > > succeeds, whereas "orelse" does. Same short-circuit logic is >> > > behind the differences between "and" and "andalso". >> > > >> > > Actually, the very book you read explains these differences and warns >> > > about caveats a couple pages later (or earlier). Don't stop reading. >> > > >> > >> > _______________________________________________ >> > 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 great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Sat Jul 19 17:15:27 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 19 Jul 2008 17:15:27 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216477872.4651.4.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> Message-ID: <4882050F.4030707@it.uu.se> Alp?r J?ttner wrote: > Btw. the Erlang Reference Manual says that > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > allowed in guards. In guards, however, evaluation is always > short-circuited since guard tests are known to be free of side > effects. > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > Something is wrong here, isn;t it? Not really, but it's a bit cryptic. The text only talks about evaluation of guard tests, i.e., the complete expressions separated by commas and/or semicolons. The commas/semicolons are always short-circuited. But they cannot be nested arbitrarily (you can have semicolon-separated groups of comma-separated expressions, but not the other way around and not grouped using parentheses). To write more complex expressions and still have short-circuiting, you need andalso/orelse. The strictness of the and/or operators is historical; I think the reasoning was that evaluating both sides gave a more predictable behaviour, with regard to possible exceptions and evaluation time. This was probably a mistake, but it was too late to fix, so andalso/orelse were added. The short answer to "when would anyone want to use plain and/or?" is "rarely". A slightly longer answer would be "when readability and horizontal space is more important than shaving off a few cycles". /Richard From dnew@REDACTED Sat Jul 19 18:59:14 2008 From: dnew@REDACTED (Darren New) Date: Sat, 19 Jul 2008 09:59:14 -0700 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> Message-ID: <48821D62.8010007@san.rr.com> Edwin Fine wrote: > of guards, it is guaranteed that leaving out the evaluation of one or > more guards will not change the state of the program. I don't think that's quite right. f(X) when (X == 0) or ((1 / X) > 2) -> "does not return for zero X"; f(X) when (X == 0) orelse ((1 / X) > 2) -> "does return for zero X". I might be misunderstanding here, but I understand that an "abrupt return" from a calculation in a guard is treated the same as "false". So in the first case, when X is 0, the guard evaluates to false, because 1/X errors out, making the entire expression false. In the second case, 1/X isn't evaluated when X==0, making the entire expression true. It does seem like the documentation is wrong. I just tried the above fragment and it printed "does return" as its answer. -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. From richardc@REDACTED Sat Jul 19 18:20:16 2008 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 19 Jul 2008 18:20:16 +0200 Subject: [erlang-questions] edoc hack to cross-reference standard Erlang OTP docs In-Reply-To: <6c2563b20807182210s560b1f84qe3170de51fdc42f8@mail.gmail.com> References: <6c2563b20807182210s560b1f84qe3170de51fdc42f8@mail.gmail.com> Message-ID: <48821440.6040506@it.uu.se> Edwin Fine wrote: > I have hacked together a modification to edoc_lib.erl that takes the > list of directories returned by code:get_path() and adds the > corresponding HTML directories to the list of apps that edoc will create > cross-reference links for. This seems to work well for my needs, which > are explained in the earlier posts I made. I don't claim that my hack is > production ready or works in all situations, but it could be a basis to > modify edoc if someone, who may or may not be named Richard, likes the > approach. I've attached the edoc_lib.erl source code, which is from > R12B-3, in case anyone who builds Erlang from source wants to try it out. Hi! Just wanted to let you know that I've seen your mails and will take a look at it when I can find the time. I know that the inter-application linkage stuff is a bit unfinished, and I wasn't even aware about the .js hack used in the OTP documentation. Thanks, /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From erlang-questions_efine@REDACTED Sat Jul 19 19:40:40 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 19 Jul 2008 13:40:40 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <48821D62.8010007@san.rr.com> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> <48821D62.8010007@san.rr.com> Message-ID: <6c2563b20807191040t59904df2n7dfe56bf516e215e@mail.gmail.com> Darren, I am not sure I understand what is "not quite right". All I can see is that I didn't mention that a failed (as in, there was an exception or error) guard condition is treated as false. I think your code works exactly as I would have expected. I see the sequence as: First Clause: f(0) when (0 == 0) [true] or ((1/X) > 2) [error = false] => entire guard fails, so try next clause. Next Clause: f(0) when (0 == 0) true => short-circuit all subsequent guard conditions, so guard is true and clause is executed. I was saying that the absence of side-effects in guard conditions allows Erlang to short-circuit guard expressions of the format when cond1; cond2; cond3 or when cond1, cond2, cond3 This was not referring to use of or/orelse/and/andalso, which I tend to avoid in guards. Please help me understand what you meant in your post. On Sat, Jul 19, 2008 at 12:59 PM, Darren New wrote: > Edwin Fine wrote: > > of guards, it is guaranteed that leaving out the evaluation of one or > > more guards will not change the state of the program. > > I don't think that's quite right. > > f(X) when (X == 0) or ((1 / X) > 2) -> > "does not return for zero X"; > f(X) when (X == 0) orelse ((1 / X) > 2) -> > "does return for zero X". > > I might be misunderstanding here, but I understand that an "abrupt > return" from a calculation in a guard is treated the same as "false". > > So in the first case, when X is 0, the guard evaluates to false, because > 1/X errors out, making the entire expression false. > > In the second case, 1/X isn't evaluated when X==0, making the entire > expression true. > > It does seem like the documentation is wrong. I just tried the above > fragment and it printed "does return" as its answer. > > -- > Darren New / San Diego, CA, USA (PST) > Helpful housekeeping hints: > Check your feather pillows for holes > before putting them in the washing machine. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.unit@REDACTED Sat Jul 19 21:06:00 2008 From: andrew.unit@REDACTED (Andrew Harris) Date: Sat, 19 Jul 2008 15:06:00 -0400 Subject: [erlang-questions] reducing size of erlang In-Reply-To: <20080716062852.GB3419@contorpis.lisalinda.com> References: <20080715174733.GA5396@contorpis.lisalinda.com> <487D4E5F.3080701@rldn.net> <20080716062852.GB3419@contorpis.lisalinda.com> Message-ID: Hi everyone, I'm still working on getting Erlang cross compiled for the arm platform. I had previously been using rev 10, but I decided to go with R12B-3 so that I could be up to date and maybe get more help. I have decided to create a shell script that tries to do the cross compile starting from just the tar file so that I can make sure I do the same thing on every attempt. This script incorporates diffs I got from Matt as well as another one I found online: #!/bin/bash -v RELEASE=otp_src_R12B-3 TARGET=arm-angstrom-linux-gnueabi INSTALL_DIR=/tmp/cross-compile export ac_cv_c_bigendian=no export ac_cv_func_setvbuf_reversed=no export ac_cv_func_mmap_fixed_mapped=yes export ac_cv_sizeof_long_long=8 export ac_cv_sizeof_off_t=8 export ac_cv_func_getaddrinfo=no rm -rf ${INSTALL_DIR} rm -rf ${RELEASE} tar xvf "${RELEASE}.tar.gz" cd ${RELEASE} # Deal with the make patch cd make echo '--- otp.mk.in.orig 2007-01-16 00:05:19.000000000 +0100' > makepatch echo '+++ otp.mk.in 2007-01-16 00:06:22.000000000 +0100' >> makepatch echo '@@ -69,21 +69,7 @@' >> makepatch echo ' # Erlang language section' >> makepatch echo ' # ----------------------------------------------------' >> makepatch echo ' EMULATOR = beam' >> makepatch echo '-ifeq ($(findstring vxworks,$(TARGET)),vxworks)' >> makepatch echo '-# VxWorks object files should be compressed.' >> makepatch echo '-# Other object files should have debug_info.' >> makepatch echo '- ERL_COMPILE_FLAGS += +compressed' >> makepatch echo '-else' >> makepatch echo '- ifeq ($(findstring ose_ppc750,$(TARGET)),ose_ppc750)' >> makepatch echo '- ERL_COMPILE_FLAGS += +compressed' >> makepatch echo '- else' >> makepatch echo '- ifdef BOOTSTRAP' >> makepatch echo '- ERL_COMPILE_FLAGS += +slim' >> makepatch echo '- else' >> makepatch echo '- ERL_COMPILE_FLAGS += +debug_info' >> makepatch echo '- endif' >> makepatch echo '- endif' >> makepatch echo '-endif' >> makepatch echo '+ERL_COMPILE_FLAGS += +compressed +slim' >> makepatch echo ' ERLC_WFLAGS = -W' >> makepatch echo ' ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)' >> makepatch echo ' ERL = erl -boot start_clean' >> makepatch cat makepatch | patch -p0 cd .. # Deal with configure patch cd erts echo '--- configure.in.orig 2006-03-17 17:38:39.000000000 +0100' >> configurepatch echo '+++ configure.in 2006-03-17 17:29:23.000000000 +0100' >> configurepatch echo '@@ -1322,7 +1322,7 @@' >> configurepatch echo ' exit(0);' >> configurepatch echo ' #endif' >> configurepatch echo ' }' >> configurepatch echo '-], poll_works=true, poll_works=false, poll_works=false)' >> configurepatch echo '+], poll_works=true, poll_works=false, poll_works=true)' >> configurepatch echo ' case $poll_works in' >> configurepatch echo ' true)' >> configurepatch echo ' AC_MSG_RESULT(ok)' >> configurepatch echo '@@ -1365,7 +1365,12 @@' >> configurepatch echo ' DED_CFLAGS="$DED_CFLAGS -fPIC"' >> configurepatch echo ' fi' >> configurepatch echo ' ' >> configurepatch echo '-DED_LD=ld' >> configurepatch echo '+if test "x$LD" = x; then' >> configurepatch echo '+ DED_LD=ld' >> configurepatch echo '+else' >> configurepatch echo '+ DED_LD=$LD' >> configurepatch echo '+fi' >> configurepatch echo '+' >> configurepatch echo ' DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R"' >> configurepatch echo ' STATIC_CFLAGS=""' >> configurepatch cat configurepatch | patch -p0 autoconf configure.in > configure cd .. ./configure --prefix=${INSTALL_DIR} --without-ssl --without-java --disable-hipe --disable-smp-support --host=${TARGET} --build=i686-pc-linux-gnu TARGET=${TARGET} make noboot I have read online that one problem in cross compiling involves hipe_mkliterals, that seems to need to be compiled with the native C compiler on the build computer. I don't really know how to modify the file erts/emulator/Makefile.in to somehow get it to use the native compiler for that. I tried some simple stuff, but I couldn't get it to work. The output below shows the arm compiler being used to compile hipe_mkliterals, which seems to be the problem. arm-angstrom-linux-gnueabi-gcc -g -O2 -I/project/otp_src_R12B-3/erts/arm-angstrom-linux-gnueabi -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS -Ibeam -Isys/unix -Isys/common -Iarm-angstrom-linux-gnueabi/opt/plain -Iarm-angstrom-linux-gnueabi -Izlib -Ipcre -Ihipe -I../include/internal -I../include/internal/arm-angstrom-linux-gnueabi -o /project/otp_src_R12B-3/bin/arm-angstrom-linux-gnueabi/hipe_mkliterals obj/arm-angstrom-linux-gnueabi/opt/plain/hipe_mkliterals.o /project/otp_src_R12B-3/bin/arm-angstrom-linux-gnueabi/hipe_mkliterals -c > arm-angstrom-linux-gnueabi/opt/plain/hipe_literals.h /bin/sh: /project/otp_src_R12B-3/bin/arm-angstrom-linux-gnueabi/hipe_mkliterals: cannot execute binary file make[4]: *** [arm-angstrom-linux-gnueabi/opt/plain/hipe_literals.h] Error 126 make[4]: Leaving directory `/project/otp_src_R12B-3/erts/emulator' make[3]: *** [generate] Error 2 make[3]: Leaving directory `/project/otp_src_R12B-3/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/project/otp_src_R12B-3/erts' make[1]: *** [emulator] Error 2 make[1]: Leaving directory `/project/otp_src_R12B-3' make: *** [noboot] Error 2 # TARGET=${TARGET} make install andrewha@REDACTED:/project$ Any help would be appreciated. In particular if someone has a patch to solve this hipe_mkliterals problem I'll include it in the script (and when the script works I'll post it here) thanks, -andrew From sean@REDACTED Sun Jul 20 01:55:38 2008 From: sean@REDACTED (Sean Allen) Date: Sat, 19 Jul 2008 19:55:38 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190827i4afbad3enaed8c6eaa5e1556a@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <6c2563b20807190747r7a8945d3nb6c1e63ba4870337@mail.gmail.com> <702D1EE1-4F4B-4C13-84C1-07916B4D92CD@monkeysnatchbanana.com> <6c2563b20807190755p63a3543aj64e2882653ca7b09@mail.gmail.com> <466FC770-D5A4-4B8C-A881-0F5EEB004FC9@monkeysnatchbanana.com> <6c2563b20807190810x7ce8327eld1717c7119d49130@mail.gmail.com> <6c2563b20807190827i4afbad3enaed8c6eaa5e1556a@mail.gmail.com> Message-ID: <062CD9BC-BEA5-4B79-9AE2-C4EAFFA1D6C7@monkeysnatchbanana.com> me too.... On Jul 19, 2008, at 11:27 AM, Edwin Fine wrote: > I am amazed that the shell could have "sort of" worked and got fixed > by a reinstall. Well, live and learn. Good luck with your learning. > > On Sat, Jul 19, 2008 at 11:23 AM, Sean Allen > wrote: > > On Jul 19, 2008, at 11:10 AM, Edwin Fine wrote: > > Sean, > > I think it's historical. "orelse" and "andalso" were added to the > language later. I would also be inclined to use the short-circuit > ones, but I don't find myself writing a lot of code that uses "and" > and "or" anyway. I might have written your example as > > f(X) when X == 0; 1/X < 2 -> > > which gets evaluated from left to right. > > that makes sense thanks. > > so, something got fubar in the version i had installed.... and > suddenly things make much more sense. > i'll upgrade if i move past the learning point or hit something that > doesnt work right again. > > thanks for the help and info. > sorry that a large chunk of it was the result of a bad erlang shell. > > > > > > -- > The great enemy of the truth is very often not the lie -- > deliberate, contrived and dishonest, but the myth, persistent, > persuasive, and unrealistic. Belief in myths allows the comfort of > opinion without the discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.unit@REDACTED Sun Jul 20 02:08:55 2008 From: andrew.unit@REDACTED (Andrew Harris) Date: Sat, 19 Jul 2008 20:08:55 -0400 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> <487D4E5F.3080701@rldn.net> <20080716062852.GB3419@contorpis.lisalinda.com> Message-ID: Success! root@REDACTED:/var/volatile/tmp/cross-compile/bin$ uname -a Linux gumstix-custom-verdex 2.6.21 #1 Sat Feb 9 15:49:35 EST 2008 armv5tel unknown root@REDACTED:/var/volatile/tmp/cross-compile/bin$ ./erl Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] [kernel-poll:false] Eshell V5.6.3 (abort with ^G) 1> I attached the current version of the script I used to compile R12B-3 for the gumstix. -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang.sh Type: application/x-sh Size: 4803 bytes Desc: not available URL: From alain.odea@REDACTED Sun Jul 20 05:26:46 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Sun, 20 Jul 2008 00:56:46 -0230 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> <487D4E5F.3080701@rldn.net> <20080716062852.GB3419@contorpis.lisalinda.com> Message-ID: <4EA45498-0573-454C-993C-39B967F31591@gmail.com> On 19-Jul-08, at 9:38 PM, Andrew Harris wrote: > Success! > > root@REDACTED:/var/volatile/tmp/cross-compile/bin$ > uname -a > Linux gumstix-custom-verdex 2.6.21 #1 Sat Feb 9 15:49:35 EST 2008 > armv5tel unknown > root@REDACTED:/var/volatile/tmp/cross-compile/bin$ ./erl > Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] > [kernel-poll:false] > > Eshell V5.6.3 (abort with ^G) > 1> > > I attached the current version of the script I used to compile R12B-3 > for the gumstix. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Awesome work. Thank you for putting this together Andrew. I have been very interested in pursuing embedded Erlang development and this kind of work shows that it is possible. From devdoer2@REDACTED Sun Jul 20 05:35:30 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sun, 20 Jul 2008 11:35:30 +0800 Subject: [erlang-questions] why the mnesia operations are divided into two parts? Message-ID: HI: I'm reading mnesia source code right now. I found all the mnesia operation such as read/write/transform_table are divided into two parts.One part is in mnesia_shcema:read ,the other part is in mnesia_shcmma:prepare_op. Take transform_table for example,the transform_table function calls make_transform_table to return "[{op, transform, Fun, cs2list(Cs2)}];". And the real transform_table is done in "prepare_op(_Tid, {op, transform, Fun, TabDef}, _WaitFor) " ,then the prepare_op finally call the Fun the do the transform. Now I know the the two parts are done in sperate process,the make_transform is done in user-process,the prepare_op is in mnesia kernel process .The function make_transform insert op "transform " into a ets table,the prepare_ops parse the op "transform" to many small ops on the fly. My problem is 1. I can't see why the main work is put into prepare_op. Why don't do all the work in make_transform function? 2. What the function prepare_op is used for? I see many mnesia operations are done in this way. Could someone explain more to me? Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Sun Jul 20 08:48:11 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Sun, 20 Jul 2008 08:48:11 +0200 Subject: [erlang-questions] Design tool for erlang software In-Reply-To: References: Message-ID: 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From alpar@REDACTED Sun Jul 20 09:16:09 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Sun, 20 Jul 2008 08:16:09 +0100 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> Message-ID: <1216538169.5585.12.camel@piko.site> What you are writing here is quite irrelevant to the quoted text, as Section 6.14 deals with orelse/andelse, it has nothing to do with , and ;. On the other hand it is not true that the evaluation of guards are always short-circuited, in case of 'or' and 'and' both sides are always evaluated. So, I still think that the quoted part of the reference manual is erroneous and confusing. Best regards, Alpar On Sat, 2008-07-19 at 12:11 -0400, Edwin Fine wrote: > I interpret those words as follows: > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > allowed in guards. Please note that evaluation is always > short-circuited in guards. > This is because guard tests are known to be free of side effects. If a > guard condition is free of side-effects, that means that in a sequence > of guards, it is guaranteed that leaving out the evaluation of one or > more guards will not change the state of the program. For example, > let's say that user-defined functions were allowed in guards. > > f(X) -> put(x, X), true. > g() -> put(x, true), put(y,"g() was called"), true. > h() -> get(x). > test(X) when f(X), g(), h() -> ok. % Will not compile - illegal > Erlang > > What will get(x) and get(y) return after test(X) is run? Will it make > a difference to the result if guards are not short-circuited? > > Non-short-circuited guards: > test(true): f(true) sets x to true, g() sets x to true, y to the > string. End result: x is true, y is "g() was called". > test(false): f(false) sets x to false, g() sets x to true. End result: > x is true, y is "g() was called". > > Short-circuited guards with side-effects: > test(true): f(true) sets x to true, g() sets x to true, y to the > string. End result: x is true, y is "g() was called". > test(false): f(false) sets x to false, g() is not evaluated. End > result: x is false, y is undefined. > > So skipping a guard test if it has a side effect can change the state > of the whole program, which would make short-circuit evaluation > impossible. But because no guard tests can have side-effects, the > state of the program cannot be changed if one or more guard tests are > not evaluated. > > Hope this makes sense. > > > > On Sat, Jul 19, 2008 at 11:22 AM, Alp?r J?ttner > wrote: > > As of Erlang 5.5/OTP R11B, short-circuit boolean > expressions are > > allowed in guards. In guards, however, evaluation is > always > > short-circuited since guard tests are known to be > free of side > > effects. > > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > > > Something is wrong here, isn;t it? > > > I mean > > * What does the word "however" mean here? Does it mean > that if > they are not in a guard, orelse/andelse might be non > short-circuited? > * How does the freedom from side effects are related to > the > short-circuited evaluation? > > Regards, > Alpar > > > > > > Regards, > > Alpar > > > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > > > Sean Allen wrote: > > > > by a small bit of example code in Programming Erlang > related to guards > > > > and short circuit booleans: > > > > > > > > f(X) when (X == 0) or (1/X > 2) -> > > > > ... > > > > > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > > > ... > > > > > > > > The guard in f(X) fails when X is zero but succeeds in > g(X) > > > > > > > > Can someone explain why? > > > > > > > > > Sean, > > > > > > The thing is, "or" does not short-circuit evaluation when > left side > > > succeeds, whereas "orelse" does. Same short-circuit logic > is > > > behind the differences between "and" and "andalso". > > > > > > Actually, the very book you read explains these > differences and warns > > > about caveats a couple pages later (or earlier). Don't > stop reading. > > > > > > > _______________________________________________ > > 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 great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) From russell.brown@REDACTED Sun Jul 20 13:34:57 2008 From: russell.brown@REDACTED (Russell Brown) Date: Sun, 20 Jul 2008 12:34:57 +0100 Subject: [erlang-questions] truncated list with ellipsis Message-ID: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> Hi, Total newbie question but not an answer to it so far in the Armstrong book (brilliant book btw, haven't enjoyed my computer and programming this much for years) or in the documentation that I installed with erlang (the erlang reference and the 4 day curse). I tried a google search for erlang, beam, ellipsis too. So...just learning the basics and my kid is in the first year at school and so I made a quick function that does the "Number Bonds" of N. It works OK but when I run it interactively the list is truncated and ellipsis are shown instead. Is there anyway I can have see the total list? An exmplae would be like this: 1> [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:= 50]. [{0,50}, {1,49}, {2,48}, {3,47}, {4,46}, {5,45}, {6,44}, {7,43}, {8,42}, {9,41}, {10,40}, {11,39}, {12,38}, {13,37}, {14,36}, {15,35}, {16,34}, {17,33}, {18,32}, {19,31}, {20,30}, {21,29}, {22,28}, {23,27}, {24,26}, {25,25}, {26,24}, {27,...}, {...}|...] Using Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [kernel-poll:false] installed via MacPorts on OS X 10.4.11. Cheers Russell From harveyd@REDACTED Sun Jul 20 13:49:56 2008 From: harveyd@REDACTED (Dale Harvey) Date: Sun, 20 Jul 2008 12:49:56 +0100 Subject: [erlang-questions] truncated list with ellipsis In-Reply-To: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> References: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> Message-ID: 1> X = [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:=50]. 2> io:format("~p~n",[X]). 2008/7/20 Russell Brown : > Hi, > Total newbie question but not an answer to it so far in the Armstrong > book (brilliant book btw, haven't enjoyed my computer and programming > this much for years) or in the documentation that I installed with > erlang (the erlang reference and the 4 day curse). I tried a google > search for erlang, beam, ellipsis too. > > So...just learning the basics and my kid is in the first year at > school and so I made a quick function that does the "Number Bonds" of > N. It works OK but when I run it interactively the list is truncated > and ellipsis are shown instead. Is there anyway I can have see the > total list? > > An exmplae would be like this: > > 1> [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:= > 50]. > [{0,50}, > {1,49}, > {2,48}, > {3,47}, > {4,46}, > {5,45}, > {6,44}, > {7,43}, > {8,42}, > {9,41}, > {10,40}, > {11,39}, > {12,38}, > {13,37}, > {14,36}, > {15,35}, > {16,34}, > {17,33}, > {18,32}, > {19,31}, > {20,30}, > {21,29}, > {22,28}, > {23,27}, > {24,26}, > {25,25}, > {26,24}, > {27,...}, > {...}|...] > > > Using Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] > [kernel-poll:false] installed via MacPorts on OS X 10.4.11. > > Cheers > > Russell > _______________________________________________ > 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 Sun Jul 20 19:53:34 2008 From: toby@REDACTED (Toby Thain) Date: Sun, 20 Jul 2008 14:53:34 -0300 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216477872.4651.4.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> Message-ID: <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> On 19-Jul-08, at 11:31 AM, Alp?r J?ttner wrote: > Btw. the Erlang Reference Manual says that > > As of Erlang 5.5/OTP R11B, short-circuit boolean > expressions are > allowed in guards. In guards, however, evaluation is always > short-circuited since guard tests are known to be free of side > effects. > (Section 6.14, Short-Circuit Boolean Expressions) > > Something is wrong here, isn;t it? I also did a double take on this text, but my reading of "always short-circuited" is "it is always safe to short circuit [since...]", so a (normally) non-short-circuit operator can always be short- circuited. (Compare, e.g. C's | and ||, where | may be used deliberately for side-effects on the RHS.) --Toby > > Regards, > Alpar > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: >> Sean Allen wrote: >>> by a small bit of example code in Programming Erlang related to >>> guards >>> and short circuit booleans: >>> >>> f(X) when (X == 0) or (1/X > 2) -> >>> ... >>> >>> g(X) when (X == 0) orelse ( 1/X > 2) -> >>> ... >>> >>> The guard in f(X) fails when X is zero but succeeds in g(X) >>> >>> Can someone explain why? >> >> >> Sean, >> >> The thing is, "or" does not short-circuit evaluation when left side >> succeeds, whereas "orelse" does. Same short-circuit logic is >> behind the differences between "and" and "andalso". >> >> Actually, the very book you read explains these differences and warns >> about caveats a couple pages later (or earlier). Don't stop reading. >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vychodil.hynek@REDACTED Sun Jul 20 20:01:57 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sun, 20 Jul 2008 20:01:57 +0200 Subject: [erlang-questions] reducing size of erlang In-Reply-To: References: <20080715174733.GA5396@contorpis.lisalinda.com> <487D4E5F.3080701@rldn.net> <20080716062852.GB3419@contorpis.lisalinda.com> Message-ID: <4d08db370807201101r7878e21m2b80e5aa07242afa@mail.gmail.com> I tidied up your script a little bit. 2008/7/20 Andrew Harris : > Success! > > root@REDACTED:/var/volatile/tmp/cross-compile/bin$ uname -a > Linux gumstix-custom-verdex 2.6.21 #1 Sat Feb 9 15:49:35 EST 2008 > armv5tel unknown > root@REDACTED:/var/volatile/tmp/cross-compile/bin$ ./erl > Erlang (BEAM) emulator version 5.6.3 [source] [async-threads:0] > [kernel-poll:false] > > Eshell V5.6.3 (abort with ^G) > 1> > > I attached the current version of the script I used to compile R12B-3 > for the gumstix. > > _______________________________________________ > 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: erlang.sh Type: application/x-sh Size: 3180 bytes Desc: not available URL: From alpar@REDACTED Sun Jul 20 20:52:22 2008 From: alpar@REDACTED (=?ISO-8859-1?Q?Alp=E1r_J=FCttner?=) Date: Sun, 20 Jul 2008 19:52:22 +0100 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> Message-ID: <1216579942.5585.62.camel@piko.site> On Sun, 2008-07-20 at 14:53 -0300, Toby Thain wrote: > On 19-Jul-08, at 11:31 AM, Alp?r J?ttner wrote: > > > Btw. the Erlang Reference Manual says that > > > > As of Erlang 5.5/OTP R11B, short-circuit boolean > > expressions are > > allowed in guards. In guards, however, evaluation is always > > short-circuited since guard tests are known to be free of side > > effects. > > (Section 6.14, Short-Circuit Boolean Expressions) > > > > Something is wrong here, isn;t it? > > > I also did a double take on this text, but my reading of "always > short-circuited" is "it is always safe to short circuit [since...]", > so a (normally) non-short-circuit operator can always be short- > circuited. Do you mean that 'or' can always be replaced by 'orelse'? We've learnt that it is not true. > (Compare, e.g. C's | and ||, where | may be used deliberately for > side-effects on the RHS.) It is a different story. In C, '|' is the bitwise or operation, it corresponds to 'bor' in Erlang. ('||' in C is the same as 'orelse' and there is no C equivalent for the 'or' operator of Erlang.) Regards, Alpar > > --Toby > > > > > Regards, > > Alpar > > > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > >> Sean Allen wrote: > >>> by a small bit of example code in Programming Erlang related to > >>> guards > >>> and short circuit booleans: > >>> > >>> f(X) when (X == 0) or (1/X > 2) -> > >>> ... > >>> > >>> g(X) when (X == 0) orelse ( 1/X > 2) -> > >>> ... > >>> > >>> The guard in f(X) fails when X is zero but succeeds in g(X) > >>> > >>> Can someone explain why? > >> > >> > >> Sean, > >> > >> The thing is, "or" does not short-circuit evaluation when left side > >> succeeds, whereas "orelse" does. Same short-circuit logic is > >> behind the differences between "and" and "andalso". > >> > >> Actually, the very book you read explains these differences and warns > >> about caveats a couple pages later (or earlier). Don't stop reading. > >> > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > From doug.mansell@REDACTED Sun Jul 20 21:10:12 2008 From: doug.mansell@REDACTED (doug mansell) Date: Sun, 20 Jul 2008 21:10:12 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216579942.5585.62.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> <1216579942.5585.62.camel@piko.site> Message-ID: On Sun, Jul 20, 2008 at 8:52 PM, Alp?r J?ttner wrote: > On Sun, 2008-07-20 at 14:53 -0300, Toby Thain wrote: >> (Compare, e.g. C's | and ||, where | may be used deliberately for >> side-effects on the RHS.) > > It is a different story. In C, '|' is the bitwise or operation, it > corresponds to 'bor' in Erlang. ('||' in C is the same as 'orelse' and > there is no C equivalent for the 'or' operator of Erlang.) sure there is: erlang_style_or(bool A, bool B) { From doug.mansell@REDACTED Sun Jul 20 21:12:46 2008 From: doug.mansell@REDACTED (doug mansell) Date: Sun, 20 Jul 2008 21:12:46 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> <1216579942.5585.62.camel@piko.site> Message-ID: oops, premature email send. On Sun, Jul 20, 2008 at 9:10 PM, doug mansell wrote: > On Sun, Jul 20, 2008 at 8:52 PM, Alp?r J?ttner wrote: >> On Sun, 2008-07-20 at 14:53 -0300, Toby Thain wrote: >>> (Compare, e.g. C's | and ||, where | may be used deliberately for >>> side-effects on the RHS.) >> >> It is a different story. In C, '|' is the bitwise or operation, it >> corresponds to 'bor' in Erlang. ('||' in C is the same as 'orelse' and >> there is no C equivalent for the 'or' operator of Erlang.) > > sure there is: > > erlang_style_or(bool A, bool B) bool erlang_style_or(bool A, bool B) { return A || B; } ... but this is getting off topic. :) From jamesma@REDACTED Sun Jul 20 23:01:24 2008 From: jamesma@REDACTED (James Mandelis) Date: Sun, 20 Jul 2008 22:01:24 +0100 Subject: [erlang-questions] run_test from a crontab job Message-ID: Hi, I'm trying to run "run_test" from a crontab job but it doesn't seem to run nor create the test results. It works fine from a terminal, by either calling it directly or via a make file. Ultimately I need to run the tests from Hudson where but I have the same problem. Any help will be greatly appreciated. cheers This email (including any attachments) is confidential, protected by copyright and may be privileged. It is for the exclusive use of the intended recipient(s). If you have received it in error, please notify the sender immediately by emailing a response before deleting the email completely from your computer, and note that any storage, copying or dissemination is prohibited. Where the content of this email is personal or otherwise unconnected with business of the Group's Companies, we accept no responsibility or liability for such content. We accept no responsibility for viruses that we may have unintentionally transmitted to you within this email and you should check for viruses before opening any attachment. Those communicating with us by email will be deemed to have consented to us intercepting and monitoring those communications. Gamesys Ltd is registered in England & Wales, company registration number 04042931. The registered office is at 54-62 Regent St -------------- next part -------------- An HTML attachment was scrubbed... URL: From russell.brown@REDACTED Sun Jul 20 21:38:56 2008 From: russell.brown@REDACTED (Russell Brown) Date: Sun, 20 Jul 2008 20:38:56 +0100 Subject: [erlang-questions] truncated list with ellipsis In-Reply-To: References: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> Message-ID: Nice one, Thank you. Found out all about it here http://www.erlang.org/doc/man/io.html Cheers Russell On 20 Jul 2008, at 12:49, Dale Harvey wrote: > 1> X = [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + > B =:=50]. > 2> io:format("~p~n",[X]). > > 2008/7/20 Russell Brown : > Hi, > Total newbie question but not an answer to it so far in the Armstrong > book (brilliant book btw, haven't enjoyed my computer and programming > this much for years) or in the documentation that I installed with > erlang (the erlang reference and the 4 day curse). I tried a google > search for erlang, beam, ellipsis too. > > So...just learning the basics and my kid is in the first year at > school and so I made a quick function that does the "Number Bonds" of > N. It works OK but when I run it interactively the list is truncated > and ellipsis are shown instead. Is there anyway I can have see the > total list? > > An exmplae would be like this: > > 1> [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:= > 50]. > [{0,50}, > {1,49}, > {2,48}, > {3,47}, > {4,46}, > {5,45}, > {6,44}, > {7,43}, > {8,42}, > {9,41}, > {10,40}, > {11,39}, > {12,38}, > {13,37}, > {14,36}, > {15,35}, > {16,34}, > {17,33}, > {18,32}, > {19,31}, > {20,30}, > {21,29}, > {22,28}, > {23,27}, > {24,26}, > {25,25}, > {26,24}, > {27,...}, > {...}|...] > > > Using Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] > [kernel-poll:false] installed via MacPorts on OS X 10.4.11. > > Cheers > > Russell > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Jul 21 02:26:02 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 21 Jul 2008 12:26:02 +1200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: Message-ID: On 20 Jul 2008, at 1:26 am, Sean Allen wrote: > by a small bit of example code in Programming Erlang related to guards > and short circuit booleans: > > f(X) when (X == 0) or (1/X > 2) -> > ... > > g(X) when (X == 0) orelse ( 1/X > 2) -> > ... > > The guard in f(X) fails when X is zero but succeeds in g(X) > > Can someone explain why? This is a perfect example of why 'or' and 'orelse' should NEVER be used in guards (and ditto for 'and' and 'andalso'. By the way, I find Pascal-inspired otiose parentheses around comparisons ugly and confusing. Let's do this the old way: f(X) when X == 0 ; 1/X > 2 -> The execution of a guard sequence stops when - all guard conjunctions have been tested or - one guard conjunction succeeds. So 1/X > 2 is only tested when the X == 0 test fails. Now let's do it with 'orelse'. f(...) when G1 orelse G2 orelse ... orelse Gn -> is a long-winded way to write f(...) when G1 ; G2 ; ... ; Gn -> and works the same way: keep on testing until something succeeds, then *stop*. This is commonly called 'short- circuit evaluation', and it is just exactly the same as C's (or Haskell's) "||", except for the spelling. 'or', on the other hand, acts just like '+'. It always evaluates both arguments. (So does 'and'.) Think of it as being like C's "|" in this respect. There are very very very very few known good uses for 'or'. So whether X is 0 or not, X == 0 or 1/X > 2 will evaluate BOTH X == 0 AND 1/X > 2. When X is 0, this would raise an exception in an expression, but things that would raise an exception in an expression just make a guard fail. Bottom line: DON'T use 'or' or 'and' ANYWHERE. DON'T use 'orelse' or 'andalso' in guards but instead stick to ';' and ','. From litaocheng@REDACTED Mon Jul 21 03:18:10 2008 From: litaocheng@REDACTED (litao cheng) Date: Mon, 21 Jul 2008 09:18:10 +0800 Subject: [erlang-questions] compile error with bits unit syntax In-Reply-To: <6c2563b20807181457i51cabde8o7cbf1ca6fc835133@mail.gmail.com> References: <6c2563b20807181457i51cabde8o7cbf1ca6fc835133@mail.gmail.com> Message-ID: Edwin , thanks for your response! :) 2008/7/19 Edwin Fine : > Litao, > > I think this is a bug in Erlang R12B-3. Certainly the documentation can be > misleading, because in Programming Examples (Section 4.6: Matching > Binaries), it specifically says that this construct is not allowed: > > *"Size** must be an integer literal, or a previously bound variable. Note > that the following is not allowed: * > > *foo(N, <>) -> > {X,T}. > * > > *The two occurrences of N are not related. The compiler will complain that > the N in the size field is unbound." * > > That being said, if you rewrite the expression as shown below, it will > compile (but does not work). If I understand correctly, binary, bits, and > bitstream are the same, except that the default bit size for binary is 8, > and for bitstring it is 1. Since you are overriding the default size anyway, > you can use binary-unit:11 in place of bits-unit:11. > > decode(<>) -> > [Chan || <> <- Chans]. > > > 103> Chans3 = <<3:5,2:11,3:11,4:11>>. > <<24,2,0,96,4:6>> > 104> bb:decode(Chans3). > N:3, Chans:<<0,64,12,2,0:1>> > ** exception error: no case clause matching {<<0,64,12,2,0:1>>} > in function bb:'-decode/1-lc$^0/1-0-'/1 > 105> > > The code is: > > -module(bb). > -compile([export_all]). > > decode(<>) -> > io:format("N:~p, Chans:~p~n", [N, Chans]), > [Chan || <> <- Chans]. > > So even though the programming examples say that you can't use the same N > in the match, it actually does work, but the list comprehension does not. I > found out this is because a bitstring generator has to use "<=" and not > "<-". So the final working code is: > > -module(bb). > -compile([export_all]). > > decode(<>) -> > [Chan || <> *<=* Chans]. > > 118> c(bb). > {ok,bb} > 119> Chans3 = <<3:5,2:11,3:11,4:11>>. > <<24,2,0,96,4:6>> > 120> bb:decode(Chans3). > [2,3,4] > > Hope this helps. > > > > 2008/7/18 litao cheng : > >> hi, all. >> when I read this paper: Programming Efficiently with Binaries and Bit >> Strings http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf, I >> encounter a compile error, the code snipes is a example to parse the IS >> 683-PRL protocol: >> >> decode(<>) -> >> [Chan || <> <- Chans]. >> >> the compiler says: >> bit type mismatch (unit) between 11 and 1 >> >> I read the erlang reference mannual, the bits unit default is 1, I think >> the unit can be set, why this compile error occur? thank you! >> my erlang emulator is 5.6.3(R12B-3). >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > The great enemy of the truth is very often not the lie -- deliberate, > contrived and dishonest, but the myth, persistent, persuasive, and > unrealistic. Belief in myths allows the comfort of opinion without the > discomfort of thought. > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang-questions_efine@REDACTED Mon Jul 21 05:12:24 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sun, 20 Jul 2008 23:12:24 -0400 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216538169.5585.12.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <1216480977.4651.14.camel@piko.site> <6c2563b20807190911k5e5c6426le199d74faec7fccb@mail.gmail.com> <1216538169.5585.12.camel@piko.site> Message-ID: <6c2563b20807202012h1664b2c6j7cf01c5a0e6d2694@mail.gmail.com> I don't think what I wrote is irrelevant. I think you misunderstood the text in the Reference Manual and what I wrote. So let me try to be more precise. In informal syntax notation, Guard ::= 'when' GuardCondExp GuardCondExp ::= GuardCond OptTail OptTail ::= GuardOp GuardCondExp | GuardOp ::= ';' | ',' Of course, the semantics, as Richard Carlsson pointed out, in his post are more complex in terms of which GuardOps can be nested. Example: when GuardCond1; GuardCond; GuardCond...; GuardCondN -> or when GuardCond1, GuardCond2, GuardCond3, ..., GuardCondN -> GuardCond1 might be (X =:=0) or (1/X < 2) The reference manual is saying that the GuardConds above are short-circuited, even if the "or"-condition *comprising* GuardCond1 is *not*short-circuited. FWIW, I agree with ROK when he says don't ever use "and" and "or", and don't use "andalso" and "orelse" in guard conditions - it's error-prone and confusing. On Sun, Jul 20, 2008 at 3:16 AM, Alp?r J?ttner wrote: > What you are writing here is quite irrelevant to the quoted text, as > Section 6.14 deals with orelse/andelse, it has nothing to do with , > and ;. > > On the other hand it is not true that the evaluation of guards are > always short-circuited, in case of 'or' and 'and' both sides are always > evaluated. > > So, I still think that the quoted part of the reference manual is > erroneous and confusing. > > Best regards, > Alpar > > On Sat, 2008-07-19 at 12:11 -0400, Edwin Fine wrote: > > I interpret those words as follows: > > > > As of Erlang 5.5/OTP R11B, short-circuit boolean expressions are > > allowed in guards. Please note that evaluation is always > > short-circuited in guards. > > This is because guard tests are known to be free of side effects. If a > > guard condition is free of side-effects, that means that in a sequence > > of guards, it is guaranteed that leaving out the evaluation of one or > > more guards will not change the state of the program. For example, > > let's say that user-defined functions were allowed in guards. > > > > f(X) -> put(x, X), true. > > g() -> put(x, true), put(y,"g() was called"), true. > > h() -> get(x). > > test(X) when f(X), g(), h() -> ok. % Will not compile - illegal > > Erlang > > > > What will get(x) and get(y) return after test(X) is run? Will it make > > a difference to the result if guards are not short-circuited? > > > > Non-short-circuited guards: > > test(true): f(true) sets x to true, g() sets x to true, y to the > > string. End result: x is true, y is "g() was called". > > test(false): f(false) sets x to false, g() sets x to true. End result: > > x is true, y is "g() was called". > > > > Short-circuited guards with side-effects: > > test(true): f(true) sets x to true, g() sets x to true, y to the > > string. End result: x is true, y is "g() was called". > > test(false): f(false) sets x to false, g() is not evaluated. End > > result: x is false, y is undefined. > > > > So skipping a guard test if it has a side effect can change the state > > of the whole program, which would make short-circuit evaluation > > impossible. But because no guard tests can have side-effects, the > > state of the program cannot be changed if one or more guard tests are > > not evaluated. > > > > Hope this makes sense. > > > > > > > > On Sat, Jul 19, 2008 at 11:22 AM, Alp?r J?ttner > > wrote: > > > As of Erlang 5.5/OTP R11B, short-circuit boolean > > expressions are > > > allowed in guards. In guards, however, evaluation is > > always > > > short-circuited since guard tests are known to be > > free of side > > > effects. > > > ?(?Section 6.14, Short-Circuit Boolean Expressions) > > > > > > Something is wrong here, isn;t it? > > > > > > I mean > > > > * What does the word "however" mean here? Does it mean > > that if > > they are not in a guard, orelse/andelse might be non > > short-circuited? > > * How does the freedom from side effects are related to > > the > > short-circuited evaluation? > > > > Regards, > > Alpar > > > > > > > > > > Regards, > > > Alpar > > > > > > On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: > > > > Sean Allen wrote: > > > > > by a small bit of example code in Programming Erlang > > related to guards > > > > > and short circuit booleans: > > > > > > > > > > f(X) when (X == 0) or (1/X > 2) -> > > > > > ... > > > > > > > > > > g(X) when (X == 0) orelse ( 1/X > 2) -> > > > > > ... > > > > > > > > > > The guard in f(X) fails when X is zero but succeeds in > > g(X) > > > > > > > > > > Can someone explain why? > > > > > > > > > > > > Sean, > > > > > > > > The thing is, "or" does not short-circuit evaluation when > > left side > > > > succeeds, whereas "orelse" does. Same short-circuit logic > > is > > > > behind the differences between "and" and "andalso". > > > > > > > > Actually, the very book you read explains these > > differences and warns > > > > about caveats a couple pages later (or earlier). Don't > > stop reading. > > > > > > > > > > _______________________________________________ > > > 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 great enemy of the truth is very often not the lie -- deliberate, > > contrived and dishonest, but the myth, persistent, persuasive, and > > unrealistic. Belief in myths allows the comfort of opinion without the > > discomfort of thought. > > John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) > > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From drwho102003-erlang@REDACTED Mon Jul 21 07:33:20 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Sun, 20 Jul 2008 22:33:20 -0700 (PDT) Subject: [erlang-questions] can mnesia be made to become something like BigTable or SimpleDB ? Message-ID: <12904.37768.qm@web31809.mail.mud.yahoo.com> Are there any plans heading in that direction ? Thanks. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Mon Jul 21 09:22:34 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 21 Jul 2008 09:22:34 +0200 Subject: [erlang-questions] run_test from a crontab job In-Reply-To: References: Message-ID: <4d08db370807210022p405f7c9ey7130f82c137df48@mail.gmail.com> There is not set any environment variables in cron jobs. Check it and set what you want. 2008/7/20 James Mandelis : > Hi, > > > > I'm trying to run "run_test" from a crontab job but it doesn't seem to run > nor create the test results. > > It works fine from a terminal, by either calling it directly or via a make > file. > > Ultimately I need to run the tests from Hudson where but I have the same > problem. > > > > Any help will be greatly appreciated. > > > > cheers > > > > > > > > This email (including any attachments) is confidential, protected by > copyright and may be privileged. It is for the exclusive use of the intended > recipient(s). If you have received it in error, please notify the sender > immediately by emailing a response before deleting the email completely from > your computer, and note that any storage, copying or dissemination is > prohibited. > > > > Where the content of this email is personal or otherwise unconnected with > business of the Group's Companies, we accept no responsibility or liability > for such content. > > > > We accept no responsibility for viruses that we may have unintentionally > transmitted to you within this email and you should check for viruses before > opening any attachment. Those communicating with us by email will be deemed > to have consented to us intercepting and monitoring those communications. > > * * > > *Gamesys Ltd is registered in England & Wales, company registration number > 04042931. The registered office is at 54-62 Regent St* > > > > _______________________________________________ > 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 devdoer2@REDACTED Mon Jul 21 11:32:52 2008 From: devdoer2@REDACTED (devdoer bird) Date: Mon, 21 Jul 2008 17:32:52 +0800 Subject: [erlang-questions] can mnesia be made to become something like BigTable or SimpleDB ? In-Reply-To: <12904.37768.qm@web31809.mail.mud.yahoo.com> References: <12904.37768.qm@web31809.mail.mud.yahoo.com> Message-ID: Do you see CouchDB? 2008/7/21, Eric Ho : > > Are there any plans heading in that direction ? > > Thanks. > > -eric > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Mon Jul 21 12:24:28 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 21 Jul 2008 03:24:28 -0700 (PDT) Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: Message-ID: <436820.31991.qm@web38807.mail.mud.yahoo.com> --- On Mon, 7/21/08, Richard A. O'Keefe wrote: > Bottom line: > DON'T use 'or' or 'and' ANYWHERE. > DON'T use 'orelse' or 'andalso' in > guards > but instead stick to ';' and ','. I normally agree with those recommendations, but with a couple of caveats: 1. You can't nest ';', but you can nest orelse. This can be useful for macros and suchlike. 2. I seem to recall that ';' is implemented by duplicating the clauses, while andalso/orelse is not. If so, andalso/orelse _may_ yield somewhat more compact code. Both of these properties are basically accidents of history (ie, hacks that have been cast in stone). Best, Thomas From vychodil.hynek@REDACTED Mon Jul 21 13:46:51 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Mon, 21 Jul 2008 13:46:51 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <436820.31991.qm@web38807.mail.mud.yahoo.com> References: <436820.31991.qm@web38807.mail.mud.yahoo.com> Message-ID: <4d08db370807210446k6d495819yd936fb416a5f6b15@mail.gmail.com> On Mon, Jul 21, 2008 at 12:24 PM, Thomas Lindgren wrote: > > > > --- On Mon, 7/21/08, Richard A. O'Keefe wrote: > > > Bottom line: > > DON'T use 'or' or 'and' ANYWHERE. > > DON'T use 'orelse' or 'andalso' in > > guards > > but instead stick to ';' and ','. > > I normally agree with those recommendations, but with a couple of caveats: > > 1. You can't nest ';', but you can nest orelse. This can be useful for > macros and suchlike. > > 2. I seem to recall that ';' is implemented by duplicating the clauses, > while andalso/orelse is not. If so, andalso/orelse _may_ yield somewhat more > compact code. 3. Code using 'andalso' and 'orelse' can be cut paste copied as expression anywhere but ',' and ';' can be used only in guards (function, case, if). > > > Both of these properties are basically accidents of history (ie, hacks that > have been cast in stone). > > Best, > Thomas > > > > _______________________________________________ > 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 erlang@REDACTED Mon Jul 21 15:08:57 2008 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 21 Jul 2008 15:08:57 +0200 Subject: [erlang-questions] Some comments from the Erlang exchange Message-ID: <9b08084c0807210608k506b1e62w1fe05bbcab738203@mail.gmail.com> I've blogged some comments I had on the Erlang exchange - it took a while all the material I wanted to refer to has only recently been made available on-line. http://armstrongonsoftware.blogspot.com/2008/06/itching-my-programming-nerve.html Cheers /Joe Armstrong From rick.richardson@REDACTED Mon Jul 21 20:51:29 2008 From: rick.richardson@REDACTED (Rick R) Date: Mon, 21 Jul 2008 14:51:29 -0400 Subject: [erlang-questions] NY Erlang User's Group Message-ID: <9810b81b0807211151o2654e7f6o9f79736a132dfe03@mail.gmail.com> I noticed on this list that the closest Erlang User's Group to Manhattan is in Chicago. Now I'm quickly becoming a rabid Erlang exponent, but I still think that that might be a tad far to travel for a meetup. Are there any Erlangers in the NYC area that would be keen to meet up and exchange ideas? (either over a beer or in work-area environment (or both)) Are there any members of the above set that would be interested in doing this on a regular basis? If there are, I'm sure we could find the space. -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Mon Jul 21 23:26:30 2008 From: rvirding@REDACTED (Robert Virding) Date: Mon, 21 Jul 2008 23:26:30 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <436820.31991.qm@web38807.mail.mud.yahoo.com> References: <436820.31991.qm@web38807.mail.mud.yahoo.com> Message-ID: <3dbc6d1c0807211426q75ff1170wae203a4e36d7a250@mail.gmail.com> The boolean operators and, or, xor and not are the originals and evaluate all their arguments, they have never been short circuiting, and are like the bitwise C operators. Orelse and andalso came much later. 2008/7/21 Thomas Lindgren : > I normally agree with those recommendations, but with a couple of caveats: > > 1. You can't nest ';', but you can nest orelse. This can be useful for > macros and suchlike. > > 2. I seem to recall that ';' is implemented by duplicating the clauses, > while andalso/orelse is not. If so, andalso/orelse _may_ yield somewhat more > compact code. > > Both of these properties are basically accidents of history (ie, hacks that > have been cast in stone). Yes, you have to go back in history to see why guards are what they are. Guards were originally meant to be just simple tests which were considered part of the pattern matching process but were clearer and simpler to write outside the actual pattern. They came directly from the guards occurring in the flat concurrent logic languages. Originally guards were a sequence of simple tests, a guard sequence, which could either succeed or fail. An exception in a guard test was made to be equivalent to failure of the test to make the guards simpler and shorter. With these original guards the order of evaluation *was* irrelevant but the compiler did them left to right. when test1, test2, ... -> Then their came a request to have alternate guards for the same head and body. To do this guards were extended to be a set of alternate guard sequences separated by ';'. The semantics were the same within each guard sequence. The sequences were evaluated from left to right, if a sequence failed then the next one was tried. An exception was equivalent to failure as before but the only led to that sequence failing, not the whole guard. This was consistent with other uses of ';' as separator. when guard_seq1 ; guard_seq2 ; ... -> .. Guard tests were still quite different semantically from "normal" expressions and it was not too different to *see* the difference. Finally guards were extended to be full boolean expressions, more or less. While this made them more useful in some ways it also made them much more difficult and confusing. As well as making them look more like "normal" expressions which they still aren't. There is no problem with code duplication when using ';'. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Jul 22 00:59:41 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 22 Jul 2008 10:59:41 +1200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <4d08db370807210446k6d495819yd936fb416a5f6b15@mail.gmail.com> References: <436820.31991.qm@web38807.mail.mud.yahoo.com> <4d08db370807210446k6d495819yd936fb416a5f6b15@mail.gmail.com> Message-ID: On 21 Jul 2008, at 11:46 pm, Hynek Vychodil wrote: > 1. You can't nest ';', but you can nest orelse. This can be useful > for macros and suchlike. (A) There is no reason whatever why ',' and ';' in guards COULDN'T be allowed to nest. That would have been the sensible thing to do, rather than introducing new and confusing operators. (B) I have yet to see any evidence that writing complicated guards is a good idea. If there are "macros and suchlike" that need nested control operators in guards, PLEASE let us see some so that we can tell whether there is a better way. > > 2. I seem to recall that ';' is implemented by duplicating the > clauses, while andalso/orelse is not. If so, andalso/orelse _may_ > yield somewhat more compact code. Ah, the old "I seem to recall" trick. This is something that is easy to discover for sure by writing a little test case, like adding a clause bar(N) when N == a ; N == b ; N == c -> [N]; to a function, then compile:file('foo.erl', ['E']) Nope, "the code after all source code transformations have been performed" shows no signs of the clause being duplicated, compile:file('foo.erl', ['S']) Nope, this clause turns into {label,6}. {test,is_ne,{f,7},[{x,0},{atom,a}]}. {test,is_ne,{f,7},[{x,0},{atom,b}]}. {test,is_eq,{f,8},[{x,0},{atom,c}]}. {label,7}. {test_heap,2,1}. {put_list,{x,0},nil,{x,0}}. {'%live',1}. return. with just ONE copy of the clause. So NO, orelse will *NOT* yield more compact code. In fact, why not try the same thing with 'orelse' instead of ';'? Changing that clause to bar(N) when N == a orelse N == b orelse N == c -> [N]; turns into the following code: {label,6}. {allocate,1,1}. {move,{x,0},{y,0}}. {test,is_eq,{f,7},[{x,0},{atom,a}]}. {move,{atom,true},{x,0}}. {jump,{f,9}}. {label,7}. {test,is_eq,{f,8},[{x,0},{atom,b}]}. {move,{atom,true},{x,0}}. {jump,{f,9}}. {label,8}. {bif,'==',{f,10},[{x,0},{atom,c}],{x,0}}. {label,9}. {test,is_eq_exact,{f,10},[{x,0},{atom,true}]}. {test_heap,2,0}. {put_list,{y,0},nil,{x,0}}. {'%live',1}. {deallocate,1}. return. As you see, using 'orelse' results in code that is CONSIDERABLY LESS COMPACT than code using ';'. And it is not just less compact, it executes more instructions. If compact speedy code is something you want, then you would have to be off your rocker to use 'orelse' in a guard. Note: this might not be true for all time. *In a guard*, and when governing tests rather than some random expressions, 'orelse' should be compiled exactly like ';' and 'andalso' should be compiled exactly like ','. At the moment they are not, partly because 'orelse' and 'andalso' were given seriously flawed semantics that makes them unusable in the place where I would most want to use them: a definition like member(X, []) -> false; member(X, [H|T]) -> X == H orelse member(X, T). fails to be tail-recursive because the second operand of 'andalso' and 'orelse' is (unlike Lisp, Scheme, Smalltalk, &c) checked to see if it is 'false' or 'true'. > > 3. Code using 'andalso' and 'orelse' can be cut paste copied > as expression anywhere but ',' and ';' can be used only in > guards (function, case, if). This is actually a serious problem with 'andalso' and 'orelse'. Guards are NOT a kind of expression and cutting a guard then pasting it as an expression, or cutting an expression and pasting it as a guard, very often doesn't work. We are not so short of ways to shoot ourselves in the feet that we need more of them. > Horses for courses: when writing Haskell or Clean naturally I use '||' and '&&' without concern. In those languages guards *are* expressions and their logical control flow operators *are* compatible with tail recursion. From kevin@REDACTED Tue Jul 22 04:35:20 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 21 Jul 2008 22:35:20 -0400 Subject: [erlang-questions] Description entry in app spec files Message-ID: <1B458EDC-4D35-4A02-8AA6-4843E7F3FDF7@hypotheticalabs.com> Who or what uses the "description" entry in an app spec file? I've read that systools requires the entry but I'm not clear on what it's used for. --Kevin From goofyheadedpunk@REDACTED Tue Jul 22 06:20:33 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Mon, 21 Jul 2008 21:20:33 -0700 Subject: [erlang-questions] Inets application unstarted. Message-ID: <971980cc0807212120t2f4ffba5oe06a442ca4e068cb@mail.gmail.com> Hello all, I'm building my first OTP program, which I'm calling Aule. It's something simple to mine data through the Amazon web services, which is REST based. I need inets started as a dependency of Aule. I've followed the OTP Design Principles "Applications" and the "Inets User Guide" Http sections most heavily, in addition to man pages and IRC guidance. All that said, I have my aule.app which looks like so: >{application, aule, > [{description, "An Amazon data AAWS data miner"}, > {vsn, "0.0.1"}, > {modules, [aaws_functions, aule, aule_supervisor, > browse_node_fiend, amazon_interface]}, > {registered, ['AmazonInterface', 'BrowseNodeFiend']}, > {applications, [kernel, stdlib, inets]}, > {mod, {aule,[]}}, > {env, []} > ]}. And a sys.config that looks like so: > [{kernel, [{start_timer, true}]}, > {inets, [{services, [{httpc, [{profile, olorin}]}]}]} > ]. I run, "erl -config sys.config" and then load/start aule like so: > 1> application:load(aule), application:start(aule). > {error,{not_started,inets}} And I'm confused. The OTP Design Principles document states that the applications field has "[a]ll applications which must be started before this application is started." I took this to mean that OTP starts the appropriate applications before aule start. Am I wrong? If so, what does applications do? If I'm not wrong, what am I missing to get inets started immediately? Thanks in advance, Brian From andreas.hillqvist@REDACTED Tue Jul 22 07:46:05 2008 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Tue, 22 Jul 2008 07:46:05 +0200 Subject: [erlang-questions] Inets application unstarted. In-Reply-To: <971980cc0807212120t2f4ffba5oe06a442ca4e068cb@mail.gmail.com> References: <971980cc0807212120t2f4ffba5oe06a442ca4e068cb@mail.gmail.com> Message-ID: <8268eea30807212246m1d96627aj80c6a4b85963550b@mail.gmail.com> Hi Brian. I belive that the pice missing from the puzzel is a Boot Script, that should start the application in a correct order acording to each applications dependencies: http://www.erlang.org/doc/system_principles/system_principles.html#1.3 The simple way to make an boot script is to use a release resource file: http://www.erlang.org/doc/man/rel.html To use your boot file: >erl -boot Your_Boot_Script.boot Or >erl -boot_var $App_Path/Your_Boot_Script.boot To summeries, I belive it should be sufficent for your use: * create a release resource file * create a boot script from your resource file * use your boot script when starting erlang Pleas feel free to comment and/or add any additional comments. Kind regards Andreas Hillqvist 2008/7/22, Brian Troutwine : > Hello all, > > I'm building my first OTP program, which I'm calling Aule. It's > something simple to mine data through the Amazon web services, which > is REST based. I need inets started as a dependency of Aule. > > I've followed the OTP Design Principles "Applications" and the "Inets > User Guide" Http sections most heavily, in addition to man pages and > IRC guidance. All that said, I have my aule.app which looks like so: > > >{application, aule, > > [{description, "An Amazon data AAWS data miner"}, > > {vsn, "0.0.1"}, > > {modules, [aaws_functions, aule, aule_supervisor, > > browse_node_fiend, amazon_interface]}, > > {registered, ['AmazonInterface', 'BrowseNodeFiend']}, > > {applications, [kernel, stdlib, inets]}, > > {mod, {aule,[]}}, > > {env, []} > > ]}. > > And a sys.config that looks like so: > > > [{kernel, [{start_timer, true}]}, > > {inets, [{services, [{httpc, [{profile, olorin}]}]}]} > > ]. > > I run, "erl -config sys.config" and then load/start aule like so: > > > 1> application:load(aule), application:start(aule). > > {error,{not_started,inets}} > > And I'm confused. The OTP Design Principles document states that the > applications field has "[a]ll applications which must be started > before this application is started." I took this to mean that OTP > starts the appropriate applications before aule start. Am I wrong? If > so, what does applications do? If I'm not wrong, what am I missing to > get inets started immediately? > > Thanks in advance, > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From circularfunc@REDACTED Tue Jul 22 08:39:30 2008 From: circularfunc@REDACTED (Circular Function) Date: Tue, 22 Jul 2008 06:39:30 +0000 (GMT) Subject: [erlang-questions] tail and head Message-ID: <862093.48307.qm@web28310.mail.ukl.yahoo.com> why cant i do head([1,2,3]). or head [1,2,3]. ? head and tail aren't real commands just abstract ones so I always have to do the following? [A:B]=[1,2,3]. A. 1 B. [2,3] __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Jul 22 09:15:32 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 22 Jul 2008 09:15:32 +0200 Subject: [erlang-questions] tail and head In-Reply-To: <862093.48307.qm@web28310.mail.ukl.yahoo.com> References: <862093.48307.qm@web28310.mail.ukl.yahoo.com> Message-ID: <95be1d3b0807220015p2c5e6a4dh469931b8de32bb7e@mail.gmail.com> Hi, You can, it's only that 'head' is actually called 'hd' and 'tail' is 'tl'. hd([1,2,3]) 1 regards, Vlad 2008/7/22 Circular Function : > why cant i do head([1,2,3]). or head [1,2,3]. ? > > head and tail aren't real commands just abstract ones so I always have to > do the following? > [A:B]=[1,2,3]. > A. > 1 > B. > [2,3] > > ------------------------------ > Ta semester! - s?k efter resor hos Kelkoo. > J?mf?r pris p? flygbiljetter och hotellrum: > http://www.kelkoo.se/c-169901-resor-biljetter.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 chsu79@REDACTED Tue Jul 22 09:19:27 2008 From: chsu79@REDACTED (Christian S) Date: Tue, 22 Jul 2008 09:19:27 +0200 Subject: [erlang-questions] tail and head In-Reply-To: <862093.48307.qm@web28310.mail.ukl.yahoo.com> References: <862093.48307.qm@web28310.mail.ukl.yahoo.com> Message-ID: The names of the functions are erlang:hd/1 and erlang:tl/1 And yes, "[A|B] = List." is another way to deconstruct a list. 2008/7/22 Circular Function : > why cant i do head([1,2,3]). or head [1,2,3]. ? From svenolof@REDACTED Tue Jul 22 11:38:09 2008 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Tue, 22 Jul 2008 11:38:09 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <8209f740806301210p42550dc0j11b739be44f61a96@mail.gmail.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <95be1d3b0806251417y33ff2e5br7597757656ce259e@mail.gmail.com> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <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> Message-ID: <18565.43649.880641.925438@harpo.it.uu.se> Ulf Wiger writes: > 2008/6/30 Sven-Olof Nystr|m : > > > > Since I came up with the channel concept, I've been looking for some > > convincing example of an Erlang program that could be implemented > > using selective receive, but was not possible to implement using > > channels (or where the solution with channels was more complex). When > > I saw your buffer example, I thought for a moment that it was the > > example I was looking for. > > A good place to start might be the POTS control program, which was > presented in the Erlang book, and also used (in a slightly different form) > in the Introductory Erlang course. > > I used it in my "Structured Network Programming" presentation to > show the consequences of different programming styles in multiway > signaling: > > http://www.erlang.se/euc/05/1500Wiger.ppt > > I'm not convinced that it will be sufficient to reveal significant differences > between the standard erlang style and channels, but it's a good place to > start, and the code can be expanded in a number of interesting ways. > > BR, > Ulf W > > (There's a working simulator to go with the program, but the OTP team > would have to give permission to release it in public. I'm sure you can > get your hands on it anyway.) Sorry about disappearing from the discussion for so long. I took a look at the POTS program in the Erlang book. It is actually easy to rewrite it to use neither channels nor selective receive. I also looked at the gen-server module. Detailed comments follow. (A non-selective receive is one that always pick the first message in the mailbox.) Sven-Olof The book's implementation of POTS only contains four receive expressions. Among these, only one (in the function make_call_to_B/3) is selective. In the book's example, each telephone has one process that is responsible for the interaction with that telephone. Each process can receive five types of messages: - off_hook - on_hook - {digit, Digit} - {seize, Pid} - cleared The first three are of course due to the user's actions. The third handles the case when another process attempts to connect to the current process. When this happens, there are two possible responses: - seized - rejected So if process X tries to connect to process Y, X sends {seize, X} to Y, and Y responds either with a message containing the atom 'seized', if the connect was successful, or 'rejected' if it was not. Now, there is no way to distinguish a response from one processes from another, so the implementation is correct only if messages cannot be delayed for too long. It is easy enough to make the receive expression in make_call_to_B non-selective by adding two clauses: on_hook -> B_Pid ! cleared, idle(Address); Other -> make_call_to_B(Address, B_Pid, B_Address) However, neither this solution nor the book's solution seem completely satisfactory. Using selective receive, a better solution is to tag responses with the sending process. Using channels, a better solution is to create separate channels for responses. I have not attempted to re-write the gen-server, but I have taken a close look. Below, numbers in parentheses indicate line numbers. The gen-server (of stdlib-1.14.5) contains 14 receive expressions: - The one in the main loop (305) is non-selective. - several are used in the monitoring of processes (366, 508) and nodes (420, 425, 435, 473, 477). These cannot immediately be rewritten using channels. However, if we follow the principle that the mailbox of a process should only contain messages related to the service that the process provides (i.e., not to messages part of the implementation of the service) the messages indicating that a process (or node) is down should arrive in a separate channel. Thus, the New Erlang versions of erlang:monitor (and possibly also erlang:demonitor) needs an additional argument giving the channel where the messages are to be sent. With the additional argument, it is possible to rewrite these receives to use channels. Also, note that several of these are very simple, for example unmonitor(Ref) when is_reference(Ref) -> erlang:demonitor(Ref), receive {'DOWN', Ref, _, _, _} -> true after 0 -> true end. Here, the purpose is simply to cleanup the mailbox. If we use a separate channel to collect monitoring messages, we can simply drop the channel without examining its contents - One receive (352), used in the implementation of multi-call, either takes a message from the calling process or a notification that it is down. - Similar to the previous case, and also in the implementation of multi-call, several receives (401, 415, 456, 469) match either a reply from a node, or a message (due to monitoring) that the node (or the processes executing on the node) is down. Multi-call collects responses from a number of nodes. The nodes are given in a list but the messages from the nodes will of course arrive in an arbitrary order. Here, selective receive is used to match the messages in the order given in the list of nodes. A solution that does not use selective receive will be slightly more complex (the simplest solution would require a function that removes a node from a list of nodes). The current solution has quadratic complexity in the number of nodes. The implementation of multi-call is surprisingly complex. Ten of the fourteen receive expressions of the gen-server module are used in the implementation of multi-call. - One receive (444) removes a message sent by a timer. To rewrite this receive using channels one needs to use a separate channel for the timeout message. As the destination of the timeout message is given explicitly in the call to the built-in function erlang:start_timer/3, a rewrite is straight-forward. From csanto@REDACTED Tue Jul 22 11:48:38 2008 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 22 Jul 2008 11:48:38 +0200 Subject: [erlang-questions] Erlang and ISDN Message-ID: <4885ACF6.6090407@diit.unict.it> Hi all, in your knowledge, is there any project to interface Erlang with ISDN boards? Thanks, --Corrado -- ================================================================== 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 svenolof@REDACTED Tue Jul 22 12:11:47 2008 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Tue, 22 Jul 2008 12:11:47 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <742534.21229.qm@web38801.mail.mud.yahoo.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <742534.21229.qm@web38801.mail.mud.yahoo.com> Message-ID: <18565.45667.961131.983262@harpo.it.uu.se> Thomas Lindgren writes: > Selective receive and channels: There seem to be two arguments > against selective receive. A third argument: Erlang processes use their mailboxes for two purposes: 1) To receive requests for whatever service the process provides. 2) For internal communication. Whenever a process needs to send a request to another process or simply ask a question, the response will arrive in the mailbox and needs to be extracted using selective receive. I think it is better to use separate channels for the second purpose. > First, that it is hard to understand. That's not my experience. Most examples that take advantage of selective receive's ability to scan the mailbox follows a simple pattern. I agree that code following this pattern is easy to understand. > Also, as I recall, Concurrent ML and its channels yielded some > horribly convoluted examples when trying to write POTS. Others have also mentioned the difficulties in writing POTS in CML. It seems to me that a solution using CML's buffered channels would be very similar to an Erlang solution. It would be interesting to learn more about the CML solutions. What did they look like, and why were they terribly convoluted? > Thus, such gains from channels seem quite unclear to me. Second, > that selective receive can be inefficient. But is it _inherently_ > inefficient, or just suffering from a lack of attention to some > cases? Could better implementation techniques solve this? A better implementation could certainly improve performance of applications that spend a lot of time scanning the mailbox, but I suspect that it would be better to rewrite such applications. > (Regarding channels: changing how receive works seems so > fundamental that the path of least resistance might be to just > switch to Concurrent ML.) Or to leave things the way they are. > Linked modules: a difficult issue in practice. I have thought about > how to do this in the context of optimization for quite some time, > but one should note that hot code loading is a feature that trumps > quite a lot of others in practice. Also, what do we really mean > when we write "-linked_module(m)."? To what does 'm' refer, for > example? (I'll happily agree that records are an abomination.) 'm' is another module. At the time of writing, I thought the linked_module proposal was the weakest of my proposals. I still decided to leave it in, as I thought that the issue was important and deserved to be addressed. Richard O'Keefe mentioned that he had proposed something similar. > A number of features of Erlang have been introduced pell-mell and > then could never be retracted (records; three nearly-identical > sorts of guard operators; two identical forms of guards, etc). A > fresh version of Erlang would do well in pruning back a lot of > these and just putting back the ones with a point. You are putting it better than I did. > (The next erlang might first of all have a nice, preinstalled way > of revising the language :-) I'm not sure what a mechanism for revising the language would look like. Lisp's macros offer a way to experiment with the language without modifying the implementation. I think this helps the development of the language in the long run. > Finally, the discussion needs some compelling examples. Would we > really get substantially better code over what we have today? > Demonstrate. I'll try to come up with something :-) Sven-Olof From vances@REDACTED Tue Jul 22 12:22:01 2008 From: vances@REDACTED (Vance Shipley) Date: Tue, 22 Jul 2008 11:22:01 +0100 Subject: [erlang-questions] Erlang and ISDN In-Reply-To: <4885ACF6.6090407@diit.unict.it> References: <4885ACF6.6090407@diit.unict.it> Message-ID: <20080722102201.GD4185@Little-Black-Book.local> On Tue, Jul 22, 2008 at 11:48:38AM +0200, Corrado Santoro wrote: } in your knowledge, is there any project to interface Erlang with ISDN } boards? Well there's good news, and bad news. The good news is that yes, yes there is: http://netaccess-erldrv.googlecode.com The bad news is that they stopped manufacturing those boards a couple years ago. You may still be able to buy them on eBay however and I do have a box of them that I'm probably never going to use. Ask me if you're interested. These were wonderful boards which had high density HDLC engines on them. A dual E1 board had 64 engines which meant that you could run more D-channels that you had timeslots, a configuration which I actually used in large IWFs. While I'm at it I'll drop another plug for my LAPD protocol stack imlementation: http://lapderl.googlecode.com I do have erlang drivers, similiar to the netaccess one, for the NMS boards as well however I've never cleaned them up and released them. These were used more for the SS7 boards and the ISDN API isn't entirely finished. If you were interested though I could boot strap you on those boards. http://www.nmscommunications.com/DevPlatforms/OpenAccess/DigitalPSTN/default.htm -Vance From thomasl_erlang@REDACTED Tue Jul 22 11:56:33 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 22 Jul 2008 02:56:33 -0700 (PDT) Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: Message-ID: <581048.64878.qm@web38804.mail.mud.yahoo.com> --- On Tue, 7/22/08, Richard A. O'Keefe wrote: > > 1. You can't nest ';', but you can nest > orelse. This can be useful > > for macros and suchlike. > > (A) There is no reason whatever why ',' and > ';' in guards COULDN'T > be allowed to nest. That would have been the sensible > thing > to do, rather than introducing new and confusing > operators. For what it's worth, I agree. But here we are. > (B) I have yet to see any evidence that writing complicated > guards > is a good idea. If there are "macros and > suchlike" that need > nested control operators in guards, PLEASE let us see > some so > that we can tell whether there is a better way. I already have a way that usually is better, which is to express a complex guard as an ordinary boolean-valued expression (perhaps even a new function) in a case. The price of this approach is that you don't get to use the more convenient guard syntax. Here are the two broad classes of guard macros I have seen: One case is when you want to hide representation. -define(is_equipment_foo(X), (record(X, eqm1) orelse record(X, eqm2)). Another is when you refactor or name a commonly occurring test. Something like: -define(is_non_empty_list(X), (is_list(X) andalso X =/= [])). -define(is_byte(X), (X >= 0 andalso X =< 255)). For concreteness, here are three guard macros from xmerl.hrl (R12B3): %% whitespace consists of 'space', 'carriage return', 'line feed' or 'tab' -define(whitespace(H), H==?space ; H==?cr ; H==?lf ; H==?tab). %% non-caharacters according to Unicode: 16#ffff and 16#fffe -define(non_character(H1,H2), H1==16#ff,H2==16#fe;H1==16#ff,H2==16#ff). -define(non_ascii(H), list(H),hd(H)>=128;integer(H),H>=128). I would guess these macros were written before the new guard operators, since they can only be used in specific contexts and would be more useful with andalso/orelse. But, mutatis mutandis, I think they are reasonable examples of what is done. > > 2. I seem to recall that ';' is implemented by > duplicating the > > clauses, while andalso/orelse is not. If so, > andalso/orelse _may_ > > yield somewhat more compact code. > > Ah, the old "I seem to recall" trick. "Trick"? You got me, Richard. I always argue in bad faith. Thomas From cthulahoops@REDACTED Tue Jul 22 13:14:32 2008 From: cthulahoops@REDACTED (Adam Kelly) Date: Tue, 22 Jul 2008 12:14:32 +0100 Subject: [erlang-questions] truncated list with ellipsis In-Reply-To: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> References: <9DC7B393-B362-4C59-A230-820B13FFCD8B@mac.com> Message-ID: <8d1798e90807220414v63e98bbbl90c9480937567e89@mail.gmail.com> 2008/7/20 Russell Brown : > 1> [{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:= 50]. The shell function rp is really useful for this, as in: 2> rp([{A,B} || A <- lists:seq(0, 50), B <- lists:seq(0, 50), A + B =:= 50]). Adam. From svenolof@REDACTED Tue Jul 22 13:45:51 2008 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Tue, 22 Jul 2008 13:45:51 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: References: <18529.883.586609.71953@hamberg.it.uu.se> <18530.17062.650561.451935@hamberg.it.uu.se> <95be1d3b0806251417y33ff2e5br7597757656ce259e@mail.gmail.com> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <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> Message-ID: <18565.51311.257657.588130@harpo.it.uu.se> Sorry for the delayed response. Richard A. O'Keefe writes: > On 1 Jul 2008, at 6:51 am, Sven-Olof Nystr|m wrote: > > > > But an Erlang process is always willing to accept messages. Unlike an > > Ada process (say) there is no way an Erlang process can prevent > > another process from sending it a message. The process can choose not > > to look at it, but that's another matter. > > I would say that > - a MAILBOX is always willing to accept any message > - a PROCESS is only willing to accept a message when > it is executing a 'receive' construct that will > match it. Correct. However, the sending process has no way of telling whether the receiving process has accepted the message or not. In contrast, in a language with unbuffered communication (such as Ada), the sending process is blocked until the receiving process has accepted the message. > By the way, the bounded buffer example can obviously be > "rescued" thus: > > producer(Buffer) -> > .... > Buffer ! {put,self(),Item}, > receive {ok,Buffer} -> ok end, > producer(Buffer). > > consumer(Buffer) -> > Buffer ! {get,self()}, > receive {ok,Buffer,Item} -> ok end, > .... > > buffer(Pool, Left) -> > receive > {put,Producer,Item} when Left > 0 -> > Producer ! {ok,Buffer}, > buffer(Pool ++ [Item], Left - 1) > ; {get,Consumer} when Pool =/= [] -> > Consumer ! {ok,Buffer,hd(Pool)}, > buffer(tl(Pool), Left + 1) > end. > > Assuming that this is part of a system where only the > producer and consumer can refer to Buffer, this is > the traditional bounded buffer. The argument that the > mailbox (but NOT the process) is always willing to > accept more messages has no force between the senders > won't *send* more messages; the buffer's mailbox will > have at most one 'put' and and most one 'get' at any > one time. The substantive point, that the *process* > (not the mailbox) is willing to accept different > messages at different times remains. Yes, this is what I had in mind. Here you are in effect simulating unbuffered communication. Using channels, the receive in the functions producer/1 and consumer/1 can easily be rewritten using channels. The function buffer/2 needs a third parameter containing an explicit queue of unprocessed requests. > This is a nice illustration of why mailbox length is > often not a problem: the need for a response means > that the mailbox is bounded in size by the number of > processes that might send messages. In effect, the > responses are a form of flow control. Unless a process sends more than one message. (Allright, I agree that normally there would only be one outstanding message per process.) > > So your argument is: Concurrent ML tried something similar. > > It did not work out. > > It worked out in the sense that the design was implementable, > was implemented, was used, and is still available in SML/NJ > and Mlton. It also worked out in the sense that *simple* > problems don't look too bad. The point is that things which > would still be pretty straightforward in Erlang with its > 'receive' quickly become very complex in CML. I have not tried writing anything in CML, but I have looked through the documentation and read parts of Reppy's thesis. The language does not look very attractive, but it doesn't look *that* bad. It would be interesting to here more about why CML was hard to use for complex problems. > > Interestingly, the Limbo programming language has CML-like > channels, but without all the extra stuff in CML. (For > example, CML has both channels and mailboxes.) Right. So CML channels are unbuffered, while CML mailboxes are buffered. Limbo channels are also unbuffered. > http://www.vitanuova.com/inferno/papers/limbo.html > 4.2.5 > chan of is a type. > ch <-= msg is a send. > 8.2.9 > <- ch is a receive > <- ch_array is multi-receive > For example, > msg = <- ch > receives a message from one channel. > (ix, msg) = <- ch_array > receives an (index, message) pair where the index says > which element of the channel array the message came from. > 8.4.3 > ch <-= msg > blocks if no process is reading from ch. > 9.8 > alt {... msg = <- ch => stmt; > ... ch <- = msg => stmt; > } > is like an Occam ALT. > > Let me quote section 12.4 in full. > > 12.4 Buffered channels > > Limbo channels are unbuffered; a sender blocks until there is a > receiver. This example shows a way to make a buffered channel of > strings from an unbuffered channel. It is written as a module > whose > bufchan function takes a chan of string and a size as argument, and > returns a new channel; it creates an asynchronous task that accepts > input from the argument channel and saves up to size strings, > meanwhile trying to send them to its user. > > implement Bufchan; > > Bufchan: module { > bufchan: fn(c: chan of string, size: int): chan of string; > }; > > xfer(oldchan, newchan: chan of string, size: int) { > temp := array[size] of string; > fp := 0; # first string in buffer > n := 0; # number of strings in buffer > dummy := chan of string; > sendch, recvch: chan of string; > s: string; > > for (;;) { > sendch = recvch = dummy; > if (n > 0) sendch = newchan; > if (n < size) recvch = oldchan; > alt { > s = <-recvch => > temp[(fp+n)%size] = s; > n++; > > sendch <- = temp[fp] => > temp[fp++] = nil; > n--; > if (fp>=size) fp -= size; > } > } > } > > bufchan(oldchan: chan of string, size: int): chan of string { > newchan := chan of string; > spawn xfer(oldchan, newchan, size); > return newchan; > } > > The module is somewhat specialized, but it illustrates useful > programming techniques. The most interesting occurs in xfer, which > does the work. The problem xfer faces is that it doesn't want to > receive input when its buffer is full, nor to try to send when it > has nothing to transmit. The solution here is to use a dummy > channel on which nothing is ever sent or received; in the alt > statement, that channel substitutes for the real input channel when > the buffer is full, and for the output channel when the buffer is > empty. > > [snipped] > > This is "real" bounded buffer. Note the trick: you need three > channels, one of them a dummy that will never be used. If you > don't want a particular alternative to really be there, make > that one wait for a communication that can never happen. To me > this is much harder to understand than a guarded 'select' in > Ada or 'alt' in Occam, because what's _really_ going on is hidden > under a layer of what I can only call obfuscation. Yes, this is a nice example. Also similar to the Ada example you gave previously. Naturally, in a language without buffered communication, one of the first things one needs to implement is buffered communication :-) > > So we agree that it's *not* an implementation of bounded buffers???? > > Why do you harp on this one note? > Idunno, you strip things to the bone to make a point concisely, > and someone makes a federal case out of your kindness. > > From now on, please do not refer to the stripped down example, > but only to the full producer/buffer/consumer example, which contains > material not relevant to the state-dependent-reception POINT. I asked because it seemed like an important example. I promise, I will not bring it up again :-) > > > > > Since I came up with the channel concept, I've been looking for some > > convincing example of an Erlang program that could be implemented > > using selective receive, but was not possible to implement using > > channels (or where the solution with channels was more complex). > > Try looking in the Erlang sources. There are plenty of simple cases > there, true. But there are also plenty of cases where many channels > would be needed, making the solution with channels look a lot more > complex to me. I have looked at the POTS solution in the Erlang book and the gen_server module. See my response to Ulf Wiger's post previously in this list. > > It may be that we have different ideas of what counts as a 'more > complex' solution. If this thread is not to degenerate into something > out of Dr Suess (was it the West-going something and the East-going > something else or was it North and South?) we really need to see > some concrete cases FROM THE PROPOSER. OK. > The proposal in the document I was responding to does not contain > any multi-receive, and it's not clear that one can be programmed from > the operations that are in the document. I don't know any message- > based language that doesn't have some analogue of an Occam 'ALT'/ > Limbo 'alt'/Ada 'select', and that document doesn't include one, > so it's clearly incomplete that way as well. Actually, I think unbuffered languages (such as the ones you mention) are very different from buffered languages, and that it is a mistake to try to transfer experiences from the unbuffered languages to Erlang. > > So we need to see a functionally complete proposal (in order to > judge how complex the proposed replacement for 'receive' is in > itself) *AND* some examples of rewritten Erlang code to judge > how complex the replacement is in use. OK. > For the statement > > I've been looking for some > > convincing example of an Erlang program that could be implemented > > using selective receive, but was not possible to implement using > > channels (or where the solution with channels was more complex). > to have any force, there must already BE a number of examples which > have been so rewritten. So let's see them. I'll get back to you on that. Sven-Olof From ignatios@REDACTED Tue Jul 22 14:26:50 2008 From: ignatios@REDACTED (Ignatios Souvatzis) Date: Tue, 22 Jul 2008 14:26:50 +0200 Subject: [erlang-questions] http:request/5 returns econnrefused for localhost In-Reply-To: <486A9ED1.1000202@hyber.org> References: <6c2563b20806231808r18fffaabu8120134b4ba1da30@mail.gmail.com> <5CA9B9A5-C9EB-4E17-9D63-8C2D18834DEE@apache.org> <20080624094811.GB4827@cs.uni-bonn.de> <486A9ED1.1000202@hyber.org> Message-ID: <20080722122650.GA15138@cs.uni-bonn.de> On Tue, Jul 01, 2008 at 11:17:05PM +0200, Claes Wikstr?m wrote: > Has anybody tried Yaws with IPv6 - I haven't Good point. I'll add that to my todo-list. -is From thomasl_erlang@REDACTED Tue Jul 22 13:30:00 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 22 Jul 2008 04:30:00 -0700 (PDT) Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <3dbc6d1c0807211426q75ff1170wae203a4e36d7a250@mail.gmail.com> Message-ID: <185005.38413.qm@web38805.mail.mud.yahoo.com> --- On Mon, 7/21/08, Robert Virding wrote: > There is no problem with code duplication when using > ';'. I'm happy to hear that. I got the impression that there was code duplication for ";" from discussions back when guards were being generalized into full and/or, but I may have been mistaken. (Or things have changed since then; at any rate, there is little reason to implement things that way.) Best, Thomas From ignatios@REDACTED Tue Jul 22 14:49:29 2008 From: ignatios@REDACTED (Ignatios Souvatzis) Date: Tue, 22 Jul 2008 14:49:29 +0200 Subject: [erlang-questions] shared library avoidance code harmful on certain architectures In-Reply-To: <20080623124616.GG6701@cs.uni-bonn.de> References: <20080623124616.GG6701@cs.uni-bonn.de> Message-ID: <20080722124929.GB15138@cs.uni-bonn.de> On Mon, Jun 23, 2008 at 02:46:16PM +0200, Ignatios Souvatzis wrote: > erlang 12 fails to build on NetBSD/amd64. I was told to test the > patches below. (...) Is there any appropriate place to send this to? -is From rvirding@REDACTED Tue Jul 22 15:28:07 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 22 Jul 2008 15:28:07 +0200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: References: <436820.31991.qm@web38807.mail.mud.yahoo.com> <4d08db370807210446k6d495819yd936fb416a5f6b15@mail.gmail.com> Message-ID: <3dbc6d1c0807220628s6e0d015ao33c30a9c61cb9f37@mail.gmail.com> 2008/7/22 Richard A. O'Keefe : > > As you see, using 'orelse' results in code that is CONSIDERABLY > LESS COMPACT than code using ';'. And it is not just less > compact, it executes more instructions. If compact speedy code > is something you want, then you would have to be off your rocker > to use 'orelse' in a guard. I won't reproduce the code here. The reason for this, which Richard touches on later in his message, is that for the 'orelse' code the compiler generates code to return 'true' when the tests succeed which is then checked at the end. This follows the semantics of 'orelse' but is not really necessary here. In the ';' case the compiler just generates a sequence of (inverted) tests which is in keeping how guards, guard sequences and the tests in them were originally defined. Note: this might not be true for all time. > *In a guard*, and when governing tests rather than some random > expressions, 'orelse' should be compiled exactly like ';' and > 'andalso' should be compiled exactly like ','. There is some difficulty here with handling exceptions in nested 'orelse'/'andalso' which could make this a little difficult. Depending on how you define nested ',' and ';' this may or may not be a problem. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvirding@REDACTED Tue Jul 22 15:39:34 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 22 Jul 2008 15:39:34 +0200 Subject: [erlang-questions] how: info on how to traverse abstract format trees? In-Reply-To: <183192.87774.qm@web38801.mail.mud.yahoo.com> References: <79854fe0-10a0-4cd6-990f-d9f7d38af651@27g2000hsf.googlegroups.com> <183192.87774.qm@web38801.mail.mud.yahoo.com> Message-ID: <3dbc6d1c0807220639o70be3ca2n13ce4fbeb6de7846@mail.gmail.com> 2008/7/3 Thomas Lindgren : > > --- On Tue, 6/24/08, Tim Fletcher wrote: > > > I'm just checking to see if there might be some > > recommended/documented > > way of doing such a traversal. Trying to work it out from > > parse > > transform code directly is a bit intimidating (which is why > > frabjous > > is very appealing). > > Personally, I've always tended to write my own, among other things because > the appropriate traversal differs depending on what you want to do. But the > erlang distribution itself includes a few hints: > > * erl_id_trans.erl contains a skeleton parse transform I agree. I have a modified version of erl_id_trans.erl which threads a (in this case dummy) state structure through all the calls as well as rebuilding the tree. It is a little easier to extend to be useful. It also uses some different styles when traversing the structure as examples of when you might need to handle them differently. For example passing over a list using mapfoldl (which fits this perfectly) when you know you can handle each element separately as opposed to processing the list explicitly when you need that. It is not really documented but you cam "see" it when you know what to look for. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Tue Jul 22 15:44:16 2008 From: toby@REDACTED (Toby Thain) Date: Tue, 22 Jul 2008 10:44:16 -0300 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <1216579942.5585.62.camel@piko.site> References: <4881F10E.9080601@lionet.info> <1216477872.4651.4.camel@piko.site> <671AB7E6-884A-4016-A0F0-112FD3B0DE6B@telegraphics.com.au> <1216579942.5585.62.camel@piko.site> Message-ID: On 20-Jul-08, at 3:52 PM, Alp?r J?ttner wrote: > On Sun, 2008-07-20 at 14:53 -0300, Toby Thain wrote: >> On 19-Jul-08, at 11:31 AM, Alp?r J?ttner wrote: >> >>> Btw. the Erlang Reference Manual says that >>> >>> As of Erlang 5.5/OTP R11B, short-circuit boolean >>> expressions are >>> allowed in guards. In guards, however, evaluation is always >>> short-circuited since guard tests are known to be free of >>> side >>> effects. >>> (Section 6.14, Short-Circuit Boolean Expressions) >>> >>> Something is wrong here, isn;t it? >> >> >> I also did a double take on this text, but my reading of "always >> short-circuited" is "it is always safe to short circuit [since...]", >> so a (normally) non-short-circuit operator can always be short- >> circuited. > > Do you mean that 'or' can always be replaced by 'orelse'? We've learnt > that it is not true. > >> (Compare, e.g. C's | and ||, where | may be used deliberately for >> side-effects on the RHS.) > > It is a different story. In C, '|' is the bitwise or operation, Yes I am aware. However, you may choose to use it in a logical context where you explicitly don't want short circuit OR (that was the point of my example). --Toby > it > corresponds to 'bor' in Erlang. ('||' in C is the same as 'orelse' and > there is no C equivalent for the 'or' operator of Erlang.) > > Regards, > Alpar > >> >> --Toby >> >>> >>> Regards, >>> Alpar >>> >>> On Sat, 2008-07-19 at 06:50 -0700, Lev Walkin wrote: >>>> Sean Allen wrote: >>>>> by a small bit of example code in Programming Erlang related to >>>>> guards >>>>> and short circuit booleans: >>>>> >>>>> f(X) when (X == 0) or (1/X > 2) -> >>>>> ... >>>>> >>>>> g(X) when (X == 0) orelse ( 1/X > 2) -> >>>>> ... >>>>> >>>>> The guard in f(X) fails when X is zero but succeeds in g(X) >>>>> >>>>> Can someone explain why? >>>> >>>> >>>> Sean, >>>> >>>> The thing is, "or" does not short-circuit evaluation when left side >>>> succeeds, whereas "orelse" does. Same short-circuit logic is >>>> behind the differences between "and" and "andalso". >>>> >>>> Actually, the very book you read explains these differences and >>>> warns >>>> about caveats a couple pages later (or earlier). Don't stop >>>> reading. >>>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From mihai@REDACTED Tue Jul 22 16:32:01 2008 From: mihai@REDACTED (Mihai Balea) Date: Tue, 22 Jul 2008 10:32:01 -0400 Subject: [erlang-questions] NY Erlang User's Group In-Reply-To: <9810b81b0807211151o2654e7f6o9f79736a132dfe03@mail.gmail.com> References: <9810b81b0807211151o2654e7f6o9f79736a132dfe03@mail.gmail.com> Message-ID: I'm in the NYC area (central NJ to be more specific) and I would be willing to join a beer/Erlang session :) Mihai On Jul 21, 2008, at 2:51 PM, Rick R wrote: > I noticed on this list that the closest Erlang User's Group to > Manhattan is in Chicago. > Now I'm quickly becoming a rabid Erlang exponent, but I still think > that that might be a tad far to travel for a meetup. > > Are there any Erlangers in the NYC area that would be keen to meet > up and exchange ideas? (either over a beer or in work-area > environment (or both)) > > Are there any members of the above set that would be interested in > doing this on a regular basis? If there are, I'm sure we could find > the space. > > > > -- > An idea that is not dangerous is unworthy of being called an idea at > all. -- Oscar Wilde > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From sol2ray@REDACTED Tue Jul 22 16:50:42 2008 From: sol2ray@REDACTED (Sol Toure) Date: Tue, 22 Jul 2008 10:50:42 -0400 Subject: [erlang-questions] NY Erlang User's Group In-Reply-To: References: <9810b81b0807211151o2654e7f6o9f79736a132dfe03@mail.gmail.com> Message-ID: <4a67dc390807220750g3a172789ra12f4227a14c40ed@mail.gmail.com> I'm in New York area (westchester) and I would like to join as well. 2008/7/22 Mihai Balea : > I'm in the NYC area (central NJ to be more specific) and I would be willing > to join a beer/Erlang session :) > Mihai > > On Jul 21, 2008, at 2:51 PM, Rick R wrote: > > I noticed on this list that the > closest Erlang User's Group to Manhattan is in Chicago. > Now I'm quickly becoming a rabid Erlang exponent, but I still think that > that might be a tad far to travel for a meetup. > > Are there any Erlangers in the NYC area that would be keen to meet up and > exchange ideas? (either over a beer or in work-area environment (or both)) > > Are there any members of the above set that would be interested in doing > this on a regular basis? If there are, I'm sure we could find the space. > > > > -- > An idea that is not dangerous is unworthy of being called an idea at all. > -- Oscar Wilde > _______________________________________________ > 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 Tue Jul 22 18:13:41 2008 From: hayeah@REDACTED (Howard Yeh) Date: Tue, 22 Jul 2008 09:13:41 -0700 Subject: [erlang-questions] what is mochiweb for? Message-ID: I've seen it mentioned and used in few places (couchdb), but I am confused what niche it's designed for, vs the inet library and yaws. Can somebody elaborate? Do I think of it as an http fronting gen_server? howard From wenewboy@REDACTED Tue Jul 22 18:36:19 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 23 Jul 2008 00:36:19 +0800 Subject: [erlang-questions] {"init terminating in do_boot", {'cannot load', error_handler, get_file}} Howto fix error_handle error? Message-ID: <4eaa09eb0807220936m1bd95100l189e88dd44805190@mail.gmail.com> FreeBSD 7.0: wenewlaptop# ./authbootdebug.sh {"init terminating in do_boot",{'cannot load',error_handler,get_file}} Crash dump was written to: erl_crash.dump init terminating in do_boot () %%context of the authbootdebug.sh,this shell works on ubuntu 8.04 wenewlaptop# cat authbootdebug.sh #!/bin/sh /usr/local/bin/erl6 -pa /home/erlang/authserver/ebin -name authservernode@REDACTED -setcookie abc -config authlog -boot authserver %%i google some infomation from internet,it's said that erlang installation abnormal, and i find the error_handle.beam on kernel directory, but i don't know howto fix it? any ideas? wenew zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin@REDACTED Tue Jul 22 18:42:09 2008 From: justin@REDACTED (Justin Sheehy) Date: Tue, 22 Jul 2008 12:42:09 -0400 Subject: [erlang-questions] what is mochiweb for? In-Reply-To: Message-ID: On 7/22/08 12:13 PM, "Howard Yeh" wrote: > I've seen it mentioned and used in few places (couchdb), but I am > confused what niche it's designed for, vs the inet library and yaws. You'd have to ask the mochi guys what it's designed for, but as a heavy user I can tell you some of what it's good for. I think of it as a programmable HTTP server layer. The inet library is a handy library, but not really a fully capable Web server. Yaws, on the other hand, is closer to Apache -- very capable, but with many of its own ideas about how to build your Web systems. Mochiweb does the heavy lifting on your outward-facing HTTP connections, leaving you to write your application-specific server logic. It provides useful abstractions over the request and response, and manages your client connections and other details of pushing data between your code and your clients. It doesn't do too much for you beyond that, which is actually a plus; this means that it's straightforward to extend as part of another system. If you want to stick with your original comparison, you might see it as a sweet spot or a local maximum in the spectrum between inets and yaws when it comes to building interesting Web applications. We've written an application (I am staying away from the term "framework" here) which uses mochiweb as the core HTTP engine but also automates the core logic of HTTP semantics that all Web apps should follow. It then provides obvious, extensible places to connect with application-specific code. We'll release that system -- "Webmachine" -- as open source when we get a bit of free time to package it up. -Justin From wenewboy@REDACTED Tue Jul 22 19:27:03 2008 From: wenewboy@REDACTED (wenew zhang) Date: Wed, 23 Jul 2008 01:27:03 +0800 Subject: [erlang-questions] {"init terminating in do_boot", {'cannot load', error_handler, get_file}} Howto fix error_handle error? Message-ID: <4eaa09eb0807221027q4c9375b0r6665fabf928963fb@mail.gmail.com> i figure out this problem that use systools:make_script() to generate new boot &script on FreeBSD, wenew zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From alain.odea@REDACTED Tue Jul 22 22:29:34 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Tue, 22 Jul 2008 17:59:34 -0230 Subject: [erlang-questions] what is mochiweb for? In-Reply-To: References: Message-ID: <291FF26D-354F-4557-8A30-F8BF814AFDF8@gmail.com> To make a Java analogy, mochiweb is like Java EE Servlets for Erlang. It provides a container/servlet programming model similar to Java EE, but with much less overhead. On 22-Jul-08, at 2:12 PM, Justin Sheehy wrote: > On 7/22/08 12:13 PM, "Howard Yeh" wrote: > >> I've seen it mentioned and used in few places (couchdb), but I am >> confused what niche it's designed for, vs the inet library and yaws. > > You'd have to ask the mochi guys what it's designed for, but as > a heavy user I can tell you some of what it's good for. > > I think of it as a programmable HTTP server layer. The inet library > is a handy library, but not really a fully capable Web server. > Yaws, on the other hand, is closer to Apache -- very capable, but > with many of its own ideas about how to build your Web systems. > > Mochiweb does the heavy lifting on your outward-facing HTTP > connections, leaving you to write your application-specific > server logic. It provides useful abstractions over the request > and response, and manages your client connections and other details > of pushing data between your code and your clients. It doesn't > do too much for you beyond that, which is actually a plus; > this means that it's straightforward to extend as part of another > system. If you want to stick with your original comparison, > you might see it as a sweet spot or a local maximum in the > spectrum between inets and yaws when it comes to building > interesting Web applications. > > We've written an application (I am staying away from the term > "framework" here) which uses mochiweb as the core HTTP engine > but also automates the core logic of HTTP semantics that all > Web apps should follow. It then provides obvious, extensible > places to connect with application-specific code. We'll release > that system -- "Webmachine" -- as open source when we get a > bit of free time to package it up. > > -Justin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jchris@REDACTED Wed Jul 23 01:29:43 2008 From: jchris@REDACTED (Chris Anderson) Date: Tue, 22 Jul 2008 19:29:43 -0400 Subject: [erlang-questions] fast JSON parser in C Message-ID: I'm considering wrapping one of the many fast JSON parsers written in C, using the Erlang FFI. I'm still just learning how the pieces fit together - got to hello world via this tutorial: http://www.wagerlabs.com/blog/2008/02/erlang-ffi---in.html The first hurdle I've found is that it might not be all the efficient to use C for a JSON parser, as the communication between Erlang and C function is limited to buffers. If communication is essentially limited to strings, I'll end up writing a parser in Erlang for whatever I concoct on the C side... so I may be better off working to speed up some of the existing pure Erlang JSON parser implementations. But perhaps I'm missing something. Is there a way to construct complex Erlang data structures (nested tuples and lists, with binary, atom, integer and float components) directly inside C, and then return the constructed object to Erlang where it can do things like participate in pattern matchers, etc? Thanks! Chris -- Chris Anderson http://jchris.mfdz.com From jlist@REDACTED Wed Jul 23 02:09:06 2008 From: jlist@REDACTED (Jonathan Gray) Date: Tue, 22 Jul 2008 17:09:06 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: Message-ID: <066301c8ec58$52ca0e70$f85e2b50$@com> Chris, I'm currently using something just as you are describing. I have erl_to_json() and json_to_erl() functions in C which convert ETERM -> JSON and JSON -> ETERM. Both are recursive C functions which make use of erl_eterm from erl_interface. The erl_interface library allows you to construct all the Erlang term types in C, marshall/encode them, and pass them off directly to Erlang. http://www.erlang.org/doc/apps/erl_interface/ref_man_erl_interface_frame.htm l Beware: I just posted to erlang-bugs an issue I'm having with this. It works just fine for smaller sizes, but we're having an issue crop up when we attempt to unmarshall/decode a large ETERM in C using erl_decode() from erl_interface. It is a reproducible "bug" as the problem only exists in C using erl_interface, Erlang has no issues with it at all. Hope that helps. Jonathan Gray Streamy Inc. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Chris Anderson Sent: Tuesday, July 22, 2008 4:30 PM To: Erlang Questions Subject: [erlang-questions] fast JSON parser in C I'm considering wrapping one of the many fast JSON parsers written in C, using the Erlang FFI. I'm still just learning how the pieces fit together - got to hello world via this tutorial: http://www.wagerlabs.com/blog/2008/02/erlang-ffi---in.html The first hurdle I've found is that it might not be all the efficient to use C for a JSON parser, as the communication between Erlang and C function is limited to buffers. If communication is essentially limited to strings, I'll end up writing a parser in Erlang for whatever I concoct on the C side... so I may be better off working to speed up some of the existing pure Erlang JSON parser implementations. But perhaps I'm missing something. Is there a way to construct complex Erlang data structures (nested tuples and lists, with binary, atom, integer and float components) directly inside C, and then return the constructed object to Erlang where it can do things like participate in pattern matchers, etc? Thanks! Chris -- Chris Anderson http://jchris.mfdz.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Wed Jul 23 02:10:40 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 23 Jul 2008 02:10:40 +0200 Subject: [erlang-questions] Scalable Computer Programming languages Message-ID: <3dbc6d1c0807221710x5f57d919jd0d8da4424e7db0b@mail.gmail.com> I usually don't send out links but I found this one in http://news.ycombinator.com which I really like: http://www.cs.caltech.edu/~mvanier/hacking/rants/scalable_computer_programming_languages.html Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Jul 23 03:17:58 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 23 Jul 2008 13:17:58 +1200 Subject: [erlang-questions] Reading, Learning, Confused In-Reply-To: <581048.64878.qm@web38804.mail.mud.yahoo.com> References: <581048.64878.qm@web38804.mail.mud.yahoo.com> Message-ID: On 22 Jul 2008, at 9:56 pm, Thomas Lindgren wrote: > > Here are the two broad classes of guard macros I have seen: > > One case is when you want to hide representation. > > -define(is_equipment_foo(X), (record(X, eqm1) orelse record(X, > eqm2)). This is a perfect application for abstract patterns. *Sigh*. > > > Another is when you refactor or name a commonly occurring test. > Something like: > > -define(is_non_empty_list(X), (is_list(X) andalso X =/= [])). > -define(is_byte(X), (X >= 0 andalso X =< 255)). Again, these things could be done beautifully by abstract patterns. For example, #byte(X) when is_integer(X), X >= 0, X =< 255 -> X. In the mean time, there is nothing wrong with -define(is_byte(X), is_integer(X), X >= 0, X =< 255 ). for use in guards. (See my previous message for an example showing that the current compiler isn't terribly good with 'orelse' in guards. This also applies to 'andalso'. Look at the code using 'S' yourself if you don't believe me.) [Abstract patterns would have to be inlined when known to the compiler, of course.] Using 'andalso' means that ?is_byte(E) can be used in an expression, but alas, the macro does double evaluation, so for general expressions E you should not use it. I have just written up a new EEP about a type/range test is_between(Term, Lower_Bound, Upper_Bound). > For concreteness, here are three guard macros from xmerl.hrl (R12B3): > > %% whitespace consists of 'space', 'carriage return', 'line feed' or > 'tab' > -define(whitespace(H), H==?space ; H==?cr ; H==?lf ; H==?tab). Oddly enough, I already have an EEP (the one on enumerations) that would handle that with a single guard test. > > > %% non-caharacters according to Unicode: 16#ffff and 16#fffe > -define(non_character(H1,H2), > H1==16#ff,H2==16#fe;H1==16#ff,H2==16#ff). Again, the enumerations EEP would handle that: -enum(illegal_unicode, {fffe=16#fffe, ffff=16#ffff}). ... is_enum_integer(H1*256+H2, illegal_unicode) ... and so would the is_between/3 EEP: ... is_between(H1*256+H2, 16#fffe, 16#ffff). > > -define(non_ascii(H), list(H),hd(H)>=128;integer(H),H>=128). This one makes me slightly queasy; I feel that integers and strings really ought not to be mushed together like that. > > > I would guess these macros were written before the new guard > operators, since they can only be used in specific contexts and > would be more useful with andalso/orelse. But, mutatis mutandis, I > think they are reasonable examples of what is done. Thank you, they provide clear evidence that we COULD do better. With hindsight, the need for is_between/3 was always there, we just hadn't noticed. > > >>> 2. I seem to recall that ';' is implemented by >> duplicating the >>> clauses, while andalso/orelse is not. If so, >> andalso/orelse _may_ >>> yield somewhat more compact code. >> >> Ah, the old "I seem to recall" trick. > > "Trick"? You got me, Richard. I always argue in bad faith. Sorry, too much "Get Smart" lately. "The old .... trick" never refers to bad faith, but to a bad idea (like relying on recollection instead of what the compiler does). Before I did the check, I was sure the compiler did the sensible thing; imagine my surprise that it didn't! From jchris@REDACTED Wed Jul 23 07:18:42 2008 From: jchris@REDACTED (Chris Anderson) Date: Wed, 23 Jul 2008 01:18:42 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <066301c8ec58$52ca0e70$f85e2b50$@com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> Message-ID: On Tue, Jul 22, 2008 at 8:09 PM, Jonathan Gray wrote: > Chris, > > I'm currently using something just as you are describing. I have > erl_to_json() and json_to_erl() functions in C which convert ETERM -> JSON > and JSON -> ETERM. Both are recursive C functions which make use of > erl_eterm from erl_interface. Awesome to hear that you are building this already. Are you interested in open sourcing it? My goal is to build a faster JSON parser for CouchDB. I don't mind doing the work, but if you already have something happening, why duplicate work? Thanks for the technical feedback. I'll definitely take a look at the marshaling stuff, but I'd rather look at your json stuff. :) Chris -- Chris Anderson http://jchris.mfdz.com From Tsoael_M@REDACTED Wed Jul 23 09:42:37 2008 From: Tsoael_M@REDACTED (Ishmael Tsoaela [ MTN - Innovation Centre ]) Date: Wed, 23 Jul 2008 09:42:37 +0200 Subject: [erlang-questions] Records in file Message-ID: <8D9281157F5F2A46A91CE09FE16F512403DA8E28@MTNMAIL1.mtn.co.za> I have records in a file and I want. I want to read the file for a certain field and set a counter to monitor the occurrence of that field, is that possible or Not. #urec{date,type}. I wan to monitor the occurrence of type. NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tchamila@REDACTED Wed Jul 23 11:48:49 2008 From: tchamila@REDACTED (chamila piyasena) Date: Wed, 23 Jul 2008 15:18:49 +0530 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <487B60C5.4030800@erix.ericsson.se> References: <487B60C5.4030800@erix.ericsson.se> Message-ID: <552d666a0807230248p752bb7bdo5e60d40070e27895@mail.gmail.com> Hi, When we receive a http response what is the format of the body of the responce(i.e : the html content)? Is it like , {ok, http_response, { body, ...........}} Cheers, Chamila On Mon, Jul 14, 2008 at 7:50 PM, Sverker Eriksson wrote: > A message from the OTP team: > > There is an undocumented socket packet mode that provides HTTP parsing. > We are planning to make this packet mode official and possibly also > change the format of the tuples returned in this mode. One current big > user is the web server Yaws. We would like to know of other applications > using this HTTP mode and what kind of impact such an incompatible change > would have. > > A socket using {packet, http} returns tuples like this in *passive* mode: > > {ok, {http_request, ...}} > {ok, {http_response, ...}} > {ok, {http_header, ...}} > > > and tuples like this in *active* mode: > > {http_request, Socket, ...} > {http_response, Socket, ...} > {http_header, Socket, ...} > > > The proposed change would only affect the active mode like this: > > {http, Socket, {http_request, ...}} > {http, Socket, {http_response, ...}} > {http, Socket, {http_header, ...}} > > > The purpose is to make the inner tuples look the same regardless of how > they were received. This would simplify both the implementation and the > documentation as well as any applications using both receive modes. > Applications only using http in passive mode (like Yaws) will not be > affected. > > Am I stirring up any worried http-users out there? > > /Sverker, Erlang/OTP Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- http://chamilar.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Jul 23 13:35:43 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 23 Jul 2008 13:35:43 +0200 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <552d666a0807230248p752bb7bdo5e60d40070e27895@mail.gmail.com> References: <487B60C5.4030800@erix.ericsson.se> <552d666a0807230248p752bb7bdo5e60d40070e27895@mail.gmail.com> Message-ID: 2008/7/23 chamila piyasena : > Hi, > When we receive a http response what is the format of the body of the > responce(i.e : the html content)? > Is it like , > {ok, http_response, { body, ...........}} You change into plain mode after the end of headers arrive. It is a little bit annoying that no chunked-mode body exists. Implementable in erlang though. From circularfunc@REDACTED Wed Jul 23 13:08:59 2008 From: circularfunc@REDACTED (Circular Function) Date: Wed, 23 Jul 2008 11:08:59 +0000 (GMT) Subject: [erlang-questions] Can I do var-assignment in a function? Message-ID: <822412.36397.qm@web28315.mail.ukl.yahoo.com> extract(Str) -> ??? A = string:tokens(Str," "). ??? lists:sort(A). I could of course do this: lists:sort(string:tokens(Str," ")). But lets say I want a bigger function that slo includes some deeper function calls, lets say 4-5 calls deep. That's the main thing I dislike about functional programming, it is very expressive but sometimes it is hard afterwards to follow what a function does and it is hard hwen you have to read what is happening from right to the left. It is easier to reason about when I can split into several calls. I guess it is doable but I can't figure out the syntax. __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From circularfunc@REDACTED Wed Jul 23 13:29:16 2008 From: circularfunc@REDACTED (Circular Function) Date: Wed, 23 Jul 2008 11:29:16 +0000 (GMT) Subject: [erlang-questions] why module:function? Message-ID: <640494.392.qm@web28314.mail.ukl.yahoo.com> a lot of often-used functions like sort and map I have to write module:func to access, why aren't they a part of the shell-functions? or maybe they arent that often used and listcomprehensions are the idiomatic way instead of map? __________________________________________________________ G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. S?k och j?mf?r priser hos Kelkoo. http://www.kelkoo.se/c-100015813-bredband.html?partnerId=96914325 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlm@REDACTED Wed Jul 23 14:03:13 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 23 Jul 2008 05:03:13 -0700 Subject: [erlang-questions] Can I do var-assignment in a function? In-Reply-To: <822412.36397.qm@web28315.mail.ukl.yahoo.com> References: <822412.36397.qm@web28315.mail.ukl.yahoo.com> Message-ID: <48871E01.5040906@lionet.info> Circular Function wrote: > extract(Str) -> > A = string:tokens(Str," "). > lists:sort(A). > > I could of course do this: > lists:sort(string:tokens(Str," ")). > > But lets say I want a bigger function that slo includes some deeper > function calls, lets say 4-5 > calls deep. > > That's the main thing I dislike about functional programming, it is very > expressive but sometimes it is hard afterwards to follow what a function > does and it is hard hwen you have to read what is happening from right > to the left. > It is easier to reason about when I can split into several calls. > > I guess it is doable but I can't figure out the syntax. Use comma. extract(Str) -> A = string:tokens(Str," "), lists:sort(A). That's it. -- vlm From chlorophil@REDACTED Wed Jul 23 14:04:32 2008 From: chlorophil@REDACTED (Philip Robinson) Date: Wed, 23 Jul 2008 22:04:32 +1000 Subject: [erlang-questions] Can I do var-assignment in a function? In-Reply-To: <822412.36397.qm@web28315.mail.ukl.yahoo.com> References: <822412.36397.qm@web28315.mail.ukl.yahoo.com> Message-ID: You are almost there: you need to replace the period on the second line with a comma. extract(Str) -> A = string:tokens(Str, " "), lists:sort(A). Generally speaking, sequential statements in a block are separated by commas; blocks are separated by semi-colons; and functions are terminated by a period. Watch out for guards, though - commas and semi-colons are used differently there. Cheers, Philip 2008/7/23 Circular Function : > extract(Str) -> > A = string:tokens(Str," "). > lists:sort(A). > > I could of course do this: > lists:sort(string:tokens(Str," ")). > > But lets say I want a bigger function that slo includes some deeper function > calls, lets say 4-5 > calls deep. > > That's the main thing I dislike about functional programming, it is very > expressive but sometimes it is hard afterwards to follow what a function > does and it is hard hwen you have to read what is happening from right to > the left. > It is easier to reason about when I can split into several calls. > > I guess it is doable but I can't figure out the syntax. > > ________________________________ > S?k efter k?rleken! > Hitta din tvillingsj?l p? Yahoo! Dejting: http://se.meetic.yahoo.net > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tchamila@REDACTED Wed Jul 23 14:10:04 2008 From: tchamila@REDACTED (chamila piyasena) Date: Wed, 23 Jul 2008 17:40:04 +0530 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: References: <487B60C5.4030800@erix.ericsson.se> <552d666a0807230248p752bb7bdo5e60d40070e27895@mail.gmail.com> Message-ID: <552d666a0807230510o39230a36ufc3d2996cb9fcaee@mail.gmail.com> On Wed, Jul 23, 2008 at 5:05 PM, Christian S wrote: > 2008/7/23 chamila piyasena : > > Hi, > > When we receive a http response what is the format of the body of the > > responce(i.e : the html content)? > > Is it like , > > {ok, http_response, { body, ...........}} > > You change into plain mode after the end of headers arrive. > > It is a little bit annoying that no chunked-mode body exists. > Implementable in erlang though. > Thank you for your reply Christian, You mean It automatically swiches in? If we originally set [binary, {packet, http}] then after end of header to what form it will be swiches to. for an example {packet, 0} and are we getting the rest as {tcp, Socket, Bin} Cheers, Chamila http://chamilar.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Wed Jul 23 14:44:19 2008 From: devdoer2@REDACTED (devdoer bird) Date: Wed, 23 Jul 2008 20:44:19 +0800 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? Message-ID: HI: I want to extend mnesia 's lock to add this function "mnesia:lock(LockItem,LockType,ConditionFun)" . This function works in this way: If a table 's record passes the ConditionFun test,the the record is locked. Eg. I have a user table with the record: -record(user,{name,age}). I want to lock the user's whose name begines with 'a' ,I can code using my customized " mnesia:lock(LockItem,LockType,ConditionFun)" like this: ConditionFun=fun(U)-> if U#user.name=='a' -> true; true->false end end mnesia:lock(user,write,ConditionFun). that is I want to lock part of the table. Have anyone done this before? How shall I extend the mensia lock? Any information will be helpful, I 'm quite unfamiliar with mnesia lock system. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Jul 23 15:14:54 2008 From: chsu79@REDACTED (Christian S) Date: Wed, 23 Jul 2008 15:14:54 +0200 Subject: [erlang-questions] Are you using {packet, http} ? In-Reply-To: <552d666a0807230510o39230a36ufc3d2996cb9fcaee@mail.gmail.com> References: <487B60C5.4030800@erix.ericsson.se> <552d666a0807230248p752bb7bdo5e60d40070e27895@mail.gmail.com> <552d666a0807230510o39230a36ufc3d2996cb9fcaee@mail.gmail.com> Message-ID: >> >> You change into plain mode after the end of headers arrive. >> >> It is a little bit annoying that no chunked-mode body exists. >> Implementable in erlang though. > > > > Thank you for your reply Christian, > You mean It automatically swiches in? If we originally set [binary, {packet, > http}] then after end of header to what form it will be swiches to. > for an example {packet, 0} > and are we getting the rest as {tcp, Socket, Bin} No, you do inet:setopts(Sock, [{packet, raw}]), when you get http_eoh Find some code that uses this and read it. Suggested example: http://www.tornkvist.org/gitweb?p=iserve.git;a=blob;f=src/iserve_socket.erl;h=6b0c0f5c37f75b7a8236029f23d8cac78f1e2b42;hb=HEAD Notice how it only sports an unencoded body (a size specified in a content length header) and chunked encoding POSTing would make it cry. From silvester.roessner@REDACTED Wed Jul 23 15:29:39 2008 From: silvester.roessner@REDACTED (Roessner, Silvester) Date: Wed, 23 Jul 2008 15:29:39 +0200 Subject: [erlang-questions] Can I do var-assignment in a function? In-Reply-To: <48871E01.5040906@lionet.info> References: <822412.36397.qm@web28315.mail.ukl.yahoo.com> <48871E01.5040906@lionet.info> Message-ID: <2CEB6DA5040AED4F946351C85FAC87B501EE2DA7@DEJENSAPP01V1.vision.zeiss.org> Circular Function wrote: > extract(Str) -> > A = string:tokens(Str," "). > lists:sort(A). I think the comma was just a typo and not the actual question. Am I right? You want var-assignment because you want to write something like: extract(Str) -> A = string:tokens(Str," "), A = lists:sort(A), A = do_something_else(A), A = and_finalize(A). But that doesn't work. You have to use a new variable each time. extract(Str) -> A1 = string:tokens(Str," "), A2 = lists:sort(A1), A3 = do_something_else(A2), A4 = and_finalize(A3). Or this hard to read version extract(Str) -> A = and_finalize(do_something_else(lists:sort(string:tokens(Str," ")))). This approach of functional languages has at least two big advantages: 1. You don't accidentally overwrite variables 2. You can see all results in the debugger. And there should be no runtime penalty. Since the processor had to allocate and de-allocate the same amount of memory in each of the 3 cases -even if you don't see this in the code. mit freundlichen Gr??en / with kind regards Silvester R??ner 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. From erlang@REDACTED Wed Jul 23 16:18:53 2008 From: erlang@REDACTED (Dominic Williams) Date: Wed, 23 Jul 2008 10:18:53 -0400 (EDT) Subject: [erlang-questions] clarify: CORBA/IIOP version supported by Orber Message-ID: <5922261e1993f5be5a9718410a5c0e23.squirrel@www.geekisp.com> Hello, I'm sorry if I've missed it (I looked documentation, FAQ, list archives), but I would like to know what is the CORBA/IIOP version supported by Orber. The only reference to this I found was in: http://www.erlang.org/white_paper.html which says 2.0, which seems a bit old. Thanks, Dominic Williams http://dominicwilliams.net From kevin@REDACTED Wed Jul 23 17:31:31 2008 From: kevin@REDACTED (Kevin Scaldeferri) Date: Wed, 23 Jul 2008 08:31:31 -0700 Subject: [erlang-questions] why module:function? In-Reply-To: <640494.392.qm@web28314.mail.ukl.yahoo.com> References: <640494.392.qm@web28314.mail.ukl.yahoo.com> Message-ID: <45BDFEE6-F6CB-4AC5-B935-F1DF06F4FFD6@scaldeferri.com> On Jul 23, 2008, at 4:29 AM, Circular Function wrote: > a lot of often-used functions like sort and map I have to write > module:func to access, why aren't they a part of the shell-functions? -import(lists, [map/2, ...]). -k From jlist@REDACTED Wed Jul 23 17:31:57 2008 From: jlist@REDACTED (Jonathan Gray) Date: Wed, 23 Jul 2008 08:31:57 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <066301c8ec58$52ca0e70$f85e2b50$@com> Message-ID: <06e701c8ecd9$3e481970$bad84c50$@com> Chris, Considering your primary goal is speed, you definitely don't want to use my implementation. I use an intermediate translation into a custom typed JSON tree. It's a poor approach when you need it to be as fast as possible. It's done this way for simplicity reasons as the JSON -> tree (and vice versa) already existed when we wanted to then go to Erlang/ETERM. If a direct parser existed I'd certainly use it. I'm still exploring the issues with segfaulting during decoding. It's been suggested to me to use ei rather than erl_interface, but it's quite a bit more involved. An ideal JSON -> Erl parser would certainly be using ei directly, so I'd dig around there for how you can build/decode Erlang from within C. http://www.erlang.org/doc/man/ei.html Jonathan -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Chris Anderson Sent: Tuesday, July 22, 2008 10:19 PM To: Jonathan Gray Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] fast JSON parser in C On Tue, Jul 22, 2008 at 8:09 PM, Jonathan Gray wrote: > Chris, > > I'm currently using something just as you are describing. I have > erl_to_json() and json_to_erl() functions in C which convert ETERM -> JSON > and JSON -> ETERM. Both are recursive C functions which make use of > erl_eterm from erl_interface. Awesome to hear that you are building this already. Are you interested in open sourcing it? My goal is to build a faster JSON parser for CouchDB. I don't mind doing the work, but if you already have something happening, why duplicate work? Thanks for the technical feedback. I'll definitely take a look at the marshaling stuff, but I'd rather look at your json stuff. :) Chris -- Chris Anderson http://jchris.mfdz.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From circularfunc@REDACTED Wed Jul 23 18:24:59 2008 From: circularfunc@REDACTED (Circular Function) Date: Wed, 23 Jul 2008 16:24:59 +0000 (GMT) Subject: [erlang-questions] Mapping over 2+ lists/variables? Message-ID: <745479.31160.qm@web28308.mail.ukl.yahoo.com> in python I can do: >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) [5, 7, 9] >>> 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). ** exception error: undefined function lists:map/3 39> isnt there general map-function that map is derived from that I can use? what about listcomprehensions? 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. * 1: variable 'X' is unbound 45> __________________________________________________________ L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Jul 23 18:56:04 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 23 Jul 2008 18:56:04 +0200 Subject: [erlang-questions] Can I do var-assignment in a function? In-Reply-To: <2CEB6DA5040AED4F946351C85FAC87B501EE2DA7@DEJENSAPP01V1.vision.zeiss.org> References: <822412.36397.qm@web28315.mail.ukl.yahoo.com> <48871E01.5040906@lionet.info> <2CEB6DA5040AED4F946351C85FAC87B501EE2DA7@DEJENSAPP01V1.vision.zeiss.org> Message-ID: <9b08084c0807230956n592b198fy5d0a4720cfa3650d@mail.gmail.com> On Wed, Jul 23, 2008 at 3:29 PM, Roessner, Silvester wrote: > Circular Function wrote: >> extract(Str) -> >> A = string:tokens(Str," "). >> lists:sort(A). > > I think the comma was just a typo and not the actual question. Am I right? > > You want var-assignment because you want to write something like: > > extract(Str) -> > A = string:tokens(Str," "), > A = lists:sort(A), > A = do_something_else(A), > A = and_finalize(A). extract(Str) -> Toks = string:tokens(Str, ""), SortedToks1 = lists:sort(Toks), ... :-) /J > > But that doesn't work. You have to use a new variable each time. > > extract(Str) -> > A1 = string:tokens(Str," "), > A2 = lists:sort(A1), > A3 = do_something_else(A2), > A4 = and_finalize(A3). > > Or this hard to read version > > extract(Str) -> > A = and_finalize(do_something_else(lists:sort(string:tokens(Str," ")))). > > This approach of functional languages has at least two big advantages: > > 1. You don't accidentally overwrite variables > 2. You can see all results in the debugger. > > And there should be no runtime penalty. Since the processor had to allocate and de-allocate the same amount of memory in each of the 3 cases -even if you don't see this in the code. > > mit freundlichen Gr??en / with kind regards > > Silvester R??ner > 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 > From vlm@REDACTED Wed Jul 23 19:14:12 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 23 Jul 2008 10:14:12 -0700 Subject: [erlang-questions] Mapping over 2+ lists/variables? In-Reply-To: <745479.31160.qm@web28308.mail.ukl.yahoo.com> References: <745479.31160.qm@web28308.mail.ukl.yahoo.com> Message-ID: <488766E4.6020508@lionet.info> Circular Function wrote: > > in python I can do: > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) > [5, 7, 9] > >>> > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > ** exception error: undefined function lists:map/3 > 39> Try opening a manual page for lists module erl -man lists and look for zip, zipwith, zipwith3 > isnt there general map-function that map is derived from that I can use? > what about listcomprehensions? > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > * 1: variable 'X' is unbound > 45> [X + Y || X <- lists:seq(1,10), Y <- lists:seq(1,10)]. -- vlm From jchris@REDACTED Wed Jul 23 19:19:39 2008 From: jchris@REDACTED (Chris Anderson) Date: Wed, 23 Jul 2008 13:19:39 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <06e701c8ecd9$3e481970$bad84c50$@com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> Message-ID: On Wed, Jul 23, 2008 at 11:31 AM, Jonathan Gray wrote: > Chris, > > Considering your primary goal is speed, you definitely don't want to use my > implementation. Thanks then for the info. My plan was to use http://www.lloydforge.org/projects/yajl/ as a fast JSON parser, and somehow get the results to Erlang. It looks like it may be more challenging than I'd thought. Out of curiosity, at roughly what size of input do you start to see the segfaults? I'll probably start with the ei interface if that is safer, but it will be nice to know how hard I have to push it to know that I've done the job safely. -- Chris Anderson http://jchris.mfdz.com From sylrouss@REDACTED Wed Jul 23 19:20:49 2008 From: sylrouss@REDACTED (Sylvain Rousseau) Date: Wed, 23 Jul 2008 19:20:49 +0200 Subject: [erlang-questions] Mapping over 2+ lists/variables? In-Reply-To: <745479.31160.qm@web28308.mail.ukl.yahoo.com> References: <745479.31160.qm@web28308.mail.ukl.yahoo.com> Message-ID: <9cde16a30807231020r3bc3faacvcb73ec5a3a059601@mail.gmail.com> Hi, You can do : 1> lists:zipwith(fun(X,Y) -> X+Y end, [1,2,3], [4,5,6]). [5, 7, 9] Does it help ? Regards, -- Sylvain 2008/7/23 Circular Function : > in python I can do: > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) > [5, 7, 9] > >>> > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > ** exception error: undefined function lists:map/3 > 39> > > isnt there general map-function that map is derived from that I can use? > what about listcomprehensions? > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > * 1: variable 'X' is unbound > 45> > > ------------------------------ > G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. > S?k och j?mf?r priser hos Kelkoo. > _______________________________________________ > 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-questions_efine@REDACTED Wed Jul 23 19:25:35 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Wed, 23 Jul 2008 13:25:35 -0400 Subject: [erlang-questions] Mapping over 2+ lists/variables? In-Reply-To: <745479.31160.qm@web28308.mail.ukl.yahoo.com> References: <745479.31160.qm@web28308.mail.ukl.yahoo.com> Message-ID: <6c2563b20807231025t5d5a336ch66719d0939993fc7@mail.gmail.com> 2> [X + Y || {X, Y} <- lists:zip([1,2,3], [4,5,6])]. [5,7,9] 2008/7/23 Circular Function : > in python I can do: > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) > [5, 7, 9] > >>> > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > ** exception error: undefined function lists:map/3 > 39> > > isnt there general map-function that map is derived from that I can use? > what about listcomprehensions? > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > * 1: variable 'X' is unbound > 45> > > ------------------------------ > G?r det l?ngsamt? Skaffa dig en snabbare bredbandsuppkoppling. > S?k och j?mf?r priser hos Kelkoo. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Wed Jul 23 19:27:33 2008 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 23 Jul 2008 19:27:33 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18565.43649.880641.925438@harpo.it.uu.se> References: <18529.883.586609.71953@hamberg.it.uu.se> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <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> Message-ID: <8209f740807231027t385f22afwe10786451c0c6204@mail.gmail.com> 2008/7/22 Sven-Olof Nystr|m : > Ulf Wiger writes: > > > > A good place to start might be the POTS control program, which was > > presented in the Erlang book, and also used (in a slightly different form) > > in the Introductory Erlang course. > > > > I used it in my "Structured Network Programming" presentation to > > show the consequences of different programming styles in multiway > > signaling: > > > > http://www.erlang.se/euc/05/1500Wiger.ppt > > > > I'm not convinced that it will be sufficient to reveal significant differences > > between the standard erlang style and channels, but it's a good place to > > start, and the code can be expanded in a number of interesting ways. > > > > BR, > > Ulf W > > > > (There's a working simulator to go with the program, but the OTP team > > would have to give permission to release it in public. I'm sure you can > > get your hands on it anyway.) > > > Sorry about disappearing from the discussion for so long. > > I took a look at the POTS program in the Erlang book. It is actually > easy to rewrite it to use neither channels nor selective receive. > > I also looked at the gen-server module. > > Detailed comments follow. (A non-selective receive is one that always > pick the first message in the mailbox.) > > Sven-Olof > > > > The book's implementation of POTS only contains four receive > expressions. Among these, only one (in the function make_call_to_B/3) > is selective. You should also take a look at the presentation that I referred to. 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. The OHaskell example assumed that functions like start_tone() were atomic and non-blocking - they are not. 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. 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. BR, Ulf W From richardc@REDACTED Wed Jul 23 18:28:46 2008 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 23 Jul 2008 18:28:46 +0200 Subject: [erlang-questions] Mapping over 2+ lists/variables? In-Reply-To: <745479.31160.qm@web28308.mail.ukl.yahoo.com> References: <745479.31160.qm@web28308.mail.ukl.yahoo.com> Message-ID: <48875C3E.7050903@it.uu.se> Circular Function wrote: > in python I can do: > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) > [5, 7, 9] > >>> > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > ** exception error: undefined function lists:map/3 > 39> > > isnt there general map-function that map is derived from that I can use? > what about listcomprehensions? > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > * 1: variable 'X' is unbound > 45> Erlang's list comprehensions can't do that. The function you want is lists:zipwith(Fun,List1,List2). You could also do lists:zip(List1,List2) and then run map on the result, but zipwith does it in one pass. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From jlist@REDACTED Wed Jul 23 19:49:04 2008 From: jlist@REDACTED (Jonathan Gray) Date: Wed, 23 Jul 2008 10:49:04 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> Message-ID: <071301c8ecec$6677bfa0$33673ee0$@com> That's the interesting thing. I've successfully encoded and decoded >1.5MB binary chunks of erlang terms when I manually create them using erl_interface. However when I get a big chunk (around 80-120K) directly from Erlang as binary (using term_to_binary in erlang), I'm unable to decode it using erl_interface erl_decode, though it can be decoded fine from within Erlang. I haven't received any responses as to a fix and was redirected towards using ei instead of (seemingly deprecated but not documented as deprecated) erl_interface. I'm going to do some testing with ei and will let you know if the problem goes away. Also, I'll take a look at Yajl now. Thanks. JG -----Original Message----- From: jchris@REDACTED [mailto:jchris@REDACTED] On Behalf Of Chris Anderson Sent: Wednesday, July 23, 2008 10:20 AM To: Jonathan Gray Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] fast JSON parser in C On Wed, Jul 23, 2008 at 11:31 AM, Jonathan Gray wrote: > Chris, > > Considering your primary goal is speed, you definitely don't want to use my > implementation. Thanks then for the info. My plan was to use http://www.lloydforge.org/projects/yajl/ as a fast JSON parser, and somehow get the results to Erlang. It looks like it may be more challenging than I'd thought. Out of curiosity, at roughly what size of input do you start to see the segfaults? I'll probably start with the ei interface if that is safer, but it will be nice to know how hard I have to push it to know that I've done the job safely. -- Chris Anderson http://jchris.mfdz.com From circularfunc@REDACTED Wed Jul 23 20:51:03 2008 From: circularfunc@REDACTED (Circular Function) Date: Wed, 23 Jul 2008 18:51:03 +0000 (GMT) Subject: [erlang-questions] tail of string = 104, bit? Message-ID: <379032.6803.qm@web28313.mail.ukl.yahoo.com> when i do tl("hej") I get 104, well I need "h". How do I get h amd if not possible how do i convert 104 to string?? or how do i convert string to the other format? is it a bit? __________________________________________________________ L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlm@REDACTED Wed Jul 23 21:32:43 2008 From: vlm@REDACTED (Lev Walkin) Date: Wed, 23 Jul 2008 12:32:43 -0700 Subject: [erlang-questions] tail of string = 104, bit? In-Reply-To: <379032.6803.qm@web28313.mail.ukl.yahoo.com> References: <379032.6803.qm@web28313.mail.ukl.yahoo.com> Message-ID: <4887875B.4040209@lionet.info> Circular Function wrote: > when i do tl("hej") I get 104, well I need "h". 104 is a code for 'h'. Try this way [tl("hej")]. You'll get a list of one element, which is an "h" letter. > How do I get h amd if not possible how do i convert 104 to string? or > how do i convert string to the other format? is it a bit? Also, could you please stop using this erlang-question list as a substitute for an introductory Erlang reading. -- vlm From dking@REDACTED Wed Jul 23 21:32:46 2008 From: dking@REDACTED (David King) Date: Wed, 23 Jul 2008 12:32:46 -0700 Subject: [erlang-questions] tail of string = 104, bit? In-Reply-To: <379032.6803.qm@web28313.mail.ukl.yahoo.com> References: <379032.6803.qm@web28313.mail.ukl.yahoo.com> Message-ID: <221C8D5D-0B1D-4A68-A8A8-99EAB7392304@ketralnis.com> > when i do tl("hej") I get 104, well I need "h". > How do I get h amd if not possible how do i convert 104 to string? > or how do i convert string to the other format? is it a bit? A string is a list of integers. [104] =:= "h" From josv@REDACTED Wed Jul 23 21:42:30 2008 From: josv@REDACTED (Jos Visser) Date: Wed, 23 Jul 2008 21:42:30 +0200 Subject: [erlang-questions] tail of string = 104, bit? In-Reply-To: <379032.6803.qm@web28313.mail.ukl.yahoo.com> References: <379032.6803.qm@web28313.mail.ukl.yahoo.com> Message-ID: <20080723194230.GN5136@Deep-Space-X.local> I guess you mean hd("hej") returning 103. tl("hej") returns "ej". In Erlang a string is a list of integers. To make a string from an integer, just make a list out of it: f(S) -> [hd(S)]. ++Jos.ch On Wed, Jul 23, 2008 at 06:51:03PM +0000 it came to pass that Circular Function wrote: > when i do tl("hej") I get 104, well I need "h". > How do I get h amd if not possible how do i convert 104 to string?? or how do i convert string to the other format? is it a bit? > > > > __________________________________________________________ > L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. > http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014 > _______________________________________________ > 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... From jchris@REDACTED Wed Jul 23 21:45:37 2008 From: jchris@REDACTED (Chris Anderson) Date: Wed, 23 Jul 2008 15:45:37 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <071301c8ecec$6677bfa0$33673ee0$@com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> Message-ID: On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray wrote: > However when I get a big chunk (around 80-120K) directly from Erlang as > binary (using term_to_binary in erlang), I'm unable to decode it using > erl_interface erl_decode, though it can be decoded fine from within Erlang. Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not need help from C. I'm just working on making the JSON -> Erlang fast enough, so as long as I can get string buffers over to C in the first place, it sounds like you're not having a problem moving data from C back to Erlang. Time to buckle down and code! -- Chris Anderson http://jchris.mfdz.com From erlang@REDACTED Wed Jul 23 23:07:59 2008 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 23 Jul 2008 23:07:59 +0200 Subject: [erlang-questions] scalaris code posted Message-ID: <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@mail.gmail.com> 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 From ok@REDACTED Thu Jul 24 03:33:23 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 24 Jul 2008 13:33:23 +1200 Subject: [erlang-questions] Mapping over 2+ lists/variables? In-Reply-To: <745479.31160.qm@web28308.mail.ukl.yahoo.com> References: <745479.31160.qm@web28308.mail.ukl.yahoo.com> Message-ID: On 24 Jul 2008, at 4:24 am, Circular Function wrote: > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > ** exception error: undefined function lists:map/3 > 39> So write your own: map(F, [A|As], [B|Bs]) -> [F(A,B) | map(F, As, Bs)]; map(_, [], [] ) -> []. I mean, it's less typing to FIX the problem than to complain about it! > isnt there general map-function that map is derived from that I can > use? No. The code for map is just map(F, [A|As]) -> [F(A) | map(F, As)]; map(_, [] ) -> []. Erlang is open source, and if you have it, you also have all the source code, including /lib/stdlib/src/lists.erl, so you can easily see for yourself how this and other functions work. > > what about listcomprehensions? > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > * 1: variable 'X' is unbound Indeed it is. Like Haskell (yah boo chiz) Erlang list comprehensions do not permit "parallel" iteration, only "nested" iteration. This is one of the things I like about Clean. Hmm. List comprehension uses '||', I've just thought of a use for '&&'... The Haskell approach would be [x + y | (x,y) <- zip [1..10] [1..10]] or better still, zipWith (+) [1..10] [1..10] The Erlang equivalent of using zip here is, well, using zip: [X + Y | {X,Y} <- lists:zip(lists:seq(1,10), lists:seq(1,10))] Personally I loathe this. Some Haskell compilers (notably GHC and I think YHC) are smart enough to do 'deforestation' and NOT really build a list of pairs. The Erlang compiler is not. (For one thing, 'zip' is part of the Haskell 'standard prelude'; it really counts as part of the language. 'zip' is not in the erlang: module, and not even in any module in the kernel application. It's in the lists module, which is in the stdlib application. So the compiler is not going to make any assumptions at all about what it does.) I would prefer to see [X + Y || X <- lists:seq(1,10) && Y <- lists:seq(1,10)] Sadly, that's not legal now. -- If stupidity were a crime, who'd 'scape hanging? From justin.giancola@REDACTED Thu Jul 24 04:17:53 2008 From: justin.giancola@REDACTED (Justin Giancola) Date: Wed, 23 Jul 2008 22:17:53 -0400 Subject: [erlang-questions] Erlang in Toronto? Message-ID: <688f5b410807231917j6579f1f2q260fb575afe1d890@mail.gmail.com> A few Toronto developers who have been experimenting with Erlang in their spare time ran into each other this weekend at a conference and decided it would be a good idea to organize some kind of a meet-up. It might not be appropriate to even call this an Erlang user group--we're not sure anyone in Toronto is actually _using_ Erlang! But maybe we're wrong. Either way, let us know if you're in Toronto and working or playing with Erlang--we'd like to get an idea of how many people would be interested so that we can select an appropriate venue. You can either reply to this post or email info@REDACTED Justin, Luke, et al. p.s. we've registered the tdoterl domain as the future home for the group. There's nothing there yet, but we're planning to build a site (in Erlang, of course) as one of the group's first projects. From amandeepm@REDACTED Thu Jul 24 04:46:57 2008 From: amandeepm@REDACTED (AmandeepMidha 72123) Date: Thu, 24 Jul 2008 10:46:57 +0800 Subject: [erlang-questions] erlang-questions Digest, Vol 14, Issue 87 In-Reply-To: References: Message-ID: this is Amandeep from Shenzhen, China. Are there any participants here for Erlang? ****************************************************************************************** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! ***************************************************************************************** ----- Original Message ----- From: erlang-questions-request@REDACTED Date: Thursday, July 24, 2008 10:17 am Subject: erlang-questions Digest, Vol 14, Issue 87 > Send erlang-questions mailing list submissions to > erlang-questions@REDACTED > > To subscribe or unsubscribe via the World Wide Web, visit > http://www.erlang.org/mailman/listinfo/erlang-questions > or, via email, send a message with subject or body 'help' to > erlang-questions-request@REDACTED > > You can reach the person managing the list at > erlang-questions-owner@REDACTED > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of erlang-questions digest..." > > > Today's Topics: > > 1. Re: Ideas for a new Erlang (Ulf Wiger) > 2. Re: Mapping over 2+ lists/variables? (Richard Carlsson) > 3. Re: fast JSON parser in C (Jonathan Gray) > 4. tail of string = 104, bit? (Circular Function) > 5. Re: tail of string = 104, bit? (Lev Walkin) > 6. Re: tail of string = 104, bit? (David King) > 7. Re: tail of string = 104, bit? (Jos Visser) > 8. Re: fast JSON parser in C (Chris Anderson) > 9. scalaris code posted (Joe Armstrong) > 10. Re: Mapping over 2+ lists/variables? (Richard A. O'Keefe) > 11. Erlang in Toronto? (Justin Giancola) > > > ------------------------------------------------------------------- > --- > > Message: 1 > Date: Wed, 23 Jul 2008 19:27:33 +0200 > From: "Ulf Wiger" > Subject: Re: [erlang-questions] Ideas for a new Erlang > To: "Sven-Olof Nystr|m" > Cc: Erlang mailing list > Message-ID: > <8209f740807231027t385f22afwe10786451c0c6204@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1 > > 2008/7/22 Sven-Olof Nystr|m : > > Ulf Wiger writes: > > > > > > > A good place to start might be the POTS control program, > which was > > > presented in the Erlang book, and also used (in a slightly > different form) > > > in the Introductory Erlang course. > > > > > > I used it in my "Structured Network Programming" presentation to > > > show the consequences of different programming styles in multiway > > > signaling: > > > > > > http://www.erlang.se/euc/05/1500Wiger.ppt > > > > > > I'm not convinced that it will be sufficient to reveal > significant differences > > > between the standard erlang style and channels, but it's a > good place to > > > start, and the code can be expanded in a number of > interesting ways. > > > > > > BR, > > > Ulf W > > > > > > (There's a working simulator to go with the program, but the > OTP team > > > would have to give permission to release it in public. I'm > sure you can > > > get your hands on it anyway.) > > > > > > Sorry about disappearing from the discussion for so long. > > > > I took a look at the POTS program in the Erlang book. It is actually > > easy to rewrite it to use neither channels nor selective receive. > > > > I also looked at the gen-server module. > > > > Detailed comments follow. (A non-selective receive is one that > always> pick the first message in the mailbox.) > > > > Sven-Olof > > > > > > > > The book's implementation of POTS only contains four receive > > expressions. Among these, only one (in the function > make_call_to_B/3)> is selective. > > You should also take a look at the presentation that I referred to. > > 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. > > The OHaskell example assumed that functions like start_tone() > were atomic and non-blocking - they are not. > > 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. > > 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. > > BR, > Ulf W > > > ------------------------------ > > Message: 2 > Date: Wed, 23 Jul 2008 18:28:46 +0200 > From: Richard Carlsson > Subject: Re: [erlang-questions] Mapping over 2+ lists/variables? > To: circularfunc@REDACTED > Cc: erlang-questions@REDACTED > Message-ID: <48875C3E.7050903@REDACTED> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Circular Function wrote: > > in python I can do: > > >>> map(lambda x,y:x+y,[1,2,3],[4,5,6]) > > [5, 7, 9] > > >>> > > > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > > ** exception error: undefined function lists:map/3 > > 39> > > > > isnt there general map-function that map is derived from that I > can use? > > what about listcomprehensions? > > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > > * 1: variable 'X' is unbound > > 45> > > Erlang's list comprehensions can't do that. The function you want is > lists:zipwith(Fun,List1,List2). You could also do > lists:zip(List1,List2)and then run map on the result, but zipwith > does it in one pass. > > /Richard > > -- > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > > > ------------------------------ > > Message: 3 > Date: Wed, 23 Jul 2008 10:49:04 -0700 > From: "Jonathan Gray" > Subject: Re: [erlang-questions] fast JSON parser in C > To: "'Chris Anderson'" > Cc: erlang-questions@REDACTED > Message-ID: <071301c8ecec$6677bfa0$33673ee0$@com> > Content-Type: text/plain; charset="us-ascii" > > That's the interesting thing. > > I've successfully encoded and decoded >1.5MB binary chunks of > erlang terms > when I manually create them using erl_interface. > > However when I get a big chunk (around 80-120K) directly from > Erlang as > binary (using term_to_binary in erlang), I'm unable to decode it using > erl_interface erl_decode, though it can be decoded fine from > within Erlang. > > I haven't received any responses as to a fix and was redirected > towardsusing ei instead of (seemingly deprecated but not > documented as deprecated) > erl_interface. > > I'm going to do some testing with ei and will let you know if the > problemgoes away. > > Also, I'll take a look at Yajl now. Thanks. > > JG > > -----Original Message----- > From: jchris@REDACTED [mailto:jchris@REDACTED] On Behalf Of > Chris Anderson > Sent: Wednesday, July 23, 2008 10:20 AM > To: Jonathan Gray > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] fast JSON parser in C > > On Wed, Jul 23, 2008 at 11:31 AM, Jonathan Gray > wrote: > > Chris, > > > > Considering your primary goal is speed, you definitely don't > want to use > my > > implementation. > > Thanks then for the info. My plan was to use > http://www.lloydforge.org/projects/yajl/ as a fast JSON parser, and > somehow get the results to Erlang. It looks like it may be more > challenging than I'd thought. > > Out of curiosity, at roughly what size of input do you start to see > the segfaults? I'll probably start with the ei interface if that is > safer, but it will be nice to know how hard I have to push it to know > that I've done the job safely. > > -- > Chris Anderson > http://jchris.mfdz.com > > > > ------------------------------ > > Message: 4 > Date: Wed, 23 Jul 2008 18:51:03 +0000 (GMT) > From: Circular Function > Subject: [erlang-questions] tail of string = 104, bit? > To: erlang > Message-ID: <379032.6803.qm@REDACTED> > Content-Type: text/plain; charset="utf-8" > > when i do tl("hej") I get 104, well I need "h". > How do I get h amd if not possible how do i convert 104 to > string?? or how do i convert string to the other format? is it a bit? > > > > __________________________________________________________ > L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. > http://www.kelkoo.se/c-100390123-lan-utan- > sakerhet.html?partnerId=96915014-------------- next part ---------- > ---- > An HTML attachment was scrubbed... > URL: http://www.erlang.org/pipermail/erlang- > questions/attachments/20080723/565ded70/attachment-0001.html > > ------------------------------ > > Message: 5 > Date: Wed, 23 Jul 2008 12:32:43 -0700 > From: Lev Walkin > Subject: Re: [erlang-questions] tail of string = 104, bit? > To: circularfunc@REDACTED > Cc: erlang > Message-ID: <4887875B.4040209@REDACTED> > Content-Type: text/plain; charset=UTF-8; format=flowed > > Circular Function wrote: > > when i do tl("hej") I get 104, well I need "h". > > 104 is a code for 'h'. Try this way > > [tl("hej")]. > > You'll get a list of one element, which is an "h" letter. > > > How do I get h amd if not possible how do i convert 104 to > string? or > > how do i convert string to the other format? is it a bit? > > > Also, could you please stop using this erlang-question list > as a substitute for an introductory Erlang reading. > > > -- > vlm > > > ------------------------------ > > Message: 6 > Date: Wed, 23 Jul 2008 12:32:46 -0700 > From: David King > Subject: Re: [erlang-questions] tail of string = 104, bit? > To: "Erlang-Questions (E-mail)" > Message-ID: <221C8D5D-0B1D-4A68-A8A8-99EAB7392304@REDACTED> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > > when i do tl("hej") I get 104, well I need "h". > > How do I get h amd if not possible how do i convert 104 to > string? > > or how do i convert string to the other format? is it a bit? > > A string is a list of integers. [104] =:= "h" > > > ------------------------------ > > Message: 7 > Date: Wed, 23 Jul 2008 21:42:30 +0200 > From: Jos Visser > Subject: Re: [erlang-questions] tail of string = 104, bit? > To: Circular Function > Cc: erlang > Message-ID: <20080723194230.GN5136@REDACTED> > Content-Type: text/plain; charset=iso-8859-1 > > I guess you mean hd("hej") returning 103. tl("hej") returns "ej". > > In Erlang a string is a list of integers. To make a string from an > integer, just make a list out of it: > > f(S) -> [hd(S)]. > > ++Jos.ch > > On Wed, Jul 23, 2008 at 06:51:03PM +0000 it came to pass that > Circular Function wrote: > > when i do tl("hej") I get 104, well I need "h". > > How do I get h amd if not possible how do i convert 104 to > string?? or how do i convert string to the other format? is it a bit? > > > > > > > > __________________________________________________________ > > L?na pengar utan s?kerhet. J?mf?r vilkor online hos Kelkoo. > > http://www.kelkoo.se/c-100390123-lan-utan- > sakerhet.html?partnerId=96915014> > _______________________________________________> 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... > > > ------------------------------ > > Message: 8 > Date: Wed, 23 Jul 2008 15:45:37 -0400 > From: "Chris Anderson" > Subject: Re: [erlang-questions] fast JSON parser in C > To: "Jonathan Gray" > Cc: erlang-questions@REDACTED > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray > wrote:> However when I get a big chunk (around 80-120K) directly > from Erlang as > > binary (using term_to_binary in erlang), I'm unable to decode it > using> erl_interface erl_decode, though it can be decoded fine > from within Erlang. > > Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not > need help from C. I'm just working on making the JSON -> Erlang fast > enough, so as long as I can get string buffers over to C in the first > place, it sounds like you're not having a problem moving data from C > back to Erlang. > > Time to buckle down and code! > > -- > Chris Anderson > http://jchris.mfdz.com > > > ------------------------------ > > Message: 9 > Date: Wed, 23 Jul 2008 23:07:59 +0200 > From: "Joe Armstrong" > Subject: [erlang-questions] scalaris code posted > To: erlang-questions > Message-ID: > <9b08084c0807231407i65c3a5d1mdb3b5aa57a5286fa@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1 > > 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 > > > ------------------------------ > > Message: 10 > Date: Thu, 24 Jul 2008 13:33:23 +1200 > From: "Richard A. O'Keefe" > Subject: Re: [erlang-questions] Mapping over 2+ lists/variables? > To: > Cc: erlang-questions@REDACTED > Message-ID: > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > > On 24 Jul 2008, at 4:24 am, Circular Function wrote: > > 38> lists:map(fun(X,Y) -> X+Y end,[1,2],[3,4]). > > ** exception error: undefined function lists:map/3 > > 39> > > > So write your own: > > map(F, [A|As], [B|Bs]) -> [F(A,B) | map(F, As, Bs)]; > map(_, [], [] ) -> []. > > I mean, it's less typing to FIX the problem than to complain > about it! > > > isnt there general map-function that map is derived from that I > can > > use? > > No. The code for map is just > > map(F, [A|As]) -> [F(A) | map(F, As)]; > map(_, [] ) -> []. > > Erlang is open source, and if you have it, you also have all the > source code, including /lib/stdlib/src/lists.erl, > so you can easily see for yourself how this and other functions > work. > > > > > what about listcomprehensions? > > 44> [X+Y || X,Y <- lists:seq(1,10),lists:seq(1,10)]. > > * 1: variable 'X' is unbound > > Indeed it is. Like Haskell (yah boo chiz) Erlang list > comprehensions do not permit "parallel" iteration, only > "nested" iteration. This is one of the things I like > about Clean. Hmm. List comprehension uses '||', I've > just thought of a use for '&&'... > > The Haskell approach would be > > [x + y | (x,y) <- zip [1..10] [1..10]] > > or better still, > zipWith (+) [1..10] [1..10] > > The Erlang equivalent of using zip here is, well, > using zip: > > [X + Y | {X,Y} <- lists:zip(lists:seq(1,10), > lists:seq(1,10))] > > Personally I loathe this. Some Haskell compilers > (notably GHC and I think YHC) are smart enough to do > 'deforestation' and NOT really build a list of pairs. > The Erlang compiler is not. (For one thing, 'zip' > is part of the Haskell 'standard prelude'; it really > counts as part of the language. 'zip' is not in the > erlang: module, and not even in any module in the > kernel application. It's in the lists module, which > is in the stdlib application. So the compiler is not > going to make any assumptions at all about what it does.) > I would prefer to see > [X + Y || X <- lists:seq(1,10) > && Y <- lists:seq(1,10)] > > Sadly, that's not legal now. > > -- > If stupidity were a crime, who'd 'scape hanging? > > > > > > > > > > ------------------------------ > > Message: 11 > Date: Wed, 23 Jul 2008 22:17:53 -0400 > From: "Justin Giancola" > Subject: [erlang-questions] Erlang in Toronto? > To: erlang-questions@REDACTED > Message-ID: > <688f5b410807231917j6579f1f2q260fb575afe1d890@REDACTED> > Content-Type: text/plain; charset=ISO-8859-1 > > A few Toronto developers who have been experimenting with Erlang > in their spare time ran into each other this weekend at a conference > and decided it would be a good idea to organize some kind of a > meet-up. > > It might not be appropriate to even call this an Erlang user > group--we're not sure anyone in Toronto is actually _using_ Erlang! > But maybe we're wrong. Either way, let us know if you're in Toronto > and working or playing with Erlang--we'd like to get an idea of how > many people would be interested so that we can select an appropriate > venue. You can either reply to this post or email info@REDACTED > > > Justin, Luke, et al. > > p.s. we've registered the tdoterl domain as the future home for > the group. > There's nothing there yet, but we're planning to build a site (in > Erlang, of course) as one of the group's first projects. > > > ------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > End of erlang-questions Digest, Vol 14, Issue 87 > ************************************************ > From nick@REDACTED Thu Jul 24 10:21:17 2008 From: nick@REDACTED (Niclas Eklund) Date: Thu, 24 Jul 2008 10:21:17 +0200 (CEST) Subject: [erlang-questions] clarify: CORBA/IIOP version supported by Orber In-Reply-To: <5922261e1993f5be5a9718410a5c0e23.squirrel@www.geekisp.com> References: <5922261e1993f5be5a9718410a5c0e23.squirrel@www.geekisp.com> Message-ID: Hello! That paper was written quite some time ago. For example, the SNMP component doesn't list v3, JAM appears in the examples etc. Any ORB you use, should at least be compliant with CORBA v 2.3 or later. Orber is roughly based on CORBA v 2.9, which include IIOP versions 1.0, 1.1 and 1.2. Best Regards, Niclas Erlang/OTP On Wed, 23 Jul 2008, Dominic Williams wrote: > Hello, > > I'm sorry if I've missed it (I looked documentation, FAQ, list archives), > but I would like to know what is the CORBA/IIOP version supported by > Orber. > > The only reference to this I found was in: > > http://www.erlang.org/white_paper.html > > which says 2.0, which seems a bit old. > > Thanks, > > Dominic Williams > http://dominicwilliams.net > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From martin@REDACTED Thu Jul 24 11:02:36 2008 From: martin@REDACTED (Martin Carlson) Date: Thu, 24 Jul 2008 10:02:36 +0100 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> Message-ID: <4888452C.3060400@erlang-consulting.com> You might want to go with the ei interface rather than the erl_interface since it is not as clumsy to use. Further, you might want to have a look at the ejabberd expat driver and just replace the expat stuff with your json SAX events. -Martin Chris Anderson wrote: > On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray wrote: >> However when I get a big chunk (around 80-120K) directly from Erlang as >> binary (using term_to_binary in erlang), I'm unable to decode it using >> erl_interface erl_decode, though it can be decoded fine from within Erlang. > > Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not > need help from C. I'm just working on making the JSON -> Erlang fast > enough, so as long as I can get string buffers over to C in the first > place, it sounds like you're not having a problem moving data from C > back to Erlang. > > Time to buckle down and code! > From devdoer2@REDACTED Thu Jul 24 11:19:46 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 24 Jul 2008 17:19:46 +0800 Subject: [erlang-questions] what is "mnesia_schema:get_tid_ts_and_lock/2" used for Message-ID: HI: Can someone explain the function "mnesia_schema:get_tid_ts_and_lock/2" to me? What is it used for in mnesia? Will it lock the table and when will be the lock released ?Thanks a lot! Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From amandeepm@REDACTED Thu Jul 24 12:06:09 2008 From: amandeepm@REDACTED (Amandeep Midha) Date: Thu, 24 Jul 2008 15:36:09 +0530 Subject: [erlang-questions] Question on Erlang Distributions In-Reply-To: Message-ID: <001301c8ed74$e53d53d0$4914120a@china.huawei.com> What are Erlang-B and Erlang-C distributions? For a load testing product implementations, which one should be chosen and why? -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Jul 24 12:49:28 2008 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 24 Jul 2008 12:49:28 +0200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <4888452C.3060400@erlang-consulting.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> Message-ID: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> Since JSON seem to be ubiquitous is seems to me that there would be a strong case for a couple of new BIFs, term_to_json and json_to_term. these would work like binary_to_term and term_to_binary the difference being that instead of converting to a binary containing the external term format, we convert to a binary containing a JSON encoded string. I imaging that modeling this code on the existing term_to_binary and binary_to_term code would not be impossibly difficult (you have to make it reentrant and not to not hog the CPU for too long ... and so on ...) And yes - it is pretty horrid increasing the number of BIFs but this might just be a useful addition. This would ease seamless integration with a lot of external programs :-) /Joe Armstrong On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson wrote: > You might want to go with the ei interface rather than the erl_interface > since it is not as clumsy to use. Further, you might want to have a look > at the ejabberd expat driver and just replace the expat stuff with your > json SAX events. > > -Martin > > Chris Anderson wrote: >> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray wrote: >>> However when I get a big chunk (around 80-120K) directly from Erlang as >>> binary (using term_to_binary in erlang), I'm unable to decode it using >>> erl_interface erl_decode, though it can be decoded fine from within Erlang. >> >> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not >> need help from C. I'm just working on making the JSON -> Erlang fast >> enough, so as long as I can get string buffers over to C in the first >> place, it sounds like you're not having a problem moving data from C >> back to Erlang. >> >> Time to buckle down and code! >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From haskellian@REDACTED Thu Jul 24 12:58:54 2008 From: haskellian@REDACTED (hask ellian) Date: Thu, 24 Jul 2008 12:58:54 +0200 Subject: [erlang-questions] comment on my erlang Spamfilter Message-ID: I made a simple spamfilter in Erlang. It takes 2 files with previous spam and good emails and then counts how many times the most frequent words from the spammy emails and the good emails occurs and then calculates the quote spam/(spam+good) in the file you want to test and returns a number between 0 and 1. It could easily be improved in numerous ways but the main point for me was to learn Erlang. This isn't exactly what Erlang is for but it s way to get started. I'd be happy to receive comments on the Erlang-ness of the code and improvements. File I/O seems slow, is there a better way? In Haskell it is fairly instant. -module(antispam). -export([take/2,count/2,count_all/1,most_common/2,count_set_in_list/2, classify/0,readfile/1]). take(N,List) -> i_take(N,List,0,[]). i_take(N,List,Count,Acc) -> if Count < N andalso List /= [] -> i_take(N,tl(List),Count+1,Acc++[hd(List)]); Count == N -> Acc; true -> [] end. count(Tok,List) -> i_count(Tok,List,0). i_count(Tok,List,Acc) -> if Tok == hd(List) andalso List /= [] -> i_count(Tok,tl(List),Acc+1); Tok /= hd(List) andalso List /= [] -> i_count(Tok,tl(List),Acc); true -> Acc end. count_all(List) -> Unique = lists:usort(List), [{U, count(U, List)} || U <- Unique]. count_set_in_list(Set,List) -> S = [{S, count(S, List)} || S <- Set], lists:sum(lists:map(fun({H,T}) -> T end, S)). most_common(Stringlist,Xmost) -> No_preps = lists:filter(fun(X) -> length(X) > 4 end, Stringlist), Sorted_by_count = lists:keysort(2, count_all(No_preps)), TakeX = take(Xmost, lists:reverse(Sorted_by_count)), lists:map(fun({H,T}) -> H end, TakeX). readfile(FileName) -> {ok, Binary} = file:read_file(FileName), string:tokens(binary_to_list(Binary), " "). classify() -> GoodWords = most_common(readfile("C:/Users/saftarn/Desktop/emails/okemails.txt"), 20), BadWords = most_common(readfile("C:/Users/saftarn/Desktop/emails/spam.txt"), 20), GoodCount = count_set_in_list(GoodWords, readfile("C:/Users/saftarn/Desktop/emails/test.txt")), BadCount = count_set_in_list(BadWords, readfile("C:/Users/saftarn/Desktop/emails/test.txt")), T = BadCount + GoodCount, if T /= 0 -> BadCount / T; true -> 0.5 end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick@REDACTED Thu Jul 24 13:01:05 2008 From: nick@REDACTED (Niclas Eklund) Date: Thu, 24 Jul 2008 13:01:05 +0200 (CEST) Subject: [erlang-questions] Question on Erlang Distributions In-Reply-To: <001301c8ed74$e53d53d0$4914120a@china.huawei.com> References: <001301c8ed74$e53d53d0$4914120a@china.huawei.com> Message-ID: Hello! I'm affraid that you've sent your questions to the wrong list. The erlang-questions list is all about the functional programming language Erlang (http://www.erlang.org/). Perhaps the following links can help you: http://en.wikipedia.org/wiki/Erlang_distribution http://en.wikipedia.org/wiki/Erlang_unit Best Regards, Niclas, Erlang/OTP On Thu, 24 Jul 2008, Amandeep Midha wrote: > What are Erlang-B and Erlang-C distributions? For a load testing product > implementations, which one should be chosen and why? > > From ulf@REDACTED Thu Jul 24 13:19:06 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 24 Jul 2008 13:19:06 +0200 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: References: Message-ID: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> I don't think you should hack mnesia for that. A simple wrapper function will do nicely. BR, Ulf W 2008/7/23, devdoer bird : > HI: > > I want to extend mnesia 's lock to add this function > "mnesia:lock(LockItem,LockType,ConditionFun)" . > > This function works in this way: If a table 's record passes the > ConditionFun test,the the record is locked. > > Eg. > I have a user table with the record: -record(user,{name,age}). > > I want to lock the user's whose name begines with 'a' ,I can code using my > customized " mnesia:lock(LockItem,LockType,ConditionFun)" > > like this: > > ConditionFun=fun(U)-> > if > U#user.name=='a' -> true; > true->false > end > end > mnesia:lock(user,write,ConditionFun). > > that is I want to lock part of the table. > > Have anyone done this before? How shall I extend the mensia lock? Any > information will be helpful, I 'm quite unfamiliar with mnesia lock > system. > From vlm@REDACTED Thu Jul 24 13:35:23 2008 From: vlm@REDACTED (Lev Walkin) Date: Thu, 24 Jul 2008 04:35:23 -0700 Subject: [erlang-questions] comment on my erlang Spamfilter In-Reply-To: References: Message-ID: <488868FB.7000804@lionet.info> hask ellian wrote: > I made a simple spamfilter in Erlang. It takes 2 files with previous > spam and good emails and then counts how many times the most frequent > words from the spammy emails and the good emails occurs and then > calculates the quote spam/(spam+good) in the file you want to test and > returns a number between 0 and 1. > It could easily be improved in numerous ways but the main point for me > was to learn Erlang. This isn't exactly what Erlang is for but it s way > to get started. > I'd be happy to receive comments on the Erlang-ness of the code and > improvements. > File I/O seems slow, is there a better way? In Haskell it is fairly instant. > > > -module(antispam). > -export([take/2,count/2,count_all/1,most_common/2,count_set_in_list/2, > classify/0,readfile/1]). > > take(N,List) -> i_take(N,List,0,[]). > i_take(N,List,Count,Acc) -> > if Count < N andalso List /= [] -> > i_take(N,tl(List),Count+1,Acc++[hd(List)]); > Count == N -> > Acc; > true -> > [] > end. Consider using lists:sublist() instead of reimplementing the standard library methods. > count(Tok,List) -> i_count(Tok,List,0). > i_count(Tok,List,Acc) -> > if Tok == hd(List) andalso List /= [] -> > i_count(Tok,tl(List),Acc+1); > Tok /= hd(List) andalso List /= [] -> > i_count(Tok,tl(List),Acc); > true -> > Acc > end. Consider using length([T == Tok || T <- List]) which is much more concise and manageable. > count_all(List) -> > Unique = lists:usort(List), > [{U, count(U, List)} || U <- Unique]. This one has O(N^2) complexity. Consider using ets if the data set is larger than, say, 1000 elements. > count_set_in_list(Set,List) -> > S = [{S, count(S, List)} || S <- Set], > lists:sum(lists:map(fun({H,T}) -> T end, S)). count_set_in_list(Set, List) -> lists:sum([count(S, List) || S <- Set]). > most_common(Stringlist,Xmost) -> > No_preps = lists:filter(fun(X) -> length(X) > 4 end, Stringlist), > Sorted_by_count = lists:keysort(2, count_all(No_preps)), > TakeX = take(Xmost, lists:reverse(Sorted_by_count)), > lists:map(fun({H,T}) -> H end, TakeX). > readfile(FileName) -> > {ok, Binary} = file:read_file(FileName), > string:tokens(binary_to_list(Binary), " "). > > classify() -> > GoodWords = > most_common(readfile("C:/Users/saftarn/Desktop/emails/okemails.txt"), 20), > BadWords = > most_common(readfile("C:/Users/saftarn/Desktop/emails/spam.txt"), 20), > GoodCount = count_set_in_list(GoodWords, > readfile("C:/Users/saftarn/Desktop/emails/test.txt")), > BadCount = count_set_in_list(BadWords, > readfile("C:/Users/saftarn/Desktop/emails/test.txt")), > T = BadCount + GoodCount, > if T /= 0 -> > BadCount / T; > true -> > 0.5 > end. > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Thu Jul 24 14:47:22 2008 From: vances@REDACTED (Vance Shipley) Date: Thu, 24 Jul 2008 13:47:22 +0100 Subject: [erlang-questions] Erlang in Toronto? In-Reply-To: <688f5b410807231917j6579f1f2q260fb575afe1d890@mail.gmail.com> References: <688f5b410807231917j6579f1f2q260fb575afe1d890@mail.gmail.com> Message-ID: <20080724124721.GC8053@Little-Black-Book.local> On Wed, Jul 23, 2008 at 10:17:53PM -0400, Justin Giancola wrote: } --we're not sure anyone in Toronto is actually _using_ Erlang! I live in downtown Toronto. I certainy _use_ Erlang. -Vance From vychodil.hynek@REDACTED Thu Jul 24 14:48:51 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 24 Jul 2008 14:48:51 +0200 Subject: [erlang-questions] comment on my erlang Spamfilter In-Reply-To: <488868FB.7000804@lionet.info> References: <488868FB.7000804@lionet.info> Message-ID: <4d08db370807240548q26debf71kb9335192735a3572@mail.gmail.com> On Thu, Jul 24, 2008 at 1:35 PM, Lev Walkin wrote: > hask ellian wrote: > > I made a simple spamfilter in Erlang. It takes 2 files with previous > > spam and good emails and then counts how many times the most frequent > > words from the spammy emails and the good emails occurs and then > > calculates the quote spam/(spam+good) in the file you want to test and > > returns a number between 0 and 1. > > It could easily be improved in numerous ways but the main point for me > > was to learn Erlang. This isn't exactly what Erlang is for but it s way > > to get started. > > I'd be happy to receive comments on the Erlang-ness of the code and > > improvements. > > File I/O seems slow, is there a better way? In Haskell it is fairly > instant. > > > > > > -module(antispam). > > -export([take/2,count/2,count_all/1,most_common/2,count_set_in_list/2, > > classify/0,readfile/1]). > > > > take(N,List) -> i_take(N,List,0,[]). > > i_take(N,List,Count,Acc) -> > > if Count < N andalso List /= [] -> > > i_take(N,tl(List),Count+1,Acc++[hd(List)]); > > Count == N -> > > Acc; > > true -> > > [] > > end. > > Consider using lists:sublist() instead of reimplementing > the standard library methods. > > > count(Tok,List) -> i_count(Tok,List,0). > > i_count(Tok,List,Acc) -> > > if Tok == hd(List) andalso List /= [] -> > > i_count(Tok,tl(List),Acc+1); > > Tok /= hd(List) andalso List /= [] -> > > i_count(Tok,tl(List),Acc); > > true -> > > Acc > > end. > > Consider using > > length([T == Tok || T <- List]) I guess you mean count(Tok, List) -> length([T || T<-List, T=:=Tok]). or may be better (less memory consuming) count(Tok, List) -> lists:foldl(fun(Tok, Acc)->Acc+1; (_,Acc)->Acc end, 0, List). but tail recursive version is not so bad at all (guess fastest) count(Tok, List) -> i_count(Tok, List, 0). i_count(_, [], Count) -> Count; i_count(Tok, [Tok|Rest], Count) -> i_count(Tok, Rest, Count+1); i_count(Tok, [_|Rest], Count) -> i_count(Tok, Rest, Count). and non tail recursive version can work for no so much big Lists reasonably well count(_, [])->0; count(Tok, [Tok|Rest])->1+count(Tok, Rest); count(Tok, [_|Rest)->count(Tok, Rest). > > which is much more concise and manageable. > > > count_all(List) -> > > Unique = lists:usort(List), > > [{U, count(U, List)} || U <- Unique]. > > This one has O(N^2) complexity. Consider using ets if the data > set is larger than, say, 1000 elements. > > > count_set_in_list(Set,List) -> > > S = [{S, count(S, List)} || S <- Set], > > lists:sum(lists:map(fun({H,T}) -> T end, S)). > > count_set_in_list(Set, List) -> > lists:sum([count(S, List) || S <- Set]). It is O(N*M) ets or dict should perform better too. count_set_in_list(Set, List) -> lists:foldl(fun(X, D)->dict:update_counter(X, 1, D) end, dict:new(), List), lists:foldl(fun(K, Acc)-> try dict:fetch(K, CountAll) of Count -> Acc+Count catch _:_->Acc end end, 0, Set). or less memory consuming and probalbly faster count_set_in_list(Set, List) -> S = sets:from_list(Set); lists:foldl(fun(K, Acc) -> case sets:is_element(K, S) of true -> Acc+1; false -> Acc end end, 0, List). But for short Set it can be slower than count_set_in_list(Set, List) -> lists:foldl(fun(K, Acc) -> case lists:member(K, Set) of true -> Acc+1; false -> Acc end end, 0, List). which can be simplified as again O(N*M) count_set_in_list(Set, List) -> length([ok || X<-List, Y<-Set, X=:=Y]). > > > most_common(Stringlist,Xmost) -> > > No_preps = lists:filter(fun(X) -> length(X) > 4 end, Stringlist), > > Sorted_by_count = lists:keysort(2, count_all(No_preps)), > > TakeX = take(Xmost, lists:reverse(Sorted_by_count)), > > lists:map(fun({H,T}) -> H end, TakeX). > > > > > readfile(FileName) -> > > {ok, Binary} = file:read_file(FileName), > > string:tokens(binary_to_list(Binary), " "). > > > > classify() -> > > GoodWords = > > most_common(readfile("C:/Users/saftarn/Desktop/emails/okemails.txt"), > 20), > > BadWords = > > most_common(readfile("C:/Users/saftarn/Desktop/emails/spam.txt"), 20), > > GoodCount = count_set_in_list(GoodWords, > > readfile("C:/Users/saftarn/Desktop/emails/test.txt")), > > BadCount = count_set_in_list(BadWords, > > readfile("C:/Users/saftarn/Desktop/emails/test.txt")), > > T = BadCount + GoodCount, > > if T /= 0 -> > > BadCount / T; > > true -> > > 0.5 > > end. > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > 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 devdoer2@REDACTED Thu Jul 24 15:11:37 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 24 Jul 2008 21:11:37 +0800 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> References: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> Message-ID: The example I give is not good.,but I just need hack the mnesia lock :(. I want to lock part of the table and which part is controled by the record's key's value range .Currently mnesia only support record lock and table lock. 2008/7/24, Ulf Wiger : > > I don't think you should hack mnesia for that. A simple wrapper > function will do nicely. > > BR, > Ulf W > > 2008/7/23, devdoer bird : > > HI: > > > > I want to extend mnesia 's lock to add this function > > "mnesia:lock(LockItem,LockType,ConditionFun)" . > > > > This function works in this way: If a table 's record passes the > > ConditionFun test,the the record is locked. > > > > Eg. > > I have a user table with the record: -record(user,{name,age}). > > > > I want to lock the user's whose name begines with 'a' ,I can code using > my > > customized " mnesia:lock(LockItem,LockType,ConditionFun)" > > > > like this: > > > > ConditionFun=fun(U)-> > > if > > U#user.name=='a' -> true; > > true->false > > end > > end > > mnesia:lock(user,write,ConditionFun). > > > > that is I want to lock part of the table. > > > > Have anyone done this before? How shall I extend the mensia lock? Any > > information will be helpful, I 'm quite unfamiliar with mnesia lock > > system. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu Jul 24 16:03:50 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 24 Jul 2008 16:03:50 +0200 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: References: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> Message-ID: <8209f740807240703l75612f05gd4038f13d312624a@mail.gmail.com> If you are to gain any performance compared to a wrapper, or using only table locks, you must do brain surgery on mnesia_locker. I strongly advise against that. The relationship between record locks and table locks is quite intricate. BR, Ulf W 2008/7/24, devdoer bird : > The example I give is not good.,but I just need hack the mnesia lock :(. > > I want to lock part of the table and which part is controled by the record's > key's value range .Currently mnesia only support record lock and table > lock. > > > 2008/7/24, Ulf Wiger : >> >> I don't think you should hack mnesia for that. A simple wrapper >> function will do nicely. >> >> BR, >> Ulf W >> >> 2008/7/23, devdoer bird : >> > HI: >> > >> > I want to extend mnesia 's lock to add this function >> > "mnesia:lock(LockItem,LockType,ConditionFun)" . >> > >> > This function works in this way: If a table 's record passes the >> > ConditionFun test,the the record is locked. >> > >> > Eg. >> > I have a user table with the record: -record(user,{name,age}). >> > >> > I want to lock the user's whose name begines with 'a' ,I can code >> > using >> my >> > customized " mnesia:lock(LockItem,LockType,ConditionFun)" >> > >> > like this: >> > >> > ConditionFun=fun(U)-> >> > if >> > U#user.name=='a' -> true; >> > true->false >> > end >> > end >> > mnesia:lock(user,write,ConditionFun). >> > >> > that is I want to lock part of the table. >> > >> > Have anyone done this before? How shall I extend the mensia lock? Any >> > information will be helpful, I 'm quite unfamiliar with mnesia lock >> > system. >> > >> > From james.hague@REDACTED Thu Jul 24 16:18:31 2008 From: james.hague@REDACTED (James Hague) Date: Thu, 24 Jul 2008 09:18:31 -0500 Subject: [erlang-questions] comment on my erlang Spamfilter In-Reply-To: References: Message-ID: readfile(FileName) -> {ok, Binary} = file:read_file(FileName), string:tokens(binary_to_list(Binary), " "). Were I writing this, I wouldn't have called string:tokens at all, but directly looped through Binary looking for words. More than once I've found string:tokens to be a hotspot, and there's no compelling reason to do the tokenization as a separate step in this case. That also avoids the 8x blowup caused by binary_to_list on a potentially large file. From devdoer2@REDACTED Thu Jul 24 16:19:50 2008 From: devdoer2@REDACTED (devdoer bird) Date: Thu, 24 Jul 2008 22:19:50 +0800 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: <8209f740807240703l75612f05gd4038f13d312624a@mail.gmail.com> References: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> <8209f740807240703l75612f05gd4038f13d312624a@mail.gmail.com> Message-ID: 2008/7/24, Ulf Wiger : > > If you are to gain any performance compared to a wrapper, or using > only table locks, you must do brain surgery on mnesia_locker. I > strongly advise against that. The relationship between record locks > and table locks is quite intricate. Yes.I want to gain some performance to lock part of the table. What's the intricate part of the locking system design?Can you give any docs about the design of the mensia table-lock and record lock? BR, > Ulf W > > 2008/7/24, devdoer bird : > > The example I give is not good.,but I just need hack the mnesia lock :(. > > > > I want to lock part of the table and which part is controled by the > record's > > key's value range .Currently mnesia only support record lock and table > > lock. > > > > > > 2008/7/24, Ulf Wiger : > >> > >> I don't think you should hack mnesia for that. A simple wrapper > >> function will do nicely. > >> > >> BR, > >> Ulf W > >> > >> 2008/7/23, devdoer bird : > >> > HI: > >> > > >> > I want to extend mnesia 's lock to add this function > >> > "mnesia:lock(LockItem,LockType,ConditionFun)" . > >> > > >> > This function works in this way: If a table 's record passes the > >> > ConditionFun test,the the record is locked. > >> > > >> > Eg. > >> > I have a user table with the record: -record(user,{name,age}). > >> > > >> > I want to lock the user's whose name begines with 'a' ,I can code > >> > using > >> my > >> > customized " mnesia:lock(LockItem,LockType,ConditionFun)" > >> > > >> > like this: > >> > > >> > ConditionFun=fun(U)-> > >> > if > >> > U#user.name=='a' -> true; > >> > true->false > >> > end > >> > end > >> > mnesia:lock(user,write,ConditionFun). > >> > > >> > that is I want to lock part of the table. > >> > > >> > Have anyone done this before? How shall I extend the mensia lock? Any > >> > information will be helpful, I 'm quite unfamiliar with mnesia lock > >> > system. > >> > > >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joseph.stewart@REDACTED Thu Jul 24 17:27:48 2008 From: joseph.stewart@REDACTED (Joseph Stewart) Date: Thu, 24 Jul 2008 11:27:48 -0400 Subject: [erlang-questions] Metro Atlanta Erlang Users Group... Message-ID: <2781f020807240827i14d95710m8d3ced296d84122c@mail.gmail.com> This is a fledgling group to hopefully get some of us together for Erlang experience and advocacy. http://groups.google.com/group/maeug (only two members so far, no meetings held yet... spread the word if you're in the area) Thanks -joe If it ain't broke, break it. How else are you going to figure out how it works? -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Thu Jul 24 18:35:08 2008 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 24 Jul 2008 17:35:08 +0100 Subject: [erlang-questions] Job posting: Contracting opportunity at T-Mobile UK Message-ID: Hello, There is a 6 month contracting opportunity to hack Erlang at T-Mobile UK. If anyone is interested, please send me your CV off list. cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlist@REDACTED Thu Jul 24 19:19:00 2008 From: jlist@REDACTED (Jonathan Gray) Date: Thu, 24 Jul 2008 10:19:00 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> Message-ID: <085601c8edb1$5d745b00$185d1100$@com> Joe, It would certainly ease our integration. JSON is certainly becoming ubiquitous and tighter integration with Erlang would be very useful. One note, in my current implementation and in general, there's no real direct mapping for JSON objects/dictionaries. While Erlang does have dicts, we were never able to "create" them using erl_interface/ei, though I'm sure it's possible by dissecting the dict representation. I use a {obj, [{},{}]} type representation now to handle JSON objects in Erlang. Any thoughts? +1 on new JSON BIFs :) Willing to help in any way I can. Jonathan Gray -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joe Armstrong Sent: Thursday, July 24, 2008 3:49 AM To: Martin Carlson Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] fast JSON parser in C Since JSON seem to be ubiquitous is seems to me that there would be a strong case for a couple of new BIFs, term_to_json and json_to_term. these would work like binary_to_term and term_to_binary the difference being that instead of converting to a binary containing the external term format, we convert to a binary containing a JSON encoded string. I imaging that modeling this code on the existing term_to_binary and binary_to_term code would not be impossibly difficult (you have to make it reentrant and not to not hog the CPU for too long ... and so on ...) And yes - it is pretty horrid increasing the number of BIFs but this might just be a useful addition. This would ease seamless integration with a lot of external programs :-) /Joe Armstrong On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson wrote: > You might want to go with the ei interface rather than the erl_interface > since it is not as clumsy to use. Further, you might want to have a look > at the ejabberd expat driver and just replace the expat stuff with your > json SAX events. > > -Martin > > Chris Anderson wrote: >> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray wrote: >>> However when I get a big chunk (around 80-120K) directly from Erlang as >>> binary (using term_to_binary in erlang), I'm unable to decode it using >>> erl_interface erl_decode, though it can be decoded fine from within Erlang. >> >> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not >> need help from C. I'm just working on making the JSON -> Erlang fast >> enough, so as long as I can get string buffers over to C in the first >> place, it sounds like you're not having a problem moving data from C >> back to Erlang. >> >> Time to buckle down and code! >> > > _______________________________________________ > 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 svenolof@REDACTED Thu Jul 24 20:24:28 2008 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Thu, 24 Jul 2008 20:24:28 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <8209f740807231027t385f22afwe10786451c0c6204@mail.gmail.com> References: <18529.883.586609.71953@hamberg.it.uu.se> <8209f740806251457w230ea12bi124f70b93c06a25c@mail.gmail.com> <478E4255-8002-46DB-93E5-C9F3F6B5E8D7@cs.otago.ac.nz> <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> Message-ID: <18568.51420.797833.139618@harpo.it.uu.se> Ulf Wiger writes: > 2008/7/22 Sven-Olof Nystr|m : > > Ulf Wiger writes: > > > > > > > A good place to start might be the POTS control program, which was > > > presented in the Erlang book, and also used (in a slightly different form) > > > in the Introductory Erlang course. > > > > > > I used it in my "Structured Network Programming" presentation to > > > show the consequences of different programming styles in multiway > > > signaling: > > > > > > http://www.erlang.se/euc/05/1500Wiger.ppt > > > > > > I'm not convinced that it will be sufficient to reveal significant differences > > > between the standard erlang style and channels, but it's a good place to > > > start, and the code can be expanded in a number of interesting ways. > > > > > > BR, > > > Ulf W > > > > > > (There's a working simulator to go with the program, but the OTP team > > > would have to give permission to release it in public. I'm sure you can > > > get your hands on it anyway.) > > > > > > Sorry about disappearing from the discussion for so long. > > > > I took a look at the POTS program in the Erlang book. It is actually > > easy to rewrite it to use neither channels nor selective receive. > > > > I also looked at the gen-server module. > > > > Detailed comments follow. (A non-selective receive is one that always > > pick the first message in the mailbox.) > > > > Sven-Olof > > > > > > > > The book's implementation of POTS only contains four receive > > expressions. Among these, only one (in the function make_call_to_B/3) > > is selective. > > You should also take a look at the presentation that I referred to. > > 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. > > The OHaskell example assumed that functions like start_tone() > were atomic and non-blocking - they are not. 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. 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)? > 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? Sven-Olof From rick.richardson@REDACTED Thu Jul 24 20:25:03 2008 From: rick.richardson@REDACTED (Rick R) Date: Thu, 24 Jul 2008 14:25:03 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <085601c8edb1$5d745b00$185d1100$@com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> Message-ID: <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> I second this. I have not yet gotten to the point in my project where I need this. But it is certainly a need looming out there on the horizon. With Yaws/Erlyweb/MochiWeb/etc becoming more prevalent and important. I could see this being a huge win for ajax/comet libraries. On Thu, Jul 24, 2008 at 1:19 PM, Jonathan Gray wrote: > Joe, > > It would certainly ease our integration. JSON is certainly becoming > ubiquitous and tighter integration with Erlang would be very useful. > > One note, in my current implementation and in general, there's no real > direct mapping for JSON objects/dictionaries. While Erlang does have > dicts, > we were never able to "create" them using erl_interface/ei, though I'm sure > it's possible by dissecting the dict representation. I use a {obj, > [{},{}]} > type representation now to handle JSON objects in Erlang. Any thoughts? > > +1 on new JSON BIFs :) Willing to help in any way I can. > > Jonathan Gray > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joe Armstrong > Sent: Thursday, July 24, 2008 3:49 AM > To: Martin Carlson > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] fast JSON parser in C > > Since JSON seem to be ubiquitous is seems to me that there would be > a strong case for a couple of new BIFs, term_to_json and json_to_term. > these would work like binary_to_term and term_to_binary the difference > being that > instead of converting to a binary containing the external term format, > we convert > to a binary containing a JSON encoded string. > > I imaging that modeling this code on the existing term_to_binary and > binary_to_term > code would not be impossibly difficult (you have to make it reentrant > and not to > not hog the CPU for too long ... and so on ...) > > And yes - it is pretty horrid increasing the number of BIFs but this > might just be > a useful addition. > > This would ease seamless integration with a lot of external programs :-) > > /Joe Armstrong > > On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson > wrote: > > You might want to go with the ei interface rather than the erl_interface > > since it is not as clumsy to use. Further, you might want to have a look > > at the ejabberd expat driver and just replace the expat stuff with your > > json SAX events. > > > > -Martin > > > > Chris Anderson wrote: > >> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray > wrote: > >>> However when I get a big chunk (around 80-120K) directly from Erlang as > >>> binary (using term_to_binary in erlang), I'm unable to decode it using > >>> erl_interface erl_decode, though it can be decoded fine from within > Erlang. > >> > >> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not > >> need help from C. I'm just working on making the JSON -> Erlang fast > >> enough, so as long as I can get string buffers over to C in the first > >> place, it sounds like you're not having a problem moving data from C > >> back to Erlang. > >> > >> Time to buckle down and code! > >> > > > > _______________________________________________ > > 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 > -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu Jul 24 22:09:41 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 24 Jul 2008 22:09:41 +0200 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: References: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> <8209f740807240703l75612f05gd4038f13d312624a@mail.gmail.com> Message-ID: <8209f740807241309sfe9c472mb0e6298c2abc6310@mail.gmail.com> As far as I know there are no docs on the locker implementation in mnesia, but I do recall some tricky bugs in this area. For one thing, the locker also handles the deadlock prevention logic, so it must keep track of dependencies to some extent. You can read the code and try to form your own opinion, but before you start trying to extend this part of mnesia, possibly introducing deadlock bugs in your application, you should carefully measure the performance of the existing locking solutions: record locks, sticky locks and table locks. You should also write a wrapper and see if it gives you the kind of performance improvement you're after. If it doesn't, you may be able to come up with some really nifty extension of mnesia_locker through deep meditation over the code. The next challenge, after ensuring that it's stable, would then be to try to get it accepted as an official extension to mnesia - otherwise, you'll be stuck maintaining your own mnesia patches, and that's no fun (been there, done that). Table locks can be surprisingly efficient, esp if you don't mix record and table locks too much. I'd advice some experimentation down that alley first. BR, Ulf W BR, Ulf W 2008/7/24 devdoer bird : > > > > 2008/7/24, Ulf Wiger : >> >> If you are to gain any performance compared to a wrapper, or using >> only table locks, you must do brain surgery on mnesia_locker. I >> strongly advise against that. The relationship between record locks >> and table locks is quite intricate. > > > Yes.I want to gain some performance to lock part of the table. > What's the intricate part of the locking system design?Can you give any docs > about the design of the mensia table-lock and record lock? >> >> BR, >> Ulf W >> >> 2008/7/24, devdoer bird : >> > The example I give is not good.,but I just need hack the mnesia lock :(. >> > >> > I want to lock part of the table and which part is controled by the >> > record's >> > key's value range .Currently mnesia only support record lock and table >> > lock. >> > >> > >> > 2008/7/24, Ulf Wiger : >> >> >> >> I don't think you should hack mnesia for that. A simple wrapper >> >> function will do nicely. >> >> >> >> BR, >> >> Ulf W >> >> >> >> 2008/7/23, devdoer bird : >> >> > HI: >> >> > >> >> > I want to extend mnesia 's lock to add this function >> >> > "mnesia:lock(LockItem,LockType,ConditionFun)" . >> >> > >> >> > This function works in this way: If a table 's record passes the >> >> > ConditionFun test,the the record is locked. >> >> > >> >> > Eg. >> >> > I have a user table with the record: -record(user,{name,age}). >> >> > >> >> > I want to lock the user's whose name begines with 'a' ,I can code >> >> > using >> >> my >> >> > customized " mnesia:lock(LockItem,LockType,ConditionFun)" >> >> > >> >> > like this: >> >> > >> >> > ConditionFun=fun(U)-> >> >> > if >> >> > U#user.name=='a' -> true; >> >> > true->false >> >> > end >> >> > end >> >> > mnesia:lock(user,write,ConditionFun). >> >> > >> >> > that is I want to lock part of the table. >> >> > >> >> > Have anyone done this before? How shall I extend the mensia lock? Any >> >> > information will be helpful, I 'm quite unfamiliar with mnesia lock >> >> > system. >> >> > >> >> >> > > > From ulf@REDACTED Thu Jul 24 22:28:49 2008 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 24 Jul 2008 22:28:49 +0200 Subject: [erlang-questions] Ideas for a new Erlang In-Reply-To: <18568.51420.797833.139618@harpo.it.uu.se> 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> Message-ID: <8209f740807241328j1f1d153bl2934cfba16cdaa60@mail.gmail.com> 2008/7/24 Sven-Olof Nystr|m : > Ulf Wiger writes: > > > > You should also take a look at the presentation that I referred to. > > > > 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. > > > > The OHaskell example assumed that functions like start_tone() > > were atomic and non-blocking - they are not. > > 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. > 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. > > 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. 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. BR, Ulf W From bob@REDACTED Thu Jul 24 22:43:22 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 24 Jul 2008 13:43:22 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> References: <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> Message-ID: <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> There are pretty decent pure Erlang JSON libraries available. They're pretty fast, relatively speaking, and they certainly don't crash the Erlang interpreter ;) I would worry about C when you actually need to. 2008/7/24 Rick R : > I second this. I have not yet gotten to the point in my project where I need > this. But it is certainly a need looming out there on the horizon. With > Yaws/Erlyweb/MochiWeb/etc becoming more prevalent and important. I could see > this being a huge win for ajax/comet libraries. > > On Thu, Jul 24, 2008 at 1:19 PM, Jonathan Gray wrote: >> >> Joe, >> >> It would certainly ease our integration. JSON is certainly becoming >> ubiquitous and tighter integration with Erlang would be very useful. >> >> One note, in my current implementation and in general, there's no real >> direct mapping for JSON objects/dictionaries. While Erlang does have >> dicts, >> we were never able to "create" them using erl_interface/ei, though I'm >> sure >> it's possible by dissecting the dict representation. I use a {obj, >> [{},{}]} >> type representation now to handle JSON objects in Erlang. Any thoughts? >> >> +1 on new JSON BIFs :) Willing to help in any way I can. >> >> Jonathan Gray >> >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joe Armstrong >> Sent: Thursday, July 24, 2008 3:49 AM >> To: Martin Carlson >> Cc: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] fast JSON parser in C >> >> Since JSON seem to be ubiquitous is seems to me that there would be >> a strong case for a couple of new BIFs, term_to_json and json_to_term. >> these would work like binary_to_term and term_to_binary the difference >> being that >> instead of converting to a binary containing the external term format, >> we convert >> to a binary containing a JSON encoded string. >> >> I imaging that modeling this code on the existing term_to_binary and >> binary_to_term >> code would not be impossibly difficult (you have to make it reentrant >> and not to >> not hog the CPU for too long ... and so on ...) >> >> And yes - it is pretty horrid increasing the number of BIFs but this >> might just be >> a useful addition. >> >> This would ease seamless integration with a lot of external programs :-) >> >> /Joe Armstrong >> >> On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson >> wrote: >> > You might want to go with the ei interface rather than the erl_interface >> > since it is not as clumsy to use. Further, you might want to have a look >> > at the ejabberd expat driver and just replace the expat stuff with your >> > json SAX events. >> > >> > -Martin >> > >> > Chris Anderson wrote: >> >> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray >> >> wrote: >> >>> However when I get a big chunk (around 80-120K) directly from Erlang >> >>> as >> >>> binary (using term_to_binary in erlang), I'm unable to decode it using >> >>> erl_interface erl_decode, though it can be decoded fine from within >> Erlang. >> >> >> >> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not >> >> need help from C. I'm just working on making the JSON -> Erlang fast >> >> enough, so as long as I can get string buffers over to C in the first >> >> place, it sounds like you're not having a problem moving data from C >> >> back to Erlang. >> >> >> >> Time to buckle down and code! >> >> >> > >> > _______________________________________________ >> > 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 > > > > -- > An idea that is not dangerous is unworthy of being called an idea at all. -- > Oscar Wilde > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From twoggle@REDACTED Thu Jul 24 23:46:29 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 24 Jul 2008 14:46:29 -0700 (PDT) Subject: [erlang-questions] how: info on how to traverse abstract format trees? In-Reply-To: <183192.87774.qm@web38801.mail.mud.yahoo.com> References: <183192.87774.qm@web38801.mail.mud.yahoo.com> Message-ID: > Personally, I've always tended to write my own, among other things because the > appropriate traversal differs depending on what you want to do. Sure, but for the case where you just want to rewrite a particular function call a full parse transform seems a bit too much. > It is not really documented but you cam "see" it when you know what to look for. Do you mean that your modified version is somewhere in the Erlang distribution, or am I misunderstanding you? From jchris@REDACTED Thu Jul 24 23:53:05 2008 From: jchris@REDACTED (Chris Anderson) Date: Thu, 24 Jul 2008 17:53:05 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> References: <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> Message-ID: On Thu, Jul 24, 2008 at 4:43 PM, Bob Ippolito wrote: > There are pretty decent pure Erlang JSON libraries available. They're > pretty fast, relatively speaking, and they certainly don't crash the > Erlang interpreter ;) I would worry about C when you actually need to. I researched some into the C way of doing things, and wasn't sure how much overhead the ei communication would consume. Currently I'm working on a leex/yecc parser for JSON. The output format is quite flexible, so for now I'm just building it to pass the CouchDB cjson test_suite. Once it is working, it should be trivial to alter the format to fit an agreed-upon convention. I'll probably finish in the next day or two, and then I'll have an idea of whether using leex/yecc to generate Erlang provides a big speed boost. If it doesn't, at least I had fun! Joe's BIF idea does seem like the long-term solution. -- Chris Anderson http://jchris.mfdz.com From erlang@REDACTED Fri Jul 25 00:31:13 2008 From: erlang@REDACTED (Dominic Williams) Date: Fri, 25 Jul 2008 00:31:13 +0200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> Message-ID: <488902B1.80708@dominicwilliams.net> Hi Joe, Joe Armstrong wrote: > Since JSON seem to be ubiquitous is seems to me that > there would be a strong case for a couple of new BIFs, > term_to_json and json_to_term. I'm a great fan of your principle of removing something for everything you add to the language. What would you want to remove in exchange for JSON bifs? JSON doesn't seem ubiquitous to me, but maybe I haven't been getting out enough lately. Cheers, Dominic Williams http://dominicwilliams.net ---- From bob@REDACTED Fri Jul 25 00:56:24 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 24 Jul 2008 15:56:24 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> Message-ID: <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> On Thu, Jul 24, 2008 at 2:53 PM, Chris Anderson wrote: > On Thu, Jul 24, 2008 at 4:43 PM, Bob Ippolito wrote: >> There are pretty decent pure Erlang JSON libraries available. They're >> pretty fast, relatively speaking, and they certainly don't crash the >> Erlang interpreter ;) I would worry about C when you actually need to. > > I researched some into the C way of doing things, and wasn't sure how > much overhead the ei communication would consume. Currently I'm > working on a leex/yecc parser for JSON. The output format is quite > flexible, so for now I'm just building it to pass the CouchDB cjson > test_suite. Once it is working, it should be trivial to alter the > format to fit an agreed-upon convention. > > I'll probably finish in the next day or two, and then I'll have an > idea of whether using leex/yecc to generate Erlang provides a big > speed boost. If it doesn't, at least I had fun! > > Joe's BIF idea does seem like the long-term solution. I'd be curious to know if leex/yecc can do any better than mochijson2 (which is written by hand), especially considering that it uses binaries instead of strings. http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson2.erl -bob From jchris@REDACTED Fri Jul 25 02:50:10 2008 From: jchris@REDACTED (Chris Anderson) Date: Thu, 24 Jul 2008 20:50:10 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> References: <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> Message-ID: On Thu, Jul 24, 2008 at 6:56 PM, Bob Ippolito wrote: > I'd be curious to know if leex/yecc can do any better than mochijson2 > (which is written by hand), especially considering that it uses > binaries instead of strings. The version of mochijson2 that is in CouchDB's trunk (not in use) is about twice as fast as cjson - which is used by CouchDB currently. After spending a day writing my own leex/yecc parser, it turns out to be about 3 times slower than cjson, and about 6 times slower than mochijson2. I could probably optimize the grammar definition to try to make it faster. I was hoping that the magic of parser-generators would give me a big jump on the hand-crafted code. Since it didn't, I don't plan to pursue it any further. If anyone wants to see the leex/yaac code, I can put it online. -- Chris Anderson http://jchris.mfdz.com From rvirding@REDACTED Fri Jul 25 02:58:01 2008 From: rvirding@REDACTED (Robert Virding) Date: Fri, 25 Jul 2008 02:58:01 +0200 Subject: [erlang-questions] how: info on how to traverse abstract format trees? In-Reply-To: References: <183192.87774.qm@web38801.mail.mud.yahoo.com> Message-ID: <3dbc6d1c0807241758j2f12f86fnb79dbd1540faba31@mail.gmail.com> 2008/7/24 Tim Fletcher : > > Personally, I've always tended to write my own, among other things > because the > > appropriate traversal differs depending on what you want to do. > > Sure, but for the case where you just want to rewrite a particular > function call a full parse transform seems a bit too much. Perhaps, but then feeping creaturism usually ensures you want to more soon. :-) > > It is not really documented but you cam "see" it when you know what to > look for. > > Do you mean that your modified version is somewhere in the Erlang > distribution, or am I misunderstanding you? No, it's not in the distribution. I will send it to anyone who is interested. What I meant that there is no extra documentation describing the different styles, but that you can see it if you are looking for it. It is quite trivial really. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Jul 25 04:16:16 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jul 2008 14:16:16 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> Message-ID: <1BC24F16-8D46-4791-9000-D33218E5CF55@cs.otago.ac.nz> On 24 Jul 2008, at 10:49 pm, Joe Armstrong wrote: > Since JSON seem to be ubiquitous is seems to me that there would be > a strong case for a couple of new BIFs, term_to_json and > json_to_term. I've written this up as an EEP and posted it to the eeps mailing list. Joe, when it turns up at the EEPs site, could you have a really good look at it and see if it fits what you meant? If not, maybe you could write a better EEP. Basically, erlang:term_to_json(Term[, Options]) is seen as a device for generating JSON to be consumed by programs in other languages (such as Javascript and Perl), and erlang:json_to_term(Io_List[, Options]) is seen as a device for accepting JSON produced by such programs. In writing my EEP, I cared about JSON->term->JSON round trip consistency, but not about term->JSON->term. > -- If stupidity were a crime, who'd 'scape hanging? From ok@REDACTED Fri Jul 25 05:12:47 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jul 2008 15:12:47 +1200 Subject: [erlang-questions] comment on my erlang Spamfilter In-Reply-To: References: Message-ID: Lev Walkin has already commented on this. I'm just going to cover a few points he omitted. On 24 Jul 2008, at 10:58 pm, hask ellian wrote: > take(N,List) -> i_take(N,List,0,[]). > i_take(N,List,Count,Acc) -> > if Count < N andalso List /= [] -> > i_take(N,tl(List),Count+1,Acc++[hd(List)]); > Count == N -> > Acc; > true -> > [] > end. (1) Where is the comment saying what this does? (2) It is a bad idea to use 'andalso' or 'orelse' in guards; the current compiler generates MUCH worse code for them than the classic ',' and ';'. (3) You wouldn't use head, tail, and not null in Haskell, so why do it in Erlang? (4) Indenting the auxiliary function is something I used to do back when I first learned Prolog. Lawrence Byrd commented wryly, "You really miss Algol, don't you?" I learned not to do that, because Prolog predicates don't nest, and NEITHER DO ERLANG FUNCTIONS. (Funs, yes. Named functions, no.) To use indentation when there is no actual nesting is misleading. (5) Jamming two function definitions together with no blank lines between makes them hard to read. (6) Oh yeah, you would count DOWN in Haskell, not up. Erlang is no different. Let's fix all those and see what we get. % take(N, List) -> Prefix % return the first N elements of List, if it has % at least that many, or all of it if it is shorter. % Error if N < 0 or List is not a list. take(N, List) when integer(N), N >= 0 -> take_loop(N, List). take_loop(N, [X|Xs]) when N > 0 -> [X | take_loop(N-1, Xs)]; take_loop(_, _) -> []. Drat. In rewriting it to use pattern matching, I accidentally fixed a serious performance bug. In Erlang, as in Haskell, List ++ [Element] is expensive; it copies all of List. Your code took O(N**2) time; the replacement is O(N). As Lev Walkin noted, you should familiarise yourself with the documentation of the 'lists' module. An even better implementation is take(N, List) -> lists:sublist(List, N). -- I actually think 'sublist' is a lousy name and that -- 'take' is a better one. But if you use the library -- function, other people will be more likely to understand -- you (and it's documented and tested already). > > > count(Tok,List) -> i_count(Tok,List,0). > i_count(Tok,List,Acc) -> > if Tok == hd(List) andalso List /= [] -> > i_count(Tok,tl(List),Acc+1); > Tok /= hd(List) andalso List /= [] -> > i_count(Tok,tl(List),Acc); > true -> > Acc > end. Same issues. Generally, if you see an 'if', it should either have been a 'case' or a function. This would be % count(Item, List) -> Count % count the number of elements of List which equal Item. count(Item, List) -> count_loop(Item, List, 0). count_loop(Item, [Item|Xs], N) -> count_loop(Item, Xs, N+1); count_loop(Item, [_|Xs], N) -> count_loop(Item, Xs, N); count_loop(_, [], N) -> N. This corresponds exactly to the Haskell count item list = count_loop item list 0 count_loop item (x:xs) n | x == item = count_loop item xs (n+1) count_loop item (_:xs) n = count_loop item xs n count_loop _ [] n = n As Lev Walkin notes, length([X | X <- List, X == Item]) would be short and simple. Erlang doesn't do deforestation (yet), so this would be more expensive than using your own function here. However, we soon learn that you really do not want to do this at all. > > > count_all(List) -> > Unique = lists:usort(List), > [{U, count(U, List)} || U <- Unique]. This takes O(N**2) time when O(N.lgN) is possible. Not a good idea. What you want to do is to sort the list WITHOUT removing duplicates, then count up the blocks. count_all(List) -> count_all_blocks(lists:sort(List)). count_all_blocks([]) -> []; count_all_blocks([X|Xs]) -> count_rest_of_block(X, Xs, 1). count_rest_of_block(X, [Y|Ys], N) when Y =< X -> count_rest_of_block(X, Ys, N+1); count_rest_of_block(X, Xs, N) -> [{X,N} | count_all_blocks(Xs)]. The sorting phase is still O(N.lgN), but now the gathering and counting phase is O(N) instead of O(N**2). > > > count_set_in_list(Set,List) -> > S = [{S, count(S, List)} || S <- Set], > lists:sum(lists:map(fun({H,T}) -> T end, S)). Why isn't this just count_set_in_list(Set, List) -> lists:sum([count(S, List) || S <- Set]). What is the point of wrapping {S, _} around the counts when the next thing you do is to throw that part away? Once again, this is an O(N**2) implementation of an operation that can be done in O(N.lgN) time. More precisely, if Set and List are sorted, it can be done in O(|Set|+|Length|) time; if they are not sorted, you have to sort them first. There are library modules ordsets, gb_sets, gb_trees, and dict that might be of use to you instead. > > > most_common(Stringlist,Xmost) -> > No_preps = lists:filter(fun(X) -> length(X) > 4 end, Stringlist), > Sorted_by_count = lists:keysort(2, count_all(No_preps)), > TakeX = take(Xmost, lists:reverse(Sorted_by_count)), > lists:map(fun({H,T}) -> H end, TakeX). If you want to collect the K "biggest" things out of N, or of course the K "smallest", that can be done in O(N.lg K) time. You are doing it in O(N.lg N). Probably not worth bothering about that. Actually, there are linear expected time algorithms for finding the Kth biggest element, and then you can use an O(N) pass to find everything that big or bigger, and then O(K.lg K) to sort those, if you really want to, so O(N+K.lg K). That might be worth having. > readfile(FileName) -> > {ok, Binary} = file:read_file(FileName), > string:tokens(binary_to_list(Binary), " "). > > classify() -> > GoodWords = most_common(readfile("C:/Users/saftarn/Desktop/ > emails/okemails.txt"), 20), > BadWords = most_common(readfile("C:/Users/saftarn/Desktop/ > emails/spam.txt"), 20), > GoodCount = count_set_in_list(GoodWords, readfile("C:/Users/ > saftarn/Desktop/emails/test.txt")), > BadCount = count_set_in_list(BadWords, readfile("C:/Users/ > saftarn/Desktop/emails/test.txt")), > T = BadCount + GoodCount, > if T /= 0 -> > BadCount / T; > true -> > 0.5 > end. Something went wonky with the indentation of your 'if'. You have two different concerns mixed up in your classify() function: (A) where are my files? (B) what do I want to calculate? Split them. classify_lists(Test_List, Good_List, Bad_List) -> Good_Count = count_set_in_list(most_common(Good_List, 20), Test_List), Bad_Count = count_set_in_list(most_common(Bad_List, 20), Test_List), case Good_Count + Bad_Count of 0 -> 0.5 ; T -> Bad_Count / T end. classify_files(Test_File, Good_File, Bad_File) -> classify_lists(readfile(Test_File), readfile(Good_File), readfile(Bad_File)). classify() -> D = "C:/Users/saftarn/Desktop/emails/"), classify_files(D ++ "test.txt", D ++ "okemails.txt", D ++ "spam.txt"). In making this change, I also fixed the performance bug where you read the test data twice. We now notice a repeated pattern, which might as well be split out: probe_count(Word_List, Base_List) -> count_set_in_list(most_common(Word_List, 20), Base_List). Now we can think about improving THIS function instead of the individual bits that it is made of. And the thought occurs at once: why read, sort, and pick the cream of *ALL* the good words and *ALL* the bad words *EVERY* time you want to classify a message? Why not just STORE the top 20 good words and the top 20 bad words, and keep them around? I'm also a little confused about where these word lists come from in the first place. If you are just extracting words from email messages, you are like to find that the top few words in BOTH lists will be something like [the,and,a]. Oddly enough, I recently had my first misclassification of an e-mail message because of something not unlike this. The message was information from the University about medical research funding that was available from the l-*-t-t-*-r-y. You can guess why it was misclassified. From drwho102003-erlang@REDACTED Fri Jul 25 04:17:43 2008 From: drwho102003-erlang@REDACTED (Eric Ho) Date: Thu, 24 Jul 2008 19:17:43 -0700 (PDT) Subject: [erlang-questions] can mnesia be made to become something like BigTable or SimpleDB ? In-Reply-To: Message-ID: <775753.75611.qm@web31807.mail.mud.yahoo.com> So, this is the plan going forward for Mnesia ? i.e. Mnesia will layer on top of CouchDB and Erlang programmers will get all the benefits of BigTable without having to learn more stuff other than what they already know with Mnesia ?? That would be really cool if that's the case.? It'll hide all the operational complexities from the programmers. -eric --- On Mon, 7/21/08, devdoer bird wrote: From: devdoer bird Subject: Re: [erlang-questions] can mnesia be made to become something like BigTable or SimpleDB ? To: drwho102003-erlang@REDACTED Cc: erlang-questions@REDACTED Date: Monday, July 21, 2008, 2:32 AM Do you see CouchDB? 2008/7/21, Eric Ho : Are there any plans heading in that direction ? Thanks. -eric _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Jul 25 05:33:03 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jul 2008 15:33:03 +1200 Subject: [erlang-questions] comment on my erlang Spamfilter In-Reply-To: References: Message-ID: On 25 Jul 2008, at 2:18 am, James Hague wrote: > readfile(FileName) -> > {ok, Binary} = file:read_file(FileName), > string:tokens(binary_to_list(Binary), " "). > > Were I writing this, I wouldn't have called string:tokens at all, but > directly looped through Binary looking for words. I guess another comment is appropriate. "What's a word?" (This takes most of a 2-hour lecture in our information retrieval paper!) This is not going to identify "The" with "the". It is going to take "time-to-live" as one word. It is not going to realise that "these, and those" contains the word "these". (It's going to think that the first word is "these,".) The obvious thing is to run some separate program that splits a document into words, and writes them out one per line, but of course string:tokens("foo\nbar\n", " ") is going to think the whole string is one token. Oh, and let's consider a popular device used by spammers. Let us suppose that Erlang is a "naughty word". They might write it as "3r1ang" and rely on the human eye to read what they meant. The simplest definition of a "word", that works much of the time, is a sequence of letters and apostrophes such that each apostrophe has a letter on each side. (This will be confused by "3r1ang"; I did say it works "much of the time", not "all the time".) I would be inclined to do - breaking documents into words - converting them to lower case - removing words in a stop list of maybe 100 words - MAYBE stemming using Porter's algorithm (if it's English you are interested in, find something else for other languages) - sorting-and-counting in an outboard program, because this is high(er) volume stuff. I'd then hack on the results in Erlang. -- If stupidity were a crime, who'd 'scape hanging? From rick.richardson@REDACTED Fri Jul 25 05:33:49 2008 From: rick.richardson@REDACTED (Rick R) Date: Thu, 24 Jul 2008 23:33:49 -0400 Subject: [erlang-questions] can mnesia be made to become something like BigTable or SimpleDB ? In-Reply-To: <775753.75611.qm@web31807.mail.mud.yahoo.com> References: <775753.75611.qm@web31807.mail.mud.yahoo.com> Message-ID: <9810b81b0807242033o7dc1886ft22f5712f44817403@mail.gmail.com> Scalaris (recently mentioned here) handles the data partitioning, distribution, replication and location. The only remaining step would be to modify it so that you could submit map/reduce style functions to be distributed to each data node to execute on each data partition. That sounds like a piece of cake in Erlang. 2008/7/24 Eric Ho > So, this is the plan going forward for Mnesia ? > i.e. Mnesia will layer on top of CouchDB and Erlang programmers will get > all the benefits of BigTable without having to learn more stuff other than > what they already know with Mnesia ? That would be really cool if that's > the case. It'll hide all the operational complexities from the programmers. > > > -eric > > --- On *Mon, 7/21/08, devdoer bird * wrote: > > From: devdoer bird > Subject: Re: [erlang-questions] can mnesia be made to become something like > BigTable or SimpleDB ? > To: drwho102003-erlang@REDACTED > Cc: erlang-questions@REDACTED > Date: Monday, July 21, 2008, 2:32 AM > > > Do you see CouchDB? > > 2008/7/21, Eric Ho : >> >> Are there any plans heading in that direction ? >> >> Thanks. >> >> -eric >> _______________________________________________ >> 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 > -- An idea that is not dangerous is unworthy of being called an idea at all. -- Oscar Wilde -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Jul 25 05:55:27 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jul 2008 15:55:27 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> References: <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> Message-ID: <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> On 25 Jul 2008, at 10:56 am, Bob Ippolito wrote: > I'd be curious to know if leex/yecc can do any better than mochijson2 > (which is written by hand), especially considering that it uses > binaries instead of strings. > > http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson2.erl I've printed that to study over the weekend. Thing is, it doesn't have to be *better*. It could even *be* the mochijson2 code. Part of what Joe was getting at, I think, is that it would be nice if JSON support were a standard part of Erlang/OTP in *some* fashion. That way everyone who wants to use JSON builds (for export) and sees (from import) the same kind of Erlang data. From a quick glance at the that code, I believe that a BIF *could* be usefully faster. Whether it is worth putting the effort into it is another matter. There are also some interface issues; I would value your comments on my EEP. -- If stupidity were a crime, who'd 'scape hanging? From jchris@REDACTED Fri Jul 25 06:20:10 2008 From: jchris@REDACTED (Chris Anderson) Date: Fri, 25 Jul 2008 00:20:10 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> References: <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> Message-ID: Richard, Thanks for taking up the charge on this JSON stuff. I agree that interface, rather than speed, is what we should be thinking about now. We can always speed it up later. I posted to the couchdb-dev mailing list with a summary of some of the format opinions I'd found in various discussions. This might be helpful for the EEP. http://mail-archives.apache.org/mod_mbox/incubator-couchdb-dev/200807.mbox/%3ce282921e0807200924k256685f6r4b5651219f16d7b5@REDACTED%3e Chris On Thu, Jul 24, 2008 at 11:55 PM, Richard A. O'Keefe wrote: > On 25 Jul 2008, at 10:56 am, Bob Ippolito wrote: >> >> I'd be curious to know if leex/yecc can do any better than mochijson2 >> (which is written by hand), especially considering that it uses >> binaries instead of strings. >> >> http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson2.erl > > I've printed that to study over the weekend. > > Thing is, it doesn't have to be *better*. It could even *be* > the mochijson2 code. Part of what Joe was getting at, I think, > is that it would be nice if JSON support were a standard part > of Erlang/OTP in *some* fashion. That way everyone who wants > to use JSON builds (for export) and sees (from import) the same > kind of Erlang data. > > From a quick glance at the that code, I believe that a BIF *could* > be usefully faster. Whether it is worth putting the effort into it > is another matter. There are also some interface issues; I would > value your comments on my EEP. > > -- > If stupidity were a crime, who'd 'scape hanging? > > > > > > > > -- Chris Anderson http://jchris.mfdz.com From ok@REDACTED Fri Jul 25 06:42:32 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jul 2008 16:42:32 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> Message-ID: <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> On 25 Jul 2008, at 4:20 pm, Chris Anderson wrote: > http://mail-archives.apache.org/mod_mbox/incubator-couchdb-dev/200807.mbox/%3ce282921e0807200924k256685f6r4b5651219f16d7b5@REDACTED%3e OK, the biggest question I see there is what to do about "objects". It seemed intuitively obvious to me (is there a common abbreviation for this (:-)?) that it would be really nice if a JSON "object" had an Erlang representation that an Erlang programmer would normally use for that kind of stuff. So I expect {"foo":1, "bar":2} to become [{foo,1},{bar,2}] -- though there is a "security" option in the EEP to force [{<<"foo">>,1},{<<"bar">>,2}] and the only major question in my mind was whether it should be sorted, so that you can give one to orddict. I see Joe recommends using a tuple, which has several merits: - all "objects" turn into the same kind of Erlang term (my proposal turns "{}" into {} but other objects into lists) - the brackets are the same in JSON and Erlang, always - I have to leave in a few minutes, you can think of others It also has some downsides: - you can't pass it to orddict, but then, it would not be beyond human power to write an ordtuple module to do orddict-ish things - it's hard to process in other ways, although my EEP about allowing [Expr || Pattern {<-} Tuple] would make it _look_ easier. - it's just not what Erlang programmers normally use. - others I'm sure you can think of. An interesting design problem. -- If stupidity were a crime, who'd 'scape hanging? From jim@REDACTED Fri Jul 25 10:15:27 2008 From: jim@REDACTED (Jim Larson) Date: Fri, 25 Jul 2008 01:15:27 -0700 Subject: [erlang-questions] [eeps] Joe Armstrong's suggestion for JSON<->Erlang BIFs In-Reply-To: Your message of "Fri, 25 Jul 2008 14:13:17 +1200." <87B91711-F378-4A2B-BE43-75D388A354E6@cs.otago.ac.nz> Message-ID: <200807250815.m6P8FRTF084549@krumkake.jetcafe.org> Richard, Thanks for the great work on the JSON EEPS proposal! Robert Chu and I wrote the first public Erlang library for JSON (released thanks to A2Z Development, "an Amazon.com Company"), later the basis for the parser in Yaws, and inspiration for dozens of other independently-developed libraries whose authors must have thought "I can do better than _this_!" With that dubious introduction, let me offer some feedback. In message <87B91711-F378-4A2B-BE43-75D388A354E6@REDACTED> you write: >Specification > > Four new functions are added to the erlang: module. > > erlang:json_to_term(Io_List) -> term() > erlang:json_to_term(Io_List, Option_List) -> term() This is assuming some sort of framing of the Io_List to limit it to a single JSON term. Since JSON is mostly self-framing (everything but numbers declare their own ends), and since at least one historical JSON-based transport took advantage of this (JSON-RPC 1.0 over raw TCP), is there any interest in a flavor of the parser that allows continuations of unparsed input? For example, our parsing interface was: decode(Continuation, CharList) => {done, Term, LeftoverChars} or {more, Continuation} > The {binary,true} option says to convert all JSON strings > to Erlang binaries, even if they are keys in key:value pairs. > The {binary,false} option says to convert keys to atoms if > possible; it is the default. I assume that the JSON strings will be turned into binaries according to their wire format, i.e. according to the 'encoding' setting above. > erlang:term_to_json(Term) -> binary() > erlang:term_to_json(Term, Option_List) -> Binary() Unless the self-framing property of JSON is used in the transport, the JSON term will have to be embedded in some sort of framing protocol. Might it give useful freedom to the implementation to have term_to_json return an iodata() (which subsumes the option of returning a single binary) to avoid unneeded data copies in the output pipeline? (Also more symmetric with json_to_term.) > Converting JSON to Erlang. > > [...] > > A string is converted to a UTF-8-encoded binary, > except where it occurs as a label in an "object". Just to make it explicit, you should probably spell out that the empty string becomes a zero-length binary, and vice-versa for the opposite conversion. > Converting Erlang to JSON. > > The atoms null, false, and true are converted to the > corresponding JSON keywords. No other Erlang atoms are > allowed. ...except for object list keys. > An Erlang integer is converted to a JSON integer. > An Erlang float is converted to a JSON float, as precisely > as practical. If the Erlang float has no fractional part, should it get a token ".0" padding? Or maybe just a bare decimal point? >Rationale > > [...] > > Clearly, Erlang->JSON->Erlang is going to be tricky. To take > just one minor point, neither www.json.org nor RFC 4627 makes > an promises whatever about the range of numbers that can be > passed through JSON. There isn't even any minimum range. It > seems as though a JSON implementation could reject all numbers > other than 0 as too large and still conform! This is stupid. > We can PROBABLY rely on IEEE doubles; we almost certainly cannot > expect to get large integers through JSON. Well, this seems to be an issue for those in the business of designing data formats based on JSON, I don't think it's an issue for writing a parser in Erlang, and I see no need for Erlang to hold itself back from exploiting its built-in bignums. There are potential round-tripping problems for the path: Erlang->JSON->RandomOtherJsonProcessingChain->JSON->Erlang not only from big integers, but also from the size of strings, number of elements in a sequence, nesting depth, total size of input, etc. I don't think there's much to be gained from doing any more than sweeping these under a "quality of implementation" rug and moving on... > No, the point of JSON support in Erlang is to let Erlang programs > deal with the JSON data that other people are sending around the > net, and to send JSON data to other programs (like scripts in Web > browsers) that are expecting plain old JSON. The round trip > conversion we need to care about is JSON -> Erlang -> JSON. The E-J-E round-trip shouldn't be ignored in the design and implementation, though. When I wrote the unit tests for the A2Z library, it was easiest to test the E-J-E round-tripping - with a special equivalence test that ignored reordering of members within an object list. It's hard to even specify what the semantic equivalence of JSON strings even means without translating to a high-level representation - such as Erlang terms. You could also define semantic round-tripping via string equality of J2 and J3 in J1 -> E1 -> J2 -> E2 -> J3 where J1 is an arbitrary JSON string. > The main thing I have not accounted for is the {binary,true} > option of json_to_term/2. For normal Erlang purposes, it is > much nicer (and somewhat more efficient) to deal with > > [{name,<<"fred">>},{female,false},{age,65}] > > than with > > [{<<"name">>,<<"fred">>},{<<"female">>,false},{<<"age">>,65}] > > If you are communicating with a trusted source that deals with > a known small number of labels, fine. There are limits on the > number of atoms Erlang can deal with. A small test program > that looped creating atoms and putting them into a list ticked > over happily until shortly after its millionth atom, and then > hung there burning cycles apparently getting nowhere. Also, > the atom table is shared by all processes on an Erlang node, > so garbage collecting it is not as cheap as it might be. As > a system integrity measure, therefore, it is useful to have a > mode of operation in which json_to_term never creates atoms. > Whether the default behaviour should be "safe" or "readable" > really depends on whether you intend to accept JSON from untrusted > sources or not. I've chosen the default to be what I would want > to use most of the time, but this is after all only a proposal. There's another option. The list_to_existing_atom(String) builtin returns the atom whose text representation is String, but only if there already exists such atom (i.e. it's already interned), raising badarg otherwise. So with existing mechanisms we could have options {object_label, binary} {object_label, atom} {object_label, existing_atom} % otherwise binary Since a loading an application interns the atoms in its source code, applications wouldn't have to do anything special (except perhaps during code upgrades) to expect their JSON input to be in the nicer term format. Labels that are expected in the data, but not explicitly handled by the application, could get an explicit nod in the source code to enjoy the more efficient translation. ballast_labels() -> [rare_flag, unused_option, ignored_field]. Unexpected (or un-internable) labels would remain in binaries. Hope the feedback is useful. Jim From devdoer2@REDACTED Fri Jul 25 12:04:12 2008 From: devdoer2@REDACTED (devdoer bird) Date: Fri, 25 Jul 2008 18:04:12 +0800 Subject: [erlang-questions] How to extend mensia lock to support conditionally lock? In-Reply-To: <8209f740807241309sfe9c472mb0e6298c2abc6310@mail.gmail.com> References: <8209f740807240419n50b3a95wff447ea80e522a00@mail.gmail.com> <8209f740807240703l75612f05gd4038f13d312624a@mail.gmail.com> <8209f740807241309sfe9c472mb0e6298c2abc6310@mail.gmail.com> Message-ID: 2008/7/25, Ulf Wiger : > > As far as I know there are no docs on the locker implementation > in mnesia, but I do recall some tricky bugs in this area. For > one thing, the locker also handles the deadlock prevention > logic, so it must keep track of dependencies to some extent. > > You can read the code and try to form your own opinion, > but before you start trying to extend this part of mnesia, > possibly introducing deadlock bugs in your application, > you should carefully measure the performance of the > existing locking solutions: record locks, sticky locks > and table locks. You should also write a wrapper and see > if it gives you the kind of performance improvement you're > after. If it doesn't, you may be able to come up with some > really nifty extension of mnesia_locker through deep > meditation over the code. The next challenge, after ensuring > that it's stable, would then be to try to get it accepted as > an official extension to mnesia - otherwise, you'll be stuck > maintaining your own mnesia patches, and that's no fun > (been there, done that). > > Table locks can be surprisingly efficient, esp if you don't > mix record and table locks too much. I'd advice some > experimentation down that alley first. Thanks! I'll do some experiement first . BR, > Ulf W > > BR, > Ulf W > > 2008/7/24 devdoer bird : > > > > > > > > 2008/7/24, Ulf Wiger : > >> > >> If you are to gain any performance compared to a wrapper, or using > >> only table locks, you must do brain surgery on mnesia_locker. I > >> strongly advise against that. The relationship between record locks > >> and table locks is quite intricate. > > > > > > Yes.I want to gain some performance to lock part of the table. > > What's the intricate part of the locking system design?Can you give any > docs > > about the design of the mensia table-lock and record lock? > >> > >> BR, > >> Ulf W > >> > >> 2008/7/24, devdoer bird : > >> > The example I give is not good.,but I just need hack the mnesia lock > :(. > >> > > >> > I want to lock part of the table and which part is controled by the > >> > record's > >> > key's value range .Currently mnesia only support record lock and > table > >> > lock. > >> > > >> > > >> > 2008/7/24, Ulf Wiger : > >> >> > >> >> I don't think you should hack mnesia for that. A simple wrapper > >> >> function will do nicely. > >> >> > >> >> BR, > >> >> Ulf W > >> >> > >> >> 2008/7/23, devdoer bird : > >> >> > HI: > >> >> > > >> >> > I want to extend mnesia 's lock to add this function > >> >> > "mnesia:lock(LockItem,LockType,ConditionFun)" . > >> >> > > >> >> > This function works in this way: If a table 's record passes the > >> >> > ConditionFun test,the the record is locked. > >> >> > > >> >> > Eg. > >> >> > I have a user table with the record: -record(user,{name,age}). > >> >> > > >> >> > I want to lock the user's whose name begines with 'a' ,I can code > >> >> > using > >> >> my > >> >> > customized " mnesia:lock(LockItem,LockType,ConditionFun)" > >> >> > > >> >> > like this: > >> >> > > >> >> > ConditionFun=fun(U)-> > >> >> > if > >> >> > U#user.name=='a' -> true; > >> >> > true->false > >> >> > end > >> >> > end > >> >> > mnesia:lock(user,write,ConditionFun). > >> >> > > >> >> > that is I want to lock part of the table. > >> >> > > >> >> > Have anyone done this before? How shall I extend the mensia lock? > Any > >> >> > information will be helpful, I 'm quite unfamiliar with mnesia > lock > >> >> > system. > >> >> > > >> >> > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saleyn@REDACTED Fri Jul 25 13:12:31 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 25 Jul 2008 07:12:31 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> Message-ID: <4889B51F.8000207@gmail.com> Perhaps a little generalization would save us from having to add more BIFs like binary_to_* and *_to_binary in the future: proto_to_binary(Term, [{codec, Codec}]) -> binary() binary_to_proto(Bin::binary(), [{codec, Codec}]) -> Term Codec = json | Other Also, this is not specific to the thread, but while on this subject, I don't quite understand why JavaScript Object Notation (JSON) is so heavily demanding double quoting everything in contrast to the JavaScript Object Notation built into all browsers. What I mean is that the javascript interpreters built into browsers happily understand this notion of an object: {foo: 1, bar: "value"} or {foo: 1, bar: 'value'} whereas in JSON this would require to be written as: {"foo": 1, "bar": "value"} The first form seems more natural for an Erlang programmer, and if JSON BIF parser is included in the OTP, perhaps a customization to support this variant of the format would be a worthwhile addition as most frequently JSON is used for interaction with browsers that happily accept the first, more compact, form. Serge Joe Armstrong wrote: > Since JSON seem to be ubiquitous is seems to me that there would be > a strong case for a couple of new BIFs, term_to_json and json_to_term. > these would work like binary_to_term and term_to_binary the difference > being that > instead of converting to a binary containing the external term format, > we convert > to a binary containing a JSON encoded string. > > I imaging that modeling this code on the existing term_to_binary and > binary_to_term > code would not be impossibly difficult (you have to make it reentrant > and not to > not hog the CPU for too long ... and so on ...) > > And yes - it is pretty horrid increasing the number of BIFs but this > might just be > a useful addition. > > This would ease seamless integration with a lot of external programs :-) > > /Joe Armstrong > > On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson > wrote: >> You might want to go with the ei interface rather than the erl_interface >> since it is not as clumsy to use. Further, you might want to have a look >> at the ejabberd expat driver and just replace the expat stuff with your >> json SAX events. >> >> -Martin >> >> Chris Anderson wrote: >>> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray wrote: >>>> However when I get a big chunk (around 80-120K) directly from Erlang as >>>> binary (using term_to_binary in erlang), I'm unable to decode it using >>>> erl_interface erl_decode, though it can be decoded fine from within Erlang. >>> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not >>> need help from C. I'm just working on making the JSON -> Erlang fast >>> enough, so as long as I can get string buffers over to C in the first >>> place, it sounds like you're not having a problem moving data from C >>> back to Erlang. >>> >>> Time to buckle down and code! >>> >> _______________________________________________ >> 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 andreas.hillqvist@REDACTED Fri Jul 25 16:15:57 2008 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Fri, 25 Jul 2008 16:15:57 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Is_there_a_Erlang_User_Group_in?= =?iso-8859-1?q?_Gothenburg/G=F6teborg=3F?= Message-ID: <8268eea30807250715m55f28410yd8e9244451ea960b@mail.gmail.com> Hi. I wonder if there is a Erlang User Group in Gothenburg that I can join? If not if there are people interested in joining our group, when we start on? Kind regards Andreas Hillqvist From bob@REDACTED Fri Jul 25 16:55:32 2008 From: bob@REDACTED (Bob Ippolito) Date: Fri, 25 Jul 2008 07:55:32 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <4889B51F.8000207@gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <4889B51F.8000207@gmail.com> Message-ID: <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> On Fri, Jul 25, 2008 at 4:12 AM, Serge Aleynikov wrote: > > Also, this is not specific to the thread, but while on this subject, I > don't quite understand why JavaScript Object Notation (JSON) is so > heavily demanding double quoting everything in contrast to the > JavaScript Object Notation built into all browsers. What I mean is that > the javascript interpreters built into browsers happily understand this > notion of an object: > > {foo: 1, bar: "value"} > or > {foo: 1, bar: 'value'} > > > whereas in JSON this would require to be written as: > > {"foo": 1, "bar": "value"} ... because it is a lot simpler and easier to write correct implementations if you remove extraneous features. Ease of interoperability is more important than aesthetic or compactness. If you want something convenient for humans you should implement YAML, but good luck writing a correct parser for that in a reasonable amount of time ;) > The first form seems more natural for an Erlang programmer, and if JSON > BIF parser is included in the OTP, perhaps a customization to support > this variant of the format would be a worthwhile addition as most > frequently JSON is used for interaction with browsers that happily > accept the first, more compact, form. That's just a bad idea. If you intend to do that, don't call it JSON because it's not. Not every JSON client is a JavaScript interpreter using eval(). Actually mochijson/mochijson2 isn't even used at Mochi Media to speak directly to a browser (outside of some internal tools), it's used to communicate with other spec JSON implementations (e.g. in ActionScript 2, ActionScript 3, or Python). -bob From jchris@REDACTED Fri Jul 25 17:38:01 2008 From: jchris@REDACTED (Chris Anderson) Date: Fri, 25 Jul 2008 11:38:01 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> References: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> Message-ID: On Fri, Jul 25, 2008 at 12:42 AM, Richard A. O'Keefe wrote: > > So I expect > {"foo":1, "bar":2} > to become > [{foo,1},{bar,2}] > -- though there is a "security" option in the EEP to force > [{<<"foo">>,1},{<<"bar">>,2}] > and the only major question in my mind was whether it should be sorted, > so that you can give one to orddict. Joe mentioned not using atoms as keys due to the atom table not being GC'd. The other consideration is making it unambigious between JSON arrays and JSON objects. {{"foo",1},{"bar",2}}, or even {[{"foo",1},{"bar",2}]} is unambiguous, whereas [{"foo",1},{"bar",2}] requires deeper inspection to differentiate it from a JSON array, if those were encoded as for instance: ["foo","bar",1] It make sense to me to encode JSON arrays as Erlang lists, for the sake of simplicity. I agree that [{"foo",1},{"bar",2}] is easier to work with than the pure tuple version, which makes me lean toward using the outer wrapping {} as a marker for object-ness. That is, I think {[{"foo",1},{"bar",2}]} is both unambiguous and easy to work with. In this case, the empty JSON object {} is encoded as {[]}. As far as sorting goes, I'd think it would be better not to automatically reorder, as the user can do that if necessary, and while the JSON spec doesn't preserve order, at least a few of the JS interpreters do (including Spidermonkey, used by CouchDB). I don't know if anyone is leaning on that feature yet, but it seems potentially useful. Chris -- Chris Anderson http://jchris.mfdz.com From sten@REDACTED Fri Jul 25 17:57:01 2008 From: sten@REDACTED (Sten Kvamme) Date: Fri, 25 Jul 2008 17:57:01 +0200 Subject: [erlang-questions] Reducing size of source Message-ID: <952C4393-5DA2-49A4-9E70-846D5FFC485A@kvamme.se> Hi, Are there some simple guidelines to follow if one wants to shoehorn the source otp_src_R12B-3 in for compilation on an Arm EABI embedded system? The size is 142 MB and I would probably need to get it down to 40-50 MB. I will use the CEAN contribution script. /Stine -------------- next part -------------- An HTML attachment was scrubbed... URL: From berlin.brown@REDACTED Fri Jul 25 18:14:06 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Fri, 25 Jul 2008 09:14:06 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) Message-ID: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> Maybe this is already implemented, but I wish there were some kind of "last_value" built in function where you can get the last value without having to define it yourself. Has this been talked about a lot already. E.g. this is from the erlang docs as a "best" practice. NewQ = queue:new(), Queue1 = queue:add(joe, NewQ), Queue2 = queue:add(mike, Queue1), ... When I am coding, I end up forgetting to define Q1, Q2 NewQ = queue:new(), queue:add(joe, NewQ), queue:add(mike, NewQ), ... Logic error!!! I wish there were something like this to get the result of the last call queue:new(), queue:add(joe, erlang:last_value()), queue:add(mike, erlang:last_value())), ... From doug.mansell@REDACTED Fri Jul 25 18:31:12 2008 From: doug.mansell@REDACTED (doug mansell) Date: Fri, 25 Jul 2008 18:31:12 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> Message-ID: On Fri, Jul 25, 2008 at 6:14 PM, Berlin Brown wrote: > When I am coding, I end up forgetting to define Q1, Q2 > > NewQ = queue:new(), > queue:add(joe, NewQ), > queue:add(mike, NewQ), ... > > Logic error!!! > > I wish there were something like this to get the result of the last > call > > queue:new(), > queue:add(joe, erlang:last_value()), > queue:add(mike, erlang:last_value())), ... What's the order of evaluation of function call arguments? if it's left to right... last_value in these calls to queue:add/2 would be 'joe' and 'mike' - not what you expected... You don't have to bind everything to a variable, you could write like this: queue:add(mike, queue:add(joe, queue:new())) You'll get the hang of it. :) From tonyg@REDACTED Fri Jul 25 18:36:45 2008 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Fri, 25 Jul 2008 17:36:45 +0100 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> Message-ID: <488A011D.2010107@lshift.net> Berlin Brown wrote: > NewQ = queue:new(), > Queue1 = queue:add(joe, NewQ), > Queue2 = queue:add(mike, Queue1), ... > > queue:new(), > queue:add(joe, erlang:last_value()), > queue:add(mike, erlang:last_value())), ... %% Untested. %% Use curried operations and a Haskell-like sequencing operator %% to provide a kind of dataflow/pipeline style. add(Elt) -> fun (Q) -> queue:add(Elt, Q) end. seq(X, []) -> X; seq(X, [F | Fs]) -> seq(F(X), Fs). test() -> seq(queue:new(), [add(joe), add(mike)]). %% Quite major language (and library!) changes would be needed to %% make this feel properly natural. %% Tony From berlin.brown@REDACTED Fri Jul 25 18:53:03 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Fri, 25 Jul 2008 09:53:03 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <488A011D.2010107@lshift.net> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> Message-ID: On Jul 25, 12:36 pm, Tony Garnock-Jones wrote: > Berlin Brown wrote: > > NewQ = queue:new(), > > Queue1 = queue:add(joe, NewQ), > > Queue2 = queue:add(mike, Queue1), ... > > > queue:new(), > > queue:add(joe, erlang:last_value()), > > queue:add(mike, erlang:last_value())), ... > > %% Untested. > %% Use curried operations and a Haskell-like sequencing operator > %% to provide a kind of dataflow/pipeline style. > > add(Elt) -> fun (Q) -> queue:add(Elt, Q) end. > > seq(X, []) -> X; > seq(X, [F | Fs]) -> seq(F(X), Fs). > > test() -> > seq(queue:new(), > [add(joe), > add(mike)]). > > %% Quite major language (and library!) changes would be needed to > %% make this feel properly natural. > > %% Tony > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions These are great, but they look like hacks to me. From bob@REDACTED Fri Jul 25 19:21:54 2008 From: bob@REDACTED (Bob Ippolito) Date: Fri, 25 Jul 2008 10:21:54 -0700 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> Message-ID: <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> On Fri, Jul 25, 2008 at 9:53 AM, Berlin Brown wrote: > > > On Jul 25, 12:36 pm, Tony Garnock-Jones wrote: >> Berlin Brown wrote: >> > NewQ = queue:new(), >> > Queue1 = queue:add(joe, NewQ), >> > Queue2 = queue:add(mike, Queue1), ... >> >> > queue:new(), >> > queue:add(joe, erlang:last_value()), >> > queue:add(mike, erlang:last_value())), ... >> >> %% Untested. >> %% Use curried operations and a Haskell-like sequencing operator >> %% to provide a kind of dataflow/pipeline style. >> >> add(Elt) -> fun (Q) -> queue:add(Elt, Q) end. >> >> seq(X, []) -> X; >> seq(X, [F | Fs]) -> seq(F(X), Fs). >> >> test() -> >> seq(queue:new(), >> [add(joe), >> add(mike)]). >> >> %% Quite major language (and library!) changes would be needed to >> %% make this feel properly natural. >> >> %% Tony >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > These are great, but they look like hacks to me. And an equivalent to Perl's $_ doesn't? -bob From james.hague@REDACTED Fri Jul 25 19:33:39 2008 From: james.hague@REDACTED (James Hague) Date: Fri, 25 Jul 2008 12:33:39 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> Message-ID: > And an equivalent to Perl's $_ Or there could be a prefix, like an asterisk, that means "fresh symbol." For example: *A = something() *A = something_else() Need to decide what this means: [A, *A | T] = something() From patrickdlogan@REDACTED Fri Jul 25 19:41:06 2008 From: patrickdlogan@REDACTED (Patrick Logan) Date: Fri, 25 Jul 2008 10:41:06 -0700 Subject: [erlang-questions] fast JSON parser in C Message-ID: "As far as sorting goes, I'd think it would be better not to automatically reorder, as the user can do that if necessary, and while the JSON spec doesn't preserve order, at least a few of the JS interpreters do (including Spidermonkey, used by CouchDB). I don't know if anyone is leaning on that feature yet, but it seems potentially useful." I'm not sure what is meant by "preserve order" in regard to the JSON spec. The spec only documents an interchange format. In JSON there is no concept of "preservation" of _anything_ because JSON does not describe "changes" of anything over time. A JSON formatted sequence of characters is "a one tiime thing". If this is intended to mean... json -> erlang -> json results in a json sequence of characters describing a json object whose members occur in the same sequence as the sequence found in the json input, then that seems more expensive than necessary. Hopefully no one in any language implementation is relying on that at an interoperability level. If you want to preserve order, that is exactly what the json array is for. -Patrick From hydo@REDACTED Fri Jul 25 16:52:18 2008 From: hydo@REDACTED (Clint Moore) Date: Fri, 25 Jul 2008 07:52:18 -0700 Subject: [erlang-questions] Request for interest: Seattle/Tacoma Erlang Users Group In-Reply-To: <8268eea30807250715m55f28410yd8e9244451ea960b@mail.gmail.com> References: <8268eea30807250715m55f28410yd8e9244451ea960b@mail.gmail.com> Message-ID: The title pretty much says it all. There is the Seattle FP group, but I wonder if there is enough interest in an Erlang specific group? Let me know if you are interested and maybe we can get something started. -cm From hydo@REDACTED Fri Jul 25 17:26:38 2008 From: hydo@REDACTED (Clint Moore) Date: Fri, 25 Jul 2008 08:26:38 -0700 Subject: [erlang-questions] Request for Interest: Seattle/Tacoma WA Erlang Users Group Message-ID: The title pretty much says it all. There is the Seattle FP group, but I wonder if there is enough interest in an Erlang specific group? Let me know if you are interested and maybe we can get something started. -cm From aconbere@REDACTED Fri Jul 25 20:53:45 2008 From: aconbere@REDACTED (anders conbere) Date: Fri, 25 Jul 2008 11:53:45 -0700 Subject: [erlang-questions] Request for Interest: Seattle/Tacoma WA Erlang Users Group In-Reply-To: References: Message-ID: <8ca3fbe80807251153q530f15d2lfba381bb7448c85@mail.gmail.com> On Fri, Jul 25, 2008 at 8:26 AM, Clint Moore wrote: > > The title pretty much says it all. There is the Seattle FP group, > but I wonder if there is enough interest in an Erlang specific group? > Let me know if you are interested and maybe we can get something > started. I haven't made it to the FP Group, but I would at the very least be interested in a break out at the next meeting to talk a bit about what people are doing. ~ Anders > > -cm > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From zerthurd@REDACTED Fri Jul 25 20:58:36 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Fri, 25 Jul 2008 22:58:36 +0400 Subject: [erlang-questions] megaco:test_digit_event/2 unexpected behaviour Message-ID: Hello I find some strange behaviour of megaco:test_digit_event/2 Digit map, like "([0-9ef])", match with following numbers: "0ef", "1ef", "2ef", ..., "9ef" but it must match with numbers: "0", "1", "2", ..., "9", "e", "f" Is this bug or not? Thank you -- Maxim Treskin From jchris@REDACTED Fri Jul 25 21:17:29 2008 From: jchris@REDACTED (Chris Anderson) Date: Fri, 25 Jul 2008 15:17:29 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: Message-ID: On Fri, Jul 25, 2008 at 1:41 PM, Patrick Logan wrote: > I'm not sure what is meant by "preserve order" in regard to the JSON > spec. > If this is intended to mean... > > json -> erlang -> json > > results in a json sequence of characters describing a json object > whose members occur in the same sequence as the sequence found in the > json input, then that seems more expensive than necessary. I was just pointing out that in terms of current implementation, CouchDB does exactly that - eg. it goes above and beyond the JSON spec (without extra expense, this is just a side-effect of how its parser works). All other things being equal, it'd be nice to maintain this "feature". But it's not necessary, if it imposes expense. -- Chris Anderson http://jchris.mfdz.com From thomasl_erlang@REDACTED Fri Jul 25 21:35:26 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 25 Jul 2008 12:35:26 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> Message-ID: <256396.440.qm@web38805.mail.mud.yahoo.com> --- On Fri, 7/25/08, Berlin Brown wrote: > I wish there were something like this to get the result of > the last call > > queue:new(), > queue:add(joe, erlang:last_value()), > queue:add(mike, erlang:last_value())), ... It's probably better to get more familiar with functional programming, which instead of updating state passes around values. How about this? lists:foldl( fun(X, Last_value) -> queue:add(X, Last_value) end, queue:new(), [joe, mike]). Best, Thomas From berlin.brown@REDACTED Fri Jul 25 21:36:24 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Fri, 25 Jul 2008 12:36:24 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> Message-ID: <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> On Jul 25, 1:33?pm, "James Hague" wrote: > > And an equivalent to Perl's $_ > > Or there could be a prefix, like an asterisk, that means "fresh > symbol." ?For example: > > *A = something() > *A = something_else() > > Need to decide what this means: > > [A, *A | T] = something() > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions "Or there could be a prefix, like an asterisk, that means "fresh symbol." For example: *A = something() *A = something_else()" Yea, but that tends to work against the immutability feature of erlang? I was merely suggesting just return or duplicate the last value returned from the call stack. You aren't changing any process/state variables, but essentially getting whatever is returned from the last operation which saves some keystrokes and might avoid some common Erlang bugs. I don't know Perl, but $_ sounds like the operation. If you have worked with stack languages, I was considering a variation of the 'dup' operation, duplicate the last value on the stack. NewQ = queue:new(), queue:add(joe, erlang:pop_call_stack), Queue2 = queue:add(mike, erlang:pop_call_stack), ... From berlin.brown@REDACTED Fri Jul 25 21:44:16 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Fri, 25 Jul 2008 12:44:16 -0700 (PDT) Subject: [erlang-questions] Metro Atlanta Erlang Users Group... In-Reply-To: <2781f020807240827i14d95710m8d3ced296d84122c@mail.gmail.com> References: <2781f020807240827i14d95710m8d3ced296d84122c@mail.gmail.com> Message-ID: <9385cc84-acae-4318-94bc-77e29e703631@a70g2000hsh.googlegroups.com> On Jul 24, 11:27?am, "Joseph Stewart" wrote: > This is a fledgling group to hopefully get some of us together for Erlang > experience and advocacy.http://groups.google.com/group/maeug > > (only two members so far, no meetings held yet... spread the word if you're > in the area) > > Thanks > > -joe > > If it ain't broke, break it. How else are you going to figure out how it > works? > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions I am interested, I left a note. Also, I think we should merge. Lisp, Haskell, Erlang, Scala, Factor, whatever else From dbt@REDACTED Fri Jul 25 22:00:16 2008 From: dbt@REDACTED (David Terrell) Date: Fri, 25 Jul 2008 15:00:16 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <256396.440.qm@web38805.mail.mud.yahoo.com> References: <256396.440.qm@web38805.mail.mud.yahoo.com> Message-ID: <488A30D0.2060506@meat.net> Thomas Lindgren wrote: > --- On Fri, 7/25/08, Berlin Brown wrote: >> I wish there were something like this to get the result of >> the last call >> >> queue:new(), >> queue:add(joe, erlang:last_value()), >> queue:add(mike, erlang:last_value())), ... > > It's probably better to get more familiar with functional programming, which instead of updating state passes around values. > > How about this? > > lists:foldl( > fun(X, Last_value) -> queue:add(X, Last_value) end, > queue:new(), > [joe, mike]). > 8> lists:foldl(fun queue:in/2, queue:new(), [joe, mike]). {[mike],[joe]} From stondage123@REDACTED Fri Jul 25 21:43:06 2008 From: stondage123@REDACTED (Andrew Stone) Date: Fri, 25 Jul 2008 12:43:06 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) Message-ID: <723452.72658.qm@web35901.mail.mud.yahoo.com> IMO this appears a bit dangerous. It seems like the OP is simply trying to get around Single-Assignment. I don't see any need for it personally. -Andrew ----- Original Message ---- From: James Hague To: erlang-questions@REDACTED Sent: Friday, July 25, 2008 1:33:39 PM Subject: Re: [erlang-questions] Simple Erlang Recommendation (last returned value) > And an equivalent to Perl's $_ Or there could be a prefix, like an asterisk, that means "fresh symbol." For example: *A = something() *A = something_else() Need to decide what this means: [A, *A | T] = something() _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From daveb@REDACTED Fri Jul 25 22:53:08 2008 From: daveb@REDACTED (Dave Bryson) Date: Fri, 25 Jul 2008 15:53:08 -0500 Subject: [erlang-questions] First look at Scalaris on OS X Message-ID: If you're interested in Scalaris but haven't had the chance to fire it up yet, I've posted a few screen shots and some instructions on what it took for me to build it on Mac OS X 10.5. http://weblog.miceda.org/2008/07/25/first-look-at-scalaris-on-os-x-105/ Dave From taronish@REDACTED Fri Jul 25 22:58:44 2008 From: taronish@REDACTED (Paul M) Date: Fri, 25 Jul 2008 13:58:44 -0700 Subject: [erlang-questions] Support for HiPE on OS X Intel Message-ID: <5FD1AA6E-5B51-452F-954B-A65F8EA1B59F@gmail.com> Hello everybody, There is some code in the erlang source distribution to support HiPE for OS X Intel, but it looks like it is currently broken. Also, it requires some (mac-specific) external files to build, and from browsing the mailing list archives, I see that the HiPE folks don't use macs and so don't have the facilities to test it or maintain it. I've spent a little bit of time looking into the current mac-related problems, and I've come to the conclusion that the mechanism used to patch sigaction() (namely, mach_override) is a bit esoteric. I think it could be fixed and replaced with a more conventional mechanism (in short, building a shared library and setting an environment variable to cause that dylib to be loaded at launch time), but I'm not sure if this is the kind of change that the team would want to incorporate or even how to submit a patch, since I haven't seen a repository that can be checked out or anything. I'm also not aware of the recent bus errors introduced as of OS X 10.5.3 are the only issues with HiPE on the Mac. I apologize if any of this has been covered already - I spent some time searching the archives and didn't see anything applicable. Thanks! Paul From greg.burri@REDACTED Sat Jul 26 00:00:13 2008 From: greg.burri@REDACTED (Greg Burri) Date: Sat, 26 Jul 2008 00:00:13 +0200 Subject: [erlang-questions] Copy of mnesia tables from a node to a another node without linkage Message-ID: <60ed8a460807251500l26aa5e11wc64c22900a19c8cd@mail.gmail.com> Hi everybody. I want to copy some tables from a node to an another and I want to keep the nodes independent. I have some data in production and I want to upgrade the modules in production but before that I have to make some preproduction tests with the production data (without destroying my production data :o]). This "how-to" : http://www.trapexit.org/Distributing_a_Mnesia_schema works great but obviously theses nodes are linked... I try to use mnesia:backup() in the production node and then mnesia:restore() to the preproduction node but it doesn't work. The saved data are linked to the first node. Does anyone have an idea about this ? TIA /Greg From alain.odea@REDACTED Sat Jul 26 00:02:34 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Fri, 25 Jul 2008 19:32:34 -0230 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <723452.72658.qm@web35901.mail.mud.yahoo.com> References: <723452.72658.qm@web35901.mail.mud.yahoo.com> Message-ID: Mutability is encapsulated in processes for a very good reason. I will strongly protest the introduction of mutable variables into Erlang. If you really want mutable state, spawn a process to manage it and send messages to it for the various actions. A process is very similar to an Object in that regard. This is how things like code:add_path/1 work. On 25-Jul-08, at 5:13 PM, Andrew Stone wrote: > IMO this appears a bit dangerous. It seems like the OP is simply > trying to get around Single-Assignment. I don't see any need for it > personally. > > -Andrew > > > > ----- Original Message ---- > From: James Hague > To: erlang-questions@REDACTED > Sent: Friday, July 25, 2008 1:33:39 PM > Subject: Re: [erlang-questions] Simple Erlang Recommendation (last > returned value) > >> And an equivalent to Perl's $_ > > Or there could be a prefix, like an asterisk, that means "fresh > symbol." For example: > > *A = something() > *A = something_else() > > Need to decide what this means: > > [A, *A | T] = something() > _______________________________________________ > 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 saleyn@REDACTED Sat Jul 26 03:48:33 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 25 Jul 2008 21:48:33 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> References: <066301c8ec58$52ca0e70$f85e2b50$@com> <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <4889B51F.8000207@gmail.com> <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> Message-ID: <488A8271.30005@gmail.com> Bob Ippolito wrote: > On Fri, Jul 25, 2008 at 4:12 AM, Serge Aleynikov wrote: >> Also, this is not specific to the thread, but while on this subject, I >> don't quite understand why JavaScript Object Notation (JSON) is so >> heavily demanding double quoting everything in contrast to the >> JavaScript Object Notation built into all browsers. What I mean is that >> the javascript interpreters built into browsers happily understand this >> notion of an object: >> >> {foo: 1, bar: "value"} >> or >> {foo: 1, bar: 'value'} >> >> >> whereas in JSON this would require to be written as: >> >> {"foo": 1, "bar": "value"} > > ... because it is a lot simpler and easier to write correct > implementations if you remove extraneous features. Ease of > interoperability is more important than aesthetic or compactness. If > you want something convenient for humans you should implement YAML, > but good luck writing a correct parser for that in a reasonable amount > of time ;) While generally your statement above is impeccable when it comes to "fancy" features, given the simplicity of this requirement, I don't see how removing double quotes from object properties would *significantly* complicate the parser. In fact, I have done this customization of the publicly available json.erl implementation and if I recall it only involved changes to a couple of lines of code to support this feature. Not sure about others but I do find this "variant of JSON" more convenient when it comes to debugging JavaScript in a browser (using Firebug debugger) as it is visually more compact and not taking as much of screen real estate. >> The first form seems more natural for an Erlang programmer, and if JSON >> BIF parser is included in the OTP, perhaps a customization to support >> this variant of the format would be a worthwhile addition as most >> frequently JSON is used for interaction with browsers that happily >> accept the first, more compact, form. > > That's just a bad idea. If you intend to do that, don't call it JSON > because it's not. > Not every JSON client is a JavaScript interpreter > using eval(). Perhaps using JSON name for the JSON protocol was a misnomer in the first place, as it has very little to do with JavaScript other than resembling its object notation? Serge From amandeepm@REDACTED Sat Jul 26 03:08:41 2008 From: amandeepm@REDACTED (Amandeep Midha) Date: Sat, 26 Jul 2008 06:38:41 +0530 Subject: [erlang-questions] How about a User Group in Chindia? In-Reply-To: Message-ID: <003801c8eebc$24f75370$4914120a@china.huawei.com> How about a Erlang user group formation in Shenzhen (China) or in Bangalore (India)? Interested people, please revert at amandeepm@REDACTED Regards, Amandeep www.linkedin.com/in/amidha -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Sat Jul 26 09:37:21 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sat, 26 Jul 2008 00:37:21 -0700 Subject: [erlang-questions] [eeps] Joe Armstrong's suggestion for JSON<->Erlang BIFs In-Reply-To: <200807250815.m6P8FRTF084549@krumkake.jetcafe.org> References: <87B91711-F378-4A2B-BE43-75D388A354E6@cs.otago.ac.nz> <200807250815.m6P8FRTF084549@krumkake.jetcafe.org> Message-ID: On Fri, Jul 25, 2008 at 1:15 AM, Jim Larson wrote: > If the Erlang float has no fractional part, should it get a token > ".0" padding? Or maybe just a bare decimal point? A bare decimal point is not valid JSON encoding. From schuett@REDACTED Sat Jul 26 10:42:45 2008 From: schuett@REDACTED (Thorsten Schuett) Date: Sat, 26 Jul 2008 10:42:45 +0200 Subject: [erlang-questions] First look at Scalaris on OS X In-Reply-To: References: Message-ID: <200807261042.45277.schuett@zib.de> On Friday 25 July 2008, Dave Bryson wrote: > If you're interested in Scalaris but haven't had the chance to fire it > up yet, I've posted a few screen shots and some instructions on what > it took for me to build it on Mac OS X 10.5. > > http://weblog.miceda.org/2008/07/25/first-look-at-scalaris-on-os-x-105/ Hi Dave, thanks for trying scalaris. I saw that you have problems with URLs as keys. Could you post the URL which crashed yaws so that we can fix the problem? I tried some URLs but it worked for me. Regarding your screenshots: On the RRD tabs you can watch various system parameters over time. The "RRD Messages" is currently disabled. But we will reenable it in the near future. There, you could see how many messages of which type were sent. We are very interested in knowing which kind of messages cause the most network traffic. The "RRD Status" is currently more useful. It tells you (from top to bottom) how many scalaris nodes are currently known, how many items/key-value pairs are stored in the system, how many items are stored per node on average, the standard deviation of the average load, the average size of the routing table, and the standard deviation of the average routing table size. Thanks, Thorsten From kostis@REDACTED Sat Jul 26 11:13:28 2008 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 26 Jul 2008 12:13:28 +0300 Subject: [erlang-questions] Support for HiPE on OS X Intel In-Reply-To: <5FD1AA6E-5B51-452F-954B-A65F8EA1B59F@gmail.com> References: <5FD1AA6E-5B51-452F-954B-A65F8EA1B59F@gmail.com> Message-ID: <488AEAB8.7030201@cs.ntua.gr> Paul M wrote: > Hello everybody, > > There is some code in the erlang source distribution to support HiPE > for OS X Intel, but it looks like it is currently broken. Also, it > requires some (mac-specific) external files to build, and from > browsing the mailing list archives, I see that the HiPE folks don't > use macs and so don't have the facilities to test it or maintain it. That's right. > I've spent a little bit of time looking into the current mac-related > problems, and I've come to the conclusion that the mechanism used to > patch sigaction() (namely, mach_override) is a bit esoteric. I think > it could be fixed and replaced with a more conventional mechanism (in > short, building a shared library and setting an environment variable > to cause that dylib to be loaded at launch time), but I'm not sure if > this is the kind of change that the team would want to incorporate or > even how to submit a patch, since I haven't seen a repository that can > be checked out or anything. Our CVS repository can be accessed by the command: cvs -d:pserver:guest@REDACTED:/hipe checkout otp It allows for read access only. We welcome any change that makes HiPE working and/or more robust in some platform. However, for the change to be included in the distribution, it will need to be reviewed by us. Kostis From bob@REDACTED Sat Jul 26 17:15:51 2008 From: bob@REDACTED (Bob Ippolito) Date: Sat, 26 Jul 2008 08:15:51 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <488A8271.30005@gmail.com> References: <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <4889B51F.8000207@gmail.com> <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> <488A8271.30005@gmail.com> Message-ID: <6a36e7290807260815m45bc4b3ag4c945201f9216378@mail.gmail.com> On Fri, Jul 25, 2008 at 6:48 PM, Serge Aleynikov wrote: > Bob Ippolito wrote: >> >> On Fri, Jul 25, 2008 at 4:12 AM, Serge Aleynikov wrote: >>> >>> Also, this is not specific to the thread, but while on this subject, I >>> don't quite understand why JavaScript Object Notation (JSON) is so >>> heavily demanding double quoting everything in contrast to the >>> JavaScript Object Notation built into all browsers. What I mean is that >>> the javascript interpreters built into browsers happily understand this >>> notion of an object: >>> >>> {foo: 1, bar: "value"} >>> or >>> {foo: 1, bar: 'value'} >>> >>> >>> whereas in JSON this would require to be written as: >>> >>> {"foo": 1, "bar": "value"} >> >> ... because it is a lot simpler and easier to write correct >> implementations if you remove extraneous features. Ease of >> interoperability is more important than aesthetic or compactness. If >> you want something convenient for humans you should implement YAML, >> but good luck writing a correct parser for that in a reasonable amount >> of time ;) > > While generally your statement above is impeccable when it comes to "fancy" > features, given the simplicity of this requirement, I don't see how removing > double quotes from object properties would *significantly* complicate the > parser. In fact, I have done this customization of the publicly available > json.erl implementation and if I recall it only involved changes to a couple > of lines of code to support this feature. You overestimate the abilities of many JSON library implementors :) > Not sure about others but I do find this "variant of JSON" more convenient > when it comes to debugging JavaScript in a browser (using Firebug debugger) > as it is visually more compact and not taking as much of screen real estate. With firebug you can just look at the objects themselves once they're evaluated. >>> The first form seems more natural for an Erlang programmer, and if JSON >>> BIF parser is included in the OTP, perhaps a customization to support >>> this variant of the format would be a worthwhile addition as most >>> frequently JSON is used for interaction with browsers that happily >>> accept the first, more compact, form. >> >> That's just a bad idea. If you intend to do that, don't call it JSON >> because it's not. >> Not every JSON client is a JavaScript interpreter >> using eval(). > > Perhaps using JSON name for the JSON protocol was a misnomer in the first > place, as it has very little to do with JavaScript other than resembling its > object notation? It's not any worse than the name JavaScript to begin with. -bob From james.hague@REDACTED Sat Jul 26 18:25:23 2008 From: james.hague@REDACTED (James Hague) Date: Sat, 26 Jul 2008 11:25:23 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> Message-ID: On Fri, Jul 25, 2008 at 2:36 PM, Berlin Brown wrote: > > Yea, but that tends to work against the immutability feature of > erlang? Not at all. Within a function, single-assignment is just a way of associating a symbolic name with a variable. No data being modified at all when you say: X = tl(L) Code like this following is fairly common in Erlang: X = tl(L), X2 = tl(X), X3 = tl(X2) Again, no data is being changed. They're just symbols representing values. And there no reason you couldn't say "I would like to use a fresh symbol with the same name as a previous symbol," like this: X = tl(L), *X = tl(X), *X = tl(X) It's exactly the same thing as the previous example. Previous values of X are not modified. In fact it would be easy to mechanically preprocess Erlang code to have the *X names automatically turned into distinct names. James From james.hague@REDACTED Sat Jul 26 18:25:58 2008 From: james.hague@REDACTED (James Hague) Date: Sat, 26 Jul 2008 11:25:58 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> Message-ID: > Not at all. Within a function, single-assignment is just a way of > associating a symbolic name with a variable. No data being modified > at all when you say: Should be "a way of associating a symbolic name with a VALUE." From vychodil.hynek@REDACTED Sat Jul 26 19:29:09 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sat, 26 Jul 2008 19:29:09 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> Message-ID: <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> On Sat, Jul 26, 2008 at 6:25 PM, James Hague wrote: > On Fri, Jul 25, 2008 at 2:36 PM, Berlin Brown > wrote: > > > > Yea, but that tends to work against the immutability feature of > > erlang? > > Not at all. Within a function, single-assignment is just a way of > associating a symbolic name with a variable. No data being modified > at all when you say: > > X = tl(L) > > Code like this following is fairly common in Erlang: > > X = tl(L), > X2 = tl(X), > X3 = tl(X2) > > Again, no data is being changed. They're just symbols representing > values. And there no reason you couldn't say "I would like to use a > fresh symbol with the same name as a previous symbol," like this: > > X = tl(L), > *X = tl(X), > *X = tl(X) > Imagine this: X = tl(L), ... many messy lines ... *X = tl(X), ... another many lines ... *X = tl(X), ... another many almost unreadable messy lines ... sensitive_usage(X), % <--- buggy X value observed here And my question is, where Value of X came from? It goes from L, but how long it take and how many errors you can do when you will investigate? It is reason why once variable assignment is in Erlang and why it is good think. One advice for you: Don't change well proved language until you worth know it. > It's exactly the same thing as the previous example. Previous values > of X are not modified. In fact it would be easy to mechanically > preprocess Erlang code to have the *X names automatically turned into > distinct names. > > James > _______________________________________________ > 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 saleyn@REDACTED Sat Jul 26 19:51:06 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 26 Jul 2008 13:51:06 -0400 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <6a36e7290807260815m45bc4b3ag4c945201f9216378@mail.gmail.com> References: <06e701c8ecd9$3e481970$bad84c50$@com> <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <4889B51F.8000207@gmail.com> <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> <488A8271.30005@gmail.com> <6a36e7290807260815m45bc4b3ag4c945201f9216378@mail.gmail.com> Message-ID: <488B640A.2060504@gmail.com> Bob Ippolito wrote: > On Fri, Jul 25, 2008 at 6:48 PM, Serge Aleynikov wrote: >> Not sure about others but I do find this "variant of JSON" more convenient >> when it comes to debugging JavaScript in a browser (using Firebug debugger) >> as it is visually more compact and not taking as much of screen real estate. > > With firebug you can just look at the objects themselves once they're evaluated. That is if JSON content coming to a web client is properly formed. During the development stage when a client fetches some JSON content read from the server's filesystem (say metadata descriptor of a dynamic grid object) it is not guaranteed to be properly formed. This is when inspecting "raw" JSON at the client-side's debugger comes in handy, and protocol succinctness brings value. >>>> The first form seems more natural for an Erlang programmer, and if JSON >>>> BIF parser is included in the OTP, perhaps a customization to support >>>> this variant of the format would be a worthwhile addition as most >>>> frequently JSON is used for interaction with browsers that happily >>>> accept the first, more compact, form. >>> That's just a bad idea. If you intend to do that, don't call it JSON >>> because it's not. >>> Not every JSON client is a JavaScript interpreter >>> using eval(). >> Perhaps using JSON name for the JSON protocol was a misnomer in the first >> place, as it has very little to do with JavaScript other than resembling its >> object notation? > > It's not any worse than the name JavaScript to begin with. At least Javascript Object specification came well before JSON and deserves a merit. Choosing JSON name for the protocol created a lot of confusion as many people think that it has much in common with Javascript Objects. Alas, the issue with double-quoting object keys has been discussed on the web quite a number of times... Serge From markkicks@REDACTED Sat Jul 26 21:37:55 2008 From: markkicks@REDACTED (mark) Date: Sat, 26 Jul 2008 12:37:55 -0700 Subject: [erlang-questions] error compiling R12B-3 Message-ID: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> I am getting this error on Fedora Core 9 x86_64, gcc version 4.3.1 obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function `my_sigaction': /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function `hipe_signal_init': /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:305: undefined reference to `INIT' obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function `my_sigaction': /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: undefined reference to `INIT' /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: undefined reference to `__next_sigaction' collect2: ld returned 1 exit status make[3]: *** [/tmp/otp_src_R12B-3/bin/x86_64-unknown-linux-gnu/beam.smp] Error 1 make[3]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/tmp/otp_src_R12B-3/erts' make: *** [emulator] Error 2 also when i did ./configure, i got this message at the end ********************************************************************* ********************** APPLICATIONS DISABLED ********************** ********************************************************************* jinterface : No Java compiler found ********************************************************************* From markkicks@REDACTED Sat Jul 26 21:54:11 2008 From: markkicks@REDACTED (mark) Date: Sat, 26 Jul 2008 12:54:11 -0700 Subject: [erlang-questions] error compiling R12B-3 In-Reply-To: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> Message-ID: <82fa9e310807261254y5b979d24m88fa474fdf6784cf@mail.gmail.com> http://www.erlang.org/pipermail/erlang-questions/2008-July/036380.html this fixed it ! thanks On Sat, Jul 26, 2008 at 12:37 PM, mark wrote: > I am getting this error on Fedora Core 9 x86_64, gcc version 4.3.1 > > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `hipe_signal_init': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:305: > undefined reference to `INIT' > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** [/tmp/otp_src_R12B-3/bin/x86_64-unknown-linux-gnu/beam.smp] Error 1 > make[3]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/tmp/otp_src_R12B-3/erts' > make: *** [emulator] Error 2 > > > > also when i did ./configure, i got this message at the end > > ********************************************************************* > ********************** APPLICATIONS DISABLED ********************** > ********************************************************************* > > jinterface : No Java compiler found > > ********************************************************************* > From tuncer.ayaz@REDACTED Sat Jul 26 22:00:00 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Sat, 26 Jul 2008 22:00:00 +0200 Subject: [erlang-questions] error compiling R12B-3 In-Reply-To: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> Message-ID: <4ac8254d0807261300y5b45d44bl70cbb29d30d6cf96@mail.gmail.com> On Sat, Jul 26, 2008 at 9:37 PM, mark wrote: > I am getting this error on Fedora Core 9 x86_64, gcc version 4.3.1 > > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `hipe_signal_init': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:305: > undefined reference to `INIT' > obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function > `my_sigaction': > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: > undefined reference to `INIT' > /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: > undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** [/tmp/otp_src_R12B-3/bin/x86_64-unknown-linux-gnu/beam.smp] Error 1 > make[3]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory `/tmp/otp_src_R12B-3/erts' > make: *** [emulator] Error 2 Hi Mark, you can either install the Erlang RPM available in F9 or take a look at the needed GLIBC version check changes as discussed in the latest thread about this topic here: http://www.erlang.org/pipermail/erlang-bugs/2008-June/000835.html > also when i did ./configure, i got this message at the end > > ********************************************************************* > ********************** APPLICATIONS DISABLED ********************** > ********************************************************************* > > jinterface : No Java compiler found This is ok as long as you do not want to use jinterface. It won't be available. If you want jinterface and use the F9 openjdk-jdk-6 javac instead of the sun-java javac I would be interested to know about your success/failure with the OpenJDK javac. The Fedora RPM source can be viewed here: http://cvs.fedoraproject.org/viewcvs/rpms/erlang/ Hope this helps. > ********************************************************************* > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tuncer.ayaz@REDACTED Sat Jul 26 22:05:06 2008 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Sat, 26 Jul 2008 22:05:06 +0200 Subject: [erlang-questions] error compiling R12B-3 In-Reply-To: <82fa9e310807261254y5b979d24m88fa474fdf6784cf@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> <82fa9e310807261254y5b979d24m88fa474fdf6784cf@mail.gmail.com> Message-ID: <4ac8254d0807261305w465f410yceb760b72b492c6@mail.gmail.com> 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. > On Sat, Jul 26, 2008 at 12:37 PM, mark wrote: >> I am getting this error on Fedora Core 9 x86_64, gcc version 4.3.1 >> >> obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `hipe_signal_init': >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:305: >> undefined reference to `INIT' >> obj/x86_64-unknown-linux-gnu/opt/smp/hipe_x86_signal.o: In function >> `my_sigaction': >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:220: >> undefined reference to `INIT' >> /tmp/otp_src_R12B-3/erts/emulator/hipe/hipe_x86_signal.c:230: >> undefined reference to `__next_sigaction' >> collect2: ld returned 1 exit status >> make[3]: *** [/tmp/otp_src_R12B-3/bin/x86_64-unknown-linux-gnu/beam.smp] Error 1 >> make[3]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory `/tmp/otp_src_R12B-3/erts/emulator' >> make[1]: *** [smp] Error 2 >> make[1]: Leaving directory `/tmp/otp_src_R12B-3/erts' >> make: *** [emulator] Error 2 >> >> >> >> also when i did ./configure, i got this message at the end >> >> ********************************************************************* >> ********************** APPLICATIONS DISABLED ********************** >> ********************************************************************* >> >> jinterface : No Java compiler found >> >> ********************************************************************* >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From markkicks@REDACTED Sat Jul 26 22:14:12 2008 From: markkicks@REDACTED (mark) Date: Sat, 26 Jul 2008 13:14:12 -0700 Subject: [erlang-questions] error compiling R12B-3 In-Reply-To: <4ac8254d0807261300y5b45d44bl70cbb29d30d6cf96@mail.gmail.com> References: <82fa9e310807261237s6128e3b7pc7712a5185b812ea@mail.gmail.com> <4ac8254d0807261300y5b45d44bl70cbb29d30d6cf96@mail.gmail.com> Message-ID: <82fa9e310807261314h3d61d46fh6214a1ea58f84a64@mail.gmail.com> On Sat, Jul 26, 2008 at 1:00 PM, Tuncer Ayaz wrote: > On Sat, Jul 26, 2008 at 9:37 PM, mark wrote: > http://www.erlang.org/pipermail/erlang-bugs/2008-June/000835.html thanks a lot!! >> also when i did ./configure, i got this message at the end >> >> ********************************************************************* >> ********************** APPLICATIONS DISABLED ********************** >> ********************************************************************* >> >> jinterface : No Java compiler found > > This is ok as long as you do not want to use jinterface. It won't be available. > If you want jinterface and use the F9 openjdk-jdk-6 javac instead of > the sun-java javac I would be interested to know about your success/failure > with the OpenJDK javac. i dont need this right now, if i try it with javac i ll let you know! thanks again! From attila.rajmund.nohl@REDACTED Sat Jul 26 22:19:07 2008 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Sat, 26 Jul 2008 22:19:07 +0200 (CEST) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> Message-ID: On Sat, 26 Jul 2008, Hynek Vychodil wrote: [...] > Imagine this: > > X = tl(L), > ... many messy lines ... > *X = tl(X), > ... another many lines ... > *X = tl(X), > ... another many almost unreadable messy lines ... > sensitive_usage(X), % <--- buggy X value observed here > > And my question is, where Value of X came from? It goes from L, but how long > it take and how many errors you can do when you will investigate? Pretty easy with the right tools. However, check this example: The original code looks like this: X = tl(L), % many messy lines using X X2 = tl(X) and should be changed to this: X = tl(L), % many messy lines using X X2 = tl(X), % many messy lines using X2 X3 = tl(X2) but the coder ends up with this: X = tl(L), % many messy lines using X X2 = tl(X), % somewhere the coder updated X to X2, so the compiler won't save us X3 = tl(X) % this one place the coder forgot to update X to X2 I don't know other IDEs, but vim can highlight a single variable and its uses in a function, so it's pretty straightforward to find where the value of X comes. On the other hand, catching this bug is harder. Actually at one place I saw "X8" in the code... > It is reason why once variable assignment is in Erlang and why it is good > think. One advice for you: Don't change well proved language until you worth > know it. In my opinion this feature leads to the most unreadable erlang code, exactly because I can't see the flow of operations on the same data, because each operation has to change the variable name. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From james.hague@REDACTED Sat Jul 26 23:17:10 2008 From: james.hague@REDACTED (James Hague) Date: Sat, 26 Jul 2008 16:17:10 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> Message-ID: > Imagine this: > > X = tl(L), > ... many messy lines ... > *X = tl(X), > ... another many lines ... > *X = tl(X), > ... another many almost unreadable messy lines ... > sensitive_usage(X), % <--- buggy X value observed here > > And my question is, where Value of X came from? It goes from L, but how long > it take and how many errors you can do when you will investigate? It's just as bad when there's code like this: T2 = something(T), T3 = something(T2), T4 = something(T3), T5 = something(T4), T6 = something(T5) You may laugh at that code, but it's hardly uncommon, even in code written by experienced programmers. It's very easy to accidentally use T4 in a spot when you meant T3, or to have to renumber things and make a mistake. Please note that I am not arguing for changes in Erlang. I truly am not. But I can understand why this request comes up regularly. James From alain.odea@REDACTED Sun Jul 27 00:54:55 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Sat, 26 Jul 2008 20:24:55 -0230 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> Message-ID: <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> On 26-Jul-08, at 6:47 PM, James Hague wrote: >> Imagine this: >> >> X = tl(L), >> ... many messy lines ... >> *X = tl(X), >> ... another many lines ... >> *X = tl(X), >> ... another many almost unreadable messy lines ... >> sensitive_usage(X), % <--- buggy X value observed here >> >> And my question is, where Value of X came from? It goes from L, but >> how long >> it take and how many errors you can do when you will investigate? > > It's just as bad when there's code like this: > > T2 = something(T), > T3 = something(T2), > T4 = something(T3), > T5 = something(T4), > T6 = something(T5) > > You may laugh at that code, but it's hardly uncommon, even in code > written by experienced programmers. It's very easy to accidentally > use T4 in a spot when you meant T3, or to have to renumber things and > make a mistake. > > Please note that I am not arguing for changes in Erlang. I truly am > not. But I can understand why this request comes up regularly. > > James Erlang should not introduce mutable variables because they make it easy to disguise a variety of code smells as clean code. Code like James' example is code that does not express its intentions clearly. The fact that it is common demonstrates a common problem with code quality, not a need to modify Erlang. Poor expression of intentions complicates analysis for someone reading the code, even the original author. Numeric increments of a variable name is a code smell that indicates a need for refactoring, not a need to modify Erlang to disguise code smells. If you give semantic names to each transformation applied to the data, then the code will express its intentions clearly. When you express your intentions clearly you avoid a lot of bugs. Subsequent refactoring work is also made easier, especially when the original author is unavailable. Mutable variables make it easy to disguise a variety of code smells as clean code. For that reason alone, Erlang should not introduce mutable variables. There is a lot of history behind Erlang not having mutable variables. There are fundamental reasons scientific reasons not to have mutability in a programming language. The most intuitive of these is that (to quote Joe Armstrong) single assignment is like algebra. X = X + 1 makes no sense. Allowing it in a programming language makes it easy to unintentionally hide intentions. More importantly it makes reasoning about your program more difficult and severely complicates concurrency and closures. Does anyone here still think that Erlang should add mutable variables? From joshuajnoble@REDACTED Sun Jul 27 01:04:34 2008 From: joshuajnoble@REDACTED (joshuajnoble) Date: Sat, 26 Jul 2008 16:04:34 -0700 (PDT) Subject: [erlang-questions] NY Erlang User's Group In-Reply-To: <4a67dc390807220750g3a172789ra12f4227a14c40ed@mail.gmail.com> References: <9810b81b0807211151o2654e7f6o9f79736a132dfe03@mail.gmail.com> <4a67dc390807220750g3a172789ra12f4227a14c40ed@mail.gmail.com> Message-ID: <2177ef87-a424-4f1b-a8d1-54d847728046@m73g2000hsh.googlegroups.com> I'm Brooklyn, and I'd join as well. On Jul 22, 10:50?am, "Sol Toure" wrote: > I'm in New York area (westchester) and I would like to join as well. > > 2008/7/22 Mihai Balea : > > > I'm in the NYC area (central NJ to be more specific) and I would be willing > > to join a beer/Erlang session :) > > Mihai > > > On Jul 21, 2008, at 2:51 PM, Rick R wrote: > > > I noticed on this list that the > > closest Erlang User's Group to Manhattan is in Chicago. > > Now I'm quickly becoming a rabid Erlang exponent, but I still think that > > that might be a tad far to travel for a meetup. > > > Are there any Erlangers in the NYC area that would be keen to meet up and > > exchange ideas? (either over a beer or in work-area environment (or both)) > > > Are there any members of the above set that would be interested in doing > > this on a regular basis? If there are, I'm sure we could find the space. > > > -- > > An idea that is not dangerous is unworthy of being called an idea at all. > > -- Oscar Wilde > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Sun Jul 27 01:20:19 2008 From: bob@REDACTED (Bob Ippolito) Date: Sat, 26 Jul 2008 16:20:19 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <488B640A.2060504@gmail.com> References: <071301c8ecec$6677bfa0$33673ee0$@com> <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <4889B51F.8000207@gmail.com> <6a36e7290807250755q322695fel29216b0a542f5dcd@mail.gmail.com> <488A8271.30005@gmail.com> <6a36e7290807260815m45bc4b3ag4c945201f9216378@mail.gmail.com> <488B640A.2060504@gmail.com> Message-ID: <6a36e7290807261620o6a4707a1xe149f7e7070b852d@mail.gmail.com> On Sat, Jul 26, 2008 at 10:51 AM, Serge Aleynikov wrote: > Bob Ippolito wrote: >> >> On Fri, Jul 25, 2008 at 6:48 PM, Serge Aleynikov wrote: >>> >>> Not sure about others but I do find this "variant of JSON" more >>> convenient >>> when it comes to debugging JavaScript in a browser (using Firebug >>> debugger) >>> as it is visually more compact and not taking as much of screen real >>> estate. >> >> With firebug you can just look at the objects themselves once they're >> evaluated. > > That is if JSON content coming to a web client is properly formed. During > the > development stage when a client fetches some JSON content read from the > server's > filesystem (say metadata descriptor of a dynamic grid object) it is not > guaranteed > to be properly formed. This is when inspecting "raw" JSON at the > client-side's > debugger comes in handy, and protocol succinctness brings value. I've never seen this happen except when writing my own JSON library... but don't do that, there's got to be at least two available for nearly any language that one would use by now... granted I have written two for Erlang, one for JavaScript (in MochiKit), and one for Python (simplejson, which i guess is two if you count the "json" package that will ship with Python 2.6 and 3.0) over the past 4 years or so. I find that the quotes are the least of your problems anyway when trying to read JSON, it's the lack of whitespace. $ curl -s http://mochiads.com/contest/jul08/feed/json {"games": [{"play_url": "http://www.mochiads.com/games/after-glow/", "swf_url": "http://games.mochiads.com/c/g/after-glow/AfterGlowMA.swf", "description": "Trapped in an ancient alien space pilot training facility you must use your skills to maneuver your spacecraft out of each area without getting destroyed. The faster you are the better.", "thumbnail": "http://cdn.mochiads.com/c/g/after-glow/_thumb_100x100.jpg", "title": "After Glow"}, ? This feed is actually generous about how it does whitespace by default, imagine the compact encoding where there are no spaces after the colons and commas! ... but there are tools you can use for that too. I wouldn't find this significantly easier to read without the quotes on the keys: $ curl -s http://mochiads.com/contest/jul08/feed/json | python -msimplejson { "games": [ { "description": "Trapped in an ancient alien space pilot training facility you must use your skills to maneuver your spacecraft out of each area without getting destroyed. The faster you are the better.", "play_url": "http://www.mochiads.com/games/after-glow/", "swf_url": "http://games.mochiads.com/c/g/after-glow/AfterGlowMA.swf", "thumbnail": "http://cdn.mochiads.com/c/g/after-glow/_thumb_100x100.jpg", "title": "After Glow" }, ? -bob From erlang-questions_efine@REDACTED Sun Jul 27 01:21:47 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Sat, 26 Jul 2008 19:21:47 -0400 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: <6c2563b20807261621r4bc34944kd8b342d46ab9a59c@mail.gmail.com> Alain, I am fairly new to Erlang but have considerable experience in other languages. I agree with you. In every case where I have struggled with this issue in Erlang, it has come down to poor code structure, and refactoring solved the problem. Erlang code that I have read which was written by other, more experienced "Erlangistas", generally doesn't seem to have this problem. On the other hand, perhaps using a functional language to express procedural algorithms is not always a good fit. I am thinking of code, of which there seems to be more than a little, which has functions named something like possibly_do_this(), or do_this() followed by really_do_this(). Although the code is understandable, and I am guilty of doing the same thing, it feels a bit unnatural at times. Perhaps the real issue is thinking procedurally in a functional language. Then again, due to my relative lack of experience with Erlang (and functional languages in general), maybe I have just not seen or written enough Erlang code to warrant giving an opinion on this. On Sat, Jul 26, 2008 at 6:54 PM, Alain O'Dea wrote: > On 26-Jul-08, at 6:47 PM, James Hague wrote: > > >> Imagine this: > >> > >> X = tl(L), > >> ... many messy lines ... > >> *X = tl(X), > >> ... another many lines ... > >> *X = tl(X), > >> ... another many almost unreadable messy lines ... > >> sensitive_usage(X), % <--- buggy X value observed here > >> > >> And my question is, where Value of X came from? It goes from L, but > >> how long > >> it take and how many errors you can do when you will investigate? > > > > It's just as bad when there's code like this: > > > > T2 = something(T), > > T3 = something(T2), > > T4 = something(T3), > > T5 = something(T4), > > T6 = something(T5) > > > > You may laugh at that code, but it's hardly uncommon, even in code > > written by experienced programmers. It's very easy to accidentally > > use T4 in a spot when you meant T3, or to have to renumber things and > > make a mistake. > > > > Please note that I am not arguing for changes in Erlang. I truly am > > not. But I can understand why this request comes up regularly. > > > > James > > > Erlang should not introduce mutable variables because they make it > easy to disguise a variety of code smells as clean code. > > Code like James' example is code that does not express its intentions > clearly. The fact that it is common demonstrates a common problem with > code quality, not a need to modify Erlang. Poor expression of > intentions complicates analysis for someone reading the code, even the > original author. > > Numeric increments of a variable name is a code smell that indicates a > need for refactoring, not a need to modify Erlang to disguise code > smells. > > If you give semantic names to each transformation applied to the data, > then the code will express its intentions clearly. When you express > your intentions clearly you avoid a lot of bugs. Subsequent > refactoring work is also made easier, especially when the original > author is unavailable. > > Mutable variables make it easy to disguise a variety of code smells as > clean code. For that reason alone, Erlang should not introduce mutable > variables. > > There is a lot of history behind Erlang not having mutable variables. > There are fundamental reasons scientific reasons not to have > mutability in a programming language. The most intuitive of these is > that (to quote Joe Armstrong) single assignment is like algebra. X = X > + 1 makes no sense. Allowing it in a programming language makes it > easy to unintentionally hide intentions. More importantly it makes > reasoning about your program more difficult and severely complicates > concurrency and closures. > > Does anyone here still think that Erlang should add mutable variables? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- The great enemy of the truth is very often not the lie -- deliberate, contrived and dishonest, but the myth, persistent, persuasive, and unrealistic. Belief in myths allows the comfort of opinion without the discomfort of thought. John F. Kennedy 35th president of US 1961-1963 (1917 - 1963) -------------- next part -------------- An HTML attachment was scrubbed... URL: From yinso.chen@REDACTED Sun Jul 27 02:07:41 2008 From: yinso.chen@REDACTED (YC) Date: Sat, 26 Jul 2008 17:07:41 -0700 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> Message-ID: <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> On Sat, Jul 26, 2008 at 2:17 PM, James Hague wrote: > > Imagine this: > > > > X = tl(L), > > ... many messy lines ... > > *X = tl(X), > > ... another many lines ... > > *X = tl(X), > > ... another many almost unreadable messy lines ... > > sensitive_usage(X), % <--- buggy X value observed here > > > > And my question is, where Value of X came from? It goes from L, but how > long > > it take and how many errors you can do when you will investigate? > > It's just as bad when there's code like this: > > T2 = something(T), > T3 = something(T2), > T4 = something(T3), > T5 = something(T4), > T6 = something(T5) > > You may laugh at that code, but it's hardly uncommon, even in code > written by experienced programmers. It's very easy to accidentally > use T4 in a spot when you meant T3, or to have to renumber things and > make a mistake. > > Please note that I am not arguing for changes in Erlang. I truly am > not. But I can understand why this request comes up regularly. > > There is a way to satisfy this request without breaking single assignment, and that is to have a more sophisticated scoping. For example, the above in lisp/scheme are: (let ((t (something t))) (let ((t (something t))) (let ((t (something t))) ...))) No mutabilities involved - just better scopes - can't be that bad for Erlang, right? ;) Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbarker@REDACTED Sun Jul 27 01:03:25 2008 From: dbarker@REDACTED (Deryk Barker) Date: Sat, 26 Jul 2008 16:03:25 -0700 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: <488BAD3D.9070709@camosun.bc.ca> Alain O'Dea wrote: > Does anyone here still think that Erlang should add mutable variables? > I, for one, never have...:-) -- |Deryk Barker, Computer Science Dept. | Music does not have to be understood| |Camosun College, Victoria, BC, Canada| It has to be listened to. | |email: dbarker@REDACTED | | |phone: +1 250 370 4452 | Hermann Scherchen. | From devdoer2@REDACTED Sun Jul 27 07:09:24 2008 From: devdoer2@REDACTED (devdoer bird) Date: Sun, 27 Jul 2008 13:09:24 +0800 Subject: [erlang-questions] How many fragments would be proper for 1 milions records in mensia? Message-ID: Hi: Considering the access performance , easy mangement ,how many fragments would be proper for 1 milions records in mensia? Are there any rules about the number of fragments and the number of total records? Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Jul 27 10:12:49 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 27 Jul 2008 10:12:49 +0200 Subject: [erlang-questions] How many fragments would be proper for 1 milions records in mensia? In-Reply-To: References: Message-ID: <8209f740807270112j64c42a8arab7035250fb4240@mail.gmail.com> Depending on object size, you may well have just a single table/fragment. 1 million objects is not that much. BR, Ulf W 2008/7/27, devdoer bird : > Hi: > > Considering the access performance , easy mangement ,how many fragments > would be proper for 1 milions records in mensia? Are there any rules about > the number of fragments and the number of total records? > > Regards > From attila.rajmund.nohl@REDACTED Sun Jul 27 10:56:22 2008 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Sun, 27 Jul 2008 10:56:22 +0200 (CEST) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: On Sat, 26 Jul 2008, Alain O'Dea wrote: > On 26-Jul-08, at 6:47 PM, James Hague wrote: > >>> Imagine this: >>> >>> X = tl(L), >>> ... many messy lines ... >>> *X = tl(X), >>> ... another many lines ... >>> *X = tl(X), >>> ... another many almost unreadable messy lines ... >>> sensitive_usage(X), % <--- buggy X value observed here >>> >>> And my question is, where Value of X came from? It goes from L, but >>> how long >>> it take and how many errors you can do when you will investigate? >> >> It's just as bad when there's code like this: >> >> T2 = something(T), >> T3 = something(T2), >> T4 = something(T3), >> T5 = something(T4), >> T6 = something(T5) >> >> You may laugh at that code, but it's hardly uncommon, even in code >> written by experienced programmers. It's very easy to accidentally >> use T4 in a spot when you meant T3, or to have to renumber things and >> make a mistake. >> >> Please note that I am not arguing for changes in Erlang. I truly am >> not. But I can understand why this request comes up regularly. >> >> James > > Erlang should not introduce mutable variables because they make it > easy to disguise a variety of code smells as clean code. > > Code like James' example is code that does not express its intentions > clearly. I disagree. Code like this: State1 = updateStateSomehow1(State, SomeVariable), State2 = updateStateSomehow2(State1, SomeOtherVariable), State3 = updateStateSomehow3(State2, SomeReallyOtherVariable), quite clearly expresses the intention: update the state. [...] > If you give semantic names to each transformation applied to the data, > then the code will express its intentions clearly. When you express > your intentions clearly you avoid a lot of bugs. Subsequent > refactoring work is also made easier, especially when the original > author is unavailable. The problem with detailed semantic names is that they tend to be long. Given the ugliness of the erlang record syntax you'd soon end up with experssions like this: StateUpdatedWithSomeVariable#stateRecord.some_field instead of the intuitive State.some_field which is actually readable and fits on the terminal nicely, unlike the erlang variant. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From rvirding@REDACTED Sun Jul 27 16:23:14 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 27 Jul 2008 16:23:14 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> Message-ID: <3dbc6d1c0807270723k4f082d5dgabf261be3ef92bbb@mail.gmail.com> 2008/7/27 YC > > It's just as bad when there's code like this: >> >> T2 = something(T), >> T3 = something(T2), >> T4 = something(T3), >> T5 = something(T4), >> T6 = something(T5) >> >> You may laugh at that code, but it's hardly uncommon, even in code >> written by experienced programmers. It's very easy to accidentally >> use T4 in a spot when you meant T3, or to have to renumber things and >> make a mistake. >> >> Please note that I am not arguing for changes in Erlang. I truly am >> not. But I can understand why this request comes up regularly. >> >> > There is a way to satisfy this request without breaking single assignment, > and that is to have a more sophisticated scoping. > > For example, the above in lisp/scheme are: > > (let ((t (something t))) > (let ((t (something t))) > (let ((t (something t))) > ...))) > > No mutabilities involved - just better scopes - can't be that bad for > Erlang, right? ;) > Shameless plug: Well you can do this today if you use LFE. Plus ti gives you a lot of other lisp goddies as well. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From alain.odea@REDACTED Sun Jul 27 16:47:06 2008 From: alain.odea@REDACTED (Alain O'Dea) Date: Sun, 27 Jul 2008 12:17:06 -0230 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: <38CF5675-B6B0-4E51-B444-3BB8D4FE6F22@gmail.com> On 27-Jul-08, at 6:26 AM, attila.rajmund.nohl@REDACTED wrote: > On Sat, 26 Jul 2008, Alain O'Dea wrote: > >> On 26-Jul-08, at 6:47 PM, James Hague wrote: >> >>>> Imagine this: >>>> >>>> X = tl(L), >>>> ... many messy lines ... >>>> *X = tl(X), >>>> ... another many lines ... >>>> *X = tl(X), >>>> ... another many almost unreadable messy lines ... >>>> sensitive_usage(X), % <--- buggy X value observed here >>>> >>>> And my question is, where Value of X came from? It goes from L, but >>>> how long >>>> it take and how many errors you can do when you will investigate? >>> >>> It's just as bad when there's code like this: >>> >>> T2 = something(T), >>> T3 = something(T2), >>> T4 = something(T3), >>> T5 = something(T4), >>> T6 = something(T5) >>> >>> You may laugh at that code, but it's hardly uncommon, even in code >>> written by experienced programmers. It's very easy to accidentally >>> use T4 in a spot when you meant T3, or to have to renumber things >>> and >>> make a mistake. >>> >>> Please note that I am not arguing for changes in Erlang. I truly am >>> not. But I can understand why this request comes up regularly. >>> >>> James >> >> Erlang should not introduce mutable variables because they make it >> easy to disguise a variety of code smells as clean code. >> >> Code like James' example is code that does not express its intentions >> clearly. > > I disagree. Code like this: > State1 = updateStateSomehow1(State, SomeVariable), > State2 = updateStateSomehow2(State1, SomeOtherVariable), > State3 = updateStateSomehow3(State2, SomeReallyOtherVariable), > > quite clearly expresses the intention: update the state. What is the actual intention behind updating the state? I would refuse to approve a colleague's code if they argued that its intent was to update the state. I think this is another counter-example that indicates a lack of code quality rather than a real Erlang problem. It is equivalent to saying that the intention of "i++" is to increment "i". > [...] >> If you give semantic names to each transformation applied to the >> data, >> then the code will express its intentions clearly. When you express >> your intentions clearly you avoid a lot of bugs. Subsequent >> refactoring work is also made easier, especially when the original >> author is unavailable. > > The problem with detailed semantic names is that they tend to be long. > Given the ugliness of the erlang record syntax you'd soon end up with > experssions like this: > StateUpdatedWithSomeVariable#stateRecord.some_field You can avoid this problem by choosing short semantic names which have domain meaning in your client code independent of the transformations. The transformations are the implementation of your intentions, they are not the intentions themselves. > instead of the intuitive > State.some_field > > which is actually readable and fits on the terminal nicely, unlike the > erlang variant. Despite using semantic naming I have never had any difficulty writing Erlang that fits within 80 characters per line (a standard terminal). At a more fundamental level; if you change the state of a data structure, then it makes sense for your process state (ie. the function the process is executing and its arguments) to change along with it. This is a common idiom in functional programming and is used extensively in Erlang's standard library modules. Going against the grain is what makes it difficult to write code like this. It is deliberately difficult to write, because it is inconsistent with the functional programming paradigm. Rather than fighting the abstractions and constraints of the language, why not leverage them to improve your productivity and code quality? From greg.burri@REDACTED Sun Jul 27 20:10:38 2008 From: greg.burri@REDACTED (Greg Burri) Date: Sun, 27 Jul 2008 20:10:38 +0200 Subject: [erlang-questions] Copy of mnesia tables from a node to a another node without linkage In-Reply-To: <290b3ba10807261714v11f33ddat39b5e7a3bedb6e22@mail.gmail.com> References: <60ed8a460807251500l26aa5e11wc64c22900a19c8cd@mail.gmail.com> <290b3ba10807261714v11f33ddat39b5e7a3bedb6e22@mail.gmail.com> Message-ID: <60ed8a460807271110pd1b66d8l702d2ae1f2f7676b@mail.gmail.com> Ok, thanks you ! I will try these two solutions. /Greg On Sun, Jul 27, 2008 at 2:14 AM, t ty wrote: > IIRC any dump of the table would actually encode the node name in it. > i.e if your other node shares the same name you are ok. Otherwise you > will have to 'edit' the node's name in. See the 'educational' > mnesia:dump_to_textfile/1 > > Personally I would consider linking the 2 nodes, let mnesia sync then > remove the links as an easy way out. > > t > > On Fri, Jul 25, 2008 at 6:00 PM, Greg Burri wrote: >> Hi everybody. >> >> I want to copy some tables from a node to an another and I want to >> keep the nodes independent. >> >> I have some data in production and I want to upgrade the modules in >> production but before that I have to make some preproduction tests >> with the production data (without destroying my production data :o]). >> >> This "how-to" : http://www.trapexit.org/Distributing_a_Mnesia_schema >> works great but obviously theses nodes are linked... >> >> I try to use mnesia:backup() in the production node and then >> mnesia:restore() to the preproduction node but it doesn't work. The >> saved data are linked to the first node. >> >> >> Does anyone have an idea about this ? >> >> TIA >> >> >> /Greg >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From vychodil.hynek@REDACTED Sun Jul 27 21:09:04 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sun, 27 Jul 2008 21:09:04 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> On Sun, Jul 27, 2008 at 10:56 AM, wrote: > On Sat, 26 Jul 2008, Alain O'Dea wrote: > > > On 26-Jul-08, at 6:47 PM, James Hague wrote: > > > >>> Imagine this: > >>> > >>> X = tl(L), > >>> ... many messy lines ... > >>> *X = tl(X), > >>> ... another many lines ... > >>> *X = tl(X), > >>> ... another many almost unreadable messy lines ... > >>> sensitive_usage(X), % <--- buggy X value observed here > >>> > >>> And my question is, where Value of X came from? It goes from L, but > >>> how long > >>> it take and how many errors you can do when you will investigate? > >> > >> It's just as bad when there's code like this: > >> > >> T2 = something(T), > >> T3 = something(T2), > >> T4 = something(T3), > >> T5 = something(T4), > >> T6 = something(T5) > >> > >> You may laugh at that code, but it's hardly uncommon, even in code > >> written by experienced programmers. It's very easy to accidentally > >> use T4 in a spot when you meant T3, or to have to renumber things and > >> make a mistake. > >> > >> Please note that I am not arguing for changes in Erlang. I truly am > >> not. But I can understand why this request comes up regularly. > >> > >> James > > > > Erlang should not introduce mutable variables because they make it > > easy to disguise a variety of code smells as clean code. > > > > Code like James' example is code that does not express its intentions > > clearly. > > I disagree. Code like this: > State1 = updateStateSomehow1(State, SomeVariable), > State2 = updateStateSomehow2(State1, SomeOtherVariable), > State3 = updateStateSomehow3(State2, SomeReallyOtherVariable), > > quite clearly expresses the intention: update the state. Well, if you want this, do it this way: NewStata = lists:foldl( fun({F, A}, S) -> F(S, A) end, State, [ {updateStateSomehow1,SomeVariable}, {updateStateSomehow2, SomeOtherVariable}, {updateStateSomehow3, SomeReallyOtherVariable} ]). Just refactor your code, don't break Language! > > [...] > > If you give semantic names to each transformation applied to the data, > > then the code will express its intentions clearly. When you express > > your intentions clearly you avoid a lot of bugs. Subsequent > > refactoring work is also made easier, especially when the original > > author is unavailable. > > The problem with detailed semantic names is that they tend to be long. > Given the ugliness of the erlang record syntax you'd soon end up with > experssions like this: > StateUpdatedWithSomeVariable#stateRecord.some_field > > instead of the intuitive > State.some_field > > which is actually readable and fits on the terminal nicely, unlike the > erlang variant. > > Bye,NAR > -- > "Beware of bugs in the above code; I have only proved it correct, not > tried it." > _______________________________________________ > 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 Sun Jul 27 21:26:57 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Sun, 27 Jul 2008 21:26:57 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> Message-ID: <4d08db370807271226q504f358ax4b20c6bad27ce511@mail.gmail.com> On Sun, Jul 27, 2008 at 9:09 PM, Hynek Vychodil wrote: > > > On Sun, Jul 27, 2008 at 10:56 AM, wrote: > >> On Sat, 26 Jul 2008, Alain O'Dea wrote: >> >> > On 26-Jul-08, at 6:47 PM, James Hague wrote: >> > >> >>> Imagine this: >> >>> >> >>> X = tl(L), >> >>> ... many messy lines ... >> >>> *X = tl(X), >> >>> ... another many lines ... >> >>> *X = tl(X), >> >>> ... another many almost unreadable messy lines ... >> >>> sensitive_usage(X), % <--- buggy X value observed here >> >>> >> >>> And my question is, where Value of X came from? It goes from L, but >> >>> how long >> >>> it take and how many errors you can do when you will investigate? >> >> >> >> It's just as bad when there's code like this: >> >> >> >> T2 = something(T), >> >> T3 = something(T2), >> >> T4 = something(T3), >> >> T5 = something(T4), >> >> T6 = something(T5) >> >> >> >> You may laugh at that code, but it's hardly uncommon, even in code >> >> written by experienced programmers. It's very easy to accidentally >> >> use T4 in a spot when you meant T3, or to have to renumber things and >> >> make a mistake. >> >> >> >> Please note that I am not arguing for changes in Erlang. I truly am >> >> not. But I can understand why this request comes up regularly. >> >> >> >> James >> > >> > Erlang should not introduce mutable variables because they make it >> > easy to disguise a variety of code smells as clean code. >> > >> > Code like James' example is code that does not express its intentions >> > clearly. >> >> I disagree. Code like this: >> State1 = updateStateSomehow1(State, SomeVariable), >> State2 = updateStateSomehow2(State1, SomeOtherVariable), >> State3 = updateStateSomehow3(State2, SomeReallyOtherVariable), >> >> quite clearly expresses the intention: update the state. > > > Well, if you want this, do it this way: > > NewStata = lists:foldl( > fun({F, A}, S) -> F(S, A) end, > State, > [ > {updateStateSomehow1,SomeVariable}, > {updateStateSomehow2, SomeOtherVariable}, > {updateStateSomehow3, SomeReallyOtherVariable} > ]). > > Just refactor your code, don't break Language! > It should be NewStata = lists:foldl( fun({F, A}, S) -> ?MODULE:F(S, A) end, State, [ {updateStateSomehow1, SomeVariable}, {updateStateSomehow2, SomeOtherVariable}, {updateStateSomehow3, SomeReallyOtherVariable} ]). or NewStata = lists:foldl( fun({F, A}, S) -> F(S, A) end, State, [ {fun updateStateSomehow1/2, SomeVariable}, {fun updateStateSomehow2/2, SomeOtherVariable}, {fun updateStateSomehow3/2, SomeReallyOtherVariable} ]). or NewStata = lists:foldl( fun({M, F, A}, S) -> F(S, A) end, State, [ {someModule, updateStateSomehow1, SomeVariable}, {otherModule, updateStateSomehow2, SomeOtherVariable}, {yetAnotherModule, updateStateSomehow3, SomeReallyOtherVariable} ]). or what ever you really wont. In most cases, when your Erlang code looks ugly, you do ugly think or you structure your code wrong way. > > >> >> [...] >> > If you give semantic names to each transformation applied to the data, >> > then the code will express its intentions clearly. When you express >> > your intentions clearly you avoid a lot of bugs. Subsequent >> > refactoring work is also made easier, especially when the original >> > author is unavailable. >> >> The problem with detailed semantic names is that they tend to be long. >> Given the ugliness of the erlang record syntax you'd soon end up with >> experssions like this: >> StateUpdatedWithSomeVariable#stateRecord.some_field >> >> instead of the intuitive >> State.some_field >> >> which is actually readable and fits on the terminal nicely, unlike the >> erlang variant. >> >> Bye,NAR >> -- >> "Beware of bugs in the above code; I have only proved it correct, not >> tried it." >> _______________________________________________ >> 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 dmitriid@REDACTED Sun Jul 27 21:30:08 2008 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sun, 27 Jul 2008 22:30:08 +0300 Subject: [erlang-questions] First look at Scalaris on OS X In-Reply-To: References: Message-ID: <51A85518-52A5-461B-B0F1-98A2476323CD@gmail.com> Thank you very much for this post. I was going to try and build Scalaris on my MacBook Pro, but you beat me to it :) It looks to be a breeze. Can't wait to try it out On Jul 25, 2008, at 11:53 PM, Dave Bryson wrote: > If you're interested in Scalaris but haven't had the chance to fire it > up yet, I've posted a few screen shots and some instructions on what > it took for me to build it on Mac OS X 10.5. > > http://weblog.miceda.org/2008/07/25/first-look-at-scalaris-on-os- > x-105/ > > Dave > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Sun Jul 27 21:32:57 2008 From: rvirding@REDACTED (Robert Virding) Date: Sun, 27 Jul 2008 21:32:57 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <3dbc6d1c0807270723k4f082d5dgabf261be3ef92bbb@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> <3dbc6d1c0807270723k4f082d5dgabf261be3ef92bbb@mail.gmail.com> Message-ID: <3dbc6d1c0807271232v143cbee1p689ee820aa354ba@mail.gmail.com> 2008/7/27 Robert Virding > 2008/7/27 YC > >> There is a way to satisfy this request without breaking single assignment, >> and that is to have a more sophisticated scoping. >> >> For example, the above in lisp/scheme are: >> >> (let ((t (something t))) >> (let ((t (something t))) >> (let ((t (something t))) >> ...))) >> >> No mutabilities involved - just better scopes - can't be that bad for >> Erlang, right? ;) >> > > Shameless plug: > > Well you can do this today if you use LFE. Plus ti gives you a lot of other > lisp goddies as well. > Well, if I had been thinking I of course would have written: (let* ((t (something t)) (t (something t)) (t (something t)) ... ) (something t)) which is very close to the original suggestion. Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.rajmund.nohl@REDACTED Sun Jul 27 22:12:21 2008 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Sun, 27 Jul 2008 22:12:21 +0200 (CEST) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <38CF5675-B6B0-4E51-B444-3BB8D4FE6F22@gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> <38CF5675-B6B0-4E51-B444-3BB8D4FE6F22@gmail.com> Message-ID: On Sun, 27 Jul 2008, Alain O'Dea wrote: > On 27-Jul-08, at 6:26 AM, attila.rajmund.nohl@REDACTED wrote: > >> On Sat, 26 Jul 2008, Alain O'Dea wrote: >> >>> On 26-Jul-08, at 6:47 PM, James Hague wrote: >>> >>>>> Imagine this: >>>>> >>>>> X = tl(L), >>>>> ... many messy lines ... >>>>> *X = tl(X), >>>>> ... another many lines ... >>>>> *X = tl(X), >>>>> ... another many almost unreadable messy lines ... >>>>> sensitive_usage(X), % <--- buggy X value observed here >>>>> >>>>> And my question is, where Value of X came from? It goes from L, but >>>>> how long >>>>> it take and how many errors you can do when you will investigate? >>>> >>>> It's just as bad when there's code like this: >>>> >>>> T2 = something(T), >>>> T3 = something(T2), >>>> T4 = something(T3), >>>> T5 = something(T4), >>>> T6 = something(T5) >>>> >>>> You may laugh at that code, but it's hardly uncommon, even in code >>>> written by experienced programmers. It's very easy to accidentally >>>> use T4 in a spot when you meant T3, or to have to renumber things and >>>> make a mistake. >>>> >>>> Please note that I am not arguing for changes in Erlang. I truly am >>>> not. But I can understand why this request comes up regularly. >>>> >>>> James >>> >>> Erlang should not introduce mutable variables because they make it >>> easy to disguise a variety of code smells as clean code. >>> >>> Code like James' example is code that does not express its intentions >>> clearly. >> >> I disagree. Code like this: >> State1 = updateStateSomehow1(State, SomeVariable), >> State2 = updateStateSomehow2(State1, SomeOtherVariable), >> State3 = updateStateSomehow3(State2, SomeReallyOtherVariable), >> >> quite clearly expresses the intention: update the state. > > What is the actual intention behind updating the state? I would refuse to > approve a colleague's code if they argued that its intent was to update the > state. I think this is another counter-example that indicates a lack of code > quality rather than a real Erlang problem. It is equivalent to saying that > the intention of "i++" is to increment "i". What the above example lacks is meaningful function names, because I didn't bother to invent some, thinking that people would get it as is. Imagine that the updateState* have meaningful names and quite possibly some side effects as well. But they do update the state too. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From attila.rajmund.nohl@REDACTED Sun Jul 27 22:15:21 2008 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Sun, 27 Jul 2008 22:15:21 +0200 (CEST) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <4d08db370807271226q504f358ax4b20c6bad27ce511@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> <4d08db370807271226q504f358ax4b20c6bad27ce511@mail.gmail.com> Message-ID: On Sun, 27 Jul 2008, Hynek Vychodil wrote: [...] [really ugly code] > In most cases, when your Erlang code looks ugly, you do ugly think or you > structure your code wrong way. It's not ugly thinking - it's non-erlangish thinking. And in my opinion it's a fault in a language if it constrains my thinking. It should be the other way: the language should follow my thinking. Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From ulf@REDACTED Sun Jul 27 22:41:33 2008 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 27 Jul 2008 22:41:33 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> <4d08db370807271226q504f358ax4b20c6bad27ce511@mail.gmail.com> Message-ID: <8209f740807271341x55b5930dn8ca9bf156fe6f49a@mail.gmail.com> 2008/7/27 : > On Sun, 27 Jul 2008, Hynek Vychodil wrote: > [...] > [really ugly code] > >> In most cases, when your Erlang code looks ugly, you do ugly think or you >> structure your code wrong way. > > It's not ugly thinking - it's non-erlangish thinking. And in my opinion > it's a fault in a language if it constrains my thinking. It should be > the other way: the language should follow my thinking. "A language that doesn't affect the way you think about programming, is not worth knowing." Alan Perlis (http://www.cs.yale.edu/quotes.html) If you want a language that follows your thinking, you should write your own language. Then you'll either have a language that has no opinion about how to structure your code, or one that many others might well find constraining. ;-) Personally, I find it a great advantage that Erlang has a pretty clear opinion about how code should be structured. BR, Ulf W From torben.lehoff@REDACTED Mon Jul 28 00:00:38 2008 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 28 Jul 2008 00:00:38 +0200 Subject: [erlang-questions] Erlang and ISDN In-Reply-To: <4885ACF6.6090407@diit.unict.it> References: <4885ACF6.6090407@diit.unict.it> Message-ID: On Tue, Jul 22, 2008 at 11:48 AM, Corrado Santoro wrote: > Hi all, > > in your knowledge, is there any project to interface Erlang with ISDN > boards? > Corrado, I cannot add to the info Vance has given, but just out of curiosity: what are you trying to accomplish? I have recently implemented a driver to a E1 card plus a layer 3 protocol (Q.SIG) so I might be able to provide some advice. No code can be given away since it is very heavily proprietary, top-secret and an outrageous business advantage to my company - these are not solely the opinions of my employer, but to a certain extend my own ;-) Cheers, Torben > > Thanks, > --Corrado > > -- > ================================================================== > 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 > ================================================================== > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Jul 28 00:31:40 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 28 Jul 2008 10:31:40 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> Message-ID: <3270809A-6E1F-4952-8935-FC9A94D94EF8@cs.otago.ac.nz> On 26 Jul 2008, at 3:38 am, Chris Anderson wrote: > Joe mentioned not using atoms as keys due to the atom table not being > GC'd. The other consideration is making it unambigious between JSON > arrays and JSON objects. Jim Larson pointed out that there are actually THREE alternatives: (1) always return labels as binaries. This is always safe, and always clunky. (2) always return labels as atoms if you can. This is always nice to use, but is only safe if you can trust the sender to use a small set of labels. (3) return labels as atoms if they are EXISTING atoms. This is the possibility that I missed (inexcusably). It means that a module that expects certain labels to be used and mentions those labels will se THOSE labels (and perhaps some others) as atoms, giving you the convenience, but at the same time it won't add anything to the atom table, giving you safety. > It make sense to me to encode JSON arrays as Erlang lists, for the > sake of simplicity. I agree that [{"foo",1},{"bar",2}] is easier to > work with than the pure tuple version, which makes me lean toward > using the outer wrapping {} as a marker for object-ness. The latest revision of the EEP does the Joe Armstrong thing of converting object <-> tuple with NO wrappers. There is a certain cuteness factor here: if you have a JSON term, then (1) Convert "..." to <<"...">> (2) Convert : to , and presto changeo, you have an Erlang term. Easy to remember. If you want a list, there is always tuple_to_list/1. The EEP requires order to be preserved on output, but not on input. There is an obvious problem with preserving order within "objects" on input, and that is that it is something that JSON explicitly says does not matter. What if people started to rely on it, and then got a nasty surprise when they ran into a JSON partner that didn't preserve order? -- If stupidity were a crime, who'd 'scape hanging? From ok@REDACTED Mon Jul 28 00:40:12 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 28 Jul 2008 10:40:12 +1200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> Message-ID: On 26 Jul 2008, at 4:14 am, Berlin Brown wrote: > Maybe this is already implemented, but I wish there were some kind of > "last_value" built in function where you can get the last value > without having to define it yourself. But what _is_ the "last value"? I can make sense of such a thing at the top interactive level, but not elsewhere. > > > Has this been talked about a lot already. > > E.g. this is from the erlang docs as a "best" practice. > > NewQ = queue:new(), > Queue1 = queue:add(joe, NewQ), > Queue2 = queue:add(mike, Queue1), ... > > When I am coding, I end up forgetting to define Q1, Q2 > > NewQ = queue:new(), > queue:add(joe, NewQ), > queue:add(mike, NewQ), ... Then learn to do better. For one thing, this particular example should be Q = queue:from_list([joe, mike]) > I wish there were something like this to get the result of the last > call > > queue:new(), > queue:add(joe, erlang:last_value()), > queue:add(mike, erlang:last_value())), ... (A) There is: it's called binding a variable. (B) If you are still thinking imperatively, so that you expect a function to work by side effects rather than by returning a new value, what makes you think that you will remember to use erlang:last_value() instead of NewQ? It is really very common for the thing you want to pass here NOT to be the result of the last value, so the proposed hack really would not help except in trivial cases. From ulf@REDACTED Mon Jul 28 00:48:36 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 28 Jul 2008 00:48:36 +0200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <3270809A-6E1F-4952-8935-FC9A94D94EF8@cs.otago.ac.nz> References: <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> <3270809A-6E1F-4952-8935-FC9A94D94EF8@cs.otago.ac.nz> Message-ID: <8209f740807271548n75bcb1d5m32fe82eb06dcdff5@mail.gmail.com> 2008/7/28 Richard A. O'Keefe : > > On 26 Jul 2008, at 3:38 am, Chris Anderson wrote: >> Joe mentioned not using atoms as keys due to the atom table not being >> GC'd. The other consideration is making it unambigious between JSON >> arrays and JSON objects. > > Jim Larson pointed out that there are actually THREE alternatives: > (1) always return labels as binaries. > This is always safe, and always clunky. > (2) always return labels as atoms if you can. > This is always nice to use, but is only safe if you > can trust the sender to use a small set of labels. > (3) return labels as atoms if they are EXISTING atoms. > This is the possibility that I missed (inexcusably). > It means that a module that expects certain labels to be used > and mentions those labels will se THOSE labels (and perhaps > some others) as atoms, giving you the convenience, > but at the same time it won't add anything to the atom table, > giving you safety. But with dynamic code loading, you cannot be sure that the atoms (presumably created when a given module is loaded) are there when the message is decoded. If the message has been decoded before a module matching on the decoded term is loaded, the labels expected to be atoms may instead be binaries, and it would be difficult to know which. BR, Ulf W From ok@REDACTED Mon Jul 28 02:47:09 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 28 Jul 2008 12:47:09 +1200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> Message-ID: <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> It may be worth pointing out that Mercury has something rather like this for "state" arguments threaded through predicates. Also, functional language with explicit 'let' allow let val x = 1 in let val x = x + 1 in x+1 end end (SML) or let x = 1 in let x = x + 1 in x+1 (Haskell). I have learned to avoid this, because the result is that when I come to *read* the code, I'm never quite sure which x I am dealing with. For some reason, the Mercury version doesn't seem to have this problem, perhaps because Mercury style is to use it for "imperative" things like I/O. From ok@REDACTED Mon Jul 28 02:58:27 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 28 Jul 2008 12:58:27 +1200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <779bf2730807261707v65c3794r19e599393e231544@mail.gmail.com> Message-ID: <882458AF-34C6-4801-9C60-A4D65D156FF2@cs.otago.ac.nz> Brian Marick has two stickers, which he makes copies of and gives away. One of them says "an example would be handy right about now". Let's have an example of some code with lots of X1..n variables, real code, and let's see what we can do with it. From ok@REDACTED Mon Jul 28 03:45:03 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 28 Jul 2008 13:45:03 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <8209f740807271548n75bcb1d5m32fe82eb06dcdff5@mail.gmail.com> References: <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> <3270809A-6E1F-4952-8935-FC9A94D94EF8@cs.otago.ac.nz> <8209f740807271548n75bcb1d5m32fe82eb06dcdff5@mail.gmail.com> Message-ID: <2FD0B40D-E361-467B-AB8D-68FF8C738F0C@cs.otago.ac.nz> On 28 Jul 2008, at 10:48 am, Ulf Wiger wrote: > > But with dynamic code loading, you cannot be sure that the atoms > (presumably created when a given module is loaded) are there > when the message is decoded. If the message has been decoded > before a module matching on the decoded term is loaded, the > labels expected to be atoms may instead be binaries, and it would > be difficult to know which. That's easily dealt with: ensure_atoms_in_json(Term) -> json_to_term(term_to_json(Term), [{label,existing_atom}]. This feature was never meant to be useful with things decoded before the module that cares was loaded. This really has nothing to do with JSON: it's an issue that comes up any time you make use of list_to_existing_atom/1. From goofyheadedpunk@REDACTED Mon Jul 28 04:32:35 2008 From: goofyheadedpunk@REDACTED (Brian Troutwine) Date: Sun, 27 Jul 2008 19:32:35 -0700 Subject: [erlang-questions] Inets application unstarted. In-Reply-To: <8268eea30807212246m1d96627aj80c6a4b85963550b@mail.gmail.com> References: <971980cc0807212120t2f4ffba5oe06a442ca4e068cb@mail.gmail.com> <8268eea30807212246m1d96627aj80c6a4b85963550b@mail.gmail.com> Message-ID: <971980cc0807271932y30e93703h7c396450b92b9a9e@mail.gmail.com> Hello Andreas, I very much thought I'd written back to thank you, but I had not. My apologies. You were quite corrrect, that was the missing bit of the puzzle. I simply misunderstood the OTP system principles. Thank you, Brian On 7/21/08, Andreas Hillqvist wrote: > Hi Brian. > > I belive that the pice missing from the puzzel is a Boot Script, that > should start the application in a correct order acording to each > applications dependencies: > http://www.erlang.org/doc/system_principles/system_principles.html#1.3 > > The simple way to make an boot script is to use a release resource file: > http://www.erlang.org/doc/man/rel.html > > To use your boot file: > >erl -boot Your_Boot_Script.boot > Or > >erl -boot_var $App_Path/Your_Boot_Script.boot > > To summeries, I belive it should be sufficent for your use: > * create a release resource file > * create a boot script from your resource file > * use your boot script when starting erlang > > Pleas feel free to comment and/or add any additional comments. > > > Kind regards > Andreas Hillqvist > > 2008/7/22, Brian Troutwine : > > > Hello all, > > > > I'm building my first OTP program, which I'm calling Aule. It's > > something simple to mine data through the Amazon web services, which > > is REST based. I need inets started as a dependency of Aule. > > > > I've followed the OTP Design Principles "Applications" and the "Inets > > User Guide" Http sections most heavily, in addition to man pages and > > IRC guidance. All that said, I have my aule.app which looks like so: > > > > >{application, aule, > > > [{description, "An Amazon data AAWS data miner"}, > > > {vsn, "0.0.1"}, > > > {modules, [aaws_functions, aule, aule_supervisor, > > > browse_node_fiend, amazon_interface]}, > > > {registered, ['AmazonInterface', 'BrowseNodeFiend']}, > > > {applications, [kernel, stdlib, inets]}, > > > {mod, {aule,[]}}, > > > {env, []} > > > ]}. > > > > And a sys.config that looks like so: > > > > > [{kernel, [{start_timer, true}]}, > > > {inets, [{services, [{httpc, [{profile, olorin}]}]}]} > > > ]. > > > > I run, "erl -config sys.config" and then load/start aule like so: > > > > > 1> application:load(aule), application:start(aule). > > > {error,{not_started,inets}} > > > > And I'm confused. The OTP Design Principles document states that the > > applications field has "[a]ll applications which must be started > > before this application is started." I took this to mean that OTP > > starts the appropriate applications before aule start. Am I wrong? If > > so, what does applications do? If I'm not wrong, what am I missing to > > get inets started immediately? > > > > Thanks in advance, > > Brian > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From ttmrichter@REDACTED Mon Jul 28 06:49:59 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Mon, 28 Jul 2008 12:49:59 +0800 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> <4d08db370807271209uca28b74j35701047be923c87@mail.gmail.com> <4d08db370807271226q504f358ax4b20c6bad27ce511@mail.gmail.com> Message-ID: <1217220599.32609.4.camel@isolde> On Sun, 2008-07-27 at 22:15 +0200, attila.rajmund.nohl@REDACTED wrote: > > In most cases, when your Erlang code looks ugly, you do ugly think or you > > structure your code wrong way. > It's not ugly thinking - it's non-erlangish thinking. And in my opinion > it's a fault in a language if it constrains my thinking. It should be > the other way: the language should follow my thinking. The practical upshot of this is that we should all program in a macro assembler because that provides the fewest constraints on your thinking. I'm more of the camp that a decent language guides your thinking by making desirable coding techniques easy and undesirable ones hard. This is where a lot of popular languages like C++ or Java fail, in my books: they claim one style of coding is desirable and then make that style of programming as hard as other styles of programming which they claim as undesirable and wonder why people don't do the Right Thing . -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) The only reason some people get lost in thought is because it's unfamiliar territory. (Paul Fix) -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sun Jul 27 21:45:25 2008 From: bob@REDACTED (Bob Cowdery) Date: Sun, 27 Jul 2008 20:45:25 +0100 Subject: [erlang-questions] wxerlang and linux In-Reply-To: <480C47B2.2050406@erix.ericsson.se> References: <1208545695.5947.11.camel@ubuntu-life-vm> <480C47B2.2050406@erix.ericsson.se> Message-ID: <1217187925.5319.10.camel@vm-linux-home> I've only just got back to looking at this as the last few months have been a bit hectic. Sorry for my ignorance but what should I copy from where. The priv directory after the build is empty. However I'm on a new VM and I'm not sure if the build worked last time or not, maybe I didn't look close enough. The build does not work correctly now: ./configure cannot find test/Makefile.in As usual, any help appreciated. Bob On Mon, 2008-04-21 at 09:52 +0200, Dan Gudmundsson wrote: > Arrgh, The installer doesn't install the driver on unix :-( > Copy the priv dir to wherever you installed it. > > Thanks for the bug report. > > /Dan > > Bob Cowdery wrote: > > Hi > > > > Has anyone set up wxwidgets on Ubuntu? I'm trying to port my wxerlang > > code to Linux and I just get an enoent error from wx:new(). As far as I > > can see everything wx wise is installed correctly in /usr/lib and > > wx-config reports sensible things. > > > > Any help appreciated. > > > > Bob > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > From ulf@REDACTED Mon Jul 28 09:24:03 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 28 Jul 2008 09:24:03 +0200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <2FD0B40D-E361-467B-AB8D-68FF8C738F0C@cs.otago.ac.nz> References: <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <881064B2-17AC-474A-B3B5-AB6790136895@cs.otago.ac.nz> <54FBB411-0D41-446A-A5B6-B73AF3CA2EE0@cs.otago.ac.nz> <3270809A-6E1F-4952-8935-FC9A94D94EF8@cs.otago.ac.nz> <8209f740807271548n75bcb1d5m32fe82eb06dcdff5@mail.gmail.com> <2FD0B40D-E361-467B-AB8D-68FF8C738F0C@cs.otago.ac.nz> Message-ID: <8209f740807280024v69461b4uccf9b9495415244d@mail.gmail.com> 2008/7/28 Richard A. O'Keefe : > On 28 Jul 2008, at 10:48 am, Ulf Wiger wrote: >> >> But with dynamic code loading, you cannot be sure that the atoms >> (presumably created when a given module is loaded) are there >> when the message is decoded. If the message has been decoded >> before a module matching on the decoded term is loaded, the >> labels expected to be atoms may instead be binaries, and it would >> be difficult to know which. > > > That's easily dealt with: > > ensure_atoms_in_json(Term) -> > json_to_term(term_to_json(Term), > [{label,existing_atom}]. > > This feature was never meant to be useful with things decoded > before the module that cares was loaded. This really has nothing > to do with JSON: it's an issue that comes up any time you make > use of list_to_existing_atom/1. True. For that reason, I tend to use list_to_existing atom/1 only in order to assert that the atoms I try to create are atoms that have already been statically created - since I have them declared in the same module where i call on list_to_existing_atom/1. BR, Ulf W From valentin@REDACTED Mon Jul 28 10:29:59 2008 From: valentin@REDACTED (Valentin Micic) Date: Mon, 28 Jul 2008 10:29:59 +0200 Subject: [erlang-questions] How many fragments would be proper for 1milions records in mensia? References: <8209f740807270112j64c42a8arab7035250fb4240@mail.gmail.com> Message-ID: <002e01c8f08c$24de1140$6501a8c0@moneymaker2> I'd say that also depends on what storage method you're using. Thus, in a case you're planning to use DETS (disc_only_copy), you may want to consider fragmentation even for 1 million... In my experience, the performance deteriorates(*) when table gets populated beyond, say, 250,000 entries (if entries are reasonably complex terms). In addition, if you increase a number of dets fragments, make sure that you also increase a number of I/O threads (+A) to some reasonable value(**). V. (*) Inserts and/or updates are affected, read seems to keep good performance levels. (**) If you are using 32-bit environment, try not to get carried away with a number of I/O threads, as the cost in memory may be substantial. ----- Original Message ----- From: "Ulf Wiger" To: "devdoer bird" ; Sent: Sunday, July 27, 2008 10:12 AM Subject: Re: [erlang-questions] How many fragments would be proper for 1milions records in mensia? > Depending on object size, you may well have just a single > table/fragment. 1 million objects is not that much. > > BR, > Ulf W > > 2008/7/27, devdoer bird : >> Hi: >> >> Considering the access performance , easy mangement ,how many fragments >> would be proper for 1 milions records in mensia? Are there any rules >> about >> the number of fragments and the number of total records? >> >> Regards >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From hakan@REDACTED Mon Jul 28 11:33:05 2008 From: hakan@REDACTED (Hakan Mattsson) Date: Mon, 28 Jul 2008 11:33:05 +0200 (CEST) Subject: [erlang-questions] Copy of mnesia tables from a node to a another node without linkage In-Reply-To: <60ed8a460807271110pd1b66d8l702d2ae1f2f7676b@mail.gmail.com> References: <60ed8a460807251500l26aa5e11wc64c22900a19c8cd@mail.gmail.com> <290b3ba10807261714v11f33ddat39b5e7a3bedb6e22@mail.gmail.com> <60ed8a460807271110pd1b66d8l702d2ae1f2f7676b@mail.gmail.com> Message-ID: You may also use the code in the change_node_name example in the Mnesia User's Guide: http://www.erlang.org/doc/apps/mnesia/Mnesia_chap7.html#6.9 /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson On Sun, 27 Jul 2008, Greg Burri wrote: gb> Date: Sun, 27 Jul 2008 20:10:38 +0200 gb> From: Greg Burri gb> To: t ty , gb> "Erlang-Questions (E-mail)" gb> Subject: Re: [erlang-questions] Copy of mnesia tables from a node to a gb> another node without linkage gb> gb> Ok, thanks you ! I will try these two solutions. gb> gb> /Greg gb> gb> On Sun, Jul 27, 2008 at 2:14 AM, t ty wrote: gb> > IIRC any dump of the table would actually encode the node name in it. gb> > i.e if your other node shares the same name you are ok. Otherwise you gb> > will have to 'edit' the node's name in. See the 'educational' gb> > mnesia:dump_to_textfile/1 gb> > gb> > Personally I would consider linking the 2 nodes, let mnesia sync then gb> > remove the links as an easy way out. gb> > gb> > t gb> > gb> > On Fri, Jul 25, 2008 at 6:00 PM, Greg Burri wrote: gb> >> Hi everybody. gb> >> gb> >> I want to copy some tables from a node to an another and I want to gb> >> keep the nodes independent. gb> >> gb> >> I have some data in production and I want to upgrade the modules in gb> >> production but before that I have to make some preproduction tests gb> >> with the production data (without destroying my production data :o]). gb> >> gb> >> This "how-to" : http://www.trapexit.org/Distributing_a_Mnesia_schema gb> >> works great but obviously theses nodes are linked... gb> >> gb> >> I try to use mnesia:backup() in the production node and then gb> >> mnesia:restore() to the preproduction node but it doesn't work. The gb> >> saved data are linked to the first node. gb> >> gb> >> gb> >> Does anyone have an idea about this ? gb> >> gb> >> TIA gb> >> gb> >> gb> >> /Greg gb> >> _______________________________________________ gb> >> erlang-questions mailing list gb> >> erlang-questions@REDACTED gb> >> http://www.erlang.org/mailman/listinfo/erlang-questions gb> >> gb> > gb> _______________________________________________ gb> erlang-questions mailing list gb> erlang-questions@REDACTED gb> http://www.erlang.org/mailman/listinfo/erlang-questions gb> From jesper.louis.andersen@REDACTED Mon Jul 28 12:10:51 2008 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 28 Jul 2008 12:10:51 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> Message-ID: <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> On Mon, Jul 28, 2008 at 2:47 AM, Richard A. O'Keefe wrote: > Also, functional language with explicit 'let' allow > let val x = 1 in > let val x = x + 1 in > x+1 end end > (SML) or This is infected with Ocaml syntax style :) The SML way would be: let val x = 1 val x = x + 1 in x + 1 end But at least one SML compiler has a warning with this style of coding since you are shadowing the 'x' value and it quickly becomes rather hard to follow what def-point is meant for each use (To the non-SML'ers, let .. in .. end works somewhat like Schemes LET*). With SML beginners, you often see "imperative" style code where the let-blocks evaluation order is used to force imperative code while a more functional solution is apparent to the experienced. What the let-binding tends to be used for is to declare a number of local functions (Which may be recursive) and then gradually combine these into more advanced functions, of which the last is called in the body of the binding. From devdoer2@REDACTED Mon Jul 28 12:28:03 2008 From: devdoer2@REDACTED (devdoer bird) Date: Mon, 28 Jul 2008 18:28:03 +0800 Subject: [erlang-questions] How many fragments would be proper for 1milions records in mensia? In-Reply-To: <002e01c8f08c$24de1140$6501a8c0@moneymaker2> References: <8209f740807270112j64c42a8arab7035250fb4240@mail.gmail.com> <002e01c8f08c$24de1140$6501a8c0@moneymaker2> Message-ID: 2008/7/28, Valentin Micic : > > I'd say that also depends on what storage method you're using. Thus, in a > case you're planning to use DETS (disc_only_copy), you may want to consider > fragmentation even for 1 million... In my experience, the performance > deteriorates(*) when table gets populated beyond, say, 250,000 entries (if > entries are reasonably complex terms). Oh,that will be a problem.Can I say mnesia is not proper for very large data-set? If I keep every fragment 250,000 records, then 100 million records will be distrubted in 400 fragments,is it a problem for mnesia? What's the size of your largest mnesia table in your application ? > In addition, if you increase a number of dets fragments, make sure that you > also increase a number of I/O threads (+A) to some reasonable value(**). > > V. > > (*) Inserts and/or updates are affected, read seems to keep good > performance levels. > > (**) If you are using 32-bit environment, try not to get carried away with > a number of I/O threads, as the cost in memory may be substantial. > > ----- Original Message ----- From: "Ulf Wiger" > To: "devdoer bird" ; > Sent: Sunday, July 27, 2008 10:12 AM > Subject: Re: [erlang-questions] How many fragments would be proper for > 1milions records in mensia? > > > Depending on object size, you may well have just a single >> table/fragment. 1 million objects is not that much. >> >> BR, >> Ulf W >> >> 2008/7/27, devdoer bird : >> >>> Hi: >>> >>> Considering the access performance , easy mangement ,how many fragments >>> would be proper for 1 milions records in mensia? Are there any rules >>> about >>> the number of fragments and the number of total records? >>> >>> Regards >>> >>> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From schuett@REDACTED Mon Jul 28 14:08:33 2008 From: schuett@REDACTED (Thorsten Schuett) Date: Mon, 28 Jul 2008 14:08:33 +0200 Subject: [erlang-questions] Scalaris Questions In-Reply-To: References: <200807261042.45277.schuett@zib.de> Message-ID: <200807281408.33470.schuett@zib.de> Hi Rudolph, On Saturday 26 July 2008, Rudolph van Graan wrote: > Hi Thorsten, > > I've had a quick look at Scalaris - It really looks like it may solve > a lot of problems. Nice work! > > Some questions: > > 1. I've looked through the code and it seems that the final storage > uses gb_trees (in cs_db_otp). Obviously this means that the current > version does not support persistence? Or did I not see it? That is correct. > 2. If this is the case, how would you suggest getting persistence into > Scalaris? For me this would be first priority - would you implement > this using mnesia, i.e. disk tables? But with a schema per Scalaris > node? A first try could/should indeed use mnesia. > 3. Would it be sufficient to abstract out cs_db_otp and replace it > with say cs_db_mnesia or cs_db_dets? Or would you suggest using a log- > based scheme? I was thinking of adding a "db" behaviour similar to the routingtable scheme. We currently have two routingtable implementations (rt_simple and rt_chord) and you can switch between them by changing ?RT in chordsharp.hrl. We can do something similar for the db. However, there is still one piece missing. Let's say your server crashed because of power outage or something but all your data is persistent on the disk. When you restart the server, you have to recreate the scalaris nodes running in the vm. There can be several (admin:add_nodes/1). I guess that it will be sufficient to store the id (see cs_keyholder) of each running node. Do you know any log-based Erlang dbs? It could better very interesting for implementing snapshot algorithms. We would be interested in placing a marker into the db and later on grab a snapshot of the database with the version as given by the marker. > I have looked through the slides/videos presented in London, and a > couple of questions popped up: > > 1. As far as I can see you loaded the entire English Wikipedia into > 320 + 20 Erlang nodes? So the entire content was distributed into > memory using gb_trees? We ran the demonstrations with the Bavarian resp. Simple English db. The real English is larger. All requests were served out of memory/the gb_trees. > 2. How did the performance of this implementation compare with the > real Wikipedia compensating for the number of machines etc? At around ~15 servers we matched the wikipedia performance. When going beyond 20 servers, the load generator became the bottleneck. > 3. In terms of the Java interface for your Wikipedia demo, did you use > the OtpNode class for communication or only the Term Libraries with a > custom transport? It is based on an OtpConnection, see scalaris/java-api/src/de/zib/chordsharp in the svn (http://code.google.com/p/scalaris). Thorsten From v@REDACTED Mon Jul 28 14:49:42 2008 From: v@REDACTED (Valentin Micic) Date: Mon, 28 Jul 2008 14:49:42 +0200 Subject: [erlang-questions] How many fragments would be proper for1milions records in mensia? In-Reply-To: Message-ID: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> We used to have up to 200 million records (+200 million for indices, therefore 400 million) in a production system, spread over 896 fragments (768 for data and 128 for indices (*)) and that worked reasonably well (all of that on a single node) - the tested limit on that particular system was more than 2*250 million records. Eventually, due to an increase in performance requirements (750 million rows/records and significantly higher transaction rates) we decided to drop MNESIA in subsequent releases of the system (and no, we did *not* replace it with any of commercially available RDBMSes). Mind you, the main reason was really considerable skepticism expressed in this forum regarding suitability of MNESIA for large data volumes (**). At any rate, I cannot tell you how big the largest fragment was (not in terms of bytes anyway), but we did not store more than 300,000 records per fragment. Our performance requirement was to service 100 transactions per second with sub 100 ms response time. These criteria were compromised whenever we approached this load per fragment -- response time would increase to 150-180 ms, or even more when we had lots of deletions). V. (*) Please note that standard MNESIA indexing is not recommended for fragmented table. Rather, as Ulf suggested once, use another (first-class) mensia table to do indexing yourself. (**) Truth be told, I do not think that we would have even consider MNESIA if we were exposed to these kind of views before we actually developed the system. Fortunately, we did not, thus, we had two very successful system releases before we abandon the MNESIA, and by that time, we were quite capable of developing a custom storage mechanism that would satisfy new requirements. What I'm trying to say is: even if it is not the best long-term choice, MNESIA can be used to buy you some valuable time while you're still figuring out what (and how) you're trying to do (it). _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of devdoer bird Sent: 28 July 2008 12:28 PM To: Valentin Micic Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] How many fragments would be proper for1milions records in mensia? 2008/7/28, Valentin Micic : I'd say that also depends on what storage method you're using. Thus, in a case you're planning to use DETS (disc_only_copy), you may want to consider fragmentation even for 1 million... In my experience, the performance deteriorates(*) when table gets populated beyond, say, 250,000 entries (if entries are reasonably complex terms). Oh,that will be a problem.Can I say mnesia is not proper for very large data-set? If I keep every fragment 250,000 records, then 100 million records will be distrubted in 400 fragments,is it a problem for mnesia? What's the size of your largest mnesia table in your application ? In addition, if you increase a number of dets fragments, make sure that you also increase a number of I/O threads (+A) to some reasonable value(**). V. (*) Inserts and/or updates are affected, read seems to keep good performance levels. (**) If you are using 32-bit environment, try not to get carried away with a number of I/O threads, as the cost in memory may be substantial. ----- Original Message ----- From: "Ulf Wiger" To: "devdoer bird" ; Sent: Sunday, July 27, 2008 10:12 AM Subject: Re: [erlang-questions] How many fragments would be proper for 1milions records in mensia? Depending on object size, you may well have just a single table/fragment. 1 million objects is not that much. BR, Ulf W 2008/7/27, devdoer bird : Hi: Considering the access performance , easy mangement ,how many fragments would be proper for 1 milions records in mensia? Are there any rules about the number of fragments and the number of total records? Regards _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Mon Jul 28 14:50:20 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 28 Jul 2008 14:50:20 +0200 Subject: [erlang-questions] Problem with connection via ODBC In-Reply-To: References: Message-ID: <488DC08C.7040305@erix.ericsson.se> Hi, This seems like some kind of configuration problem, maybe it has to do with ipv6. Odbc on unix will use either ipv4 or ipv6 depending on configuration, but if you have a broken configuration maybe odbc tries to use a ipv6 that is not really there?! My first hit when gooling for eafnosupport says: "Address family not supported by protocol This is an error you get when you try to connect(2) or bind(2) a socket to an address where that address doesn't make sense. For example trying to bind a socket created with PF_INET (Protocol Family Internet) to a AF_UNIX (Address Family Unix Domain Socket) address, it just doesn't make sense. Alternatively you forgot to fill in the sin_family or uin_family field in your address structure. Either way the programmer screwed up. This can also occur if the OperatingSystem does not support a particular protocol. For example $ ping6 ::1 ping6: socket: Address family not supported by protocol $ strace ping6 ::1 ... socket(PF_INET6, SOCK_RAW, 58) = -1 EAFNOSUPPORT (Address family not supported by protocol) ... In this case, the machine does not have IPv6 support, but a program tried to use i. Regards Ingela - Erlang/OTP, Ericsson > ------------------------------ > > Message: 3 > Date: Tue, 15 Jul 2008 09:15:03 +0400 > From: camui > Subject: Re: [erlang-questions] Problem with connection via ODBC > To: "Gleb Peregud" > Cc: erlang-questions@REDACTED > Message-ID: > <3df44f150807142215re1450d8l5b5856974760d52e@REDACTED> > Content-Type: text/plain; charset="iso-8859-1" > > I have some doubt in that this is bug in ODBC, because I have no trouble > with connection to the database from another applications (such as > OpenOffice). This applications also use ODBC. > > 2008/7/14, Gleb Peregud : > >> 2008/7/14 camui : >> >> >>> Dear Erlang Team! >>> >>> I have a problem with connection to the remote database via ODBC in >>> >> Erlang. >> >>> 1> odbc:connect("DSN=pg", [{scrollable_cursors, off}]). >>> {error,{{badmatch,{error,eafnosupport}}, >>> [{odbc,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}} >>> >>> The database is located on another machine in the local network. >>> I have tried to connect to this database in the OpenOffice Base (using >>> >> ODBC) >> >>> and there are no problems. And I had not any troubles with connection in >>> Erlang on the machine where database is located. >>> >>> May you help me, please? >>> >>> Andrey. >>> >> Hi, >> >> Quick search about "eafnosupport" (which, as can be read from this >> error log, is the error "code") reveals: >> >> "This is an error you get when you try to connect(2) or bind(2) a >> socket to an address where that address doesn't make sense. " >> >> and >> >> "Either way the programmer screwed up." >> >> So it may be bug in ODBC or i are using it in a wrong way :) >> >> >> -- >> Gleb Peregud >> http://gleber.pl/ >> >> Every minute is to be grasped. >> Time waits for nobody. >> -- Inscription on a Zen Gong >> >> > From ingela@REDACTED Mon Jul 28 15:33:20 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 28 Jul 2008 15:33:20 +0200 Subject: [erlang-questions] SSL: SSL_set_verify callback (Nicola Lugato) In-Reply-To: References: Message-ID: <488DCAA0.2000109@erix.ericsson.se> Hi, I am not sure that the existing Erlang API towards openssl lets you get at this functionallity, however we are working on a new ssl-implementation, that does not use openssl for communication only for cryptographics, where you will be able to do the corresponding. I can not make any promises regarding when we can release this but it is in the pipeline and should be ready in a not too distant future. There is a beta-version of new ssl in R12B but you would have to hack it as that functionality is not yet included in the API. (That code has also changed quite a lot since the R12B release) Regards - Ingela Erlang/OTP, Ericsson > >>> > >>> Hello, > >>> i'm considering porting some code of mine to erlang. It's a network > >>> server that uses SSL. > >>> It makes use of the callback that you can specify on SSL_set_verify (and > >>> similar) to check if a peer is allowed to connect, based on data in its > >>> certificate. > >>> > >>> (see: http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html) > >>> > >>> I've checked the documentation of the SSL application in Erlang > >>> (http://www.erlang.org/doc/apps/ssl/index.html), but i couldn't find a way > >>> to supply such a callback. Is it possible? > >>> This is a fundamental feature of my server so it would be a blocking > >>> problem. > >>> > >>> Thanks, Nicola > From ksiztof.laurenovic@REDACTED Mon Jul 28 16:50:57 2008 From: ksiztof.laurenovic@REDACTED (xenta xenta) Date: Mon, 28 Jul 2008 16:50:57 +0200 Subject: [erlang-questions] Mnesia for mobile telco billing? Message-ID: Hello gents, Just bumpped into Mnesia db and after studying it whole weekend I am still in exalted state by him. Since I dont believe "silver bullets" I diecided to ask Mnesia gurus before starting to prototype it. So what I am looking for is suppopsed to be high performance IMDB for mobile telco billing, currently our R&D department is considering off-the-shelf products like TimesTen, BerkleyDB, MySQL Carrier Grade and so on. But there are also a lot of issues even though they are comercial. could you dedicate some time to check whether Mnesia cover my very strict requirements: 1) The imdb is intended for storing big amout of subscriber fund items (like balances, counters: free traffic, free sms, free minutes, friendly numbers and etc) 2) The number of fund items may vary from 12 mln and up to 420 mln depending on telco provider, means scaling up and scaling out features are necessary 3) Fault tolerance and high availbility level of imdb should be "five nines" at least 4) The host OS is Windows, pls dont I ask me why so :) but this requirement is optional and can be substituted in case imdb provide high performance through the network 5) Locking read and respecting unlocking write requests shall be supported 6) Number of items per atomic locking read/unlocking write may vary from 1 till 20 items 7) As persistent storage supposed to use Oralce DB, where imdb will write all of changes asynchronously, and the fund items will be loaded from persistent storage during fisrt initialization, this req is optional though 8) And the most important requirements are the throughput of IMDb that should be at least 3000 locking read + write requests per second and latency of either read or write request should be not more than 10ms Thank you, Ksiztof -------------- next part -------------- An HTML attachment was scrubbed... URL: From devdoer2@REDACTED Mon Jul 28 16:56:46 2008 From: devdoer2@REDACTED (devdoer bird) Date: Mon, 28 Jul 2008 22:56:46 +0800 Subject: [erlang-questions] How many fragments would be proper for1milions records in mensia? In-Reply-To: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> References: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> Message-ID: Many thanks for your sharing. 2008/7/28, Valentin Micic : > > We used to have up to 200 million records (+200 million for indices, > therefore 400 million) in a production system, spread over 896 fragments > (768 for data and 128 for indices (*)) and that worked reasonably well (all > of that on a single node) ?C the tested limit on that particular system was > more than 2*250 million records. > > > > Eventually, due to an increase in performance requirements (750 million > rows/records and significantly higher transaction rates) we decided to drop > MNESIA in subsequent releases of the system (and no, we did **not** > replace it with any of commercially available RDBMSes). Mind you, the main > reason was really considerable skepticism expressed in this forum regarding > suitability of MNESIA for large data volumes (**). > > > > At any rate, I cannot tell you how big the largest fragment was (not in > terms of bytes anyway), but we did not store more than 300,000 records per > fragment. Our performance requirement was to service 100 transactions per > second with sub 100 ms response time. These criteria were compromised > whenever we approached this load per fragment -- response time would > increase to 150-180 ms, or even more when we had lots of deletions). > > > > > > V. > > > > (*) Please note that standard MNESIA indexing is not recommended for > fragmented table. Rather, as Ulf suggested once, use another (first-class) > mensia table to do indexing yourself. > > > > (**) Truth be told, I do not think that we would have even consider MNESIA > if we were exposed to these kind of views before we actually developed the > system. Fortunately, we did not, thus, we had two very successful system > releases before we abandon the MNESIA, and by that time, we were quite > capable of developing a custom storage mechanism that would satisfy new > requirements. What I'm trying to say is: even if it is not the best > long-term choice, MNESIA can be used to buy you some valuable time while > you're still figuring out what (and how) you're trying to do (it). > > > > > ------------------------------ > > *From:* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *On Behalf Of *devdoer bird > *Sent:* 28 July 2008 12:28 PM > *To:* Valentin Micic > *Cc:* erlang-questions@REDACTED > *Subject:* Re: [erlang-questions] How many fragments would be proper > for1milions records in mensia? > > > > > > 2008/7/28, Valentin Micic : > > I'd say that also depends on what storage method you're using. Thus, in a > case you're planning to use DETS (disc_only_copy), you may want to consider > fragmentation even for 1 million... In my experience, the performance > deteriorates(*) when table gets populated beyond, say, 250,000 entries (if > entries are reasonably complex terms). > > > > Oh,that will be a problem.Can I say mnesia is not proper for very large > data-set? > > If I keep every fragment 250,000 records, then 100 million records will be > distrubted in > > 400 fragments,is it a problem for mnesia? > > What's the size of your largest mnesia table in your application ? > > > In addition, if you increase a number of dets fragments, make sure that you > also increase a number of I/O threads (+A) to some reasonable value(**). > > V. > > (*) Inserts and/or updates are affected, read seems to keep good > performance levels. > > (**) If you are using 32-bit environment, try not to get carried away with > a number of I/O threads, as the cost in memory may be substantial. > > ----- Original Message ----- From: "Ulf Wiger" > To: "devdoer bird" ; > Sent: Sunday, July 27, 2008 10:12 AM > Subject: Re: [erlang-questions] How many fragments would be proper for > 1milions records in mensia? > > Depending on object size, you may well have just a single > table/fragment. 1 million objects is not that much. > > BR, > Ulf W > > 2008/7/27, devdoer bird : > > Hi: > > Considering the access performance , easy mangement ,how many fragments > would be proper for 1 milions records in mensia? Are there any rules about > the number of fragments and the number of total records? > > Regards > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpellerin@REDACTED Mon Jul 28 17:10:04 2008 From: jpellerin@REDACTED (jason pellerin) Date: Mon, 28 Jul 2008 11:10:04 -0400 Subject: [erlang-questions] Scalaris Questions Message-ID: <3bb02d620807280810h47f0303at44b213c22cd41a74@mail.gmail.com> First off, thank you, thank you, thank you for releasing scalaris. It's such an interesting application. >> 3. Would it be sufficient to abstract out cs_db_otp and replace it >> with say cs_db_mnesia or cs_db_dets? Or would you suggest using a log- >> based scheme? > >I was thinking of adding a "db" behaviour similar to the routingtable scheme. >We currently have two routingtable implementations (rt_simple and rt_chord) >and you can switch between them by changing ?RT in chordsharp.hrl. We can do >something similar for the db. I'm very interested in this, too. The ability to plug in an arbitrary storage module would be very useful. For instance, I'd really like to try out tcerl (tokyocabinet) as the storage backend, since it provides ordered storage on disk, and is very fast and compact. Another question I have about scalaris is how best to use it for transient data, such as web application session state. Ideally, each key would have a lifetime, and automatically expire. It looks like that would require either a specialized storage backend and convention for including the lifetime in the value, or fairly large changes to the api. How would you suggest doing something like this? Lastly, a memcached api seems like a natural fit for scalaris. It's likely that I'll be working on one for my employer -- if they agree to allow me to contribute it back (which they probably will) would you be interested in including something like that in the main distribution of scalaris? Thank you, JP From berlin.brown@REDACTED Mon Jul 28 17:32:12 2008 From: berlin.brown@REDACTED (Berlin Brown) Date: Mon, 28 Jul 2008 08:32:12 -0700 (PDT) Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> Message-ID: <594df510-d8d5-45d9-95f1-1310ed0da0a7@56g2000hsm.googlegroups.com> On Jul 28, 6:10 am, "Jesper Louis Andersen" wrote: > On Mon, Jul 28, 2008 at 2:47 AM, Richard A. O'Keefe wrote: > > > Also, functional language with explicit 'let' allow > > let val x = 1 in > > let val x = x + 1 in > > x+1 end end > > (SML) or > > This is infected with Ocaml syntax style :) The SML way would be: > > let > val x = 1 > val x = x + 1 > in > x + 1 > end > > But at least one SML compiler has a warning with this style of coding > since you are shadowing the 'x' value and it quickly becomes rather > hard to follow what def-point is meant for each use (To the > non-SML'ers, let .. in .. end works somewhat like Schemes LET*). With > SML beginners, you often see "imperative" style code where the > let-blocks evaluation order is used to force imperative code while a > more functional solution is apparent to the experienced. > > What the let-binding tends to be used for is to declare a number of > local functions (Which may be recursive) and then gradually combine > these into more advanced functions, of which the last is called in the > body of the binding. > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions Thanks for all of the responses. I think this is the best solution for what I am doing. lists:foldl( fun(X, Last_value) -> queue:add(X, Last_value) end, queue:new(), [joe, mike]). ------------------- There are a couple of things that I wanted to make clear. I did NOT want to change the mutability aspect of Erlang, as many have suggested, it goes to the core of Erlang and functional programming. And ideally what I suggested was more from "stack/functional" based languages like Factor or Forth not so much imperative languages like Java/C++. I as assuming there was a call stack or some internal mechanism in Erlang that keeps track of the result of the last expression and maybe there is a way to "dup"licate that expression or something similar. In a stack oriented language, you push expression onto the stack and perform operations against values that are on the stack. There are built in functions to duplicate, copy values on the stack. The following code is equivalent in "Factor" a forth based language. Square the values on the stack. 3 3 * . Or 3 dup * . Dup = duplicates the value on the stack. ================ Essentially, I was wishing there was a similar erlang function to do something which might save keystrokes. Q1 = queue(dog, NewQ), Q2 = queue(dog, Q1), Q3 = queue(dog, Q2) ... Q1 = queue(dog, NewQ), queue(dog, erlang:dup()), queue(dog, erlang:dup()) ... where dup = return result from last expression. ... ================ And I don't totally understand how erlang expressions are evaluated so it may not make sense at all in Erlang. For example, with Erlang's pattern matching, internally expressions may not be evaluated in such a routine by routine fashion as they may be in imperative languages. Thanks and this look like a good discussion. From ulf@REDACTED Mon Jul 28 17:40:03 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 28 Jul 2008 17:40:03 +0200 Subject: [erlang-questions] Mnesia for mobile telco billing? In-Reply-To: References: Message-ID: <8209f740807280840q4d10d2f7v4ae289a4fd6097f0@mail.gmail.com> What about geographical redundancy? (If that's a requirement too, the answer is: Mnesia doesn't support it, but it can be faked, to some extent, by fragmenting the tables and spreading the fragments and corresponding replicas smartly. One reason why this is possible is that mnesia is not particularly sensitive to delays in communications, so parts of a transaction can go over low-latency links and others over high-latency links.) As for the other requirements, the answer is "yes, but it depends". It depends on data volumes, and whether it's Ok that you have to do some coding (I've encountered similar cases where a requirement was that the DBMS should do all these things pre-packaged, with no coding whatsoever necessary - this has never been Mnesia's focus.) Prototyping is of course a good idea, and you should convince yourself that you can get the kind of characteristics you want. The requirements you list aren't obvious showstoppers, but Mnesia wasn't primarily designed for implementing billing databases. BR, Ulf W 2008/7/28 xenta xenta : > Hello gents, > > Just bumpped into Mnesia db and after studying it whole weekend I am still > in exalted state by him. Since I dont believe "silver bullets" I diecided to > ask Mnesia gurus before starting to prototype it. So what I am looking for > is suppopsed to be high performance IMDB for mobile telco billing, currently > our R&D department is considering off-the-shelf products like TimesTen, > BerkleyDB, MySQL Carrier Grade and so on. But there are also a lot of issues > even though they are comercial. > > could you dedicate some time to check whether Mnesia cover my very strict > requirements: > > 1) The imdb is intended for storing big amout of subscriber fund items (like > balances, counters: free traffic, free sms, free minutes, friendly numbers > and etc) > > 2) The number of fund items may vary from 12 mln and up to 420 mln depending > on telco provider, means scaling up and scaling out features are necessary > > 3) Fault tolerance and high availbility level of imdb should be "five nines" > at least > > 4) The host OS is Windows, pls dont I ask me why so :) but this requirement > is optional and can be substituted in case imdb provide high performance > through the network > > 5) Locking read and respecting unlocking write requests shall be supported > > 6) Number of items per atomic locking read/unlocking write may vary from 1 > till 20 items > > 7) As persistent storage supposed to use Oralce DB, where imdb will write > all of changes asynchronously, and the fund items will be loaded from > persistent storage during fisrt initialization, this req is optional though > > 8) And the most important requirements are the throughput of IMDb that > should be at least 3000 locking read + write requests per second and latency > of either read or write request should be not more than 10ms > > Thank you, > Ksiztof > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From zerthurd@REDACTED Mon Jul 28 18:03:35 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Jul 2008 20:03:35 +0400 Subject: [erlang-questions] megaco:test_digit_event/2 unexpected behaviour In-Reply-To: <488D94D7.10101@erix.ericsson.se> References: <488D94D7.10101@erix.ericsson.se> Message-ID: Hello, Micael Is there any patch for this bug or not? For the time present, I cannot fix it, but still dig into sourcefile. Thank you On 28/07/2008, Micael Karlberg wrote: > Hi, > > It seems that we parse the DigitMap incorrectly. > [0-9ef] is interpreted as [0-9]ef. > > So, a bug. Thanks for spotting it. > > Regards, > /BMK -- Maxim Treskin From schuett@REDACTED Mon Jul 28 18:04:02 2008 From: schuett@REDACTED (Thorsten Schuett) Date: Mon, 28 Jul 2008 18:04:02 +0200 Subject: [erlang-questions] Scalaris Questions In-Reply-To: <3bb02d620807280810h47f0303at44b213c22cd41a74@mail.gmail.com> References: <3bb02d620807280810h47f0303at44b213c22cd41a74@mail.gmail.com> Message-ID: <200807281804.02558.schuett@zib.de> On Monday 28 July 2008, jason pellerin wrote: > First off, thank you, thank you, thank you for releasing scalaris. > It's such an interesting application. > > >> 3. Would it be sufficient to abstract out cs_db_otp and replace it > >> with say cs_db_mnesia or cs_db_dets? Or would you suggest using a log- > >> based scheme? > > > >I was thinking of adding a "db" behaviour similar to the routingtable > > scheme. We currently have two routingtable implementations (rt_simple and > > rt_chord) and you can switch between them by changing ?RT in > > chordsharp.hrl. We can do something similar for the db. > > I'm very interested in this, too. The ability to plug in an arbitrary > storage module would be very useful. For instance, I'd really like to > try out tcerl (tokyocabinet) as the storage backend, since it provides > ordered storage on disk, and is very fast and compact. > > Another question I have about scalaris is how best to use it for > transient data, such as web application session state. Ideally, each > key would have a lifetime, and automatically expire. It looks like > that would require either a specialized storage backend and convention > for including the lifetime in the value, or fairly large changes to > the api. How would you suggest doing something like this? The easiest way is probably having your own backend (see above) and implement your own timeout mechanism. > Lastly, a memcached api seems like a natural fit for scalaris. It's I was also thinking about adding a memcached interface. > likely that I'll be working on one for my employer -- if they agree to > allow me to contribute it back (which they probably will) would you be > interested in including something like that in the main distribution > of scalaris? Of course. Kai already has a memcached implementation in Erlang. http://kai.svn.sourceforge.net/viewvc/kai/trunk/src/kai_memcache.erl?revision=55&view=markup It should be fairly easy to adapt this code. Thorsten From zerthurd@REDACTED Mon Jul 28 18:11:31 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Jul 2008 20:11:31 +0400 Subject: [erlang-questions] Megaco: Void signalsDescriptor crashes stack Message-ID: Hello When MGC sends to our megaco gateway void signals descriptor, like Signals{}, we have parser error. I make a small patch for this, just add following line into megaco_text_parser_v1.yrl (and for other versions): signalsDescriptor -> 'SignalsToken' 'LBRKT' 'RBRKT' : [] . This works fine, and it seems, that real solution. -- Maxim Treskin From james.hague@REDACTED Mon Jul 28 18:22:28 2008 From: james.hague@REDACTED (James Hague) Date: Mon, 28 Jul 2008 11:22:28 -0500 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <4d08db370807261029m287f2a47w52989ea5205a1d83@mail.gmail.com> <04573073-ABB0-4603-8849-948DFDF563F1@gmail.com> Message-ID: On Sat, Jul 26, 2008 at 5:54 PM, Alain O'Dea wrote: > > Erlang should not introduce mutable variables because they make it easy to > disguise a variety of code smells as clean code. You say "mutable"; I say "introducing a new symbol into the environment which has the same name as a previously existing symbol." The difference is that the second is already 100% possible in Erlang. You can trivially simulate reusing a symbol name without changing Erlang semantics AT ALL. One way is to have a preprocessor make symbol names distinct. Another is by passing all live symbols to a new function as parameters, changing the ones you want (see http://prog21.dadgum.com/5.html). True mutability of data structures is something else entirely, and that's not a road I would ever consider going down. James From zerthurd@REDACTED Mon Jul 28 18:35:22 2008 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 28 Jul 2008 20:35:22 +0400 Subject: [erlang-questions] Megaco: Receive packets only from one MGC Message-ID: Hello How I can make receiving of packets on megaco gateway only from one MGC? For this time I add hack on UDP-level, which check source IP, and accepts packets only from specified IP address of MGC. Is there any clean method to do this without such hacks? I don't see this in man megaco and man megaco_user. Is it possible? Thank you -- Maxim Treskin From paul-trapexit@REDACTED Mon Jul 28 19:35:54 2008 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Mon, 28 Jul 2008 10:35:54 -0700 (PDT) Subject: [erlang-questions] How many fragments would be proper for1milions records in mensia? In-Reply-To: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> References: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> Message-ID: As another opinion, arguing against a large number of fragments: We have some large dbs as well, and we started with a large number of fragments (initially: 1260) but have actually dropped the number of fragments over time (currently: 12). We're using EC2 as we found that introducing a new node or removing an old one went faster with less fragments. Also we have several dbs like this and it was more challenging to inspect mnesia's state when the total number of tables in the system was circa 10000. Finally, with dets there is some memory overhead per fragment that we never completely understood (the "buddy system"), but we found less fragments meant less memory usage. One disadvantage of fewer fragments is that, since it is relatively cheap to move fragments versus repartition, starting with a larger number of fragments allows for relatively straightforward load balancing when introducing new nodes, until you get to the point where you have a fragment for each node. However, lately we've been running the bigger EC2 instance types and using tcerl for the backend and so our node count has been reduced from 24 to 6, thus we could afford to reduce the number of fragments. -- p On Mon, 28 Jul 2008, Valentin Micic wrote: > We used to have up to 200 million records (+200 million for indices, > therefore 400 million) in a production system, spread over 896 fragments > (768 for data and 128 for indices (*)) and that worked reasonably well (all > of that on a single node) - the tested limit on that particular system was > more than 2*250 million records. > > > > Eventually, due to an increase in performance requirements (750 million > rows/records and significantly higher transaction rates) we decided to drop > MNESIA in subsequent releases of the system (and no, we did *not* replace it > with any of commercially available RDBMSes). Mind you, the main reason was > really considerable skepticism expressed in this forum regarding suitability > of MNESIA for large data volumes (**). > > > > At any rate, I cannot tell you how big the largest fragment was (not in > terms of bytes anyway), but we did not store more than 300,000 records per > fragment. Our performance requirement was to service 100 transactions per > second with sub 100 ms response time. These criteria were compromised > whenever we approached this load per fragment -- response time would > increase to 150-180 ms, or even more when we had lots of deletions). > > > > > > V. > > > > (*) Please note that standard MNESIA indexing is not recommended for > fragmented table. Rather, as Ulf suggested once, use another (first-class) > mensia table to do indexing yourself. > > > > (**) Truth be told, I do not think that we would have even consider MNESIA > if we were exposed to these kind of views before we actually developed the > system. Fortunately, we did not, thus, we had two very successful system > releases before we abandon the MNESIA, and by that time, we were quite > capable of developing a custom storage mechanism that would satisfy new > requirements. What I'm trying to say is: even if it is not the best > long-term choice, MNESIA can be used to buy you some valuable time while > you're still figuring out what (and how) you're trying to do (it). > > > > > > _____ > > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of devdoer bird > Sent: 28 July 2008 12:28 PM > To: Valentin Micic > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] How many fragments would be proper > for1milions records in mensia? > > > > > > 2008/7/28, Valentin Micic : > > I'd say that also depends on what storage method you're using. Thus, in a > case you're planning to use DETS (disc_only_copy), you may want to consider > fragmentation even for 1 million... In my experience, the performance > deteriorates(*) when table gets populated beyond, say, 250,000 entries (if > entries are reasonably complex terms). > > > > Oh,that will be a problem.Can I say mnesia is not proper for very large > data-set? > > If I keep every fragment 250,000 records, then 100 million records will be > distrubted in > > 400 fragments,is it a problem for mnesia? > > What's the size of your largest mnesia table in your application ? > > > In addition, if you increase a number of dets fragments, make sure that you > also increase a number of I/O threads (+A) to some reasonable value(**). > > V. > > (*) Inserts and/or updates are affected, read seems to keep good performance > levels. > > (**) If you are using 32-bit environment, try not to get carried away with a > number of I/O threads, as the cost in memory may be substantial. > > ----- Original Message ----- From: "Ulf Wiger" > To: "devdoer bird" ; > Sent: Sunday, July 27, 2008 10:12 AM > Subject: Re: [erlang-questions] How many fragments would be proper for > 1milions records in mensia? > > > > Depending on object size, you may well have just a single > table/fragment. 1 million objects is not that much. > > BR, > Ulf W > > 2008/7/27, devdoer bird : > > Hi: > > Considering the access performance , easy mangement ,how many fragments > would be proper for 1 milions records in mensia? Are there any rules about > the number of fragments and the number of total records? > > Regards > > _______________________________________________ > 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 csanto@REDACTED Mon Jul 28 19:42:22 2008 From: csanto@REDACTED (Corrado Santoro) Date: Mon, 28 Jul 2008 19:42:22 +0200 Subject: [erlang-questions] ANN: New Italian Erlang User Group Message-ID: <488E04FE.6090505@diit.unict.it> Hi all, I'm proud to announce the birth of the first (in my knowledge) Italian Erlang user group. http://groups.google.it/group/erlang-etna It is also advertised in trapexit: http://www.trapexit.org/ErlangUserGroups#Etna_Erlang_User_Group Membership is free and the discussions are mainly in Italian, so if you are located in Italy, feel free to join! All the best, --Corrado -- ================================================================== 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 jchris@REDACTED Mon Jul 28 20:42:04 2008 From: jchris@REDACTED (Chris Anderson) Date: Mon, 28 Jul 2008 11:42:04 -0700 Subject: [erlang-questions] json_to_term EEP Message-ID: Richard, Thanks again for your work on the EEP. I've been communicating with Damien (CouchDB lead) about the shape of objects as returned by json_to_term(). We think that returning a list of tuples is preferable to returning a tuple of tuples. Starting with a JSON object like: {"key":"value", "key2":"value2"} the two options in Erlang are: Tuple of tuples (A): {{<<"key">>, <<"value">>},{<<"key2">>, <<"value2">>}} or Tuple containing a list of tuples (B): {[{<<"key">>, <<"value">>},{<<"key2">>, <<"value2">>}]} We both have a preference for (B - list of tuples) because based on current usage in CouchDB, (A - raw tuples) would have us calling tuple_to_list() constantly when we need to interact with the data. I don't see any big drawbacks to (B) and the ease-of-use argument is important. Requiring less code for the most common use-cases is a big win. Chris -- Chris Anderson http://jchris.mfdz.com From kevin@REDACTED Mon Jul 28 21:34:21 2008 From: kevin@REDACTED (Kevin A. Smith) Date: Mon, 28 Jul 2008 15:34:21 -0400 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: Message-ID: On Jul 28, 2008, at 2:42 PM, Chris Anderson wrote: > Richard, > > Thanks again for your work on the EEP. > > I've been communicating with Damien (CouchDB lead) about the shape of > objects as returned by json_to_term(). We think that returning a list > of tuples is preferable to returning a tuple of tuples. > > Starting with a JSON object like: > > {"key":"value", "key2":"value2"} > > the two options in Erlang are: > > Tuple of tuples (A): {{<<"key">>, <<"value">>},{<<"key2">>, > <<"value2">>}} > > or > > Tuple containing a list of tuples (B): {[{<<"key">>, > <<"value">>},{<<"key2">>, <<"value2">>}]} > > We both have a preference for (B - list of tuples) because based on > current usage in CouchDB, (A - raw tuples) would have us calling > tuple_to_list() constantly when we need to interact with the data. I > don't see any big drawbacks to (B) and the ease-of-use argument is > important. Requiring less code for the most common use-cases is a big > win. Wouldn't B also allow us to access the data as a proplist? If so, that seems like another reason to vote for B. --Kevin > > > Chris > > -- > Chris Anderson > http://jchris.mfdz.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Mon Jul 28 22:47:11 2008 From: bob@REDACTED (Bob Ippolito) Date: Mon, 28 Jul 2008 13:47:11 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: Message-ID: <6a36e7290807281347g774b0af6q420fa4a08eed75b6@mail.gmail.com> On Mon, Jul 28, 2008 at 11:42 AM, Chris Anderson wrote: > Richard, > > Thanks again for your work on the EEP. > > I've been communicating with Damien (CouchDB lead) about the shape of > objects as returned by json_to_term(). We think that returning a list > of tuples is preferable to returning a tuple of tuples. > > Starting with a JSON object like: > > {"key":"value", "key2":"value2"} > > the two options in Erlang are: > > Tuple of tuples (A): {{<<"key">>, <<"value">>},{<<"key2">>, <<"value2">>}} > > or > > Tuple containing a list of tuples (B): {[{<<"key">>, > <<"value">>},{<<"key2">>, <<"value2">>}]} > > We both have a preference for (B - list of tuples) because based on > current usage in CouchDB, (A - raw tuples) would have us calling > tuple_to_list() constantly when we need to interact with the data. I > don't see any big drawbacks to (B) and the ease-of-use argument is > important. Requiring less code for the most common use-cases is a big > win. I have a strong preference for B. I don't think I would use it if it was implemented as a tuple of tuples just because it wouldn't be very convenient. -bob From tom.ayerst@REDACTED Mon Jul 28 23:08:48 2008 From: tom.ayerst@REDACTED (Tom Ayerst) Date: Mon, 28 Jul 2008 22:08:48 +0100 Subject: [erlang-questions] dialyzer won't start Message-ID: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> 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. Thanks Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From psa@REDACTED Mon Jul 28 23:51:23 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Mon, 28 Jul 2008 22:51:23 +0100 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: Message-ID: <488E3F5B.3000004@di.uminho.pt> Hi, Chris Anderson wrote: > the two options in Erlang are: > > Tuple of tuples (A): {{<<"key">>, <<"value">>},{<<"key2">>, <<"value2">>}} > > or > > Tuple containing a list of tuples (B): {[{<<"key">>, > <<"value">>},{<<"key2">>, <<"value2">>}]} I think there is no doubt that lists will be more useful than tuples. There is, however another option, that I have been using in a json parser I wrote: (C) an object is simply a proplist, i.e. a list of tuples. This is what one really wants to have in erlang. The difference to option (B) is that while if a single object is decoded it is easy to discard the outer {}, when objects are used inside other structures that is not the case anymore, and (C) will result in a greater chance of allowing a decoded structure to be stored as is with no post-processing in a useful erlang structure. The only problem (C) poses is distinguishing the empty object from an empty array. My solution (which I am almost happy about) is to represent the empty object as [{}]. This way: - objects can be distinguished from arrays, e.g. by the following function: is_object(O=[T|_]) when is_tuple(T) -> true; is_object(_) -> false. - we can use objects as proplists, use functions like lists:keysearch or list comprehensions like Keys = [V || {V,_} <- Object] which will work even for the special empty object [{}]. Anyway, the empty object is not a common case (at least for my purposes), and the advantages of being able to store nested objects in the most pleasant way is something that should make one consider option (C). As others have said, I also do not consider option (A) useful. Regards, Paulo P.S. Given the sudden interest in json, I will describe the options I took in my parser and make it available in a subsequent post, to further discussion. From jchris@REDACTED Tue Jul 29 00:43:15 2008 From: jchris@REDACTED (Chris Anderson) Date: Mon, 28 Jul 2008 15:43:15 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <488E3F5B.3000004@di.uminho.pt> References: <488E3F5B.3000004@di.uminho.pt> Message-ID: Here's an example of (C): >From the JSON: {"key":"value", "key2":"value2"} (C - object as proplist): [{<<"key">>,<<"value">>}, {<<"key2">>, <<"value2">>}] On Mon, Jul 28, 2008 at 2:51 PM, Paulo S?rgio Almeida wrote: > > The only problem (C) poses is distinguishing the empty object from an empty > array. My solution (which I am almost happy about) is to represent the empty > object as [{}]. This way: > > - objects can be distinguished from arrays, e.g. by the following function: > > is_object(O=[T|_]) when is_tuple(T) -> true; > is_object(_) -> false. > > - we can use objects as proplists, use functions like lists:keysearch or > list comprehensions like > > Keys = [V || {V,_} <- Object] > > which will work even for the special empty object [{}]. (C) seems promising to me now that I've convinced myself that there aren't issues with nesting. Thanks for the input, Paulo! -- Chris Anderson http://jchris.mfdz.com From thomasl_erlang@REDACTED Tue Jul 29 00:50:43 2008 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 28 Jul 2008 15:50:43 -0700 (PDT) Subject: [erlang-questions] How many fragments would be proper for1milions records in mensia? In-Reply-To: Message-ID: <384914.16874.qm@web38803.mail.mud.yahoo.com> --- On Mon, 7/28/08, Paul Mineiro wrote: > Finally, with dets there is some memory > overhead per > fragment that we never completely understood (the > "buddy system"), but > we found less fragments meant less memory usage. Presumably this is a variant of buddy memory allocation: http://en.wikipedia.org/wiki/Buddy_memory_allocation Best, Thomas From psa@REDACTED Tue Jul 29 01:02:58 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Tue, 29 Jul 2008 00:02:58 +0100 Subject: [erlang-questions] erljson - a fast JSON parser in Erlang In-Reply-To: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> References: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> Message-ID: <488E5022.7010502@di.uminho.pt> Hi all, now that I have caught your attention with the subject ... ;) Given the sudden interest in JSON, I am making available yet another JSON parser I wrote some time ago. I never ended up polishing it, but considering the risk of forgetting about it for some months ... again, here it goes as is. I wanted something fast, not fancy, but which decoded json into something I could store directly in my data structures, avoiding further post-processing of decoded terms. My design decisions were: - use [] for arrays; - use lists of pairs for objects - the empty object is distinguished from the empty array using a special case [{}] for the empty object; empty objects are rare (at least for my purposes I never used them) and even with this representation one can still use things like lists:keysearch or list comprehensions such as [K || {K,_} <- Object]; - objects are distinguishable from arrays; e.g. is_object([T|_]) when is_tuple(T) -> true; is_object(_)-> false. - objects decoded are ordered by keys; this imposes a negligible overhead and is useful if needed; I use it frequently; this option is arguable but anyway it is a single line of code and easy to change; - strings are decoded to existing atoms, or binaries otherwise; - I was not interested in string processing, only store strings to send them later on; therefore I did not worry about char sets, or decoding into code points or such; the parser is char set agnostic; it can operate on ascii, iso-latin-* or utf8; - but if \uxxxx is used in the input, it assumes and decodes to utf8, using its own functions using binaries, avoiding using general utf processing libraries. - fast encoding to io_lists; special care is taken to see if no escaping is needed, so as to reuse binaries in the structure to encode. (A sample testing on a small example mostly with objects gave about 4 times faster encoding than mochijson2; decoding was about the same speed). - encoding is liberal on allowed keys of objects; it can take integers, floats, atoms, lists, binaries; but produces valid json with keys being strings; - this is an example that means the current version may not produce a roundtrip erlang->json->erlang, as object keys are only decoded to atoms or binaries; this could possibly change; some thought and polishing needed. That's it. Comments, suggestions are welcome. Also, it has not been much tested and bugs may remain. I attach it here. I can also make it available elsewhere. Trapexit? Regards, Paulo -------------- next part -------------- A non-text attachment was scrubbed... Name: erljson.erl Type: text/x-erlang Size: 11622 bytes Desc: not available URL: From ok@REDACTED Tue Jul 29 01:22:52 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 29 Jul 2008 11:22:52 +1200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> Message-ID: <3E055B6A-7A6F-4401-B662-F03EA8B80F58@cs.otago.ac.nz> On 28 Jul 2008, at 10:10 pm, Jesper Louis Andersen wrote: > This is infected with Ocaml syntax style :) OUCH! That hurts! OCaml has to be one of the ugliest genuinely useful functional languages around! > The SML way would be: > > let > val x = 1 > val x = x + 1 > in > x + 1 > end I knew I could do that. That's how SML handles top level bindings, for example. There's a classic trap for young players there: - val x = 1; - fun f y = x + y; - f 2; val it = 3 : int - val x = 4; (* whoops, x was wrong, fix it *) - f 2; val it = 3 : int The new binding for x *shadowed* the old one, it did not *replace it*. So f still uses the old binding, and there's no way to fix it but to redefine f as well. Too much painful experience with this led me to the rule "NEVER declare the same variable twice at the same level, even if you are allowed to". That's one of the reasons I don't want *X in Erlang. From bob@REDACTED Tue Jul 29 01:56:42 2008 From: bob@REDACTED (Bob Ippolito) Date: Mon, 28 Jul 2008 16:56:42 -0700 Subject: [erlang-questions] erljson - a fast JSON parser in Erlang In-Reply-To: <488E5022.7010502@di.uminho.pt> References: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> <488E5022.7010502@di.uminho.pt> Message-ID: <6a36e7290807281656h4ad4cef2icb54e6ce63a816d7@mail.gmail.com> 2008/7/28 Paulo S?rgio Almeida : > - strings are decoded to existing atoms, or binaries otherwise; This doesn't really seem like a great idea for the cases where your code expects a binary but gets an atom instead because some other part of the system happened to have an atom of that name. It "forces" all of your code to use atoms everywhere that you expect to match on something... > - fast encoding to io_lists; special care is taken to see if no escaping is > needed, so as to reuse binaries in the structure to encode. (A sample > testing on a small example mostly with objects gave about 4 times faster > encoding than mochijson2; decoding was about the same speed). Can you provide such an example benchmark? It would be pretty easy to go add a similar special case to mochijson2's encoder. > - encoding is liberal on allowed keys of objects; it can take integers, > floats, atoms, lists, binaries; but produces valid json with keys being > strings; > - this is an example that means the current version may not produce a > roundtrip erlang->json->erlang, as object keys are only decoded to atoms or > binaries; this could possibly change; some thought and polishing needed. I'm pretty sure this is the right thing to do, at least I've found it very convenient and that's how JavaScript behaves. -bob From takeru.inoue@REDACTED Tue Jul 29 02:21:52 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Tue, 29 Jul 2008 09:21:52 +0900 Subject: [erlang-questions] Scalaris Questions In-Reply-To: <200807281804.02558.schuett@zib.de> References: <3bb02d620807280810h47f0303at44b213c22cd41a74@mail.gmail.com> <200807281804.02558.schuett@zib.de> Message-ID: >> Lastly, a memcached api seems like a natural fit for scalaris. It's > I was also thinking about adding a memcached interface. >> likely that I'll be working on one for my employer -- if they agree to >> allow me to contribute it back (which they probably will) would you be >> interested in including something like that in the main distribution >> of scalaris? > Of course. Kai already has a memcached implementation in Erlang. > http://kai.svn.sourceforge.net/viewvc/kai/trunk/src/kai_memcache.erl?revision=55&view=markup > It should be fairly easy to adapt this code. Yes, Kai implemented memcache APIs, and you can adapt it for your code since it's based on Apache Licnese 2.0. If you have any trouble, please post it to our lists. kai-users@REDACTED kai-devel@REDACTED Regards, > Thorsten > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Takeru INOUE From markkicks@REDACTED Tue Jul 29 02:22:12 2008 From: markkicks@REDACTED (mark) Date: Mon, 28 Jul 2008 17:22:12 -0700 Subject: [erlang-questions] inets example eval mod_esi Message-ID: <82fa9e310807281722t17f4246fxe55a0eaa979c5eae@mail.gmail.com> i am trying to get the example in inets working. the eval of mod_esi is not working. how do i get it to work. inets.config & httpd.conf are below this is what i did. cp -R /usr/lib/erlang/lib/inets-5.0.2/src/ /home/mark/ cp -R /usr/lib/erlang/lib/inets-5.0.2/examples/server_root /home/mark/test cd /home/mark/src erl -make erl -config ./inets inets:start(). and i go to http://localhost:8888/ it opens fine but if i go here: http://localhost:8888/eval/httpd_example/newformat I get this html error in html Object Not Found The requested URL /eval/httpd_example/newformat was not found on this server. and in error_log, i get this. how do i get it to ==> error_log <== "Error reading request:No request received on keep-alive connectionbefore server side timeout" [28/Jul/2008:17:11:44 -0700] access to /eval/httpd_example/newformat failed for 127.0.0.1 reason: "httpd_file: Can't access/home/mark/test/htdocs/eval/httpd_example/newformat" [28/Jul/2008:17:11:50 -0700] server crash for 127.0.0.1, reason: "Error reading request:No request received on keep-alive connectionbefore server side timeout" inets.config [{inets, [{services, [{httpd,"/home/mark/test/conf/httpd.conf"}]}]}]. httpd.conf Port 8888 BindAddress * ServerName localhost SocketType ip_comm Modules mod_alias mod_auth mod_esi mod_actions mod_cgi mod_responsecontrol mod_trace mod_range mod_head mod_include mod_dir mod_get mod_log mod_disk_log ServerAdmin jocke@REDACTED ServerRoot /home/mark/test ErrorLog logs/error_log TransferLog logs/access_log SecurityLog logs/security_log ErrorDiskLog logs/error_disk_log ErrorDiskLogSize 200000 10 TransferDiskLog logs/access_disk_log TransferDiskLogSize 200000 10 SecurityDiskLog logs/security_disk_log SecurityDiskLogSize 200000 10 MaxClients 50 KeepAlive on KeepAliveTimeout 10 MaxKeepAliveRequests 10 DocumentRoot /home/mark/test/htdocs DirectoryIndex index.html welcome.html DefaultType text/plain Alias /icons/ /home/mark/test/icons/ Alias /pics/ /home/mark/test/icons/ ScriptAlias /cgi-bin/ /home/mark/test/cgi-bin/ ScriptAlias /htbin/ /home/mark/test/cgi-bin/ ErlScriptAlias /down/erl httpd_example io EvalScriptAlias /eval httpd_example io SSLVerifyClient 0 From ok@REDACTED Tue Jul 29 02:31:29 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 29 Jul 2008 12:31:29 +1200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <594df510-d8d5-45d9-95f1-1310ed0da0a7@56g2000hsm.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> <594df510-d8d5-45d9-95f1-1310ed0da0a7@56g2000hsm.googlegroups.com> Message-ID: <1BB9C2E2-A951-451A-AEBF-5E28F8974A84@cs.otago.ac.nz> On 29 Jul 2008, at 3:32 am, Berlin Brown wrote: > > I think this is the best solution for what I am doing. > > lists:foldl( > fun(X, Last_value) -> queue:add(X, Last_value) end, > queue:new(), > [joe, mike]). Why is this better than using queue:from_list/1? > > There are a couple of things that I wanted to make clear. I did NOT > want to change the mutability aspect of Erlang, as many have > suggested, it goes to the core of Erlang and functional programming. > And ideally what I suggested was more from "stack/functional" based > languages like Factor or Forth not so much imperative languages like > Java/C++. I don't know anything about Factor, but Forth ***IS*** an imperative language. Just because one of the things it goes around smashing is a stack doesn't make it any less based on smashing things. If you liked Forth, you may like Pop. See http://www.cs.bham.ac.uk/research/projects/poplog/freepoplog.html In one box: - Pop11, a dialect of the AI programming language Pop-2 - Common Lisp - Standard ML - a somewhat nonstandard but still useful Prolog - VED, a programmable editor - books, teaching materials, library packages, ... The point of interest about Pop is that it is an explicitly stack- based language. When I was a student at Edinburgh, I adapted a Listerine slogan: I hate Pop: twice every day. > > I as assuming there was a call stack or some internal mechanism in > Erlang that keeps track of the result of the last expression and maybe > there is a way to "dup"licate that expression or something similar. As has already been pointed out, in order to use such a feature you would have to KNOW which was the last expression, which means you would have to KNOW the order in which the arguments of a function call are evaluated. Part of the point of *pure* functional languages is that you have no reason to care what the order is, so the compiler has complete freedom to evaluate things in any order it finds convenient. Now Erlang is not a pure functional language by any means, but the queue operations are in the pure part of the language. It has also been pointed out that if you do NewQ = queue:new() then this _can_ be understood as pushing something on the stack AND THEN POPPING IT OFF. The Pop equivalent would be queue$new() -> NewQ; > Essentially, I was wishing there was a similar erlang function to do > something which might save keystrokes. > > Q1 = queue(dog, NewQ), > Q2 = queue(dog, Q1), > Q3 = queue(dog, Q2) > ... > > Q1 = queue(dog, NewQ), > queue(dog, erlang:dup()), > queue(dog, erlang:dup()) > ... > where dup = return result from last expression. As noted above and in earlier messages, by the time you get to the first erlang:dup(): 1. Q1 is *not* on the stack any more, 2. the "last expression" is 'dog'. In this case, you have queue:from_list/1 which takes a list of items and returns a queue with the same items in the same order. queue:from_list([first,second,third,fourth]) is clearer than ANY hack. > And I don't totally understand how erlang expressions are evaluated so > it may not make sense at all in Erlang. The value of a constant is that constant. The value of a variable is the term bound to that variable. The value of a function call is determined by - evaluating the arguments - finding a matching clause using pattern matching and guards - evaluating the corresponding body and so it goes. There might be an expression stack (there was in the JAM VM for Erlang) or there might not be (the current BEAM VM is register based). Aside from questions of performance, we have no reason to care. > For example, with Erlang's > pattern matching, internally expressions may not be evaluated in such > a routine by routine fashion as they may be in imperative languages. Pattern matching doesn't do anything at all to expression evaluation. As in ML, pattern matching is just a generalisation of 'case'. From ok@REDACTED Tue Jul 29 03:13:07 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 29 Jul 2008 13:13:07 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <488E3F5B.3000004@di.uminho.pt> References: <488E3F5B.3000004@di.uminho.pt> Message-ID: On 29 Jul 2008, at 9:51 am, Paulo S?rgio Almeida wrote: > I think there is no doubt that lists will be more useful than > tuples. There is, however another option, that I have been using in > a json parser I wrote: > > (C) an object is simply a proplist, i.e. a list of tuples. This is in fact what I originally proposed, the tricky point being that {} is a legal empty object in JSON, and we can't map that to [] because that's the representation for the empty sequence []. (O) Original proposal: {} => {}, other objects => list of pairs (A) Armstrong version: object => tuple of pairs, no exceptions. (B) Object => {list of pairs}. (C) Almeida proposal: as (O) but {} => [{}]. The arguments for usability of the result in Erlang are the arguments that originally had me proposing (O). However, I note that nothing stops us providing a range of handy-dandy functions that work on tuples of pairs. %(O) is_object({}) -> true; is_object([{_,_}|_]) -> true; is_object(_) -> false. %(A) is_object(T) -> is_tuple(T). %(B) is_object({T}) -> is_list(T). %(C) is_object([T|_]) -> is_tuple(T); is_object(_) -> false. It's rather annoying to be so bothered about empty objects; do they occur in practical JSON? Proposal (C) seems neat enough; the main problem is fitting the results with @type. -- If stupidity were a crime, who'd 'scape hanging? From sreenivasan.sreeramu@REDACTED Tue Jul 29 03:48:07 2008 From: sreenivasan.sreeramu@REDACTED (Sreenivasan K) Date: Mon, 28 Jul 2008 20:48:07 -0500 Subject: [erlang-questions] Emacs and distel Message-ID: Hi friends i am new to erlang . . . I think emacs is one of the best development tool for erlang . . . At present i am using emacs in windows xp and i came to know that distel is best debugger so thous who are using distel with emacs can explain me how to install distel in windows and how to useit in emacs . . . ??? From devdoer2@REDACTED Tue Jul 29 04:07:57 2008 From: devdoer2@REDACTED (devdoer bird) Date: Tue, 29 Jul 2008 10:07:57 +0800 Subject: [erlang-questions] How many fragments would be proper for1milions records in mensia? In-Reply-To: References: <200807281249.m6SCnDvN009168@mail.pharos-avantgard.com> Message-ID: How can you upgrade the record schema when your fragment is large? The cocurrent r/w will be blocked for a long time without stopping service. 2008/7/29, Paul Mineiro : > > As another opinion, arguing against a large number of fragments: > > We have some large dbs as well, and we started with a large number of > fragments (initially: 1260) but have actually dropped the number of > fragments over time (currently: 12). We're using EC2 as we found that > introducing a new node or removing an old one went faster with less > fragments. Also we have several dbs like this and it was more challenging > to inspect mnesia's state when the total number of tables in the system > was circa 10000. Finally, with dets there is some memory overhead per > fragment that we never completely understood (the "buddy system"), but > we found less fragments meant less memory usage. > > One disadvantage of fewer fragments is that, since it is relatively cheap > to move fragments versus repartition, starting with a larger number of > fragments allows for relatively straightforward load balancing when > introducing new nodes, until you get to the point where you have a > fragment for each node. However, lately we've been running the bigger EC2 > instance types and using tcerl for the backend and so our node count has > been reduced from 24 to 6, thus we could afford to reduce the number of > fragments. > > -- p > > On Mon, 28 Jul 2008, Valentin Micic wrote: > > > We used to have up to 200 million records (+200 million for indices, > > therefore 400 million) in a production system, spread over 896 fragments > > (768 for data and 128 for indices (*)) and that worked reasonably well > (all > > of that on a single node) - the tested limit on that particular system > was > > more than 2*250 million records. > > > > > > > > Eventually, due to an increase in performance requirements (750 million > > rows/records and significantly higher transaction rates) we decided to > drop > > MNESIA in subsequent releases of the system (and no, we did *not* replace > it > > with any of commercially available RDBMSes). Mind you, the main reason > was > > really considerable skepticism expressed in this forum regarding > suitability > > of MNESIA for large data volumes (**). > > > > > > > > At any rate, I cannot tell you how big the largest fragment was (not in > > terms of bytes anyway), but we did not store more than 300,000 records > per > > fragment. Our performance requirement was to service 100 transactions per > > second with sub 100 ms response time. These criteria were compromised > > whenever we approached this load per fragment -- response time would > > increase to 150-180 ms, or even more when we had lots of deletions). > > > > > > > > > > > > V. > > > > > > > > (*) Please note that standard MNESIA indexing is not recommended for > > fragmented table. Rather, as Ulf suggested once, use another > (first-class) > > mensia table to do indexing yourself. > > > > > > > > (**) Truth be told, I do not think that we would have even consider > MNESIA > > if we were exposed to these kind of views before we actually developed > the > > system. Fortunately, we did not, thus, we had two very successful system > > releases before we abandon the MNESIA, and by that time, we were quite > > capable of developing a custom storage mechanism that would satisfy new > > requirements. What I'm trying to say is: even if it is not the best > > long-term choice, MNESIA can be used to buy you some valuable time while > > you're still figuring out what (and how) you're trying to do (it). > > > > > > > > > > > > _____ > > > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of devdoer bird > > Sent: 28 July 2008 12:28 PM > > To: Valentin Micic > > Cc: erlang-questions@REDACTED > > Subject: Re: [erlang-questions] How many fragments would be proper > > for1milions records in mensia? > > > > > > > > > > > > 2008/7/28, Valentin Micic : > > > > I'd say that also depends on what storage method you're using. Thus, in a > > case you're planning to use DETS (disc_only_copy), you may want to > consider > > fragmentation even for 1 million... In my experience, the performance > > deteriorates(*) when table gets populated beyond, say, 250,000 entries > (if > > entries are reasonably complex terms). > > > > > > > > Oh,that will be a problem.Can I say mnesia is not proper for very large > > data-set? > > > > If I keep every fragment 250,000 records, then 100 million records will > be > > distrubted in > > > > 400 fragments,is it a problem for mnesia? > > > > What's the size of your largest mnesia table in your application ? > > > > > > In addition, if you increase a number of dets fragments, make sure that > you > > also increase a number of I/O threads (+A) to some reasonable value(**). > > > > V. > > > > (*) Inserts and/or updates are affected, read seems to keep good > performance > > levels. > > > > (**) If you are using 32-bit environment, try not to get carried away > with a > > number of I/O threads, as the cost in memory may be substantial. > > > > ----- Original Message ----- From: "Ulf Wiger" > > To: "devdoer bird" ; > > Sent: Sunday, July 27, 2008 10:12 AM > > Subject: Re: [erlang-questions] How many fragments would be proper for > > 1milions records in mensia? > > > > > > > > Depending on object size, you may well have just a single > > table/fragment. 1 million objects is not that much. > > > > BR, > > Ulf W > > > > 2008/7/27, devdoer bird : > > > > Hi: > > > > Considering the access performance , easy mangement ,how many fragments > > would be proper for 1 milions records in mensia? Are there any rules > about > > the number of fragments and the number of total records? > > > > Regards > > > > _______________________________________________ > > 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 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dking@REDACTED Tue Jul 29 04:08:47 2008 From: dking@REDACTED (David King) Date: Mon, 28 Jul 2008 19:08:47 -0700 Subject: [erlang-questions] Emacs and distel In-Reply-To: References: Message-ID: <53752DFC-8015-4856-B64D-B63A76131442@ketralnis.com> Distel = Emacs erlang-mode++: http://bc.tech.coop/blog/070528.html On 28 Jul 2008, at 18:48, Sreenivasan K wrote: > Hi friends i am new to erlang . . . I think emacs is one of the best > development tool for erlang . . . At present i am using emacs in > windows xp and i came to know that distel is best debugger so thous > who are using distel with emacs can explain me how to install distel > in windows and how to useit in emacs . . . ??? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From markkicks@REDACTED Tue Jul 29 04:28:05 2008 From: markkicks@REDACTED (mark) Date: Mon, 28 Jul 2008 19:28:05 -0700 Subject: [erlang-questions] json-rpc erlang adding new procedure/ method Message-ID: <82fa9e310807281928n7dbf05bdo4e46d870fedb92ee@mail.gmail.com> 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']}} From w.a.de.jong@REDACTED Tue Jul 29 08:10:23 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 29 Jul 2008 08:10:23 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <488E3F5B.3000004@di.uminho.pt> Message-ID: <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> Hi all, How about a SAX-like API? See for example http://www.p6r.com/articles/2008/05/22/a-sax-like-parser-for-json/. I can imagine that it would be easy to create any of the forms proposed in this thread based on such an API. On the other hand it would allow you to do things that you wouldn't be able to do with a parser that produces a complete representation at once (in particular: parsing very big documents), and it would be better suitedt to support a 'data mapper' approach like the Erlang ASN.1 implementation, Googles Protocol Buffers or erlsom. Regards, Willem On 7/29/08, Richard A. O'Keefe wrote: > > On 29 Jul 2008, at 9:51 am, Paulo S?rgio Almeida wrote: > > I think there is no doubt that lists will be more useful than > > tuples. There is, however another option, that I have been using in > > a json parser I wrote: > > > > (C) an object is simply a proplist, i.e. a list of tuples. > > This is in fact what I originally proposed, > the tricky point being that {} is a legal empty object in JSON, > and we can't map that to [] because that's the representation > for the empty sequence []. > > (O) Original proposal: {} => {}, other objects => list of pairs > (A) Armstrong version: object => tuple of pairs, no exceptions. > (B) Object => {list of pairs}. > (C) Almeida proposal: as (O) but {} => [{}]. > > The arguments for usability of the result in Erlang are the > arguments that originally had me proposing (O). > > However, I note that nothing stops us providing a range of > handy-dandy functions that work on tuples of pairs. > > %(O) > is_object({}) -> true; > is_object([{_,_}|_]) -> true; > is_object(_) -> false. > > %(A) > is_object(T) -> is_tuple(T). > > %(B) > is_object({T}) -> is_list(T). > > %(C) > is_object([T|_]) -> is_tuple(T); > is_object(_) -> false. > > It's rather annoying to be so bothered about empty objects; > do they occur in practical JSON? Proposal (C) seems neat enough; > the main problem is fitting the results with @type. > > -- > If stupidity were a crime, who'd 'scape hanging? > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.hillqvist@REDACTED Tue Jul 29 08:42:45 2008 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Tue, 29 Jul 2008 08:42:45 +0200 Subject: [erlang-questions] Simple Erlang Recommendation (last returned value) In-Reply-To: <594df510-d8d5-45d9-95f1-1310ed0da0a7@56g2000hsm.googlegroups.com> References: <64aa7b3c-dcb2-4717-bde8-9027a114779b@q28g2000prh.googlegroups.com> <488A011D.2010107@lshift.net> <6a36e7290807251021p45df8cb6h681094b33b3f981c@mail.gmail.com> <944df97e-7bd8-4f32-b009-7eb0bf1aba41@x35g2000hsb.googlegroups.com> <14660E6A-2ED8-44F7-8620-7CAB4354C2A1@cs.otago.ac.nz> <56a0a2840807280310v3db5b745la2b444b4f0673f9c@mail.gmail.com> <594df510-d8d5-45d9-95f1-1310ed0da0a7@56g2000hsm.googlegroups.com> Message-ID: <8268eea30807282342u6ee6f627k52f3b5d477857504@mail.gmail.com> Small note: You shoule be able to write: lists:foldl(fun queue:add/2, queue:new(), [joe, mike]). If you would like to save keystrokes. ;-) Kind regards Andreas Hillqvist 2008/7/28, Berlin Brown : > > > On Jul 28, 6:10 am, "Jesper Louis Andersen" > wrote: > > On Mon, Jul 28, 2008 at 2:47 AM, Richard A. O'Keefe wrote: > > > > > Also, functional language with explicit 'let' allow > > > let val x = 1 in > > > let val x = x + 1 in > > > x+1 end end > > > (SML) or > > > > This is infected with Ocaml syntax style :) The SML way would be: > > > > let > > val x = 1 > > val x = x + 1 > > in > > x + 1 > > end > > > > But at least one SML compiler has a warning with this style of coding > > since you are shadowing the 'x' value and it quickly becomes rather > > hard to follow what def-point is meant for each use (To the > > non-SML'ers, let .. in .. end works somewhat like Schemes LET*). With > > SML beginners, you often see "imperative" style code where the > > let-blocks evaluation order is used to force imperative code while a > > more functional solution is apparent to the experienced. > > > > What the let-binding tends to be used for is to declare a number of > > local functions (Which may be recursive) and then gradually combine > > these into more advanced functions, of which the last is called in the > > body of the binding. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > Thanks for all of the responses. > > I think this is the best solution for what I am doing. > > lists:foldl( > fun(X, Last_value) -> queue:add(X, Last_value) end, > queue:new(), > [joe, mike]). > > ------------------- > > There are a couple of things that I wanted to make clear. I did NOT > want to change the mutability aspect of Erlang, as many have > suggested, it goes to the core of Erlang and functional programming. > And ideally what I suggested was more from "stack/functional" based > languages like Factor or Forth not so much imperative languages like > Java/C++. > > I as assuming there was a call stack or some internal mechanism in > Erlang that keeps track of the result of the last expression and maybe > there is a way to "dup"licate that expression or something similar. > > In a stack oriented language, you push expression onto the stack and > perform operations against values that are on the stack. There are > built in functions to duplicate, copy values on the stack. The > following code is equivalent in "Factor" a forth based language. > Square the values on the stack. > > 3 3 * . > > Or > > 3 dup * . > > Dup = duplicates the value on the stack. > > ================ > > Essentially, I was wishing there was a similar erlang function to do > something which might save keystrokes. > > Q1 = queue(dog, NewQ), > Q2 = queue(dog, Q1), > Q3 = queue(dog, Q2) > ... > > Q1 = queue(dog, NewQ), > queue(dog, erlang:dup()), > queue(dog, erlang:dup()) > ... > where dup = return result from last expression. > > ... > ================ > > And I don't totally understand how erlang expressions are evaluated so > it may not make sense at all in Erlang. For example, with Erlang's > pattern matching, internally expressions may not be evaluated in such > a routine by routine fashion as they may be in imperative languages. > > Thanks and this look like a good discussion. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ingela@REDACTED Tue Jul 29 09:50:12 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 29 Jul 2008 09:50:12 +0200 Subject: [erlang-questions] Erlang ODBC with Postgres In-Reply-To: References: Message-ID: <488ECBB4.2030907@erix.ericsson.se> Hi, > Please go through the following link for more ideas.... > http://www.erlang.org/pipermail/erlang-questions/2007-March/025606.html > In my SQL DB, I have used NVARCHAR datatype. This type is not suppotred in > Erlang ODBC. So, I have changed the type to VARCHAR which is supported in > Erlang ODBC. Thus the problem is solved. > > Hopefully the above suggested can be a solotion, however I put support for "SQL_UNICODE-types" corresponding types for nvarchar and friends on the wish list for odbc. Even though it is not a very big job it does not come on top of the priority list, so if anyone wants it badly I would like to encourage you to make a patch-contribution. Otherwise we will get around to it sometime ... probably in a somewhat distant future. Regards - Ingela Erlang/OTP Ericsson From psa@REDACTED Tue Jul 29 10:22:14 2008 From: psa@REDACTED (=?UTF-8?B?UGF1bG8gU8OpcmdpbyBBbG1laWRh?=) Date: Tue, 29 Jul 2008 09:22:14 +0100 Subject: [erlang-questions] erljson - a fast JSON parser in Erlang In-Reply-To: <6a36e7290807281656h4ad4cef2icb54e6ce63a816d7@mail.gmail.com> References: <3c5163930807281408l2bc52b00q52af408891c9b2cb@mail.gmail.com> <488E5022.7010502@di.uminho.pt> <6a36e7290807281656h4ad4cef2icb54e6ce63a816d7@mail.gmail.com> Message-ID: <488ED336.9020106@di.uminho.pt> Hi, Bob Ippolito wrote: > 2008/7/28 Paulo S?rgio Almeida : >> - strings are decoded to existing atoms, or binaries otherwise; > > This doesn't really seem like a great idea for the cases where your > code expects a binary but gets an atom instead because some other part > of the system happened to have an atom of that name. It "forces" all > of your code to use atoms everywhere that you expect to match on > something... That was the idea. If I am interested in matching, I use an atom; otherwise I just store it to send it back later, and I don't care whether it was stored in atom or binary form. In fact, I can have a list of atoms for very frequent strings, so as to save memory when decoding, even if I don't care about matching them. One relevant alternative design I forgot to mention, would be to do it (decode to existing atoms) only for the object keys and not strings in general (as I do now). Maybe it would be faster, not trying to do list_to_existing_atom with little chance of success. (I never tried to figure out the cost of this function.) > >> - fast encoding to io_lists; special care is taken to see if no escaping is >> needed, so as to reuse binaries in the structure to encode. (A sample >> testing on a small example mostly with objects gave about 4 times faster >> encoding than mochijson2; decoding was about the same speed). > > Can you provide such an example benchmark? It would be pretty easy to > go add a similar special case to mochijson2's encoder. Sorry but I don't have much json around and I just made a simple test on a small file I downloaded. But I am sure it will improve speed. I guess over 99.9% of the strings don't need escaping, and traversing an existing list or binary is definitely faster than traversing and building a new one. An added advantage is less pressure on GC. >> - encoding is liberal on allowed keys of objects; it can take integers, >> floats, atoms, lists, binaries; but produces valid json with keys being >> strings; >> - this is an example that means the current version may not produce a >> roundtrip erlang->json->erlang, as object keys are only decoded to atoms or >> binaries; this could possibly change; some thought and polishing needed. > > I'm pretty sure this is the right thing to do, at least I've found it > very convenient and that's how JavaScript behaves. Ok. Thanks for the feedback. Regards, Paulo > > -bob From vychodil.hynek@REDACTED Tue Jul 29 11:30:31 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 29 Jul 2008 11:30:31 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: References: <488E3F5B.3000004@di.uminho.pt> Message-ID: <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> On Tue, Jul 29, 2008 at 3:13 AM, Richard A. O'Keefe wrote: > On 29 Jul 2008, at 9:51 am, Paulo S?rgio Almeida wrote: > > I think there is no doubt that lists will be more useful than > > tuples. There is, however another option, that I have been using in > > a json parser I wrote: > > > > (C) an object is simply a proplist, i.e. a list of tuples. > > This is in fact what I originally proposed, > the tricky point being that {} is a legal empty object in JSON, > and we can't map that to [] because that's the representation > for the empty sequence []. > > (O) Original proposal: {} => {}, other objects => list of pairs > (A) Armstrong version: object => tuple of pairs, no exceptions. > (B) Object => {list of pairs}. > (C) Almeida proposal: as (O) but {} => [{}]. > > The arguments for usability of the result in Erlang are the > arguments that originally had me proposing (O). > > However, I note that nothing stops us providing a range of > handy-dandy functions that work on tuples of pairs. > > %(O) > is_object({}) -> true; > is_object([{_,_}|_]) -> true; > is_object(_) -> false. > > %(A) > is_object(T) -> is_tuple(T). > > %(B) > is_object({T}) -> is_list(T). is_object({T}) -> is_list(T); is_object(_) -> false. % avoid exception > > > %(C) > is_object([T|_]) -> is_tuple(T); > is_object(_) -> false. > > It's rather annoying to be so bothered about empty objects; > do they occur in practical JSON? Proposal (C) seems neat enough; > the main problem is fitting the results with @type. (C) seems good for me too, because proplist works fine with it. > proplists:get_bool(a, [{}]). false > proplists:get_bool(a, [{a, true}]). true > proplists:get_value(a, [{a, true}]). true > proplists:get_value(a, [{a, heh}]). heh > proplists:get_value(a, [{}]). undefined atom is used only for simplicity, but works with binaries too. (JSON's boolean should be true/false atom of course I assume.) > > > -- > If stupidity were a crime, who'd 'scape hanging? > > > > > > > > _______________________________________________ > 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 ingela@REDACTED Tue Jul 29 12:08:44 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 29 Jul 2008 12:08:44 +0200 Subject: [erlang-questions] erlang-questions Digest, Vol 14, Issue 27 In-Reply-To: References: Message-ID: <488EEC2C.1080807@erix.ericsson.se> Hi, chunked encoding with mod_esi works fine in our daily builds. Try it with the OTP-http client maybe you will get a clue about what happens? inets:start(). http:request("http://..."). You can also try to set the verbose option to verbose, debug or trace with the http:set_options/[1,2] to get more information. Maybe if your callback-function crashes you would get this behavior. Regards - Ingela Erlang/OTP, Ericsson > I'm working with inets httpd using a mod_esi module which calls > deliver/2 multiple times before returning from the callback/3 function > in order to send the response back to the client incrementally. Reading > the code in mod_esi quickly hints that this calling pattern should > produced chunked response segments being sent to an http 1.1 client. I > have not been able to get this working for FF3, with the browser > choosing to close the connection before the entire result set is > received. > > If i use wget (which connects as an http 1.0 client), or I supply the > disable chunked attribute to inets httpd, the transfer works correctly. > > Are there known issues with inets httpd and chunked response transport? > > > From rvirding@REDACTED Tue Jul 29 16:07:55 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 29 Jul 2008 16:07:55 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> Message-ID: <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> You will have to forgive but I am now going to do something which I hate when others do it: comment without really knowing much about the topic. :-) Why not just use option (B) and have the empty object as {[]}? It is always consistent and the empty object is easily from the empty list and empty string. I don't see having the extra tuple should cause any problems, but then again I am no expert. I would prefer to always have strings in *one* format and not special case keys with atoms sometimes. Otherwise to be certain you would have to match both atom and binary to find key. Unless you *always* use atoms for keys, which could easily explode. Robert 2008/7/29 Hynek Vychodil > > > On Tue, Jul 29, 2008 at 3:13 AM, Richard A. O'Keefe wrote: > >> On 29 Jul 2008, at 9:51 am, Paulo S?rgio Almeida wrote: >> > I think there is no doubt that lists will be more useful than >> > tuples. There is, however another option, that I have been using in >> > a json parser I wrote: >> > >> > (C) an object is simply a proplist, i.e. a list of tuples. >> >> This is in fact what I originally proposed, >> the tricky point being that {} is a legal empty object in JSON, >> and we can't map that to [] because that's the representation >> for the empty sequence []. >> >> (O) Original proposal: {} => {}, other objects => list of pairs >> (A) Armstrong version: object => tuple of pairs, no exceptions. >> (B) Object => {list of pairs}. >> (C) Almeida proposal: as (O) but {} => [{}]. >> >> The arguments for usability of the result in Erlang are the >> arguments that originally had me proposing (O). >> >> However, I note that nothing stops us providing a range of >> handy-dandy functions that work on tuples of pairs. >> >> %(O) >> is_object({}) -> true; >> is_object([{_,_}|_]) -> true; >> is_object(_) -> false. >> >> %(A) >> is_object(T) -> is_tuple(T). >> >> %(B) >> is_object({T}) -> is_list(T). > > is_object({T}) -> is_list(T); > is_object(_) -> false. % avoid exception > >> >> >> %(C) >> is_object([T|_]) -> is_tuple(T); >> is_object(_) -> false. >> >> It's rather annoying to be so bothered about empty objects; >> do they occur in practical JSON? Proposal (C) seems neat enough; >> the main problem is fitting the results with @type. > > > (C) seems good for me too, because proplist works fine with it. > > > proplists:get_bool(a, [{}]). > false > > proplists:get_bool(a, [{a, true}]). > true > > proplists:get_value(a, [{a, true}]). > true > > proplists:get_value(a, [{a, heh}]). > heh > > proplists:get_value(a, [{}]). > undefined > > atom is used only for simplicity, but works with binaries too. (JSON's > boolean should be true/false atom of course I assume.) > >> >> >> -- >> If stupidity were a crime, who'd 'scape hanging? >> >> >> >> >> >> >> >> _______________________________________________ >> 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 zrinka@REDACTED Tue Jul 29 16:43:50 2008 From: zrinka@REDACTED (Zrinka Maria Kovacic) Date: Tue, 29 Jul 2008 15:43:50 +0100 (BST) Subject: [erlang-questions] load test publications? Message-ID: <24739.78.151.160.146.1217342630.squirrel@mail.erlangsystems.com> Hi everyone I am writing my thesis on the behavior of Erlang systems under heavy load and wondering if you can point me to some related work. Does anyone know some paper, article or study concerning load/stress test? It would be much of a help. If you want, feel free to replay on my private email. Thank you and best regards Zrinka Maria Kovacic zrinka@REDACTED Erlang Training & Consulting From vychodil.hynek@REDACTED Tue Jul 29 16:55:27 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Tue, 29 Jul 2008 16:55:27 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> Message-ID: <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> On Tue, Jul 29, 2008 at 4:07 PM, Robert Virding wrote: > You will have to forgive but I am now going to do something which I hate > when others do it: comment without really knowing much about the topic. :-) > Why not just use option (B) and have the empty object as {[]}? It is always > consistent and the empty object is easily from the empty list and empty > string. I don't see having the extra tuple should cause any problems, but > then again I am no expert. > *I am no expert.* You are joking. So on topic: JSON: {"key":"value", "key2":{}, "key3":[{}, 3.14 , "val", true], "key4": {"a":false, "b":2} } (B): {[ {<<"key">>, <<"value">>}, {<<"key2">>, {[]}}, {<<"key3", [{[]}, 3.14, <<"val">>, true]}, {<<"key4">>, {[{<<"a">>, false},{<<"b">>, 2}]}} ]} (C): [ {<<"key">>, <<"value">>}, {<<"key2">>, [{}]}, {<<"key3", [[{}], 3.14, <<"val">>, true]}, {<<"key4">>, [{<<"a">>, false},{<<"b">>, 2}]} ] (One can use it as simple test case ;-) ) I don't know why (B) version should be better than (C). It's true that (B) have minimal overhead and (C) have a little bit (a really little) more complicate object detection, but in both variants object and list can be determined exactly and in both in function/case guard expression. Notice key2, key3 and key4 values. Result: (B) - one structure level for each object more - no problem in Erlang (C) - first element type check "more" - no problem in Erlang It's fifty fifty in technically manner and only personal preference rules. (One more structure level is worse in my feeling, but ...) > I would prefer to always have strings in *one* format and not special case > keys with atoms sometimes. Otherwise to be certain you would have to match > both atom and binary to find key. Unless you *always* use atoms for keys, > which could easily explode. > I argue unification, so transforming all to atom is insecure and result is don't use this way at all. Aside non-uniformity of list_to_existing_atom way, there is performance drawback too. For each key you must call list_to_existing_atom(binary_to_list(X)) and binary_to_list causes GC pressure in this usage. I would not have use this variant, too. All is binary is best for me. P.S.: Why non-uniform is problem. One can argue, it looks nicer. OK. One can argue, binary->atom transformation is done only for exists atoms and all atoms which used in comparisons are exists. BAD, imagine for example store Erlang term for long time or send to other nodes ... It *can* complicate think, so avoid it if you can and we *can*. I think, it is dangerous. > Robert > > 2008/7/29 Hynek Vychodil > > >> >> On Tue, Jul 29, 2008 at 3:13 AM, Richard A. O'Keefe wrote: >> >>> On 29 Jul 2008, at 9:51 am, Paulo S?rgio Almeida wrote: >>> > I think there is no doubt that lists will be more useful than >>> > tuples. There is, however another option, that I have been using in >>> > a json parser I wrote: >>> > >>> > (C) an object is simply a proplist, i.e. a list of tuples. >>> >>> This is in fact what I originally proposed, >>> the tricky point being that {} is a legal empty object in JSON, >>> and we can't map that to [] because that's the representation >>> for the empty sequence []. >>> >>> (O) Original proposal: {} => {}, other objects => list of pairs >>> (A) Armstrong version: object => tuple of pairs, no exceptions. >>> (B) Object => {list of pairs}. >>> (C) Almeida proposal: as (O) but {} => [{}]. >>> >>> The arguments for usability of the result in Erlang are the >>> arguments that originally had me proposing (O). >>> >>> However, I note that nothing stops us providing a range of >>> handy-dandy functions that work on tuples of pairs. >>> >>> %(O) >>> is_object({}) -> true; >>> is_object([{_,_}|_]) -> true; >>> is_object(_) -> false. >>> >>> %(A) >>> is_object(T) -> is_tuple(T). >>> >>> %(B) >>> is_object({T}) -> is_list(T). >> >> is_object({T}) -> is_list(T); >> is_object(_) -> false. % avoid exception >> >>> >>> >>> %(C) >>> is_object([T|_]) -> is_tuple(T); >>> is_object(_) -> false. >>> >>> It's rather annoying to be so bothered about empty objects; >>> do they occur in practical JSON? Proposal (C) seems neat enough; >>> the main problem is fitting the results with @type. >> >> >> (C) seems good for me too, because proplist works fine with it. >> >> > proplists:get_bool(a, [{}]). >> false >> > proplists:get_bool(a, [{a, true}]). >> true >> > proplists:get_value(a, [{a, true}]). >> true >> > proplists:get_value(a, [{a, heh}]). >> heh >> > proplists:get_value(a, [{}]). >> undefined >> >> atom is used only for simplicity, but works with binaries too. (JSON's >> boolean should be true/false atom of course I assume.) >> >>> >>> >>> -- >>> If stupidity were a crime, who'd 'scape hanging? >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> 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 >> > > -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From ksiztof.laurenovic@REDACTED Tue Jul 29 21:55:13 2008 From: ksiztof.laurenovic@REDACTED (xenta xenta) Date: Tue, 29 Jul 2008 21:55:13 +0200 Subject: [erlang-questions] Mnesia for mobile telco billing? In-Reply-To: <8209f740807280840q4d10d2f7v4ae289a4fd6097f0@mail.gmail.com> References: <8209f740807280840q4d10d2f7v4ae289a4fd6097f0@mail.gmail.com> Message-ID: Thank you for detailed reponse! What i liked in Mnesia that it is adapted for "one by one" synchronous requests that`s right what we need in telco domain, where each request should be safe and logged in redo file, since request may convey fund movements like payment, debiting correction, reservation and so on, it means we cant lose even one of them. Although asynchronous bulk interaction would be more faster and efficient, but not safe such as component which is sending/receiving/retranslating requests towards IMDB becomes statefull and in case of any crash may lose requests which were not processed as for geo redundancy you are right it is worth but not mandatory, moreover that property can be maintaned by Oracle RAC which serves as persistent storage for an IMDB, since Oracle RAC is common choise in telco field btw what do you mean in coding, i am not so good in Erlang / Mnesia yet, has Mnesia allow some coding/redisining ? one more point, on what I have not found any info is Mnesia benchmarks, have you seen it anywhere ? Cheers, Ks. On Mon, Jul 28, 2008 at 5:40 PM, Ulf Wiger wrote: > What about geographical redundancy? > > (If that's a requirement too, the answer is: Mnesia doesn't support it, > but it can be faked, to some extent, by fragmenting the tables and > spreading the fragments and corresponding replicas smartly. > One reason why this is possible is that mnesia is not particularly > sensitive to delays in communications, so parts of a transaction > can go over low-latency links and others over high-latency links.) > > As for the other requirements, the answer is "yes, but it depends". > It depends on data volumes, and whether it's Ok that you have to > do some coding (I've encountered similar cases where a requirement > was that the DBMS should do all these things pre-packaged, with > no coding whatsoever necessary - this has never been Mnesia's > focus.) > > Prototyping is of course a good idea, and you should convince > yourself that you can get the kind of characteristics you want. > The requirements you list aren't obvious showstoppers, but > Mnesia wasn't primarily designed for implementing billing databases. > > BR, > Ulf W > > 2008/7/28 xenta xenta : > > Hello gents, > > > > Just bumpped into Mnesia db and after studying it whole weekend I am > still > > in exalted state by him. Since I dont believe "silver bullets" I diecided > to > > ask Mnesia gurus before starting to prototype it. So what I am looking > for > > is suppopsed to be high performance IMDB for mobile telco billing, > currently > > our R&D department is considering off-the-shelf products like TimesTen, > > BerkleyDB, MySQL Carrier Grade and so on. But there are also a lot of > issues > > even though they are comercial. > > > > could you dedicate some time to check whether Mnesia cover my very strict > > requirements: > > > > 1) The imdb is intended for storing big amout of subscriber fund items > (like > > balances, counters: free traffic, free sms, free minutes, friendly > numbers > > and etc) > > > > 2) The number of fund items may vary from 12 mln and up to 420 mln > depending > > on telco provider, means scaling up and scaling out features are > necessary > > > > 3) Fault tolerance and high availbility level of imdb should be "five > nines" > > at least > > > > 4) The host OS is Windows, pls dont I ask me why so :) but this > requirement > > is optional and can be substituted in case imdb provide high performance > > through the network > > > > 5) Locking read and respecting unlocking write requests shall be > supported > > > > 6) Number of items per atomic locking read/unlocking write may vary from > 1 > > till 20 items > > > > 7) As persistent storage supposed to use Oralce DB, where imdb will write > > all of changes asynchronously, and the fund items will be loaded from > > persistent storage during fisrt initialization, this req is optional > though > > > > 8) And the most important requirements are the throughput of IMDb that > > should be at least 3000 locking read + write requests per second and > latency > > of either read or write request should be not more than 10ms > > > > Thank you, > > Ksiztof > > > > _______________________________________________ > > 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 Tue Jul 29 22:32:18 2008 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 29 Jul 2008 22:32:18 +0200 Subject: [erlang-questions] Mnesia for mobile telco billing? In-Reply-To: References: <8209f740807280840q4d10d2f7v4ae289a4fd6097f0@mail.gmail.com> Message-ID: <8209f740807291332x5319f3b8v8dd38a71f88e45d6@mail.gmail.com> > btw what do you mean in coding, i am not so good in Erlang / Mnesia yet, > has Mnesia allow some coding/redisining ? Mnesia is a programmer's DBMS, and the single biggest advantage is that it almost feels like an extension to the programming language. But it doesn't have a battery of admin tools, like most conventional DBMS products. For programmers building a custom application where some database functionality is needed, this is wonderful, but depending on the problem domain, there may be products that solve a larger part of the problem out of the box. I don't know what's available for billing applications, but I imagine that there *could* be products that provide lots of great provisioning support on top of the basic storage functionality. If you go with Mnesia, you will have to write most of the application logic from scratch. If that's what you were planning to do anyway, no problem. > one more point, on what I have not found any info is Mnesia benchmarks, > have you seen it anywhere ? Of course, you'd need to look for benchmarks that are representative for your application. The nearest I found was this: http://www.erlang.org/pipermail/erlang-questions/2002-April/004608.html Perhaps someone can provide some status update on that one? BR, Ulf W 2008/7/29 xenta xenta : > Thank you for detailed reponse! > > What i liked in Mnesia that it is adapted for "one by one" synchronous > requests that`s right what we need in telco domain, where each request > should be safe and logged in redo file, since request may convey fund > movements like payment, debiting correction, reservation and so on, it means > we cant lose even one of them. Although asynchronous bulk interaction would > be more faster and efficient, but not safe such as component which is > sending/receiving/retranslating requests towards IMDB becomes statefull and > in case of any crash may lose requests which were not processed > > as for geo redundancy you are right it is worth but not mandatory, moreover > that property can be maintaned by Oracle RAC which serves as persistent > storage for an IMDB, since Oracle RAC is common choise in telco field > > btw what do you mean in coding, i am not so good in Erlang / Mnesia yet, has > Mnesia allow some coding/redisining ? > > one more point, on what I have not found any info is Mnesia benchmarks, have > you seen it anywhere ? > > Cheers, > Ks. > > On Mon, Jul 28, 2008 at 5:40 PM, Ulf Wiger wrote: >> >> What about geographical redundancy? >> >> (If that's a requirement too, the answer is: Mnesia doesn't support it, >> but it can be faked, to some extent, by fragmenting the tables and >> spreading the fragments and corresponding replicas smartly. >> One reason why this is possible is that mnesia is not particularly >> sensitive to delays in communications, so parts of a transaction >> can go over low-latency links and others over high-latency links.) >> >> As for the other requirements, the answer is "yes, but it depends". >> It depends on data volumes, and whether it's Ok that you have to >> do some coding (I've encountered similar cases where a requirement >> was that the DBMS should do all these things pre-packaged, with >> no coding whatsoever necessary - this has never been Mnesia's >> focus.) >> >> Prototyping is of course a good idea, and you should convince >> yourself that you can get the kind of characteristics you want. >> The requirements you list aren't obvious showstoppers, but >> Mnesia wasn't primarily designed for implementing billing databases. >> >> BR, >> Ulf W >> >> 2008/7/28 xenta xenta : >> > Hello gents, >> > >> > Just bumpped into Mnesia db and after studying it whole weekend I am >> > still >> > in exalted state by him. Since I dont believe "silver bullets" I >> > diecided to >> > ask Mnesia gurus before starting to prototype it. So what I am looking >> > for >> > is suppopsed to be high performance IMDB for mobile telco billing, >> > currently >> > our R&D department is considering off-the-shelf products like TimesTen, >> > BerkleyDB, MySQL Carrier Grade and so on. But there are also a lot of >> > issues >> > even though they are comercial. >> > >> > could you dedicate some time to check whether Mnesia cover my very >> > strict >> > requirements: >> > >> > 1) The imdb is intended for storing big amout of subscriber fund items >> > (like >> > balances, counters: free traffic, free sms, free minutes, friendly >> > numbers >> > and etc) >> > >> > 2) The number of fund items may vary from 12 mln and up to 420 mln >> > depending >> > on telco provider, means scaling up and scaling out features are >> > necessary >> > >> > 3) Fault tolerance and high availbility level of imdb should be "five >> > nines" >> > at least >> > >> > 4) The host OS is Windows, pls dont I ask me why so :) but this >> > requirement >> > is optional and can be substituted in case imdb provide high performance >> > through the network >> > >> > 5) Locking read and respecting unlocking write requests shall be >> > supported >> > >> > 6) Number of items per atomic locking read/unlocking write may vary from >> > 1 >> > till 20 items >> > >> > 7) As persistent storage supposed to use Oralce DB, where imdb will >> > write >> > all of changes asynchronously, and the fund items will be loaded from >> > persistent storage during fisrt initialization, this req is optional >> > though >> > >> > 8) And the most important requirements are the throughput of IMDb that >> > should be at least 3000 locking read + write requests per second and >> > latency >> > of either read or write request should be not more than 10ms >> > >> > Thank you, >> > Ksiztof >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From anthony.hw.kong@REDACTED Tue Jul 29 23:47:52 2008 From: anthony.hw.kong@REDACTED (Anthony Kong) Date: Wed, 30 Jul 2008 07:47:52 +1000 Subject: [erlang-questions] load test publications? In-Reply-To: <24739.78.151.160.146.1217342630.squirrel@mail.erlangsystems.com> References: <24739.78.151.160.146.1217342630.squirrel@mail.erlangsystems.com> Message-ID: http://www.sics.se/~joe/apachevsyaws.html On Wed, Jul 30, 2008 at 12:43 AM, Zrinka Maria Kovacic < zrinka@REDACTED> wrote: > Hi everyone > > I am writing my thesis on the behavior of Erlang systems under heavy load > and > wondering if you can point me to some related work. Does anyone know some > paper, article or study concerning load/stress test? It would be much of a > help. If you want, feel free to replay on my private email. > > Thank you and best regards > Zrinka Maria Kovacic > > zrinka@REDACTED > Erlang Training & Consulting > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jchris@REDACTED Wed Jul 30 02:11:24 2008 From: jchris@REDACTED (Chris Anderson) Date: Tue, 29 Jul 2008 17:11:24 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> Message-ID: I find this discussion very interesting. Thanks to everyone who has spoken up. 2008/7/28 Willem de Jong : > How about a SAX-like API? See for > example http://www.p6r.com/articles/2008/05/22/a-sax-like-parser-for-json/ CouchDB will definitely need a streaming JSON processor if we are to handle giant documents without building them in memory. The example SAX/JSON parser in C++ is a good read, it's making me want to prototype something like that in Ruby. A SAX-like streaming tokenizer seems like it could lend itself to a nice, lean implementation. On the question of formats, I think any of the proplist formats would be a good choice. Here's a look at is_array() for the proplist options. %(O) is_array([{_,_}|_]) -> false; is_array(T) -> is_list(T). %(B) is_array(T) -> is_list(T). %(C) is_array([T|_]) -> not is_tuple(T); is_array(T) -> is_list(T). (B) has the simplest array/object test-functions and has the parsing/writing advantage that it doesn't require you to look inside each Erlang list, to see if it corresponds to a JSON array or object. This means reading left-to-right you know immediately when you've encountered a JSON array or object. I'm not sure how heavy to weight the easy-to-read (especially as some people could think of the {[]} format as harder to read due to the extra {}. Chris -- Chris Anderson http://jchris.mfdz.com From ok@REDACTED Wed Jul 30 02:50:39 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 30 Jul 2008 12:50:39 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> Message-ID: <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> On 29 Jul 2008, at 6:10 pm, Willem de Jong wrote: > How about a SAX-like API? (1) Anyone who wants such a design can produce their own design, AND their own code. The EEP I am concerned with is a DVM- like design (Document *Value* Model). (2) In the XML world, there are several reasons for being interested in SAX-like designs (why the H*LL they could not bring themselves to say ESIS-like, when ESIS was the traditional SGML model for the event stream, I cannot imagine, unless it was sheer NIH). (A) You can start processing a document without waiting for the end. If people have JSON applications where they need to start, say, processing the properties of an "object" before knowing what other properties it may have, then such a design may be useful for them. See JSON-RPC note below. (B) You can process a HUGE document without having to hold all of it in memory. This was a major issue back in the days of 16-bit machines; one of the merits of Troff was that it produced pages "on-line", and pipelines involving SGML and Troff (or similar) made sense. These days, there are some amazingly large RDF files around, so again, not having to hold the hold thing makes sense. If people have JSON applications where they want to send 100s of MB of data as JSON, such a design may be useful for them. The 'man' documentation kit on Solaris works in very much this way: SGML documentation => events => hacky program that converts element edges to Troff macros => Troff. (C) You may be able to filter an event stream so as to yield the effect of selecting (or removing) elements. I've done more of this than I care to remember piping the output of nsgmls (or of the SWI Prolog SGML parser) through AWK scripts. Think "subset of XPath" and you'll get the idea. This is really a special case of (A) and (B). People who have a need for filtering lengthy JSON streams and want to reduce latency could use such a design. (3) In the functional programming world, SAX is less attractive, because the usual techniques for using an ESIS/SAX-like interface are heavily stateful. Once I had my Document Value Model kit, I found doing things the "functional" way over documents as trees was so much easier than doing things the ESIS/SAX-like way that now work with entire forms whenever I can, and this is *C* programming I'm talking about, where stateful is supposed to be easy. (4) The JSON RFC makes it clear that JSON "messages", if I may call them that, may only be "arrays" or "objects"; a number or a string must be inside something else. In cases where an ESIS/ SAX-like interface might have made sense, it would be more usual using JSON to send a stream of self-contained forms that can be easily processed one at a time as entire things. (5) The JSON-RPC 1.1 draft (I haven't looked at 1.0) hints at some kind of ESIS/SAX-like interface when it says that arguments should be sent in such an order that the receiver can process them when it gets them. How are people actually using JSON-RPC? Is there that much to gain, in actual practice? (6) Not on topic, but I can't help feeling that Linux D-Bus would be nicer if it used JSON... > See for example http://www.p6r.com/articles/2008/05/22/a-sax-like-parser-for-json/ > . I can imagine that it would be easy to create any of the forms > proposed in this thread based on such an API. The thing is, it wouldn't be NEARLY as easy as NOT using such an API. Several Erlang JSON implementations have been mentioned or displayed in this thread already. They are not particularly hard to write. I'd say they are MUCH harder to design than to write! And the ones I have read would definitely have been *harder* to code using an ESIS/ SAX- like interface. > On the other hand it would allow you to do things that you wouldn't > be able to do with a parser that produces a complete representation > at once (in particular: parsing very big documents), and it would be > better suitedt to support a 'data mapper' approach like the Erlang > ASN.1 implementation, Googles Protocol Buffers or erlsom. 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 world has room for both "value" interfaces and "event stream" interfaces. Obviously an ESIS-like interface is possible because we can trivially map JSON to XML: number => string => array => e1...en object => e1... So a JSON parser could simply emit the same event stream (using *precisely* a SAX interface) as an XML parser *would* have emitted given the equivalent XML. That is, you would not have a new *interface*, just a new *parser* that reused your existing "SAX" interface. From rvirding@REDACTED Wed Jul 30 03:26:37 2008 From: rvirding@REDACTED (Robert Virding) Date: Wed, 30 Jul 2008 03:26:37 +0200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> Message-ID: <3dbc6d1c0807291826i1855073ap881d51055aca0348@mail.gmail.com> 2008/7/25 Chris Anderson > On Thu, Jul 24, 2008 at 6:56 PM, Bob Ippolito wrote: > > I'd be curious to know if leex/yecc can do any better than mochijson2 > > (which is written by hand), especially considering that it uses > > binaries instead of strings. > > The version of mochijson2 that is in CouchDB's trunk (not in use) is > about twice as fast as cjson - which is used by CouchDB currently. > > After spending a day writing my own leex/yecc parser, it turns out to > be about 3 times slower than cjson, and about 6 times slower than > mochijson2. I could probably optimize the grammar definition to try to > make it faster. I was hoping that the magic of parser-generators would > give me a big jump on the hand-crafted code. Since it didn't, I don't > plan to pursue it any further. > > If anyone wants to see the leex/yaac code, I can put it online. I have looked at Chris's code and done some optimising of the leex .xrl file. It now goes about 3.5 times faster than before and is only about 20% slower than mochijson2. At least for a limited range of input files. Though Chris uses lists for input as well as for strings while the mochiweb uses binaries. How much this affects the speed I don't know. The difference is *much* less than I expected and *much* *much* easier to read and understand. If I was doing ?t I might consider handwriting the scanner and usng the yecc generated parser. One benefit of the leex generated scanner is that it is re-entrant which means it can easily handle input coming in chunks, as well as being directly usable in the i/o system. The yecc grammar is trivial. As yet leex cannot generate a scanner which will work directly on binaries, but this is no real problem but will unfortunately result in code almost duplication. Parse tools rule, Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Jul 30 03:34:03 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 30 Jul 2008 13:34:03 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> Message-ID: <38C632F4-991C-4F8D-8694-8DE1066385FC@cs.otago.ac.nz> It would be nice if people would read the EEP. On 30 Jul 2008, at 2:55 am, Hynek Vychodil wrote: > I would prefer to always have strings in *one* format and not > special case keys with atoms sometimes. Otherwise to be certain you > would have to match both atom and binary to find key. Unless you > *always* use atoms for keys, which could easily explode. In the EEP, json_to_term(IO_Data, Options) has an option {label,binary} or {label,atom} or {label,existing_atom} There is no corresponding option for strings, which are always binaries. (The idea is that strings are unpredictable data, whereas labels are predictable structure.) {label,binary} says to leave all labels as binaries. This would have been intolerable before <<"...">> syntax was introduced; now the main thing is that it wastes space. {label,atom} says to convert to an atom any label that CAN be converted to an atom, the main limitation being that Erlang atoms are not yet Unicode-ready. (Someone else has an EEP about that, I believe.) This is perfect for communicating with a TRUSTED source, just like receiving Erlang term_to_binary() values and decoding them. {label,existing_atom} means that a module that mentions certain atoms in pattern matches against formerly-JSON labels can be confident of finding those atoms, while other labels may remain binaries. Options are a way of coping with different people's different situations and needs; the trick is to have just enough of them. > I argue unification, Unification of what with what? > so transforming all to atom is insecure and result is don't use this > way at all. WITHIN a trust boundary, all is well. Not all communication crosses trust boundaries, otherwise term_to_binary() would be of little or no use. > > Aside non-uniformity of list_to_existing_atom way, there is > performance drawback too. For each key you must call > list_to_existing_atom(binary_to_list(X)) and binary_to_list causes > GC pressure in this usage. I would not have use this variant, too. What performance drawback? What call to binary_to_list()? Whoever said the binary EXISTED in the first place? The EEP is a proposal for putting these conversion functions in the Erlang core, eventually to be implemented in C. So implemented, the alleged performance drawback simply does not exist. > > P.S.: Why non-uniform is problem. It is a problem for people who EXPECT a uniform translation, and not for people who don't. > One can argue, it looks nicer. OK. One can argue, binary->atom > transformation is done only for exists atoms and all atoms which > used in comparisons are exists. BAD, imagine for example store > Erlang term for long time or send to other nodes Again, you are overlooking the fact that different people have different needs, and that the translation of labels can be (and IS, in the EEP) an OPTION. You are also overlooking the fact that *considered as JSON*, the forms are entirely equivalent, and that since JSON explicitly says that the order of key:value pairs does not matter, there is uncertainty about precisely what Erlang term you get anyway. In fact, for binary storage, conversion to existing atoms is *better* than conversion to binaries, because the Erlang term-to-binary format uses a compression scheme for atoms that it does not use for binaries. Admittedlty, the answer to that is to extend the compression scheme to binaries as well. From jchris@REDACTED Wed Jul 30 03:52:33 2008 From: jchris@REDACTED (Chris Anderson) Date: Tue, 29 Jul 2008 18:52:33 -0700 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: <3dbc6d1c0807291826i1855073ap881d51055aca0348@mail.gmail.com> References: <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <3dbc6d1c0807291826i1855073ap881d51055aca0348@mail.gmail.com> Message-ID: Robert, Thanks for taking the time to optimize the unescape code. I think you have to be seasoned in Erlang before you think to use recursive pattern matching like that. I'll be looking for opportunities to work like that in my code now. For the curious, Robert's version is here http://gist.github.com/3212 and my original is here: http://gist.github.com/2353 (the Erlang term format outputted by this parser is an attempt to match CouchDB's current JSON conventions, although it would be trivial to adjust it to output any of the EEP format options under discussion.) It's a pleasant surprise to me that function dispatch is faster than regex matching. Very cool. -- Chris Anderson http://jchris.mfdz.com From ttmrichter@REDACTED Wed Jul 30 04:22:57 2008 From: ttmrichter@REDACTED (Michael T. Richter) Date: Wed, 30 Jul 2008 10:22:57 +0800 Subject: [erlang-questions] Retry: ERTS external term format questions. Message-ID: <1217384577.2045.0.camel@isolde> Does anybody have some guidance here? Even a pointer to the appropriate docs would be enough. -------- Forwarded Message -------- > From: Michael T. Richter > Reply-To: ttmrichter@REDACTED > To: erlang-questions@REDACTED > Subject: ERTS external term format questions. > Date: Fri, 18 Jul 2008 14:59:11 +0800 > > For testing purposes I need to be able to generate every type of the > External Term Format. I've been able to do this for every type except > REFERENCE_EXT (the system always gives me a NEW_REFERENCE_EXT) and > FUN_EXT (the system always gives me a NEW_FUN_EXT). How would I go > about making the run-time generate the older forms from terms? > > -- > Michael T. Richter (GoogleTalk: > ttmrichter@REDACTED) > I have to wonder why people think that when they can't manage local > personnel within easy strangling and shooting distance, then they can > manage personnel thousands of miles away that have different > languages, cultures, and business rules. (Joe Celko) -- Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) A well-designed and humane interface does not need to be split into beginner and expert subsystems. (Jef Raskin) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Jul 30 05:24:35 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 30 Jul 2008 15:24:35 +1200 Subject: [erlang-questions] fast JSON parser in C In-Reply-To: References: <4888452C.3060400@erlang-consulting.com> <9b08084c0807240349s1de17897q801d3ee7653ec849@mail.gmail.com> <085601c8edb1$5d745b00$185d1100$@com> <9810b81b0807241125i6adde5a5k4fc117f6395a6e22@mail.gmail.com> <6a36e7290807241343u53b4695bx8bf9d94b89b4ff02@mail.gmail.com> <6a36e7290807241556r143e7ce1lc3675dfd8483fdba@mail.gmail.com> <3dbc6d1c0807291826i1855073ap881d51055aca0348@mail.gmail.com> Message-ID: In json_lex2.xrl we find whole_float(TokenChars) -> {ok, NowFloat, 1} = regexp:sub(TokenChars, "e", ".0e"), list_to_float(NowFloat). I note that the Leex pattern for the token string allows capital E, but this regular expression doesn't seem to. \-?{D}+((E|e)(\+|\-)?{D+} ^ I therefore suggest whole_float(Token_Chars) -> list_to_float(insert_point_zero(Token_Chars)). insert_point_zero([$e|Cs]) -> ".0e" ++ Cs; insert_point_zero([$E|Cs]) -> ".0e" ++ Cs; insert_point_zero([C |Cs]) -> [C | insert_point_zero(Cs)]. which also avoids the overheads of regular expressions. From jim@REDACTED Wed Jul 30 08:57:24 2008 From: jim@REDACTED (Jim Larson) Date: Tue, 29 Jul 2008 23:57:24 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: Your message of "Wed, 30 Jul 2008 12:50:39 +1200." <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> Message-ID: <200807300657.m6U6vOTF096408@krumkake.jetcafe.org> In message <5B5B0B86-D10A-4B88-AA77-BD13381E1393@REDACTED> Richard O'Keefe writes: >On 29 Jul 2008, at 6:10 pm, Willem de Jong wrote: >> How about a SAX-like API? > >(1) Anyone who wants such a design can produce their own design, > AND their own code. The EEP I am concerned with is a DVM- > like design (Document *Value* Model). Note: if anyone dislikes DVM because of difficulties in editing large values - have a look at "zippers". >(5) The JSON-RPC 1.1 draft (I haven't looked at 1.0) hints at some > kind of ESIS/SAX-like interface when it says that arguments > should be sent in such an order that the receiver can process > them when it gets them. How are people actually using JSON-RPC? > Is there that much to gain, in actual practice? I've used only JSON-RPC 1.0, which (as gratuitous exposition) was essentially just: requests are JSON objects with the fields: - id: (term) a value to associate request and response - method: (string) the name of the procedure being called - args: (array) the arguments responses are JSON ojects with the fields: - id: (term) to associate the response with the request - result: (term) the result of the procedure application - error: (term) an exceptional result - exactly one of result or error will be null JSON-RPC could be layered directly over TCP, or any other bytestream transport. This means that the JSON parser is required to do proper framing - to be able to handle too much or too little input. This motivated my request for a continuation-based parser interface in my feedback to the original EEP draft. The direct layering of JSON-RPC over a stream transport allowed for out-of-order responses over a single connection. For reasonably-sized requests and responses, this was almost as good as having channels within the connection, as BEEP has. Sadly, JSON-RPC 1.1 looks like it is only layered on top of HTTP, losing this feature. In answer to your question, I've used JSON-RPC (1.0) for a production service, and I've been just fine with a value model for the parsed results. I kept the size of JSON terms small by design: if the parsed terms were too big to conveniently handle as Erlang values, they would have been clogging the transport too much. Jim From jim@REDACTED Wed Jul 30 09:04:25 2008 From: jim@REDACTED (Jim Larson) Date: Wed, 30 Jul 2008 00:04:25 -0700 Subject: [erlang-questions] json_to_term EEP In-Reply-To: Your message of "Wed, 30 Jul 2008 13:34:03 +1200." <38C632F4-991C-4F8D-8694-8DE1066385FC@cs.otago.ac.nz> Message-ID: <200807300704.m6U74PTF096433@krumkake.jetcafe.org> In message <38C632F4-991C-4F8D-8694-8DE1066385FC@REDACTED> Richard A. O'Keefe writes: >On 30 Jul 2008, at 2:55 am, Hynek Vychodil wrote: >> Aside non-uniformity of list_to_existing_atom way, there is >> performance drawback too. For each key you must call >> list_to_existing_atom(binary_to_list(X)) and binary_to_list causes >> GC pressure in this usage. I would not have use this variant, too. > >What performance drawback? What call to binary_to_list()? Whoever said >the binary EXISTED in the first place? The EEP is a proposal for >putting >these conversion functions in the Erlang core, eventually to be >implemented in C. So implemented, the alleged performance drawback >simply >does not exist. I may have been the source of the confusion here. I mentioned list_to_existing_atom/1 in my feedback to Richard's original draft. I mentioned it only to a) point to existing semantics, and b) suggest that the proposed parser interface would allows a pure erlang implementation in addition to being built in to the runtime, though I was not explicit about either reason. Jim From vychodil.hynek@REDACTED Wed Jul 30 12:07:49 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 30 Jul 2008 12:07:49 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <38C632F4-991C-4F8D-8694-8DE1066385FC@cs.otago.ac.nz> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> <38C632F4-991C-4F8D-8694-8DE1066385FC@cs.otago.ac.nz> Message-ID: <4d08db370807300307l199066e7p354b29642e15dbd9@mail.gmail.com> On Wed, Jul 30, 2008 at 3:34 AM, Richard A. O'Keefe wrote: > It would be nice if people would read the EEP. > > On 30 Jul 2008, at 2:55 am, Hynek Vychodil wrote: > >> I would prefer to always have strings in *one* format and not special case >> keys with atoms sometimes. Otherwise to be certain you would have to match >> both atom and binary to find key. Unless you *always* use atoms for keys, >> which could easily explode. >> > > In the EEP, json_to_term(IO_Data, Options) has an option > {label,binary} > or {label,atom} > or {label,existing_atom} > There is no corresponding option for strings, which are > always binaries. (The idea is that strings are > unpredictable data, whereas labels are predictable structure.) > {label,binary} says to leave all labels as binaries. > This would have been intolerable before <<"...">> syntax > was introduced; now the main thing is that it wastes space. > {label,atom} says to convert to an atom any label that CAN > be converted to an atom, the main limitation being that > Erlang atoms are not yet Unicode-ready. (Someone else has > an EEP about that, I believe.) This is perfect for > communicating with a TRUSTED source, just like receiving > Erlang term_to_binary() values and decoding them. > {label,existing_atom} means that a module that mentions > certain atoms in pattern matches against formerly-JSON > labels can be confident of finding those atoms, while > other labels may remain binaries. > > Options are a way of coping with different people's different > situations and needs; the trick is to have just enough of them. > > I argue unification, >> > > Unification of what with what? > > so transforming all to atom is insecure and result is don't use this way >> at all. >> > > WITHIN a trust boundary, all is well. Not all communication > crosses trust boundaries, otherwise term_to_binary() would be > of little or no use. > > >> Aside non-uniformity of list_to_existing_atom way, there is performance >> drawback too. For each key you must call >> list_to_existing_atom(binary_to_list(X)) and binary_to_list causes GC >> pressure in this usage. I would not have use this variant, too. >> > > What performance drawback? What call to binary_to_list()? Whoever said > the binary EXISTED in the first place? The EEP is a proposal for putting > these conversion functions in the Erlang core, eventually to be > implemented in C. So implemented, the alleged performance drawback simply > does not exist. All JSON data coming outside Erlang are binary in first state, there is no Erlang lists outside Erlang. > > >> > P.S.: Why non-uniform is problem. >> > > It is a problem for people who EXPECT a uniform translation, > and not for people who don't. > > One can argue, it looks nicer. OK. One can argue, binary->atom >> transformation is done only for exists atoms and all atoms which used in >> comparisons are exists. BAD, imagine for example store Erlang term for long >> time or send to other nodes >> > > Again, you are overlooking the fact that different people have > different needs, and that the translation of labels can be (and > IS, in the EEP) an OPTION. You are also overlooking the fact > that *considered as JSON*, the forms are entirely equivalent, > and that since JSON explicitly says that the order of key:value > pairs does not matter, there is uncertainty about precisely > what Erlang term you get anyway. > > In fact, for binary storage, conversion to existing atoms is > *better* than conversion to binaries, because the Erlang > term-to-binary format uses a compression scheme for atoms > that it does not use for binaries. > > Admittedlty, the answer to that is to extend the compression > scheme to binaries as well. > > You are overlooking the fact, that there are another scenarios. For example: 1/ Read and parse JSON {"a":1, "b":2, "c":3} on one erlang node with one set of existing atoms (a,b). 2/ Store Erlang term to file [{a,1}, {b,2}, {<<"c">>, 3}] 3/ In another erlang node with existing atom list {a,c} (for examle in some module you want detect c key of data take from JSON) you load and parse same JSON {"a":1, "b":2, "c":3} and from parser you get [{a,1}, {<<"b">>,2}, {c, 3}] 4/ Than you load stored erlang term from file and two think happend. You take [{a,1}, {b,2}, {<<"c">>, 3}] and existing atoms are now {a,b,c}. 5/ Read and poarse JSON {"a":1, "b":2, "c":3} again and you take [{a,1}, {b,2}, {c, 3}] 6/ Great, you have terms [{a,1}, {b,2}, {c, 3}], [{a,1}, {b,2}, {<<"c">>, 3}] and [{a,1}, {<<"b">>,2}, {c, 3}] as Erlang term representing same JSON input {"a":1, "b":2, "c":3}. What the hell, there is some totaly wrong, isn't it? Erlang is way how to make things safe and reliable. Converting keys to atoms is not safe and reliable so don't do it, It hurts you! -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Wed Jul 30 11:05:11 2008 From: als@REDACTED (Anthony Shipman) Date: Wed, 30 Jul 2008 19:05:11 +1000 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> References: <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> Message-ID: <200807301905.11296.als@iinet.net.au> On Wed, 30 Jul 2008 12:55:27 am Hynek Vychodil wrote: > JSON: {"key":"value", "key2":{}, "key3":[{}, 3.14 , "val", true], "key4": > {"a":false, "b":2} } > > (B): {[ > ? ? ? {<<"key">>, <<"value">>}, > ? ? ? {<<"key2">>, {[]}}, > ? ? ? {<<"key3", [{[]}, 3.14, <<"val">>, true]}, > ? ? ? {<<"key4">>, {[{<<"a">>, false},{<<"b">>, 2}]}} > ? ?]} How about {json, [ {...} ] } so that we know what we are looking at and can check it in function argument patterns etc. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Wed Jul 30 11:13:09 2008 From: als@REDACTED (Anthony Shipman) Date: Wed, 30 Jul 2008 19:13:09 +1000 Subject: [erlang-questions] Extensions to comprehensions eeps Message-ID: <200807301913.09216.als@iinet.net.au> A recent eep says Currently, Erlang has Pattern <- Expr to enumerate over the elements of a single list and Pattern <= Expr to enumerate over a binary. EEP 12 [1] adds Pattern [<-] List Pattern {<-} Tuple Pattern <<<->> Binary Why the plethora of obscure arrow symbols? We should only need the one arrow. Since it is a dynamic language the system should know what type of collection is supplied and iterate appropriately. With the above symbols if I change a string from a list to a binary I've got to go and change all of the comprehensions. The funny symbols are a kind of type annotation by stealth that is quite irregular in the language. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From vychodil.hynek@REDACTED Wed Jul 30 15:31:39 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Wed, 30 Jul 2008 15:31:39 +0200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <200807301913.09216.als@iinet.net.au> References: <200807301913.09216.als@iinet.net.au> Message-ID: <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> +1 It is useless mess. It is not improving readability, reliability nor whatever other. On Wed, Jul 30, 2008 at 11:13 AM, Anthony Shipman wrote: > A recent eep says > > Currently, Erlang has > > Pattern <- Expr > > to enumerate over the elements of a single list and > > Pattern <= Expr > > to enumerate over a binary. EEP 12 [1] adds > > Pattern [<-] List > Pattern {<-} Tuple > Pattern <<<->> Binary > > Why the plethora of obscure arrow symbols? We should only need the one > arrow. > Since it is a dynamic language the system should know what type of > collection > is supplied and iterate appropriately. > > With the above symbols if I change a string from a list to a binary I've > got > to go and change all of the comprehensions. > > The funny symbols are a kind of type annotation by stealth that is quite > irregular in the language. > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > _______________________________________________ > 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 golubovsky@REDACTED Wed Jul 30 15:56:29 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Wed, 30 Jul 2008 09:56:29 -0400 Subject: [erlang-questions] How to access functions type signatures? Message-ID: Hi, If somewhere in the documentation we see: fread([IoDevice,] Prompt, Format) -> Result Types: IoDevice = io_device() Prompt = atom() | string() Format = string() Result = {ok, Terms} | eof | {error, What} Terms = [term()] What = term() is the above type information stored anywhere in a machine-consumable form (being readable by an Erlang program is fine)? I am asking this in connection with my Haskell-to-Erlang conversion experiments. Being able to access such information, it would be possible to create Haskell type signatures to call these functions from Haskell code, something like this (manually derived): fread :: IoDevice -> Prompt -> Format -> Result -- or rather IO Result data IoDevice = IoDevice -- perhaps an opaque type data Term = Term -- another opaque type type Prompt = String type Format = String data Result = etc. I did something like this earlier for HSFFIG (derived foreign imports from C function prototypes), but I had to parse C headers, which I would like to avoid this time. Thanks. PS this must be somewhere in th docs, but I haven't been able to dig it up. -- Dimitry Golubovsky Anywhere on the Web From tonyg@REDACTED Wed Jul 30 21:44:50 2008 From: tonyg@REDACTED (Tony Garnock-Jones) Date: Wed, 30 Jul 2008 20:44:50 +0100 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <200807301905.11296.als@iinet.net.au> References: <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> <200807301905.11296.als@iinet.net.au> Message-ID: <4890C4B2.9080003@lshift.net> Anthony Shipman wrote: > How about > {json, [ {...} ] } > so that we know what we are looking at and can check it in function argument > patterns etc. rfc4627.erl uses {obj, [{Key, Value}, ...]}. Personally, I'm in favour of the uniform option {[{Key, Value}, ...]}, with the empty object being {[]}. It permits uniform treatment of the list of key-value pairs without a gratuitous special case. I find myself reading it as if JSON objects are delimited by a new kind of brackets, "{[" and "]}". Tony From jchris@REDACTED Wed Jul 30 22:10:54 2008 From: jchris@REDACTED (Chris Anderson) Date: Wed, 30 Jul 2008 13:10:54 -0700 Subject: [erlang-questions] json_to_term EEP (example code) Message-ID: I've uploaded a primitive version of the parser, so that we can play with real code. The git repo can be cloned (or a tar downloaded) from http://github.com/jchris/erlang-json-eep-parser/tree/master The readme describes running the tests. To just play with the interface, the function is json_eep:term_to_json(JsonString) I've coded up a version of (B) that only outputs strings as binaries (no atoms). It should be easy to modify the grammar file to output some of the other formats, as well as to add the options such as existing_atoms etc. Thanks to Richard, Bob, and Robert for helping me speed it up and work out other kinks. -- Chris Anderson http://jchris.mfdz.com From justin@REDACTED Wed Jul 30 22:22:12 2008 From: justin@REDACTED (Justin Sheehy) Date: Wed, 30 Jul 2008 16:22:12 -0400 Subject: [erlang-questions] Merkle trees and related things in Erlang In-Reply-To: Message-ID: > On 7/14/08 10:09 AM, "Takeru INOUE" wrote: > >>>> What good news! >>>> We were seeking vector clocks and Merkle tree. Several people have been asking about this for a while, so I decided to just go ahead and put it online. The google code project at http://code.google.com/p/distributerl/ now has vector clocks, consistent hashing, and a Merkle tree implementation that is suitable for dynamic trees. The Merkle trees are somewhat different from the traditional style of construction algorithm, because the common way to do it works very well for the original use (digital signatures) but does not adapt easily to trees representing data that changes incrementally over time. The documentation is minimal but functional right now. If anyone has questions about this, feel free to either ask me or post to the google group tied to the code repository. Enjoy. -Justin From kenneth.lundin@REDACTED Wed Jul 30 23:04:20 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 30 Jul 2008 23:04:20 +0200 Subject: [erlang-questions] Retry: ERTS external term format questions. In-Reply-To: <1217384577.2045.0.camel@isolde> References: <1217384577.2045.0.camel@isolde> Message-ID: Hi, NEW_REFERENCE_EXT replaces REFERENCE_EXT starting from OTP R6B (1997). >From the introduction of NEW REFERENCE_EXT the old format (REFERENCE_EXT) is only used by Erlang systems older than the above mentioned and newer systems up to 2 major releases after when the new format was introduced will send them to the older systems to retain backwards compaibility. The same goes for NEW_FUN_EXT and FUN_EXT except that the new format was introduced in as I remember it a somewhat later release , but still a long time ago. So in practice the formats REFERENCE_EXT and FUN_EXT will never occur in Erlang/OTP systems from version R10B or newer. And I don't think you have reason to support or use older systems than that. The documentation about the external protocol which you find here http://www.erlang.org/doc/apps/erts/erl_ext_dist.html#8 need to clarify this. Need to clarify the distribution version used at the handshake and it's relation to OTP and ERTS versions. /Regards Kenneth Erlang/OTP team Ericsson 2008/7/30 Michael T. Richter : > Does anybody have some guidance here? Even a pointer to the appropriate > docs would be enough. > > -------- Forwarded Message -------- > > From: Michael T. Richter > Reply-To: ttmrichter@REDACTED > To: erlang-questions@REDACTED > Subject: ERTS external term format questions. > Date: Fri, 18 Jul 2008 14:59:11 +0800 > > For testing purposes I need to be able to generate every type of the > External Term Format. I've been able to do this for every type except > REFERENCE_EXT (the system always gives me a NEW_REFERENCE_EXT) and FUN_EXT > (the system always gives me a NEW_FUN_EXT). How would I go about making the > run-time generate the older forms from terms? > > -- > Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) > I have to wonder why people think that when they can't manage local > personnel within easy strangling and shooting distance, then they can manage > personnel thousands of miles away that have different languages, cultures, > and business rules. (Joe Celko) > > -- > Michael T. Richter (GoogleTalk: ttmrichter@REDACTED) > A well-designed and humane interface does not need to be split into beginner > and expert subsystems. (Jef Raskin) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From norton@REDACTED Wed Jul 30 16:12:08 2008 From: norton@REDACTED (Joseph Wayne Norton) Date: Wed, 30 Jul 2008 23:12:08 +0900 Subject: [erlang-questions] How to access functions type signatures? In-Reply-To: References: Message-ID: 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). %% @spec () -> ok | whatever %% @doc Helper function to make it easier to generate XML Edoc %% documentation %% make_xml() -> make_xml([undefined]). %% @spec ([atom()]) -> ok | whatever %% @doc Helper function to make it easier to generate XML Edoc %% documentation %% make_xml([ApplicationName]) -> {ok, CurrentDir} = file:get_cwd(), file:set_cwd(".."), {ok, Up1Path} = file:get_cwd(), LastDir = filename:basename(Up1Path), file:set_cwd(".."), Options = [{new, true}, {hidden, true}, {private, true}, {todo, true}] ++ [{layout, ?MODULE}, {dir, LastDir ++ "/doc/xml"}, {file_suffix, ".xml"}], Res = if ApplicationName =/= undefined -> edoc:application(atom_ify(ApplicationName), LastDir, Options); true -> edoc:application(atom_ify(LastDir), LastDir, Options) end, file:set_cwd(CurrentDir), Res. %% --------------------------------------------------------------------- %% @spec atom_ify(X::term()) -> atom() %% @doc Convert a term to an atom (if convertable). atom_ify(X) when is_atom(X) -> X; atom_ify(X) when is_binary(X) -> list_to_atom(binary_to_list(X)); atom_ify(X) when is_list(X) -> list_to_atom(X). %% --------------------------------------------------------------------- module(#xmlElement{name = module, content = Es}, _Options) -> Prolog = ["\n"], Content = [#xmlElement{ name=package , attributes=[#xmlAttribute{name=name,value=[]}] , content=[#xmlElement{ name=modules , attributes=[] , content=[#xmlElement{ name=module , attributes=[#xmlAttribute{name=name,value=[]}] , content=Es }]}]}], xmerl:export_simple(Content,xmerl_xml,[{prolog,Prolog}]). package(#xmlElement{name = package, content = Es}, _Options) -> Prolog = ["\n"], xmerl:export_simple(Es,xmerl_xml, [{prolog,Prolog}]). overview(#xmlElement{name = overview, content = Es}, _Options) -> Prolog = ["\n"], xmerl:export_simple(Es,xmerl_xml, [{prolog,Prolog}]). On Wed, 30 Jul 2008 22:56:29 +0900, Dimitry Golubovsky wrote: > Hi, > > If somewhere in the documentation we see: > > fread([IoDevice,] Prompt, Format) -> Result > > > Types: > > IoDevice = io_device() > Prompt = atom() | string() > Format = string() > Result = {ok, Terms} | eof | {error, What} > Terms = [term()] > What = term() > > > is the above type information stored anywhere in a machine-consumable > form (being readable by an Erlang program is fine)? > > I am asking this in connection with my Haskell-to-Erlang conversion > experiments. Being able to access such information, it would be > possible to create Haskell type signatures to call these functions > from Haskell code, something like this (manually derived): > > fread :: IoDevice -> Prompt -> Format -> Result -- or rather IO Result > > data IoDevice = IoDevice -- perhaps an opaque type > > data Term = Term -- another opaque type > > type Prompt = String > type Format = String > data Result = > > etc. > > I did something like this earlier for HSFFIG (derived foreign imports > from C function prototypes), but I had to parse C headers, which I > would like to avoid this time. > > Thanks. > > PS this must be somewhere in th docs, but I haven't been able to dig it > up. > -- norton@REDACTED From 0x6e6562@REDACTED Wed Jul 30 23:48:36 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Wed, 30 Jul 2008 22:48:36 +0100 Subject: [erlang-questions] Minimum number of attributes in an mnesia table Message-ID: <269388e30807301448p321914b4i32654c39b74747c@mail.gmail.com> Hi, This seems like a very stupid question, but why do you need to have a minimum of two fields in table definition? For example, if you try to create the following table mnesia:create_table(binding,[{type,ordered_set},{attributes, [b]}]), it returns {aborted,{bad_type,binding,{attributes,[b]}}} The apparent solution is to add a dummy field to the table definition. Thx, Ben From 0x6e6562@REDACTED Thu Jul 31 00:37:46 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Wed, 30 Jul 2008 23:37:46 +0100 Subject: [erlang-questions] Minimum number of attributes in an mnesia table In-Reply-To: <7c9d57ea0807301531x1bbec0a8wb32122f516beef82@mail.gmail.com> References: <269388e30807301448p321914b4i32654c39b74747c@mail.gmail.com> <7c9d57ea0807301531x1bbec0a8wb32122f516beef82@mail.gmail.com> Message-ID: <269388e30807301537r48aab7fcla0bc929ba0cd1fa@mail.gmail.com> On Wed, Jul 30, 2008 at 11:31 PM, Sargun Dhillon wrote: > It is a key-store database. One key, multiple values.... That's a fair call, I just would imagined mnesia would provide some syntactic sugar to fill out the value in the key-value pair with some kind of dummy value. Then again, the reason why I am using mnesia just to maintain a tree index could be questioned. The reason why I'm doing this is for easy maintenance in a clustered scenario. Maybe their are other ways to acheive the same goal? >> >> This seems like a very stupid question, but why do you need to have a >> minimum of two fields in table definition? >> >> For example, if you try to create the following table >> >> mnesia:create_table(binding,[{type,ordered_set},{attributes, [b]}]), >> >> it returns >> >> {aborted,{bad_type,binding,{attributes,[b]}}} >> >> The apparent solution is to add a dummy field to the table definition. >> >> Thx, >> >> Ben >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > From 0x6e6562@REDACTED Thu Jul 31 02:25:13 2008 From: 0x6e6562@REDACTED (Ben Hood) Date: Thu, 31 Jul 2008 01:25:13 +0100 Subject: [erlang-questions] Minimum number of attributes in an mnesia table In-Reply-To: <7c9d57ea0807301540m71c72deeo37d04ba18c311fb5@mail.gmail.com> References: <269388e30807301448p321914b4i32654c39b74747c@mail.gmail.com> <7c9d57ea0807301531x1bbec0a8wb32122f516beef82@mail.gmail.com> <269388e30807301537r48aab7fcla0bc929ba0cd1fa@mail.gmail.com> <7c9d57ea0807301540m71c72deeo37d04ba18c311fb5@mail.gmail.com> Message-ID: <269388e30807301725r4e375880w586b731c1266afc2@mail.gmail.com> On Wed, Jul 30, 2008 at 11:40 PM, Sargun Dhillon wrote: > Are you querying based on the value? Why not just use make_ref() as the > index, or an incrementing an integer. I am querying on the key which is a 3 part tuple {X,Y,Z} which is indexed as as a tree in term order. Given X and Y I need to access Z and I also need to query on Z to get X,Y combinations. So I've got 2 tables, 1 in a forwards direction, 1 in reverse as such: {forwards, {X,Y,Z}, const} {reverse, {Z,Y,X}, const} From takeru.inoue@REDACTED Thu Jul 31 02:33:01 2008 From: takeru.inoue@REDACTED (Takeru INOUE) Date: Thu, 31 Jul 2008 09:33:01 +0900 Subject: [erlang-questions] [Kai-users] Merkle trees and related things in Erlang In-Reply-To: References: Message-ID: Good job! The three algorithms are essential in most of distributed data store. Especially, merkle.erl enables the tree to grow incrementally. This is great feature. On Thu, Jul 31, 2008 at 5:22 AM, Justin Sheehy wrote: >> On 7/14/08 10:09 AM, "Takeru INOUE" wrote: >> >>>>> What good news! >>>>> We were seeking vector clocks and Merkle tree. > > Several people have been asking about this for a while, so I decided > to just go ahead and put it online. The google code project at > http://code.google.com/p/distributerl/ now has vector clocks, > consistent hashing, and a Merkle tree implementation that is suitable > for dynamic trees. > > The Merkle trees are somewhat different from the traditional style of > construction algorithm, because the common way to do it works very > well for the original use (digital signatures) but does not adapt > easily to trees representing data that changes incrementally over time. > > The documentation is minimal but functional right now. If anyone has > questions about this, feel free to either ask me or post to the google > group tied to the code repository. > > Enjoy. > > -Justin > > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Kai-users mailing list > Kai-users@REDACTED > https://lists.sourceforge.net/lists/listinfo/kai-users > -- Takeru INOUE From ok@REDACTED Thu Jul 31 03:36:44 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 31 Jul 2008 13:36:44 +1200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <4d08db370807300307l199066e7p354b29642e15dbd9@mail.gmail.com> References: <488E3F5B.3000004@di.uminho.pt> <4d08db370807290230q59bc7ea9r92416adff8499f46@mail.gmail.com> <3dbc6d1c0807290707u4e7f0809vee0a7a9accdb5997@mail.gmail.com> <4d08db370807290755hcd1f0f9n8e2a3ae25400cd9@mail.gmail.com> <38C632F4-991C-4F8D-8694-8DE1066385FC@cs.otago.ac.nz> <4d08db370807300307l199066e7p354b29642e15dbd9@mail.gmail.com> Message-ID: <5C67EE1D-3EBA-4676-AA2E-C07BBB1B5E17@cs.otago.ac.nz> On 30 Jul 2008, at 10:07 pm, Hynek Vychodil wrote: [it was rather hard to figure out what was just quoting and what was actual response] > What performance drawback? What call to binary_to_list()? Whoever > said > the binary EXISTED in the first place? The EEP is a proposal for > putting > these conversion functions in the Erlang core, eventually to be > implemented in C. So implemented, the alleged performance drawback > simply > does not exist. > > All JSON data coming outside Erlang are binary in first state, > there is no Erlang lists outside Erlang. True and irrelevant: the ONLY lists that json_to_term/[1,2] should construct are the ones in the results. NO list construction whatsoever is implied in the handling of strings. Remember, this is an EEP based on Joe Armstrong's suggestion that there should be new built in functions! > You are overlooking the fact, that there are another scenarios. ABSOLUTELY NOT! Remember, options are OPTIONS. > For example: > > 1/ Read and parse JSON {"a":1, "b":2, "c":3} on one erlang node with > one set of existing atoms (a,b). > > 2/ Store Erlang term to file [{a,1}, {b,2}, {<<"c">>, 3}] Remember, this does *NOT* happen by default. For labels to be converted to existing atoms, the programmer HAS TO ASK FOR IT EXPLICITLY. You are 100% right that the DEFAULT options should be safe. However, the real danger here has nothing to do with atoms. The danger is this: if you want to store JSON data, you should store it *as* JSON, not as something else. (I am counting compressed JSON as JSON here.) The EEP points out other ways in which Erlang-encoded-JSON may vary: numbers might be integers or floats, {key,value} pairs may be reordered in many ways. Nor does this have anything to do with Erlang specifically. For ALL languages, if you want to store JSON or transmit it or in any way cause JSON data known to one node to become known to another node you should store or transmit it *AS* (possibly compressed) JSON, not as something else. Anyone who keeps this straight will not run into trouble. > > 3/ In another erlang node with existing atom list {a,c} (for examle > in some module you want detect c key of data take from JSON) you > load and parse same JSON {"a":1, "b":2, "c":3} and from parser you > get [{a,1}, {<<"b">>,2}, {c, 3}] Remember, {label,existing_atom} is meant for a module that wants to receive a JSON term and process it, looking for keys that are mentioned in that module. If an Erlang process holds a JSON term in Erlang form and wants to pass it to another node or another time, it should send it AS JSON. > 4/ Than you load stored erlang term from file and two think happend. > You take [{a,1}, {b,2}, {<<"c">>, 3}] and existing atoms are now > {a,b,c}. > > 5/ Read and poarse JSON {"a":1, "b":2, "c":3} again and you take [{a, > 1}, {b,2}, {c, 3}] > > 6/ Great, you have terms [{a,1}, {b,2}, {c, 3}], [{a,1}, {b,2}, > {<<"c">>, 3}] and [{a,1}, {<<"b">>,2}, {c, 3}] as Erlang term > representing same JSON input {"a":1, "b":2, "c":3}. What the hell, > there is some totaly wrong, isn't it? Yes, and what is wrong is seriously incompetent programming. There are other round trip issues, including the handling of numbers, and the order of {key,value} pairs. Recall that the default is {label,binary}. So in one node we convert a JSON form to an Erlang term. Another node does the same. One of the nodes then sends its term to the other, which compares the two terms. Are they guaranteed to be the same? Nope. [hint FOR ANY PROGRAMMING LANGUAGE AND LIBRARY THE ONLY COMPLETELY RELIABLE WAY TO TRANSMIT JSON DATA IS *AS* *JSON*. Got that? {label,existing_atom} simply is not meant for the use case you present. > > > Erlang is way how to make things safe and reliable. Converting keys > to atoms is not safe and reliable so don't do it, It hurts you! No, it only hurts stupid people. Converting keys to existing atoms is perfectly safe for SOME uses, and there seems to be no good reason to forbid letting people do that when they are willing to take responsibility for it being safe. Expecting JSON forms to convert to identical Erlang terms at all times and in all places, now THAT is not safe and not reliable and WILL hurt you. I could make similar remarks about any language, and about many formats including XML. From ok@REDACTED Thu Jul 31 03:41:29 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 31 Jul 2008 13:41:29 +1200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> References: <200807301913.09216.als@iinet.net.au> <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> Message-ID: <46F3A11E-ECD8-4549-9137-69561C87B184@cs.otago.ac.nz> The statement > > The funny symbols are a kind of type annotation by stealth that is > quite > irregular in the language. applies just as strongly to the existing distinction between <- and <= . Would {<-} be better if written the Clean way as <-: ? How would that be any less "type annotation by stealth"? If it comes to that, how is the distinction between '/' and 'div' not "type annotation by stealth". Let's have some serious comments, please. From ok@REDACTED Thu Jul 31 03:48:07 2008 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 31 Jul 2008 13:48:07 +1200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <200807301913.09216.als@iinet.net.au> References: <200807301913.09216.als@iinet.net.au> Message-ID: On 30 Jul 2008, at 9:13 pm, Anthony Shipman wrote: > A recent eep says > > Currently, Erlang has > > Pattern <- Expr > > to enumerate over the elements of a single list and > > Pattern <= Expr > > to enumerate over a binary. EEP 12 [1] adds > > Pattern [<-] List > Pattern {<-} Tuple > Pattern <<<->> Binary > > Why the plethora of obscure arrow symbols? We should only need the > one arrow. We already have two. I do not find the distinction between <- and <= at all clear, especially given the number of requests we've had to make <= a spelling for less-than-or-equal, and I do not find Clean's distinction between <- (lists) and <-: (arrays) mnemonic either. Adding the appropriate brackets is a way of trying to make it mnemonic. As the EEP points out, I would have preferred <-[], <-{}, <-<<>>, but couldn't get that through Yecc. > > Since it is a dynamic language the system should know what type of > collection > is supplied and iterate appropriately. The generated code needs to be different in each case, which means that the compiler needs to know, unless the code is to be slower or bigger or both. > > > With the above symbols if I change a string from a list to a binary > I've got > to go and change all of the comprehensions. Yes. It has been that way for quite some time, and it's only now that you've noticed? > The funny symbols are a kind of type annotation by stealth that is > quite > irregular in the language. When it is right out there in the open, how is it "stealth"? Please clarify how <- vs <= (in the existing language) is "type annotation by stealth" and 'and' vs 'band' is not. From sgrady@REDACTED Thu Jul 31 03:59:53 2008 From: sgrady@REDACTED (Steven Grady) Date: Wed, 30 Jul 2008 18:59:53 -0700 (PDT) Subject: [erlang-questions] JInterface publishPort() issue Message-ID: <18746378.post@talk.nabble.com> (Erlang and erlang-questions newbie here!) I just spent 3 days tracking down a bug in my code, that was related to JInterface. I thought I would let other people learn from my error. The symptom was that a registered OtpNode stopped responding to messages at some point. Lots of tracking down (e.g. by running epmd with debugging turned on) finally revealed that the name was being unregistered due to the connection closing on the JInterface side. Further thought and investigation showed that it was occurring because the garbage collector was reaping the Socket created in OtpNode.r4_publish(). The problem turned out to be that after creating an OtpNode, I was explicitly calling publishPort(node). But OtpNodes do a publishPort() as part of initialization. Because the port was already published, the 2nd call to r4_publish() was returning null, and the null was being assigned into node.epmd, clobbering the previously-stored Socket. Once GC got around to noticing that no one was referring to the Socket, it closed the connection. So lesson 1: don't call OtpEpmd.publishPort() on an OtpNode(). Lesson 2: Check the return value of functions (had I realized that publishPort() was returning false on the 2nd call, I could have tracked down the bug immediately). Lesson 3: OtpEpmd. publishPort() should probably check to see if node.epmd is already set, and if so, just return (maybe with a warning), rather than clobbering the existing Socket. Lesson 4: Open source rocks. This bug would have been impossible to track down without being to read and modify the source to JInterface and epmd. -Steven -- View this message in context: http://www.nabble.com/JInterface-publishPort%28%29-issue-tp18746378p18746378.html Sent from the Erlang Questions mailing list archive at Nabble.com. From w.a.de.jong@REDACTED Thu Jul 31 08:06:28 2008 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Thu, 31 Jul 2008 08:06:28 +0200 Subject: [erlang-questions] json_to_term EEP In-Reply-To: <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> References: <488E3F5B.3000004@di.uminho.pt> <407d9ef80807282310k5f407fd9l8b09aa3f323b7d22@mail.gmail.com> <5B5B0B86-D10A-4B88-AA77-BD13381E1393@cs.otago.ac.nz> Message-ID: <407d9ef80807302306p7879fc1cne2fbd8e0f5229841@mail.gmail.com> On 7/30/08, Richard A. O'Keefe wrote: > > On 29 Jul 2008, at 6:10 pm, Willem de Jong wrote: > >> How about a SAX-like API? >> > > (1) Anyone who wants such a design can produce their own design, > AND their own code. The EEP I am concerned with is a DVM- > like design (Document *Value* Model). 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. (3) In the functional programming world, SAX is less attractive, > because the usual techniques for using an ESIS/SAX-like interface > are heavily stateful. > > Once I had my Document Value Model kit, I found doing things the > "functional" way over documents as trees was so much easier than > doing things the ESIS/SAX-like way that now work with entire > forms whenever I can, and this is *C* programming I'm talking > about, where stateful is supposed to be easy. I personally like working with a SAX parser. See the example below - I quite enjoyed writing it. > 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. 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. To give an example: 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]. (This corresponds to a slightly shortened version of the second example found on json.org). 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}; 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. With the events given above this gives the following output: (you can use lists:foldl(fun dvm/2, [], E). to try this). {[{"menu", {[{"id","file"}, {"popup", {[{"menuitem", [{[{"value","New"},{"onclick","CreateNewDoc()"}]}, {[{"value","Close"},{"onclick","CloseDoc()"}]}]}]}}]}}]} Regards, Willem -------------- next part -------------- An HTML attachment was scrubbed... URL: From vychodil.hynek@REDACTED Thu Jul 31 09:40:01 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 31 Jul 2008 09:40:01 +0200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <46F3A11E-ECD8-4549-9137-69561C87B184@cs.otago.ac.nz> References: <200807301913.09216.als@iinet.net.au> <4d08db370807300631u41f4d17ds74f3019dbf70c8ab@mail.gmail.com> <46F3A11E-ECD8-4549-9137-69561C87B184@cs.otago.ac.nz> Message-ID: <4d08db370807310040n14c502eh9a7b9fcd99562d99@mail.gmail.com> On Thu, Jul 31, 2008 at 3:41 AM, Richard A. O'Keefe wrote: > The statement > >> >> The funny symbols are a kind of type annotation by stealth that is quite >> irregular in the language. >> > > applies just as strongly to the existing distinction between > <- and <= . Would {<-} be better if written the Clean way as <-: ? > How would that be any less "type annotation by stealth"? > > If it comes to that, how is the distinction between '/' and 'div' > not "type annotation by stealth". > > Let's have some serious comments, please. > > > 1/2. 0.5 > 1 div 2. 0 There is functional difference, between <- and <= is not functional difference. There is not reason why [X || <> <- <<"abc">> ]. should not return same result as > [X || <> <= <<"abc">> ]. "abc" {<-} and other are only more useless syntactic sugar. Oops, it is not sugar it is bitter. -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Thu Jul 31 09:59:27 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 31 Jul 2008 09:59:27 +0200 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: <95be1d3b0807310059q5fd47761s2ca5c53f4b71c7d0@mail.gmail.com> 2008/7/31 Hynek Vychodil > There is functional difference, between <- and <= is not functional > difference. > There is not reason why > [X || <> <- <<"abc">> ]. > should not return same result as > > [X || <> <= <<"abc">> ]. > "abc" > Hi, I might be mistaken here, but I think the issue is that the compiler generates completely different code for each case and when the generator looks like X <- Y, i.e. the right side is not a constant, it has to know which one to produce. The compiler can't guess from the source code, because for example <> <- L is a very normal list generator, one can't assume L is a binary. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Thu Jul 31 11:35:50 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 31 Jul 2008 19:35:50 +1000 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <95be1d3b0807310059q5fd47761s2ca5c53f4b71c7d0@mail.gmail.com> References: <200807301913.09216.als@iinet.net.au> <4d08db370807310040n14c502eh9a7b9fcd99562d99@mail.gmail.com> <95be1d3b0807310059q5fd47761s2ca5c53f4b71c7d0@mail.gmail.com> Message-ID: <200807311935.50484.als@iinet.net.au> On Thu, 31 Jul 2008 05:59:27 pm Vlad Dumitrescu wrote: > 2008/7/31 Hynek Vychodil > > > There is functional difference, between <- and <= is not functional > > difference. > > There is not reason why > > [X || <> <- <<"abc">> ]. > > should not return same result as > > > > > [X || <> <= <<"abc">> ]. > > > > "abc" > > Hi, > > I might be mistaken here, but I think the issue is that the compiler > generates completely different code for each case and when the generator > looks like X <- Y, i.e. the right side is not a constant, it has to know > which one to produce. The compiler can't guess from the source code, > because for example <> <- L is a very normal list generator, one can't > assume L is a binary. > > best regards, > Vlad Or they could define some virtual machine instructions for iterating over collections so that the compiler's generated code is the same for all cases. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From als@REDACTED Thu Jul 31 11:47:01 2008 From: als@REDACTED (Anthony Shipman) Date: Thu, 31 Jul 2008 19:47:01 +1000 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: References: <200807301913.09216.als@iinet.net.au> Message-ID: <200807311947.01781.als@iinet.net.au> On Thu, 31 Jul 2008 11:48:07 am Richard A. O'Keefe wrote: > > The funny symbols are a kind of type annotation by stealth that is ? > > quite > > irregular in the language. > > When it is right out there in the open, how is it "stealth"? > > Please clarify how <- vs <= (in the existing language) > is "type annotation by stealth" and 'and' vs 'band' is not. 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. 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. 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. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From vychodil.hynek@REDACTED Thu Jul 31 12:05:15 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 31 Jul 2008 12:05:15 +0200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <95be1d3b0807310059q5fd47761s2ca5c53f4b71c7d0@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> Message-ID: <4d08db370807310305m3aacc5b2kd2241c9ec8905aab@mail.gmail.com> On Thu, Jul 31, 2008 at 9:59 AM, Vlad Dumitrescu wrote: > 2008/7/31 Hynek Vychodil > >> There is functional difference, between <- and <= is not functional >> difference. >> There is not reason why >> [X || <> <- <<"abc">> ]. >> should not return same result as >> > [X || <> <= <<"abc">> ]. >> "abc" >> > > Hi, > > I might be mistaken here, but I think the issue is that the compiler > generates completely different code for each case and when the generator > looks like X <- Y, i.e. the right side is not a constant, it has to know > which one to produce. The compiler can't guess from the source code, because > for example <> <- L is a very normal list generator, one can't assume L > is a binary. > > best regards, > Vlad > > 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. {joke, "It should not evolve in ugliness of assembly language"}. For example, in some lisp compilers, I heard, are two entry point to function, with and without parameters check and so. And HiPE do some optimization for float only functions ... This is better way how deal with it. Changing language to solve some special low level optimizations is wrong idea. 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]. and deal with it is compiler business. -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Thu Jul 31 12:27:57 2008 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 31 Jul 2008 12:27:57 +0200 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: <95be1d3b0807310327k439cb6do61ba4e2fadb7aa09@mail.gmail.com> On Thu, Jul 31, 2008 at 12:05, Hynek Vychodil wrote: > > On Thu, Jul 31, 2008 at 9:59 AM, Vlad Dumitrescu wrote: > >> 2008/7/31 Hynek Vychodil >> >>> There is functional difference, between <- and <= is not functional >>> difference. >>> There is not reason why >>> [X || <> <- <<"abc">> ]. >>> should not return same result as >>> > [X || <> <= <<"abc">> ]. >>> "abc" >>> >> >> Hi, >> >> I might be mistaken here, but I think the issue is that the compiler >> generates completely different code for each case and when the generator >> looks like X <- Y, i.e. the right side is not a constant, it has to know >> which one to produce. The compiler can't guess from the source code, because >> for example <> <- L is a very normal list generator, one can't assume L >> is a binary. >> >> best regards, >> Vlad >> >> > 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. {joke, "It should not evolve in ugliness > of assembly language"}. For example, in some lisp compilers, I heard, are > two entry point to function, with and without parameters check and so. And > HiPE do some optimization for float only functions ... This is better way > how deal with it. Changing language to solve some special low level > optimizations is wrong idea. > > 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]. > > and deal with it is compiler business. > Not quite. Compare these 7> [X || <> <= <<1,2,2,3,4,4,5,6>>]. [4] 8> [X || [X,X] <- [1,2,2,3,4,4,5,6]]. [] 9> [X || [X,X] <- [[1,2],[2,3],[4,4],[5,6]]]. [4] With binary comprehensions you are not limited to matching one element at a time (like you are with lists), so there is a functional difference. 10> [{X,Y} || <> <= <<1,2,2,3,4,4,5,6>>]. [{1,2},{2,3},{4,4},{5,6}] best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Thu Jul 31 12:59:51 2008 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 31 Jul 2008 12:59:51 +0200 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: <48919B27.7090406@it.uu.se> Hynek Vychodil wrote: > I understand it, but I think this is wrong design decision. Compiler > optimization should not impact language design, [...] Changing > language to solve some special low level optimizations is wrong idea. > > > 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]. > > and deal with it is compiler business. Most of the time, this is a good principle, but there are trade-offs that have to be considered. Each list comprehension expression is rewritten by the compiler into a self-recursive function that iterates over the input. If you allow the input to be either a list or a binary (and the compiler is not able to infer that the input is always a list or always a binary), it means that you will have to generate twice as much code for each such loop, to handle both cases at runtime. And in general, half of that code will never be executed, ever. Some people would happily accept this relatively small amount of code bloat, to be able to use a single symbol, while some people might not be happy with that at all. Separate optimized code paths for float operations have a similar trade-off, but currently you only get that if you compile to native code. The other trade-off is that of generality vs. readability and least astonishment. For example, should the symbol '+' be overloaded to represent every operation that is vaguely "sum"-like? Some languages use + both for adding numbers and concatenating lists and strings. But then, when you write a function that does both string concatenation and adding (maybe on the same line), it can get hard to read, and if the language does not do static type checking, and you happen to pass a string instead of an integer somewhere, the function will probably not crash, but instead start to convert numbers to strings and concatenate those strings. If there had been separate symbols for the different functions, you would have failed early, and the code would (perhaps arguably) have been easier to understand. Separating the <=/<- operators in Erlang may not help readability (again, arguably), but they do provide early failure if you happen to pass a binary instead of a list or vice versa. That might or might not be what you want. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From vychodil.hynek@REDACTED Thu Jul 31 16:14:56 2008 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Thu, 31 Jul 2008 16:14:56 +0200 Subject: [erlang-questions] Extensions to comprehensions eeps In-Reply-To: <48919B27.7090406@it.uu.se> 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> <48919B27.7090406@it.uu.se> Message-ID: <4d08db370807310714p60b4b4cm604df2e30d82e19e@mail.gmail.com> On Thu, Jul 31, 2008 at 12:59 PM, Richard Carlsson wrote: > Hynek Vychodil wrote: > >> I understand it, but I think this is wrong design decision. Compiler >> optimization should not impact language design, [...] Changing language to >> solve some special low level optimizations is wrong idea. >> >> >> 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]. >> >> and deal with it is compiler business. >> > > Most of the time, this is a good principle, but there are trade-offs > that have to be considered. Each list comprehension expression is > rewritten by the compiler into a self-recursive function that iterates > over the input. If you allow the input to be either a list or a binary > (and the compiler is not able to infer that the input is always a list > or always a binary), it means that you will have to generate twice as > much code for each such loop, to handle both cases at runtime. And in > general, half of that code will never be executed, ever. Some people > would happily accept this relatively small amount of code bloat, to be > able to use a single symbol, while some people might not be happy with > that at all. Separate optimized code paths for float operations have a > similar trade-off, but currently you only get that if you compile to > native code. > > The other trade-off is that of generality vs. readability and least > astonishment. For example, should the symbol '+' be overloaded to > represent every operation that is vaguely "sum"-like? Some languages > use + both for adding numbers and concatenating lists and strings. > But then, when you write a function that does both string concatenation > and adding (maybe on the same line), it can get hard to read, and if the > language does not do static type checking, and you happen to pass a > string instead of an integer somewhere, the function will probably > not crash, but instead start to convert numbers to strings and > concatenate those strings. If there had been separate symbols for > the different functions, you would have failed early, and the code > would (perhaps arguably) have been easier to understand. Separating the > <=/<- operators in Erlang may not help readability (again, arguably), > but they do provide early failure if you happen to pass a binary instead > of a list or vice versa. That might or might not be what you want. > > /Richard > > -- > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > OK, you are right. '+' numbers vs string operations is good example. Erlang is not typeless language it is not strong typed only. There is good reason why distinct between <- and <= as different typed operands. As another example 'true and false' vs '1 band 2'. There are many such kinds in current Erlang. -- --Hynek (Pichi) Vychodil -------------- next part -------------- An HTML attachment was scrubbed... URL: From golubovsky@REDACTED Thu Jul 31 18:39:47 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Thu, 31 Jul 2008 12:39:47 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? Message-ID: Hi, Are the sources of Erlang/OTP releases "officially" available on the Internet in browseable (and therefore engine-searchable) form? Via Google, I found this location: http://web.mit.edu/erlang_vR11B-5/ but this does not seem to be the latest release and is not "official". Thanks. -- Dimitry Golubovsky Anywhere on the Web From jwecker@REDACTED Thu Jul 31 19:12:51 2008 From: jwecker@REDACTED (Joseph Wecker) Date: Thu, 31 Jul 2008 11:12:51 -0600 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: Message-ID: <4891F293.6050103@entride.com> Dimitry Golubovsky wrote: > Hi, > > Are the sources of Erlang/OTP releases "officially" available on the > Internet in browseable (and therefore engine-searchable) form? > > http://erlang.org/download.html They're zipped up so not so browseable online- you'll have to take the extra step of downloading them, tar -xvzf'ing them, and then grep or find to find what you're looking for (or whatever the equivalent in Windows is). -Joseph From golubovsky@REDACTED Thu Jul 31 19:18:23 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Thu, 31 Jul 2008 13:18:23 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: <4891F293.6050103@entride.com> References: <4891F293.6050103@entride.com> Message-ID: Joseph, I pretty well understand that; I was thinking that it would be useful to have an unzipped source snapshot online. Sometimes I find it easier to find things via search engines rather than grepping local files (but this may be just my own bias). Thanks. On 7/31/08, Joseph Wecker wrote: > They're zipped up so not so browseable online- you'll have to take the extra > step of downloading them, tar -xvzf'ing them, and then grep or find to find > what you're looking for (or whatever the equivalent in Windows is). -- Dimitry Golubovsky Anywhere on the Web From jarrod@REDACTED Thu Jul 31 19:35:05 2008 From: jarrod@REDACTED (Jarrod Roberson) Date: Thu, 31 Jul 2008 13:35:05 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: <4891F293.6050103@entride.com> Message-ID: On Thu, Jul 31, 2008 at 1:18 PM, Dimitry Golubovsky wrote: > Joseph, > > I pretty well understand that; I was thinking that it would be useful > to have an unzipped source snapshot online. Sometimes I find it easier > to find things via search engines rather than grepping local files > (but this may be just my own bias). > > Thanks. > this is a good idea, it would be wonderful if you could search the erlang sources via something like krugle.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From jchris@REDACTED Thu Jul 31 19:50:14 2008 From: jchris@REDACTED (Chris Anderson) Date: Thu, 31 Jul 2008 10:50:14 -0700 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: <4891F293.6050103@entride.com> Message-ID: 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... On Thu, Jul 31, 2008 at 10:18 AM, Dimitry Golubovsky wrote: > Joseph, > > I pretty well understand that; I was thinking that it would be useful > to have an unzipped source snapshot online. Sometimes I find it easier > to find things via search engines rather than grepping local files > (but this may be just my own bias). > > Thanks. > > On 7/31/08, Joseph Wecker wrote: > >> They're zipped up so not so browseable online- you'll have to take the extra >> step of downloading them, tar -xvzf'ing them, and then grep or find to find >> what you're looking for (or whatever the equivalent in Windows is). > > > > -- > Dimitry Golubovsky > > Anywhere on the Web > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Chris Anderson http://jchris.mfdz.com From doug.mansell@REDACTED Thu Jul 31 20:27:55 2008 From: doug.mansell@REDACTED (doug mansell) Date: Thu, 31 Jul 2008 20:27:55 +0200 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: <4891F293.6050103@entride.com> Message-ID: Someone posted a while back about this: https://code.launchpad.net/erlang On Thu, Jul 31, 2008 at 7:50 PM, Chris Anderson wrote: > 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... > > On Thu, Jul 31, 2008 at 10:18 AM, Dimitry Golubovsky > wrote: >> Joseph, >> >> I pretty well understand that; I was thinking that it would be useful >> to have an unzipped source snapshot online. Sometimes I find it easier >> to find things via search engines rather than grepping local files >> (but this may be just my own bias). >> >> Thanks. >> >> On 7/31/08, Joseph Wecker wrote: >> >>> They're zipped up so not so browseable online- you'll have to take the extra >>> step of downloading them, tar -xvzf'ing them, and then grep or find to find >>> what you're looking for (or whatever the equivalent in Windows is). >> >> >> >> -- >> Dimitry Golubovsky >> >> Anywhere on the Web >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Chris Anderson > http://jchris.mfdz.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From golubovsky@REDACTED Thu Jul 31 20:53:04 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Thu, 31 Jul 2008 14:53:04 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: <4891F293.6050103@entride.com> Message-ID: Ok, looks like the Erlang bzr repo can be browsed here: http://bazaar.launchpad.net/~erlang-dev/erlang/trunk/files although the launchpad server response is not very fast, this is probably it. Thanks On 7/31/08, doug mansell wrote: > Someone posted a while back about this: > > https://code.launchpad.net/erlang > > > > > On Thu, Jul 31, 2008 at 7:50 PM, Chris Anderson wrote: > > 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... > > > > On Thu, Jul 31, 2008 at 10:18 AM, Dimitry Golubovsky > > wrote: > >> Joseph, > >> > >> I pretty well understand that; I was thinking that it would be useful > >> to have an unzipped source snapshot online. Sometimes I find it easier > >> to find things via search engines rather than grepping local files > >> (but this may be just my own bias). > >> > >> Thanks. > >> > >> On 7/31/08, Joseph Wecker wrote: > >> > >>> They're zipped up so not so browseable online- you'll have to take the extra > >>> step of downloading them, tar -xvzf'ing them, and then grep or find to find > >>> what you're looking for (or whatever the equivalent in Windows is). > >> > >> > >> > >> -- > >> Dimitry Golubovsky > >> > >> Anywhere on the Web > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > > > -- > > Chris Anderson > > http://jchris.mfdz.com > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- Dimitry Golubovsky Anywhere on the Web From erlang-questions_efine@REDACTED Thu Jul 31 21:05:32 2008 From: erlang-questions_efine@REDACTED (Edwin Fine) Date: Thu, 31 Jul 2008 15:05:32 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: References: <4891F293.6050103@entride.com> Message-ID: <6c2563b20807311205rf2a9ca0gd5725a2366b377fc@mail.gmail.com> I believe that's Canonical's server for the Ubuntu packaging of Erlang. It seems to be at R12B-1, because Ubuntu lags official releases in general. On Thu, Jul 31, 2008 at 2:53 PM, Dimitry Golubovsky wrote: > Ok, looks like the Erlang bzr repo can be browsed here: > > http://bazaar.launchpad.net/~erlang-dev/erlang/trunk/files > > although the launchpad server response is not very fast, this is probably > it. > > Thanks > > On 7/31/08, doug mansell wrote: > > Someone posted a while back about this: > > > > https://code.launchpad.net/erlang > > > > > > > > > > On Thu, Jul 31, 2008 at 7:50 PM, Chris Anderson wrote: > > > 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... > > > > > > On Thu, Jul 31, 2008 at 10:18 AM, Dimitry Golubovsky > > > wrote: > > >> Joseph, > > >> > > >> I pretty well understand that; I was thinking that it would be useful > > >> to have an unzipped source snapshot online. Sometimes I find it easier > > >> to find things via search engines rather than grepping local files > > >> (but this may be just my own bias). > > >> > > >> Thanks. > > >> > > >> On 7/31/08, Joseph Wecker wrote: > > >> > > >>> They're zipped up so not so browseable online- you'll have to take > the extra > > >>> step of downloading them, tar -xvzf'ing them, and then grep or find > to find > > >>> what you're looking for (or whatever the equivalent in Windows is). > > >> > > >> > > >> > > >> -- > > >> Dimitry Golubovsky > > >> > > >> Anywhere on the Web > > >> _______________________________________________ > > >> erlang-questions mailing list > > >> erlang-questions@REDACTED > > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > >> > > > > > > > > > > > > -- > > > Chris Anderson > > > http://jchris.mfdz.com > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > -- > Dimitry Golubovsky > > Anywhere on the Web > _______________________________________________ > 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 golubovsky@REDACTED Thu Jul 31 21:13:52 2008 From: golubovsky@REDACTED (Dimitry Golubovsky) Date: Thu, 31 Jul 2008 15:13:52 -0400 Subject: [erlang-questions] Erlang/OTP browseable sources? In-Reply-To: <6c2563b20807311205rf2a9ca0gd5725a2366b377fc@mail.gmail.com> References: <4891F293.6050103@entride.com> <6c2563b20807311205rf2a9ca0gd5725a2366b377fc@mail.gmail.com> Message-ID: Right, it's Canonical/Ubuntu, but this one seems to be at least newer than the one (at MIT) I found earlier. There does not seem to be such public Erlang repo run by Ericsson, does it? Thanks. On 7/31/08, Edwin Fine wrote: > I believe that's Canonical's server for the Ubuntu packaging of Erlang. It > seems to be at R12B-1, because Ubuntu lags official releases in general. -- Dimitry Golubovsky Anywhere on the Web From nicholassm@REDACTED Thu Jul 31 23:26:06 2008 From: nicholassm@REDACTED (=?ISO-8859-1?Q?Nicholas_Schultz-M=F8ller?=) Date: Thu, 31 Jul 2008 22:26:06 +0100 Subject: [erlang-questions] now() seems to produce inconsistent timestamps. Message-ID: Hi, Starting two Eshells on a single machine with the commands: erl -sname rip erl -sname rup and running X = now(), Self = self(), spawn(rup@REDACTED, fun() -> Self ! now() end), receive Y -> io:format("Diff=~w~n", [timer:now_diff(Y, X)]) end. yields "Diff=-1000" and occational a positive value as one would expect. (Hostname is Nway.) Is this a bug or a feature? Does two or more Eshells not agree on the time when running on the same host??? I'm running this using R12B-3 and the machine has a dual core processor. Regards, Nicholas Schultz-M?ller -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlist@REDACTED Sat Jul 19 06:29:55 2008 From: jlist@REDACTED (Jonathan Gray) Date: Sat, 19 Jul 2008 04:29:55 -0000 Subject: [erlang-questions] Segfault in erl_interface attempting to decode certain large binaries Message-ID: <023b01c8e90b$8daff450$a90fdcf0$@com> All, I have a TCP interface between an Erlang system and a C system. Both send/receive marshaled binary Erlang terms and I have not had any problems to date. Today I began doing some more serious testing with larger chunks of binary to be decoded in C. We ran into a bug (it seems) with erl_interface 3.5.5.4 that is causing it to segfault during decoding. The backtrace looks like this: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 46912496233216 (LWP 4091)] 0x00000000004032c4 in _erl_free_term () (gdb) bt #0 0x00000000004032c4 in _erl_free_term () #1 0x000000000040496b in erl_decode_it () #2 0x0000000000404937 in erl_decode_it () #3 0x0000000000404c93 in erl_decode_it () #4 0x0000000000404c93 in erl_decode_it () #5 0x0000000000405311 in erl_decode () #6 0x0000000000401b38 in main (argc=1, argv=0x7fff51ec7938) at badtest.c:28 The unfortunate part is that the way this large binary term is generated cannot be done in any kind of sample code (it's being pulled off an external database). However, I have created a set of test files in C which recreate the segfault. I stored the binary in a flat file (as 'badbinary') and have a testing program which reads it off disk and attempts to decode it. To prove the approach is sane (and that this segfault is related to something strange about the decoding of this particular binary, not the size or general format of the binary) there is a 'goodbinary' file and testing program for that. To use the test code: Untar/Ungzip the file. You may need to edit the Makefile to fix the paths to your erl_interface library. 'make' and then you can: ./badtest (this reads 'badbinary' and attempts to decode, causes segfault) ./goodtest (this reads 'goodbinary' and successfully decodes it) [nearly identical code to badtest.c but reads different file w/ different size] Also included is ./makegoodbin (a simple program that generates a large ETERM in an identical format to the badbinary but contains duplicated binary data everywhere) Notes: * The marshaled binary erlang term being sent to C can be successfully decoded/unmarshaled from within Erlang without a problem * This is reproducible with many different large erlang terms generated from our database queries. 'makegoodbin.c' creates a term identical in format to those causing problems, however it does not have the random distribution of binary sizes and content, and so I'm not able to reproduce the problem in this way. * The entire system, end-to-end including this decoding step, works perfectly in most cases. However when the data goes into the 100k+ range, the segfaults start to happen. That's why I created the 'makegoodbin' which follows the same format. Unfortunately that works even at sizes of >1MB adding to the confusion of the problem. Any help is appreciated. Thanks. Jonathan Gray Streamy Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_decode_segfault_test.tar.gz Type: application/x-gzip Size: 31030 bytes Desc: not available URL: