From chandrashekhar.mullaparthi@REDACTED Thu Jun 1 00:08:36 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 31 May 2006 23:08:36 +0100 Subject: ibrowse bug Message-ID: Hi, Sean Hinde reported a bug in ibrowse. The response for the first request was never returned when asynchronous requests were pipelined. I have patched the code in jungerl. A diff is included below. The fix has been tested by sending a number of requests to google.com in a tight loop :-) cheers Chandru Chandrus-Mac:$ cvs diff -r1.5 ibrowse_http_client.erl Index: ibrowse_http_client.erl =================================================================== RCS file: /cvsroot/jungerl/jungerl/lib/ibrowse/src/ibrowse_http_client.erl,v retrieving revision 1.5 retrieving revision 1.6 diff -r1.5 -r1.6 9c9 < -vsn('$Id: ibrowse_http_client.erl,v 1.5 2006/03/17 10:05:18 chandrusf Exp $ '). --- > -vsn('$Id: ibrowse_http_client.erl,v 1.6 2006/05/31 22:02:06 chandrusf Exp $ '). 210c210 < State_1#state{cur_req = NewReq} --- > State_1 From sean.hinde@REDACTED Thu Jun 1 00:28:54 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 31 May 2006 23:28:54 +0100 Subject: ibrowse bug In-Reply-To: References: Message-ID: <84B48C1C-64F2-4E67-B7F6-C9C494A99996@gmail.com> Thanks Chandru. Nice work Sean On 31 May 2006, at 23:08, Chandru wrote: > Hi, > > Sean Hinde reported a bug in ibrowse. The response for the first > request was never returned when asynchronous requests were pipelined. > I have patched the code in jungerl. A diff is included below. The fix > has been tested by sending a number of requests to google.com in a > tight loop :-) > > cheers > Chandru > > Chandrus-Mac:$ cvs diff -r1.5 ibrowse_http_client.erl > Index: ibrowse_http_client.erl > =================================================================== > RCS file: /cvsroot/jungerl/jungerl/lib/ibrowse/src/ > ibrowse_http_client.erl,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -r1.5 -r1.6 > 9c9 > < -vsn('$Id: ibrowse_http_client.erl,v 1.5 2006/03/17 10:05:18 > chandrusf Exp $ '). > --- >> -vsn('$Id: ibrowse_http_client.erl,v 1.6 2006/05/31 22:02:06 >> chandrusf Exp $ '). > 210c210 > < State_1#state{cur_req = NewReq} > --- >> State_1 From yarivvv@REDACTED Thu Jun 1 00:42:46 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 31 May 2006 18:42:46 -0400 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <95be1d3b0605311427w1e7cabbaj9be6cedbccea7612@mail.gmail.com> References: <11498CB7D3FCB54897058DE63BE3897C01A48EBC@esealmw105.eemea.ericsson.se> <17244f480605311136r69d3d79bm2ec81501007d9d02@mail.gmail.com> <95be1d3b0605311427w1e7cabbaj9be6cedbccea7612@mail.gmail.com> Message-ID: <17244f480605311542g32ecdde0u7ad92f9953c86db4@mail.gmail.com> > > Why must stubs be avoided? Couldn't an Erlang->Java RPC mechanism support stubs? > > Well, not *must* but implementing everything properly requires > something that feels like an ORB implementation. That's not an easy > thing to do... so one could use the existing CORBA support, but all > these layers are making everything very heavyweight, and we're not > even talking about the real useful stuff, it's just > intercommunnication... > > /Vlad > I was thinking about something along the lines of Java RMI, which is simpler than CORBA, but yes, this certainly does involve significant complexity... Maybe the best solution would be to only expose static methods to this RPC generator, at least initially :) Yariv From bsder@REDACTED Thu Jun 1 02:04:32 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 31 May 2006 17:04:32 -0700 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447D4ECF.8030209@ericsson.com> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> <447D4ECF.8030209@ericsson.com> Message-ID: <447E2F10.10405@allcaps.org> Mats Cronqvist wrote: > > > Andrew Lentvorski wrote: >> Christian S wrote: >> >> GUI Integration: >> Tk and Gtk only - that pretty much makes my point >> (Yes, I know about the wx bindings. I've used wx. Never again.) > > i don't get the point. you consider Tk and Gtk (and wx, obviously) to > be no good? what would it take to make you happy then? Tk looks ... suboptimal. Gtk wouldn't be bad, but it has Windows and OS X issues. Wx -- Lots of code for no gain. Three different projects I have worked with started with Wx and dumped it for custom wrappers. The quality of abstraction is poor. Generally, you either need: A) Something which has very weak UI needs, in which case *anything* will work and the choice should be for something fast and lightweight (aka. Tk) even if it looks a bit crummy. In this case, Wx is a huge overkill. B) Something which needs a sophisticated UI, in which case you have to go to the base GUI because the differences are significant (drawing area abstractions, custom widgets, etc.). In which case, Wx can't solve the problem. -a From xlcr@REDACTED Thu Jun 1 06:46:42 2006 From: xlcr@REDACTED (Nick Linker) Date: Thu, 01 Jun 2006 11:46:42 +0700 Subject: QuickCheck tool for Erlang In-Reply-To: <20060531154444.4281.qmail@webmail18.rediffmail.com> References: <20060531154444.4281.qmail@webmail18.rediffmail.com> Message-ID: <447E7132.4010408@mail.ru> zubi wrote: > > QuickCheck for Erlang seems to be an excellent tool, but that is not > publicly available. Can anybody help me in getting that. Also any > comments on testing for Erlang are most welcome. > > Many thanks, > Zubair > I have some (probably not last) version of QC. Please look at the attached files. Best regards, Linker Nick. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: qc.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: quickcheck.hrl URL: From bsder@REDACTED Thu Jun 1 09:16:12 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 01 Jun 2006 00:16:12 -0700 Subject: Erlang bytecodes and/or VM description? Message-ID: <447E943C.1060702@allcaps.org> Is there a concise reference of the Erlang bytescodes and/or VM description somewhere? It seems like I have to go back to about R7B to look at an emulator that is clean (as opposed to having lots of HiPE stuff scattered inside). Thanks, -a From richardc@REDACTED Thu Jun 1 09:23:02 2006 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 01 Jun 2006 09:23:02 +0200 Subject: QuickCheck tool for Erlang In-Reply-To: <200605312251.57897.mikael.karlsson@creado.com> References: <20060531154444.4281.qmail@webmail18.rediffmail.com> <200605312251.57897.mikael.karlsson@creado.com> Message-ID: <447E95D6.2060501@it.uu.se> Mikael Karlsson wrote: > Quickcheck is publicly available as a part of the jungerl project on > sourceforge.net, so if you check out the source it will be in one of > the libraries, see: > http://sourceforge.net/projects/jungerl Note that the version in the jungerl is mostly an early draft. Nowadays, QuickCheck is being developed as a commercial product: http://www.cs.chalmers.se/~rjmh/ErlangQC/ > The Erlang/OTP folks has also published their own test_server, > see: http://www.erlang.org/project/test_server/index.html And there's also my EUnit 2.0 alpha, for more lightweight testing. http://www.erlang.org/ml-archive/erlang-questions/200604/msg00171.html /Richard From matthias@REDACTED Thu Jun 1 09:36:56 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 1 Jun 2006 09:36:56 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447E943C.1060702@allcaps.org> References: <447E943C.1060702@allcaps.org> Message-ID: <17534.39192.378162.26436@antilipe.corelatus.se> Andrew Lentvorski writes: > Is there a concise reference of the Erlang bytescodes and/or VM > description somewhere? No. Matthias From bsder@REDACTED Thu Jun 1 10:09:32 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 01 Jun 2006 01:09:32 -0700 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <17534.39192.378162.26436@antilipe.corelatus.se> References: <447E943C.1060702@allcaps.org> <17534.39192.378162.26436@antilipe.corelatus.se> Message-ID: <447EA0BC.6030905@allcaps.org> Matthias Lang wrote: > Andrew Lentvorski writes: > > Is there a concise reference of the Erlang bytescodes and/or VM > > description somewhere? > > No. Useful to know. I'll quit looking for one then. -a From thomasl_erlang@REDACTED Thu Jun 1 11:19:07 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 1 Jun 2006 02:19:07 -0700 (PDT) Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447E943C.1060702@allcaps.org> Message-ID: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> --- Andrew Lentvorski wrote: > Is there a concise reference of the Erlang > bytescodes and/or VM > description somewhere? > > It seems like I have to go back to about R7B to look > at an emulator that > is clean (as opposed to having lots of HiPE stuff > scattered inside). It depends on what you want to do. There used to be a BEAM bytecode reference, but I think the format and instructions change mildly every now and then, both with new releases and with different targets. For example, I believe some instruction sequences can be merged into superinstructions by the loader, and/or otherwise specialized or optimized. This can lead to hundreds of nearly identical instruction variants, so some patience and experience is needed to decipher them. If you just want to learn the high level BEAM instruction set, then that is more straightforward. To see what code compiles to, use "erlc +S mod.erl", which emits a file "mod.S" with symbolic BEAM code in it. Historically, the BEAM instruction set has its root in the elegant and subtle Warren Abstract Machine (for Prolog). Bogdan Hausman, the original designer, has his roots in the Prolog world, and started from a simplification of the WAM instruction set. Here is one of the original documents: http://www.erlang.se/publications/Erlang_to_C.pdf But basically it's not so hard: the VM is register based, and there are two kinds of temporaries, "registers" (x-regs) and "stack slots" (y-regs). There are instructions to dispatch on register value or type, to speed up clause selection. There are function calls, including last calls (jumps with arguments). There are instructions to take apart and put together terms. And maybe a few more that I've forgotten about. If you want to learn about the ancestral WAM, Hassan Ait-Kaci wrote a good tutorial (MIT Press, 1991), which can be found here: http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ke.han@REDACTED Thu Jun 1 12:38:01 2006 From: ke.han@REDACTED (ke han) Date: Thu, 1 Jun 2006 18:38:01 +0800 Subject: jaws available for testing?? Message-ID: Hello, This is directed mostly to Joe, but any others may have inside info ;-). What's the status of jaws? I would very much like to start testing what's available. thanks, ke han From gordonguthrie@REDACTED Thu Jun 1 12:52:52 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Thu, 1 Jun 2006 11:52:52 +0100 Subject: CATCHA was Re: Erlang port to the Java Virtual Machine Message-ID: <1149159172.447ec704ad5da@backawinner.gg> Quoting Yariv Sadan : > (...) if you > already have an application with a presentation layer written in > Erlang, and you want to make use of some Java library for a small part > of the application (for example, CAPTCHA generation, for which I don't > think Erlang has a library), it would be advantageous to expose the > Java api to Erlang via an easy-to-use rpc wrapper. Getting a CATCHA into yaws is something I have been looking at as well in a desultory sort of fashion... It seems to me that C would probably be the language of choice - the selection/response of text for obsfuction part would be straight forward in Erlang, but the graphical munginess and distortion/colourbanding of fonts-as- beziers must be a solved problem in some C library - but which one? Any thoughts from someone less idle than me would be welcome ;-> Gordon ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From gordonguthrie@REDACTED Thu Jun 1 12:53:12 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Thu, 1 Jun 2006 11:53:12 +0100 Subject: QuickCheck tool for Erlang Message-ID: <1149159192.447ec718a87b8@backawinner.gg> Zubi Also in jungerl is my erlang_automated_build which is a shell script designed to manage a testing pipeline. It is designed to automate some or all of the following: * clean checking out of code from CVS * run a full set of test cases using the standard test server * run the Dialyzer against the code base * run a Tsunami load test It also calls user-defined pre- and post-stage batch jobs to set-up and tear down the different sort of tests as appropriate. It marshalls these results and graphs them up to give a change/testing dashboard. I am currently writing a spider test that will spider an app and check for broken links/404's/etc and particularly yaws crashes on a web site. In the fullness of time (ie when it is less lame than it currently is) it will be integrated into the erlang_automated_build and stuck in Sourceforge as well. Gordon Quoting zubi : > ? > Hi all, > > I am currently doing research on automated testing for Erlang programs. For > this I have been looking at many potential techniques that can aid this > process. QuickCheck for Erlang seems to be an excellent tool, but that is not > publicly available. Can anybody help me in getting that. Also any comments on > testing for Erlang are most welcome. > > Many thanks, > Zubair ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From serge@REDACTED Thu Jun 1 12:54:37 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 01 Jun 2006 06:54:37 -0400 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> Message-ID: <447EC76D.6000803@hq.idt.net> Thomas, Which compiler version supports "+S" switch? On R10B-11 I get: $ erlc +S test.erl bad term: S Runtime error: {{nocatch,error}, [{erl_compile,make_term,1}, {erl_compile,compile1,3}, {erl_compile,compiler_runner,1}]} =ERROR REPORT==== 1-Jun-2006::06:45:19 === Error in process <0.20.0> with exit value: {{nocatch,error},[{erl_compile,make_term,1},{erl_compile,compile1,3},{erl_compile,compiler_runner,1}]} Serge Thomas Lindgren wrote: > > --- Andrew Lentvorski wrote: > > >>Is there a concise reference of the Erlang >>bytescodes and/or VM >>description somewhere? >> >>It seems like I have to go back to about R7B to look >>at an emulator that >>is clean (as opposed to having lots of HiPE stuff >>scattered inside). > > > It depends on what you want to do. There used to be a > BEAM bytecode reference, but I think the format and > instructions change mildly every now and then, both > with new releases and with different targets. > > For example, I believe some instruction sequences can > be merged into superinstructions by the loader, and/or > otherwise specialized or optimized. This can lead to > hundreds of nearly identical instruction variants, so > some patience and experience is needed to decipher > them. > > If you just want to learn the high level BEAM > instruction set, then that is more straightforward. To > see what code compiles to, use "erlc +S mod.erl", > which emits a file "mod.S" with symbolic BEAM code in > it. > > Historically, the BEAM instruction set has its root in > the elegant and subtle Warren Abstract Machine (for > Prolog). Bogdan Hausman, the original designer, has > his roots in the Prolog world, and started from a > simplification of the WAM instruction set. Here is one > of the original documents: > > http://www.erlang.se/publications/Erlang_to_C.pdf > > But basically it's not so hard: the VM is register > based, and there are two kinds of temporaries, > "registers" (x-regs) and "stack slots" (y-regs). There > are instructions to dispatch on register value or > type, to speed up clause selection. There are function > calls, including last calls (jumps with arguments). > There are instructions to take apart and put together > terms. And maybe a few more that I've forgotten about. > > If you want to learn about the ancestral WAM, Hassan > Ait-Kaci wrote a good tutorial (MIT Press, 1991), > which can be found here: > > http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf > > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > From vlad.xx.dumitrescu@REDACTED Thu Jun 1 13:15:39 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Thu, 1 Jun 2006 13:15:39 +0200 Subject: Erlang bytecodes and/or VM description? Message-ID: <11498CB7D3FCB54897058DE63BE3897C01A79C92@esealmw105.eemea.ericsson.se> > Which compiler version supports "+S" switch? On R10B-11 I get: You'll have to write erlc +'S' mod.erl And also to remember that the qutes need to be escaped, so the working comand line is: erlc +\'S\' mod.erl Nice! ;-) /Vlad From serge@REDACTED Thu Jun 1 13:26:48 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 01 Jun 2006 07:26:48 -0400 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <17534.51691.379786.273519@antilipe.corelatus.se> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447EC76D.6000803@hq.idt.net> <17534.51691.379786.273519@antilipe.corelatus.se> Message-ID: <447ECEF8.2090907@hq.idt.net> Thanks. What a difference! This works as well if single quoted: erlc +\'S\' module.erl Serge Matthias Lang wrote: > Try -S > > Matthias > > Serge Aleynikov writes: > > Thomas, > > > > Which compiler version supports "+S" switch? On R10B-11 I get: > > > > $ erlc +S test.erl > > bad term: S > > Runtime error: {{nocatch,error}, > > [{erl_compile,make_term,1}, > > {erl_compile,compile1,3}, > > {erl_compile,compiler_runner,1}]} > > > > =ERROR REPORT==== 1-Jun-2006::06:45:19 === > > Error in process <0.20.0> with exit value: > > {{nocatch,error},[{erl_compile,make_term,1},{erl_compile,compile1,3},{erl_compile,compiler_runner,1}]} > > > > Serge > > > > Thomas Lindgren wrote: > > > > > > --- Andrew Lentvorski wrote: > > > > > > > > >>Is there a concise reference of the Erlang > > >>bytescodes and/or VM > > >>description somewhere? > > >> > > >>It seems like I have to go back to about R7B to look > > >>at an emulator that > > >>is clean (as opposed to having lots of HiPE stuff > > >>scattered inside). > > > > > > > > > It depends on what you want to do. There used to be a > > > BEAM bytecode reference, but I think the format and > > > instructions change mildly every now and then, both > > > with new releases and with different targets. > > > > > > For example, I believe some instruction sequences can > > > be merged into superinstructions by the loader, and/or > > > otherwise specialized or optimized. This can lead to > > > hundreds of nearly identical instruction variants, so > > > some patience and experience is needed to decipher > > > them. > > > > > > If you just want to learn the high level BEAM > > > instruction set, then that is more straightforward. To > > > see what code compiles to, use "erlc +S mod.erl", > > > which emits a file "mod.S" with symbolic BEAM code in > > > it. > > > > > > Historically, the BEAM instruction set has its root in > > > the elegant and subtle Warren Abstract Machine (for > > > Prolog). Bogdan Hausman, the original designer, has > > > his roots in the Prolog world, and started from a > > > simplification of the WAM instruction set. Here is one > > > of the original documents: > > > > > > http://www.erlang.se/publications/Erlang_to_C.pdf > > > > > > But basically it's not so hard: the VM is register > > > based, and there are two kinds of temporaries, > > > "registers" (x-regs) and "stack slots" (y-regs). There > > > are instructions to dispatch on register value or > > > type, to speed up clause selection. There are function > > > calls, including last calls (jumps with arguments). > > > There are instructions to take apart and put together > > > terms. And maybe a few more that I've forgotten about. > > > > > > If you want to learn about the ancestral WAM, Hassan > > > Ait-Kaci wrote a good tutorial (MIT Press, 1991), > > > which can be found here: > > > > > > http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf > > > > > > Best, > > > Thomas > > > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Tired of spam? Yahoo! Mail has the best spam protection around > > > http://mail.yahoo.com > > > > > > From richardc@REDACTED Thu Jun 1 13:39:25 2006 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 01 Jun 2006 13:39:25 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447E2F10.10405@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> <447D4ECF.8030209@ericsson.com> <447E2F10.10405@allcaps.org> Message-ID: <447ED1ED.6090807@it.uu.se> Andrew Lentvorski wrote: > Wx -- Lots of code for no gain. Three different projects I have worked > with started with Wx and dumped it for custom wrappers. The quality of > abstraction is poor. Generally, you either need: > > A) Something which has very weak UI needs, in which case *anything* will > work and the choice should be for something fast and lightweight (aka. > Tk) even if it looks a bit crummy. In this case, Wx is a huge overkill. > > B) Something which needs a sophisticated UI, in which case you have to > go to the base GUI because the differences are significant (drawing area > abstractions, custom widgets, etc.). In which case, Wx can't solve the > problem. Audacity, AVG Anti-virus, Amaya, Tortoise CVS, ... Are you sure it's WxWidgets that is the problem? For example, Wired (http://sourceforge.net/projects/wired) does not look like it has "very weak UI needs". Nor does Audacity, for that matter. But I'm no GUI programmer. /Richard From thomasl_erlang@REDACTED Thu Jun 1 14:11:36 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 1 Jun 2006 05:11:36 -0700 (PDT) Subject: Erlang bytecodes and/or VM description? In-Reply-To: <11498CB7D3FCB54897058DE63BE3897C01A79C92@esealmw105.eemea.ericsson.se> Message-ID: <20060601121136.91198.qmail@web38809.mail.mud.yahoo.com> --- "Vlad Dumitrescu XX (LN/EAB)" wrote: > > Which compiler version supports "+S" switch? On > R10B-11 I get: > > You'll have to write > erlc +'S' mod.erl > And also to remember that the qutes need to be > escaped, so the working > comand line is: > erlc +\'S\' mod.erl > > Nice! ;-) In retrospect I'm surprised that worked :-) I think the canonical compiler flag actually is "erlc -S ...". Sorry about that. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From vlad.xx.dumitrescu@REDACTED Thu Jun 1 14:15:34 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Thu, 1 Jun 2006 14:15:34 +0200 Subject: Erlang bytecodes and/or VM description? Message-ID: <11498CB7D3FCB54897058DE63BE3897C01A79D63@esealmw105.eemea.ericsson.se> > > erlc +\'S\' mod.erl > > In retrospect I'm surprised that worked :-) I think the > canonical compiler flag actually is "erlc -S ...". > Sorry about that. Well, you are excused: the documentation doesn't even mention -S as a flag, but only +term A flag starting with a plus ('+') rather than a hyphen will be converted to an Erlang term and passed unchanged to the compiler. Depending on the platform, the value may need to be quoted if the shell itself interprets certain characters. Regards, Vlad From matthias@REDACTED Thu Jun 1 14:33:18 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 1 Jun 2006 14:33:18 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <11498CB7D3FCB54897058DE63BE3897C01A79D63@esealmw105.eemea.ericsson.se> References: <11498CB7D3FCB54897058DE63BE3897C01A79D63@esealmw105.eemea.ericsson.se> Message-ID: <17534.56974.366920.100431@antilipe.corelatus.se> Vlad Dumitrescu XX (LN/EAB) writes: > Well, you are excused: the documentation doesn't even mention -S as a > flag, but only try 'erlc -h' Matthias From matthias@REDACTED Thu Jun 1 14:37:46 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 1 Jun 2006 14:37:46 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <17534.56974.366920.100431@antilipe.corelatus.se> References: <11498CB7D3FCB54897058DE63BE3897C01A79D63@esealmw105.eemea.ericsson.se> <17534.56974.366920.100431@antilipe.corelatus.se> Message-ID: <17534.57242.282419.684899@antilipe.corelatus.se> Vlad Dumitrescu XX (LN/EAB) writes: > Well, you are excused: the documentation doesn't even mention -S as a > flag, I don't know what documentation you're looking at, but the page about 'erlc' at erlang.org most certainly does: The options -P, -E, and -S are equivalent to +'P', +'E', and +'S', except that it is not necessary to include the single quotes to protect them from the shell. http://www.erlang.org/doc/doc-5.5/erts-5.5/doc/html/erlc.html Matthias From vlad.xx.dumitrescu@REDACTED Thu Jun 1 14:42:54 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Thu, 1 Jun 2006 14:42:54 +0200 Subject: Erlang bytecodes and/or VM description? Message-ID: <11498CB7D3FCB54897058DE63BE3897C01A79DA2@esealmw105.eemea.ericsson.se> > Vlad Dumitrescu XX (LN/EAB) writes: > > > Well, you are excused: the documentation doesn't even > mention -S as a > flag, > > I don't know what documentation you're looking at, but the > page about 'erlc' at erlang.org most certainly does: > > The options -P, -E, and -S are equivalent to +'P', +'E', and +'S', > except that it is not necessary to include the single quotes to > protect them from the shell. > > http://www.erlang.org/doc/doc-5.5/erts-5.5/doc/html/erlc.html > Oh, well, I didn't read that far!... I hope it is my turn to be excused!? /Vlad From mats.cronqvist@REDACTED Thu Jun 1 15:01:54 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 01 Jun 2006 15:01:54 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447E2F10.10405@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> <447D4ECF.8030209@ericsson.com> <447E2F10.10405@allcaps.org> Message-ID: <447EE542.2080606@ericsson.com> Andrew Lentvorski wrote: > Tk looks ... suboptimal. > Gtk wouldn't be bad, but it has Windows and OS X issues. > > Wx -- Lots of code for no gain. [...] not that i disagree with any of this, but... what would be good, then? mats -- Premature optimization is the root of all evil in programming. C. A. R. Hoare From yarivvv@REDACTED Thu Jun 1 15:26:21 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 1 Jun 2006 09:26:21 -0400 Subject: CATCHA was Re: Erlang port to the Java Virtual Machine In-Reply-To: <1149159172.447ec704ad5da@backawinner.gg> References: <1149159172.447ec704ad5da@backawinner.gg> Message-ID: <17244f480606010626s5da21227laca651a6d4cb836b@mail.gmail.com> > Getting a CATCHA into yaws is something I have been looking at as well in a > desultory sort of fashion... > > It seems to me that C would probably be the language of choice - the > selection/response of text for obsfuction part would be straight forward in > Erlang, but the graphical munginess and distortion/colourbanding of fonts-as- > beziers must be a solved problem in some C library - but which one? > > Any thoughts from someone less idle than me would be welcome ;-> > > Gordon > Hi Gordon, Yes, I sort of had the same issue in mind when I started looking at easily integrating with Java. I know of jcaptcha, which does the trick (http://jcaptcha.sourceforge.net/main.html). The reason I looked at Java rather than C is because jinterface actually seemed pretty easy to use, Java is easier than C (the performance difference isn't very relevant here), and Java has a library for almost everything in the universe (well, so does C, but at least Java wins on the ease front). The solution I had in mind would be to have a CAPTCHA server written in Java that communicates with Erlang over jinterface. When yaws needs to display a CAPTCHA, it would send a message to the CAPTCHA server and get back the binary CAPTCHA plus its textual meaning. For efficiency and speed, yaws, could request a number of CAPTCHAS at once and cache them for future requests. If you have any other ideas in this area, let me know! Thanks Yariv From ernie.makris@REDACTED Thu Jun 1 15:55:33 2006 From: ernie.makris@REDACTED (Ernie Makris) Date: Thu, 01 Jun 2006 09:55:33 -0400 Subject: CATCHA was Re: Erlang port to the Java Virtual Machine In-Reply-To: <17244f480606010626s5da21227laca651a6d4cb836b@mail.gmail.com> References: <1149159172.447ec704ad5da@backawinner.gg> <17244f480606010626s5da21227laca651a6d4cb836b@mail.gmail.com> Message-ID: <447EF1D5.7030502@comcast.net> Hi, Well, since you are asking for suggestions, how about spawning a script to generate N captcha images as well as their details, then have a gen_server serve these up and replenish them when they get low. I would use os:cmd to spawn the script and dump the files somewhere. Keep it simple rather than using jinterface. Let the script do one thing only. Hope that helps. Thanks Ernie Yariv Sadan wrote: >> Getting a CATCHA into yaws is something I have been looking at as >> well in a >> desultory sort of fashion... >> >> It seems to me that C would probably be the language of choice - the >> selection/response of text for obsfuction part would be straight >> forward in >> Erlang, but the graphical munginess and distortion/colourbanding of >> fonts-as- >> beziers must be a solved problem in some C library - but which one? >> >> Any thoughts from someone less idle than me would be welcome ;-> >> >> Gordon >> > > Hi Gordon, > > Yes, I sort of had the same issue in mind when I started looking at > easily integrating with Java. I know of jcaptcha, which does the trick > (http://jcaptcha.sourceforge.net/main.html). The reason I looked at > Java rather than C is because jinterface actually seemed pretty easy > to use, Java is easier than C (the performance difference isn't very > relevant here), and Java has a library for almost everything in the > universe (well, so does C, but at least Java wins on the ease front). > The solution I had in mind would be to have a CAPTCHA server written > in Java that communicates with Erlang over jinterface. When yaws needs > to display a CAPTCHA, it would send a message to the CAPTCHA server > and get back the binary CAPTCHA plus its textual meaning. For > efficiency and speed, yaws, could request a number of CAPTCHAS at once > and cache them for future requests. > If you have any other ideas in this area, let me know! > > Thanks > Yariv > From yarivvv@REDACTED Thu Jun 1 16:43:55 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 1 Jun 2006 10:43:55 -0400 Subject: CATCHA was Re: Erlang port to the Java Virtual Machine In-Reply-To: <447EF1D5.7030502@comcast.net> References: <1149159172.447ec704ad5da@backawinner.gg> <17244f480606010626s5da21227laca651a6d4cb836b@mail.gmail.com> <447EF1D5.7030502@comcast.net> Message-ID: <17244f480606010743hd0a28dbrf4faa120313796b2@mail.gmail.com> On 6/1/06, Ernie Makris wrote: > Hi, > > Well, since you are asking for suggestions, how about spawning a script > to generate N captcha images as well > as their details, then have a gen_server serve these up and replenish > them when they get low. I would use os:cmd to spawn the script and dump > the files somewhere. Keep it simple rather than using jinterface. Let > the script do one thing only. > > Hope that helps. > Ernie, I like this solution. It's definitely simpler than what I had in mind. Another benefit it has is that you can implement the CAPTCHA generation script using any language. Thanks! Yariv From ABARTOLI@REDACTED Thu Jun 1 19:06:39 2006 From: ABARTOLI@REDACTED (Bartolini, Antony (ABARTOLI)) Date: Thu, 1 Jun 2006 13:06:39 -0400 Subject: GS bitmap problem Message-ID: Greetings, We are having difficulty creating a bitmap image in a canvas using GS. We are using erl5.4.12 for both Linux and Windows. We are able to load a gif image into a canvas W=gs:create(window,gs:start(),[{width,400},{height,400}]), C=gs:create(canvas,W,[{width,380},{height,380}]), P=gs:create(image,C,[{load_gif,"junk.gif"}]), gs:config(W,{map,true}). brings up a window with a canvas containing junk.gif. No problem. But, when we do the same except with the {bitmap,"junk.bmp"} option instead of the {load_gif,"junk.gif"} as below W=gs:create(window,gs:start(),[{width,400},{height,400}]), C=gs:create(canvas,W,[{width,380},{height,380}]), P=gs:create(image,C,[{bitmap,"junk.bmp"}]), gs:config(W,{map,true}). We've tried enlarging the window/canvas sizes to ensure that the bitmaps fit but that doesn't seem to make a difference. I spent some time looking through the archives for this list but the search seems to be broken, so community help seemed like a better way to go. Internet searches for -- erlang gs image -- or -- erlang gs bitmap -- didn't seem to turn up much either. Any pointers would be greatly appreciated. Thanks, Tony Bartolini ARINC, Engineering Services LLC -------------- next part -------------- An HTML attachment was scrubbed... URL: From hokan.stenholm@REDACTED Thu Jun 1 20:08:45 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Thu, 01 Jun 2006 20:08:45 +0200 Subject: GS bitmap problem In-Reply-To: References: Message-ID: <447F2D2D.3060506@bredband.net> Bartolini, Antony (ABARTOLI) wrote: >Greetings, > >We are having difficulty creating a bitmap image in a canvas using GS. >We are using erl5.4.12 for both Linux and Windows. We are able to load >a gif image into a canvas > >W=gs:create(window,gs:start(),[{width,400},{height,400}]), >C=gs:create(canvas,W,[{width,380},{height,380}]), >P=gs:create(image,C,[{load_gif,"junk.gif"}]), >gs:config(W,{map,true}). > >brings up a window with a canvas containing junk.gif. No problem. But, >when we do the same except with the {bitmap,"junk.bmp"} option instead >of the {load_gif,"junk.gif"} as below > >W=gs:create(window,gs:start(),[{width,400},{height,400}]), >C=gs:create(canvas,W,[{width,380},{height,380}]), >P=gs:create(image,C,[{bitmap,"junk.bmp"}]), >gs:config(W,{map,true}). > >We've tried enlarging the window/canvas sizes to ensure that the bitmaps >fit but that doesn't seem to make a difference. > >I spent some time looking through the archives for this list but the >search >seems to be broken, so community help seemed like a better way to go. >Internet searches for -- erlang gs image -- or -- erlang gs bitmap -- >didn't >seem to turn up much either. Any pointers would be greatly appreciated. > > You should probably look for "tk bitmap" as gs is based on tk. This looks like a decent starting point: http://www.mathematik.uni-ulm.de/help/perl5/doc/Tk/Bitmap.html >Thanks, > >Tony Bartolini >ARINC, Engineering Services LLC > > > > > From roger.larsson@REDACTED Thu Jun 1 22:57:27 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 1 Jun 2006 22:57:27 +0200 Subject: GUI toolkit - Qt? In-Reply-To: <447EE542.2080606@ericsson.com> References: <447C2B08.9010206@allcaps.org> <447E2F10.10405@allcaps.org> <447EE542.2080606@ericsson.com> Message-ID: <200606012257.27585.roger.larsson@norran.net> On torsdag 01 juni 2006 15.01, Mats Cronqvist wrote: > Andrew Lentvorski wrote: > > Tk looks ... suboptimal. > > Gtk wouldn't be bad, but it has Windows and OS X issues. > > > > Wx -- Lots of code for no gain. [...] > > not that i disagree with any of this, but... what would be good, then? > > mats What about Qt? http://www.trolltech.no/ Multiplatform, message based - signals and slots Used in KDE, by Xilinx and others... It should be possible to write a wrapper... (especially for Qt 4) GPL License if your application is GPL. You do not have to release source to anyone you have not released the binary to. In house use is OK. Commercial licenses/support available if you do not like to share your code. /RogerL From bsder@REDACTED Thu Jun 1 23:27:05 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 01 Jun 2006 14:27:05 -0700 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <11498CB7D3FCB54897058DE63BE3897C01A79C92@esealmw105.eemea.ericsson.se> References: <11498CB7D3FCB54897058DE63BE3897C01A79C92@esealmw105.eemea.ericsson.se> Message-ID: <447F5BA9.2030508@allcaps.org> Vlad Dumitrescu XX (LN/EAB) wrote: >> Which compiler version supports "+S" switch? On R10B-11 I get: > > You'll have to write > erlc +'S' mod.erl > And also to remember that the qutes need to be escaped, so the working > comand line is: > erlc +\'S\' mod.erl > > Nice! ;-) > /Vlad All of the following have been useful, as well: beam_asm beam_lib beam_disasm genop.tab -a From robert.virding@REDACTED Fri Jun 2 00:12:00 2006 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 02 Jun 2006 00:12:00 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> Message-ID: <447F6630.9040107@telia.com> Thomas Lindgren wrote: > > If you want to learn about the ancestral WAM, Hassan > Ait-Kaci wrote a good tutorial (MIT Press, 1991), > which can be found here: > > http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf > I personally feel that the original report by David H.D. Warren is more concise, more readable and easier to understand than many of the tutorials that came after it. It was actually through Warren's report that I finally understood how prolog works. Although I will admit that I haven't read the one you cite. Robert From bsder@REDACTED Fri Jun 2 00:36:55 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 01 Jun 2006 15:36:55 -0700 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6630.9040107@telia.com> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6630.9040107@telia.com> Message-ID: <447F6C07.4050204@allcaps.org> Robert Virding wrote: > Thomas Lindgren wrote: >> >> If you want to learn about the ancestral WAM, Hassan >> Ait-Kaci wrote a good tutorial (MIT Press, 1991), >> which can be found here: >> >> http://archive.bibalex.org/web/*/http://www.isg.sfu.ca/~hak/documents/wambook.pdf >> >> > > I personally feel that the original report by David H.D. Warren is more > concise, more readable and easier to understand than many of the > tutorials that came after it. It was actually through Warren's report > that I finally understood how prolog works. > > Although I will admit that I haven't read the one you cite. Are you talking about this one? http://citeseer.ist.psu.edu/context/17835/0 D. H. D. Warren. An abstract Prolog instruction set. Technical Report 309, SRI, 1983. Unfortunately, I can't seem to locate a PDF. -a From david.nospam.hopwood@REDACTED Fri Jun 2 00:51:56 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 01 Jun 2006 23:51:56 +0100 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> Message-ID: <447F6F8C.9000005@blueyonder.co.uk> Thomas Lindgren wrote: > Andrew Lentvorski wrote: > >>Is there a concise reference of the Erlang bytescodes and/or VM >>description somewhere? >> >>It seems like I have to go back to about R7B to look at an emulator >>that is clean (as opposed to having lots of HiPE stuff scattered inside). > > It depends on what you want to do. There used to be a > BEAM bytecode reference, but I think the format and > instructions change mildly every now and then, both > with new releases and with different targets. > > For example, I believe some instruction sequences can > be merged into superinstructions by the loader, and/or > otherwise specialized or optimized. This can lead to > hundreds of nearly identical instruction variants, so > some patience and experience is needed to decipher > them. This might seem like a pointed question, but I'll ask it anyway: how does one maintain a VM without accurate documentation of the executable format it implements? I know I couldn't do it. -- David Hopwood From pupeno@REDACTED Fri Jun 2 01:56:00 2006 From: pupeno@REDACTED (Pupeno) Date: Thu, 1 Jun 2006 23:56:00 +0000 Subject: GUI toolkit - Qt? In-Reply-To: <200606012257.27585.roger.larsson@norran.net> References: <447C2B08.9010206@allcaps.org> <447EE542.2080606@ericsson.com> <200606012257.27585.roger.larsson@norran.net> Message-ID: <200606012356.00404.pupeno@pupeno.com> On Thursday, 1 de June de 2006 20:57, Roger Larsson wrote: > It should be possible to write a wrapper... > (especially for Qt 4) Why especially for Qt 4 ? -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From ok@REDACTED Fri Jun 2 02:12:08 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 2 Jun 2006 12:12:08 +1200 (NZST) Subject: Erlang bytecodes and/or VM description? Message-ID: <200606020012.k520C8vH140837@atlas.otago.ac.nz> You'll have to write erlc +'S' mod.erl And also to remember that the qutes need to be escaped, so the working comand line is: erlc +\'S\' mod.erl How is erlc +"'S'" mod.erl different from erlc -S mod.erl (except for being harder to type)? From ok@REDACTED Fri Jun 2 02:20:16 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 2 Jun 2006 12:20:16 +1200 (NZST) Subject: CATCHA was Re: Erlang port to the Java Virtual Machine Message-ID: <200606020020.k520KGF8140814@atlas.otago.ac.nz> Before deploying CAPTCHAs, please *do* think carefully about the fact that some real genuine entirely innocent human beings cannot cope with them. For blocking entry to a collection of photographs, it might make sense to use a technique that the blind and partially sighted can't even see let alone solve; for other things there are humane reasons not to use them. You might even want to consider legal advice about whether shutting the disabled out is legal in your country. From yarivvv@REDACTED Fri Jun 2 02:51:21 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 1 Jun 2006 20:51:21 -0400 Subject: CATCHA was Re: Erlang port to the Java Virtual Machine In-Reply-To: <200606020020.k520KGF8140814@atlas.otago.ac.nz> References: <200606020020.k520KGF8140814@atlas.otago.ac.nz> Message-ID: <17244f480606011751ob43f42cv22461782f4f37eac@mail.gmail.com> On 6/1/06, Richard A. O'Keefe wrote: > Before deploying CAPTCHAs, please *do* think carefully about the > fact that some real genuine entirely innocent human beings cannot > cope with them. For blocking entry to a collection of photographs, > it might make sense to use a technique that the blind and partially > sighted can't even see let alone solve; for other things there are > humane reasons not to use them. You might even want to consider > legal advice about whether shutting the disabled out is legal in > your country. > Yes, you are making a very important point. It didn't even occur to me earlier as I was just thinking about the technical challenge of using CAPTCHAs with Yaws. Do you know of an alternative solution for blocking automated spam bots while being usable by the blind? Regards, Yariv From chandrashekhar.mullaparthi@REDACTED Fri Jun 2 08:22:34 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 2 Jun 2006 07:22:34 +0100 Subject: How to run distributed Erlang through a firewall? In-Reply-To: <1149186282.29722.45.camel@gateway> References: <1148499128.9039.77.camel@gateway> <1149033109.12130.20.camel@gateway> <1149186282.29722.45.camel@gateway> Message-ID: On 01/06/06, Tony Zheng wrote: > 2. If I don't use SSL and start erl commands with sys.config to restrict > the TCP ports distributed Erlang, it seems to force two Erlang nodes to > use only ports 4367--4368. But why will they not replicate between them? > You have to open op port 4369 as well. 4369 is the listen port for epmd (erlang port mapper daemon). This enables a node to discover another named node. cheers Chandru From vladdu55@REDACTED Fri Jun 2 08:50:58 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 2 Jun 2006 08:50:58 +0200 Subject: syntax_tools:epp_dodger Message-ID: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> Hi all, Using epp_dodger is very nice, but the resulting tree is a mixture of "normal" trees and erl_syntax trees. Because I send these trees to Java, it would be much easier to have a uniform representation. Is there any way to force the use of erl_syntax trees everywhere? I could store the trees on the Erlang side and use rpc to query them by only using the erl_syntax API, but it feels quite heavyweight (there will be many more queries than creations) plus that on the Java side the trees are mutable. best regards, Vlad From jaiswal.vikash@REDACTED Fri Jun 2 09:00:22 2006 From: jaiswal.vikash@REDACTED (jaiswal.vikash@REDACTED) Date: Fri, 2 Jun 2006 12:30:22 +0530 Subject: Unexpected behavior in Linux Message-ID: Hello , I have developed a graphical application using erlang . But it's behavior is different in Solaris and Linux systems . The application works as : When a window ( W1 ) is resized it in turn should generate an error message window ( W2 ) on crossing certain threshold values for height and width . The event for resizing has been captured by { gs, W1,configure,_,_ } . Behavior on resizing the window W1 : 1) ON SOLARIS -> i ) Only one error message window is coming ( as expected ) . ii ) The error message window W2 comes up only when the left click button of the mouse is let free . 2) ON LINUX -> i) Numerous error message windows are coming up . ii ) The error message window W2 starts coming up from the moment the left click button of the mouse is pressed ( unlike as in SOLARIS where W2 comes up only after the left click button of the mouse is let free ) . Could you please suggest me why the behaviors are different when I'm using the same piece of code for both ? Also is there any way I can prevent the numerous error message windows ( W2 s ) in case of Linux ? Note : Erlang used : otp_src_R9C-2 Solaris : 5.8 Linux : 2.6.9-5 Regards , Vikash The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tzheng@REDACTED Thu Jun 1 20:24:43 2006 From: tzheng@REDACTED (Tony Zheng) Date: Thu, 01 Jun 2006 11:24:43 -0700 Subject: How to run distributed Erlang through a firewall? In-Reply-To: References: <1148499128.9039.77.camel@gateway> <1149033109.12130.20.camel@gateway> Message-ID: <1149186282.29722.45.camel@gateway> Hi Chandru I deleted the ERL_FLAGS environment variable for SSL in Erlang. The sys.config took effect this time. $ erl -name one -config /usr/local/erlang/bin/sys Erlang (BEAM) emulator version 5.4.12 [source] [hipe] Eshell V5.4.12 (abort with ^G) (one@REDACTED)1> application:get_all_env(kernel). [{inet_dist_listen_min,4367}, {included_applications,[]}, {inet_dist_listen_max,4368}, {error_logger,tty}] (one@REDACTED)2> net_adm:names(). {ok,[{"one",4367}]} But the two erlang nodes didn't replicate yet even if the 4367--4368 ports of the two servers were forwarded on the routers. My understanding is: 1. To set env parameters(inet_dist_listen_min and inet_dist_listen_max) in sys.config, it will only take effect for general TCP layer. But the erlang SSL still create a dynamic port for listening. The sys.config will not take effect in SSL. Is it right? 2. If I don't use SSL and start erl commands with sys.config to restrict the TCP ports distributed Erlang, it seems to force two Erlang nodes to use only ports 4367--4368. But why will they not replicate between them? Thanks. tony On Wed, 2006-05-31 at 01:31, Chandru wrote: > What does application:get_all_env(kernel) return? > > Chandru From vladdu55@REDACTED Fri Jun 2 09:41:05 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 2 Jun 2006 09:41:05 +0200 Subject: Unexpected behavior in Linux In-Reply-To: References: Message-ID: <95be1d3b0606020041x3bd881fatca1492db546fdf20@mail.gmail.com> Hi, On 6/2/06, jaiswal.vikash@REDACTED wrote: > > I have developed a graphical application using erlang . But it's > behavior is different in Solaris and Linux systems . > Could it be that the window managers on the two systems are behaving differently? A wild guess is that on Solaris the WM displays only a frame while moving/resizing and redraws the window when releasing the mouse button; and the Linux WM does display the whole window as you move/resize it around. The latter causes rezise events to be sent whenever the mouse moves... regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From her@REDACTED Fri Jun 2 10:27:05 2006 From: her@REDACTED (Helmut Enck-Radana) Date: Fri, 02 Jun 2006 10:27:05 +0200 Subject: CAPTCHA In-Reply-To: <17244f480606011751ob43f42cv22461782f4f37eac@mail.gmail.com > References: <200606020020.k520KGF8140814@atlas.otago.ac.nz> <17244f480606011751ob43f42cv22461782f4f37eac@mail.gmail.com> Message-ID: <6.2.3.4.0.20060602101852.01dc55c8@paradigma-software.de> At 02:51 2006-06-02, Yariv Sadan wrote: >Do you know of an alternative solution for blocking automated spam >bots while being usable by the blind? Here are some links to web pages where the problem is discussed and some solutions are described: http://www.w3.org/TR/turingtest/ http://www.bestkungfu.com/?p=445 http://tldz.org/blog/computers/web/captcha.entry -- Helmut From thomasl_erlang@REDACTED Fri Jun 2 11:03:32 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 2 Jun 2006 02:03:32 -0700 (PDT) Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6F8C.9000005@blueyonder.co.uk> Message-ID: <20060602090332.68278.qmail@web38809.mail.mud.yahoo.com> --- David Hopwood wrote: > This might seem like a pointed question, but I'll > ask it anyway: > how does one maintain a VM without accurate > documentation of the > executable format it implements? I know I couldn't > do it. (You might be appalled by the state of the art :-) Well, first of all, this documentation may be partial, informal, written in swedish, or otherwise mostly intended for internal use. Or reading some of the code might be necessary. Recall that extensive 'formal' documentation also needs maintenance, and easily becomes a drag on development. (For beam, the basic file format is documented http://www.erlang.se/~bjorn/beam_file_format.html but I haven't seen any docs on the instruction set in a long time.) Second, the low-level instruction set can be in part implemented by a DSL. I believe this is a common approach when merging VM instructions, for example. Documenting the formats of autogenerated instructions is not so useful in practice. (Been there, read that :-) Third, there often are tools to slice and dice the generated code (in object form or when loaded). Using the tools and familiarizing oneself with their internals might be sufficient to learn. Fourth, experienced implementors may actually not need a lot of documentation of these things. And you won't be parachuted into maintaining beam without first getting some experience. In summary, not an ideal situation for a new beam developer, but nor would I say it is hopeless. In practice, I prefer higher-level documentation myself; once you understand the VM principles (assuming there are any), the rest tends to sort itself out. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From matthias@REDACTED Fri Jun 2 11:23:20 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 2 Jun 2006 11:23:20 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6F8C.9000005@blueyonder.co.uk> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6F8C.9000005@blueyonder.co.uk> Message-ID: <17536.904.295111.59773@antilipe.corelatus.se> David Hopwood writes: > This might seem like a pointed question, but I'll ask it anyway: > how does one maintain a VM without accurate documentation of the > executable format it implements? I know I couldn't do it. You're probably underestimating your abilities. It just takes imagination and dedication. Most of the OTP group have a lifestyle strictly designed for extraordinary performance. The exact details aren't known or documented, but the chief VM designer, for instance, never deviates from a balanced diet of rotten herring, Swedish chewing tobacco, cigarettes and coffee. And he always wears one of those helmets with horns. On overseas raids, he eats babies for breakfast. In addition, there's a free-running helper-monkey in the building. The radiation-hardened helper-monkey is kept fully up to date on the executable format and can answer any developer's question much faster than you can imagine. Every time someone asks about VM documentation, frenzied efforts (involving painful injections and dangerous drugs) are made are made to connect the monkey to the WWW, but so far there's been little success. In light of recent activity, the monkey is probably due for another round next week. Matthias From thomasl_erlang@REDACTED Fri Jun 2 11:31:31 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 2 Jun 2006 02:31:31 -0700 (PDT) Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6C07.4050204@allcaps.org> Message-ID: <20060602093131.77584.qmail@web38809.mail.mud.yahoo.com> --- Andrew Lentvorski wrote: > Are you talking about this one? > > http://citeseer.ist.psu.edu/context/17835/0 > D. H. D. Warren. An abstract Prolog instruction set. > Technical Report > 309, SRI, 1983. > > Unfortunately, I can't seem to locate a PDF. That's the original report. I'm not aware of any online copies, but it seems you can order a hardcopy from SRI: http://www.ai.sri.com/pub_list/641 Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pupeno@REDACTED Fri Jun 2 12:03:52 2006 From: pupeno@REDACTED (Pupeno) Date: Fri, 2 Jun 2006 10:03:52 +0000 Subject: Unexpected behavior in Linux In-Reply-To: References: Message-ID: <200606021003.52761.pupeno@pupeno.com> I would say the problem is deeper. Displaying a pop up when resizing the window is not very friendly. It is very likely that there's a way to stop the resizing at some size so you can't resize it anymore, even if you try. The same way some windows just can't be made smaller. But respecting all this, I believe, depends on the Window Manager (and not on the kernel, like Linux, neither on the operating system, like Solaris). If there are no other posibilities, I'd say that as soon as the window was resized over certain size, resize it back. On Friday, 2 de June de 2006 07:00, jaiswal.vikash@REDACTED wrote: > Hello , > > I have developed a graphical application using erlang . But it's > behavior is different in Solaris and Linux systems . > > The application works as : > When a window ( W1 ) is resized it in turn should generate an > error message window ( W2 ) on crossing certain threshold values for > height and width . > The event for resizing has been captured by { gs, W1,configure,_,_ > } . > > Behavior on resizing the window W1 : > 1) ON SOLARIS -> > i ) Only one error message window > is coming ( as expected ) . > ii ) The error message window W2 > comes up only when the left click button of the mouse is let free . > > 2) ON LINUX -> > i) Numerous error message windows > are coming up . > ii ) The error message window W2 > starts coming up from the moment the left click button of the mouse is > pressed ( unlike as in > SOLARIS where W2 comes up > only after the left click button of the mouse is let free ) . > > Could you please suggest me why the behaviors are different when > I'm using the same piece of code for both ? > Also is there any way I can prevent the numerous error message > windows ( W2 s ) in case of Linux ? > > Note : Erlang used : otp_src_R9C-2 > Solaris : 5.8 > Linux : 2.6.9-5 > > Regards , > Vikash > > > > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. > The company accepts no liability for any damage caused by any virus > transmitted by this email. > > www.wipro.com -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From richardc@REDACTED Fri Jun 2 12:23:20 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 02 Jun 2006 12:23:20 +0200 Subject: syntax_tools:epp_dodger In-Reply-To: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> References: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> Message-ID: <44801198.2010802@it.uu.se> Vlad Dumitrescu wrote: > Using epp_dodger is very nice, but the resulting tree is a mixture of > "normal" trees and erl_syntax trees. Because I send these trees to > Java, it would be much easier to have a uniform representation. > > Is there any way to force the use of erl_syntax trees everywhere? So, you want to convert the trees to a Java representation? First, note that any "normal" erl_parse tree can always be used as it is with the erl_syntax functions, but once you use an erl_syntax function to manipulate syntax trees, the output is not backwards compatible with erl_parse unless you do a 'revert' (which does not work on all things, e.g. macro calls and comments). Or do you want to force other library modules, such as the compiler or linter, to accept full erl_syntax trees? Probably, the best way to write a translator from erl_syntax trees to some other representation like Java objects would be to base it on the functions erl_syntax:type/1 and erl_syntax:subtrees/1. Also see the functions get_pos/1, get_ann/1, get_precomments/1 and get_postcomments/1. In the reverse direction, use erl_syntax:make_tree/2. /Richard From Bruce@REDACTED Fri Jun 2 12:28:03 2006 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 02 Jun 2006 22:28:03 +1200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <17536.904.295111.59773@antilipe.corelatus.se> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6F8C.9000005@blueyonder.co.uk> <17536.904.295111.59773@antilipe.corelatus.se> Message-ID: <448012B3.9080701@Fitzsimons.org> Matthias Lang wrote: Well done Matthias, we've been lacking constructive humour on this list I've often wondered what it took to become an OTP team member, and now I know. I'm not sure I could bear it :-) Cheers, Bruce PS I'd suggest a Dryverl interface with the monkey next time, I hear you only need a loose coupling. From richardc@REDACTED Fri Jun 2 12:31:41 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 02 Jun 2006 12:31:41 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <200606020012.k520C8vH140837@atlas.otago.ac.nz> References: <200606020012.k520C8vH140837@atlas.otago.ac.nz> Message-ID: <4480138D.7060007@it.uu.se> Richard A. O'Keefe wrote: > You'll have to write > erlc +'S' mod.erl > > And also to remember that the qutes need to be escaped, so the working > comand line is: > erlc +\'S\' mod.erl > > How is > > erlc +"'S'" mod.erl > > different from > > erlc -S mod.erl > > (except for being harder to type)? These are command-line options, remember. The ones prefixed by + are further parsed as erlang terms to be given as options to the compiler. The - ones are just flags. I suppose the -S is defined as an alias for passing the atom 'S' as a compiler option. /Richard From richardc@REDACTED Fri Jun 2 12:33:22 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 02 Jun 2006 12:33:22 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6F8C.9000005@blueyonder.co.uk> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6F8C.9000005@blueyonder.co.uk> Message-ID: <448013F2.4040807@it.uu.se> David Hopwood wrote: > This might seem like a pointed question, but I'll ask it anyway: > how does one maintain a VM without accurate documentation of the > executable format it implements? I know I couldn't do it. It's a little thing known as Job Security (for Bj?rn G., in this case). /Richard From vladdu55@REDACTED Fri Jun 2 12:47:04 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 2 Jun 2006 12:47:04 +0200 Subject: syntax_tools:epp_dodger In-Reply-To: <44801198.2010802@it.uu.se> References: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> <44801198.2010802@it.uu.se> Message-ID: <95be1d3b0606020347s7883d45kb56bc36c538bc2f1@mail.gmail.com> On 6/2/06, Richard Carlsson wrote: > Vlad Dumitrescu wrote: > > Is there any way to force the use of erl_syntax trees everywhere? > > So, you want to convert the trees to a Java representation? Yes, I use the parse trees in Erlide. Right now, I take the mixed trees that epp_dodger returns, but we are planning some changes that would make this more inconvenient. For example, we will have extra information to annotate the nodes with. I suppose I should walk the tree and clone it using erl_syntax calls, then the new tree will be fully "syntax_tools" style. It is possible that I'll have to do it anyway, in order to add the annotations. > Or do you want to force other library modules, such as the compiler > or linter, to accept full erl_syntax trees? We are using the parser just as a "syntactic parser", not for compiling but for having a model of the code as it is written in the file. For example, I modified the lexical scanner to retain the token text, thus making a difference between the integer 10 written as 16#A or 2#1010. > Probably, the best way to write a translator from erl_syntax trees > to some other representation like Java objects would be to base it > on the functions erl_syntax:type/1 and erl_syntax:subtrees/1. Also > see the functions get_pos/1, get_ann/1, get_precomments/1 and get_postcomments/1. If I want to create serialized Java objects in Erlang, I'd have to reimplement most of the serialization streaming stuff, which I don't look forward to. Instead, I am sending the Erlang term representing the tree and use jinterface to split it in components. So I have to rely on the internal representation... Thank you for the answer! best regards, Vlad From mats.cronqvist@REDACTED Fri Jun 2 12:53:18 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 02 Jun 2006 12:53:18 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <448013F2.4040807@it.uu.se> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6F8C.9000005@blueyonder.co.uk> <448013F2.4040807@it.uu.se> Message-ID: <4480189E.9020100@ericsson.com> Richard Carlsson wrote: > David Hopwood wrote: >> This might seem like a pointed question, but I'll ask it anyway: >> how does one maintain a VM without accurate documentation of the >> executable format it implements? I know I couldn't do it. > > It's a little thing known as Job Security (for Bj?rn G., in this case). Matthias Lang wrote: > In addition, there's a free-running helper-monkey in the building. Bj?rn G. == the monkey then? mats From richardc@REDACTED Fri Jun 2 13:14:59 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 02 Jun 2006 13:14:59 +0200 Subject: syntax_tools:epp_dodger In-Reply-To: <95be1d3b0606020347s7883d45kb56bc36c538bc2f1@mail.gmail.com> References: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> <44801198.2010802@it.uu.se> <95be1d3b0606020347s7883d45kb56bc36c538bc2f1@mail.gmail.com> Message-ID: <44801DB3.8040504@it.uu.se> Vlad Dumitrescu wrote: > If I want to create serialized Java objects in Erlang, I'd have to > reimplement most of the serialization streaming stuff, which I don't > look forward to. Instead, I am sending the Erlang term representing > the tree and use jinterface to split it in components. So I have to > rely on the internal representation... Apart from being more sensitive to changes in erl_syntax, the actual internal representation is a bit difficult to work with directly. I suggest that you use the functions that I mentioned to map a tree to a simple Canonical Form: something like {NodeType, [Attributes], [SubTrees]}. This translation would make your problems with handling the old erl_parse representation simply go away, and you are still free to add your annotations etc. Then send this canonical form as a term to the Java side. /Richard From luna@REDACTED Fri Jun 2 13:52:31 2006 From: luna@REDACTED (Daniel Luna) Date: Fri, 2 Jun 2006 13:52:31 +0200 (CEST) Subject: Unexpected behavior in Linux In-Reply-To: <200606021003.52761.pupeno@pupeno.com> References: <200606021003.52761.pupeno@pupeno.com> Message-ID: On Fri, 2 Jun 2006, Pupeno wrote: > On Friday, 2 de June de 2006 07:00, jaiswal.vikash@REDACTED wrote: >> The application works as : When a window ( W1 ) is resized it in turn >> should generate an error message window ( W2 ) on crossing certain >> threshold values for height and width . >> > I would say the problem is deeper. I can only agree. > Displaying a pop up when resizing the window is not very friendly. Displaying a pop up is never friendly. Stopping the user from what he wants to do, is a good way to lose me as a customer. And not having a limit on the number of error popups is really crappy. I once took a course where you were supposed to add your personnummer(*) to a field in a web form. If you made a mistake, you got a popup that told you so. Removing focus from that input area was enough to trigger the popup. So by just hitting tab one time too many you got the popup (an empty number obviously is obviously wrong). The script also activated every few seconds after that. And probably it activated when you clicked close on the popup. Anyway, after a few seconds the popups spawned quicker than you could close them... Yay! After killing my browser a few times I was always very careful when registering labs for that course. (*) National insurance number-equivalent in Sweden > If there are no other posibilities, I'd say that as soon as the window > was resized over certain size, resize it back. Oh, no! Don't ever do this. It's the job of the window manager to resize windows. You could easily have infinite loops in window managers that want to have its own window sizes. Ratpoison, for instance, would break horribly with this implementation. If you really, really want the popup. Write code that: 1. Makes certain that there is only ever a single popup active. 2. Has some sort of timeout between closing a window and opening a new one. Otherwise you can end up in a position where you can't remove the reason for the popup since there is a popup in the way... /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From vladdu55@REDACTED Fri Jun 2 14:53:09 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 2 Jun 2006 14:53:09 +0200 Subject: syntax_tools:epp_dodger In-Reply-To: <44801DB3.8040504@it.uu.se> References: <95be1d3b0606012350p4613e385mc51a11149efbe42d@mail.gmail.com> <44801198.2010802@it.uu.se> <95be1d3b0606020347s7883d45kb56bc36c538bc2f1@mail.gmail.com> <44801DB3.8040504@it.uu.se> Message-ID: <95be1d3b0606020553p45051267q3e6ac730096082c4@mail.gmail.com> On 6/2/06, Richard Carlsson wrote: > I suggest that you use the functions > that I mentioned to map a tree to a simple Canonical Form: > something like {NodeType, [Attributes], [SubTrees]}. This > translation would make your problems with handling the old > erl_parse representation simply go away, and you are still > free to add your annotations etc. Then send this canonical > form as a term to the Java side. I thought the tree node representation was {tree, NodeType, [Attributes], [SubTrees]} and thus didn't understand your suggestion... but after checking again, I suppose I forgot everything about the current hairy representation [*] right after implementing it :-) [*] the representation being {tree, #attributes, #erl_parse_tree_with_erlsyntaxified_subnodes} Or since we already have to hack the parser (in order to gather the required annotation information), we can build this simplified representation directly... Thanks again! regards, Vlad From roger.larsson@REDACTED Fri Jun 2 15:36:08 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 2 Jun 2006 15:36:08 +0200 Subject: GUI toolkit - Qt? In-Reply-To: <200606012356.00404.pupeno@pupeno.com> References: <447C2B08.9010206@allcaps.org> <200606012257.27585.roger.larsson@norran.net> <200606012356.00404.pupeno@pupeno.com> Message-ID: <200606021536.08533.roger.larsson@norran.net> On fredag 02 juni 2006 01.56, Pupeno wrote: > On Thursday, 1 de June de 2006 20:57, Roger Larsson wrote: > > It should be possible to write a wrapper... > > (especially for Qt 4) > > Why especially for Qt 4 ? "Improved Multithreading Comprehensive support for threaded programming makes it easy and efficient to create programs that take full advantage of the huge performance benefits of today's multi-core processors, while helping minimizing the amount of added complexity that programmers must manage. Qt now supports per-thread event loops, signal/ across threads, and thread-safe shared data with fast machine atomic reference counting. The Qt API in general has been with regards to reentrancy and thread-safety. " http://www.trolltech.com/products/qt/whatsnew/whatsnew-qt4 So, a Qt application could have several event loops that communicates with several Erlang processes. It must be possible to intergrate this in nicely... Summer project? /RogerL From pupeno@REDACTED Fri Jun 2 16:17:49 2006 From: pupeno@REDACTED (Pupeno) Date: Fri, 2 Jun 2006 14:17:49 +0000 Subject: Unexpected behavior in Linux In-Reply-To: References: <200606021003.52761.pupeno@pupeno.com> Message-ID: <200606021417.50002.pupeno@pupeno.com> On Friday, 2 de June de 2006 11:52, Daniel Luna wrote: > > If there are no other posibilities, I'd say that as soon as the window > > was resized over certain size, resize it back. > > Oh, no! Don't ever do this. It's the job of the window manager to resize > windows. You could easily have infinite loops in window managers that want > to have its own window sizes. > > Ratpoison, for instance, would break horribly with this implementation. Yes, right, I should have thought about it before. I'd say: A) let the user do whatever he wants. B) rely on the window manager and if that's not possible, do B. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From erlang@REDACTED Fri Jun 2 18:26:42 2006 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 2 Jun 2006 09:26:42 -0700 Subject: Asynchronous ODBC In-Reply-To: <4888552.4441149106634833.JavaMail.root@zimbra> References: <4888552.4441149106634833.JavaMail.root@zimbra> Message-ID: <20060602162642.GA12938@cougora.autosys.us> Basically, spawned processes run independently (with certain caveats according to how it was started (spawn, spawn_link, etc.) and child/parent relationships). If I do not need direct return information from a slow fun() then I will spawn it and let it do its thing in the background. For more details of operation, see the 'Gettting Started' section of the Erlang docs, particularly section 3, Concurrent Programming. Here's a good spot to see: http://www.erlang.org/starting.html On my system with documentation installed, I point my browser here: file:///usr/local/lib/erlang/doc/getting_started/part_frame.html ~Michael On Wed, May 31, 2006 at 02:17:14PM -0600, Michael FIG wrote: > Hi, > > >> imho it would be sufficient to have the wrapper in another process > >> (created by erlang:spawn/1). there is no need to involve another node. > >> please accept my apology if i have misunderstood something. > > > >I agree with bengt (with, apparently, the same understanding of your > >question). > > Ahh. I think I see now. I was under the mistaken understanding that all other processes on a node block during gen_server:call. Now I think I understand that any "receive", no matter how deeply nested, allows other processes to run. So then the "spawn"ed wrapper just insulates the caller from the process that blocks during gen_server:call. > > Is that correct? If so, then that's really good, and finally an escape from the nuisances of event-driven programming (my experience with Visual Basic 6, where DoEvents was truly horrid... you'd either reenter your code or blow up the stack if you aren't careful). > > Nice. > > -- > Michael FIG , PMP > VP Technology > MarkeTel Multi-Line Dialing Systems, Ltd. > Phone: (306) 359-6893 ext. 528 > -- Michael McDaniel Portland, Oregon, USA +1 503 283 5284 http://autosys.us From michel.urvoy@REDACTED Fri Jun 2 21:13:17 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Fri, 2 Jun 2006 21:13:17 +0200 Subject: Language Bindings for Erlang Again Message-ID: There are two aims in the binding. One is to give a way to use some specificity of the language: Rewrite a part of code in "C" with a port (driver) for efficiency and except an ASM port, there is nothing to add in this way. The other point of view is to open Erlang to other language, because what is to notice about Erlang? Everybody says that it's a very attractive language, but as far as I can see, it is very few used. This is the paradox of Erlang. For example, there is now millions of web site, but who knows one site written in Erlang? And the choice of Erlang (+C) and nothing else is not very easy when you have on the shelf a lot of code you will not be able to reuse. Well, that's to say that all the languages that are TCP/IP able should have an Erlang node interface. It is not as efficient as ports but it is a clean way to open Erlang to reuse code. For example I have already two part of code. One in C# and one in Fortran. I wrap each of them in an Erlang node and I write an Erlang framework that make the communication between the two nodes. Furthermore I should be able to use the hot replacement code mechanism on the two nodes to update the foreign code. In such a way Erlang could behave like universal glue between languages and seems to be well designed for that job. And it's a way to confirm that Erlang is something different than other language, but here everybody already knows that. Michel. From yarivvv@REDACTED Sat Jun 3 00:14:54 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 2 Jun 2006 18:14:54 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> > The other point of view is to open Erlang to other language, because > what is to notice about Erlang? Everybody says that it's a very > attractive language, but as far as I can see, it is very few used. > This is the paradox of Erlang. > For example, there is now millions of web site, but who knows one site > written in Erlang? I know of a site: http://yaws.hyber.org/ :) Seriously, though, I have wondered about the same question. If Erlang is so well suited for distributed applications (which are most non-trivial web applications), why is it not more popular? My theory is that the barrier to entry is too high. If you're a PHP programmer, there just isn't an easy way for you to hit the ground running if you want to create a web app in Erlang. You have to invest quite a lot of time into learning Erlang, OTP, Mnesia and Yaws, and all together this is quite intimidating. I think Erlang would get much more popular if it had a framework similar to Ruby on Rails. Before Ruby on Rails, relatively few programmers have used Ruby, but the success of Ruby on Rails has made the Ruby language quite popular. I think the same can happen with Erlang if Erlang had such a framework. As a first step towards such a framework, I thought about writing a script that would take a .hrl file, parse its record definitions (representing database objects), and then generate all the code required to set up a simple web app using Mnesia and Yaws. This would help newcomers overcome the initial barrier to entry for Erlang web development. That's my 2c :) Yariv From thomasl_erlang@REDACTED Sat Jun 3 00:26:59 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 2 Jun 2006 15:26:59 -0700 (PDT) Subject: Language Bindings for Erlang Again In-Reply-To: Message-ID: <20060602222659.63338.qmail@web38809.mail.mud.yahoo.com> --- Michel Urvoy wrote: > The other point of view is to open Erlang to other > language, because > what is to notice about Erlang? Everybody says that > it's a very > attractive language, but as far as I can see, it is > very few used. > This is the paradox of Erlang. > For example, there is now millions of web site, but > who knows one site written in Erlang? Look harder. > And the choice of Erlang (+C) and nothing else is > not very easy when > you have on the shelf a lot of code you will not be > able to reuse. If that's what you believe, maybe you should read the documentation a bit more closely. > Furthermore I should be able to use the hot > replacement code mechanism > on the two nodes to update the foreign code. Hot code loading for other languages is not an Erlang issue. Basically, it sounds like you are inventing problems where there aren't any. Why? Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From vances@REDACTED Sat Jun 3 00:42:10 2006 From: vances@REDACTED (Vance Shipley) Date: Fri, 2 Jun 2006 18:42:10 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <20060602224210.GB17222@frogman.motivity.ca> On Fri, Jun 02, 2006 at 09:13:17PM +0200, Michel Urvoy wrote: } For example I have already two part of code. One in C# and one in } Fortran. I wrap each of them in an Erlang node and I write an Erlang } framework that make the communication between the two nodes. There is Orber: http://www.erlang.org/doc/doc-5.5/lib/orber-3.6.3/doc/html/index.html -Vance From dbarker@REDACTED Sat Jun 3 01:04:46 2006 From: dbarker@REDACTED (Deryk Barker) Date: Fri, 02 Jun 2006 16:04:46 -0700 Subject: Language Bindings for Erlang Again In-Reply-To: <20060602222659.63338.qmail@web38809.mail.mud.yahoo.com> References: <20060602222659.63338.qmail@web38809.mail.mud.yahoo.com> Message-ID: <4480C40E.90307@camosun.bc.ca> Thomas Lindgren wrote: >--- Michel Urvoy wrote: > > > >>The other point of view is to open Erlang to other >>language, because >>what is to notice about Erlang? Everybody says that >>it's a very >>attractive language, but as far as I can see, it is >>very few used. >>This is the paradox of Erlang. >>For example, there is now millions of web site, but >>who knows one site written in Erlang? >> >> > >Look harder. > > Indeed. One of my students turned up this: 27,000 Concurrent Erlang Poker Games In the past six weeks, Joel Reymont has rewritten a large part of his online poker software engine in Erlang , with some impressive results: I have a PowerBook G4 1.25Ghz with 512Mb of memory. Running 27K games consumes about 600Mb of memory and takes around 15 minutes per 10K games due to heavy swapping. I gave "top" a cursory look so this is a probably reason. Each game runs in about 0.02 to 0.07 seconds, depending on the number of games running. at http://www.kendyck.com/2005/05/27000-concurrent-erlang-poker-games.php From david.nospam.hopwood@REDACTED Sat Jun 3 04:46:31 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Sat, 03 Jun 2006 03:46:31 +0100 Subject: Unexpected behavior in Linux In-Reply-To: References: Message-ID: <4480F807.2040408@blueyonder.co.uk> jaiswal.vikash@REDACTED wrote: > The application works as : > When a window ( W1 ) is resized it in turn should generate an > error message window ( W2 ) on crossing certain threshold values for > height and width. That sounds like terrible user interface design. If there is a minimum and/or maximum height and width, the resized window should be silently constrained to those dimensions; a modal error dialog is much too intrusive. -- David Hopwood From tobbe@REDACTED Sat Jun 3 09:14:30 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sat, 03 Jun 2006 09:14:30 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> References: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> Message-ID: <448136D6.2030203@tornkvist.org> Yariv Sadan wrote: >> The other point of view is to open Erlang to other language, because >> what is to notice about Erlang? Everybody says that it's a very >> attractive language, but as far as I can see, it is very few used. >> This is the paradox of Erlang. >> For example, there is now millions of web site, but who knows one site >> written in Erlang? > > > I know of a site: http://yaws.hyber.org/ :) > > Seriously, though, I have wondered about the same question. If Erlang > is so well suited for distributed applications (which are most > non-trivial web applications), why is it not more popular? My theory > is that the barrier to entry is too high. If you're a PHP programmer, > there just isn't an easy way for you to hit the ground running if you > want to create a web app in Erlang. You have to invest quite a lot of > time into learning Erlang, OTP, Mnesia and Yaws, and all together this > is quite intimidating. > > I think Erlang would get much more popular if it had a framework > similar to Ruby on Rails. Before Ruby on Rails, relatively few > programmers have used Ruby, but the success of Ruby on Rails has made > the Ruby language quite popular. I think the same can happen with > Erlang if Erlang had such a framework. > > As a first step towards such a framework, I thought about writing a > script that would take a .hrl file, parse its record definitions > (representing database objects), and then generate all the code > required to set up a simple web app using Mnesia and Yaws. That is something I've been thinking of for quite a while now. I even started an embryo for a framework ('yfront' in jungerl) and played around with Javascript libraries ('js' in jungerl). --Tobbe > This would > help newcomers overcome the initial barrier to entry for Erlang web > development. > > That's my 2c :) > > Yariv > From jilani.khaldi1@REDACTED Sat Jun 3 10:21:50 2006 From: jilani.khaldi1@REDACTED (Jilani Khaldi) Date: Sat, 03 Jun 2006 10:21:50 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> References: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> Message-ID: <4481469E.9070406@virgilio.it> > I think Erlang would get much more popular if it had a framework > similar to Ruby on Rails. Before Ruby on Rails, relatively few > programmers have used Ruby, but the success of Ruby on Rails has made > the Ruby language quite popular. I think the same can happen with > Erlang if Erlang had such a framework. Ruby has above all an easy, elegant and nice way to be extended with C/C++ language, this is the true success key of Ruby. You can easily use the huge C/C++ code libraries and for this reason it is even used with success in scientific computation (http://www.artcompsci.org/rel/index.html). You can write everything in Ruby and for particular need, write it easily in C/C++ without going banana. jk From robert.virding@REDACTED Sat Jun 3 11:52:33 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 03 Jun 2006 11:52:33 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <447F6C07.4050204@allcaps.org> References: <20060601091907.77508.qmail@web38810.mail.mud.yahoo.com> <447F6630.9040107@telia.com> <447F6C07.4050204@allcaps.org> Message-ID: <44815BE1.6060508@telia.com> Andrew Lentvorski wrote: > Are you talking about this one? > > http://citeseer.ist.psu.edu/context/17835/0 > D. H. D. Warren. An abstract Prolog instruction set. Technical Report > 309, SRI, 1983. > > Unfortunately, I can't seem to locate a PDF. That's the one. No, I have not seen a digital copy either. I have a paper copy "somewhere" amongst my stuff, but seeing that is mostly packed in boxes at the moment there is little chance in finding it. :-) If anyone has, or knows of, a digital copy please tell. But it is a good report. Robert From terrance.sullivan@REDACTED Sat Jun 3 17:11:35 2006 From: terrance.sullivan@REDACTED (Terrance Sullivan) Date: Sat, 3 Jun 2006 11:11:35 -0400 Subject: Erlang port to the Java Virtual Machine In-Reply-To: References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> <447CBB21.2050003@allcaps.org> <20060531152011.GA22347@memphis.ilius.fr> Message-ID: <5440AD30-1F1A-40F3-BD1F-6D37D2D024FC@exray.ca> Recently I attempted to drill down on this very thing but after a fairly wide search it failed to generate enough detailed design documentation on beam that would afford much progress towards implementing something. However, from my perspective, I think your idea here has merit, for any number of good reasons... On 31-May-06, at 2:08 PM, Christian S wrote: > On 5/31/06, Mickael Remond wrote: >> When you get used to Erlang, you realized that its virtual machine is >> superior to the JVM and it take a big part in Erlang success. > > Now, have anyone considered making a java compiler that targets > beam? :) From michel.urvoy@REDACTED Sat Jun 3 21:08:59 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Sat, 3 Jun 2006 21:08:59 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> References: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> Message-ID: 2006/6/3, Yariv Sadan : > > I know of a site: http://yaws.hyber.org/ :) > > Seriously, though, I have wondered about the same question. If Erlang > is so well suited for distributed applications (which are most > non-trivial web applications), why is it not more popular? My theory > is that the barrier to entry is too high. If you're a PHP programmer, > there just isn't an easy way for you to hit the ground running if you > want to create a web app in Erlang. You have to invest quite a lot of > time into learning Erlang, OTP, Mnesia and Yaws, and all together this > is quite intimidating. > OK, this is the point. There are a lot of tools but it is difficult to know what is up to date. For example, I had a look to Eddie that seems great, but it's not updated since 2000. This is a little disappointing. > I think Erlang would get much more popular if it had a framework > similar to Ruby on Rails. Before Ruby on Rails, relatively few > programmers have used Ruby, but the success of Ruby on Rails has made > the Ruby language quite popular. I think the same can happen with > Erlang if Erlang had such a framework. > An Erlang on Rails sounds great, but it's a really huge work. It could be lighter to provide an internet library with usefully functions like : - users and password management, - Paypal (or others) secure management, - (x)html files management, - news management, - page edition, - language management etc? > As a first step towards such a framework, I thought about writing a > script that would take a .hrl file, parse its record definitions > (representing database objects), and then generate all the code > required to set up a simple web app using Mnesia and Yaws. This would > help newcomers overcome the initial barrier to entry for Erlang web > development. > Not bat, it's possible to mix the both approach. > That's my 2c :) > > Yariv > From yarivvv@REDACTED Sun Jun 4 18:03:23 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 4 Jun 2006 12:03:23 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> Message-ID: <17244f480606040903x1bbace8fi85addac17fa7b6cd@mail.gmail.com> > An Erlang on Rails sounds great, but it's a really huge work. It could > be lighter to provide an internet library with usefully functions like > : > - users and password management, > - Paypal (or others) secure management, > - (x)html files management, > - news management, > - page edition, > - language management etc? > I agree that it's a huge work, but it could be done in stages. I think that at the very least, this framework should provide easy integration between Mnesia (or other databases) and Yaws and have a set of "best practices" baked in so that one could build traditional CRUD applications with good design patterns very easily (as with ROR, one should be able to set up a basic site in a matter of minutes). I also think there should also be a module system allowing third party extensions to easily plug in to the framework to support the list of features you described. By the way, last April, the Ruby on Rails mailing list had 8020 postings compared to 338 for Erlang-questions (most of which aren't concerned with web development). This shows how popular such a framework could be among developers. Best Yariv From yarivvv@REDACTED Sun Jun 4 18:13:06 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 4 Jun 2006 12:13:06 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: <4481469E.9070406@virgilio.it> References: <17244f480606021514o5d03d83dsbd52a295bf3bfab9@mail.gmail.com> <4481469E.9070406@virgilio.it> Message-ID: <17244f480606040913g4a881da4wf035087c225e91f2@mail.gmail.com> > Ruby has above all an easy, elegant and nice way to be extended with > C/C++ language, this is the true success key of Ruby. You can easily use > the huge C/C++ code libraries and for this reason it is even used with > success in scientific computation > (http://www.artcompsci.org/rel/index.html). You can write everything in > Ruby and for particular need, write it easily in C/C++ without going banana. > jk I agree that easy C/C++ is a great strength for Ruby, but Rails developers probably never stray outside of Ruby (even for client-side Javascript, which you can write in pure Ruby using RJS). Yariv From danie@REDACTED Sun Jun 4 18:38:22 2006 From: danie@REDACTED (Danie Schutte) Date: Sun, 4 Jun 2006 18:38:22 +0200 Subject: tcp question Message-ID: <200606041838.22651.danie@erlfinsys.net> Is there any significant benefits or drawbacks to either of the following scenarios - or is it preferable to use the one or the other? 1. in a gen server receiving the tcp date in handle_info. 2. using a gen_tcp:recv for receiving the data Kind regards Daniel From neumann@REDACTED Mon Jun 5 01:24:55 2006 From: neumann@REDACTED (Francois-Denis Gonthier) Date: Sun, 4 Jun 2006 19:24:55 -0400 Subject: Non-free documentation in the Erlang distribution Message-ID: <200606041924.58277.neumann@lostwebsite.net> Hello all, It has been brought to our attention that a file currently distributed with Erlang documentation has been deemed non-free, meaning that they should be removed from the main repository of Debian, and most likely other distributions like Ubuntu. One of the file for which the problem has been confirmed is rfc3015.txt from the Megaco documentation. See bug 365175 [1] on Debian. Another file is suspected to be non-free by a part of the packaging team. implementors_guide_v6.pdf, in the same directory as the previous file, might not be freely redistributable. The copyright [2] indeed seems restrictive. If those file are not required in the distribution, it would probably be good for a Linux packaging teams that those files got removed. We have to remove it ourselves anyway or erlang-doc-html would have to go to the "non-free" repository. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=365175 [2] http://www.itu.int/home/copyright/index.html Thank you. F.D.-Gonthier -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 191 bytes Desc: not available URL: From michel.urvoy@REDACTED Mon Jun 5 01:54:25 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Mon, 5 Jun 2006 01:54:25 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <20060602222659.63338.qmail@web38809.mail.mud.yahoo.com> References: <20060602222659.63338.qmail@web38809.mail.mud.yahoo.com> Message-ID: 2006/6/3, Thomas Lindgren : > > > --- Michel Urvoy wrote: > > > The other point of view is to open Erlang to other > > language, because > > what is to notice about Erlang? Everybody says that > > it's a very > > attractive language, but as far as I can see, it is > > very few used. > > This is the paradox of Erlang. > > For example, there is now millions of web site, but > > who knows one site written in Erlang? > > Look harder. Right, I found one real commercial site, a bank: http://www.kreditor.se/Jobb/jobb.html > > > And the choice of Erlang (+C) and nothing else is > > not very easy when > > you have on the shelf a lot of code you will not be > > able to reuse. > > If that's what you believe, maybe you should read the > documentation a bit more closely. > Right again, there is the java node interface (Jinterface), but my purpose was more to reuse old Pascal or Fortran code. > > Furthermore I should be able to use the hot > > replacement code mechanism > > on the two nodes to update the foreign code. > > Hot code loading for other languages is not an Erlang > issue. If you say so! But it could be. I've not seen in the documentation it was not. > > Basically, it sounds like you are inventing problems > where there aren't any. Why? > I'm sorry Thomas, I've no answer for this point, but your question is a kind of answer to my Erlang paradox. Friendly, Michel. > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > From michel.urvoy@REDACTED Mon Jun 5 09:14:10 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Mon, 5 Jun 2006 09:14:10 +0200 Subject: Non-free documentation in the Erlang distribution In-Reply-To: <200606041924.58277.neumann@lostwebsite.net> References: <200606041924.58277.neumann@lostwebsite.net> Message-ID: The document is there: ftp://ftp.rfc-editor.org/in-notes/rfc3015.txt From rprice@REDACTED Mon Jun 5 11:12:20 2006 From: rprice@REDACTED (Roger Price) Date: Mon, 5 Jun 2006 11:12:20 +0200 (CEST) Subject: Non-free documentation in the Erlang distribution In-Reply-To: <200606041924.58277.neumann@lostwebsite.net> References: <200606041924.58277.neumann@lostwebsite.net> Message-ID: On Sun, 4 Jun 2006, Francois-Denis Gonthier wrote: > It has been brought to our attention that a file currently distributed > with Erlang documentation has been deemed non-free, meaning that they > should be removed from the main repository of Debian, and most likely > other distributions like Ubuntu. > One of the file for which the problem has been confirmed is rfc3015.txt > from the Megaco documentation. See bug 365175 [1] on Debian. When two standards development authorities, in this case the IETF and the ITU share text, each is entitled to publish as it sees fit. The ITU have a "non-free" copyright statement: Access to databases of the International Telecommunication Union (ITU) for consultation of documents and/or information retrieval is permitted by the ITU subject to the user's acceptance of ITU's provisions and conditions of copyright contained within each document which obliges the user not to duplicate the document or parts thereof for distribution or sale external to the user's organization... but the IETF have a "free" copyright policy, and RFC 3015 http://www.ietf.org/rfc/rfc3015.txt contains the statement: Cuervo, et al. Standards Track [Page 178] RFC 3015 Megaco Protocol Version 1.0 November 2000 Full Copyright Statement Copyright (C) The Internet Society (2000). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. It seems to me that if a packager takes file rfc3015.txt from the IETF, its "free", and may be redistributed. Roger From thomasl_erlang@REDACTED Mon Jun 5 12:44:26 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 5 Jun 2006 03:44:26 -0700 (PDT) Subject: Language Bindings for Erlang Again In-Reply-To: Message-ID: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> --- Michel Urvoy wrote: > 2006/6/3, Thomas Lindgren > : > > > > Look harder. > > Right, I found one real commercial site, a bank: > http://www.kreditor.se/Jobb/jobb.html Just the Nortel SSL-VPN product has delivered thousands of commercial intranet sites, written in Erlang and Yaws. > > > And the choice of Erlang (+C) and nothing else > is > > > not very easy when > > > you have on the shelf a lot of code you will not > be > > > able to reuse. > > > > If that's what you believe, maybe you should read > the > > documentation a bit more closely. > > > Right again, there is the java node interface > (Jinterface), but my > purpose was more to reuse old Pascal or Fortran > code. You can find plenty of other interfacing code if you look, including Orber (CORBA), Comet (COM), erl interface, IC, ... If you want to wrap Pascal or Fortran, then you can integrate at different points by communication via pipes, writing a C-node wrapper, or writing an Erlang driver. > > > Furthermore I should be able to use the hot > > > replacement code mechanism > > > on the two nodes to update the foreign code. > > > > Hot code loading for other languages is not an > Erlang > > issue. > > If you say so! But it could be. I've not seen in the > documentation it was not. How could it be? Most languages don't even have a semantics for hot code loading. > > Basically, it sounds like you are inventing > > problems > > where there aren't any. Why? > > I'm sorry Thomas, I've no answer for this point, but > your question is > a kind of answer to my Erlang paradox. In other words, you strongly feel that Erlang would be used (much?) more if there was even more support for wrapping arbitrary libraries than today? Or if Erlang somehow implemented hot code loading for arbitrary languages? Well, if you enjoy working on interfacing, why not join the recently started Dryverl project? As to general hot code loading, this seems still to be very much a research topic. Here are a couple of pointers: http://www.cs.umd.edu/projects/dsu/ http://www.pmg.lcs.mit.edu/ Or why not have a look at how to improve/extend hot code loading in Erlang itself? Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From thomasl_erlang@REDACTED Mon Jun 5 12:47:39 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 5 Jun 2006 03:47:39 -0700 (PDT) Subject: Erlang documentation sources Message-ID: <20060605104739.70011.qmail@web38804.mail.mud.yahoo.com> Hi all, Are the Erlang documentation sources available for download? Meaning the source used to generate the HTML etc. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From chsu79@REDACTED Mon Jun 5 14:11:37 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 5 Jun 2006 14:11:37 +0200 Subject: Erlang documentation sources In-Reply-To: <20060605104739.70011.qmail@web38804.mail.mud.yahoo.com> References: <20060605104739.70011.qmail@web38804.mail.mud.yahoo.com> Message-ID: I recall reading a more direct answer on the state of the documentation sources than this post indicates: http://www.erlang.org/ml-archive/erlang-questions/200009/msg00062.html Summary: The sources are internal and not released for whatever reason. I too have been interested in looking at the source data to see if I could get around pet pieves when using the current html version. Anyone: Is the HTML format documentation EPL that I have the right to edit and/or present differently? On 6/5/06, Thomas Lindgren wrote: > Hi all, > > Are the Erlang documentation sources available for > download? Meaning the source used to generate the HTML > etc. > > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > From neumann@REDACTED Mon Jun 5 15:12:39 2006 From: neumann@REDACTED (Francois-Denis Gonthier) Date: Mon, 5 Jun 2006 09:12:39 -0400 Subject: Non-free documentation in the Erlang distribution In-Reply-To: References: <200606041924.58277.neumann@lostwebsite.net> Message-ID: <200606050912.41725.neumann@lostwebsite.net> On Monday 05 June 2006 05:12, Roger Price wrote: > However, this > ? ?document itself may not be modified in any way, such as by removing > ? ?the copyright notice or references to the Internet Society or other > ? ?Internet organizations, except as needed for the purpose of > ? ?developing Internet standards in which case the procedures for > ? ?copyrights defined in the Internet Standards process must be > ? ?followed, or as required to translate it into languages other than > ? ?English. The bug that was posted explicitely mention IETF RFC because of that part. I'm not the one making policies in Debian, but it seems that this part makes the IETF RFCs "not-free-enough" for Debian. That's why I'm asking if that file can be removed from the distribution, See 199810 [1] for the discussion on the subject, if anyone cares. F-D [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=199810 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 191 bytes Desc: not available URL: From taavi@REDACTED Mon Jun 5 15:30:02 2006 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 5 Jun 2006 16:30:02 +0300 Subject: Non-free documentation in the Erlang distribution In-Reply-To: <200606050912.41725.neumann@lostwebsite.net> References: <200606041924.58277.neumann@lostwebsite.net> <200606050912.41725.neumann@lostwebsite.net> Message-ID: <6e0a65a1f6693edf22181f20b9d83393@uninet.ee> This is clearly Debian problem to align their copyright policy with IETF RFC copyright policy and they themselves must take appropriate steps to resolve conflicts. If necessary repackage Erlang distribution for Debian to comply. This file is useful (at least for me) as part of Erlang distribution. best regards, taavi > On Monday 05 June 2006 05:12, Roger Price wrote: >> However, this >> ? ?document itself may not be modified in any way, such as by removing >> ? ?the copyright notice or references to the Internet Society or other >> ? ?Internet organizations, except as needed for the purpose of >> ? ?developing Internet standards in which case the procedures for >> ? ?copyrights defined in the Internet Standards process must be >> ? ?followed, or as required to translate it into languages other than >> ? ?English. > > The bug that was posted explicitely mention IETF RFC because of that > part. > I'm not the one making policies in Debian, but it seems that this part > makes > the IETF RFCs "not-free-enough" for Debian. > > That's why I'm asking if that file can be removed from the > distribution, > > See 199810 [1] for the discussion on the subject, if anyone cares. > > F-D > > [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=199810 > > From david.nospam.hopwood@REDACTED Mon Jun 5 16:26:04 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Mon, 05 Jun 2006 15:26:04 +0100 Subject: Non-free documentation in the Erlang distribution In-Reply-To: References: <200606041924.58277.neumann@lostwebsite.net> Message-ID: <44843EFC.80208@blueyonder.co.uk> Roger Price wrote: > [...] but the IETF have a "free" copyright policy, and RFC 3015 > http://www.ietf.org/rfc/rfc3015.txt contains the statement: > > Cuervo, et al. Standards Track [Page 178] > RFC 3015 Megaco Protocol Version 1.0 November 2000 > > Full Copyright Statement > > Copyright (C) The Internet Society (2000). All Rights Reserved. > > This document and translations of it may be copied and furnished to > others, and derivative works that comment on or otherwise explain it > or assist in its implementation may be prepared, copied, published > and distributed, in whole or in part, without restriction of any > kind, provided that the above copyright notice and this paragraph are > included on all such copies and derivative works. However, this > document itself may not be modified in any way, such as by removing > the copyright notice or references to the Internet Society or other > Internet organizations, except as needed for the purpose of > developing Internet standards in which case the procedures for > copyrights defined in the Internet Standards process must be > followed, or as required to translate it into languages other than > English. > > The limited permissions granted above are perpetual and will not be > revoked by the Internet Society or its successors or assigns. > > It seems to me that if a packager takes file rfc3015.txt from the IETF, > its "free", and may be redistributed. The clause that the bug reporters are complaining about is the "However, this document itself may not be modified in any way ... except ..." part. See . As pointed out by a respondant to that bug, the GPL "LICENSE" file has such a clause: Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. and so we arrive at the absurd result that all GPL-licensed packages are "non-free", if the policy is to be interpreted so strictly. It is clearly the DFSG policy that is broken, or at least poorly expressed. -- David Hopwood From sgolovan@REDACTED Mon Jun 5 16:47:19 2006 From: sgolovan@REDACTED (Sergei Golovan) Date: Mon, 5 Jun 2006 18:47:19 +0400 Subject: Non-free documentation in the Erlang distribution In-Reply-To: <6e0a65a1f6693edf22181f20b9d83393@uninet.ee> References: <200606041924.58277.neumann@lostwebsite.net> <200606050912.41725.neumann@lostwebsite.net> <6e0a65a1f6693edf22181f20b9d83393@uninet.ee> Message-ID: As for me, it looks like someone simply forget about these two files. They are never referenced in megaco HTML docs. Moreover, there is a link to RFC-3015, but it points to http://www.ietf.org/rfc/rfc3015.txt, not to locally stored file. On 6/5/06, Taavi Talvik wrote: > This is clearly Debian problem to align their copyright policy > with IETF RFC copyright policy and they themselves must take > appropriate steps to resolve conflicts. > > If necessary repackage Erlang distribution for Debian to comply. > > This file is useful (at least for me) as part of Erlang distribution. -- Sergei Golovan From yarivvv@REDACTED Mon Jun 5 17:02:44 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 5 Jun 2006 11:02:44 -0400 Subject: Mnesia question Message-ID: <17244f480606050802t16dbec9bnd23ca3b602d3762d@mail.gmail.com> Hi, I have a newbie question about one-to-many relations in Mnesia: In the Getting Started section of the Mnesia User's guide, the one-to-many relation between "employee" and "dept" is given its own table, "at-dep". Why is this relation expressed in a new table? Wouldn't it be better to add a "dep_id" field to the "employee" table, with an index on this field? Thanks, Yariv From goertzen@REDACTED Mon Jun 5 17:10:19 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Mon, 05 Jun 2006 10:10:19 -0500 Subject: beam crashes on inet_gethost port Message-ID: <4484495B.2050203@ertw.com> I am still trying to get a cross compiled system going (x86_64 to i486, linux, R11B0), but am having troubles. When I run my i486 erlang I get: bash-3.00# erl Segmentation Fault bash-3.00# After much tracing with strace, it is revealed that beam crashes after using inet_gethost as a port. Beam appears to conduct a successful transaction with inet_gethost, then starts to close the port. inet_gethost shuts down properly, but beam segfaults immediately after receiving SIGCHLD. Any ideas where to look next? Thanks, Dan. Here is a fragment of a trace: hints: pid 3931 = beam pid 3937 = inet_gethost pid 3938 = inet_gethost child worker process comments in double braces, ie {{comment}} bash-3.00# strace -f erl . (snip) . [pid 3931] close(7) = 0 {{this is beam's write pipe to inet_gethost}} [pid 3931] fcntl64(10, F_GETFL) = 0x801 (flags O_WRONLY|O_NONBLOCK) [pid 3931] fcntl64(10, F_SETFL, O_WRONLY) = 0 [pid 3931] close(10 [pid 3937] <... select resumed> ) = 1 (in [0]) [pid 3931] <... close resumed> ) = 0 [pid 3937] read(0, [pid 3931] times( [pid 3937] <... read resumed> "", 4) = 0 [pid 3931] <... times resumed> {tms_utime=9, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 1923210188 [pid 3937] kill(3938, SIGUSR1 {{inet_gethost cleans up its child}} [pid 3931] gettimeofday( [pid 3937] <... kill resumed> ) = 0 [pid 3931] <... gettimeofday resumed> {1149519332, 422564}, NULL) = 0 [pid 3937] exit_group(0) = ? Process 3937 detached {{inet_gethost} [pid 3931] times({tms_utime=9, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 1923210188 [pid 3931] --- SIGCHLD (Child exited) @ 0 (0) --- {{ beam sees inet_gethost exiting }} [pid 3931] --- SIGSEGV (Segmentation fault) @ 0 (0) --- {{beam goes tits up :( }} [pid 3938] <... read resumed> "", 4) = 0 [pid 3938] --- SIGUSR1 (User defined signal 1) @ 0 (0) --- Process 3938 detached [pid 3935] <... poll resumed> [{fd=5, events=POLLIN}], 1, 2000) = -1 EINTR (Interrupted system call) [pid 3936] +++ killed by SIGKILL +++ [pid 3931] +++ killed by SIGSEGV +++ +++ killed by SIGKILL +++ bash-3.00# From goertzen@REDACTED Mon Jun 5 18:41:06 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Mon, 05 Jun 2006 11:41:06 -0500 Subject: beam crashes on inet_gethost port In-Reply-To: <4484495B.2050203@ertw.com> References: <4484495B.2050203@ertw.com> Message-ID: <44845EA2.60308@ertw.com> I finally got it working by adding "--disable-hipe" to configure. While I'm happy it now works, I wish I had the option of using hipe. Dan. Daniel Goertzen wrote: > I am still trying to get a cross compiled system going (x86_64 to > i486, linux, R11B0), but am having troubles. When I run my i486 > erlang I get: > > bash-3.00# erl > Segmentation Fault > bash-3.00# > > After much tracing with strace, it is revealed that beam crashes after > using inet_gethost as a port. Beam appears to conduct a successful > transaction with inet_gethost, then starts to close the port. > inet_gethost shuts down properly, but beam segfaults immediately after > receiving SIGCHLD. > > Any ideas where to look next? > > Thanks, > Dan. > > > Here is a fragment of a trace: > > hints: > pid 3931 = beam > pid 3937 = inet_gethost > pid 3938 = inet_gethost child worker process > comments in double braces, ie {{comment}} > > > bash-3.00# strace -f erl > . > (snip) > . > [pid 3931] close(7) = 0 {{this is beam's > write pipe to inet_gethost}} > [pid 3931] fcntl64(10, F_GETFL) = 0x801 (flags > O_WRONLY|O_NONBLOCK) > [pid 3931] fcntl64(10, F_SETFL, O_WRONLY) = 0 > [pid 3931] close(10 > [pid 3937] <... select resumed> ) = 1 (in [0]) > [pid 3931] <... close resumed> ) = 0 > [pid 3937] read(0, > [pid 3931] times( > [pid 3937] <... read resumed> "", 4) = 0 > [pid 3931] <... times resumed> {tms_utime=9, tms_stime=0, > tms_cutime=0, tms_cstime=0}) = 1923210188 > [pid 3937] kill(3938, SIGUSR1 {{inet_gethost > cleans up its child}} > [pid 3931] gettimeofday( > [pid 3937] <... kill resumed> ) = 0 > [pid 3931] <... gettimeofday resumed> {1149519332, 422564}, NULL) = 0 > [pid 3937] exit_group(0) = ? > Process 3937 detached {{inet_gethost} > [pid 3931] times({tms_utime=9, tms_stime=0, tms_cutime=0, > tms_cstime=0}) = 1923210188 > [pid 3931] --- SIGCHLD (Child exited) @ 0 (0) --- {{ beam sees > inet_gethost exiting }} > [pid 3931] --- SIGSEGV (Segmentation fault) @ 0 (0) --- {{beam goes > tits up :( }} > [pid 3938] <... read resumed> "", 4) = 0 > [pid 3938] --- SIGUSR1 (User defined signal 1) @ 0 (0) --- > Process 3938 detached > [pid 3935] <... poll resumed> [{fd=5, events=POLLIN}], 1, 2000) = -1 > EINTR (Interrupted system call) > [pid 3936] +++ killed by SIGKILL +++ > [pid 3931] +++ killed by SIGSEGV +++ > +++ killed by SIGKILL +++ > bash-3.00# > > From richardc@REDACTED Mon Jun 5 22:46:03 2006 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 05 Jun 2006 22:46:03 +0200 Subject: So, you think you know Erlang? Message-ID: <4484980B.3090503@it.uu.se> Think you know a thing or two about the Erlang language by now? Do you have nothing to do (for example, because it happens to be the National Day of Sweden tomorrow)? Here is something for you. I submitted the following file (attached) to the Obfuscated Erlang Contest last year, but didn't even make the top three. In retrospect, it seems like it was a bit of overkill. So, I now offer it to the list as an excercise and a competition: the first person who can tell me precisely what the program does, in sufficient detail, shall be announced on the list as being a Very Clever and Knowledgeable Erlang Hacker, along with the explanation and a promise of a drink of the best beer available whenever we should meet in person. Enjoy! /Richard Carlsson -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: export_all.erl URL: From micke@REDACTED Tue Jun 6 00:34:32 2006 From: micke@REDACTED (Michael Fogeborg) Date: Tue, 06 Jun 2006 00:34:32 +0200 Subject: So, you think you know Erlang? In-Reply-To: <4484980B.3090503@it.uu.se> References: <4484980B.3090503@it.uu.se> Message-ID: %% %% compiler complained... had to do manual macro-expansion myself... %% %% Copyright (C) 2005 Richard Carlsson %% Compile and call run(). -module(export_all). -define(xyzzy, -ifdef(magic)). -define(plugh, -ifndef(magic)). -define(pi, 3.141592653589793). -define('\',). ','compile'. -define(%',?MODULE). _@,?'\^@'.%@*^&@^&#$@ ?xyzzy. -define(zy,)). -define(_,?'\',).\012'.%.'). -define('\0',?'\115O\104U\114\105'). -define(__(_),??_.%._??,(_)__). -define(xy, -?%?- _(.%. ?xy?_@?zy.%)). ?plugh. -define(else,;(X)-> . %%%% . %% .. %% 'fun'() -> fun() -> $\n = io:nl() end. -record('\'',{'\'\'','\'\'\''}). undefined_function(M, F, As) -> fun() -> [hd(As)|apply(M, F, tl(As))] end. run() -> process_flag(error_handler, ?MODULE), case fun(__)->{element(#'\''.'\'\'\''-#'\''.'\'\'', __?zy,__#'\''.'\'\''} end of ___ -> begin case catch size([apply(spawn,lists,length([]))]) of __->__ end end, _@=(___(hd((__#'\''.'\'\'')#'\''.'\'\'')))(___({?'\0',(fun (_x) -> list_to_atom(((fun (_y) -> (fun (___) -> (fun (__) -> (__)(__) end)((fun (__) -> (___)(fun (___) -> ((__)(__))(___) end) end)) end)(fun(___) -> fun (__) -> _z = _y(hd(__)), if _z -> [hd(__)|(___)(tl(__))]; true -> [] end end end) end)(fun (X) when float(X) /= false -> X >= math:pow(?pi, 4) ?else X < 8#177 end))(_x)) end)(?__(fun (_) -> false end)),0}),?__([?plugh?])) end, catch (((fun (___) -> (fun (__) -> (__)(__) end)((fun (__) -> (___)(fun (___) -> ((__)(__))(___) end) end)) end)(fun(___) -> fun (__) -> fun (____) -> io:put_chars([hd(__())]), ((___)(tl(__())))(____) end end end))(((((fun (___) -> (fun (__) -> (__)(__) end)((fun (__) -> (___)(fun (___) -> ((__)(__))(___) end) end)) end)(fun(_w) -> fun (_x) -> fun (__) -> fun (___) -> fun () -> [_x(hd(__()),hd(___()))|(((_w)(_x))(tl(__())))(tl(___()))] end end end end end))(fun (_x,_y) -> _x bxor _y end))(_@))((((fun (___) -> (fun (__) -> (__)(__) end)((fun (__) -> (___)(fun (___) -> ((__)(__))(___) end) end)) end)(fun(_x) -> fun (__) -> fun (___) -> fun () -> [___+hd(__())| ((_x)(tl(__())))(hd(__())+___)] end end end end))(?'\^@':(hd(tuple_to_list(hd((hd(module_info()))#'\''.'\'\''))))(2, 50, 14, -7, -45, 33, 21, -69, -9, 75, 1, -15, 56)))(17))))(fun (_) -> exit(42) end), ok. From jefcrane@REDACTED Tue Jun 6 02:40:19 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Mon, 5 Jun 2006 17:40:19 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> > > > Basically, it sounds like you are inventing > > > problems > > > where there aren't any. Why? Erlang is not some utopian language. There must be large or multiple problems to prevent adoption when implementing the most trivial of tasks. First, Erlang is not adopted because it is not exceptionally good at satisfying basic project goals like speed, maintainability, and efficiency. In small standalone programs, it's unlikely that anyone would consider Erlang over a purely interpreted language. As an employer, it's near-impossible to find a person to maintain or support my new Erlang project in any State, much less my County. The amount of Erlang the average programmer (me) needs to write to perform the same work as 12 lines of ASP, is beyond reasonable. The difficulty in bridging to other languages is what stifles adoption within my peer group. I have no examples of Erlang binding nicely to anything but C++. A month of digging and posting in my free time (that 99% of Erlang dabblers will not bother with regardless), I still dont have Erlang talking to Python (which I'm also learning). Personally, I'm using Erlang for its strengths. Is it better than RakNet? It's certainly easier to implement! and that's worth something...but it's not exactly presented as a prototyping language. I first bought into the advantages of Joel Reymont when he presented findings through the OpenPoker project. I also examined the criticisms, which were never really addressed. Anyone can whip up a large program that passes numbers around registers and point out "see how fast it is". How scaleable, realtime, is a large Erlang program? Where are the performance tests over 100m of cat5? I'll test it myself and then I'll know. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rpettit@REDACTED Tue Jun 6 03:13:01 2006 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 5 Jun 2006 20:13:01 -0500 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> Message-ID: <20060606011301.GF25847@vailsys.com> On Mon, Jun 05, 2006 at 05:40:19PM -0700, Jeff Crane wrote: > > > > Basically, it sounds like you are inventing > > > > problems > > > > where there aren't any. Why? > > Erlang is not some utopian language. There must be > large or multiple problems to prevent adoption when > implementing the most trivial of tasks. First, Erlang > is not adopted because it is not exceptionally good at > satisfying basic project goals like speed, > maintainability, and efficiency. Really? > In small standalone programs, it's unlikely that anyone would consider > Erlang over a purely interpreted language. I'm not sure small, standalone programs fit the problem domain Erlang is best suited for. > As an employer, it's near-impossible to find a person to > maintain or support my new Erlang project in any > State, much less my County. This, sadly, is true. I bet you could find a thousand really terrible Java programmers for every 1 decent erlang programmer (but that's just a guess). > The amount of Erlang the average programmer (me) needs to write to perform > the same work as 12 lines of ASP, is beyond reasonable. I'm pretty sure that the ASP and Erlang don't qualify as solutions in the same problem domain. A good erlang programmer can write in 10 lines what might take 100 lines in a language like C/C++ or even Java. But again, it all depends on the problems you are trying to solve. For building concurrent, distributed, fault-tolerant systems I haven't found anything that beats Erlang. > The difficulty in bridging to other languages is what > stifles adoption within my peer group. I have no > examples of Erlang binding nicely to anything but C++. J-interface for Java? PyErlang for Python? Erl_interface/ei for C/C++? You can find information about these off the Erlang website and after about 30 seconds on google. We use J-interface and erl_interface/ei both in production with great success. When calling out to some other process in Erlang a quick-and-dirty method might be to spawn the foreign interpreter, etc, as an erlang port. We have done this with perl and expect scripts before, for example (again in production systems with much success). > A month of digging and posting in my free time (that > 99% of Erlang dabblers will not bother with > regardless), I still dont have Erlang talking to > Python (which I'm also learning). I googled for "erlang python binding" and the first entry returned was: http://starship.python.net/crew/gandalf/PyErlang/ That said I don't know much about it. I also didn't bother to see what other links were returned (but then again it isn't a problem that I personally am trying to solve). > Personally, I'm using Erlang for its strengths. Is it > better than RakNet? It's certainly easier to > implement! and that's worth something...but it's not > exactly presented as a prototyping language. Erlang is an excellent protoyping language, especially with its great support for loading new code into a running system on-the-fly. We have used this feature both to toss up a skeleton server and add functionality w/out downtime as well as to patch bugs in production systems requiring 24x7 uptime. > I first bought into the advantages of Joel Reymont > when he presented findings through the OpenPoker > project. I also examined the criticisms, which were > never really addressed. Anyone can whip up a large > program that passes numbers around registers and point > out "see how fast it is". How scaleable, realtime, is > a large Erlang program? Where are the performance > tests over 100m of cat5? I'll test it myself and then > I'll know. I'm not sure what more to say. There is a learning curve involved with Erlang, like anything else. Perhaps the learning curve is a bit more steep as there are so many foreign concepts (single assignment, functional programming paradigm, etc). In my case the benefits have greatly outweighed the cost of learning. -Rick From ok@REDACTED Tue Jun 6 03:16:46 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 Jun 2006 13:16:46 +1200 (NZST) Subject: Erlang bytecodes and/or VM description? Message-ID: <200606060116.k561GkFX164196@atlas.otago.ac.nz> David Hopwood asked: > This might seem like a pointed question, but I'll ask it anyway: > how does one maintain a VM without accurate documentation of the > executable format it implements? I know I couldn't do it. This year I have my third-year software engineering students doing maintenance work on Mawk -- Mike Brennan's version of AWK. We are in *exactly* this situation. Twice over, in fact. Mawk includes two instruction sets, one generated from a Yacc grammar for ordinary statements and expressions, and one generated from some fairly impenetrable code for regular expressions. If you have read "Software Tools" -- which I have and my students haven't -- the regexp code is fairly obvious, although my considered opinion is that it is going to be easier to rewrite than repair. If you've read Per Brinch Hansen "On Pascal Compilers" -- which I have and my students haven't -- the main instruction set isn't _that_ hard to figure out, although there are two quirks of the compiler that make things harder to understand than they need be. (1) Instead of building ASTs and then generating code from those, the compiler generates code as it goes, sometimes bodily shifting large chunks of code from one place to another in order to cope with generating them out of order. (2) The AWK language allows you to pass scalars or entire arrays as function parameters (what if you mix them up? the documentation is either entirely silent or explicitly refuses to say, depending on which AWK you are dealing with), and Mawk does a wee bit of type inference to try and figure out what's what. If you've read anything on type inference -- you know what goes here -- it's not terribly hard to figure out what is going on, BUT by the time the type inference is done the code has already been generated, and so the type inference pass has to go back and patch some of it up, which is a little bit confusing. You're probably underestimating your abilities. It just takes imagination and dedication. What it takes is *BACKGROUND*. If you have a reasonably good idea of how something like this OUGHT to work, then you can probably figure things out. But while you do so, you will curse the author for not having the decency to *TELL* you what he knew and you have to rediscover. Why maintain Mawk? Because it needs maintenance (we have now fixed almost all of the known Mawk bugs and several that weren't on the list) and because it is worth maintaining: it is easily the fastest AWK around. From fig@REDACTED Tue Jun 6 06:25:34 2006 From: fig@REDACTED (Michael FIG) Date: Mon, 5 Jun 2006 22:25:34 -0600 (CST) Subject: Proposal: E / Erlang integration Message-ID: <10851539.7111149567934607.JavaMail.root@zimbra> Greetings to E and Erlang people, both. [First, to qualify this message, I'm a novice in both the Erlang and E worlds, so please forgive me if I make some incorrect assumptions. Many thanks if you take the time to correct me. :) I think that both the e-lang and erlang-questions lists are subscriber-only, so I will try to summarize responses to the other list if that turns out to be true.] I would like to introduce each of you to the other: E (http://www.erights.org/) is an object-oriented, secure, distributed capability-based language with its main implementation in Java and a secondary implementation written in Common Lisp. Erlang (http://www.erlang.org/) is a mature functional, process-oriented, distributed language with its own virtual machine. I am writing because I think that E uses an excellent architecture for sending messages between mutually-untrusting components (based on _promises_, also known as _refs_ or _vows_), and because I like Erlang (it is fun to write applications using a dynamically-typed functional language). Erlang fits all the present needs of my applications, but I recognize that in the future my distributed applications will probably need to communicate with untrusted components across untrusted networks. I like E's architecture, but really don't want to have anything to do with Java-like syntaxes. In my mind, the only things that would need to be changed in Erlang in order to support E's semantics would be syntax to send E-style messages (that result in a promise), a construct to invoke code when promises are fulfilled, and a flag to indicate that a specific process is untrusted and may only interact with the rest of the system by receiving and sending E-style messages. For E-style eventual sends, I propose: Promise = Target !< Message something like: LocationPromise = MyCar !< {moveTo, 2, 3} % An asynchronous send which results in a promise and for associating a promise with result callbacks: io:format("Associating LocationPromise with callbacks~n"), promise_case LocationPromise of % This is E's when/catch in more Erlang-friendly syntax {X, Y} when is_integer(X) and is_integer(Y) -> % The promise resolved to a tuple io:format("Now at location ~p,~p~n", [X, Y]); catch E -> % thrown exception or bad match io:format("Promise broken ~p~n", [E]) after 3000 -> % timeout io:format("Promise took more than 3 seconds to resolve~n") end, io:format("Continuing execution~n") which would print: Associating LocationPromise with callbacks Continuing execution [... and sometime after LocationPromise is resolved into moveTo's return value] Now at location 2,3 "promise_case" in this example does a deep scan of its argument, recognizes which are promises, and spawns a process that will wait on those promises and execute the associated callbacks when all have been resolved. The server side of MyCar would be something like: -behaviour(gen_server). -export([handle_send/2]). handle_send({moveto, X, Y}, State) -> {reply, {X, Y}, State}; handle_send(Msg, State) -> {throw, {unexpected_message, Msg}, State}. Where the gen_server behaviour could be extended to recognize E-style sends and dispatch them to handle_send. I expect that untrusted processes would be able to export their own handle_send implementations, so long as they only used E-style eventual sends and safe Erlang primitives in their bodies. The advantage to the E community would be yet another implementation and popularization of E. The advantage to the Erlang community would be a robust model for secure distribution and a mechanism for executing untrusted Erlang code which is far more effective than "sandboxing" techniques. Initially, I only want to define the syntax and semantics and implement them in Erlang... adding cryptography and compatibility with the existing Elib is something that I would like to defer until later. I am prepared to work on the implementation, but I do need to hear what people in each community think about this. I would like to come up with something that both communities are happy with, so that we can work together. Thanks, -- Michael FIG From damien_katz@REDACTED Tue Jun 6 06:53:54 2006 From: damien_katz@REDACTED (Damien Katz) Date: Mon, 5 Jun 2006 21:53:54 -0700 (PDT) Subject: file:sync doesn't work on windows? Message-ID: <20060606045354.11980.qmail@web54501.mail.yahoo.com> It appears that file:sync/1 is a no-op on Windows (unless I'm missing something, which is possible). Does anyone know why this is? More importantly, can it be fixed? From michel.urvoy@REDACTED Tue Jun 6 08:18:14 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Tue, 6 Jun 2006 08:18:14 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: 2006/6/5, Thomas Lindgren : > > > --- Michel Urvoy wrote: > > > 2006/6/3, Thomas Lindgren > > : > > > > > > Look harder. > > > > Right, I found one real commercial site, a bank: > > http://www.kreditor.se/Jobb/jobb.html > > Just the Nortel SSL-VPN product has delivered > thousands of commercial intranet sites, written in > Erlang and Yaws. I've no doubt about this. The point I had already noticed with Nortel is that Erlang is mentioned nowhere. The company that use or have used Erlang are very discret about the language. Even with an open source project like process one / ejabberd: http://www.process-one.net/en/projects/ejabberd/ It feels like if people were not proud to claim they use Erlang. > > > > > And the choice of Erlang (+C) and nothing else > > is > > > > not very easy when > > > > you have on the shelf a lot of code you will not > > be > > > > able to reuse. > > > > > > If that's what you believe, maybe you should read > > the > > > documentation a bit more closely. > > > > > Right again, there is the java node interface > > (Jinterface), but my > > purpose was more to reuse old Pascal or Fortran > > code. > > You can find plenty of other interfacing code if you > look, including Orber (CORBA), Comet (COM), erl > interface, IC, ... Well, I can understand people that want to develop their own interface, but so many differents projects add more complexity and confusion. It's up to Erlang conceptors to fix the canvas of the bindings, so people have just to focus their work on the language port. In that way you can interface more languages and the result is more clean and coherent. > > If you want to wrap Pascal or Fortran, then you can > integrate at different points by communication via > pipes, writing a C-node wrapper, or writing an Erlang > driver. I'm afraid I'm not able to do this yet. > > > > > Furthermore I should be able to use the hot > > > > replacement code mechanism > > > > on the two nodes to update the foreign code. > > > > > > Hot code loading for other languages is not an > > Erlang > > > issue. > > > > If you say so! But it could be. I've not seen in the > > documentation it was not. > > How could it be? Most languages don't even have a > semantics for hot code loading. I just ment the documentation was not clear about this point. It better to say the things: Hot code loading is limited to this use (to precise) with C bindings. > > > > Basically, it sounds like you are inventing > > > problems > > > where there aren't any. Why? > > > > I'm sorry Thomas, I've no answer for this point, but > > your question is > > a kind of answer to my Erlang paradox. > > In other words, you strongly feel that Erlang would be > used (much?) more if there was even more support for > wrapping arbitrary libraries than today? Or if Erlang > somehow implemented hot code loading for arbitrary > languages? I strongly feel that Erlang is insulated. Despite a certain activity in Academics (thesis, publications). > > Well, if you enjoy working on interfacing, why not > join the recently started Dryverl project? As to > general hot code loading, this seems still to be very > much a research topic. Here are a couple of pointers: > > http://www.cs.umd.edu/projects/dsu/ > http://www.pmg.lcs.mit.edu/ I had a look to that post, last month. The only point I wonder is why experiment Dryverl on a C binding, that is already improved, instead of another language that is not covered. > > Or why not have a look at how to improve/extend hot > code loading in Erlang itself? In a few years when I'll get retired. Regards, Michel. > > Best, > Thomas > From rlenglet@REDACTED Tue Jun 6 09:34:38 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 6 Jun 2006 16:34:38 +0900 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: <200606061634.38422.rlenglet@users.forge.objectweb.org> Michel Urvoy wrote: > I had a look to that post, last month. > The only point I wonder is why experiment Dryverl on a C > binding, that is already improved, instead of another > language that is not covered. Which one? We already have: Java, Ada, Python, Lisp... What do you miss? It is quite easy to develop a new library in your preferred language to interact remotely with an Erlang node, similar to erl_interface and j_interface. This is really simple: you need to implement functions to encode/decode terms into/from the external format, and handle the simple (AFAIK) protocols. In addition, if in your language you can read and write from the standard input and output, then you can already implement C port programs. That's it. I don't know of any useful programming language that prevents one from reading and writing from the standard input and output, but if you know one you may list it as "not covered". But maybe what you meant is that you want "intimate" bindings between Erlang code and code in another languages, even more intimate than C port drivers? One limitation/advantage (depending on the viewpoint) of the Erlang emulator is that all the emulator internals are insulated from any kind of extension, even to the most intimate (C port drivers). One cannot directly interact with the emulator internals to spawn processes, etc. C port drivers have only a limited API to interact with the emulator, and guess what? That API is in C. So, if your intent is to implement port drivers in other languages than C, you will have anyway to have small stubs in C, at least to define your driver entry struct, with the right function pointers. It should be feasable for instance to write your driver in Java, compile it to binary using GCJ, and add C stubs to make it a C port driver (to make the emulator call the right static methods in your program). My first point is: Erlang/C bindings are for now needed as a basis to implement bindings to any other kind of language as C port drivers. If you don't really need the efficiency (and the complexity!) of port drivers, you can write an erl_interface-like library in your language. My second point is: do not expect to have soon a way to bind intimately Erlang and other languages (even C), like using Java's JNI or Python/C API, because the internals of the emulator are not accessible, and making them accessible seems not to be planned, and is certainly not a trivial task. IMHO, I am not sure anyway that opening the internals is a good idea. This lets the Erlang/OTP developers free to make big changes in the emulator without having to bother about "too-intimate" interfaces that may be broken by the changes. For instance, switching from one thread to multiple threads in the R11Bx emulator may have been difficult or impossible if such internal details affected extensions. I prefer having an emulator that is able to undercome big changes easily and transparently, than having efficient, intimate extension mechanisms. Erlang already has its share of legacy parts... the port driver API being one of them. ;-) The long term, right approach would be to open the internals of the emulator a little, but by reifying them cleanly, and to let users write and load/unload dynamically their own BIFs. To define the cleanest interface, C may not be the "primary" language here, but Ulf Wiger proposed to use Felix instead. A lot of work has to be done on this. Your contributions in code and ideas will be welcome. Regards, -- Romain LENGLET From gordonguthrie@REDACTED Tue Jun 6 10:32:26 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Tue, 6 Jun 2006 09:32:26 +0100 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> Message-ID: <1149582746.44853d9a9eb23@backawinner.gg> Jeff > How scaleable, realtime, is > a large Erlang program? Where are the performance > tests over 100m of cat5? I'll test it myself and then > I'll know. Erlang runs the telephone system in the UK - all 1.7m sloc of it with 31ms downtime per year (yes 99.9999999% availability). The lesson of this is that Erlang 'only' gives you commodity, open-source, google scalability on comodity hardware. Apart from that it has little to offer ;-> Gordon ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From richardc@REDACTED Tue Jun 6 10:34:44 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 06 Jun 2006 10:34:44 +0200 Subject: So, you think you know Erlang? In-Reply-To: References: <4484980B.3090503@it.uu.se> Message-ID: <44853E24.8080506@it.uu.se> Michael Fogeborg wrote: > %% > %% compiler complained... had to do manual macro-expansion myself... > %% Sorry - I hadn't tested it on Windows. Here is a tweaked version for all you linebreak-impaired people out there. /Richard -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: export_all.erl URL: From tomas.abrahamsson@REDACTED Tue Jun 6 11:58:55 2006 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Tue, 6 Jun 2006 11:58:55 +0200 Subject: OpenSSL and hardware acceleration In-Reply-To: <447D6CB7.6090600@altern.org> References: <447D6CB7.6090600@altern.org> Message-ID: On 5/31/06, dcocoyer wrote: > Hi, > > I'm trying to set up Erlang ssl and crypto libraries to make use of my > motherboard hardware acceleration (VIA padlock engine). OpenSSL (0.9.8b) > is already using it (I can check it using 'openssl speed -evp > aes-128-cbc -engine padlock' and it works), but when I use the > accelerated ciphers under Erlang, the speed and cpu usage show that > hardware acceleration is not used at all. Does it work to add an engine section to the openssl.cnf file? On my computer it seems to be located in /usr/lib/ssl/. I don't have any computer with hardware acceleration at hand, so I can't check whether this actually will work. > Is esock_openssl.c also called by crypto:start() ? No. The esock_openssl.c is only used for ssl communication. ssl:start() starts an external program, ssl_esock, which performs the actual ssl encryption/decryption. The crypto:start() loads a linked-in driver. BRs Tomas From Micic_V@REDACTED Tue Jun 6 12:37:48 2006 From: Micic_V@REDACTED (Valentin Micic [ MTN - Innovation Centre ]) Date: Tue, 6 Jun 2006 12:37:48 +0200 Subject: FW: Erlang R9C-2 NODE stops accepting new connections Message-ID: <23684C9CDF88C04FA8800AA825EADF5103264CED@MTNMAIL.mtn.co.za> People, I'm getting desperate here... anyone from ERLANG development team care to comment? V. ________________________________ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Valentin Micic [ MTN - Innovation Centre ] Sent: Wednesday, 31 May 2006 10:33 AM To: erlang-questions@REDACTED Cc: Ognian Pantov [ MTN - Innovation Centre ]; Primanathan Reddy [ MTN - Innovation Centre ]; Wayne Swart [ MTN - Innovation Centre ] Subject: Erlang R9C-2 NODE stops accepting new connections Hi, We have a reoccurring problem on one of our nodes, call it node1@REDACTED Under some circumstances (we suspect intermittent network instability), the main listening port (the port that is published with EPMD) stops accepting new connections. The active connections are serviced though. I did verify that empd (using epmd -names) has an entry indicating node1 and port, say, P1. Using netstat, I did verify that port P1 is used. I've used pfiles (Solaris 9) to verify that this port is used by this particular run-time (node1@REDACTED). Finally, in desperation, I've attempted to telnet to this particular port, and noticed that netstat reports SYN_SENT, but no further action is taken. This indicates a potential problem with SOLARIS, however, had a similar situation on LINUX as well, thus, concluding that it might be ERLANG related. It seems that erlang process that is servicing this erlang port (linked-in tcp driver) somehow lost a link to it, however without terminating it, as indicated by messege: #Port<0.7>: tcp_inet: Input driver gone away without deselecting! Any ideas? V. NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Tue Jun 6 14:47:12 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 06 Jun 2006 14:47:12 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <200606061634.38422.rlenglet@users.forge.objectweb.org> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> Message-ID: Den 2006-06-06 09:34:38 skrev Romain Lenglet : > To define the cleanest interface, C may not be the "primary" > language here, but Ulf Wiger proposed to use Felix instead. > A lot of work has to be done on this. Your contributions in code > and ideas will be welcome. I'll just have you know that I'm still working on this, as a really looow intensity background job. Whenever I have something working, I'll report it. I still think the felix approach is very interesting, but for now it seems as if the quickest way to learn felix is to first learn C++, then OCaml, and then figure out the differences... :) /Ulf W -- Ulf Wiger From ulf@REDACTED Tue Jun 6 14:49:49 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 06 Jun 2006 14:49:49 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: Den 2006-06-06 08:18:14 skrev Michel Urvoy : > The company that use or have used Erlang are very discret about the > language. Even with an open source project like process one / > ejabberd: > http://www.process-one.net/en/projects/ejabberd/ > It feels like if people were not proud to claim they use Erlang. Some companies will refrain from mentioning Erlang because (a) it doesn't necessarily help them sell their product, and (b) because they don't want to give away to their competitors how they've done things. I believe Paul Graham used the same approach when he was using LISP for commercial gain. Why let the competition in on your secret? BR, Ulf W -- Ulf Wiger From yarivvv@REDACTED Tue Jun 6 15:52:21 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 6 Jun 2006 09:52:21 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: <200606061634.38422.rlenglet@users.forge.objectweb.org> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> Message-ID: <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> > > The long term, right approach would be to open the internals of > the emulator a little, but by reifying them cleanly, and to let > users write and load/unload dynamically their own BIFs. Unless I have a serious gap in understanding, isn't there another danger with letting developers essentially create their own BIFs, because BIF calls block the entire Erlang system process, hence blocking all spawned Erlang processes during their execution? If one could easily create BIFs, either they would have to be executed in a separate system thread, creating the same complexity with regards to communication with the Erlang VM, or developers would have to be pretty careful not to write BIFs such as synchronouslyDefragMyDrive() :) Yariv From jefcrane@REDACTED Tue Jun 6 18:19:34 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Tue, 6 Jun 2006 09:19:34 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606011301.GF25847@vailsys.com> Message-ID: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> > I'm not sure small, standalone programs fit the > problem domain Erlang is > best suited for. Hence, it's not a utopian language. I'm not sure there is one, but it's definitely not Erlang. > > The amount of Erlang the average programmer (me) > needs to write to perform > > the same work as 12 lines of ASP, is beyond > reasonable. > > I'm pretty sure that the ASP and Erlang don't > qualify as solutions in the same > problem domain. Sure they do. They are both turing complete languages. Erlang is not the best choice, in solving one of the most common "simple" problems. > > The difficulty in bridging to other languages is > what > > stifles adoption within my peer group. I have no > > examples of Erlang binding nicely to anything but > C++. > > J-interface for Java? PyErlang for Python? > Erl_interface/ei for C/C++? > You can find information about these off the Erlang > website and after about > 30 seconds on google. > > We use J-interface and erl_interface/ei both in > production with great success. I suggest you do any manner of search for Erlang, binding, language, interface and then get back to me with what page J-interface comes up on. Your attitude is rather silly. That being said, J-interface is a GREAT way to put a GUI face on Erlang. PyErlang is not maintained...not even sure what version it supported. Erl_interface/C++/C-port is redundant. They are different approaches to an Erlang-C++ binding. > I googled for "erlang python binding" and the first > entry returned was: > http://starship.python.net/crew/gandalf/PyErlang/ > > That said I don't know much about it. I also didn't > bother to see what other > links were returned (but then again it isn't a > problem that I personally am > trying to solve). PyErlang is not useable. It's a lot like looking up Extraterrestrial Babies in Google and pointing "There, see! All you had to do was type it in Google to see it exists." I am being serious when I am talking about the problems or Erlang needing bindings. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From jahakala@REDACTED Tue Jun 6 18:55:19 2006 From: jahakala@REDACTED (Jani Hakala) Date: Tue, 06 Jun 2006 19:55:19 +0300 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> (Jeff Crane's message of "Tue, 6 Jun 2006 09:19:34 -0700 (PDT)") References: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> Message-ID: <87verei5qg.fsf@pingviini.kortex.jyu.fi> Jeff Crane writes: > > I suggest you do any manner of search for Erlang, > binding, language, interface and then get back to me > with what page J-interface comes up on. Your attitude > is rather silly. That being said, J-interface is a > GREAT way to put a GUI face on Erlang. PyErlang is not > maintained...not even sure what version it supported. > Erl_interface/C++/C-port is redundant. They are > different approaches to an Erlang-C++ binding. > There is also py_interface that is probably more like jinterface. It is native python code unlike PyErlang. It might also be unmaintained :( I'm going to use it in my project for GUI purposes. Jani Hakala From yarivvv@REDACTED Tue Jun 6 19:31:25 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 6 Jun 2006 13:31:25 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> References: <20060606011301.GF25847@vailsys.com> <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> Message-ID: <17244f480606061031q75005bc0u6cc6a7a28c5ed95@mail.gmail.com> > > I'm pretty sure that the ASP and Erlang don't > > qualify as solutions in the same > > problem domain. > > Sure they do. They are both turing complete languages. > Erlang is not the best choice, in solving one of the > most common "simple" problems. Yaws actually lets you do ASP-ish things in very few LOC (http://yaws.hyber.org/simple.yaws):

Yesssssss

out(Arg) -> {html, "

Hello again

"}.
> PyErlang is not useable. It's a lot like looking up > Extraterrestrial Babies in Google and pointing "There, > see! All you had to do was type it in Google to see it > exists." I am being serious when I am talking about > the problems or Erlang needing bindings. I looked at the PyErlang source code and it looks pretty simple. I bet you could make it usable after a couple of days' worth of hacking :) My 2c Yariv From garry@REDACTED Tue Jun 6 19:42:17 2006 From: garry@REDACTED (Garry Hodgson) Date: Tue, 6 Jun 2006 13:42:17 -0400 (EDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <1149582746.44853d9a9eb23@backawinner.gg> References: <1149582746.44853d9a9eb23@backawinner.gg> Message-ID: <2006060613421149615736@k2.sage.att.com> Gordon Guthrie wrote: > > How scaleable, realtime, is > > a large Erlang program? Where are the performance > > tests over 100m of cat5? I'll test it myself and then > > I'll know. > > Erlang runs the telephone system in the UK - all 1.7m sloc of it with 31ms > downtime per year (yes 99.9999999% availability). > > The lesson of this is that Erlang 'only' gives you commodity, open-source, > google scalability on comodity hardware. Apart from that it has little to > offer ;-> does anyone have a pointer to some documentation about that? i'd like to beat some people over the head with it. ---- Garry Hodgson, Senior Software Geek, AT&T CSO Can't you hear my lambs a callin'? Oh good shepherd won't you feed my sheep? From thomasl_erlang@REDACTED Tue Jun 6 20:01:00 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 6 Jun 2006 11:01:00 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> Message-ID: <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> --- Jeff Crane wrote: > > > > Basically, it sounds like you are inventing > > > > problems > > > > where there aren't any. Why? > > Erlang is not some utopian language. Noone claimed that. My comment concerns the specific problems posed by the OP. > In small standalone > programs, it's unlikely that anyone would consider > Erlang over a purely interpreted language. Perhaps the small standalone tasks are better served by a scripting language like Perl, Python or Ruby in that case? There was support for stand-alone Erlang for a while, but this seems to have withered away. Part of the reason was probably because it wasn't very easy to start using it. On the other hand, scripting isn't used much for Erlang's historical application domain. Perhaps the demand was small too. > As an > employer, it's near-impossible to find a person to > maintain or support my new Erlang project in any > State, much less my County. This is what I consider a real Erlang problem: it is fairly obscure. I'd furthermore expect things are worse in the US. (Some consider that a competitive advantage, of course. Not I.) I'd like to see some good books on "modern erlang/otp" for example. > The amount of Erlang the > average programmer (me) needs to write to perform > the > same work as 12 lines of ASP, is beyond reasonable. I'd recommend using the appropriate tool for the task at hand. (Are you using Yaws, by the way? It's not nearly as smooth as ASP, but it simplifies generating dynamic content.) > How scaleable, realtime, > is > a large Erlang program? Where are the performance > tests over 100m of cat5? I'll test it myself and > then > I'll know. Clearly these factors depend on the program as well as the language. The experiences so far, as far as I know and as far as I can summarize, are that skilled teams can do remarkable things. Productivity is quite good (4x productivity of C++ according to Ulf Wiger at Ericsson). I have seen Erlang used for commercial purposes in teams ranging from a handful to nearly a hundred people. Performance is normally competitive or excellent for intended tasks. (Scientific computing is better done in Fortran, say.) Programming for all-out performance is probably better done in C/C++, at least if the developers are skilled. System scalability is normally excellent compared to simple thread-based solutions. In essence, the Erlang runtime system "under the hood" is event-based, a programming principle which has turned out to be very robust in the face of high load. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From david.nospam.hopwood@REDACTED Tue Jun 6 20:12:54 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 06 Jun 2006 19:12:54 +0100 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> References: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> Message-ID: <4485C5A6.3040900@blueyonder.co.uk> Jeff Crane wrote: >>J-interface for Java? PyErlang for Python? >>Erl_interface/ei for C/C++? >>You can find information about these off the Erlang >>website and after about >>30 seconds on google. >> >>We use J-interface and erl_interface/ei both in >>production with great success. > > I suggest you do any manner of search for Erlang, > binding, language, interface and then get back to me > with what page J-interface comes up on. Google "Erlang Java interface", first link. -- David Hopwood From ulf@REDACTED Tue Jun 6 20:21:06 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 06 Jun 2006 20:21:06 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> Message-ID: Den 2006-06-06 15:52:21 skrev Yariv Sadan : >> >> The long term, right approach would be to open the internals of >> the emulator a little, but by reifying them cleanly, and to let >> users write and load/unload dynamically their own BIFs. You can do this pretty much today, since you can write linked-in drivers that are dynamically linked in (using erl_ddll), registered with a unique name, and called synchronously using port_call(). There are even support functions for letting the driver code return any erlang term. The main drawback compared to BIFs is that the data is copied between erlang and C. > Unless I have a serious gap in understanding, isn't there another > danger with letting developers essentially create their own BIFs, > because BIF calls block the entire Erlang system process, hence > blocking all spawned Erlang processes during their execution? If one > could easily create BIFs, either they would have to be executed in a > separate system thread, creating the same complexity with regards to > communication with the Erlang VM, or developers would have to be > pretty careful not to write BIFs such as synchronouslyDefragMyDrive() > :) Actually, creating BIFs is rather straightforward, as long as they do rather simple stuff. But there are lots of things one needs to understand about beam's memory management, etc., and it's not documented. You basically have to read other BIFs to find out how it's done. BR, Ulf W -- Ulf Wiger From loic-dev@REDACTED Tue Jun 6 20:35:06 2006 From: loic-dev@REDACTED (Loic Domaigne) Date: Tue, 06 Jun 2006 20:35:06 +0200 Subject: Erlang and high availability Message-ID: <4485CADA.6000501@gmx.net> Dear Erlangers, since several years now I am dealing with scalability, concurrency, high availability and fault tolerance problems using mainstream languages like C/C++/JAVA etc. I think I have a quite reasonable understanding of what can be achieved with those languages, and what their limitations are. Although it is difficult to learn new tricks to an old dog, I really like to see beyond my own nose. I am interest to solve these problems by using truly different approaches. Erlang looks one of the most promizing language in that regard. For my first study case, I would like to consider the standard heartbeat problem for a 2 nodes cluster. The cluster is composed of two physically distinct nodes A and B. The nodes may possibly have different hardware architecture/OS (to emphasize portability aspects). The 2 nodes are connected via two physically different networks N and N'. I'd like to implement a simple heartbeat mechanism that achieves the following: (*) detect a network failure: no heartbeat received over network N (resp. N') within a (pre-defined) period of time, but heartbeat received over N' (resp. N) within the same period. (*) detect a failure of the node A or B: no heartbeat from the corresponding node over both network N and N' within a (pre-defined) period of time. Ideally, the heartbeat mechanism should use a lightweight protocol (like UDP). The first idea that comes to my mind would be to use gen_udp and implement the protocol from the ground. But that's something I'd like to avoid, since I would have eventually have to manage the architecture differences between the nodes. Furthermore, I am wondering if they are perhaps neater solutions to this problem. Indeed, Erlang has a built-in mechanism for exchanging message between processes. Second, Erlang already performs heartbeat between connected nodes. I would be thankful for any advises, links to documents or code that would help me to make the first step in the right direction. Thanks in advance, Loic. N.B> My apologize if you have answered a similar question already. Unfortunately the search function for the erlang.org mailing list archives doesn't work. From thomasl_erlang@REDACTED Tue Jun 6 20:35:39 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 6 Jun 2006 11:35:39 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> Message-ID: <20060606183539.83332.qmail@web38811.mail.mud.yahoo.com> --- Jeff Crane wrote: > > I'm pretty sure that the ASP and Erlang don't > > qualify as solutions in the same > > problem domain. > > Sure they do. They are both turing complete > languages. Turing completeness is hardly the be-all of comparing computer languages. At least four of the properties we use to describe Erlang(*) go missing when we get to the level of a Turing machine. Nevertheless, if ASP serves you better in your work, why not use ASP? I wouldn't use ASP to implement a distributed transactional soft real-time database, for example, so why assume that Erlang should a priori beat a domain-specific templating language on its home ground? Even better, write an ASP-beating templating system for Yaws. Since Yaws already supports dynamic content with gusto, this might be reasonably straightforward. >From this discussion, it sounds like there is some ambient interest in contributing to such a thing. Best, Thomas * concurrency, distribution, fault-tolerance, soft real-time __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From david.nospam.hopwood@REDACTED Tue Jun 6 20:37:08 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 06 Jun 2006 19:37:08 +0100 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <2006060613421149615736@k2.sage.att.com> References: <1149582746.44853d9a9eb23@backawinner.gg> <2006060613421149615736@k2.sage.att.com> Message-ID: <4485CB54.40409@blueyonder.co.uk> Garry Hodgson wrote: > Gordon Guthrie wrote: > >>>How scaleable, realtime, is >>>a large Erlang program? Where are the performance >>>tests over 100m of cat5? I'll test it myself and then >>>I'll know. >> >>Erlang runs the telephone system in the UK - all 1.7m sloc of it with 31ms >>downtime per year (yes 99.9999999% availability). >> >>The lesson of this is that Erlang 'only' gives you commodity, open-source, >>google scalability on comodity hardware. Apart from that it has little to >>offer ;-> > > does anyone have a pointer to some documentation about that? > i'd like to beat some people over the head with it. The problem with searching for "Erlang" in connection with telecoms is Agner Krarup Erlang and the erlang unit, not to mention several companies named after them. However, the 1.7m SLOC and 31 ms downtime per year figures are for the AXD 301 ATM switch, which is much easier to search on -- for example see The whole UK telephone system of course involves much more code than that switch. -- David Hopwood From yarivvv@REDACTED Tue Jun 6 20:41:30 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 6 Jun 2006 14:41:30 -0400 Subject: joining Mnesia tables Message-ID: <17244f480606061141h1b2cd33bu8d2de99b2b4d307@mail.gmail.com> Hi, I noticed the following comment in the QLC documentation (http://erlang.org/doc/doc-5.5/lib/stdlib-1.14/doc/html/index.html) : "Support for faster join of two tables will be added not later than in R11. Depending on preferences and priorities some high level optimizations may be added in the future." I noticed this feature isn't in the latest release notes, so did some digging and came across these old discussions: http://www.erlang.org/ml-archive/erlang-questions/200511/msg00336.html http://www.erlang.org/ml-archive/erlang-questions/200502/msg00278.html I'm not a Mnesia expert, but if (according to the first thread) joins can take 45 minutes on large tables, it makes QLC (and maybe even Mnesia) unusable for certain applications. My questions are: - Is QLC join optimization still a planned feature for OTP? - In cases where joining 2 or more large tables is necessary, can such joins be optimized manually? If so, what is the best procedure for doing so? Any insight is appreciated. Thanks, Yariv From vances@REDACTED Tue Jun 6 21:40:30 2006 From: vances@REDACTED (Vance Shipley) Date: Tue, 6 Jun 2006 15:40:30 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> Message-ID: <20060606194030.GD9814@frogman.motivity.ca> On Tue, Jun 06, 2006 at 08:21:06PM +0200, Ulf Wiger wrote: } } You can do this pretty much today, since you can write linked-in drivers } that are dynamically linked in (using erl_ddll), registered with a unique } name, and called synchronously using port_call(). There are even support } functions for letting the driver code return any erlang term. The main } drawback compared to BIFs is that the data is copied between erlang and C. I was going to point this out myself. As far as copying goes, as I understand it, large binaries are not copied. -Vance From bsder@REDACTED Tue Jun 6 23:37:45 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 06 Jun 2006 14:37:45 -0700 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <200606060116.k561GkFX164196@atlas.otago.ac.nz> References: <200606060116.k561GkFX164196@atlas.otago.ac.nz> Message-ID: <4485F5A9.10907@allcaps.org> Richard A. O'Keefe wrote: > You're probably underestimating your abilities. It just takes > imagination and dedication. > > What it takes is *BACKGROUND*. If you have a reasonably good idea of > how something like this OUGHT to work, then you can probably figure > things out. But while you do so, you will curse the author for not > having the decency to *TELL* you what he knew and you have to rediscover. Ayup. Sure, I can read code, but that shows me the trees, not the forest. It's easy to see bits, its hard to see the overview. I'm not even talking a gigantic amount of information. A couple pages on the structure of how the BEAM code is executed would be enough. ie. four simple functions, the "assembly" code listing, a hex dump and comments per line would be enough. Glossing over the issues of instruction scheduling, garbage collection, and message queuing would be fine since they will vary implementation to implementation anyhow. Here's the current file that produces the BEAM code I am trying to dig through. It's not complicated, but even this covers enough ground to be difficult to penetrate (how do the tags on the arguments work when things are bytes, how do you handle labels when there are more than 16, is there anything which signifies the end of function code without actually decoding the code?, etc.) -module(arith). -export([three/0, four/0]). one() -> 1. two() -> 2. three() -> one() + two(). four() -> two() + two(). Sure, I'll eventually get it, but it would help to have the basics. -a From michel.urvoy@REDACTED Tue Jun 6 23:40:18 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Tue, 6 Jun 2006 23:40:18 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: 2006/6/6, Ulf Wiger : > Den 2006-06-06 08:18:14 skrev Michel Urvoy : > > > The company that use or have used Erlang are very discret about the > > language. Even with an open source project like process one / > > ejabberd: > > http://www.process-one.net/en/projects/ejabberd/ > > It feels like if people were not proud to claim they use Erlang. > > Some companies will refrain from mentioning Erlang because > (a) it doesn't necessarily help them sell their product, and > (b) because they don't want to give away to their competitors > how they've done things. I believe Paul Graham used the same > approach when he was using LISP for commercial gain. Why > let the competition in on your secret? That's seems a good explanation. Meanwhile (a) should be developed. About code protection, the other way is to provide machine code. As HiPE is able to do it, at least partially, what are the possibilities to target this point? Michel. > > BR, > Ulf W > -- > Ulf Wiger > From michel.urvoy@REDACTED Wed Jun 7 00:01:26 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Wed, 7 Jun 2006 00:01:26 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> Message-ID: 2006/6/6, Ulf Wiger : > Den 2006-06-06 09:34:38 skrev Romain Lenglet > : > > > To define the cleanest interface, C may not be the "primary" > > language here, but Ulf Wiger proposed to use Felix instead. > > A lot of work has to be done on this. Your contributions in code > > and ideas will be welcome. > > I'll just have you know that I'm still working on this, > as a really looow intensity background job. Whenever I > have something working, I'll report it. I still think > the felix approach is very interesting, but for now it > seems as if the quickest way to learn felix is to first > learn C++, then OCaml, and then figure out the > differences... :) Hi Ulf, Felix has a strong potential and is growing quickly. Is your project to make a Felix port/node? A couple Erlang + Felix could be terrific! And gives to Erlang a direct access to C++ code/libraries. You only miss the code replacement. I know this is a difficult issue but perhaps not unreachable. Why don't you try to contact John Skaller, Felix is perhaps young enough to be improved in that way. Michel. > > /Ulf W > -- > Ulf Wiger > From per.gustafsson@REDACTED Wed Jun 7 00:33:33 2006 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Wed, 07 Jun 2006 00:33:33 +0200 Subject: Erlang bytecodes and/or VM description? In-Reply-To: <4485F5A9.10907@allcaps.org> References: <200606060116.k561GkFX164196@atlas.otago.ac.nz> <4485F5A9.10907@allcaps.org> Message-ID: <448602BD.2090001@it.uu.se> Andrew Lentvorski wrote: > Richard A. O'Keefe wrote: > >> You're probably underestimating your abilities. It just takes >> imagination and dedication. >> >> What it takes is *BACKGROUND*. If you have a reasonably good idea of >> how something like this OUGHT to work, then you can probably figure >> things out. But while you do so, you will curse the author for not >> having the decency to *TELL* you what he knew and you have to >> rediscover. > > > Ayup. Sure, I can read code, but that shows me the trees, not the > forest. It's easy to see bits, its hard to see the overview. > > I'm not even talking a gigantic amount of information. A couple pages > on the structure of how the BEAM code is executed would be enough. > ie. four simple functions, the "assembly" code listing, a hex dump and > comments per line would be enough. Glossing over the issues of > instruction scheduling, garbage collection, and message queuing would > be fine since they will vary implementation to implementation anyhow. > > Here's the current file that produces the BEAM code I am trying to dig > through. It's not complicated, but even this covers enough ground to > be difficult to penetrate (how do the tags on the arguments work when > things are bytes, how do you handle labels when there are more than > 16, is there anything which signifies the end of function code without > actually decoding the code?, etc.) > > -module(arith). > -export([three/0, four/0]). > > one() -> > 1. > > two() -> > 2. > > three() -> > one() + two(). > > four() -> > two() + two(). > > > Sure, I'll eventually get it, but it would help to have the basics. > > -a > > There is a quite nice description of the tag scheme used in BEAM in "A Staged Tag Scheme for Erlang" which is available at: http://www.it.uu.se/research/publications/reports/2000-029/2000-029-nc.pdf Of course this paper only describes how values are represented on the stack and heap, but it helped we to better understand how the BEAM works. The tag scheme has not changed very much since R7 which is the last release described in the paper. From thomasl_erlang@REDACTED Wed Jun 7 01:01:00 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 6 Jun 2006 16:01:00 -0700 (PDT) Subject: FW: Erlang R9C-2 NODE stops accepting new connections In-Reply-To: <23684C9CDF88C04FA8800AA825EADF5103264CED@MTNMAIL.mtn.co.za> Message-ID: <20060606230101.38291.qmail@web38813.mail.mud.yahoo.com> --- "Valentin Micic [ MTN - Innovation Centre ]" wrote: > People, I'm getting desperate here... anyone from > ERLANG development > team care to comment? I'm not an OTP developer but ... Looking at the source of R11B (erts/emulator/beam/io.c, input_ready() ), it seems as if data has arrived on a port but the status field of the port is 'FREE'. Then driver_select() is called, presumably to clear the event. So, it looks like the port is marked as free but the corresponding file descriptor has not been closed. At least that's my best guess. There should thus be some code path where error handling is incomplete. (Either the port should not be freed or the fd should be closed.) This occurs for your listen port? Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rlenglet@REDACTED Wed Jun 7 02:38:19 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 7 Jun 2006 09:38:19 +0900 Subject: Language Bindings for Erlang Again In-Reply-To: <20060606194030.GD9814@frogman.motivity.ca> References: <20060606194030.GD9814@frogman.motivity.ca> Message-ID: <200606070938.19580.rlenglet@users.forge.objectweb.org> > On Tue, Jun 06, 2006 at 08:21:06PM +0200, Ulf Wiger wrote: > } > } You can do this pretty much today, since you can write > linked-in drivers } that are dynamically linked in (using > erl_ddll), registered with a unique } name, and called > synchronously using port_call(). There are even support } > functions for letting the driver code return any erlang term. > The main } drawback compared to BIFs is that the data is > copied between erlang and C. First, using port_call/3, terms are not only copied, but also encoded/decoded in the external format, which by the way requires every driver to statically link to libei.a from erl_interface. And as I wrote also in my email, unlike a BIF, a driver can't spawn processes, etc. All a driver can do with the emulator using the driver API is basically to exchange raw binary data or encoded terms with its port owner (some functions also allow it to send messages to arbitrary processes). This is far from the possibilities offered by BIFs. Vance Shipley wrote: > I was going to point this out myself. As far as copying goes, > as I understand it, large binaries are not copied. No, only when using port_command/2. And using port_command/2, only raw binary data is exchanged: if you want to send terms, you have for instance to encode them using term_to_binary/1, and decode them on the C side using erl_interface. That is what I do in Dryverl. And beware of packing of binaries that can occur in port_command/2! How I deal in Dryverl with binary packing in port_command/2 is a scary story. ;-) -- Romain LENGLET From goertzen@REDACTED Wed Jun 7 04:59:35 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Tue, 06 Jun 2006 21:59:35 -0500 Subject: Erlang and high availability In-Reply-To: <4485CADA.6000501@gmx.net> References: <4485CADA.6000501@gmx.net> Message-ID: <44864117.6050507@ertw.com> I'm relatively new to erlang, but I've given this area a good read recently so I'll have a crack at this: The standard erlang distribution mechanism between nodes is TCP, so you would be unable to use multiple networks to connect nodes. However, according to the erts user's manual, you can write your own distribution driver to do whatever you want. You could do multiple TCP connections, or perhaps try SCTP (google for erlang sctp). As for monitoring for partial link failure, I would be surprised if a driver could not be made to supply such information. The erlang distribution mechanism takes care of heartbeats, so I don't see why anything on top of that would need to be done. See the BIF monitor_node to get messages about nodes going down. Cheers, Dan. Loic Domaigne wrote: > Dear Erlangers, > > since several years now I am dealing with scalability, concurrency, > high availability and fault tolerance problems using mainstream > languages like C/C++/JAVA etc. I think I have a quite reasonable > understanding of what can be achieved with those languages, and what > their limitations are. > > Although it is difficult to learn new tricks to an old dog, I really > like to see beyond my own nose. I am interest to solve these problems > by using truly different approaches. Erlang looks one of the most > promizing language in that regard. > > For my first study case, I would like to consider the standard > heartbeat problem for a 2 nodes cluster. The cluster is composed of > two physically distinct nodes A and B. The nodes may possibly have > different hardware architecture/OS (to emphasize portability aspects). > The 2 nodes are connected via two physically different networks N and N'. > > I'd like to implement a simple heartbeat mechanism that achieves the > following: > > (*) detect a network failure: no heartbeat received over network N > (resp. N') within a (pre-defined) period of time, but heartbeat > received over N' (resp. N) within the same period. > > (*) detect a failure of the node A or B: no heartbeat from the > corresponding node over both network N and N' within a (pre-defined) > period of time. > > Ideally, the heartbeat mechanism should use a lightweight protocol > (like UDP). > > > The first idea that comes to my mind would be to use gen_udp and > implement the protocol from the ground. But that's something I'd like > to avoid, since I would have eventually have to manage the > architecture differences between the nodes. > > Furthermore, I am wondering if they are perhaps neater solutions to > this problem. Indeed, Erlang has a built-in mechanism for exchanging > message between processes. Second, Erlang already performs heartbeat > between connected nodes. > > > I would be thankful for any advises, links to documents or code that > would help me to make the first step in the right direction. > > Thanks in advance, > Loic. > > N.B> My apologize if you have answered a similar question already. > Unfortunately the search function for the erlang.org mailing list > archives doesn't work. > > From ok@REDACTED Wed Jun 7 06:13:47 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 7 Jun 2006 16:13:47 +1200 (NZST) Subject: Language Bindings for Erlang Again (Opinion) Message-ID: <200606070413.k574DlYW176812@atlas.otago.ac.nz> Jeff Crane wrote: I suggest you do any manner of search for Erlang, binding, language, interface and then get back to me with what page J-interface comes up on. If I am looking for an interface between language X and language Y, and I have language X installed on my system, I go looking in the documentation for language X before looking on the Web. So I did. cd /users/local/src/otp* Where I keep my current Erlang find . -name "*interface*" -print Some manner of search for "interface" Lo and behold! jinterface popped out right away. Something which is right there in the documentation cannot honestly be said to be hard to find. If you insist on a Web search, "erlang/java interface" led me to http://www.darrenhobbs.com/archives/2003/02/erlang_exceedin.html which led directly to http://www.erlang.org/doc/r7b/lib/jinterface-1.2.1/doc/index.html which is, um, a dead link. But it _did_ suggest visiting http://www.erlang.org and typing JInterface in the search box, which led straight to http://www.erlang.org/doc/doc-5.5/pdf/jinterface-1.3.pdf and various messages about JInterface. Took about five minutes to get there. From bjarne@REDACTED Wed Jun 7 07:30:06 2006 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Wed, 7 Jun 2006 07:30:06 +0200 Subject: Erlang Workshop and User Conference 2006 References: <001b01c6702c$ade3d7a0$082669d4@segeltorp> Message-ID: <000e01c689f3$709f8ac0$052669d4@segeltorp> Dear Erlang friends Please note that we are almost up to the deadline of this year's ACM SIGPLAN Erlang Workshop (in Portland, Oregon, on September 16) http://www.erlang.se/workshop/2006/ The subsequent event will be this year's Erlang User Conference (in Stockholm, Sweden, on November 9) http://www.erlang.se/euc/06/ See you there Bjarne From tzheng@REDACTED Mon Jun 5 21:04:59 2006 From: tzheng@REDACTED (Tony Zheng) Date: Mon, 05 Jun 2006 12:04:59 -0700 Subject: How to get the memory usage for the system in Erlang? Message-ID: <1149534299.568.15.camel@gateway> Hi I want to check the memory usage(the amount of free memory available) for the system in Erlang on Unix platform(Sun Solarix 10). I used memsup:get_memory_data() or memsup:get_system_memory_data() command to do it. But both of them gave an error message. Are there any suggestions for that? Thanks. $ erl -sname one Erlang (BEAM) emulator version 5.4.12 [source] [hipe] Eshell V5.4.12 (abort with ^G) (one@REDACTED)1> memsup:get_memory_data(). ** exited: {noproc,{gen_server,call,[memsup,get_memory_data,infinity]}} ** (one@REDACTED)2> memsup:get_system_memory_data(). ** exited: {noproc,{gen_server,call,[memsup,get_system_memory_data,infinity]}} ** tony From sgolovan@REDACTED Mon Jun 5 16:43:19 2006 From: sgolovan@REDACTED (Sergei Golovan) Date: Mon, 5 Jun 2006 18:43:19 +0400 Subject: Non-free documentation in the Erlang distribution In-Reply-To: <6e0a65a1f6693edf22181f20b9d83393@uninet.ee> References: <200606041924.58277.neumann@lostwebsite.net> <200606050912.41725.neumann@lostwebsite.net> <6e0a65a1f6693edf22181f20b9d83393@uninet.ee> Message-ID: As for me, it looks like someone simply forget about these two files. They are never referenced in megaco HTML docs. Moreover, there is a link to RFC-3015, but it points to http://www.ietf.org/rfc/rfc3015.txt, not to lokally stored file. On 6/5/06, Taavi Talvik wrote: > This is clearly Debian problem to align their copyright policy > with IETF RFC copyright policy and they themselves must take > appropriate steps to resolve conflicts. > > If necessary repackage Erlang distribution for Debian to comply. > > This file is useful (at least for me) as part of Erlang distribution. -- Sergei Golovan From tzheng@REDACTED Tue Jun 6 22:10:46 2006 From: tzheng@REDACTED (Tony Zheng) Date: Tue, 06 Jun 2006 13:10:46 -0700 Subject: How can we become a member of erlang organization? Message-ID: <1149624646.10289.43.camel@gateway> Hi Our company is an IP payment company and most of our software products were developed by Erlang. Are there any Erlang organizations that we can join? If have, How can we apply to become a member of such erlang organizations? Thanks. Tony Zheng Email: tzheng@REDACTED From hans.bolinder@REDACTED Wed Jun 7 09:56:50 2006 From: hans.bolinder@REDACTED (hans.bolinder@REDACTED) Date: Wed, 7 Jun 2006 09:56:50 +0200 Subject: joining Mnesia tables In-Reply-To: <17244f480606061141h1b2cd33bu8d2de99b2b4d307@mail.gmail.com> References: <17244f480606061141h1b2cd33bu8d2de99b2b4d307@mail.gmail.com> Message-ID: <17542.34498.233870.551119@gargle.gargle.HOWL> [Yariv Sadan:] > "Support for faster join of two tables will be added not later than in > R11. Depending on preferences and priorities some high level > optimizations may be added in the future." > > I noticed this feature isn't in the latest release notes, ... > > - Is QLC join optimization still a planned feature for OTP? There is ongoing work on faster join of QLC tables. The results will be part of R11B-X, for some small X. Best regards, Hans Bolinder, Erlang/OTP From chsu79@REDACTED Wed Jun 7 10:07:33 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 7 Jun 2006 10:07:33 +0200 Subject: Mnesia question In-Reply-To: <17244f480606050802t16dbec9bnd23ca3b602d3762d@mail.gmail.com> References: <17244f480606050802t16dbec9bnd23ca3b602d3762d@mail.gmail.com> Message-ID: My conclusion is that this is just a case of more-than-one-way-to-do-it. By the way, indexing would be a lot more useful if one could use them to speed up queries on multiple keys. Ex. for a database storing forum threads: {thread, Site, Forum, ThreadId} And you want to find ThreadIds for Site="erlang.org", Forum="mnesia". Today one has to create a key or indexed field that stores {Site, Forum} in a tuple. This makes the records a bit uglier. All in all though, this is just a wart. Not a showstopper. On 6/5/06, Yariv Sadan wrote: > Hi, > > I have a newbie question about one-to-many relations in Mnesia: In the > Getting Started section of the Mnesia User's guide, the one-to-many > relation between "employee" and "dept" is given its own table, > "at-dep". Why is this relation expressed in a new table? Wouldn't it > be better to add a "dep_id" field to the "employee" table, with an > index on this field? > > Thanks, > Yariv > From bengt.kleberg@REDACTED Wed Jun 7 10:11:06 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 07 Jun 2006 10:11:06 +0200 Subject: How to get the memory usage for the system in Erlang? In-Reply-To: <1149534299.568.15.camel@gateway> References: <1149534299.568.15.camel@gateway> Message-ID: <44868A1A.2070009@ericsson.com> On 2006-06-05 21:04, Tony Zheng wrote: > Hi > I want to check the memory usage(the amount of free memory available) > for the system in Erlang on Unix platform(Sun Solarix 10). I used > memsup:get_memory_data() or memsup:get_system_memory_data() command to > do it. But both of them gave an error message. Are there any suggestions it is not mentioned in the documentation, but the memsup module has a start_link/0 function you can call memsup:start_link(). {ok,<0.49.0>} after that it works. memsup:get_memory_data(). {0,0,{<0.49.0>,0}} note that you are linking to the memsup process, so if your process (the shell?) dies then the memsup process will die to. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From joe.armstrong@REDACTED Wed Jun 7 10:16:58 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 7 Jun 2006 10:16:58 +0200 Subject: Language Bindings for Erlang Again (Opinion) Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Jeff Crane > Sent: den 6 juni 2006 02:40 > To: erlang-questions@REDACTED > Subject: Re: Language Bindings for Erlang Again (Opinion) > > > > > Basically, it sounds like you are inventing problems > where there > > > > aren't any. Why? > > Erlang is not some utopian language. There must be large or > multiple problems to prevent adoption when implementing the > most trivial of tasks. First, Erlang is not adopted because > it is not exceptionally good at satisfying basic project > goals like speed, maintainability, and efficiency. This last sentence is crazy - "speed" depends upon the combination of problem and language NOT on language alone. Erlang *is* a lot slower than (say) C - for (say) compressing a file, but a lot faster for (say) creating large sets of parallel processes. So where is Erlang great? - for things like web servers, where you want to protect each of the users from each other. In a convential server like Apache you have to spawn one OS process/connection in order to protect the sessions from each other. This is very slow. In Erlang you spawn one Erlang process/connection which is a very lightweight operation - so FOR WEB SERVERS Erlang is *much* faster than C or php or whatever. This is why Erlang is being used at for, example, jabber.org, just because Erlang can handle vast numbers of parallel sessions. Erlang also maps nicely onto multi-core CPUs - why is this? - precisely because we use a non-shared lots of parallel processes model of computation. No shared memory, no threads, no locks = ease of running on a parallel CPU. Believe me, making your favourite C++ application run really fast on a multi-core CPU is no easy job. By the time the Java/C++ gang have figured out how to throw away threads and use processes and how to structure their application into small lightweight processes they will be where we were 20 years ago. Does this work? - yes - we are experimenting with Erlang programs on the sun Niagara - the results are disappointing our message passing benchmark only goes 18 times faster on 32 CPU's - but 18 is not too bad - if any C++ fans want to try the naigara all they have to do is make sure they have a multi-threaded version of their application, debug it -'cos it probably won't work and they can compare their results with us (and I'm not holding my breath) Turning a sequential program in a parallel program for the niagara is really easy. Just change map/2 to pmap/2 in a few well chosen places in your program and sit back and enjoy. Efficency comes from a correct underlying architecture, ie in this case being able to acuatlly use all the CPUs on a multi-core CPU. The ability to scale and application, to make it very efficient, to distribute it depends upon how well we can slit the application up into chuncks that can be evaluated in parallel. Erlang programmers have a head start here. > In small > standalone programs, it's unlikely that anyone would consider > Erlang over a purely interpreted language. Not true - I can find one counter example to "anyone" - that's me! > As an employer, > it's near-impossible to find a person to maintain or support > my new Erlang project in any State, much less my County. Have you advertised a job *in this group* - this mailing list is the prime place to advertise. If it should happen that you cannot recruit an Erlang/Haskell/O'caml programmer in your State/county then I would be seriously worried - you are going to be seriously threatened by companies in other countries that DO use these technologies and will threaten your existence. Suggestion - keep away from on-line banking and credit assesments - Erlang is expanding rapidly in this niche. Guess what - I work for Ericsson - we use Erlang - it gives us a market advantage over companies that do not use Erlang. We are market leaders in telephony over ATM etc. If *other companies* (TM) do not use Erlang that's fine by me - we can then outcompete them. This is NOT a level playing field - If N companies all use the *same* technology then *nobody* has any advantage - you can't win by doing the same thing as everybody else - you might be a wee bit better but you can't win. > The > amount of Erlang the average programmer (me) needs to write > to perform the same work as 12 lines of ASP, is beyond reasonable. > Example, please - can you show us the 12 line ASP program, so we can show you how this would be done in yaws. > The difficulty in bridging to other languages is what stifles > adoption within my peer group. I have no examples of Erlang > binding nicely to anything but C++. > A month of digging and posting in my free time (that 99% of > Erlang dabblers will not bother with regardless), I still > dont have Erlang talking to Python (which I'm also learning). Binding Erlang to other languages is really easy AND safe. Why? because we only really allow bindings through a socket. In the "good old Unix" days nobody ever talked about "language bindings" We talked about pipes and sockets. In a UNIX shell we would write > foo out We pipe the output of foo into bar then baz then bingo etc. bar, baz,bingo etc. could be written in ANY programming language. What people do today is to create "language bindings" this usually means "linking different programming language code into the *same* memory space" This particular act of lunacy guarantees that faults that crash my program will also crash your program - As I have often pointed out - then most important problem to solve in making any system is to stop errors propagating. If my program is super fast, wonderful great, tested, etc. it makes no difference if your program can crash my program. So how can we isolate programs. Easy - I run my program on a machine in Australia, you run yours on a machine in Ulambatar - and make sure there is no network connection between them. But can we do better than this? - can we run them on the *same* machine - yes if we isolate them using processes. This is what the process is for, it is a unit of isolation. Unfortunately, most programming language designers *forgot* to put processes in their languages - so you have to use OS processes to protect you applications. Do people do this? - no - why not? because OS processes are expensive *very* expensive. So what do they do instead? - LINK THEIR APPLICATIONS INTO THE SAME MEMORY SPACE and USE THREADS. - both a receipt for disaster - why? Because we have violated our most important principle - STOP ERRORS FOR PROPAGATING. (Sorry for shouting) Back to the subject - Erlang *is* easy to interface to any external language because the ONLY way this is possible is through a defined protocol on a socket. Now that other language are not good at this is hardly a problem for Erlang. This (separation through a socket) has many added benefits. - it enforces separation of components - it raises the abstraction level of an interface - when thing go wrong you know who is to blame - you can put a policeman on the interface and check that both parties follow the protocol - distributing the application is easy - parallelising the application on a multi-core CPU is easy > > Personally, I'm using Erlang for its strengths. Is it better > than RakNet? It's certainly easier to implement! and that's > worth something...but it's not exactly presented as a > prototyping language. Erlang is a programming language *designed* for building highly scalable fault-tolerant distributed soft real-time applications. RakNet is "a C++ UDP based network library designed to allow programmers to add response time-critical network capabilities to their applications. It is mostly used for games, but is application independent." You can't compare a fully fledged programming language with a C++ library for message passing. > > I first bought into the advantages of Joel Reymont when he > presented findings through the OpenPoker project. I also > examined the criticisms, which were never really addressed. > Anyone can whip up a large program that passes numbers around > registers and point out "see how fast it is". How scaleable, > realtime, is a large Erlang program? Where are the > performance tests over 100m of cat5? I'll test it myself and > then I'll know. Most of my programs don't "pass numbers around registers". And you don't just "whip up a large program" - large to me means > 1 mega line of code - these take years to write. We could, I guess, make a small well-defined benchmark and talk about this, but it would be more sensible to contribute to the great language shootout. Cheers /Joe > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection > around http://mail.yahoo.com > From gunilla@REDACTED Wed Jun 7 10:20:53 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Wed, 07 Jun 2006 10:20:53 +0200 Subject: How to get the memory usage for the system in Erlang? In-Reply-To: <1149534299.568.15.camel@gateway> References: <1149534299.568.15.camel@gateway> Message-ID: <44868C65.4000808@erix.ericsson.se> $ erl -sname one .. 1> application:start(sasl). ... ok 2> application:start(os_mon). ... ok 3> memsup:get_system_memory_data(). [{system_total_memory,1073741824}, {free_memory,503242752}, {total_memory,1073741824}] 4> / Gunilla Tony Zheng wrote: > Hi > I want to check the memory usage(the amount of free memory available) > for the system in Erlang on Unix platform(Sun Solarix 10). I used > memsup:get_memory_data() or memsup:get_system_memory_data() command to > do it. But both of them gave an error message. Are there any suggestions > for that? Thanks. > > $ erl -sname one > Erlang (BEAM) emulator version 5.4.12 [source] [hipe] > Eshell V5.4.12 (abort with ^G) > (one@REDACTED)1> memsup:get_memory_data(). > ** exited: {noproc,{gen_server,call,[memsup,get_memory_data,infinity]}} > ** > (one@REDACTED)2> memsup:get_system_memory_data(). > ** exited: > {noproc,{gen_server,call,[memsup,get_system_memory_data,infinity]}} ** > > tony > > From joe.armstrong@REDACTED Wed Jun 7 11:41:50 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 7 Jun 2006 11:41:50 +0200 Subject: Language Bindings for Erlang Again Message-ID: Interesting - I heard a talk about RonR and afterwards asked the speaker why RonR was so popular. He thought for a bit and said something like: "it's because the tight integration with a data base. The RonR view of a web application is that the web application is always driven by a data-base, so tight integration with a DB is essential. Using RonR you get a lot for free - given a data base schema you can automatically generate a lot of goodies" Now I have no experience that can verify if this statement was true or not but it did sound like a good idea. So the question is given a database schema, how much could we generate from the schema alone? I guess forms for data entry, and data table interrogation + queries should come for free. If we add a meta-language for layout and validation, we could generate a lot for free. Suppose we were to say that -record(foo, {x,y,z}). generated HTML forms with CSS selectors that were (say)
... x entry ...
... y entry ...
And suppose we added meta-data describing who can read/write what data base fields with/without authentication, and how the fields are typed then I think we could get a lot of mileage from little effort. Just describing the mnesia tables in some declarative language, and then being able to automatically generate a load of forms to manipulate this data would be a great start. /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Yariv Sadan > Sent: den 3 juni 2006 00:15 > To: Michel Urvoy > Cc: erlang-questions@REDACTED > Subject: Re: Language Bindings for Erlang Again > > > The other point of view is to open Erlang to other > language, because > > what is to notice about Erlang? Everybody says that it's a very > > attractive language, but as far as I can see, it is very few used. > > This is the paradox of Erlang. > > For example, there is now millions of web site, but who > knows one site > > written in Erlang? > > I know of a site: http://yaws.hyber.org/ :) > > Seriously, though, I have wondered about the same question. > If Erlang is so well suited for distributed applications > (which are most non-trivial web applications), why is it not > more popular? My theory is that the barrier to entry is too > high. If you're a PHP programmer, there just isn't an easy > way for you to hit the ground running if you want to create a > web app in Erlang. You have to invest quite a lot of time > into learning Erlang, OTP, Mnesia and Yaws, and all together > this is quite intimidating. > > I think Erlang would get much more popular if it had a > framework similar to Ruby on Rails. Before Ruby on Rails, > relatively few programmers have used Ruby, but the success of > Ruby on Rails has made the Ruby language quite popular. I > think the same can happen with Erlang if Erlang had such a framework. > > As a first step towards such a framework, I thought about > writing a script that would take a .hrl file, parse its > record definitions (representing database objects), and then > generate all the code required to set up a simple web app > using Mnesia and Yaws. This would help newcomers overcome the > initial barrier to entry for Erlang web development. > > That's my 2c :) > > Yariv > From mickael.remond@REDACTED Wed Jun 7 12:46:52 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 7 Jun 2006 12:46:52 +0200 Subject: How can we become a member of erlang organization? In-Reply-To: <1149624646.10289.43.camel@gateway> References: <1149624646.10289.43.camel@gateway> Message-ID: <20060607104652.GA8456@memphis.ilius.fr> Hello, * Tony Zheng [2006-06-06 13:10:46 -0700]: > Hi > > Our company is an IP payment company and most of our software products > were developed by Erlang. Are there any Erlang organizations that we can > join? If have, How can we apply to become a member of such erlang > organizations? Thanks. There was a push at some time for an Erlang foundation. At this time (in 2004) the idea was probably not mature enough, with enough company willing to pay a fees to have an Erlang organisation defending and pushing the language and environment further. The idea would have a been to use the fee to finance an Erlang advocate salary and participation to events, promotion of members' products, etc. Maybe we could revive this idea if the context has changed. -- Micka?l R?mond From dmitriid@REDACTED Wed Jun 7 13:29:09 2006 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Wed, 7 Jun 2006 14:29:09 +0300 Subject: Erlang goes multicore Message-ID: I wonder if anyone has seen this (nothing appeared in the list as far as I can tell): http://www.ericsson.com/technology/opensource/erlang/news/archive/erlang_goes_multi_core.shtml In Erlang/OTP R11B released on May 17 the major news is the support for SMP (Symmetric MultiProcessing). SMP is supported by most modern operating systems like Linux, Windows, Mac OSx, Solaris and is becoming more important now when dual processors, hyper-threading technology and multi-core systems is a reality. ... Multi-threading support in Erlang The Erlang VM is written in C and run as one process on the host operating system (OS). Within the Erlang VM an internal scheduler is responsible for running the Erlang processes (which can be many thousands). In the SMP version of the Erlang VM, there can be many such schedulers running in separate OS threads. As default there will be as many schedulers as there are processors or processor cores on the system. The SMP support is totally transparent for the Erlang programs. That is, there is no need to change or recompile existing programs. Programs with built-in assumptions about sequential execution must be rewritten in order to take advantage of the SMP support, however. This is the first step In this release, the Erlang VM supports SMP with focus on stability. There will follow a number of subsequent steps with necessary optimizations and support for more platforms. The Erlang VM with SMP support has been tested on the following platforms: Solaris 10 sparc Suse Linux (SLES 9) x86 Mac OSx PPC From yann.rouillard@REDACTED Wed Jun 7 11:19:53 2006 From: yann.rouillard@REDACTED (Yann Rouillard) Date: Wed, 07 Jun 2006 11:19:53 +0200 Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor Message-ID: <1149671993.9944.35.camel@localhost> Hi, I am trying to compile erlang under a Dell Powerdge 2850 bi-processor without success. I have tried erlang 10.b.8 to 11.b.0, 10.b.8 can compile but erlexec segfaults. The other versions fails the compilation steps with the following error: erlc -W -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/kernel/ebin -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/stdlib/ebin -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/sasl/ebin -o /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.boot /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel ) /usr/bin/install -c -d /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp ( cd /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp && \ erl -boot start_clean -noinput +B -eval 'release_handler:create_RELEASES("%ERL_ROOT%", "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts", "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel", []), halt()') make[2]: *** [RELEASES.src] Erreur 139 What is strange is that I already successfully compiled and used erlang 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use on the Powerdge the binaries compiled on the Pentium, erl segfaults. I attached the output of the compilation for the different version and also the strace output of erl 10.B.8 segfault. Thanks for any help, I don't know where to look to solve this problem. Yann -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.8.txt.gz Type: application/x-gzip Size: 47225 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.9.txt.gz Type: application/x-gzip Size: 47350 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.10.txt.gz Type: application/x-gzip Size: 47521 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_11.b.0.txt.gz Type: application/x-gzip Size: 47275 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_segfault_10.b.8.txt.gz Type: application/x-gzip Size: 15672 bytes Desc: not available URL: From yann.rouillard@REDACTED Wed Jun 7 11:58:49 2006 From: yann.rouillard@REDACTED (Yann Rouillard) Date: Wed, 07 Jun 2006 11:58:49 +0200 Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor Message-ID: <1149674329.9944.48.camel@localhost> Hi, I am trying to compile erlang under a Dell Powerdge 2850 bi-processor without success. I have tried erlang 10.b.8 to 11.b.0, 10.b.8 can compile but erlexec segfaults. The other versions fails the compilation steps with the following error: erlc -W -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/kernel/ebin -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/stdlib/ebin -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/sasl/ebin -o /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.boot /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel ) /usr/bin/install -c -d /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp ( cd /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp && \ erl -boot start_clean -noinput +B -eval 'release_handler:create_RELEASES("%ERL_ROOT%", "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts", "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel", []), halt()') make[2]: *** [RELEASES.src] Erreur 139 What is strange is that I already successfully compiled and used erlang 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use on the Powerdge the binaries compiled on the Pentium, erl segfaults. I attached the output of the compilation for the different version and also the strace output of erl 10.B.8 segfault. Thanks for any help, I don't know where to look to solve this problem. Yann -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.8.txt.gz Type: application/x-gzip Size: 47225 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.9.txt.gz Type: application/x-gzip Size: 47350 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_10.b.10.txt.gz Type: application/x-gzip Size: 47521 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compilation_erlang_11.b.0.txt.gz Type: application/x-gzip Size: 47275 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_segfault_10.b.8.txt.gz Type: application/x-gzip Size: 15672 bytes Desc: not available URL: From Micic_V@REDACTED Wed Jun 7 13:23:22 2006 From: Micic_V@REDACTED (Valentin Micic [ MTN - Innovation Centre ]) Date: Wed, 7 Jun 2006 13:23:22 +0200 Subject: FW: Erlang R9C-2 NODE stops accepting new connections Message-ID: <23684C9CDF88C04FA8800AA825EADF5103265191@MTNMAIL.mtn.co.za> Thomas, Thanks for the effort. Yes, this is related to listening port, but no, it is not my port, rather the one created by the listener that is servicing incoming connections from other Erlang nodes. There is no doubt in my mind that a new connection requests are not accepted by this listener and/or associated process. The code for this listener start-up and its registration with epmd is contained in "inet_tcp_dist", but I can only speculate as to what is causing the problem (might just as well be a SOLARIS feature, I've seen it before with telnet daemon). What I'd like (or am dying) to find out is how to work around this problem. For example, is there any way to terminate this listener, and start a new one without shutting the whole node down? V. -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Thomas Lindgren Sent: Wednesday, 07 June 2006 1:01 AM To: Valentin Micic [ MTN - Innovation Centre ]; erlang-questions@REDACTED Subject: Re: FW: Erlang R9C-2 NODE stops accepting new connections --- "Valentin Micic [ MTN - Innovation Centre ]" wrote: > People, I'm getting desperate here... anyone from > ERLANG development > team care to comment? I'm not an OTP developer but ... Looking at the source of R11B (erts/emulator/beam/io.c, input_ready() ), it seems as if data has arrived on a port but the status field of the port is 'FREE'. Then driver_select() is called, presumably to clear the event. So, it looks like the port is marked as free but the corresponding file descriptor has not been closed. At least that's my best guess. There should thus be some code path where error handling is incomplete. (Either the port should not be freed or the fd should be closed.) This occurs for your listen port? Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer From pupeno@REDACTED Wed Jun 7 13:53:14 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 7 Jun 2006 11:53:14 +0000 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <200606071153.19854.pupeno@pupeno.com> On Wednesday, 7 de June de 2006 09:41, Joe Armstrong (AL/EAB) wrote: > Interesting - I heard a talk about RonR and afterwards asked the > speaker why RonR was so popular. > > He thought for a bit and said something like: > > "it's because the tight integration with a data base. > The RonR view of a web application is that the web application > is always driven by a data-base, so tight integration with a DB is > essential. Using RonR you get a lot for free - given a data base > schema you can automatically generate a lot of goodies" > > Now I have no experience that can verify if this statement was true or > not > but it did sound like a good idea. > > So the question is given a database schema, how much could we generate > from the schema alone? > > I guess forms for data entry, and data table interrogation + queries > should come for free. > > If we add a meta-language for layout and validation, we could generate a > > lot for free. Suppose we were to say that > > -record(foo, {x,y,z}). > > generated HTML forms with CSS selectors that were (say) > >
>
> ... x entry ... >
>
> ... y entry ... >
>
> > And suppose we added meta-data describing who can read/write what data > base > fields with/without authentication, and how the fields are typed then I > think we could get > a lot of mileage from little effort. > > Just describing the mnesia tables in some declarative language, and then > being able to > automatically generate a load of forms to manipulate this data would be > a > great start. I believe that if you go that way, you'll end up having some kind of workflow engine. Like: Any authenticated user may create a record; any authenticated manager can make the record visible, any anonymous user can see the record, and then, who can modify it ? Only a manager... unless the you make it private again. I've seen Plone workfolw; it can get very complex very fast. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From nm@REDACTED Wed Jun 7 13:55:23 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 07 Jun 2006 16:55:23 +0500 Subject: how to lookup last record in dataset in Mnesia? Message-ID: <4486BEAB.9050901@web.am> Hello all! I have a table in Mnesia, which I with to filter by some field(s) and fetch one record with maximal ID (ie. last inserted). The only method I can imagine - make qlc query, sort it by ID in reverse order, create qlc cursor and fetch exactly 1 record from resulting dataset. (SQL equivalent: SELECT MAX(ID) FROM table WHERE foo_field = 'bar' and user_name = 'Alice') Are there any fast ways to achieve this in mnesia? Thanks in advance, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From mikpe@REDACTED Wed Jun 7 14:14:54 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 7 Jun 2006 14:14:54 +0200 Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor In-Reply-To: <1149674329.9944.48.camel@localhost> References: <1149674329.9944.48.camel@localhost> Message-ID: <17542.49982.207167.800816@alkaid.it.uu.se> Yann Rouillard writes: > Hi, > > I am trying to compile erlang under a Dell Powerdge 2850 bi-processor > without success. > > I have tried erlang 10.b.8 to 11.b.0, 10.b.8 can compile but erlexec > segfaults. Your R10B versions don't compile cleanly: there are several segmentation faults while compiling the libraries. Didn't you notice them? > What is strange is that I already successfully compiled and used erlang > 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use > on the Powerdge the binaries compiled on the Pentium, erl segfaults. I suspect the two machines don't have the exact same libraries etc. You're not saying anything about the OS, C compiler, or C library versions. As a first step, configure R10B-10 with --disable-hipe and try rebuilding it. If that makes R10B-10 work then it's an issue with your C libraries. From michel.urvoy@REDACTED Wed Jun 7 14:26:46 2006 From: michel.urvoy@REDACTED (Michel Urvoy) Date: Wed, 7 Jun 2006 14:26:46 +0200 Subject: How can we become a member of erlang organization? In-Reply-To: <1149624646.10289.43.camel@gateway> References: <1149624646.10289.43.camel@gateway> Message-ID: Hi Tony, do you know if your company offers an Erlang interface for IP payment within the Veyu Payment process. Michel. 2006/6/6, Tony Zheng : > Hi > > Our company is an IP payment company and most of our software products > were developed by Erlang. Are there any Erlang organizations that we can > join? If have, How can we apply to become a member of such erlang > organizations? Thanks. > > > Tony Zheng > Email: tzheng@REDACTED > > From goertzen@REDACTED Wed Jun 7 14:48:17 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Wed, 07 Jun 2006 07:48:17 -0500 Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor In-Reply-To: <1149674329.9944.48.camel@localhost> References: <1149674329.9944.48.camel@localhost> Message-ID: <4486CB11.9050201@ertw.com> Does configuring with --disable-hipe help? Dan. Yann Rouillard wrote: > Hi, > > I am trying to compile erlang under a Dell Powerdge 2850 bi-processor > without success. > > I have tried erlang 10.b.8 to 11.b.0, 10.b.8 can compile but erlexec > segfaults. The other versions fails the compilation steps with the > following error: > > erlc -W > -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/kernel/ebin > -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/stdlib/ebin > -I/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/lib/sasl/ebin > -o /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.boot /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel ) > /usr/bin/install -c > -d /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp > ( cd /home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/tmp && \ > erl -boot start_clean -noinput +B -eval > 'release_handler:create_RELEASES("%ERL_ROOT%", > "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts", > "/home/yrouillard/ejabberd/erlang/otp_src_R11B-0/erts/start_scripts/start_sasl.rel", []), halt()') > make[2]: *** [RELEASES.src] Erreur 139 > > What is strange is that I already successfully compiled and used erlang > 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use > on the Powerdge the binaries compiled on the Pentium, erl segfaults. > > I attached the output of the compilation for the different version and > also the strace output of erl 10.B.8 segfault. > > Thanks for any help, I don't know where to look to solve this problem. > > Yann > From hans.bolinder@REDACTED Wed Jun 7 15:29:06 2006 From: hans.bolinder@REDACTED (hans.bolinder@REDACTED) Date: Wed, 7 Jun 2006 15:29:06 +0200 Subject: how to lookup last record in dataset in Mnesia? In-Reply-To: <4486BEAB.9050901@web.am> References: <4486BEAB.9050901@web.am> Message-ID: <17542.54434.165565.124618@gargle.gargle.HOWL> [Gaspar Chilingarov:] > I have a table in Mnesia, which I with to filter by some field(s) and > fetch one record with maximal ID (ie. last inserted). > > (SQL equivalent: SELECT MAX(ID) FROM table WHERE foo_field = 'bar' and > user_name = 'Alice') > > Are there any fast ways to achieve this in mnesia? QH = qlc:q([R#foo.id || R <- mnesia:table(T), R#foo.foo_field =:= bar, R#foo.user_name =:= 'Alice']), lists:max([0 | qlc:e(QH)]) % assumption: 'id' is an integer > 0 If 'foo_field' or 'user_name' is the key column, or either of them is indexed, the query is just a lookup. Otherwise the whole table will be traversed, possibly using select and a match specification. Best regards, Hans Bolinder, Erlang/OTP From chandrashekhar.mullaparthi@REDACTED Wed Jun 7 15:34:59 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 7 Jun 2006 14:34:59 +0100 Subject: how to lookup last record in dataset in Mnesia? In-Reply-To: <4486BEAB.9050901@web.am> References: <4486BEAB.9050901@web.am> Message-ID: You can use mnesia:foldl/foldr probably. But this will traverse the entire table everytime. Alternately, you could use an ordered_set table and then use mnesia:dirty_last - but I don't think it meets your needs from what you've said. Chandru On 07/06/06, Gaspar Chilingarov wrote: > > Hello all! > > > I have a table in Mnesia, which I with to filter by some field(s) and > fetch one record with maximal ID (ie. last inserted). > > The only method I can imagine - > > make qlc query, sort it by ID in reverse order, create qlc cursor and > fetch exactly 1 record from resulting dataset. > > (SQL equivalent: SELECT MAX(ID) FROM table WHERE foo_field = 'bar' and > user_name = 'Alice') > > Are there any fast ways to achieve this in mnesia? > > Thanks in advance, Gaspar > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivvv@REDACTED Wed Jun 7 15:37:44 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 7 Jun 2006 09:37:44 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> Message-ID: <17244f480606070637r58a1e91ct7b8b8f4890f42785@mail.gmail.com> > This is what I consider a real Erlang problem: it is > fairly obscure. I'd furthermore expect things are > worse in the US. (Some consider that a competitive > advantage, of course. Not I.) > I agree it's a problem, mostly because popularity often brings many useful 3rd party libraries and tools. However, I think this can be fixed in a relatively short amount of time (2 years, roughly the time it took Ruby on Rails to explode in popularity -- check out http://www.google.com/trends?q=ruby+on+rails%2C+erlang&ctab=0&geo=all&date=all). I seriously think Erlang could become quite popular if - it had a solid web development framework that made common tasks easy for PHP/Ruby/JSP developers who are "making the switch." (The bar keeps getting higher, btw -- check out http://code.google.com/webtoolkit/.) - it had a friendlier website with community features such as comments/forums, a wiki and an official blog, which I think are the best modern-day PR tools for geeky stuff :) http://rubyonrails.org is a nice example. - Mnesia disc-only storage engine, dets, had the improvements described here http://erlang.org/ml-archive/erlang-questions/200605/msg00042.html . I think this is important because most cheap web apps run in hosted environments where RAM is scarce and storage capacity is more important than soft real-time performance. I am actually looking into running an Erlang app in such an environment (a cheap VPS virtual server with decent disc capacity but very little RAM), so the dets issue is definitely on my mind. Erlang's popularity can also be driven by pure economics. If an Erlang application server can have x10 the throughput of LAMP server during high load because Erlang scales much better with large numbers of parallel processes (I made up the number but the multiplier shoud be substantial :) ), web hosting companies could offer Erlang hosting for lower rates than LAMP hosting (or, vice versa, one would need to rent fewer dedicated servers to run an Erlang app than a LAMP/Java app). This would make Erlang more appealing for many web developers/companies than the alternatives. However, web hosting companies won't offer Erlang hosting unless developers adopt Erlang in greater numbers, which depends on features than cater to LAMP developers, good PR and open source community building. My 2c. Yariv From yann.rouillard@REDACTED Wed Jun 7 15:41:53 2006 From: yann.rouillard@REDACTED (Yann Rouillard) Date: Wed, 07 Jun 2006 15:41:53 +0200 Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor In-Reply-To: <17542.49982.207167.800816@alkaid.it.uu.se> References: <1149674329.9944.48.camel@localhost> <17542.49982.207167.800816@alkaid.it.uu.se> Message-ID: <1149687714.9944.83.camel@localhost> > > What is strange is that I already successfully compiled and used erlang > > 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use > > on the Powerdge the binaries compiled on the Pentium, erl segfaults. > > I suspect the two machines don't have the exact same libraries etc. Debian Sarge was installed on both machines, so I am not sure the problem lies here. > You're not saying anything about the OS, C compiler, or C library versions. The OS is Debian Sarge, the C compiler is the default one, gcc 3.3.5. The Linux kernel is different (it shouldn't be important here, no ?), 2.6.16 from Debian Backports on the Pentium Pro where erlang works, 2.4.27 debian one on the Dell Powerdge. > As a first step, configure R10B-10 with --disable-hipe and try rebuilding it. > If that makes R10B-10 work then it's an issue with your C libraries. Ok --disable-hipe solved the problem. Thanks for your help. I still don't understand why this problem only happens on that machine. Both machines are Debian Sarge without modification except the kernel for the Pentium Pro machine. Yann From bengt.kleberg@REDACTED Wed Jun 7 15:47:39 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 07 Jun 2006 15:47:39 +0200 Subject: Proposal: E / Erlang integration In-Reply-To: <10851539.7111149567934607.JavaMail.root@zimbra> References: <10851539.7111149567934607.JavaMail.root@zimbra> Message-ID: <4486D8FB.1090108@ericsson.com> On 2006-06-06 06:25, Michael FIG wrote: ...deleted > In my mind, the only things that would need to be changed in Erlang in order to support E's semantics would be syntax to send E-style messages (that result in a promise), a construct to invoke code when promises are fulfilled, and a flag to indicate that a specific process is untrusted and may only interact with the rest of the system by receiving and sending E-style messages. presumably this only shows my ignorance, but i hope that it will be possible to reduce it after this question :-) why do erlang need a special syntax to send e-style messages? what does this add that the normal send (!) does not have? why do erlang need a special syntax to receive e-style messages? what does this add that the normal receive does not have? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From apnadkarni@REDACTED Wed Jun 7 15:50:16 2006 From: apnadkarni@REDACTED (Ashok P. Nadkarni) Date: Wed, 07 Jun 2006 19:20:16 +0530 Subject: Confused about erl_free_term Message-ID: <4486D998.8040007@users.sourceforge.net> I'm confused about allocation/freeing of terms when using the erl_interface library. Suppose I have code as follows: t1 = erl_decode(blah blah....); t2 = erl_hd(t1); Once I'm done using t1 and t2, do I have to call erl_free_term for both t1 and t2 ? Or will calling erl_free_term(t1) also free t2? If I do have to call erl_free_term separately for both, could I instead call erl_free_compound(t1) to get the same effect? Thanks in advance, /Ashok From chsu79@REDACTED Wed Jun 7 16:08:11 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 7 Jun 2006 16:08:11 +0200 Subject: how to lookup last record in dataset in Mnesia? In-Reply-To: <4486BEAB.9050901@web.am> References: <4486BEAB.9050901@web.am> Message-ID: Is there any way you could update a last-inserted-table on your own each time you make a change? E.g. all modifications go through the same code that makes sure the last-inserted-table is updated. On 6/7/06, Gaspar Chilingarov wrote: > Hello all! > > > I have a table in Mnesia, which I with to filter by some field(s) and > fetch one record with maximal ID (ie. last inserted). > > The only method I can imagine - > > make qlc query, sort it by ID in reverse order, create qlc cursor and > fetch exactly 1 record from resulting dataset. > > (SQL equivalent: SELECT MAX(ID) FROM table WHERE foo_field = 'bar' and > user_name = 'Alice') > > Are there any fast ways to achieve this in mnesia? > > Thanks in advance, Gaspar > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED > From chsu79@REDACTED Wed Jun 7 16:17:51 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 7 Jun 2006 16:17:51 +0200 Subject: Erlang goes multicore In-Reply-To: References: Message-ID: On 6/7/06, Dmitrii Dimandt wrote: > I wonder if anyone has seen this (nothing appeared in the list as far > as I can tell): This thread discussed it http://www.erlang.org/ml-archive/erlang-questions/200605/msg00186.html It doesnt hurt to repeat SMP-support some more though. I'm waiting to hear success stories where production systems go faster and money is saved, and not just extreme benchmarks. From bjarne@REDACTED Wed Jun 7 16:32:35 2006 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Wed, 7 Jun 2006 16:32:35 +0200 Subject: How can we become a member of erlang organization? References: <1149624646.10289.43.camel@gateway> Message-ID: <000d01c68a3f$3cb7f7a0$d62069d4@segeltorp> Hello There exists an informal gathering of Erlang users who are, for example, active on this mailing list. One good idea is to attend the Erlang workshops and the Erlang user conferences and mingle with other users. Just check out http://www.erlang.se/euc/05/photo/ http://www.erlang.se/workshop/2005/photo/ Best wishes Bjarne ----- Original Message ----- From: "Tony Zheng" To: Sent: Tuesday, June 06, 2006 10:10 PM Subject: How can we become a member of erlang organization? > Hi > > Our company is an IP payment company and most of our software products > were developed by Erlang. Are there any Erlang organizations that we can > join? If have, How can we apply to become a member of such erlang > organizations? Thanks. > > > Tony Zheng > Email: tzheng@REDACTED > From yarivvv@REDACTED Wed Jun 7 16:46:37 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 7 Jun 2006 10:46:37 -0400 Subject: joining Mnesia tables In-Reply-To: <17542.34498.233870.551119@gargle.gargle.HOWL> References: <17244f480606061141h1b2cd33bu8d2de99b2b4d307@mail.gmail.com> <17542.34498.233870.551119@gargle.gargle.HOWL> Message-ID: <17244f480606070746k12d95baep2da75f9981f24094@mail.gmail.com> > > There is ongoing work on faster join of QLC tables. The results will > be part of R11B-X, for some small X. > > Best regards, > > Hans Bolinder, Erlang/OTP > Excellent! :) Thanks, Yariv From yarivvv@REDACTED Wed Jun 7 17:01:07 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 7 Jun 2006 11:01:07 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <17244f480606070801l73156a4cwba6a7448e7ec65c4@mail.gmail.com> > Now I have no experience that can verify if this statement was true or > not > but it did sound like a good idea. Joe, please do a Ruby on Rails tutorial (you can easily find one on Google) -- it'll be a very rewarding experience :) Once you have everything installed, It shouldn't take you more than than 10 minutes to create a complete database-driven Rails web app. > Just describing the mnesia tables in some declarative language, and then > being able to > automatically generate a load of forms to manipulate this data would be > a > great start. > I think Erlang is actually the perfect language, because its records already fully describe Mnesia tables. For instance, consider the following code: -record(employee, {id, deptartment_id, name, office}). -record(department, {id, name, building}). -record(project, {id, name, deadline}). -record(employee_project, {employee_id, project_id}). By relying on certain naming conventions (one of Rail's motos is "Convention over Configuration") these records can describe a full database schema with both 1-1, 1-many and many-many relations. A simple Erlang script could parse this code and generate a complete web app with CRUD capabilities, similar to the Rails scaffold generation script. Hope I'm making sense :) Best, Yariv From anders.nygren@REDACTED Wed Jun 7 18:03:15 2006 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 7 Jun 2006 11:03:15 -0500 Subject: Erlang on Intel Mac Message-ID: Hi I am considering buying a new computer and am becoming seduced by the idea of getting a Mac. The question is how well does erlang work on the new Intel based Macs? I saw some discussions back in January that said that Hipe does not support Intel Macs, is that the only limitation? Regards Anders From nm@REDACTED Wed Jun 7 18:15:45 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 07 Jun 2006 21:15:45 +0500 Subject: how to lookup last record in dataset in Mnesia? In-Reply-To: <17542.54434.165565.124618@gargle.gargle.HOWL> References: <4486BEAB.9050901@web.am> <17542.54434.165565.124618@gargle.gargle.HOWL> Message-ID: <4486FBB1.2060506@web.am> hans.bolinder@REDACTED wrote: > [Gaspar Chilingarov:] >> I have a table in Mnesia, which I with to filter by some field(s) and >> fetch one record with maximal ID (ie. last inserted). >> >> (SQL equivalent: SELECT MAX(ID) FROM table WHERE foo_field = 'bar' and >> user_name = 'Alice') >> >> Are there any fast ways to achieve this in mnesia? > > QH = qlc:q([R#foo.id || > R <- mnesia:table(T), > R#foo.foo_field =:= bar, > R#foo.user_name =:= 'Alice']), > lists:max([0 | qlc:e(QH)]) % assumption: 'id' is an integer > 0 > > If 'foo_field' or 'user_name' is the key column, or either of them is > indexed, the query is just a lookup. Otherwise the whole table will be > traversed, possibly using select and a match specification. > > Best regards, > > Hans Bolinder, Erlang/OTP > Thanks a lot - this one was really useful. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From yarivvv@REDACTED Wed Jun 7 19:14:26 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 7 Jun 2006 13:14:26 -0400 Subject: Erlang on Intel Mac In-Reply-To: References: Message-ID: <17244f480606071014n6c42837fia2a5a34aeedf9289@mail.gmail.com> It works fine on my MacBook. I don't know about Hipe. Yariv On 6/7/06, Anders Nygren wrote: > Hi > I am considering buying a new computer and am becoming seduced > by the idea of getting a Mac. > The question is how well does erlang work on the new Intel based Macs? > > I saw some discussions back in January that said that Hipe does not support > Intel Macs, is that the only limitation? > > Regards > Anders > From jefcrane@REDACTED Wed Jun 7 19:18:40 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Wed, 7 Jun 2006 10:18:40 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <200606070413.k574DlYW176812@atlas.otago.ac.nz> Message-ID: <20060607171840.20946.qmail@web31610.mail.mud.yahoo.com> According to the erlang documentation there's erl_interface and jinterface. The jinterface documentation is quite robust! (http://www.erlang.se/doc/doc-5.0.1/lib/jinterface-1.2/doc/html/index.html) --- "Richard A. O'Keefe" wrote: > If I am looking for an interface between language X > and language Y, > and I have language X installed on my system, I go > looking in the > documentation for language X before looking on the > Web. > So I did. I dont see the point of looking up the documentation for an interface when 3rd party, example usage, will both alert you to the gotchas that the documentation (inevitably) fails to cover (hence a gotcha) and contemporary usage. I suppose many people forget how ridiculous their first C programs would have looked, without examples to follow. Coupled with the fact that I dont think an Erlang to Java to Python binding is a good idea, it just didn't occur to me to look for Java Your methodology is sound and I should have adopted it. It's interesting to note that my peers (3 other people I know) did not find the jinterface either. Google does not return it without explicitly putting Java in the search which is pretty specific. I guess the second step to looking for an interface is iterating through erlang interface Language. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ke.han@REDACTED Wed Jun 7 19:24:33 2006 From: ke.han@REDACTED (ke han) Date: Thu, 8 Jun 2006 01:24:33 +0800 Subject: Erlang on Intel Mac In-Reply-To: References: Message-ID: I don't know about Hipe, but I use erlang + yaws for development on my iMac Intel. No problems. ke han On Jun 8, 2006, at 12:03 AM, Anders Nygren wrote: > Hi > I am considering buying a new computer and am becoming seduced > by the idea of getting a Mac. > The question is how well does erlang work on the new Intel based Macs? > > I saw some discussions back in January that said that Hipe does not > support > Intel Macs, is that the only limitation? > > Regards > Anders From klacke@REDACTED Wed Jun 7 20:34:41 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 07 Jun 2006 20:34:41 +0200 Subject: Confused about erl_free_term In-Reply-To: <4486D998.8040007@users.sourceforge.net> References: <4486D998.8040007@users.sourceforge.net> Message-ID: <44871C41.7010809@hyber.org> Ashok P. Nadkarni wrote: > I'm confused about allocation/freeing of terms when using the > erl_interface library. > > Suppose I have code as follows: > > t1 = erl_decode(blah blah....); > t2 = erl_hd(t1); > > Once I'm done using t1 and t2, do I have to call erl_free_term for both > t1 and t2 ? Or will calling erl_free_term(t1) also free t2? If I do have > to call erl_free_term separately for both, could I instead call > erl_free_compound(t1) to get the same effect? > Yes, call erl_free_compound(t1), only, that is the easiest solution. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From klacke@REDACTED Wed Jun 7 20:54:12 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 07 Jun 2006 20:54:12 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> <200606061634.38422.rlenglet@users.forge.objectweb.org> <17244f480606060652w2b9f515ar3e2d1deba1ec633d@mail.gmail.com> Message-ID: <448720D4.3090302@hyber.org> Yariv Sadan wrote: >> >> The long term, right approach would be to open the internals of >> the emulator a little, but by reifying them cleanly, and to let >> users write and load/unload dynamically their own BIFs. > > Unless I have a serious gap in understanding, isn't there another > danger with letting developers essentially create their own BIFs, > because BIF calls block the entire Erlang system process, hence > blocking all spawned Erlang processes during their execution? If one > could easily create BIFs, either they would have to be executed in a > separate system thread, creating the same complexity with regards to > communication with the Erlang VM, or developers would have to be > pretty careful not to write BIFs such as synchronouslyDefragMyDrive() Writing a BIF would be equally complicated to writing a linked in driver. C programmers that do that are supposed to understand exactly what they're doing - and blocking seems like one of the smaller obstacles to overcome. Debugging BIFs and linked in drivers is hard - it's a really unfriendly environment in the emulator. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From klacke@REDACTED Wed Jun 7 21:02:02 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 07 Jun 2006 21:02:02 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <17244f480606070637r58a1e91ct7b8b8f4890f42785@mail.gmail.com> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <17244f480606070637r58a1e91ct7b8b8f4890f42785@mail.gmail.com> Message-ID: <448722AA.3000006@hyber.org> Yariv Sadan wrote: > > I seriously think Erlang could become quite popular if > > - it had a solid web development framework that made common tasks easy > for PHP/Ruby/JSP developers who are "making the switch." (The bar > keeps getting higher, btw -- check out > http://code.google.com/webtoolkit/.) > The time is more than ripe to build that now. Yaws + Mnesia + records + possibly some additional description "little language" would make an excellent starting point. Quite a bit of work though, (guesstimate: 3 hackers x 3 months) to get a first acceptable version in the air. It also requires lots of good documentation and packaging. Should be done - now. Actually, I think one could make a good living from this, build it, write a book, and sell consultancy on the toolkit only. > - Mnesia disc-only storage engine, dets, had the improvements > described here > http://erlang.org/ml-archive/erlang-questions/200605/msg00042.html Should also be done - now. Not by me though, I'm - well, fully occupied - to say the least. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From ulf@REDACTED Wed Jun 7 21:31:02 2006 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 07 Jun 2006 21:31:02 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <2006060613421149615736@k2.sage.att.com> References: <1149582746.44853d9a9eb23@backawinner.gg> <2006060613421149615736@k2.sage.att.com> Message-ID: Den 2006-06-06 19:42:17 skrev Garry Hodgson : >> Erlang runs the telephone system in the UK - all 1.7m sloc of it with >> 31ms >> downtime per year (yes 99.9999999% availability). >> >> The lesson of this is that Erlang 'only' gives you commodity, >> open-source, >> google scalability on comodity hardware. Apart from that it has little >> to >> offer ;-> > does anyone have a pointer to some documentation about that? > i'd like to beat some people over the head with it. It is true that the availability figures were nine nines during the first period of operation. It was pretty exciting, since when it was taken into service, it was the first network of its kind, and it was a live cutover in one of the busiest transit networks in the world. I don't know what the availability figures are today. As you may know, the biggest contributors to downtime in telecom systems are maintenance and upgrades. There were some articles, but I don't know if they are still reachable. Here's a post that quotes some of the contents of one article long since lost. http://www.erlang.org/ml-archive/erlang-questions/200211/msg00050.html Here's the original article on the AXD 301: http://web.archive.org/web/20020605062622/http://www.ericsson.com/about/publications/review/1998_01/files/1998012.pdf It does mention (in the "software technology" box on page 15) that Erlang is the primary language used for the control system. BR, Ulf W -- Ulf Wiger From klacke@REDACTED Wed Jun 7 23:06:12 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 07 Jun 2006 23:06:12 +0200 Subject: yaws 1.62 Message-ID: <44873FC4.40105@hyber.org> Folks, we have a new release, yaws 1.62 relnotes and code as usual at http://yaws.hyber.org /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From csanto@REDACTED Wed Jun 7 23:07:15 2006 From: csanto@REDACTED (Corrado Santoro) Date: Wed, 07 Jun 2006 23:07:15 +0200 Subject: [ANN] Erlang Golfer wins the second prize at Eurobot '06 Message-ID: <44874003.8050508@diit.unict.it> Dear Erlangers, maybe some of you remember that, at the latest Erlang User Conference, I announced the intention of building an Erlang-enabled robot to participate to the next EUROBOT contest (see http://www.eurobot.dees.unict.it/eu/index.php). The contest is now over: our team got the second prize in the Italian Campionship, and the 37th position (on 50) in the International Campionship. Not too bad, if we consider that we are not robot builders and that we had a *huge* number of problems (five motors burned, encoders broken, power supply problems, to cite few of them). In any case, we had a lot of fun and we will surely repeat such an experience next year in France. If you are interested, you may take a look at our web site http://pciso.diit.unict.it/~eurobot Here you may find information, photos and newspaper articles (even if they are in Italian). And don't forget to see our trailer at http://www.catanialife.it/eurobot/ So far... Is Erlang good to program robots?? We learned many things from this experience and we plan to give a (tentative) answer to this question at the next Erlang User Conference. All the best, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 +39 095 7387035 +39 095 7382365 +39 095 7382364 VoIP: sip:7035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ====================================================== From tomas.abrahamsson@REDACTED Wed Jun 7 23:55:44 2006 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Wed, 7 Jun 2006 23:55:44 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <87verei5qg.fsf@pingviini.kortex.jyu.fi> References: <20060606161934.60991.qmail@web31610.mail.mud.yahoo.com> <87verei5qg.fsf@pingviini.kortex.jyu.fi> Message-ID: On 6/6/06, Jani Hakala wrote: > There is also py_interface that is probably more like jinterface. [...] It might also be > unmaintained :( Yes, this is mostly true. I've not really used py_interface myself since I wrote it, sadly enough. The patch in http://article.gmane.org/gmane.comp.lang.erlang.general/9751 should be applied. /Tomas From klacke@REDACTED Thu Jun 8 00:07:32 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 08 Jun 2006 00:07:32 +0200 Subject: [ANN] Erlang Golfer wins the second prize at Eurobot '06 In-Reply-To: <44874003.8050508@diit.unict.it> References: <44874003.8050508@diit.unict.it> Message-ID: <44874E24.1010708@hyber.org> > Here you may find information, photos and newspaper articles (even if > they are in Italian). And don't forget to see our trailer at > > http://www.catanialife.it/eurobot/ > Way to go !!! /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From gefla@REDACTED Thu Jun 8 00:57:20 2006 From: gefla@REDACTED (Gerd Flaig) Date: Thu, 08 Jun 2006 00:57:20 +0200 Subject: Language Bindings for Erlang Again (Opinion) References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> Message-ID: <87y7w860bz.fsf@kilo.pond.sub.org> Thomas Lindgren writes: >> As an employer, it's near-impossible to find a person to maintain >> or support my new Erlang project in any State, much less my County. > > This is what I consider a real Erlang problem: it is > fairly obscure. I'd furthermore expect things are > worse in the US. (Some consider that a competitive > advantage, of course. Not I.) as often as I hear that argument, I still don't understand it. Anyone you would want to hire for software development can pick up Erlang in a few days and OTP in four to eight weeks. > I'd like to see some good books on "modern erlang/otp" > for example. Yes, something like Practical Common Lisp, only for Erlang. Goodbyte, Gerd. -- The last thing one knows in constructing a work is what to put first. -- Blaise Pascal From bsder@REDACTED Thu Jun 8 04:58:16 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 07 Jun 2006 19:58:16 -0700 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <87y7w860bz.fsf@kilo.pond.sub.org> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <87y7w860bz.fsf@kilo.pond.sub.org> Message-ID: <44879248.7000905@allcaps.org> Gerd Flaig wrote: > as often as I hear that argument, I still don't understand it. Anyone > you would want to hire for software development can pick up Erlang in > a few days and OTP in four to eight weeks. I disagree. The complete rearrangement to functional programming and message passing does not come easily for 99% of software developers. Now, we can argue whether you should hire people like that, but if you ignore 99% of all developers, your language is unlikely to become very widespread. OTP cannot be picked up in 4 to 8 weeks because its documentation sucks. Why do I use OTP? When do I use OTP? When do I *not* use OTP? A reference manual like we currently have is merely a first step. Something on the list like "Guru of the Week" was for C++ would be useful and wouldn't require the publication of a book. >> I'd like to see some good books on "modern erlang/otp" >> for example. > > Yes, something like Practical Common Lisp, only for Erlang. Ayup. That would be nice. -a From nm@REDACTED Thu Jun 8 07:10:38 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 08 Jun 2006 10:10:38 +0500 Subject: yaws 1.62 In-Reply-To: <44873FC4.40105@hyber.org> References: <44873FC4.40105@hyber.org> Message-ID: <4487B14E.9020500@web.am> Great, we got new release of yaws! :))) Let me explain a little bit about added -RPC handlers. Changes involve 4 files -- o json.erl -- generic encoder from erlang strauctures to string and visa versa o jsonrpc.erl -- module to make json rpc calls to remote handlers o yaws_jsonrpc.erl -- handlers to dispatch JSONRPC calls o yaws_xmlrpc.erl -- handlers to dispatch XMLRPC calls Now let go deeper in the code: json:encode(RPCData) -> string() -- encode erlang structures to string RPCData -> int() | string() | bool() | {array, [RPCData,...]} | {struct, [ {atom(), RPCData}, ... ] Thus any deep nested structure can be described by such notation. Structures are represented as objects in javascript and arrays - just map to arrays with numeric indexes. json:decode_string(String) -> RPCData -- parse string and convert to erlang structures Both of function crash on encode/decode errors. jsonrpc:call(URL, Options, Payload) -> {ok,{response, Result}} | {error, ErrDescr} URL -> string() Options -> [] | OptionList Payload -> {call, MethodName, Arguments} MethodName -> atom() Arguments -> [ RPCData, ... ] Result -> [ RPCData ] jsonrpc:call makes synchronous call to remote JSONRPC server. HTTP is used for calling remote servers, so you should specify URL where server resides. All calls are made by http:request function, so Options are passed there without changes. Payload argument specifies which method should be called on remote side and with which arguments. Note, that passing several items in Arguments list means that you invoke remote procedure with multiple arguments. Result is returned also as a single element list with RPCData data type - i.e. structures/arrays/etc. Such format of calling arguments and returning is made to have full interface compatibility with xmlrpc module (http://www.gleipnir.com/xmlrpc/). jsonrpc:call returns errors for some conditions - i.e. timeouts and so on and crashes in case if it cannot encode/decode payload structures. Now the most interesting part - writing handlers for RPC calls. Writing xmlrpc and jsonrpc handlers is quite the same - even same handlers can handle requests from both protocols. Dispatching rpc calls without keeping state between calls: In out() function you should have following code: yaws_jsonrpc:handler(A, {M, F}). A -> args() M, F -> atom() A is an yaws #args record (we need post request payload from there), M,F is a tuple pointing to handler module:function . passing funs is not supported yet - but it should be very easy to add. When yaws_jsonrpc:handler is invoked it checks that we got a POST request, parses POST request text to Payload, extracts from there method name and arguments and invokes M:F(State, {call, MethodName, Arguments}) -> Result handler. State -> term() MethodName -> atom(), Arguments -> RPCData() Result -> {false, ResponsePayload} MehodName and Arguments comes from remote side, State comes from A#args.state fields - so if you with to pass some data from yaws page to RPC handler - you should put it there before calling yaws_jsonrpc:handler . As handler execution is completed yaws_jsonrpc:handler encodes resulting payload to tuple which is ready to be returned to yaws. Stateless handlers/2 are 100% compatible with xmlrpc module handlers, which allows smooth transition. Handlers which use sessions are more interesting, but they are not compatible with original xmlrpc module interface - only yaws_jsonrpc and yaws_xmlrpc will support them. The sessions are cookie based, they use yaws build-in session server functionality and allow rpc handlers keep data on server side between calls. There is 2 functions to support them yaws_jsonrpc:handler_session(Args, {M, F}) yaws_jsonrpc:handler_session(Args, {M, F}, CookieName) CookieName -> atom() | string() handler_session/2 uses ookie with the name "SID". In case of sessions callback handler should take 3 parameters M:F(State, {call, MethodName, Arguments}, Session) -> Result State -> term() MethodName -> atom(), Arguments -> RPCData() Session -> undefined | SessionData SessionData -> term() Result -> {false, ResponsePayload} | {true, _NewTimeout, NewSessionValue, ResponsePayload} _NewTimeout -> any value (just for compatibility) NewSessionValue -> undefined | term() ResponsePayload -> {response, RPCData} At the first call Session value is `undefined` and handler can decide what to do with session. Returning {false, Response} does not change session state at all. If handler returns some data in NewSessionValue argument then session is started (in this case cookie returned to client) or session data updates. If handler with to stay without session or destroy old session - it sould return `undefined` atom, which will cause destroying cookie session in yaws. yaws_(xml|json)rpc:handler* functions will crash in case it handler cannot be found, illegal return values are generated or if payloads cannot be encoded/decoded. That's it - it's really easy to implement RPC server using this modules and it provides convenient way to fully use yaws strength without inventing the bicycle. Also it solves problems with javascript security model -- because javascript functions may post data only to URLs at same protocol/host/port combination from where js file was loaded. You are welcome to try this modules and submit your suggestions and ideas. With best regards, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From mikpe@REDACTED Wed Jun 7 18:45:03 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 7 Jun 2006 18:45:03 +0200 (MEST) Subject: Erlang on Intel Mac Message-ID: <200606071645.k57Gj33E002940@harpo.it.uu.se> On Wed, 7 Jun 2006 11:03:15 -0500, Anders Nygren wrote: >I am considering buying a new computer and am becoming seduced >by the idea of getting a Mac. >The question is how well does erlang work on the new Intel based Macs? > >I saw some discussions back in January that said that Hipe does not support >Intel Macs, is that the only limitation? I'm assuming you're intending to use OSX on it. I can think of a few issues: - Fast floating-point support: needs reliable FP exceptions, but the code for that is both OS and CPU specific. I wrote the code for Linux/{x86,amd64,ppc} and OSX/ppc, but without a machine I can't say how the code needs to change to handle OSX/x86. - HiPE: wants fast floating-point, but on x86 also needs working sigaltstack() and ability to enforce SA_ONSTACK in sigaction() calls. This is highly dependent on details of the C library, but it does work on Linux/x86 (at least RedHat/Fedora) and Solaris/x86 8/9. OSX/x86 is a complete unknown here. The rest should work, including SMP. From mickael.remond@REDACTED Wed Jun 7 22:32:00 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 7 Jun 2006 22:32:00 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: <20060607203200.GA19104@memphis> * Michel Urvoy [2006-06-06 08:18:14 +0200]: > I've no doubt about this. The point I had already noticed with Nortel > is that Erlang is mentioned nowhere. > The company that use or have used Erlang are very discret about the > language. Even with an open source project like process one / > ejabberd: > http://www.process-one.net/en/projects/ejabberd/ You have to look carefully: - Erlang support: http://www.process-one.net/en/services/support/erlang.html - Erlang contribs and docs: http://support.process-one.net/doc/display/CONTRIBS/Contributions http://support.process-one.net/doc/display/ERL/Erlang+area - Erlang Packaging (Something that aims at becoming the CPAN for Erlang): http://erlrt.process-one.net/?page=index But, most of the time you should not mix messages that are intended to different kind of people on the same explaination. That's counter-productive. And seeming to be "secret" about the technology used has one advantage: People start thinking it might be a powerfull secret weapon they should adopt. I like to think of this as a marketing strategy for Erlang. The idea is taken from Parmentier who introduced the Potato in France: >From http://www.menumagazine.co.uk/book/azpotato.htm : "However, the French were less than enamoured of this ugly, unprepossessing tuber and resisted strongly. Feelings against the potato were so high that a rumour even existed that it would cause leprosy. So Parmentier indulged in a little reverse psychology; gaining permission from Louis XVI to plant a small field of potatoes just outside Paris, he posted a very conspicuous guard. This was enough to pique the interest of the contrary French temperament with Parisians, who had initially turned up their noses at the tuber, plundering the crop and giving the potato a new-found ?chic?. To reinforce this new growing popularity, M. Parmentier demonstrated a genius for marketing that many modern companies would envy in organizing a royal banquet, at which every course contained potatoes in some form and the Royal couple wore potato flowers, his name gaining synonymity with the potato for posterity in France." Nice, isn't it ? -- Micka?l R?mond http://www.process-one.net/ From mickael.remond@REDACTED Wed Jun 7 22:32:00 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 7 Jun 2006 22:32:00 +0200 Subject: Language Bindings for Erlang Again In-Reply-To: References: <20060605104426.84810.qmail@web38810.mail.mud.yahoo.com> Message-ID: <20060607203200.GA19104@memphis> * Michel Urvoy [2006-06-06 08:18:14 +0200]: > I've no doubt about this. The point I had already noticed with Nortel > is that Erlang is mentioned nowhere. > The company that use or have used Erlang are very discret about the > language. Even with an open source project like process one / > ejabberd: > http://www.process-one.net/en/projects/ejabberd/ You have to look carefully: - Erlang support: http://www.process-one.net/en/services/support/erlang.html - Erlang contribs and docs: http://support.process-one.net/doc/display/CONTRIBS/Contributions http://support.process-one.net/doc/display/ERL/Erlang+area - Erlang Packaging (Something that aims at becoming the CPAN for Erlang): http://erlrt.process-one.net/?page=index But, most of the time you should not mix messages that are intended to different kind of people on the same explaination. That's counter-productive. And seeming to be "secret" about the technology used has one advantage: People start thinking it might be a powerfull secret weapon they should adopt. I like to think of this as a marketing strategy for Erlang. The idea is taken from Parmentier who introduced the Potato in France: >From http://www.menumagazine.co.uk/book/azpotato.htm : "However, the French were less than enamoured of this ugly, unprepossessing tuber and resisted strongly. Feelings against the potato were so high that a rumour even existed that it would cause leprosy. So Parmentier indulged in a little reverse psychology; gaining permission from Louis XVI to plant a small field of potatoes just outside Paris, he posted a very conspicuous guard. This was enough to pique the interest of the contrary French temperament with Parisians, who had initially turned up their noses at the tuber, plundering the crop and giving the potato a new-found ?chic?. To reinforce this new growing popularity, M. Parmentier demonstrated a genius for marketing that many modern companies would envy in organizing a royal banquet, at which every course contained potatoes in some form and the Royal couple wore potato flowers, his name gaining synonymity with the potato for posterity in France." Nice, isn't it ? -- Micka?l R?mond http://www.process-one.net/ From bsder@REDACTED Thu Jun 8 02:38:20 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 07 Jun 2006 17:38:20 -0700 Subject: Erlang goes multicore In-Reply-To: References: Message-ID: <4487717C.8050908@allcaps.org> Christian S wrote: > On 6/7/06, Dmitrii Dimandt wrote: >> I wonder if anyone has seen this (nothing appeared in the list as far >> as I can tell): > > This thread discussed it > http://www.erlang.org/ml-archive/erlang-questions/200605/msg00186.html > > It doesnt hurt to repeat SMP-support some more though. I'm waiting to > hear success stories where production systems go faster and money is > saved, > and not just extreme benchmarks. Yes, some marketing would be *good*. Erlang is the only language which does multithreading/multiprocessing well. -a From raimo@REDACTED Thu Jun 8 09:29:49 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 08 Jun 2006 09:29:49 +0200 Subject: Erlang on Intel Mac References: Message-ID: We have a Mac Mini in our daily build machine park for SMP test - it is an Intel DualCore. I just checked and it has _not_ got Hipe enabled for its builds. Erlang works well on it, but it has revealed a very rarely occuring SMP bug that we are currently hunting. anders.nygren@REDACTED (Anders Nygren) writes: > Hi > I am considering buying a new computer and am becoming seduced > by the idea of getting a Mac. > The question is how well does erlang work on the new Intel based Macs? > > I saw some discussions back in January that said that Hipe does not support > Intel Macs, is that the only limitation? > > Regards > Anders -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rvg@REDACTED Thu Jun 8 09:36:51 2006 From: rvg@REDACTED (Rudolph van Graan) Date: Thu, 8 Jun 2006 09:36:51 +0200 Subject: Erlang on Intel Mac In-Reply-To: <200606071645.k57Gj33E002940@harpo.it.uu.se> References: <200606071645.k57Gj33E002940@harpo.it.uu.se> Message-ID: <1412FE2A-3DBB-45A8-8E76-09E8B7014F22@patternmatched.com> Hey, We've been using Erlang on OSX/intel for about two months. We haven't seen any Intel specific issues, apart from the fact that everything is roughly 3-4x faster than on the PPC's. Hipe also seem to work (at least from our limited perspective). BR, Rudolph van Graan Telecommunications Specialist Pattern Matched Technologies E-Mail: rvg@REDACTED Mobile: +27 83 390 7767 Fax: +27 12 667 5342 Web: www.patternmatched.com On 07 Jun 2006, at 6:45 PM, Mikael Pettersson wrote: > On Wed, 7 Jun 2006 11:03:15 -0500, Anders Nygren wrote: >> I am considering buying a new computer and am becoming seduced >> by the idea of getting a Mac. >> The question is how well does erlang work on the new Intel based >> Macs? >> >> I saw some discussions back in January that said that Hipe does >> not support >> Intel Macs, is that the only limitation? > > I'm assuming you're intending to use OSX on it. > > I can think of a few issues: > - Fast floating-point support: needs reliable FP exceptions, but > the code for that is both OS and CPU specific. I wrote the code > for Linux/{x86,amd64,ppc} and OSX/ppc, but without a machine I > can't say how the code needs to change to handle OSX/x86. > - HiPE: wants fast floating-point, but on x86 also needs working > sigaltstack() and ability to enforce SA_ONSTACK in sigaction() > calls. > This is highly dependent on details of the C library, but it does > work on Linux/x86 (at least RedHat/Fedora) and Solaris/x86 8/9. > OSX/x86 is a complete unknown here. > > The rest should work, including SMP. > From joe.armstrong@REDACTED Thu Jun 8 09:41:58 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 8 Jun 2006 09:41:58 +0200 Subject: Language Bindings for Erlang Again (Opinion) Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Andrew Lentvorski > Sent: den 8 juni 2006 04:58 > To: Gerd Flaig > Cc: erlang-questions@REDACTED > Subject: Re: Language Bindings for Erlang Again (Opinion) > > Gerd Flaig wrote: > > as often as I hear that argument, I still don't understand > it. Anyone > > you would want to hire for software development can pick up > Erlang in > > a few days and OTP in four to eight weeks. > > I disagree. > > The complete rearrangement to functional programming and > message passing > does not come easily for 99% of software developers. Now, > we can argue whether you should hire people like that, but if > you ignore 99% of all developers, your language is unlikely > to become very widespread. What are you basing this number of 99.9% on? What evidence do you have to support this figure? Let me give you some facts here: I have taught a large number of Erlang classes, I never kept any records so I don't know exactly how many. These were four days hand's on classes - with about 8 pupils/class. These were internal Ericsson classes, in all about 400 programmers attended the courses, which makes about 50 classes. Initially Robert Virding, Mike Williams and I held most of the courses, later we got so fed up giving the courses that we persuaded other people to take over the courses - the first ten times was fun, then it got to be a drag. The people attending our courses were regular Ericsson programmers - not computer scientists, most of them programmed in Plex (an Ericsson internal language) and C. Very few had a computer science background and only a few had every tried "esoteric languages" like lisp or Prolog. What was our experience of this? - almost without exception our pupils had very few problems converting to Erlang. I can only remember one case of a skilled C programmer who just didn't "get it" - he really didn't understand - and I could not understand what he didn't understand. In most cases I observed that "a good programmer in X" will become "a good programmer in Y" (for all X and Y) this appears to be universally true. << I program in lots of languages, but in a sense they are "all the same", or to be more precise fall into one of a small number of categories, for example, imperative, functional, relational ... when you know one you know them all. I've recently programmed a lot of JavaScript (great fun) - after a brief tussle it just feels like any other imperative language with dynamic hash tables - the only problem in switching languages is learning the libraries>> Back to teaching Erlang. Our pupils had two minor problems. - recursion, and - write once variables - processes Now recursion was only a problem IF YOU USED THE WORD RECURSION - it seemed like somewhere lurking at the back of their brains was the idea that "recursion is difficult" and the word "recursion" triggered an immune response - we tried never to mention it. The weird thing is that you learn recursion in school (at least I did) but it was never called that, I learnt that: sin(2X) = 2 sin(X) cos(A) << Wow they're taught me Erlang in school sin(X) -> 2 * sin(X/2)* cos(X/2) >> As for the write once variables - hey you can't say "X = X + 1" you have to say X1 = X +1 in Erlang. Was this a problem? - not really I remember when I first learnt Fortran, the teacher got to X = X + 1 and the class was highly upset "You can't do that", we all protested. My old mathematics teacher would have been appalled - we had learnt in school that X can never be equal to X+1, so we had to "suspend our disbelief" and leant that now = dose not mean equals but something completely different. So what does it mean in Erlang - answer pattern matching. Now processes - these were a problem. The pupils understood processes - but they didn't use them enough. Even today this is probably the biggest mistake people make - not using enough processes - why? probably because using processes is made very difficult in languages like C - so difficult that many C programmers have *never* created a process. > OTP cannot be picked up in 4 to 8 weeks because its > documentation sucks. Now I could write several pages here, since I wrote a lot of the documentation I would find it rather helpful to know which part "sucks" - please send me a list of errata or tell me exactly which parts of the documentation you are having problems with. If you do not understand the documentation then there are plenty of people on this list who can help you. IHMO the *amazing* thing is the large number of people who have understood the documentation and built pretty impressive system *without ever asking any questions on this list* These are the people who's first question to this list is something like "I have set up a 20 machine cluster, and a fragmented mnesia table, and when two of the machine crash I need to ..." - and you wonder - how the heck did they get that far *without* asking any questions - well done guys - at least *somebody* must have read the manual. > > Why do I use OTP? When do I use OTP? When do I *not* use OTP? > > A reference manual like we currently have is merely a first step. > Something on the list like "Guru of the Week" was for C++ > would be useful and wouldn't require the publication of a book. > What would you like - what I am planning is an interactive version of *all* the documentation - ie every document becomes a "forum" where you can interact with the documents. The idea is that you should be able to "ask a paragraph a question" - so if you read something that you don't understand or which "sucks" then you can click on it and "post a question to the paragraph" - this will get back to the person who wrote the text, moreover anybody else who is reading the document will be able to answer the question at this point. <> > >> I'd like to see some good books on "modern erlang/otp" > >> for example. > > > > Yes, something like Practical Common Lisp, only for Erlang. > > Ayup. That would be nice. Books are in the pipeline /Joe > > -a > From chsu79@REDACTED Thu Jun 8 09:44:53 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 8 Jun 2006 09:44:53 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <44879248.7000905@allcaps.org> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <87y7w860bz.fsf@kilo.pond.sub.org> <44879248.7000905@allcaps.org> Message-ID: On 6/8/06, Andrew Lentvorski wrote: > Gerd Flaig wrote: > > as often as I hear that argument, I still don't understand it. Anyone > > you would want to hire for software development can pick up Erlang in > > a few days and OTP in four to eight weeks. > > I disagree. > > The complete rearrangement to functional programming and message passing > does not come easily for 99% of software developers. Now, we can > argue whether you should hire people like that, but if you ignore 99% of > all developers, your language is unlikely to become very widespread. > > OTP cannot be picked up in 4 to 8 weeks because its documentation sucks. > > Why do I use OTP? When do I use OTP? When do I *not* use OTP? What do you take these numbers from? Isnt there empirical evidence that programmers with _no_ previous erlang experience grasp it well after a four day course? Aren't there people on this list that teach erlang that can give us their view of how easy it is to train people in erlang, and also otp? From matthias@REDACTED Thu Jun 8 10:20:14 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 8 Jun 2006 10:20:14 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: Message-ID: <17543.56766.136721.827662@antilipe.corelatus.se> Joe Armstrong (AL/EAB) writes: > In a convential server like Apache you have to spawn one OS > process/connection in order to protect the sessions from > each other. This is very slow. http://tcl.apache.org/presentations/rivet/apache-architecture.rvt?index=13 Or can I clarify the original post thusly: | Apache should spawn one OS process per connection, and, if it did, it | would be slow, but in actual fact it doesn't, but let's assume it does | so that we can say it's slow. ;-) Matthias From ke.han@REDACTED Thu Jun 8 11:30:45 2006 From: ke.han@REDACTED (ke han) Date: Thu, 8 Jun 2006 17:30:45 +0800 Subject: FYI - SueakNOS (Squeak No Operating System) Message-ID: I have heard from time to time erlang folk talk about erlang booting off "bare metal". Just released is a bootable iso which does just this for Squeak Smalltalk. The announcement page, with good details in how they accomplished this, is: http://people.squeakfoundation.org/article/59.html Of particular interest is that further OS behavior can be written with Squeak (and/or its subset language which translates to & compiles in C). Seems a similar approach may work for an erlang OS. It would be interesting to hear from erlang VM gurus if some of what is done to support SqueakNOS is applicable to building an "erlangNOS". thanks, ke han From thomasl_erlang@REDACTED Thu Jun 8 10:46:16 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 8 Jun 2006 01:46:16 -0700 (PDT) Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <87y7w860bz.fsf@kilo.pond.sub.org> Message-ID: <20060608084616.25552.qmail@web38804.mail.mud.yahoo.com> --- Gerd Flaig wrote: > Thomas Lindgren writes: > > > This is what I consider a real Erlang problem: it > is > > fairly obscure. I'd furthermore expect things are > > worse in the US. (Some consider that a competitive > > advantage, of course. Not I.) > > as often as I hear that argument, I still don't > understand it. Anyone > you would want to hire for software development can > pick up Erlang in > a few days and OTP in four to eight weeks. Well, in essence it's one less hurdle. (Or several.) If the "industry standard" is Erlang, things get much easier for the individual manager. Less arguing with bosses, less resistance from the organization, less trouble in recruiting and training talent, ... The same basic argument goes for developers. If Erlang becomes a recruiting keyword, then having it on your resume isn't just dead space (to put it a bit drastically :-). In marketing speak, we'd like to put Erlang further to the right on the product adoption curve. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From dot@REDACTED Thu Jun 8 12:18:04 2006 From: dot@REDACTED (Tony Finch) Date: Thu, 8 Jun 2006 11:18:04 +0100 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <17543.56766.136721.827662@antilipe.corelatus.se> References: <17543.56766.136721.827662@antilipe.corelatus.se> Message-ID: On Thu, 8 Jun 2006, Matthias Lang wrote: > Joe Armstrong (AL/EAB) writes: > > > In a convential server like Apache you have to spawn one OS > > process/connection in order to protect the sessions from > > each other. This is very slow. > > http://tcl.apache.org/presentations/rivet/apache-architecture.rvt?index=13 > > Or can I clarify the original post thusly: > > | Apache should spawn one OS process per connection, and, if it did, it > | would be slow, but in actual fact it doesn't, but let's assume it does > | so that we can say it's slow. Apache *is* slow compareed to Erlang. You are right that it isn't the cost of spawning, because that's amortized. The problem is that Apache uses an OS process or a POSIX thread per connection, and context switching between them is enormously more expensive than switching between Erlang processes. Tony. -- f.a.n.finch http://dotat.at/ ST DAVIDS HEAD TO COLWYN BAY, INCLUDING ST GEORGES CHANNEL: VARIABLE BECOMING EAST OR SOUTHEAST 3 OR 4. FAIR. MODERATE OR GOOD, WITH RISK OF FOG PATCHES AT FIRST. SLIGHT. From mikpe@REDACTED Thu Jun 8 13:42:38 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 8 Jun 2006 13:42:38 +0200 (MEST) Subject: Can't compile erlang under Dell Powerdge 2850 bi-processor Message-ID: <200606081142.k58BgcQ2028638@harpo.it.uu.se> On Wed, 07 Jun 2006 15:41:53 +0200, Yann Rouillard wrote: >> > What is strange is that I already successfully compiled and used erlang >> > 10.b.9 on another computer (Pentium Pro mono-pro), but if I try to use >> > on the Powerdge the binaries compiled on the Pentium, erl segfaults. >> >> I suspect the two machines don't have the exact same libraries etc. > >Debian Sarge was installed on both machines, so I am not sure the >problem lies here. > >> You're not saying anything about the OS, C compiler, or C library versions. > >The OS is Debian Sarge, the C compiler is the default one, gcc 3.3.5. >The Linux kernel is different (it shouldn't be important here, no ?), >2.6.16 from Debian Backports on the Pentium Pro where erlang works, >2.4.27 debian one on the Dell Powerdge. > >> As a first step, configure R10B-10 with --disable-hipe and try rebuilding it. >> If that makes R10B-10 work then it's an issue with your C libraries. > >Ok --disable-hipe solved the problem. Thanks for your help. > >I still don't understand why this problem only happens on that machine. >Both machines are Debian Sarge without modification except the kernel >for the Pentium Pro machine. In most Linux systems, running a 2.4 or a 2.6 kernel affects which implementation of pthreads the C library will use: typically a 2.4 kernel causes it to use LinuxThreads while a 2.6 kernel causes it to use NPTL, but this depends on how the C library was configured when it was built. Furthermore, LinuxThreads can be configured with or without so-called "floating stacks", and with or without support for a global per-thread pointer in an x86 segment register, and I'm fairly sure that one of these configurations don't work well with HiPE/x86's signal handling stuff. FWIW, HiPE/x86 has been known to work on every RedHat/Fedora release from RH6.2 up to FC5. /Mikael From gefla@REDACTED Thu Jun 8 13:50:25 2006 From: gefla@REDACTED (Gerd Flaig) Date: Thu, 08 Jun 2006 13:50:25 +0200 Subject: Language Bindings for Erlang Again (Opinion) References: <87y7w860bz.fsf@kilo.pond.sub.org> <20060608084616.25552.qmail@web38804.mail.mud.yahoo.com> Message-ID: <87hd2v6f3y.fsf@kilo.pond.sub.org> Thomas Lindgren writes: > If the "industry standard" is Erlang, things get much > easier for the individual manager. Less arguing with > bosses, less resistance from the organization, less > trouble in recruiting and training talent, ... You're right. Of all the religions I came to know on this planet, the Industry Standard belief system is one of the weirder ones. For starters, most of its followers vehemently deny it being belief rather than science. Goodbyte, Gerd. -- The last thing one knows in constructing a work is what to put first. -- Blaise Pascal From yarivvv@REDACTED Thu Jun 8 15:00:18 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 8 Jun 2006 09:00:18 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: <17543.56766.136721.827662@antilipe.corelatus.se> Message-ID: <17244f480606080600u53c09cceqd2f4ce31b3079163@mail.gmail.com> > Apache *is* slow compareed to Erlang. You are right that it isn't the cost > of spawning, because that's amortized. The problem is that Apache uses an > OS process or a POSIX thread per connection, and context switching between > them is enormously more expensive than switching between Erlang processes. > There's no need to base one's conclusions on theoretical arguments alone. This graph tells the whole story: http://www.sics.se/~joe/apachevsyaws.html :) Yariv From yarivvv@REDACTED Thu Jun 8 15:10:47 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 8 Jun 2006 09:10:47 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <44879248.7000905@allcaps.org> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <87y7w860bz.fsf@kilo.pond.sub.org> <44879248.7000905@allcaps.org> Message-ID: <17244f480606080610x40185837v3560bfefd157ab47@mail.gmail.com> > The complete rearrangement to functional programming and message passing > does not come easily for 99% of software developers. Now, we can > argue whether you should hire people like that, but if you ignore 99% of > all developers, your language is unlikely to become very widespread. > Learning Erlang is far easier than learning C/C++/Java. Erlang processes and message passing are *far* easier to grasp than threads, threadpools, mutexes, forks, barriers, locks, producer/consumer chains, etc. Erlang tuples and functions are *far* easier to understand than convoluted C++ inhertience rules, virtual functions, memory management, pointers, auto-pointers, references, templates, template metaprogramming (yes, C++ templates are a functional code generation language) etc. Erlang data structures are much easier to use than STL equivalents. Who are those developers for whom Erlang is so hard to grasp? Is the world truly dominated only by VBScript and PHP developers? > OTP cannot be picked up in 4 to 8 weeks because its documentation sucks. > The documentation is actually very good. I agree that user comments are lacking, but Joe is working on that. An official Erlang wiki would be very helpful as well for people who aren't comfortable with mailing lists. Cheers Yariv From yarivvv@REDACTED Thu Jun 8 15:32:59 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 8 Jun 2006 09:32:59 -0400 Subject: [Erlyaws-list] yaws 1.62 In-Reply-To: <4487B14E.9020500@web.am> References: <44873FC4.40105@hyber.org> <4487B14E.9020500@web.am> Message-ID: <17244f480606080632u42543748l2be76dfb5bc2f073@mail.gmail.com> Nice work! This is a big step forward for Yaws. I suggest you take a look at haXe (http://www.haxe.org). It's a new open-source statically/dynamically typed language that you can use to compile to cross-browser Javascript, SWF and Necko (its special server-side VM). haXe really takes the pain out of Javascript/AJAX/Flash development, partly due to its excellent compiler written in OCaml. haXe has an RPC library that integrates all its runtimes, and it would be great to have a haXe RPC adapter for Yaws. Best, Yariv From mickael.remond@REDACTED Thu Jun 8 14:28:40 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 8 Jun 2006 14:28:40 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: Message-ID: <20060608122840.GB18192@memphis.ilius.fr> * Joe Armstrong (AL/EAB) [2006-06-07 10:16:58 +0200]: > In Erlang you spawn one Erlang process/connection which is a very > lightweight > operation - so FOR WEB SERVERS Erlang is *much* faster than C or php or > whatever. This is the impression you get when comparing Yaws to Apache. However, to be fair, I had the opportunity to see Zeus web server in action recently (http://www.zeus.com/products/zws/). It has been a shock. This server is really, really fast. It was more than three time faster than Yaws on simple static pages. (13000 requests per second for Zeus versus 3000 to 4000 requests per seconds for Yaws on the same hardware). To be fair, I have been told they use lot of kernel level optimisation (Like zero-copy between streams for example). A coworker tried to write a slimed down minimal (=everything hardcoded) HTTP server version, serving a hardcoded page in the code in Erlang and the result was about 8000 requests served per seconds. This gives you an idea of the level of performance of a web server like Zeus. I am not criticizing Yaws, but just wanted to share recent comparisons. -- Micka?l R?mond http://www.process-one.net/ From joe.armstrong@REDACTED Thu Jun 8 16:50:11 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 8 Jun 2006 16:50:11 +0200 Subject: Erlang on the niagara Message-ID: I've been having fun :-) How can you parallelise an existing (Erlang) program? As an experiment I parallelised my document generator, this is a program which batch converts my new wiki-file documentation format into HTML. As a small test I ran this on a directory of 63 wiki files which are converted into HTML files, totalling 1.35 MBytes of HTML (ie 21.9 KBytes/file on average) - this is a very typical batch processing task, with an extremely simple logical structure. I usually write batch converters something like this: all() -> Dir = "../wik", Files = file:files(Dir, "*.wik"), lists:foreach(fun(I) -> xform_file(I) end, Files), ... Parallelising this is easy, all I needed was a simple "parallel foreach", actually I just made a pmap (parallel map) and used that instead. pmap is easy: pmap(F, L) -> S = self(), Pids = map(fun(I) -> spawn(fun() -> do_f(S, F, I) end) end, L), gather(Pids). gather([H|T]) -> receive {H, Ret} -> [Ret|gather(T)] end; gather([]) -> []. do_f(Parent, F, I) -> Parent ! {self(), (catch F(I))}. Then I just replaced the call to lists:foreach with pmap Now I could run on the niagara. The results were as follows: #CPUs Speedup 1 0,953 2 1,855 3 2,679 4 3,44 5 4,012 6 4,624 7 5,093 8 5,46 9 5,73 10 6,11 11 6,108 12 6,47 13 6,58 14 6,8 15 6,67 16 7 17 6,99 18 7,29 19 6,97 20 6,97 21 6,74 22 6,86 23 7,07 24 6,85 What I'm measuring here is the speedup as a function of the number of schedulers enabled in the SMP erlang. The speedup factor is just computed as the pmap/foreach ratio - ie I did the conversion twice, one with foreach the second time with pmap. As you can see we get near linear speedup for 1-7 CPUs - then a gradual tailing off, with a plateau reached at 16 CPUs, above 16 CPUs we can do no better. Realistically a speedup of 7 was achieved. Why can't we speed up beyond a factor 7 - who knows? - at some stage things do get serialised, there is after all only one disk on the machine, and the SMP erlang has to serialise all disk I/O, even if the programs generating data run in parallel, also, the CPU caches will get filled and have to swap into shared memory. Nevertheless, I'm encouraged by this result? Why? because - this kind of program is a typical of a large class of programs (ie a lot of my program just do boring things to large numbers of files) Usually batch processes on individual files are sequential often there is not much intrinsic concurrency in a typical file In -> file Out program. The concurrency comes from the fact that the top loop of the program can be changed from a: forAllFiles Do ... end structure to a: forAllFiles DoInParallel ... end structure. Now this only requires a ONE LINE change to the program (change a foreach to a pmap) - My program went 7 times faster. At this stage this is very nice - usually when a program is complete there is little that can be done to speed it up - since I usually chose my data structures and algorithms with some care. Sure I *could* speed things up with messy optimised code, but the code would be less beautiful, and more difficult to maintain. Changing a foreach to a pmap means the programs goes faster (x 7) AND stays beautiful - the best of both worlds. From yerl@REDACTED Thu Jun 8 17:14:43 2006 From: yerl@REDACTED (yerl@REDACTED) Date: Thu, 8 Jun 2006 17:14:43 +0200 Subject: Language Bindings for Erlang Again (Opinion) Message-ID: An HTML attachment was scrubbed... URL: From mbpaz@REDACTED Thu Jun 8 17:58:52 2006 From: mbpaz@REDACTED (Miguel Barreiro Paz) Date: Thu, 08 Jun 2006 17:58:52 +0200 Subject: Erlang on the niagara In-Reply-To: References: Message-ID: <4488493C.1000102@lambdastream.com> Joe Armstrong (AL/EAB) wrote: > I've been having fun :-) Indeed you have... > Realistically a speedup of 7 was achieved. > > Why can't we speed up beyond a factor 7 - who knows? - at some stage By Niagara you mean a Sun T1000/T2000? These beasties features eight cores, each of them with 4 "threads". Forget about "processor threads" and it's pretty consistent with your numbers. Regards, Miguel From mickael.remond@REDACTED Thu Jun 8 18:00:25 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 8 Jun 2006 18:00:25 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: <20060608122840.GB18192@memphis.ilius.fr> Message-ID: <20060608160025.GF23198@memphis.ilius.fr> * Tony Finch [2006-06-08 16:53:34 +0100]: > Zeus has its own concurrency mechanism (mostly based on select rather than > threads) and it's highly tuned for being an HTTP server. So, not > surprising it's fast. Yes of course. It has even some kernel based optimisation. My point was just to share this experience and put it into the debate. -- Micka?l R?mond http://www.process-one.net/ From markm@REDACTED Thu Jun 8 18:04:41 2006 From: markm@REDACTED (Mark S. Miller) Date: Thu, 08 Jun 2006 09:04:41 -0700 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <10851539.7111149567934607.JavaMail.root@zimbra> References: <10851539.7111149567934607.JavaMail.root@zimbra> Message-ID: <44884A99.1030007@cs.jhu.edu> Michael FIG wrote: > I am writing because I think that E uses an excellent architecture > for sending messages between mutually-untrusting components (based > on _promises_, also known as _refs_ or _vows_), and because I like > Erlang (it is fun to write applications using a dynamically-typed > functional language). Hi Michael, I also like Erlang a lot, and I agree that there are many connections between it and E. Peter van Roy (one of Oz's creators), in "Convergence in Language Design: A Case of Lightning Striking Four Times in the Same Place", makes some comparisons between Erlang, E, and Oz at and . Section 24.2 (p. 187) of my thesis, at says: > Joe Armstrong's Making Reliable Distributed Systems in the Presence of > Software Errors [Arm03] explains the design and rationale for the > Erlang language. Erlang has many similarities with E. Erlang is a > dynamically type safe distributed language, inspired by Actors, and > based on communicating asynchronous messages between encapsulated > processes. It was designed for writing systems that remain reliable > despite software errors. Erlang has been in commercial use at Ericsson > as the basis for their highly reliable (five nines) telephone > switching products. This represents an empirical demonstration of > robustness *well* beyond anything we have accomplished. One particular > notable accomplishment of Erlang---well beyond anything in E but > needed for E to achieve its goals---is Erlang's support for robustly > upgrading code in a running system. I believe the E and Erlang efforts have much to learn from each other. I have certainly learned much of value from Erlang already, and have encouraged others to do likewise. I think the questions you and Bengt Kleberg are asking, of how to embed elements of E's semantics into Erlang, and what (if anything) this would contribute to Erlang, are an excellent way to start exploring these issues. > In my mind, the only things that would need to be changed in Erlang > in order to support E's semantics would be syntax to send E-style > messages (that result in a promise), a construct to invoke code when > promises are fulfilled, and a flag to indicate that a specific > process is untrusted and may only interact with the rest of the > system by receiving and sending E-style messages. I would like to discourage you from starting with syntax. First, try creating an Erlang library exporting operations that correspond to E's primitives. Then ask what value (if any) these add to Erlang. I think you have correctly identified the two areas where E's ideas may contribute to Erlang: concurrency control and security. More on these below. > The advantage to the E community would be yet another implementation and > popularization of E. We try to be careful to distinguish between two ways to adapt E to other language platforms. One is to port E onto the other platform (E-on-Java, E-on-CL, E-on-Squeak, E-on-C), so that existing E programs (ideally) run compatibly. The other is to adapt the other platform so that it may benefit from ideas derived from E (Joe-E, Twisted Python, Squeak-E, Emily, Oz-E, CaPerl, etc). From your message, I gather that you are not actually proposing "another implementation" of E, but rather an adaptation of E ideas to Erlang. I think this is a wise choice. While E-on-Erlang would also be an interesting project, and one that I'd love to see happen, it would probably teach each community less about the other. > The advantage to the Erlang community would be a robust model for > secure distribution and a mechanism for executing untrusted Erlang > code which is far more effective than "sandboxing" techniques. > Initially, I only want to define the syntax and semantics and > implement them in Erlang... adding cryptography and compatibility > with the existing Elib is something that I would like to defer until > later. I would drop compatibility as a goal from the project you have in mind. Again, this would be more appropriate to an E-on-Erlang project, which would be quite a different effort. > I am prepared to work on the implementation, but I do need to hear > what people in each community think about this. I would like to > come up with something that both communities are happy with, so that > we can work together. I for one think this is a great idea! Please continue to post on your progress and any questions you have. Bengt Kleberg wrote: > presumably this only shows my ignorance, but i hope that it will be > possible to reduce it after this question :-) > > why do erlang need a special syntax to send e-style messages? what > does this add that the normal send (!) does not have? why do erlang > need a special syntax to receive e-style messages? what does this > add that the normal receive does not have? As I said to Michael, I think any attempt to provide special syntax should be postponed. Regarding concurrency control, E's event-loops are non-blocking. By contrast, the preferred Erlang style for sending a request and receiving a response is for the requesting process to do a blocking receive that is receptive only to the alleged response (where the alleged response is distinguished from other requests by convention). This would seem to leave networks of Erlang processes vulnerable to deadlock. Continuing with section 24.2 of my thesis: > Although Erlang was inspired by Actors, a common programming pattern > in Erlang is for a process to block waiting for a reply to a > previous request. While blocked, the process is not responsive to > other requests. This is like the "message-oriented systems" of Lauer > and Needham [LN79] rather than the non-blocking event loops of E. > [LN79] Hugh C. Lauer and Roger M. Needham. On the Duality of > Operating System Structures. In Proc. 2nd International Symposium on > Operating Systems, pages 3--19. IRIA, October 1979. ACM Operating > System Review. However, if Erlang systems don't seem to be vulnerable to deadlock in practice, the Erlang community may not find the above difference compelling. OTOH, I consider the following issue urgent: > Although Erlang is not engineered to provide robustness against > malice, it seems to be an object-capability language. Erlang > processes are encapsulated objects and processIds are unforgeable > capabilities, providing the right to send messages to a process. The > rules by which processIds are transmitted and acquired seem to be > precisely object-capability rules. Most importantly, the language > has no global scope. Each process has its own separate state. > Unfortunately, a process has only one processId, so the common > convention is for making a request and receiving a reply is for the > client to include its own processId in the message as a reply > port. This gives the provider the authority, not only to reply to > the client, but to invoke the client. It is not clear how to repair > this convention within the overall Erlang framework. This issue seems fundamental. It cannot be fixed either by syntax or by a library. Until it is fixed, I don't see how to write practical Erlang programs with distributed object-capability security properties. -- Cheers, --MarkM From david.nospam.hopwood@REDACTED Thu Jun 8 19:01:23 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 08 Jun 2006 18:01:23 +0100 Subject: Erlang on the niagara In-Reply-To: References: Message-ID: <448857E3.7050508@blueyonder.co.uk> Joe Armstrong (AL/EAB) wrote: > The results were as follows: > > #CPUs Speedup > 1 0,953 > 2 1,855 > 3 2,679 > 4 3,44 > 5 4,012 > 6 4,624 > 7 5,093 > 8 5,46 > 9 5,73 > 10 6,11 > 11 6,108 > 12 6,47 > 13 6,58 > 14 6,8 > 15 6,67 > 16 7 [...] That's not too shabby, for a single-line change. > Why can't we speed up beyond a factor 7 - who knows? - at some stage > things do get serialised, there is after all only one disk on the > machine, and the SMP erlang has to serialise all disk I/O, even if the > programs generating data run in parallel, [...] Do you mean that it does disk I/O in a single OS thread, or with a mutex around the I/O code, or just that the I/O is serialized at the hardware bus level? -- David Hopwood From vladdu55@REDACTED Thu Jun 8 20:35:51 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 8 Jun 2006 19:35:51 +0100 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <44884A99.1030007@cs.jhu.edu> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> Message-ID: <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> Hi! If I may add a few observations: > > Although Erlang is not engineered to provide robustness against > > malice, it seems to be an object-capability language. Erlang > > processes are encapsulated objects and processIds are unforgeable > > capabilities, providing the right to send messages to a process. The > > rules by which processIds are transmitted and acquired seem to be > > precisely object-capability rules. Most importantly, the language > > has no global scope. Each process has its own separate state. No, process ids are actually forgeable... For remote pids one has to find out the internal value to use as first argument for c:pid/3, but even that one could be found by trial and error. > > Unfortunately, a process has only one processId, so the common > > convention is for making a request and receiving a reply is for the > > client to include its own processId in the message as a reply > > port. This gives the provider the authority, not only to reply to > > the client, but to invoke the client. It is not clear how to repair > > this convention within the overall Erlang framework. > > This issue seems fundamental. It cannot be fixed either by syntax or > by a library. Until it is fixed, I don't see how to write practical > Erlang programs with distributed object-capability security > properties. Maybe I am completely missing the point, but I think it is possible to build a system that matches at least some of these requirements (I include here the non-blocking event loop). I am thinking about a setup where an "e-process" is actually composed from several erlang processes: one for receiving events, one to do the actual job, and maybe some more. best regards, Vlad From ulf@REDACTED Thu Jun 8 20:44:12 2006 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 08 Jun 2006 20:44:12 +0200 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <44884A99.1030007@cs.jhu.edu> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> Message-ID: Den 2006-06-08 18:04:41 skrev Mark S. Miller : > Regarding concurrency control, E's event-loops are non-blocking. By > contrast, the preferred Erlang style for sending a request and > receiving a response is for the requesting process to do a blocking > receive that is receptive only to the alleged response (where the > alleged response is distinguished from other requests by > convention). This would seem to leave networks of Erlang processes > vulnerable to deadlock. Continuing with section 24.2 of my thesis: > >> Although Erlang was inspired by Actors, a common programming pattern >> in Erlang is for a process to block waiting for a reply to a >> previous request. While blocked, the process is not responsive to >> other requests. This is like the "message-oriented systems" of Lauer >> and Needham [LN79] rather than the non-blocking event loops of E. > >> [LN79] Hugh C. Lauer and Roger M. Needham. On the Duality of >> Operating System Structures. In Proc. 2nd International Symposium on >> Operating Systems, pages 3--19. IRIA, October 1979. ACM Operating >> System Review. > However, if Erlang systems don't seem to be vulnerable to deadlock in > practice, the Erlang community may not find the above difference > compelling. You could read and perhaps comment on my presentation at EUC 05: Structured Network Programming (http://www.erlang.se/euc/05/1500Wiger.ppt), where I take a basic telephony problem ("complex concurrency") and implement it both using selective receive and in an event-driven, non-blocking fashion. One of the things to note is that while it is possible to accomplish low-level deadlocks, the application-level concurrency issues are the really hairy ones. You may well accomplish an application-level deadlock even with a fully non-blocking, event-driven design. These deadlocks are extremely difficult to foresee and debug. I argue that non-blocking event-driven programming can lead to a complexity explosion in certain situations. This is hardly an original idea. Mike Williams, Bjarne D?cker and others wrote about this already in the late 70's, I believe (at least in internal Ericsson documents.) However, it's not that well covered in teaching material. In Erlang, programmers tend to learn pretty quickly to insert timeout guards on receive statements most of the time. If one uses gen_servers, there's a built-in 5-second timeout. This way, your processes will crash rather than deadlock, which at least gives you a clear indicator that something went wrong, and sometimes even lets the program continue. BR, Ulf Wiger -- Ulf Wiger From ulf@REDACTED Thu Jun 8 20:45:31 2006 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 08 Jun 2006 20:45:31 +0200 Subject: Erlang on the niagara In-Reply-To: <448857E3.7050508@blueyonder.co.uk> References: <448857E3.7050508@blueyonder.co.uk> Message-ID: Den 2006-06-08 19:01:23 skrev David Hopwood : > Joe Armstrong (AL/EAB) wrote: >> Why can't we speed up beyond a factor 7 - who knows? - at some stage >> things do get serialised, there is after all only one disk on the >> machine, and the SMP erlang has to serialise all disk I/O, even if the >> programs generating data run in parallel, [...] > > Do you mean that it does disk I/O in a single OS thread, or with a mutex > around the I/O code, or just that the I/O is serialized at the hardware > bus level? AFAIK, the whole I/O subsystem in OTP R11B is protected with a single big mutex. BR, Ulf W -- Ulf Wiger From yarivvv@REDACTED Thu Jun 8 21:09:22 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 8 Jun 2006 15:09:22 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060608122840.GB18192@memphis.ilius.fr> References: <20060608122840.GB18192@memphis.ilius.fr> Message-ID: <17244f480606081209g366196cbped3b0c94a74c518b@mail.gmail.com> > It has been a shock. This server is really, really fast. > It was more than three time faster than Yaws on simple static pages. > (13000 requests per second for Zeus versus 3000 to 4000 requests per > seconds for Yaws on the same hardware). > > To be fair, I have been told they use lot of kernel level optimisation > (Like zero-copy between streams for example). > A coworker tried to write a slimed down minimal (=everything hardcoded) > HTTP server version, serving a hardcoded page in the code in Erlang and > the result was about 8000 requests served per seconds. > This gives you an idea of the level of performance of a web server like > Zeus. > I am not criticizing Yaws, but just wanted to share recent comparisons. > Does Zeus run in user space or kernel space? It's not suprising that a C server (esp one than runs in kernel space) can outperform an Erlang server on static content, but what about dynamic content? Regards, Yariv From tobbe@REDACTED Fri Jun 9 00:03:15 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 09 Jun 2006 00:03:15 +0200 Subject: trapexit.org is moving Message-ID: JFYI: www.trapexit.org has been moved from its original home and is unfortunately not in a good shape anymore. However, it should still be possible to access and read the existing HowTo's. It has been some discussions lately on the list about the slow spread of Erlang, the lack of good community web-sites etc. trapexit was an attempt to remedy the latter. Unfortunately, the response has not been what I was hoping for. A few heroic contributers has showed up with HowTo's (thank you guys!), and one person has shown any interest in helping out with the trapexit stuff (thanks Bengt!). But really, to me it has been a big disappointment. Perhaps it is a chicken/egg problem (small community, small amount of contributions); I don't know. Anyway, perhaps trapexit can come alive some other time, and if anyone would like to take over the trapexit.org domain name, then let me know. Cheers, Tobbe From pihentagy@REDACTED Fri Jun 9 01:01:12 2006 From: pihentagy@REDACTED (Gergely Kontra) Date: Fri, 9 Jun 2006 01:01:12 +0200 Subject: slightly off: bittorrent client Message-ID: Hi! A week ago I was told about erlang, and I was impressed the speed of the code, and finding another ML. But for now, I just want to replace my CPU eater bittorrent client to replace with an erlang one (I've found a message about that on this ML's archive), but I couldn't find any guide how to set it up. I have installed erlang and yaws from package under debian, and don't know where to hunt for docs. thanks -- +-[ Gergely Kontra http://www.mcl.hu/~kgergely ]------+ | PhD Student (Room:IB113) PGP ID: 0x7E3846BF Mobile:(+36 20)356 9656 | | Budapest University of Technology and Economics ICQ# 175564914 | +------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+ From bsder@REDACTED Fri Jun 9 02:29:40 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 08 Jun 2006 17:29:40 -0700 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: Message-ID: <4488C0F4.2060606@allcaps.org> Joe Armstrong (AL/EAB) wrote: >> OTP cannot be picked up in 4 to 8 weeks because its >> documentation sucks. > > Now I could write several pages here, since I wrote a lot of the > documentation > I would find it rather helpful to know which part "sucks" - please send > me a list > of errata or tell me exactly which parts of the documentation you are > having problems > with. "Sucks" is probably too strong a word. It connotes incorrect information. "Unhelpful" is probably closer. If you know what you need, it is okay. If you only kinda vaguely know what you are looking for, it is problematic. The main questions the current documentation does not answer are: Why do you use module/feature/application X? When do you use module/feature/application X? When do you *not* use module/feature/application X? What are the important features X which you want to pay attention to? Your tutorial code is better documentation than the reference manual because it provides *context*. Learning Erlang from the reference manual is like learning English by reading a dictionary with very few example sentences. It can be done with enough motivation, but there are much better ways. You (IIRC) posted a very nice comment about OTP explaining that gen_server was meant to organize the code for a large project to provide an overall structure and is probably overkill for a single person. That's a tremendously useful insight that is completely missing from the documentation. How about basic idioms in the language? a la. the Python and Perl cookbooks. Where are they stored? Who has them? What are the good idioms? What are the bad idioms? Why do I have to go to the Scheme cookbook to find the Erlang cookbook? Why isn't that in the Erlang wiki? Or linked directly from the Erlang website. Is the Erlang wiki even updated anymore? Why is search broken on the mailing list? http://www.erlang.org/cgi-bin/marc-search.cgi?ml-archive%2Ferlang-questions All of this leads to the sense of corporate abandonware when you start digging unless you dig deep. Thank heavens for everybody on the mailing list. > IHMO the *amazing* thing is the large number of people who have > understood the documentation > and built pretty impressive system *without ever asking any questions on > this list* > > These are the people who's first question to this list is something like > "I have set up > a 20 machine cluster, and a fragmented mnesia table, and when two of the > machine crash > I need to ..." - and you wonder - how the heck did they get that far > *without* asking any > questions - well done guys - at least *somebody* must have read the > manual. Yes, it is amazing. I managed to compress 12,000 lines of Java code into about 1,000 lines of Erlang code. Does that make my code good? No. Does that mean that I am using the language properly? No. How many bugs am I going to have to kill because the architecture I chose does not really quite map onto Erlang structure? Quite a few (already I'm thinking about rewriting one section now that I understand things better). >> Why do I use OTP? When do I use OTP? When do I *not* use OTP? >> >> A reference manual like we currently have is merely a first step. >> Something on the list like "Guru of the Week" was for C++ >> would be useful and wouldn't require the publication of a book. >> > > What would you like - what I am planning is an interactive version > of *all* the documentation - ie every document becomes a "forum" > where you can interact with the documents. We don't need to interact with the documents; we need to interact with the experts. Guru of the Week (GotW) was an ongoing discussion in comp.lang.c++.moderated (I think) where some of the experts would pose a question on the mailing list about something they bumped into while coding and then detail their attempts to solve it. Surprisingly, many of the questions considered turned out to be much more involved than expected. By watching the experts (and how they solved things), good C++ style got disseminated. >>>> I'd like to see some good books on "modern erlang/otp" >>>> for example. >>> Yes, something like Practical Common Lisp, only for Erlang. >> Ayup. That would be nice. > > Books are in the pipeline Cool. I'd be happy to help proof. -a From markm@REDACTED Fri Jun 9 02:34:24 2006 From: markm@REDACTED (Mark S. Miller) Date: Thu, 08 Jun 2006 17:34:24 -0700 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> Message-ID: <4488C210.6050309@cs.jhu.edu> Vlad Dumitrescu wrote: > No, process ids are actually forgeable... For remote pids one has to > find out the internal value to use as first argument for c:pid/3, but > even that one could be found by trial and error. This is unfortunate. My assumption that they were unforgeable was based on existing Erlang documents, but I'm not sure which. (Perhaps Armstrong's thesis?) In order to function as distributed cryptographic capabilities, pids should not be feasibly forgeable or spoofable. The approach taken by E and the Web Calculus is to make a crypto-cap not feasibly spoofable by including a public key fingerprint, such that the entity designated by the cap must prove it knows the corresponding private key in a handshake setting up a secure session. We make crypto-caps not feasibly forgeable by including a so-called "Swiss Number" -- an unguessable randomly chosen number. Swiss Numbers are only revealed over sessions set up by the above handshake. There are other approaches to crypto-caps, some of which arguably have better security properties. AFAICT from the Erlang readings I've done, all this could be provided for Erlang without affecting the semantics at all. Would it break anything? Would such a change be upwards compatible? Among Erlang processes running within one host OS process, I would hope pids could be able to be absolutely unforgeable and unspoofable by safe language rules without resorting to crypto. >> This issue seems fundamental. It cannot be fixed either by syntax or >> by a library. Until it is fixed, I don't see how to write practical >> Erlang programs with distributed object-capability security >> properties. > > Maybe I am completely missing the point, but I think it is possible to > build a system that matches at least some of these requirements (I > include here the non-blocking event loop). > > I am thinking about a setup where an "e-process" is actually composed > from several erlang processes: one for receiving events, one to do the > actual job, and maybe some more. On practicality, perhaps I am underestimating how lightweight Erlang processes are. If they are lightweight enough, then this approach would work. To whit: When Erlang process X wishes to make a request and receive a response from process Y, X would make a new use-once process X2 which knows X's pid. X would then include X2's pid in the message to Y. When Y responds to X2, X2 would then wrap Y's response with a tag and send this response to X. Either these tags can themselves be unforgeable, or X's clients would also need to go through a tagging intermediate process so that a client couldn't send a message that X would mistake for Y's tagged response. I think it works for X2 to tag the message with X2's (presumed unforgeable) pid, since anyone who has that pid can respond on behalf of Y anyway. With enough care, X could reuse X2 for successive requests to Y. But if X wants to make requests of Z, it would need a separate X3 for that purpose. Otherwise, it enables Y to issues Z's response, and vice versa. The above scheme would meet the hard requirements. But how practical would it be? -- Text by me above is hereby placed in the public domain Cheers, --MarkM From markm@REDACTED Fri Jun 9 02:54:06 2006 From: markm@REDACTED (Mark S. Miller) Date: Thu, 08 Jun 2006 17:54:06 -0700 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> Message-ID: <4488C6AE.8020500@cs.jhu.edu> Ulf Wiger wrote: > You could read and perhaps comment on my presentation at EUC 05: > > Structured Network Programming > (http://www.erlang.se/euc/05/1500Wiger.ppt), where I take a basic > telephony problem ("complex concurrency") and implement it both using > selective receive and in an event-driven, non-blocking fashion. One of > [...] Mike Williams, Bjarne D?cker and others > wrote about this already in the late 70's, I believe (at least in > internal Ericsson documents.) However, it's not that well covered in > teaching material. I am overjoyed to encounter a realistic challenge problem. Thank you! However, I am not able to understand it well enough from these slides to respond. I have googled "Mike Williams, Bjarne D?cker" and found many hits, but it's not clear which if any of these are relevant. Do you know of any documents explaining this or a related problem in enough detail that I might try expressing a solution in E? Btw, I am not claiming that non-monotonic[*] selective receive is never useful. In my experience so far, I have found it useful only once, but that one time I did find it essential. My claim is only that it is the wrong default. Unfortunately, this weaker claim is also much harder to evaluate. We'll see if this challenge problem helps us do so. [*] E's promises provide a limited monotonic form of selective receive, which often provides the synchronization that one needs from selective receive, but with reduced danger of deadlock. If this turns out to be relevant, I will explain further. -- Text by me above is hereby placed in the public domain Cheers, --MarkM From bsder@REDACTED Fri Jun 9 03:11:48 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Thu, 08 Jun 2006 18:11:48 -0700 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: Message-ID: <4488CAD4.6080207@allcaps.org> Joe Armstrong (AL/EAB) wrote: >> The complete rearrangement to functional programming and >> message passing >> does not come easily for 99% of software developers. Now, >> we can argue whether you should hire people like that, but if >> you ignore 99% of all developers, your language is unlikely >> to become very widespread. > > What are you basing this number of 99.9% on? Having lectured about different functional programming languages to audiences which were more oriented toward what I consider to be "average" programmers. > The people attending our courses were regular Ericsson programmers - not > computer scientists, most of them programmed in Plex (an Ericsson > internal language) > and C. Very few had a computer science background and only a few had > every tried > "esoteric languages" like lisp or Prolog. What does "not computer scientists" mean? What are the likely qualifications of a "regular" Ericsson programmer? I find it unlikely that these programmers would qualify as average on any measure. I find it more likely that these programmers qualify closer to "excellent" than "good". That, at least, has been my experience with programmers who can do protocol stacks and heavy hardware programming. > In most cases I observed that "a good programmer in X" will become "a > good programmer in Y" > (for all X and Y) this appears to be universally true. No argument. > with dynamic hash tables - the only problem in switching languages is > learning the libraries>> Ayup. > Our pupils had two minor problems. > > - recursion, and > - write once variables > - processes > > Now recursion was only a problem IF YOU USED THE WORD RECURSION - it > seemed like > somewhere lurking at the back of their brains was the idea that > "recursion is difficult" > and the word "recursion" triggered an immune response - we tried never > to mention it. I'll keep that in mind about recursion. That's probably good advice no matter what the functional language is. You left out "pattern matching"--I find this to be a more fundamental problem. This tells me that your groups have selection bias. Folks working on protocol stacks understand finite state automata inside and out. "Average" programmers have no such background. This is a problem even when teaching languages like Java and trying to explain regular expressions. > Now I could write several pages here, since I wrote a lot of the > documentation > I would find it rather helpful to know which part "sucks" - please send > me a list > of errata or tell me exactly which parts of the documentation you are > having problems > with. How, when and why to use gen_server should be in the documentation. How, when and why to use gen_fsm should be in the documentation. etc. These aren't easy questions. They take lots of writing. They take motivating examples. I'm well aware that coming up with such docs is a pain in the butt (I wrote much of the tutorials on FFI calls in OpenMCL). However, they are really useful to those new people coming into the language for the first time. -a From dot@REDACTED Fri Jun 9 03:26:33 2006 From: dot@REDACTED (Tony Finch) Date: Fri, 9 Jun 2006 02:26:33 +0100 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <4488C210.6050309@cs.jhu.edu> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> <4488C210.6050309@cs.jhu.edu> Message-ID: On Thu, 8 Jun 2006, Mark S. Miller wrote: > > When Erlang process X wishes to make a request and receive a response from > process Y, X would make a new use-once process X2 which knows X's pid. X would > then include X2's pid in the message to Y. When Y responds to X2, X2 would > then wrap Y's response with a tag and send this response to X. > [...] > The above scheme would meet the hard requirements. But how practical would it > be? Ignoring efficiency, this has a similar effect to E's facets: it allows you to be more careful about leaking authority than the default message passing syntax, but it's a lot more clunky. The bigger problem (probably a consequence of the clunkiness) is that the standard libraries and code-structure idioms don't work in this object-capability way. Tony. -- f.a.n.finch http://dotat.at/ HUMBER THAMES DOVER: EAST OR SOUTHEAST 4 OR 5. FAIR. MODERATE OR GOOD, WITH FOG PATCHES AT FIRST IN HUMBER. From yarivvv@REDACTED Fri Jun 9 04:16:16 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 8 Jun 2006 22:16:16 -0400 Subject: dets improvements? Message-ID: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> Hi list, I hope I'm not bringing it up too many times but I figured I'll give one last shot trying to get an answer... Is the OTP team planning on making the dets improvements discussed in this thread? http://erlang.org/ml-archive/erlang-questions/200606/msg00161.html. (To quote Claes: "Should also be done - now.") I ask because I think it's important to at least have some indication this will be resolved at some point before seriously promoting Erlang to the "general public" (I guess some people would prefer keeping Erlang as little known "secret weapon" but that's a whole other debate :) ) Otherwise, I can see people's reaction: "Erlang looks very interesting but I can't afford to keep all my data in RAM and Mnesia's disc storage isn't up to par with MySQL/Postgres/Oracle, so I think I'll stick with PHP/Java." I confess that I also have a more selfish reason and that is I need to decide whether to use Erlang or Ruby for a hobby project and since *I* can't afford gigs of RAM (hosted server) and I don't want to risk broken dets tables taking hours to rebuild, I may have to go with Ruby. Best regards, Yariv From david.nospam.hopwood@REDACTED Fri Jun 9 04:17:36 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 03:17:36 +0100 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <44889F4E.9030905@cs.jhu.edu> References: <44889F4E.9030905@cs.jhu.edu> Message-ID: <4488DA40.9090603@blueyonder.co.uk> Ulf Wiger wrote: > Mark S. Miller wrote: >> Continuing with section 24.2 of my thesis: >> >>>Although Erlang was inspired by Actors, a common programming pattern >>>in Erlang is for a process to block waiting for a reply to a >>>previous request. While blocked, the process is not responsive to >>>other requests. This is like the "message-oriented systems" of Lauer >>>and Needham [LN79] rather than the non-blocking event loops of E. >> >>>[LN79] Hugh C. Lauer and Roger M. Needham. On the Duality of >>>Operating System Structures. In Proc. 2nd International Symposium on >>>Operating Systems, pages 3--19. IRIA, October 1979. ACM Operating >>>System Review. >> >> However, if Erlang systems don't seem to be vulnerable to deadlock in >> practice, the Erlang community may not find the above difference >> compelling. > > You could read and perhaps comment on my presentation at EUC 05: > > Structured Network Programming > (http://www.erlang.se/euc/05/1500Wiger.ppt), where I take a basic > telephony problem ("complex concurrency") and implement it both using > selective receive and in an event-driven, non-blocking fashion. It may be instructive to show how this example would be handled in E. The executive summary is that E can implement it with the "non-blocking restriction" just as straightforwardly as the blocking code, even though E does not support selective receive: # Like the Erlang example, we don't handle errors. # The hardware, which can be controlled asynchronously. def lim { to startTone(tone :String) { ... } to stopTone() { ... } to startRinging() { ... } } def makePOTS() { return def pots { # Declare the states, to avoid forward references... def waiting, idle, getting_first_digit, ringing_B_side, calling_B, ringing_A_side, speech # The peer we are connecting to. var B # The number being dialed. var number :String := "" # This is just a way to make a process that has different behaviours # over time look like a single object. var state := idle match [verb, args] { E.call(state, verb, args) } # Now define the states... # waiting is a dummy state used while we are waiting for the hardware. # (In a real example there would have to be a way of getting out of this # state if the hardware fails, but the Erlang code doesn't deal with that # either.) bind waiting {} bind idle { to offhook() { state := waiting when (lim <- startTone("dial")) -> { state := getting_first_digit } } to digit() { # ignore } to requestConnection(peer) { # This is a literal interpretation of the Erlang code, but it is # not what should be done in E for security reasons -- the peer # should only get a facet, not full access to the pots object. peer <- accept(pots) state := waiting B := peer when (lim <- startRinging()) -> { state := ringing_B_side } } # we don't need to match unexpected messages here, but we could. } bind getting_first_digit { to onhook() { state := waiting when (lim <- stopTone()) -> { state := idle } } to digit(d) { state := waiting when (lim <- stopTone()) -> { # the Erlang code seemed to be missing some context, but # this is probably about right... number := analyse(number, d, validSequences()) state := getting_number } } to requestConnection(peer) { # same security comment as above peer <- reject(pots) } } bind calling_B { to onhook() { state := idle } to digit(d) { # ignore } to accept(peer) { state := waiting B := peer when (lim <- startTone("ring")) -> { state := ringing_A_side } } to reject(peer) { state := waiting peer := null when (lim <- startTone("busy")) -> { state := wait_on_hook } } to requestConnection(peer) { # same security comment as above peer <- reject(pots) } } ... # more states, also not shown in Erlang code } } The differences from the Erlang code are mainly due to a different encoding of the state machine (using an explicit state rather than tail recursion), and are not fundamental. However, although this code has the same structure as the blocking Erlang example, it never blocks, and it cannot be subject to a low-level deadlock. > One of the things to note is that while it is possible to accomplish low-level > deadlocks, the application-level concurrency issues are the really hairy > ones. You may well accomplish an application-level deadlock even with a > fully non-blocking, event-driven design. True -- as I've written it above, the 'waiting' state can cause an application-level deadlock if the hardware never responds to a request. But note that I was effectively forced to make this state explicit. > In Erlang, programmers tend to learn pretty quickly to insert timeout > guards on receive statements most of the time. If one uses gen_servers, > there's a built-in 5-second timeout. This way, your processes will crash > rather than deadlock, which at least gives you a clear indicator that > something went wrong, and sometimes even lets the program continue. I think timeouts are almost always the wrong thing and tend to be overused, but that's a different discussion. -- David Hopwood From david.nospam.hopwood@REDACTED Fri Jun 9 04:47:00 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 03:47:00 +0100 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <4488C210.6050309@cs.jhu.edu> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> <4488C210.6050309@cs.jhu.edu> Message-ID: <4488E124.7060006@blueyonder.co.uk> Mark S. Miller wrote: > Vlad Dumitrescu wrote: > >>No, process ids are actually forgeable... For remote pids one has to >>find out the internal value to use as first argument for c:pid/3, but >>even that one could be found by trial and error. > > This is unfortunate. My assumption that they were unforgeable was based on > existing Erlang documents, but I'm not sure which. (Perhaps Armstrong's thesis?) > > In order to function as distributed cryptographic capabilities, pids should > not be feasibly forgeable or spoofable. The approach taken by E and the Web > Calculus is to make a crypto-cap > not feasibly spoofable by including a public key fingerprint, such that the > entity designated by the cap must prove it knows the corresponding private key > in a handshake setting up a secure session. We make crypto-caps not feasibly > forgeable by including a so-called "Swiss Number" -- an unguessable randomly > chosen number. Swiss Numbers are only revealed over sessions set up by the > above handshake. There are other approaches to crypto-caps, some of which > arguably have better security > properties. > > AFAICT from the Erlang readings I've done, all this could be provided for > Erlang without affecting the semantics at all. Would it break anything? Would > such a change be upwards compatible? See the following erlang-questions thread: The most serious incompatibilities would be - removing the ability to enumerate processes - registering processes by name in a global namespace, which is quite common in Erlang programs, is not consistent with capability discipline. -- David Hopwood From markm@REDACTED Fri Jun 9 06:08:40 2006 From: markm@REDACTED (Mark S. Miller) Date: Thu, 08 Jun 2006 21:08:40 -0700 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488DA40.9090603@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> Message-ID: <4488F448.2070009@cs.jhu.edu> # David's code reformatted so it parses correctly. No substantive changes. # David, what is B for? It is never used? pragma.disable("explicit-result-guard") pragma.enable("easy-return") # Like the Erlang example, we don't handle errors. # The hardware, which can be controlled asynchronously. def lim { to startTone(tone :String) { "..." } to stopTone() { "..." } to startRinging() { "..." } } def makePOTS() { # Declare the states, to avoid forward references... def waiting def idle def getting_first_digit def ringing_B_side def calling_B def ringing_A_side def speech # The peer we are connecting to. var B := null # The number being dialed. var number :String := "" # Together with the match clause in the definition of pots below, # this is just a way to make a process that has different behaviours # over time look like a single object. var state := idle def pots # Now define the states... # waiting is a dummy state used while we are waiting for the hardware. # (In a real example there would have to be a way of getting out of this # state if the hardware fails, but the Erlang code doesn't deal with that # either.) bind waiting {} bind idle { to offhook() { state := waiting when (lim <- startTone("dial")) -> { state := getting_first_digit } } to digit() { # ignore } to requestConnection(peer) { # This is a literal interpretation of the Erlang code, but it is # not what should be done in E for security reasons -- the peer # should only get a facet, not full access to the pots object. peer <- accept(pots) state := waiting B := peer when (lim <- startRinging()) -> { state := ringing_B_side } } # we don't need to match unexpected messages here, but we could. } bind getting_first_digit { to onhook() { state := waiting when (lim <- stopTone()) -> { state := idle } } to digit(d) { state := waiting when (lim <- stopTone()) -> { # the Erlang code seemed to be missing some context, but # this is probably about right... number := analyse(number, d, validSequences()) state := getting_number } } to requestConnection(peer) { # same security comment as above peer <- reject(pots) } } bind calling_B { to onhook() { state := idle } to digit(d) { # ignore } to accept(peer) { state := waiting B := peer when (lim <- startTone("ring")) -> { state := ringing_A_side } } to reject(peer) { state := waiting peer := null when (lim <- startTone("busy")) -> { state := wait_on_hook } } to requestConnection(peer) { # same security comment as above peer <- reject(pots) } } #... more states, also not shown in Erlang code bind pots { match [verb, args] { E.call(state, verb, args) } } return pots } From david.nospam.hopwood@REDACTED Fri Jun 9 06:35:37 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 05:35:37 +0100 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488DA40.9090603@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> Message-ID: <4488FA99.7000802@blueyonder.co.uk> David Hopwood wrote: > It may be instructive to show how this example would be handled in E. > The executive summary is that E can implement it with the "non-blocking > restriction" just as straightforwardly as the blocking code, even though > E does not support selective receive: > > # Like the Erlang example, we don't handle errors. > > # The hardware, which can be controlled asynchronously. > def lim { > to startTone(tone :String) { ... } > to stopTone() { ... } > to startRinging() { ... } > } > > def makePOTS() { ^ :any > return def pots { > # Declare the states, to avoid forward references... > def waiting, idle, getting_first_digit, ringing_B_side, calling_B, > ringing_A_side, speech > > # The peer we are connecting to. > var B > > # The number being dialed. > var number :String := "" > > # This is just a way to make a process that has different behaviours > # over time look like a single object. > var state := idle > match [verb, args] { E.call(state, verb, args) } > > # Now define the states... > > # waiting is a dummy state used while we are waiting for the hardware. > # (In a real example there would have to be a way of getting out of this > # state if the hardware fails, but the Erlang code doesn't deal with that > # either.) > bind waiting {} Actually, it can't quite be done this way because messages received in the waiting state would cause a crash (and it is not correct to ignore them). If the intent is to delay any messages until we get out of the waiting state, then the following would work (but would be inefficient, as discussed in the earlier thread at ): bind waiting { match [verb, args] { E.send(pots, verb, args) } } Hmm, maybe selective receive would be beneficial here. I don't think it is incompatible with the rest of E's concurrency model, and I think it can be implemented purely in E as a reusable abstraction (using an actors-style 'receptionist' that buffers messages until they can be matched -- see section 3.6 of ). OTOH, I'm not entirely convinced that buffering messages until we leave the waiting state (as the Erlang code implicitly does) is exactly the right thing. For example, if we get an 'offhook' message, or if the hardware fails, then the message buffer should be flushed. I don't think there's any way to do that in Erlang (there is with the receptionist approach). -- David Hopwood From david.nospam.hopwood@REDACTED Fri Jun 9 06:42:36 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 05:42:36 +0100 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488F448.2070009@cs.jhu.edu> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488F448.2070009@cs.jhu.edu> Message-ID: <4488FC3C.8060000@blueyonder.co.uk> Mark S. Miller wrote: > # David's code reformatted so it parses correctly. No substantive changes. > # David, what is B for? It is never used? In the Erlang code, some of the states have a 'PidB' parameter representing the peer we are connecting to (the way that I implemented the state machine means that parameters get translated into instance variables). It would presumably have been used by code that was not shown in the presentation. -- David Hopwood From surindar.shanthi@REDACTED Fri Jun 9 06:49:10 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 9 Jun 2006 10:19:10 +0530 Subject: Erlang shell crash Message-ID: <42ea5fb60606082149k45095741ue04cb3450bf11ba6@mail.gmail.com> Dear all, I'm running an Erlang application. After 12 hours, the erlang shell crashes with *Abnormal termination.* Then i have viewed the Erlang dump in the *Crash dump viewer*. The crash dump viewer has the following information. Slogan*: no next heap size found: 148185174, offset 0.* Memory allocated: 606002043 bytes. Atoms : 7158. Processes : 703 ETS tables : 45 Funs : 442 Please give me the reason for this crash. with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.nospam.hopwood@REDACTED Fri Jun 9 06:55:10 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 05:55:10 +0100 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488FA99.7000802@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488FA99.7000802@blueyonder.co.uk> Message-ID: <4488FF2E.8050702@blueyonder.co.uk> I wrote: > Hmm, maybe selective receive would be beneficial here. I don't think it is > incompatible with the rest of E's concurrency model, and I think it can be > implemented purely in E as a reusable abstraction (using an actors-style > 'receptionist' that buffers messages until they can be matched -- see > section 3.6 of ). > > OTOH, I'm not entirely convinced that buffering messages until we leave the > waiting state (as the Erlang code implicitly does) is exactly the right thing. > For example, if we get an 'offhook' message, or if the hardware fails, then the > message buffer should be flushed. I don't think there's any way to do that in > Erlang (there is with the receptionist approach). Another reason to be dubious about the way Erlang handles selective receive is the performance issue described in . -- David Hopwood From ulf@REDACTED Fri Jun 9 07:12:14 2006 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 09 Jun 2006 07:12:14 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <4488CAD4.6080207@allcaps.org> References: <4488CAD4.6080207@allcaps.org> Message-ID: Den 2006-06-09 03:11:48 skrev Andrew Lentvorski : > How, when and why to use gen_server should be in the documentation. > How, when and why to use gen_fsm should be in the documentation. > etc. I think that the Design Principles section at least attempts to provide you with such answers, with examples too. http://www.erlang.org/doc/doc-5.5/doc/design_principles/part_frame.html It doesn't give much guidance on when *not* to use things, though. But it's a start. Regards, Ulf W -- Ulf Wiger From ulf@REDACTED Fri Jun 9 07:54:06 2006 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 09 Jun 2006 07:54:06 +0200 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488FA99.7000802@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488FA99.7000802@blueyonder.co.uk> Message-ID: Den 2006-06-09 06:35:37 skrev David Hopwood : > Actually, it can't quite be done this way because messages > received in the waiting state would cause a crash (and it > is not correct to ignore them). Yes, this is the problem. If one may receive input from multiple, uncoordinated senders, there is no way to predict the order in which the inputs will arrive. So you either explicitly handle all permutations, or find a way to reorder messages where applicable. This is essentially what the selective receive does in this example. In the case of allocating a resource, strictly speaking, we shouldn't allocate the resource if the subscriber has already put the phone down. But since we have to handle the case that the on_hook signal arrived *after* we allocated the connection, and the two entities (resource handler and subscriber) are unsynchronized, we may reorder the events to fit our logic. This radically reduces the number of combinations we are forced to write code for. UML has an attribute, deferrable_event, which allows the designer to do pretty much the same thing. My gripe with that approach is that the consequences can be dire if one forgets to add the deferrable_event attribute (the UML default is to discard unexpected messages.) So far, I'm of the opinion that this phenomenon is restricted to transient states. You never (?) need selective receive in top-level states. If this is true, then one should be able to label states such that they either leave unexpected messages in the queue, discard them, or raise an exception. What the default should be probably depends on the domain. In my presentation, I offered an example of an event-based program that switched between a selective dispatch loop and a plain dispatch loop depending on context. This also seems to solve the problem of complexity explosion in the code. > If the intent is to delay any messages until we get out of > the waiting state, then the following would work (but would > be inefficient, as discussed in the earlier thread at > ): > bind waiting { > match [verb, args] { E.send(pots, verb, args) } > } > Hmm, maybe selective receive would be beneficial here. The efficiency part is in practice (at least in the telco domain) very seldomly a problem, but of course could be under special circumstances. OTOH, I've seen several examples of how programmers have defered the ordering problem to user-level, effecively re-implementing selective receive there. This doesn't make it more efficient. Regards, Ulf W -- Ulf Wiger From ulf@REDACTED Fri Jun 9 08:09:14 2006 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 09 Jun 2006 08:09:14 +0200 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488FA99.7000802@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488FA99.7000802@blueyonder.co.uk> Message-ID: Den 2006-06-09 06:35:37 skrev David Hopwood : > If the intent is to delay any messages until we get out of the waiting > state, then > the following would work (but would be inefficient, as discussed in the > earlier > thread at > ): > bind waiting { > match [verb, args] { E.send(pots, verb, args) } > } I don't know E, but does this mean that you resend the message to yourself? So what if the unexpected message is e.g. (on_hook), but the subscriber simply flashed the hook? Then you might get a rapid (on_hook) - (off_hook) sequence. Resending (on_hook), then (off_hook) might work, and result in the same sequence, but what if it doesn't play out that way? Perhaps the contents of the queue were (on_hook) - (switch_reply) - (off_hook). Now, you resend (on_hook), then find an expected message, and continue normally. But now the queue looks like: (off_hook) - (on_hook), which is not what the subscriber intended. Regards, Ulf W -- Ulf Wiger From dot@REDACTED Thu Jun 8 17:53:34 2006 From: dot@REDACTED (Tony Finch) Date: Thu, 8 Jun 2006 16:53:34 +0100 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060608122840.GB18192@memphis.ilius.fr> References: <20060608122840.GB18192@memphis.ilius.fr> Message-ID: On Thu, 8 Jun 2006, Mickael Remond wrote: > > This is the impression you get when comparing Yaws to Apache. > However, to be fair, I had the opportunity to see Zeus web server in > action recently (http://www.zeus.com/products/zws/). > It has been a shock. This server is really, really fast. Zeus has its own concurrency mechanism (mostly based on select rather than threads) and it's highly tuned for being an HTTP server. So, not surprising it's fast. You might also try comparing yaws with thttpd or lighttpd. Tony. -- f.a.n.finch http://dotat.at/ PORTPATRICK: STRONG SOUTH OR SOUTHEAST WINDS IN ALL AREAS EXCEPT LUNDY AND IRISH SEA, WILL BECOME CONFINED TO SHANNON, ROCKALL AND SOUTHEAST ICELAND BY LATE SUNDAY, BEFORE MODERATING. From mickael.remond@REDACTED Thu Jun 8 23:23:10 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 8 Jun 2006 23:23:10 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <17244f480606081209g366196cbped3b0c94a74c518b@mail.gmail.com> References: <20060608122840.GB18192@memphis.ilius.fr> <17244f480606081209g366196cbped3b0c94a74c518b@mail.gmail.com> Message-ID: <20060608212310.GA5091@memphis> * Yariv Sadan [2006-06-08 15:09:22 -0400]: > Does Zeus run in user space or kernel space? > > It's not suprising that a C server (esp one than runs in kernel space) > can outperform an Erlang server on static content, but what about > dynamic content? In user space, from what I know. The server take care of using interesting kernel feature such as sendfile, described in this thread: http://www.erlang.org/ml-archive/erlang-questions/200311/msg00145.html I have been told that dynamic content is also very fast (but slower obviously). It depend what kind of generation tool for page you plug behind. -- Micka?l R?mond From digitale@REDACTED Fri Jun 9 07:23:32 2006 From: digitale@REDACTED (Eric Northup) Date: Fri, 09 Jun 2006 01:23:32 -0400 Subject: [e-lang] Proposal: E / Erlang integration In-Reply-To: <4488C210.6050309@cs.jhu.edu> References: <10851539.7111149567934607.JavaMail.root@zimbra> <44884A99.1030007@cs.jhu.edu> <95be1d3b0606081135n57e92dd7ue1e513dd044f279@mail.gmail.com> <4488C210.6050309@cs.jhu.edu> Message-ID: <1149830611.4286.35.camel@localhost.localdomain> On Thu, 2006-06-08 at 20:34, Mark S. Miller wrote: > > I am thinking about a setup where an "e-process" is actually composed > > from several erlang processes: one for receiving events, one to do the > > actual job, and maybe some more. > > > On practicality, perhaps I am underestimating how lightweight Erlang processes > are. If they are lightweight enough, then this approach would work. To whit: > > When Erlang process X wishes to make a request and receive a response from > process Y, X would make a new use-once process X2 which knows X's pid. X would > then include X2's pid in the message to Y. When Y responds to X2, X2 would > then wrap Y's response with a tag and send this response to X. > > Either these tags can themselves be unforgeable, or X's clients would also > need to go through a tagging intermediate process so that a client couldn't > send a message that X would mistake for Y's tagged response. I think it works > for X2 to tag the message with X2's (presumed unforgeable) pid, since anyone > who has that pid can respond on behalf of Y anyway. > > With enough care, X could reuse X2 for successive requests to Y. But if X > wants to make requests of Z, it would need a separate X3 for that purpose. > Otherwise, it enables Y to issues Z's response, and vice versa. > > The above scheme would meet the hard requirements. But how practical would it be? Coyotos will be using essentially this scheme, so I sure hope it's practical ;-). It is not difficult for an IDL compiler to emit the appropriate routines in C; for a more dynamic language, a session-wrapper factory would be feasible. Coyotos introduces a new primitive object - the First Class Receive Buffer - whose behavior is a hard-coded implementation of the forwarding-and-tagging process X2, and Erlang could implement the same optimization. So if by "practical", you mean "fast", then the design you describe seems plausible. -Eric From markm@REDACTED Fri Jun 9 08:46:21 2006 From: markm@REDACTED (Mark S. Miller) Date: Thu, 08 Jun 2006 23:46:21 -0700 Subject: [Fwd: Re: [e-lang] Proposal: E / Erlang integration] Message-ID: <4489193D.4050709@cs.jhu.edu> -------- Original Message -------- Subject: Re: [e-lang] Proposal: E / Erlang integration Date: Fri, 09 Jun 2006 01:23:32 -0400 From: Eric Northup Reply-To: Discussion of E and other capability languages To: Discussion of E and other capability languages , erlang-questions -at- erlang.org On Thu, 2006-06-08 at 20:34, Mark S. Miller wrote: > > I am thinking about a setup where an "e-process" is actually composed > > from several erlang processes: one for receiving events, one to do the > > actual job, and maybe some more. > > > On practicality, perhaps I am underestimating how lightweight Erlang processes > are. If they are lightweight enough, then this approach would work. To whit: > > When Erlang process X wishes to make a request and receive a response from > process Y, X would make a new use-once process X2 which knows X's pid. X would > then include X2's pid in the message to Y. When Y responds to X2, X2 would > then wrap Y's response with a tag and send this response to X. > > Either these tags can themselves be unforgeable, or X's clients would also > need to go through a tagging intermediate process so that a client couldn't > send a message that X would mistake for Y's tagged response. I think it works > for X2 to tag the message with X2's (presumed unforgeable) pid, since anyone > who has that pid can respond on behalf of Y anyway. > > With enough care, X could reuse X2 for successive requests to Y. But if X > wants to make requests of Z, it would need a separate X3 for that purpose. > Otherwise, it enables Y to issues Z's response, and vice versa. > > The above scheme would meet the hard requirements. But how practical would it be? Coyotos will be using essentially this scheme, so I sure hope it's practical ;-). It is not difficult for an IDL compiler to emit the appropriate routines in C; for a more dynamic language, a session-wrapper factory would be feasible. Coyotos introduces a new primitive object - the First Class Receive Buffer - whose behavior is a hard-coded implementation of the forwarding-and-tagging process X2, and Erlang could implement the same optimization. So if by "practical", you mean "fast", then the design you describe seems plausible. -Eric From raimo@REDACTED Fri Jun 9 09:04:31 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 09 Jun 2006 09:04:31 +0200 Subject: Erlang shell crash References: <42ea5fb60606082149k45095741ue04cb3450bf11ba6@mail.gmail.com> Message-ID: Well first the standard questions: * What is the Erlang/OTP release, or emulator version erlang:system_info(system_version)? * What is the application, or what kind of application is it? When the emultor starts it pre-calculates the heap sizes to use and puts them in an array. The calculated heap sizes are up to ridiculouosly large sizes, so that if you would need such large heaps you most probably have other problems. You most probably have other problems. Your emulator has allocated 578 Mbytes of memory and had a gigantic process heap for one process. That process must have eaten all memory. The question is if the emulator is leaking memory or if your application allocates memory that can not be reclaimed in a garbage collection? So, more info is needed. And, there has been releases with a wee bit to small pre-calculated heap sizes. Locate the culprit process in the crash dump viewer and try to find out what it is doing. Perhaps look at the call stack. That may give something. surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > Dear all, > I'm running an Erlang application. > After 12 hours, the erlang shell crashes with *Abnormal termination.* > Then i have viewed the Erlang dump in the *Crash dump viewer*. > The crash dump viewer has the following information. > > Slogan*: no next heap size found: 148185174, offset 0.* > Memory allocated: 606002043 bytes. > Atoms : 7158. > Processes : 703 > ETS tables : 45 > Funs : 442 > > Please give me the reason for this crash. > > > with regards, > S.Surindar -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From surindar.shanthi@REDACTED Fri Jun 9 09:32:32 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 9 Jun 2006 13:02:32 +0530 Subject: Erlang shell crash In-Reply-To: References: <42ea5fb60606082149k45095741ue04cb3450bf11ba6@mail.gmail.com> Message-ID: <42ea5fb60606090032i50aafbc2kf08b35a354ea5587@mail.gmail.com> I'm using Eralng emulator version is 5.4.3. The type of application is load testing with simulator in one PC ( which has multiple thread. At that monent we have 200 threads) which sends requests to the server in another PC. The Shell running as server is collapsed. -with regards, S.Surindar On 09 Jun 2006 09:04:31 +0200, Raimo Niskanen wrote: > > Well first the standard questions: > * What is the Erlang/OTP release, or emulator version > erlang:system_info(system_version)? > * What is the application, or what kind of application is it? > > When the emultor starts it pre-calculates the heap sizes > to use and puts them in an array. The calculated heap sizes > are up to ridiculouosly large sizes, so that if you would > need such large heaps you most probably have other problems. > > You most probably have other problems. > > Your emulator has allocated 578 Mbytes of memory and had > a gigantic process heap for one process. That process > must have eaten all memory. The question is if the > emulator is leaking memory or if your application > allocates memory that can not be reclaimed in a > garbage collection? > > So, more info is needed. > > And, there has been releases with a wee bit to small > pre-calculated heap sizes. > > Locate the culprit process in the crash dump viewer and > try to find out what it is doing. Perhaps look at the > call stack. That may give something. > > > > surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > > > Dear all, > > I'm running an Erlang application. > > After 12 hours, the erlang shell crashes with *Abnormal termination.* > > Then i have viewed the Erlang dump in the *Crash dump viewer*. > > The crash dump viewer has the following information. > > > > Slogan*: no next heap size found: 148185174, offset 0.* > > Memory allocated: 606002043 bytes. > > Atoms : 7158. > > Processes : 703 > > ETS tables : 45 > > Funs : 442 > > > > Please give me the reason for this crash. > > > > > > with regards, > > S.Surindar > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From markm@REDACTED Fri Jun 9 09:37:02 2006 From: markm@REDACTED (Mark S. Miller) Date: Fri, 09 Jun 2006 00:37:02 -0700 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4488FA99.7000802@blueyonder.co.uk> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488FA99.7000802@blueyonder.co.uk> Message-ID: <4489251E.3030902@cs.jhu.edu> David Hopwood wrote: > If the intent is to delay any messages until we get out of the waiting state, then > the following would work (but would be inefficient, as discussed in the earlier > thread at ): > > bind waiting { > match [verb, args] { E.send(pots, verb, args) } > } > > Hmm, maybe selective receive would be beneficial here. I don't think it is > incompatible with the rest of E's concurrency model, It is certainly not incompatible, and can be done in E without the polling loop above. Everywhere that David's code uses the pattern state := waiting when (lim <- msg(..)) -> { state := new_state } change it to say instead def [promise, resolver] := Ref.promise() state := promise when (lim <- msg(..)) -> { state := new_state resolver.resolve(pots) } In other words, while we're waiting for a response from lim, 'state' holds a promise. Messages eventually sent to this promise (here, by E.send(..)) are queued up in the promise. Once we obtain a response from lim, we set state to the new state, and we resolve this promise to be pots, releasing all these queued up messages to be delivered, preserving relative order, initially according to this new state. With this pattern, we no longer need the waiting state. However, let's remember the original question. It seems both models can be implemented in both languages. Erlang supports selective receive more naturally. E supports non-blocking event-loops more naturally. Above, we implemented selective receive in E, effectively simulating Erlang's selective receive. If this is indeed the best solution to the problem, and it might be, then we have a clear case where Erlang made the programmer's life simpler but E made it more complex. Is there a better solution that's more natural for non-blocking event loops? I don't know. > OTOH, I'm not entirely convinced that buffering messages until we leave the > waiting state (as the Erlang code implicitly does) is exactly the right thing. > For example, if we get an 'offhook' message, or if the hardware fails, then the > message buffer should be flushed. I don't think there's any way to do that in > Erlang (there is with the receptionist approach). IIUC the behavior you're suggesting, the hardware failure case could be coded in E as: def [promise, resolver] := Ref.promise() state := promise when (lim <- msg(..)) -> { state := new_state resolver.resolve(pots) } catch problem { resolver.smash(problem) } As explained in section 18.1 (p. 149) of , this can also be written in E as state := when (lim <- msg(..)) -> { state := new_state pots } This causes all messages received while 'state' was a promise to be discarded, and causes any promises for the results of these messages to be likewise broken, discarding any messages sent to those promises, etc. As for whether this is realistic or appropriate for this problem domain, I have no idea. Is it? -- Text by me above is hereby placed in the public domain Cheers, --MarkM From markm@REDACTED Fri Jun 9 09:48:52 2006 From: markm@REDACTED (Mark S. Miller) Date: Fri, 09 Jun 2006 00:48:52 -0700 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] In-Reply-To: <4489251E.3030902@cs.jhu.edu> References: <44889F4E.9030905@cs.jhu.edu> <4488DA40.9090603@blueyonder.co.uk> <4488FA99.7000802@blueyonder.co.uk> <4489251E.3030902@cs.jhu.edu> Message-ID: <448927E4.3020900@cs.jhu.edu> Mark S. Miller wrote: > IIUC the behavior you're suggesting, the hardware failure case could be coded > in E as: > > def [promise, resolver] := Ref.promise() > state := promise > when (lim <- msg(..)) -> { > state := new_state > resolver.resolve(pots) > } catch problem { > resolver.smash(problem) > } Oops, how embarrassing. The above code is clearly very broken: in the hardware failure case it leaves state bound to a broken promise. We need to add to the catch clause an assignment setting 'state' to whatever state we should be in following such a hardware problem. With this addition, the code can only be simplified to state := when (lim <- msg(..)) -> { state := new_state pots } catch problem { state := other_new_state throw(problem) # breaks the promise for when's result } which is only a tad less verbose. -- Text by me above is hereby placed in the public domain Cheers, --MarkM From chsu79@REDACTED Fri Jun 9 10:14:29 2006 From: chsu79@REDACTED (Christian S) Date: Fri, 9 Jun 2006 10:14:29 +0200 Subject: trapexit.org is moving In-Reply-To: References: Message-ID: On 6/9/06, Torbjorn Tornkvist wrote: > It has been some discussions lately on the list about the > slow spread of Erlang, the lack of good community web-sites > etc. trapexit was an attempt to remedy the latter. > Unfortunately, the response has not been what I was hoping > for. A few heroic contributers has showed up with HowTo's > (thank you guys!), and one person has shown any interest > in helping out with the trapexit stuff (thanks Bengt!). > But really, to me it has been a big disappointment. > Perhaps it is a chicken/egg problem (small community, > small amount of contributions); I don't know. This just shows that creating a community doesnt mean one create a technical solution and then the people will come. However: My reason to comment is to again make people aware that there is an IRC channel on irc.freenode.net called #erlang, currently 36 hangarounds. If you can, keep an irc client connected and catch up with discussion once or twice during the day. We're a rather silent bunch. It is a good place to find people with similar interests to yours, so you can get someone to bounce ideas off. If we grow large enough some people are bound to start some interesting community projects. (Hey, it happens with #lisp) Also, planeterlang.org needs to be pushed too. Not too much traffic, but also a good way to get more awareness for projects you start. Probably the best way to reach people not yet aware of Erlang, given how blogs get comments that spread into other language communities. From bjorn@REDACTED Fri Jun 9 10:26:24 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 Jun 2006 10:26:24 +0200 Subject: Erlang on the niagara In-Reply-To: References: <448857E3.7050508@blueyonder.co.uk> Message-ID: "Ulf Wiger" writes: > AFAIK, the whole I/O subsystem in OTP R11B is protected with a single > big mutex. Correct. We plan to change that in a future R11B-X release. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ke.han@REDACTED Fri Jun 9 10:27:41 2006 From: ke.han@REDACTED (ke han) Date: Fri, 9 Jun 2006 16:27:41 +0800 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <448722AA.3000006@hyber.org> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <17244f480606070637r58a1e91ct7b8b8f4890f42785@mail.gmail.com> <448722AA.3000006@hyber.org> Message-ID: I am working on just such a beast. It is an MVC framework using yaws + mnesia + records (w/ "common accessors inteface" ). It is intended as an Ajax only framework leveraging dojotoolkit. I have started over on this project 3 times now... Even spent lots of time looking at Rails, Django, Seaside to see if creating an erlang MVC framework is worth my time. Net result is think yes, an erlang based framework could be different enough in terms of footprint and scalability. I should have a _very rough_ cut of things within a week. It will be a small example of my ideas and hopefully enough feedback will come to know what to build next. I'm not looking to make a living on doing this, but I need something for my projects and will open source what I create and see if we can as a group expand on it. BTW, In terms of making a living on frameworks, I spent all of the 90s doing just that. My company, patternWare, made enterprise level app frameworks in Smalltalk and Java. Not a business model I want to be involved in anymore...better to open source everything ;-). ke han On Jun 8, 2006, at 3:02 AM, Claes Wikstrom wrote: > Yariv Sadan wrote: >> I seriously think Erlang could become quite popular if >> - it had a solid web development framework that made common tasks >> easy >> for PHP/Ruby/JSP developers who are "making the switch." (The bar >> keeps getting higher, btw -- check out >> http://code.google.com/webtoolkit/.) > > The time is more than ripe to build that now. Yaws + Mnesia > + records + possibly some additional description "little language" > would make an excellent starting point. > > Quite a bit of work though, (guesstimate: 3 hackers x 3 months) > to get a first acceptable version in the air. It also requires > lots of good documentation and packaging. > > Should be done - now. > > Actually, I think one could make a good living from this, build it, > write a book, and sell consultancy on the toolkit only. > > >> - Mnesia disc-only storage engine, dets, had the improvements >> described here http://erlang.org/ml-archive/erlang-questions/ >> 200605/msg00042.html > > Should also be done - now. > > Not by me though, I'm - well, fully occupied - to say the least. > > > > /klacke > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > cellphone: +46 70 2097763 From ulf.wiger@REDACTED Fri Jun 9 10:40:14 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 9 Jun 2006 10:40:14 +0200 Subject: [e-lang] [Fwd: Re: Proposal: E / Erlang integration] Message-ID: David Hopwood wrote: > > OTOH, I'm not entirely convinced that buffering messages > until we leave the waiting state (as the Erlang code > implicitly does) is exactly the right thing. > For example, if we get an 'offhook' message, or if the > hardware fails, then the message buffer should be flushed. I > don't think there's any way to do that in Erlang (there is > with the receptionist approach). The conventional way to implement flush() in Erlang is: flush() -> receive _ -> flush() after 0 -> ok end. If you want to be paranoid, you can insert a unique end token to prevent a possible infinite loop: flush() -> Ref = make_ref(), self() ! {end, Ref}, flush_until({end, Ref}). flush_until(Msg) -> receive Msg -> ok; _ -> flush_until(Msg) end. There are of course variants of the above. Unfortunately, you can't pass a pattern or parameterize the pattern match in receive. Partly for this reason, there's no library function for dropping messages until a good message comes along. You have to roll your own for the occasion. Regards, Ulf W From raimo@REDACTED Fri Jun 9 10:46:59 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 09 Jun 2006 10:46:59 +0200 Subject: Erlang shell crash References: , , <42ea5fb60606090032i50aafbc2kf08b35a354ea5587@mail.gmail.com> Message-ID: In erts-5.4.8 (R10B-6) there was a fix for larger heap sizes: OTP-5596 In the hipe application, there's a new experimental register allocator (optimistic coalescing), and the linear scan register allocator is now also available on ppc. Plus lots of cleanups. Minor hybrid heap corrections. The maximum size of a heap used to be articially limited so that the size of a heap would fit in 28 bits; that limitation could cause the emulator to terminate in a garbage collection even if there still was available memory. Now the largest heap size for a 32 bit CPU is 1,699,221,830 bytes. (Thanks to Jesper Wilhelmsson.) Also removed the undocumented +H emulator option. But do you need larger heap sizes or fixing your application? There is a gotcha concerning the shell history. The shell keeps a history of commands and results, and since the shell has references to this data, it is not garbage collected. Might this be a problem? Or is it simply so that you have a non-tail recurisive loop that is eating your memory? You can use top (the unix command) to see if the server side emulator grows gradually, or explodes suddenly, which size it starts on and so on, and this may give you some clue. surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > I'm using Eralng emulator version is 5.4.3. > The type of application is load testing with simulator in one PC ( which has > multiple thread. At that monent we have 200 threads) which sends requests to > the server in another PC. > The Shell running as server is collapsed. Do you mean that the server side shell process is the one that memory exploded and caused the emulator to crash? > > -with regards, > S.Surindar > > > On 09 Jun 2006 09:04:31 +0200, Raimo Niskanen > wrote: > > > > Well first the standard questions: > > * What is the Erlang/OTP release, or emulator version > > erlang:system_info(system_version)? > > * What is the application, or what kind of application is it? > > > > When the emultor starts it pre-calculates the heap sizes > > to use and puts them in an array. The calculated heap sizes > > are up to ridiculouosly large sizes, so that if you would > > need such large heaps you most probably have other problems. > > > > You most probably have other problems. > > > > Your emulator has allocated 578 Mbytes of memory and had > > a gigantic process heap for one process. That process > > must have eaten all memory. The question is if the > > emulator is leaking memory or if your application > > allocates memory that can not be reclaimed in a > > garbage collection? > > > > So, more info is needed. > > > > And, there has been releases with a wee bit to small > > pre-calculated heap sizes. > > > > Locate the culprit process in the crash dump viewer and > > try to find out what it is doing. Perhaps look at the > > call stack. That may give something. > > > > > > > > surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > > > > > Dear all, > > > I'm running an Erlang application. > > > After 12 hours, the erlang shell crashes with *Abnormal termination.* > > > Then i have viewed the Erlang dump in the *Crash dump viewer*. > > > The crash dump viewer has the following information. > > > > > > Slogan*: no next heap size found: 148185174, offset 0.* > > > Memory allocated: 606002043 bytes. > > > Atoms : 7158. > > > Processes : 703 > > > ETS tables : 45 > > > Funs : 442 > > > > > > Please give me the reason for this crash. > > > > > > > > > with regards, > > > S.Surindar > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > -- > with regards, > S.Surindar -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From sgsfak@REDACTED Fri Jun 9 10:49:16 2006 From: sgsfak@REDACTED (Stelianos G. Sfakianakis) Date: Fri, 9 Jun 2006 11:49:16 +0300 Subject: Erlang on the niagara In-Reply-To: References: <448857E3.7050508@blueyonder.co.uk> Message-ID: On 6/8/06, Ulf Wiger wrote: > Den 2006-06-08 19:01:23 skrev David Hopwood > : > > > Joe Armstrong (AL/EAB) wrote: > >> Why can't we speed up beyond a factor 7 - who knows? - at some stage > >> things do get serialised, there is after all only one disk on the > >> machine, and the SMP erlang has to serialise all disk I/O, even if the > >> programs generating data run in parallel, [...] > > > > Do you mean that it does disk I/O in a single OS thread, or with a mutex > > around the I/O code, or just that the I/O is serialized at the hardware > > bus level? > > AFAIK, the whole I/O subsystem in OTP R11B is protected with a single > big mutex. > Just to make sure that I understand this correctly, are you referring only to the disk IO or really to the *whole* IO system (including network)? thanks Stelios From rasmussen.bryan@REDACTED Fri Jun 9 11:25:06 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Fri, 9 Jun 2006 11:25:06 +0200 Subject: archiving erlang info was Re: trapexit.org is moving Message-ID: <3bb44c6e0606090225g4fe7a671pcea681ea293ac752@mail.gmail.com> I think basically the how-tos should be moved from trapexit.org to one of the more permanent sites. this brings me to another point, that of archiving old erlang information etc. Sometimes things are moved or no longer available. Sometimes this no longer available information can be retrieved either from the google cache or internet archive. if internet archive gets submitted a link they will crawl that link if they do not currently have it archived, I think it might make sense to start backing up to internet archive non-archived information that we are familiar with. This also helps with redundancy etc. Cheers, Bryan Rasmussen On 6/9/06, Christian S wrote: > On 6/9/06, Torbjorn Tornkvist wrote: > > It has been some discussions lately on the list about the > > slow spread of Erlang, the lack of good community web-sites > > etc. trapexit was an attempt to remedy the latter. > > Unfortunately, the response has not been what I was hoping > > for. A few heroic contributers has showed up with HowTo's > > (thank you guys!), and one person has shown any interest > > in helping out with the trapexit stuff (thanks Bengt!). > > But really, to me it has been a big disappointment. > > Perhaps it is a chicken/egg problem (small community, > > small amount of contributions); I don't know. > > This just shows that creating a community doesnt mean one create > a technical solution and then the people will come. However: > > My reason to comment is to again make people aware that there is an > IRC channel on irc.freenode.net called #erlang, currently 36 hangarounds. > If you can, keep an irc client connected and catch up with discussion > once or twice during the day. We're a rather silent bunch. > > It is a good place to find people with similar interests to yours, so > you can get someone to bounce ideas off. If we grow large enough some > people are bound to start some interesting community projects. (Hey, > it happens with #lisp) > > Also, planeterlang.org needs to be pushed too. Not too much traffic, but > also a good way to get more awareness for projects you start. Probably > the best way to reach people not yet aware of Erlang, given how blogs > get comments that spread into other language communities. > From pupeno@REDACTED Fri Jun 9 10:29:11 2006 From: pupeno@REDACTED (Pupeno) Date: Fri, 9 Jun 2006 08:29:11 +0000 Subject: Erlang goes multicore In-Reply-To: <4487717C.8050908@allcaps.org> References: <4487717C.8050908@allcaps.org> Message-ID: <200606090829.11286.pupeno@pupeno.com> On Thursday, 8 de June de 2006 00:38, Andrew Lentvorski wrote: > Yes, some marketing would be *good*. At least, a Slashdot post. It would be nice for the people that take care to release Erlang to also fill out the new releases in Freshmeat (http://freshmeat.net), I am doing that myself very poorly. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From surindar.shanthi@REDACTED Fri Jun 9 11:43:02 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 9 Jun 2006 15:13:02 +0530 Subject: Erlang shell crash In-Reply-To: References: <42ea5fb60606090032i50aafbc2kf08b35a354ea5587@mail.gmail.com> Message-ID: <42ea5fb60606090243g5a771361r460dd657a6c84e7b@mail.gmail.com> Yes, the server side shell has collapsed. I will analyse all of your points. Thank you very much for your reply. -- with regards, S.Surindar On 09 Jun 2006 10:46:59 +0200, Raimo Niskanen wrote: > > In erts-5.4.8 (R10B-6) there was a fix for larger heap sizes: > > OTP-5596 In the hipe application, there's a new experimental register > allocator (optimistic coalescing), and the linear scan > register allocator is now also available on ppc. Plus lots of > cleanups. > > Minor hybrid heap corrections. > > The maximum size of a heap used to be articially limited so > that the size of a heap would fit in 28 bits; that limitation > could cause the emulator to terminate in a garbage collection > even if there still was available memory. Now the largest > heap size for a 32 bit CPU is 1,699,221,830 bytes. (Thanks to > Jesper Wilhelmsson.) > > Also removed the undocumented +H emulator option. > > But do you need larger heap sizes or fixing your application? > > There is a gotcha concerning the shell history. The shell > keeps a history of commands and results, and since > the shell has references to this data, it is not > garbage collected. Might this be a problem? > > Or is it simply so that you have a non-tail recurisive loop > that is eating your memory? > > You can use top (the unix command) to see if the server > side emulator grows gradually, or explodes suddenly, > which size it starts on and so on, and this may give > you some clue. > > surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > > > I'm using Eralng emulator version is 5.4.3. > > The type of application is load testing with simulator in one PC ( which > has > > multiple thread. At that monent we have 200 threads) which sends > requests to > > the server in another PC. > > The Shell running as server is collapsed. > > Do you mean that the server side shell process is the one that > memory exploded and caused the emulator to crash? > > > > > -with regards, > > S.Surindar > > > > > > On 09 Jun 2006 09:04:31 +0200, Raimo Niskanen > > wrote: > > > > > > Well first the standard questions: > > > * What is the Erlang/OTP release, or emulator version > > > erlang:system_info(system_version)? > > > * What is the application, or what kind of application is it? > > > > > > When the emultor starts it pre-calculates the heap sizes > > > to use and puts them in an array. The calculated heap sizes > > > are up to ridiculouosly large sizes, so that if you would > > > need such large heaps you most probably have other problems. > > > > > > You most probably have other problems. > > > > > > Your emulator has allocated 578 Mbytes of memory and had > > > a gigantic process heap for one process. That process > > > must have eaten all memory. The question is if the > > > emulator is leaking memory or if your application > > > allocates memory that can not be reclaimed in a > > > garbage collection? > > > > > > So, more info is needed. > > > > > > And, there has been releases with a wee bit to small > > > pre-calculated heap sizes. > > > > > > Locate the culprit process in the crash dump viewer and > > > try to find out what it is doing. Perhaps look at the > > > call stack. That may give something. > > > > > > > > > > > > surindar.shanthi@REDACTED (Surindar Sivanesan) writes: > > > > > > > Dear all, > > > > I'm running an Erlang application. > > > > After 12 hours, the erlang shell crashes with *Abnormal > termination.* > > > > Then i have viewed the Erlang dump in the *Crash dump viewer*. > > > > The crash dump viewer has the following information. > > > > > > > > Slogan*: no next heap size found: 148185174, offset 0.* > > > > Memory allocated: 606002043 bytes. > > > > Atoms : 7158. > > > > Processes : 703 > > > > ETS tables : 45 > > > > Funs : 442 > > > > > > > > Please give me the reason for this crash. > > > > > > > > > > > > with regards, > > > > S.Surindar > > > > > > -- > > > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > > -- > > with regards, > > S.Surindar > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivvv@REDACTED Fri Jun 9 13:02:51 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 9 Jun 2006 07:02:51 -0400 Subject: trapexit.org is moving In-Reply-To: References: Message-ID: <17244f480606090402m6ef1693dvf184c83f53493712@mail.gmail.com> > > This just shows that creating a community doesnt mean one create > a technical solution and then the people will come. I think there needs to be a "critical mass" of content before enough people start using it... I was thinking that taking all official Erlang docs, dumping them into a wiki (wikimedia would be nice), and setting up a community site around it would be effective. However, I'm pretty sure somebody mentioned there are license restrictions with this documentation. Cheers, Yariv From chaitanya@REDACTED Fri Jun 9 12:26:55 2006 From: chaitanya@REDACTED (Chaitanya Chalasani) Date: Fri, 9 Jun 2006 15:56:55 +0530 Subject: Oracle on Linux In-Reply-To: <01e601c6834d$d0f33cc0$6500a8c0@inswitchapp> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> <01e601c6834d$d0f33cc0$6500a8c0@inswitchapp> Message-ID: <200606091556.56174.chaitanya@pyronetworks.com> On Monday 29 May 2006 23:59, Sebastian Bello wrote: > An additional question: > 4- how do you handle transactions? Transactions are not possible with the way we are using. Auto commit has been enabled. We load the mnesia database on startup and the application runs on mnesia while non realtime update/delete/insert queries are sent to oracle for MIS purpose. Though oracle lags behind during peak traffic it copes up once the traffic is low. > Sebastian- > > ----- Original Message ----- > From: "Sebastian Bello" > To: "Chaitanya Chalasani" > Cc: "Erlang Questions" > Sent: Friday, May 26, 2006 11:20 AM > Subject: Re: Oracle on Linux > > > Chaitanya, > > > > thanks for the source code. > > > > Some additional questions: > > 1- do you use multiple connections to Oracle? How would/do you manage it > > (resolved in the C++ class or with multiples ports)? > > 2- how do you encode/decode responses (mainly in the case of SELECT > > statements)? Do you read responses at the Erlang side as binaries and > > then create the corresponding Erlang datatypes, or do you use ei to > > generate Erlang datatypes on the C side? > > 3- how do you multiplex queries (use for example a PID to identify the > > requester and return the response to it)? > > > > Thank you very much for your help! > > Regards, > > Sebastian- > > > > > > ----- Original Message ----- > > From: "Chaitanya Chalasani" > > To: "Joel Reymont" > > Cc: "Erlang Questions" > > Sent: Wednesday, May 24, 2006 1:44 AM > > Subject: Re: Oracle on Linux > > > > > On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > > > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > > > Folks, > > > > > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > > > commercial ODBC driver? > > > > > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > > > > > Thanks, Joel > > > > > > > > > > -- > > > > > http://wagerlabs.com/ > > > > > > > > I am away from my office all there days. The day I am back I will > > share > > > the > > > > > > source. I have already got the nod from my manager.:) > > > > > > The attachment is the c++ code of occi interface that acts as port > > > > executable. > > > > > Sorry for the delay -- CHAITANYA CHALASANI MEMBER - TECHNICAL TEAM PYRO NETWORKS PVT LTD MOBILE: +919849901241 URL: www.pyronetworks.com From chaitanya@REDACTED Fri Jun 9 12:23:12 2006 From: chaitanya@REDACTED (Chaitanya Chalasani) Date: Fri, 9 Jun 2006 15:53:12 +0530 Subject: Oracle on Linux In-Reply-To: <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605241014.46638.chaitanya@pyronetworks.com> <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> Message-ID: <200606091553.12891.chaitanya@pyronetworks.com> On Friday 26 May 2006 19:50, Sebastian Bello wrote: > Chaitanya, > > thanks for the source code. > > Some additional questions: > 1- do you use multiple connections to Oracle? How would/do you manage it > (resolved in the C++ class or with multiples ports)? I am using multiple ports. > 2- how do you encode/decode responses (mainly in the case of SELECT > statements)? Do you read responses at the Erlang side as binaries and then > create the corresponding Erlang datatypes, or do you use ei to generate > Erlang datatypes on the C side? No i read as stdout content of C binary and parse it on my own. > 3- how do you multiplex queries (use for example a PID to identify the > requester and return the response to it)? Thread spawn on request is used so the port application running would serve that particular thread only. > > Thank you very much for your help! > Regards, > Sebastian- > > > ----- Original Message ----- > From: "Chaitanya Chalasani" > To: "Joel Reymont" > Cc: "Erlang Questions" > Sent: Wednesday, May 24, 2006 1:44 AM > Subject: Re: Oracle on Linux > > > On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > > Folks, > > > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > > commercial ODBC driver? > > > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > > > Thanks, Joel > > > > > > > > -- > > > > http://wagerlabs.com/ > > > > > > I am away from my office all there days. The day I am back I will share > > the > > > > source. I have already got the nod from my manager.:) > > > > The attachment is the c++ code of occi interface that acts as port > > executable. > > > Sorry for the delay -- CHAITANYA CHALASANI MEMBER - TECHNICAL TEAM PYRO NETWORKS PVT LTD MOBILE: +919849901241 URL: www.pyronetworks.com From mickael.remond@REDACTED Fri Jun 9 12:34:05 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 9 Jun 2006 12:34:05 +0200 Subject: Erlang goes multicore In-Reply-To: <200606090829.11286.pupeno@pupeno.com> References: <4487717C.8050908@allcaps.org> <200606090829.11286.pupeno@pupeno.com> Message-ID: <20060609103405.GA6907@memphis.ilius.fr> * Pupeno [2006-06-09 08:29:11 +0000]: > On Thursday, 8 de June de 2006 00:38, Andrew Lentvorski wrote: > > Yes, some marketing would be *good*. > > At least, a Slashdot post. I already tried the Slashdot article for the new version and it has been rejected. It is quite unclear to me what are the criterium for rejection. -- Micka?l R?mond From yani.dzhurov@REDACTED Fri Jun 9 13:53:00 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Fri, 9 Jun 2006 14:53:00 +0300 Subject: socket options Message-ID: <00b001c68bbb$41953300$1500a8c0@dobrosoft.local> I've been reading through the documentation of inet module, trying to get familiar with all tcp socket options. There is sth I don't understand for this one: {packet_size, Integer} (TCP/IP sockets) Sets the max allowed length of the packet body. If the packet header indicates that the length of the packet is longer than the max allowed length, the packet is considered invalid. The same happens if the packet header is too big for the socket receive buffer. What does "considered invalid" mean? Is the packet just discarded? Or cause some error - socket closure for example? Also what happens when the receive buffer is full? May this cause some socket error also? Or just waits until any data is read from the buffer and move on receiving from its peer? Thanks, jani -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3326 bytes Desc: not available URL: From klacke@REDACTED Fri Jun 9 13:53:40 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 09 Jun 2006 13:53:40 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <20060608122840.GB18192@memphis.ilius.fr> References: <20060608122840.GB18192@memphis.ilius.fr> Message-ID: <44896144.4000403@hyber.org> Mickael Remond wrote: > > It has been a shock. This server is really, really fast. > It was more than three time faster than Yaws on simple static pages. > (13000 requests per second for Zeus versus 3000 to 4000 requests per > seconds for Yaws on the same hardware). To make static page delivery fast is easy. Has been done many times. I think possibly the fastest HTTP server for static pages is the one that got builtin to linux kernel a couple of years ago. The thing is that static pages aren't that interesting. The trick is to make dynamic pages deliver fast and to many at the same time. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From klacke@REDACTED Fri Jun 9 13:57:17 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 09 Jun 2006 13:57:17 +0200 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <17244f480606070637r58a1e91ct7b8b8f4890f42785@mail.gmail.com> <448722AA.3000006@hyber.org> Message-ID: <4489621D.8080300@hyber.org> ke han wrote: > > My company, patternWare, made > enterprise level app frameworks in Smalltalk and Java. Not a business > model I want to be involved in anymore...better to open source > everything ;-). Absolutely agree, but open sourcing and making a living are not necessarily contradictory. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From sebastian@REDACTED Fri Jun 9 14:11:34 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 9 Jun 2006 09:11:34 -0300 Subject: Oracle on Linux References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> <01e601c6834d$d0f33cc0$6500a8c0@inswitchapp> <200606091556.56174.chaitanya@pyronetworks.com> Message-ID: <002a01c68bbd$daf69230$6500a8c0@inswitchapp> Ok, thanks Chaitanya for your responses! Sebastian- ----- Original Message ----- From: "Chaitanya Chalasani" To: "Sebastian Bello" Cc: "Erlang Questions" Sent: Friday, June 09, 2006 7:26 AM Subject: Re: Oracle on Linux > On Monday 29 May 2006 23:59, Sebastian Bello wrote: > > An additional question: > > 4- how do you handle transactions? > Transactions are not possible with the way we are using. Auto commit has been > enabled. > > We load the mnesia database on startup and the application runs on mnesia > while non realtime update/delete/insert queries are sent to oracle for MIS > purpose. Though oracle lags behind during peak traffic it copes up once the > traffic is low. > > > Sebastian- > > > > ----- Original Message ----- > > From: "Sebastian Bello" > > To: "Chaitanya Chalasani" > > Cc: "Erlang Questions" > > Sent: Friday, May 26, 2006 11:20 AM > > Subject: Re: Oracle on Linux > > > > > Chaitanya, > > > > > > thanks for the source code. > > > > > > Some additional questions: > > > 1- do you use multiple connections to Oracle? How would/do you manage it > > > (resolved in the C++ class or with multiples ports)? > > > 2- how do you encode/decode responses (mainly in the case of SELECT > > > statements)? Do you read responses at the Erlang side as binaries and > > > then create the corresponding Erlang datatypes, or do you use ei to > > > generate Erlang datatypes on the C side? > > > 3- how do you multiplex queries (use for example a PID to identify the > > > requester and return the response to it)? > > > > > > Thank you very much for your help! > > > Regards, > > > Sebastian- > > > > > > > > > ----- Original Message ----- > > > From: "Chaitanya Chalasani" > > > To: "Joel Reymont" > > > Cc: "Erlang Questions" > > > Sent: Wednesday, May 24, 2006 1:44 AM > > > Subject: Re: Oracle on Linux > > > > > > > On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > > > > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > > > > Folks, > > > > > > > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > > > > commercial ODBC driver? > > > > > > > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > > > > > > > Thanks, Joel > > > > > > > > > > > > -- > > > > > > http://wagerlabs.com/ > > > > > > > > > > I am away from my office all there days. The day I am back I will > > > > share > > > > > the > > > > > > > > source. I have already got the nod from my manager.:) > > > > > > > > The attachment is the c++ code of occi interface that acts as port > > > > > > executable. > > > > > > > Sorry for the delay > > -- > CHAITANYA CHALASANI > MEMBER - TECHNICAL TEAM > PYRO NETWORKS PVT LTD > MOBILE: +919849901241 > URL: www.pyronetworks.com > > __________ Informaci?n de NOD32, revisi?n 1.1586 (20060608) __________ > > Este mensaje ha sido analizado con NOD32 antivirus system > http://www.nod32.com > > From yarivvv@REDACTED Fri Jun 9 15:19:54 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 9 Jun 2006 09:19:54 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <44896144.4000403@hyber.org> References: <20060608122840.GB18192@memphis.ilius.fr> <44896144.4000403@hyber.org> Message-ID: <17244f480606090619x1b215df8ja77277b0a82a4e0d@mail.gmail.com> > > To make static page delivery fast is easy. Has been done many times. I > think possibly the fastest HTTP server for static pages is the one > that got builtin to linux kernel a couple of years ago. The thing > is that static pages aren't that interesting. The trick is to make > dynamic pages deliver fast and to many at the same time. > I have a suspicion that such servers lose their speed and scalability advantage over Yaws when they are integrated with the common set of today's web languages. Well, you can probably get ridiculous performance if you write everything in C, but your competition will have a 3 year lead in featuers :) Also, raw speed isn't everything. Exchanging some performance for high level semantics and massive scalability it a pretty good tradeoff IMO. Yariv From taavi.talvik@REDACTED Fri Jun 9 14:18:28 2006 From: taavi.talvik@REDACTED (Taavi Talvik) Date: Fri, 9 Jun 2006 15:18:28 +0300 Subject: Erlang course material for beginners Message-ID: <20c3fe42ac641e735c88e609c38ba161@elisa.ee> I am planning to make introductory Erlang course in autumn for my colleagues. Plan is to cover topics for absolute beginning to general OTP principles with the aim, that they are able to write *small* Erlang applications (for example network monitoring). Does anybody have good introductory course material or useful guidelines for course outline (which can be distributed)? best regards, taavi From roger.larsson@REDACTED Fri Jun 9 16:06:04 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 9 Jun 2006 16:06:04 +0200 Subject: Linux in kernel web server - not any more... In-Reply-To: <44896144.4000403@hyber.org> References: <20060608122840.GB18192@memphis.ilius.fr> <44896144.4000403@hyber.org> Message-ID: <200606091606.04814.roger.larsson@norran.net> On Friday 09 June 2006 13:53, Claes Wikstrom wrote: > To make static page delivery fast is easy. Has been done many times. I > think possibly the fastest HTTP server for static pages is the one > that got builtin to linux kernel a couple of years ago. The thing > is that static pages aren't that interesting. The trick is to make > dynamic pages deliver fast and to many at the same time. The kernel webserver (khttpd, TUX) for static pages has been removed from Linus kernel www.kernel.org since user space servers can give almost the same preformance! Red Hat does however include TUX in their distribution. http://www.redhat.com/docs/manuals/tux/TUX-2.2-Manual/intro.html (It would be interesting to know where the limit is using Erlang for something like - http://www.spec.org/web2005/ But the dynamic content generation is done by PHP or Java script. So those would need to be ported first...) /RogerL From david.nospam.hopwood@REDACTED Fri Jun 9 16:12:26 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 09 Jun 2006 15:12:26 +0100 Subject: [e-lang] [Fwd: Re: [Fwd: Re: Proposal: E / Erlang integration]] In-Reply-To: <448919DB.4030208@cs.jhu.edu> References: <448919DB.4030208@cs.jhu.edu> Message-ID: <448981CA.3070303@blueyonder.co.uk> Ulf Wiger wrote: > Den 2006-06-09 06:35:37 skrev David Hopwood > : > >>If the intent is to delay any messages until we get out of the waiting >>state, then the following would work (but would be inefficient, as >>discussed in the earlier thread at >>): >> bind waiting { >> match [verb, args] { E.send(pots, verb, args) } >> } > > I don't know E, but does this mean that you resend the message to yourself? Yes. > So what if the unexpected message is e.g. (on_hook), but the subscriber > simply flashed the hook? Then you might get a rapid (on_hook) - (off_hook) > sequence. Resending (on_hook), then (off_hook) might work, and result in > the same sequence, but what if it doesn't play out that way? You're right, resending to self doesn't work in general. I posted in too much haste. Buffering the messages in an explicit FIFO queue would work (and as I said, this can be a reusable abstraction rather than something that has to be done per-application). In the previous post: > So far, I'm of the opinion that this phenomenon is restricted to transient > states. You never (?) need selective receive in top-level states. If this > is true, then one should be able to label states such that they either > leave unexpected messages in the queue, discard them, or raise an > exception. What the default should be probably depends on the domain. I agree. I'll try and write something in E that implements this. -- David Hopwood From yarivvv@REDACTED Fri Jun 9 21:15:46 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 9 Jun 2006 15:15:46 -0400 Subject: dets improvements? In-Reply-To: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> Message-ID: <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> I just discovered the Erlang MySQL library from Process One: http://support.process-one.net/doc/display/CONTRIBS/Yxa/. This bodes well as I can store large volumes of data in MySQL and still get the performance and scalability of Yaws. Still... it would be nice if Mnesia were a better fit for my needs because, well, it's more Erlangy :) Regards, Yarivv On 6/8/06, Yariv Sadan wrote: > Hi list, > > I hope I'm not bringing it up too many times but I figured I'll give > one last shot trying to get an answer... Is the OTP team planning on > making the dets improvements discussed in this thread? > http://erlang.org/ml-archive/erlang-questions/200606/msg00161.html. > > (To quote Claes: "Should also be done - now.") > > I ask because I think it's important to at least have some indication > this will be resolved at some point before seriously promoting Erlang > to the "general public" (I guess some people would prefer keeping > Erlang as little known "secret weapon" but that's a whole other debate > :) ) Otherwise, I can see people's reaction: "Erlang looks very > interesting but I can't afford to keep all my data in RAM and Mnesia's > disc storage isn't up to par with MySQL/Postgres/Oracle, so I think > I'll stick with PHP/Java." > > I confess that I also have a more selfish reason and that is I need to > decide whether to use Erlang or Ruby for a hobby project and since *I* > can't afford gigs of RAM (hosted server) and I don't want to risk > broken dets tables taking hours to rebuild, I may have to go with > Ruby. > > Best regards, > Yariv > From fig@REDACTED Fri Jun 9 23:10:09 2006 From: fig@REDACTED (Michael FIG) Date: Fri, 9 Jun 2006 15:10:09 -0600 (CST) Subject: Summary: E / Erlang integration Message-ID: <11888713.8581149887409449.JavaMail.root@zimbra> Hi, First of all, I want to say thanks to all those who have contributed to this discusssion. I think most of you have seen all the traffic, since some people who appeared to be on both erlang-questions and e-lang have forwarded messages from those who don't have posting access. So, I'd like to resummarize the reasons I have for desiring an E-compatible model within Erlang. Erlang is already a melting pot for many different kinds of messaging models, whether it is its native async messages (that can be distributed to C or Java), other styles that are layered on top of it (gen_server implements RPCs, gen_fsm implements event-driven state machines), communication via CORBA, or drivers for passing custom-structured data. Where I see E integration fitting is that each of Erlang's existing models makes no special consideration for untrusted clients, untrusted servers, or untrusted networks. I don't think that's something that can be securely grafted onto the existing Erlang messaging system, but I believe that E has a proven model that doesn't burden the programmer. To answer more about MarkM's comments, I'm talking about Erlang-E (E semantics embedded in Erlang) rather than E-on-Erlang (an implementation of the E language using Erlang as a VM). I retract my original suggestion of developing special syntax for E message sending (the !< part), since that can easily be accomplished by a library function "Promise = e:send(CryptoCap, Message)". However, the when/catch construct of E would be clunky to use without some syntactic sugar. With sugar: promise_case e:send(RaceTrack, getPolePositionCar) of FarPolePositionCar -> io:format("My car is in pole position~n"); after 3000 -> io:format("Timed out~n") catch E -> ok; end. without sugar: e:pcase(e:send(RaceTrack, getPolePositionCar), fun (SomeFreshName) -> case SomeFreshName of FarPolePositionCar -> io:format("My car is in pole position~n"), matched; _ -> notmatched end end, 3000, fun () -> io:format("Timed out~n"), fun (E) -> ok end). I'd like to get this or equivalent syntax solidified to make the code I write somewhat more understandable, and to abstract the protocol between the initiater of the promise_case and the process that actually receives the results of the promise and dispatches to the promise_case arms. So, I would like to proceed with implementing a library for E-style messages based on the recommendations given by MarkM (quoted below so that people in both communities may review it). To meet my goals, this library would initially be a thin veneer over Erlang's messaging, deliberately ignoring the issue of untrusted networks. I also want to document a safe subset of Erlang that uses the library for any communication, and cannot block the host node or otherwise compromise the security of other processes running on the node. It would be important to me to somehow annotate an Erlang module so that the compiler could enforce that nothing outside that safe subset is used. Mark S. Miller wrote: > On practicality, perhaps I am underestimating how lightweight Erlang processes > are. If they are lightweight enough, then this approach would work. To whit: > > When Erlang process X wishes to make a request and receive a response from > process Y, X would make a new use-once process X2 which knows X's pid. X would > then include X2's pid in the message to Y. When Y responds to X2, X2 would > then wrap Y's response with a tag and send this response to X. > > Either these tags can themselves be unforgeable, or X's clients would also > need to go through a tagging intermediate process so that a client couldn't > send a message that X would mistake for Y's tagged response. I think it works > for X2 to tag the message with X2's (presumed unforgeable) pid, since anyone > who has that pid can respond on behalf of Y anyway. > > With enough care, X could reuse X2 for successive requests to Y. But if X > wants to make requests of Z, it would need a separate X3 for that purpose. > Otherwise, it enables Y to issues Z's response, and vice versa. > > The above scheme would meet the hard requirements. But how practical would it be? I'm not too concerned about practicality initially: messaging to and from "safe" Erlang processes layered on top of the standard Erlang messaging primitives would probably still be cheaper than having cryptographically secure communication (but I may be wrong). On demand, and with enough acceptance in the Erlang community, we could figure out how to optimize the e:send and e:pcase functions, (probably making them builtins) as well as the corresponding E-style server behaviour. But that's a harder job than I'm prepared to commit to up front. "Make it work, then make it fast." ;) > However, let's remember the original question. It seems both models can be > implemented in both languages. Erlang supports selective receive more > naturally. E supports non-blocking event-loops more naturally. Above, we > implemented selective receive in E, effectively simulating Erlang's selective > receive. If this is indeed the best solution to the problem, and it might be, > then we have a clear case where Erlang made the programmer's life simpler but > E made it more complex. Is there a better solution that's more natural for > non-blocking event loops? I don't know. I would like to be able to use Erlang's system for performance reasons, and choose the E model in circumstances in which I know a part of the system is untrusted. I also want to know that when I use the E model exclusively, whether it be in Erlang or E proper, I have code that is easy to reason about when it comes to privilege. It would be interesting to see if E had something to gain by providing support for Erlang's model, or if there is some fused model we can arrive at. If we get something that turns out to be useful, maybe somebody can talk to the Mozart/Oz folks. :) Thanks, -- Michael FIG From klacke@REDACTED Fri Jun 9 23:12:42 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 09 Jun 2006 23:12:42 +0200 Subject: dets improvements? In-Reply-To: <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> Message-ID: <4489E44A.6030005@hyber.org> Yariv Sadan wrote: > > Mnesia were a better fit for my needs because, well, it's more Erlangy > :) > It certainly is, one of the real strengths of mnesia is the ability to have complex fields. In SQL dbs the fields are atomic, whereas in mnesia, they can be arbitrarily complex structures - trees, tuples, lists, etc. This difference alone makes all normal DB modeling theory ... well not mute, but everything gets easier and different. We do need to store > 2G in mnesia thoufg ... and the answer is not fragmented tables. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From quancta@REDACTED Sat Jun 10 03:10:23 2006 From: quancta@REDACTED (Quan Ta) Date: Fri, 9 Jun 2006 20:10:23 -0500 Subject: newbie question: flat_length example Message-ID: -module(list2). -export([flat_length/1]). %% flat_length(List) %% Calculate the length of a list of lists. flat_length(List) -> flat_length(List, 0). flat_length([H,T], N) when list(H) -> flat_length(T, flat_length(H, N)); flat_length([H|T], N) -> flat_length(T, N + 1); flat_length([], N) -> N. $ erl Eshell V5.5 (abort with ^G) 1> c(list2). ./list2.erl:12: Warning: variable 'H' is unused {ok,list2} 2> list2:flat_length([1,2,[3,4]]). 3 why is the result 3? should it be 4? -- Quan -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sat Jun 10 03:29:33 2006 From: vances@REDACTED (Vance Shipley) Date: Fri, 9 Jun 2006 21:29:33 -0400 Subject: newbie question: flat_length example In-Reply-To: References: Message-ID: <20060610012933.GF24411@frogman.motivity.ca> On Fri, Jun 09, 2006 at 08:10:23PM -0500, Quan Ta wrote: } } flat_length([H,T], N) when list(H) -> ^ | should be | ----+ } why is the result 3? should it be 4? } } -- Quan From ssmith@REDACTED Sat Jun 10 05:42:51 2006 From: ssmith@REDACTED (Steve) Date: Sat, 10 Jun 2006 13:42:51 +1000 Subject: [patch] Jungerl/iBrowse compiler error workaround Message-ID: <1149910972.11048.9.camel@bill> Hi, I need to apply the following patch to the current jungerl CVS version of iBrowse due to what appears to be a compiler error in erlang versions prior to R11B: ---------------- diff -Nurw jungerl.orig/lib/ibrowse/src/ibrowse_http_client.erl jungerl/lib/ibrowse/src/ibrowse_http_client.erl --- jungerl.orig/lib/ibrowse/src/ibrowse_http_client.erl 2006-06-01 08:02:06.000000000 +1000 +++ jungerl/lib/ibrowse/src/ibrowse_http_client.erl 2006-06-10 13:30:15.000000000 +1000 @@ -587,7 +587,7 @@ chunk_request_body(Body, ChunkSize) -> chunk_request_body(Body, ChunkSize, []). -chunk_request_body(Body, _ChunkSize, Acc) when Body == <<>>; Body == [] -> +chunk_request_body(Body, _ChunkSize, Acc) when Body == []; Body == <<>> -> LastChunk = "0\r\n", lists:reverse(["\r\n", LastChunk | Acc]); chunk_request_body(Body, ChunkSize, Acc) when binary(Body), ---------------- The compiler problem can be reproduced with the following fragment: -module(test). -export([works/1, fails/1]). works(Body) when Body == []; Body == <<>> -> []. fails(Body) when Body == <<>>; Body == [] -> []. which produces the following: Function fails/1 refers to undefined label 11 ./test.erl:none: internal error in beam_dead; crash reason: {{case_clause,{'EXIT',{undefined_label,11}}}, [{compile,'-select_passes/2-anonymous-2-',2}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} I can reproduce this with erlang versions R10B-7 (Dapper) and R10B-9 (Debian unstable), but it doesn't occur with a manual build of R11B. Cheers, Steve From yarivvv@REDACTED Sat Jun 10 17:17:07 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sat, 10 Jun 2006 11:17:07 -0400 Subject: dets improvements? In-Reply-To: <4489E44A.6030005@hyber.org> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> Message-ID: <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> > > It certainly is, one of the real strengths of mnesia is the > ability to have complex fields. In SQL dbs the fields are > atomic, whereas in mnesia, they can be arbitrarily complex > structures - trees, tuples, lists, etc. > > This difference alone makes all normal DB modeling theory > ... well not mute, but everything gets easier and different. > > We do need to store > 2G in mnesia thoufg ... and the answer is > not fragmented tables. > > Although the need for fragmentation alone isn't a deal breaker for me (it's more the long repair time, due to which I don't want to risk taking my app offline for hours), it does give the impression that Mnesia is behind the curve because no other database I know of puts such demands on the user. Even if fragmentation happened behind the scenes, it would be a different story. (That's what Postgres does, actually, in 1Gb segments -- http://www.postgresql.org/docs/8.1/interactive/storage.html.) I think Mnesia should be at least as good as MySQL and Postgres at disc storage if not other features as well because those are the most popular open source databases and hence Mnesia will always be compared to them. I'm waiting for the day Mnesia will have extensible indexing, for instance (http://www.postgresql.org/docs/8.1/interactive/gist.html), allowing support for full-text search (http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/), and a high-end query optimizer (http://www.postgresql.org/docs/8.1/interactive/geqo.html). Regards, Yariv From ulf@REDACTED Sat Jun 10 20:58:35 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 10 Jun 2006 20:58:35 +0200 Subject: dets improvements? In-Reply-To: <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> Message-ID: Den 2006-06-10 17:17:07 skrev Yariv Sadan : > Although the need for fragmentation alone isn't a deal breaker for me > (it's more the long repair time, due to which I don't want to risk > taking my app offline for hours), it does give the impression that > Mnesia is behind the curve because no other database I know of puts > such demands on the user. To be fair, mnesia doesn't target the same applications as e.g. PostgreSQL and MySQL. It's difficult to come up with database systems that achieve such tight integration with the applications. There is no semantic gap and overhead is very low. > Even if fragmentation happened behind the scenes, it > would be a different story. (That's what Postgres does, > actually, in 1Gb segments -- > http://www.postgresql.org/docs/8.1/interactive/storage.html.) Recall that mnesia is primarily a dbms for embedded realtime systems. Normally, one wants to have more control over what goes on, even if it means more work up front. > I think Mnesia should be at least as good as MySQL and > Postgres at disc storage if not other features as well > because those are the most popular open source databases > and hence Mnesia will always be compared to them. It's certainly been discussed for a long time, but I see two main reasons for the current situation: - The most influential application projects for Erlang's development so far simply haven't seen this has a hard requirement. And in fairness, only MySQL Cluster (and perhaps a few others, like TimesTen) could reasonably be a contender to mnesia in those applications. - It *is* more difficult to make efficient disk storage for dynamically typed data. Especially ordered_set disk storage is extremely difficult to implement efficiently without knowing the type or size of the keys. IMO, in order to compete squarely with conventional DBMSes on large data volumes, mnesia will have to allow type definitions of data. > I'm waiting for the day Mnesia will have extensible indexing, for > instance (http://www.postgresql.org/docs/8.1/interactive/gist.html), The rdbms contrib has this, even though it's in early beta. > allowing support for full-text search > (http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/), Again, rdbms has an embryo to this. It's not fully functional yet. I would certainly welcome some help, but it's probably best to first verify the indexing functionality first. > and a high-end query optimizer > (http://www.postgresql.org/docs/8.1/interactive/geqo.html). Ironically, there was one from the start - mnemosyne. It received a bad reputation for a couple of reasons: (1) The main applications at the time were real-time applications with little or no need for an optimizing query engine. Some people misunderstood this to mean that mnemosyne was no good, when in fact it was misused, or simply vast overkill for the given applications; and (2) it was really a research project at the time when it was included in OTP, and not enough work was put in to make it product quality. The aim of mnemosyne was, if I've understood things correctly, partly to explore the idea of set comprehensions for database queries, and partly to make a very advanced query optimizer, which was especially good at really, really hairy queries. There are queries that can bring most query engines to their knees, and optimization techniques that can bring down query time from hours to minutes in certain situations. Mnemosyne was especially good at resolving recursive dependencies. But all such processing comes at a cost, and in practice, mnemosyne was mostly used for very simple queries, where optimization made little or no difference. Basically, most things are possible, but there has to be sufficient demand for them, and people willing to put in the effort. Regards, Ulf Wiger -- Ulf Wiger From yarivvv@REDACTED Sat Jun 10 22:07:42 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sat, 10 Jun 2006 16:07:42 -0400 Subject: dets improvements? In-Reply-To: References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> Message-ID: <17244f480606101307h31e7fdcej79cb2b19ab4c7d69@mail.gmail.com> > To be fair, mnesia doesn't target the same applications as e.g. PostgreSQL > and MySQL. It's difficult to come up with database systems that achieve > such tight integration with the applications. There is no semantic gap and > overhead is very low. I know... I think Mnesia is quite amazing actually. I would much rather use it than MySQL or Postgres, and that's why it hurts that it's not really suited for my application -- a standard web site with forums, etc, running on a hosted server with little RAM. Pretty standard stuff, actually. > Recall that mnesia is primarily a dbms for embedded realtime systems. > Normally, one wants to have more control over what goes on, even if it > means more work up front. I think it's great to give the developer the capability of fragmentation -- clearly essential for clustering -- but I think that in general things should "just work" out of the box with the least amount of maintenance. In fact, the "just works" property is what makes Mnesia so appealing. You write a one liner such as save_page(Page) -> mnesia:transaction(fun()-> mnesia:write(Page) end). and magically the transaction is broadcast to a cluster of nodes without your knowing or caring what happens behind the scenes. That's powerful. Then again, I should say that the need for fragmentation is just a peeve. Rebuilding time for broken tables is the real deal breaker for me. > - The most influential application projects for Erlang's > development so far simply haven't seen this has a hard > requirement. Yes, I understand... I'm not criticizing the historical design decisions that were made because clearly Erlang was not created as a language for building web based forums :) I just think there are probably a lot of developers like me who are just getting into Erlang and who would like to use its full power on a $40/month hosted server, and it's unforunate that they should run into these same issues. By the way, I think that if the Erlang ecosystem had more features catering to hobbyists like me, this graph http://www.google.com/trends?q=ruby+on+rails%2C+erlang&ctab=0&geo=all&date=all)would look quite different. > > - It *is* more difficult to make efficient disk storage > for dynamically typed data. Especially ordered_set > disk storage is extremely difficult to implement > efficiently without knowing the type or size of the > keys. IMO, in order to compete squarely with > conventional DBMSes on large data volumes, mnesia > will have to allow type definitions of data. I didn't realize this point. Hmm... maybe the create_table function could have more parameters indicating the type of each field? > > The rdbms contrib has this, even though it's in early beta. Interesting! I didn't know that. > Again, rdbms has an embryo to this. It's not fully functional yet. I would > certainly welcome some help, but it's probably best to first verify the > indexing functionality first. That's great! I can't wait for the next Erlang-powered Google killer :) (It recently occurred to me that Erlang would be a great platform for such a beast.) > Ironically, there was one from the start - mnemosyne. It received a bad > reputation for a couple of reasons: > > (1) The main applications at the time were real-time applications with > little or no need for an optimizing > query engine. Some people misunderstood this to mean that mnemosyne was no > good, when in fact it was misused, or simply vast overkill for the given > applications; and > > (2) it was really a research project at the time when it was included in > OTP, and not enough work was put in to make it product quality. > > The aim of mnemosyne was, if I've understood things correctly, partly to > explore the idea of set comprehensions for database queries, and partly to > make a very advanced query optimizer, which was especially good at really, > really hairy queries. There are queries that can bring most query engines > to their knees, and optimization techniques that can bring down query time > from hours to minutes in certain situations. Mnemosyne was especially good > at resolving recursive dependencies. But all such processing comes at a > cost, and in practice, mnemosyne was mostly used for very simple queries, > where optimization made little or no difference. I did hear that the OTP group is working on a query optimizer for QLC, so I wonder what strategies they are taking to avoid the issues that came up with mnemosyne. Maybe in order to get the best of both worlds -- complex optimizations and real time performace -- it would make sense to have prepared queries whose optimizations are only done once and then cached for future uses. > > Basically, most things are possible, but there has to be sufficient demand > for them, and people willing to put in the effort. > I don't know how much demand there is for such features... all I can do is express demand from at least 1 developer here on the mailing list :) However, I don't think my issues are so esoteric, so hopefully they will be answered by the time I build Erlang Hobby Project #2. For Erlang Hobby Project #1, I'll probably use Yaws backed by MySQL or Postgres, so forunately I don't have to undergo complete Erlang withdrawal :) Best, Yariv From kgergely@REDACTED Sat Jun 10 23:37:36 2006 From: kgergely@REDACTED (Gergely Kontra) Date: Sat, 10 Jun 2006 23:37:36 +0200 Subject: slightly off: bittorrent client Message-ID: Hi! A week ago I was told about erlang, and I was impressed the speed of the code, and finding another ML. But for now, I just want to replace my CPU eater bittorrent client to replace with an erlang one (I've found a message about that on this ML's archive), but I couldn't find any guide how to set it up. I have installed erlang and yaws from package under debian, and don't know where to hunt for docs. -- +-[ Gergely Kontra http://www.mcl.hu/~kgergely ]------+ | PhD Student (Room:IB113) PGP ID: 0x7E3846BF Mobile:(+36 20)356 9656 | | Budapest University of Technology and Economics ICQ# 175564914 | +------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+ From ulf@REDACTED Sun Jun 11 00:14:19 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 00:14:19 +0200 Subject: dets improvements? In-Reply-To: <17244f480606101307h31e7fdcej79cb2b19ab4c7d69@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> <17244f480606101307h31e7fdcej79cb2b19ab4c7d69@mail.gmail.com> Message-ID: Den 2006-06-10 22:07:42 skrev Yariv Sadan : > By the way, I think that if the Erlang ecosystem had more features > catering to hobbyists like me, this graph > http://www.google.com/trends?q=ruby+on+rails%2C+erlang&ctab=0&geo=all&date=all)would > look quite different. Cool! Erlang beats Ruby on Rails in Sweden and India, and in the languages Swedish, French, Polish and Portuguese. (: Ulf W -- Ulf Wiger From robert.virding@REDACTED Sun Jun 11 01:48:31 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 11 Jun 2006 01:48:31 +0200 Subject: Yecc bug Message-ID: <448B5A4F.6000103@telia.com> There is a bug in yecc when using terminals whose names have characters which need \ escaping, for example the atom '\\'. The terminal atoms are generated without the extra "\" characters. This means that the generated .erl file will not compile correctly and the only fix is to go in by hand and add the "\" character. The bug is in the function quoted_atom which used to generate the atom name string of terminals: quoted_atom(Atom) -> [$'|atom_to_list(Atom)++"'"]. There are no problems using atoms like these in productions as the code for generating the productions use erl_pp:expr which does it right. Robert From yarivvv@REDACTED Sun Jun 11 08:57:59 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 11 Jun 2006 02:57:59 -0400 Subject: dets improvements? In-Reply-To: References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> <17244f480606101307h31e7fdcej79cb2b19ab4c7d69@mail.gmail.com> Message-ID: <17244f480606102357k29dd2658pfde51264c0a5d487@mail.gmail.com> > > Cool! Erlang beats Ruby on Rails in Sweden and India, and in the languages > Swedish, French, Polish and Portuguese. (: > I should admit that I carefully picked a graph that wouldn't damped too much the spirits of Erlangers who are still bent on world domination. Add Java to the query (http://www.google.com/trends?q=erlang%2C+ruby+on+rails%2C+java) and the result is quite unfortunate -- even in Sweden :) Best, Yariv From micke@REDACTED Sun Jun 11 10:05:21 2006 From: micke@REDACTED (Michael Fogeborg) Date: Sun, 11 Jun 2006 10:05:21 +0200 Subject: dets improvements? In-Reply-To: References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17244f480606091215s37bd90a4ie99d1bf2a0586a24@mail.gmail.com> <4489E44A.6030005@hyber.org> <17244f480606100817i45c14713q468c602701775f38@mail.gmail.com> <17244f480606101307h31e7fdcej79cb2b19ab4c7d69@mail.gmail.com> Message-ID: Seems like some parts of the world don't struggle with fault tolerance anymore. Is there a connection with erlang here ? ;-) http://www.google.com/trends?q=erlang%2C+fault+tolerant&ctab=0&geo=all&date=all From pupeno@REDACTED Sun Jun 11 12:30:24 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 11 Jun 2006 12:30:24 +0200 Subject: Loading application variables Message-ID: <1150021824.12185.36.camel@ulab.pupeno.com> Hello, I have written an Erlang application called MiSelfu (well, miselfu actually). I can start it from the command line with: erl -sname miselfu -boot miselfu -config /usr/local/etc/miselfu/miselfu.config but I'd like to be able to start it from a already-running emulator, that's so I can run it from within my shell running within Emacs. I can try: > application:start(miselfu). =INFO REPORT==== 11-Jun-2006::12:04:35 === application: miselfu exited: {shutdown,{miselfu_app,start,[normal,[]]}} type: temporary {error,{shutdown,{miselfu_app,start,[normal,[]]}}} > but as you can see, I get a non-very descriptive error (at least, for my eyes). I only can think of the missing config file as the problem. How do I load that config file[1] to be able to run my application ? Am I doing something wrong ? As a newbie to Erlang and not knowing anyone else using it (I have never seen anyone else codding on Erlang), I am not sure about the best way to go thru the development cicle. Thank you. -- Pupeno http://pupeno.com [1] The config file contais: %% Configuration file for MiSelfu. [{miselfu, [ %% Ports for the different processes. {echoTCPPort, 7}, {echoUDPPort, 7}, {chargenTCPPort, 19}, {chargenUDPPort, 19}, {daytimeTCPPort, 13}, {daytimeUDPPort, 13}, {timeTCPPort, 37}, {timeUDPPort, 37}, %% Offset, it will be added to all the ports. {portOffset, 0}]}]. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: This is a digitally signed message part URL: From ayrnieu@REDACTED Sun Jun 11 13:08:23 2006 From: ayrnieu@REDACTED (Julian Fondren) Date: Sun, 11 Jun 2006 06:08:23 -0500 Subject: slightly off: bittorrent client In-Reply-To: References: Message-ID: You can find docs on http://www.erlang.org/ , as on-line HTML, as an HTML tarball, and as a manpage tarball. I normally untar HTML and man pages under /usr/local/lib/erlang , where Erlang installs, and then edit MANPATH and add bookmarks as appropriate. I haven't looked very hard, but it doesn't seem that an Erlang bittorrent /client/ exists. You might find it instructive to write one. Anyway, you suggest that you do in fact have an Erlang bittorrent client and just don't know how to set it up. Well, ask questions. "I don't know how to set it up" only forces us to try and drag the question you should have asked out of you. On 6/10/06, Gergely Kontra wrote: > Hi! > > A week ago I was told about erlang, and I was impressed the speed of > the code, and finding another ML. > But for now, I just want to replace my CPU eater bittorrent client to > replace with an erlang one (I've found a message about that on this > ML's archive), but I couldn't find any guide how to set it up. > I have installed erlang and yaws from package under debian, and don't > know where to hunt for docs. > > -- > +-[ Gergely Kontra http://www.mcl.hu/~kgergely ]------+ > | PhD Student (Room:IB113) PGP ID: 0x7E3846BF Mobile:(+36 20)356 9656 | > | Budapest University of Technology and Economics ICQ# 175564914 | > +------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+ > From ulf@REDACTED Sun Jun 11 14:02:39 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 14:02:39 +0200 Subject: Loading application variables In-Reply-To: <1150021824.12185.36.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> Message-ID: I don't know if there's a standard function for loading the .config file, but you can read and parse a .config file with file:consult("miselfu.config"), and you can set environment variables with application:set_env(AppName, Key, Value). BR, Ulf Wiger Den 2006-06-11 12:30:24 skrev Pupeno : > Hello, > I have written an Erlang application called MiSelfu (well, miselfu > actually). I can start it from the command line with: > > erl -sname miselfu -boot miselfu > -config /usr/local/etc/miselfu/miselfu.config > > but I'd like to be able to start it from a already-running emulator, > that's so I can run it from within my shell running within Emacs. > I can try: > >> application:start(miselfu). > > =INFO REPORT==== 11-Jun-2006::12:04:35 === > application: miselfu > exited: {shutdown,{miselfu_app,start,[normal,[]]}} > type: temporary > {error,{shutdown,{miselfu_app,start,[normal,[]]}}} >> > > but as you can see, I get a non-very descriptive error (at least, for my > eyes). I only can think of the missing config file as the problem. How > do I load that config file[1] to be able to run my application ? > Am I doing something wrong ? > As a newbie to Erlang and not knowing anyone else using it (I have never > seen anyone else codding on Erlang), I am not sure about the best way to > go thru the development cicle. > Thank you. -- Ulf Wiger From pupeno@REDACTED Sun Jun 11 14:06:50 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 11 Jun 2006 14:06:50 +0200 Subject: Loading application variables In-Reply-To: References: <1150021824.12185.36.camel@ulab.pupeno.com> Message-ID: <1150027610.12185.50.camel@ulab.pupeno.com> On Sun, 2006-06-11 at 14:02 +0200, Ulf Wiger wrote: > I don't know if there's a standard function for loading the .config file, > but you can read and parse a .config file with > file:consult("miselfu.config"), and you can set environment variables with > application:set_env(AppName, Key, Value). So, you don't normally work that way ? Opening up a shell on Emacs, running the application and re-loading code as it is modified ? Thanks. -- Pupeno http://pupeno.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: This is a digitally signed message part URL: From ulf@REDACTED Sun Jun 11 14:22:44 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 14:22:44 +0200 Subject: Loading application variables In-Reply-To: <1150027610.12185.50.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> Message-ID: Den 2006-06-11 14:06:50 skrev Pupeno : > On Sun, 2006-06-11 at 14:02 +0200, Ulf Wiger wrote: >> I don't know if there's a standard function for loading the .config >> file, >> but you can read and parse a .config file with >> file:consult("miselfu.config"), and you can set environment variables >> with >> application:set_env(AppName, Key, Value). > > So, you don't normally work that way ? Opening up a shell on Emacs, > running the application and re-loading code as it is modified ? > > Thanks. Well, you can also set environment variables via the command line, e.g. erl -miselfu echoTCPPort 7 ... but in order for them to actually take, you also need to load the miselfu application, using application:load(miselfu). If your variables are defined in a .config file, I thought it would be easier to write a small erlang function that reads it and sets them appropriately. It can be done in less than 10 lines of code. I personally try to use builder in situations like that. It builds a bash script that loads all given applications, but doesn't start them (except the mandatory kernel and stdlib), essentially so that one could fire up an erlang shell, with the code path and all the environment variables set, and then do initialization or debugging from the shell. BR, Ulf W -- Ulf Wiger From sean.hinde@REDACTED Sun Jun 11 14:39:42 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Sun, 11 Jun 2006 13:39:42 +0100 Subject: Loading application variables In-Reply-To: <1150027610.12185.50.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> Message-ID: On 11 Jun 2006, at 13:06, Pupeno wrote: > On Sun, 2006-06-11 at 14:02 +0200, Ulf Wiger wrote: >> I don't know if there's a standard function for loading >> the .config file, >> but you can read and parse a .config file with >> file:consult("miselfu.config"), and you can set environment >> variables with >> application:set_env(AppName, Key, Value). > > So, you don't normally work that way ? Opening up a shell on Emacs, > running the application and re-loading code as it is modified ? I would think that most more serious erlang applications use the sys.config file for a few parameters that are only required at startup and not subject to change. Parameters that should change at runtime would typically be stored in a database or opened up as APIs so they can be changed without restarting the application. Of course your application might be such that it can be restarted after every config change, in which case sys.config might be sufficient. Sean From pupeno@REDACTED Sun Jun 11 14:42:43 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 11 Jun 2006 14:42:43 +0200 Subject: Loading application variables In-Reply-To: References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> Message-ID: <1150029763.12185.57.camel@ulab.pupeno.com> On Sun, 2006-06-11 at 14:22 +0200, Ulf Wiger wrote: > Den 2006-06-11 14:06:50 skrev Pupeno : > Well, you can also set environment variables via the command line, e.g. > > erl -miselfu echoTCPPort 7 ... If I was running erl myself I would just run erl -config /usr/local/etc/miselfu/miselfu.config and then application:start(miselfu). just works. But the thing is that I am not running erl myself, Emacs is. And although I can customize the command line, I don't want to always load the config file, I may not be codding miselfu itself. > but in order for them to actually take, you also need to load the miselfu > application, using application:load(miselfu). If your variables are > defined in a .config file, I thought it would be easier to write a small > erlang function that reads it and sets them appropriately. It can be done > in less than 10 lines of code. I understand it can be written, but since nobody has written it yet I suppose people work in other ways, if so, I want to learn that instead of writing a function (that doesn't belong to my project anyway, but to Erlang itself). > I personally try to use builder What is builder ? > in situations like that. It builds a bash > script that loads all given applications, but doesn't start them (except > the mandatory kernel and stdlib), essentially so that one could fire up an > erlang shell, with the code path and all the environment variables set, > and then do initialization or debugging from the shell. I think that solution is not quite what I need either. Thank you. -- Pupeno http://pupeno.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: This is a digitally signed message part URL: From thomasl_erlang@REDACTED Sun Jun 11 14:47:51 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 11 Jun 2006 05:47:51 -0700 (PDT) Subject: dets improvements? In-Reply-To: Message-ID: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> --- Ulf Wiger wrote: > To be fair, mnesia doesn't target the same > applications as e.g. PostgreSQL > and MySQL. It's difficult to come up with database > systems that achieve > such tight integration with the applications. There > is no semantic gap and > overhead is very low. Personally, I'd prefer not to use an external database. However, my impression, based on this list as well as elsewhere, is that for higher-level web or telco services, Mnesia will have to compete with ODBC and external databases or simply be left along the wayside. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pupeno@REDACTED Sun Jun 11 14:51:02 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 11 Jun 2006 14:51:02 +0200 Subject: Loading application variables In-Reply-To: References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> Message-ID: <1150030262.12185.59.camel@ulab.pupeno.com> On Sun, 2006-06-11 at 13:39 +0100, Sean Hinde wrote: > On 11 Jun 2006, at 13:06, Pupeno wrote: > > > On Sun, 2006-06-11 at 14:02 +0200, Ulf Wiger wrote: > >> I don't know if there's a standard function for loading > >> the .config file, > >> but you can read and parse a .config file with > >> file:consult("miselfu.config"), and you can set environment > >> variables with > >> application:set_env(AppName, Key, Value). > > > > So, you don't normally work that way ? Opening up a shell on Emacs, > > running the application and re-loading code as it is modified ? > > I would think that most more serious erlang applications use the > sys.config file for a few parameters that are only required at > startup and not subject to change. Parameters that should change at > runtime would typically be stored in a database or opened up as APIs > so they can be changed without restarting the application. > > Of course your application might be such that it can be restarted > after every config change, in which case sys.config might be sufficient. So far, these configurations, are port numbers. You have to interrupt the service anyway to change the port you offer the service on. Although I may store them on a DB latter, right now I only want to be able to run the app from erl. -- Pupeno http://pupeno.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: This is a digitally signed message part URL: From ulf@REDACTED Sun Jun 11 16:25:03 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 16:25:03 +0200 Subject: Loading application variables In-Reply-To: <1150029763.12185.57.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> <1150029763.12185.57.camel@ulab.pupeno.com> Message-ID: Den 2006-06-11 14:42:43 skrev Pupeno : > I understand it can be written, but since nobody has written it yet I > suppose people work in other ways, if so, I want to learn that instead > of writing a function (that doesn't belong to my project anyway, but to > Erlang itself). What I normally do is (possibly) use environment variables to store defaults, and then providing an API for setting the desired values at runtime. Mnesia, for example, relies on environment variables for various settings, but you can also call mnesia:start(Options), and set the same values that way. What mnesia does at startup is to read the options - either passed as arguments to the start function, or given as environment variables - and then storing them as temporary objects in the schema. The module proplists is a convenient way to handle {Key, Value} options. You can, for example, do: start(StartOpts) -> Options = StartOpts ++ application:get_all_env(?APP_NAME), Port = proplists:get_value(port, Options), ... The proplists module will fetch the first instance of a given key, so all you need to do to override the defaults is to prepend the new values to the list. Regards, Ulf W -- Ulf Wiger From yarivvv@REDACTED Sun Jun 11 16:39:55 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 11 Jun 2006 10:39:55 -0400 Subject: dets improvements? In-Reply-To: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> References: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> Message-ID: <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> > > Personally, I'd prefer not to use an external > database. > However, my impression, based on this list as well as > elsewhere, is that for higher-level web or telco > services, Mnesia will have to compete with ODBC and > external databases or simply be left along the > wayside. I think that with its new clustering features, MySQL has positioned itself as very serious competition for Mnesia even in Mnesia's home court: soft real time applications. Yes, with MySQL you still have the semantic gap, which is not as sexy as with a pure Erlang DB. However, MySQL cluster has similar performace to Mnesia AFAIK, and it gives you a mix of in-memory clustered tables as well as high capacity, high speed transactional disc tables. The latest version, MySQL 5.1, even has clustered disc tables, where only index rows are kept in RAM. MySQL has a great track record with running high traffic websites, it undergoes rapid development, and, best of all, MySQL is open source. I think that if Ericsson wants Mnesia to stay relevent, it should invest significant resources in its continuing improvement. The competition is heating up and Mnesia is losing ground fast. If Postgres develops a clustered version, Mnesia will be in even greater trouble. Yariv From pupeno@REDACTED Sun Jun 11 16:42:55 2006 From: pupeno@REDACTED (Pupeno) Date: Sun, 11 Jun 2006 16:42:55 +0200 Subject: Loading application variables In-Reply-To: References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> <1150029763.12185.57.camel@ulab.pupeno.com> Message-ID: <1150036975.12185.66.camel@ulab.pupeno.com> On Sun, 2006-06-11 at 16:25 +0200, Ulf Wiger wrote: > Den 2006-06-11 14:42:43 skrev Pupeno : > > > I understand it can be written, but since nobody has written it yet I > > suppose people work in other ways, if so, I want to learn that instead > > of writing a function (that doesn't belong to my project anyway, but to > > Erlang itself). > > What I normally do is (possibly) use environment variables to store > defaults, and then providing an API for setting the desired values > at runtime. > > Mnesia, for example, relies on environment variables for various settings, > but you can also call mnesia:start(Options), and set the same values that > way. What mnesia does at startup is to read the options - either passed as > arguments to the start function, or given as environment variables - and > then storing them as temporary objects in the schema. > > The module proplists is a convenient way to handle {Key, Value} options. > You can, for example, do: > > start(StartOpts) -> > Options = StartOpts ++ application:get_all_env(?APP_NAME), > Port = proplists:get_value(port, Options), > ... > > > The proplists module will fetch the first instance of a given key, so all > you need to do to override the defaults is to prepend the new values to > the list. Does this mean that I would not be using the standard way of application to load configuration files ? -- Pupeno http://pupeno.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: This is a digitally signed message part URL: From gefla@REDACTED Sun Jun 11 16:45:44 2006 From: gefla@REDACTED (Gerd Flaig) Date: Sun, 11 Jun 2006 16:45:44 +0200 Subject: Loading application variables References: <1150021824.12185.36.camel@ulab.pupeno.com> Message-ID: <871wtv699j.fsf@kilo.pond.sub.org> Pupeno writes: > Hello, > I have written an Erlang application called MiSelfu (well, miselfu > actually). I can start it from the command line with: > > erl -sname miselfu -boot miselfu > -config /usr/local/etc/miselfu/miselfu.config > > but I'd like to be able to start it from a already-running emulator, > that's so I can run it from within my shell running within Emacs. you can also try setting inferior-erlang-machine-options in Emacs before starting the emulator, e.g. like this (untested!): (setq inferior-erlang-machine-options '("-sname" "miselfu" "-boot" "miselfu" "-config" "/usr/local/etc/miselfu/miselfu.confog")) I would be very interested to hear if anybody has configured erlang-mode in a way so that erlang-compile and erlang-next-error interact with a distel-connected node instead of an inferior-erlang buffer. Goodbyte, Gerd. -- The last thing one knows in constructing a work is what to put first. -- Blaise Pascal From thomasl_erlang@REDACTED Sun Jun 11 19:10:24 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 11 Jun 2006 10:10:24 -0700 (PDT) Subject: dets improvements? In-Reply-To: <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> Message-ID: <20060611171024.71375.qmail@web38802.mail.mud.yahoo.com> --- Yariv Sadan wrote: > I think that if Ericsson wants Mnesia to stay > relevent, it should > invest significant resources in its continuing > improvement. The > competition is heating up and Mnesia is losing > ground fast. Well, to be honest, Mnesia would be lucky to take measurable percentages of MySQL customers ... But it's a bit worrying that even Erlang projects seem to be chosing other solutions. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf@REDACTED Sun Jun 11 19:16:02 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 19:16:02 +0200 Subject: dets improvements? In-Reply-To: <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> References: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> Message-ID: Den 2006-06-11 16:39:55 skrev Yariv Sadan : > I think that with its new clustering features, > MySQL has positioned itself as very serious > competition for Mnesia even in Mnesia's home > court: soft real time applications. Yes, with > MySQL you still have the semantic gap, which > is not as sexy as with a pure Erlang DB. However, > MySQL cluster has similar performace to Mnesia AFAIK, MySQL Cluster (a.k.a. NDB) actually outperforms Mnesia rather significantly on in-memory database clusters. It is one of the few comparable products that does. In terms of transactions/second, NDB should be at least 2-4x faster than mnesia. > MySQL has a great track record with running high traffic > websites, it undergoes rapid development, and, best of > all, MySQL is open source. Well, a dual license, actually. But for practical purposes, this often means GPL. > I think that if Ericsson wants Mnesia to stay relevent, > it should invest significant resources in its continuing > improvement. The competition is heating up and Mnesia is > losing ground fast. I don't know about losing ground. Mnesia never did target large databases, or even really cluster databases (even though it's turned out to be surprisingly competitive as a cluster database.) The standard solution for people handling large databases from Erlang is to use MySQL, Sybase or Oracle. There are lots of applications where mnesia is the obvious choice, mainly due to the seamless integration, but also because it runs in the same memory space and can serve simple requests within tens of microseconds. Also, the only ones who ever choose mnesia are Erlang programmers. The lack of an ODBC interface (to mnesia) pretty much makes it a non-starter for anyone not using Erlang. Having said this, I would very much like to see mnesia expand its capabilities, relieving more Erlang programmers from the hassles of ODBC and third-party product integration. (: BR, Ulf W -- Ulf Wiger From ulf@REDACTED Sun Jun 11 19:20:32 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Jun 2006 19:20:32 +0200 Subject: Loading application variables In-Reply-To: <1150036975.12185.66.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> <1150029763.12185.57.camel@ulab.pupeno.com> <1150036975.12185.66.camel@ulab.pupeno.com> Message-ID: Den 2006-06-11 16:42:55 skrev Pupeno : >> The module proplists is a convenient way to handle >> {Key, Value} options. You can, for example, do: >> >> start(StartOpts) -> >> Options = StartOpts ++ application:get_all_env(?APP_NAME), >> Port = proplists:get_value(port, Options), >> ... >> >> >> The proplists module will fetch the first instance of a given >> key, so all you need to do to override the defaults is to >> prepend the new values to the list. > > Does this mean that I would not be using the standard way of application > to load configuration files ? No, you would use applications and config files in the normal fashion. You just don't look up the environment parameters using application:get_env() at runtime, but rather in bulk at application start, copying the values to your own dynamic store (e.g. a mnesia ram copy table). This gives you the freedom to tweak the environment at will. BR, Ulf W -- Ulf Wiger From nm@REDACTED Sun Jun 11 20:44:49 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 11 Jun 2006 23:44:49 +0500 Subject: [Erlyaws-list] yaws 1.62 In-Reply-To: <17244f480606110613ja78a761xe089e2c15a3adab4@mail.gmail.com> References: <44873FC4.40105@hyber.org> <4487B14E.9020500@web.am> <17244f480606110613ja78a761xe089e2c15a3adab4@mail.gmail.com> Message-ID: <448C64A1.5080100@web.am> Hi, Yariv! Yariv Sadan wrote: > Hi, > > Is there a way of exposing only specific functions/modules to JSON-RPC > and making the rest inaccessible (for security)? > > Thanks > Yariv you are expriclity passing to yaws_(json|xml)rpc:handler(_session) which Module:Function should be called ;) *RPC methods are passed as one of the arguments to that function -- i.e. in payload which have {call, Method, Arguments} form, Method is an atom. so you can define handle_rpc(State, {call, add, [ A, B ]}) -> {false, {response, [ A + B ]}}; handle_rpc(State, {call, substract, [ A, B ]}) -> {false, {response, [ A - B ]}}. Thus you will explictly allow RPC caller use 2 methods - add and substract. Regards, Gaspar x-posted to erlang-questions too. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From yarivvv@REDACTED Sun Jun 11 21:03:14 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 11 Jun 2006 15:03:14 -0400 Subject: dets improvements? In-Reply-To: References: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> Message-ID: <17244f480606111203i46dfb1cem7fbdd5272307721f@mail.gmail.com> > I don't know about losing ground. Mnesia never did target large databases, > or even really cluster databases (even though it's turned out to be > surprisingly competitive as a cluster database.) The standard solution for > people handling large databases from Erlang is to use MySQL, Sybase or > Oracle. There are lots of applications where mnesia is the obvious choice, > mainly due to the seamless integration, but also because it runs in the > same memory space and can serve simple requests within tens of > microseconds. I think that with other DBMS racing forward with clustering and soft real-time performance, while also providing large storage capacity, etc, Mnesia's niche shrinks. There's a good argument for using only 1 DBMS in an application, so (forgetting cost for a second) usually the most versatile DBMS wins. According to Claes, the dets issues that handicap Mnesia disc storage can be fixed: http://erlang.org/ml-archive/erlang-questions/200605/msg00042.html. This alone will make Mnesia suitable for a much larger array of applications. What do you think about his proposed solution? That thread wasn't about adding ordering to dets tables. Maybe the create_table function should accept a comparator function as a parameter? (compare(A, B) -> first | second | equal) > > Having said this, I would very much like to see mnesia expand its > capabilities, relieving more Erlang programmers from the hassles of ODBC > and third-party product integration. (: > So would I :) Best, Yariv From bsder@REDACTED Sat Jun 10 13:01:49 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sat, 10 Jun 2006 04:01:49 -0700 Subject: Erlang goes multicore In-Reply-To: <20060609103405.GA6907@memphis.ilius.fr> References: <4487717C.8050908@allcaps.org> <200606090829.11286.pupeno@pupeno.com> <20060609103405.GA6907@memphis.ilius.fr> Message-ID: <448AA69D.8040409@allcaps.org> Mickael Remond wrote: > * Pupeno [2006-06-09 08:29:11 +0000]: > >> On Thursday, 8 de June de 2006 00:38, Andrew Lentvorski wrote: >>> Yes, some marketing would be *good*. >> At least, a Slashdot post. > > I already tried the Slashdot article for the new version and it has been > rejected. It is quite unclear to me what are the criterium for > rejection. Reddit or Digg might be friendlier. Reddit has more than a few functional programming aficionados sitting in the background. I believe it was reddit that had the blog postings about the Erlang poker server that finally pushed me to start looking seriously at Erlang for protocol mashing. -a From ulf@REDACTED Mon Jun 12 00:47:08 2006 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 12 Jun 2006 00:47:08 +0200 Subject: dets improvements? In-Reply-To: <17244f480606111203i46dfb1cem7fbdd5272307721f@mail.gmail.com> References: <20060611124751.22747.qmail@web38808.mail.mud.yahoo.com> <17244f480606110739u74533a85lf421875ed40263f5@mail.gmail.com> <17244f480606111203i46dfb1cem7fbdd5272307721f@mail.gmail.com> Message-ID: Den 2006-06-11 21:03:14 skrev Yariv Sadan : > According to Claes, the dets issues that handicap Mnesia disc storage > can be fixed: > http://erlang.org/ml-archive/erlang-questions/200605/msg00042.html. > This alone will make Mnesia suitable for a much larger array of > applications. What do you think about his proposed solution? I bow to Klacke's authority on the subject. /Ulf W -- Ulf Wiger From ok@REDACTED Mon Jun 12 03:23:16 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 12 Jun 2006 13:23:16 +1200 (NZST) Subject: newbie question: flat_length example Message-ID: <200606120123.k5C1NGmg207427@atlas.otago.ac.nz> "Quan Ta" wrote: -module(list2). -export([flat_length/1]). %% flat_length(List) %% Calculate the length of a list of lists. Why are you writing a function that is already there (lists:flatlength/1)? flat_length([H,T], N) when list(H) -> ----------------------^ The error is almost certainly there; a comma where there should be a vertical bar. flat_length(T, flat_length(H, N)); Erlang's lists:flatten/1 is rather odd. The traditional specification of flatten in Lisp goes something like this: (define (flatten L) (if (pair? L) (append (flatten (car L)) (flatten (cdr L))) (if (null? L) '() (list L)))) from which we conclude that (flatten 27) ==> (27). The Erlang version, flatten(List) when list(List) -> do_flatten(List, []). do_flatten([H|T], Tail) when list(H) -> do_flatten(H, do_flatten(T, Tail)); do_flatten([H|T], Tail) -> [H|do_flatten(T, Tail)]; do_flatten([], Tail) -> Tail. makes the top level quite inconsistent with lower levels. Why? Why should lists:flatten($x) crash instead of answering "x"? The definition of lists:flatlength/1 (andwhyisthenameruntogetherlikethat?) is this: flatlength(List) -> flatlength(List, 0). flatlength([H|T], L) when list(H) -> flatlength(H, flatlength(T, L)); flatlength([_|T], L) -> flatlength(T, L + 1); flatlength([], L) -> L. This structure is similar (but not identical) to the structure of flatten/1. For the sake of efficiency, it shouldn't be. The first clause of flatlength/2 should be flatlength([H|T], L) when list(H) -> flatlength(T, flatlength(H, L)); From yarivvv@REDACTED Mon Jun 12 06:00:24 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 12 Jun 2006 00:00:24 -0400 Subject: Helen OS Message-ID: <17244f480606112100x79a432d9ybf24383ba1339d72@mail.gmail.com> Hi, I just saw on Digg this Interesting new open source OS: http://www.helenos.eu/. Among other things, It has support for SMP, Kernel threads, userspace threads, userspace pseudo-threads ("Userspace pseudo threads are very lightweight threads running in the context of one userspace thread") and IPC ("the ability of userspace threads to communicate with other threads (possibly from different tasks) via sending and receiving, synchronously or asynchronously, short messages"). The full list is here: http://www.helenos.eu/?reason=features. This sounds very Erlangy. I wonder if these features would make it possible to write C/C++ code with the same scalability characteristics as Erlang at large numbers of concurrent processes. Yariv From bengt.kleberg@REDACTED Mon Jun 12 08:46:26 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 12 Jun 2006 08:46:26 +0200 Subject: Erlang course material for beginners In-Reply-To: <20c3fe42ac641e735c88e609c38ba161@elisa.ee> References: <20c3fe42ac641e735c88e609c38ba161@elisa.ee> Message-ID: <448D0DC2.5080604@ericsson.com> On 2006-06-09 14:18, Taavi Talvik wrote: ...deleted > Does anybody have good introductory course material or > useful guidelines for course outline (which can be distributed)? have you looked at http://www.erlang.org/course/course.html ? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bengt.kleberg@REDACTED Mon Jun 12 10:28:51 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 12 Jun 2006 10:28:51 +0200 Subject: Summary: E / Erlang integration In-Reply-To: <11888713.8581149887409449.JavaMail.root@zimbra> References: <11888713.8581149887409449.JavaMail.root@zimbra> Message-ID: <448D25C3.9090605@ericsson.com> On 2006-06-09 23:10, Michael FIG wrote: ...deleted > To answer more about MarkM's comments, I'm talking about Erlang-E (E semantics > embedded in Erlang) waht are your thoughts about handling the non-blocking receive of E? do you want all e:when_catch() (made up name) to be non blocking? ...deleted > "Promise = e:send(CryptoCap, Message)". However, the when/catch construct > of E would be clunky to use without some syntactic sugar. > > With sugar: > > promise_case e:send(RaceTrack, getPolePositionCar) of > FarPolePositionCar -> > io:format("My car is in pole position~n"); > after 3000 -> > io:format("Timed out~n") > catch E -> > ok; > end. > > without sugar: > > e:pcase(e:send(RaceTrack, getPolePositionCar), > fun (SomeFreshName) -> > case SomeFreshName of > FarPolePositionCar -> > io:format("My car is in pole position~n"), > matched; > _ -> > notmatched > end > end, > 3000, fun () -> io:format("Timed out~n"), > fun (E) -> ok end). could you explain how the 'notmatched case clause will be reached? also, perhaps it would be simpler to understand e:pcase/5 if you wrote it like in edoc: @spec my_function(X::integer()) -> integer() perhaps that would be: @spec pcase( Promise::promise(), Receive::function(), Timeout_time::integer(), Timeout::function(), Error::function() ) -> atom() promise() = ??? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From joe.armstrong@REDACTED Mon Jun 12 10:53:57 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 12 Jun 2006 10:53:57 +0200 Subject: Language Bindings for Erlang Again Message-ID: Yariv Sadan posted the following *wonderful* advice: > Joe, please do a Ruby on Rails tutorial (you can easily find one on > Google) -- it'll be a very rewarding experience :) Once you > have everything installed, It shouldn't take you more than > than 10 minutes to create a complete database-driven Rails web app. I did - and here's what happened ( this is long so, but there is a moral at the end ...) To start with its lucky Yariv said (Once you have everything installed) - this step took about 5 hours. Of course RoR didn't work "out of the box" on my Ubuntu breezy. I ran the good old > apt-get install Installed rails and got the *wonderful* error message "Rails does not work with Ruby version 1.8.3 Please upgrade to version 1.8.4 or downgrade to version 1.8.2." This must the all-time greatest error message. For this to work you need *either* the previous version of the software or the *next* version of the software - but NOT the version you actually have. I Googled away and found several "this worked for me" recipes and followed them pedantically - did they work - NO. Finally I did what I should have done from the start, take Ruby 1.8.2 and compiled from the sources. Two hours later I could start the tutorial. Step one: Create the scaffolding "Wow - something happened" Lot's of files were created - (and when I say lots, I mean lots) - all with funny extensions .rhtml, .rb, .yml - I've no idea what these are - but what ho - who cares - live dangerously, press on. Then I had to edit one of these files and put my mysql password in. Big problems - did you know I am the only programmer on the planet who does not not know how to configure MySQL. I didn't even know IO had MySQL installed on my machine - but there it was lurking on my hard disk - in a shady corner where I hadn't noticed. I found that I could talk to MySQL as root - mysql didn't like Joe and refused to talk to him. Back to google - I found dozens of magic spells that supposedly would change Joe's password - non worked. Finally I killed and reincarnated myself - this didn't even take three days - only another hour and half - though is *felt* like three days. Then I could "run" my application. I gave some command, I forget which, and pointed my browser at localhost:3000 (I'm making this up - I forget) and BINGO "Congratulations you have just programmed your first application" At this stage I felt very pleased - "Wow - I'm a programmer" - the feel good factor was high here - time for a congratulatory glass. Did any of the above sound familiar - Yariv was spot on "Once you have everything installed, ... shouldn't take you more than 10 minutes ..." Now guess what - I hadn't even got this stuff running with Apache - which I guess would take another few hours of frustration. .... after a couple of glasses of Riesling (I think) - or possibly a Pinot, I could clearly see how Erlang on Steroids should do things: We'll call it the ONE TWO THREE method. ONE: Install Erlang, then wget eos.tgz, unpack etc. TWO: Create a directory somewhere: Type the command: > eos_make_app MyApp This should create a new directory, with a small number of files in it These files should contain *English* and say what they do. If they do have code in the code should be "almost" English so you can have some chance of understanding them. They should contain references to manuals etc. THREE: Type the command: > eos_run_app MyApp The app will start and your browser will open a new page pointing at the App The applications should have those heart-warming feel goodwords - "Congratulations you are a Genius and have just programmed your first application" - which you can show to your Gran and children - "Hey kids - come and look. Your father is a Genius, I've just programmed my first web app - how about that - I bet Jonny WhistleThorp Jrn's. Brother's half sister's taxi-driver's Father can't do that ... I have said (many times) that I do not want to have to learn three things to make a web app (ruby|python|php, mysql|oracle|..., apache|...) ONLY ONE (erlang|mnesia=erlang|yaws=erlang) Now all I have to do is rework the front end to eos - so that it corresponds to my daydream. Oh, and thanks, Yariv, for the good advice. /Joe From ulf.wiger@REDACTED Mon Jun 12 11:12:33 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 12 Jun 2006 11:12:33 +0200 Subject: Summary: E / Erlang integration Message-ID: I think that even without sugar, it can be cleaned up a little: %% @spec send(To, Request, Timeout, MatchFun) -> Result %% @throws timeout try e:send(RaceTrack, getPolePositionCar, 3000, fun(N) when N ==FarPolePositionCar -> io:format("My car is in pole position~n"), match; (_) -> no_match end) of Result -> Result catch throw:timeout -> ... end. I'd rename the function to something other than send(), since the asynchronous send-and-pray function in erlang is erlang:send(Dest, Msg). I see no reason to create funs for anything but a filter function. This fun should be passed to another process, and the return values passed back as regular messages. Compare with gen_server call. BR, Ulf W Michael FIG wrote: > > I retract my original suggestion of developing > special syntax for E message sending (the !< part), since > that can easily be accomplished by a library function > "Promise = e:send(CryptoCap, Message)". However, the > when/catch construct of E would be clunky to use without some > syntactic sugar. > > With sugar: > > promise_case e:send(RaceTrack, getPolePositionCar) of > FarPolePositionCar -> > io:format("My car is in pole position~n"); > after 3000 -> > io:format("Timed out~n") > catch E -> > ok; > end. > > without sugar: > > e:pcase(e:send(RaceTrack, getPolePositionCar), > fun (SomeFreshName) -> > case SomeFreshName of > FarPolePositionCar -> > io:format("My car is in pole position~n"), > matched; > _ -> > notmatched > end > end, > 3000, fun () -> io:format("Timed out~n"), > fun (E) -> ok end). From joe.armstrong@REDACTED Mon Jun 12 11:45:56 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 12 Jun 2006 11:45:56 +0200 Subject: Language Bindings for Erlang Again (Opinion) Message-ID: > -----Original Message----- > From: Andrew Lentvorski [mailto:bsder@REDACTED] > Sent: den 9 juni 2006 03:12 > To: Joe Armstrong (AL/EAB) > Cc: Gerd Flaig; erlang-questions@REDACTED > Subject: Re: Language Bindings for Erlang Again (Opinion) .. cut .. > > What does "not computer scientists" mean? What are the > likely qualifications of a "regular" Ericsson programmer? Not computer scientist means "not having a degree in computer science" The most likely qualifications would have been 5-10 years "on the job" experience. > I find it unlikely that these programmers would qualify as > average on any measure. I find it more likely that these > programmers qualify closer to "excellent" than "good". I disagree - very few programmers qualify as excellent - They guys I taught were average almost be definition - Ericsson is a huge (for Swedish standards) employer of programmers - it almost *defines* average by virtue of the fact that employs vast numbers of programmers. > > That, at least, has been my experience with programmers who > can do protocol stacks and heavy hardware programming. > But a system has far more to it than stacks and drivers > > In most cases I observed that "a good programmer in X" will > become "a > > good programmer in Y" > > (for all X and Y) this appears to be universally true. > > No argument. > > > with dynamic hash tables - the only problem in switching > languages is > > learning the libraries>> > > Ayup. > > > Our pupils had two minor problems. > > > > - recursion, and > > - write once variables > > - processes > > > > Now recursion was only a problem IF YOU USED THE WORD > RECURSION - it > > seemed like somewhere lurking at the back of their brains > was the idea > > that "recursion is difficult" > > and the word "recursion" triggered an immune response - we > tried never > > to mention it. > > I'll keep that in mind about recursion. That's probably good > advice no matter what the functional language is. > > You left out "pattern matching"--I find this to be a more > fundamental problem. This tells me that your groups have > selection bias. Folks working on protocol stacks understand > finite state automata inside and out. "Average" programmers > have no such background. > I've never met anybody who didn't understand pattern matching. The only case that needs some explanation is that X = X + 1 will always fail :-) > This is a problem even when teaching languages like Java and > trying to explain regular expressions. But Erlang patterns and *far simpler* than regexps > > > Now I could write several pages here, since I wrote a lot of the > > documentation I would find it rather helpful to know which part > > "sucks" - please send me a list of errata or tell me exactly which > > parts of the documentation you are having problems with. > > How, when and why to use gen_server should be in the documentation. > How, when and why to use gen_fsm should be in the documentation. > etc. > > These aren't easy questions. They take lots of writing. > They take motivating examples. I'm well aware that coming up > with such docs is a pain in the butt (I wrote much of the > tutorials on FFI calls in OpenMCL). > > However, they are really useful to those new people coming > into the language for the first time. > Yup - the problem is that is extremely difficult to see the world through other people's eyes. A couple of days ago I played with Ruby on Rails - I hadn't the faintest idea what all these funny file extensions (.rb, .yml, .rhtml) meant - I guess I should try to remember this experience when writing Erlang tutorials - and tell people what .beam, .erl, .yrl, .htr files are unfortunately it's very difficult to remember to do this - since *everybody knows this* It takes years of explaining things before you realise that people just don't know what you think is "obvious". Example: - It was so obvious to me that "you need at least two computers to make a fault tolerant system" That I never mentioned it. When I did start mentioning it the response was amazing (to me at least) - many people had never really thought about this so they just assumed that somehow you could make fault-tolerant systems with one computer. Then I'd ask "what happens if it crashes?" Then I'd point out that "two computers = distributed programming, concurrent etc." So a consequence of "fault-tolerance" IS distribution and concurrency (this is less obvious - though after 20 years of working with this is seems to me to be self-evident" Now if you think about distribution you will rapidly realise that shared data structures and dangling pointers become very messy *when things start failing* so you'd better avoid them. << this realisation was incidentally the *start point* for Erlang, this was about 20 years ago. By 1989 Robert Virding, Mike William were convinced that fault-tolerance implied distribution, concurrency and no sharing. We argued this point at a conference in Bournemouth, we kept going on and on and on and on about making things work in the presence of failures - nobody else seemed interested, many people *still* don't get it>> ... and once you don't have shared things you can parallelise them on a multi-core CPU ... Now all of these are pretty "self-evident" - once you have seen the light - but it *is* very difficult (once you have seen the light) to recall what it was like before you had seen the light - which is why writing books atc. is so difficult. > -a > From bjorn@REDACTED Mon Jun 12 11:51:09 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 12 Jun 2006 11:51:09 +0200 Subject: Yecc bug In-Reply-To: <448B5A4F.6000103@telia.com> References: <448B5A4F.6000103@telia.com> Message-ID: Have you tried R11B? In R11B, quoted_atom/1 looks like this: quoted_atom(Atom) -> io_lib:fwrite('~w', [Atom]). /Bjorn Robert Virding writes: > There is a bug in yecc when using terminals whose names have > characters which need \ escaping, for example the atom '\\'. The > terminal atoms are generated without the extra "\" characters. This > means that the generated .erl file will not compile correctly and the > only fix is to go in by hand and add the "\" character. > > The bug is in the function quoted_atom which used to generate the atom > name string of terminals: > > quoted_atom(Atom) -> > [$'|atom_to_list(Atom)++"'"]. > > There are no problems using atoms like these in productions as the > code for generating the productions use erl_pp:expr which does it > right. > > Robert > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bsder@REDACTED Mon Jun 12 12:44:10 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 12 Jun 2006 03:44:10 -0700 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <448D457A.3010405@allcaps.org> Joe Armstrong (AL/EAB) wrote: > > Yariv Sadan posted the following *wonderful* advice: > >> Joe, please do a Ruby on Rails tutorial (you can easily find one on >> Google) -- it'll be a very rewarding experience :) Once you >> have everything installed, It shouldn't take you more than >> than 10 minutes to create a complete database-driven Rails web app. > > I did - and here's what happened ( this is long so, but there is a moral > at the end ...) > > To start with its lucky Yariv said (Once you have everything installed) > - this step > took about 5 hours. Of course RoR didn't work "out of the box" on my > Ubuntu breezy. Ouch. I'll ask some of the folks I know to see if there is something more equivalent to "Instant Rails" for Windows or "Locomotive" for OS X but instead for Linux. I'm not a big fan of Rails (too much magic for my taste), but Locomotive was rather well-done as a demonstration. It includes everything as local applications so that you don't have to do lots of installing to make everything work. I think it even included demonstration videos, IIRC. -a From bengt.kleberg@REDACTED Mon Jun 12 13:15:28 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 12 Jun 2006 13:15:28 +0200 Subject: Summary: E / Erlang integration In-Reply-To: References: Message-ID: <448D4CD0.8000509@ericsson.com> On 2006-06-12 11:12, Ulf Wiger (AL/EAB) wrote: > I think that even without sugar, it can be cleaned up a little: > > %% @spec send(To, Request, Timeout, MatchFun) -> Result > %% @throws timeout > > try e:send(RaceTrack, getPolePositionCar, 3000, > fun(N) when N ==FarPolePositionCar -> > io:format("My car is in pole position~n"), > match; > (_) -> no_match > end) of > Result -> Result > catch > throw:timeout -> ... > end. in the e documentation i think <- is used for send. it seems to have 2 ''arguments'' (<- is infix). there is no Timeout, nor any MatchFun. or am i missing something? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bsder@REDACTED Mon Jun 12 13:24:01 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 12 Jun 2006 04:24:01 -0700 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: References: Message-ID: <448D4ED1.2020305@allcaps.org> Joe Armstrong (AL/EAB) wrote: > Yup - the problem is that is extremely difficult to see the > world through other people's eyes. Oh, yeah. That's a big problem. My students surprised me this semester when they said: "CVS is the best drop box system we've ever had in a computer science course." I was appalled. First by the fact other teachers were using bizarre systems for turning in code rather than just using a standard, known, supported open source tool. Second by the fact that the students only saw the usefulness in terms of turning in the code to me. While *I* understand the value of source control, beginners have a very different viewpoint. > A couple of days ago > I played with Ruby on Rails - I hadn't the faintest idea > what all these funny file extensions (.rb, .yml, .rhtml) meant > - I guess I should try to remember this experience when writing Erlang > tutorials - and tell people what .beam, .erl, .yrl, .htr files are > unfortunately it's very difficult to remember to do this - since > *everybody knows this* Well, I find Rails to be a bit "magical". I kinda like the way Django does stuff, but I'm also more of a fan of Python than Ruby. No particular reason for that bias other than I learned Python first and Ruby doesn't seem to offer me enough to be worth learning yet another language. Although, I don't think I've bumped into .yrl or .htr files yet. The beam file format description from Bjorn was very nice for decoding beam files. Two things I would add are notes on tags (what they mean- u--Untagged; i--integer; a--atom, X&Y--Register Banks?, etc.) and how to decode integers. Decoding a big integer (or negative integer) has quite a few strange cases. I figured out how to decode integers up to about 9 bytes in length, after that, I don't quite see how it all goes together (especially for *really* big integers). > When I did start mentioning it the response was amazing (to me > at least) > - many people had never really thought > about this so they just assumed that somehow you could make > fault-tolerant systems > with one computer. Then I'd ask "what happens if it crashes?" > > Then I'd point out that "two computers = distributed > programming, concurrent etc." > > So a consequence of "fault-tolerance" IS distribution and > concurrency (this is less > obvious - though after 20 years of working with this is seems to > me to be > self-evident" Maybe it's obvious once somebody says it. Until then, you don't really think about it. ;) In addition, lots of the new folks coming to Erlang aren't that interested in the fault tolerance. They are searching for a better way to deal with concurrency. A lot of it has to do with peer-to-peer networking. Peer-to-peer demands concurrency and generally some level of dynamic typing for serialization/deserialization and gets really annoying to manage in languages like Java or C. term_to_binary() *alone* makes Erlang worth using in network protocols. > Now all of these are pretty "self-evident" - once you have seen > the light - > but it *is* very difficult (once you have seen the light) to > recall what it was > like before you had seen the light - which is why writing books > atc. > is so difficult. Yup. No argument there. I saw recently someone talking about a BitTorrent client. Perhaps that would make a nice tutorial for modern Erlang techniques. I know that I tend to go mucking about in yaws and ejabberd when I get stuck for ideas. I think that the Python for the original BitTorrent library is only about 6000 lines of code. Probably a lot of that is dealing with the lack of concurrency in Python and how to emulate that with generators. -a From yarivvv@REDACTED Mon Jun 12 14:25:30 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 12 Jun 2006 08:25:30 -0400 Subject: Language Bindings for Erlang Again In-Reply-To: References: Message-ID: <17244f480606120525v6ae4eedm40241684ec867113@mail.gmail.com> > > To start with its lucky Yariv said (Once you have everything installed) > - this step > took about 5 hours. Of course RoR didn't work "out of the box" on my > Ubuntu breezy. > > I ran the good old > > > apt-get install > > Installed rails and got the *wonderful* error message > > "Rails does not work with Ruby version 1.8.3 > Please upgrade to version 1.8.4 or downgrade to version 1.8.2." > > This must the all-time greatest error message. > > For this to work you need *either* the previous version of the software > or the *next* version of the software - but NOT the version you actually > have. > > I Googled away and found several "this worked for me" recipes and > followed them > pedantically - did they work - NO. > > Finally I did what I should have done from the start, take Ruby 1.8.2 > and compiled > from the sources. Joe, I'm using OS X. I tend to build everything from source so I'm not too familiar with Linux package management and how it affects Rails. Plus, to be fair, I said "once you have everything installed" -- at least Ruby, Rails and MySQL. > > Two hours later I could start the tutorial. > > Step one: > > Create the scaffolding > > "Wow - something happened" Lot's of files were created - (and when I say > lots, I mean > lots) - all with funny extensions .rhtml, .rb, .yml - I've no idea what > these are - but > what ho - who cares - live dangerously, press on. Rails is based on the MVC pattern. .rhtml are the ruby template files for the view. .rb files are the controller, model and helper files. .yml files are very simple data description files that populate your database during testing. Rails, has an integrated unit testing framework. > > Then I had to edit one of these files and put my mysql password in. > > Big problems - did you know I am the only programmer on the planet who > does not > not know how to configure MySQL. I didn't even know IO had MySQL > installed on > my machine - but there it was lurking on my hard disk - in a shady > corner where > I hadn't noticed. > > I found that I could talk to MySQL as root - mysql didn't like Joe and > refused to > talk to him. > > Back to google - I found dozens of magic spells that supposedly would > change Joe's > password - non worked. Finally I killed and reincarnated myself - > this didn't even take three days - only another hour and half - though > is *felt* > like three days. Again -- I said "once you have everything installed." However, setting up MySQL for the first time, although painful, at least should be a good learning experience :) > > Then I could "run" my application. I gave some command, I forget which, > and pointed my > browser at localhost:3000 (I'm making this up - I forget) and BINGO > > "Congratulations you have just programmed your first application" > > At this stage I felt very pleased - "Wow - I'm a programmer" - the feel > good factor > was high here - time for a congratulatory glass. Well, you *almost* made it to the point when you're ready to see the benefits Rails gives programmers. I hope you don't give up right now. > > Did any of the above sound familiar - Yariv was spot on "Once you have > everything installed, > ... shouldn't take you more than 10 minutes ..." > > Now guess what - I hadn't even got this stuff running with Apache - > which I guess would take > another few hours of frustration. You don't need Apache for developer. Just run "scripts/server". > > .... after a couple of glasses of Riesling (I think) - or possibly a > Pinot, > > I could clearly see how Erlang on Steroids should do things: > > We'll call it the ONE TWO THREE method. > > ONE: Install Erlang, then wget eos.tgz, unpack etc. > > TWO: Create a directory somewhere: > Type the command: > > > eos_make_app MyApp > > This should create a new directory, with a small number of files in > it > These files should contain *English* and say what they do. > > If they do have code in the code should be "almost" English so you > can have > some chance of understanding them. They should contain > references to manuals > etc. > > THREE: Type the command: > > > eos_run_app MyApp > > The app will start and your browser will open a new page > pointing at the App > > > The applications should have those heart-warming feel goodwords - > "Congratulations > you are a Genius and have just programmed your first application" - > which you can > show to your Gran and children - "Hey kids - come and look. Your father > is a Genius, > I've just programmed my first web app - how about that - I bet Jonny > WhistleThorp Jrn's. > Brother's half sister's taxi-driver's Father can't do that ... > > I have said (many times) that I do not want to have to learn three > things to > make a web app (ruby|python|php, mysql|oracle|..., apache|...) Unfortunately, as previously discussed on this list, Mnesia isn't quite ideal for disc-based storage. Therefore, knowing MySQL or Postgres will probably inescapable even for many users of Erlang on Steroids. Unforutnately, the only help I can give them on this matter is to google "erlang mysql". > > ONLY ONE (erlang|mnesia=erlang|yaws=erlang) > > Now all I have to do is rework the front end to eos - so that it > corresponds to > my daydream. > > Oh, and thanks, Yariv, for the good advice. Any time! There are about 15 other frameworks I can recommend you in a variety of different languages. Just let me know when you're done with Rails :) I hope you at least couple of relations, set up some relations and take it to the next step, where things *almost* start looking interesting. I also recommend using RJS, so you can skip Javascript altogether for ordinary things. Cheers, Yariv From yarivvv@REDACTED Mon Jun 12 14:29:59 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 12 Jun 2006 08:29:59 -0400 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <448D4ED1.2020305@allcaps.org> References: <448D4ED1.2020305@allcaps.org> Message-ID: <17244f480606120529x89f387eu6ac18aad6f8fe79b@mail.gmail.com> > > I think that the Python for the original BitTorrent library is only > about 6000 lines of code. Probably a lot of that is dealing with the > lack of concurrency in Python and how to emulate that with generators. > The Python code is single threaded. It uses non-blocking IO. It would be very interesting to see an Erlang implementation, From tty@REDACTED Mon Jun 12 15:43:39 2006 From: tty@REDACTED (tty@REDACTED) Date: Mon, 12 Jun 2006 09:43:39 -0400 Subject: dets improvements? Message-ID: I choose Mnesia because I could do interesting things with it including easily storing an AST for later interpretation or dynamically create/change table schema. Regards t -------- Original Message -------- From: Thomas Lindgren Apparently from: owner-erlang-questions@REDACTED To: Yariv Sadan Cc: Erlang Questions List Subject: Re: dets improvements? Date: Sun, 11 Jun 2006 10:10:24 -0700 (PDT) > > > --- Yariv Sadan wrote: > > > I think that if Ericsson wants Mnesia to stay > > relevent, it should > > invest significant resources in its continuing > > improvement. The > > competition is heating up and Mnesia is losing > > ground fast. > > Well, to be honest, Mnesia would be lucky to take > measurable percentages of MySQL customers ... But it's > a bit worrying that even Erlang projects seem to be > chosing other solutions. > > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com From jozsef.berces@REDACTED Mon Jun 12 18:47:04 2006 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces_=28LA/ETH=29?=) Date: Mon, 12 Jun 2006 18:47:04 +0200 Subject: Erlang for Windows Mobile 5.0 Message-ID: Hi, Does anyone tried to compile erlang for Windows Mobile 5.0. So then I could play with erlang even without my laptop :-) Thanks in advance, Jozsef -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Mon Jun 12 22:50:39 2006 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 12 Jun 2006 22:50:39 +0200 Subject: Yecc bug In-Reply-To: References: <448B5A4F.6000103@telia.com> Message-ID: <448DD39F.5060100@telia.com> Ooh so, it does. That's what you get for not using tha absolute latest release. :-) Now it seems to work. Robert Bjorn Gustavsson wrote: > Have you tried R11B? > > In R11B, quoted_atom/1 looks like this: > > quoted_atom(Atom) -> > io_lib:fwrite('~w', [Atom]). > > /Bjorn > > Robert Virding writes: > > >>There is a bug in yecc when using terminals whose names have >>characters which need \ escaping, for example the atom '\\'. The >>terminal atoms are generated without the extra "\" characters. This >>means that the generated .erl file will not compile correctly and the >>only fix is to go in by hand and add the "\" character. >> >>The bug is in the function quoted_atom which used to generate the atom >>name string of terminals: >> >>quoted_atom(Atom) -> >> [$'|atom_to_list(Atom)++"'"]. >> >>There are no problems using atoms like these in productions as the >>code for generating the productions use erl_pp:expr which does it >>right. >> >>Robert >> > > From kgergely@REDACTED Mon Jun 12 23:43:49 2006 From: kgergely@REDACTED (Gergely Kontra) Date: Mon, 12 Jun 2006 23:43:49 +0200 Subject: slightly off: bittorrent client In-Reply-To: References: Message-ID: On 6/11/06, Julian Fondren wrote: > You can find docs on http://www.erlang.org/ , as on-line HTML, as an HTML > tarball, and as a manpage tarball. I normally untar HTML and man pages > under /usr/local/lib/erlang , where Erlang installs, and then edit MANPATH > and add bookmarks as appropriate. > > I haven't looked very hard, but it doesn't seem that an Erlang bittorrent > /client/ exists. You might find it instructive to write one. Ok, I've found this: http://www.erlang.org/ml-archive/erlang-questions/200605/msg00207.html Tried to start it with the script with the following result: ./start Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe] Eshell V5.5 (abort with ^G) 1> =INFO REPORT==== 11-Jun-2006::23:36:59 === application: tracker exited: {bad_return,{{tracker,start,[normal,[]]}, {'EXIT',{undef, [{tracker,start,[normal,[]]}, {application_master,start_it_old,4}]}}}} type: temporary > > Anyway, you suggest that you do in fact have an Erlang bittorrent client and > just don't know how to set it up. Well, ask questions. "I don't know how to > set it up" only forces us to try and drag the question you should have asked > out of you. > > > On 6/10/06, Gergely Kontra wrote: > > Hi! > > > > A week ago I was told about erlang, and I was impressed the speed of > > the code, and finding another ML. > > But for now, I just want to replace my CPU eater bittorrent client to > > replace with an erlang one (I've found a message about that on this > > ML's archive), but I couldn't find any guide how to set it up. > > I have installed erlang and yaws from package under debian, and don't > > know where to hunt for docs. -- +-[ Gergely Kontra http://www.mcl.hu/~kgergely ]------+ | PhD Student (Room:IB113) PGP ID: 0x7E3846BF Mobile:(+36 20)356 9656 | | Budapest University of Technology and Economics ICQ# 175564914 | +------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+ From mattias.wadman@REDACTED Tue Jun 13 00:35:37 2006 From: mattias.wadman@REDACTED (Mattias Wadman) Date: Tue, 13 Jun 2006 00:35:37 +0200 Subject: slightly off: bittorrent client In-Reply-To: References: Message-ID: <448DEC39.5090105@galaxen.se> Gergely Kontra wrote: > Ok, I've found this: > http://www.erlang.org/ml-archive/erlang-questions/200605/msg00207.html It's not a bittorrent client it's a bittorrent tracker, the server that is contacted by clients to get other client peers. http://en.wikipedia.org/wiki/Bittorrent > Tried to start it with the script with the following result: > > ./start > Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe] > > Eshell V5.5 (abort with ^G) > 1> > =INFO REPORT==== 11-Jun-2006::23:36:59 === > application: tracker > exited: {bad_return,{{tracker,start,[normal,[]]}, > {'EXIT',{undef, > [{tracker,start,[normal,[]]}, > > {application_master,start_it_old,4}]}}}} > type: temporary Did you compile the code? run "make" first, you also need to modify the start script to have the correct yaws ebin path. -Mattias From pihentagy@REDACTED Tue Jun 13 01:37:34 2006 From: pihentagy@REDACTED (Gergely Kontra) Date: Tue, 13 Jun 2006 01:37:34 +0200 Subject: slightly off: bittorrent client In-Reply-To: <448DEC39.5090105@galaxen.se> References: <448DEC39.5090105@galaxen.se> Message-ID: Feeling dumb. Sorry for the noise. On 6/13/06, Mattias Wadman wrote: > Gergely Kontra wrote: > > Ok, I've found this: > > http://www.erlang.org/ml-archive/erlang-questions/200605/msg00207.html > It's not a bittorrent client it's a bittorrent tracker, the server that > is contacted by clients to get other client peers. -- +-[ Gergely Kontra http://www.mcl.hu/~kgergely ]------+ | PhD Student (Room:IB113) PGP ID: 0x7E3846BF Mobile:(+36 20)356 9656 | | Budapest University of Technology and Economics ICQ# 175564914 | +------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+ From ke.han@REDACTED Tue Jun 13 08:24:01 2006 From: ke.han@REDACTED (ke han) Date: Tue, 13 Jun 2006 14:24:01 +0800 Subject: Language Bindings for Erlang Again (Opinion) In-Reply-To: <17244f480606080610x40185837v3560bfefd157ab47@mail.gmail.com> References: <20060606004019.95345.qmail@web31602.mail.mud.yahoo.com> <20060606180100.36315.qmail@web38814.mail.mud.yahoo.com> <87y7w860bz.fsf@kilo.pond.sub.org> <44879248.7000905@allcaps.org> <17244f480606080610x40185837v3560bfefd157ab47@mail.gmail.com> Message-ID: <8573F5E8-A0BA-4626-A443-C89242825BE9@redstarling.com> On Jun 8, 2006, at 9:10 PM, Yariv Sadan wrote: > >> OTP cannot be picked up in 4 to 8 weeks because its documentation >> sucks. >> > > The documentation is actually very good. I agree that user comments > are lacking, but Joe is working on that. An official Erlang wiki would > be very helpful as well for people who aren't comfortable with mailing > lists. > The online mySQL docs are very good. http://dev.mysql.com/doc/refman/ 5.0/en/ What makes them so is the ability for users to annotate the docs with messages. I think erlang would benefit from this approach. > Cheers > Yariv From joe.armstrong@REDACTED Tue Jun 13 10:32:34 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 10:32:34 +0200 Subject: Implementing tables - advice wanted Message-ID: Hello, I've been thinking a bit about tables in Erlang. Erlang really really really (^100) needs tables. Tables are like records without the record declarations, or like ets tables with a nicer syntactic structure - they are what I used to call structs in earlier postings, but most other languages call them tables. In a Daghstuhl meeting we has a session on the theme "all you need are tables - virtually all dynamically typed languages (except Erlang) have tables. In Lua they are called tables, in Python dictionaries, in JavaScript associative arrays - the semantics of all these things are slightly different but essentially they are the same. All of these are first-class hash tables - think of them as hash tables on the heap. Of all the syntaxes and semantics Lua's attracts me most. Keys are strings or integers, conseqative ranges of integers (very useful for arrays) are handled in a special manner. I'm wondering about how to implement tables. Let's choose "@" as the table constructor (just about the only character left, that's unused. X = @{name="fred", age=23, footSize = 42} Name = X.name, ... creates a table, etc. the syntax is "just like records only with #Tag replaced by @. Now how could I implement this? Question how lightweight is ets? To try and answer this I wrote the following: Let's implement this: X = @{name="fred", age=23, footSize = 42} Name = X.name, By transforming into this: test() -> X = ets:new(anonymnous, []), ets:insert(X, [{name,fred}, {age,23}, {footSize, 42}]), [{_,Name}] = ets:lookup(X, name), io:format("Info:~p~n",[ets:info(X)]), Name. What I'm interested in is not the syntax - we can fix that later but the size of the ets object created. The info call returns Info:{{memory,310}, {owner,<0.39.0>}, {name,anonymnous}, {size,3}, {node,nonode@REDACTED}, {named_table,false}, {type,set}, {keypos,1}, {protection,protected}} The memory is 310 is this reasonable? - Let's do a quick calculation. My table has 3 keys, all atoms, and three values atoms or integers So: Space for Keys and values = 6 words Space for hash table = 6 words (say 2 x # entries) Headers = 4 words (guess) Extra space per entry = 3 x 3 = 9 words (guess) (this is for bucket overflows etc) This gets me to 25 words - so it looks like the 310 words is way too big. I then made an incrementally larger table by adding a {sex,male} entry - the new size was 321 words ie 11 words more for the additional entry. Without looking at the C code I'd imagine that most of the overhead is in the headers since etrs table are a lot more than simple hash tables. Suppose I want to implement tables. Do I - reuse some of the ets code - take a look at the Lua and do like they do - roll my own and if the answer is roll my own, what is the best approach? Should I keep the distinction between array indices and other things as indices in the table (a la Lua) or just put *everything* into a hash table? Should I use sorted lists, skip-lists, or binary searches instead of hash tables? I guess for "small" tables linear search is as good as a hash table - but in this case how small is "small"?. If I use hashing then what is the best algorithm? - I rather like http://en.wikipedia.org/wiki/Cuckoo_hashing Finally, should atoms in the table (either as keys or values) be pointers to a global hash table, or local. The "local" option here might sound crazy but it would avoid problems with atom table GC. From chsu79@REDACTED Tue Jun 13 11:35:58 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 13 Jun 2006 11:35:58 +0200 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: On 6/13/06, Joe Armstrong (AL/EAB) wrote: > > Hello, > > I've been thinking a bit about tables in Erlang. > > Erlang really really really (^100) needs tables. > > Tables are like records without the record declarations, or like > ets tables with a nicer syntactic structure - they are what I used to > call structs in earlier postings, but most other languages call them > tables. I have been missing records in erlang that know what named fields they contain at runtime. The design issues that i care most about is how they would be integrated in terms of pattern matching and being immutable. @{age=Age} = Table, Table2 = Table@{age=Age+1}, NSA ! {birthday, table_to_list(Table2)} If they are mutable it would lead to ad-hoc OO systems in erlang and people using OO programming (storing methods in tables). I kind of like the explicit state that erlang makes you carry around (*naa* *naa* *naa* the process dictionary doesnt exist *naa* *naa* *naa*), and i dont want it to go away. How would tables be used in mnesia? mnesia:write would allow you to store a "table" if it contains all the keys that the target mnesia table has? (eeek, name collision, isnt associative array a better name? map?) Is there a good reason to limit the types of the keys? Or are you not? How would these tables be stored in term_to_binary() format? From thomasl_erlang@REDACTED Tue Jun 13 11:54:01 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 13 Jun 2006 02:54:01 -0700 (PDT) Subject: Implementing tables - advice wanted In-Reply-To: Message-ID: <20060613095401.41843.qmail@web38803.mail.mud.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > > Hello, > > I've been thinking a bit about tables in Erlang. Question: are these tables pure or impure? Since you are using ets in your examples, I would guess impure. If so, is this a wise choice? (I personally wouldn't recommend it, unless it's a conscious decision to introduce mutable data inside Erlang processes.) I would instead recommend starting out by translating the notation into using dict or, even better, a well-defined behaviour. Then plug in more efficient implementations as needed. Most operations should be straightforward to translate. The main exception I can think of is pattern matching. (I think it sounds like a useful thing to have, by the way.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From thomasl_erlang@REDACTED Tue Jun 13 12:00:53 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 13 Jun 2006 03:00:53 -0700 (PDT) Subject: Implementing tables - advice wanted In-Reply-To: Message-ID: <20060613100053.22306.qmail@web38813.mail.mud.yahoo.com> --- Christian S wrote: > Table2 = Table@{age=Age+1}, It might be nice to also permit Table2 = Table@{age=@age+1} as a shorthand for Table2 = Table@{age=Table@REDACTED} That is, just using @field inside a table implicitly references the enclosing table. (Happily, @field is not a valid atom name.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From richardc@REDACTED Tue Jun 13 12:30:21 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 13 Jun 2006 12:30:21 +0200 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: <448E93BD.9030004@it.uu.se> Joe Armstrong (AL/EAB) wrote: > Erlang really really really (^100) needs tables. Allow me to disagree somewhat. Erlang already has good tables, both using hashing (dict) and binary trees (gb_trees). The syntactic convenience of a built-in table/dictionary type is really a minor thing. (Not that I would oppose having such a notation, but I really don't think it is critical in any way.) The main advantage would be psychological, I think: a standard one-size-fits-all dictionary type makes it easier for people to start using them in public interfaces, and not just internally. What I _do_ miss now and then (and when I need them, I have to jump through several hoops to get them) is indexable tables (i.e., arrays) with O(1) access time and a _small_ constant factor, and no copying of the stored data. If I remember correctly, the experiment with a "vector" data type (which used destructive update internally, with some penalty for accessing older versions of the data) was killed by bad interaction with the garbage collector, leading to rotten performance. Have things changed enough in the GC by now for this to become worth a new attempt? /Richard From carin.gustafsson@REDACTED Tue Jun 13 13:16:00 2006 From: carin.gustafsson@REDACTED (Carin Gustafsson (LN/EAB)) Date: Tue, 13 Jun 2006 13:16:00 +0200 Subject: Distributed node on xp with firewall Message-ID: <94B96B3383630441B365F764903403480334187D@esealmw103.eemea.ericsson.se> Hi Does any one know how to start a distibuted node on windows xp ? I get an error message {error, enotsok} if the firewall is enabled. After installing Panda it's not possible at all. Br Carin Ericsson AB SEGS/EAB/AUF/TU Ericsson AB SE-431 84 G?TEBORG, Sweden Phone (fixed&mobile): +46 31 747 4710 E-Mail: carin.gustafsson@REDACTED Fax: +46 31 747 6033 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lennart.ohman@REDACTED Tue Jun 13 13:24:57 2006 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Tue, 13 Jun 2006 13:24:57 +0200 Subject: Distributed node on xp with firewall In-Reply-To: <94B96B3383630441B365F764903403480334187D@esealmw103.eemea.ericsson.se> Message-ID: <001101c68edc$00432eb0$070b14ac@st.se> Hi, start with reading what was "said" in this thread. http://www.erlang.org/ml-archive/erlang-questions/200605/msg00336.html Best Regards, Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Carin Gustafsson (LN/EAB) > Sent: Tuesday, June 13, 2006 1:16 PM > To: erlang-questions@REDACTED > Subject: Distributed node on xp with firewall > > > Hi > > Does any one know how to start a distibuted node on windows xp ? I get an > error message > {error, enotsok} if the firewall is enabled. After installing Panda it's > not possible at all. > > Br Carin > Ericsson AB > SEGS/EAB/AUF/TU > Ericsson AB > SE-431 84 G?TEBORG, Sweden > Phone (fixed&mobile): +46 31 747 4710 > E-Mail: carin.gustafsson@REDACTED > Fax: +46 31 747 6033 > From joe.armstrong@REDACTED Tue Jun 13 13:29:05 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 13:29:05 +0200 Subject: Implementing tables - advice wanted Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Thomas Lindgren > Sent: den 13 juni 2006 11:54 > To: erlang-questions@REDACTED > Subject: Re: Implementing tables - advice wanted > > > > --- "Joe Armstrong (AL/EAB)" > wrote: > > > > > Hello, > > > > I've been thinking a bit about tables in Erlang. > > Question: are these tables pure or impure? Since you are > using ets in your examples, I would guess impure. > If so, is this a wise choice? (I personally wouldn't > recommend it, unless it's a conscious decision to introduce > mutable data inside Erlang processes.) No pure - perhaps the ets example was misleading, I was really more interested in knowing if the ets C code was reusable. > > I would instead recommend starting out by translating the > notation into using dict or, even better, a well-defined > behaviour. Then plug in more efficient implementations as needed. I did that a long time ago - it's the more efficient implementation I'm interested in. > Most operations should be straightforward to translate. The > main exception I can think of is pattern matching. A naive translation is easy - doing the PJ style optimisations is needs some thought. > > (I think it sounds like a useful thing to have, by the > way.) > > Best, > Thomas > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection > around http://mail.yahoo.com > From carin.gustafsson@REDACTED Tue Jun 13 13:30:47 2006 From: carin.gustafsson@REDACTED (Carin Gustafsson (LN/EAB)) Date: Tue, 13 Jun 2006 13:30:47 +0200 Subject: Distributed node on xp with firewall Message-ID: <94B96B3383630441B365F76490340348033418B9@esealmw103.eemea.ericsson.se> Thank you, I will try that to night. Carin -----Original Message----- From: Lennart Ohman [mailto:lennart.ohman@REDACTED] Sent: den 13 juni 2006 13:25 To: Carin Gustafsson (LN/EAB); erlang-questions@REDACTED Subject: RE: Distributed node on xp with firewall Hi, start with reading what was "said" in this thread. http://www.erlang.org/ml-archive/erlang-questions/200605/msg00336.html Best Regards, Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Carin Gustafsson (LN/EAB) > Sent: Tuesday, June 13, 2006 1:16 PM > To: erlang-questions@REDACTED > Subject: Distributed node on xp with firewall > > > Hi > > Does any one know how to start a distibuted node on windows xp ? I > get an error message {error, enotsok} if the firewall is enabled. > After installing Panda it's not possible at all. > > Br Carin > Ericsson AB > SEGS/EAB/AUF/TU > Ericsson AB > SE-431 84 G?TEBORG, Sweden > Phone (fixed&mobile): +46 31 747 4710 > E-Mail: carin.gustafsson@REDACTED > Fax: +46 31 747 6033 > From joe.armstrong@REDACTED Tue Jun 13 13:35:09 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 13:35:09 +0200 Subject: Implementing tables - advice wanted Message-ID: > -----Original Message----- > From: Richard Carlsson [mailto:richardc@REDACTED] > Sent: den 13 juni 2006 12:30 > To: Joe Armstrong (AL/EAB) > Cc: erlang-questions@REDACTED; Bj?rn Gustavsson > Subject: Re: Implementing tables - advice wanted > > Joe Armstrong (AL/EAB) wrote: > > Erlang really really really (^100) needs tables. > > Allow me to disagree somewhat. Erlang already has good > tables, both using hashing (dict) and binary trees > (gb_trees). The syntactic convenience of a built-in > table/dictionary type is really a minor thing. (Not that I > would oppose having such a notation, but I really don't think > it is critical in any way.) The main advantage would be > psychological, I think: a standard one-size-fits-all > dictionary type makes it easier for people to start using > them in public interfaces, and not just internally. I disagree X = dict:from_list([{name,fred},{age,12},{footsize,8}]), foo(X). foo(X) -> case dict:find(name, X) of {ok, Val} -> bar(Val); error -> ... end. Contra: X = @{name=fred, age=12, footsize=8},foo(X) X1 = dict:store( > What I _do_ miss now and then (and when I need them, I have > to jump through several hoops to get them) is indexable > tables (i.e., arrays) with O(1) access time and a _small_ > constant factor, and no copying of the stored data. > > If I remember correctly, the experiment with a "vector" data > type (which used destructive update internally, with some > penalty for accessing older versions of the data) was killed > by bad interaction with the garbage collector, leading to > rotten performance. Have things changed enough in the GC by > now for this to become worth a new attempt? > > /Richard > > From joe.armstrong@REDACTED Tue Jun 13 13:50:47 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 13:50:47 +0200 Subject: Implementing tables - advice wanted Message-ID: Second try, my last mail got sent prematurely ... > -----Original Message----- > From: Richard Carlsson [mailto:richardc@REDACTED] > Sent: den 13 juni 2006 12:30 > To: Joe Armstrong (AL/EAB) > Cc: erlang-questions@REDACTED; Bj?rn Gustavsson > Subject: Re: Implementing tables - advice wanted > > Joe Armstrong (AL/EAB) wrote: > > Erlang really really really (^100) needs tables. > > Allow me to disagree somewhat. Erlang already has good > tables, both using hashing (dict) and binary trees > (gb_trees). The syntactic convenience of a built-in > table/dictionary type is really a minor thing. (Not that I > would oppose having such a notation, but I really don't think > it is critical in any way.) The main advantage would be > psychological, I think: a standard one-size-fits-all > dictionary type makes it easier for people to start using > them in public interfaces, and not just internally. I disagree about the syntax. Try this: X = @{name="fred", age=12, footsize=8} foo(X) foo(@{name=Name}=X) -> ... foo(Other) -> This matches a table with key "name" How does this look with dicts? X = dict:from_list([{name,"fred"},{age,12},{footsize,8}]), foo(X). foo(X) -> case dict:find(name, X) of {ok, name} -> ... error -> ... end Which is much more verbose. I recently attended a dagstuhl workshop where one of the topics was "tables as universal data structures" - some of the people there thought that "the python data structures were just hash tables and this was why python was popular". > > What I _do_ miss now and then (and when I need them, I have > to jump through several hoops to get them) is indexable > tables (i.e., arrays) with O(1) access time and a _small_ > constant factor, and no copying of the stored data. > > If I remember correctly, the experiment with a "vector" data > type (which used destructive update internally, with some > penalty for accessing older versions of the data) was killed > by bad interaction with the garbage collector, leading to > rotten performance. Have things changed enough in the GC by > now for this to become worth a new attempt? Strange - I can't understand what "interaction with GC" has to do with matters. /Joe > /Richard > > From taavi@REDACTED Tue Jun 13 14:08:22 2006 From: taavi@REDACTED (Taavi Talvik) Date: Tue, 13 Jun 2006 15:08:22 +0300 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: >> -----Original Message----- >> From: Richard Carlsson [mailto:richardc@REDACTED] >> Sent: den 13 juni 2006 12:30 >> To: Joe Armstrong (AL/EAB) >> Cc: erlang-questions@REDACTED; Bj?rn Gustavsson >> Subject: Re: Implementing tables - advice wanted >> >> Joe Armstrong (AL/EAB) wrote: >>> Erlang really really really (^100) needs tables. >> >> Allow me to disagree somewhat. Erlang already has good >> tables, both using hashing (dict) and binary trees >> (gb_trees). The syntactic convenience of a built-in >> table/dictionary type is really a minor thing. (Not that I >> would oppose having such a notation, but I really don't think >> it is critical in any way.) The main advantage would be >> psychological, I think: a standard one-size-fits-all >> dictionary type makes it easier for people to start using >> them in public interfaces, and not just internally. > > I disagree > > X = dict:from_list([{name,fred},{age,12},{footsize,8}]), > foo(X). This is nice enough. > foo(X) -> > case dict:find(name, X) of > {ok, Val} -> > bar(Val); > error -> > ... > end. > > Contra: > > X = @{name=fred, age=12, footsize=8},foo(X) If lookup time is small (like Richard wrote below) it would be useful to do pattern matching with some special syntax. For example: foo(@{name=fred, age=12}=X) -> blaah; foo(@{name=joe}=X) -> other_blaah. IMHO special syntax for construction is not necessary. Many languages have special constructs for hash table lookup. PS. Year or two ago I played with same idea. Even implemented (somewhat working) parsers and code transformation from pattern matching to lookup+pattern matching. best regards, taavi > > X1 = dict:store( > >> What I _do_ miss now and then (and when I need them, I have >> to jump through several hoops to get them) is indexable >> tables (i.e., arrays) with O(1) access time and a _small_ >> constant factor, and no copying of the stored data. >> >> If I remember correctly, the experiment with a "vector" data >> type (which used destructive update internally, with some >> penalty for accessing older versions of the data) was killed >> by bad interaction with the garbage collector, leading to >> rotten performance. Have things changed enough in the GC by >> now for this to become worth a new attempt? >> >> /Richard >> From thomasl_erlang@REDACTED Tue Jun 13 14:22:49 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 13 Jun 2006 05:22:49 -0700 (PDT) Subject: Implementing tables - advice wanted In-Reply-To: Message-ID: <20060613122249.84619.qmail@web38806.mail.mud.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > > I would instead recommend starting out by > translating the > > notation into using dict or, even better, a > well-defined > > behaviour. Then plug in more efficient > implementations as needed. > > I did that a long time ago - it's the more efficient > implementation I'm > interested in. OK, but why not settle the notation first? For implementation of fast, pure arrays and hash tables, I'd suggest looking at what could be called the "exception list approach", e.g.: ftp://ftp.csd.uu.se/pub/papers/reports/0040.ps.gz ftp://ftp.csd.uu.se/pub/papers/reports/0042.ps.gz or Eriksson & Rayner, 2nd Int'l Logic Programming Conference, 1984. The same approach was later used in Hipe (pre-generational GC). Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ke.han@REDACTED Tue Jun 13 14:24:59 2006 From: ke.han@REDACTED (ke han) Date: Tue, 13 Jun 2006 20:24:59 +0800 Subject: Implementing tables - advice wanted In-Reply-To: <448E93BD.9030004@it.uu.se> References: <448E93BD.9030004@it.uu.se> Message-ID: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> I have programmed in Smalltalk for about 15 years and find the collection types key to every app. Dictionary is very important. However, these are all mutable objects. 1 - If the idea to have a table syntax is to introduce mutable collections, I would say it would quickly lead to a breakdown of the single assignment nature of erlang programs. 2 - If the the idea is simply to have a syntax for constructing immutable tables, this could be nice. But any "real" app will have large enough or unpredictable "structure" in these tables meaning that almost all programs will access the table "object" via an API, not a syntax where the names of fields are hard coded. Your syntax does look nice and could prove useful for teaching erlang, but the core API would be used more for larger apps. 3 - I don't see much value in this new data type if the key must be only atoms or strings. Too restrictive and would only server special cases. I am used to using hash table where the key may be a domain object. Unless of course, you can create a non-mutable, highly performant, space conscious hash table to replace most uses of record. 4 - Is the performance/space characteristics of module dictionary lacking? It is common practice (smalltalk, java, python, ruby) in model and controller frameworks to store attributes as hash tables keyed by attribute name. This representation is very handy for abstract framework code to manipulate attributes, handle events, etc... However, the code should always encapsulate the internal implementation. This means the app programmer never sees the dictionary/hash table. So syntactic sugar for creating/accessing the tables isn't exposed to the app programmer. Smalltalk and Java have several good dictionary types but do not have special syntax for them. This works out just fine. What I really need is the ability to pass around records (treat them as objects: meaning I have the discipline not to access them directly but via some module which owns its representation) and reference the fields by name via some record module's API. So, why would I need to have a record's fields be available outside its created module if I'm disciplined enough to always use said module to access the record? Well, for creating abstract frameworks and helper "objects", of course. I need to write some reusable "abstract" modules that are closely coupled to their "concrete" counterpart. This abstract code needs to know things about the record. I am doing just that in some erlang framework code I'm working on, but I feel its a bit clumsy and may not be efficient. I would think just one or two well performing APIs for record field would be just what I need. I also need a good template engine for yaws ;-) just my 2 cents, ke han On Jun 13, 2006, at 6:30 PM, Richard Carlsson wrote: > Joe Armstrong (AL/EAB) wrote: >> Erlang really really really (^100) needs tables. > > Allow me to disagree somewhat. Erlang already has good tables, > both using hashing (dict) and binary trees (gb_trees). The > syntactic convenience of a built-in table/dictionary type is > really a minor thing. (Not that I would oppose having such a > notation, but I really don't think it is critical in any way.) > The main advantage would be psychological, I think: a standard > one-size-fits-all dictionary type makes it easier for people to > start using them in public interfaces, and not just internally. > > What I _do_ miss now and then (and when I need them, I have to > jump through several hoops to get them) is indexable tables > (i.e., arrays) with O(1) access time and a _small_ constant > factor, and no copying of the stored data. > > If I remember correctly, the experiment with a "vector" data > type (which used destructive update internally, with some > penalty for accessing older versions of the data) was killed > by bad interaction with the garbage collector, leading to > rotten performance. Have things changed enough in the GC by > now for this to become worth a new attempt? > > /Richard > From thomasl_erlang@REDACTED Tue Jun 13 14:29:37 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 13 Jun 2006 05:29:37 -0700 (PDT) Subject: Implementing tables - advice wanted In-Reply-To: Message-ID: <20060613122937.2366.qmail@web38812.mail.mud.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > Strange - I can't understand what "interaction with > GC" has to do with > matters. The implementation used destructive update under the hood, which needs support in a generational GC. As far as I recall, the solution implemented for BEAM was much too expensive to make destructive update practical. (For the previous simple copying GC, the Hipe implementation worked fairly well.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From joe.armstrong@REDACTED Tue Jun 13 14:40:48 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 14:40:48 +0200 Subject: Implementing tables - advice wanted Message-ID: > -----Original Message----- > From: ke han [mailto:ke.han@REDACTED] > Sent: den 13 juni 2006 14:25 > To: Richard Carlsson > Cc: Joe Armstrong (AL/EAB); erlang-questions@REDACTED; > Bj?rn Gustavsson > Subject: Re: Implementing tables - advice wanted > > I have programmed in Smalltalk for about 15 years and find the > collection types key to every app. Dictionary is very important. > However, these are all mutable objects. > 1 - If the idea to have a table syntax is to introduce > mutable collections, I would say it would quickly lead to a > breakdown of the single assignment nature of erlang programs. No > 2 - If the the idea is simply to have a syntax for > constructing immutable tables, this could be nice. Yes > But any > "real" app will have large enough or unpredictable > "structure" in these tables meaning that almost all programs > will access the table "object" via an API, not a syntax where > the names of fields are hard coded. Your syntax does look > nice and could prove useful for teaching erlang, but the core > API would be used more for larger apps. > 3 - I don't see much value in this new data type if the key > must be only atoms or strings. Too restrictive and would > only server special cases. In Lua keys strings and integers. One design decision might be to limit the keys to say atoms, strings and integers In Lua tables contain two areas - a hash table and an array table. If Lua can find some integer key N such that half the slots from 1 .. N are in use and at least one slot from N/2 to N are in use then it will put these items into an array Exceptions are put into a regular hash table. > I am used to using hash table > where the key may be a domain object. Unless of course, you > can create a non-mutable, highly performant, space conscious > hash table to replace most uses of record. > 4 - Is the performance/space characteristics of module > dictionary lacking? No - this is more a syntax thing > It is common practice (smalltalk, java, python, ruby) in > model and controller frameworks to store attributes as hash > tables keyed by attribute name. This representation is very > handy for abstract > framework code to manipulate attributes, handle events, etc... > However, the code should always encapsulate the internal > implementation. This means the app programmer never sees the > dictionary/hash table. So syntactic sugar for > creating/accessing the tables isn't exposed to the app > programmer. Smalltalk and Java have several good dictionary > types but do not have special syntax for them. This works > out just fine. > > What I really need is the ability to pass around records > (treat them as objects: meaning I have the discipline not to > access them directly but via some module which owns its > representation) and reference the > fields by name via some record module's API. So, why would I need > to have a record's fields be available outside its created > module if I'm disciplined enough to always use said module to > access the record? Well, for creating abstract frameworks > and helper "objects", of course. I need to write some > reusable "abstract" modules that are closely coupled to their > "concrete" counterpart. This abstract code needs to know > things about the record. I am doing just that in some erlang > framework code I'm working on, but I feel its a bit clumsy and > may not be efficient. I would think just one or two well > performing > APIs for record field would be just what I need. > Absolutly. keys(X) should return a list of all the keys in X (for meta programming) > I also need a good template engine for yaws ;-) > > just my 2 cents, ke han > > > > On Jun 13, 2006, at 6:30 PM, Richard Carlsson wrote: > > > Joe Armstrong (AL/EAB) wrote: > >> Erlang really really really (^100) needs tables. > > > > Allow me to disagree somewhat. Erlang already has good tables, both > > using hashing (dict) and binary trees (gb_trees). The syntactic > > convenience of a built-in table/dictionary type is really a minor > > thing. (Not that I would oppose having such a notation, but > I really > > don't think it is critical in any way.) The main advantage would be > > psychological, I think: a standard one-size-fits-all > dictionary type > > makes it easier for people to start using them in public > interfaces, > > and not just internally. > > > > What I _do_ miss now and then (and when I need them, I have to jump > > through several hoops to get them) is indexable tables > (i.e., arrays) > > with O(1) access time and a _small_ constant factor, and no > copying of > > the stored data. > > > > If I remember correctly, the experiment with a "vector" data type > > (which used destructive update internally, with some penalty for > > accessing older versions of the data) was killed by bad interaction > > with the garbage collector, leading to rotten performance. > Have things > > changed enough in the GC by now for this to become worth a new > > attempt? > > > > /Richard > > > > From richardc@REDACTED Tue Jun 13 14:47:33 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 13 Jun 2006 14:47:33 +0200 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: <448EB3E5.8060506@it.uu.se> Joe Armstrong (AL/EAB) wrote: > Second try, my last mail got sent prematurely ... > > I disagree about the syntax. > > Try this: > > X = @{name="fred", age=12, footsize=8} > foo(X) > > foo(@{name=Name}=X) -> > ... > foo(Other) -> > > How does this look with dicts? > > X = dict:from_list([{name,"fred"},{age,12},{footsize,8}]), > foo(X). > > foo(X) -> > case dict:find(name, X) of > {ok, name} -> > ... > error -> > ... > end > > Which is much more verbose. More verbose, yes. Much more - no, not really; only by about 50%. But yes, such notation would be convenient - in particular if you could use it in pattern matching, as in your example. My point is that I really find the above verbosity a much smaller inconvenience, compared to the amounts of careful thinking and separation and laying out of data and writing wrappers that hide the actual calls to ets, etc., that I have to write each time I really need some fast indexed tables. That's not to say that Erlang shouldn't have both, if possible. > I recently attended a dagstuhl workshop where one of the > topics was "tables as universal data structures" - some of the people > there thought that "the python data structures were just hash tables and > this was why python was popular". It is. It's also why Python is slow, but that's mainly a language implementation issue. It shows that it can be better to use a generic, though less efficient, mechanism to base your constructs on if you want to get stuff done, rather than spend ages trying to find the best trade-off between power and speed (virtual function tables? - it's just another hash table, mapping names to functions). However, when the tool starts to be used for really heavy tasks, you need to start optimizing internally, and I think that's where Python is currently lacking most. (Yes, I have a little experience in that area.) >> If I remember correctly, the experiment with a "vector" data >> type (which used destructive update internally, with some >> penalty for accessing older versions of the data) was killed >> by bad interaction with the garbage collector, leading to >> rotten performance. Have things changed enough in the GC by >> now for this to become worth a new attempt? > > Strange - I can't understand what "interaction with GC" has to do with > matters. Ah. I remember when I too, once, was blissfully unaware of the many ways the current GC implementation can get in the way of other, supposedly orthogonal issues. Alas, my mind is now forever tainted. But ask Bj?rn if you want the details. /Richard From james.hague@REDACTED Tue Jun 13 15:45:39 2006 From: james.hague@REDACTED (James Hague) Date: Tue, 13 Jun 2006 08:45:39 -0500 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: Here's a very simple, timid step toward making hash tabels easier to use in Erlang This is ugly: ets:new(anonymnous, []), I'm all for adding a helper function that creates the equivalent of a Python dict / Perl hash: ets:new() It creates an anonymous, private set. This covers 90% of the cases where I want to use hash tables. Back to your original question, you might find this interesting: http://factor-language.blogspot.com/2005_11_01_factor-language_archive.html From joe.armstrong@REDACTED Tue Jun 13 16:33:43 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 13 Jun 2006 16:33:43 +0200 Subject: Making a new BIF Message-ID: I'm tryng to make some new BIF's - can anybody enligten me as to what the minimal make incantations are to recompile my BIFs. So far I have changed bif.tab and binary.c (in erts/emulator/beam) A top-level make clean make takes a zillion years always seems to work make emulator appears[1] to work and is somewhat faster, but still can take a long time What is the approved method with the fastest turn-around time? Thanks /Joe [1] not always ??? - once I got a beam loader error which vanished after another make clean From yarivvv@REDACTED Tue Jun 13 17:43:50 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 13 Jun 2006 11:43:50 -0400 Subject: lists functions complexity? Message-ID: <17244f480606130843k68eec751j8af5a63183b61fe8@mail.gmail.com> Hi, I think it would be useful to mention the order of complexity of list functions in the "list" module documentation (as well as the ++ and -- operators), and include some tips for efficient use of lists. This wlil help non-experts such as myself avoid writing inefficient code. Regards, Yariv From bsder@REDACTED Tue Jun 13 23:03:28 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 13 Jun 2006 14:03:28 -0700 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: <448F2820.4040708@allcaps.org> Joe Armstrong (AL/EAB) wrote: >> -----Original Message----- >> From: ke han [mailto:ke.han@REDACTED] >> 3 - I don't see much value in this new data type if the key >> must be only atoms or strings. Too restrictive and would >> only server special cases. > > In Lua keys strings and integers. > > One design decision might be to limit the keys to say atoms, strings and integers > In Lua tables contain two areas - a hash table and an array table. If Lua > can find some integer key N such that half the slots from 1 .. N are in use and at least > one slot from N/2 to N are in use then it will put these items into an array > Exceptions are put into a regular hash table. What about terms like {atom1, atom2}? What you want to avoid is the Perl problem where the only thing which could key a hash was a string (I think this has been fixed). Suddenly, everybody was splitting and mangling strings to get around the fact that they really wanted more advanced keys on their hashes. Basically, if it's immutable and you can create a hash for it, it should be usable as a key. That's pretty much the Python philosophy. Even if it's *not* immutable, but you can create a hash for it, Python will often let you dump it into a dict. I liked your proposal for structs a lot where the "record" effectively carries around its own dictionary for runtime use. >> programmer. Smalltalk and Java have several good dictionary >> types but do not have special syntax for them. This works >> out just fine. I disagree. Try building an assembler in Java. Look at just how many characters you spend simply initializing the opcode hashes. It's huge. Even my beginning students ask: "Isn't there a better way?" It's no wonder Java folks think XML is useful. And don't get me started about the lack of an easy to use tuple in Java. I use Vector way too much in Java. -a From nm@REDACTED Tue Jun 13 23:23:03 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 14 Jun 2006 02:23:03 +0500 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> References: <448E93BD.9030004@it.uu.se> <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> Message-ID: <448F2CB7.9040000@web.am> Hello all! Post directed mainly to ke han, but all other list members are welcome -- You have mentioned html template engine for erlang - what kind of features do you like in there ? For current moment I got some simple engine which provides following templating commands - <%TRANSLATE atom%> - generate string, calling some translation function (to make multilangual sites) <%FOREACH keyname%> - <%/FOREACH%> - take element keyname from proplist (which should have list value) and iterate inner part of FOREACH loop for each element in that list. <%WITH keyname%> <%/WITH%>- just go one level deeper - fetch one element from proplist and execute inner template with it <%PUT keyname%> - just put element of proplist into current position. <%PUTVALUE%> - if we are in a leaf node - put it's value into current position - ether string or integer. so if you have template <%FOREACH args%><%PUTVALUE%> <%/FOREACH%> and we feed templating function with {struct, [ {args, {array, ["Hello", "world", "!"]} } ]} data we will receive "Hello world ! " string. this approach - added with if/ifdef/else commands allows create templates which are totally separate from programming language and are driven only by data which is fed to template interpreted. it somehow resembles XSLT, but much more simple to allow HTML designers easily use it and put into pages without disturbing programmer too much. second idea with such markup is that there is translator from such markup to JSON notation, and there is JS template renderer, which could be run on client machine - thus allowing passing from server not rendered template, but parsed template and data -- JS copes well even on slow machines with datasets about up to 1000 elements - like 10x100 table - which is practically enough for most tasks. I would like to listen any suggestions on templating solution, which you would like to see - even too fantastic or futuristic -- because it's always possible to find something reasonable and practical there. Looking forward for answers :) -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From ok@REDACTED Wed Jun 14 04:09:20 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 14 Jun 2006 14:09:20 +1200 (NZST) Subject: Implementing tables - advice wanted Message-ID: <200606140209.k5E29Kwn222562@atlas.otago.ac.nz> "Joe Armstrong \(AL/EAB\)" wrote: I've been thinking a bit about tables in Erlang. Erlang really really really (^100) needs tables. I have written about this in detail suggesting Erlang-appropriate syntax, an adequate set of built in functions, and explaining how they can be implemented efficiently. In a Daghstuhl meeting we has a session on the theme "all you need are tables - virtually all dynamically typed languages (except Erlang) have tables. In Lua they are called tables, in Python dictionaries, in JavaScript associative arrays - the semantics of all these things are slightly different but essentially they are the same. There is one essential difference: Python, Ruby, Javascript, Perl, Icon, ... all have MUTABLE tables. Erlang data structures are not mutable. This has consequences for implementation. Keys are strings or integers, conseqative ranges of integers (very useful for arrays) are handled in a special manner. The most appropriate keys for Erlang would seem to be atoms. I'm wondering about how to implement tables. Let's choose "@" as the table constructor (just about the only character left, that's unused. X = @{name="fred", age=23, footSize = 42} Name = X.name, ... The syntax I proposed uses <{...}> for anonymous psi-terms and for named psi-terms, e.g., X = Now how could I implement this? Very very cheaply. Basically, a psi-term is a tuple, with a different tag, whose first element points to a tuple containing the name (if any) and the keys, in a standard order. There is again quite an important difference between the way Erlang would use something like this and the way we'd use hash tables; Erlang uses _pattern matching_, so that = X is a normal thing to do. With keys in standard order, this can be done in a linear scan. For something like get(X, name) a binary search is required, but immutable psi-terms are unlikely to grow large enough for binary search (especially if cunningly done) to be a performance issue at all. Psi-terms are a good, perhaps even the ideal, replacement for records. The analogy with *mutable* hash tables in other languages, which get *used* in completely different ways, is probably misleading. That's not to say that a mutable hash table data type would be of no use. It already exists, courtesy of the process dictionary, and if you want a light-weight way to implement these things, building on top of the process dictionary rather than ets is probably the way to go. From cyberlync@REDACTED Wed Jun 14 04:23:01 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 13 Jun 2006 19:23:01 -0700 Subject: Progrommatic control of dialyzer Message-ID: Is there some method to control and use dialyzer pragmatically? I have been fiddling with something akin to a continuous build system for my erlang projects with support for unit tests and the like. I would like to add support for dialyzer and an API would make that simpler. The R11 docs only cover the command line version but just because something isn't documented doesn't mean it doesn't exist. Hence this question to the list. From rlenglet@REDACTED Wed Jun 14 05:23:45 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 14 Jun 2006 12:23:45 +0900 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448F2CB7.9040000@web.am> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> Message-ID: <200606141223.45282.rlenglet@users.forge.objectweb.org> Gaspar Chilingarov wrote: > Post directed mainly to ke han, but all other list members are > welcome -- You have mentioned html template engine for erlang > - what kind of features do you like in there ? > > For current moment I got some simple engine which provides > following templating commands - [...] I would personally avoid any imperative / non-declarative construct in a template language. Tons of template languages exist for PHP, etc. so one should at least look at them and reuse ideas from them. Many existing usable template engines / languages end up having the same characteristics / features: - they usually apply the MVC pattern, - in views, the pattern language allow to identify placeholders for values (strings) set by the controller (by the code), and allow to identify / markup blocks of text that are optional or that can be repeated, as controlled by the controller; - some languages allow to recursively identify blocks inside blocks in views; - the only information shared between a view (a template) and a controller (Erlang code) is: the names of value placeholders, and the names and structures (hierarchies) of optional/repeatable blocks. The view language is usually completely declarative. If you need to do a loop to repeat a block, you should do it in the code (in the controller), not by defining a "FOREACH" construct in the template language (in the view). A good, simple template language that can directly be used in an Erlang template engine in that of PHP Pear: http://pear.php.net/manual/en/package.html.html-template-it.intro.php For example, using this syntax, one view could be:
{DATA}
The advantage of that syntax is that it allows most of the time to edit a template as HTML using any existing visual editor: nvu, dreamweaver, etc. This simplifies the design of templates by non-programmers. No loops, no programming logic in views. Then, the template engine could allow a controller in Erlang to process a template like: engine:parse_template("foo.tpl.html", [{block, row, [{block, cell, [{variable, DATA, "hello"}]}, {block, cell, [{variable, DATA, "world"}]}]}]) which would return a string containing the whole parsed template. PHP Pear also allows to maintain a cache of pre-parsed templates, to improve performance. This should be provided also by an Erlang template engine. -- Romain LENGLET From yarivvv@REDACTED Wed Jun 14 06:50:45 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 00:50:45 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448F2CB7.9040000@web.am> References: <448E93BD.9030004@it.uu.se> <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> Message-ID: <17244f480606132150x5839f810g5a75985cc5eda4b7@mail.gmail.com> On 6/13/06, Gaspar Chilingarov wrote: > Hello all! > > Post directed mainly to ke han, but all other list members are welcome > -- You have mentioned html template engine for erlang - what kind of > features do you like in there ? > > For current moment I got some simple engine which provides following > templating commands - > > <%TRANSLATE atom%> - generate string, calling some translation function > (to make multilangual sites) I would omit this from the template language to keep the language as simple as possible. I think it's better to let the controller feed the template with the correct strings. > > <%FOREACH keyname%> - <%/FOREACH%> - take element keyname from proplist > (which should have list value) and iterate inner part of FOREACH loop > for each element in that list. I think you should consider using dicts rather than property lists, because the lists can get quite long and inefficient. > <%WITH keyname%> <%/WITH%>- just go one level deeper - fetch one element > from proplist and execute inner template with it > > <%PUT keyname%> - just put element of proplist into current position. > <%PUTVALUE%> - if we are in a leaf node - put it's value into current > position - ether string or integer. > > so > if you have template > <%FOREACH args%><%PUTVALUE%> <%/FOREACH%> > > and we feed templating function with > {struct, [ > {args, {array, ["Hello", "world", "!"]} } > ]} > data we will receive "Hello world ! " string. > > this approach - added with if/ifdef/else commands allows > create templates which are totally separate from programming language > and are driven only by data which is fed to template interpreted. > > > second idea with such markup is that there is translator from such > markup to JSON notation, and there is JS template renderer, which could > be run on client machine - thus allowing passing from server not > rendered template, but parsed template and data -- JS copes well even on > slow machines with datasets about up to 1000 elements - like 10x100 > table - which is practically enough for most tasks. Interesting idea... I suggest you take a look at the RJS feature in Ruby on Rails (http://api.rubyonrails.org/, under 'ActionView' and 'ActionView::Helpers::PrototypeHelper::JavaScriptGenerator'). RJS does much more than just render text in the browser as it provides a set of commonly used AJAX effects. Here's the example from the documentation: page.replace_html 'sidebar', :partial => 'sidebar' page.remove "person-#{@person.id}" page.visual_effect :highlight, 'user-list' These effects could be described as Erlang tuples, and the Javascript generator would translate them into Javascript on the fly. Just an idea, probably for v2 :) > > > I would like to listen any suggestions on templating solution, which you > would like to see - even too fantastic or futuristic -- because it's > always possible to find something reasonable and practical there. I think it's important to have some sort of an 'include' tag so you can include templates from other templates. <% include "header" %>

body

<% include "footer" %> and *please* don't make everything uppercase! Keep us posted on your progress. :) Regards, Yariv From bernardp@REDACTED Wed Jun 14 07:13:36 2006 From: bernardp@REDACTED (Pierpaolo BERNARDI) Date: Wed, 14 Jun 2006 07:13:36 +0200 Subject: Implementing tables - advice wanted In-Reply-To: References: Message-ID: On Tue, 13 Jun 2006 14:40:48 +0200, Joe Armstrong (AL/EAB) wrote: > In Lua keys strings and integers. In lua, keys can be anything except nil. P. From yarivvv@REDACTED Wed Jun 14 07:26:29 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 01:26:29 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <200606141223.45282.rlenglet@users.forge.objectweb.org> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> Message-ID: <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> > > I would personally avoid any imperative / non-declarative > construct in a template language. > Tons of template languages exist for PHP, etc. so one should at > least look at them and reuse ideas from them. I actually think there's something to learn from Drupal, the popular open source PHP CMS. Drupal's default template engine used to be xtemplate, which had a basic template language, but at a recent version, Drupal switched to PHP template by default. The reason, as I recall, is that the Drupal developers realized they already 'had' a template language: PHP. Ruby on Rails also has a template engine that embeds Ruby code. I think one should consider making an Erlang template engine. It would look like current Yaws pages, but different. For instance, let's say your controller had this code get_users(A) -> [{person1, [{"name", "john"}, {age, 26}, {hobbies, [music, movies}]}, {person2, [{"name", "lisa"}, {age, 27}, {city, "new york"}]}]. The template could look like

person1:

<% match({person1, Props} = Obj) -> props:get(hobbies, Props). %>

person2:

<% match({person2, Props} = Obj) -> props:get(name, Props). %>
<%= length(Data) %> people I'm not sure that this syntax is really optimal (I just came up with it), but I think there's an advantage to using a turing complete template laugnage with a short learning curve :) Best, Yariv From gordonguthrie@REDACTED Wed Jun 14 08:37:43 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Wed, 14 Jun 2006 07:37:43 +0100 Subject: Progrommatic control of dialyzer In-Reply-To: References: Message-ID: <1150267063.448faeb75cc73@backawinner.gg> Eric There is a continuous build script for Erlang in the jungerl. The full documentation is available here: http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/erlang_automated_build/doc/DOCUMENTATION.TXT?view=markup It can do some or all of the following: * check out from CVS * run a compile * run a test suite * run the dialyzer * run a tsunami load test All the outputs can be graphed and sent up to a web site. At the moment I also have a rough cut of a web site spider enginge that will follow all your hyperlinks but it is too shonky to be shown to the world. When it is finished I will integrate it. Gordon Quoting Eric Merritt : > Is there some method to control and use dialyzer pragmatically? I have > been fiddling with something akin to a continuous build system for my > erlang projects with support for unit tests and the like. I would like > to add support for dialyzer and an API would make that simpler. The > R11 docs only cover the command line version but just because > something isn't documented doesn't mean it doesn't exist. Hence this > question to the list. > > ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From Tobias.Lindahl@REDACTED Wed Jun 14 09:20:17 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Wed, 14 Jun 2006 09:20:17 +0200 Subject: Progrommatic control of dialyzer In-Reply-To: References: Message-ID: <448FB8B1.7050101@it.uu.se> Hi, The question has been asked before, and unfortunately the answer is the same this time. I will make a way of calling Dialyzer and get the answers in Erlang rather than through the command line, but I haven't got around to it yet. Just keep asking and it might even happen ;-) Tobias Eric Merritt wrote: > Is there some method to control and use dialyzer pragmatically? I have > been fiddling with something akin to a continuous build system for my > erlang projects with support for unit tests and the like. I would like > to add support for dialyzer and an API would make that simpler. The > R11 docs only cover the command line version but just because > something isn't documented doesn't mean it doesn't exist. Hence this > question to the list. From nm@REDACTED Wed Jun 14 10:17:12 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 14 Jun 2006 13:17:12 +0500 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <200606141223.45282.rlenglet@users.forge.objectweb.org> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> Message-ID: <448FC608.7030107@web.am> Romain Lenglet wrote: just a reference: Enforcing Strict Model-View Separation in Template Engines. http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf > [....] > I would personally avoid any imperative / non-declarative > construct in a template language. > Tons of template languages exist for PHP, etc. so one should at > least look at them and reuse ideas from them. > Many existing usable template engines / languages end up having > the same characteristics / features: > > - they usually apply the MVC pattern, > > - in views, the pattern language allow to identify placeholders > for values (strings) set by the controller (by the code), and > allow to identify / markup blocks of text that are optional or > that can be repeated, as controlled by the controller; > > - some languages allow to recursively identify blocks inside > blocks in views; > > - the only information shared between a view (a template) and a > controller (Erlang code) is: the names of value placeholders, > and the names and structures (hierarchies) of > optional/repeatable blocks. > > The view language is usually completely declarative. If you need > to do a loop to repeat a block, you should do it in the code (in > the controller), not by defining a "FOREACH" construct in the > template language (in the view). > hm, this sounds good - I should think about such model. > > A good, simple template language that can directly be used in an > Erlang template engine in that of PHP Pear: > http://pear.php.net/manual/en/package.html.html-template-it.intro.php > > For example, using this syntax, one view could be: > > > > > > > > > > >
> {DATA} >
> > > The advantage of that syntax is that it allows most of the time > to edit a template as HTML using any existing visual editor: > nvu, dreamweaver, etc. This simplifies the design of templates > by non-programmers. No loops, no programming logic in views. > > > Then, the template engine could allow a controller in Erlang to > process a template like: > > engine:parse_template("foo.tpl.html", > [{block, row, > [{block, cell, [{variable, DATA, "hello"}]}, > {block, cell, [{variable, DATA, "world"}]}]}]) > > which would return a string containing the whole parsed template. > > PHP Pear also allows to maintain a cache of pre-parsed templates, > to improve performance. This should be provided also by an > Erlang template engine. > this is quite simple to do in erlang - just hang aroung caching process - one thing which you can not have done in php and apache (monitord is somehow working solution). -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From ft@REDACTED Wed Jun 14 10:35:20 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 14 Jun 2006 10:35:20 +0200 Subject: shell rr/1 problem in R11B-0 Message-ID: <200606141035.20923.ft@it.su.se> Hi With R10B-9, I can "rr" xmerl.hrl : Erlang (BEAM) emulator version 5.4.12 [source] Eshell V5.4.12 (abort with ^G) 1> rr("/pkg/erlang/R10B-9/lib/erlang/lib/xmerl-1.0.3/include/xmerl.hrl"). [xmerl_event, ... ] 2> but with R11B-0, it gives me an error that seems to be incorrect : Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] Eshell V5.5 (abort with ^G) 1> rr("/pkg/erlang/R11B-0/lib/erlang/lib/xmerl-1.0.5/include/xmerl.hrl"). ** exited: "record xmlNamespace undefined" ** 2> the record xmlNamespace _is_ defined before it's first use. /Fredrik From ft@REDACTED Wed Jun 14 10:38:27 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 14 Jun 2006 10:38:27 +0200 Subject: Dialyzer and include paths Message-ID: <200606141038.27489.ft@it.su.se> Hi When using the "-r" option of Dialyzer to recursively scan for .erl or .beam files to analyze, wouldn't it be convenient if include files (.hrl) were also identified and their path added to the include search path? Just an idea, no patch ;) /Fredrik From trinder@REDACTED Tue Jun 13 17:34:29 2006 From: trinder@REDACTED (Phil Trinder) Date: Tue, 13 Jun 2006 16:34:29 +0100 (BST) Subject: Erlang'06 Deadline Extension Message-ID: <3918.82.41.12.29.1150212869.squirrel@www.macs.hw.ac.uk> The submission deadline for the 2006 ACM SIGPLAN Erlang Workshop (http://www.erlang.se/workshop/2006/) has been extended until the 18th June. We're very keen to have good quality submissions! All the best, Phil -------------------------------------------------- Phil Trinder School of Mathematical and Computer Sciences Heriot-Watt University Edinburgh, EH14 4AS E-mail: trinder@REDACTED Teleph: +44 (0)131 451 3435 Depart: +44 (0)131 451 3328 Fasmly: +44 (0)131 451 3327 Intrnt: http://www.macs.hw.ac.uk/~trinder From Tobias.Lindahl@REDACTED Wed Jun 14 11:05:06 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Wed, 14 Jun 2006 11:05:06 +0200 Subject: Dialyzer and include paths In-Reply-To: <200606141038.27489.ft@it.su.se> References: <200606141038.27489.ft@it.su.se> Message-ID: <448FD142.6010509@it.uu.se> Fredrik Thulin wrote: > Hi > > When using the "-r" option of Dialyzer to recursively scan for .erl > or .beam files to analyze, wouldn't it be convenient if include files > (.hrl) were also identified and their path added to the include search > path? > > Just an idea, no patch ;) And a good idea, it is. More good (or bad) ideas are welcome, either to the list or directly to me. Tobias > > /Fredrik From ft@REDACTED Wed Jun 14 11:35:26 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 14 Jun 2006 11:35:26 +0200 Subject: xmerl exporting with namespace? Message-ID: <200606141135.26120.ft@it.su.se> Hi I am most unfortunate, I have to not only parse XML documents, but also try to merge XML documents ;(. I think the easiest way to explain my problem is with the attached module. The problem is that x:output_tuples() (which uses xmerl:export_simple_content(Tuples, xmerl_xml) produces the following : open Idle idle 2006-06-13T21:40:17Z To put that into another XML document, I need the namespace information that _was_ available in the xmlElement record outputted, something like open Idle idle 2006-06-13T21:40:17Z (I'm no XML expert, far from). Is that possible somehow? /Fredrik -------------- next part -------------- -module(x). -compile(export_all). -include_lib("xmerl/include/xmerl.hrl"). %% example SIP/SIMPLE Presence PIDF XML document in() -> "\n" "\n" " \n" " open\n" " Idle\n" " idle\n" " 2006-06-13T21:40:17Z\n" " \n" " \n" " Idle\n" " \n" "\n". %% parse the example XML document, namespace_conformant parse() -> parse( in() ). parse(Src) when is_list(Src) -> try xmerl_scan:string(Src, [{namespace_conformant, true}]) of {XML, []} -> XML; _ -> {error, bad_xml} catch _: _ -> {error, failed_parsing} end. %% get the PIDF tuples ( in the XML source) get_tuples() -> XML = parse(), get_tuples(XML). get_tuples(XML) when is_record(XML, xmlElement) -> get_xml_elements(tuple, XML#xmlElement.content). get_xml_elements(Name, In) when is_atom(Name), is_list(In) -> get_xml_elements2(Name, In, []). get_xml_elements2(Name, [#xmlElement{name = Name} = H | T], Res) -> get_xml_elements2(Name, T, [H | Res]); get_xml_elements2(Name, [#xmlElement{expanded_name = {_URI, Name}} = H | T], Res) -> get_xml_elements2(Name, T, [H | Res]); get_xml_elements2(Name, [_H | T], Res) -> get_xml_elements2(Name, T, Res); get_xml_elements2(_Name, [], Res) -> lists:reverse(Res). %% Output only the PIDF tuple(s), this is where I am missing the namespace information output_tuples() -> Tuples = get_tuples(), output_tuples(Tuples). output_tuples(Tuples) when is_list(Tuples) -> Out = xmerl:export_simple_content(Tuples, xmerl_xml), io:format("~s~n~n", [lists:flatten(Out)]), ok. From chsu79@REDACTED Wed Jun 14 11:51:20 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 14 Jun 2006 11:51:20 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> Message-ID: On 6/14/06, Yariv Sadan wrote: > > > > I would personally avoid any imperative / non-declarative > > construct in a template language. > > Tons of template languages exist for PHP, etc. so one should at > > least look at them and reuse ideas from them. > > > I actually think there's something to learn from Drupal, the popular > open source PHP CMS. Drupal's default template engine used to be > xtemplate, which had a basic template language, but at a recent > version, Drupal switched to PHP template by default. The reason, as I > recall, is that the Drupal developers realized they already 'had' a > template language: PHP. > > Ruby on Rails also has a template engine that embeds Ruby code. > [snip] > > I'm not sure that this syntax is really optimal (I just came up with > it), but I think there's an advantage to using a turing complete > template laugnage with a short learning curve :) I would have to second this. I have suffered template languages[*] that are made to be small and simple ("only the things you're ever going to need (TM)"), only to reach a point where they are insufficient. *Erlang is succinct and readable enough to be the language to be used, and it is very complete.* What I miss the most in yaws is a way to call erlang code using less typing. , or similar would be nice. Especially since the tag sports a module attribute, allowing you to name the created module that contains the code . Then one can locate all the reused components in the same yaws-file they're used in. I'm imagining things like

That is, if yaws had an i18n framework at all, and i18n was imported from yaws_api. producttable(Category) -> %% Lookup Category products and %% return a ehtml table from the result. ...

Buy junk!

[*] So far: Apache Velocity and XSLT (hardly that small though) From joe.armstrong@REDACTED Wed Jun 14 11:54:32 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 14 Jun 2006 11:54:32 +0200 Subject: Web pages using a simple tuple store [was : RE: template engine] Message-ID: > From: Gaspar Chilingarov > Sent: den 13 juni 2006 23:23 [cut] > I would like to listen any suggestions on templating > solution, which you would like to see - even too fantastic or > futuristic -- because it's always possible to find something > reasonable and practical there. Thinking out loud ... I've been thinking about this for a couple of years ... I actually rather like the result - it combines a distributed object tuple store with web pages and removes the need for complex data base tables and configuration. So ... Can we abstract out the data base in a web application? Yes - here's how. Imagine a site www.some.server There are some users (joe, gaspar, fred ... ) There are some web pages (login, main, chat ...) The web pages have *regions* (new concept here) :-) with names like (inbox, mood, status) These three things define a key in a tuple store associated with www.some.server The values of the regions are strings Example: the key ("joe", "login", "mood") in the tuple store on www.some.server currently contains the string "happy" When joe requests the page called "login" he gets a different page to gaspar. The VALUES of the regions in the web page come from the tuple store. What does the code look like for the login page? Login

Hello

My mood is Here ?Who is "joe" To implement this all we need is a persistent tuple store. get(Who, Page, Region) return the value of the {Who, Page, Region} tuple. Getting values out of the tuple store is easy, just use the function get(Who, Page, Region). Putting values into the store is also easy (if we ignoring security, which I'll deal with later) To put a value in the tuple store we evaluate put({Who,Page,region}, Value) But this is a *local* operation - let's make this distributed, and let's define a protocol on top of HTTP which does this: This request updates the tuple store: http://www.some.server/put/joe/login/region?val=EncodedString It returns the OLD value of the tuple (joe,login,region) http://www.some.server/get/joe/login/region Retrieves the value of the (joe,login,region) tuple What is the behaviour of get and put? How about: 1) put is persistent 2) If a user is viewing a page and sombody put's a new value the change is seen immediately (this needs an ajax lister, for every page, it rpc the server and gets a return value if any region on the page is updated) Now the tuple store is just a function from a 3 tuple of strings to a string ie of type string x string x string -> string. HOW the tuple store is implemented is irrelevant (use mnesia, mysql, whatever) Note we also don't need to define any data base tables. Extensions extensions ..... Authentication ============== Authentication: Who can do a put? - anybody, the "owner" of the data, some trusted people: here we can use (say) RSA http://www.some.server/put/joe/login/mood?val=happy&auth=ag234zs12321 and require that the value is signed with an appropriate key - unfortunately RSA is pretty heavyweight - so I'd welcome suggestions here for a lighter-weight method. RSS feeds ========= Suppose you'd like to know when a region was updated? htpp://www.some.server/pleaseTellmeWhenChanged/joe/login/mood? key=ghajgdjagd128731 & site=www.foo.bar/put/agregator/changed/inbox => Ok | refused So when the tuple (joe,login,mood) was changed the server would do a http://www.foo.bar/put/agregator/chanded/inbox?val=EncodedString ? key=... etc. Let's try and formalise this: 1) Every web site has a tuple store with keys of type string x string x string API create_tuple_store() create_tuple(Who, Page, Region, PriKey, PubKey) => ok | error string put_val(Who, Page, Region, NewVal, Auth) => bool get_val(Who, Page, Region) => Val | "error" is_authorised(Who, Page, Region, Val, Auth) => bool get_pub_key(Who, Page, Region) => Pubkey sign(Val, PriKey) => Auth 2) put_val and get_val can be accessed by HTTP requests http:/www.some.site/put/who/page/region?val=...&auth=.... http://www.some.site/get/who/page/region 3) Web page writers can get tuple values using the following syntax (example)

hello

Welcome you have been here times The meta variable Page is the page name - Who is the owner Finally. I don't have time to implement this tonight - the Mother-in-law is coming to stay (for two weeks) and there are a number of distractions coming up like Holidays - where I'm expected to "enjoy myself" - so feel free to implement this. If Luke or Tobbe is reading - I'll expect a complete implementation by return of post. Hint: RSA in Erlang can be run of-of-the box Just read http://www.erlang.org/examples/examples-2.0.html There's a link to the code tarball on this page - RSA is included (uses Erlang bignums :-) /Joe From joe.armstrong@REDACTED Wed Jun 14 11:56:54 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 14 Jun 2006 11:56:54 +0200 Subject: template engine [ was: Re: Implementing tables - advice wanted ] Message-ID: I see no reason why a template engine should offer any other than full access to all Erlang functions, not some ad-hock subset. My template engine is described here: http://www.erlang.org/ml-archive/erlang-questions/200602/msg00326.html I've edited some comments into Gaspar's mail at the end of this post. I have to briefly explain the semantics of my original template language:

hello

Factorial is This means "create a string" "

hello

++ "" ++ "

factorial N is" ++ coerce_to_string(N) ++ " is " ++ ... is the LAST value is a is coerced into a string and the value is pasted into the document. Bindings created *within* get carried to the next context. My new language (inspired by PHP) was more like this:

hello

factorial is Which was transformed into: out("

hello

"), N = 10, out("

factorial "); out(N), out(" is "), out(fac(N)) At the time I rather liked this - all I had to do was enclose top level bits of HTML in an out(...) wrapper. Then my subroutines could also call out(...) - like PHP This resulted in a soggy mess. Why? - evaluation order now matters. I/O is an imperative side effect, scattering out(X) statements at random in subroutines implies that somehow and somewhere you have an idea as to in which order these subroutines will be called. Pure functional programming is far easier - in the earlier model each function returns a string (if that's what you want) and the caller assembles the return values into new strings. The order of calling the routines is irrelevant, since you will always get the same result. I/O by side effects (using out(X) in a subroutines) made writing all other than simple code a mess. I junked this experiment. To recap - If I had distributed experiment 1 (the velocity approach) I would have committed a venial sin, resulting in "temporary loss of grace" from the Erlang Users. But distributing something with a PHP like syntax would be a mortal sin requiring a valid confession in articolo mortis - and what would happen if I met an untimely end, like in a car crash, so that I couldn't confess ... So we're back to my original design. In passing I did make a little mini-mini-template language. This is simply HTML with a few ${Var} variables in it - like this: Put this in a file foo.template ${title}

hello ${person} how are you? Then expand with: expand:file("foo.template", [{"title", "my web page"}, {"person", "joe"}]). Or make an xml template instance (say in the file bar) my web page joe and expand with: expand_xml("bar!", "foo.template") This mini-mini-template language which is laughably simple, is *very useful*. /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Gaspar Chilingarov > Sent: den 13 juni 2006 23:23 > To: Erlang Users' List; ke han > Subject: RFC: template engine [ was: Re: Implementing tables > - advice wanted ] > > Hello all! > > Post directed mainly to ke han, but all other list members are welcome > -- You have mentioned html template engine for erlang - what > kind of features do you like in there ? > > For current moment I got some simple engine which provides > following templating commands - > > <%TRANSLATE atom%> - generate string, calling some > translation function (to make multilangual sites) > > <%FOREACH keyname%> - <%/FOREACH%> - take element keyname > from proplist (which should have list value) and iterate > inner part of FOREACH loop for each element in that list. with an external function, or ["

...", I , ... ] end, L) ?> > <%WITH keyname%> <%/WITH%>- just go one level deeper - fetch > one element from proplist and execute inner template with it I don't understand - possibly > > <%PUT keyname%> - just put element of proplist into current position. (note the extra "" :-) > <%PUTVALUE%> - if we are in a leaf node - put it's value into > current position - ether string or integer. ?????? > so > if you have template > <%FOREACH args%><%PUTVALUE%> <%/FOREACH%> > > and we feed templating function with > {struct, [ > {args, {array, ["Hello", "world", "!"]} } ]} data we > will receive "Hello world ! " string. > > this approach - added with if/ifdef/else commands allows > create templates which are totally separate from programming > language and are driven only by data which is fed to template > interpreted. > > it somehow resembles XSLT, but much more simple to allow HTML > designers easily use it and put into pages without disturbing > programmer too much. > > second idea with such markup is that there is translator from > such markup to JSON notation, and there is JS template > renderer, which could be run on client machine - thus > allowing passing from server not rendered template, but > parsed template and data -- JS copes well even on slow > machines with datasets about up to 1000 elements - like > 10x100 table - which is practically enough for most tasks. > > > solution, which you would like to see - even too fantastic or > futuristic -- because it's always possible to find something > reasonable and practical there. > > > Looking forward for answers :) > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED > From vladdu55@REDACTED Wed Jun 14 12:50:41 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Jun 2006 12:50:41 +0200 Subject: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: Message-ID: <95be1d3b0606140350t30a79db2m557f451ed9192bd7@mail.gmail.com> Hi, On 6/14/06, Joe Armstrong (AL/EAB) wrote: > In passing I did make a little mini-mini-template language. > > This is simply HTML with a few ${Var} variables in it - like this: This is similar to StringTemplate (www.stringtemplate.org). One nice feature (IMHO) of ST is that it handles transparently variables that are lists. regards, Vlad From dot@REDACTED Wed Jun 14 12:59:26 2006 From: dot@REDACTED (Tony Finch) Date: Wed, 14 Jun 2006 11:59:26 +0100 Subject: Web pages using a simple tuple store [was : RE: template engine] In-Reply-To: References: Message-ID: On Wed, 14 Jun 2006, Joe Armstrong (AL/EAB) wrote: > > But this is a *local* operation - let's make this distributed, and > let's define a protocol on top of HTTP which does this: > > This request updates the tuple store: > http://www.some.server/put/joe/login/region?val=EncodedString > It returns the OLD value of the tuple (joe,login,region) > http://www.some.server/get/joe/login/region > Retrieves the value of the (joe,login,region) tuple It would be more HTTPish to use HTTP's PUT and GET methods (rather than encoding this in the URL), so you get well-known semantics. > If a user is viewing a page and sombody put's a new value the change is > seen immediately (this needs an ajax lister, for every page, it rpc the > server and gets a return value if any region on the page is updated) XMPP is the ideal protocol for this :-) > RSS feeds > ========= See the specs produced by the IETF's atompub working group. http://www.ietf.org/html.charters/atompub-charter.html Tony. -- f.a.n.finch http://dotat.at/ PORTPATRICK: STRONG SOUTH WINDS DEVELOPING IN SHANNON AND ROCKALL, AND STRONG CYCLONIC WINDS DEVELOPING IN SOUTHEAST ICELAND, ON SATURDAY. From klacke@REDACTED Wed Jun 14 13:33:58 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 14 Jun 2006 13:33:58 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> Message-ID: <448FF426.1080502@hyber.org> Christian S wrote: > On 6/14/06, Yariv Sadan wrote: > > That is, if yaws had an i18n framework at all, and i18n was imported > from yaws_api. > Lot's of yaws apps have been built using the ?TXT macro from jungerl. Easy. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From ke.han@REDACTED Wed Jun 14 13:38:09 2006 From: ke.han@REDACTED (ke han) Date: Wed, 14 Jun 2006 19:38:09 +0800 Subject: Implementing tables - advice wanted In-Reply-To: <200606140209.k5E29Kwn222562@atlas.otago.ac.nz> References: <200606140209.k5E29Kwn222562@atlas.otago.ac.nz> Message-ID: Please allow me to express a current problem I'm working on and see if pattern matching on this new type could use "named tags" to match in addition to or instead of "position and shape" matching. I have a complex term which represents the view's relationship to the controller and models. The goal is to allow an app programmer to specify this term and have my metadata engine restructure the term into two or more sets of metadata to be efficiently used by the view and controller "objects". (In this case, the view means that metadata gets written out as json and is used by my javascript code). The trouble is the potential complexity of this original term. Here is an example below: 1: Metadata = rs:metadata(A, %% need to associate any controller pids to session in A 2: {controller, PersonController, [ 3: {validate, throwFirst}, % or throwAll 4: {attributes, [ 5: {message, '<=', string}, 6: {{country.list, countries}, '<=', [integer, string]}]}, 7: {event, {saveButton, onClick}, [sync, save]}, % can I rely on dojo.event to keep these in order? 8: {event, {cancelButton, onClick}, cancel}, 9: {model, person, [ 10: {attributes, [ 11: {id, '<=', integer}, 12: {firstName, '<=>', string}, 13: {lastName, '<=>', string}, 14: {birthDate, '<=>', date, 15: [{event, onBlur, validate}]}, 16: {{country.selection, country}, '<=>', integer} % infer type integer from list def 17: ]} 18: ]} 19: ]}), As hopefully may be obvious, the term describes the following: a View contains a Controller(Holder, really a reference to a pid on the server)...this is called controller. It contains the pid which is the PersonController process. From there we set things like (line 3) for the controller to later know how to handle errors on batch sync from the view; we see a attributes like message (line 5), a model (line 9) which implies the PersonController must be able to respond to some message to retrieve such object. Further, we see definition for attributes of the model such as id, firstName, etc.. (11-16). The above structure is a simple one. Line 11 could also be written as: {{personId, id}, '<=', integer} which would mean the view's id for the view's id for the person id is personId, but the internal attribute name of the person object it maps to is id. Also we could write: {{personId, id}, '<=', {integer, 1, 1000}} which would bound the integer value. The term structure for attribute typing and constraints could get rather complex. BTW, the '<=' means that the view will receive the value but that the controller will not accept changes to it; '<=>' means the value is viewable and changeable; '=>' would be useful for password fields where the user types in the value and it gets sent to the controller, but never the other direction. Line 2 could be written as: {{controller, personController}, PersonController, [...]) which would mean that the object in the view which holds the controller pid needs to have id personController instead of default id of controller. Event descriptions can be written in long or short format as well; line 8 could be written as: {event, {cancelButton, onClick}, {personController, cancel}} This removes ambiguity of the receiver (personController) of the onClick event. ok, I think you can see that these terms can have lots of variations. The question as it relates to a new dictionary syntax is: Can I describe this structure using a dictionary syntax that would allow me to more easily write my metadata interpreter which deconstructs this original term and creates several sets of metadata to be used by the collaborating mvc participants.? In javascript frameworks such as dojo, I have seen associative arrays used as a clean method of calling functions which may have a large number of optional parameters. For example, the javascript: dojo.io.bind({ url: 'HelloWorldResponseGET.php', handler: helloCallback, content: {name: dojo.byId('name').value } }); The above uses an associative array as the argument to dojo.io.bind (). This allows the programmer to use the same function bind() with many different combinations of parameters. This javascript example has little mapping to what I want to do in erlang (which is pattern matching internal to the call), but does show the powers of using an associative array in javascript function args (just to get the mind working ;-)). Let me take a try at using Joe's proposed syntax to rewrite part of me my original term: 2: @controller{id=personController, value=PersonController, [ 3: @validate{rule=throwFirst}, 4: @attributes{list= [ 5: @attribute{id=message, viewId= messageDiv, sync='<=', type=string}, If I write my structure this way, would I find benefits in pattern matching against named tags instead of or in addition to position and shape of the term? Since I haven't seen examples on how this would be done, I'll experiment with some ides: @controller{id=Id, value=Value} = Term -> @attribute{id=Id, externalId=ExternalId, sync=Sync, type=Type} = Term -> if Id == undefined -> throw error ExternalId2 = case ExternalId of undefined -> Id; ExternalId -> ExternalId end, ... @type{name=Name, ....} = Type %% not sure what to do here as type could have may different structures depending on its type. The code above is written with the full possibilities of each dict type and defaults to undefined for any value which is not defined in the dict (maybe the dict definition could define default values similar to records, but with added behavior such as @attribute{id, {externalId, @id}, {sync, '<='}} which would allow direct and relative defaults. I'm probably trying to do too much with this, but my point is that If I don't get added value in pattern matching, then perhaps having the dictionary syntax only gives value as a slightly better record format??? thanks for putting up with this long post, ke han On Jun 14, 2006, at 10:09 AM, Richard A. O'Keefe wrote: > "Joe Armstrong \(AL/EAB\)" wrote: > I've been thinking a bit about tables in Erlang. > > Erlang really really really (^100) needs tables. > > I have written about this in detail suggesting Erlang-appropriate > syntax, an adequate set of built in functions, and explaining how > they can be implemented efficiently. > > In a Daghstuhl meeting we has a session on the theme "all you need > are tables - virtually all dynamically typed languages (except > Erlang) > have tables. In Lua they are called tables, in Python > dictionaries, in > JavaScript associative arrays - the semantics of all these things are > slightly different but essentially they are the same. > > There is one essential difference: Python, Ruby, Javascript, Perl, > Icon, > ... all have MUTABLE tables. Erlang data structures are not mutable. > This has consequences for implementation. > > Keys are strings or integers, conseqative ranges of integers > (very useful for arrays) are handled in a special manner. > > The most appropriate keys for Erlang would seem to be atoms. > > I'm wondering about how to implement tables. > > Let's choose "@" as the table constructor (just about the only > character > left, that's unused. > > X = @{name="fred", age=23, footSize = 42} > Name = X.name, > ... > The syntax I proposed uses <{...}> for anonymous psi-terms and > for named psi-terms, e.g., > X = > > Now how could I implement this? > > Very very cheaply. Basically, a psi-term is > a tuple, with a different tag, > whose first element points to a tuple containing the name (if any) > and the keys, in a standard order. > > There is again quite an important difference between the way Erlang > would use something like this and the way we'd use hash tables; Erlang > uses _pattern matching_, so that > > = X > > is a normal thing to do. With keys in standard order, this can be > done > in a linear scan. For something like > > get(X, name) > > a binary search is required, but immutable psi-terms are unlikely to > grow large enough for binary search (especially if cunningly done) to > be a performance issue at all. > > Psi-terms are a good, perhaps even the ideal, replacement for records. > The analogy with *mutable* hash tables in other languages, which get > *used* in completely different ways, is probably misleading. > > That's not to say that a mutable hash table data type would be of no > use. It already exists, courtesy of the process dictionary, and if > you want a light-weight way to implement these things, building on > top of the process dictionary rather than ets is probably the way > to go. > From nm@REDACTED Wed Jun 14 13:48:24 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 14 Jun 2006 16:48:24 +0500 Subject: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: Message-ID: <448FF788.40906@web.am> Joe Armstrong (AL/EAB) wrote: > I see no reason why a template engine should offer any other than > full access to all Erlang functions, not some ad-hock subset. > > > My template engine is described here: > > http://www.erlang.org/ml-archive/erlang-questions/200602/msg00326.html > > I've edited some comments into Gaspar's mail at the end of this post. > > Since this posting I have done one or two experiments - all failed > so I stand by the original design. > > I also came up with a small (and useful) "mini template". > > Since it is instructive, I can relate what happened when I tried to > improve upon the original design. > > - I made two attempts to "improve" my design > 1) make a restricted template language (like velocity) > 2) make something A lot like PHP > > What happened? > > 1) > > I did something like velocity - but I very soon missed > the power of a full programming language - doing easy thing was, > well .. uuug easy - doing other things was complex and doing > difficult things was ... impossible. > > Embedding ajax calls using higher order functions - forget it ... > > I junked this experiment > > 2) I thought "this (ie my template engine) is pretty much like PHP > let's make it even more like PHP to attract users who know PHP. > > To do this I added an out(String) primitive and changed the semantics of > my > template language. > > < aside > > I have to briefly explain the semantics of my original template > language: > >

hello

> >

Factorial is > > This means "create a string" > > "

hello

++ "" ++ "

factorial N is" ++ > coerce_to_string(N) ++ " is " ++ ... > > is the LAST value is a is coerced into a string and the value > is > pasted into the document. Bindings created *within* get > carried to the > next context. > > > My new language (inspired by PHP) was more like this: > >

hello

> >

factorial is > > Which was transformed into: > > out("

hello

"), > N = 10, > out("

factorial "); > out(N), > out(" is "), > out(fac(N)) > > At the time I rather liked this - all I had to do was enclose > top level bits of HTML in an out(...) wrapper. > > Then my subroutines could also call out(...) - like PHP > > This resulted in a soggy mess. Why? - evaluation order now matters. > I/O is an imperative side effect, scattering out(X) statements at random > > in subroutines implies that somehow and somewhere you have an idea as to > > in which order these subroutines will be called. > > Pure functional programming is far easier - in the earlier model > each function returns a string (if that's what you want) and the caller > assembles the > return values into new strings. The order of calling the routines is > irrelevant, > since you will always get the same result. > > I/O by side effects (using out(X) in a subroutines) made writing all > other than simple code a mess. > > I junked this experiment. > > To recap - If I had distributed experiment 1 (the velocity approach) I > would > have committed a venial sin, resulting in "temporary loss of grace" from > the > Erlang Users. But distributing something with a PHP like syntax would be > a mortal > sin requiring a valid confession in articolo mortis - and what would > happen if > I met an untimely end, like in a car crash, so that I couldn't confess > ... > > So we're back to my original design. > > In passing I did make a little mini-mini-template language. > > This is simply HTML with a few ${Var} variables in it - like this: > > Put this in a file foo.template > > ${title} >

hello ${person} how are you? > > > Then expand with: > > expand:file("foo.template", [{"title", "my web page"}, > {"person", "joe"}]). > > Or make an xml template instance (say in the file bar) > > my web page > joe > > and expand with: > > expand_xml("bar!", "foo.template") > > This mini-mini-template language which is laughably simple, > is *very useful*. > > > /Joe > > > > > >> -----Original Message----- >> From: owner-erlang-questions@REDACTED >> [mailto:owner-erlang-questions@REDACTED] On Behalf Of >> Gaspar Chilingarov >> Sent: den 13 juni 2006 23:23 >> To: Erlang Users' List; ke han >> Subject: RFC: template engine [ was: Re: Implementing tables >> - advice wanted ] >> >> Hello all! >> >> Post directed mainly to ke han, but all other list members are welcome >> -- You have mentioned html template engine for erlang - what >> kind of features do you like in there ? >> >> For current moment I got some simple engine which provides >> following templating commands - >> >> <%TRANSLATE atom%> - generate string, calling some >> translation function (to make multilangual sites) >> > > > >> <%FOREACH keyname%> - <%/FOREACH%> - take element keyname >> from proplist (which should have list value) and iterate >> inner part of FOREACH loop for each element in that list. > > with an external function, or > > > ["

...", I , ... ] > end, L) ?> > > >> <%WITH keyname%> <%/WITH%>- just go one level deeper - fetch >> one element from proplist and execute inner template with it > > I don't understand - possibly > > > > >> <%PUT keyname%> - just put element of proplist into current position. > > (note the extra "" :-) > >> <%PUTVALUE%> - if we are in a leaf node - put it's value into >> current position - ether string or integer. > > ?????? > >> so >> if you have template >> <%FOREACH args%><%PUTVALUE%> <%/FOREACH%> >> >> and we feed templating function with >> {struct, [ >> {args, {array, ["Hello", "world", "!"]} } ]} data we >> will receive "Hello world ! " string. >> >> this approach - added with if/ifdef/else commands allows >> create templates which are totally separate from programming >> language and are driven only by data which is fed to template >> interpreted. >> >> it somehow resembles XSLT, but much more simple to allow HTML >> designers easily use it and put into pages without disturbing >> programmer too much. >> >> second idea with such markup is that there is translator from >> such markup to JSON notation, and there is JS template >> renderer, which could be run on client machine - thus >> allowing passing from server not rendered template, but >> parsed template and data -- JS copes well even on slow >> machines with datasets about up to 1000 elements - like >> 10x100 table - which is practically enough for most tasks. >> >> >> solution, which you would like to see - even too fantastic or >> futuristic -- because it's always possible to find something >> reasonable and practical there. >> > > >> Looking forward for answers :) >> >> -- >> Gaspar Chilingarov >> >> System Administrator, >> Network security consulting >> >> t +37493 419763 (mob) >> i 63174784 >> e nm@REDACTED >> > -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From mickael.remond@REDACTED Wed Jun 14 14:04:13 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 14 Jun 2006 14:04:13 +0200 Subject: Web pages using a simple tuple store [was : RE: template engine] In-Reply-To: References: Message-ID: <20060614120413.GA26707@memphis.ilius.fr> * Tony Finch [2006-06-14 11:59:26 +0100]: > > If a user is viewing a page and sombody put's a new value the change is > > seen immediately (this needs an ajax lister, for every page, it rpc the > > server and gets a return value if any region on the page is updated) > > XMPP is the ideal protocol for this :-) I agree. A realtime wiki project is currently under development in the Google summer of code context: http://wiki.jabber.org/index.php/Real-time_wiki The idea is exactly this, build on XMPP and the pubsub protocol for the server part. The code is developed by Grzegorz Grasza and I am mentoring the work. XMPP is a good idea for that as many building bricks are already available: - Pubsub engine (in ejabberd) - XMPP Javascript client-side libraries. The Realtime wiki project should be the basis of a very nice Ajax framework. -- Micka?l R?mond http://www.process-one.net/ From yarivvv@REDACTED Wed Jun 14 15:53:01 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 09:53:01 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448FF426.1080502@hyber.org> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> <448FF426.1080502@hyber.org> Message-ID: <17244f480606140653h6fbc6cd6h9fb29b5a2d85901c@mail.gmail.com> > > Lot's of yaws apps have been built using the ?TXT macro > from jungerl. Easy. > Claes, I assume it shouldn't be too difficult to add to Yaws another rendering function, which would be used such as yaws_api:render("template1.tpl", TemplateData). where template1.tpl has such code: <% out(Data) -> Person1 = data:get(person1, Data), %% do something with Person1 ... Result = io_lib:format("~w", [Person1]), %% modify props NewData = data:add({person2, [{name, "bob"}]}, Data), %% return result {Result, NewData}. <%> <%! this is a comment, won't be rendered %> <%! syntactic sugar for implicitly writing 'out(Data) ->...{Result} ' %> <%= data:get(person2, Data). %> <%= yaws_api:render("footer.tpl", {year) %> The major change is to modify out(A) to accept the Data parameter rather than today's Arg, and to make it return either {Result} or a {Result, NewData} tuple. NewData, if exists, will be passed to subsequent out(Data) calls. With this feature, it will be quite easy to add a controller that takes a URL, calls a function and matches the result with a template file. What do you think? Regards, Yariv From ke.han@REDACTED Wed Jun 14 16:47:59 2006 From: ke.han@REDACTED (ke han) Date: Wed, 14 Jun 2006 22:47:59 +0800 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448FC608.7030107@web.am> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> Message-ID: > Romain Lenglet wrote: > > just a reference: > Enforcing Strict Model-View Separation in Template Engines > http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf Excellent reference paper, thanks. I think all could benefit from reading this as well as other info at http://www.stringtemplate.org/ A good summary as it relates to this thread...from http:// www.stringtemplate.org/doc/doc.tml After examining hundreds of template files that I created over years of jGuru.com (and now in ANTLR v3) development, I found that I needed only the following four basic canonical operations (with some variations): * attribute reference; e.g., $phoneNumber$ * template reference (like #include or macro expansion); e.g., $searchbox()$ * conditional include of subtemplate (an IF statement); e.g., $if (title)$$title$$endif$ * template application to list of attributes; e.g., $names:bold()$ Indeed, these four characteristics seem to be all we need and is in line with mine and others' intuition that a template engine should _not_ be a Turing complete language. Unfortunately, StringTemplate has no C port...only Java, Python and C# variants.. It does seem that building a clean-room erlang implementation of StringTemplate would be easy for someone handy with lex and parse tools, hence bypassing an antlr dependancy and implementing entirely in erlang. From there, we only need some basic additions to yaws to pull it all together. Of course, if Joe's existing template engine embodies the same principals as StringTemplate, then that seems worth plugging into yaws as well. To be fair to Claes, yaws already does some of this...variable bindings, yssi, etc..but it comes together as separate utils, not a cohesive template strategy. ke han On Jun 14, 2006, at 4:17 PM, Gaspar Chilingarov wrote: > Romain Lenglet wrote: > > just a reference: > Enforcing Strict Model-View Separation in Template Engines. > http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf > >> [....] >> I would personally avoid any imperative / non-declarative >> construct in a template language. >> Tons of template languages exist for PHP, etc. so one should at >> least look at them and reuse ideas from them. >> Many existing usable template engines / languages end up having >> the same characteristics / features: >> >> - they usually apply the MVC pattern, >> >> - in views, the pattern language allow to identify placeholders >> for values (strings) set by the controller (by the code), and >> allow to identify / markup blocks of text that are optional or >> that can be repeated, as controlled by the controller; >> >> - some languages allow to recursively identify blocks inside >> blocks in views; >> >> - the only information shared between a view (a template) and a >> controller (Erlang code) is: the names of value placeholders, >> and the names and structures (hierarchies) of >> optional/repeatable blocks. >> > > > >> The view language is usually completely declarative. If you need >> to do a loop to repeat a block, you should do it in the code (in >> the controller), not by defining a "FOREACH" construct in the >> template language (in the view). >> > > hm, this sounds good - I should think about such model. > > >> >> A good, simple template language that can directly be used in an >> Erlang template engine in that of PHP Pear: >> http://pear.php.net/manual/en/package.html.html-template-it.intro.php >> >> For example, using this syntax, one view could be: >> >> >> >> >> >> >> >> >> >> >>
>> {DATA} >>
>> >> >> The advantage of that syntax is that it allows most of the time >> to edit a template as HTML using any existing visual editor: >> nvu, dreamweaver, etc. This simplifies the design of templates >> by non-programmers. No loops, no programming logic in views. >> >> >> Then, the template engine could allow a controller in Erlang to >> process a template like: >> >> engine:parse_template("foo.tpl.html", >> [{block, row, >> [{block, cell, [{variable, DATA, "hello"}]}, >> {block, cell, [{variable, DATA, "world"}]}]}]) >> >> which would return a string containing the whole parsed template. >> > >> PHP Pear also allows to maintain a cache of pre-parsed templates, >> to improve performance. This should be provided also by an >> Erlang template engine. >> > > this is quite simple to do in erlang - just hang aroung caching > process > - one thing which you can not have done in php and apache (monitord is > somehow working solution). > > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED From Hans.Bolinder@REDACTED Wed Jun 14 17:14:42 2006 From: Hans.Bolinder@REDACTED (Hans.Bolinder@REDACTED) Date: Wed, 14 Jun 2006 17:14:42 +0200 Subject: dets improvements? In-Reply-To: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> Message-ID: <17552.10210.591016.642666@gargle.gargle.HOWL> [Yariv Sadan:] > I hope I'm not bringing it up too many times but I figured I'll give > one last shot trying to get an answer... Is the OTP team planning on > making the dets improvements discussed in this thread? There are currently no plans to improve Dets. > Maybe it's possible to develop for Mnesia an alternative disc only > storage engine designed for storing large blobs. Dets stores objects on the external term format, which means that binary_to_term() (term_to_binary()) is called whenever objects are retrieved (stored). These functions block the emulator (or just the scheduler running the Dets process, if SMP), which spoils the soft real-time properties for huge terms. Films etc are better stored outside of Dets. [Klacke:] > Two major problems with dets as of today (and of yeasterday) > > 1. 64 bit indexing - really easy to fix > 2. repair time - this is a bit harder to fix, ... As regards the second point: The repair time was significantly reduced in Erlang/OTP R8B. When repairing, data is written and read serially; no random access is involved. (By the way, the same goes for copying (open) Dets files between nodes, something Mnesia does every now and then.) A full Dets table (16 millions small objects) should not take more than half an hour to repair, at the worst. This is of course a very long time... I don't think it's easy to further reduce repair times. The major problem with Dets as I see it is that the memory allocation scheme (a buddy system) is kept in RAM. For a fragmented table with millions of objects, the RAM data can amount to several megabytes. When closing or syncing a table, this (possibly huge) data structure has to be written to disc. Best regards, Hans Bolinder, Erlang/OTP From stock16@REDACTED Wed Jun 14 17:55:38 2006 From: stock16@REDACTED (jim min) Date: Wed, 14 Jun 2006 15:55:38 +0000 Subject: newbie question: flat_length example In-Reply-To: <20060610012933.GF24411@frogman.motivity.ca> Message-ID: >From: Vance Shipley >To: Quan Ta >CC: erlang-questions@REDACTED >Subject: Re: newbie question: flat_length example >Date: Fri, 9 Jun 2006 21:29:33 -0400 > >On Fri, Jun 09, 2006 at 08:10:23PM -0500, Quan Ta wrote: >} >} flat_length([H,T], N) when list(H) -> > ^ > | >should be | ----+ > >} why is the result 3? should it be 4? >} >} -- Quan From serge@REDACTED Wed Jun 14 19:43:15 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 14 Jun 2006 13:43:15 -0400 Subject: SFTP in R11B Message-ID: <44904AB3.8080407@hq.idt.net> I've been experimenting with the SSH application in R11B, and found that in some occasions when an ssh_sftp client cannot establish connection with an SFTP server, the ssh_sftp client crashes misarably producing a nice chunk of CRASH REPORTs when SASL is started. A dive into the ssh_sftp's source led to the following observations: 1. SFTP clients starts an connection manager ssh_cm. The later is implemented as a gen_server process that doesn't carefully handle exceptions in user_auth call leading to a leaky exception in the gen_server's init/1. That is easy to fix: --- lib/ssh/src/ssh_cm.erl 2006-06-07 18:24:43.767831191 -0400 +++ lib/ssh/src/ssh_cm.erl 2006-06-07 18:45:01.594608966 -0400 @@ -199,7 +199,7 @@ init([client, User, Host, Port, Opts]) -> case ssh_transport:connect(Host, Port, Opts) of {ok, SSH} -> - case user_auth(SSH, Opts) of + case catch user_auth(SSH, Opts) of ok -> SSH ! {ssh_install, connect_messages()}, process_flag(trap_exit, true), 2. However, in this case gen_server's init/1 returns {stop, Reason}. This is an expected callback's return value, but because the Reason is not normal, this still produces a sasl CRASH REPORT. I am not sure this is a good thing. I'd like to be able to do: ssh_sftp:connect(Host, Opts) -> {ok, Pid} | {error, Reason} without getting a crash report. Is there a way to avoid that? Additionally, here's a reference to another ssh_sftp patch fixing sftp's hanging issue: http://www.erlang.org/ml-archive/erlang-questions/200605/msg00095.html Regards, Serge -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From yarivvv@REDACTED Wed Jun 14 19:57:45 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 13:57:45 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> Message-ID: <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Hi, > Indeed, these four characteristics seem to be all we need and is in > line with mine and others' intuition that a template engine should > _not_ be a Turing complete language. I would like to bring up one more point in favor of using Erlang as a template language: ehtml. With an Erlang template language, you could write code such as <%= {ehtml, {table, [], { lists:foldl(fun(E, A) -> [{tr, [], {td, [{width, 20}], E#person.name}} | A] end, [], dict:get(people, Data))} } }, %> in the template file. I think there's little doubt that this code does not belong in the controller, and that an ehtml tuple generated with pure Erlang is quite elegant. My 2c. Regards, Yariv From ke.han@REDACTED Wed Jun 14 20:12:30 2006 From: ke.han@REDACTED (ke han) Date: Thu, 15 Jun 2006 02:12:30 +0800 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448FF426.1080502@hyber.org> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> <448FF426.1080502@hyber.org> Message-ID: <0584A2F4-0E18-44CB-A004-E736D4D530CD@redstarling.com> ok, I give up the jungerl search... where in jungerl is this ?TXT macro to which you refer? thanks, ke han On Jun 14, 2006, at 7:33 PM, Claes Wikstrom wrote: > Christian S wrote: >> On 6/14/06, Yariv Sadan wrote: > >> That is, if yaws had an i18n framework at all, and i18n was imported >> from yaws_api. >> > > Lot's of yaws apps have been built using the ?TXT macro > from jungerl. Easy. > > > /klacke > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > cellphone: +46 70 2097763 From ke.han@REDACTED Wed Jun 14 20:28:30 2006 From: ke.han@REDACTED (ke han) Date: Thu, 15 Jun 2006 02:28:30 +0800 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Message-ID: On Jun 15, 2006, at 1:57 AM, Yariv Sadan wrote: > Hi, > >> Indeed, these four characteristics seem to be all we need and is in >> line with mine and others' intuition that a template engine should >> _not_ be a Turing complete language. > > I would like to bring up one more point in favor of using Erlang as a > template language: ehtml. With an Erlang template language, you could > write code such as > > <%= > {ehtml, {table, [], { > lists:foldl(fun(E, A) -> > [{tr, [], {td, [{width, 20}], E#person.name}} | A] > end, [], dict:get(people, Data))} > } > }, > %> according to StringTemplate syntax, your example can be written more clearly, IMO: $people:row()$
where row() is defined as: $attr.name$ - or - if you feel like putting it together as one: $people: { }$
$attr.name$
I think if you read the pdf referred in this thread, you can see the rational for not using erlang as the template language but in favor of using erlang for all the behavior needed elsewhere such as the controllers, models, and renderers. In other words, "if StringTemplate can't easily help you construct your view, then you shouldn't be coding that behavior in the view". thanks, ke han > > in the template file. I think there's little doubt that this code does > not belong in the controller, and that an ehtml tuple generated with > pure Erlang is quite elegant. > > My 2c. > > Regards, > Yariv From bsder@REDACTED Wed Jun 14 20:45:23 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 14 Jun 2006 11:45:23 -0700 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> Message-ID: <44905943.2000409@allcaps.org> Yariv Sadan wrote: > I actually think there's something to learn from Drupal, the popular > open source PHP CMS. Drupal's default template engine used to be > xtemplate, which had a basic template language, but at a recent > version, Drupal switched to PHP template by default. The reason, as I > recall, is that the Drupal developers realized they already 'had' a > template language: PHP. I'm torn on this. On one hand, I would like to have a template language that is executable and embeddable. It makes my life easier. On the other hand, this scales poorly. Once the content writer is no longer a programmer, this is bad. All the HTML content editing tools cope badly. In addition, having executable code in the HTML is generally an MVC abstraction failure. The Django folks generally make comments about this every time they give a presentation. The content writers don't want to be programmers and hate having code in their HTML. They don't even want to deal with Javascript; they just don't want to program. Take a look at the Django templating to see how they limit the issue. I don't think there is an ultimate solution. This is one of those issues where different solutions work at different levels. I personally despise PHP because my projects almost always wind up exceeding the level that it works comfortably. Generally my pain is not enough that I have to rip up the already done work but enough to hurt. -a From yarivvv@REDACTED Wed Jun 14 21:10:56 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 15:10:56 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Message-ID: <17244f480606141210r35a577ebg81073f4f9c74aed2@mail.gmail.com> > according to StringTemplate syntax, your example can be written more > clearly, IMO: > > > $people:row()$ >
> > where row() is defined as: > $attr.name$ > > > - or - if you feel like putting it together as one: > > > $people: { > > }$ >
$attr.name$
> > I think if you read the pdf referred in this thread, you can see the > rational for not using erlang as the template language but in favor > of using erlang for all the behavior needed elsewhere such as the > controllers, models, and renderers. In other words, "if > StringTemplate can't easily help you construct your view, then you > shouldn't be coding that behavior in the view". > Ke Han, I admit I haven't fully read the PDF before I wrote my last email... :) I agree that the StringTemplate code is looks much better than the ehtml code. I will try to think of cases where an Erlang template language would clearly be superior to StringTemplate... If I can't think of such cases, or nobody points one out to me, I may very well turn into a StringTemplate convert. Best, Yariv From cyberlync@REDACTED Wed Jun 14 21:23:51 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 14 Jun 2006 12:23:51 -0700 Subject: Progrommatic control of dialyzer In-Reply-To: <448FB8B1.7050101@it.uu.se> References: <448FB8B1.7050101@it.uu.se> Message-ID: Sorry about the duplication, I should have done a bit more research before posting. However, if the duplication provides just a bit more impetus to do the api it might be worth it ;) On 6/14/06, Tobias Lindahl wrote: > Hi, > > The question has been asked before, and unfortunately the answer is the > same this time. I will make a way of calling Dialyzer and get the > answers in Erlang rather than through the command line, but I haven't > got around to it yet. Just keep asking and it might even happen ;-) > > Tobias > > Eric Merritt wrote: > > Is there some method to control and use dialyzer pragmatically? I have > > been fiddling with something akin to a continuous build system for my > > erlang projects with support for unit tests and the like. I would like > > to add support for dialyzer and an API would make that simpler. The > > R11 docs only cover the command line version but just because > > something isn't documented doesn't mean it doesn't exist. Hence this > > question to the list. > From cyberlync@REDACTED Wed Jun 14 21:46:28 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 14 Jun 2006 12:46:28 -0700 Subject: Progrommatic control of dialyzer In-Reply-To: <1150267063.448faeb75cc73@backawinner.gg> References: <1150267063.448faeb75cc73@backawinner.gg> Message-ID: Very cool, It seems that I missed that project when I started this. It looks like really good stuff as well. However, I don't think there is too much duplication though the two projects have somewhat similar low level functionality the purpose and direction seem to be pretty different. The goal for my project is to build and test modules as they change giving the developer immediate feedback during his work cycle. There are also the secondary goals of automating a lot of the more difficult aspects of managing erlang projects, like the whole release management thing. For now that means that I make the assumption that the project uses an otp style layout to make this automation possible. In any case, it's not really meant as a continuous build system, that's just the easiest way to describe it. That's why I don't think that we are duplicating each other. On 6/13/06, Gordon Guthrie wrote: > Eric > > There is a continuous build script for Erlang in the jungerl. The full > documentation is available here: > http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/erlang_automated_build/doc/DOCUMENTATION.TXT?view=markup > > It can do some or all of the following: > * check out from CVS > * run a compile > * run a test suite > * run the dialyzer > * run a tsunami load test > > All the outputs can be graphed and sent up to a web site. > > At the moment I also have a rough cut of a web site spider enginge that will > follow all your hyperlinks but it is too shonky to be shown to the world. When > it is finished I will integrate it. > > Gordon > > > Quoting Eric Merritt : > > > Is there some method to control and use dialyzer pragmatically? I have > > been fiddling with something akin to a continuous build system for my > > erlang projects with support for unit tests and the like. I would like > > to add support for dialyzer and an API would make that simpler. The > > R11 docs only cover the command line version but just because > > something isn't documented doesn't mean it doesn't exist. Hence this > > question to the list. > > > > > > > > > ------------------------------------------------- > This mail sent through IMP: http://horde.org/imp/ > From tobbe@REDACTED Wed Jun 14 23:31:05 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 14 Jun 2006 23:31:05 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <0584A2F4-0E18-44CB-A004-E736D4D530CD@redstarling.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> <448FF426.1080502@hyber.org> <0584A2F4-0E18-44CB-A004-E736D4D530CD@redstarling.com> Message-ID: ke han wrote: > ok, I give up the jungerl search... where in jungerl is this ?TXT macro > to which you refer? > thanks, ke han Look at the gettext application in jungerl. There is also a HowTo for gettext at trapexit.org. --Tobbe > > On Jun 14, 2006, at 7:33 PM, Claes Wikstrom wrote: > >> Christian S wrote: >> >>> On 6/14/06, Yariv Sadan wrote: >> >> >>> That is, if yaws had an i18n framework at all, and i18n was imported >>> from yaws_api. >>> >> >> Lot's of yaws apps have been built using the ?TXT macro >> from jungerl. Easy. >> >> >> /klacke >> >> -- >> Claes Wikstrom -- Caps lock is nowhere and >> http://www.hyber.org -- everything is under control >> cellphone: +46 70 2097763 > > > From tobbe@REDACTED Wed Jun 14 23:33:51 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 14 Jun 2006 23:33:51 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Message-ID: Yariv Sadan wrote: > Hi, > >> Indeed, these four characteristics seem to be all we need and is in >> line with mine and others' intuition that a template engine should >> _not_ be a Turing complete language. > > > I would like to bring up one more point in favor of using Erlang as a > template language: ehtml. With an Erlang template language, you could > write code such as > > <%= > {ehtml, {table, [], { > lists:foldl(fun(E, A) -> > [{tr, [], {td, [{width, 20}], E#person.name}} | A] > end, [], dict:get(people, Data))} > } > }, > %> Using the ehtml module in yfront (jungerl) you can write the above as: {ehtml, ehtml:table([[E#person.name] || E <- dict:get(people,Data)])} --Tobbe > > in the template file. I think there's little doubt that this code does > not belong in the controller, and that an ehtml tuple generated with > pure Erlang is quite elegant. > > My 2c. > > Regards, > Yariv > From bsder@REDACTED Thu Jun 15 00:12:17 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 14 Jun 2006 15:12:17 -0700 Subject: gen_server and gen_tcp messages Message-ID: <449089C1.8000305@allcaps.org> How do I make a gen_server compatible with receiving messages from gen_tcp? What I would like to do is packetize a TCP stream. I want this to be encapsulated into a server so that I just send packets and receive packets to the server which handles the rest of the underlying issues. The problem I have is that I need a receive loop in the gen_server in order to grab the gen_tcp messages. Currently, I wind up with a gen_server which the spawns off another process solely to handle the gen_tcp messages. The gen_server and the tcp grab process then have to handle bidi coordination messages just like are already implemented by gen_server. This seems ... wrong. I have almost certainly made a poor architectural decision somewhere. Is there a way to convince the gen_server to call some code when it gets a gen_tcp message or message which it doesn't recognize? Basically I need to splice some extra message handling code into the existing gen_server receive loop. Thanks, -a From bsder@REDACTED Thu Jun 15 00:59:38 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 14 Jun 2006 15:59:38 -0700 Subject: gen_server and gen_tcp messages In-Reply-To: <449089C1.8000305@allcaps.org> References: <449089C1.8000305@allcaps.org> Message-ID: <449094DA.7030200@allcaps.org> Andrew Lentvorski wrote: > Is there a way to convince the gen_server to call some code when it gets > a gen_tcp message or message which it doesn't recognize? Basically I > need to splice some extra message handling code into the existing > gen_server receive loop. Sigh, it never fails. Send a help message and the answer jumps out at you. I should patent that as a help method ... Yes, there is a way to deal with messages that are unknown to gen_server. Quoting the documentation for gen_server: Module:handle_info(Info, State) -> Result This function is called by a gen_server when a timeout occurs or when it receives any other message than a synchronous or asynchronous request (or a system message). -a From yarivvv@REDACTED Thu Jun 15 01:19:50 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 14 Jun 2006 19:19:50 -0400 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Message-ID: <17244f480606141619ye36b9deud216e516566c79c@mail.gmail.com> > > Using the ehtml module in yfront (jungerl) you can write the > above as: > > {ehtml, ehtml:table([[E#person.name] || E <- > dict:get(people,Data)])} > Tobbe, this example make my previous code look like quite an eye sore :) However, the advantage I still see with a template language is that it makes it easy (i.e. no Erlang skills needed) to style and tweak the table without digging into Erlang code. OTOH, hacking a simple MVC framework into Yaws using Erlang as a template language is probably 1-3 days of work, whereas implementing a StringTemplate-like template engine is a bit harder. In addition, by integrating this way with Yaws you get caching for free. Depending on the maturity of the various efforts mentioned on this list, I might try this temporary hack just for fun :) Best, Yariv From chris.double@REDACTED Thu Jun 15 06:15:44 2006 From: chris.double@REDACTED (Chris Double) Date: Thu, 15 Jun 2006 16:15:44 +1200 Subject: Web pages using a simple tuple store [was : RE: template engine] In-Reply-To: <20060614120413.GA26707@memphis.ilius.fr> References: <20060614120413.GA26707@memphis.ilius.fr> Message-ID: On 6/15/06, Mickael Remond wrote: > I agree. > A realtime wiki project is currently under development in the Google > summer of code context: > http://wiki.jabber.org/index.php/Real-time_wiki That looks very cool! I'm very interested in the result. On the page it mentions: "...but I made a message passing interface between windows I call Portal Cookies (reminds me of Erlang, anyone willing to implement Erlang in JavaScript?)" This is something that has interested me. Being able to send and receive messages from a browser to erlang. I got sending messages from Erlang to the browser working and posted about that before. But having a more Erlang like client side library would be neat. I played around with lightweight threads and message passing in Javascript with an example here: http://www.bluishcoder.co.nz/2006/06/more-concurrency-in-narrative.html This allowed creating lightweight processes in Javascript and send and receiving messages between them. It uses a pre-processor called 'Narrative Javascript' that compiles the javascript code into CPS form. You can then capture the continuations - I built a lightweight thread scheduler around that. I haven't got much further but I think some neat things could be done with lightweight processes in the browser. Chris. -- http://www.bluishcoder.co.nz From nm@REDACTED Thu Jun 15 07:08:56 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 15 Jun 2006 10:08:56 +0500 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> Message-ID: <4490EB68.7070807@web.am> ke han wrote: [skip] > according to StringTemplate syntax, your example can be written more > clearly, IMO: > > > $people:row()$ >
> > where row() is defined as: > $attr.name$ > > > - or - if you feel like putting it together as one: > > > $people: { > > }$ >
$attr.name$
> > I think if you read the pdf referred in this thread, you can see the > rational for not using erlang as the template language but in favor of > using erlang for all the behavior needed elsewhere such as the > controllers, models, and renderers. In other words, "if StringTemplate > can't easily help you construct your view, then you shouldn't be coding > that behavior in the view". > > thanks, ke han > I'm even against such templating language -- because I wish to pass some simple template to designers and HTML coders and forget about it. Such syntax will break visual editors. In other hand -- I agree with Joe -- it's better to think about truly dynamic AJAX applications, and framework for easy building them. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From olgeni@REDACTED Wed Jun 14 22:58:58 2006 From: olgeni@REDACTED (Jimmy Olgeni) Date: Wed, 14 Jun 2006 22:58:58 +0200 (CEST) Subject: Dialyzer in R11B-0 In-Reply-To: <44904AB3.8080407@hq.idt.net> References: <44904AB3.8080407@hq.idt.net> Message-ID: <20060614225504.Y6951@olgeni.olgeni> Hello, While building R11B-0 I noticed that %DIALYZER_DIR% is replaced in dialyzer.hrl.src using a path from the build directory, rather than the path where Erlang will be installed into after "make install". I quickly fixed it using code:lib_dir/1, probably there's a better fix but this one may help if you are experiencing problems with dialyzer and PLT files :-) --- lib/dialyzer/src/dialyzer.hrl.src.orig +++ lib/dialyzer/src/dialyzer.hrl.src @@ -22,7 +22,7 @@ %% Values will be set by the Makefile -define(DEFAULT_LIBS, %DEF_LIBS%). --define(DIALYZER_DIR, %DIALYZER_DIR%). +-define(DIALYZER_DIR, code:lib_dir (dialyzer)). -record(analysis, {analysis_pid, core_transform=cerl_typean, defines=[], doc_plt, -- jimmy From Tobias.Lindahl@REDACTED Thu Jun 15 09:32:43 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Thu, 15 Jun 2006 09:32:43 +0200 Subject: Dialyzer in R11B-0 In-Reply-To: <20060614225504.Y6951@olgeni.olgeni> References: <44904AB3.8080407@hq.idt.net> <20060614225504.Y6951@olgeni.olgeni> Message-ID: <44910D1B.40700@it.uu.se> Thanks for the patch. Included. Tobias Jimmy Olgeni wrote: > > Hello, > > While building R11B-0 I noticed that %DIALYZER_DIR% is replaced in > dialyzer.hrl.src using a path from the build directory, rather than the > path where Erlang will be installed into after "make install". > > I quickly fixed it using code:lib_dir/1, probably there's a better fix > but this one may help if you are experiencing problems with dialyzer and > PLT files :-) > > --- lib/dialyzer/src/dialyzer.hrl.src.orig > +++ lib/dialyzer/src/dialyzer.hrl.src > @@ -22,7 +22,7 @@ > > %% Values will be set by the Makefile > -define(DEFAULT_LIBS, %DEF_LIBS%). > --define(DIALYZER_DIR, %DIALYZER_DIR%). > +-define(DIALYZER_DIR, code:lib_dir (dialyzer)). > > -record(analysis, {analysis_pid, core_transform=cerl_typean, > defines=[], doc_plt, > From ke.han@REDACTED Thu Jun 15 09:44:48 2006 From: ke.han@REDACTED (ke han) Date: Thu, 15 Jun 2006 15:44:48 +0800 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606141619ye36b9deud216e516566c79c@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> <17244f480606141619ye36b9deud216e516566c79c@mail.gmail.com> Message-ID: On Jun 15, 2006, at 7:19 AM, Yariv Sadan wrote: >> >> Using the ehtml module in yfront (jungerl) you can write the >> above as: >> >> {ehtml, ehtml:table([[E#person.name] || E <- >> dict:get(people,Data)])} >> > > Tobbe, this example make my previous code look like quite an eye sore > :) However, the advantage I still see with a template language is that > it makes it easy (i.e. no Erlang skills needed) to style and tweak the > table without digging into Erlang code. > > OTOH, hacking a simple MVC framework into Yaws using Erlang as a > template language is probably 1-3 days of work, whereas implementing a > StringTemplate-like template engine is a bit harder. That's the bottom line, isn't it. I am working on an mvc ajax only framework with yaws. I can get an alpha release out in a few more days as I do not need templating for this. I can also cheat and use erlang/ehtml for templating in yaws and simply watch how I use it so not to violate model-view separation. But longer term, I think something like StringTemplate is the way to go for traditional or "mixed mode" (ajax and templating) apps. ke han > In addition, by > integrating this way with Yaws you get caching for free. Depending on > the maturity of the various efforts mentioned on this list, I might > try this temporary hack just for fun :) > > Best, > Yariv From klacke@REDACTED Thu Jun 15 09:45:33 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 15 Jun 2006 09:45:33 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <17244f480606140653h6fbc6cd6h9fb29b5a2d85901c@mail.gmail.com> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <17244f480606132226t19ec6936r743ae90e0f906846@mail.gmail.com> <448FF426.1080502@hyber.org> <17244f480606140653h6fbc6cd6h9fb29b5a2d85901c@mail.gmail.com> Message-ID: <4491101D.2090502@hyber.org> Yariv Sadan wrote: >> >> Lot's of yaws apps have been built using the ?TXT macro >> from jungerl. Easy. >> > > > Claes, I assume it shouldn't be too difficult to add to Yaws another > rendering function, which would be used such as > > yaws_api:render("template1.tpl", TemplateData). > > where template1.tpl has such code: > > > > <% > out(Data) -> > .... Yes, that would be easy. Harder but more "yawsish" would be to work furher along the lines of yaws as of today whare the file extension is used to decide which "renderer' to use. This decision is made in yaws_server:suffix_type/2 /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From pacini@REDACTED Thu Jun 15 11:00:31 2006 From: pacini@REDACTED (Filippo Pacini (S.G. Consulting)) Date: Thu, 15 Jun 2006 11:00:31 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <4490EB68.7070807@web.am> References: <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> <200606141223.45282.rlenglet@users.forge.objectweb.org> <448FC608.7030107@web.am> <17244f480606141057y416ad4f2uec2347d73f047aa1@mail.gmail.com> <4490EB68.7070807@web.am> Message-ID: <449121AF.9030704@sgconsulting.it> Gaspar Chilingarov wrote: > ke han wrote: > >> according to StringTemplate syntax, your example can be written more >> clearly, IMO: >> >> >> $people:row()$ >>
>> >> where row() is defined as: >> $attr.name$ >> >> >> - or - if you feel like putting it together as one: >> >> >> $people: { >> >> }$ >>
$attr.name$
>> >> [skip] > > I'm even against such templating language -- because I wish to pass some > simple template to designers and HTML coders and forget about it. Such > syntax will break visual editors. > I develop web sites in python using Cheetah templates (similar to velocity). In Chetaah you can specify the start and end token of the template language. So if you use for example start token: In html you can write a table like:
$r.item1$r.item2
Usually designers can use visual editors on this templates without much problems. All the template code is in html comments. I'd like something similar also in erlang. Regards, filippo From jakob@REDACTED Thu Jun 15 13:18:28 2006 From: jakob@REDACTED (Jakob Cederlund) Date: Thu, 15 Jun 2006 13:18:28 +0200 Subject: ssh_sftp connection problem In-Reply-To: <445BCF0F.1030003@corp.idt.net> References: <445BCF0F.1030003@corp.idt.net> Message-ID: <44914204.4010905@erix.ericsson.se> Thanks for the patch! Test-case added for the connect of unknown host... Will check other ssh-modules too... /Jakob Dmitriy Kargapolov wrote: > Dmitriy Kargapolov wrote: >> Hi, >> I found that in ssh-0.9.1 ssh_sftp:connect/2,3 hangs in case when >> remote host is unknown. Supposedly it happens because: >> >> 1) internal ssh_cm:connect() call is implemented using >> gen_server:start_link: >> connect(Host, Port, Opts) -> >> gen_server:start_link(?MODULE, [client, self(), Host, Port, >> Opts], []). >> 2) when ssh_cm:init() failed because of lookup/connect timeout, >> parent linked process is died as well, i.e. ssh_sftp:init() is died. >> >> 3) call call ssh_cm:connect() never ends, and calling process hangs. >> >> To test just run ssh_sftp:connect(unexisting_host,[]). >> > > Not sure if the whole ssh_sftp server needs to be linked with ssh_cm, > but at least for the initialization phase it's better to catch exit > signal. Following patch solved problem mentioned above. > > Index: ssh_sftp.erl > =================================================================== > --- ssh_sftp.erl > +++ ssh_sftp.erl > @@ -284,8 +284,10 @@ > {stop, Error } > end; > init([Host,Port,Opts]) -> > + SaveFlag = process_flag(trap_exit, true), > case ssh_xfer:connect(Host, Port, Opts) of > {ok, Xf, RBuf} -> > + process_flag(trap_exit, SaveFlag), > {ok, #state { req_id = 0, xf = Xf, rep_buf=RBuf }}; > Error -> > {stop, Error} > > From matt@REDACTED Thu Jun 15 14:15:48 2006 From: matt@REDACTED (Matthew McDonnell) Date: Thu, 15 Jun 2006 13:15:48 +0100 (BST) Subject: gen_server and gen_tcp messages In-Reply-To: <449094DA.7030200@allcaps.org> References: <449089C1.8000305@allcaps.org> <449094DA.7030200@allcaps.org> Message-ID: On Wed, 14 Jun 2006, Andrew Lentvorski wrote: > Andrew Lentvorski wrote: > > Is there a way to convince the gen_server to call some code when it gets > > a gen_tcp message or message which it doesn't recognize? Basically I > > need to splice some extra message handling code into the existing > > gen_server receive loop. > Module:handle_info(Info, State) -> Result The handle_info method for handling calls from "non-OTP" processes works, but it still strikes me as a bit of a hack. The approach that you first mentioned seems cleaner ie gen_server <-> interface process <-> gen_tcp process where the interface process exists only to convert messages from the gen_tcp process (or port etc) into gen_server:calls (or casts). I like this method because it lets you put a logical box around the OTP processes where you can say "Everything within this box acts is an OTP component, interacting with the outside world with this interface process (X), that react to these sets of messages (X,Y) from the outside world." As far as I can tell the only disadvantage is the extra cost of transmission of the data from the outside world through the interface process. Another approach is given in Pete Kazmier's "Writing an Erlang Port using OTP Principles" tutorial (http://www.trapexit.org/docs/howto/port_and_otp.html). The gen_server receives a call from a client using handle_call, calls an external echo process and then goes into state that waits for the reply, before finally returning from the handle_call function. This works fine for the case where the gen_server is the thing doing the calling, but not when the resource attached to the gen_server can send messages spontaneously (ie the gen_tcp in you case, or a port connected to an experimental microcontroller in a problem I was thinking about previously). Using handle_info is one solution, using an extra interface process is another (which seems cleaner somehow). Is there a definitive answer for how to connect a OTP application to non-OTP processes cleanly? Cheers, Matt Matt McDonnell Email: matt@REDACTED Web: http://www.matt-mcdonnell.com/ From gordonguthrie@REDACTED Thu Jun 15 14:33:05 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Thu, 15 Jun 2006 13:33:05 +0100 Subject: Progrommatic control of dialyzer In-Reply-To: References: <1150267063.448faeb75cc73@backawinner.gg> Message-ID: <1150374785.44915381d1fcb@backawinner.gg> Quoting Eric Merritt : > The goal for my project is to build and test modules as they change > giving the developer immediate feedback during his work cycle. erlang_automated_build does some of that in the background. You can set up different cron jobs to do different parts of the testing suite and also do 'report on success/report on failure'. So you can run: * a daily job that does everything in CVS HEAD, graphs it all and sticks it up on a web site and reports on success * a daily job that does everything in CVS BRANCH, etc, etc * an hourly job that does a compile and runs the dialyzer, doesn't graph and only reports on failure and so on... The working model here would be: * do a small change * run the unit test suite * commit to CVS and continue You then get a bump if you fail the dialyzer (no notification if you don't)... > There > are also the secondary goals of automating a lot of the more difficult > aspects of managing erlang projects, like the whole release management > thing. That would be something I would be keen to add as my release management is currently manual and horrid... Gordon Quoting Eric Merritt : > Very cool, It seems that I missed that project when I started this. It > looks like really good stuff as well. However, I don't think there is > too much duplication though the two projects have somewhat similar low > level functionality the purpose and direction seem to be pretty > different. > > The goal for my project is to build and test modules as they change > giving the developer immediate feedback during his work cycle. There > are also the secondary goals of automating a lot of the more difficult > aspects of managing erlang projects, like the whole release management > thing. For now that means that I make the assumption that the project > uses an otp style layout to make this automation possible. In any > case, it's not really meant as a continuous build system, that's just > the easiest way to describe it. That's why I don't think that we are > duplicating each other. > > On 6/13/06, Gordon Guthrie wrote: > > Eric > > > > There is a continuous build script for Erlang in the jungerl. The full > > documentation is available here: > > > http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/erlang_automated_build/do c/DOCUMENTATION.TXT?view=markup > > > > It can do some or all of the following: > > * check out from CVS > > * run a compile > > * run a test suite > > * run the dialyzer > > * run a tsunami load test > > > > All the outputs can be graphed and sent up to a web site. > > > > At the moment I also have a rough cut of a web site spider enginge that > will > > follow all your hyperlinks but it is too shonky to be shown to the world. > When > > it is finished I will integrate it. > > > > Gordon > > > > > > Quoting Eric Merritt : > > > > > Is there some method to control and use dialyzer pragmatically? I have > > > been fiddling with something akin to a continuous build system for my > > > erlang projects with support for unit tests and the like. I would like > > > to add support for dialyzer and an API would make that simpler. The > > > R11 docs only cover the command line version but just because > > > something isn't documented doesn't mean it doesn't exist. Hence this > > > question to the list. > > > > > > > > > > > > > > > > ------------------------------------------------- > > This mail sent through IMP: http://horde.org/imp/ > > > > ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From james.hague@REDACTED Thu Jun 15 17:27:19 2006 From: james.hague@REDACTED (James Hague) Date: Thu, 15 Jun 2006 10:27:19 -0500 Subject: simple standard library additions Message-ID: These are things I write all the time, and they'd be nice to roll into the standard library (preferably without having to prefix "erlang:" before each use). (Note that there's a min/1 and max/1 in lists, but not the simplest case.) min(X,Y) when X =< Y -> X; min(_,Y) -> Y. max(X,Y) when X >= Y -> X; max(_,Y) -> Y. % Wrapper for functions that return {ok,Something}. ok({ok,Data}) -> Data. % Should be in lists. keyfind(Key, N, TupleList) -> case lists:keysearch(Key, N, TupleList) of {value,X} -> X; false -> false end. From dmitry.kargapolov@REDACTED Thu Jun 15 17:31:49 2006 From: dmitry.kargapolov@REDACTED (Dmitriy Kargapolov) Date: Thu, 15 Jun 2006 11:31:49 -0400 Subject: bug in timer:sleep/1 smp implementation (R11B-0) Message-ID: <44917D65.4040703@corp.idt.net> When running erl with -smp +S 2 option, sometimes process gets stuck in timer:sleep/1. Process code looks like: some_receiver(State) -> NewState = receive % legal packet {some_keyword, Address, Port, Packet} -> State1 = handle_packet(Address, Port, Packet, State), timer:sleep(get_loop_delay()), State1; % unknown message _ -> State end, some_receiver(NewState). Delay value varies in range 1..999 Since timer:sleep/1 implemented as: sleep(T) -> receive after T -> ok end. it seems to be problem with "after" in smp implementation in R11B-0 I don't have more details yet but will continue testing. My platform: 2.6.9-5.ELsmp #1 SMP i686 i686 i386 GNU/Linux From igor@REDACTED Thu Jun 15 17:40:20 2006 From: igor@REDACTED (Igor Goryachev) Date: Thu, 15 Jun 2006 19:40:20 +0400 Subject: huge list matching -- different behaviour on x86_32 and x86_64 Message-ID: <87zmgepguz.fsf@goryachev.org> Hello. I have experienced a different behaviour and possibly a weird result while playing with matching a huge lists on x86_32 and x86_64 machines. Version r10b10 was used in both cases. The results (see the attachment): x86_32: goryachev@REDACTED:~% uname -a Linux l1 2.6.16-1-686-smp #2 SMP Fri May 5 05:00:58 UTC 2006 i686 GNU/Linux goryachev@REDACTED:~% erl Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] [kernel-poll] Eshell V5.4.13 (abort with ^G) 1> tv:b(). matched! ok x86_64: goryachev@REDACTED:~% uname -a Linux x1 2.6.12-1-em64t-p4-smp #1 SMP Wed Sep 28 03:50:13 CEST 2005 x86_64 GNU/Linux goryachev@REDACTED:~% erl Erlang (BEAM) emulator version 5.4.13 [64-bit] [source] [hipe] [threads:0] [kernel-poll] Eshell V5.4.13 (abort with ^G) 1> tv:b(). not matched! ok Could you be so kind to explain me whether it is the expected behaviour? What more information should I provide for you if it is not enough? Thank you very much for your attention. The program is attached in the message. PS: Well, in the real program I changed it to partial matching, something like: ["uid", "nickname" | _], and it works now. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: tv.erl Type: application/octet-stream Size: 1606 bytes Desc: not available URL: From yarivvv@REDACTED Thu Jun 15 18:24:55 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 15 Jun 2006 12:24:55 -0400 Subject: dets improvements? In-Reply-To: <17552.10210.591016.642666@gargle.gargle.HOWL> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17552.10210.591016.642666@gargle.gargle.HOWL> Message-ID: <17244f480606150924k7f3a2f58p1756bcec614d4d83@mail.gmail.com> > > Dets stores objects on the external term format, which means that > binary_to_term() (term_to_binary()) is called whenever objects are > retrieved (stored). These functions block the emulator (or just the > scheduler running the Dets process, if SMP), which spoils the soft > real-time properties for huge terms. Films etc are better stored > outside of Dets. Interesting... I don't expect to store objects bigger than a few megs. I hope such usage won't hurt performance too much. > The repair time was significantly reduced in Erlang/OTP R8B. When > repairing, data is written and read serially; no random access is > involved. (By the way, the same goes for copying (open) Dets files > between nodes, something Mnesia does every now and then.) A full Dets > table (16 millions small objects) should not take more than half an > hour to repair, at the worst. This is of course a very long time... > I don't think it's easy to further reduce repair times. This is much better than the 12 hour figure I had in mind based on a previous message I had seen on this list. In fact, it may change my mind about using MySQL instead of Mnesia. Are there any databased gurus out there than know how the rebuilding cost in dets compares to the disc storage in MySQL/Postgres/Oracle/etc? > > The major problem with Dets as I see it is that the memory allocation > scheme (a buddy system) is kept in RAM. For a fragmented table with > millions of objects, the RAM data can amount to several megabytes. > When closing or syncing a table, this (possibly huge) data structure > has to be written to disc. Is there any way to 1) measure the level of this fragmentation and 2) to manage/reduce it via maintenance operations (preferably, without taking offline the whole database/table)? I think this monitoring and maintentance aspect needs to be documented somewhere, because there will always be a fear that it may run out of control. I don't know too much about database storage algorithms, but is there any way to improve this allocation scheme? I think it will be beneficial for many applications that use Mnesia if the "worst case" fragmentation scenario were mitigated. I appreciate the response! Thanks Yariv From mikpe@REDACTED Thu Jun 15 18:28:27 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 15 Jun 2006 18:28:27 +0200 Subject: bug in timer:sleep/1 smp implementation (R11B-0) In-Reply-To: <44917D65.4040703@corp.idt.net> References: <44917D65.4040703@corp.idt.net> Message-ID: <17553.35499.634400.359802@alkaid.it.uu.se> Dmitriy Kargapolov writes: > > When running erl with -smp +S 2 option, sometimes process gets stuck in > timer:sleep/1. > Process code looks like: > > some_receiver(State) -> > NewState = receive > % legal packet > {some_keyword, Address, Port, Packet} -> > State1 = handle_packet(Address, Port, Packet, State), > timer:sleep(get_loop_delay()), > State1; > % unknown message > _ -> > State > end, > some_receiver(NewState). > > Delay value varies in range 1..999 > > Since timer:sleep/1 implemented as: > sleep(T) -> > receive > after T -> ok > end. > it seems to be problem with "after" in smp implementation in R11B-0 > > I don't have more details yet but will continue testing. > My platform: 2.6.9-5.ELsmp #1 SMP i686 i686 i386 GNU/Linux Interesting. Please send us a small standalone module that exhibits the bug, and I'll see if I can reproduce it. /Mikael From mikpe@REDACTED Thu Jun 15 18:33:14 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 15 Jun 2006 18:33:14 +0200 Subject: huge list matching -- different behaviour on x86_32 and x86_64 In-Reply-To: <87zmgepguz.fsf@goryachev.org> References: <87zmgepguz.fsf@goryachev.org> Message-ID: <17553.35786.302508.891878@alkaid.it.uu.se> Igor Goryachev writes: > Hello. > > I have experienced a different behaviour and possibly a weird result > while playing with matching a huge lists on x86_32 and x86_64 > machines. Version r10b10 was used in both cases. > > The results (see the attachment): > > x86_32: > goryachev@REDACTED:~% uname -a > Linux l1 2.6.16-1-686-smp #2 SMP Fri May 5 05:00:58 UTC 2006 i686 GNU/Linux > goryachev@REDACTED:~% erl > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] [kernel-poll] > > Eshell V5.4.13 (abort with ^G) > 1> tv:b(). > matched! > ok > > > x86_64: > goryachev@REDACTED:~% uname -a > Linux x1 2.6.12-1-em64t-p4-smp #1 SMP Wed Sep 28 03:50:13 CEST 2005 x86_64 GNU/Linux > goryachev@REDACTED:~% erl > Erlang (BEAM) emulator version 5.4.13 [64-bit] [source] [hipe] [threads:0] [kernel-poll] > > Eshell V5.4.13 (abort with ^G) > 1> tv:b(). > not matched! > ok > > > Could you be so kind to explain me whether it is the expected behaviour? This is clearly a bug. It also happens with an OTP R11 snapshot from about a month ago on x86_64. It does NOT happen when I compile the tv module with hipe, or when I remove about 10 lines from the lists. From rcbeerman@REDACTED Thu Jun 15 20:30:18 2006 From: rcbeerman@REDACTED (RCB) Date: Thu, 15 Jun 2006 11:30:18 -0700 Subject: dets improvements Message-ID: >Are there any databased gurus out there than know how the rebuilding >cost in dets compares to the disc storage in >MySQL/Postgres/Oracle/etc? These are WAL based ARIES database systems (well, I'm not sure about MySQL myisam tables, but the innodbs are.) Changes destined for persistent storage are first placed into a write ahead log so that they are durable. "Rebuilding" after an unexpected interruption is typically a matter of placing logged persistent changes into the database file(s) (and backing out uncommitted changes.) It does not typically require a full sequential sweep and rebuild. When things get to that point, it's time to start pulling out backups and rolling forward journals. >> The major problem with Dets as I see it is that the memory allocation >> scheme (a buddy system) is kept in RAM. For a fragmented table with >> millions of objects, the RAM data can amount to several megabytes. >> When closing or syncing a table, this (possibly huge) data structure >> has to be written to disc. >Is there any way to 1) measure the level of this fragmentation and 2) >to manage/reduce it via maintenance operations (preferably, without >taking offline the whole database/table)? I think this monitoring and >maintentance aspect needs to be documented somewhere, because there >will always be a fear that it may run out of control. 1) I do this by finding the pid of the dets:open_file_loop2 and using erlang:process_info(), which should give you an idea of the memory consumption associated with an open dets table. These tests can be made systematically. Check the heap size and also the process dictionary, which dets apparently uses to store file segments. 2) From the documentation: "The current implementation keeps the entire buddy system in RAM, which implies that if the table gets heavily fragmented, quite some memory can be used up. The only way to defragment a table is to close it and then open it again with the repair option set to force." The table is unavailable during the file_open() with {repair, force} set. As discussed, this operation is fairly heavy weight. Somewhat similar to a Postgresql/MVCC vacuum sweep but of course those systems remain online. It might be possible to do this manually, at run-time, by using the bchunk()/ init_table() mechanism -- or some other traversal (maybe traverse()) The docs say mnesia uses this, so the answer might be there. I have no direct experience with bchunk, so I'm not certain of the overhead, but you can bet that a traverse()/insert() construct will be quite expensive relative to a sequential rebuild. --- Yariv-Keep in mind that some rdbms systems actually keep blobs OUTSIDE of the paged files, and instead store them as files in a directory tree on the host filesystem. Some systems that even support TOAST actually keep the large objects in ONE table per database, which obviously does not scale well. Keeping large binary objects in a paged transactional database incurs a -significant- amount of i/o overhead relative to just writing the binary assets on a filesystem and managing them some other way (and doesn't Erlang give us so many useful mechanisms for designing these management frameworks?) There are just so many valid arguments against shoehorning large blobs in a paged transactional database (IMO.) Back to Erlang, though, there are some other detriments regarding using large dets tables (even fragmented) with mnesia. There are some detriments for using even plain vanilla dets even outside of mnesia, but many of these can be worked around. If you're looking at supporting large datasets in a real system then there is a very real possibility that you will find yourself in the situation of implementing creative solutions to work around some of the limitations. From marc.vanwoerkom@REDACTED Thu Jun 15 21:53:05 2006 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Thu, 15 Jun 2006 21:53:05 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448F2CB7.9040000@web.am> References: <448E93BD.9030004@it.uu.se> <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> Message-ID: <4491BAA1.3090305@fernuni-hagen.de> > Post directed mainly to ke han, but all other list members are welcome > -- You have mentioned html template engine for erlang - what kind of > features do you like in there ? > > It will probably depend on what one wants to achieve by using such an engine. I used smarty and gettext with PHP as member of a large web development team. As far as I can tell, the lead used it to achieve these goals: - separate the HTML/Javascript presentation from the data access / control written in PHP - programmers do PHP scripting and provide simple template files, just complex enough to illustrate how to get the data into the template and what to ask from the user - web designers will then take over the template and add the final design - use a restricted syntax in the template so that web designers don't misuse the exposed PHP data / objects - the web designer can't programm anyway, so give them some syntax similar to HTML, so they might feel familiar I think the whole setup there reflected the view that a view high level folks develop or choose the frameworks, so that the programmers are confined to a certain degree to come up with the same kind of web app in the end. And the template engine was used to separate web programming and web design and the lousy syntax to confine web designer from doing too much programming. A good framework might ensure a certain quality level, so I won't discuss that one. Also I think organizational separation is not bad, if there are distinct web developers and web designers. But about the HTML-like-syntax-for-stupid-web-designers issue I am not sure. Why not give them the power of a nice language? Regards, Marc From marc.vanwoerkom@REDACTED Thu Jun 15 22:05:30 2006 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Thu, 15 Jun 2006 22:05:30 +0200 Subject: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: References: Message-ID: <4491BD8A.6010102@fernuni-hagen.de> Joe Armstrong (AL/EAB) wrote: > I see no reason why a template engine should offer any other than > full access to all Erlang functions, not some ad-hock subset. > My impression was that the folks who choose the restrictive template engines wanted to confine the web designer people, folks who typically are more designers than programmers. A too oppressive attempt in my view. The HTML like syntax of an engine like PHP's smarty might be either some kind of attempt to make designer feel more comfortable, or perhaps it is really the case, that the tools that web designers prefer (heck I forgot what our people used, it was neither vi or emacs, it was some graphical editor..) can cope easier with the templates, if they are compatible with HTML/XML syntax. Regards, Marc From marc.vanwoerkom@REDACTED Thu Jun 15 22:21:27 2006 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Thu, 15 Jun 2006 22:21:27 +0200 Subject: Web pages using a simple tuple store [was : RE: template engine] In-Reply-To: <20060614120413.GA26707@memphis.ilius.fr> References: <20060614120413.GA26707@memphis.ilius.fr> Message-ID: <4491C147.8020300@fernuni-hagen.de> > I agree. > A realtime wiki project is currently under development in the Google > summer of code context: > http://wiki.jabber.org/index.php/Real-time_wiki > > The idea is exactly this, build on XMPP and the pubsub protocol for the > server part. > The code is developed by Grzegorz Grasza and I am mentoring the work. > > XMPP is a good idea for that as many building bricks are already > available: > - Pubsub engine (in ejabberd) > - XMPP Javascript client-side libraries. > > The Realtime wiki project should be the basis of a very nice Ajax > framework. > Cool idea for a jabber project! It would be the web equivalent of something I know under the name 'cooperative editor' or maybe 'group editor'. I remember having read about such a cooperative editor some years ago. (Cooperative systems are an active reasearch field) If one goes to Ajax interfaces for present wikis, that is the way, yes. What might it be good for? I am a regular contributor to the german wikipedia edition. The scenario that several folks edit the same article happens, but is rather seldom. I usually notice this, when my edit commit results in a conflict. For a real time wiki scenario, it might be nice if i could be aware of the other's presence (.. clearly a job for jabber!) a bit earlier and perhaps chat with the other person in some way to avoid conflicting edits or to split work in a useful way. That would help. The other useful scenario might be shared white board pages in the real time wiki, meeting places where folks develop some text in groups on purpose, or give some talk. Regards, Marc From cyberlync@REDACTED Thu Jun 15 22:35:15 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 15 Jun 2006 13:35:15 -0700 Subject: Progrommatic control of dialyzer In-Reply-To: <1150374785.44915381d1fcb@backawinner.gg> References: <1150267063.448faeb75cc73@backawinner.gg> <1150374785.44915381d1fcb@backawinner.gg> Message-ID: > The working model here would be: > * do a small change > * run the unit test suite > * commit to CVS and continue You may have the better approach here. The likelihood of tests running on a single file change is probably pretty low, so doing it on a single commit with the understanding that a commit frequency is high is probably the best way to go. > You then get a bump if you fail the dialyzer (no notification if you don't)... > > > There > > are also the secondary goals of automating a lot of the more difficult > > aspects of managing erlang projects, like the whole release management > > thing. > > That would be something I would be keen to add as my release management is > currently manual and horrid... So is mine hence my wanting to do something about it. There are actually a number of little rough edges like this that could be addressed by a tool. One thing that caused me a problem when I first started with erlang was understanding how to layout an otp project. So I built a project generator that lays things out as they should be. Of course, it's only useful once in awhile and even then mostly to newbies but its a barrier that's fairly easy to remove. From robert.virding@REDACTED Thu Jun 15 23:18:11 2006 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 15 Jun 2006 23:18:11 +0200 Subject: simple standard library additions In-Reply-To: References: Message-ID: <4491CE93.8010605@telia.com> James Hague wrote: > These are things I write all the time, and they'd be nice to roll into > the standard library (preferably without having to prefix "erlang:" > before each use). (Note that there's a min/1 and max/1 in lists, but > not the simplest case.) > ... > % Should be in lists. > keyfind(Key, N, TupleList) -> > case lists:keysearch(Key, N, TupleList) of > {value,X} -> X; > false -> false > end. What happens if the value X is false? That's why it is wrapped. Or did you mean that it should generate an error if not found. Dict separates these two cases with dict:find has the wrapped value and dict:fetch returns the value or else generates an error if not found. Robert From francesco@REDACTED Fri Jun 16 01:25:47 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 16 Jun 2006 00:25:47 +0100 Subject: Thesis Presentations / Erlang Robocup Experiences (London, 21/6 @ 1700) Message-ID: <4491EC7B.7030106@erlang-consulting.com> It is that time of the year again :-) You are all invited to attend two thesis presentations and a talk on the Erlang "Funny Golf" robot on Wednesday June 21st. The subjects covered include: A Metrics for Evaluating Web Components in Erlang While Erlang as a language has many of the features desirable in web based applications, it lacks many of the reusable libraries and components (either vendor specific or open source) readily available in Perl and PhP. Lukas has been developing web components in Erlang for a few months now, and in conjunction with it, has developed a metric for evaluating their complexity, and hence, their reusability. Evaluation of DBMS Systems for Erlang Mnesia is lacking in several important areas to consider when implementing systems with large scalability requirements. Based on a study examining the requirements of Erlang developers, Emil studied four open source databases, their features, and and their interoperability with Erlang, using AHP to evaluate them. The result is a paper helping Erlang developers who have scalbility requirements mnesia can't handle pick the one best one based on their requirements. Experiences at the Eurobot competition The Computer and Telecommunication Engineering department of the University of Catania (Italy), headed by Corrado Santoro built a "powered by Erlang" robot who recently competed in a competition of "Funny Golf" against other international solutions. They came second in the Italian qualifiers and 37th in the overall competition. Corrado will be giving a brief talk on the competition, sharing his experiences in the project and the suitability of Erlang in robotics. We will be starting at 17.00 in Erlang Training & Consulting's London office. Drop me a line if you are planing to attend so we can plan the refreshments. For those of you who can't make it, we hope to have the thesis online soon. Directions and conact details are here http://www.erlang-consulting.com/contact.html Welcome! Francesco -- http://www.erlang-consulting.com From bengt.kleberg@REDACTED Fri Jun 16 08:03:25 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 Jun 2006 08:03:25 +0200 Subject: Web pages using a simple tuple store [was : RE: template engine] In-Reply-To: <4491C147.8020300@fernuni-hagen.de> References: <20060614120413.GA26707@memphis.ilius.fr> <4491C147.8020300@fernuni-hagen.de> Message-ID: <449249AD.2070208@ericsson.com> On 2006-06-15 22:21, Marc van Woerkom wrote: ...deleted > It would be the web equivalent of something I know under the name > 'cooperative editor' > or maybe 'group editor'. I remember having read about such a cooperative do you mean like SubEthaEdit (http://www.codingmonkeys.de/subethaedit/)? or something else? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From tobbe@REDACTED Fri Jun 16 08:49:28 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 16 Jun 2006 08:49:28 +0200 Subject: trapexit.org is moving In-Reply-To: References: Message-ID: First of all, I want to thank all of you who offered to host trapexit.org. Thanks! I have now arranged for trapexit to get a new home were it can continue live and hopefully be improved a lot. Until the new site is up and running, parts of trapexit are available at its current, temporary, location. As soon as the new site is up and running, the new responsible will announce it here. Cheers, Tobbe Torbjorn Tornkvist wrote: > > JFYI: > > www.trapexit.org has been moved from its original home > and is unfortunately not in a good shape anymore. > However, it should still be possible to access and read > the existing HowTo's. > > It has been some discussions lately on the list about the > slow spread of Erlang, the lack of good community web-sites > etc. trapexit was an attempt to remedy the latter. > Unfortunately, the response has not been what I was hoping for. A few > heroic contributers has showed up with HowTo's > (thank you guys!), and one person has shown any interest > in helping out with the trapexit stuff (thanks Bengt!). > But really, to me it has been a big disappointment. > Perhaps it is a chicken/egg problem (small community, > small amount of contributions); I don't know. > > Anyway, perhaps trapexit can come alive some other time, > and if anyone would like to take over the trapexit.org > domain name, then let me know. > > Cheers, Tobbe > > > > From ulf.wiger@REDACTED Fri Jun 16 09:15:55 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 16 Jun 2006 09:15:55 +0200 Subject: simple standard library additions Message-ID: James Hague wrote: > > % Should be in lists. > keyfind(Key, N, TupleList) -> > case lists:keysearch(Key, N, TupleList) of > {value,X} -> X; > false -> false > end. This particular type of operation is amply provided by proplists in stdlib. proplists:get_value(Key, KeyValueList) -> Value | undefined proplists:get_value(Key, KVList, Default) -> Value | Default BR, Ulf W From kfisher@REDACTED Thu Jun 15 18:43:00 2006 From: kfisher@REDACTED (Kathleen Fisher) Date: Thu, 15 Jun 2006 09:43:00 -0700 Subject: CUFP: Call for Contributions Message-ID: <9E9E7B05-68CD-4016-8B98-843EBF942CFD@research.att.com> [ Apologies for multiple postings; please forward to potentially interested parties ] CUFP 2006 THE THIRD COMMERCIAL USERS OF FUNCTIONAL PROGRAMMING WORKSHOP "Functional programming as a means, not an end" Portland, Oregon, USA September 21st 2006 Co-located with ICFP Functional languages have been under academic development for over 25 years, and are still proving to be very fertile ground for programming language research. Consequently, most of the development focus of these languages is driven by academic and theoretical questions. More recently, however, functional languages have been very successfully used in commercial, industrial, and government settings, as well as in the open-source community. In these settings, the advantages of functional languages have provided dramatic leverage. The goal of CUFP is to act as a voice for commercial users of functional programming languages and technology. It aims to help functional programming become increasingly viable as a technology for use in the commercial, industrial, governmental, and open-source space by providing a forum for FP professionals to share their experiences and ideas, whether business, management or engineering. It also aims to enable the formation and strengthening of relationships and alliances that further the commercial use of functional languages. Providing user feedback to language designers and implementors is not a primary goal of the workshop, though it will be welcome if it occurs. Program plans ------------- The meeting will last a full day, with a mix of invited and submitted presentations, plus discussion sessions. Topics will range over a wide area, including: * Case studies both of successful and unsuccessful uses of functional programming; * Business opportunities and risks from using functional languages; * Enablers for functional language use in a commercial setting; * Barriers to the adoption of functional languages, and * Mitigation strategies for overcoming limitations of FP. There will be no published proceedings, as the meeting is intended to be more a discussion forum than a technical interchange. See http://www.galois.com/cufp/ for more information, including last year's schedule and a report describing a previous CUFP workshop. This year's schedule will also be available there soon. Submissions ----------- Submissions by prospective speakers or suggestions for speakers are welcome! Just send an e-mail to kfisher at research.att.com with an outline of what you'd like to talk about or what you think your suggestee should give a talk about. Program Committee ----------------- Andy Adams-Moran. adams-moran at galois.com (Co-Chair) Mike Ashley. mashley at beckman.com Matthias Felleisen. matthias at ccs.neu.edu Kathleen Fisher. kfisher at research.att.com (Chair) Jim Grundy. jim_grundy at ichips.intel.com John Hughes. rjmh at cs.chalmers.se Stephen Weeks. sweeks at sweeks.com Ulf Wiger. ulf.wiger at ericsson.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From hans.bolinder@REDACTED Fri Jun 16 09:32:30 2006 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 16 Jun 2006 09:32:30 +0200 Subject: dets improvements? In-Reply-To: <17244f480606150924k7f3a2f58p1756bcec614d4d83@mail.gmail.com> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17552.10210.591016.642666@gargle.gargle.HOWL> <17244f480606150924k7f3a2f58p1756bcec614d4d83@mail.gmail.com> Message-ID: <17554.24206.507193.791986@gargle.gargle.HOWL> [Yariv Sadan:] > > The major problem with Dets as I see it is that the memory allocation > > scheme (a buddy system) is kept in RAM. For a fragmented table with > > millions of objects, the RAM data can amount to several megabytes. > > Is there any way <...> 2) to manage/reduce it via maintenance > operations (preferably, without taking offline the whole > database/table)? I haven't tried this myself, but... If you use Mnesia and 'disc_only_copies', then directly (or indirectly, by changing the schema) calling mnesia:add_table_copy() would create a defragmented copy of the Dets table on some other node. While the table is being copied, the table can be updated as usual, at some extra cost. Best regards, Hans Bolinder, Erlang/OTP From ulf.wiger@REDACTED Fri Jun 16 10:48:05 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 16 Jun 2006 10:48:05 +0200 Subject: remote ets select Message-ID: We had reason to deal with the need for doing chunked ets:select() via rpc. The complication, which is well documented in ets, is that the continuation returned by ets:select/3 cannot be serialized, and therefore breaks if it is passed between nodes. I wrote the following example program to illustrate how one could go about using ets:select/3 remotely. One *could* imagine putting something similar in ets.erl as a library function, but I don't know if there is enough demand to warrant that. Let this be a lightweight howto for now. (: The solution is somewhat inspired by rpc:async_rpc/4. Not one line of comments - the code is obviously self-documenting. ;) BR, Ulf W -module(remote_select). -export([select/4, select/1]). select(Node, Tab, Ms, Limit) -> ReplyTo = self(), Pid = spawn( Node, fun() -> MRefB = erlang:monitor(process, ReplyTo), handle_select(MRefB, ReplyTo, ets:select(Tab, Ms, Limit)) end), MRefA = erlang:monitor(process, Pid), await_reply(Pid, MRefA). select('$end_of_table' = Last) -> Last; select({MRef, {Pid, Cont}}) -> Pid ! {self(), Cont}, await_reply(Pid, MRef). await_reply(Pid, MRef) -> receive {'DOWN', MRef, _, _, Reason} -> erlang:error({proxy_error, Pid, Reason}); {Pid, {_Objs, '$end_of_table'} = Last} -> erlang:demonitor(MRef), Last; {Pid, {Objs, Cont}} -> {Objs, {MRef, Cont}} end. handle_select(MRef, ReplyTo, Result) -> case Result of {_, '$end_of_table'} -> ReplyTo ! {self(), Result}, done; {Objs, Cont1} -> ReplyTo ! {self(), {Objs, {self(), cont}}}, select_loop(MRef, ReplyTo, Cont1) end. select_loop(MRef, ReplyTo, Cont) -> receive {'DOWN', MRef, _, _, _} -> done; {ReplyTo, cont} -> handle_select(MRef, ReplyTo, ets:select(Cont)) end. From bsder@REDACTED Fri Jun 16 12:13:11 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Fri, 16 Jun 2006 03:13:11 -0700 Subject: Tracking down superlinear reductions Message-ID: <44928437.7090708@allcaps.org> pman seems to be reporting that I have a gen_server that appears to be doing a superlinear (probably closer to quadratic, but I haven't done the full analysis, yet) number of reductions (200,000,000+) for what should only be a linear amount of work (14,000 packets). Dialyzer doesn't report anything obviously stupid, so I'm going to need to dig into this further. Which tool should I use to analyze this? pman seems to be choking on the trace. I see a couple of different programs listed in the "Tool Applications" section of the manual, but nothing jumps out at me as being the obvious choice. What I'd like to do is the Erlang equivalent of getting the number of times a function is called. This would avoid the problem of Erlang trying to print out the arguments and flooding the I/O system. What's the best way to do this? Thanks, -a From bengt.kleberg@REDACTED Fri Jun 16 12:30:25 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 Jun 2006 12:30:25 +0200 Subject: Tracking down superlinear reductions In-Reply-To: <44928437.7090708@allcaps.org> References: <44928437.7090708@allcaps.org> Message-ID: <44928841.90403@ericsson.com> On 2006-06-16 12:13, Andrew Lentvorski wrote: ...deleted > What I'd like to do is the Erlang equivalent of getting the number of > times a function is called. This would avoid the problem of Erlang > trying to print out the arguments and flooding the I/O system. have a look at: cprof, eprof, fprof and friends, in the tools section of the docuemntation. http://erlang.org/doc/doc-5.5/lib/tools-2.5/doc/html/index.html bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From ulf.wiger@REDACTED Fri Jun 16 12:52:49 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 16 Jun 2006 12:52:49 +0200 Subject: Tracking down superlinear reductions Message-ID: One could imagine using QuickCheck and specifying as a property that the number of reductions (returned from statistics(reductions) should be roughly proportional to the size of the input. QuickCheck will then generate random input, according to a specification, and report if it finds a case where the number of reductions is out of bounds for the given input. I haven't actually tried it, though. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Andrew Lentvorski > Sent: den 16 juni 2006 12:13 > To: erlang-questions > Subject: Tracking down superlinear reductions > > pman seems to be reporting that I have a gen_server that > appears to be doing a superlinear (probably closer to > quadratic, but I haven't done the full analysis, yet) number > of reductions (200,000,000+) for what should only be a linear > amount of work (14,000 packets). > > Dialyzer doesn't report anything obviously stupid, so I'm > going to need to dig into this further. > > Which tool should I use to analyze this? pman seems to be > choking on the trace. I see a couple of different programs > listed in the "Tool Applications" section of the manual, but > nothing jumps out at me as being the obvious choice. > > What I'd like to do is the Erlang equivalent of getting the > number of times a function is called. This would avoid the > problem of Erlang trying to print out the arguments and > flooding the I/O system. > > What's the best way to do this? > > Thanks, > -a > From headspin@REDACTED Fri Jun 16 13:03:27 2006 From: headspin@REDACTED (dda) Date: Fri, 16 Jun 2006 13:03:27 +0200 Subject: xmerl_* tutorials Message-ID: Are there any [good] tutorials for xmerl_* [esp scan and xpath]? The docs are a little, er, arid, to say the least, on the subject... -- dda From sebastian@REDACTED Fri Jun 16 14:44:40 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 16 Jun 2006 09:44:40 -0300 Subject: Port drivers Message-ID: <005e01c69142$a51f0360$6500a8c0@inswitchapp> Hello list, a few questions regarding port drivers: 1- when should a port driver be used instead of a port? 2- is a port driver faster than a port? 3- is it easy/possible to debug a port driver under Windows? 4- has anybody written an MFC based dll as a port driver? Is there any sample code available? 5- when having to deal with a big number of requests for a port driver, may it be possible/desirable to start multiple port drivers to handle them? Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From danie@REDACTED Fri Jun 16 15:27:53 2006 From: danie@REDACTED (Danie Schutte) Date: Fri, 16 Jun 2006 15:27:53 +0200 Subject: Port drivers In-Reply-To: <005e01c69142$a51f0360$6500a8c0@inswitchapp> References: <005e01c69142$a51f0360$6500a8c0@inswitchapp> Message-ID: <200606161527.53787.danie@erlfinsys.net> I may misunderstand but just to clarify port driver = linked in driver port = the erl_interface stdin stdout type communication 1. Linked in drivers, use binaries to send data, we experienced a 270% performance increase over our traditional port interface. Side effect - if something goes wrong :) it goes wrong spectacularly (but this rarely happened) 2. Significantly faster 3. no windows :) 4. Attached to this mail is some sample (production driver) code. 5. We have the same thing, the attached code is sybase linked in drivers, and each one makes a connection to the database. We run about 50 of these drivers simultaneously. The answer might also lie in what you do with the driver. On Friday 16 June 2006 14:44, Sebastian Bello wrote: > Hello list, > > a few questions regarding port drivers: > > 1- when should a port driver be used instead of a port? > 2- is a port driver faster than a port? > 3- is it easy/possible to debug a port driver under Windows? > 4- has anybody written an MFC based dll as a port driver? Is there any > sample code available? 5- when having to deal with a big number of requests > for a port driver, may it be possible/desirable to start multiple port > drivers to handle them? > > Thanks, > Sebastian- -- Managing Director Erlang Financial Systems (Pty) Ltd Mobile: +27 84 468 3138 Phone : +11 235 6500 ext 6801 Fax : +11 235 6690 -------------- next part -------------- A non-text attachment was scrubbed... Name: port_driver1.c Type: text/x-csrc Size: 1599 bytes Desc: not available URL: -------------- next part -------------- -module(sybase_api). -revision('$Revision: 1958 $ '). -vsn('$Revision: 1958 $ '). -behaviour(gen_server). %% touch for recompile %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- -include("sybase_api.hrl"). %%-------------------------------------------------------------------- %% External exports -export([start_link/0, transaction/3, get_state/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_info/2, terminate/2, handle_cast/2, code_change/3]). -export([spawn_workers/2]). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: start_link/0 -> {ok, pid()} %% Description: Starts the sybase DB server %%-------------------------------------------------------------------- start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). %% local / global? %%-------------------------------------------------------------------- %% Function: transaction/2 -> {ok, ref()} %% Description: Forwards a sybase transaction to a Database running %% on Node. %% Parameters: Node - Node on which the sybase_api server is running %% Cmd - {Function, Param, Type} %% Function - Cmd to be executed in the databse %% Param - Parameters to the Sybase Transaction %% Type - Type list of the Param List %% Returns: {ok, Ref()} %%-------------------------------------------------------------------- transaction(Node, Cmd, ReplyPID) -> gen_server:call({?MODULE, Node}, {transaction, Cmd, ReplyPID}). %%-------------------------------------------------------------------- %% Function: get_state/0 -> #state %% Description: Retrieves the state of the server. Note, this function %% should be used for testing and debugging only. get_state() -> gen_server:call(?MODULE, get_state). %%==================================================================== %% Server functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: init/1 %% Description: Initiates the server by starting all the C Nodes. %% Number of Nodes and host name defined in app file. %% Returns: {ok, State} %%-------------------------------------------------------------------- init([]) -> process_flag(trap_exit, true), ThreadNum = case application:get_env(sybase_threads) of undefined -> ?SYBASE_THREADS; {ok, Num} -> Num end, SybaseHost = case application:get_env(sybase_host) of undefined -> ?SYBASE_HOST; {ok, Name} -> Name end, alarm({{sybase_api, max_threshold}, requests_queued}), %% timer:apply_after(60000, gen_server, cast, [self(), stats]), %% open logfile. FileName = "log/sybase_api_" ++ format_util:format_date_out(date(), yyyymmdd) ++ "_" ++ format_util:format_time_out(time(), hhmmss) ++ ".log", case error_logger:logfile({open, FileName}) of FileName -> %%error_logger:info_msg("Logging to ~s", [FileName]), error_logger:tty(true), ok; ok -> %%error_logger:info_msg("Logging to ~s", [FileName]), error_logger:tty(true), ok; ErrorReason -> error_logger:error_msg("Could NOT log, reason ~p~n", [ErrorReason]) end, SybSettings = sybase_settings:read(), timer:apply_after(1000, gen_server, cast, [?MODULE, {spawn_workers, ThreadNum, SybSettings}]), {ok, #state{hostname = SybaseHost, settings = SybSettings}}. %%-------------------------------------------------------------------- %% Function: handle_call({transaction, Cmd, Pid}, From, State) %% Description: Handling a request for a sybase transaction from a %% client. If C nodes are available, it will execute %% immideately, else it is queued for next available %% node. Reposnses are send directly to clients, %% sybase_api gets ack that transaction has completed. %% Parameters: Cmd - Command passed on to sybase %% Pid - Cliend pid who will receive the response %% Returns: {reply, {ok, ref(()}, #state} %%-------------------------------------------------------------------- handle_call({transaction, Cmd, Pid}, _From, State) -> #state{avail=Avail, reqlist=ReqList, working=Working} = State, Ref = make_ref(), Req = #req{pid = Pid, ref = Ref, cmd = Cmd}, NewState = case Avail of [] -> case ReqList of [] -> alarm({{sybase_api, max_threshold}, requests_queued}); _ -> ok end, State#state{reqlist = ReqList ++ [Req]}; [H|T] -> gen_server:cast(H#worker.num, {rpc, self(), Ref, Cmd}), %error_logger:info_msg("~p command ~p", [H#worker.num, Cmd]), NewWorking = [H#worker{req=Req}|Working], State#state{avail=T, working = NewWorking} end, {reply, {ok, Ref}, NewState}; %%-------------------------------------------------------------------- %% Function: handle_call(get_state, From, State) %% Description: retrieves the state for testing purposes %% Returns: {reply, #state, #state} %%-------------------------------------------------------------------- handle_call(get_state, _From, State) -> {reply, State, State}; %%handle_call({Ref, {row, RowData}}, From, State) -> %% %%error_logger:info_msg("Returning data for reference ~p", [Ref]), %% {reply, gen_server:call(syb_db_result, {returndata, Ref, RowData}), State}; handle_call(OtherCall, _from, _state) -> error_logger:error_msg("!! unknown handle_call received !! (sybase_api) : ~p", [OtherCall]), {reply, OtherCall, _state}. handle_cast(What, State) -> %% wrapper for handle cast %% %%error_logger:info_msg("handle_cast(~p, ~p)", [What, State]), hc(What, State). hc(stats, State) -> %%error_logger:info_msg("~nsnapshot reports ~s% capacity used", [hd(io_lib:format("~.3f", [(length(State#state.working)/(length(State#state.avail)+length(State#state.working))*100)]))]), timer:apply_after(60000, gen_server, cast, [self(), stats]), {noreply, State}; hc({spawn_workers, Num, Settings}, State)-> NumList = spawn_workers(Num, Settings), NewState = State#state{started = NumList, avail = NumList}, {noreply, NewState}; hc(What, State) -> %% %%error_logger:info_msg("~nUnhandled cast (sybase_api) - ~p", [What]), {noreply, State}. %%-------------------------------------------------------------------- %% Function: handle_info({nodedown, Node}, State) %% Description: Handling of C Nodes terminating. Raises alarm and %% tries to create a new one. If there was an ongoing %% transaction on the node, the client is informed. %% Parameters: Node - C Node that terminated. %% Returns: {noreply, #state} | %%-------------------------------------------------------------------- %% handle_info({nodedown, Node}, State) -> %% case remove(Node, State#state.started) of %% {ok, #node{num = Num}, Started} -> %% clear({sybase_api, {node_down, Node}}), %% NewStarted = [c_node(Num, State#state.settings)|Started], %% {noreply,State#state{started = NewStarted}}; %% undefined -> %% Node was running %% error_logger:error_msg("!! nodedown !!"), %% {noreply, handle_nodedown(Node, State)} %% end; %%-------------------------------------------------------------------- %% Function: handle_info({pong, Node}, State) %% Description: Handling of C Nodes Startup. Acknowledges that the %% node has started and schedules a task for it if there %% is a queue. %% Parameters: Node - C Node that started. %% Returns: {noreply, #state} | %%-------------------------------------------------------------------- %% handle_info({pong, Node}, State) -> %% clear({sybase_api, {node_down, Node}}), %% case remove(Node, State#state.started) of %% undefined -> %% Should not happen %% info("~nUnknown C Node sent pong:~p", [Node]), %% {noreply, State}; %% {ok , NodeRec, NewStarted} -> %% NewState = State#state{started = NewStarted}, %% {noreply, handle_reqlist(NodeRec, NewState)} %% end; %%-------------------------------------------------------------------- %% Function: handle_info({pong, Node}, State) %% Description: Handling of C Nodes Startup. Acknowledges that the %% node has started and schedules a task for it if there %% is a transaction queue. %% Parameters: Node - C Node that started. %% Returns: {noreply, #state} | %%-------------------------------------------------------------------- handle_info({completed, Worker}, State) -> case remove(Worker, State#state.working) of undefined -> %% Should not happen info("~nUnknown Worker Completed:~p",[Worker]), self()! {completed, Worker}, {noreply, State}; {ok, WorkerRec, NewWorking} -> %%error_logger:info_msg("Worker ~p complete", [Worker]), NewState = State#state{working = NewWorking}, {noreply, handle_reqlist(WorkerRec, NewState)} end; handle_info({Reference, {rows, RowData}, {status, Status}}, State) -> %% get_reference_pid(Reference, State#state.working) ! {Reference, RowData}, ok = gen_server:cast(get_reference_pid(Reference, State#state.working), {Reference, {rows, RowData}, {status, Status}}), {noreply, State}; handle_info({'EXIT',Port,normal}, State) -> error_logger:error_msg("Sybase driver exit received! port ~p", [Port]), {noreply, State}; handle_info(_Unknown, State) -> info("!! Unknown Msg in handle_info !! (sybase_api) : ~p",[_Unknown]), {noreply, State}. code_change(OldVsn, State, Extra) -> {ok, State}. %%-------------------------------------------------------------------- %% get_refernce_pid %%-------------------------------------------------------------------- get_reference_pid(Reference, []) -> error_logger:error_msg("Unable to find reply PID for Reference ~p !!", [Reference]), {error, no_pid}; get_reference_pid(Reference, [Worker|Next]) -> %% %%error_logger:info_msg("Node = ~p", [Node]), Request = Worker#worker.req, Pid = Request#req.pid, Ref = Request#req.ref, %% %%error_logger:info_msg("~p == ~p", [Reference, Ref]), case (Ref == Reference) of true -> Pid; false -> get_reference_pid(Reference, Next) end. %%-------------------------------------------------------------------- %% Function: terminate/2 %% Description: Shutdown the server. Terminates all C nodes %% Returns: any (ignored by gen_server) %%-------------------------------------------------------------------- terminate(Reason, State) -> %% #state{started=Started, avail=Avail, working=Working} = State, %% Fun = fun(#worker{name = Name}) -> {db, Name} ! {self(), stop} end, %% lists:foreach(Fun, Started ++ Avail ++ Working). bla. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% Spawns Count C Nodes with connections towards the Sybase DB spawn_workers(Count, Settings) -> lists:map(fun(Num)-> worker(Num, Settings) end,lists:seq(1,Count)). %%-------------------------------------------------------------------- %% Creates a C Node worker(Num, Settings) -> #setup{hostname = HostName, servername = ServerName, databasename = DatabaseName, username = UserName, password = Password } = Settings, {ok, Num1} = sybase_api_sup:start_worker(Num, ["sybasedrv" ++ integer_to_list(Num), 0,DatabaseName, 0,ServerName, 0,UserName, 0,Password,0]), #worker{num = Num1}. %%-------------------------------------------------------------------- %% When a node goes down, removes it from the available and working %% set and if it was involved in a transaction, informs the client %% handle_nodedown(Node, State) -> %% #state{started=Started, avail=Avail, working=Working} = State, %% case remove(Node, Avail) of %% {ok, #node{num = Num}, NewAvail} -> %% NewStarted = [worker(Num, State#state.settings)|Started], %% State#state{started=NewStarted, avail = NewAvail}; %% undefined -> %% case remove(Node, Working) of %% {ok, #node{num=Num, req = Req}, NewWorking} -> %% #req{pid = Pid, ref = Ref} = Req, %% gen_server:cast(Pid, {trx_fail, Pid, Ref, {error, node_down}}), %% %% syncro_worker:trx_failed(Pid, Ref, {error,node_down}), %% NewStarted=[worker(Num,State#state.settings)|Started], %% State#state{started=NewStarted, working=NewWorking}; %% undefined -> %% info("~nUnknown Node sending node down:~p", [Node]), %% State %% end %% end. %%-------------------------------------------------------------------- % When a node comes up or has completed a transaction, this function % checks if there are jobs queued up which need executing. handle_reqlist(WorkerRec, #state{reqlist=[],avail=Avail} = State) -> case Avail of [] -> clear({sybase_api, max_threshold}); _ -> ok end, State#state{avail = [WorkerRec#worker{req = undefined}|Avail]}; handle_reqlist(WorkerRec, State) -> #state{reqlist = [Req|ReqList], working = Working} = State, #req{pid = Pid, ref = Ref, cmd = Cmd} = Req, gen_server:cast(WorkerRec#worker.num, {rpc, self(), Ref, Cmd}), State#state{working = [WorkerRec#worker{req = Req}|Working], reqlist = ReqList}. %%-------------------------------------------------------------------- % Removes a node from a list of nodes, returning the nodeRec and the % new list. Used when moving nodes among lists. remove(Worker, Workers) -> case lists:keysearch(Worker, #worker.num, Workers) of {value, Rec} -> {ok,Rec,lists:keydelete(Worker,#worker.num,Workers)}; false -> undefined end. %%-------------------------------------------------------------------- % Short cut to the error logger info(Msg, Args) -> %%error_logger:info_msg(Msg, Args), ok. alarm({Id, Desc}) -> alarm_handler:set_alarm({Id, Desc}). clear(Id) -> alarm_handler:clear_alarm(Id). -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : sybase_api_app.erl %%% Author : Henk Bijker %%% Description : %%% %%% Created : 27 Apr 2004 by Henk Bijker %%%------------------------------------------------------------------- -module(sybase_api_app). -behaviour(application). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports %%-------------------------------------------------------------------- -export([ start/2, stop/1 ]). %%-------------------------------------------------------------------- %% Internal exports %%-------------------------------------------------------------------- -export([ ]). %%-------------------------------------------------------------------- %% Macros %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% Records %%-------------------------------------------------------------------- %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Func: start/2 %% Returns: {ok, Pid} | %% {ok, Pid, State} | %% {error, Reason} %%-------------------------------------------------------------------- start(Type, StartArgs) -> case sybase_api_sup:start_link() of {ok, Pid} -> {ok, Pid}; Error -> Error end. %%-------------------------------------------------------------------- %% Func: stop/1 %% Returns: any %%-------------------------------------------------------------------- stop(State) -> ok. %%==================================================================== %% Internal functions %%==================================================================== -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : sybase_api_sup.erl %%% Author : Henk Bijker %%% Description : %%% %%% Created : 27 Apr 2004 by Henk Bijker %%%------------------------------------------------------------------- -module(sybase_api_sup). -behaviour(supervisor). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports %%-------------------------------------------------------------------- -export([ start_link/0 ]). %%-------------------------------------------------------------------- %% Internal exports %%-------------------------------------------------------------------- -export([ init/1, start_worker/2 ]). %%-------------------------------------------------------------------- %% Macros %%-------------------------------------------------------------------- -define(SERVER, ?MODULE). %%-------------------------------------------------------------------- %% Records %%-------------------------------------------------------------------- %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: start_link/0 %% Description: Starts the supervisor %%-------------------------------------------------------------------- start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). %%==================================================================== %% Server functions %%==================================================================== %%-------------------------------------------------------------------- %% Func: init/1 %% Returns: {ok, {SupFlags, [ChildSpec]}} | %% ignore | %% {error, Reason} %%-------------------------------------------------------------------- init([]) -> AChild = {sybase_api, %% name db_sybase {sybase_api, %% module start_link,[]}, permanent,2000,worker,[sybase_api]}, {ok,{{one_for_all,0,1}, [AChild]}}. %%==================================================================== %% Internal functions %%==================================================================== start_worker(Num, Settings) -> Child = {{'sybase_worker', Num}, {sybase_worker, start_link, [[Settings, Num]]}, permanent, 2000, worker, [sybase_worker]}, supervisor:start_child(?SERVER, Child). -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : sybase_settings.erl %%% Author : Henk Bijker %%% Description : %%% %%% Created : 27 Dec 2004 by Henk Bijker %%%------------------------------------------------------------------- -module(sybase_settings). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports %%-------------------------------------------------------------------- -export([ read/0 ]). %%-------------------------------------------------------------------- %% Internal exports %%-------------------------------------------------------------------- -export([ ]). %%-------------------------------------------------------------------- %% Macros %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% Records %%-------------------------------------------------------------------- -include("sybase_api.hrl"). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: %% Description: %%-------------------------------------------------------------------- read() -> mnesia:start(), timer:sleep(2000), case catch mnesia:transaction(fun() -> mnesia:read({setup, setup}) end) of {aborted,{no_exists,setup}} -> execute_once(); {atomic, []} -> error_logger:error_msg("!! Error !! initial setup complete, no entries found!"), timer:sleep(10000), execute_once(); {'EXIT',{aborted,{no_exists,[setup,setup]}}} -> execute_once(); {atomic, [Settings]} -> Settings end. %%==================================================================== %% Internal functions %%==================================================================== initial_entry() -> {ok, [HostName]} = io:fread('Hostname?', "~s"), {ok, [ServerName]} = io:fread('Servername?', "~s"), {ok, [DatabaseName]} = io:fread('Database name?', "~s"), {ok, [UserName]} = io:fread('Username?', "~s"), {ok, [Password]} = io:fread('Password?', "~s"), Object = #setup{ description = setup, hostname = HostName, servername = ServerName, databasename = DatabaseName, username = UserName, password = Password}, Write = mnesia:transaction(fun() -> mnesia:write(Object) end), error_logger:info_msg("~nWrite is ~p", [Write]), Object. %%%--------------------------------------------------------------------- %% create the table %%%--------------------------------------------------------------------- create() -> io:format("Done.~nCreating table ..."), io:format("~nsetup ..."), mnesia:create_table(setup, [{type, bag}, {disc_copies,[node()]}, {attributes, record_info(fields, setup)}]). %% initial setup execute_once() -> io:format("please switch to terminal 1, (^G, c1)"), io:format("~nConfirm first sybase execution, (initial setup) [y/n]"), Confirm = io:fread("", "~s"), case Confirm of {ok, ["y"]} -> io:format("~nOk, creating database, please wait ..."), schema([node()]), startm(), create(), mnesia:change_table_copy_type(setup, node(), disc_copies), Data = initial_entry(), io:format("done.~n"), Data; _ -> io:format("~nKeypressed: setup cancelled, please check nodename, database setup, directory access or user rights."), #setup{} end. %%%--------------------------------------------------------------------- %% create mnesia schema if not exist %%%--------------------------------------------------------------------- schema(Nodes) -> io:format("~nStopping existing instances, please wait ..."), mnesia:stop(), io:format("Creating schema on local node & trx node, please wait ..."), mnesia:create_schema(Nodes). %%%--------------------------------------------------------------------- %% start mnesia %%%--------------------------------------------------------------------- startm() -> io:format("done.~nStarting mnesia ..."), mnesia:start() . -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : sybase_worker.erl %%% Author : MP Scholtz (michael@REDACTED) %%% Description : %%% %%% Created : 2005/08/16 %%%------------------------------------------------------------------- -module(sybase_worker). -behaviour(gen_server). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports -export([start_link/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -record(state, {port, ref, rows, status, lastrow}). -define(SERVER, ?MODULE). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: start_link/0 %% Description: Starts the server %%-------------------------------------------------------------------- start_link([Settings, Num]) -> gen_server:start_link(?MODULE, [Settings, Num], []). %%==================================================================== %% Server functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: init/1 %% Description: Initiates the server %% Returns: {ok, State} | %% {ok, State, Timeout} | %% ignore | %% {stop, Reason} %%-------------------------------------------------------------------- init([Settings, Num]) -> DriverName = "sybasedrv" ++ integer_to_list(Num), error_logger:error_msg("DRV NAME ~p", [DriverName]), case erl_ddll:load_driver(".", DriverName) of ok -> ok; {error, already_loaded} -> ok; _ -> exit({error, could_not_load_driver}) end, Port = open_port({spawn, DriverName}, []), Port ! {self(), {command, [1, Settings]}}, %%Send connect to sybase_driver {ok, #state{port = Port, rows = []}}. %%-------------------------------------------------------------------- %% Function: handle_call/3 %% Description: Handling call messages %% Returns: {reply, Reply, State} | %% {reply, Reply, State, Timeout} | %% {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, Reply, State} | (terminate/2 is called) %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_call(Request, From, State) -> io:format("~n Unhandled Request - ~p~n", [Request]), {reply, ok, State}. %%-------------------------------------------------------------------- %% Function: handle_cast/2 %% Description: Handling cast messages %% Returns: {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_cast({rpc, From, Ref, Cmd}, State) -> {Proc, ArgList} = Cmd, X = create_string(ArgList, atom_to_list(Proc)), State#state.port!{self(), {command, [2, X]}}, {noreply, State#state{ref = Ref}}; handle_cast(Msg, State) -> {noreply, State}. %%-------------------------------------------------------------------- %% Function: handle_infox/2 %% Description: Handling all non call/cast messages %% Returns: {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_info({_, {data, [0]}}, State) -> case State#state.lastrow of undefined -> NewState = State; _ -> Rows = State#state.rows -- [State#state.lastrow], sybase_api!{State#state.ref, {rows, Rows} , {status, State#state.lastrow}}, sybase_api!{completed, self()}, NewState = State#state{lastrow = undefined, status = State#state.lastrow, rows = []} end, {noreply, NewState}; handle_info({_, {data, Data}}, State) -> Cols = string:tokens(Data, [173]), [H|T] = lists:reverse(Cols), Row = lists:reverse(T), NewState = State#state{lastrow = Row, rows = State#state.rows ++ [Row]}, {noreply, NewState}; handle_info(Info, State) -> {noreply, State}. %%-------------------------------------------------------------------- %% Function: terminate/2 %% Description: Shutdown the server %% Returns: any (ignored by gen_server) %%-------------------------------------------------------------------- terminate(Reason, State) -> ok. %%-------------------------------------------------------------------- %% Func: code_change/3 %% Purpose: Convert process state when code is changed %% Returns: {ok, NewState} %%-------------------------------------------------------------------- code_change(OldVsn, State, Extra) -> {ok, State}. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- create_string([], String) -> [String|[0]]; create_string([{Arg, Type}|T], String) when is_list(Arg) -> create_string(T, String ++ [0] ++ Arg ++ [0] ++ [Type]); create_string([{Arg, Type}|T], String) when is_integer(Arg) -> create_string(T, String ++ [0] ++ integer_to_list(Arg) ++ [0] ++ [Type]). From yarivvv@REDACTED Fri Jun 16 15:47:17 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Fri, 16 Jun 2006 09:47:17 -0400 Subject: dets improvements? In-Reply-To: <17554.24206.507193.791986@gargle.gargle.HOWL> References: <17244f480606081916g4552111dtb4780f9c67aa79c8@mail.gmail.com> <17552.10210.591016.642666@gargle.gargle.HOWL> <17244f480606150924k7f3a2f58p1756bcec614d4d83@mail.gmail.com> <17554.24206.507193.791986@gargle.gargle.HOWL> Message-ID: <17244f480606160647u106e0657jf9306553c4eb1589@mail.gmail.com> > > If you use Mnesia and 'disc_only_copies', then directly (or > indirectly, by changing the schema) calling mnesia:add_table_copy() > would create a defragmented copy of the Dets table on some other node. > While the table is being copied, the table can be updated as usual, at > some extra cost. > Thanks, Hans. This option did occur to me, but I think it will be prohibitively expensive in my case, as I am probably going to run my whole app on a single server, and I don't want massive table copies to thrash the disc. I understand that there is no current plan to improve dets, but if the OTP group ever decides to integrate the changes discussed in this thread that would make dets more "worry-free" like InnoDB or Postgres disc storage into its roadmap, please let me know and I will dump MySQL in a second :) Best, Yariv From sebastian@REDACTED Fri Jun 16 15:51:57 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 16 Jun 2006 10:51:57 -0300 Subject: Port drivers References: <005e01c69142$a51f0360$6500a8c0@inswitchapp> <200606161527.53787.danie@erlfinsys.net> Message-ID: <008301c6914c$09bfe1f0$6500a8c0@inswitchapp> Danie, > I may misunderstand but just to clarify > port driver = linked in driver > port = the erl_interface stdin stdout type communication Yes, that's what I meant. > 5. We have the same thing, the attached code is sybase linked in drivers, and > each one makes a connection to the database. We run about 50 of these > drivers simultaneously. The answer might also lie in what you do with the > driver. I'm trying something similar, each driver would start an ODBC connection. I have a working TCP version (instead of port driver), but hope to gain performance using a port driver. Thanks for your reply and code! Sebastian- ----- Original Message ----- From: "Danie Schutte" To: "Sebastian Bello" Cc: "Erlang Questions" Sent: Friday, June 16, 2006 10:27 AM Subject: Re: Port drivers > I may misunderstand but just to clarify > port driver = linked in driver > port = the erl_interface stdin stdout type communication > > 1. Linked in drivers, use binaries to send data, we experienced a 270% > performance increase over our traditional port interface. Side effect - if > something goes wrong :) it goes wrong spectacularly (but this rarely > happened) > 2. Significantly faster > 3. no windows :) > 4. Attached to this mail is some sample (production driver) code. > 5. We have the same thing, the attached code is sybase linked in drivers, and > each one makes a connection to the database. We run about 50 of these > drivers simultaneously. The answer might also lie in what you do with the > driver. > > > > On Friday 16 June 2006 14:44, Sebastian Bello wrote: > > Hello list, > > > > a few questions regarding port drivers: > > > > 1- when should a port driver be used instead of a port? > > 2- is a port driver faster than a port? > > 3- is it easy/possible to debug a port driver under Windows? > > 4- has anybody written an MFC based dll as a port driver? Is there any > > sample code available? 5- when having to deal with a big number of requests > > for a port driver, may it be possible/desirable to start multiple port > > drivers to handle them? > > > > Thanks, > > Sebastian- > > -- > Managing Director > Erlang Financial Systems (Pty) Ltd > > Mobile: +27 84 468 3138 > Phone : +11 235 6500 ext 6801 > Fax : +11 235 6690 > > > __________ Informacin de NOD32, revisi n 1.1602 (20060616) __________ > > Este mensaje ha sido analizado con NOD32 antivirus system > http://www.nod32.com > > From dmitry.kargapolov@REDACTED Fri Jun 16 16:07:07 2006 From: dmitry.kargapolov@REDACTED (Dmitriy Kargapolov) Date: Fri, 16 Jun 2006 10:07:07 -0400 Subject: bug in timer:sleep/1 smp implementation (R11B-0) In-Reply-To: <17553.35499.634400.359802@alkaid.it.uu.se> References: <44917D65.4040703@corp.idt.net> <17553.35499.634400.359802@alkaid.it.uu.se> Message-ID: <4492BB0B.5060003@corp.idt.net> I tried to make a small module for testing the problem, but in that case there has been no issue so far. I guess it's only happens in complex environment with thousand of processes and big volume network traffic. Once I found anything I'll let you know. Any ideas how to trace the problem are welcome. Mikael Pettersson wrote: > Dmitriy Kargapolov writes: > > > > When running erl with -smp +S 2 option, sometimes process gets stuck in > > timer:sleep/1. > > Process code looks like: > > > > some_receiver(State) -> > > NewState = receive > > % legal packet > > {some_keyword, Address, Port, Packet} -> > > State1 = handle_packet(Address, Port, Packet, State), > > timer:sleep(get_loop_delay()), > > State1; > > % unknown message > > _ -> > > State > > end, > > some_receiver(NewState). > > > > Delay value varies in range 1..999 > > > > Since timer:sleep/1 implemented as: > > sleep(T) -> > > receive > > after T -> ok > > end. > > it seems to be problem with "after" in smp implementation in R11B-0 > > > > I don't have more details yet but will continue testing. > > My platform: 2.6.9-5.ELsmp #1 SMP i686 i686 i386 GNU/Linux > > Interesting. Please send us a small standalone module that exhibits > the bug, and I'll see if I can reproduce it. > > /Mikael > From bjorn.ericsson@REDACTED Fri Jun 16 16:43:55 2006 From: bjorn.ericsson@REDACTED (=?iso-8859-1?Q?Ericsson=2C_Bj=F6rn?=) Date: Fri, 16 Jun 2006 16:43:55 +0200 Subject: 8 bit signed float possible? In-Reply-To: Message-ID: Hi! I'm trying to construct an eight bit signed float in binary format: Float = 3.14. Bin = <>. This only give badarg error. Is 8 bits too small for a float? Manual says default is 64 bits, but I cant find info on minimum. Any clues? /BE This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Fri Jun 16 17:06:46 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 16 Jun 2006 17:06:46 +0200 Subject: 8 bit signed float possible? In-Reply-To: References: Message-ID: Only 32 and 64 bits are supported. /Bjorn Ericsson, Bj?rn writes: > Hi! > > I'm trying to construct an eight bit signed float in binary format: > > Float = 3.14. > Bin = <>. > > This only give badarg error. Is 8 bits too small for a float? Manual says default is 64 bits, but I cant find info on minimum. > > Any clues? > > /BE > > > > This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jay@REDACTED Fri Jun 16 21:18:03 2006 From: jay@REDACTED (Jay Nelson) Date: Fri, 16 Jun 2006 12:18:03 -0700 Subject: IBM tutorial on functional Javascript Message-ID: <449303EB.10405@duomark.com> Might give some ideas to those working on template expanders: "Using functional programming techniques to write elegant JavaScript" http://www-128.ibm.com/developerworks/library/wa-javascript.html jay From bsder@REDACTED Sat Jun 17 00:48:57 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Fri, 16 Jun 2006 15:48:57 -0700 Subject: 8 bit signed float possible? In-Reply-To: References: Message-ID: <44933559.9070207@allcaps.org> Ericsson wrote: > Hi! > > I'm trying to construct an eight bit signed float in binary format: > > Float = 3.14. > Bin = <>. > > This only give badarg error. Is 8 bits too small for a float? Yes. Erlang doesn't support floats other than 32 and 64. However, I recommend that you do some homework on understanding floating point. An 8-bit float would simply be too small to contain 3.14. You need about 8 bits of mantissa and 1 bit of sign to contain that number. That would only leave 7 bits for the exponent of which 1 bit is a sign bit. Even a 16-bit floating point number would be pushing it. I heartily recommend David Goldberg's "What Every Computer Scientist Should Know About Floating Point.": http://docs.sun.com/source/806-3568/ncg_goldberg.html -a From bsder@REDACTED Sat Jun 17 01:14:02 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Fri, 16 Jun 2006 16:14:02 -0700 Subject: Tracking down superlinear reductions In-Reply-To: <44928841.90403@ericsson.com> References: <44928437.7090708@allcaps.org> <44928841.90403@ericsson.com> Message-ID: <44933B3A.7080907@allcaps.org> Bengt Kleberg wrote: > On 2006-06-16 12:13, Andrew Lentvorski wrote: > ...deleted >> What I'd like to do is the Erlang equivalent of getting the number of >> times a function is called. This would avoid the problem of Erlang >> trying to print out the arguments and flooding the I/O system. > > have a look at: cprof, eprof, fprof and friends, in the tools section of > the docuemntation. > http://erlang.org/doc/doc-5.5/lib/tools-2.5/doc/html/index.html cprof did it. ... {699175, [{orddict,535312, [{{orddict,store,3},524697}, ... Ouch! And that's only for 1000 packets. That's the only function in my entire program that isn't within a small multiplier of 1000. I'm not calling orddict:store() anywhere near that many times. It looks like orddict:store() is an O(n) function as it seems to be doing a linear scan. That explains why its about 1000*1000/2. A linear scan should be O(n)/2. I'll go look at the gb_trees module. Thanks for the help, -a From ulf.wiger@REDACTED Sat Jun 17 08:10:15 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Sat, 17 Jun 2006 08:10:15 +0200 Subject: Tracking down superlinear reductions Message-ID: > It looks like orddict:store() is an O(n) function as it seems > to be doing a linear scan. That explains why its about > 1000*1000/2. A linear scan should be O(n)/2. > > I'll go look at the gb_trees module. The simplest way to check how much the complexity of orddict adds to the equation is of course to switch to dict - since orddict and dict have exactly the same API. According to the manual, orddict mimics dict, but uses an ordered list. The manual for dict doesn't specify what it uses, but the code does: %% We use the dynamic hashing techniques by Per-?ke Larsson as %% described in "The Design and Implementation of Dynamic Hashing for %% Sets and Tables in Icon" by Griswold and Townsend. Much of the %% terminology comes from that paper as well. BR, Ulf W From ulf.wiger@REDACTED Sat Jun 17 11:28:09 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Sat, 17 Jun 2006 11:28:09 +0200 Subject: Tracking down superlinear reductions Message-ID: Ulf Wiger (AL/EAB) wrote: > > The simplest way to check how much the complexity of orddict > adds to the equation is of course to switch to dict - since > orddict and dict have exactly the same API. ... unless of course you depend on the ordered semantics. (: BR, Ulf W From michal@REDACTED Sat Jun 17 12:26:32 2006 From: michal@REDACTED (Michal Slaski) Date: Sat, 17 Jun 2006 12:26:32 +0200 Subject: RFC: template engine [ was: Re: Implementing tables - advice wanted ] In-Reply-To: <448F2CB7.9040000@web.am> References: <448E93BD.9030004@it.uu.se> <3DC2972C-244A-45E0-9D47-4189B02C9D1F@redstarling.com> <448F2CB7.9040000@web.am> Message-ID: <84d062da0606170326v42561bb5x256dd1f3de55521e@mail.gmail.com> Gaspar Chilingarov wrote: > I would like to listen any suggestions on templating solution, which you > would like to see We use a concept of xml tags that can be included in xhtml pages. The tag can be translated into: 1. Call to a call-back function implemented in erlang module - since parameters and body of the tag are passed as arguments to the call-back function, it is easy to develop patterns like branching constructions, list processing or even execution of erlang code included in xhtml page (however we hardly mix erlang and xhtml code). 2. Block of code that can be extracted and used for inclusion in other blocks, so it is possible to gather all templates used to format data of same kind in one file. A block can be then included either by erlang or by dedicated xml tag. A platform implementing this concept has been built on top of yaws and is described in a paper submitted to the Erlang Workshop 2006. -- Michal Slaski www.erlang-consulting.com From chsu79@REDACTED Sat Jun 17 14:27:35 2006 From: chsu79@REDACTED (Christian S) Date: Sat, 17 Jun 2006 14:27:35 +0200 Subject: 8 bit signed float possible? In-Reply-To: <44933559.9070207@allcaps.org> References: <44933559.9070207@allcaps.org> Message-ID: On 6/17/06, Andrew Lentvorski wrote: > Ericsson wrote: > > I'm trying to construct an eight bit signed float in binary format: > > > > Float = 3.14. > > Bin = <>. > > > > This only give badarg error. Is 8 bits too small for a float? > > Yes. > > Erlang doesn't support floats other than 32 and 64. > I heartily recommend David Goldberg's "What Every Computer Scientist > Should Know About Floating Point.": > > http://docs.sun.com/source/806-3568/ncg_goldberg.html And once that is understood you can of course deconstruct 8 bits into small integers and construct a floating point number out of them yourself. Given 1 sign bit, 2 exponent bits and 5 mantissa bits you can have 32 different fractions between 1.0 and 0.0, and you have have (as a suggestion) 10^1, 10^0, 10^-1, 10^2 multipliers from the exponent bit. Then the closest you can come to 3.14 is 10*(1.0/32) * 10^1 = 0.3125 * 10^1 = 3.125. Good enought for government work, or what is it they say? From bsder@REDACTED Sun Jun 18 10:55:22 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sun, 18 Jun 2006 01:55:22 -0700 Subject: 8 bit signed float possible? In-Reply-To: References: <44933559.9070207@allcaps.org> Message-ID: <449514FA.3060809@allcaps.org> Christian S wrote: > And once that is understood you can of course deconstruct 8 bits into > small integers and construct a floating point number out of them > yourself. > > Given 1 sign bit, 2 exponent bits and 5 mantissa bits you can have 32 > different fractions between 1.0 and 0.0, and you have have (as a > suggestion) 10^1, 10^0, 10^-1, 10^2 > multipliers from the exponent bit. Then the closest you can come to 3.14 is > 10*(1.0/32) * 10^1 = 0.3125 * 10^1 = 3.125. > > Good enought for government work, or what is it they say? I am assuming that you are being flippant, so I send this return message in the same vein. ;) What they say is, "The net provides a thousand wrong answers as well as the right one.". First, mixing bases for exponent (10) and fractional mantissa (2) is unusual. Think there might be a reason for that? (Hint: there is.) In addition, you make the implicit assumption that the floating point numbers are allowed to be denormal without explicit indication (ie. no implicit leading 1 in the mantissa). While not incorrect, not having an implicit leading 1 in the mantissa without indication is certainly an unusual assumption and should be noted. To top things off, two's complement arithmetic normally implies that the negative range is larger than the positive range. Thus, the normal sequence for your exponent would be -2, -1, 0, 1. Additionally, since you allow unindicated denormal numbers, you would be better better off representing the number as 5/16 (0.3125) so that you could use an exponent of 1 and preserve more bits of accuracy. Finally, the request to store 3.14 normally carries an implication of error of approximately +/- 1/200 (1/2 ulp). Your floating point exceeds that error. Not indicating that the next two nearest numbers around it are {9/32*10, 10/32*10, 11/32*10} = (2.8125, 3.125, 3.4375} is just unsporting. -a From rasmussen.bryan@REDACTED Sun Jun 18 12:07:28 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Sun, 18 Jun 2006 12:07:28 +0200 Subject: record problem Message-ID: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> Why does this -record(a,{b="b",c="c"}). give this =ERROR REPORT==== 18-Jun-2006::12:03:20 === Error in process <0.168.0> with exit value: {{badmatch,"b"},[{erl_eval,expr,3}]} ** exited: {{badmatch,"b"},[{erl_eval,expr,3}]} ** In Erlang 5.4.13 Cheers, Bryan Rasmussen From bengt.kleberg@REDACTED Sun Jun 18 12:44:00 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Sun, 18 Jun 2006 12:44:00 +0200 Subject: record problem In-Reply-To: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> Message-ID: <44952E70.6040009@ericsson.com> On 2006-06-18 12:07, bryan rasmussen wrote: > Why does this > > -record(a,{b="b",c="c"}). > give this > > =ERROR REPORT==== 18-Jun-2006::12:03:20 === > Error in process <0.168.0> with exit value: > {{badmatch,"b"},[{erl_eval,expr,3}]} it does not give an error in Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.5 is there any other code surrounding the record definition? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From valentin@REDACTED Sun Jun 18 13:19:28 2006 From: valentin@REDACTED (Valentin Micic) Date: Sun, 18 Jun 2006 13:19:28 +0200 Subject: record problem References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> Message-ID: <000701c692c9$124e4900$6501a8c0@moneymaker2> Sometimes if one changes state variable returned by gen_server (or any other behaviour) callback module, and then dyunamically upgrade code, run-time may report error like this one. For example, if you had a gen_server callback module with a state variable like this: -record( state, {x="X"} ) Later, if you start the server and change the code with new state variable modified to: -record( state, {x="X", y="Y"} ) and compile & deploy the code, but fail to restart the server, the gen_server loop shall pass the old record definition {state, "X"}, whilst callback module would expect, something like {state, "X", "Y"}. If you do not have *catch_all* pattern, the program shall crash. Would this be applicable to your case? V. ----- Original Message ----- From: "bryan rasmussen" To: "Erlang Questions" Sent: Sunday, June 18, 2006 12:07 PM Subject: record problem > Why does this > > -record(a,{b="b",c="c"}). > give this > > =ERROR REPORT==== 18-Jun-2006::12:03:20 === > Error in process <0.168.0> with exit value: > {{badmatch,"b"},[{erl_eval,expr,3}]} > > > > ** exited: {{badmatch,"b"},[{erl_eval,expr,3}]} ** > > > > In Erlang 5.4.13 > > Cheers, > Bryan Rasmussen > From rasmussen.bryan@REDACTED Sun Jun 18 13:36:16 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Sun, 18 Jun 2006 13:36:16 +0200 Subject: record problem In-Reply-To: <44952E70.6040009@ericsson.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> Message-ID: <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> Hi, yeah there was code surrounding but it was not pertinent I was just in the shell testing some stuff out. In order to test again I have closed down the shell and started, here is what I got: Erlang (BEAM) emulator version 5.4.13 [threads:0] Eshell V5.4.13 (abort with ^G) 1> -record(a,{b="b"}). ** exited: {{badmatch,"b"},[{erl_eval,expr,3}]} ** =ERROR REPORT==== 18-Jun-2006::13:31:12 === Error in process <0.30.0> with exit value: {{badmatch,"b"},[{erl_eval,expr,3}]} this is basically an old erlang running on an old work laptop, I should install newer version but I was wondering. Cheers, Bryan Rasmussen On 6/18/06, Bengt Kleberg wrote: > On 2006-06-18 12:07, bryan rasmussen wrote: > > Why does this > > > > -record(a,{b="b",c="c"}). > > give this > > > > =ERROR REPORT==== 18-Jun-2006::12:03:20 === > > Error in process <0.168.0> with exit value: > > {{badmatch,"b"},[{erl_eval,expr,3}]} > > it does not give an error in Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator > version 5.5 > > is there any other code surrounding the record definition? > > > bengt > -- > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > From jahakala@REDACTED Sun Jun 18 13:59:36 2006 From: jahakala@REDACTED (Jani Hakala) Date: Sun, 18 Jun 2006 14:59:36 +0300 Subject: record problem In-Reply-To: <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> (bryan rasmussen's message of "Sun, 18 Jun 2006 13:36:16 +0200") References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> Message-ID: <877j3efzdj.fsf@pingviini.kortex.jyu.fi> "bryan rasmussen" writes: > Hi, yeah there was code surrounding but it was not pertinent I was > just in the shell testing some stuff out. In order to test again I > have closed down the shell and started, here is what I got: > > Erlang (BEAM) emulator version 5.4.13 [threads:0] > > Eshell V5.4.13 (abort with ^G) > 1> -record(a,{b="b"}). > ** exited: {{badmatch,"b"},[{erl_eval,expr,3}]} ** > rd(a,{b="b"}). see help(). Jani Hakala From bengt.kleberg@REDACTED Sun Jun 18 14:11:19 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Sun, 18 Jun 2006 14:11:19 +0200 Subject: record problem In-Reply-To: <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> Message-ID: <449542E7.9040407@ericsson.com> On 2006-06-18 13:36, bryan rasmussen wrote: > Hi, yeah there was code surrounding but it was not pertinent I was > just in the shell testing some stuff out. the record syntax is syntactic sugar for tuples. the ''de-sugaring'' is done by the pre-processor during compilation. you can not write records directly into the shell. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From nils.muellner@REDACTED Sun Jun 18 14:33:27 2006 From: nils.muellner@REDACTED (=?ISO-8859-15?Q?Nils_M=FCllner?=) Date: Sun, 18 Jun 2006 14:33:27 +0200 Subject: Erlang vs Java: Comparison by Crypto Message-ID: <44954817.6000301@heh.uni-oldenburg.de> hi@REDACTED, ive just tested performance of erlang and java by using the crypto-funs. test is available under http://www.informatik.uni-oldenburg.de/~phoenix/crypto.zip result (time needed): java: 100% erlang: ca. 29% more detailed results will follow (including network test). nils From rasmussen.bryan@REDACTED Sun Jun 18 21:11:34 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Sun, 18 Jun 2006 21:11:34 +0200 Subject: record problem In-Reply-To: <449542E7.9040407@ericsson.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> <449542E7.9040407@ericsson.com> Message-ID: <3bb44c6e0606181211w4630698cpa6e47d7b2b3f2e69@mail.gmail.com> Yes thanks, I figured out later by reading over the programming examples that one can't define records in the shell and have to use rd() instead, but I couldn't figure out why this was the case. Personally I prefer using straight up tuples but I had something for which records might make sense. Cheers, Bryan Rasmussen On 6/18/06, Bengt Kleberg wrote: > On 2006-06-18 13:36, bryan rasmussen wrote: > > Hi, yeah there was code surrounding but it was not pertinent I was > > just in the shell testing some stuff out. > > the record syntax is syntactic sugar for tuples. the ''de-sugaring'' is > done by the pre-processor during compilation. you can not write records > directly into the shell. > > > bengt > -- > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > From bengt.kleberg@REDACTED Mon Jun 19 06:36:55 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 19 Jun 2006 06:36:55 +0200 Subject: record problem In-Reply-To: <3bb44c6e0606181211w4630698cpa6e47d7b2b3f2e69@mail.gmail.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> <3bb44c6e0606180436l32ec371bof1e1cf66d7a65759@mail.gmail.com> <449542E7.9040407@ericsson.com> <3bb44c6e0606181211w4630698cpa6e47d7b2b3f2e69@mail.gmail.com> Message-ID: <449629E7.2020608@ericsson.com> On 2006-06-18 21:11, bryan rasmussen wrote: ...deleted > Personally I prefer using straight up tuples but I had something for > which records might make sense. imho: when a tuple has few members it makes sense to use it. but when it becomes impossible to remember the order of the members, then a record is better. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From mikpe@REDACTED Fri Jun 16 18:43:37 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 16 Jun 2006 18:43:37 +0200 (MEST) Subject: huge list matching -- different behaviour on x86_32 and x86_64 Message-ID: <200606161643.k5GGhbhI010950@harpo.it.uu.se> On Thu, 15 Jun 2006 18:33:14 +0200, Mikael Pettersson wrote: >Igor Goryachev writes: > > Hello. > > > > I have experienced a different behaviour and possibly a weird result > > while playing with matching a huge lists on x86_32 and x86_64 > > machines. Version r10b10 was used in both cases. > > > > The results (see the attachment): > > > > x86_32: > > goryachev@REDACTED:~% uname -a > > Linux l1 2.6.16-1-686-smp #2 SMP Fri May 5 05:00:58 UTC 2006 i686 GNU/Linux > > goryachev@REDACTED:~% erl > > Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] [kernel-poll] > > > > Eshell V5.4.13 (abort with ^G) > > 1> tv:b(). > > matched! > > ok > > > > > > x86_64: > > goryachev@REDACTED:~% uname -a > > Linux x1 2.6.12-1-em64t-p4-smp #1 SMP Wed Sep 28 03:50:13 CEST 2005 x86_64 GNU/Linux > > goryachev@REDACTED:~% erl > > Erlang (BEAM) emulator version 5.4.13 [64-bit] [source] [hipe] [threads:0] [kernel-poll] > > > > Eshell V5.4.13 (abort with ^G) > > 1> tv:b(). > > not matched! > > ok > > > > > > Could you be so kind to explain me whether it is the expected behaviour? > >This is clearly a bug. It also happens with an OTP R11 snapshot from about a >month ago on x86_64. It does NOT happen when I compile the tv module with hipe, >or when I remove about 10 lines from the lists. The bug also occurs in current R11 when compiled for 64-bit SPARC, but not when compiled for 32-bit PowerPC. Thus it appears to be a plain 64-bit bug, unrelated to CPU type or endianess. /Mikael From goran.bage@REDACTED Sun Jun 18 13:36:26 2006 From: goran.bage@REDACTED (=?ISO-8859-1?Q?G=F6ran_B=E5ge?=) Date: Sun, 18 Jun 2006 13:36:26 +0200 Subject: record problem In-Reply-To: <44952E70.6040009@ericsson.com> References: <3bb44c6e0606180307k3ef15025t131e8e988bdaf5ed@mail.gmail.com> <44952E70.6040009@ericsson.com> Message-ID: <44953ABA.1060506@mobilearts.com> Bengt Kleberg wrote: > On 2006-06-18 12:07, bryan rasmussen wrote: > >> Why does this >> >> -record(a,{b="b",c="c"}). >> give this >> >> =ERROR REPORT==== 18-Jun-2006::12:03:20 === >> Error in process <0.168.0> with exit value: >> {{badmatch,"b"},[{erl_eval,expr,3}]} > My guess is that Bryan tried this in the erlang shell which doesnt know about records and would interpret this as an arithmetic expression. > > it does not give an error in Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator > version 5.5 > > is there any other code surrounding the record definition? > > > bengt -- -- Goran -------------------- May the Snow be with you -------- Goran Bage Byvagen 10, SE-133 34 Saltsjobaden, Sweden email:goran.bage@REDACTED, phone: +46 8 7172907 From bsder@REDACTED Mon Jun 19 10:16:44 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 19 Jun 2006 01:16:44 -0700 Subject: Polymorphic record question Message-ID: <44965D6C.4080509@allcaps.org> I define some basic packet records. Every packet has a sequence number, and I would like to be able to pull out that sequence number regardless of packet type like so: -module(test). -compile(export_all). -record(u_P2PGen, {sequenceNumber}). -record(u_P2PSyn, {sequenceNumber, synData}). -record(u_P2PFin, {sequenceNumber, finData}). test() -> Q0 = queue:new(), Q1 = queue:in(#u_P2PSyn{sequenceNumber=1, synData=foo}, Q0), Q2 = queue:in(#u_P2PFin{sequenceNumber=9, finData=bar}, Q1), io:format("Q2: ~p~n", [Q2]), {{value, P0}, Q3} = queue:out(Q2), io:format("P0: ~p~n", [P0]), io:format("SN: ~p~n", [P0#u_P2PGen.sequenceNumber]). Obviously, with different types of packets hitting the queue, I don't know a priori which packet type it is. Thus why I use a generic packet to get at the sequence number. My question is: Is this "downcast" the only/best way of doing this kind generic handling? Thanks, -a From dgud@REDACTED Mon Jun 19 10:20:49 2006 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 19 Jun 2006 10:20:49 +0200 Subject: Implementing tables - advice wanted In-Reply-To: <448E93BD.9030004@it.uu.se> References: <448E93BD.9030004@it.uu.se> Message-ID: <17558.24161.153454.458978@balin.du.uab.ericsson.se> I have worked on a "large" integer "array" imp. Faster than gb_trees but not an O(1) access time, it still is a tree. For 4500000 objects total millisecs/micros per op. Module gb_trees ga -------------------------------------- insert alot 9155/ 2.0347 lookup 6419/ 1.4265 2689/ 0.5977 update 19065/ 4.2368 8679/ 1.9288 from_list 2560/ 0.5689 766/ 0.1702 to_list 967/ 0.2151 243/ 0.0542 from_orddict 2560/ 0.5690 1084/ 0.2411 to_orddict 995/ 0.2213 1884/ 0.4188 map 4554/ 1.0122 1788/ 0.3974 keymap 4704/ 1.0454 2287/ 0.5083 foldl 1806/ 0.4014 1204/ 0.2677 keyfoldl 1700/ 0.3779 1825/ 0.4057 foldr 1622/ 0.3606 1318/ 0.2929 /Dan -------------- next part -------------- A non-text attachment was scrubbed... Name: ga.erl Type: application/octet-stream Size: 21656 bytes Desc: ga.erl URL: -------------- next part -------------- Richard Carlsson writes: > Joe Armstrong (AL/EAB) wrote: > > Erlang really really really (^100) needs tables. > > Allow me to disagree somewhat. Erlang already has good tables, > both using hashing (dict) and binary trees (gb_trees). The > syntactic convenience of a built-in table/dictionary type is > really a minor thing. (Not that I would oppose having such a > notation, but I really don't think it is critical in any way.) > The main advantage would be psychological, I think: a standard > one-size-fits-all dictionary type makes it easier for people to > start using them in public interfaces, and not just internally. > > What I _do_ miss now and then (and when I need them, I have to > jump through several hoops to get them) is indexable tables > (i.e., arrays) with O(1) access time and a _small_ constant > factor, and no copying of the stored data. > > If I remember correctly, the experiment with a "vector" data > type (which used destructive update internally, with some > penalty for accessing older versions of the data) was killed > by bad interaction with the garbage collector, leading to > rotten performance. Have things changed enough in the GC by > now for this to become worth a new attempt? > > /Richard From chsu79@REDACTED Mon Jun 19 10:59:11 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 19 Jun 2006 10:59:11 +0200 Subject: Polymorphic record question In-Reply-To: <44965D6C.4080509@allcaps.org> References: <44965D6C.4080509@allcaps.org> Message-ID: How about an accessor function: sequenceNumber(#p2psyn{sequenceNumber=Seq}) -> Seq; ... sequenceNumber(#p2pfin{sequenceNumber=Seq}) -> Seq. Or is the different kinds of packets not restricted, instead new ones will be defined later on by dynamicly loaded code? If the latter is the case then you should probably store which position of the record that hold the sequence number, and then use erlang:element/2 to fetch the value at that position in the tuple (since records are implemented on top of tuples). Example: "#record.field" will give you an integer representing the position of 'field' in tuples that hold 'record'. Another idea could be to consider sequenceNumber to be part of the header and the data part of the payload, so you define -record(p2ppacket, {something, sequenceNumber, payload}). and then various records that you put in the payload field. The downside is that (Packet#p2ppacket.payload)#p2psyn.synData is a bit ugly to write. Just some alternatives. The way you chosed to implement it seems to be an "exploiting the implementation"-approach. Although using element to access a field in the tuple is too, I admit. I wonder if dialyzer would complain if it did see these approaches in code. On 6/19/06, Andrew Lentvorski wrote: > I define some basic packet records. Every packet has a sequence number, > and I would like to be able to pull out that sequence number regardless > of packet type like so: > > -module(test). > > -compile(export_all). > > -record(u_P2PGen, {sequenceNumber}). > -record(u_P2PSyn, {sequenceNumber, synData}). > -record(u_P2PFin, {sequenceNumber, finData}). > > test() -> > Q0 = queue:new(), > Q1 = queue:in(#u_P2PSyn{sequenceNumber=1, synData=foo}, Q0), > Q2 = queue:in(#u_P2PFin{sequenceNumber=9, finData=bar}, Q1), > io:format("Q2: ~p~n", [Q2]), > > {{value, P0}, Q3} = queue:out(Q2), > io:format("P0: ~p~n", [P0]), > io:format("SN: ~p~n", [P0#u_P2PGen.sequenceNumber]). > > Obviously, with different types of packets hitting the queue, I don't > know a priori which packet type it is. Thus why I use a generic packet > to get at the sequence number. > > My question is: Is this "downcast" the only/best way of doing this kind > generic handling? > > Thanks, > -a > From bengt.kleberg@REDACTED Mon Jun 19 11:06:10 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 19 Jun 2006 11:06:10 +0200 Subject: Polymorphic record question In-Reply-To: <44965D6C.4080509@allcaps.org> References: <44965D6C.4080509@allcaps.org> Message-ID: <44966902.6070507@ericsson.com> On 2006-06-19 10:16, Andrew Lentvorski wrote: > I define some basic packet records. Every packet has a sequence number, > and I would like to be able to pull out that sequence number regardless > of packet type like so: > > -module(test). > > -compile(export_all). > > -record(u_P2PGen, {sequenceNumber}). > -record(u_P2PSyn, {sequenceNumber, synData}). > -record(u_P2PFin, {sequenceNumber, finData}). ...deleted > Obviously, with different types of packets hitting the queue, I don't > know a priori which packet type it is. Thus why I use a generic packet > to get at the sequence number. > > My question is: Is this "downcast" the only/best way of doing this kind > generic handling? it is not the only way. this is another way of doing it: -record(u_P2P_seq, {number, packet}). -record(u_P2P_syn, {data}). -record(u_P2P_fin, {data}). test() -> Q0 = queue:new(), Q1 = queue:in(#u_P2P_seq{number=1, packet=#u_P2P_syn{data=foo}}, Q0), Q2 = queue:in(#u_P2P_seq{number=9, packet=#u_P2P_fin{data=bar}}, Q1), io:format("Q2: ~p~n", [Q2]), {{value, P0}, Q3} = queue:out(Q2), io:format("P0: ~p~n", [P0]), io:format("SN: ~p~n", [P0#u_P2P_seq.number]). bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bsder@REDACTED Mon Jun 19 11:39:06 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 19 Jun 2006 02:39:06 -0700 Subject: Polymorphic record question In-Reply-To: References: <44965D6C.4080509@allcaps.org> Message-ID: <449670BA.4050608@allcaps.org> Christian S wrote: > How about an accessor function: > > sequenceNumber(#p2psyn{sequenceNumber=Seq}) -> > Seq; > ... > sequenceNumber(#p2pfin{sequenceNumber=Seq}) -> > Seq. *smacks forehead with palm for being an idiot* Right. I'm in a pattern matching language. I should use a pattern match. What a concept. ;} Talk about missing the obvious. > Or is the different kinds of packets not restricted, instead new ones > will be > defined later on by dynamicly loaded code? No, I'm not loading dynamically. Your solution works great. > Another idea could be to consider sequenceNumber to be part of the > header and the data part of the payload, so you define > -record(p2ppacket, {something, sequenceNumber, payload}). > > and then various records that you put in the payload field. The downside > is that > (Packet#p2ppacket.payload)#p2psyn.synData is a bit ugly to write. Yeah, that's getting a little convoluted. At that point, putting things into tuples and just recording the position starts to look more readable. -a From carin.gustafsson@REDACTED Mon Jun 19 11:40:01 2006 From: carin.gustafsson@REDACTED (Carin Gustafsson (LN/EAB)) Date: Mon, 19 Jun 2006 11:40:01 +0200 Subject: Distributed node on xp with firewall Message-ID: <94B96B3383630441B365F76490340348033B2CE4@esealmw103.eemea.ericsson.se> Hi I tried erl -sname testnode -env inet_dist_listen_min 9100 -env inet_dist_listen_max 9105 that didn't work. The problem might be the firewall Panda titanium because even though I disable every Feature it won't work, it has to be uninstalled in order to get erl running. Btw, there is no problem when using Symantec firewall. If anyone has any ideas please let me know. Br Carin -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Carin Gustafsson (LN/EAB) Sent: den 13 juni 2006 13:31 Thank you, I will try that to night. Carin -----Original Message----- From: Lennart Ohman [mailto:lennart.ohman@REDACTED] Sent: den 13 juni 2006 13:25 Hi, start with reading what was "said" in this thread. http://www.erlang.org/ml-archive/erlang-questions/200605/msg00336.html Best Regards, Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Carin Gustafsson (LN/EAB) > Sent: Tuesday, June 13, 2006 1:16 PM > To: erlang-questions@REDACTED > Subject: Distributed node on xp with firewall > > > Hi > > Does any one know how to start a distibuted node on windows xp ? I > get an error message {error, enotsok} if the firewall is enabled. > After installing Panda it's not possible at all. > > Br Carin > Ericsson AB > SEGS/EAB/AUF/TU > Ericsson AB > SE-431 84 G?TEBORG, Sweden > Phone (fixed&mobile): +46 31 747 4710 > E-Mail: carin.gustafsson@REDACTED > Fax: +46 31 747 6033 > From bjorn@REDACTED Mon Jun 19 16:14:42 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 19 Jun 2006 16:14:42 +0200 Subject: huge list matching -- different behaviour on x86_32 and x86_64 In-Reply-To: <87zmgepguz.fsf@goryachev.org> References: <87zmgepguz.fsf@goryachev.org> Message-ID: Igor Goryachev writes: > Hello. > > I have experienced a different behaviour and possibly a weird result > while playing with matching a huge lists on x86_32 and x86_64 > machines. Version r10b10 was used in both cases. > The problem was in the loader. The following patch resolves the problem at least in R11B-0. (It will probably work if applied to R10B-10 too, but I have not tested that.) *** erts/emulator/utils/beam_makeops@@/main/release/13 Wed May 3 10:01:25 2006 --- erts/emulator/utils/beam_makeops Mon Jun 19 15:56:33 2006 *************** *** 481,487 **** print "\n"; print "#ifdef ARCH_64\n"; print "# define BEAM_LOOSE_MASK 0x1FFFUL\n"; ! print "# define BEAM_TIGHT_MASK 0xFFCUL\n"; print "# define BEAM_LOOSE_SHIFT 16\n"; print "# define BEAM_TIGHT_SHIFT 16\n"; print "#else\n"; --- 481,487 ---- print "\n"; print "#ifdef ARCH_64\n"; print "# define BEAM_LOOSE_MASK 0x1FFFUL\n"; ! print "# define BEAM_TIGHT_MASK 0x1FF8UL\n"; print "# define BEAM_LOOSE_SHIFT 16\n"; print "# define BEAM_TIGHT_SHIFT 16\n"; print "#else\n"; /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From michael206@REDACTED Mon Jun 19 18:35:59 2006 From: michael206@REDACTED (Michael Leonhard) Date: Mon, 19 Jun 2006 11:35:59 -0500 Subject: trapexit.org is moving In-Reply-To: <17244f480606090402m6ef1693dvf184c83f53493712@mail.gmail.com> References: <17244f480606090402m6ef1693dvf184c83f53493712@mail.gmail.com> Message-ID: <21f8b6e20606190935h616f564brc1a27354dae42be9@mail.gmail.com> I think it's a great idea to put the Erlang docs into a Wiki. Searching documentation is the biggest annoyance for new Erlang users. We need documentation that has no frames. A wiki would allow people to correct typos and add missing details and examples. Of course there will be the question of which documentation is authoritative. Ideally, the Erlang development team would put up the wiki on Erlang.org and update it along with each release. The release could include HTML docs generated from the wiki. This would also be great for Jungerl. It would also be great to package the docs in a MS Help file for offline searching. -Michael Michael Leonhard http://tamale.net/ michael206@REDACTED On 6/9/06, Yariv Sadan wrote: > > > > This just shows that creating a community doesnt mean one create > > a technical solution and then the people will come. > > I think there needs to be a "critical mass" of content before enough > people start using it... I was thinking that taking all official > Erlang docs, dumping them into a wiki (wikimedia would be nice), and > setting up a community site around it would be effective. However, I'm > pretty sure somebody mentioned there are license restrictions with > this documentation. > > Cheers, > Yariv From ke.han@REDACTED Mon Jun 19 19:58:43 2006 From: ke.han@REDACTED (ke han) Date: Tue, 20 Jun 2006 01:58:43 +0800 Subject: trapexit.org is moving In-Reply-To: <21f8b6e20606190935h616f564brc1a27354dae42be9@mail.gmail.com> References: <17244f480606090402m6ef1693dvf184c83f53493712@mail.gmail.com> <21f8b6e20606190935h616f564brc1a27354dae42be9@mail.gmail.com> Message-ID: Its my understanding that most/all the erlang docs use docbook. The mySQL site's documentation also uses docbook and they have a very clean structure which allows user comments per page. Perhaps someone from the mySQL team is willing to share the methods/ tools they use to produce this online doc?? expert from http://dev.mysql.com/doc/refman/5.0/en/manual-info.html The Reference Manual source files are written in DocBook XML format. The HTML version and other formats are produced automatically, primarily using the DocBook XSL stylesheets. For information about DocBook, see http://docbook.org/ The DocBook XML sources of this manual are available from http:// dev.mysql.com/tech-resources/sources.html. You can check out a copy of the documentation repository with this command: svn checkout http://svn.mysql.com/svnpublic/mysqldoc/ If you have any suggestions concerning additions or corrections to this manual, please send them to the documentation team at . ke han On Jun 20, 2006, at 12:35 AM, Michael Leonhard wrote: > I think it's a great idea to put the Erlang docs into a Wiki. > Searching documentation is the biggest annoyance for new Erlang users. > We need documentation that has no frames. A wiki would allow people > to correct typos and add missing details and examples. Of course > there will be the question of which documentation is authoritative. > Ideally, the Erlang development team would put up the wiki on > Erlang.org and update it along with each release. The release could > include HTML docs generated from the wiki. > > This would also be great for Jungerl. It would also be great to > package the docs in a MS Help file for offline searching. > > -Michael > > Michael Leonhard > http://tamale.net/ > michael206@REDACTED > > On 6/9/06, Yariv Sadan wrote: >> > >> > This just shows that creating a community doesnt mean one create >> > a technical solution and then the people will come. >> >> I think there needs to be a "critical mass" of content before enough >> people start using it... I was thinking that taking all official >> Erlang docs, dumping them into a wiki (wikimedia would be nice), and >> setting up a community site around it would be effective. However, >> I'm >> pretty sure somebody mentioned there are license restrictions with >> this documentation. >> >> Cheers, >> Yariv From fig@REDACTED Mon Jun 19 20:41:01 2006 From: fig@REDACTED (Michael FIG) Date: Mon, 19 Jun 2006 12:41:01 -0600 (CST) Subject: Summary: E / Erlang integration Message-ID: <32353537.12801150742461866.JavaMail.root@zimbra> Sorry for the long delay... I somehow missed your e-mail. The examples I gave depended on providing the same semantics as E. Basically, the "send" is an eventual send that doesn't block the calling process. The "promise_case" or whatever function is not supposed to block the caller either, which is why it takes all those funs. They are separate functions because the caller may make several sends before issuing the "promise_case" to collect the results. With both of these functions non-blocking, there is a guarantee that deadlock is impossible. That's the main property of E programs that I'd like to achieve in this library. Does that explain things a bit better? -- Michael FIG , PMP ----- Original Message ----- From: Ulf Wiger (AL/EAB) To: Michael FIG , erlang-questions@REDACTED, Discussion of E and other capability languages Sent: Monday, June 12, 2006 3:12:33 AM GMT-0200 Subject: RE: Summary: E / Erlang integration I think that even without sugar, it can be cleaned up a little: %% @spec send(To, Request, Timeout, MatchFun) -> Result %% @throws timeout try e:send(RaceTrack, getPolePositionCar, 3000, fun(N) when N ==FarPolePositionCar -> io:format("My car is in pole position~n"), match; (_) -> no_match end) of Result -> Result catch throw:timeout -> ... end. I'd rename the function to something other than send(), since the asynchronous send-and-pray function in erlang is erlang:send(Dest, Msg). I see no reason to create funs for anything but a filter function. This fun should be passed to another process, and the return values passed back as regular messages. Compare with gen_server call. BR, Ulf W Michael FIG wrote: > > I retract my original suggestion of developing > special syntax for E message sending (the !< part), since > that can easily be accomplished by a library function > "Promise = e:send(CryptoCap, Message)". However, the > when/catch construct of E would be clunky to use without some > syntactic sugar. > > With sugar: > > promise_case e:send(RaceTrack, getPolePositionCar) of > FarPolePositionCar -> > io:format("My car is in pole position~n"); > after 3000 -> > io:format("Timed out~n") > catch E -> > ok; > end. > > without sugar: > > e:pcase(e:send(RaceTrack, getPolePositionCar), > fun (SomeFreshName) -> > case SomeFreshName of > FarPolePositionCar -> > io:format("My car is in pole position~n"), > matched; > _ -> > notmatched > end > end, > 3000, fun () -> io:format("Timed out~n"), > fun (E) -> ok end). -- MarkeTel Systems has made every effort to ensure this message is virus-free. Our mail server uses multiple virus scanners to provide maximum protection. From igor@REDACTED Mon Jun 19 20:46:20 2006 From: igor@REDACTED (Igor Goryachev) Date: Mon, 19 Jun 2006 22:46:20 +0400 Subject: huge list matching -- different behaviour on x86_32 and x86_64 In-Reply-To: (Bjorn Gustavsson's message of "19 Jun 2006 16:14:42 +0200") References: <87zmgepguz.fsf@goryachev.org> Message-ID: <87wtbdc7b7.fsf@goryachev.org> On 19 Jun 2006, Bjorn Gustavsson wrote: >> I have experienced a different behaviour and possibly a weird result >> while playing with matching a huge lists on x86_32 and x86_64 >> machines. Version r10b10 was used in both cases. >> > > The problem was in the loader. The following patch resolves the > problem at least in R11B-0. (It will probably work if applied to > R10B-10 too, but I have not tested that.) Many thanks, Bjorn. I will test this patch tomorrow morning. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED From fig@REDACTED Mon Jun 19 20:55:21 2006 From: fig@REDACTED (Michael FIG) Date: Mon, 19 Jun 2006 12:55:21 -0600 (CST) Subject: Summary: E / Erlang integration Message-ID: <13951556.12831150743321528.JavaMail.root@zimbra> Also sorry for the long delay... I missed your message in an e-mail filter somewhere. >> To answer more about MarkM's comments, I'm talking about Erlang-E (E semantics >> embedded in Erlang) >waht are your thoughts about handling the non-blocking receive of E? >do you want all e:when_catch() (made up name) to be non blocking? Yes. "promise_case" is my proposal to replace when/catch, since that way Erlang users can take advantage of pattern matching in their non-blocking receives. >> without sugar: >>> >> e:pcase(e:send(RaceTrack, getPolePositionCar), >> fun (SomeFreshName) -> >> case SomeFreshName of >> FarPolePositionCar -> >> io:format("My car is in pole position~n"), >> matched; >> _ -> >> notmatched >> end >> end, >> 3000, fun () -> io:format("Timed out~n"), >> fun (E) -> ok end). >could you explain how the 'notmatched case clause will be reached? You're right, it wouldn't. In my example, I was giving what I would consider to be automatically generated code. The notmatched clause would only be reached if the caller did more restrictive patterns. >also, perhaps it would be simpler to understand e:pcase/5 if you wrote >it like in edoc: @spec my_function(X::integer()) -> integer() I'll do this. I'm almost done a first implementation of the library, and intend to fully document the meaning and usage of all the functions. This would give people a much better picture (i.e. working prototype) of what I have in mind. >perhaps that would be: >@spec pcase( Promise::promise(), Receive::function(), >Timeout_time::integer(), Timeout::function(), Error::function() ) -> atom() > promise() = ??? That's very close... the difference is that the first argument is an arbitrary term that can contain promises as deeply nested as you like. So you could pass a tuple of promises, a list of promises, etc. Thanks for your reply, Michael. From yarivvv@REDACTED Mon Jun 19 21:59:22 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 19 Jun 2006 15:59:22 -0400 Subject: are Mnesia tables immutable? Message-ID: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> Hi, I have a rather basic question: does Erlang's lack of mutable data structures mean that every time you modify a Mnesia (ets) table, the whole table is copied? This sounds very expensive... am I missing something? Thanks Yariv From hokan.stenholm@REDACTED Mon Jun 19 23:34:12 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 19 Jun 2006 23:34:12 +0200 Subject: are Mnesia tables immutable? In-Reply-To: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> References: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> Message-ID: <44971854.6080408@bredband.net> Yariv Sadan wrote: > Hi, > > I have a rather basic question: does Erlang's lack of mutable data > structures mean that every time you modify a Mnesia (ets) table, the > whole table is copied? This sounds very expensive... am I missing > something? > Most data structures are non-mutable but mnesia, ets tables and process dictionaries _are_ mutable, data is copied in and out of mnesia/ets when accessing - it helps to think of them as erlang processes that one can send (write) and recieve (read) messages to/from. Also note that a non-mutable datastructure doesn't necessarily need to copy everything, it's often sufficient, to build a new datastructure using mostly old unchanged parts. There are for example tree based data structures like gb_trees, that have O(log N) read and write costs - only a single tree branch is traveresed or updated, when accessing a specific tree element. > Thanks > Yariv > From yarivvv@REDACTED Tue Jun 20 00:51:51 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 19 Jun 2006 18:51:51 -0400 Subject: are Mnesia tables immutable? In-Reply-To: <44971854.6080408@bredband.net> References: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> <44971854.6080408@bredband.net> Message-ID: <17244f480606191551n5d4d3926hbd3b964df19600aa@mail.gmail.com> Yes, I should have realized that... I'm still new to Erlang and functional programming so the concept of immutable data structures still needs to settle fully in my brain. I have been writing some parsing code and have been quite paranoid about making horribly inefficient use of lists. It did occur to me that it would be useful to have a API for efficiently handling large strings. It would have similar function signatures to regular strings, but the implementation would involve less copying. Does such an API exist? Regards, Yariv On 6/19/06, H?kan Stenholm wrote: > Yariv Sadan wrote: > > > Hi, > > > > I have a rather basic question: does Erlang's lack of mutable data > > structures mean that every time you modify a Mnesia (ets) table, the > > whole table is copied? This sounds very expensive... am I missing > > something? > > > Most data structures are non-mutable but mnesia, ets tables and process > dictionaries _are_ mutable, data is copied in and out of mnesia/ets when > accessing - it helps to think of them as erlang processes that one can > send (write) and recieve (read) messages to/from. > > Also note that a non-mutable datastructure doesn't necessarily need to > copy everything, it's often sufficient, to build a new datastructure > using mostly old unchanged parts. There are for example tree based data > structures like gb_trees, that have O(log N) read and write costs - > only a single tree branch is traveresed or updated, when accessing a > specific tree element. > > > Thanks > > Yariv > > > > From ok@REDACTED Tue Jun 20 03:26:58 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 20 Jun 2006 13:26:58 +1200 (NZST) Subject: Polymorphic record question Message-ID: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> Andrew Lentvorski wrote: I define some basic packet records. Every packet has a sequence number, and I would like to be able to pull out that sequence number regardless of packet type like so: -module(test). -compile(export_all). -record(u_P2PGen, {sequenceNumber}). -record(u_P2PSyn, {sequenceNumber, synData}). -record(u_P2PFin, {sequenceNumber, finData}). This seems like a very strange choice. Whoever said that a data structure could have only one level? When a bunch of abstract values have some properties in common and some properties that are NOT in common, use two levels (or more in some cases): -record(p2p, {sequence_number, variant}). -record(p2p_syn, {syn_data}). -record(p2p_fin, {fin_data}). mk_p2p_syn(SNo, Data) -> #p2p{sequence_number=SNo, variant=#p2p_syn{syn_data=Data}}. mk_p2p_fin(SNo, Data) -> #p2p{sequence_number=SNo, variant=#p2p_fin{fin_data=Data}}. test() -> Q0 = queue:new(), Q1 = queue:in(#u_P2PSyn{sequenceNumber=1, synData=foo}, Q0), Q2 = queue:in(#u_P2PFin{sequenceNumber=9, finData=bar}, Q1), io:format("Q2: ~p~n", [Q2]), {{value, P0}, Q3} = queue:out(Q2), io:format("P0: ~p~n", [P0]), io:format("SN: ~p~n", [P0#u_P2PGen.sequenceNumber]). and write this as test() -> Q0 = queue:new(), Q1 = queue:in(mk_p2p_syn(1, foo), Q0), Q2 = queue:in(mk_p2p_fin(9, bar), Q1), io:format("Q2: ~p~n", [Q2]), {{value, P0=#p2p{sequence_number=SNo}}, Q3} = queue:out(Q2), io:format("P0: ~p~n", [P0]), io:format("SN: ~p~n", [SNo]). I'm a little surprised that the "downcasting" hack worked at all, and I wouldn't expect it to _keep_ working in future releases. From rlenglet@REDACTED Tue Jun 20 04:58:42 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 20 Jun 2006 11:58:42 +0900 Subject: trapexit.org is moving In-Reply-To: References: <21f8b6e20606190935h616f564brc1a27354dae42be9@mail.gmail.com> Message-ID: <200606201158.42948.rlenglet@users.forge.objectweb.org> ke han wrote: > Its my understanding that most/all the erlang docs use > docbook. The mySQL site's documentation also uses docbook and > they have a very clean structure which allows user comments > per page. > Perhaps someone from the mySQL team is willing to share the > methods/ tools they use to produce this online doc?? [...] I once stumbled accross DocBookWiki: http://doc-book.sourceforge.net/homepage/ It is a Wiki that edits DocBook XML documents. It is distributed under the GPL, it seems regularly maintained, but I have never tried it. One important requirement is to be able to extract the documents in a format suitable for publishing, in HTML, in PDF, etc. DocBook XML is certainly one of the best choices. I believed that the Erlang doc source format was a SGML format? Converting into DocBook XML should then be quite easy?! -- Romain LENGLET From bsder@REDACTED Tue Jun 20 08:17:13 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 19 Jun 2006 23:17:13 -0700 Subject: Polymorphic record question In-Reply-To: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> References: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> Message-ID: <449792E9.705@allcaps.org> Richard A. O'Keefe wrote: > This seems like a very strange choice. > Whoever said that a data structure could have only one level? > When a bunch of abstract values have some properties in common > and some properties that are NOT in common, use two levels (or > more in some cases): Your solution is perfectly fine. However, the extra layer of hierarchy binds me to a structural decision that I may not want to be held to. If I wish to decode those packets in a different language, the hierarchy inserts an extra set of decode steps which need to be compatible with Erlang. I feel this very keenly having just written a decoder for BEAM files in Java. > and write this as > > test() -> > Q0 = queue:new(), > Q1 = queue:in(mk_p2p_syn(1, foo), Q0), > Q2 = queue:in(mk_p2p_fin(9, bar), Q1), I'm not a big fan of lots of make_foo or create_foo functions. It feels like get() and set() functions. It's an extra layer of indirection and the consequent increase in conceptual complexity for very little gain. I would rather keep the basic functions flat and native while making the unusual stuff accessible by function. Normally, I can just access the sequenceNumber directly from the record because I know what the packet is. When I need a generic access (the unusual case), I can call a function that does a pattern match. > I'm a little surprised that the "downcasting" hack worked at all, > and I wouldn't expect it to _keep_ working in future releases. Yeah, I was a bit surprised that it worked, too. Presumably the compiler just does a mapping from record field to tuple position number and doesn't bother checking the first field to make sure that the names match. -a From ulf.wiger@REDACTED Tue Jun 20 09:35:11 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 20 Jun 2006 09:35:11 +0200 Subject: dlialyzer a bit too sceptic? Message-ID: Dialyzer (R11B-0) gave me the following warning on some 'rdbms' code: {rdbms_groups,'-do_add_members/2-fun-0-',2}: Call to function {rdbms_props,do_write_property,2} with signature ((_,{{'acl',atom()} | {'typedef',_} | {'attr',_,_} | 'access_module' | 'acl' | 'indexes' | 'read_filter' | 'rec_type' | 'references' | 'write_filter',_}) -> 'ok') will fail since the arguments are of type ('schema',{{'group',_,'membership'},_})! But the function rdbms_props:do_write_property/2 looks like this: do_write_property(Tab, Prop) -> mnesia_schema:do_write_table_property(Tab, Prop). I.e. absolutely no restrictions on Prop. If one were to introduce one, it would be something similar to that of mnesia_schema:write_table_property/2 - namely that Prop is a tuple with at least one element. write_table_property(Tab, Prop) when tuple(Prop), size(Prop) >= 1 -> schema_transaction(fun() -> do_write_table_property(Tab, Prop) end); write_table_property(Tab, Prop) -> {aborted, {bad_type, Tab, Prop}}. do_write_table_property(Tab, Prop) -> TidTs = get_tid_ts_and_lock(schema, write), {_, _, Ts} = TidTs, Store = Ts#tidstore.store, case change_prop_in_existing_op(Tab, Prop, write_property, Store) of true -> ... %% we have merged the table prop into the create_table op ok; false -> ..., insert_schema_ops(TidTs, make_write_table_properties(Tab, [Prop])) end. It's not at all clear to me why Dialyzer thinks the call would fail. BR, Ulf W From bengt.kleberg@REDACTED Tue Jun 20 09:51:03 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 20 Jun 2006 09:51:03 +0200 Subject: Polymorphic record question In-Reply-To: <449792E9.705@allcaps.org> References: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> <449792E9.705@allcaps.org> Message-ID: <4497A8E7.8040705@ericsson.com> On 2006-06-20 08:17, Andrew Lentvorski wrote: > Richard A. O'Keefe wrote: ...deleted >> I'm a little surprised that the "downcasting" hack worked at all, >> and I wouldn't expect it to _keep_ working in future releases. > > Yeah, I was a bit surprised that it worked, too. Presumably the > compiler just does a mapping from record field to tuple position number > and doesn't bother checking the first field to make sure that the names > match. if you want to discover errors when using records it is best to avoid ''.'' to access the members. see example below: -module(t). -export([main/1]). -record(a,{data=a}). -record(b,{data=b}). main(_) -> A = #a{}, B = #b{}, should_not_work(B, A), will_fail(B, A), init:stop(). should_not_work(A, B) -> A_data = A#a.data, B_data = B#b.data, io:fwrite( "A_data ~w~n", [A_data] ), io:fwrite( "B_data ~w~n", [B_data] ). will_fail(A, B) -> #a{data=A_data} = A, #b{data=B_data} = B, io:fwrite( "A_data ~w~n", [A_data] ), io:fwrite( "B_data ~w~n", [B_data] ). bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From hans.bolinder@REDACTED Tue Jun 20 10:08:10 2006 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Tue, 20 Jun 2006 10:08:10 +0200 Subject: Polymorphic record question In-Reply-To: <4497A8E7.8040705@ericsson.com> References: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> <449792E9.705@allcaps.org> <4497A8E7.8040705@ericsson.com> Message-ID: <17559.44266.607641.325789@gargle.gargle.HOWL> [Bengt Kleberg:] > On 2006-06-20 08:17, Andrew Lentvorski wrote: > > Richard A. O'Keefe wrote: > > ...deleted > >> I'm a little surprised that the "downcasting" hack worked at all, > >> and I wouldn't expect it to _keep_ working in future releases. > > > > Yeah, I was a bit surprised that it worked, too. Presumably the > > compiler just does a mapping from record field to tuple position number > > and doesn't bother checking the first field to make sure that the names > > match. > > if you want to discover errors when using records it is best to avoid > ''.'' to access the members. When given the option 'strict_record_tests' the compiler will emit code that checks the record tag as well. See compile(3). Best regards, Hans Bolinder, Erlang/OTP From bengt.kleberg@REDACTED Tue Jun 20 10:16:33 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 20 Jun 2006 10:16:33 +0200 Subject: Polymorphic record question In-Reply-To: <17559.44266.607641.325789@gargle.gargle.HOWL> References: <200606200126.k5K1Qw5X260211@atlas.otago.ac.nz> <449792E9.705@allcaps.org> <4497A8E7.8040705@ericsson.com> <17559.44266.607641.325789@gargle.gargle.HOWL> Message-ID: <4497AEE1.3050102@ericsson.com> On 2006-06-20 10:08, Hans Bolinder wrote: ...deleted > When given the option 'strict_record_tests' the compiler will emit > code that checks the record tag as well. See compile(3). imho it would be better to check the record tag by default and have a 'no_strict_record_tests' option to the compiler. as usual, i could be wrong. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From thomasl_erlang@REDACTED Tue Jun 20 10:33:28 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 20 Jun 2006 01:33:28 -0700 (PDT) Subject: Polymorphic record question In-Reply-To: <4497AEE1.3050102@ericsson.com> Message-ID: <20060620083328.79565.qmail@web38804.mail.mud.yahoo.com> --- Bengt Kleberg wrote: > On 2006-06-20 10:08, Hans Bolinder wrote: > ...deleted > > When given the option 'strict_record_tests' the > compiler will emit > > code that checks the record tag as well. See > compile(3). > > imho it would be better to check the record tag by > default and have a > 'no_strict_record_tests' option to the compiler. > as usual, i could be wrong. I for one agree with you. The default behaviour is basically a bug. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf.wiger@REDACTED Tue Jun 20 10:52:29 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 20 Jun 2006 10:52:29 +0200 Subject: Summary: E / Erlang integration Message-ID: > From: Michael FIG wrote: > With both of these functions non-blocking, there is a > guarantee that deadlock is impossible. That's the main > property of E programs that I'd like to achieve in > this library. The Erlang philosophy is to provide for synchronous wrappers around asynchronous message passing. Waiting for a response can (and often is) blocking. To reduce the "problem" of blocking, processes are made lightweight enought that it should be feasible to create one concurrent process for each naturally concurrent activity. Thus, the natural thing to do when one needs a response from another process would be to stop and wait for it. My opinion is that it is dangerous to advocate completely non-blocking semantics in complex programs, unless one makes abundantly clear what problems can come of it. I think one of the biggest problems today in the design of complex control logic is the inability to avoid complexity explosion in the state-event matrix. It was suggested that E is able to avoid this, and from a cursory glance at the code in this thread and at erights.org, it seems plausible. I'm not convinced yet that it will be intuitive enough, but maybe... What I do know is that careless use of non-blocking programming in complex control scenarios can very easily blow up in your face, leaving you with an unintelligible and unmanageable mess. What's worse - very few programmers involved in this type of programming are actually aware of what causes these problems. Even in Erlang, many programmers prefer 'cast' to 'call' for performance reasons and/or fear of deadlock, but cast and call are semantically different! If one needs a reply from the other process, a call is natural. Deadlock can occur if two processes try to call each other at the same time (this is the simplest form of deadlock), but changing call to cast doesn't change this - deadlock can still occur, but it will be immensely more difficult to detect. There is a wealth of documentation on deadlock avoidance in the database community. There are also good algorithms, such as the 'banker's algorithm' to ensure freedom of deadlock. The reason why no DBMSs use the algorithm is that it requires all resource dependencies to be known up-front. Deadlock detection is relatively easy to implement, unless the system is distributed. Deadlock prevention works in a distributed setting, but may cause 'phantom deadlocks'. One has to pick the right poison. Erlang doesn't solve the problem of deadlock, just as it doesn't solve the problem of complexity explosion. It has a programming model that seems pretty intuitive and, if followed, tends to reduce (perhaps eliminate) some of the very hairiest problems. You'll be left with some smaller problems (unnecessary serialization, forgotten messages in message queues, etc.) but these are relatively easy to detect and solve. Regards, Ulf W From stefan.l.axelsson@REDACTED Tue Jun 20 14:28:43 2006 From: stefan.l.axelsson@REDACTED (Stefan Axelsson L (LN/EAB)) Date: Tue, 20 Jun 2006 14:28:43 +0200 Subject: Bug in HiPE on x86-64? Message-ID: <6D145AB0AF765D4988C49705263A1DBC03D17013@esealmw106.eemea.ericsson.se> Hi, I'm seeing different behaviour depending on whether a module is compiled with HiPE and without, when I make a call with a function argument. It works when I wrap the function in an anonymous function though. Is this a feature or a bug? I've read the documentation and while there are a few differences noted, nothing really jumps out at me that would explain this (I'm a relative newbie to Erlang, so that's not to say isn't in there of course). Below are a few test cases that provoke the deviation. In the first case the evaluation succeeds and in the second I get an error message. Removing the -smp switch makes no difference. As mentioned, invoking the test as: "merge_sort:test_sort(1000000, 1, fun(N,Xs)-> merge_sort:merge_sort(N,Xs) end)/1000000." works, i.e. Produces the expected results. This is on an AMD Opteron x86-64. The code and details are included below. ------------------------------------------------------------------------ ------------- sax@REDACTED:~/Erlang> erl -smp Erlang (BEAM) emulator version 5.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] Eshell V5.5 (abort with ^G) 1> c(merge_sort). {ok,merge_sort} 2> merge_sort:test_sort(1000000, 1, fun merge_sort:merge_sort/2)/1000000. 2.69710 ------------------------------------------------------------------------ ------------- sax@REDACTED:~/Erlang> erl -smp Erlang (BEAM) emulator version 5.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] Eshell V5.5 (abort with ^G) 1> c(merge_sort,native). {ok,merge_sort} 2> merge_sort:test_sort(1000000, 1, fun merge_sort:merge_sort/2)/1000000. ** exited: {{badfun,#Fun},[]} ** 3> =ERROR REPORT==== 20-Jun-2006::11:10:20 === Error in process <0.32.0> with exit value: {{badfun,#Fun},[]} ------------------------------------------------------------------------ -------------- sax@REDACTED:~/Erlang> erl -smp Erlang (BEAM) emulator version 5.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] Eshell V5.5 (abort with ^G) 1> c(merge_sort,native). {ok,merge_sort} 2> merge_sort:test_sort(1000000, 1, fun(N,Xs)-> merge_sort:merge_sort(N,Xs) end)/1000000. 2.65750 3> ------------------------------------------------------------------------ -------------- Same results in all cases without -smp. sax@REDACTED:~/Erlang> uname -a Linux genset01 2.6.5-7.191-smp #1 SMP Tue Jun 28 14:58:56 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux ------------------------------------------------------------------------ -------------- -module(merge_sort). -export([merge_sort/2, sorter/2, randlist/2, test_sort/3]). % Multi threaded merge sort. Spawn as many processes as there are % processors (n). Let each sort 1/n of the input. Merge the results. % Split a list into a lists of N lists, could do with a pair of % reverse to fix the problem that the big lists come at the end. split_list(0, Xs) -> Xs; split_list(N, Xs) -> {Hs, Ts} = lists:split(trunc(length(Xs)/N), Xs), [Hs | split_list(N-1, Ts) ]. % Do N receive messages and return list of all results regardless of % what message was do_receive(N) -> do_receive(N, []). do_receive(0, A) -> A; do_receive(N, A) -> receive X -> do_receive(N-1, [X|A]) end. % S sorting process, that sorts a list and sends the result back sorter(Receiver, Xs) -> % io:format("~w sorting length ~p ~n", [self(), length(Xs)]), % Brag about parallelism Receiver ! lists:sort(Xs). % Spawn N processes, let them sort and merge the results % The merge ought to be tree like with the merging in steps in parallel? merge_sort(N, Xs) -> Me = self(), Lists = split_list(N, Xs), % One chunk per process lists:foreach(fun(Zs) -> spawn(merge_sort, sorter, [Me, Zs]) end, Lists), Sorts = do_receive(N), % Collect results % lists:foldr(fun(X,Y) -> lists:merge(X,Y) end, [], Sorts). % Merge lists:merge(Sorts). % Merge % Randlist, generate a random list of length N with ints between 1-K randlist(N, K) -> lists:map(fun(_) -> random:uniform(K) end, lists:duplicate(N, 0)). % Test the sort, generate a random list of length M and sort with N processes, % return the number of microseconds % Ex: merge_sort:test_sort(1000000, 2, fun merge_sort:merge_sort/2)/1000000. test_sort(M, N, The_sort) -> Tests = randlist(M, 400000000), {StMs, StS, StUS} = now(), % St(art) M(ega)sec, sec, usecs The_sort(N, Tests), {EnMs, EnS, EnUS} = now(), % E(nd) M(ega)sec etc. (EnUS-StUS) + (EnS-StS)*1000000 + (EnMs-StMs)*1000000*1000000. ------------------------------------------------------------------------ -------------- Best Regards, -- Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 3963 (mobile/work) From maruthavanan_s@REDACTED Tue Jun 20 14:55:20 2006 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Tue, 20 Jun 2006 12:55:20 +0000 Subject: Logs Message-ID: An HTML attachment was scrubbed... URL: From mikpe@REDACTED Tue Jun 20 17:52:31 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 20 Jun 2006 17:52:31 +0200 Subject: Bug in HiPE on x86-64? In-Reply-To: <6D145AB0AF765D4988C49705263A1DBC03D17013@esealmw106.eemea.ericsson.se> References: <6D145AB0AF765D4988C49705263A1DBC03D17013@esealmw106.eemea.ericsson.se> Message-ID: <17560.6591.463985.794550@alkaid.it.uu.se> Stefan Axelsson L \(LN/EAB\) writes: > Hi, I'm seeing different behaviour depending on whether a module is > compiled with HiPE and without, when I make a call with a function > argument. It works when I wrap the function in an anonymous function > though. Is this a feature or a bug? I've read the documentation and > while there are a few differences noted, nothing really jumps out at me > that would explain this (I'm a relative newbie to Erlang, so that's not > to say isn't in there of course). > > Below are a few test cases that provoke the deviation. In the first case > the evaluation succeeds and in the second I get an error message. > Removing the -smp switch makes no difference. As mentioned, invoking the > test as: "merge_sort:test_sort(1000000, 1, fun(N,Xs)-> > merge_sort:merge_sort(N,Xs) end)/1000000." works, i.e. Produces the > expected results. > > This is on an AMD Opteron x86-64. The code and details are included > below. ... > sax@REDACTED:~/Erlang> erl -smp > Erlang (BEAM) emulator version 5.5 [source] [64-bit] [smp:2] > [async-threads:0] [hipe] > > Eshell V5.5 (abort with ^G) > 1> c(merge_sort,native). > {ok,merge_sort} > 2> merge_sort:test_sort(1000000, 1, fun > merge_sort:merge_sort/2)/1000000. > ** exited: {{badfun,#Fun},[]} ** > 3> > =ERROR REPORT==== 20-Jun-2006::11:10:20 === > Error in process <0.32.0> with exit value: > {{badfun,#Fun},[]} I've reproduced this problem on 32-bit PowerPC. It's not dependent on architecture or word size; instead, the issue appears to be that these pseudo-closures (values of fun M:F/A expressions) aren't recognized by HiPE-generated code as function values. Thanks for reporting this. We'll look into it. /Mikael From chandrashekhar.mullaparthi@REDACTED Tue Jun 20 18:03:28 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 20 Jun 2006 17:03:28 +0100 Subject: Article on FP praising Erlang! Message-ID: Came across this link on reddit.com about FP and it talks about Erlang a lot. http://www.defmacro.org/ramblings/fp.html Enjoy! Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From igor@REDACTED Tue Jun 20 18:18:56 2006 From: igor@REDACTED (Igor Goryachev) Date: Tue, 20 Jun 2006 20:18:56 +0400 Subject: huge list matching -- different behaviour on x86_32 and x86_64 In-Reply-To: <87wtbdc7b7.fsf@goryachev.org> (Igor Goryachev's message of "Mon, 19 Jun 2006 22:46:20 +0400") References: <87zmgepguz.fsf@goryachev.org> <87wtbdc7b7.fsf@goryachev.org> Message-ID: <878xnrvlzj.fsf@goryachev.org> On 19 Jun 2006, Igor Goryachev wrote: >>> I have experienced a different behaviour and possibly a weird result >>> while playing with matching a huge lists on x86_32 and x86_64 >>> machines. Version r10b10 was used in both cases. >>> >> >> The problem was in the loader. The following patch resolves the >> problem at least in R11B-0. (It will probably work if applied to >> R10B-10 too, but I have not tested that.) > > Many thanks, Bjorn. I will test this patch tomorrow morning. This patch seems to fix the problem. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED From fig@REDACTED Tue Jun 20 20:27:52 2006 From: fig@REDACTED (Michael FIG) Date: Tue, 20 Jun 2006 12:27:52 -0600 (CST) Subject: Summary: E / Erlang integration Message-ID: <33353901.13691150828072351.JavaMail.root@zimbra> Thank you for this excellent post. I greatly value being able to learn from people who have experience with the hard problems. Now that I've actually been working on a prototype implementation, I'm getting closer to something that is close enough to E's structure hopefully to spur future discussion. I'm still heading towards a "capabilities on Erlang" library, with a model for execution of untrusted code, but I'm curious if the end result will be useful to others. It's been a fun exercise for me, at the very least. -- Michael FIG ----- Original Message ----- From: Ulf Wiger (AL/EAB) To: Michael FIG Cc: erlang-questions@REDACTED, Discussion of E and other capability languages Sent: Tuesday, June 20, 2006 2:52:29 AM GMT-0200 Subject: RE: Summary: E / Erlang integration > From: Michael FIG wrote: > With both of these functions non-blocking, there is a > guarantee that deadlock is impossible. That's the main > property of E programs that I'd like to achieve in > this library. The Erlang philosophy is to provide for synchronous wrappers around asynchronous message passing. Waiting for a response can (and often is) blocking. To reduce the "problem" of blocking, processes are made lightweight enought that it should be feasible to create one concurrent process for each naturally concurrent activity. Thus, the natural thing to do when one needs a response from another process would be to stop and wait for it. My opinion is that it is dangerous to advocate completely non-blocking semantics in complex programs, unless one makes abundantly clear what problems can come of it. I think one of the biggest problems today in the design of complex control logic is the inability to avoid complexity explosion in the state-event matrix. It was suggested that E is able to avoid this, and from a cursory glance at the code in this thread and at erights.org, it seems plausible. I'm not convinced yet that it will be intuitive enough, but maybe... What I do know is that careless use of non-blocking programming in complex control scenarios can very easily blow up in your face, leaving you with an unintelligible and unmanageable mess. What's worse - very few programmers involved in this type of programming are actually aware of what causes these problems. Even in Erlang, many programmers prefer 'cast' to 'call' for performance reasons and/or fear of deadlock, but cast and call are semantically different! If one needs a reply from the other process, a call is natural. Deadlock can occur if two processes try to call each other at the same time (this is the simplest form of deadlock), but changing call to cast doesn't change this - deadlock can still occur, but it will be immensely more difficult to detect. There is a wealth of documentation on deadlock avoidance in the database community. There are also good algorithms, such as the 'banker's algorithm' to ensure freedom of deadlock. The reason why no DBMSs use the algorithm is that it requires all resource dependencies to be known up-front. Deadlock detection is relatively easy to implement, unless the system is distributed. Deadlock prevention works in a distributed setting, but may cause 'phantom deadlocks'. One has to pick the right poison. Erlang doesn't solve the problem of deadlock, just as it doesn't solve the problem of complexity explosion. It has a programming model that seems pretty intuitive and, if followed, tends to reduce (perhaps eliminate) some of the very hairiest problems. You'll be left with some smaller problems (unnecessary serialization, forgotten messages in message queues, etc.) but these are relatively easy to detect and solve. Regards, Ulf W -- MarkeTel Systems has made every effort to ensure this message is virus-free. Our mail server uses multiple virus scanners to provide maximum protection. From yarivvv@REDACTED Tue Jun 20 22:02:03 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 20 Jun 2006 16:02:03 -0400 Subject: Article on FP praising Erlang! In-Reply-To: References: Message-ID: <17244f480606201302h45502148s94a857f9719d522@mail.gmail.com> Very interesting and well written article! I have two questions about some of the author's points: - Erlang doesn't support currying, does it? Will it ever? - It would be interesting to take advantage of continuations in Yaws. I suppose one could save the continuation in a session variable, but I'm not entirely sure about the specifics. Has anybody done this? Regards, Yariv On 6/20/06, Chandru wrote: > Came across this link on reddit.com about FP and it talks about Erlang a > lot. > > http://www.defmacro.org/ramblings/fp.html > > Enjoy! > Chandru > > From hokan.stenholm@REDACTED Tue Jun 20 23:45:08 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Tue, 20 Jun 2006 23:45:08 +0200 Subject: are Mnesia tables immutable? In-Reply-To: <17244f480606191551n5d4d3926hbd3b964df19600aa@mail.gmail.com> References: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> <44971854.6080408@bredband.net> <17244f480606191551n5d4d3926hbd3b964df19600aa@mail.gmail.com> Message-ID: <44986C64.90703@bredband.net> Yariv Sadan wrote: > Yes, I should have realized that... I'm still new to Erlang and > functional programming so the concept of immutable data structures > still needs to settle fully in my brain. I have been writing some > parsing code and have been quite paranoid about making horribly > inefficient use of lists. Most list operations are not particulary costly. * traversing list e.g. "hd(List)" or "[H | R] = List" is a O(1) operation. * building lists by adding to the front e.g. "NewList = [H | OldList]" is a O(1) operation. * reversing a list is a O(N) operation. * the various lists:map/foldl/foreach operations and list comprehension work over lists, in O(N) time. But you should carefull when using "NewList = List1 ++ List2" (and other list append functions) especialy in loops where you build a lot of NewList entries, as it is a O(N) operation (N = length of List1). It is also generaly a bad idea to use nth(List, Nth) to do random list access, this is a O(N) operation as each nth(...) call traverses the list until it gets to the Nth list position. Tuples/Records (they are essentialy the same thing) have slightly different properties: * access is O(1) * updates are O(N), where N is the size of the tuple - but only a array of pointers (pointing to other erlang terms) is created when a new tuple is created, so if the tuple isn't very large (< 100 elements (?)) or the tuple isn't used often - there should be little performance cost. This means that tuples/records work well in the role of C structs or Java classes, but are a bad choice for large arrays that need random access updates (sequential data processing is best done with lists) If you needs random write access your basicly stuck with trees, ets tables or the even slower mnesia tables (slower due to their database transaction support). Note: that lists (sequential list traversal) and tuples/records are the fastest types for read operations, while adding elements to the front of a list - "NewList = [H | OldList]" is the fastest way to build a new data structure. > > It did occur to me that it would be useful to have a API for > efficiently handling large strings. It would have similar function > signatures to regular strings, but the implementation would involve > less copying. Does such an API exist? Erlang is somewhat weak in the area of strings (strings where not a main concern when erlang was begin designed to be used in Ericssons telecom products - switches ... etc): * erlang strings are implemented as lists of (8 bit) integers - while this makes it easy to use lists functions on strings this also means that strings take a lot of space, ~2 words (2 * 32 bit on a 32 bit CPU). * erlang strings and string operations assume that characters are 8 bit, latin-1 encodes characters. There are several ways to handle this if it becomes a performance/size issue: * chars can be stored more compactly - chars can for example be packed into binaries (allowing for a N byte sized char to fit in N bytes of memory). * string data could be preprocessed by other unix tools, better suited for fast text processing, before passing the data to erlang * lines-1.1 at http://erlang.org/user.html may be useful to handle large strings. You may also find stuff here: http://www.erlang-projects.org/ http://planeterlang.org/ > > Regards, > Yariv > > On 6/19/06, H?kan Stenholm wrote: > >> Yariv Sadan wrote: >> >> > Hi, >> > >> > I have a rather basic question: does Erlang's lack of mutable data >> > structures mean that every time you modify a Mnesia (ets) table, the >> > whole table is copied? This sounds very expensive... am I missing >> > something? >> > >> Most data structures are non-mutable but mnesia, ets tables and process >> dictionaries _are_ mutable, data is copied in and out of mnesia/ets when >> accessing - it helps to think of them as erlang processes that one can >> send (write) and recieve (read) messages to/from. >> >> Also note that a non-mutable datastructure doesn't necessarily need to >> copy everything, it's often sufficient, to build a new datastructure >> using mostly old unchanged parts. There are for example tree based data >> structures like gb_trees, that have O(log N) read and write costs - >> only a single tree branch is traveresed or updated, when accessing a >> specific tree element. >> >> > Thanks >> > Yariv >> > >> >> > From bruce1828@REDACTED Wed Jun 21 00:16:52 2006 From: bruce1828@REDACTED (Bruce Bailey) Date: Tue, 20 Jun 2006 15:16:52 -0700 Subject: Problems Building ErLang R11B Message-ID: I hope this is the right place for these types of questions . . . While trying to build version R11B (otp_src_R11B-0.tar.gz), I encountered several problems (segfaults, compile errors, etc. see below). Can anyone suggest anyway to get past this? Thanks in advance, Bruce ********************** Software Versions ********************** Os: Linux C126215 2.4.18-27.8.0-3 #1 Tue Jan 18 04:26:03 PST 2005 i686 i686 i386 GNU/Linux Java version: 1.4.0_03 OpenSSL 0.9.7c 30 Sep 2003 ********************** Build Errors ********************** erlc -W +debug_info +strict_record_tests -o../ebin gse.erl erl -pa ../ebin -s gs_make -s erlang halt -noshell make[3]: *** [gstk_generic.hrl] Segmentation fault (core dumped) erlc -W +debug_info +strict_record_tests -o./ mk_ssl_pkix_oid.erl erl -pa ../ebin -noshell -s mk_ssl_pkix_oid make -s erlang halt make[3]: *** [ssl_pkix_oid.erl] Segmentation fault (core dumped) cd src; erlc -W -o ../ebin make_certs.erl erl -noinput -pa ebin -run make_certs all /bjb/bin/openssl \ -s erlang halt make[4]: *** [done] Segmentation fault (core dumped) erlc -W +debug_info +strict_record_tests -I/bjb/tmp/otp_src_R11B-0/lib/kernel/src -I../include +warn_unused_vars -DVSN=\"3.0.12\" -o../ebin ssl_pkix.erl ./ssl_pkix.hrl:19: can't find include file "SSL-PKIX.hrl" ./ssl_pkix.erl:78: record 'Certificate' undefined ./ssl_pkix.erl:79: record 'Certificate' undefined ./ssl_pkix.erl:91: record 'TBSCertificate' undefined ./ssl_pkix.erl:92: record 'TBSCertificate' undefined ./ssl_pkix.erl:102: record 'SignatureAlgorithm-Any' undefined ./ssl_pkix.erl:108: record 'SignatureAlgorithm' undefined ./ssl_pkix.erl:109: record 'SignatureAlgorithm' undefined ./ssl_pkix.erl:118: record 'AttributeTypeAndValue' undefined ./ssl_pkix.erl:122: record 'AttributeTypeAndValue' undefined ./ssl_pkix.erl:123: record 'AttributeTypeAndValue' undefined ./ssl_pkix.erl:137: record 'SubjectPublicKeyInfo' undefined ./ssl_pkix.erl:140: record 'SubjectPublicKeyInfo' undefined ./ssl_pkix.erl:143: record 'SubjectPublicKeyInfo' undefined ./ssl_pkix.erl:145: record 'PublicKeyAlgorithm' undefined ./ssl_pkix.erl:148: record 'SubjectPublicKeyInfo-Any' undefined ./ssl_pkix.erl:157: record 'SubjectPublicKeyInfo' undefined ./ssl_pkix.erl:158: record 'SubjectPublicKeyInfo_algorithm' undefined ./ssl_pkix.erl:160: record 'SubjectPublicKeyInfo_algorithm' undefined ./ssl_pkix.erl:162: record 'SubjectPublicKeyInfo' undefined ./ssl_pkix.erl:164: record 'Extension' undefined ./ssl_pkix.erl:165: record 'Extension' undefined ./ssl_pkix.erl:170: record 'Extension' undefined ./ssl_pkix.erl:183: record 'Certificate' undefined ./ssl_pkix.erl:183: record 'TBSCertificate' undefined ./ssl_pkix.erl:108: Warning: variable 'NAlgo' is unused ./ssl_pkix.erl:122: Warning: variable 'Type' is unused ./ssl_pkix.erl:141: Warning: variable 'Algo' is unused ./ssl_pkix.erl:142: Warning: variable 'Parameters' is unused ./ssl_pkix.erl:145: Warning: variable 'AlgorithmAny' is unused ./ssl_pkix.erl:147: Warning: variable 'Bin' is unused ./ssl_pkix.erl:159: Warning: variable 'NAlgoCd' is unused ./ssl_pkix.erl:160: Warning: variable 'NAlgorithmCd' is unused ./ssl_pkix.erl:165: Warning: variable 'NExtID' is unused ./ssl_pkix.erl:175: Warning: function transform_extensions/1 is unused make[3]: *** [../ebin/ssl_pkix.beam] Error 1 /usr/bin/install -c -d /bjb/tmp/otp_src_R11B-0/erts/start_scripts/tmp ( cd /bjb/tmp/otp_src_R11B-0/erts/start_scripts/tmp && \ erlc -W -I/bjb/tmp/otp_src_R11B-0/lib/kernel/ebin -I/bjb/tmp/otp_src_R11B-0/lib/stdlib/ebin -I/bjb/tmp/otp_src_R11B-0/lib/sasl/ebi n -o /bjb/tmp/otp_src_R11B-0/erts/start_scripts/start_sasl.boot /bjb/tmp/otp_src_R11B-0/erts/start_scripts/start_sasl.rel ) /usr/bin/install -c -d /bjb/tmp/otp_src_R11B-0/erts/start_scripts/tmp ( cd /bjb/tmp/otp_src_R11B-0/erts/start_scripts/tmp && \ erl -boot start_clean -noinput +B -eval 'release_handler:create_RELEASES("%ERL_ROOT%", "/bjb/tmp/otp_src_R11B-0/erts/start_scripts", "/bjb/tmp/otp_src_R11B-0/erts/start_scripts/start_sasl.rel", []), halt()') make[2]: *** [RELEASES.src] Error 139 make[2]: Leaving directory `/bjb/tmp/otp_src_R11B-0/erts/start_scripts' make[1]: *** [local_setup] Error 2 make[1]: Leaving directory `/bjb/tmp/otp_src_R11B-0/erts' make: *** [local_setup] Error 2 _________________________________________________________________ Is your PC infected? Get a FREE online computer virus scan from McAfee? Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From ok@REDACTED Wed Jun 21 01:46:15 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 21 Jun 2006 11:46:15 +1200 (NZST) Subject: Article on FP praising Erlang! Message-ID: <200606202346.k5KNkFeH269345@atlas.otago.ac.nz> "Yariv Sadan" wrote: - Erlang doesn't support currying, does it? Will it ever? Let's be clear about what we're asking for. "Currying" is the process of taking a function f : A x B -> C and returning a function f' : A -> B -> C We can do that right now: curry2(F) -> fun (A) -> fun (B) -> F(A,B) end end. curry3(F) -> fun (A) -> fun (B,C) -> F(A,B,C) end end. curry4(F) -> fun (A) -> fun (B,C,D) -> F(A,B,C,D) end end. plus(X, Y) -> X + Y. Now we can write things like lists:map(curry2(plus)(42), [1,2,3]) Except we can't. curry(plus)(42) is a syntax error. I suppose to count as "supporting" currying, Erlang would have to allow this. So we change that to F = curry2(plus), lists:map(F(42), [1,2,3]) and of course _that_ doesn't work either, because 'plus' is an atom, not a function. So we see that the way to curry a function in Erlang is F = curry2(fun plus/2), lists:map(F(42), [1,2,3]). which is admittedly clumsy, but it does work, so arguably Erlang supports currying right now, and has ever since funs were introduced. I would tend to add curry2(F, A) -> fun (B) -> F(A,B) end. curry3(F, A) -> fun (B,C) -> F(A,B,C) end. curry4(F, A) -> fun (B,C,D) -> F(A,B,C,D) end. and then use lists:map(curry2(fun plus/2, 42), [1,2,3]) Having used Clean and Haskell, where functions are "born" curried, and SML, where traditional usage (hard-wired into binary operators) passes tuples to functions, and Lisp and R, where functions are not generally unary at all, I have to say that curried functions work well in a language built from the ground up for that kind of use, but tend to be clumsy in thought and in use in other languages. I _could_ write currying functions for R, but I can't think when I'd ever want to use them, for example. The "natural" thing to do in languages like Lisp, R, and Erlang, is to define ad-hoc lambdas (funs) on the few occasions when currying would have been any use. From ok@REDACTED Wed Jun 21 01:57:25 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 21 Jun 2006 11:57:25 +1200 (NZST) Subject: Polymorphic record question Message-ID: <200606202357.k5KNvP7l269349@atlas.otago.ac.nz> Andrew Lentvorski wrote: However, the extra layer of hierarchy binds me to a structural decision that I may not want to be held to. That is the point of introducing access functions. If I wish to decode those packets in a different language, the hierarchy inserts an extra set of decode steps which need to be compatible with Erlang. The answer is to write a tool that takes a description of a data type and generates an encoder or decoder. It might as well generate the -record declarations and Erlang code as well. The last thing you would want to do is to write en/decoders by hand, because then it is fatally easy for them to get out of synch. I'm not a big fan of lots of make_foo or create_foo functions. It feels like get() and set() functions. It's an extra layer of indirection and the consequent increase in conceptual complexity for very little gain. You get the possibility of multiple creators. You get the possibility of data-dependent creation, where calling a creation function with certain values causes one kind of result to be built and other values cause another kind of result to be built. You get a certain amount of future-proofing. Of course, what you *really* want is abstract patterns, which can solve your original problem exactly the way you'd like to solve it. From yarivvv@REDACTED Wed Jun 21 07:36:04 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 21 Jun 2006 01:36:04 -0400 Subject: are Mnesia tables immutable? In-Reply-To: <44986C64.90703@bredband.net> References: <17244f480606191259q2c7097dduf46c0d0e14e57c34@mail.gmail.com> <44971854.6080408@bredband.net> <17244f480606191551n5d4d3926hbd3b964df19600aa@mail.gmail.com> <44986C64.90703@bredband.net> Message-ID: <17244f480606202236j762757ads778981d191017edd@mail.gmail.com> > > Most list operations are not particulary costly. > > * traversing list e.g. "hd(List)" or "[H | R] = List" is a O(1) > operation. > * building lists by adding to the front e.g. "NewList = [H | OldList]" > is a O(1) operation. > * reversing a list is a O(N) operation. > * the various lists:map/foldl/foreach operations and list comprehension > work over lists, in O(N) time. > > But you should carefull when using "NewList = List1 ++ List2" (and > other list append functions) especialy in loops where you build a lot of > NewList entries, as it is a O(N) operation (N = length of List1). > > It is also generaly a bad idea to use nth(List, Nth) to do random list > access, this is a O(N) operation as each nth(...) call traverses the > list until it gets to the Nth list position. > > > Tuples/Records (they are essentialy the same thing) have slightly > different properties: > > * access is O(1) > * updates are O(N), where N is the size of the tuple - but only a array > of pointers (pointing to other erlang terms) is created when a new tuple > is created, so if the tuple isn't very large (< 100 elements (?)) or the > tuple isn't used often - there should be little performance cost. > This means that tuples/records work well in the role of C structs or > Java classes, but are a bad choice for large arrays that need random > access updates (sequential data processing is best done with lists) > > If you needs random write access your basicly stuck with trees, ets > tables or the even slower mnesia tables (slower due to their database > transaction support). > > Note: that lists (sequential list traversal) and tuples/records are the > fastest types for read operations, while adding elements to the front of > a list - "NewList = [H | OldList]" is the fastest way to build a new > data structure. > > > > > It did occur to me that it would be useful to have a API for > > efficiently handling large strings. It would have similar function > > signatures to regular strings, but the implementation would involve > > less copying. Does such an API exist? > > Erlang is somewhat weak in the area of strings (strings where not a main > concern when erlang was begin designed to be used in Ericssons telecom > products - switches ... etc): > * erlang strings are implemented as lists of (8 bit) integers - while > this makes it easy to use lists functions on strings this also means > that strings take a lot of space, ~2 words (2 * 32 bit on a 32 bit CPU). > * erlang strings and string operations assume that characters are 8 bit, > latin-1 encodes characters. > > > There are several ways to handle this if it becomes a performance/size > issue: > * chars can be stored more compactly - chars can for example be packed > into binaries (allowing for a N byte sized char to fit in N bytes of > memory). > * string data could be preprocessed by other unix tools, better suited > for fast text processing, before passing the data to erlang > * lines-1.1 at http://erlang.org/user.html may be useful to handle large > strings. > > You may also find stuff here: > http://www.erlang-projects.org/ > http://planeterlang.org/ > Thanks, Hokan. This is very useful. I did initially make the mistake of abusing the ++ operator in iterative functions because I wanted to end up with a single string, not a nested structure of lists. However, I saw in the Erlang efficiency guide that Erlang knows how to automatically serialize nested lists as a single character stream, which made me realize that appending new lists to the beginning of an accumulator is the right thing to do. I looked at the lines module, and it does seem pretty close to what I had in mind. I was thinking more along the lines of a generic string container that allows efficient (less than O(n)) modification and random access of strings, which would work by breaking the string up into a tree of some sorts. Lines, if I understand correctly, is similar, but it requires the user to do the chunking. Are Erlang's drawbacks with regards to efficient string manipulation shared among all functional languages? I was planning on writing a Google killer in Erlang, and this new knowledge makes me rethink this strategy :) Best, Yariv From yarivvv@REDACTED Wed Jun 21 03:42:48 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 20 Jun 2006 21:42:48 -0400 Subject: Article on FP praising Erlang! In-Reply-To: <200606202346.k5KNkFeH269345@atlas.otago.ac.nz> References: <200606202346.k5KNkFeH269345@atlas.otago.ac.nz> Message-ID: <17244f480606201842v10c223bai552f5a97353e838e@mail.gmail.com> On 6/20/06, Richard A. O'Keefe wrote: > "Yariv Sadan" wrote: > - Erlang doesn't support currying, does it? Will it ever? > > Let's be clear about what we're asking for. > "Currying" is the process of taking a function > f : A x B -> C > and returning a function > f' : A -> B -> C > > We can do that right now: > > curry2(F) -> fun (A) -> fun (B) -> F(A,B) end end. > curry3(F) -> fun (A) -> fun (B,C) -> F(A,B,C) end end. > curry4(F) -> fun (A) -> fun (B,C,D) -> F(A,B,C,D) end end. > > plus(X, Y) -> X + Y. > > Now we can write things like > > lists:map(curry2(plus)(42), [1,2,3]) > > Except we can't. curry(plus)(42) is a syntax error. > I suppose to count as "supporting" currying, Erlang would have to allow this. > So we change that to > > F = curry2(plus), > lists:map(F(42), [1,2,3]) > > and of course _that_ doesn't work either, because 'plus' is an atom, > not a function. So we see that the way to curry a function in Erlang > is > > F = curry2(fun plus/2), > lists:map(F(42), [1,2,3]). > > which is admittedly clumsy, but it does work, so arguably Erlang supports > currying right now, and has ever since funs were introduced. > > I would tend to add > > curry2(F, A) -> fun (B) -> F(A,B) end. > curry3(F, A) -> fun (B,C) -> F(A,B,C) end. > curry4(F, A) -> fun (B,C,D) -> F(A,B,C,D) end. > > and then use > > lists:map(curry2(fun plus/2, 42), [1,2,3]) > > Having used Clean and Haskell, where functions are "born" curried, and > SML, where traditional usage (hard-wired into binary operators) passes > tuples to functions, and Lisp and R, where functions are not generally > unary at all, > I have to say that curried functions work well in a language built from > the ground up for that kind of use, but tend to be clumsy in thought and > in use in other languages. I _could_ write currying functions for R, > but I can't think when I'd ever want to use them, for example. The > "natural" thing to do in languages like Lisp, R, and Erlang, is to > define ad-hoc lambdas (funs) on the few occasions when currying would have > been any use. > Richard, thanks for the explanation. I'm still learning Erlang and I don't have a full grip on its nuances yet :) So, one could use fun expressions in Erlang to acheive the same end as currying, or "binding" a parameter to a function. I was wondering whether Erlangers think it would be desirable to add "built in" support for currying to Erlang, similar to other languages such as OCaml and Haskell. With "build in" currying, the plus() example could be written as (hypothetically): lists:map(plus(42), [1,2,3]). I'm sure this issue has been discussed extensively, but I thought this is a good opportunity to ask given that the article mentioned Currying as a parallel to the Adapter pattern in the OOP world. Regards, Yariv From raimo@REDACTED Wed Jun 21 08:45:16 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 21 Jun 2006 08:45:16 +0200 Subject: are Mnesia tables immutable? References: <17244f480606191551n5d4d3926hbd3b964df19600aa@mail.gmail.com>, <44986C64.90703@bredband.net>, <17244f480606202236j762757ads778981d191017edd@mail.gmail.com> Message-ID: You can consider to use binaries for holding strings. They are designed to hold 8-bit (or 16-bit (or any-bit-divisible by 8)) data, random access. Care must be taken when creating them, though; not to build them as lists - concatenating binaries builds a new one and the old will become garbage. Lots of copying and lots of garbage collect. yarivvv@REDACTED (Yariv Sadan) writes: > > > > Most list operations are not particulary costly. > > > > * traversing list e.g. "hd(List)" or "[H | R] = List" is a O(1) > > operation. > > * building lists by adding to the front e.g. "NewList = [H | OldList]" > > is a O(1) operation. > > * reversing a list is a O(N) operation. > > * the various lists:map/foldl/foreach operations and list comprehension > > work over lists, in O(N) time. > > > > But you should carefull when using "NewList = List1 ++ List2" (and > > other list append functions) especialy in loops where you build a lot of > > NewList entries, as it is a O(N) operation (N = length of List1). > > > > It is also generaly a bad idea to use nth(List, Nth) to do random list > > access, this is a O(N) operation as each nth(...) call traverses the > > list until it gets to the Nth list position. > > > > > > Tuples/Records (they are essentialy the same thing) have slightly > > different properties: > > > > * access is O(1) > > * updates are O(N), where N is the size of the tuple - but only a array > > of pointers (pointing to other erlang terms) is created when a new tuple > > is created, so if the tuple isn't very large (< 100 elements (?)) or the > > tuple isn't used often - there should be little performance cost. > > This means that tuples/records work well in the role of C structs or > > Java classes, but are a bad choice for large arrays that need random > > access updates (sequential data processing is best done with lists) > > > > If you needs random write access your basicly stuck with trees, ets > > tables or the even slower mnesia tables (slower due to their database > > transaction support). > > > > Note: that lists (sequential list traversal) and tuples/records are the > > fastest types for read operations, while adding elements to the front of > > a list - "NewList = [H | OldList]" is the fastest way to build a new > > data structure. > > > > > > > > It did occur to me that it would be useful to have a API for > > > efficiently handling large strings. It would have similar function > > > signatures to regular strings, but the implementation would involve > > > less copying. Does such an API exist? > > > > Erlang is somewhat weak in the area of strings (strings where not a main > > concern when erlang was begin designed to be used in Ericssons telecom > > products - switches ... etc): > > * erlang strings are implemented as lists of (8 bit) integers - while > > this makes it easy to use lists functions on strings this also means > > that strings take a lot of space, ~2 words (2 * 32 bit on a 32 bit CPU). > > * erlang strings and string operations assume that characters are 8 bit, > > latin-1 encodes characters. > > > > > > There are several ways to handle this if it becomes a performance/size > > issue: > > * chars can be stored more compactly - chars can for example be packed > > into binaries (allowing for a N byte sized char to fit in N bytes of > > memory). > > * string data could be preprocessed by other unix tools, better suited > > for fast text processing, before passing the data to erlang > > * lines-1.1 at http://erlang.org/user.html may be useful to handle large > > strings. > > > > You may also find stuff here: > > http://www.erlang-projects.org/ > > http://planeterlang.org/ > > > > Thanks, Hokan. This is very useful. I did initially make the mistake > of abusing the ++ operator in iterative functions because I wanted to > end up with a single string, not a nested structure of lists. However, > I saw in the Erlang efficiency guide that Erlang knows how to > automatically serialize nested lists as a single character stream, > which made me realize that appending new lists to the beginning of an > accumulator is the right thing to do. > > I looked at the lines module, and it does seem pretty close to what I > had in mind. I was thinking more along the lines of a generic string > container that allows efficient (less than O(n)) modification and > random access of strings, which would work by breaking the string up > into a tree of some sorts. Lines, if I understand correctly, is > similar, but it requires the user to do the chunking. > > Are Erlang's drawbacks with regards to efficient string manipulation > shared among all functional languages? I was planning on writing a > Google killer in Erlang, and this new knowledge makes me rethink this > strategy :) > > Best, > Yariv -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ok@REDACTED Wed Jun 21 08:48:14 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 21 Jun 2006 18:48:14 +1200 (NZST) Subject: are Mnesia tables immutable? Message-ID: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> "Yariv Sadan" wrote: I looked at the lines module, and it does seem pretty close to what I had in mind. I was thinking more along the lines of a generic string container that allows efficient (less than O(n)) modification and random access of strings, which would work by breaking the string up into a tree of some sorts. Lines, if I understand correctly, is similar, but it requires the user to do the chunking. There is a fundamental fact about strings that applies to every programming language: STRINGS ARE WRONG. Strings are a good data type for text that you are NOT going to manipulate. If you have to manipulate text, it's usually a good idea to convert it to something else as quickly as you can, such as an abstract syntax tree. This will be orders of magnitude cheaper to process, even in C. Are Erlang's drawbacks with regards to efficient string manipulation shared among all functional languages? What drawbacks? Who said string manipulation in Erlang wasn't efficient? My personal favourite observation here concerns Xerox Quintus Prolog. The Xerox D-machines (1108 Dandelion, 1109 Dandetiger, 1185 1186 -- one of those was Daybreak but I don't remember which) were available running Interlisp-D (and eventually Xerox Common Lisp on top of that). These were microcoded machines. Interlisp had always had strings; Interlisp-D seamlessly supported any mix of 8-bit and 16-bit strings. There was microcode to make string operations fast. Xerox Quintus Prolog used the Quintus Prolog compiler and libraries, but the WAM emulator was mostly written in microcode (instead of macro assembler). Interlisp used cdr-coding, so Lisp list cells were 4 bytes. The WAM doesn't use cdr-coding, so our list cells were 8 bytes. So, here's the contest. The incumbent has packed byte strings with O(1) access time to individual elements, including O(1) in-place update -- except if you replace an 8-bit character by a 16-bit one. The incumbent has special microcode support for some basic string operations. The the other corner, the upstate takes EIGHT TIMES as much space per character, has O(N) access time to the Nth element, has no in-place update, and while it has microcode support for cons, car, and cdr, has *no* microcode support for any string operations, all string calculations being done in macrocode. Clear victory for the imcumbent, right? Wrong. Prolog beat the pants off Interlisp, same hardware, same microcode expert having written the microcode for both. The reason? Simple. Prolog made it very cheap to *build* "strings"; list differences (as used in Definite Clause Grammars) made concatenation O(1) instead of O(N). It's the same with Erlang. *Building* strings using [This|That] instead of This ++ That is an O(1) operation no matter how big This is. Yes, you can beat C that way -- unless the C programmer knows that strings are wrong too. I was planning on writing a Google killer in Erlang, and this new knowledge makes me rethink this strategy :) Google actually have a few programming language clues; they have no hangups about using or even inventing special-purpose programming languages. Especially these days when a single "character" from the user's point of view may be several Unicode characters and each of those characters might be mapped to several bytes, random access into strings is of very little actual interest. It gets worse: if you change a Unicode string to lower case or to upper case or to title case, the result may and quite often WILL be a different length from the original, so in-place case shifting is a thing of the past, and that's one of the few things that in-place update was ever good for. So the things that Erlang _can't_ do well with strings are things that aren't going to work _anyway_ in a Unicode world, while the things that Erlang _can_ to well (lists, trees, recursive functions, leex, yecc) are still very useful. From mikpe@REDACTED Wed Jun 21 11:10:17 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 21 Jun 2006 11:10:17 +0200 (MEST) Subject: Problems Building ErLang R11B Message-ID: <200606210910.k5L9AH6A003350@harpo.it.uu.se> On Tue, 20 Jun 2006 15:16:52 -0700, Bruce Bailey wrote: >While trying to build version R11B (otp_src_R11B-0.tar.gz), I encountered >several problems (segfaults, compile errors, etc. see below). Can anyone >suggest anyway to get past this? > >Thanks in advance, > >Bruce > >********************** Software Versions ********************** > >Os: Linux C126215 2.4.18-27.8.0-3 #1 Tue Jan 18 04:26:03 PST 2005 i686 i686 >i386 GNU/Linux >Java version: 1.4.0_03 >OpenSSL 0.9.7c 30 Sep 2003 > >********************** Build Errors ********************** > >erlc -W +debug_info +strict_record_tests -o../ebin gse.erl >erl -pa ../ebin -s gs_make -s erlang halt -noshell >make[3]: *** [gstk_generic.hrl] Segmentation fault (core dumped) etc That looks like an antique RedHat 8.0 kernel, which, assuming the rest is also RH8-ish would make glibc be glibc-2.3.2 or thereabouts. Try ./configure --disable-hipe and rebuild. If things work, then the issue is with the (rather old) kernel and/or glibc you're running. HiPE/x86 did work on RH8.0 at one point, but it's not something we test on or support these days. /Mikael From joe.armstrong@REDACTED Wed Jun 21 11:51:59 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 21 Jun 2006 11:51:59 +0200 Subject: Erlang Refactoring Message-ID: Are there any Erlang refactoring programs that I can download and use? I want to do the following: I have a directory with Erlang modules glurk.erl foo_server.erl ... And a Makefile And I have a renaming scheme Old Name New Name glurk.erl foo_bar_krulg.erl foo_server.erl foo23_glunker.erl ... I want some program that changes all the filenames and module names in a consistent manner, and which tries to keep the formatting of my programs intact. Is there such a program? - << in the form of a function I evaluate in the Erlang shell - ie with no incomprehensible GUI >> /Joe From bengt.kleberg@REDACTED Wed Jun 21 12:06:45 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Jun 2006 12:06:45 +0200 Subject: Erlang Refactoring In-Reply-To: References: Message-ID: <44991A35.3000407@ericsson.com> On 2006-06-21 11:51, Joe Armstrong (AL/EAB) wrote: > > Are there any Erlang refactoring programs that I can > download and use? i do not have the thing you are requesting. it sounds like shell script using a stream editor, or am i missing something? for ''real refactoring'' :-) i have an erlang program that takes some lines of erlang inside a function, and adds a function head with the free variables as function arguments. i find it quite usfull when spliting a very long function into several shorter ones. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From vladdu55@REDACTED Wed Jun 21 12:27:10 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 21 Jun 2006 12:27:10 +0200 Subject: Erlang Refactoring In-Reply-To: References: Message-ID: <95be1d3b0606210327k4e774a40h6ee5fb7c257c5e31@mail.gmail.com> Hi Joe, Have you looked at igor, which is included in syntax_tools? regards, Vlad On 6/21/06, Joe Armstrong (AL/EAB) wrote: > > Are there any Erlang refactoring programs that I can > download and use? > > I want to do the following: > > I have a directory with Erlang modules > > glurk.erl > foo_server.erl > ... > > And a Makefile > > And I have a renaming scheme > > Old Name New Name > glurk.erl foo_bar_krulg.erl > foo_server.erl foo23_glunker.erl > ... > > > I want some program that changes all the filenames and > module names in a consistent manner, and which tries > to keep the formatting of my programs intact. > > Is there such a program? - << in the form of a function I > evaluate in the Erlang shell - ie with no incomprehensible GUI >> > > /Joe > > From tobbe@REDACTED Wed Jun 21 13:04:23 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 21 Jun 2006 13:04:23 +0200 Subject: Erlang Refactoring In-Reply-To: References: Message-ID: distel is great for refactoring pieces of erlang code. --Tobbe Joe Armstrong (AL/EAB) wrote: > > Are there any Erlang refactoring programs that I can > download and use? > > I want to do the following: > > I have a directory with Erlang modules > > glurk.erl > foo_server.erl > ... > > And a Makefile > > And I have a renaming scheme > > Old Name New Name > glurk.erl foo_bar_krulg.erl > foo_server.erl foo23_glunker.erl > ... > > > I want some program that changes all the filenames and > module names in a consistent manner, and which tries > to keep the formatting of my programs intact. > > Is there such a program? - << in the form of a function I > evaluate in the Erlang shell - ie with no incomprehensible GUI >> > > /Joe > > From H.Li@REDACTED Wed Jun 21 13:23:02 2006 From: H.Li@REDACTED (H.Li@REDACTED) Date: Wed, 21 Jun 2006 12:23:02 +0100 (BST) Subject: Erlang Refactoring In-Reply-To: References: Message-ID: <1150888982.44992c1635753@webmail.ukc.ac.uk> We, a group from the University of Kent in the UK, are in the early stage of building a refactoring tool for Erlang. The current implementation supports renaming variable/function names, and generalisation of function definitions, within a single module. We are now in the process of extending the implementation, so that the tool can work with multiple modules. Renaming module names is another refactoring we would like to support in the future. At the same time, we would be more than happy to hear from you about what refactorings you think is useful for Erlang programmers. Cheers, Huiqing > > Are there any Erlang refactoring programs that I can > download and use? > > I want to do the following: > > I have a directory with Erlang modules > > glurk.erl > foo_server.erl > ... > > And a Makefile > > And I have a renaming scheme > > Old Name New Name > glurk.erl foo_bar_krulg.erl > foo_server.erl foo23_glunker.erl > ... > > > I want some program that changes all the filenames and > module names in a consistent manner, and which tries > to keep the formatting of my programs intact. > > Is there such a program? - << in the form of a function I > evaluate in the Erlang shell - ie with no incomprehensible GUI >> > > /Joe > > From thomasl_erlang@REDACTED Wed Jun 21 13:35:41 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 21 Jun 2006 04:35:41 -0700 (PDT) Subject: Erlang Refactoring In-Reply-To: Message-ID: <20060621113541.75230.qmail@web38803.mail.mud.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > I want some program that changes all the filenames > and > module names in a consistent manner, and which tries > to keep the formatting of my programs intact. > > Is there such a program? - << in the form of a > function I > evaluate in the Erlang shell - ie with no > incomprehensible GUI >> Not that I know. Maybe you could do a partial solution with Richard C.'s syntax_tools, which I think can do transformations while preserve formatting. However, for full automation, you also have to handle atoms used to name modules: M = glurk, M:F(X). This requires flow analysis. Actually, it can be even worse than that. You can also do this: M = list_to_atom("prefix" ++ Lst), M:F(X). and these: M1 = read_from_mnesia(Key), M2 = read_from_remote_node(Node), M1:f(), M2:g(). Automated transformations may be (probably are) stumped by those cases. In a program optimization tool I wrote (EUC 2001), I inserted runtime conversions where the atom was used instead: new_name_of(M1):f() new_name_of(old_mod) -> new_mod; ... If you accept false positives, then conservatively mark all call sites that MAY be affected by the rewrite. An ambitious extension is to use or repurpose one of the static analyzers that have appeared in recent years, in order to remove as many of these false positives as possible. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From vladdu55@REDACTED Wed Jun 21 14:06:28 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 21 Jun 2006 14:06:28 +0200 Subject: Erlang Refactoring In-Reply-To: <1150888982.44992c1635753@webmail.ukc.ac.uk> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> Message-ID: <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> On 6/21/06, H.Li@REDACTED wrote: > > We, a group from the University of Kent in the UK, are in the early stage > of building a refactoring tool for Erlang. The current implementation > supports renaming variable/function names, and generalisation of function > definitions, within a single module. > > We are now in the process of extending the implementation, so that the > tool can work with multiple modules. Renaming module names is another > refactoring we would like to support in the future. hi, is this implemented in Erlang? If yes, is it meant to be used standalone (like for example dialyzer) or can it be run from the Erlang shell too? regards, Vlad From serge@REDACTED Wed Jun 21 14:09:35 2006 From: serge@REDACTED (Serge) Date: Wed, 21 Jun 2006 08:09:35 -0400 Subject: Loading application variables In-Reply-To: <1150030262.12185.59.camel@ulab.pupeno.com> References: <1150021824.12185.36.camel@ulab.pupeno.com> <1150027610.12185.50.camel@ulab.pupeno.com> <1150030262.12185.59.camel@ulab.pupeno.com> Message-ID: <449936FF.1010409@corp.idt.net> Actually, there is a way to reload the application configuration from sys.config without restarting a node using a non-documented application_controller's call (in a similar way how it's done by the release handler): reload_config(AppNames, ConfigFile) -> {ok, [Config]} = file:consult(ConfigFile), Apps = [{application, A, element(2,application:get_all_key(A))} || {A,_,_} <- application:while_applications()], application_controller:change_application_data(Apps,Config). It would be nice if the following function was exported from the application_controller: check_conf/0 then, you wouldn't need to pass the ConfigFile name to the reload_config/2 written above, but do: Config = application_controller:check_conf(). Regards, Serge Pupeno wrote: > On Sun, 2006-06-11 at 13:39 +0100, Sean Hinde wrote: > >>On 11 Jun 2006, at 13:06, Pupeno wrote: >> >> >>>On Sun, 2006-06-11 at 14:02 +0200, Ulf Wiger wrote: >>> >>>>I don't know if there's a standard function for loading >>>>the .config file, >>>>but you can read and parse a .config file with >>>>file:consult("miselfu.config"), and you can set environment >>>>variables with >>>>application:set_env(AppName, Key, Value). >>> >>>So, you don't normally work that way ? Opening up a shell on Emacs, >>>running the application and re-loading code as it is modified ? >> >>I would think that most more serious erlang applications use the >>sys.config file for a few parameters that are only required at >>startup and not subject to change. Parameters that should change at >>runtime would typically be stored in a database or opened up as APIs >>so they can be changed without restarting the application. >> >>Of course your application might be such that it can be restarted >>after every config change, in which case sys.config might be sufficient. > > > So far, these configurations, are port numbers. You have to interrupt > the service anyway to change the port you offer the service on. Although > I may store them on a DB latter, right now I only want to be able to run > the app from erl. From yarivvv@REDACTED Wed Jun 21 14:29:19 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 21 Jun 2006 08:29:19 -0400 Subject: are Mnesia tables immutable? In-Reply-To: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> References: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> Message-ID: <17244f480606210529o42a2b6fdy96fbb3c2af9f8d10@mail.gmail.com> > > There is a fundamental fact about strings that applies to every > programming language: > > STRINGS ARE WRONG. > > Strings are a good data type for text that you are NOT going to manipulate. > If you have to manipulate text, it's usually a good idea to convert it to > something else as quickly as you can, such as an abstract syntax tree. > This will be orders of magnitude cheaper to process, even in C. Interesting. Do you think it would be possible to write an API similar to Lines (or on top of Lines), that would turn any string into a tree for easy manipulation and pseudo-random access, without understanding its syntax? The tradeoff would be speed in exchage for space. > > Are Erlang's drawbacks with regards to efficient string manipulation > shared among all functional languages? > > What drawbacks? Who said string manipulation in Erlang wasn't efficient? Well, Hokan said it in this thread :) "Erlang is somewhat weak in the area of strings (strings where not a main concern when erlang was begin designed to be used in Ericssons telecom products - switches ... etc)" > My personal favourite observation here concerns Xerox Quintus Prolog. > > It's the same with Erlang. *Building* strings using [This|That] instead > of This ++ That is an O(1) operation no matter how big This is. Yes, you > can beat C that way -- unless the C programmer knows that strings are wrong > too. Coming from a C/C++ background, I would say that it's pretty easy to write an expanding buffer in those languages to which you can append characters at the end for O(1) cost, with an occasional realloc() call. There's some wasted space and realloc() isn't cheap by any means, but it's staightforward and I bet most C/C++ programs use such a buffer (std:vector and std:string use this technique AFAIK). > > I was planning on writing a Google killer in Erlang, and this > new knowledge makes me rethink this strategy :) > > Google actually have a few programming language clues; they have no > hangups about using or even inventing special-purpose programming languages. To the outside observer, it seems like Google's lightbulb hasn't gone off yet when it comes to functional languages :) http://www.google.com/support/jobs/bin/search.py?hl=en&lr=lang_en&type=f&query=erlang&Action.Search=Search+U.S.+Openings http://www.google.com/support/jobs/bin/search.py?lr=lang_en&type=f&query=haskell&Action.Search=Search+U.S.+Openings http://www.google.com/support/jobs/bin/search.py?lr=lang_en&type=f&query=ocaml&Action.Search=Search+U.S.+Openings http://www.google.com/support/jobs/bin/search.py?lr=lang_en&type=f&query=lisp&Action.Search=Search+U.S.+Openings http://www.google.com/support/jobs/bin/search.py?lr=lang_en&type=f&query=ML&Action.Search=Search+U.S.+Openings So, either this is an advantage to Google's competitors who *do* use functional languages -- especially Erlang, the #1 choice for buidling scalable, concurrent, fault-tolert, distributed systems, which is Google's bread and butter -- or Google is shy about this fact on its website :) > > Especially these days when a single "character" from the user's point of > view may be several Unicode characters and each of those characters might > be mapped to several bytes, random access into strings is of very little > actual interest. It gets worse: if you change a Unicode string to lower > case or to upper case or to title case, the result may and quite often WILL > be a different length from the original, so in-place case shifting is a > thing of the past, and that's one of the few things that in-place update > was ever good for. So the things that Erlang _can't_ do well with strings > are things that aren't going to work _anyway_ in a Unicode world, while the > things that Erlang _can_ to well (lists, trees, recursive functions, leex, > yecc) are still very useful. Yes, unicode does make things different. In Java, all strings are unicode (like Erlang), but there isn't the extra 32 bit overhead per characters for building the linked list. Is it always 32, by the way, even on 64 bit machines? Or do Erlang "strings" double in size on 64 bit architectures? Best regards, Yariv From H.Li@REDACTED Wed Jun 21 14:32:51 2006 From: H.Li@REDACTED (H.Li@REDACTED) Date: Wed, 21 Jun 2006 13:32:51 +0100 (BST) Subject: Erlang Refactoring In-Reply-To: <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> Message-ID: <1150893171.44993c73211c5@webmail.ukc.ac.uk> > > is this implemented in Erlang? If yes, is it meant to be used > standalone (like for example dialyzer) or can it be run from the > Erlang shell too? > Yes, this is implemented in Erlang. The tool is integrated with Emacs as an extension of Distel, therefore allows the user to refactor programs in an interactive way. Cheers, Huiqing From vladdu55@REDACTED Wed Jun 21 14:35:49 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 21 Jun 2006 14:35:49 +0200 Subject: Erlang Refactoring In-Reply-To: <1150893171.44993c73211c5@webmail.ukc.ac.uk> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> <1150893171.44993c73211c5@webmail.ukc.ac.uk> Message-ID: <95be1d3b0606210535h1d2052a0i7fd73825127900de@mail.gmail.com> On 6/21/06, H.Li@REDACTED wrote: > > is this implemented in Erlang? > > Yes, this is implemented in Erlang. The tool is integrated with Emacs > as an extension of Distel, therefore allows the user to refactor > programs in an interactive way. Cool, then I look forward to integrate it in Erlide too! :-) regards, Vlad From mats.cronqvist@REDACTED Wed Jun 21 14:57:37 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 21 Jun 2006 14:57:37 +0200 Subject: Erlang Refactoring In-Reply-To: <1150893171.44993c73211c5@webmail.ukc.ac.uk> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> <1150893171.44993c73211c5@webmail.ukc.ac.uk> Message-ID: <44994241.20503@ericsson.com> H.Li@REDACTED wrote: >> is this implemented in Erlang? If yes, is it meant to be used >> standalone (like for example dialyzer) or can it be run from the >> Erlang shell too? >> > > Yes, this is implemented in Erlang. The tool is integrated with Emacs > as an extension of Distel, therefore allows the user to refactor > programs in an interactive way. distel already has refactoring support. how is this different? mats From rsaccon@REDACTED Wed Jun 21 15:47:31 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Wed, 21 Jun 2006 10:47:31 -0300 Subject: any recommendation for tutorials on functional programming Message-ID: I am new to erlang and never before used a functional programmming language. I am used to switch between Java, Ruby, Javascript and C++ and I expected it to be similar with Erlang, but it is very different ... Anybody knows some good tutorial on functional programmming languages (and if specific to erlang, even better). I went throught what I found at the erlang website and some stuff I found with google, but I did not find anything with examples of problems (a bit more complex than just a foor loop) solved in procedural and functional language. regards -- Roberto Saccon From mickael.remond@REDACTED Wed Jun 21 15:48:41 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 21 Jun 2006 15:48:41 +0200 Subject: Erlang Refactoring In-Reply-To: <44994241.20503@ericsson.com> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> <1150893171.44993c73211c5@webmail.ukc.ac.uk> <44994241.20503@ericsson.com> Message-ID: <20060621134841.GD8297@memphis.ilius.fr> * Mats Cronqvist [2006-06-21 14:57:37 +0200]: > >Yes, this is implemented in Erlang. The tool is integrated with Emacs > >as an extension of Distel, therefore allows the user to refactor > >programs in an interactive way. > > distel already has refactoring support. how is this different? The difference probably lies in the number of refactoring action that are available. Distel supports only a few methods. I think this project will implement more. Refactoring is important for functionnal languages. For example side-effect free function get everything from parameters. If you extend your code to add features, you might need to pass a new parameter to the function and handle this everywhere in the code. This is a very interesting project :-) -- Micka?l R?mond http://www.process-one.net/ From H.Li@REDACTED Wed Jun 21 16:16:10 2006 From: H.Li@REDACTED (H.Li@REDACTED) Date: Wed, 21 Jun 2006 15:16:10 +0100 (BST) Subject: Erlang Refactoring In-Reply-To: <44994241.20503@ericsson.com> References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> <1150893171.44993c73211c5@webmail.ukc.ac.uk> <44994241.20503@ericsson.com> Message-ID: <1150899370.449954aa0b088@webmail.ukc.ac.uk> > distel already has refactoring support. how is this different? > If I am right, the number of supported refactorings by distel is still very limted. We hope that our refactoring tool can support a more comprehensive list of useful Erlang refactorings. Cheers, Huiqing From gkoller@REDACTED Wed Jun 21 16:40:49 2006 From: gkoller@REDACTED (Guido Kollerie) Date: Wed, 21 Jun 2006 16:40:49 +0200 Subject: any recommendation for tutorials on functional programming In-Reply-To: References: Message-ID: <44995A71.30205@inter.nl.net> Roberto Saccon wrote: > Anybody knows some good tutorial on functional programmming languages > (and if specific to erlang, even better). I've found "Functional Programming in Clean" to be a good introduction to functional programming. Haven't touched Clean in quite a while though the concepts learned from that book translate easily to other functional languages. Here's the URL: ftp://ftp.cs.kun.nl/pub/Clean/papers/cleanbook/CleanBookI.pdf -- Guido From joe.armstrong@REDACTED Wed Jun 21 17:25:42 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 21 Jun 2006 17:25:42 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: Start by reading this. http://www.erlang.org/doc/doc-5.5/pdf/getting_started-5.5.pdf Print it out and read it in the bath or on an omnibus. Better still read it in the bath, then leave you copy on an omnibus for somebody else to pick up and enjoy. To find this and other documents go to http://www.erlang.org/doc.html Click on the the first link http://www.erlang.org/doc/doc-5.5/doc/ Then on any of the links in the sidebar in the category "Erlang programming" PDF manuals can be found here http://www.erlang.org/doc/doc-5.5/pdf/ Once you have read "getting started" proceed to http://www.erlang.org/doc/doc-5.5/pdf/programming_examples-5.5.pdf Or part one of the Erlang book is at http://www.erlang.org/download/erlang-book-part1.pdf Still a good read :-) Cheers /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Roberto Saccon > Sent: den 21 juni 2006 15:48 > To: erlang-questions@REDACTED > Subject: any recommendation for tutorials on functional programming > > I am new to erlang and never before used a functional > programmming language. I am used to switch between Java, > Ruby, Javascript and C++ and I expected it to be similar with > Erlang, but it is very different ... > > Anybody knows some good tutorial on functional programmming > languages (and if specific to erlang, even better). I went > throught what I found at the erlang website and some stuff I > found with google, but I did not find anything with examples > of problems (a bit more complex than just a foor loop) solved > in procedural and functional language. > > regards > -- > Roberto Saccon > From stefan.l.axelsson@REDACTED Wed Jun 21 17:31:17 2006 From: stefan.l.axelsson@REDACTED (Stefan Axelsson L (LN/EAB)) Date: Wed, 21 Jun 2006 17:31:17 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: <6D145AB0AF765D4988C49705263A1DBC03D51C13@esealmw106.eemea.ericsson.se> > Anybody knows some good tutorial on functional programmming languages (and if specific to erlang, even better). > I went throught what I found at the erlang website and some stuff I found with google, but I did not find > anything with examples of problems (a bit more complex than just a foor loop) solved in procedural and > functional language. Well there's a ton out there, but unfortunately most of it is not geared towards Erlang. The classical "introductory" text, "The Structure and Interpretation of Computer Programs" is available on-line (at: http://mitpress.mit.edu/sicp/full-text/book/book.html). It uses Scheme for its examples, and as that's a strict language and you don't really have to know/learn it to work the book, it's a closer match to Erlang's way of going about business than say the Haskell material. It comes highly recommended and you could do a lot worse for a more in depth introduction to functional programming. When it comes Erlang the problem is the concurrent stuff, that is unique to Erlang (well not entirely, but you get my drift) and not well covered from an introductory perspective. There are bits and pieces here and there (e.g. on Joe Armstrong's homepage) but no comprehensive collection that I know of. Stefan, -- Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 3963 (mobile/work) From ulf.wiger@REDACTED Wed Jun 21 17:44:49 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 21 Jun 2006 17:44:49 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: I don't know how many have noticed, but there is actually quite a good guide to the documentation on the splash page (the first page, with the "e" logo, that comes up when you surf to the docs). You just have to scroll down a bit to see it. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Joe > Armstrong (AL/EAB) > Sent: den 21 juni 2006 17:26 > To: Roberto Saccon; erlang-questions@REDACTED > Subject: RE: any recommendation for tutorials on functional > programming > > > Start by reading this. > > http://www.erlang.org/doc/doc-5.5/pdf/getting_started-5.5.pdf > > > Print it out and read it in the bath or on an omnibus. > > Better still read it in the bath, then leave you copy on an > omnibus for somebody else to pick up and enjoy. > > To find this and other documents go to http://www.erlang.org/doc.html > > Click on the the first link http://www.erlang.org/doc/doc-5.5/doc/ > > Then on any of the links in the sidebar in the category > "Erlang programming" > > PDF manuals can be found here > > http://www.erlang.org/doc/doc-5.5/pdf/ > > Once you have read "getting started" proceed to > > http://www.erlang.org/doc/doc-5.5/pdf/programming_examples-5.5.pdf > > Or part one of the Erlang book is at > > http://www.erlang.org/download/erlang-book-part1.pdf > > Still a good read :-) > > Cheers > > /Joe > > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Roberto Saccon > > Sent: den 21 juni 2006 15:48 > > To: erlang-questions@REDACTED > > Subject: any recommendation for tutorials on functional programming > > > > I am new to erlang and never before used a functional programmming > > language. I am used to switch between Java, Ruby, > Javascript and C++ > > and I expected it to be similar with Erlang, but it is very > different > > ... > > > > Anybody knows some good tutorial on functional programmming > languages > > (and if specific to erlang, even better). I went throught > what I found > > at the erlang website and some stuff I found with google, > but I did > > not find anything with examples of problems (a bit more > complex than > > just a foor loop) solved in procedural and functional language. > > > > regards > > -- > > Roberto Saccon > > > From yarivvv@REDACTED Wed Jun 21 17:46:54 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 21 Jun 2006 11:46:54 -0400 Subject: any recommendation for tutorials on functional programming In-Reply-To: References: Message-ID: <17244f480606210846u439bda1bh2b61233316cb3bf6@mail.gmail.com> > > Anybody knows some good tutorial on functional programmming languages > (and if specific to erlang, even better). I went throught what I found > at the erlang website and some stuff I found with google, but I did > not find anything with examples of problems (a bit more complex than > just a foor loop) solved in procedural and functional language. I like the OCaml tutorial. It's not exactly like Erlang, but it has similar concepts. http://ocaml-tutorial.org/ Yariv From rsaccon@REDACTED Wed Jun 21 18:30:39 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Wed, 21 Jun 2006 13:30:39 -0300 Subject: any recommendation for tutorials on functional programming In-Reply-To: <17244f480606210846u439bda1bh2b61233316cb3bf6@mail.gmail.com> References: <17244f480606210846u439bda1bh2b61233316cb3bf6@mail.gmail.com> Message-ID: thanks for all the suggestions. regards -- Roberto Saccon From Tobias.Lindahl@REDACTED Wed Jun 21 18:55:49 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Wed, 21 Jun 2006 18:55:49 +0200 Subject: dlialyzer a bit too sceptic? In-Reply-To: References: Message-ID: <44997A15.3000403@it.uu.se> This seems very strange to me too. Can you send me the module (offline from the list) so that I can have a look? By the way, which version of Dialyzer is this? Tobias Ulf Wiger (AL/EAB) wrote: > Dialyzer (R11B-0) gave me the following warning on some 'rdbms' code: > > {rdbms_groups,'-do_add_members/2-fun-0-',2}: Call to function > {rdbms_props,do_write_property,2} with signature ((_,{{'acl',atom()} | > {'typedef',_} | {'attr',_,_} | 'access_module' | 'acl' | 'indexes' | > 'read_filter' | 'rec_type' | 'references' | 'write_filter',_}) -> 'ok') > will fail since the arguments are of type > ('schema',{{'group',_,'membership'},_})! > > > But the function rdbms_props:do_write_property/2 looks like this: > > > do_write_property(Tab, Prop) -> > mnesia_schema:do_write_table_property(Tab, Prop). > > > I.e. absolutely no restrictions on Prop. If one were to introduce one, > it would be something similar to that of > mnesia_schema:write_table_property/2 - namely that Prop is a tuple with > at least one element. > > > write_table_property(Tab, Prop) when tuple(Prop), size(Prop) >= 1 -> > schema_transaction(fun() -> do_write_table_property(Tab, Prop) end); > write_table_property(Tab, Prop) -> > {aborted, {bad_type, Tab, Prop}}. > > do_write_table_property(Tab, Prop) -> > TidTs = get_tid_ts_and_lock(schema, write), > {_, _, Ts} = TidTs, > Store = Ts#tidstore.store, > case change_prop_in_existing_op(Tab, Prop, write_property, Store) of > true -> > ... > %% we have merged the table prop into the create_table op > ok; > false -> > ..., > insert_schema_ops(TidTs, make_write_table_properties(Tab, > [Prop])) > end. > > > It's not at all clear to me why Dialyzer thinks the call would fail. > > BR, > Ulf W From luke@REDACTED Wed Jun 21 18:55:32 2006 From: luke@REDACTED (Luke Gorrie) Date: Wed, 21 Jun 2006 18:55:32 +0200 Subject: Erlang Refactoring References: <1150888982.44992c1635753@webmail.ukc.ac.uk> <95be1d3b0606210506v28dffcbeh16255663a0ac58f4@mail.gmail.com> <1150893171.44993c73211c5@webmail.ukc.ac.uk> Message-ID: H.Li@REDACTED writes: > Yes, this is implemented in Erlang. The tool is integrated with Emacs > as an extension of Distel, therefore allows the user to refactor > programs in an interactive way. Cool! From tzheng@REDACTED Wed Jun 21 22:16:37 2006 From: tzheng@REDACTED (Tony Zheng) Date: Wed, 21 Jun 2006 13:16:37 -0700 Subject: system free memory Message-ID: <1150920997.28450.2.camel@gateway> Hi I used Solaris x86 on Unix platform. Is there any commands on erlang to know the system free memory? Thanks. tony From bsder@REDACTED Wed Jun 21 23:51:32 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 21 Jun 2006 14:51:32 -0700 Subject: any recommendation for tutorials on functional programming In-Reply-To: References: Message-ID: <4499BF64.6070601@allcaps.org> Roberto Saccon wrote: > I am new to erlang and never before used a functional programmming > language. I am used to switch between Java, Ruby, Javascript and C++ > and I expected it to be similar with Erlang, but it is very different > ... Well, how basic do you want? The most basic two tutorials that I know of are "The Little Schemer" and "The Seasoned Schemer"--the first author is Friedman for both. I highly recommend "The Little Schemer" in spite of its somewhat juvenile nature. You don't really notice it because you get pay more attention to typing in the vast number of code examples. Apparently, there is another book called "The Reasoned Schemer" that just came out that covers some added logic constructs (a la Prolog) to Scheme. I cannot comment on it as I have never seen it; I just noticed it on Amazon. I know that someone recommended "The Structure and Interpretation of Computer Programs." It's a good book and lots of people like it. I don't actually dislike it, but, for some reason, it never really resonated with me. I actually thought "Common Lisp: A Gentle Introduction to Symbolic Computation" by David S. Touretzky was better. It is also available online: http://www.cs.cmu.edu/~dst/LispBook/ -a From bsder@REDACTED Thu Jun 22 00:08:13 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 21 Jun 2006 15:08:13 -0700 Subject: are Mnesia tables immutable? In-Reply-To: <17244f480606210529o42a2b6fdy96fbb3c2af9f8d10@mail.gmail.com> References: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> <17244f480606210529o42a2b6fdy96fbb3c2af9f8d10@mail.gmail.com> Message-ID: <4499C34D.3020600@allcaps.org> Yariv Sadan wrote: > To the outside observer, it seems like Google's lightbulb hasn't gone > off yet when it comes to functional languages :) Careful. Google for MapReduce. http://labs.google.com/papers/mapreduce.html And, BTW, Google hired Peter Norvig. Take a look at norvig.com. > So, either this is an advantage to Google's competitors who *do* use > functional languages -- especially Erlang, the #1 choice for buidling > scalable, concurrent, fault-tolert, distributed systems, which is > Google's bread and butter -- or Google is shy about this fact on its > website :) Google is very different from most distributed systems. They don't need to be particularly reliable, correct, or accurate and long as they don't return anything that is particularly *wrong*. Again, see MapReduce. With MapReduce, they either rerun the computation, or, more likely, just don't worry about the lost results since they have so many other ones anyhow. > Yes, unicode does make things different. In Java, all strings are > unicode (like Erlang), but there isn't the extra 32 bit overhead per > characters for building the linked list. Is that strictly true? It is for String, but String is immutable. What about StringBuilder or StringBuffer? Those will almost certainly have some overhead. -a From bsder@REDACTED Thu Jun 22 00:16:51 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 21 Jun 2006 15:16:51 -0700 Subject: Beam label 0 special? Message-ID: <4499C553.3050705@allcaps.org> Does label 0 have a special meaning in BEAM code similar to the way atom 0 does? nil is always atom 0 even though it is not listed in the atom table, right? Is there something similar going on with label 0 that I am missing? Thanks, -a From yarivvv@REDACTED Thu Jun 22 02:29:34 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 21 Jun 2006 20:29:34 -0400 Subject: are Mnesia tables immutable? In-Reply-To: <4499C34D.3020600@allcaps.org> References: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> <17244f480606210529o42a2b6fdy96fbb3c2af9f8d10@mail.gmail.com> <4499C34D.3020600@allcaps.org> Message-ID: <17244f480606211729n5398bea9g6bee871aec4db6e8@mail.gmail.com> > > Google for MapReduce. http://labs.google.com/papers/mapreduce.html > > And, BTW, Google hired Peter Norvig. Take a look at norvig.com. > Very interesting... thanks for the link. I was under the impression that the Google search engine is written in C++. I do find it pretty strange that Google doesn't advertise a single job for developers with functional programming background (at least none that I could find). > > Google is very different from most distributed systems. They don't need > to be particularly reliable, correct, or accurate and long as they don't > return anything that is particularly *wrong*. > > Again, see MapReduce. With MapReduce, they either rerun the > computation, or, more likely, just don't worry about the lost results > since they have so many other ones anyhow. > I got the PDF, and I'll read it now. Thanks for pointing it out. > > Is that strictly true? It is for String, but String is immutable. What > about StringBuilder or StringBuffer? Those will almost certainly have > some overhead. String is indeed immutable. AFAIK, StringBuffer expands by 2x when it reaches its capacity, most probably using realloc(). I'm not sure about Java, but the SGI implementation of the C++ Standard Libaray has the Rope extension library (http://www.sgi.com/tech/stl/Rope.html), which provides efficient operations on very large strings by representing them internally as trees. I was wondering whether Erlang had a similar library. Regards, Yariv From ok@REDACTED Thu Jun 22 05:55:43 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 22 Jun 2006 15:55:43 +1200 (NZST) Subject: are Mnesia tables immutable? Message-ID: <200606220355.k5M3th6R277745@atlas.otago.ac.nz> Interesting. Do you think it would be possible to write an API similar to Lines (or on top of Lines), that would turn any string into a tree for easy manipulation and pseudo-random access, without understanding its syntax? The tradeoff would be speed in exchage for space. If "Lines" refers to Ulf Wiger's 'lines' module, that defines an indexable sequence data type which stores its contents as a balanced binary tree of "blocks" (where a "block" may have up to 10 elements). There is nothing in that module that knows or cares what the elements are. As it happens, 'lines' itself _will_ turn any stirng into a tree. Just use Array = lines:convert_from_list(String) This will take even more space than an ordinary list. That could be fixed quite easily by rewriting the 'lines' module (amongst other things, the operation 'lines' calls 'append' is in fact 'snoc' and there isn't any true 'append' operation for 'lines'). The main problem with this is that it concentrates on operations - fetch one element - replace one element - insert one element - delete one element that are simply at the wrong level of abstraction for anything you are likely to want to do with a "string" these days. There are quite a lot of data structures _like_ the 'lines' module around, starting with the old 'AVL DAGs' and including some very clever data structures indeed. Here is a very simple illustration of how choosing a slightly different data structure can give useful savings. I have an XML file with 1,322,807 characters. (It's part of the TREC Wall Street Journal collection.) Reading it into SWI Prolog as a list of character codes, just the same as the normal Erlang representation of a string, required 15,874,896 bytes, from which we conclude that SWI Prolog uses 12 bytes per list cell. (Quintus Prolog used 8.) A common trick in Information Retrieval is to represent a text as a sequence of *words*. So I wrote a small amount of Prolog code to convert a sequence of alphanumerics possibly followed by a space to an atom, while any other character remained as a character code (and cancelled the implied space at the end of the preceding word). So "'Twas the night before Christmas, and all through the house," would be stored as [39,'Twas',the,night,before,'Christmas',44, and,all,through,the,house,44]. Using that representation, the same text required under 3.5 bytes per character. The great thing about that representation is that you can search for words and phrases easily, in fact _easier_ than you can on a string. We can also represent a list of items as a list of blocks (in much the same way that 'lines' uses a tree of blocks); a block could be a tuple. >From actual measurements in SWI Prolog: list of characters 3.0 words = 12.0 bytes per character list of blocks of characters 1.4 words = 5.6 bytes per character list of words 0.86 words = 3.43 bytes per character list of blocks of words 0.40 words = 1.6 bytes per character Now the list of blocks of words representation doesn't give you constant time index, but that's not a useful operation on strings. It _does_ give you efficient word and phrase search. But my whole point is that the real way to get efficient text representation is *NOT* to use a one-size-fits-everyone-badly representation that operates 'without understanding the syntax' but to use something that _does_ exploit the structures that are relevant to the processing you intend to do. Erlang's binaries are a perfectly good space-efficient representation for textual data that you are just accepting, storing, and passing on. For more general textual processing, you want - O(1) slicing - somewhere between O(1) and O(lg n) concatenation - O(n) traversal - O(n) search The conventional packed-array-of-bytes approach gives you the last two, but not the first two. Well, Hokan said it in this thread :) "Erlang is somewhat weak in the area of strings (strings where not a main concern when erlang was begin designed to be used in Ericssons telecom products - switches ... etc)" He was wrong. Strings may not have been a major concern, but that doesn't mean that Erlang is weak in that area. It's rather like the contrast between PL/I -- where strings *are* a special data type and a lot of thought went into them -- and C -- where they *aren't*. Way back in 1979, a friend of mine, who was an experienced PL/I programmer, wrote a 'stream editor' not entirely unlike sed for IBM mainframes. It took him a *lot* of code, and he was fighting PL/I every step of the way, because the operations *it* wanted to provide for strings were not the operations he needed to use, and to get the operations he needed required a great deal of rather clumsy code. A month after meeting C for the first time, I decided to reimplement his editor. It took me about 1/8th as much code, and one of the reasons for that was that I was able to implement *precisely* the operations I needed using the array primitives provided by C and then write the rest of the editor using them. That was my first inkling that strings were wrong, and good *sequence* data types were right. Like Prolog and Haskell, Erlang has excellent list processing support. So Erlang is in fact a very *good* language for working on strings, not because of special support for strings but because special support is not needed. And as a consequence of that, Erlang offers *equally* good support for sequences of words, sequences of tokens, sequences of lines, &c; it's not like AWK which is _just_ good at strings... > It's the same with Erlang. *Building* strings using [This|That] instead > of This ++ That is an O(1) operation no matter how big This is. Yes, you > can beat C that way -- unless the C programmer knows that strings are wrong > too. Coming from a C/C++ background, I would say that it's pretty easy to write an expanding buffer in those languages to which you can append characters at the end for O(1) cost, with an occasional realloc() call. Yes of course. Everyone knows that. BUT it's not the way most C code is actually written, and that's *not* the data type that is directly supported by strcpy(), strstr(), sprintf(), sscanf(), and so on. Above all, you have completely missed the point of 'this is an O(1) operation NO MATTER HOW BIG This IS'. That is, you can concatenate two non-flat strings in Erlang in CONSTANT time regardless of how big either string is. Using the flex array technique you mention in C, the cost is LINEAR IN THE SIZE OF AT LEAST ONE OF THE STRINGS. Now there _is_ a way around that in C, and it is to use a completely diferent representation for strings, which is *not* like the flex array approach. It's a tree. (Yes, we're back at AVL DAGs and their kin.) To the outside observer, it seems like Google's lightbulb hasn't gone off yet when it comes to functional languages :) The language they designed for querying their logs has as an *essential* feature that it does not and cannot change any persistent data structure. It looks imperative, and it's presumably implemented in an imperative way, but it could be regarded as syntactic sugar for a functional language. Google are *definitely* looking for people with XSLT experience. Weird, ugly, misbegotten freak that it is, XSLT is none-the-less a functional language. It's not just a _declarative_ language, like SQL, it's an honest-to-goodness functional language. Yes, unicode does make things different. In Java, all strings are unicode (like Erlang), Actually, no. Unicode is 17 planes of 65566 positions each, so a Unicode character may require 21 bits. There are already about 100,000 different characters. Alas, Java strings are sequences of *16-bit* codes, which means that it doesn't fit Unicode all that well. There are tens of thousands of Unicode characters which do NOT fit in a Java character, and which take 2 positions in a Java string. So the O(1) indexing you get in Java strings is *not* O(1) access to the nth Unicode character, but O(1) access to the nth fragment of some Unicode character, who knows which. Accessing the nth Unicode character in a Java string is an O(n) operation. but there isn't the extra 32 bit overhead per characters for building the linked list. The overheads for building a string are so high that they require another data type (which _should_ have been a kind of output stream, but in a typical Java design botch isn't, although Java 1.5 has a bodged-on half-solution) for that. The space overheads for Java strings are much worse than you think, because strings (other than the results of String.intern()) do not share storage with other strings. Erlang makes trees easy, trees make sharing easy, and sharing cuts space costs a LOT. Is it always 32, by the way, even on 64 bit machines? It's a pointer-sized word. Or do Erlang "strings" double in size on 64 bit architectures? Yes, they do. Perhaps I can put it this way: The _simplest_ way to represent and process strings in Erlang is neither compact nor particularly fast (although as speed goes it's not bad). However, _problem-appropriate_ data structures can make text processing in Erlang both space efficient and fast. But you have to _think_ about the data you have and what you want to do with it. From bengt.kleberg@REDACTED Thu Jun 22 07:22:32 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 22 Jun 2006 07:22:32 +0200 Subject: system free memory In-Reply-To: <1150920997.28450.2.camel@gateway> References: <1150920997.28450.2.camel@gateway> Message-ID: <449A2918.6020308@ericsson.com> On 2006-06-21 22:16, Tony Zheng wrote: > Hi > > I used Solaris x86 on Unix platform. Is there any commands on erlang to > know the system free memory? Thanks. take a look at get_system_memory_data() in the memsup module, in the osmon application: http://www.erlang.se/doc/doc-5.4.3/lib/os_mon-1.7.1/doc/html/index.html remember to start the applicaiton before you use the function. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From vladdu55@REDACTED Thu Jun 22 09:30:34 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Jun 2006 09:30:34 +0200 Subject: jinterface can't connect to Erlang node Message-ID: <95be1d3b0606220030v76fd15e3oed69012845723d12@mail.gmail.com> Hi folks! We have this interesting problem when trying to let a jinterface node talk to an Erlang node: sometimes they just can't find each other. Using -DOtpConnection.trace=4 the ouptut is -> PUBLISH (r4) jerlide_1a8833@REDACTED port=55020 <- OK <- (no response) The nodes are started using long names, and the host name is the one that Java returns, for both nodes. The erlang node is started from Java. It works in most cases, but not all. (We were using short names before, but hit a very similar problem, the got solved when switching to long names) My interpretation is that Erlang and/or epmd may use different values for the host name (regardless of what was used on the command line), which causes this effect. The question is: * how can I make sure the names are always matching? thanks in advance for any help! best regards, Vlad From vladdu55@REDACTED Thu Jun 22 09:36:55 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Jun 2006 09:36:55 +0200 Subject: jinterface can't connect to Erlang node In-Reply-To: <95be1d3b0606220030v76fd15e3oed69012845723d12@mail.gmail.com> References: <95be1d3b0606220030v76fd15e3oed69012845723d12@mail.gmail.com> Message-ID: <95be1d3b0606220036k78301e79x175ae44ee1b19ae9@mail.gmail.com> To follow up myself... * epmd doesn't seem to care about the host name when registering nodes. * when using short names, we could work around this by editing /etc/hosts so that the host names picked by Java and Erlang were the same. regards, Vlad From stefan.l.axelsson@REDACTED Thu Jun 22 10:56:56 2006 From: stefan.l.axelsson@REDACTED (Stefan Axelsson L (LN/EAB)) Date: Thu, 22 Jun 2006 10:56:56 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: <6D145AB0AF765D4988C49705263A1DBC03D52080@esealmw106.eemea.ericsson.se> I wrote: >When it comes Erlang the problem is the concurrent stuff, that is unique to Erlang (well not entirely, but you >get my drift) and not well covered from an introductory perspective. There are bits and pieces here and there >(e.g. on Joe Armstrong's homepage) but no comprehensive collection that I know of. I actually forgot one source. Joe Armstrong's PhD thesis is a readable introduction to these parts of Erlang (i.e. it covers much of the ground and doesn't get bogged down in just a few details here and there, like many other PhD theses has a tendency to.) Get it at: http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf Stefan, -- Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 3963(mobile/work) From mikpe@REDACTED Thu Jun 22 13:36:30 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 22 Jun 2006 13:36:30 +0200 (MEST) Subject: Beam label 0 special? Message-ID: <200606221136.k5MBaUGI007738@harpo.it.uu.se> On Wed, 21 Jun 2006 15:16:51 -0700, Andrew Lentvorski wrote: > Does label 0 have a special meaning in BEAM code similar to the way atom > 0 does? > > nil is always atom 0 even though it is not listed in the atom table, right? > > Is there something similar going on with label 0 that I am missing? 'nil' would be an atom, but it's unrelated to [] (NIL). NIL is not an atom, either in the language or in the BEAM implementation. Atom number 0 happens to be 'false' in the current system, but I strongly doubt that the number 0 has any special significance in this context. From rasmussen.bryan@REDACTED Thu Jun 22 14:37:05 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Thu, 22 Jun 2006 14:37:05 +0200 Subject: big erlang web solution Message-ID: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> Hi, I've decided to work on a new web site project and I've decided to use Erlang for it. The reason for using Erlang is two fold: 1. I want to have fun making the project. 2. The site has to be extremely scalable. Although I might not move it out to large scale work I want it to be able to handle it. Other requirements I have are as follows: 1. Will be hosted on a linux machine. Does anyone have any notes on performance of Erlang and also Yaws on different 'brands' of linux. 2. I will want to have use a distributed filesystem instead of database to access data. Any good recommendations in this context. Database will still probably be used to hold pointers to specific data but data will be in filesystem. Cheers, Bryan Rasmussen From ulf.wiger@REDACTED Thu Jun 22 14:57:10 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 22 Jun 2006 14:57:10 +0200 Subject: are Mnesia tables immutable? Message-ID: Richard A. O'Keefe wrote: > > If "Lines" refers to Ulf Wiger's 'lines' module, that defines > an indexable sequence data type which stores its contents as > a balanced binary tree of "blocks" (where a "block" may have > up to 10 elements). > There is nothing in that module that knows or cares what the > elements are. As it happens, 'lines' itself _will_ turn any > stirng into a tree. The Lines module was of course never intended to be used for strings, but mainly (initially) a line buffer, where each entry might be a string. I agree fully that it would be a bad structure to represent strings. BR, Ulf W From james.hague@REDACTED Thu Jun 22 15:03:03 2006 From: james.hague@REDACTED (James Hague) Date: Thu, 22 Jun 2006 08:03:03 -0500 Subject: are Mnesia tables immutable? In-Reply-To: <17244f480606211729n5398bea9g6bee871aec4db6e8@mail.gmail.com> References: <200606210648.k5L6mEB9271914@atlas.otago.ac.nz> <17244f480606210529o42a2b6fdy96fbb3c2af9f8d10@mail.gmail.com> <4499C34D.3020600@allcaps.org> <17244f480606211729n5398bea9g6bee871aec4db6e8@mail.gmail.com> Message-ID: On 6/21/06, Yariv Sadan wrote: > > I do find it pretty > strange that Google doesn't advertise a single job for developers with > functional programming background (at least none that I could find). I think Google is solidly in the "use what works" camp. Supposedly they're heavy users of Python internally, which, while it can be used in a purely functional way, is essentially a multiparadigm language (imperative, OO, functional). From vladdu55@REDACTED Thu Jun 22 15:09:47 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Jun 2006 14:09:47 +0100 Subject: list archives privacy Message-ID: <95be1d3b0606220609g3a24f3d0p94834d2dae9d5292@mail.gmail.com> Hi! Just noticed that while in the body of the messages in the archive all emeil addresses are displayed as images, this is not the case for the date index page... regards, Vlad From roger.larsson@REDACTED Thu Jun 22 15:27:08 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 22 Jun 2006 15:27:08 +0200 Subject: R11B-0 dialyzer internal error Message-ID: <200606221527.08706.roger.larsson@norran.net> Probably I use it in a completely wrong way... (The unknoown functions did I also get during compilation) SuSE Linux 10.1 (x86-64) I am recompiling with relevant patches from threads * "Dialyzer in R11B-0" * "huge list matching -- different behaviour on x86_32 and x86_64" /RogerL > dialyzer --src Checking whether the initial PLT exists and is up-to-date... no Creating initial PLT (will take several minutes; please be patient) Unknown functions: [{i,ipb,0}, {i,ini,1}, {i,ir,0}, {i,ii,1}, {crypto,des3_cbc_decrypt,5}, {i,iaa,2}, {i,ia,2}, {i,ic,0}, {i,ib,2}, {i,ir,2}, {yecc,file,2}, {i,ia,4}, {i,iv,0}, {crypto,start,0}, {i,ibd,2}, {i,ibe,2}, {int,eval,3}, {compile,forms,2}, {i,ia,1}, {i,inq,1}, {i,iaa,1}, {i,iq,1}, {i,ii,2}, {compile,file,2}, {i,ipb,1}, {i,ini,2}, {i,ir,1}, {yecc,file,1}, {i,il,0}, {i,iba,3}, {i,ia,3}, {i,ir,3}, {i,ist,1}, {xref,m,1}, {i,im,0}, {i,ib,3}, {i,ibc,3}, {i,ip,0}, {i,help,0}, {compile,output_generated,1}] {badmatch,{error, {file_error,"/usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_init_plt", eacces}}} [{dialyzer_plt,to_dets,2}, {dialyzer_cl,return_value,1}, {dialyzer_cl_parse,doit,0}, {dialyzer_cl_parse,start,0}, {init,start_it,1}, {init,start_em,1}] dialyzer: internal error From rsaccon@REDACTED Thu Jun 22 15:34:59 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 22 Jun 2006 10:34:59 -0300 Subject: any recommendation for tutorials on functional programming In-Reply-To: <6D145AB0AF765D4988C49705263A1DBC03D52080@esealmw106.eemea.ericsson.se> References: <6D145AB0AF765D4988C49705263A1DBC03D52080@esealmw106.eemea.ericsson.se> Message-ID: Thanks very much for that link, that document now is my personal favourite for an Erlang tutorial, it includes all aspects such as functional programming but also many examples and real world case studies and it is easy readable. And within minutes that document cleared up several missunderstandings, questions and doubts I head. thanks again On 6/22/06, Stefan Axelsson L (LN/EAB) wrote: > I wrote: > >When it comes Erlang the problem is the concurrent stuff, that is > unique to Erlang (well not entirely, but you > >get my drift) and not well covered from an introductory perspective. > There are bits and pieces here and there > >(e.g. on Joe Armstrong's homepage) but no comprehensive collection that > I know of. > > I actually forgot one source. Joe Armstrong's PhD thesis is a readable > introduction to these parts of Erlang (i.e. it covers much of the ground > and doesn't get bogged down in just a few details here and there, like > many other PhD theses has a tendency to.) Get it at: > http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf > > Stefan, > -- > Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 > 3963(mobile/work) > -- Roberto Saccon From chsu79@REDACTED Thu Jun 22 15:40:05 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 22 Jun 2006 15:40:05 +0200 Subject: big erlang web solution In-Reply-To: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> Message-ID: On 6/22/06, bryan rasmussen wrote: > Hi, I've decided to work on a new web site project and I've decided to > use Erlang for it. > > The reason for using Erlang is two fold: > > 1. I want to have fun making the project. > 2. The site has to be extremely scalable. Although I might not move it > out to large scale work I want it to be able to handle it. > > Other requirements I have are as follows: > > 1. Will be hosted on a linux machine. Does anyone have any notes on > performance of Erlang and also Yaws on different 'brands' of linux. At most a linux that has epoll support in the kernel and of course an erlang VM compiled for using epoll. Though I never bothered caring about this myself so I dont know if this is enabled by default in current releases? I doubt you will have to care about this as early in the project, it is something you can "correct" later without any change to your code. > 2. I will want to have use a distributed filesystem instead of > database to access data. Any good recommendations in this context. > Database will still probably be used to hold pointers to specific data > but data will be in filesystem. This seems rather non-trivial to get right. Is it a way to work around blob-inefficiency in mnesia that has been made infamous the last weeks? First I dont know if the blob inefficy is unfair criticism or founded in actual bottlenecks everyone storing more than atomic types in their tables end up with. I'm certainly not afraid of using mnesia until it breaks rather than avoiding it altogheter in fear that i might have to work around it later. Of course, my needs are limited to a few hundred ten(s)-of-kilobyte documents. Anyway, if your files are large and you want them replicated over a fraction of the nodes in a cluster you might want to look at http://en.wikipedia.org/wiki/Distributed_hash_table Joe was in #erlang arising my interest for distributed hashes a week or two ago. I wonder if he finished any thoughts on it. There are some very interesting research in peer to peer filesharing, i suggest you look around for what scientists have published. From chsu79@REDACTED Thu Jun 22 15:42:48 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 22 Jun 2006 15:42:48 +0200 Subject: list archives privacy In-Reply-To: <95be1d3b0606220609g3a24f3d0p94834d2dae9d5292@mail.gmail.com> References: <95be1d3b0606220609g3a24f3d0p94834d2dae9d5292@mail.gmail.com> Message-ID: You too have your gmail Spam filter full of messages from mao,kanaei, nozomi, yukari... etc ? On 6/22/06, Vlad Dumitrescu wrote: > Hi! > > Just noticed that while in the body of the messages in the archive all > emeil addresses are displayed as images, this is not the case for the > date index page... > > regards, > Vlad > From rsaccon@REDACTED Thu Jun 22 15:43:52 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 22 Jun 2006 10:43:52 -0300 Subject: big erlang web solution In-Reply-To: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> Message-ID: For similar reason I just started to take a closer look at Erlang ! For distributed filesystem I found the following: http://couchdb.infogami.com/ At his blog, I asked whether CouchDB is comparable to MogileFS or Amazon S3, read his answer there: http://damienkatz.net/2006/06/coin_in_the_cou.html#comments regards Roberto On 6/22/06, bryan rasmussen wrote: > Hi, I've decided to work on a new web site project and I've decided to > use Erlang for it. > > The reason for using Erlang is two fold: > > 1. I want to have fun making the project. > 2. The site has to be extremely scalable. Although I might not move it > out to large scale work I want it to be able to handle it. > > Other requirements I have are as follows: > > 1. Will be hosted on a linux machine. Does anyone have any notes on > performance of Erlang and also Yaws on different 'brands' of linux. > > 2. I will want to have use a distributed filesystem instead of > database to access data. Any good recommendations in this context. > Database will still probably be used to hold pointers to specific data > but data will be in filesystem. > > > Cheers, > Bryan Rasmussen > -- Roberto Saccon From vladdu55@REDACTED Thu Jun 22 15:44:55 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 22 Jun 2006 14:44:55 +0100 Subject: list archives privacy In-Reply-To: References: <95be1d3b0606220609g3a24f3d0p94834d2dae9d5292@mail.gmail.com> Message-ID: <95be1d3b0606220644t40c23364v7cc44f8c8a88fa79@mail.gmail.com> No, but on the other hand it's only recently that I moved to gmail /Vlad On 6/22/06, Christian S wrote: > You too have your gmail Spam filter full of messages from mao,kanaei, > nozomi, yukari... etc ? From kostis@REDACTED Thu Jun 22 15:47:18 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 22 Jun 2006 15:47:18 +0200 (MEST) Subject: R11B-0 dialyzer internal error Message-ID: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> > ... > {badmatch,{error, > {file_error,"/usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_init_plt", > eacces}}} Looks like you do not have the proper permissions on this file. Either compile and install as root, or change its permissions manually. Kostis From serge@REDACTED Thu Jun 22 15:54:27 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 22 Jun 2006 09:54:27 -0400 Subject: release_handler Message-ID: <449AA113.600@hq.idt.net> OTP team: I've been studying the code of the sasl's release_handler, and came up with this question that perhaps someone qualified would be able to answer. As far as I understand, the following functions do the following tasks: application_controller:prep_config_change() - Fetch OLD applications' environment from application controller's internal ETS table. application_controller:config_change(EnvBefore) - Notify running applications (via config_change/3 callback) about configuration changes derived from comparing EnvBefore with the content of the application controller's ETS table storing applications' environment. application_controller:change_application_data(AppSpecs, Config) - Rereads applications' environment from config files stored on disk and stores it to the application controller's ETS table. Now with this background let's look at how the release handler does the application upgrade: ==[begin]== sasl/src/release_handler.erl ===== ... eval_appup_script(App, ToVsn, ToDir, Script) -> EnvBefore = application_controller:prep_config_change(), AppSpecL = read_appspec(App, ToDir), Res = release_handler_1:eval_script(Script, [], % [AppSpec] [{App, ToVsn, ToDir}], []), % [Opt] case Res of {ok, _Unpurged} -> application_controller:config_change(EnvBefore), application_controller:change_application_data(AppSpecL,[]); _Res -> ignore end, Res. ... ==[end]======================================= Unless I am wrong, from this code it does *not* look like application's config_change/3 callback will ever be invoked by application_controller:config_change(EnvBefore) because EnvBefore has the same applications' environment information as the current content of the applications' controller's ETS table. It seems to me that at least the config_change/1 and change_application_data/2 calls should be done in the opposite order, or better, do something like this: ... {ok, _Unpurged} -> Files = case init:get_argument(config) of {ok, [ ConfFileNames ]} -> [begin S = filename:basename(F,".config"), filename:join(filename:dirname(F), S ++ ".config") end || F <- ConfFileNames], {ok, _} -> [] end, application_controller:change_application_data(AppSpecL, Files); application_controller:config_change(EnvBefore); _Res -> ignore ... I'd appreciate some clarification on the subject. Regards, Serge From raimo@REDACTED Thu Jun 22 15:54:34 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 22 Jun 2006 15:54:34 +0200 Subject: list archives privacy References: <95be1d3b0606220609g3a24f3d0p94834d2dae9d5292@mail.gmail.com> Message-ID: vladdu55@REDACTED (Vlad Dumitrescu) writes: Crap! I was not aware of that. We will look into it in due time... > Hi! > > Just noticed that while in the body of the messages in the archive all > emeil addresses are displayed as images, this is not the case for the > date index page... > > regards, > Vlad -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joe.armstrong@REDACTED Thu Jun 22 16:05:36 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 22 Jun 2006 16:05:36 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: One point which people haven't mentioned is that it is not a good idea to point beginners, who wish to learn Erlang to texts that tell you how to learn *other* FPLs. If you are a beginner and want to learn X - find a beginners X text. Once you know X it will be slightly easier to learn Y (if both X and Y are in the same family of FPLs) Once you know X AND Y then it will be a tiny bit easier to learn Z etc. FPLs fall into families, lazy, eager, strongly typed, dynamically typed etc. Knowing a language in one family will not help you with a language in the other schools if you are a beginner. Once you know Erlang well THEN you can try O'CAML (or vice versa) Yariv Sadan said: > I like the OCaml tutorial. It's not exactly like Erlang, but it has similar concepts. To me this is like telling somebody who is interested in imperative languages (especially Perl) to read a book on python - yes they have similar concepts - but you will only be able to see the similarities when you got pretty good at both languages. The golden rule of teaching things is "only confuse people with one thing at a time" Learning Erlang is pretty easy - but not by reading an O'Caml book - the concepts are similar - but this is not blindingly obvious to a beginner. Cheers /Joes > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Roberto Saccon > Sent: den 22 juni 2006 15:35 > To: erlang-questions@REDACTED > Subject: Re: any recommendation for tutorials on functional > programming > > Thanks very much for that link, that document now is my > personal favourite for an Erlang tutorial, it includes all > aspects such as functional programming but also many examples > and real world case studies and it is easy readable. > > And within minutes that document cleared up several > missunderstandings, questions and doubts I head. > > thanks again > > On 6/22/06, Stefan Axelsson L (LN/EAB) > wrote: > > I wrote: > > >When it comes Erlang the problem is the concurrent stuff, that is > > unique to Erlang (well not entirely, but you > > >get my drift) and not well covered from an introductory > perspective. > > There are bits and pieces here and there > > >(e.g. on Joe Armstrong's homepage) but no comprehensive collection > > >that > > I know of. > > > > I actually forgot one source. Joe Armstrong's PhD thesis is > a readable > > introduction to these parts of Erlang (i.e. it covers much of the > > ground and doesn't get bogged down in just a few details here and > > there, like many other PhD theses has a tendency to.) Get it at: > > http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf > > > > Stefan, > > -- > > Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 > > 3963(mobile/work) > > > > > -- > Roberto Saccon > From emil.hellman@REDACTED Thu Jun 22 16:08:35 2006 From: emil.hellman@REDACTED (Emil Hellman) Date: Thu, 22 Jun 2006 16:08:35 +0200 Subject: Question about erlguten and images Message-ID: Hi! I'm using erlguten to produce pdf's based on data stored in an mnesia table. Getting erlguten to print out the information is real easy using the functions in pdf.erl. However, I would now like to have a little logo on my pdfs and here I have run into a problem. In the code I'm using: PDF = pdf:new(), pdf:set_pagesize(PDF,a4), pdf:set_author(PDF,"Test"), pdf:set_title(PDF, "Test"), pdf:set_subject(PDF,""), pdf:set_keywords(PDF,""), {Y, M, D} = date(), pdf:set_date(PDF,Y,M,D), pdf:new_page(PDF), pdf:set_page(PDF,1), pdf:moveto(PDF, {50, 775}), pdf:image(PDF, "frs.JPG"), Serialised = pdf:export(PDF), file:write_file("test.pdf",[Serialised]), pdf:delete(PDF). The pdf file gets generated, however, when I open the file in acrobat reader I get the following message: Could not find the XObject named 'Im1'. I've tried to give the absolute path to the image file, but that had no effect so I'm at a bit of a loss. I'm sure I've missed something, but I can't find what it is. Should I call some other functions before using pdf:image/2? Should I go about generating the pdf's in another manner? Thanks! - Emil From roger.larsson@REDACTED Thu Jun 22 16:12:11 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 22 Jun 2006 16:12:11 +0200 Subject: R11B-0 dialyzer internal error In-Reply-To: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> References: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> Message-ID: <200606221612.11600.roger.larsson@norran.net> Patches did not help, I guess they wont hurt either... On Thursday 22 June 2006 15:47, Kostis Sagonas wrote: > > ... > > {badmatch,{error, > > {file_error,"/usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_init_ > >plt", eacces}}} > > Looks like you do not have the proper permissions on this file. > Either compile and install as root, or change its permissions > manually. > I saw that too.. File has access: -rw-r--r-- 1 root root 1380740 2006-06-22 15:36 /usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_init_plt Hmm... I guess dialyzer wants to write to this file? I compiled erlang as myself, then changed to root for > make install Should an initial dialyzer run be made in the "make install"? /RogerL From stefan.l.axelsson@REDACTED Thu Jun 22 17:20:22 2006 From: stefan.l.axelsson@REDACTED (Stefan Axelsson L (LN/EAB)) Date: Thu, 22 Jun 2006 17:20:22 +0200 Subject: any recommendation for tutorials on functional programming Message-ID: <6D145AB0AF765D4988C49705263A1DBC03D52525@esealmw106.eemea.ericsson.se> -----Original Message----- >From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Joe Armstrong > One point which people haven't mentioned is that it is not a good idea to point beginners, who wish to learn > Erlang to texts that tell you how to learn *other* FPLs. In fairness, the original call for assistance was: "Anybody knows some good tutorial on functional programmming languages (and if specific to erlang, even better)." Which I would put in slightly different bin than the "I want to learn Erlang" category, i.e. the requester having problems wrapping his head around the whole functional "thing" as in "what/how can I think about doing stuff with this." At that level I wouldn't necessarily rule out e.g. the O'Caml book, as it shares enough features (pattern matching, strict evaluation) that enough tricks could be picked up to get used to the paradigm. Not that it's ideal, that's a given. I'm assuming here of course that we're talking about someone who is new to functional programming, not programming per se. Stefan, -- Stefan Axelsson PhD (ERVSTAX) PDU PCN Syst. Mgmt. tel: 031-747 3963 (mobile/work) From roger.larsson@REDACTED Thu Jun 22 22:53:30 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 22 Jun 2006 22:53:30 +0200 Subject: R11B-0 dialyzer internal error In-Reply-To: <200606221612.11600.roger.larsson@norran.net> References: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> <200606221612.11600.roger.larsson@norran.net> Message-ID: <200606222253.31188.roger.larsson@norran.net> On Thursday 22 June 2006 16:12, Roger Larsson wrote: > Patches did not help, I guess they wont hurt either... > > On Thursday 22 June 2006 15:47, Kostis Sagonas wrote: > > > ... > > > {badmatch,{error, > > > {file_error,"/usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_ini > > >t_ plt", eacces}}} > > > > Looks like you do not have the proper permissions on this file. > > Either compile and install as root, or change its permissions > > manually. > > I saw that too.. > > File has access: > -rw-r--r-- 1 root root 1380740 2006-06-22 > 15:36 /usr/local/lib/erlang/lib/dialyzer-1.4.1/plt/dialyzer_init_plt > > Hmm... I guess dialyzer wants to write to this file? > > I compiled erlang as myself, then changed to root for > > > make install > A dialyze run as root fixes the problem. > Should an initial dialyzer run be made in the "make install"? Should it? /RogerL From roger.larsson@REDACTED Thu Jun 22 23:25:46 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 22 Jun 2006 23:25:46 +0200 Subject: dialyzer: will it ever catch out of bounds errors like this? Message-ID: <200606222325.46503.roger.larsson@norran.net> -module(bounds). -export([wrong/0, harder/1]). wrong() -> lists:nth(4, [1, 2, 3]). triple(X) -> lists:duplicate(3, X). harder(X) -> lists:nth(4, triple(X)). As wanted in "The Next Mainstream Programming Language" http://www.st.cs.uni-sb.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf (Haskell for Next Generation Games) /RogerL From sanjaya@REDACTED Fri Jun 23 15:02:26 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Fri, 23 Jun 2006 18:32:26 +0530 Subject: xmerl - \n\r Message-ID: <02e901c696c5$48d85a60$9a0a10ac@wavenet.lk> Hi Error: 19> xmerl_scan:file('f1.xml',[{validation,true}]). 1007- fatal: {invalid_target_name," version=\""} ** exited: {fatal,{{invalid_target_name," version=\""}, {file,'f1.xml'}, {line,2}, {col,6}}} ** 20> Reason: "escape characters" (\n\r) or "Space" in the beginning of file as below. \r\n Your message has been recorded. Press 1 to send the message, press 2 to listen to the message, or press 3 to record the message again. http://172.22.6.28:8080/vsms/send/index.jsp http://172.22.6.28:8080/vsms/send/index.jsp http://172.22.6.28:8080/vsms/send/index.jsp 773215936&vw=ssendmenu&cli=773215936&date=200606231726796&serv=777331370&id=99&filename=777331370200606231726796.vox&lang=E&starttime=1151061961&frm=null&msgBox=null&fileNo=null Question: 1.) -- must be in the staring point of a xml file ??? 2.) how to avoid such situation ??? (without checking all xml files). Are there any way to tell parser to avoid those characters ??? Thanks in advance Sanjaya Vitharana -------------- next part -------------- An HTML attachment was scrubbed... URL: From alabala111@REDACTED Fri Jun 23 15:21:22 2006 From: alabala111@REDACTED (F2 L2) Date: Fri, 23 Jun 2006 13:21:22 +0000 Subject: Random access to terms in ETS table. Message-ID: Is there a way to randomly access terms stored for example in ETS table. I.e. I want to randomly sample from the tuples stored in ETS table without knowing the keys. _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ From her@REDACTED Fri Jun 23 22:57:41 2006 From: her@REDACTED (Helmut Enck-Radana) Date: Fri, 23 Jun 2006 22:57:41 +0200 Subject: xmerl - \n\r In-Reply-To: <02e901c696c5$48d85a60$9a0a10ac@wavenet.lk> References: <02e901c696c5$48d85a60$9a0a10ac@wavenet.lk> Message-ID: <7.0.1.0.0.20060623215043.01be35f0@paradigma-software.de> At 15:02 2006-06-23, Sanjaya Vitharana wrote: [...] >Reason: "escape characters" (\n\r) or "Space" in the beginning of >file as below. [...] >Question: >1.) -- must be in the staring point of a xml file ??? According to http://www.w3.org/TR/2004/REC-xml-20040204/#sec-well-formed the XML-declaration must not be preceeded by anything except a byte-order mark. This is also explained in http://www.w3.org/TR/2004/REC-xml-20040204/#sec-guessing. The XML-declaration is not necessary, when the encoding is UTF-8, UTF-16 or US ASCII. If there is no XML-declaration, an XML entity may start with white space characters, according to http://www.w3.org/TR/2004/REC-xml-20040204/#NT-prolog. -- Helmut From mikael.karlsson@REDACTED Sat Jun 24 08:17:44 2006 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sat, 24 Jun 2006 08:17:44 +0200 Subject: Question about erlguten and images In-Reply-To: References: Message-ID: <200606240817.45537.mikael.karlsson@creado.com> Hi Emil, I think you found a bug in an older version of ErlGuten. Can you see a section like: 1 0 obj << /Type /XObject /Subtype /Image /Width 183 /Height 300 /Filter /DCTDecode /ColorSpace /DeviceRGB /BitsPerComponent 8 /Length 17336 >> And a second after the image stream like: 2 0 obj << /Im1 1 0 R >> ? Mikael torsdag 22 juni 2006 16:08 skrev Emil Hellman: > Hi! > > I'm using erlguten to produce pdf's based on data stored in an mnesia > table. Getting erlguten to print out the information is real easy > using the functions in pdf.erl. However, I would now like to have a > little logo on my pdfs and here I have run into a problem. > > In the code I'm using: > > PDF = pdf:new(), > pdf:set_pagesize(PDF,a4), > pdf:set_author(PDF,"Test"), > pdf:set_title(PDF, "Test"), > pdf:set_subject(PDF,""), > pdf:set_keywords(PDF,""), > {Y, M, D} = date(), > pdf:set_date(PDF,Y,M,D), > pdf:new_page(PDF), > pdf:set_page(PDF,1), > pdf:moveto(PDF, {50, 775}), > pdf:image(PDF, "frs.JPG"), > Serialised = pdf:export(PDF), > file:write_file("test.pdf",[Serialised]), > pdf:delete(PDF). > > > The pdf file gets generated, however, when I open the file in acrobat > reader I get the following message: > > Could not find the XObject named 'Im1'. > > I've tried to give the absolute path to the image file, but that had > no effect so I'm at a bit of a loss. I'm sure I've missed something, > but I can't find what it is. Should I call some other functions before > using pdf:image/2? Should I go about generating the pdf's in another > manner? > > Thanks! > - Emil From serge@REDACTED Sat Jun 24 17:31:17 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 24 Jun 2006 11:31:17 -0400 Subject: edoc custom XML layout Message-ID: <449D5AC5.3030102@hq.idt.net> Hi, I am trying to figure out how to write a custom layout module for edoc in order to export Erlang documentation to an XML format suitable for including in our internal documentation site powered by the Appache's Forrest engine (forrest.apache.org). As the edoc's documentation doesn't mention the guidelines for creating custom layouts, is there any reference or samples with some helpful info (other than the *.erl sources)? I tried to call edoc:read/2, but it doesn't seem to work with otpsgml_layout: 23> pwd(). /opt/erlang/R11B-0/lib/erlang/lib/edoc-0.6.9/src ok 24> edoc:read("edoc_layout.erl", [{layout, edoc_layout}]). [" edoc:read("edoc_layout.erl", [{layout, otpsgml_layout}]). edoc: error in layout 'otpsgml_layout': {'EXIT',{badarg,[{erlang,binary_to_list,[{aname,[[82,105,99,104,97,114,100|...]]}]},{xmerl_lib,export_text,2},{xmerl_lib,export_text,2},{xmerl,apply_cb,5},{xmerl,export_content,2},{xmerl,export_content,2},{xmerl,export_content,2},{xmerl,export_content,2}]}}. ** exited: error ** Is my assumption correct that I would need to create a xxx_layout.erl module similar to otpsgml_layout, and then make the following call to generate edoc documentation using that layout: edoc:run([], ["my_file.erl"], [{layout, xxx_layout}]). I am only guessing because edoc:run/3 doesn't mention the {layout, Layout} option. Regards, Serge From ke.han@REDACTED Sun Jun 25 14:47:34 2006 From: ke.han@REDACTED (ke han) Date: Sun, 25 Jun 2006 20:47:34 +0800 Subject: big erlang web solution In-Reply-To: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> Message-ID: <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> On Jun 22, 2006, at 8:37 PM, bryan rasmussen wrote: > Hi, I've decided to work on a new web site project and I've decided to > use Erlang for it. > > The reason for using Erlang is two fold: > > 1. I want to have fun making the project. > 2. The site has to be extremely scalable. Although I might not move it > out to large scale work I want it to be able to handle it. > > Other requirements I have are as follows: > > 1. Will be hosted on a linux machine. Does anyone have any notes on > performance of Erlang and also Yaws on different 'brands' of linux. As to performance, I doubt you will find substantial performance differences between different linux distros (assuming same kernel and use of epoll if appropriate to your app). That said, I have had lots of success with erlang/yaws on freeBSD 6.1. The kpoll (equivalent to epoll on linux) is built into freeBSD and is used by default from the erlang ports installation. The performance of your app will be mostly due to your overall app design, not the OS kernel as both the linux and BSD kernels are quite sufficient for erlang scaling. I bring up freeBSD 6.1 because I have it found it a much more carefully managed _server_ OS than any of the major linux distros. > > 2. I will want to have use a distributed filesystem instead of > database to access data. Any good recommendations in this context. > Database will still probably be used to hold pointers to specific data > but data will be in filesystem. I have similar needs in the near future. My desire is to use mensia for my main OLTP data store and have a filesystem store for documents. I need full text search and easy admin for this file system document store. If you find a product that does this, please let me know. good luck, ke han > > > Cheers, > Bryan Rasmussen From ulf.wiger@REDACTED Sun Jun 25 19:08:25 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Sun, 25 Jun 2006 19:08:25 +0200 Subject: Random access to terms in ETS table. Message-ID: You could build something around ets:slot(Tab, I). BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of F2 L2 > Sent: den 23 juni 2006 15:21 > To: erlang-questions@REDACTED > Subject: Random access to terms in ETS table. > > Is there a way to randomly access terms stored for example in > ETS table. > I.e. I want to randomly sample from the tuples stored in ETS > table without knowing the keys. > > _________________________________________________________________ > FREE pop-up blocking with the new MSN Toolbar - get it now! > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ > > From yarivvv@REDACTED Sun Jun 25 19:56:02 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 25 Jun 2006 13:56:02 -0400 Subject: big erlang web solution In-Reply-To: <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> Message-ID: <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> > > 2. I will want to have use a distributed filesystem instead of > > database to access data. Any good recommendations in this context. > > Database will still probably be used to hold pointers to specific data > > but data will be in filesystem. > > I have similar needs in the near future. My desire is to use mensia > for my main OLTP data store and have a filesystem store for > documents. I need full text search and easy admin for this file > system document store. If you find a product that does this, please > let me know. > Hi, Just out of curiosity, what kind of characteristics are you looking for in a distributed file system? I'm in the initial stages of building a web application that needs to store files on disc (not huge files, probably only images), and my planned approach at the moment is to store file metadata and pointer to physical location in a distributed database -- either MySQL or Mnesia (I prefer Mnesia, but at the moment, it looks like I'm going to have to use MySQL to store at least some of my data, so I might end up using MySQL exclusively -- I haven't made up my mind yet). What's the primary motivation for using a distributed file system over a database-backed approach? Best regards, Yariv From rsaccon@REDACTED Sun Jun 25 23:26:11 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 25 Jun 2006 18:26:11 -0300 Subject: mnesia key of last inserted record Message-ID: How can I get the key of the last inserted record at mensia ? Right after mnesia:write I need to know the key. I think could construct something with mnesia:match_object() to retrieve that key, but there must must be something smarter and with less overhead to get that key ! regards -- Roberto Saccon From ryanobjc@REDACTED Mon Jun 26 00:12:58 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Sun, 25 Jun 2006 15:12:58 -0700 Subject: mnesia key of last inserted record In-Reply-To: References: Message-ID: <78568af10606251512k5d2b8770x6e5f2112ba0bdeeb@mail.gmail.com> Since mnesia doesn't support 'auto increment' the last key is whatever it was you chose! Meaning that the first field in your tuple is the key of the record, thus whatever it is you had it set to is what it is. If you want to support sequences, you need to do a seperate sequence fetch in your own code, and thus know what the artifical key would be. Specifically you would have code like: Record=#myRec{a=1,b=2,c=3} , mnesia:write(Record) , %%% what is the key? Well the key is '1' since a=1 -ryan On 6/25/06, Roberto Saccon wrote: > How can I get the key of the last inserted record at mensia ? Right > after mnesia:write I need to know the key. I think could construct > something with mnesia:match_object() to retrieve that key, but there > must must be something smarter and with less overhead to get that key > ! > > regards > -- > Roberto Saccon > From rsaccon@REDACTED Mon Jun 26 04:23:33 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 25 Jun 2006 23:23:33 -0300 Subject: mnesia key of last inserted record In-Reply-To: <78568af10606251512k5d2b8770x6e5f2112ba0bdeeb@mail.gmail.com> References: <78568af10606251512k5d2b8770x6e5f2112ba0bdeeb@mail.gmail.com> Message-ID: Uuff, I "assumed" the key is not part of the provided record and autoincremented by mnesia. But now everything is clarified, thanks. On 6/25/06, Ryan Rawson wrote: > Since mnesia doesn't support 'auto increment' the last key is whatever > it was you chose! Meaning that the first field in your tuple is the > key of the record, thus whatever it is you had it set to is what it > is. If you want to support sequences, you need to do a seperate > sequence fetch in your own code, and thus know what the artifical key > would be. > > Specifically you would have code like: > > Record=#myRec{a=1,b=2,c=3} , > mnesia:write(Record) , > %%% what is the key? Well the key is '1' since a=1 > > -ryan > > On 6/25/06, Roberto Saccon wrote: > > How can I get the key of the last inserted record at mensia ? Right > > after mnesia:write I need to know the key. I think could construct > > something with mnesia:match_object() to retrieve that key, but there > > must must be something smarter and with less overhead to get that key > > ! > > > > regards > > -- > > Roberto Saccon > > > -- Roberto Saccon From ok@REDACTED Mon Jun 26 05:26:55 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 26 Jun 2006 15:26:55 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606260326.k5Q3QtBU302745@atlas.otago.ac.nz> What I wrote about Java strings turns out not to be true. Substrings *do* share their character array with their parent, and string.substring(begin, end) *is* an O(1) operation, although this doesn't seem to be documented in the official Java documentation, so one presumably cannot rely on it. That's the good news for Java. The bad news is that the space overheads are high, there is a space leak, and while the performance is better than Erlang, it isn't _that_ much better, and the difference has very little to do with using lists. It turns out that Peter Norvig has measured the space overheads, and a Java string of N characters requires 40 + 4*ceil(N/2) bytes on a 32-bit machine. (On a 64-bit machine, I'm guessing it would be 64 + 8*ceil(N/4).) An Erlang string requires 8N bytes on a 32-bit machine (16N on a 64-bit one). So on a 32-bit machine, strings of 0..7 characters held as Erlang lists are smaller than they would be in Java, and strings of 8 or more characters are larger. This means that with a little care, a collection of words held in Erlang can take _less_ space than a collection of words in Java. What about the space leak? Suppose we construct a Java String of one million characters, call it x. Then we do x = x.substring(0, 1); Now there is only one useful character, BUT all million characters will be retained. That's a space leak. A sufficiently smart garbage collector could work around that. In fact my very first publication described just such a garbage collector. But I have seen no evidence in any Sun publication that they have one. So when you are splitting a string into pieces in Java, it is up to you to either - ensure that all the pieces are dead when the original string is dead, or - do x = new String(x) for each non-dead piece. With strings implemented just as lists, the very common case of shared tails requires no manual intervention. If you implement strings as trees, there is still no large scale leakage. It's _only_ when strings are handled as array slices that this can happen. (ML has "substring" as a type that is distinct from "string" to help the programmer keep track.) What about time? In Erlang, we can get at the first character of "fred" in *one* memory reference. In Java, "fred".charAt(0) requires - NO dynamic dispatch (String is a final class) unless you go through the CharSequence interface - check 0 against the string length (memory reference to pick it up) - add the offset (another memory reference) - fetch the array (another memory reference) - check 0+offset against array size (another memory reference) - fetch the code (the last reference) for a total of 5 memory references. So, given a sufficiently smart Erlang compiler, we'd expect access to any of the first few characters of a string to be faster in Erlang than in Java. Alas, current Erlang compilers aren't that smart. I wrote a little test program in several languages to see how fast string access was. Here's the Java code: private static int hash(String s) { int h = 0; for (int i = s.length(); --i >= 0; ) h = (h*31 + (int)s.charAt(i)) % 1645499; return h; } Here's the Erlang equivalent: hash(Cs) -> hash(Cs, 0). hash([C|Cs], H) -> hash(Cs, (H*31 + C) rem 1645499); hash([], H) -> H. (compiled with the 'inline' option, hash/1 goes away). Here's the Haskell equivalent: hash :: [Int] -> Int hash cs = aux cs 0 where aux (c:cs) h = aux cs ((h*31 + c) `mod` 1645499) aux [] h = h How long does it take _per character_ to compute this hash function? 14.4 AWK 2.06 usec (Mawk 1.4) 4.8 Erlang 0.68 usec (Erlang R11B) 2.0 Haskell 0.29 usec (GHC 6.2) 1.4 Java 0.195 usec (Sun Java 1.4.2 SDK) 1.0 C 0.143 usec (GCC 3.3.2, -O4) all on a 500MHz UltraSPARC II but compiled for 32 bits. We note that Haskell and Erlang are using the *same* representation for sequences here; we would expect them to be going through the *same* steps at run time. (Haskell is lazy, but GHC is smart enough to figure out that this particular function would benefit from being compiled as strict.) It might perhaps be to do with Haskell being typeful and Erlang not. The Erlang : Haskell ratio tells us that compiler quality accounts for more (a factor of 2.4) than data representation (a factor of 2.0) for this particular test. The Java : C ratio tells us that Sun's Java compiler is actually doing a pretty good job with this chunk of code; SPARCs have never been very good at division, so a fair bit of the time is probably going in the remainder. (Which I stuck in to make this a reasonable test; usually you are doing _something_ rather more interesting with the characters.) AWK is usually regarded as being reasonably good at strings. My initial C times were a lot smaller than that because I used Sun's C compiler, which was bright enough to spot that hash(s, n) was constant... So was GHC until I modified the code so it wasn't. Whether you want to call this being "weak" at strings or not, I don't see any evidence here that Erlang is weak*er* at strings than at any other kind of data structure. From nm@REDACTED Mon Jun 26 08:26:13 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 26 Jun 2006 11:26:13 +0500 Subject: big erlang web solution In-Reply-To: <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> Message-ID: <449F7E05.3040400@web.am> ke han wrote: >> 1. Will be hosted on a linux machine. Does anyone have any notes on >> performance of Erlang and also Yaws on different 'brands' of linux. > > I bring up freeBSD 6.1 because I have it found it a much more carefully > managed _server_ OS than any of the major linux distros. as old freebsd admin I will fully agree :) >> >> 2. I will want to have use a distributed filesystem instead of >> database to access data. Any good recommendations in this context. >> Database will still probably be used to hold pointers to specific data >> but data will be in filesystem. > > I have similar needs in the near future. My desire is to use mensia for > my main OLTP data store and have a filesystem store for documents. I > need full text search and easy admin for this file system document > store. If you find a product that does this, please let me know. > > good luck, ke han > what about http://vodka.lfcia.org/ ? in other hand - it seems that creating distributed storage using erlang to monitor fs and transfer files on demand seems to be not so difficult -- especially if you can prohibit concurrent updates for same file on different nodes - to avoid all conflicts and conflict resolution logic. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From ke.han@REDACTED Mon Jun 26 08:32:11 2006 From: ke.han@REDACTED (ke han) Date: Mon, 26 Jun 2006 14:32:11 +0800 Subject: big erlang web solution In-Reply-To: <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> Message-ID: <893CED66-CB54-44D8-9D4C-4365663D5894@redstarling.com> On Jun 26, 2006, at 1:56 AM, Yariv Sadan wrote: >> > 2. I will want to have use a distributed filesystem instead of >> > database to access data. Any good recommendations in this context. >> > Database will still probably be used to hold pointers to >> specific data >> > but data will be in filesystem. >> >> I have similar needs in the near future. My desire is to use mensia >> for my main OLTP data store and have a filesystem store for >> documents. I need full text search and easy admin for this file >> system document store. If you find a product that does this, please >> let me know. >> > > Hi, > > Just out of curiosity, what kind of characteristics are you looking > for in a distributed file system? My needs are a little less "distributed" and more full text search and splitting of data between "semantic+OLTP" and "doc search": (1) store documents in HTML or other markup (Markdown) in utf-8. Documents will fall into different types or groups such as "service description", "service results", "account details", etc... For example, a document of type "service description" might be a simple resume of a person and his skill set. There is little or no semantic info in the docs. i.e. the docs are to be referenced by the OLTP _and_ to be used in full text search. The document types are simple and do not overlap. i.e., You can think of each type as a directory containing all docs of that type. No subtypes / subdirectories. No doc belongs to more than one type; i.e. no need for file links (sym or hard). (2) semantic docs - The docs in 1 do no have much semantics internal to them. Any semantics are either (a) stored in the OLTP and reference docs or (b) stored in special attribute areas of the docs to be used by tools other than the full text search requirements herein. (3) full text search and index maintenance - docs must be full text searchable by type (which would imply a file directory). Index of text search must be automatic as docs are added/removed/modified. This part of the system must be zero admin (or close to it). I don't care much about the size of index files; disk space is cheap. I care more about fast performance and low memory footprint of queries, usefulness of query results, and low admin of entire search system. (4) search results must be "google-like". (a) results contain enough highlighted context to the original search to let the user know which item in the results are worth digging into. (b) queries have "continuations". meaning I don't have to retrieve all 100,000 matching results in one chunk just to show the user the first three pages. This aspect must have low memory consumption. (5) distribution - all access to the docs and queries will be through an erlang node, distribution can be through erlang thus we are a bit free here. I expect that since full text search will be outside erlang and a search will only use the file resources of its local disks (direct attached or SAN). No searches spanning slow internet attached file systems. (6) access and scaling - To get a physical picture of what I plan to implement, imagine: (A) 2 x erlang+yaws+mnesia servers each with power and disk (RAID 1) redundancy. This is a load balanced and failover config...so each server has the full capabilities of the other with one being the lead server for certain shared info. (B) 2 x file servers+full text search. This can be either a shared RAID 1+0 file system or two separate RAID 0 file systems. These servers are only queriable via A, the erlang servers. > I'm in the initial stages of > building a web application that needs to store files on disc (not huge > files, probably only images), and my planned approach at the moment is > to store file metadata and pointer to physical location in a > distributed database -- either MySQL or Mnesia (I prefer Mnesia, but > at the moment, it looks like I'm going to have to use MySQL to store > at least some of my data, so I might end up using MySQL exclusively -- Any reasons why MySQL over PostgreSQL? If its due to erlang access, I know that ejabberd accesses postgresql so there is a working native driver for it. > I haven't made up my mind yet). What's the primary motivation for > using a distributed file system over a database-backed approach? > Mainly the full text search and having no need to store docs or blobs in a DB. also, over time, I want to write other utils besides full text search that utilize the docs and I think referencing them via a file system gives me more options than having docs stored as fields in a DB. thanks for taking time to brainstorm on this topic. I need persons who can share their experiences on various tools. ke han > Best regards, > Yariv From ft@REDACTED Mon Jun 26 08:42:00 2006 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 26 Jun 2006 08:42:00 +0200 Subject: R11B-0 dialyzer internal error In-Reply-To: <200606222253.31188.roger.larsson@norran.net> References: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> <200606221612.11600.roger.larsson@norran.net> <200606222253.31188.roger.larsson@norran.net> Message-ID: <200606260842.00280.ft@it.su.se> On Thursday 22 June 2006 22:53, Roger Larsson wrote: ... > A dialyze run as root fixes the problem. > > > Should an initial dialyzer run be made in the "make install"? > > Should it? Yes, I think it should - or the path to the PLT should include $HOME. /Fredrik From ryanobjc@REDACTED Mon Jun 26 09:25:13 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Mon, 26 Jun 2006 00:25:13 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606260326.k5Q3QtBU302745@atlas.otago.ac.nz> References: <200606260326.k5Q3QtBU302745@atlas.otago.ac.nz> Message-ID: <78568af10606260025s3dfdfb50h7ee9fe35351850ea@mail.gmail.com> Excellent, thank you for that write up. There is a general perception that Erlang is no good at strings. Part of the issue is the whole 'lists of integers' and people freak on the memory requirements. The other part I think is the Unicode support. Care to speak to that? -ryan On 6/25/06, Richard A. O'Keefe wrote: > What I wrote about Java strings turns out not to be true. > Substrings *do* share their character array with their parent, > and string.substring(begin, end) *is* an O(1) operation, > although this doesn't seem to be documented in the official > Java documentation, so one presumably cannot rely on it. > That's the good news for Java. > The bad news is that the space overheads are high, > there is a space leak, > and while the performance is better than Erlang, it isn't _that_ much better, > and the difference has very little to do with using lists. > > It turns out that Peter Norvig has measured the space overheads, > and a Java string of N characters requires 40 + 4*ceil(N/2) bytes on a 32-bit > machine. (On a 64-bit machine, I'm guessing it would be 64 + 8*ceil(N/4).) > An Erlang string requires 8N bytes on a 32-bit machine (16N on a 64-bit one). > > So on a 32-bit machine, strings of 0..7 characters held as Erlang lists > are smaller than they would be in Java, and strings of 8 or more characters > are larger. > > This means that with a little care, a collection of words held in Erlang > can take _less_ space than a collection of words in Java. > > What about the space leak? Suppose we construct a Java String of one > million characters, call it x. Then we do > x = x.substring(0, 1); > Now there is only one useful character, BUT all million characters will > be retained. That's a space leak. A sufficiently smart garbage collector > could work around that. In fact my very first publication described just > such a garbage collector. But I have seen no evidence in any Sun publication > that they have one. So when you are splitting a string into pieces in Java, > it is up to you to either > - ensure that all the pieces are dead when the original string is dead, or > - do x = new String(x) for each non-dead piece. > > With strings implemented just as lists, the very common case of shared tails > requires no manual intervention. If you implement strings as trees, there > is still no large scale leakage. It's _only_ when strings are handled as > array slices that this can happen. (ML has "substring" as a type that is > distinct from "string" to help the programmer keep track.) > > What about time? > > In Erlang, we can get at the first character of "fred" in *one* memory > reference. In Java, "fred".charAt(0) requires > - NO dynamic dispatch (String is a final class) > unless you go through the CharSequence interface > - check 0 against the string length (memory reference to pick it up) > - add the offset (another memory reference) > - fetch the array (another memory reference) > - check 0+offset against array size (another memory reference) > - fetch the code (the last reference) > for a total of 5 memory references. > > So, given a sufficiently smart Erlang compiler, we'd expect access to > any of the first few characters of a string to be faster in Erlang than > in Java. > > Alas, current Erlang compilers aren't that smart. > > I wrote a little test program in several languages to see how fast > string access was. Here's the Java code: > > private static int hash(String s) { > int h = 0; > for (int i = s.length(); --i >= 0; ) > h = (h*31 + (int)s.charAt(i)) % 1645499; > return h; > } > > Here's the Erlang equivalent: > > hash(Cs) -> > hash(Cs, 0). > > hash([C|Cs], H) -> > hash(Cs, (H*31 + C) rem 1645499); > hash([], H) -> > H. > > (compiled with the 'inline' option, hash/1 goes away). > > Here's the Haskell equivalent: > > hash :: [Int] -> Int > > hash cs = aux cs 0 > where aux (c:cs) h = aux cs ((h*31 + c) `mod` 1645499) > aux [] h = h > > How long does it take _per character_ to compute this hash function? > > 14.4 AWK 2.06 usec (Mawk 1.4) > 4.8 Erlang 0.68 usec (Erlang R11B) > 2.0 Haskell 0.29 usec (GHC 6.2) > 1.4 Java 0.195 usec (Sun Java 1.4.2 SDK) > 1.0 C 0.143 usec (GCC 3.3.2, -O4) > > all on a 500MHz UltraSPARC II but compiled for 32 bits. > > We note that Haskell and Erlang are using the *same* representation for > sequences here; we would expect them to be going through the *same* steps > at run time. (Haskell is lazy, but GHC is smart enough to figure out that > this particular function would benefit from being compiled as strict.) > It might perhaps be to do with Haskell being typeful and Erlang not. > > The Erlang : Haskell ratio tells us that compiler quality accounts for > more (a factor of 2.4) than data representation (a factor of 2.0) for this > particular test. The Java : C ratio tells us that Sun's Java compiler is > actually doing a pretty good job with this chunk of code; SPARCs have > never been very good at division, so a fair bit of the time is probably > going in the remainder. (Which I stuck in to make this a reasonable test; > usually you are doing _something_ rather more interesting with the characters.) > AWK is usually regarded as being reasonably good at strings. > > My initial C times were a lot smaller than that because I used Sun's C > compiler, which was bright enough to spot that hash(s, n) was constant... > So was GHC until I modified the code so it wasn't. > > Whether you want to call this being "weak" at strings or not, > I don't see any evidence here that Erlang is weak*er* at strings > than at any other kind of data structure. > > From Tobias.Lindahl@REDACTED Mon Jun 26 10:48:20 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Mon, 26 Jun 2006 10:48:20 +0200 Subject: dialyzer: will it ever catch out of bounds errors like this? In-Reply-To: <200606222325.46503.roger.larsson@norran.net> References: <200606222325.46503.roger.larsson@norran.net> Message-ID: <449F9F54.4020009@it.uu.se> In Dialyzer lists are collapsed to include the contents and the termination. The length of a list is not recorded, only if it is a non-empty list. Roger Larsson wrote: > -module(bounds). > -export([wrong/0, harder/1]). > > wrong() -> lists:nth(4, [1, 2, 3]). This could probablybly be caught by a special case for constant lists, but currently it is not. > triple(X) -> lists:duplicate(3, X). > harder(X) -> lists:nth(4, triple(X)). This is not caught since the return type of triple/1 is [any(),...] which indicates a non-empty list containing anything. The information that it is of length 3 is not recorded. In general I do not think that a more precise list type would be worth the extra work (both for the analysis and for me ;-). I have been thinking about using a list type that explicitly captures the cons-cells up to a limit and then abstracts into the current representation, but typically the only time this kind of information would be found is in small constructed examples such as the one above. Recursion over lists most often do not have a limit on the size of the list, and the input list is seldom a constant outside the wonderful world of benchmarks. Best, Tobias > > > As wanted in "The Next Mainstream Programming Language" > http://www.st.cs.uni-sb.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf > (Haskell for Next Generation Games) > > /RogerL From Tobias.Lindahl@REDACTED Mon Jun 26 10:56:58 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Mon, 26 Jun 2006 10:56:58 +0200 Subject: R11B-0 dialyzer internal error In-Reply-To: <200606260842.00280.ft@it.su.se> References: <200606221347.k5MDlI2s008233@spikklubban.it.uu.se> <200606221612.11600.roger.larsson@norran.net> <200606222253.31188.roger.larsson@norran.net> <200606260842.00280.ft@it.su.se> Message-ID: <449FA15A.7030201@it.uu.se> During the make Dialyzer builds the dialyzer_init_plt. It also records a md5-sum of the included files. A make install moves files around, but this should not really change anything. Dialyzer should not have to write to the dialyzer_init_plt unless some of the analyzed files are changed, so there should be no reason for it to write to the plt just because of a make install. I will have a look at what is happening. I guess I really have to do a make install at some point anyway... Tobias Fredrik Thulin wrote: > On Thursday 22 June 2006 22:53, Roger Larsson wrote: > ... > >>A dialyze run as root fixes the problem. >> >> >>>Should an initial dialyzer run be made in the "make install"? >> >>Should it? > > > Yes, I think it should - or the path to the PLT should include $HOME. > > /Fredrik From rasmussen.bryan@REDACTED Mon Jun 26 11:09:10 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 26 Jun 2006 11:09:10 +0200 Subject: big erlang web solution In-Reply-To: <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> Message-ID: <3bb44c6e0606260209r64e174a0y677ec959aee59ad0@mail.gmail.com> > Just out of curiosity, what kind of characteristics are you looking > for in a distributed file system? I'm in the initial stages of > building a web application that needs to store files on disc (not huge > files, probably only images), and my planned approach at the moment is > to store file metadata and pointer to physical location in a > distributed database -- either MySQL or Mnesia (I prefer Mnesia, but > at the moment, it looks like I'm going to have to use MySQL to store > at least some of my data, so I might end up using MySQL exclusively -- > I haven't made up my mind yet). What's the primary motivation for > using a distributed file system over a database-backed approach? It has been my experience (limited), and my observation that a filesystem approach scales better than an exclusive database approach and is furthermore more maintable because scaling a large database based solution often requires further optimization, changes to the database. Thus I like to keep database usage to a minimum. I also do not like to keep web data, documents, or similar things in a database because it is not likely to be especially well suited to representation in a database in the same way that customer records are. At any rate for the maintainability issue, I don't want to go mucking about in the database and my schemas if I want to do an upgrade of my app. The caveat about filesystem scaling better is however that an optimized filesystem is supposed. Cheers, Bryan Rasmussen From rasmussen.bryan@REDACTED Mon Jun 26 11:12:14 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 26 Jun 2006 11:12:14 +0200 Subject: big erlang web solution In-Reply-To: <449F7E05.3040400@web.am> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> <449F7E05.3040400@web.am> Message-ID: <3bb44c6e0606260212rc9ec27j1bad469595a1a757@mail.gmail.com> > > > > what about http://vodka.lfcia.org/ ? > I've looked at vodka before, and the documents are really good reading, but I've never noticed anything executable, compilable, or other interpretable as an application in itself that one could download. Are there any files that one can access and run? Note: I fully understand if there isn't but I'm just hoping. Cheers, Bryan Rasmussen From rasmussen.bryan@REDACTED Mon Jun 26 11:15:44 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Mon, 26 Jun 2006 11:15:44 +0200 Subject: erlang rdf? Message-ID: <3bb44c6e0606260215g6fe8bc13t1e6498759cd3ee3a@mail.gmail.com> Anybody done any erlang rdf parsing, tools for working with analysing rdf to extract the graphs? I suppose the best thing would be mapping of RDF tuples to Erlang tuples and storing in Mnesia? Cheers, Bryan Rasmussen From ulf.wiger@REDACTED Mon Jun 26 12:02:13 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 26 Jun 2006 12:02:13 +0200 Subject: dlialyzer a bit too sceptic? Message-ID: Just for the record, the problem was that the function in question wasn't exported. After seeing Dialyzer's warning, I simply assumed that it was. The helpful message from Dialyzer would of course have been that the call will fail because the function isn't exported. BR, Ulf W > -----Original Message----- > From: Tobias Lindahl [mailto:Tobias.Lindahl@REDACTED] > Sent: den 21 juni 2006 18:56 > To: Ulf Wiger (AL/EAB) > Cc: erlang-questions > Subject: Re: dlialyzer a bit too sceptic? > > This seems very strange to me too. Can you send me the module > (offline from the list) so that I can have a look? > > By the way, which version of Dialyzer is this? > > Tobias > > > Ulf Wiger (AL/EAB) wrote: > > Dialyzer (R11B-0) gave me the following warning on some > 'rdbms' code: > > > > {rdbms_groups,'-do_add_members/2-fun-0-',2}: Call to function > > {rdbms_props,do_write_property,2} with signature > ((_,{{'acl',atom()} | > > {'typedef',_} | {'attr',_,_} | 'access_module' | 'acl' | > 'indexes' | > > 'read_filter' | 'rec_type' | 'references' | 'write_filter',_}) -> > > 'ok') will fail since the arguments are of type > > ('schema',{{'group',_,'membership'},_})! > > > > > > But the function rdbms_props:do_write_property/2 looks like this: > > > > > > do_write_property(Tab, Prop) -> > > mnesia_schema:do_write_table_property(Tab, Prop). > > > > > > I.e. absolutely no restrictions on Prop. If one were to > introduce one, > > it would be something similar to that of > > mnesia_schema:write_table_property/2 - namely that Prop is a tuple > > with at least one element. > > > > > > write_table_property(Tab, Prop) when tuple(Prop), size(Prop) >= 1 -> > > schema_transaction(fun() -> do_write_table_property(Tab, Prop) > > end); write_table_property(Tab, Prop) -> > > {aborted, {bad_type, Tab, Prop}}. > > > > do_write_table_property(Tab, Prop) -> > > TidTs = get_tid_ts_and_lock(schema, write), > > {_, _, Ts} = TidTs, > > Store = Ts#tidstore.store, > > case change_prop_in_existing_op(Tab, Prop, > write_property, Store) of > > true -> > > ... > > %% we have merged the table prop into the create_table op > > ok; > > false -> > > ..., > > insert_schema_ops(TidTs, make_write_table_properties(Tab, > > [Prop])) > > end. > > > > > > It's not at all clear to me why Dialyzer thinks the call would fail. > > > > BR, > > Ulf W > From ke.han@REDACTED Mon Jun 26 12:02:35 2006 From: ke.han@REDACTED (ke han) Date: Mon, 26 Jun 2006 18:02:35 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <78568af10606260025s3dfdfb50h7ee9fe35351850ea@mail.gmail.com> References: <200606260326.k5Q3QtBU302745@atlas.otago.ac.nz> <78568af10606260025s3dfdfb50h7ee9fe35351850ea@mail.gmail.com> Message-ID: I do appreciate these conversations on erlang "strings". As a practitioner, I have learned lots from Richard and others clarification of how erlang handles strings and how it compares to other languages. Now what I'd like to see is discussion on "best practices" for using strings (not assuming they are lists of integers but binaries or both lists and binaries). Here is the scenario around which I'd like to shape a best practices thread of conversation: (1) Given: a web based erlang+yaws+mnesia application. This implies: all semantic data and OLTP go into mnesia, yaws files are used for control and presentation of all data. (2) Given: all strings are in utf-8. why, because its a good "one size fits almost all" format. This mean all strings in mnesia, yaws files, templates, "foreign language lookup strings" etc.. are in utf-8. Here is a thread of behavior for the app: Thread A: "User requests yaws page from browser". This triggers creation of controller and model objects (processes or lightweight "record models"). These models and controllers are used in binding attributes to or injecting into the template of the yaws files to output the HTML stream. assume the file requested is personForm.yaws which contains HTML inputs firstName and lastName, and select country which contains a list of countries and the selected item in the list. The list of countries come from the countryManager process which is accessed via an attribute of the personFormController process. The countryManager process has a life cycle matching the VM and does not die when the personFormController or its related model objects die. countryManager returns a list of country names (we'll skip bits about mapping this to an id and assume we store just country name in mnesia). The person object (just a record owned by the personFormController contains attributes firstName, lastName and country (not the whole list of countries, just the selected country in the list). several problem come to mind: 1 - handling the HTML "decoration" strings. This would be things like field labels, page title etc which would be looked up based on id from some. I think this has been address with macros like ?TXT, but want to reflect on this. 2 - injecting attributes into yaws (either via yaws bind or other higher level template methods). How to inject these values without going from a binary format to a list back to a binary for streaming out to the browser. 3 - retrieving the list of countries from countryManager to be put in the select list. Each time I want to write out personForm.yaws, I end up passing this list of countries between processes (from countryManager to personFormController to yaws process handling the page output). I _do not_ want this list to be copied each time. Nor do I want this list to go from a utf8 binary to a list back to a binary for streaming out to the browser. As you can see, although strings in erlang may not be grossly under- provided for, needing to store them in a compact form and passing lists of strings between processes (utf8 binary or lists of integers) compounds the memory issues....when all you want to do is output a page of concatenated utf8 binaries pulled from different sources. So, I'm looking for some tips on establishing best practices for minimizing the copying and the short and long term memory structure. A goal would be to have a set of practices for a yaws+mnesia app combined with macros and enhanced libraries which makes it easy for a beginner erlang programmer to build an app which by default is fairly efficient. Any ideas?? thanks, ke han On Jun 26, 2006, at 3:25 PM, Ryan Rawson wrote: > Excellent, thank you for that write up. > > There is a general perception that Erlang is no good at strings. Part > of the issue is the whole 'lists of integers' and people freak on the > memory requirements. The other part I think is the Unicode support. > Care to speak to that? > > -ryan > > On 6/25/06, Richard A. O'Keefe wrote: >> What I wrote about Java strings turns out not to be true. >> Substrings *do* share their character array with their parent, >> and string.substring(begin, end) *is* an O(1) operation, >> although this doesn't seem to be documented in the official >> Java documentation, so one presumably cannot rely on it. >> That's the good news for Java. >> The bad news is that the space overheads are high, >> there is a space leak, >> and while the performance is better than Erlang, it isn't _that_ >> much better, >> and the difference has very little to do with using lists. >> >> It turns out that Peter Norvig has measured the space overheads, >> and a Java string of N characters requires 40 + 4*ceil(N/2) bytes >> on a 32-bit >> machine. (On a 64-bit machine, I'm guessing it would be 64 + >> 8*ceil(N/4).) >> An Erlang string requires 8N bytes on a 32-bit machine (16N on a >> 64-bit one). >> >> So on a 32-bit machine, strings of 0..7 characters held as Erlang >> lists >> are smaller than they would be in Java, and strings of 8 or more >> characters >> are larger. >> >> This means that with a little care, a collection of words held in >> Erlang >> can take _less_ space than a collection of words in Java. >> >> What about the space leak? Suppose we construct a Java String of one >> million characters, call it x. Then we do >> x = x.substring(0, 1); >> Now there is only one useful character, BUT all million characters >> will >> be retained. That's a space leak. A sufficiently smart garbage >> collector >> could work around that. In fact my very first publication >> described just >> such a garbage collector. But I have seen no evidence in any Sun >> publication >> that they have one. So when you are splitting a string into >> pieces in Java, >> it is up to you to either >> - ensure that all the pieces are dead when the original string is >> dead, or >> - do x = new String(x) for each non-dead piece. >> >> With strings implemented just as lists, the very common case of >> shared tails >> requires no manual intervention. If you implement strings as >> trees, there >> is still no large scale leakage. It's _only_ when strings are >> handled as >> array slices that this can happen. (ML has "substring" as a type >> that is >> distinct from "string" to help the programmer keep track.) >> >> What about time? >> >> In Erlang, we can get at the first character of "fred" in *one* >> memory >> reference. In Java, "fred".charAt(0) requires >> - NO dynamic dispatch (String is a final class) >> unless you go through the CharSequence interface >> - check 0 against the string length (memory reference to pick it up) >> - add the offset (another memory reference) >> - fetch the array (another memory reference) >> - check 0+offset against array size (another memory reference) >> - fetch the code (the last reference) >> for a total of 5 memory references. >> >> So, given a sufficiently smart Erlang compiler, we'd expect access to >> any of the first few characters of a string to be faster in Erlang >> than >> in Java. >> >> Alas, current Erlang compilers aren't that smart. >> >> I wrote a little test program in several languages to see how fast >> string access was. Here's the Java code: >> >> private static int hash(String s) { >> int h = 0; >> for (int i = s.length(); --i >= 0; ) >> h = (h*31 + (int)s.charAt(i)) % 1645499; >> return h; >> } >> >> Here's the Erlang equivalent: >> >> hash(Cs) -> >> hash(Cs, 0). >> >> hash([C|Cs], H) -> >> hash(Cs, (H*31 + C) rem 1645499); >> hash([], H) -> >> H. >> >> (compiled with the 'inline' option, hash/1 goes away). >> >> Here's the Haskell equivalent: >> >> hash :: [Int] -> Int >> >> hash cs = aux cs 0 >> where aux (c:cs) h = aux cs ((h*31 + c) `mod` 1645499) >> aux [] h = h >> >> How long does it take _per character_ to compute this hash function? >> >> 14.4 AWK 2.06 usec (Mawk 1.4) >> 4.8 Erlang 0.68 usec (Erlang R11B) >> 2.0 Haskell 0.29 usec (GHC 6.2) >> 1.4 Java 0.195 usec (Sun Java 1.4.2 SDK) >> 1.0 C 0.143 usec (GCC 3.3.2, -O4) >> >> all on a 500MHz UltraSPARC II but compiled for 32 bits. >> >> We note that Haskell and Erlang are using the *same* >> representation for >> sequences here; we would expect them to be going through the >> *same* steps >> at run time. (Haskell is lazy, but GHC is smart enough to figure >> out that >> this particular function would benefit from being compiled as >> strict.) >> It might perhaps be to do with Haskell being typeful and Erlang not. >> >> The Erlang : Haskell ratio tells us that compiler quality accounts >> for >> more (a factor of 2.4) than data representation (a factor of 2.0) >> for this >> particular test. The Java : C ratio tells us that Sun's Java >> compiler is >> actually doing a pretty good job with this chunk of code; SPARCs have >> never been very good at division, so a fair bit of the time is >> probably >> going in the remainder. (Which I stuck in to make this a >> reasonable test; >> usually you are doing _something_ rather more interesting with the >> characters.) >> AWK is usually regarded as being reasonably good at strings. >> >> My initial C times were a lot smaller than that because I used >> Sun's C >> compiler, which was bright enough to spot that hash(s, n) was >> constant... >> So was GHC until I modified the code so it wasn't. >> >> Whether you want to call this being "weak" at strings or not, >> I don't see any evidence here that Erlang is weak*er* at strings >> than at any other kind of data structure. >> >> From bjorn@REDACTED Mon Jun 26 15:38:02 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 26 Jun 2006 15:38:02 +0200 Subject: Beam label 0 special? In-Reply-To: <4499C553.3050705@allcaps.org> References: <4499C553.3050705@allcaps.org> Message-ID: Andrew Lentvorski writes: > Does label 0 have a special meaning in BEAM code similar to the way > atom 0 does? In a way, yes. {f,0} means that if an error occur in execution of the instruction, an exception should be generated (whereas if {f,LabelNumber} is given, execution will continue at {label,LabelNumber} if an error occurs). (Label 0 is not allowed to be defined.) > > nil is always atom 0 even though it is not listed in the atom table, right? If you refer to [] (empty list), yes. This is just an encoding trick in Beam files to make the Beam files smaller. The Beam loader does the translation to [] at load time. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From andreas.hillqvist@REDACTED Mon Jun 26 15:49:13 2006 From: andreas.hillqvist@REDACTED (Andreas Hillqvist) Date: Mon, 26 Jun 2006 14:49:13 +0100 Subject: Erlang and AI reserach or practical experience Message-ID: <8268eea30606260649k1e5f42dfo417c905bee7edf9d@mail.gmail.com> Hi. IS ther anyone who have herad of resarch or practical application of Erlang for AI or AI oriented projects? Regards, Andreas -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Mon Jun 26 16:06:34 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 26 Jun 2006 10:06:34 -0400 Subject: [Fwd: edoc custom XML layout] Message-ID: <449FE9EA.5050501@hq.idt.net> I seemed to have figured out how to do custom layouts in edoc by looking at the otpsgml_layout.erl code. Here is a patch for otpsgml_layout.erl that fixes a bug in its output: --- otpsgml_layout.erl.orig 2006-06-22 20:11:25.000000000 -0400 +++ otpsgml_layout.erl 2006-06-26 09:57:51.000000000 -0400 @@ -173,9 +173,9 @@ ?NL,ModuleSummary, ?NL,Description, ?NL,Funcs, - ?NL,See, - ?NL,Authors - ] + ?NL,See + ] ++ + Authors }. Here's how you can test it: cd .../edoc-X.X.X/src erl -noshell -run edoc_run file '"edoc_layout.erl"' '[{layout, otpsgml_layout}]' -pa ../ebin Regards, Serge -------------- next part -------------- An embedded message was scrubbed... From: Serge Aleynikov Subject: edoc custom XML layout Date: Sat, 24 Jun 2006 11:31:17 -0400 Size: 1892 URL: From gunilla@REDACTED Mon Jun 26 16:19:55 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Mon, 26 Jun 2006 16:19:55 +0200 Subject: release_handler In-Reply-To: <449AA113.600@hq.idt.net> References: <449AA113.600@hq.idt.net> Message-ID: <449FED0B.8060208@erix.ericsson.se> Hi Serge, Yes, the config_change/1 and change_application_data/2 calls should be done in the opposite order. Note however that release_handler:eval_appup_script/4 is actually not used by release_handler (the process), but is primarily intended to be called by the release_handler (the module) functions upgrade_app/2 and downgrade_app/2,3. These two functions were added rather recently to simplify testing of .appup files. (the release_handler process calls do_install_release/3 to install a new release.) I will correct the bug and try to clarify the documentation. Thanks, Gunilla Serge Aleynikov wrote: > OTP team: > > I've been studying the code of the sasl's release_handler, and came up > with this question that perhaps someone qualified would be able to answer. > > As far as I understand, the following functions do the following tasks: > > application_controller:prep_config_change() > - Fetch OLD applications' environment from > application controller's internal ETS table. > > application_controller:config_change(EnvBefore) > - Notify running applications (via config_change/3 callback) about > configuration changes derived from comparing EnvBefore with the > content of the application controller's ETS table storing > applications' environment. > > application_controller:change_application_data(AppSpecs, Config) > - Rereads applications' environment from config files stored on disk > and stores it to the application controller's ETS table. > > Now with this background let's look at how the release handler does the > application upgrade: > > ==[begin]== sasl/src/release_handler.erl ===== > ... > eval_appup_script(App, ToVsn, ToDir, Script) -> > EnvBefore = application_controller:prep_config_change(), > AppSpecL = read_appspec(App, ToDir), > Res = release_handler_1:eval_script(Script, > [], % [AppSpec] > [{App, ToVsn, ToDir}], > []), % [Opt] > case Res of > {ok, _Unpurged} -> > application_controller:config_change(EnvBefore), > application_controller:change_application_data(AppSpecL,[]); > _Res -> > ignore > end, > Res. > ... > ==[end]======================================= > > Unless I am wrong, from this code it does *not* look like application's > config_change/3 callback will ever be invoked by > application_controller:config_change(EnvBefore) because EnvBefore has > the same applications' environment information as the current content of > the applications' controller's ETS table. It seems to me that at least > the config_change/1 and change_application_data/2 calls should be done > in the opposite order, or better, do something like this: > > ... > {ok, _Unpurged} -> > Files = > case init:get_argument(config) of > {ok, [ ConfFileNames ]} -> > [begin > S = filename:basename(F,".config"), > filename:join(filename:dirname(F), S ++ ".config") > end || F <- ConfFileNames], > {ok, _} -> > [] > end, > application_controller:change_application_data(AppSpecL, Files); > application_controller:config_change(EnvBefore); > _Res -> > ignore > ... > > I'd appreciate some clarification on the subject. > > Regards, > > Serge > > From yarivvv@REDACTED Mon Jun 26 16:29:59 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 26 Jun 2006 10:29:59 -0400 Subject: big erlang web solution In-Reply-To: <893CED66-CB54-44D8-9D4C-4365663D5894@redstarling.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> <893CED66-CB54-44D8-9D4C-4365663D5894@redstarling.com> Message-ID: <17244f480606260729h3bcd52b9i249a2f115a7fa002@mail.gmail.com> Hi, > > Any reasons why MySQL over PostgreSQL? If its due to erlang access, > I know that ejabberd accesses postgresql so there is a working native > driver for it. The main reason is that MySQL has clustering capabilities, so I won't have to use a second DBMS if I ever need a high-speed distributed multi-master database. Since version 5.1, MySQL lets you store cluster data on disk while keeping index fields in RAM, which I find to be a very appealing combination because it allows fast queries combined with large storage capacity (I think it would be great if Mnesia had such an option, btw). Regards, Yariv From yarivvv@REDACTED Mon Jun 26 16:35:05 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Mon, 26 Jun 2006 10:35:05 -0400 Subject: big erlang web solution In-Reply-To: <893CED66-CB54-44D8-9D4C-4365663D5894@redstarling.com> References: <3bb44c6e0606220537h61210313i4b08a1e4517dd583@mail.gmail.com> <6DD750E1-C4E2-47C8-BFBC-D24D44DAF6B8@redstarling.com> <17244f480606251056k627d2b9xed903ccf70602613@mail.gmail.com> <893CED66-CB54-44D8-9D4C-4365663D5894@redstarling.com> Message-ID: <17244f480606260735u3f91587dpd97ac07cecd8fc54@mail.gmail.com> > (3) full text search and index maintenance - docs must be full text > searchable by type (which would imply a file directory). Index of > text search must be automatic as docs are added/removed/modified. > This part of the system must be zero admin (or close to it). I don't > care much about the size of index files; disk space is cheap. I care > more about fast performance and low memory footprint of queries, > usefulness of query results, and low admin of entire search system. > (4) search results must be "google-like". (a) results contain enough > highlighted context to the original search to let the user know which > item in the results are worth digging into. (b) queries have > "continuations". meaning I don't have to retrieve all 100,000 > matching results in one chunk just to show the user the first three > pages. This aspect must have low memory consumption. ke han, did you take a look at tsearch2 for Postgres? http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/. It requires you to keep your text in the database, but it's very low maintenance and it has google-like results. Another option is to use Lucene with j/interface. With lucene, you can store just the index, but I'm not sure how changes to the file system would cascade into lucene in an automated manner. This is where tsearch2 shines IMO. Best, Yariv From ulf.wiger@REDACTED Mon Jun 26 16:47:54 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 26 Jun 2006 16:47:54 +0200 Subject: Erlang and AI reserach or practical experience Message-ID: At EUC 2005: eXAT: Software Agents in Erlang. by Corrado Santoro http://www.erlang.se/euc/05/1130Santoro.ppt http://www.erlang.se/euc/05/Santoro.pdf At the ACM SIGPLAN Erlang workshop 2005: ERESYE: Artificial Intelligence in Erlang Programs, by Antonella Di Stefano, Francesca Gangemi, and Corrado Santoro http://www.erlang-consulting.com/erlangworkshop05/eresye.pdf That should get you started. BR, Ulf W ________________________________ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Andreas Hillqvist Sent: den 26 juni 2006 15:49 To: erlang-questions@REDACTED Subject: Erlang and AI reserach or practical experience Hi. IS ther anyone who have herad of resarch or practical application of Erlang for AI or AI oriented projects? Regards, Andreas From serge@REDACTED Mon Jun 26 17:13:25 2006 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 26 Jun 2006 11:13:25 -0400 Subject: release_handler In-Reply-To: <449FED0B.8060208@erix.ericsson.se> References: <449AA113.600@hq.idt.net> <449FED0B.8060208@erix.ericsson.se> Message-ID: <449FF995.10404@hq.idt.net> Thanks, Gunilla! Also, when I was experimenting with the application:config_change/3 it seemed that the third parameter (Deleted) did not ever get set with the list of deleted application's environment entries. A closer look into the application_controller:do_change_appl/3 showed that the environment (NewEnv1, NewEnv2, NewEnv3) would always get appended/replaced but never deleted: do_change_appl({ok, {ApplData, Env, IncApps, Descr, Id, Vsn, Apps}}, OldAppl, Config) -> AppName = OldAppl#appl.name, %% Merge application env with env from sys.config, if any ConfEnv = get_opt(AppName, Config, []), NewEnv1 = merge_app_env(Env, ConfEnv), %% Merge application env with command line arguments, if any CmdLineEnv = get_cmd_env(AppName), NewEnv2 = merge_app_env(NewEnv1, CmdLineEnv), %% included_apps is made into an env parameter as well NewEnv3 = keyreplaceadd(included_applications, 1, NewEnv2, {included_applications, IncApps}), %% Update ets table with new application env del_env(AppName), add_env(AppName, NewEnv3), While you are looking at the previous bug report, please also verify this one. Regards, Serge Gunilla Arendt wrote: > Hi Serge, > > Yes, the config_change/1 and change_application_data/2 calls should be > done in the opposite order. > > Note however that release_handler:eval_appup_script/4 is actually not > used by release_handler (the process), but is primarily intended to be > called by the release_handler (the module) functions upgrade_app/2 > and downgrade_app/2,3. These two functions were added rather recently > to simplify testing of .appup files. (the release_handler process > calls do_install_release/3 to install a new release.) > > I will correct the bug and try to clarify the documentation. > > Thanks, > Gunilla > > > Serge Aleynikov wrote: > >> OTP team: >> >> I've been studying the code of the sasl's release_handler, and came up >> with this question that perhaps someone qualified would be able to >> answer. >> >> As far as I understand, the following functions do the following tasks: >> >> application_controller:prep_config_change() >> - Fetch OLD applications' environment from >> application controller's internal ETS table. >> >> application_controller:config_change(EnvBefore) >> - Notify running applications (via config_change/3 callback) about >> configuration changes derived from comparing EnvBefore with the >> content of the application controller's ETS table storing >> applications' environment. >> >> application_controller:change_application_data(AppSpecs, Config) >> - Rereads applications' environment from config files stored on disk >> and stores it to the application controller's ETS table. >> >> Now with this background let's look at how the release handler does >> the application upgrade: >> >> ==[begin]== sasl/src/release_handler.erl ===== >> ... >> eval_appup_script(App, ToVsn, ToDir, Script) -> >> EnvBefore = application_controller:prep_config_change(), >> AppSpecL = read_appspec(App, ToDir), >> Res = release_handler_1:eval_script(Script, >> [], % [AppSpec] >> [{App, ToVsn, ToDir}], >> []), % [Opt] >> case Res of >> {ok, _Unpurged} -> >> application_controller:config_change(EnvBefore), >> application_controller:change_application_data(AppSpecL,[]); >> _Res -> >> ignore >> end, >> Res. >> ... >> ==[end]======================================= >> >> Unless I am wrong, from this code it does *not* look like >> application's config_change/3 callback will ever be invoked by >> application_controller:config_change(EnvBefore) because EnvBefore has >> the same applications' environment information as the current content >> of the applications' controller's ETS table. It seems to me that at >> least the config_change/1 and change_application_data/2 calls should >> be done in the opposite order, or better, do something like this: >> >> ... >> {ok, _Unpurged} -> >> Files = >> case init:get_argument(config) of >> {ok, [ ConfFileNames ]} -> >> [begin >> S = filename:basename(F,".config"), >> filename:join(filename:dirname(F), S ++ ".config") >> end || F <- ConfFileNames], >> {ok, _} -> >> [] >> end, >> application_controller:change_application_data(AppSpecL, Files); >> application_controller:config_change(EnvBefore); >> _Res -> >> ignore >> ... >> >> I'd appreciate some clarification on the subject. >> >> Regards, >> >> Serge >> >> > > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From daniel.n.wiik@REDACTED Mon Jun 26 17:15:49 2006 From: daniel.n.wiik@REDACTED (Daniel wiik) Date: Mon, 26 Jun 2006 17:15:49 +0200 Subject: SUN ONC/RPC over IPv6 (with jungerl rpc lib) Message-ID: Hi! Has anyone tried to implement IPv6 support for the SUN ONC/RPC application in jungerl? My initial attempt (adding option inet6 to gen_tcp calls when IPv6 addresses are used) wasn't very succesful. When the pmap application tries to talk to the Solaris portmapper on port 111 the application fails and reports {'PROG_MISMATCH', 2, 4} which I (without to much investigation) have assumed is either because there is some packing/unpacking problem in the erlang implementation of rpc when using IPv6 addresses or it is because SUN assumes that you should use the rpcbind instead of portmapper protocol when you want to communication over IPv6 and hasn't implemented any IPv6 support in the portmapper protocol. When googling for info I found RFC 1833 (which includes XDR specifications for portmapper and rpcbind) so I thought to myself that it shouldn't be that difficult to rewrite the rpc application to use rpcbind instead of portmapper. Unfortunately the xdr compiler included in the rpc application failed to compile the rpcbind specification, to my best guess due to a struct definition that is recursive (the definition for struct rp__list contains references to itself). Any info that could help me move forward in the implementation of IPv6 support for my rpc protocol would be very appreciated. Best regards, Daniel Wiik From hp@REDACTED Mon Jun 26 21:15:25 2006 From: hp@REDACTED (HP Wei) Date: Mon, 26 Jun 2006 15:15:25 -0400 (EDT) Subject: gen_tcp:recv() and client_machine_crash Message-ID: I have a server (written in Erlang) which handles clients' request(s) through tcp_socket by the following piece of psudo-code: handle_request(Sock) -> case gen_tcp:recv(Sock, 0) of {ok, Bin} -> handle_Bin(...); {error, Reason} -> handle_exit(...) end. [ Note: The client code is written in python. ] I want the handle_exit() to handle three abnormal-exit situations that may occur on the client side. (1) the client's code gets Control_C exit; (2) the client's code gets killed by 'kill -9 pid' [ under UNIX ]; (3) the machine that the client is running on crashes ! For (1) and (2), the part 'handle_exit()' in the above snippet gets executed as expected. However, we had a client_machine_crash this morning but the handle_exit(..) did not seem to get executed. Questions: Is it supposed to be executed ? If yes, I will check the other part of the server-code. If no, then what is the proper way to detect a machine crash ?? thanks HP From chsu79@REDACTED Mon Jun 26 21:51:52 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 26 Jun 2006 21:51:52 +0200 Subject: gen_tcp:recv() and client_machine_crash In-Reply-To: References: Message-ID: On 6/26/06, HP Wei wrote: > handle_request(Sock) -> > case gen_tcp:recv(Sock, 0) of > {ok, Bin} -> > handle_Bin(...); > {error, Reason} -> > handle_exit(...) > end. > I want the handle_exit() to handle three abnormal-exit situations > that may occur on the client side. > (1) the client's code gets Control_C exit; > (2) the client's code gets killed by 'kill -9 pid' > [ under UNIX ]; > (3) the machine that the client is running on > crashes ! When the process dies as in 1 and 2, the OS will be so kind as to politely inform socket peers that the connection should be removed. When the OS itself has died, there is nothing to inform the peer about it. My suggestion is that you use timeouts. See the optional third argument to recv. From bsder@REDACTED Tue Jun 27 00:24:13 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 26 Jun 2006 15:24:13 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: References: <200606260326.k5Q3QtBU302745@atlas.otago.ac.nz> <78568af10606260025s3dfdfb50h7ee9fe35351850ea@mail.gmail.com> Message-ID: <44A05E8D.6040004@allcaps.org> ke han wrote: > (2) Given: all strings are in utf-8. why, because its a good "one size > fits almost all" format. This mean all strings in mnesia, yaws files, > templates, "foreign language lookup strings" etc.. are in utf-8. UTF-8 is a pretty bad choice for most Asian languages in terms of size. *However*, UTF-8 is very good for being compatible. If I build UTF-8 strings in Erlang, they survive all of the programmatic alterations. I don't believe that the interactive shell can enter them, though. In addition, UTF-8 is very detectable. It looks like ASCII, or it looks like UTF-8 and nothing else, by and large. -a From ok@REDACTED Tue Jun 27 06:41:43 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 27 Jun 2006 16:41:43 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> "Ryan Rawson" wrote: There is a general perception that Erlang is no good at strings. That perception is definitely mistaken. Part of the issue is the whole 'lists of integers' and people freak on the memory requirements. It's just like the way that the credulous swallow the Da Vinci Code. They just don't check for themselves. (Brown has Langdon go into raptures about ((1+sqrt(5))/2) and gets many of his facts so far wrong that you'd think he was a whole government department. But he does actually _tell_ his students to measure their own (head-floor)/(navel-floor), and any readers who _did_ that almost surely found their own ratios weren't even close to phi. And for bees he is out by thousands.) The other part I think is the Unicode support. Care to speak to that? Ah, Unicode. I've struggled to provide Unicode support in one language and written a draft library proposal for another. It's quite frighteningly hard. (Interesting point: the C99 standard does _not_ provide enough information about the current locale to implement POSIX regular expressions, and POSIX itself doesn't provide access to the information you need either. Guess how come I found that out?) I'm not even sure what "support" for Unicode language tags (the absence of which was one of the core design features originally, so it defies belief that they added them) would begin to look like. Simply telling when two sequence of Unicode codepoints represent the "same" string is the very reverse of trivial. Not that there is a single definition. Unicode has four "normal forms", so there are five different definitions of "same", counting the trivial one, and _not_ counting differences between versions of Unicode (I see Unicode 5 is on the horizon already). And there isn't even a normal form with the property that is_nf(Xs) and is_nf(Ys) => is_nf(Xs ++ Ys). Yep, concatenating two normalised strings (any of the four definitions) can give you a result that is _not_ normalised. Mind you, Unicode support in C and C++ is extremely weak too, unless you use the Taligent/IBM International Components for Unicode (icu4c, icu4j, see icu.sourceforge.net). From ryanobjc@REDACTED Tue Jun 27 07:21:54 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Mon, 26 Jun 2006 22:21:54 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> References: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> Message-ID: <78568af10606262221p3335e6dcj77e770bb7f5310ac@mail.gmail.com> On 6/26/06, Richard A. O'Keefe wrote: > "Ryan Rawson" wrote: > There is a general perception that Erlang is no good at strings. > > That perception is definitely mistaken. It's called "education" I believe. The best part about this list, is it becomes archived online, and google when searching for 'erlang ' it returns results from this list archive very often. Meaning your replies create future knowledge for young'uns. :-) > > Part of the issue is the whole 'lists of integers' and people > freak on the memory requirements. > > It's just like the way that the credulous swallow the Da Vinci Code. > They just don't check for themselves. (Brown has Langdon go into > raptures about ((1+sqrt(5))/2) and gets many of his facts so far wrong > that you'd think he was a whole government department. But he does > actually _tell_ his students to measure their own > (head-floor)/(navel-floor), and any readers who _did_ that almost > surely found their own ratios weren't even close to phi. And for bees > he is out by thousands.) > > The other part I think is the Unicode support. > Care to speak to that? > > Ah, Unicode. > I've struggled to provide Unicode support in one language and > written a draft library proposal for another. > It's quite frighteningly hard. (Interesting point: the C99 standard > does _not_ provide enough information about the current locale to > implement POSIX regular expressions, and POSIX itself doesn't provide > access to the information you need either. Guess how come I found that > out?) I'm not even sure what "support" for Unicode language tags (the > absence of which was one of the core design features originally, so it > defies belief that they added them) would begin to look like. > > Simply telling when two sequence of Unicode codepoints represent the > "same" string is the very reverse of trivial. Not that there is a > single definition. Unicode has four "normal forms", so there are > five different definitions of "same", counting the trivial one, and > _not_ counting differences between versions of Unicode (I see Unicode 5 > is on the horizon already). And there isn't even a normal form with > the property that is_nf(Xs) and is_nf(Ys) => is_nf(Xs ++ Ys). Yep, > concatenating two normalised strings (any of the four definitions) can > give you a result that is _not_ normalised. > > Mind you, Unicode support in C and C++ is extremely weak too, unless > you use the Taligent/IBM International Components for Unicode (icu4c, > icu4j, see icu.sourceforge.net). Then perhaps icu4c should be used as the basis of providing Erlang unicode support? I'm not really a unicode expert, so I don't know what is involved, but if a library provides good support, then it can be the core basis of a Erlang library, no? -ryan From yarivvv@REDACTED Tue Jun 27 08:29:48 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 27 Jun 2006 02:29:48 -0400 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <78568af10606262221p3335e6dcj77e770bb7f5310ac@mail.gmail.com> References: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> <78568af10606262221p3335e6dcj77e770bb7f5310ac@mail.gmail.com> Message-ID: <17244f480606262329u492bb7dbm5f4efe69b4ef2ff0@mail.gmail.com> > > It's called "education" I believe. The best part about this list, is > it becomes archived online, and google when searching for 'erlang > ' it returns results from this list archive very often. > Meaning your replies create future knowledge for young'uns. :-) > As a young'un, I can say that I've definitely learned a lot from the veterans on this list, often by asking stupid questions that the rest of you kindly didn't ignore, so speaking for all of us young'uns, your informative answers have been invaluable for our education. Thanks! :) Yariv From roger.larsson@REDACTED Tue Jun 27 09:16:13 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 27 Jun 2006 09:16:13 +0200 Subject: another bounds example - catched by normal compile but not by dialyzer In-Reply-To: <449F9F54.4020009@it.uu.se> References: <200606222325.46503.roger.larsson@norran.net> <449F9F54.4020009@it.uu.se> Message-ID: <200606270916.14137.roger.larsson@norran.net> Furter experimentation: * Static checking of array bounds is a simpler problem than handling dynamic lists. So, lets try the same kind of errors with tuples. Normal compile detects these simple cases. But dialyzer return some strange messages. At least the dialyzer output is hard to decipher... -module(bounds). -export([detect/0, wrong_match/0]). detect() -> element(4, {1, 2, 3}). wrong_match() -> {_, _, _, _} = {1, 2, 3}. > erl 1> c(bounds). ./bounds.erl:4: Warning: this expression would cause a 'badarg' exception at run-time ./bounds.erl:5: Warning: this clause cannot match because of different types/sizes {ok,bounds} > dialyzer (from source) {bounds,detect,0}: Function has no local return {bounds,wrong_match,0}: Function has no local return /RogerL From Tobias.Lindahl@REDACTED Tue Jun 27 09:51:31 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Tue, 27 Jun 2006 09:51:31 +0200 Subject: another bounds example - catched by normal compile but not by dialyzer In-Reply-To: <200606270916.14137.roger.larsson@norran.net> References: <200606222325.46503.roger.larsson@norran.net> <449F9F54.4020009@it.uu.se> <200606270916.14137.roger.larsson@norran.net> Message-ID: <44A0E383.6050906@it.uu.se> Roger Larsson wrote: > Furter experimentation: > * Static checking of array bounds is a simpler problem than handling dynamic > lists. > So, lets try the same kind of errors with tuples. > > Normal compile detects these simple cases. But dialyzer > return some strange messages. > At least the dialyzer output is hard to decipher... > > -module(bounds). > -export([detect/0, wrong_match/0]). > > detect() -> element(4, {1, 2, 3}). > wrong_match() -> {_, _, _, _} = {1, 2, 3}. > > >>erl > > 1> c(bounds). > ./bounds.erl:4: Warning: this expression would cause a 'badarg' exception at > run-time > ./bounds.erl:5: Warning: this clause cannot match because of different > types/sizes > {ok,bounds} > > >>dialyzer (from source) > > {bounds,detect,0}: Function has no local return > {bounds,wrong_match,0}: Function has no local return Strangely enough the problem is that the error is too easy to find ;-) The BEAM compiler finds the problem and simply removes it, leaving only the exception. Since Dialyzer first compiles the code to an internal format and then perform the analysis on this code, it only finds that there is no non-exception return for the functions and warns about this. This is indeed a problem, but not a very severe one since you get the warning from the compiler. Tobias > > /RogerL From bjorn@REDACTED Tue Jun 27 09:56:30 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 27 Jun 2006 09:56:30 +0200 Subject: another bounds example - catched by normal compile but not by dialyzer In-Reply-To: <200606270916.14137.roger.larsson@norran.net> References: <200606222325.46503.roger.larsson@norran.net> <449F9F54.4020009@it.uu.se> <200606270916.14137.roger.larsson@norran.net> Message-ID: The reason for Dialyzer's strange messages is that the Beam compiler has already replaced the failing expression/failing match with explicit code to generate a badarg/badmatch (so that Dialyzer can't see the original code). Therefore, it is probably a good idea to first fix all problems that the compiler and xref can find before running Dialyzer. /Bjorn Roger Larsson writes: > Furter experimentation: > * Static checking of array bounds is a simpler problem than handling dynamic > lists. > So, lets try the same kind of errors with tuples. > > Normal compile detects these simple cases. But dialyzer > return some strange messages. > At least the dialyzer output is hard to decipher... > > -module(bounds). > -export([detect/0, wrong_match/0]). > > detect() -> element(4, {1, 2, 3}). > wrong_match() -> {_, _, _, _} = {1, 2, 3}. > > > erl > 1> c(bounds). > ./bounds.erl:4: Warning: this expression would cause a 'badarg' exception at > run-time > ./bounds.erl:5: Warning: this clause cannot match because of different > types/sizes > {ok,bounds} > > > dialyzer (from source) > {bounds,detect,0}: Function has no local return > {bounds,wrong_match,0}: Function has no local return > > /RogerL > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Tue Jun 27 10:09:12 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 27 Jun 2006 01:09:12 -0700 (PDT) Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> Message-ID: <20060627080912.58647.qmail@web38807.mail.mud.yahoo.com> --- "Richard A. O'Keefe" wrote: > Ah, Unicode. > I've struggled to provide Unicode support in one > language and > written a draft library proposal for another. > It's quite frighteningly hard. /.../ Richard, Assuming one would want to implement a character datatype for Erlang, do you think Unicode is the way to go? Or something else (e.g., settle for UTF-8)? Or some sort of framework a la Common Lisp? Or wait and see a bit longer? (Bang-per-buck vs done right is a decision too, I guess.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From goryachev@REDACTED Tue Jun 27 10:44:10 2006 From: goryachev@REDACTED (Igor Goryachev) Date: Tue, 27 Jun 2006 12:44:10 +0400 Subject: http client us ascii restriction Message-ID: <871wtbq97p.fsf@yandex-team.ru> Hello. I have met some US ASCII restrictions in erlang's http client: igor@REDACTED:~% erl Erlang (BEAM) emulator version 5.5 [source] [64-bit] [async-threads:0] [kernel-poll:false] Eshell V5.5 (abort with ^G) 1> http_uri:parse("http://www.google.com/search?q=%D1%82%D0%B5%D1%81%D1%82"). {error,no_query} 2> I have made a trivial patch that fixes this misbehaviour (attached in this message): goryachev@REDACTED:~% erl Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [kernel-poll:false] Eshell V5.5 (abort with ^G) 1> http_uri:parse("http://www.google.com/search?q=%D1%82%D0%B5%D1%81%D1%82"). {http,"www.google.com",80,"/search","?q=%d1%82%d0%b5%d1%81%d1%82"} 2> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: http_uri_255.diff URL: -------------- next part -------------- -- Igor Goryachev Yandex development team. From yani.dzhurov@REDACTED Tue Jun 27 12:36:03 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Tue, 27 Jun 2006 13:36:03 +0300 Subject: gen_tcp:recv() and client_machine_crash In-Reply-To: Message-ID: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Hi, Why don't trying using the keep alive option for tcp socket: {keepalive, Boolean} (TCP/IP sockets) Enables/disables periodic transmission on a connected socket, when no other data is being exchanged. If the other end does not respond, the connection is considered broken and an error message will be sent to the controlling process. Default disabled. This is from the inet module docs . I think this should work for you. Cheerz, Jani -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of HP Wei Sent: Monday, June 26, 2006 10:15 PM To: erlang-questions@REDACTED Subject: gen_tcp:recv() and client_machine_crash I have a server (written in Erlang) which handles clients' request(s) through tcp_socket by the following piece of psudo-code: handle_request(Sock) -> case gen_tcp:recv(Sock, 0) of {ok, Bin} -> handle_Bin(...); {error, Reason} -> handle_exit(...) end. [ Note: The client code is written in python. ] I want the handle_exit() to handle three abnormal-exit situations that may occur on the client side. (1) the client's code gets Control_C exit; (2) the client's code gets killed by 'kill -9 pid' [ under UNIX ]; (3) the machine that the client is running on crashes ! For (1) and (2), the part 'handle_exit()' in the above snippet gets executed as expected. However, we had a client_machine_crash this morning but the handle_exit(..) did not seem to get executed. Questions: Is it supposed to be executed ? If yes, I will check the other part of the server-code. If no, then what is the proper way to detect a machine crash ?? thanks HP -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3326 bytes Desc: not available URL: From richardc@REDACTED Tue Jun 27 13:49:55 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 27 Jun 2006 13:49:55 +0200 Subject: Erlang Refactoring In-Reply-To: <95be1d3b0606210327k4e774a40h6ee5fb7c257c5e31@mail.gmail.com> References: <95be1d3b0606210327k4e774a40h6ee5fb7c257c5e31@mail.gmail.com> Message-ID: <44A11B63.3030801@it.uu.se> Yes, the igor module in syntax tools has a rename function, which can take a set of modules and rename them, updating all intermodule references. It will print some warnings if there are calls to spawn or apply that you may need to inspect manually afterwards (if module names are being passed around). Try it - it sounds like the best match for what you want to do. http://www.erlang.org/doc/doc-5.5/lib/syntax_tools-1.5.0/doc/html/igor.html#rename-3 /Richard Vlad Dumitrescu wrote: > Hi Joe, > > Have you looked at igor, which is included in syntax_tools? > > regards, > Vlad > > > On 6/21/06, Joe Armstrong (AL/EAB) wrote: >> >> Are there any Erlang refactoring programs that I can >> download and use? >> >> I want to do the following: >> >> I have a directory with Erlang modules >> >> glurk.erl >> foo_server.erl >> ... >> >> And a Makefile >> >> And I have a renaming scheme >> >> Old Name New Name >> glurk.erl foo_bar_krulg.erl >> foo_server.erl foo23_glunker.erl >> ... >> >> >> I want some program that changes all the filenames and >> module names in a consistent manner, and which tries >> to keep the formatting of my programs intact. >> >> Is there such a program? - << in the form of a function I >> evaluate in the Erlang shell - ie with no incomprehensible GUI >> >> >> /Joe >> >> > From hp@REDACTED Tue Jun 27 14:12:19 2006 From: hp@REDACTED (HP Wei) Date: Tue, 27 Jun 2006 08:12:19 -0400 (EDT) Subject: gen_tcp:recv() and client_machine_crash In-Reply-To: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: Thanks for the pointer... In my application, the client keeps the socket open for some undetermined time (to do something else). So, this TCP_keepalive option would have been a good solution without changing the client_code. However, the default time for the keepalive probing signal to be sent out is 2 hours (from Stevens Book), which is too LONG. And changing that default 2 hours may affect ALL sockets on the host! Maybe the simple solution for my case is simply implementing a monitoring process on the server side to probe the client machine periodically :) [ Fortunately, there is ONLY one machine on the client side, even though there may be many clients at a time. ] Thanks HP On Tue, 27 Jun 2006, Yani Dzhurov wrote: > Hi, > > Why don't trying using the keep alive option for tcp socket: > > {keepalive, Boolean} (TCP/IP sockets) > Enables/disables periodic transmission on a connected socket, when no other > data is being exchanged. If the other end does not respond, the connection > is considered broken and an error message will be sent to the controlling > process. Default disabled. > > This is from the inet module docs . I think this should work for you. > > Cheerz, > > Jani > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of HP Wei > Sent: Monday, June 26, 2006 10:15 PM > To: erlang-questions@REDACTED > Subject: gen_tcp:recv() and client_machine_crash > > > I have a server (written in Erlang) which handles > clients' request(s) through tcp_socket by > the following piece of psudo-code: > > handle_request(Sock) -> > case gen_tcp:recv(Sock, 0) of > {ok, Bin} -> > handle_Bin(...); > {error, Reason} -> > handle_exit(...) > end. > > [ Note: The client code is written in python. ] > > I want the handle_exit() to handle three abnormal-exit situations > that may occur on the client side. > (1) the client's code gets Control_C exit; > (2) the client's code gets killed by 'kill -9 pid' > [ under UNIX ]; > (3) the machine that the client is running on > crashes ! > > For (1) and (2), the part 'handle_exit()' in the > above snippet gets executed as expected. > > However, we had a client_machine_crash this morning > but the handle_exit(..) did not seem to get executed. > > Questions: > Is it supposed to be executed ? > If yes, I will check the other part of the server-code. > If no, then what is the proper way to detect a > machine crash ?? > > thanks > HP > > From hp@REDACTED Tue Jun 27 14:37:33 2006 From: hp@REDACTED (HP Wei) Date: Tue, 27 Jun 2006 08:37:33 -0400 (EDT) Subject: concurrency(?) in rpc:multicall() In-Reply-To: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: According to the manual, " It is semantically the same as iteratively making a series of RPCs on all the nodes, but the multicall is faster as all the requests are sent at the same time... " I do NOT understand the last part: " all the requests are sent at the same time " I trace the source code for rpc:multicall(). It boils down to gen_server:send_nodes(), whose function head reads: send_nodes([Node|Tail], ...) Apparently, multicall sends out the requests to the target processes 'one by one' (not at the same time). Is there a typo in the manual for rpc:multicall() ??? --HP From vladdu55@REDACTED Tue Jun 27 15:10:15 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 27 Jun 2006 15:10:15 +0200 Subject: gen_tcp:recv() and client_machine_crash In-Reply-To: References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: <95be1d3b0606270610q596930d6nc8b6ee483c20d014@mail.gmail.com> > Maybe the simple solution for my case is simply implementing > a monitoring process on the server side to probe the > client machine periodically :) Hi, Another alternative would be to let the server record the time of the last request from a client, and close the connection after some period of inactivity. best regards, Vlad From thomasl_erlang@REDACTED Tue Jun 27 15:09:52 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 27 Jun 2006 06:09:52 -0700 (PDT) Subject: concurrency(?) in rpc:multicall() In-Reply-To: Message-ID: <20060627130952.97386.qmail@web38812.mail.mud.yahoo.com> --- HP Wei wrote: > > According to the manual, > " > It is semantically the same as iteratively making > a series > of RPCs on all the nodes, > but the multicall is faster as all the requests > are sent at the same time... > " > > I do NOT understand the last part: > " > all the requests are sent at the same time > " > > I trace the source code for rpc:multicall(). > It boils down to gen_server:send_nodes(), > whose function head reads: > send_nodes([Node|Tail], ...) > > Apparently, multicall sends out the requests to the > target processes 'one by one' (not at the same > time). > > > Is there a typo in the manual for rpc:multicall() > ??? I think the intent of the documentation is that multicall first sends all the requests, then only waits for the answers after all the requests have been sent. Thus, rather than the "iterative" approach that is mentioned in the man page: Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From vladdu55@REDACTED Tue Jun 27 15:19:38 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 27 Jun 2006 15:19:38 +0200 Subject: concurrency(?) in rpc:multicall() In-Reply-To: References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: <95be1d3b0606270619x6afba74cp813123c26d8e2eeb@mail.gmail.com> Hi, The meaning is that the requests are all sent before even trying to receive an answer. The sequentioal alternative is to send a request, wait for the answer, send the next request, and so on. regards, Vlad On 6/27/06, HP Wei wrote: > > According to the manual, > " > It is semantically the same as iteratively making a series > of RPCs on all the nodes, > but the multicall is faster as all the requests > are sent at the same time... > " > > I do NOT understand the last part: > " > all the requests are sent at the same time > " > > I trace the source code for rpc:multicall(). > It boils down to gen_server:send_nodes(), > whose function head reads: > send_nodes([Node|Tail], ...) > > Apparently, multicall sends out the requests to the > target processes 'one by one' (not at the same time). > > > Is there a typo in the manual for rpc:multicall() ??? > > --HP > > From serge@REDACTED Tue Jun 27 15:23:34 2006 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 27 Jun 2006 09:23:34 -0400 Subject: edoc custom layout Message-ID: <44A13156.4090105@hq.idt.net> Richard, While I was writing a custom layout for edoc I ran into the following concern. Current edoc's implementation of layouts excludes customization of the modules/packages frames of the generated menu and the index file. It seems to me that it would be a worthy modification in edoc to force the edoc_doclet:application_frame/3, edoc_doclet:modules_frame/4, edoc_doclet:packages_frame/4, and edoc_doclet:index_file/3 to follow the same approach as done in edoc_doclet:overview/4 call of invoking the layout's callback that may customize the look of navigation frames. I've done this modification (patch included) that allowed me to generate an XML layout in the format suitable for the forrest.appache.org's project. The absense of custom callback functions will default to the edoc's current layout method. Do you think it would be possible to include this patch in the distribution? Regards, Serge -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: edoc.patch URL: From sanjaya@REDACTED Tue Jun 27 14:54:56 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Tue, 27 Jun 2006 18:24:56 +0530 Subject: inets - http client - pipeline bug Message-ID: <025901c699e8$e6f535d0$9a0a10ac@wavenet.lk> Hi http://www.erlang.org/ml-archive/erlang-questions/200603/msg00024.html http://www.erlang.org/ml-archive/erlang-questions/200505/msg00237.html Any one knows if this pipeline bug fixed in the R10B-10 ? I have noted the error "session_remotly_closed" in my log files. Is this the same bug discussed in above threads, or something different ? are there any way to avoid this ? here is a part from my log. ---------------------------------------------------------------------------------------------------- =ERROR REPORT==== 26-Jun-2006::15:09:25 === ** Generic server <0.24937.2> terminating ** Last message in was {tcp_closed,#Port<0.208644>} ** When Server state == {state,{request, #Ref<0.0.10.65963>, <0.61.0>, 1, http, {"172.16.1.24",8080}, "/vsms/send/index.jsp", "?cli=776628499&serv=779030447&session=a1151314764776628499&ch=54", get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "172.16.1.24", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,12000,true,[],false}, "http://172.16.1.26/ivr/server/Scripts/redirect.php?key=c&session=a1151314764776628499&serv=779030447&ch=54"}, {tcp_session, {{"172.16.1.24",8080},<0.24937.2>}, false, http, #Port<0.208644>, 1}, undefined, undefined, undefined, {httpc_response,parse,[nolimit]}, {[],[]}, new, [], nolimit, nolimit, {options, {undefined,[]}, 0, 2, 2, disabled, enabled, false}, {timers, [{#Ref<0.0.10.65963>,#Ref<0.0.10.65974>}], undefined}} ** Reason for termination == ** session_remotly_closed =CRASH REPORT==== 26-Jun-2006::15:09:25 === crasher: pid: <0.24937.2> registered_name: [] error_info: session_remotly_closed initial_call: {gen,init_it, [gen_server, <0.53.0>, <0.53.0>, httpc_handler, [{request,#Ref<0.0.10.65963>, <0.61.0>, 1, http, {"172.16.1.24",8080}, "/vsms/send/index.jsp", "?cli=776628499&serv=779030447&session=a1151314764776628499&ch=54", get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "172.16.1.24", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,12000,true,[],false}, "http://172.16.1.26/ivr/server/Scripts/redirect.php?key=c&session=a1151314764776628499&serv=779030447&ch=54"}, {options,{undefined,[]},0,2,2,disabled,enabled,false}], []]} ancestors: [httpc_manager,httpc_sup,inets_sup,<0.49.0>] messages: [] links: [<0.53.0>] dictionary: [] trap_exit: true status: running heap_size: 1597 stack_size: 21 reductions: 1718 neighbours: ---------------------------------------------------------------------------------------------------- Thanks in advance. Sanjaya Vitharana -------------- next part -------------- An HTML attachment was scrubbed... URL: From hp@REDACTED Tue Jun 27 15:47:08 2006 From: hp@REDACTED (HP Wei) Date: Tue, 27 Jun 2006 09:47:08 -0400 (EDT) Subject: concurrency(?) in rpc:multicall() In-Reply-To: <95be1d3b0606270619x6afba74cp813123c26d8e2eeb@mail.gmail.com> References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> <95be1d3b0606270619x6afba74cp813123c26d8e2eeb@mail.gmail.com> Message-ID: Thank you, Vlad and Thomas, for clarifying the meaning of the documentation. The reason that I asked in the first place was that I saw the phrase 'all requests are sent at the same time' and I thought wow, this should be what I need when I want to trigger an event on all machines at the same time!! Apparently, this 'at the same time' is not what I thought it is. I understand that for a small number of target machines, the effect of rpc:multicall() is a good approximation to 'simultaneous' triggering... Thanks HP On Tue, 27 Jun 2006, Vlad Dumitrescu wrote: > Hi, > > The meaning is that the requests are all sent before even trying to > receive an answer. The sequentioal alternative is to send a request, > wait for the answer, send the next request, and so on. > > regards, > Vlad > > > On 6/27/06, HP Wei wrote: > > > > According to the manual, > > " > > It is semantically the same as iteratively making a series > > of RPCs on all the nodes, > > but the multicall is faster as all the requests > > are sent at the same time... > > " > > > > I do NOT understand the last part: > > " > > all the requests are sent at the same time > > " > > > > I trace the source code for rpc:multicall(). > > It boils down to gen_server:send_nodes(), > > whose function head reads: > > send_nodes([Node|Tail], ...) > > > > Apparently, multicall sends out the requests to the > > target processes 'one by one' (not at the same time). > > > > > > Is there a typo in the manual for rpc:multicall() ??? > > > > --HP > > > > > From hp@REDACTED Tue Jun 27 16:21:49 2006 From: hp@REDACTED (HP Wei) Date: Tue, 27 Jun 2006 10:21:49 -0400 (EDT) Subject: Timeout in rpc:multicall() In-Reply-To: References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: I must have made some simple mistake somewhere. I tried this: rpc:multicall([node()], os, cmd, ["pgrep beam"]). {["7589\n"],[]} But, when I added Timeout = 1000, rpc:multicall([node()], os, cmd, ["pgrep beam"], 1000). ** exited: {undef,[{rpc,multicall,[[hp@REDACTED],os,cmd,["pgrep beam"],1000]}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** any pointer? thanks HP From hp@REDACTED Tue Jun 27 17:55:40 2006 From: hp@REDACTED (HP Wei) Date: Tue, 27 Jun 2006 11:55:40 -0400 (EDT) Subject: Timeout in rpc:multicall() In-Reply-To: References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> Message-ID: I knew it must be due to a simple mistake. I tried it with Erlang (BEAM) emulator version 5.4.13 [64-bit] [source] [hipe] and it worked. [ Old version 5.2 gives the undef message. :) --hp On Tue, 27 Jun 2006, HP Wei wrote: > > I must have made some simple mistake somewhere. > > I tried this: > > rpc:multicall([node()], os, cmd, ["pgrep beam"]). > {["7589\n"],[]} > > > But, when I added Timeout = 1000, > > rpc:multicall([node()], os, cmd, ["pgrep beam"], 1000). > ** exited: {undef,[{rpc,multicall,[[hp@REDACTED],os,cmd,["pgrep > beam"],1000]}, > {erl_eval,expr,3}, > {erl_eval,exprs,4}, > {shell,eval_loop,2}]} ** > > any pointer? > thanks > HP > > From david.nospam.hopwood@REDACTED Tue Jun 27 18:19:12 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 27 Jun 2006 17:19:12 +0100 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> References: <200606270441.k5R4fh9K311542@atlas.otago.ac.nz> Message-ID: <44A15A80.4050206@blueyonder.co.uk> Richard A. O'Keefe wrote: > Ah, Unicode. > I've struggled to provide Unicode support in one language and > written a draft library proposal for another. > It's quite frighteningly hard. (Interesting point: the C99 standard > does _not_ provide enough information about the current locale to > implement POSIX regular expressions, and POSIX itself doesn't provide > access to the information you need either. Guess how come I found that > out?) I'm not even sure what "support" for Unicode language tags (the > absence of which was one of the core design features originally, so it > defies belief that they added them) would begin to look like. Political compromise. They have essentially been deprecated from birth -- just ignore them. (There are a lot of things in Unicode that implementors should just ignore; unfortunately this is not always apparent from reading the spec.) > Simply telling when two sequence of Unicode codepoints represent the > "same" string is the very reverse of trivial. Not that there is a > single definition. Unicode has four "normal forms", so there are > five different definitions of "same", counting the trivial one, No, there are three: equality, canonical equivalence, and compatibility equivalence. Comparing NFC forms is the same as comparing NFD, and comparing NFKC is the same as comparing NFKD. Compatibility equivalence is another thing that you should just ignore -- use canonical equivalence. > and _not_ counting differences between versions of Unicode (I see Unicode 5 > is on the horizon already). And there isn't even a normal form with > the property that is_nf(Xs) and is_nf(Ys) => is_nf(Xs ++ Ys). Yes, that's irritating, as is the fact that case folding does not preserve normalization. -- David Hopwood From rpettit@REDACTED Tue Jun 27 19:49:51 2006 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 27 Jun 2006 12:49:51 -0500 Subject: Proper use of mnesia bag table Message-ID: <20060627174951.GA13744@vailsys.com> I have a situation in which a collection of distributed agents need to record events which are to be processed at a later time. All events for a given task (distributed across the network) will share an ID with which events can be stored and later retrieved. I could have a process (FSM or otherwise) for each distributed task which collects events for that task from various distributed agents, or I could have the distributed agents simply store their events in a mnesia bag table keyed on the task ID. Is this a good fit for mnesia bag tables? That is, the storing (and subsequent retrieval) of arbitrary amounts of data for a given key? In practice there won't likely be more than 20 records (~1k each, usually less) for a given key. It would be easier to have such data rendezvous in a mnesia bag table than to have an FSM process for each task and a lookup service allowing distributed agents to "discover" the right FSM process to hand their events to. Any pointers would be greatly appreciated. -Rick From ok@REDACTED Wed Jun 28 04:22:57 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 28 Jun 2006 14:22:57 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> Thomas Lindgren wrote: Assuming one would want to implement a character datatype for Erlang, do you think Unicode is the way to go? Or something else (e.g., settle for UTF-8)? Or some sort of framework a la Common Lisp? Or wait and see a bit longer? UTF-8 is a fine thing, but it is not a *character* data type. UTF-8 is a way of encoding *strings*. Let's consider SWI Prolog, which has four ways of representing strings: - as lists of integers, the traditional Prolog way. In this form, each Unicode code-point is represented by one integer. - as lists of single-character atoms, the ISO substandard way. In this form, each Unicode code-point is represented by one atom. - as packed byte strings. The internal representation used, visible from C, is UTF-8, but whenever *Prolog* code looks at a string, it sees Unicode code-points. sub_string/5 uses character counts, not byte counts, to specify a slice. - as atoms. Again, the internal representation, visible from C, is UTF-8, but whenever *Prolog* code looks at an atom, it sees Unicode code-points. sub_atom/5 uses character counts, not byte counts, to specify a slice. I/O can be done with bytes (get_byte/[1,2], put_byte/[1,2]) or with Unicode code-points represented as integers (get_code/[1,2], put_code/[1,2]) or single-character atoms (get_char/[1,2], put_char/[1,2]). Jan really did an *amazing* amount of work moving SWI Prolog over to Unicode, and all things considered, it went amazingly smoothly. Yes, problems are still being reported in the SWI Prolog mailing list, BUT (a) funnily enough they all seem to involve Windows, and (b) these days they only seem to involve things like Prolog and C disagreeing about what the default encoding is. Prolog programs that don't do anything fancy just work. So I would definitely suggest looking hard at SWI Prolog for a model, and if anyone with money wants to see something happen with Unicode in Erlang they could do worse than ask Jan if he wants to do some consulting... I note that UTF-8 is not the only storage scheme around for Unicode. There's another one which is in some ways better, and that's SCSU (the Simple Compression Scheme for Unicode). Compared with UTF-8, SCSU has three weak points and two strong points: - if S1 and S2 are sequences of Unicode code points, lex-order(S1, S2) == lex-order(UTF-8-encode(S1), UTF-8-encode(S2)). This is not true for SCSU. Given that lexical order of code-points isn't particularly close to _any_ locale's collation order, it's not clear that this matters very much. - UTF-8 locales are available for most UNIX-like operating systems. This is not true for SCSU. However, nothing says that the internal representation of text has to be the same as the external one. - SCSU encoding is not unique; there is a standard *decoding* algorithm, but no standard *encoding* algorithm, although there is an example one. + Latin-1 data _is_ SCSU data; for many alphabetic scripts SCSU is n+1 bytes or n+2 bytes. (Useful here, where Maori uses five vowels with macrons, upper and lower case; being able to store one character per byte with just one byte of overhead is nice.) + CJK text requires 2n+1 bytes (one byte says "switch to 16-bit"), so SCSU is a good representation for CJK. Back in the Paleolithic when computers were things you could walk inside and programmers chipped their programs out of cardboard with flint knives, the Burroughs B6700 MCP (= operating sytem) tagged each file with the character set it was written in. (OK, the choice was 6-bit BCL, 7-bit ASCII, or 8-bit EBCDIC, but the _idea_ of each file being tagged with a character encoding was there, and the _idea_ of the file's character set being _automatically_ translated by the operating system into whichever character encoding the program wanted without the program getting involved was also there.) The nastiest problem we have with Unicode is that UNIX file systems don't do that. (Windows attributes could. I don't understand the MacOS X file system well enough yet, but I'm pretty sure it could do this. And Solaris lets you attach properties to files; in effect each file is also a directory with the properties as files. Try 'man openat'.) Just because the user's terminal is set up for UTF-8 doesn't mean that this file isn't in Windows 1252 or that file isn't in MacRoman. Of course there are ways of saying what encoding to use; the problem is that there are too many. XML declarations; MIME types; ISO 2022 announcers; environment variables. This is where the remaining SWI Prolog problems are, in conflicts between "OEM" and "ANSI" encodings arising because more than one software component has to be told about more than one encoding in more than one way. If a Unicode file begins with a "byte order mark", it is easy for a program to tell whether the representation used is UCS4-BE, UCS4-LE, UCS2-BE, UCS2-LE, SCSU, or UTF-8. Telling the difference between 8-bit variants of ASCII is not so easy. What about Common Lisp? Well, I have CLtL1, CLtL2; I keep the HyperSpec on-line; I have three different implementations of Common Lisp on my SPARC and two on my Mac. There are little things like 'Every character with case is in one-to-one correspondence with some other character with the opposite case' which are a poor fit to non-ASCII reality: - in Latin 1 y-umlaut and sharp-s are definitely lower case but have no upper case equivalent - in Unicode, there are THREE cases, not two - in scripts such as Greek or 18th-century English the lower-case version of an upper-case letter is *position*-dependent (different forms for final-vs-non-final "s", for example) This issue, at least, was *certainly* understood when CLtL1 was written, because Interlisp-D used the XNS character set, and the XNS character set included position-dependent letters. - in Unicode, case conversion is *locale*-dependent That is, whether you call things like CHAR-UPCASE and CHAR-DOWNCASE part of a "framework" or not, they are *not* part of a framework that can cope well with Unicode, because Unicode case mapping for strings is *not* a simple matter of iterating case mapping for characters. Much as I love Lisp, I honestly don't see anything in Common Lisp character or string handling that Erlang needs to learn from, and more than a little that it would be a bad idea to copy. From rlenglet@REDACTED Wed Jun 28 06:00:45 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 28 Jun 2006 13:00:45 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> References: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> Message-ID: <200606281300.46231.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: > Thomas Lindgren wrote: > Assuming one would want to implement a character > datatype for Erlang, do you think Unicode is the way > to go? Or something else (e.g., settle for UTF-8)? Or > some sort of framework a la Common Lisp? Or wait and > see a bit longer? > > UTF-8 is a fine thing, but it is not a *character* data type. > UTF-8 is a way of encoding *strings*. [deleted] Thanks for your explanations. I still see an interest in an Erlang data type for strings, or in a way to "tag" an integer list as a string, when considering the Erlang external encoding format (cf. term_to_binary/1). In Erlang, strings are represented as flat lists of integers <= 255. When transfering strings or any kinds of lists, nobody cares about encoding, and uses term_to_binary/1 (well, the emulator's external encoding functions). term_to_binary/1 is "smart" when encoding lists: it visits the list, and if it detects that the list is flat and all elements are integers are <= 255, then it encodes it as a string (a special representation!), otherwise as a list of terms. The string external format is compact: byte 0: STRING_EXT tag bytes 1-2: number of bytes (16 bits) bytes 3-: the bytes that form the string I.e., a string of N ASCII characters is encoded into N+3 bytes. However, the list format is much less efficient when transfering a flat list of integers: byte 0: LIST_EXT tag bytes 1-4: number of terms (32 bits), not counting the tail bytes 5-: the terms last bytes: the tail, which is [] when the list is flat (encoded as one byte: the NIL_EXT tag). Integer terms are encoded into different forms depending on their value. Since Unicode considers encoding every character into up to 32 bits, not more, let's consider the different encoding formats available for 32-bit integers: (1) 0<=x<=255: byte 0: SMALL_INTEGER_EXT tag byte 1: x (8 bits) (2) -134217728<=x<=134217727 byte 0: INTEGER_EXT tag bytes 1-4: x (32 bits) (3) all other cases: byte 0: SMALL_BIG_EXT byte 1: length (== 4) byte 2: sign (8 bits!) bytes 3-6: abs(x) (32 bits) There is also the LARGE_BIG_EXT encoding format, for larger integers, but we don't need to consider this for 32-bit values. Let's go back to flat lists of integers. If a flat list of integers contains values < 0 or > 255, then the total encoding size is: 6 + (2 to 7 bytes for every integer) Then, in the worst case, a list of N integers can be encoded into 6+N*7 bytes!!! Then, we can consider how to represent strings in Erlang: either (1) we represent a string as a list of integers, where every integer is the Unicode character as a 32-bit value, or (2) we represent a string as a list of integers <=255, which is the UTF-8 encoding (or just any encoding) of the string. The problem with (1), is that we end up with a very inefficient external encoding of strings (as a list, see above). The real problem, is that we have no way to specify that a list is a string, and that it should be encoded, e.g. into UTF-8, when externally encoded e.g. by term_to_binary/1. In case (1), to have a more efficient representation of strings, encoding/decoding must be done by programmers explicitly, e.g. by doing: Pid ! to_utf8(String) instead of directly: Pid ! String But who does that? I have seen nobody caring about encoding of strings in Erlang code. At least, in Java Strings are distinct data type, and the APIs force everybody to consider the encoding/decoding of strings. It is not transparent, and it is a Good Thing (when considering external representation). Case (2) introduces a lot of problems: the length of a string may no more be the number of characters, and a character may be encoded as several terms in the list. This would surely break a lot of existing code, and makes strings handling awkward. IMHO the best solution is to have something like Java: represent internally every character as one term (solution (1)), but we should have a way to "tag" a list to specify that it is a string, and therefore should be encoded appropriately. The heuristic in the emulator, which considers a list as a string iff it is flat and contains only integers <=255, is not appropriate to handle Unicode. In addition, the external representation of strings should transmit for every string, for instance in 1 additional header byte, the encoding format of the string. E.g., well-known constants for that byte could be: 0 = "ASCII" 1 = "UTF-8" etc. -- Romain Lenglet From ok@REDACTED Wed Jun 28 07:40:58 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 28 Jun 2006 17:40:58 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> Romain Lenglet raises the issue of the external format. Suppose a string were a list of Unicode code points expressed as integers in the range 0..16r10FFFF. (Remember, Unicode simply cannot express any code outside that range.) How inefficient would that be? Romain Lenglet explored the question "how inefficient would that be WITH THE PRESENT EXTERNAL REPRESENTATION." Suppose we had a different external representation. Suppose we had e1' ... eN' => {e1, ..., eN} e1' ... eN' eT' => [e1, ..., eN | eT] e1' ... eN' => [e1, ..., eN] e1" ... eN" => [e1, ..., eN] where all ei naturals c1" ... cN" => 'c1...cN' other stuff using variable byte encoding for things known to be non-negative integers, and a modified variable byte encoding for 3-bit-tag+length values. Length ASCII ..U+3FFF ALL Unicode 0..15 N+1 bytes 2N+1 bytes 3N+1 bytes 16..2063 N+2 bytes 2N+2 bytes 3N+2 bytes 2064..264207 N+3 bytes 2N+3 bytes 3N+3 bytes The simplest change to the Erlang external representation would be to make the STRING representation apply to any list of integers 0..2097151 and to make it use variable byte encoding for the values, which is never worse than UTF-8 and very often better. IMHO the best solution is to have something like Java: represent internally every character as one term (solution (1)), but we should have a way to "tag" a list to specify that it is a string, and therefore should be encoded appropriately. You are forgetting that Java is a statically typed language and Erlang is not. Adding more types to something like Erlang makes *everything* slower. I note that NU Prolog had two internal representations for lists. Literal strings were stored as packed arrays of bytes, while other lists were stored as linked nets of pairs, and the NU Prolog emulator automagically converted strings to pairs as and when needed. The programmer who implemented that stuff (Jeff Schultz) once told me that he regretted it; that it had never really paid off. From rlenglet@REDACTED Wed Jun 28 08:47:57 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 28 Jun 2006 15:47:57 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> Message-ID: <200606281547.57745.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: > Romain Lenglet raises the > issue of the external format. > > Suppose a string were a list of Unicode code points expressed > as integers in the range 0..16r10FFFF. (Remember, Unicode > simply cannot express any code outside that range.) How > inefficient would that be? > > Romain Lenglet explored the question "how inefficient would > that be WITH THE PRESENT EXTERNAL REPRESENTATION." > > Suppose we had a different external representation. > Suppose we had > e1' ... eN' => {e1, ..., eN} > e1' ... eN' eT' => [e1, ..., eN | eT] > e1' ... eN' => [e1, ..., eN] > e1" ... eN" => [e1, ..., eN] where all ei > naturals c1" ... cN" => 'c1...cN' > other stuff > using variable byte encoding for things known to be > non-negative integers, and a modified variable byte encoding > for 3-bit-tag+length values. > > Length ASCII ..U+3FFF ALL Unicode > 0..15 N+1 bytes 2N+1 bytes 3N+1 bytes > 16..2063 N+2 bytes 2N+2 bytes 3N+2 bytes > 2064..264207 N+3 bytes 2N+3 bytes 3N+3 bytes > > The simplest change to the Erlang external representation > would be to make the STRING representation apply to any list > of integers 0..2097151 and to make it use variable byte > encoding for the values, which is never worse than UTF-8 and > very often better. The most efficient is still most often to use an official 8-bit encoding for strings. E.g. for Thai, TIS-620 is the most efficient, for Japanese, ISO-2022 (or others) is the most efficient, etc. But how to know which 8-bit encoding to use? We can't automatically determine the 8-bit encoding to use, since (I guess) this would be too costly. But the application usually knows, or *should* know which encoding to use (e.g. using the NLS configuration, etc.). I think that we should find a way to identify lists of integers as strings, i.e. as lists of Unicode code points, and to "attach" a "preferred encoding" to such lists. Of course, the problem is that to be usable and efficient, a lot of 8-bit encodings have to be known and implemented in the emulator (and erl_interface), which may increase the code size significantly. But those encoding/decoding primitives could also be made usable directly by programs, which would be very useful in general. > IMHO the best solution is to have something like Java: > represent internally every character as one term (solution > (1)), but we should have a way to "tag" a list to specify that > it is a string, and therefore should be encoded appropriately. > > You are forgetting that Java is a statically typed language > and Erlang is not. Adding more types to something like Erlang > makes *everything* slower. I was not thinking about adding a new type, but rather new conventions. After all, the concept of "string" is only a matter of conventions in Erlang! For instance, I propose to represent a string as a 'string' record: {string, 'utf-8', [$a, $b]} The second element would be the "preferred encoding" of the string, and the third element the flat list of Unicode code points. Two forms would then be accepted for strings: (1) as a flat list of Unicode code points (this is the current form, kept for backward compatibility); (2) as a tuple described just above. > I note that NU Prolog had two internal representations for > lists. Literal strings were stored as packed arrays of bytes, > while other lists were stored as linked nets of pairs, and the > NU Prolog emulator automagically converted strings to pairs as > and when needed. > > The programmer who implemented that stuff (Jeff Schultz) once > told me that he regretted it; that it had never really paid > off. Personally, I am voting for (1) representing strings as lists of Unicode code points, but (2) providing a better (more flexible, more efficient) external representation, and most importantly (3) providing a more flexible interface to the external encoding/decoding primitives, such as supporting strings as tuples as above. -- Romain LENGLET From chandrashekhar.mullaparthi@REDACTED Wed Jun 28 11:19:05 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 28 Jun 2006 10:19:05 +0100 Subject: http client us ascii restriction In-Reply-To: <871wtbq97p.fsf@yandex-team.ru> References: <871wtbq97p.fsf@yandex-team.ru> Message-ID: This works in ibrowse :-) Chandru On 27/06/06, Igor Goryachev wrote: > > Hello. > > I have met some US ASCII restrictions in erlang's http client: > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rlenglet@REDACTED Wed Jun 28 11:21:33 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 28 Jun 2006 18:21:33 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281547.57745.rlenglet@users.forge.objectweb.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> Message-ID: <200606281821.33933.rlenglet@users.forge.objectweb.org> Romain Lenglet wrote: > Richard A. O'Keefe wrote: [deleted the description of your proposed encoding] > > The simplest change to the Erlang external representation > > would be to make the STRING representation apply to any list > > of integers 0..2097151 and to make it use variable byte > > encoding for the values, which is never worse than UTF-8 and > > very often better. > > The most efficient is still most often to use an official > 8-bit encoding for strings. E.g. for Thai, TIS-620 is the most > efficient, for Japanese, ISO-2022 (or others) is the most > efficient, etc. > > But how to know which 8-bit encoding to use? We can't > automatically determine the 8-bit encoding to use, since (I > guess) this would be too costly. But the application usually > knows, or *should* know which encoding to use (e.g. using the > NLS configuration, etc.). [...] > I was not thinking about adding a new type, but rather new > conventions. After all, the concept of "string" is only a > matter of conventions in Erlang! > For instance, I propose to represent a string as a 'string' > record: > > {string, 'utf-8', [$a, $b]} > > The second element would be the "preferred encoding" of the > string, and the third element the flat list of Unicode code > points. I have been thinking about another solution, completely compatible with existing code: Let's define a few new BIFs: set_default_string_external_encoding/1, get_default_string_external_encoding/0 and get_available_string_external_encodings/0. These may manipulate the default encoding of strings for the whole Erlang node, which can be chosen among the list returned by get_available_string_external_encodings/0, e.g. ['utf-8', 'iso-8859-1', 'tis-620', ...]. That default encoding could also be specified on erl's command line, or determined from the environment (e.g. environment variable LC_CTYPE on Unixes). As a variant, we could have a per-process default string encoding. (???) When encoding a list, e.g. when calling term_to_binary/1, the emulator would visit the elements, as it does now, to test if all elements are integers >= 0, if they are <= 255, and if the list is flat. BUT in addition, it would check that the integers can be encoded using that default encoding (if it is 'utf-8', it can always be encoded, but with other 8-bit encodings it is not the case). We could then distinguish 3 cases: (1) all elements are integers >= 0 and <= 255: we encode using the currently available STRING_EXT format. else (2) all elements are integers >= 0 and that can be encoded using the default encoding: we encode the string in a new STRING_ENC_EXT format: byte 0: STRING_ENC_EXT tag byte 1: identifier for the encoding bytes 2-3: number of bytes (16 bits) bytes 4-: string encoded using the default encoding else (3) all elements are integers: the list is encoded using your variable-length encoding for every integer (or why not ASN.1's BER or PER encoding?), in a new INTEGER_LIST_EXT format: byte 0: INTEGER_LIST_EXT tag bytes 1-2: number of bytes (16 bits) bytes 3-: encoded integers else (the list is not flat or contains non-integers) (4) the list is encoded using the currently available LIST_EXT format. For existing code that uses only ASCII strings, the external encoding of strings is unchanged: (1) is always used. For programs that combine strings that contain ASCII English text, and strings in *one* other language, strings are either encoded using (1) or (2), which are optimal external encodings (if the default encoding is chosen carefully). For other cases, i.e. programs that manipulate strings in several non-English languages, or strings that mix several languages, then strings can be encoded using either (1), (2) or (3), which is a "not so bad" compromise. -- Romain LENGLET From goryachev@REDACTED Wed Jun 28 11:37:07 2006 From: goryachev@REDACTED (Igor Goryachev) Date: Wed, 28 Jun 2006 13:37:07 +0400 Subject: http client us ascii restriction In-Reply-To: (Chandru's message of "Wed, 28 Jun 2006 10:19:05 +0100") References: <871wtbq97p.fsf@yandex-team.ru> Message-ID: <87lkrhoc3g.fsf@yandex-team.ru> Chandru writes: >> I have met some US ASCII restrictions in erlang's http client: >> > This works in ibrowse :-) > Well, but ibrowse is not a part of official erlang distribution? -- Igor Goryachev Yandex development team. From ke.han@REDACTED Wed Jun 28 12:21:20 2006 From: ke.han@REDACTED (ke han) Date: Wed, 28 Jun 2006 18:21:20 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281547.57745.rlenglet@users.forge.objectweb.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> Message-ID: <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> On Jun 28, 2006, at 2:47 PM, Romain Lenglet wrote: > > Personally, I am voting for (1) representing strings as lists of > Unicode code points, but (2) providing a better (more flexible, > more efficient) external representation, and most importantly > (3) providing a more flexible interface to the external > encoding/decoding primitives, such as supporting strings as > tuples as above. > I don't care about the internal representation of string so long as its (a) _significantly_ more memory efficient than one word per character in a list and (b) allows me to pass these non-mutable strings between processes without a mem copy each time. My end game is writing web apps in erlang+yaws+mnesia. The basic result of any yaws page (or any dynamic html server) is to output a sequence of terms into a stream the browser is expecting. This means the following concatenation or list of "strings" is common in streaming out a page: Header + StaticWebPagePreamble + StaticContentSuchAsLabelsLookedUpByUsersLangPref + HTMLInputControl + ContentForInputControl + ... + HTMLSelectControl + ContentForSelectControl + StaticWebPageFooter Lets assume the above is a good general view of what yaws needs to output. - Header may be hardcoded in the yaws file or calculated. - StaticWebPagePreamble may be hardcoded in the yaws file or looked up used something like gettext for different language representations. - StaticContentSuchAsLabelsLookedUpByUsersLangPref is looked up by user lang prefs. e.g. is the field label "name:" or "nom:" - HTMLInputControl hard coded in the yaws file. may need to have its size adjusted based on content (see next value) - ContentForInputControl injected or "bound attribute" from a model or controller process or record - ContentForSelectControl injected or "bound attribute" from a process This implies the following: 1 - yaws should be able to handle "strings" (even if they are some binary encoded utf-8 format) without touching them until its time to stream out the final result. Yaws already does this for terms in general when constructing pages. A string solution would need to ensure yaws can handle the new string form. 2 - it should be easy/possible but not necessarily efficient to compute the length of a string. for example, string like StaticContentSuchAsLabelsLookedUpByUsersLangPref and HTMLInputControl might need to be sized based on the length of string content. Counting the characters in a utf-8 encoded binary to compute its length is not a problem since these string will always be short (they have to fit in the HTML page). 3 - lists of strings such as ContentForSelectControl might be a long list of country names. You _do not_ want this list of strings copied from countryManager process to pageController process to yaws page _every time_ you output a page. This is a killer inefficiency!!! It is academically interesting to learn about the complexities of supporting unicode. However, most practitioners like myself simple do not care and just want _one_ solution that works efficiently for an entire set of use case for the type of apps we build. If SCSU internal and utf-8 external is smart, than thats fine. If utf-8 internal and external is easier to implement and is good enough, its heaps better than what we have now and would unblock this reality (not perception) that "erlang doesn't handle strings well". thanks, ke han > -- > Romain LENGLET From vladdu55@REDACTED Wed Jun 28 12:34:52 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Jun 2006 12:34:52 +0200 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281821.33933.rlenglet@users.forge.objectweb.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <200606281821.33933.rlenglet@users.forge.objectweb.org> Message-ID: <95be1d3b0606280334r58a93d9dkc718459773669fc3@mail.gmail.com> hi, I don't have a strong opinion about this encoding stuff (more that it would be good to have a working solution), but there is one thing that I'm not comfortable with: > bytes 1-2: number of bytes (16 bits) (this applies to today's STRING_EXT format too). There are cases when one has to handle strings longer than 65536 chars, and if sending to external programs, those have to be able to handle both STRING_EXT and LIST_EXT, which is a little unwieldy. regards, Vlad From thomasl_erlang@REDACTED Wed Jun 28 12:34:57 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 28 Jun 2006 03:34:57 -0700 (PDT) Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281821.33933.rlenglet@users.forge.objectweb.org> Message-ID: <20060628103457.51934.qmail@web38807.mail.mud.yahoo.com> --- Romain Lenglet wrote: > I have been thinking about another solution, > completely > compatible with existing code: > > Let's define a few new BIFs: > set_default_string_external_encoding/1, > get_default_string_external_encoding/0 and > get_available_string_external_encodings/0. > These may manipulate the default encoding of strings > for the > whole Erlang node, which can be chosen among the > list returned > by get_available_string_external_encodings/0, e.g. > ['utf-8', 'iso-8859-1', 'tis-620', ...]. > > That default encoding could also be specified on > erl's command > line, or determined from the environment (e.g. > environment > variable LC_CTYPE on Unixes). Persistent data (e.g., mnesia) will also need to play nice with different encodings. I'm not sure how generic databases handle this, but for dets, perhaps one could (persistently) set the encoding for the table. (Clients could then invoke the appropriate term_to_binary and binary_to_term as part of insert/lookup/...) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rlenglet@REDACTED Wed Jun 28 12:45:07 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 28 Jun 2006 19:45:07 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> Message-ID: <200606281945.07709.rlenglet@users.forge.objectweb.org> ke han wrote: > On Jun 28, 2006, at 2:47 PM, Romain Lenglet wrote: > > Personally, I am voting for (1) representing strings as > > lists of Unicode code points, but (2) providing a better > > (more flexible, more efficient) external representation, and > > most importantly (3) providing a more flexible interface to > > the external encoding/decoding primitives, such as > > supporting strings as tuples as above. > > I don't care about the internal representation of string so > long as its (a) _significantly_ more memory efficient than one > word per character in a list and (b) allows me to pass these > non-mutable strings between processes without a mem copy each > time. > > My end game is writing web apps in erlang+yaws+mnesia. What we were discussing is how to internally represent, and externally encode (in the term_to_binary/1 sense), strings in a form suitable for building or modification by programs. You are discussing about the need to pass around strings that are already 8-bit encoded and that don't need to be modified. Different problems. Different representations. > The basic result of any yaws page (or any dynamic html server) > is to output a sequence of terms into a stream the browser is > expecting. This means the following concatenation or list of > "strings" is common in streaming out a page: > > Header + StaticWebPagePreamble + > StaticContentSuchAsLabelsLookedUpByUsersLangPref + > HTMLInputControl + ContentForInputControl + ... + > HTMLSelectControl + > ContentForSelectControl + StaticWebPageFooter [...] Since you don't seem to need to modify the contents of those strings, why don't IO-lists (i.e. a list of binaries) fit your need? You should simply pass a list of binaries, where each binary contains text is 8-bit encoded in UTF-8 or ISO-8859-1 or whatever. Binaries are not copied. Such IO-lists are what is used to communicate with linked-in C drivers. IO-lists are the most efficient way to transmit large data in an Erlang node. Why doesn't that fit your needs? -- Romain LENGLET From surindar.shanthi@REDACTED Wed Jun 28 12:55:08 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 28 Jun 2006 16:25:08 +0530 Subject: gen_supervisor problem Message-ID: <42ea5fb60606280355y1cbd90f4p2f0cd03c28162d85@mail.gmail.com> Dear all, I'm running an application using OTP principles. The Supervision tree has the following structure. Supervisor1 / \ / \ Supervisor2 Workers / / Workers Here if the Supervisor2 is exited then it would start automatically. There is no problem in that. But Supervisor2 starts with the same data which i passed while starting the Supervisor2 . What i want is, if the Supervisor2 is restarted, it should not use the same data which i passed to it while starting that. ie. I want the data to be passed to the Supervisor2 under my control while restarting it. How this can be acheived? Please clarify -- Thanks in advance, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From rlenglet@REDACTED Wed Jun 28 12:56:39 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 28 Jun 2006 19:56:39 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <95be1d3b0606280334r58a93d9dkc718459773669fc3@mail.gmail.com> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281821.33933.rlenglet@users.forge.objectweb.org> <95be1d3b0606280334r58a93d9dkc718459773669fc3@mail.gmail.com> Message-ID: <200606281956.39592.rlenglet@users.forge.objectweb.org> Vlad Dumitrescu wrote: > hi, > > I don't have a strong opinion about this encoding stuff (more > that it would be good to have a working solution), but there > is one thing that > > I'm not comfortable with: > > bytes 1-2: number of bytes (16 bits) > > (this applies to today's STRING_EXT format too). There are > cases when one has to handle strings longer than 65536 chars, > and if sending to external programs, those have to be able to > handle both STRING_EXT and LIST_EXT, which is a little > unwieldy. You're right! And inversely, if you need to exchange lists of integers that are not strings (i.e. the elements are semantically not characters), but your lists happen to be flat and all values are between 0 and 255, then they will be encoded as STRING_EXTs. I needed to exchange lists of lengths of binaries with a linked-in driver, and I was surprised, the first time, to receive a STRING_EXT and not a LIST_EXT. :-) A bad point about erl_interface is that it does not unify both representations. ei_decode_string() can decode both representations, but not ei_decode_list() (it fails if a STRING_EXT is transmitted). I think that this is the most important point, and what blocks you: we should have a cleaner erl_interface that abstracts those external representations of strings and lists. I have thought about how to solve this cleanly, but I have not found yet. Once I have found, I will send a patch. ;-) Regards, -- Romain LENGLET From thomasl_erlang@REDACTED Wed Jun 28 13:01:50 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 28 Jun 2006 04:01:50 -0700 (PDT) Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> Message-ID: <20060628110150.58780.qmail@web38805.mail.mud.yahoo.com> --- "Richard A. O'Keefe" wrote: > [long] Thanks, Richard. In essence, it sounds like representing strings as lists of unicode characters (either as separate character objects, or simply as integers?(*)) with ways to encode/decode to other formats (UTF-8, SCSU) would be a quite reasonable way forward, then? (And, I suppose, libraries to work with unicode.) Other useful comments have appeared too. Maybe we should collect them and see. Are there any programming language issues to be considered? Backwards compatibility? Best, Thomas (*) I seem to recall that the old Erlang-5 specification proposed a separate character datatype. It seems a bit useful to me, but I haven't really thought it through. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf.wiger@REDACTED Wed Jun 28 13:34:16 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 28 Jun 2006 13:34:16 +0200 Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: ke han wrote: > > I don't care about the internal representation of string so > long as its (a) _significantly_ more memory efficient than > one word per character in a list and (b) allows me to pass > these non-mutable strings between processes without a mem > copy each time. If you want to see something memory-inefficient, try compiling Erlang for 64-bit. Each character in a string will still be two heap words, but each word will now be 64 bits instead of 32. /Ulf W (: From ulf.wiger@REDACTED Wed Jun 28 13:39:27 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 28 Jun 2006 13:39:27 +0200 Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: Thomas Lindgren wrote: > > Persistent data (e.g., mnesia) will also need to play nice > with different encodings. > > I'm not sure how generic databases handle this, but for dets, > perhaps one could (persistently) set the encoding for the > table. (Clients could then invoke the appropriate > term_to_binary and binary_to_term as part of insert/lookup/...) This is one of the things I added to 'rdbms'. It allows you to specify read/write filters to a table, where the filter is an extended match specification. This makes 'rdbms' able to transparently coerce data (within limits) to/from given representations. You can, for example, specify a list_to_binary/binary_to_list coersion (binary_to_term also works.) Beta testing has gone pretty well, I think, and I will pretty soon make a new version available. I'd love to have someone take a look at these filters too, to see whether they are appropriate and add sufficient value. BR, Ulf W From headspin@REDACTED Wed Jun 28 13:43:32 2006 From: headspin@REDACTED (dda) Date: Wed, 28 Jun 2006 13:43:32 +0200 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> Message-ID: On 6/28/06, Richard A. O'Keefe wrote: [snip] > + CJK text requires 2n+1 bytes (one byte says "switch to 16-bit"), > so SCSU is a good representation for CJK. Nope. 16 bit is 65536 chars tops, and this is not going to cut it. While common usage sinograms are in the neighbourhood of 2,000, depending on the language, my own [somewhat] limited dictionary has 50,000 of them, without counting alternative/ancient forms and vernacular characters [hangul letters and syllables, kata- and hiragana, bopomofo, chu nom chars and many other glyphs used by CJKV languages]. The first sinogram in my wife's name is not available in the Unicode standard, for instance. This is why these countries, and Japan especially, are very reluctant to even prod Unicode with a 10-foot pole ? although the UniHan project has a lot of CJKV people. See the Ruby Talk list and Matz's arguments in favout of m17n for instance... [Although I think it is kind of selfish from Matz to try and impose a complex and convoluted encoding-aware String implementation just because a fewRuby users ? including himself ? don't want unicode. But I digress]. The Mojikyo project http://www.mojikyo.org/html/abroad/index_e.html has around 80,000 characters ? 70,000+ of which are sinograms ? although it is based around different fonts rather than a X-bit (with X>16) encoding scheme, which seems to me a tad deluded, but anyway... Same goes for the Korean word process HWP, which has internally more characters than you could possibly need, and use separate fonts to achieve that. In another programming language I use, string objects are encoding aware [and utf8 by default], and string operations are split among byte ops and character ops ? eg len vs lenB ? which is very convenient. There's a lot to learn from them. I have played for a while with a bare-ass utf-8 implementation in Erlang ? geared towards CJKV. Things that look simple on paper like getting a substring of the X rightmost *chars* suddenly become a pita. But it's slowly coming around. -- Didier From yarivvv@REDACTED Wed Jun 28 15:13:28 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 28 Jun 2006 09:13:28 -0400 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281300.46231.rlenglet@users.forge.objectweb.org> References: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> <200606281300.46231.rlenglet@users.forge.objectweb.org> Message-ID: <17244f480606280613v27bad535jcd62832d71f7c9ba@mail.gmail.com> > The problem with (1), is that we end up with a very inefficient > external encoding of strings (as a list, see above). The real > problem, is that we have no way to specify that a list is a > string, and that it should be encoded, e.g. into UTF-8, when > externally encoded e.g. by term_to_binary/1. > In case (1), to have a more efficient representation of strings, > encoding/decoding must be done by programmers explicitly, e.g. > by doing: > Pid ! to_utf8(String) > instead of directly: > Pid ! String > > But who does that? I have seen nobody caring about encoding of > strings in Erlang code. I've been hacking the JSON parser in Yaws, and I actually came across usage of the undocumented (as far as I can see) xmerl_ucs module, especially the to_utf8 and from_utf8 functions. I would have probably never known about these functions had I not seen this code. Yariv From ke.han@REDACTED Wed Jun 28 16:14:48 2006 From: ke.han@REDACTED (ke han) Date: Wed, 28 Jun 2006 22:14:48 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281945.07709.rlenglet@users.forge.objectweb.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> <200606281945.07709.rlenglet@users.forge.objectweb.org> Message-ID: <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> On Jun 28, 2006, at 6:45 PM, Romain Lenglet wrote: > ke han wrote: >> On Jun 28, 2006, at 2:47 PM, Romain Lenglet wrote: >>> Personally, I am voting for (1) representing strings as >>> lists of Unicode code points, but (2) providing a better >>> (more flexible, more efficient) external representation, and >>> most importantly (3) providing a more flexible interface to >>> the external encoding/decoding primitives, such as >>> supporting strings as tuples as above. >> >> I don't care about the internal representation of string so >> long as its (a) _significantly_ more memory efficient than one >> word per character in a list and (b) allows me to pass these >> non-mutable strings between processes without a mem copy each >> time. >> >> My end game is writing web apps in erlang+yaws+mnesia. > > What we were discussing is how to internally represent, and > externally encode (in the term_to_binary/1 sense), strings in a > form suitable for building or modification by programs. You are > discussing about the need to pass around strings that are > already 8-bit encoded and that don't need to be modified. > Different problems. Different representations. right..I do understand this thread has several facets...I'm adding my high level application needs into the mix to ensure they aren't forgotten...why, because I haven't the skills to solve this low level problem and need guys like you who do understand the internals of erlang to take these needs into account in hopes of eventually getting something useful ;-) > >> The basic result of any yaws page (or any dynamic html server) >> is to output a sequence of terms into a stream the browser is >> expecting. This means the following concatenation or list of >> "strings" is common in streaming out a page: >> >> Header + StaticWebPagePreamble + >> StaticContentSuchAsLabelsLookedUpByUsersLangPref + >> HTMLInputControl + ContentForInputControl + ... + >> HTMLSelectControl + >> ContentForSelectControl + StaticWebPageFooter > [...] > > Since you don't seem to need to modify the contents of those > strings, why don't IO-lists (i.e. a list of binaries) fit your > need? You should simply pass a list of binaries, where each > binary contains text is 8-bit encoded in UTF-8 or ISO-8859-1 or > whatever. Binaries are not copied. Such IO-lists are what is > used to communicate with linked-in C drivers. IO-lists are the > most efficient way to transmit large data in an Erlang node. > Why doesn't that fit your needs? I understand that a lengthy binary is not copied. I have seen posts on this maillist that short binaries _are_ copied and long ones _are not_...but I don't know what length determines when something is copied or not. In the example I gave, my countryManager process is a singleton (pardon the oo pattern reference, but thats what it is) that serves the entire VM to answer a list of countries. This is a lengthy list of short utf-8 encoded binaries. So wouldn't the list get copied? And won't each short binary in the list get copied as well? There must be a better way. In order to get around this problem, I would have to destroy MVC separations and have my model object (countryManager) return an already serialized binary of binaries (or if I'm going to do that I may as well have the countryManager go ahead and serialize it to json form as well). This violates lots of sounds application design. Basic principles of encapsulation and separation of presentation and app logic are well grounded in OO design. These principals apply to non-OO languages as well. I understand that not having object references and copying terms between calls to erlang processes is a key element of erlang. But for non-mutable strings??? Not having a solution for this makes mainstream web apps very inefficient. To reference Richard's earlier post: > STRINGS ARE WRONG. > >Strings are a good data type for text that you are NOT going to manipulate. >If you have to manipulate text, it's usually a good idea to convert it to >something else as quickly as you can, such as an abstract syntax tree. >This will be orders of magnitude cheaper to process, even in C. I agree. I am talking about handling these non-mutable things (I've been calling them strings) that need to be stored (in mem and on disk) and passed around between processes efficiently. My point of providing a real world example of how I need to use strings is that talk of string implementation without defining a set of cases for how it would be used is pretty, well useless. As Ulf points out, my scenario gets even worse with 64-bit erlang. thanks, ke han > > -- > Romain LENGLET -------------- next part -------------- An HTML attachment was scrubbed... URL: From dot@REDACTED Wed Jun 28 17:30:54 2006 From: dot@REDACTED (Tony Finch) Date: Wed, 28 Jun 2006 16:30:54 +0100 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281300.46231.rlenglet@users.forge.objectweb.org> References: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> <200606281300.46231.rlenglet@users.forge.objectweb.org> Message-ID: On Wed, 28 Jun 2006, Romain Lenglet wrote: > > Integer terms are encoded into different forms depending on their > value. Since Unicode considers encoding every character into up > to 32 bits, not more, let's consider the different encoding > formats available for 32-bit integers: Unicode characters have code points up to 0x10FFFF so you don't need to worry about the SMALL_BIG_EXT binary format. > (1) 0<=x<=255: > byte 0: SMALL_INTEGER_EXT tag > byte 1: x (8 bits) > (2) -134217728<=x<=134217727 > byte 0: INTEGER_EXT tag > bytes 1-4: x (32 bits) > (3) all other cases: > byte 0: SMALL_BIG_EXT > byte 1: length (== 4) > byte 2: sign (8 bits!) > bytes 3-6: abs(x) (32 bits) Tony. -- f.a.n.finch http://dotat.at/ PORTPATRICK: STRONG SOUTH OR SOUTHEAST WINDS IN ROCKALL AND BAILEY SPREADING TO MALIN, HEBRIDES, FAIR ISLE, FAEROES AND SOUTHEAST ICELAND DURING FRIDAY BUT DECREASING BY SATURDAY, PERHAPS GALES AT FIRST IN WEST ROCKALL AND WEST BAILEY. From ke.han@REDACTED Wed Jun 28 18:47:50 2006 From: ke.han@REDACTED (ke han) Date: Thu, 29 Jun 2006 00:47:50 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <17244f480606280613v27bad535jcd62832d71f7c9ba@mail.gmail.com> References: <200606280222.k5S2MvP4321049@atlas.otago.ac.nz> <200606281300.46231.rlenglet@users.forge.objectweb.org> <17244f480606280613v27bad535jcd62832d71f7c9ba@mail.gmail.com> Message-ID: On Jun 28, 2006, at 9:13 PM, Yariv Sadan wrote: > > I've been hacking the JSON parser in Yaws, and I actually came across > usage of the undocumented (as far as I can see) xmerl_ucs module, > especially the to_utf8 and from_utf8 functions. I would have probably > never known about these functions had I not seen this code. > > Yariv Have you looked into jungerl? there is a lib called gettext which does lots of unicode conversions? In short, erlang has libraries (like gettext) to convert to/from various formats. What's missing is: 1) best practices 2) combined with macros or syntax sugar or language additions to make binary strings more transparently usable and 3) efficiency: memory copying and storing strings by default as binaries encoded to default format (utf-8?) instead of lists of integers. ke han From hp@REDACTED Wed Jun 28 21:40:20 2006 From: hp@REDACTED (HP Wei) Date: Wed, 28 Jun 2006 15:40:20 -0400 (EDT) Subject: behavior of io:format() in spawn'ed process In-Reply-To: <95be1d3b0606270610q596930d6nc8b6ee483c20d014@mail.gmail.com> References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> <95be1d3b0606270610q596930d6nc8b6ee483c20d014@mail.gmail.com> Message-ID: I am writing a monitoring module whose partial code is appended at the end of this email. I would like to ask for help in understanding the behavior of io:format() in a spawn'ed process. Suppose there are three nodes. What the code does is illustrated in the following. node_a node_b node_c stage(1) migrate()-------> watch_job() through spawn_link() stage(2) send_back done stage(3) migrate()-------->watch_job() through spawn_link The code is compiled and loaded on all three nodes' erl-sehll (in interactive mode). The first migrate() call is invoked in node_a's shell window. Here comes the questions: How come the output of io:format() in the first line of the function watch_job() always gets displayed in the shell-window of node_a ?? In the above diagram, both watch_job() are not run on node_a. I thought there would be no output on node_a. Somehow, the IO is tied to node_a's erl-shell. [ If I break the tie (by killing the erl-shell on node_a, the code won't work anymore...] Am I doing something wrong in the code ? Thanks, --hp -module(wd). -export([watch_job/2, migrate/1]). watch_job(Nodes, Calling_pid) -> io:format("~p -- calling from ~p~n", [node(), Calling_pid]), do_something(), % including re-starting any dead erl. % ask the next node to take over Calling_pid ! {done, {node(), self()}}, spawn(?MODULE, migrate, [Nodes]). ... migrate(Nodes) -> process_flag(trap_exit, true), Node = next_node(node(), Nodes), % get the next node other than me Pid = spawn_link(Node, ?MODULE, watch_job, [Nodes, self()]), loop(Pid, Nodes). ... loop(Pid, Nodes) -> receive {'EXIT', Pid, noconnection} -> deal_with_it(), % start another migrater spawn(?MODULE, migrate, [Nodes]); X -> ok end. ... From bsder@REDACTED Wed Jun 28 22:54:59 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 28 Jun 2006 13:54:59 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606281547.57745.rlenglet@users.forge.objectweb.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> Message-ID: <44A2ECA3.6040904@allcaps.org> Romain Lenglet wrote: > The most efficient is still most often to use an official 8-bit > encoding for strings. E.g. for Thai, TIS-620 is the most > efficient, for Japanese, ISO-2022 (or others) is the most > efficient, etc. Really? ISO-2022? How does that beat UTF-16? IIRC, UTF-16 manages to account for all of the Joyou Kanji as well as kana in two bytes. Given that the Kana account for close to 90 entries off the top, that only leaves the upper 128 bytes for Kanji. That isn't much. In addition, Japanese mixes Kanji, Kana, and Roman characters fairly fluidly on the web. I find it very difficult to believe that any "byte"-based encoding beats UTF-16 by very much for any of the languages which use Kanji. -a From bsder@REDACTED Wed Jun 28 23:17:02 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 28 Jun 2006 14:17:02 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> Message-ID: <44A2F1CE.2010201@allcaps.org> dda wrote: > While common usage sinograms are in the neighbourhood of 2,000, > depending on the language, my own [somewhat] limited dictionary has > 50,000 of them, without counting alternative/ancient forms and > vernacular characters [hangul letters and syllables, kata- and > hiragana, bopomofo, chu nom chars and many other glyphs used by CJKV > languages]. The first sinogram in my wife's name is not available in > the Unicode standard, for instance. Really? Not even in the Supplementary Ideographic Plane (Plane 2)? Wow. What's the sinogram? I'm curious. > This is why these countries, and > Japan especially, are very reluctant to even prod Unicode with a > 10-foot pole ? although the UniHan project has a lot of CJKV people. Well, there is also more than a little politics involved. Part of it is "our characters are more important than their characters" a la "Our diplomats get to sit here and their diplomats get to sit there." Contrary to popular belief, an official UTF-16 encoding is capable of accessing all of the planes (it uses an escape sequence to create a 4-byte combination which can access the 20-bit code points). Technically, it's just a matter of adding the ideogram to the standard. As the web becomes more and more fluid, "my language gets the first n characters so that my text is small" encodings just aren't going to work. I already read forums in which people throw around English, Japanese, and Chinese fairly interchangeably in the same thread. Anyone who doesn't use Unicode and UTF-8 gets a fast, harsh beatdown. And don't get me started about the Japanese penchant for stars, hearts, and other dingbats characters (and bright pink--I think the red receptors in my eyes are burning out). > In another programming language I use, string objects are encoding > aware [and utf8 by default], and string operations are split among > byte ops and character ops ? eg len vs lenB ? which is very > convenient. There's a lot to learn from them. Yeah, that seems to be the only real way to deal with this. I default to UTF-8 unless I have a really good reason otherwise. Even encoding ignorant programs (aka some databases) avoid molesting UTF-8 strings (this is not true for UTF-16--too many bytes of 0's). > I have played for a > while with a bare-ass utf-8 implementation in Erlang ? geared towards > CJKV. Things that look simple on paper like getting a substring of the > X rightmost *chars* suddenly become a pita. But it's slowly coming > around. A lot of people fail to realize that even if you use something like UTF-32 (4-bytes per character), combining characters *still* make the delineation of "character boundaries" non-trivial. -a From klacke@REDACTED Thu Jun 29 00:50:09 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 29 Jun 2006 00:50:09 +0200 Subject: behavior of io:format() in spawn'ed process In-Reply-To: References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> <95be1d3b0606270610q596930d6nc8b6ee483c20d014@mail.gmail.com> Message-ID: <44A307A1.2020605@hyber.org> HP Wei wrote: > I am writing a monitoring module whose partial code is appended > at the end of this email. > I would like to ask for help in understanding the behavior of > io:format() in a spawn'ed process. terminal I/O goes back and is produced at the node which originally spawned the process. If you want I/O to appear at the node where the process is running - use io:format(user, Format, Args). ^ | atom there /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From rlenglet@REDACTED Thu Jun 29 05:14:12 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 29 Jun 2006 12:14:12 +0900 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <44A2ECA3.6040904@allcaps.org> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <44A2ECA3.6040904@allcaps.org> Message-ID: <200606291214.13316.rlenglet@users.forge.objectweb.org> Andrew Lentvorski wrote: > Romain Lenglet wrote: > > The most efficient is still most often to use an official > > 8-bit encoding for strings. E.g. for Thai, TIS-620 is the > > most efficient, for Japanese, ISO-2022 (or others) is the > > most efficient, etc. > > Really? ISO-2022? How does that beat UTF-16? ISO-2022 allows to *combine* encodings, by specifying "switch" escape characters. One switch specifies that the following bytes are 7-bit ASCII, other switches specify that the following bytes are in some JIS-* encoding, etc. That way, every sequence of characters can be encoded using the best encoding for that sequence of characters, preceded by the switch escape characters for that encoding. I admit that I don't really know if ISO-2022-JP is actually more efficient than UTF-16 (I have not found figures), but such an adaptive encoding / compression is potentially more efficient than UTF-16, IMHO. > IIRC, UTF-16 manages to account for all of the Joyou Kanji as > well as kana in two bytes. Given that the Kana account for > close to 90 entries off the top, that only leaves the upper > 128 bytes for Kanji. > > That isn't much. > > In addition, Japanese mixes Kanji, Kana, and Roman characters > fairly fluidly on the web. > > I find it very difficult to believe that any "byte"-based > encoding beats UTF-16 by very much for any of the languages > which use Kanji. I can guarantee you that nobody uses UTF-* here in Japan. Although all email software I have seen support UTF-*, everybody uses either ISO-2022-JP or directly JIS encodings. The reason they invoke is efficiency. Even well educated people who understand the advantages of using a common encoding such as UTF-*. Or maybe that's a kind of superstition... ;-) -- Romain LENGLET From ok@REDACTED Thu Jun 29 06:29:48 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 29 Jun 2006 16:29:48 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606290429.k5T4Tmkh334750@atlas.otago.ac.nz> I described a replacement for the representation of strings in Erlang's external term form which (1) is extremely fast to decode (2) is tolerably space-efficient; most of the Indic scripts will fit in 2 bytes per character, even Bopomofo. And for that matter, Thai. Romain Lenglet continues to press for a far more "heavyweight" solution. The most efficient is still most often to use an official 8-bit encoding for strings. E.g. for Thai, TIS-620 is the most efficient, for Japanese, ISO-2022 (or others) is the most efficient, etc. I don't see any reason to believe that ISO-2022 is the most space efficient representation for Japanese. For one thing, ISO-2022 doesn't have anything to say about Japanese characters as such. For another, ISO-2022 is a framework for streams using multiple code-sets and using "announcers" to switch between codes. Those announcers are rather longer (3 bytes) than the single byte that SCSU would take to switch to DBCS. Perhaps Romain Lenglet has ISO-2022-JP or (or -JP-1, -JP-2, or -JP-3), which is an application of ISO 2022, in mind. It would be interesting to know whether those are more space efficient than SCSU or not; I suspect not. So we have two possible approaches here: (A) Encode sequences of integers that could be Unicode code-points using variable-byte encoding (instead of one byte per number). + Extremely fast to encode and decode. + Never worse than UTF-8 and often better. - Not as compact as script-specific encodings. (B) Encode sequences of integers that could be Unicode code-points using the standard Simple Compression Scheme for Unicode (Unicode Technical Standard 6, http://www.unicode.org/reports/tr6/). + Fairly simple to decode. (My SCSU decoder is 103 SLOC of Smalltalk, including tables.) + Gets down to 1 byte per character for the commoner alphabetic scripts, including Latin, Greek, Cyrillic, Arabic, and the Indic scripts, amongst others. + Gets down to 2 bytes per character for BMP characters including the more common CJK characters and averages less than 2 bytes per character for Japanese. + The report comes with a sample encoder, which is 75 lines of C. - The sample encoder doesn't use all the features of SCSU and writing and encoder that does better requires careful design. Looking at TIS 620.2533 (http://www.langbox.com/codeset/tis620.html) I see that it is a typical "ASCII+top half" character set, and that the top half is simply a shifted version of the Unicode code points U+0E01 to U+0E5B (which probably means that the Thai block in Unicode was copied from TIS 620 in the first place). And what _that_ means is that this is _exactly_ the kind of alphabetic script that SCSU was designed to support efficiently. The U+0E00..U+0E7F half-block is half-block 28, so to encode Thai characters using SCSU would take <16r18 {SD1}, 16r1c {Thai}> followed by ONE BYTE PER CHARACTER. (The "minimal encoder" in section 8.4 of UTR-6 won't do this well. But an encoder that buffers a few characters before deciding whether to set a dynamic window should be able to cope easily.) Let me repeat that. To encode N characters of Thai text using TIS-620 would take N bytes. To do so using SCSU would take N+2 bytes. That's not a lot of overhead. Can we do anything to reduce it? Why yes. Simply leave the coding state unchanged between strings, so that a sequence of Thai strings would have *one" "set dynamic window" opcode for all of them But how to know which 8-bit encoding to use? You don't need to. While SCSU doesn't handle _every_ possible 8-bit character set, it _does_ handle the scripts used by several thousand million people, with a very modest investment in tables. But the application usually knows, or *should* know which encoding to use (e.g. using the NLS configuration, etc.). Wrong. Just because my personal "NLS configuration" is set to en_NZ.ISO8859-1 (on systems that have it) or en_AU.ISO8859-1 (on systems that don't), that *doesn't* mean that the text I am processing is or even *could be* encoded using ISO 8859-1. As it happens, I have quite a lot of text in Maori, which would need ISO 8859-4 (Latin 4), 8859-10 (Latin 6), or 8859-13 (Latin 7). Yes, that means that those characters won't display correctly on my terminal, but just because I am *storing*, *transmitting*, or *processing* characters, that does NOT mean that I want to *display* them. In fact, the whole point of Unicode is that I should be able to store, transmit, and process a vast range of characters *without* having to be concerned with a painfully large range of encodings. I think that we should find a way to identify lists of integers as strings, i.e. as lists of Unicode code points, and to "attach" a "preferred encoding" to such lists. Why? We've just seen that strings can be stored compactly in a revised external term representation WITHOUT knowing anything about ANY encodings other than Unicode and SCSU. Of course, the problem is that to be usable and efficient, a lot of 8-bit encodings have to be known and implemented in the emulator (and erl_interface), which may increase the code size significantly. But there are literally HUNDREDS of encodings. http://www.iana.org/assignments/character-sets lists 250 of them, and there are a lot more that aren't listed (yet). Some of them can be handled using simple table lookup, but quite a few cannot. But those encoding/decoding primitives could also be made usable directly by programs, which would be very useful in general. Well, it _would_ be useful, _if_ everyone agreed about what the wretched things were _called_. For example, a de facto standard part of Unix these days is 'iconv'. Unfortunately, the character set names are *not* standard. And I have had a program throw thousands of error messages at me because the character set name it used internally was not one known to the version of iconv on my system, although the actual character set _was_ known. This is one of the reasons why asking the 'NLS configuration' about encodings won't work very well. There is some text, somehow you discover that my environment is set up for ISO8859-10, and you encode 'ISO8859-1' as the encoding name, BUT the data get sent to a system that calls the same character set 'l6' or 'iso-latin-6' and has never heard of 'ISO8859-1'. Using Unicode internally _everywhere_ and using SCSU as the 'packing' mechanism _everywhere_ means NO INCOMPATIBILITIES BETWEEN ERLANGS. (As it happens, SCSU _is_ one of the IANA character sets.) I was not thinking about adding a new type, but rather new conventions. After all, the concept of "string" is only a matter of conventions in Erlang! Ah. For instance, I propose to represent a string as a 'string' record: {string, 'utf-8', [$a, $B]} Yi-yi-yi-yi-yi-yi-yi-YI! I guess the big difference between us is that you think "preferred encoding" is a good idea, and I think it makes absolutely no sense whatever. What looks to you like a help (and I honestly still do not understand why) looks to _me_ like a crushing burden. If there were a *single* common standard for encoding names, it might make sense, except that the point of Unicode is to save programmers (and programs) from having to know about such things. Did I mention that the character set which has to be called 'ISO8859-1' in a locale name on my system is known to 'iconv' as '8859' (on one system, that is; on another it's 'ISO8859-1' after all). And of course you know that the preferred MIME name for this is 'ISO-8859-1' and the official IANA name for it is 'ISO_8859-1:1987'... Then there is the Macintosh Roman character set, known as 'MacRoman' on one system and 'mac' on another. (The IANA registry calls it 'macintosh' as if Macs only ever had one character set; I have tables for 25.) If your program contains {string, "mac", [Florin,Micro]} and my system calls it 'MacRoman' or doesn't have Macintosh Romain in its iconv tables under _any_ name, what happens? (And I have such a lot of old Mac files...) Amongst other things, it makes no sense to me to regard the preferred encoding of a Unicode string as a property of the *string* rather than of a *use* of a string. I want the string "aB" to be the *same* value every time. By the way, we DO agree that it will be important for people to be able to take data in an external coding known to their system, decode it to Unicode, process it, and then encode the result back into some external coding known to their system. Dealing with Unicode is hard. Dealing with the multiplicity of character encodings with multiple names for each is hard. Separation of concerns is one of our main tools for coping with complexity. From ok@REDACTED Thu Jun 29 07:43:11 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 29 Jun 2006 17:43:11 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> I wrote: > + CJK text requires 2n+1 bytes (one byte says "switch to 16-bit"), > so SCSU is a good representation for CJK. I meant, of course, "CJK text using BMP characters". dda wrote at length about the fact that are are more CJK characters than the ones in the BMP. That isn't actually relevant, because neither the variable-byte encoding that I outlined nor SCSU has any 16-bit limit. Both of them can handle the *full* 20-and-fraction bits of Unicode. I _did_ think that people would actually _look_ at SCSU before attacking it. How naive of me. By the way, here is just one example of why encoding-tagged strings can be a pain. Suppose S1 is Greek text with preferred encoding MacGreek and S2 is Hebrew text with preferred encoding MacHebrew. What is the preferred encoding of S1 ++ S2 and why? From bsder@REDACTED Thu Jun 29 08:27:24 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 28 Jun 2006 23:27:24 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606290429.k5T4Tmkh334750@atlas.otago.ac.nz> References: <200606290429.k5T4Tmkh334750@atlas.otago.ac.nz> Message-ID: <44A372CC.4060109@allcaps.org> Richard A. O'Keefe wrote: > So we have two possible approaches here: We have more than that, but how about choice 0: 0) We leave strings alone and simply declare them by fiat to be lists of integers and encoded as UTF-8. This has the advantage that strings survive very nicely inside BEAM files without making any code changes to the Erlang system. It also means that the current term-to-binary stuff works just fine if a bit verbose. UTF-8 is documented everywhere on the planet and survives old systems because it makes sure not to use ASCII NUL (0) except as NUL. It is also very identifiable as it looks like ASCII or it looks like nothing else. Therefore, dropped bytes and characters are usually fairly identifiable, but the decoding can continue so that all the information isn't lost. This requires *0* lines of code and no understanding by those who stay within the ASCII character set. There should, however, be a module which encodes and decodes from the internal format to the various multiplicity of encodings. Probably the end result should be a binary object. That way, if you want to put a string on the wire in a particular encoding, you can. If you don't want to, you don't have to. And there will always be someone who doesn't want to. -a From ok@REDACTED Thu Jun 29 08:41:22 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 29 Jun 2006 18:41:22 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606290641.k5T6fMeJ333849@atlas.otago.ac.nz> Richard A. O'Keefe wrote: > So we have two possible approaches here: Andrew Lentvorski replied: We have more than that, but how about choice 0: 0) We leave strings alone and simply declare them by fiat to be lists of integers and encoded as UTF-8. But that is an incompatible change. This has the advantage that strings survive very nicely inside BEAM files without making any code changes to the Erlang system. Suppose you have string data held in dets/mnesia in R11. Then along comes R12 and says that strings use UTF-8. BOOM! A whole lot of data breaks badly. _NOT_ a good idea. Also, a whole lot of code that assumes one-list-element-equals-one-codepoint breaks badly too. _NOT_ a good idea. Keeping one-list-element-equals-one-codepoint means that existing string data encoded as Latin 1 RETAINS ITS VALUE when interpreted as Unicode, and existing code that assumes one-list-element-equals-one- codepoint KEEPS ON WORKING. It also means that the current term-to-binary stuff works just fine if a bit verbose. As has already been noted, the current term-to-binary stuff doesn't work as well as it could right now. [UTF-8] is also very identifiable as it looks like ASCII or it looks like nothing else. Not true. I can find you a string as long as you want that could be interpreted as UTF-8 or as Latin 1. True, there are all sorts of good things about UTF-8. It's really cool that modern systems come with UTF-8 locales set by default so I can type practically _anything_ in TextEdit. BUT it's a *Transmission* format, that's what the "T" and "F" stand for. It was never designed to be used for serious *processing* UTF-8 is a great representation for C, but for a language where characters never were stored as bytes in the first place it is pretty pointless. Apparently people are already saying bad things about Erlang string handling; what do you think they'll say when they hear that a single character might require 8 words (32 bytes)? From bsder@REDACTED Thu Jun 29 08:42:05 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Wed, 28 Jun 2006 23:42:05 -0700 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> References: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> Message-ID: <44A3763D.6050201@allcaps.org> Richard A. O'Keefe wrote: > I _did_ think that people would actually _look_ at SCSU before attacking > it. How naive of me. I did. I just don't see much advantage to the added annoyance. http://www.unicode.org/reports/tr6 "Switch to Unicode mode for uncompressible text. SCSU does not provide for window definitions for the main Han and Hangul character ranges, which are too large for effective use of dynamic windows. The Unicode mode should also be used for large scripts using supplementary code points." So, the only language this benefits is basically Japanese. And, even then, the true benfit is suspect. If you look at the Japanese example, the difference is 178 bytes vs. 232 bytes. That's not a great compression ratio given the highly regular code points and the sample text is highly biased toward Kana(compressible) rather than Kanji(uncompressible). This is the standard problem with trying to "compress" text. Compressing text at the character level almost always loses. Even a crummy LZW would pack 30hex into a single bit. -a From ok@REDACTED Thu Jun 29 08:49:39 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 29 Jun 2006 18:49:39 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606290649.k5T6nd9s335977@atlas.otago.ac.nz> I suggested that people should look at SCSU before attacking it. Andrew Lentvorski wrote: So, the only language this benefits is basically Japanese. It would be more accurate to say that the only language it DOESN'T benefit is Japanese (and the Chinese languages). Remember, the main point of it is to get the *alphabetic* scripts (like the Indic scripts used in India and much of Asia) down to one byte per character. And that's a 50% compression, well worth having. Remember, I was not talking about *processing* characters in SCSU. Processing characters in anything other than one-program-thingy-equals- one-codepoint is pretty silly. I was talking about SCSU *FOR USE IN THE EXTERNAL TERM REPRESENTATION*, where the "annoyance" is confined exclusively to external term representation encoders and decoders. (Having written an SCSU encoder and decoder, I have to say that the annoyance is minimal; it's not _that_ much harder than encoding or decoding UTF-8, especially if you have to cope with not-really-UTF-8 generated by Java.) From chsu79@REDACTED Thu Jun 29 09:38:04 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 29 Jun 2006 09:38:04 +0200 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> <200606281945.07709.rlenglet@users.forge.objectweb.org> <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> Message-ID: On 6/28/06, ke han wrote: > In the example I gave, my countryManager process is a singleton (pardon the > oo pattern reference, but thats what it is) that serves the entire VM to > answer a list of countries. This is a lengthy list of short utf-8 encoded > binaries. So wouldn't the list get copied? And won't each short binary in > the list get copied as well? There must be a better way. When benchmarking, how fast could you serve requests to your countryManager? (Btw, registered process would be more erlangy than 'singleton') What job does it do? > In order to get around this problem, I would have to destroy MVC separations > and have my model object (countryManager) return an already serialized > binary of binaries (or if I'm going to do that I may as well have the > countryManager go ahead and serialize it to json form as well). > This violates lots of sounds application design. Basic principles of > encapsulation and separation of presentation and app logic are well grounded > in OO design. These principals apply to non-OO languages as well. I > understand that not having object references and copying terms between calls > to erlang processes is a key element of erlang. But for non-mutable > strings??? Not having a solution for this makes mainstream web apps very > inefficient. Since we have first class functions in erlang you can pass your countryManager process a function that process the data it has, and send you back only the result of that call. No violation of sound application design. This is a trick languages without first class functions have a hard time to take advantage of, luckily Erlang is not that crappy. You keep mentioning non-mutable strings as we had mutable strings. We have ways to modify bindings (process dictionary or ets) but not to manipulate the string value itself (hipe extensions ignored). The later is a good thing nobody want to give up. Where are your benchmark that show how mainstream web apps in erlang are very inefficient? Maybe you are just doing the wrong thing? From serge@REDACTED Thu Jun 29 16:44:43 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 29 Jun 2006 10:44:43 -0400 Subject: behavior of io:format() in spawn'ed process In-Reply-To: <44A307A1.2020605@hyber.org> References: <001a01c699d5$7d9e06b0$1500a8c0@dobrosoft.local> <95be1d3b0606270610q596930d6nc8b6ee483c20d014@mail.gmail.com> <44A307A1.2020605@hyber.org> Message-ID: <44A3E75B.1040303@hq.idt.net> As a continuation of this question - is it possible to redirect that I/O to a remote C node? Example: host1: $ erl -sname t host2: $ erl_call -sname t@REDACTED -a 'io format [user, "abc\n", []]' ok The result of this call is displayed in the shell on t@REDACTED Is there a way using EI to get that output captured by the C program on host2? Serge Claes Wikstrom wrote: > HP Wei wrote: >> I am writing a monitoring module whose partial code is appended >> at the end of this email. >> I would like to ask for help in understanding the behavior of >> io:format() in a spawn'ed process. > > terminal I/O goes back and is produced at the node which originally spawned > the process. If you want I/O to appear at the node where the > process is running - use io:format(user, Format, Args). > > ^ > | > atom there > > > /klacke > From ke.han@REDACTED Thu Jun 29 19:01:25 2006 From: ke.han@REDACTED (ke han) Date: Fri, 30 Jun 2006 01:01:25 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> <200606281945.07709.rlenglet@users.forge.objectweb.org> <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> Message-ID: Christian, Thanks for the reply... On Jun 29, 2006, at 3:38 PM, Christian S wrote: > On 6/28/06, ke han wrote: >> In the example I gave, my countryManager process is a singleton >> (pardon the >> oo pattern reference, but thats what it is) that serves the entire >> VM to >> answer a list of countries. This is a lengthy list of short utf-8 >> encoded >> binaries. So wouldn't the list get copied? And won't each short >> binary in >> the list get copied as well? There must be a better way. > > When benchmarking, how fast could you serve requests to your > countryManager? (Btw, registered process would be more erlangy than > 'singleton') thanks..calling it a registered process is best...although if I can really get my apps designed right, I wouldn't register processes by name. I would inject the process into the controllers that need to know about them and not name them at all. > > What job does it do? I was trying to write a simple example so not to let the app design get in the way of my point. In tthe apps I'm building there are _many_ lists of strings. Some of these are as simple as names of countries, states, technology interests, etc... Some lists are keyed by other lists...e.g. states grouped by country choice. Since my app is AJAX oriented, sometimes these lists get encoded into the original page that gets sent to the browser and sometimes they get sent later as json data to update dependent lists. These lists come from mnesia tables and are managed by appropriate processes which encapsulate access to the lists. Mnesia table size is another concern..but I think I can deal with this easier than my main memory concerns. In addition to these basic look-up-table types lists, lots of other lists of strings or complex terms (which mostly contain strings) occur in my app (mostly to create html tables). The bottom line is that to get at any list, a message is sent from the yaws page to a controller (a separate process) which then sends a message to a model (sometimes another process sometimes a record. Each of these sends is synchronized to wait for a return of a copy of these lists. So not only is this data stored as lists of integers (which gets really bad for 64-bit) but they are being copied with each message send. > >> In order to get around this problem, I would have to destroy MVC >> separations >> and have my model object (countryManager) return an already >> serialized >> binary of binaries (or if I'm going to do that I may as well have the >> countryManager go ahead and serialize it to json form as well). >> This violates lots of sounds application design. Basic principles of >> encapsulation and separation of presentation and app logic are >> well grounded >> in OO design. These principals apply to non-OO languages as well. I >> understand that not having object references and copying terms >> between calls >> to erlang processes is a key element of erlang. But for non-mutable >> strings??? Not having a solution for this makes mainstream web >> apps very >> inefficient. > > Since we have first class functions in erlang you can pass your > countryManager process a function that process the data it has, and > send you back only the result of that call. No violation of sound > application design. This is a trick languages without first class > functions have a hard time to take advantage of, luckily Erlang is not > that crappy. yes, I am looking into solutions like this. I will post to the yaws maillist asking about how to accomplish some of the ideas I have rolling around. > > You keep mentioning non-mutable strings as we had mutable strings. We > have ways to modify bindings (process dictionary or ets) but not to > manipulate the string value itself (hipe extensions ignored). The > later is a good thing nobody want to give up. I was stressing the strings were non-mutable (and should have added don't require character level access) because it seemed the discussion going on in this thread was talking about many other unicode issues and I wanted to stress the difference. > > Where are your benchmark that show how mainstream web apps in erlang > are very inefficient? Maybe you are just doing the wrong thing? The apps I develop are mostly data in / data out with some nice presentation and validation on what goes in. This means that the majority of memory is taken up by strings as most of my data is text of some form or another. I don't need benchmarks to know that 4 bytes per character is _too_ much. In most cases its 4x too much and going to 64-bits is off limits with this type of memory allocation. Add to that the intermittent copying of these lists of integers (one page request could trigger 20 copies of lengthy lists of lists of integers in memory...just to stream out a page containing drop down lists that don't change very often)... and you will get spikes of memory allocation as the number of page requests grows. It turns out that processor performance, io, concurrency issues won't be my first bottleneck...it will be memory taken up by strings!!! I am actually less concerned about the copy time...but the mem required by the strings (in the model objects and in mnesia) and the mem required for a web server to constantly be copying these lists to output pages. sorry..I know this already turned into a rant...I do like erlang very much...which is why I'm crying out for help on this issue. I already have one erlang+yaws+mnesia app in production. Its an internal corporate app and the uptake on usage is slow..,but I can already tell the memory its taking for all the data is too much...I should be able to get at least twice as much data in RAM as I have. The next app I'm writing over this summer should get released this September. This will be a world-wide highly public app and will hopefully get lots of page requests. The last time I launched a large system on the web was a few years ago...it was a Java based web app. It actually scaled pretty well but I can vividly recall that what kept me from sleeping at night was worying about my servers...will some mem leak crash things...will some concurrency deadlock crash the system..etc... I chose erlang for this new app because I want to sleep at night when I launch this next product. I have to launch this new app on one or two low end servers and pray for success...My biggest fear is memory support for all my character strings. performance is secondary. thanks for allowing the rant... ke han From ke.han@REDACTED Thu Jun 29 19:17:41 2006 From: ke.han@REDACTED (ke han) Date: Fri, 30 Jun 2006 01:17:41 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <200606290641.k5T6fMeJ333849@atlas.otago.ac.nz> References: <200606290641.k5T6fMeJ333849@atlas.otago.ac.nz> Message-ID: <66ADFDBE-624D-4066-8220-7C87AE25E2E6@redstarling.com> Richard, On Jun 29, 2006, at 2:41 PM, Richard A. O'Keefe wrote: > > True, there are all sorts of good things about UTF-8. It's really > cool > that modern systems come with UTF-8 locales set by default so I can > type > practically _anything_ in TextEdit. BUT it's a *Transmission* format, > that's what the "T" and "F" stand for. It was never designed to be > used for serious *processing* > > UTF-8 is a great representation for C, but for a language where > characters > never were stored as bytes in the first place it is pretty pointless. > > Apparently people are already saying bad things about Erlang string > handling; what do you think they'll say when they hear that a single > character might require 8 words (32 bytes)? > I'm confused about one point of your posts. It seems from the above you appreciate that its grossly inefficient to use 4 or 8 bytes (64-bit erlang) per character as a method of representing strings in erlang. However, from other messages you post in this thread, your proposals seem to still be to use lists of integers (one cell per character). Are you talking about two different things? One memory efficient form for when the string doesn't need to be accessed at a character level and the list of integers form for when they do? thanks, ke han From david.nospam.hopwood@REDACTED Thu Jun 29 21:19:11 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 29 Jun 2006 20:19:11 +0100 Subject: Strings In-Reply-To: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> References: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> Message-ID: <44A427AF.6040806@blueyonder.co.uk> Richard A. O'Keefe wrote: > I wrote: > > + CJK text requires 2n+1 bytes (one byte says "switch to 16-bit"), > > so SCSU is a good representation for CJK. > > I meant, of course, "CJK text using BMP characters". > > dda wrote at length about the fact that are are > more CJK characters than the ones in the BMP. That isn't actually > relevant, because neither the variable-byte encoding that I outlined > nor SCSU has any 16-bit limit. Both of them can handle the *full* > 20-and-fraction bits of Unicode. > > I _did_ think that people would actually _look_ at SCSU before attacking > it. How naive of me. > > By the way, here is just one example of why encoding-tagged strings > can be a pain. Suppose S1 is Greek text with preferred encoding > MacGreek and S2 is Hebrew text with preferred encoding MacHebrew. > What is the preferred encoding of S1 ++ S2 and why? Note that an implementation of strings using SCSU would need to guarantee that the final state of a string encoding is the same as the initial state ('single byte mode', *all* windows set back to the defaults). Otherwise, ++ cannot be implemented by direct concatenation; only by reencoding (which takes O(length(S1) + length(S2)) time, since we need to both reconstruct the state at the end of S1, and reencode S2). Because of this, an encoding scheme without dynamic windows, or with a 'reset' code, might be preferable to SCSU. BOCU-1 shows that it is possible to get essentially the same compression ratios without any need for dynamic windows (see the table in section 6). BOCU-1 is also deterministic and codepoint-ordered, although only if resets are not used. (Note that BOCU-1 is patented, however. Despite that "IBM would like to offer a royalty free license to this patent upon request to implementers of a fully compliant version of BOCU-1", this might not be sufficient to satisfy some open-source licensing policies.) Given that strings are immutable, use of a stateful, compressed encoding is more practical in Erlang than it would be in a language in which strings are mutable. OTOH, UTF-8 would be simpler, and I think that the concerns about encoding efficiency of UTF-8 for CJK languages have been somewhat overstated in this thread. For example, here are the sizes of some translations of the "What is Unicode?" page at in UTF-8 (just the translated text, with the HTML header and trailer removed): Simplified Chinese: 3463 bytes English: 4422 bytes Korean: 5023 bytes Japanese: 5345 bytes Chinese and Korean have a higher information density than English (and other alphabetic scripts) to start with; in the case of Chinese, this more than compensates for any inefficiency of UTF-8 when encoding translated texts. This example is not atypical. IOW, it is more accurate to say that UTF-16 and other 16-bit encodings are particularly efficient for these languages, rather than UTF-8 being inefficient. -- David Hopwood From yarivvv@REDACTED Thu Jun 29 21:46:06 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 29 Jun 2006 15:46:06 -0400 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> <200606281945.07709.rlenglet@users.forge.objectweb.org> <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> Message-ID: <17244f480606291246u4faeecc8u38a5ae2281fed717@mail.gmail.com> > > The apps I develop are mostly data in / data out with some nice > presentation and validation on what goes in. This means that the > majority of memory is taken up by strings as most of my data is text > of some form or another. I don't need benchmarks to know that 4 > bytes per character is _too_ much. In most cases its 4x too much and > going to 64-bits is off limits with this type of memory allocation. > Add to that the intermittent copying of these lists of integers (one > page request could trigger 20 copies of lengthy lists of lists of > integers in memory...just to stream out a page containing drop down > lists that don't change very often)... and you will get spikes of > memory allocation as the number of page requests grows. It turns out > that processor performance, io, concurrency issues won't be my first > bottleneck...it will be memory taken up by strings!!! > Ke Han, >From your description, It sounds like the rule of thumb web developers should follow is to avoid strings whenever possible and use binaries instead, especially on 64 bit machines. Would you say that's a fair interpretation? I'm just looking for a short term solution here because I don't expect Erlang string handling to change much in the near future. Thanks, Yariv From rsaccon@REDACTED Fri Jun 30 03:58:58 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 29 Jun 2006 22:58:58 -0300 Subject: mnesia primary key creation Message-ID: I am wondering whether experienced erlang developers have something better in their best-practises-treasure-box than what I have come up with to create mnesia primary keys: 1. use "ordered_set" tables 2. use "mnesia:dirty_last(myTable)" to get the last inserted key and increment it for a new key before inserting a new record. regards -- Roberto Saccon From rlenglet@REDACTED Fri Jun 30 05:06:33 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 30 Jun 2006 12:06:33 +0900 Subject: Strings In-Reply-To: <44A427AF.6040806@blueyonder.co.uk> References: <200606290543.k5T5hBIa335154@atlas.otago.ac.nz> <44A427AF.6040806@blueyonder.co.uk> Message-ID: <200606301206.33320.rlenglet@users.forge.objectweb.org> David Hopwood wrote: > Note that an implementation of strings using SCSU would need > to guarantee that the final state of a string encoding is the > same as the initial state ('single byte mode', *all* windows > set back to the defaults). Otherwise, ++ cannot be implemented > by direct concatenation; only by reencoding (which takes > O(length(S1) + length(S2)) time, since we need to both > reconstruct the state at the end of S1, and reencode S2). That would not be a problem if (1) we keep the string representation of strings as lists of code points, and if (2) we encode/decode strings only in the external representation (in term_to_binary/1 and binary_to_term/1). Strings are externally encoded as a whole, and are well delimited. Concatenation of encoded strings would never happen. > Because of this, an encoding scheme without dynamic windows, > or with a 'reset' code, might be preferable to SCSU. > BOCU-1 shows > that it is possible to get essentially the same compression > ratios without any need for dynamic windows (see the table in > section 6). BOCU-1 is also deterministic and > codepoint-ordered, although only if resets are not used. > > (Note that BOCU-1 is patented, however. Despite that "IBM > would like to offer a royalty free license to this patent upon > request to implementers of a fully compliant version of > BOCU-1", this might not be sufficient to satisfy some > open-source licensing policies.) IBM's ICU library implements SCSU and BOCU-1 (and several others, cf. the UConverterType). http://icu.sourceforge.net/apiref/icu4c/ucnv_8h.html ICU is licensed under the modified BSD license. Couldn't that library be used directly? -- Romain LENGLET From Bruce@REDACTED Fri Jun 30 05:55:29 2006 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 30 Jun 2006 15:55:29 +1200 Subject: mnesia primary key creation In-Reply-To: References: Message-ID: <44A4A0B1.2040703@Fitzsimons.org> Roberto Saccon wrote: > I am wondering whether experienced erlang developers have something > better in their best-practises-treasure-box than what I have come up > with to create mnesia primary keys: I use a seperate app or sys table (used for storing random system config items) and use: mnesia:dirty_update_counter(Tab, Key, Incr) -> NewVal | exit({aborted, Reason}) (which is atomic, despite the dirty name) with one key per table that requires keys. Works well. Cheers, Bruce From ke.han@REDACTED Fri Jun 30 06:39:45 2006 From: ke.han@REDACTED (ke han) Date: Fri, 30 Jun 2006 12:39:45 +0800 Subject: Strings (was: Re: are Mnesia tables immutable?) In-Reply-To: <17244f480606291246u4faeecc8u38a5ae2281fed717@mail.gmail.com> References: <200606280540.k5S5ewdd322595@atlas.otago.ac.nz> <200606281547.57745.rlenglet@users.forge.objectweb.org> <06D2B775-4130-4FA2-ACF9-DB99DC3AE27B@redstarling.com> <200606281945.07709.rlenglet@users.forge.objectweb.org> <8D410447-3CBF-4D7A-8D0E-6790219ACAF7@redstarling.com> <17244f480606291246u4faeecc8u38a5ae2281fed717@mail.gmail.com> Message-ID: On Jun 30, 2006, at 3:46 AM, Yariv Sadan wrote: >> >> The apps I develop are mostly data in / data out with some nice >> presentation and validation on what goes in. This means that the >> majority of memory is taken up by strings as most of my data is text >> of some form or another. I don't need benchmarks to know that 4 >> bytes per character is _too_ much. In most cases its 4x too much and >> going to 64-bits is off limits with this type of memory allocation. >> Add to that the intermittent copying of these lists of integers (one >> page request could trigger 20 copies of lengthy lists of lists of >> integers in memory...just to stream out a page containing drop down >> lists that don't change very often)... and you will get spikes of >> memory allocation as the number of page requests grows. It turns out >> that processor performance, io, concurrency issues won't be my first >> bottleneck...it will be memory taken up by strings!!! >> > > Ke Han, > From your description, It sounds like the rule of thumb web developers > should follow is to avoid strings whenever possible and use binaries > instead, especially on 64 bit machines. Would you say that's a fair > interpretation? I'm just looking for a short term solution here > because I don't expect Erlang string handling to change much in the > near future. yes, for the new app I'm working on, I will encode all string data as utf-8 binaries. This makes debugging a little tough as I can't read my strings in the console, debugger, etc...but its workable. I don't expect a quick solution to the items being discussed. I just continue to be a pest on this thread to ensure people don't lose focus on the practical ways that we need to use strings in our apps. ke han > > Thanks, > Yariv From ok@REDACTED Fri Jun 30 07:15:12 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 30 Jun 2006 17:15:12 +1200 (NZST) Subject: Strings (was: Re: are Mnesia tables immutable?) Message-ID: <200606300515.k5U5FCKS346738@atlas.otago.ac.nz> ke han wrote: It seems from the above you appreciate that it's grossly inefficient to use 4 or 8 bytes (64-bit erlang) per character as a method of representing strings in erlang. Not quite. I accept that it is *space* inefficient (using 8 bytes for a 3-byte character is a little excessive), but I do not accept that it is *grossly* inefficient. On the contrary, I argued and gave empirical evidence that Erlang strings are (relative to other things in Erlang) quite *time* efficient. The big thing about space is that *sometimes* we care and *sometimes* we don't. I have 1.6GB of memory on my desktop machine. This is useful to me because I am doing Information Retrieval experiments with hundreds of MB of text. But for looking at a _single_ document... Most of the individual documents I'm looking at are under 8kB, and if I'm processing them one at a time, I can't imagine caring about it taking 64kB instead of 8kB. However, from other messages you post in this thread, your proposals seem to still be to use lists of integers (one cell per character). Yes. It's simple. It's time-efficient. It works. Are you talking about two different things? One memory efficient form for when the string doesn't need to be accessed at a character level and the list of integers form for when they do? Exactly. More precisely, I am arguing that "strings" get used in different ways and we should not expect a single representation to be good at all of them. For some applications it's transmission time over the network, or space on a CD-ROM, that matters. For some applications it's searching in large amounts of text. For some applications it's the ability to do lots of edit operations. For some applications it's the ability to compactly store multiple versions. Different applications come with _different_ tradeoffs, and an Erlang programmer should never be afraid to invent a task-specific "string" data structure. From matt@REDACTED Fri Jun 30 10:13:33 2006 From: matt@REDACTED (Matthew McDonnell) Date: Fri, 30 Jun 2006 09:13:33 +0100 (BST) Subject: mnesia primary key creation In-Reply-To: References: Message-ID: On Thu, 29 Jun 2006, Roberto Saccon wrote: > I am wondering whether experienced erlang developers have something > better in their best-practises-treasure-box than what I have come up > with to create mnesia primary keys: (not an experienced erlang developer) I use a separate process to act as a server to access the database, with the state of the server containing the last primary key used. Something like the following: loop(Key) -> receive {From, {add, Record}} -> loop(Key+1); ... More robust solution is to do this in an OTP application with a gen_server that can get restarted if it crashes, recalculates last Key when intialised, is registered with a name eg mnesia_server, etc Cheers, Matt Matt McDonnell Email: matt@REDACTED Web: http://www.matt-mcdonnell.com/ From pghollis@REDACTED Fri Jun 30 03:56:49 2006 From: pghollis@REDACTED (paul) Date: Fri, 30 Jun 2006 11:56:49 +1000 Subject: String to tuple Message-ID: <44A484E1.7040804@bigpond.net.au> Hi, I'm trying to convert a string in to a tuple, or a list of tuples. Eg. From: A="{aa, bb}". to: B={aa, bb}. Any ideas? Regards Paul. From chsu79@REDACTED Fri Jun 30 11:45:07 2006 From: chsu79@REDACTED (Christian S) Date: Fri, 30 Jun 2006 11:45:07 +0200 Subject: String to tuple In-Reply-To: <44A484E1.7040804@bigpond.net.au> References: <44A484E1.7040804@bigpond.net.au> Message-ID: 26> A="{aa, bb}.". "{aa, bb}." 27> B={aa, bb}. {aa,bb} 28> {ok, Tokens, _} = erl_scan:string(A). {ok,[{'{',1},{atom,1,aa},{',',1},{atom,1,bb},{'}',1},{dot,1}],1} 29> {ok, B} = erl_parse:parse_term(Tokens). {ok,{aa,bb}} Notice how I terminated your string with a dot to make the expression grammatically sound for the parser. If you have the data in a file then file:consult/1 is very handy. On 6/30/06, paul wrote: > Hi, > > I'm trying to convert a string in to a tuple, or a list of tuples. Eg. > From: > A="{aa, bb}". > to: > B={aa, bb}. > > Any ideas? > > Regards Paul. > From ulf.wiger@REDACTED Fri Jun 30 11:47:44 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 30 Jun 2006 11:47:44 +0200 Subject: mnesia primary key creation Message-ID: I sketched the attached code for maintaining a node-specific sequence number in a cluster of nodes. The code is untested - probably doesn't even compile, and upon reflection, I'd do away with all the dirty ops. Basically, you should never use dirty ops on replicated tables. The thing I was after was a system-unique object identifier which was compact enough to be human- and URL-friendly. For cheap(in terms of CPU cost) automatic primary keys, I tend to use oid() -> {node(), erlang:now()}. Given a reasonably well-behaved system clock(*), this is certain to give unique values - increasing values, even - each time. (*) AFAIK, even though it's not documented, erlang:now() is derived from sys_gethrtime(), except on Win32, where it's derived from GetTickCount() - I gave up before understanding from the source how erlang:now() relates to "zero hour" on Windows. A cursory inspection of the code made me doubt that my statement holds true for Windows. Correct me, please, anyone. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Roberto Saccon > Sent: den 30 juni 2006 03:59 > To: erlang-questions@REDACTED > Subject: mnesia primary key creation > > I am wondering whether experienced erlang developers have > something better in their best-practises-treasure-box than > what I have come up with to create mnesia primary keys: > > 1. use "ordered_set" tables > > 2. use "mnesia:dirty_last(myTable)" to get the last inserted > key and increment it for a new key before inserting a new record. > > > regards > -- > Roberto Saccon > -------------- next part -------------- A non-text attachment was scrubbed... Name: bbsOid.erl Type: application/octet-stream Size: 2231 bytes Desc: bbsOid.erl URL: From cvarela@REDACTED Fri Jun 30 12:16:23 2006 From: cvarela@REDACTED (Carlos Varela Paz) Date: Fri, 30 Jun 2006 12:16:23 +0200 Subject: String to tuple In-Reply-To: <44A484E1.7040804@bigpond.net.au> References: <44A484E1.7040804@bigpond.net.au> Message-ID: <200606301216.24288.cvarela@lambdastream.com> El Viernes, 30 de Junio de 2006 03:56, paul escribi?: > Hi, > > I'm trying to convert a string in to a tuple, or a list of tuples. Eg. > From: > A="{aa, bb}". > to: > B={aa, bb}. > > Any ideas? That's what I do: {ok, ItemTokens, _} = erl_scan:string(String ++ "."), {ok, Term} = erl_parse:parse_term(ItemTokens), Regards, Carlos From cromain@REDACTED Fri Jun 30 15:39:57 2006 From: cromain@REDACTED (Christophe Romain) Date: Fri, 30 Jun 2006 15:39:57 +0200 Subject: lightweight Erlang with package management Message-ID: <5a2ffbc483bc6d68ed166f46c0229d6c@process-one.net> New version of erlrt is available ! http://erlrt.process-one.net/ erlrt aims to be for Erlang what CPAN is for Perl. It allows to install a minimal binary version of erlang base system by downloading a 1.4Mb self extractable archive. Binary packages are now provided for: MacOSX (powerpc), Linux (alpha, amd64, arm, hppa, ia64, mips, mipsel, powerpc, s390, sparc, x86), SunOS (sparc), Windows. A package management with simple dependency handling (level 1 dependences only) is to be tested in that second version of erlrt. we are ready to add several erlang applications into erlrt if packaged the otp way. new usage: list available packages > erlrt:available(). list installed packages > erlrt:installed(). check for an installed packages (returns true/false) > erlrt:installed(mnesia). install a package (mnesia as example) > erlrt:install(mnesia). uninstall a package (mnesia as example) > erlrt:uninstall(mnesia). upgrade a package (ejabberd as example) > erlrt:upgrade(ejabberd). upgrade the whole distribution > erlrt:upgrade(). session exemple: chris@REDACTED:~/Desktop> sh install_erlrt.sh please wait... Erlang (BEAM) emulator version 5.4.13 [source] [hipe] [threads:0] Erlang/OTP R10B-10 darwin-powerpc stripped runtime environment Eshell V5.4.13 (abort with ^G) 1> erlrt:install(tv). + gs md5=<<109,155,181,199,32,47,247,71,239,109,204,124,122,0,61,143>> + mnesia md5=<<206,204,38,247,43,206,40,49,126,67,81,24,238,13,109,24>> + pman md5=<<86,63,0,213,103,200,76,219,187,140,187,148,113,171,196,202>> + tv md5=<<140,111,173,82,54,59,41,75,152,229,22,229,210,127,62,128>> ok 2> Many thanks to Bengt Kleberg who hellped to make scripts not to be "bash specific", gives erlrt web proxy support, and added the sunos-sparc support in both erlrt and repos. From csanto@REDACTED Fri Jun 30 16:05:11 2006 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 30 Jun 2006 16:05:11 +0200 Subject: Erlang and AI reserach or practical experience In-Reply-To: References: Message-ID: <44A52F97.60607@diit.unict.it> Thanks Ulf for the advertising :-) And Andreas, if you want to get the software, please contact me directly. All the best, --Corrado Ulf Wiger (AL/EAB) ha scritto: > > At EUC 2005: > > eXAT: Software Agents in Erlang. by Corrado Santoro > > http://www.erlang.se/euc/05/1130Santoro.ppt > http://www.erlang.se/euc/05/Santoro.pdf > > At the ACM SIGPLAN Erlang workshop 2005: > ERESYE: Artificial Intelligence in Erlang Programs, by > Antonella Di Stefano, Francesca Gangemi, and Corrado Santoro > > http://www.erlang-consulting.com/erlangworkshop05/eresye.pdf > > That should get you started. > > BR, > Ulf W > > > ________________________________ > > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Andreas > Hillqvist > Sent: den 26 juni 2006 15:49 > To: erlang-questions@REDACTED > Subject: Erlang and AI reserach or practical experience > > > Hi. > > IS ther anyone who have herad of resarch or practical > application of Erlang for AI or AI oriented projects? > > Regards, > Andreas > > From Micic_V@REDACTED Fri Jun 30 16:31:29 2006 From: Micic_V@REDACTED (Valentin Micic [ MTN - Innovation Centre ]) Date: Fri, 30 Jun 2006 16:31:29 +0200 Subject: 64-bit pointer support in linked-in driver Message-ID: <23684C9CDF88C04FA8800AA825EADF51034089FC@MTNMAIL.mtn.co.za> Hi, I need to write a (C-based) linked-in driver that has to use 64-bit pointers (i.e. address RAM segments larger than 2 (or 4) GB). Not sure if it is possible to do this, so I'd appreciate educated opinions very much. Valentin. NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Fri Jun 30 17:03:32 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 30 Jun 2006 17:03:32 +0200 Subject: 64-bit pointer support in linked-in driver In-Reply-To: <23684C9CDF88C04FA8800AA825EADF51034089FC@MTNMAIL.mtn.co.za> References: <23684C9CDF88C04FA8800AA825EADF51034089FC@MTNMAIL.mtn.co.za> Message-ID: It should work provided you use the 64-bit emulator. /Bjorn "Valentin Micic [ MTN - Innovation Centre ]" writes: > Hi, > > > > I need to write a (C-based) linked-in driver that has to use 64-bit > pointers (i.e. address RAM segments larger than 2 (or 4) GB). > > Not sure if it is possible to do this, so I'd appreciate educated > opinions very much. > > > > Valentin. > > > > NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From marc.vanwoerkom@REDACTED Fri Jun 30 23:11:27 2006 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Fri, 30 Jun 2006 23:11:27 +0200 Subject: Article: A Taste of Erlang.. Message-ID: <44A5937F.9060405@fernuni-hagen.de> This came in via Google alert: http://www.informit.com/articles/article.asp?p=482670&rl=1 Regards, Marc PS For some reason they want to sell a Python book with that article From mickael.remond@REDACTED Fri Jun 30 23:29:54 2006 From: mickael.remond@REDACTED (=?ISO-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Fri, 30 Jun 2006 23:29:54 +0200 Subject: A Taste of Erlang, a Dynamic, Asynchronous Message-Passing Language Message-ID: <21D61D04-1218-4B8D-994D-36E27593C813@process-one.net> Hello, I thought you might be interested by this new article on Erlang: A Taste of Erlang, a Dynamic, Asynchronous Message-Passing Language http://www.informit.com/articles/article.asp?p=482670&seqNum=1&rl=1 This is again very good press :-) -- Micka?l R?mond http://www.process-one.net/