From jla415@REDACTED Sun Jul 1 03:21:10 2007 From: jla415@REDACTED (jla415) Date: Sat, 30 Jun 2007 18:21:10 -0700 (PDT) Subject: [erlang-questions] Emacs Erlang mode: how to compile properly? In-Reply-To: <46863266.6060801@mail.ru> References: <46863266.6060801@mail.ru> Message-ID: <11378448.post@talk.nabble.com> Denys Rtveliashvili wrote: > > - As for Erlang, I can create a makefile and re-run the program every > time I change and rebuild it, but it look like the development process > should be similar to the one in LISP. I see that it is possible to > connect to Erlang machine (at least by using Distel) and do something > in it. > However: > * I do not see any way to "rebuild" the whole project and refresh the > code in virtual machine from Emacs. Is this functionality available? > * The Ctrl-C Ctrl-K combination does re-compile the currently opened > document. However, it does so only if all the dependencies are on the > system path or in the current directory. Which is usually not true, as > Erlang projects tend to have .erl files in "src" directory and ".hrl" in > "include". So, when I try to compile an Erlang source code from within > Emacs it does not do so because it can't find .erl files (which are in > ../include). > > I hope, there is a description of the development process somewhere. > Could someone give me a link or write a few words about it? > > > Lately I've been developing in emacs with distel using the following keybinds: (add-hook 'erlang-mode-hook 'my-erl-binds) (defun my-erl-binds () (define-key erlang-mode-map [f5] (lambda () (interactive) (progn (save-buffer) (compile "make -k")))) (define-key erlang-mode-map [f6] 'erl-reload-modules))) f5 saves the current buffer, runs make to compile the sources, then f6 reloads all the modified modules in whatever erlang node distel is currently connected to. -- View this message in context: http://www.nabble.com/Emacs-Erlang-mode%3A-how-to-compile-properly--tf4005548.html#a11378448 Sent from the Erlang Questions mailing list archive at Nabble.com. From tobbe@REDACTED Sun Jul 1 18:29:11 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sun, 01 Jul 2007 18:29:11 +0200 Subject: [erlang-questions] code:load_file/1 Message-ID: In R11B-4 it seems like code:load_file/1 doesn't like to get a string as input. I guess I have myself to blame since the man-page says it wants an atom. However, I think it is a little too harsh to crash somewhere down deep in the hipe code: --------------------- Native loading of /home/tobbe/junk/../eblog/lib/site/ebin/eblog_SUITE.beam failed: {'EXIT', {function_clause, [{hipe_unified_loader, load_native_code, ["eblog_SUITE", <<70,79,.....the whole binary comes here... ---------------------- In R11B-2, the following works nicely: code:load_file("eblog_SUITE"). % crash in R11B-4 code:load_file(eblog_SUITE). Cheers, Tobbe From bfulg@REDACTED Sun Jul 1 20:41:09 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Sun, 1 Jul 2007 11:41:09 -0700 Subject: [erlang-questions] Patches for HIPE on OS X (Leopard WWDC Beta) Message-ID: <6862F895-A7B4-4463-B083-072FFDF1AED3@pacbell.net> I ran into problems trying to build Erlang using the Leopard Beta from WWDC. Attached are the patches I generated to get HIPE to compile with the new OS changes. Most of these patches are simply adjusting the thread and float primitives to the new structure (under Intel, 32-bit). Someone knowledgeable about HIPE should check them to see if they seem reasonable. It is very likely that they will break for PowerPC and 64- bit Intel. If any of the HIPE guys would like me to try variations on these patches, I'd be happy to look into it. At the very least, these changes let me run various shootout tests on my MacBook Pro. Thanks, -Brent -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-erts_configure.in Type: application/octet-stream Size: 1090 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-erts_emulator_hipe_hipe_x86_signal.c Type: application/octet-stream Size: 368 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-erts_emulator_sys_unix_sys_float.c Type: application/octet-stream Size: 1235 bytes Desc: not available URL: From pwa@REDACTED Mon Jul 2 04:22:36 2007 From: pwa@REDACTED (Peter Wang) Date: Mon, 2 Jul 2007 12:22:36 +1000 Subject: [erlang-questions] HiPE and large number of string cases Message-ID: <20070702022235.GB4597@missioncriticalit.com> Hi, I've been writing an Erlang backend for the Mercury compiler. I've come across a problem compiling a particular generated function with HiPE. The function simply matches a variable against a string and returns a corresponding atom, like this: f(X) -> case X of "option1" -> atom1; "option2" -> atom2; ... _ -> fail end. There are over 500 cases. Compiling it to bytecode takes a reasonable amount of time (~2 secs), but compiling it to native code is unbearably slow (over five minutes). Breaking it into smaller functions does help, but it's still not exactly fast (~1 minute). (These times are at optimisation level o1.) I've found a workaround, which is to convert the string to an atom at runtime and match on atom instead, but I'd rather not do that. What else can I do? Thanks. Peter From kostis@REDACTED Mon Jul 2 09:39:50 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 02 Jul 2007 09:39:50 +0200 Subject: [erlang-questions] HiPE and large number of string cases In-Reply-To: <20070702022235.GB4597@missioncriticalit.com> References: <20070702022235.GB4597@missioncriticalit.com> Message-ID: <4688ABC6.5040602@cs.ntua.gr> Peter Wang wrote: > Hi, > > I've been writing an Erlang backend for the Mercury compiler. I've come > across a problem compiling a particular generated function with HiPE. > The function simply matches a variable against a string and returns a > corresponding atom, like this: > > f(X) -> > case X of > "option1" -> atom1; > "option2" -> atom2; > ... > _ -> fail > end. > > There are over 500 cases. Compiling it to bytecode takes a reasonable > amount of time (~2 secs), but compiling it to native code is unbearably > slow (over five minutes). Breaking it into smaller functions does help, > but it's still not exactly fast (~1 minute). (These times are at > optimisation level o1.) I cannot reproduce your findings with the latest OTP release (R11B-5). I've created two such functions, one with 500+1 cases and one with 1000+1 cases, and the times I get indeed show that there is a non-linear component somewhere in the native code compiler, but it is nowhere as bad as you describe. 2> timer:tc(hipe, c, [{t,f500,1}]). {7211870,{ok,{t,f500,1}}} 3> timer:tc(hipe, c, [{t,f1000,1}]). {21001894,{ok,{t,f1000,1}}} For me, native code compilation on an x86 running Linux takes about 7.2 secs for 500 cases and 21 secs for 1000. With optimization level o1 these times are smaller. Which OTP version are you using? What platform is this? If you are not using R11B-5, can you try with that and tell us what's happening. Kostis From pwa@REDACTED Mon Jul 2 10:11:02 2007 From: pwa@REDACTED (Peter Wang) Date: Mon, 2 Jul 2007 18:11:02 +1000 Subject: [erlang-questions] HiPE and large number of string cases In-Reply-To: <4688ABC6.5040602@cs.ntua.gr> References: <20070702022235.GB4597@missioncriticalit.com> <4688ABC6.5040602@cs.ntua.gr> Message-ID: <20070702081100.GA30554@missioncriticalit.com> On 2007-07-02, Kostis Sagonas wrote: > > I cannot reproduce your findings with the latest OTP release (R11B-5). I've > created two such functions, one with 500+1 cases and one with 1000+1 cases, > and the times I get indeed show that there is a non-linear component > somewhere in the native code compiler, but it is nowhere as bad as you > describe. > > 2> timer:tc(hipe, c, [{t,f500,1}]). > {7211870,{ok,{t,f500,1}}} > 3> timer:tc(hipe, c, [{t,f1000,1}]). > {21001894,{ok,{t,f1000,1}}} > > For me, native code compilation on an x86 running Linux takes about 7.2 secs > for 500 cases and 21 secs for 1000. With optimization level o1 these times > are smaller. Hmm, I can confirm that with an artificial test case using strings like "a1", "a2, etc. Perhaps it has to do with the strings themselves? > > Which OTP version are you using? What platform is this? I am using R11R-3 on Linux/x86_64. > If you are not using R11B-5, can you try with that and tell us what's > happening. I will do that. If the problem persists, would you mind if I sent you the test case? Peter From kostis@REDACTED Mon Jul 2 10:16:27 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 02 Jul 2007 11:16:27 +0300 Subject: [erlang-questions] HiPE and large number of string cases In-Reply-To: <20070702081100.GA30554@missioncriticalit.com> References: <20070702022235.GB4597@missioncriticalit.com> <4688ABC6.5040602@cs.ntua.gr> <20070702081100.GA30554@missioncriticalit.com> Message-ID: <4688B45B.3060503@cs.ntua.gr> Peter Wang wrote: > On 2007-07-02, Kostis Sagonas wrote: >> I cannot reproduce your findings with the latest OTP release (R11B-5). I've >> created two such functions, one with 500+1 cases and one with 1000+1 cases, >> and the times I get indeed show that there is a non-linear component >> somewhere in the native code compiler, but it is nowhere as bad as you >> describe. >> >> 2> timer:tc(hipe, c, [{t,f500,1}]). >> {7211870,{ok,{t,f500,1}}} >> 3> timer:tc(hipe, c, [{t,f1000,1}]). >> {21001894,{ok,{t,f1000,1}}} >> >> For me, native code compilation on an x86 running Linux takes about 7.2 secs >> for 500 cases and 21 secs for 1000. With optimization level o1 these times >> are smaller. > > Hmm, I can confirm that with an artificial test case using strings like > "a1", "a2, etc. Perhaps it has to do with the strings themselves? > >> Which OTP version are you using? What platform is this? > > I am using R11R-3 on Linux/x86_64. > >> If you are not using R11B-5, can you try with that and tell us what's >> happening. > > I will do that. If the problem persists, would you mind if I sent you > the test case? Of course not. As a matter of fact, why don't you send it anyway? (off the list). Kostis From mikpe@REDACTED Mon Jul 2 11:04:37 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 2 Jul 2007 11:04:37 +0200 (MEST) Subject: [erlang-questions] Patches for HIPE on OS X (Leopard WWDC Beta) Message-ID: <200707020904.l6294b6J003608@harpo.it.uu.se> On Sun, 1 Jul 2007 11:41:09 -0700, Brent Fulgham wrote: > I ran into problems trying to build Erlang using the Leopard Beta from > WWDC. Attached are the patches I generated to get HIPE to compile > with the new OS changes. > > Most of these patches are simply adjusting the thread and float > primitives to the new structure (under Intel, 32-bit). Someone > knowledgeable about HIPE should check them to see if they seem > reasonable. It is very likely that they will break for PowerPC and 64- > bit Intel. > > If any of the HIPE guys would like me to try variations on these > patches, I'd be happy to look into it. > > At the very least, these changes let me run various shootout tests on > my MacBook Pro. These patches look quite reasonable. The only change I don't like is this one: > --- erts/configure.in.orig 2007-06-30 19:35:17.000000000 -0700 > +++ erts/configure.in 2007-06-30 19:39:13.000000000 -0700 > @@ -1697,6 +1697,13 @@ > __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr)); > } > > +#if defined(__DARWIN__) > +#include > +#include > +#include > +#endif > + > + > #if defined(__x86_64__) || defined(__DARWIN__) > static inline int cpu_has_sse2(void) { return 1; } > #else /* !__x86_64__ */ It includes OS-specific stuff in an OS-agnostic part of the code. I'd much prefer if you could move that to the #ifdef/#include block just before fpe_sig_action(), and make it #ifdef __DARWIN_UNIX03 like your other changes. The HiPE group doesn't have OSX/x86 development machines, so OSX/x86 support relies on contributions like this one. Most of the changes in this patch set are about enabling floating-point exceptions. This will benefit BEAM as well. /Mikael From bengt.kleberg@REDACTED Mon Jul 2 11:41:11 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 02 Jul 2007 11:41:11 +0200 Subject: [erlang-questions] input too fast In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> Message-ID: <4688C837.9040405@ericsson.com> On 2007-06-29 14:45, Fredrik Svahn wrote: ...deleted > fileio()-> > {ok,StdIn}=file:open("",[raw, binary, read]), > {ok,StdOut}=file:open("",[raw, binary, write]), minor detail: somebody might want to call a file (not impossible imho) and therefore it could be better to use an atom in this case. ie, string is file name, atom is one of stdin, stdout, stderr. bengt -- Those were the days... 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 kosik@REDACTED Mon Jul 2 12:33:42 2007 From: kosik@REDACTED (Matej Kosik) Date: Mon, 02 Jul 2007 12:33:42 +0200 Subject: [erlang-questions] Mnesia and automatic generation of primary keys Message-ID: <4688D486.2060407@fiit.stuba.sk> Hello, The best tutorial to using Mnesia I have found is this document: http://www.erlang.org/documentation/doc-5.2/pdf/mnesia-4.1.pdf According to that information I was able to set up a database, add tables, entries and make some querries. Ok. Now when I am thinking about tables I need and their attributes, I would like to generate unique primary keys for new entries to certain tables (where none of their attributes is a clear candidate for primary key). Is there a lucid way to generate such primary keys (that will guarantee uniqueness of those keys during the whole lifetime of that table) regardless of how many times the system will be shut down and restarted. Do you also have this problem? How do you solve it? Should I set up some kind of global table where I can use "last used primary key (integer)" and gradually increment it as I will acquire new keys? Or can this information be somehow associated with particular tables (stored in a schema as an attribute of that table)? Regards -- Matej Kosik -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From chlorophil@REDACTED Mon Jul 2 13:01:18 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Mon, 2 Jul 2007 21:01:18 +1000 Subject: [erlang-questions] Mnesia and automatic generation of primary keys In-Reply-To: <4688D486.2060407@fiit.stuba.sk> References: <4688D486.2060407@fiit.stuba.sk> Message-ID: On 7/2/07, Matej Kosik wrote: > Now when I am thinking about tables I need and their attributes, I would like to generate unique primary keys for new entries to certain tables (where none of their attributes is a clear candidate for primary key). Matej, Have you tried mnesia:dirty_update_counter/2 & /3? Cheers, Philip From oscar@REDACTED Mon Jul 2 13:03:30 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Mon, 02 Jul 2007 12:03:30 +0100 Subject: [erlang-questions] stress test with tcp_server In-Reply-To: <4680DA0B.3080000@web.am> References: <6cef17180706240600v20c830ffhacb1ab6fcd108920@mail.gmail.com> <467E81CD.1080300@web.am> <6cef17180706242031t684415c0h33b2189111786d24@mail.gmail.com> <4680DA0B.3080000@web.am> Message-ID: <4688DB82.9040306@erlang-consulting.com> Hi Gaspar Chilingarov wrote: > Jeremy Chow wrote: >> I've tried use command ulimit to increase the file descriptors number to >> 10240. >> but the connections number was no more than 1024, sometimes is 1017, >> sometimes is 1018. > > it depends how much files descriptors already allocated by this user at > the moment -- because file descriptor limit is set for users and not for > 1 process. > > Anyway, after some experiments with FreeBSD I was able to push max > connection count to 4999 open connections > > You should tune sysctl's to increase a hard limits > kern.maxfiles: 25000 > kern.maxfilesperproc: 20000 > > I've also tried to increase kern.ipc.nmbclusters=64000 but without success. > > Are there any limit in 5000 FD's hard coded in erlang??? No, but if I remember correctly FreeBSD also has a setting for max sockets per process, not only FD's (this could be another BSD though). Also, depending on the application the maximum number of processes (+P) can affect the situation. $ sysctl -a | grep max might give hints :) I've had over 20000 connections without problems using FreeBSD. > Setting ERL_MAX_PORTS also does not change the situation. > > /Gaspar > Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From ulf@REDACTED Mon Jul 2 13:35:16 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 2 Jul 2007 13:35:16 +0200 Subject: [erlang-questions] Mnesia and automatic generation of primary keys In-Reply-To: <4688D486.2060407@fiit.stuba.sk> References: <4688D486.2060407@fiit.stuba.sk> Message-ID: <8209f740707020435h6daf10c7g10b2a5382619e732@mail.gmail.com> I usually use {node(), erlang:now()} when I need a persistently unique key. It also functions as a timestamp, letting you derive the creation time from the key. BR, Ulf W 2007/7/2, Matej Kosik : > Hello, > > The best tutorial to using Mnesia I have found is this document: > http://www.erlang.org/documentation/doc-5.2/pdf/mnesia-4.1.pdf > > According to that information I was able to set up a database, add tables, entries and make some querries. Ok. > > Now when I am thinking about tables I need and their attributes, I would like to generate unique primary keys for new entries to certain tables (where none of their attributes is a clear candidate for primary key). > > Is there a lucid way to generate such primary keys (that will guarantee uniqueness of those keys during the whole lifetime of that table) regardless of how many times the system will be shut down and restarted. Do you also have this problem? How do you solve it? > > Should I set up some kind of global table where I can use "last used primary key (integer)" and gradually increment it as I will acquire new keys? Or can this information be somehow associated with particular tables (stored in a schema as an attribute of that table)? > > Regards > -- > Matej Kosik > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From jeffm@REDACTED Mon Jul 2 14:31:39 2007 From: jeffm@REDACTED (jm) Date: Mon, 02 Jul 2007 22:31:39 +1000 Subject: [erlang-questions] erlyweb accessing record fields Message-ID: <4688F02B.1000802@ghostgun.com> In writing a view for a component which displays one entry, call it mod, with a field called name I am attempting to access the values with mod:name(Data) which I thought would work based on the metafunctions, but this causes an error where Data is a list of tuple. I can get it to work with element(4,lists:nth(1,Data)) which is not very practical and from what I read else where mod:name(Data) should work. The applicable code folllows. Any help would be welcome even pointing out the obvious :-). In mod_controller.erl -export([show/3]). show(A, Model, Id) -> Rec = Model:find_id(Id), Fields = tl(Model:db_fields()), Vals = tl(Model:to_iolist(Rec)), FV = lists:zip(Fields, Vals), %% IdStr = case Model:id(Rec) of %% undefined -> []; %% Id -> integer_to_list(Id) %% end, FieldData = [{erlydb_field:name_bin(Field), erlydb_field:html_input_type(Field), erlydb_field:modifier(Field), Val} || {Field, Val} <- FV], {data, {erlyweb:get_app_root(A), atom_to_list(Model), Id, yaws_arg:server_path(A), FieldData}}. In mod_view.erl -export([show/1]). show(Data) -> classes_show:show(Data). In mod_show.et, a some what cut down extract, <%! Shows a summary %> <%@ show({AppRoot, Model, Id, Action, Data} = Fields) %> <--problem <%! rest of table goes here %>
<% element(4,lists:nth(1,Data)) %>
Name:A Name
----- End Extracts ----- Jeff. From kosik@REDACTED Mon Jul 2 16:11:39 2007 From: kosik@REDACTED (Matej Kosik) Date: Mon, 02 Jul 2007 16:11:39 +0200 Subject: [erlang-questions] Mnesia and automatic generation of primary keys In-Reply-To: References: <4688D486.2060407@fiit.stuba.sk> Message-ID: <4689079B.2060201@fiit.stuba.sk> Philip Robinson wrote: > On 7/2/07, Matej Kosik wrote: >> Now when I am thinking about tables I need and their attributes, I >> would like to generate unique primary keys for new entries to certain >> tables (where none of their attributes is a clear candidate for >> primary key). > > Matej, > > Have you tried mnesia:dirty_update_counter/2 & /3? > > Cheers, > Philip > Thank you (both). This will probably work for me. -- Matej Kosik -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From fredrik.svahn@REDACTED Mon Jul 2 21:13:48 2007 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Mon, 2 Jul 2007 21:13:48 +0200 Subject: [erlang-questions] input too fast In-Reply-To: <4688C837.9040405@ericsson.com> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> <4688C837.9040405@ericsson.com> Message-ID: On 7/2/07, Bengt Kleberg wrote: > > On 2007-06-29 14:45, Fredrik Svahn wrote: > ...deleted > > fileio()-> > > {ok,StdIn}=file:open("",[raw, binary, read]), > > {ok,StdOut}=file:open("",[raw, binary, write]), > > minor detail: somebody might want to call a file (not impossible > imho) and therefore it could be better to use an atom in this case. > > ie, string is file name, atom is one of stdin, stdout, stderr. While I agree that "" seems to be a perfectly valid (although not recommended) filename in all(?) unix systems I do not think that using an atom will help. file:open/2 can already take an atom as filename argument according to the docs. Thus the following commands are all vaild and will return usable IoDevices 1> {ok, File1}=file:open("hello.erl",[read]). 2> {ok, File2}=file:open('hello.erl',[read]). 3> {ok, File3}=file:open(hosts,[read]). 4> {ok, File4}=file:open(stdin,[read]). Changing this would unfortunately not be backwards compatible. Maybe Ulfs suggested solution with back pressure is better after all... /F -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Mon Jul 2 23:08:11 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 2 Jul 2007 16:08:11 -0500 Subject: [erlang-questions] Erlang vs. Haskell Message-ID: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> I find myself writing real-time ("soft" real-time) communications and data manipulation code a fair bit, and before I discovered Erlang, I had written a whole set of concurrency and scheduling libraries to assist me. When I discovered Erlang, I thought I had hit upon exactly what I needed (I wished I had known about Erlang four years ago!). I have therefore started to teach myself Erlang. However, I was taken aback by the benchmark comparison (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all &lang=ghc&lang2=hipe), which shows Haskell to perform every bit as well as Erlang. Since Erlang and Haskell seem to have a lot in common, I am now wondering if I should instead teach myself Haskell. Now, granted, this will be a biased group to ask, but I am curious as to what the Erlang community's take on Haskell's apparent performance superiority is. It seems to me that Erlang as a language seems to fit very nicely into my needs, but given Haskell's similarity and superior performance, does anyone have any experience with both who could help me in my decision? I have written some prototype modules in Erlang, but have never written anything in Haskell, and am wondering whether to stop and play around with Haskell some before I continue. Please advise. Thank-you. David Mercer -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Mon Jul 2 23:59:16 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 2 Jul 2007 22:59:16 +0100 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> Message-ID: David, May I suggest this Google query? http://www.google.com/search?client=safari&rls=en&q=haskell+vs +erlang&ie=UTF-8&oe=UTF-8 Also, please keep in mind that Haskell is lazy so performance is often unpredictable. Plus, Erlang is dynamically typed which means that it's harder for the compiler to generate optimized code. Erlang is usually compiled to byte code whereas Haskell is a native code compiler with full static typing. The fact that Erlang is on par with Haskell in the benchmarks should say wonders about Erlang. Thanks, Joel On Jul 2, 2007, at 10:08 PM, David Mercer wrote: > I find myself writing real-time (?soft? real-time) communications > and data manipulation code a fair bit, and before I discovered > Erlang, I had written a whole set of concurrency and scheduling > libraries to assist me. When I discovered Erlang, I thought I had > hit upon exactly what I needed (I wished I had known about Erlang > four years ago!). I have > -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From pro@REDACTED Tue Jul 3 00:09:10 2007 From: pro@REDACTED (Peter Ross) Date: Tue, 3 Jul 2007 08:09:10 +1000 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> Message-ID: > On Jul 2, 2007, at 10:08 PM, David Mercer wrote: > > > I find myself writing real-time ("soft" real-time) communications > > and data manipulation code a fair bit, and before I discovered > > Erlang, I had written a whole set of concurrency and scheduling > > libraries to assist me. When I discovered Erlang, I thought I had > > hit upon exactly what I needed (I wished I had known about Erlang > > four years ago!). I have > > Haskell is a beautiful language, and I love its static typing, I would certainly prefer to write a single-threaded program in it than erlang. It is also a lazy language so it can be difficult to reason about its performance. If you want a high-performance statically typed language, then you can try Mercury (which is what I mainly use) or Ocaml. However if my program has lots and lots of concurrency, then the erlang vm is amazing, it is so scalable. So if you have to write a highly concurrent program, I would go for erlang. From matthew@REDACTED Tue Jul 3 00:13:25 2007 From: matthew@REDACTED (Matthew Sackman) Date: Mon, 2 Jul 2007 23:13:25 +0100 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> Message-ID: <20070702221324.GD15071@wellquite.org> On Mon, Jul 02, 2007 at 04:08:11PM -0500, David Mercer wrote: > However, I was taken aback by the benchmark comparison > (http://shootout.alioth.debian.org/gp4/benchmark.php?test=all > =hipe> &lang=ghc&lang2=hipe), which shows Haskell to perform every bit as > well as Erlang. Since Erlang and Haskell seem to have a lot in common, I am > now wondering if I should instead teach myself Haskell. Now, granted, this > will be a biased group to ask, but I am curious as to what the Erlang > community's take on Haskell's apparent performance superiority is. It seems > to me that Erlang as a language seems to fit very nicely into my needs, but > given Haskell's similarity and superior performance, does anyone have any > experience with both who could help me in my decision? I have written a decent amount of high performance code in both Erlang and Haskell. The main issue in Haskell is that the laziness hurts performance and so in order to make it go really fast, you tend to end up adding lots of "strictness" annotations (!) which controllably destroy laziness. There are then further tricks that can be employed, and a whole host of flags to pass to ghc and through to gcc in order to make it go really fast. Whilst this can mean you can out-perform C in some cases, it always tends to result in very unidiomatic code. Until ghc 6.8 comes out with its generalised loop fusion framework, high speed Haskell tends to mean "do recursion directly" rather than map/fold as it will be detected and optimised better. Performance issues in Erlang seem to be utterly different. There seems to be less of a concerted effort to use higher-order functions all over the place, and you can get away with murder due to the lack of a static type system. lists:flatten/1 for example, can not be expressed in Haskell and so you end up having to think quite differently about any given problem. I'm sure others can offer other evidence, but to me, most opitisation work in Erlang seems to be focussed around communication between processes, ensuring bottlenecks don't occur and minimising queue lengths. I'm comfortable in both, and would use both for different means. I would say that Haskell probably is far more of an academic's playground than Erlang is and has one of the finest type systems ever constructed by man, but then again, I like static code analysis, and not everyone does. I would suggest that you should learn both, and learn when to use each one. Concurrency in Haskell is definitely more challenging than in Erlang (regardless of whether you use Chan, MVar or TVar/STM to do shared state), but purely algorithmic code and number crunching will almost always be faster in Haskell. They're different tools, shaped for different nails. Matthew -- Matthew Sackman http://www.wellquite.org/ From bob@REDACTED Tue Jul 3 01:26:52 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 2 Jul 2007 16:26:52 -0700 Subject: [erlang-questions] Parameterized modules shell regression in R11B-5 Message-ID: <6a36e7290707021626m3af15017q8e38e7f967768a3d@mail.gmail.com> In R11B-5 it seems that the shell no longer works with parameterized modules. It worked fine in R11B-4. -module(parameterized, [A]). -export([test/0]). test() -> A. 1> (parameterized:new(adsf)):test(). ** exited: {{badfun,{{parameterized,adsf},test}}, [{shell,apply_fun,3},{shell,exprs,6},{shell,eval_loop,3}]} ** =ERROR REPORT==== 2-Jul-2007::16:15:57 === Error in process <0.33.0> with exit value: {{badfun,{{parameterized,adsf},test}},[{shell,apply_fun,3},{shell,exprs,6},{shell,eval_loop,3}]} -bob From jeffm@REDACTED Tue Jul 3 02:42:47 2007 From: jeffm@REDACTED (jm) Date: Tue, 03 Jul 2007 10:42:47 +1000 Subject: [erlang-questions] erlyweb accessing record fields In-Reply-To: <4688F02B.1000802@ghostgun.com> References: <4688F02B.1000802@ghostgun.com> Message-ID: <46899B87.6080500@ghostgun.com> Had another chance to look at this this morning. (It was about 22:30 last night when I got stuck and posted the last message). For anyone else who comes across this in the future it was solve as follows. Based on http://dcaoyuan.javaeye.com/blog/84022 I found out about decompiling the beam files and did {ok, {_, [{abstract_code, {_, AC}}]}} = beam_lib:chunks("ebin/mod.beam", [abstract_code]). {ok, S} = file:open("decompiled_mod.erl", write). io:fwrite(S, "~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). file:close(S). looking at the decompiled code, .... name(Rec) -> erlydb_base:get(4, Rec). name(Rec, Val) -> setelement(4, Rec, Val). .... new(name, duration, logo_small, logo_flat, description) -> {mod, true, undefined, name, duration, logo_small, logo_flat, description}. .... >From this it can be see I was over doing things, ie over processing the results. From the original message the mod_controller.erl was jm wrote: > In mod_controller.erl > -export([show/3]). > > show(A, Model, Id) -> > Rec = Model:find_id(Id), > Fields = tl(Model:db_fields()), > Vals = tl(Model:to_iolist(Rec)), > FV = lists:zip(Fields, Vals), > %% IdStr = case Model:id(Rec) of > %% undefined -> []; > %% Id -> integer_to_list(Id) > %% end, > FieldData = [{erlydb_field:name_bin(Field), > erlydb_field:html_input_type(Field), > erlydb_field:modifier(Field), > Val} || {Field, Val} <- FV], > {data, {erlyweb:get_app_root(A), > atom_to_list(Model), > Id, > yaws_arg:server_path(A), > FieldData}}. > This can be reduced to -export([show/3]). show(A, Model, Id) -> Rec = Model:find_id(Id), %% this IdStr bit could also possible go IdStr = case Model:id(Rec) of undefined -> []; Id2 -> integer_to_list(Id2) end, {data, {erlyweb:get_app_root(A), atom_to_list(Model), IdStr, yaws_arg:server_path(A), Rec}}. Jeff. From ok@REDACTED Tue Jul 3 06:16:36 2007 From: ok@REDACTED (ok) Date: Tue, 3 Jul 2007 16:16:36 +1200 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> Message-ID: On 3 Jul 2007, at 9:08 am, David Mercer wrote: > However, I was taken aback by the benchmark comparison (http:// > shootout.alioth.debian.org/gp4/benchmark.php? > test=all&lang=ghc&lang2=hipe), which shows Haskell to perform every > bit as well as Erlang. Why do you find this surprising? Haskell has strong compile-time types; Erlang does not. GHC compiles who programs to traditional object programs; Erlang has to support dynamic reloading of modules. GHC is a mature heavily optimising compiler; Erlang's HiPE is younger. If all you care about is speed, let me recommend Fortran 95. If you insist on a functional language, Clean used to be faster than GHC (I don't know if it still is), and the king of functional speed is O'CAML (which to my mind also wins prizes for ugliness). For most things that don't involve concurrency, I would prefer Haskell myself. But as soon as concurrency or distribution are involved, Erlang is so much simpler it isn't funny. Yes, I am aware of the concurrency features supported by some (but by no means all) Haskell compilers, and I *still* say that it is a LOT easier to write concurrent code in Erlang. If the comparison involved some other Haskell compiler, by the way, such as the hbc or nch98 compilers I often use, I think you would find Erlang looking a lot better. > Since Erlang and Haskell seem to have a lot in common, I am now > wondering if I should instead teach myself Haskell. Now, granted, > this will be a biased group to ask, but I am curious as to what the > Erlang community?s take on Haskell?s apparent performance > superiority is. It seems to me that Erlang as a language seems to > fit very nicely into my needs, but given Haskell?s similarity and > superior performance, does anyone have any experience with both who > could help me in my decision? > > > I have written some prototype modules in Erlang, but have never > written anything in Haskell, and am wondering whether to stop and > play around with Haskell some before I continue. Please advise. > Thank-you. > > > David Mercer > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Tue Jul 3 09:28:02 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 03 Jul 2007 09:28:02 +0200 Subject: [erlang-questions] input too fast In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> <4688C837.9040405@ericsson.com> Message-ID: <4689FA82.1020403@ericsson.com> On 2007-07-02 21:13, Fredrik Svahn wrote: ...deleted > While I agree that "" seems to be a perfectly valid (although not > recommended) filename in all(?) unix systems I do not think that using > an atom will help. file:open/2 can already take an atom as filename > argument according to the docs. Thus the following commands are all backwards compatibility sure makes for a lot of inconsistencies, does it not? atoms for file names, what will they think of next? so, next suggestion (this is not to say that -user is a bad idea, just that _i_ would prefer something else): a new function in the file module: dup/1. used like this: {ok,Stdin} = file:dup( stdin ), {ok,Stdout} = file:dup( stdout ), {ok,Stderr} = file:dup( stderr ), better? worse? bengt -- Those were the days... 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 Tue Jul 3 12:46:17 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 3 Jul 2007 12:46:17 +0200 Subject: [erlang-questions] surprising bit syntax Message-ID: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> Is it just me, or is this behaviour surprising? 4> <<255>>. <<"?">> 5> <<256>>. <<0>> 6> <<257>>. <<1>> 7> <<257:8>>. <<1>> 8> <> = <<999>>. <<"?">> 9> I. 231 I scanned the reference manual to find a note stating that this is exactly what one should expect, but I couldn't find it. Personally, I would have expected something along the lines of badarg, which is what list_to_binary([999]) gives. BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvg@REDACTED Tue Jul 3 13:28:55 2007 From: rvg@REDACTED (Rudolph van Graan) Date: Tue, 3 Jul 2007 13:28:55 +0200 Subject: [erlang-questions] Behaviour of list_to_float(...) Message-ID: <7E6ED60E-7535-4144-BBE5-54193C9D0F6C@patternmatched.com> Hi all, list_to_float is not behaving correctly in my view, even though it may be behaving according to the erlang documentation 1> list_to_float("0.1"). 0.100000 2> list_to_float("0.0"). 0.00000e+0 3> list_to_float("0"). =ERROR REPORT==== 3-Jul-2007::13:11:30 === Error in process <0.34.0> with exit value: {badarg, [{erlang,list_to_float,["0"]},{erl_eval,do_apply,5},{shell,exprs,6}, {shell,eval_loop,3}]} ** exited: {badarg,[{erlang,list_to_float,["0"]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** According to IEEE 754 the number 0 is also a float, namely the fraction is 0 and the exponent is also zero, albeit with a sign bit. I Think the correct behaviour should have been: list_to_float("0") = 0.0 as The code clearly indicates that we want the result to be a float. To me, the behaviour that makes sense is that list_to_float always succeeds if the argument is a number so we can avoid having to write code like this: safe_float(S) -> try list_to_float(S) catch error:badarg -> list_to_integer(S) end. I think it should also work for list_to_float("1") etc... Can someone please explain the rationale behind this behaviour? Rudolph van Graan From mad.one@REDACTED Tue Jul 3 13:47:09 2007 From: mad.one@REDACTED (mad.one@REDACTED) Date: Tue, 03 Jul 2007 11:47:09 -0000 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> Message-ID: <20070801224845.GA8047@continuum.localdomain> Given what you've found yourself already doing, I would say you stick with Erlang for now. You get mass scale concurrency cheap and the message-oriented syntax is, personally, a pleasure to work with. :) Once you start stepping out into a much bigger, concurrent world, erlang is a better choice for what you're doing, hands down if you ask me. Now, granted, with Haskell you get some nice things too. You get monadic abstractions which, while tough to grok at first, provide a very nice mechanism to remove code boilerplate, as well as let you create the rules as to how a 'sequential' action/function should occur (quotes on 'sequential' as in haskell, order doesn't matter: monads give you the sense of sequential evaluation, but you can describe exactly what happens under the hood, since the monadic do-notation in haskell is just syntactic sugar. This allows you to do things like pass around state transparently.) Monads are a lot of things, however, which can be confusing at first. No monad really follows a 'guiding principle' as to how it should act (although there are laws all monads must abide by.) Some monads, for example, State and Reader, act as a container which allows you to have an outermost 'environment' where globalized data is held, so that anything executed in this container has access to it, in a language where there things are referentially transparent (that is, it's just acting like a global variable in C or somesuch.) The IO monad gives the notion of a side effect, etc. etc.. There are also other benefits. The haskell type system is incredbly strong and flexible in itself. The compiler -will- complain. A lot. But this is something that shouldn't aggrivate you: without the compiler catching all those type-errors (remember, very strong,) those issues would most likely manifest into runtime bugs rather than compile-time bugs. So the type system basically offers you debugging for free. This is why after you generally get a haskell program to compile fully, it just seems to 'work.' The type system will ensure this correctness. Haskell is a language where things can be 'hard' but they just hit the point of 'hard enough.' I learned a lot while doing Haskell, so while you might not use it for this project (again, I waver in Erlang's favor here), I highly advise it's investigation anyway. I don't think you'll regret it; once you can get past the initial frusterations (I felt as though I couldn't write 6 lines of code without a thousand type errors!), and you'll see a very amazing, beautiful language underneath. Austin Seipp From dmitriid@REDACTED Tue Jul 3 13:40:18 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Tue, 03 Jul 2007 14:40:18 +0300 Subject: [erlang-questions] surprising bit syntax In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> Message-ID: <468A35A2.8070605@gmail.com> Ulf Wiger (TN/EAB) wrote: > > Is it just me, or is this behaviour surprising? > > 4> <<255>>. > <<"?">> > 5> <<256>>. > <<0>> > 6> <<257>>. > <<1>> > 7> <<257:8>>. > <<1>> > 8> <> = <<999>>. > <<"?">> > 9> I. > 231 > > I scanned the reference manual to find a note stating that this > is exactly what one should expect, but I couldn't find it. > > Personally, I would have expected something along the lines > of badarg, which is what list_to_binary([999]) gives. > My results are consistent with yours: 1> <<255>>. <<"\377">> 2> <<256>>. <<0>> 3> <<257>>. <<1>> 4> <<257:8>>. <<1>> 5> <> = <<999>>. <<"\347">> 6> I. 231 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Tue Jul 3 15:12:46 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 03 Jul 2007 15:12:46 +0200 Subject: [erlang-questions] Erlang job opportunity! Message-ID: Kreditor is looking for Erlang SW developers! You'll find more info here: http://kreditor.se/jobb/wanted-developer.html Cheers, Tobbe From mogorman@REDACTED Tue Jul 3 15:23:39 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Tue, 3 Jul 2007 08:23:39 -0500 Subject: [erlang-questions] surprising bit syntax In-Reply-To: <468A35A2.8070605@gmail.com> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> <468A35A2.8070605@gmail.com> Message-ID: 8 bits you pump in 999 which would be 03 E7, so what happens e7 rolls over 3 times so e7 in decimal is nnananna = 231. what you would need to do is make <> is <> hope this helps mog On 7/3/07, Dmitrii 'Mamut' Dimandt wrote: > > Ulf Wiger (TN/EAB) wrote: > > > > Is it just me, or is this behaviour surprising? > > 4> <<255>>. > <<"?">> > 5> <<256>>. > <<0>> > 6> <<257>>. > <<1>> > 7> <<257:8>>. > <<1>> > 8> <> = <<999>>. > <<"?">> > 9> I. > 231 > > I scanned the reference manual to find a note stating that this > is exactly what one should expect, but I couldn't find it. > > Personally, I would have expected something along the lines > of badarg, which is what list_to_binary([999]) gives. My results are > consistent with yours: > > 1> <<255>>. > <<"\377">> > 2> <<256>>. > <<0>> > 3> <<257>>. > <<1>> > 4> <<257:8>>. > <<1>> > 5> <> = <<999>>. > <<"\347">> > 6> I. > 231 > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per.gustafsson@REDACTED Tue Jul 3 15:24:27 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Tue, 03 Jul 2007 15:24:27 +0200 Subject: [erlang-questions] surprising bit syntax In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> Message-ID: <468A4E0B.7090505@it.uu.se> Ulf Wiger (TN/EAB) wrote: > Is it just me, or is this behaviour surprising? > > 4> <<255>>. > <<"?">> > 5> <<256>>. > <<0>> > 6> <<257>>. > <<1>> > 7> <<257:8>>. > <<1>> > 8> <> = <<999>>. > <<"?">> > 9> I. > 231 > This behaviour might be surprising and it should probably be mentioned in the reference manual that <> is equivalent to <<(I band ((1 bsl N) - 1)):N>> That is, if the integer I can not be represented in N bits the low N bits of the integer is put into the binary. Binaries work in a similar manner e.g. 1> <<1,2>> = << (<<1,2,3>>):2/binary >>. <<1,2>> Per From ulf@REDACTED Tue Jul 3 15:49:08 2007 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 3 Jul 2007 15:49:08 +0200 Subject: [erlang-questions] surprising bit syntax In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> <468A35A2.8070605@gmail.com> Message-ID: <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> Well, I was just goofing around with term comparisons, and came across something unexpected. It's logical, of course, but it should be documented. BR, Ulf W 2007/7/3, Matthew O'Gorman : > 8 bits you pump in 999 which would be 03 E7, so what happens e7 rolls > over 3 times so e7 in decimal is nnananna = 231. what you would need > to do is make <> is <> > > hope this helps > > mog > > On 7/3/07, Dmitrii 'Mamut' Dimandt wrote: > > > > Ulf Wiger (TN/EAB) wrote: > > > > > > > > Is it just me, or is this behaviour surprising? > > > > 4> <<255>>. > > <<"?">> > > 5> <<256>>. > > <<0>> > > 6> <<257>>. > > <<1>> > > 7> <<257:8>>. > > <<1>> > > 8> <> = <<999>>. > > <<"?">> > > 9> I. > > 231 > > > > I scanned the reference manual to find a note stating that this > > is exactly what one should expect, but I couldn't find it. > > > > Personally, I would have expected something along the lines > > of badarg, which is what list_to_binary([999]) gives. My results are > > consistent with yours: > > > > 1> <<255>>. > > <<"\377">> > > 2> <<256>>. > > <<0>> > > 3> <<257>>. > > <<1>> > > 4> <<257:8>>. > > <<1>> > > 5> <> = <<999>>. > > <<"\347">> > > 6> I. > > 231 > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmercer@REDACTED Tue Jul 3 23:45:49 2007 From: dmercer@REDACTED (David Mercer) Date: Tue, 3 Jul 2007 16:45:49 -0500 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <20070801224845.GA8047@continuum.localdomain> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> <20070801224845.GA8047@continuum.localdomain> Message-ID: <000301c7bdbb$85a9cbe0$891ea8c0@SSI.CORP> Thank-you all who responded. I think I shall stick to teaching myself Erlang for now. I understood Erlang as being a good language for concurrent and distributed applications, but I thought that maybe with Haskell being so similar to Erlang -- and faster -- that Haskell might have been a better choice. Apparently, this is not the case. Thank-you. David From anders.nygren@REDACTED Wed Jul 4 00:44:40 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 3 Jul 2007 17:44:40 -0500 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: <000301c7bdbb$85a9cbe0$891ea8c0@SSI.CORP> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> <20070801224845.GA8047@continuum.localdomain> <000301c7bdbb$85a9cbe0$891ea8c0@SSI.CORP> Message-ID: On 7/3/07, David Mercer wrote: > Thank-you all who responded. I think I shall stick to teaching myself > Erlang for now. I understood Erlang as being a good language for concurrent > and distributed applications, but I thought that maybe with Haskell being so > similar to Erlang -- and faster -- that Haskell might have been a better > choice. Apparently, this is not the case. > Hi Since nobody have mentioned it yet, take a look at. http://wagerlabs.com/articles/2006/01/01/haskell-vs-erlang-reloaded /Anders From codeslinger@REDACTED Wed Jul 4 01:04:17 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Tue, 3 Jul 2007 19:04:17 -0400 Subject: [erlang-questions] Erlang vs. Haskell In-Reply-To: References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> <20070801224845.GA8047@continuum.localdomain> <000301c7bdbb$85a9cbe0$891ea8c0@SSI.CORP> Message-ID: <876ef97a0707031604i343aa709v935b922410a0a8fb@mail.gmail.com> On 7/3/07, Anders Nygren wrote: > Since nobody have mentioned it yet, take a look at. > > http://wagerlabs.com/articles/2006/01/01/haskell-vs-erlang-reloaded Actually, Joel semi-mentioned it already, as its the first result on the Google search link he provided. And its his article ;-) -- Toby DiPasquale From rsaccon@REDACTED Wed Jul 4 05:15:47 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Wed, 4 Jul 2007 00:15:47 -0300 Subject: [erlang-questions] emacs / distel problem with dynamic tags Message-ID: when using "M-.", "M-,", and "M-*" for jumping from call to function implementation, emacs always asks me for the nodename. But I have defined the nodename (of a webapp inside yaws) and I can reload modules perfectly without emacs asking me each time again for the nodename. So how can I make emacs picking automatically that nodename for the dynamic tags stuff ? regards -- Roberto Saccon From ulf@REDACTED Wed Jul 4 07:09:44 2007 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 4 Jul 2007 07:09:44 +0200 Subject: [erlang-questions] Sixth ACM SIGPLAN Erlang Workshop: SUBMISSION DEADLINE EXTENSION In-Reply-To: References: Message-ID: <8209f740707032209x69dc6898i1b6b6619e78866f3@mail.gmail.com> This extension should perhaps be noted under the erlang.org News section, as well as on the web-based call for papers? (Granted, by now it is probably too late to make a difference.) BR, Ulf W 2007/6/24, S.J.Thompson : > > We have received a number of requests for extensions of the submission > deadline for the Sixth ACM SIGPLAN Erlang Workshop. This is to confirm > that the deadline will be extended by ONE WEEK ONLY to midnight on > Thursday 5 July. > > Lars-Ake Fredlund > Simon Thompson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bfulg@REDACTED Wed Jul 4 07:16:51 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Tue, 3 Jul 2007 22:16:51 -0700 Subject: [erlang-questions] Patches for HIPE on OS X (Leopard WWDC Beta) In-Reply-To: <200707020904.l6294b6J003608@harpo.it.uu.se> References: <200707020904.l6294b6J003608@harpo.it.uu.se> Message-ID: <0CA5E3FE-81BD-4D80-B960-DEE3327EB6E9@pacbell.net> On Jul 2, 2007, at 2:04 AM, Mikael Pettersson wrote > It includes OS-specific stuff in an OS-agnostic part of > the code. I'd much prefer if you could move that to the > #ifdef/#include block just before fpe_sig_action(), and > make it #ifdef __DARWIN_UNIX03 like your other changes. Sounds good -- I'll revise the patch and re-test. As has been published elsewhere, the Leopard release of the OS has 64- bit support "top-to-bottom". Some of the changes this patch works around is to deal with revised constructs that are more word-size agnostic. It should be possible to revise the Darwin stuff to engage the appropriate variation based on compile-time-options, but I'm not sure. Attached is the revised configure.in patch, moving the change closer to the fpe_sig_action stanza. Thanks, -Brent -------------- next part -------------- A non-text attachment was scrubbed... Name: erts_configure.in.patch Type: application/octet-stream Size: 1078 bytes Desc: not available URL: -------------- next part -------------- From erlanging@REDACTED Wed Jul 4 07:39:38 2007 From: erlanging@REDACTED (Jeremy Chow) Date: Wed, 4 Jul 2007 13:39:38 +0800 Subject: [erlang-questions] ssl failed during the time shaking hands Message-ID: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> hi list, I've tried to do some tests for understanding the communications of two nodes through the ssl protocol in erlang. I've created a boot script for this case and two certificates following the otp reference,one was ssl_server.pem, the other was ssl_client.pem. Then I used command-line to create two nodes -- x@REDACTED and y@REDACTED -- as follows: # erl -boot start_ssl -proto_dist inet_ssl -name x@REDACTED -ssl_dist_opt client_certfile "ssl_client" -ssl_dist_opt server_certfile "ssl_server.pem" -setcookie 123456 # erl -boot start_ssl -proto_dist inet_ssl -name y@REDACTED -ssl_dist_opt client_certfile "ssl_client.pem" -ssl_dist_opt server_certfile "ssl_server.pem" -setcookie 123456 Everything is okay at that time, I 've seen the erlang prompts as well. But when I tried to ping one node from the other one, it failed with a message pang. (y@REDACTED)1> net_adm:ping('x@REDACTED'). pang By analysing it with shell commands netstat and strace, It appears that the ssl ping failed during the time shaking hands. The file descriptor who receives data from the other node hasnot been added into the pollfds. this a fragment of the strace result: accept(5, {sa_family=AF_INET, sin_port=htons(13198), sin_addr=inet_addr("192.168.0.97")}, [16]) = 7 fcntl64(7, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(7, F_SETFL, O_RDWR|O_NONBLOCK) = 0 write(2, "fuck\n", 5) = 5 write(1, "\0\0\0\t", 4) = 4 write(1, "\f\0\0\0\5\0\0\0\7", 9) = 9 poll([{fd=4, events=POLLIN|POLLRDNORM}, {fd=0, events=POLLIN|POLLRDNORM, revents=POLLIN|POLLRDNORM}], 2, 2000) = 1 time(NULL) = 1183526380 read(0, "\0\0\0\6", 4) = 4 read(0, "\n\0\0\0\5\0", 6) = 6 poll([{fd=4, events=POLLIN|POLLRDNORM}, {fd=0, events=POLLIN|POLLRDNORM}, {fd=5, events=POLLIN|POLLRDNORM}], 3, 2000) = 0 time(NULL) = 1183526382 and below is the result of netstat: # netstat --tcp -n Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State ...(omit) tcp 0 0 192.168.0.98:31719 221.174.21.84:8080 ESTABLISHED tcp 0 0 192.168.0.98:31728 221.174.21.84:8080 ESTABLISHED tcp 142 0 192.168.0.98:25233 192.168.0.97:13198 ESTABLISHED tcp 0 0 ::ffff:192.168.0.98:40272 ::ffff:192.168.0.100:3306 ESTABLISHED tcp 0 0 ::ffff:127.0.0.1:8052 ::ffff:127.0.0.1:59274 ESTABLISHED tcp 0 264 ::ffff:192.168.0.98:22 ::ffff:192.168.0.217:3103 ESTABLISHED Apparently, there are still 142 bytes data stayed at the receive queue. The receiver terminal program hasnot take any data from that queue beacuse the right file descriptor has not been added yet. Who can explain that phenomenon and give me a solution? Thx, Jeremy From sanjaya@REDACTED Wed Jul 4 08:42:48 2007 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Wed, 4 Jul 2007 12:12:48 +0530 Subject: [erlang-questions] inets http --- httpc_handler, retry_pipline Message-ID: <017c01c7be06$898f7570$9a0810ac@wavenet.lk> Hi all, Anyone has a idea about below error & why it gets with http:request(get, {URL, []}, [{timeout, ?REQUEST_TIMEOUT},{autoredirect, true}], [{sync, false}]) ??? I have get it with R11B-4 (emulator version 5.5.4 - inets-4.7.11). Is this a bug in in inets ?? regards, Sanjaya Vitharana ** Reason for termination == ** {{badmatch,#Ref<0.0.43.103898>}, [{httpc_handler,retry_pipline,2}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} =CRASH REPORT==== 4-Jul-2007::10:16:10 === crasher: pid: <0.25066.9> registered_name: [] error_info: {{badmatch,#Ref<0.0.43.103898>}, [{httpc_handler,retry_pipline,2}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} initial_call: {gen, init_it, [gen_server, <0.54.0>, <0.54.0>, httpc_handler, [{request, #Ref<0.0.43.103750>, <0.63.0>, 0, http, {"scrb.int",80}, "/vmail/vmStart.php", "?key=c&session=a1183524542772308306&ch=56&serverid=3", get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "scrb.int", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,18000,true,[],undefined,false}, "http://scrb.int/vmail/vmStart.php?key=c&session=a1183524542772308306&ch=56&serverid=3", [], none, []}, {options,{undefined,[]},0,2,2,disabled,enabled,false}], []]} ancestors: [httpc_manager,httpc_sup,inets_sup,<0.50.0>] messages: [] links: [<0.54.0>,#Port<0.390595>] dictionary: [] trap_exit: true status: running heap_size: 4181 stack_size: 21 reductions: 12757 neighbours: -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Jul 4 09:56:55 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 04 Jul 2007 09:56:55 +0200 Subject: [erlang-questions] input too fast Message-ID: <468B52C7.3020900@ericsson.com> greetings, i have a better idea than my previous suggestions. once, upon one of the occasions that i tried to make a contribution to the shootout, i noted the lack of stdin/stdout/stderr access from the file module. looking around i found my old code (from many years ago) and this is what i had at the time: add the possibility to handle the atom standard_io as an IoDevice in file:read/2, write/2, pread/2-3, pwrite/2-3. 1 this is backwards compatible since nobody can have used an atom here. 2 it is consistent since the io module has this possibility already. it might be a good idea to add a access stderr, too. bengt -- Those were the days... 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 dmitriid@REDACTED Wed Jul 4 10:46:13 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 04 Jul 2007 11:46:13 +0300 Subject: [erlang-questions] Can't set long node name on windows Message-ID: <468B5E55.7080100@gmail.com> Reading Joe Armstrong's book and trying all the examples :) Anyway, in the "Distributed Programming" chapter I'm trying to run one node on a Linux box and another one on a Windows box. Unfortunately, trying to invoke erl like this: erl -name bilbo -setcookie abc results in "Can't set long node name. Please check your configuration" Both machines run on DHCP. And yes, I know, Windows sucks :) But I need it :( -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Wed Jul 4 11:10:17 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 4 Jul 2007 11:10:17 +0200 Subject: [erlang-questions] Can't set long node name on windows In-Reply-To: <468B5E55.7080100@gmail.com> References: <468B5E55.7080100@gmail.com> Message-ID: <20070704091017.GA18696@erix.ericsson.se> Try: erl -name bilbo@REDACTED -setcookie abc On Wed, Jul 04, 2007 at 11:46:13AM +0300, Dmitrii 'Mamut' Dimandt wrote: > Reading Joe Armstrong's book and trying all the examples :) > > Anyway, in the "Distributed Programming" chapter I'm trying to run one > node on a Linux box and another one on a Windows box. > > Unfortunately, trying to invoke erl like this: > > erl -name bilbo -setcookie abc > > results in "Can't set long node name. Please check your configuration" > > Both machines run on DHCP. And yes, I know, Windows sucks :) But I need > it :( > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dmitriid@REDACTED Wed Jul 4 13:41:33 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 04 Jul 2007 14:41:33 +0300 Subject: [erlang-questions] Can't set long node name on windows In-Reply-To: <20070704091017.GA18696@erix.ericsson.se> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> Message-ID: <468B876D.2050107@gmail.com> Raimo Niskanen wrote: > Try: > erl -name bilbo@REDACTED -setcookie abc > > Well, this works, but the node isn't accessible from outside world: From joelr1@REDACTED Wed Jul 4 14:04:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 4 Jul 2007 13:04:39 +0100 Subject: [erlang-questions] Interesting behavior of mnesia:transaction/1 Message-ID: Folks, I'm running two processes that both write to the same Mnesia table to update the same object. Each process runs this code: %%% Fetch record, bump counter, store bump(Parent, _, _, 0) -> Parent ! {done, self()}, ok; bump(Parent, Cache, K, N) -> F = fun() -> {ok, _, L} = cache:fetch(Cache, K), V = binary_to_term(list_to_binary(L)), V1 = V + 1, L1 = binary_to_list(term_to_binary(V1)), X = cache:store(Cache, K, L1, "", "text/plain"), {V1, X} end, cache:transaction(F), erlang:yield(), bump(Parent, Cache, K, N - 1). where cache:transaction/1 is just a wrapper around mnesia:transaction/1. I put a delay of 200ms into cache:store/5 and start process #2 with a 100ms delay. I was expecting to see processes take turns but instead I'm seeing each process run twice. Is there any explanation for this? bump <0.904.0>: V = ok, Result = 1 bump <0.904.0>: V = ok, Result = 2 bump <0.905.0>: V = ok, Result = 3 bump <0.905.0>: V = ok, Result = 4 bump <0.904.0>: V = ok, Result = 5 bump <0.904.0>: V = ok, Result = 6 bump <0.905.0>: V = ok, Result = 7 bump <0.905.0>: V = ok, Result = 8 bump <0.904.0>: V = ok, Result = 9 bump <0.904.0>: V = ok, Result = 10 bump <0.905.0>: V = ok, Result = 11 bump <0.905.0>: V = ok, Result = 12 Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From hans.bolinder@REDACTED Wed Jul 4 14:31:22 2007 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Wed, 4 Jul 2007 14:31:22 +0200 Subject: [erlang-questions] Parameterized modules shell regression in R11B-5 In-Reply-To: <6a36e7290707021626m3af15017q8e38e7f967768a3d@mail.gmail.com> References: <6a36e7290707021626m3af15017q8e38e7f967768a3d@mail.gmail.com> Message-ID: <18059.37658.986126.694508@gargle.gargle.HOWL> [Bob Ippolito:] > In R11B-5 it seems that the shell no longer works with parameterized > modules. It worked fine in R11B-4. > > -module(parameterized, [A]). > -export([test/0]). > test() -> A. > > 1> (parameterized:new(adsf)):test(). > ** exited: {{badfun,{{parameterized,adsf},test}}, > [{shell,apply_fun,3},{shell,exprs,6},{shell,eval_loop,3}]} ** Thanks for the bug report. Best regards, Hans Bolinder, Erlang/OTP team *** /usr/local/otp/releases/otp_beam_solaris8_r11b_patched/lib/stdlib-1.14.5/src/shell.erl Tue Jun 12 14:19:50 2007 --- shell.erl Wed Jul 4 14:28:42 2007 *************** *** 709,714 **** --- 709,716 ---- erlang:garbage_collect(Shell), catch erlang:garbage_collect(whereis(user)), erlang:garbage_collect(); + apply_fun({M,F}, As, _Shell) -> + apply(M, F, As); apply_fun(MForFun, As, _Shell) -> apply(MForFun, As). From raimo+erlang-questions@REDACTED Wed Jul 4 14:37:59 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 4 Jul 2007 14:37:59 +0200 Subject: [erlang-questions] : Can't set long node name on windows In-Reply-To: <468B876D.2050107@gmail.com> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> Message-ID: <20070704123759.GA14953@erix.ericsson.se> Try the same but use the machines actual short hostname. If you do not know it, right click on "My Computer", choose "Properties", "Computer Name", and compare the "Full computer name" with the "Domain". The difference should be the short (unqualified) hostname. That was for XP. If the machine is not configured to be part of a DNS domain, you have that problem to solve before making Erlang distributed networks work. On Wed, Jul 04, 2007 at 02:41:33PM +0300, Dmitrii 'Mamut' Dimandt wrote: > Raimo Niskanen wrote: > > Try: > > erl -name bilbo@REDACTED -setcookie abc > > > > > Well, this works, but the node isn't accessible from outside world: > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Wed Jul 4 14:42:12 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 4 Jul 2007 14:42:12 +0200 Subject: [erlang-questions] : Can't set long node name on windows In-Reply-To: <468B876D.2050107@gmail.com> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> Message-ID: <20070704124212.GA20300@erix.ericsson.se> That is, if short hostname is my_computer: erl -name bilbo@REDACTED -setcookie abc On Wed, Jul 04, 2007 at 02:41:33PM +0300, Dmitrii 'Mamut' Dimandt wrote: > Raimo Niskanen wrote: > > Try: > > erl -name bilbo@REDACTED -setcookie abc > > > > > Well, this works, but the node isn't accessible from outside world: > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From dmitriid@REDACTED Wed Jul 4 14:36:47 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Wed, 04 Jul 2007 15:36:47 +0300 Subject: [erlang-questions] : Can't set long node name on windows In-Reply-To: <20070704123759.GA14953@erix.ericsson.se> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> <20070704123759.GA14953@erix.ericsson.se> Message-ID: <468B945F.3050905@gmail.com> Raimo Niskanen wrote: > Try the same but use the machines actual short hostname. > If you do not know it, right click on "My Computer", > choose "Properties", "Computer Name", and compare > the "Full computer name" with the "Domain". The > difference should be the short (unqualified) hostname. > > What do you mean by difference? If full computer name is turkeyhotels and domain is DHGROUP then the hostname would be? From joelr1@REDACTED Wed Jul 4 13:53:57 2007 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 4 Jul 2007 12:53:57 +0100 Subject: [erlang-questions] wait_on_pids? Message-ID: Is there a library function that given a list of process ids can wait for all of them to exit? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From bengt.kleberg@REDACTED Wed Jul 4 15:37:29 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 04 Jul 2007 15:37:29 +0200 Subject: [erlang-questions] wait_on_pids? In-Reply-To: References: Message-ID: <468BA299.6040302@ericsson.com> On 2007-07-04 13:53, Joel Reymont wrote: > Is there a library function that given a list of process ids can wait > for all of them to exit? i do not know of such a library function, but given erlang:monitor/2 it seems possible to write your own rather simply. bengt -- Those were the days... 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 Wed Jul 4 15:49:53 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 4 Jul 2007 15:49:53 +0200 Subject: [erlang-questions] wait_on_pids? In-Reply-To: References: Message-ID: <6616D98C65DD514BA2E1DDC5F9223155023EAF5E@esealmw115.eemea.ericsson.se> wait_on_pids(Pids) -> [receive {'DOWN',Ref,_,_,_} -> true end || Ref <- [erlang:monitor(process,P) || P <- Pids]]. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joel Reymont > Sent: den 4 juli 2007 13:54 > To: Erlang Questions > Subject: [erlang-questions] wait_on_pids? > > Is there a library function that given a list of process ids > can wait for all of them to exit? > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From raimo+erlang-questions@REDACTED Wed Jul 4 15:55:20 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 4 Jul 2007 15:55:20 +0200 Subject: [erlang-questions] : : Can't set long node name on windows In-Reply-To: <468B945F.3050905@gmail.com> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> <20070704123759.GA14953@erix.ericsson.se> <468B945F.3050905@gmail.com> Message-ID: <20070704135520.GA29185@erix.ericsson.se> I rather ment if the full computer name is foo.dom.main.com the hostname would be foo and the domain dom.main.com. If the full computer name is turkeyhotels, try use node name bilbo@REDACTED If the domain is DHGROUP, is that not the workgroup name? DHGROUP is not a complete DNS domain. It appears your machine is not configured for a DNS environment, and that is bad for Erlang/OTP. But try bilbo@REDACTED On Wed, Jul 04, 2007 at 03:36:47PM +0300, Dmitrii 'Mamut' Dimandt wrote: > Raimo Niskanen wrote: > > Try the same but use the machines actual short hostname. > > If you do not know it, right click on "My Computer", > > choose "Properties", "Computer Name", and compare > > the "Full computer name" with the "Domain". The > > difference should be the short (unqualified) hostname. > > > > > > What do you mean by difference? > If full computer name is turkeyhotels and domain is DHGROUP then the > hostname would be? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From billclem@REDACTED Wed Jul 4 15:56:41 2007 From: billclem@REDACTED (Bill Clementson) Date: Wed, 04 Jul 2007 06:56:41 -0700 Subject: [erlang-questions] emacs / distel problem with dynamic tags References: Message-ID: "Roberto Saccon" writes: > when using "M-.", "M-,", and "M-*" for jumping from call to function > implementation, emacs always asks me for the nodename. Presumably, you're using distel from svn and this issue only occurs when you're using calling erl-find-source with a prefix arg (e.g. - "C-u M-.")? > But I have defined the nodename (of a webapp inside yaws) and I can > reload modules perfectly without emacs asking me each time again for > the nodename. > > So how can I make emacs picking automatically that nodename for the > dynamic tags stuff ? There was a recent distel enhancement (which allows one to select a node name when running many distel commands by calling the command with a prefix arg). This mod also affected the erl-find-source command. I've made a fix for this and you should retrieve the latest svn version of distel (from http://code.google.com/p/distel/) -- Bill Clementson From valentin@REDACTED Wed Jul 4 09:12:22 2007 From: valentin@REDACTED (Valentin Micic) Date: Wed, 4 Jul 2007 09:12:22 +0200 Subject: [erlang-questions] surprising integer (external) encoding References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se><468A35A2.8070605@gmail.com> <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> Message-ID: <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> Observation: term_to_binary( 16#7FFFFFF ) produces <<131,98,7,255,255,255>> however term_to_binary( 16#7FFFFFF ) does *not* produce <<131,98,8,255,255,255>> but: <<131,110,4,0,255,255,255,8>> whish is encoding for big numbers. Out of curisosty: Q1: Why 2^27 values only? It is more intuitive to expect 2^31, and leave only one bit (as opposed to 5) for sign (second complement) encoding. Q2: Big numbers are encoded using little endian encoding, however lengths indicating the number are encoded using big-endian (well, this becomes obvious only for large enough numbers). Any particular reason? Or is it just a question of more Haiku? V. From christophe.romain@REDACTED Thu Jul 5 02:15:27 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Thu, 5 Jul 2007 02:15:27 +0200 Subject: [erlang-questions] CEAN 1.3 is out Message-ID: <4645B4E1-1EF9-4807-948E-B579D740B5B8@process-one.net> done for CEAN 1.3: fixed most of pending issues live upgrade is now working with local version checking (many thanks to Bengt Kleberg) compiler added in developper version, and add erlang/include/ symlinks packages upgrade, and some packages added added armeb port (thanks to Brian Zhou) R11B-4 upgrade for linux for all architectures R11B-5 upgrade for MacOSX,Linux-x86,Windows,SunOS packaged Erlang/OTP for 18 platforms packaged standalone application archives (without any configuration) better yaws integration (thanks to Bogdan Marinescu) better erlyweb integration (thanks to Matthew Elder) improved dependencies runtime_tools added into base archive future version of cean will focus on package improvement, configuration integration. as package upgrade is working, packages will be upgraded more often. patch provided by users will be applyable very quickly. yaws will work "as this" using a default repository. erlyweb as well. applications such as wings will also be working. a matrix showing actual packages status is available here http://cean.process-one.net/matrix/ it will be upgraded as packages status will be well known. the idea is to make CEAN integrate automatic package testing to flag packages as OK or ERROR todo for CEAN 1.4: packages bugfixes and upgrade include ssh for cluster deployment code server patch (kernel/src/code_server.erl) for remote code loading version checking in dependency handler any questions or comment ? From bbmaj7@REDACTED Thu Jul 5 06:18:28 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 5 Jul 2007 14:18:28 +1000 (EST) Subject: [erlang-questions] matching binaries directly into records Message-ID: <3637.41429.qm@web52002.mail.re2.yahoo.com> Couldn't find an answer to this in the archives. I'd like to match a binary directly into a record; eg. syntax something like the following: -record( thing, {first=0, second=0} ). binary_to_thing( Data ) -> <> = Data, R. ---- The above doesn't work, but the required functionality can be achieved by binding to temporaries and then populating R from the temporaries as a second step. My problem is that as the size of the record becomes large there is a lot of clutter associated with the temporary bindings and I'd like to remove it if possible. Will the temporaries will lead to inefficiency; or whether I can expect them to be effectively optimised away? What is the best way to do this conversion from binary to record? -- Rich ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From tobbe@REDACTED Thu Jul 5 07:36:58 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 05 Jul 2007 07:36:58 +0200 Subject: [erlang-questions] matching binaries directly into records In-Reply-To: <3637.41429.qm@web52002.mail.re2.yahoo.com> References: <3637.41429.qm@web52002.mail.re2.yahoo.com> Message-ID: Richard Andrews wrote: > Couldn't find an answer to this in the archives. > > I'd like to match a binary directly into a record; eg. syntax something like > the following: > > -record( thing, {first=0, second=0} ). > > binary_to_thing( Data ) -> > <> = Data, > R. You need to do something like: binary_to_thing(<>) -> #thing{first = First, second = Second}. --Tobbe > > ---- > The above doesn't work, but the required functionality can be achieved by > binding to temporaries and then populating R from the temporaries as a second > step. My problem is that as the size of the record becomes large there is a lot > of clutter associated with the temporary bindings and I'd like to remove it if > possible. > > Will the temporaries will lead to inefficiency; or whether I can expect them to > be effectively optimised away? > > What is the best way to do this conversion from binary to record? > > -- > Rich > > > > ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. > http://au.docs.yahoo.com/mail/unlimitedstorage.html > > > From dmitriid@REDACTED Thu Jul 5 09:12:21 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Thu, 05 Jul 2007 10:12:21 +0300 Subject: [erlang-questions] : : Can't set long node name on windows In-Reply-To: <20070704135520.GA29185@erix.ericsson.se> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> <20070704123759.GA14953@erix.ericsson.se> <468B945F.3050905@gmail.com> <20070704135520.GA29185@erix.ericsson.se> Message-ID: <468C99D5.1020003@gmail.com> Raimo Niskanen wrote: > I rather ment if the full computer name is foo.dom.main.com > the hostname would be foo and the domain dom.main.com. > > If the full computer name is turkeyhotels, try use > node name bilbo@REDACTED > > If the domain is DHGROUP, is that not the workgroup name? > DHGROUP is not a complete DNS domain. It appears your machine > is not configured for a DNS environment, and that is bad > for Erlang/OTP. > > But try bilbo@REDACTED > Tried it. Doesn't work :( When I run "erl -name some_name" on Linux machine I get this: some_name@REDACTED>1> where DHGROUP is our workgroup. I then run "erl -name another_name@REDACTED" on my Windows box and try to call it from Linux: rpc:call(yo@REDACTED,kvs,store, [weather, fine]). =ERROR REPORT==== 5-Jul-2007::10:08:13 === ** System running to use fully qualified hostnames ** ** Hostname turkeyhotels is illegal ** {badrpc,nodedown} :( > It appears your machine > is not configured for a DNS environment, and that is bad > for Erlang/OTP. Hmmm... Whatever shall I do? I was hoping I could develop a distributed system and just run it on a network... No it looks like I need a way to quickly and painlessly configure a system (any system) to work with Erlang/OTP... > > > On Wed, Jul 04, 2007 at 03:36:47PM +0300, Dmitrii 'Mamut' Dimandt wrote: > >> Raimo Niskanen wrote: >> >>> Try the same but use the machines actual short hostname. >>> If you do not know it, right click on "My Computer", >>> choose "Properties", "Computer Name", and compare >>> the "Full computer name" with the "Domain". The >>> difference should be the short (unqualified) hostname. >>> >>> >>> >> What do you mean by difference? >> If full computer name is turkeyhotels and domain is DHGROUP then the >> hostname would be? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Thu Jul 5 09:35:19 2007 From: tony@REDACTED (Tony Rogvall) Date: Thu, 5 Jul 2007 09:35:19 +0200 Subject: [erlang-questions] matching binaries directly into records In-Reply-To: References: <3637.41429.qm@web52002.mail.re2.yahoo.com> Message-ID: But it would be nice to be able to write: -record(thing, { first : 16, second : 16 }). binary_to_thing(Data) -> <> = Data, Thing. Compact and it gives some type info hints too ;-) /Tony On 5 jul 2007, at 07.36, Torbjorn Tornkvist wrote: > Richard Andrews wrote: >> Couldn't find an answer to this in the archives. >> >> I'd like to match a binary directly into a record; eg. syntax >> something like >> the following: >> >> -record( thing, {first=0, second=0} ). >> >> binary_to_thing( Data ) -> >> <> = Data, >> R. > > You need to do something like: > > binary_to_thing(<>) -> > #thing{first = First, second = Second}. > > --Tobbe > >> >> ---- >> The above doesn't work, but the required functionality can be >> achieved by >> binding to temporaries and then populating R from the temporaries >> as a second >> step. My problem is that as the size of the record becomes large >> there is a lot >> of clutter associated with the temporary bindings and I'd like to >> remove it if >> possible. >> >> Will the temporaries will lead to inefficiency; or whether I can >> expect them to >> be effectively optimised away? >> >> What is the best way to do this conversion from binary to record? >> >> -- >> Rich >> >> >> >> >> _____________________________________________________________________ >> _______________ Yahoo!7 Mail has just got even bigger and better >> with unlimited storage on all webmail accounts. >> http://au.docs.yahoo.com/mail/unlimitedstorage.html >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dmitriid@REDACTED Thu Jul 5 09:45:34 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Thu, 05 Jul 2007 10:45:34 +0300 Subject: [erlang-questions] : : [SOLVED] Can't set long node name on windows In-Reply-To: <20070704135520.GA29185@erix.ericsson.se> References: <468B5E55.7080100@gmail.com> <20070704091017.GA18696@erix.ericsson.se> <468B876D.2050107@gmail.com> <20070704123759.GA14953@erix.ericsson.se> <468B945F.3050905@gmail.com> <20070704135520.GA29185@erix.ericsson.se> Message-ID: <468CA19E.5020407@gmail.com> Raimo Niskanen wrote: > I rather ment if the full computer name is foo.dom.main.com > the hostname would be foo and the domain dom.main.com. > > If the full computer name is turkeyhotels, try use > node name bilbo@REDACTED > > If the domain is DHGROUP, is that not the workgroup name? > DHGROUP is not a complete DNS domain. It appears your machine > is not configured for a DNS environment, and that is bad > for Erlang/OTP. > > But try bilbo@REDACTED I should really be careful when reading books :) : "We can also use -sname on two different machines when they are on the same subnet. Using -sname is also the only method that will work if no DNS service is available." Apart from that, Kirill Zaborski suggested that I directly write nodename@REDACTED So I ran erl -name another_name@REDACTED on my Windows box and it was immediately available from my Linux box. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcaoyuan@REDACTED Thu Jul 5 11:37:50 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Thu, 5 Jul 2007 17:37:50 +0800 Subject: [erlang-questions] HTML Entity Refs and xmerl Message-ID: According to http://www.erlang.org/pipermail/erlang-bugs/2007-May/000345.html, currently xmerl_scan only recognizes the very limited set of entity references. In brief, if you try to xmerl:scan xml text that includes standard HTML entity refs, such as nbsp, iexcl, pound, frac14, etc. you'll encounter something like: 16> edoc:file("exprecs.erl"). 2670- fatal: {unknown_entity_ref,nbsp} 2580- fatal: error_scanning_entity_ref exprecs.erl, in module header: at line 28: error in XML parser: {fatal, {error_scanning_entity_ref, {file,file_name_unknown}, {line,86}, {col,18}}}. ** exited: error ** Ulf Wiger said: ... I realize that xmerl can be customized with a rules function which, for example, can handle entity references... So I take a try by writing a piece of code (html_entity_refs.erl) to parse a HTML entity ref DTD file to ets rules, then: xmerl_scan:string(XmlText, [{rules, html_entity_refs:get_xmerl_rules()}]). Yes, this works. But for a 3MB testing file, the parsing took about 30 seconds. How about convert these entity refs to utf-8 chars first, then apply xmerl_scan to it? I wrote another piece of code, and now: xmerl_scan:string(html_entity_refs:decode_for_xml(XmlText)). This time, the decoding+parsing time is about 5 seconds, it's 6 times faster than ets rules solution. The html_entity_refs.erl can be got from: http://caoyuan.googlecode.com/svn/trunk/erlang/html_entity_refs.erl From opfer@REDACTED Thu Jul 5 11:06:17 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Thu, 5 Jul 2007 11:06:17 +0200 Subject: [erlang-questions] Using system's zlib Message-ID: <20070705110617.046eee70@luna.home> Hi, is there an easy way to avoid building against erlang's internal zlib so the one from the system is used? If not, could a simple way be added? V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From opfer@REDACTED Thu Jul 5 11:19:51 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Thu, 5 Jul 2007 11:19:51 +0200 Subject: [erlang-questions] Using system's zlib Message-ID: <20070705111951.2ec4bef8@luna.home> Hi, is there an easy way to avoid building against erlang's internal zlib so the one from the system is used? If not, could a simple way be added? V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From olivier.boudeville@REDACTED Thu Jul 5 12:13:42 2007 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 5 Jul 2007 12:13:42 +0200 Subject: [erlang-questions] Function-related BIFs Message-ID: Hi, is there any way In Erlang to list programatically the functions exported by a given module and/or to resolve a function name (ex : "foobar/1") into its corresponding Fun object (a kind of reversed erlang:fun_to_list/1) ? I did not find any BIF for that. That would be very useful to implement introspection-like features. Thanks in advance for any hint, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau C-052 Office : 33 1 47 65 59 58 / Mobile : 33 6 16 83 37 22 / Fax : 33 1 47 65 34 24 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Jul 5 12:21:03 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 05 Jul 2007 12:21:03 +0200 Subject: [erlang-questions] Function-related BIFs In-Reply-To: References: Message-ID: <468CC60F.30504@ericsson.com> On 2007-07-05 12:13, Olivier BOUDEVILLE wrote: > > Hi, > > is there any way In Erlang to list programatically the functions > exported by a given module and/or to resolve a function name (ex : the first part is easy: :module_info(exports). bengt -- Those were the days... 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 vpkaihla@REDACTED Thu Jul 5 13:09:59 2007 From: vpkaihla@REDACTED (Vesa Kaihlavirta) Date: Thu, 5 Jul 2007 04:09:59 -0700 Subject: [erlang-questions] CEAN 1.3 is out In-Reply-To: <4645B4E1-1EF9-4807-948E-B579D740B5B8@process-one.net> References: <4645B4E1-1EF9-4807-948E-B579D740B5B8@process-one.net> Message-ID: <25acdd550707050409q6b205fe3s5d02a83c2d1f140@mail.gmail.com> On 7/4/07, Christophe Romain wrote: > > done for CEAN 1.3: Hi. I just installed cean-otp_R11B_linux-amd64.tar.gz, for the first time. There are a couple of glitches... first of all, the start.sh script doesn't work on amd64, but that's fixed easily by making the arch detection thing output amd64 instead of x86. I.e. arch() { case `uname -m` in i[3456]86) echo x86 ;; i86pc) echo x86 ;; x86) echo x86 ;; x86_64) echo x86 ;; # amd64 ... Change that last line. I suppose you knew about this already, given the comment. The next weird thing concerns upgrades inside the shell. For example: vegai@REDACTED:~/cean/R11B$ ./start.sh Erlang (BEAM) emulator version 5.5.4 [source] [64-bit] [async-threads:0] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) 1> cean:upgrade(os_mon). + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> ok 2> cean:upgrade(os_mon). + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> ok 3> cean:upgrade(cean). cean: no newer package available ok Am I reading this right? Shouldn't os_mon be properly upgraded after the first command, and shouldn't therefore the second command output "os_mon: no newer package available"? What does cean:upgrade/1 actually do, or should do? --vk fixed most of pending issues > live upgrade is now working with local version checking (many thanks > to Bengt Kleberg) > compiler added in developper version, and add erlang/include/ > symlinks > packages upgrade, and some packages added > added armeb port (thanks to Brian Zhou) > R11B-4 upgrade for linux for all architectures > R11B-5 upgrade for MacOSX,Linux-x86,Windows,SunOS > packaged Erlang/OTP for 18 platforms > packaged standalone application archives (without any configuration) > better yaws integration (thanks to Bogdan Marinescu) > better erlyweb integration (thanks to Matthew Elder) > improved dependencies > runtime_tools added into base archive > > future version of cean will focus on package improvement, > configuration integration. > as package upgrade is working, packages will be upgraded more often. > patch provided by users will be applyable very quickly. > yaws will work "as this" using a default repository. erlyweb as well. > applications such as wings will also be working. > > a matrix showing actual packages status is available here > http://cean.process-one.net/matrix/ > it will be upgraded as packages status will be well known. > the idea is to make CEAN integrate automatic package testing to flag > packages as OK or ERROR > > todo for CEAN 1.4: > packages bugfixes and upgrade > include ssh for cluster deployment > code server patch (kernel/src/code_server.erl) for remote code loading > version checking in dependency handler > > > any questions or comment ? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- --vk -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Jul 5 13:39:26 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 05 Jul 2007 13:39:26 +0200 Subject: [erlang-questions] CEAN 1.3 is out In-Reply-To: <25acdd550707050409q6b205fe3s5d02a83c2d1f140@mail.gmail.com> References: <4645B4E1-1EF9-4807-948E-B579D740B5B8@process-one.net> <25acdd550707050409q6b205fe3s5d02a83c2d1f140@mail.gmail.com> Message-ID: <468CD86E.1090009@ericsson.com> On 2007-07-05 13:09, Vesa Kaihlavirta wrote: ...deleted > > The next weird thing concerns upgrades inside the shell. For example: > vegai@REDACTED:~/cean/R11B$ ./start.sh > Erlang (BEAM) emulator version 5.5.4 [source] [64-bit] [async-threads:0] > [kernel-poll:false] > > Eshell V5.5.4 (abort with ^G) > 1> cean:upgrade(os_mon). > + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> > ok > 2> cean:upgrade(os_mon). > + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> > ok > 3> cean:upgrade(cean). > cean: no newer package available > ok > > Am I reading this right? Shouldn't os_mon be properly upgraded after the > first command, and > shouldn't therefore the second command output "os_mon: no newer package > available"? What does > cean:upgrade/1 actually do, or should do? cean:upgrade/1 should check if something newer exists, and if it does install it. it should not be possible to upgrade the same package twice like you managed. this is my problem and i will check it after work today. please be patient. bengt -- Those were the days... 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 erlanging@REDACTED Thu Jul 5 05:57:50 2007 From: erlanging@REDACTED (Jeremy Chow) Date: Thu, 5 Jul 2007 11:57:50 +0800 Subject: [erlang-questions] ssl failed during the time shaking hands In-Reply-To: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> References: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> Message-ID: <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> hi list, I've tried to do some tests for understanding the communications of two nodes through the ssl protocol in erlang. I've created a boot script for this case and two certificates following the otp reference,one was ssl_server.pem, the other was ssl_client.pem. Then I used command-line to create two nodes -- x@REDACTED and y@REDACTED -- as follows: # erl -boot start_ssl -proto_dist inet_ssl -name x@REDACTED -ssl_dist_opt client_certfile "ssl_client" -ssl_dist_opt server_certfile "ssl_server.pem" -setcookie 123456 # erl -boot start_ssl -proto_dist inet_ssl -name y@REDACTED -ssl_dist_opt client_certfile "ssl_client.pem" -ssl_dist_opt server_certfile "ssl_server.pem" -setcookie 123456 Everything is okay at that time, I 've seen the erlang prompts as well. But when I tried to ping one node from the other one, it failed with a message pang. (y@REDACTED)1> net_adm:ping('x@REDACTED'). pang By analysing it with shell commands netstat and strace, It appears that the ssl ping failed during the time shaking hands. The file descriptor which was used to receives data from the other node hasnot been added into the pollfds. this a fragment of the strace result: accept(5, {sa_family=AF_INET, sin_port=htons(13198), sin_addr=inet_addr("192.168.0.97")}, [16]) = 7 fcntl64(7, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(7, F_SETFL, O_RDWR|O_NONBLOCK) = 0 write(2, "fuck\n", 5) = 5 write(1, "\0\0\0\t", 4) = 4 write(1, "\f\0\0\0\5\0\0\0\7", 9) = 9 poll([{fd=4, events=POLLIN|POLLRDNORM}, {fd=0, events=POLLIN|POLLRDNORM, revents=POLLIN|POLLRDNORM}], 2, 2000) = 1 time(NULL) = 1183526380 read(0, "\0\0\0\6", 4) = 4 read(0, "\n\0\0\0\5\0", 6) = 6 poll([{fd=4, events=POLLIN|POLLRDNORM}, {fd=0, events=POLLIN|POLLRDNORM}, {fd=5, events=POLLIN|POLLRDNORM}], 3, 2000) = 0 time(NULL) = 1183526382 and below is the result of netstat: # netstat --tcp -n Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State ...(omit) tcp 0 0 192.168.0.98:31719 221.174.21.84:8080 ESTABLISHED tcp 0 0 192.168.0.98:31728 221.174.21.84:8080 ESTABLISHED tcp 142 0 192.168.0.98:25233 192.168.0.97:13198 ESTABLISHED tcp 0 0 ::ffff:192.168.0.98:40272 ::ffff:192.168.0.100:3306 ESTABLISHED tcp 0 0 ::ffff:127.0.0.1:8052 ::ffff:127.0.0.1:59274 ESTABLISHED tcp 0 264 ::ffff:192.168.0.98:22 ::ffff:192.168.0.217:3103 ESTABLISHED Apparently, there are still 142 bytes data stayed at the receive queue. The receiver terminal program hasnot take any data from that queue beacuse the right file descriptor has not been added yet. Who can explain that phenomenon and give me a solution? Thx, Jeremy From olivier.boudeville@REDACTED Thu Jul 5 13:43:23 2007 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 5 Jul 2007 13:43:23 +0200 Subject: [erlang-questions] =?iso-8859-1?q?R=E9f=2E_=3A_Re=3A__Function-re?= =?iso-8859-1?q?lated_BIFs?= Message-ID: Thanks for your help, it does the trick for me : with this (rather well-hidden) 'module_info' function, I can collect the atoms designating exported functions, which I can then use, with the 'apply' BIF, to execute these functions. Hence a kind of reflection can be achieved this way. Thanks again, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau C-052 Office : 33 1 47 65 59 58 / Mobile : 33 6 16 83 37 22 / Fax : 33 1 47 65 34 24 erlang-questions-bounces@REDACTED 05/07/2007 12:21 Pour : erlang-questions@REDACTED cc : (ccc : Olivier BOUDEVILLE/IMA/DER/EDFGDF/FR) Objet : Re: [erlang-questions] Function-related BIFs On 2007-07-05 12:13, Olivier BOUDEVILLE wrote: > > Hi, > > is there any way In Erlang to list programatically the functions > exported by a given module and/or to resolve a function name (ex : the first part is easy: :module_info(exports). bengt -- Those were the days... 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." _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Thu Jul 5 14:41:00 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 05 Jul 2007 14:41:00 +0200 Subject: [erlang-questions] Comprehensive comprehensions Message-ID: I wonder if any of the ideas in this paper could be incorporated with qlc ? http://research.microsoft.com/%7Esimonpj/papers/list%2Dcomp/ The Abstract follows... Cheers, Tobbe ---------------------------------------------------------------------- Abstract We propose an extension to list comprehensions that makes it easy to express the kind of queries one would write in SQL using ORDER BY, GROUP BY, and LIMIT. Our extension adds expressive power to comprehensions, and generalises the SQL constructs that inspired it. Moreover, it is easy to implement, using simple desugaring rules. For example, consider this SQL query SELECT dept, SUM(salary) FROM employees GROUP BY dept ORDER BY SUM(salary) DESCENDING LIMIT 5 The GROUP BY clause groups records together; the ORDER BY sorts the departments in order of salary bill; and the LIMIT clause picks just the first five records. This support for grouping and sorting is extremely useful in practice, but is not available in list comprehensions. In this paper we propose an extension to list comprehensions that makes it easy to express the kind of queries one would write in SQL using ORDER BY, GROUP BY, and LIMIT. Here, for example, is how the above SQL query would be rendered in our extension. [ (the dept, sum salary) | (name, dept, salary) <- employees , group by dept , order by Down (sum salary) , order using take 5 ] Moreover, our extensions are significantly more general than SQL's facilities. ------------------------------------------------------------------- From bertil.karlsson@REDACTED Thu Jul 5 14:56:22 2007 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Thu, 05 Jul 2007 14:56:22 +0200 Subject: [erlang-questions] HTML Entity Refs and xmerl In-Reply-To: References: Message-ID: <468CEA76.2000107@ericsson.com> Hi, whatever entity references you depend on when parsing an XML document with xmerl you have to provide a DTD with those entities defined. However I think the time difference in your example is unacceptable and maybe indicating a bug in xmerl. I will take a closer look at this. /Bertil Caoyuan wrote: > According to http://www.erlang.org/pipermail/erlang-bugs/2007-May/000345.html, > currently xmerl_scan only recognizes the very limited set of entity > references. In brief, if you try to xmerl:scan xml text that includes > standard HTML entity refs, such as nbsp, iexcl, pound, frac14, etc. > you'll encounter something like: > > 16> edoc:file("exprecs.erl"). > 2670- fatal: {unknown_entity_ref,nbsp} > 2580- fatal: error_scanning_entity_ref > exprecs.erl, in module header: at line 28: error in XML parser: {fatal, > {error_scanning_entity_ref, > {file,file_name_unknown}, > {line,86}, > {col,18}}}. > ** exited: error ** > > Ulf Wiger said: > ... I realize that xmerl can be customized with a rules function > which, for example, can handle entity references... > > So I take a try by writing a piece of code (html_entity_refs.erl) to > parse a HTML entity ref DTD file to ets rules, then: > > xmerl_scan:string(XmlText, [{rules, html_entity_refs:get_xmerl_rules()}]). > > Yes, this works. But for a 3MB testing file, the parsing took about 30 seconds. > > How about convert these entity refs to utf-8 chars first, then apply > xmerl_scan to it? > I wrote another piece of code, and now: > > xmerl_scan:string(html_entity_refs:decode_for_xml(XmlText)). > > This time, the decoding+parsing time is about 5 seconds, it's 6 times > faster than ets rules solution. > > The html_entity_refs.erl can be got from: > http://caoyuan.googlecode.com/svn/trunk/erlang/html_entity_refs.erl > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From luna@REDACTED Thu Jul 5 16:14:07 2007 From: luna@REDACTED (Daniel Luna) Date: Thu, 5 Jul 2007 16:14:07 +0200 (CEST) Subject: [erlang-questions] surprising integer (external) encoding In-Reply-To: <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se><468A35A2.8070605@gmail.com> <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> Message-ID: On Wed, 4 Jul 2007, Valentin Micic wrote: > Q1: Why 2^27 values only? It is more intuitive to expect 2^31, and leave > only one bit (as opposed to 5) for sign (second complement) encoding. 4 bits for the type tag. 1 bit for sign. That leaves 27 bits (on a 32 bit machine) for the number. (On a 64 bit machine, you can have 59 bits in a fixnum.) It's the cost of having a dynamically typed language. /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 nm@REDACTED Thu Jul 5 16:30:26 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 05 Jul 2007 19:30:26 +0500 Subject: [erlang-questions] Using system's zlib In-Reply-To: <20070705111951.2ec4bef8@luna.home> References: <20070705111951.2ec4bef8@luna.home> Message-ID: <468D0082.4060908@web.am> Christian Faulhammer wrote: > Hi, > > is there an easy way to avoid building against erlang's internal zlib > so the one from the system is used? If not, could a simple way be > added? > > V-Li > AFAIK no, because erlang's zlib is heavily patched :) /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From joelr1@REDACTED Thu Jul 5 16:32:38 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 5 Jul 2007 15:32:38 +0100 Subject: [erlang-questions] Order of Mnesia table events Message-ID: Does the order of Mnesia table events strictly correspond to the order they happened in a transaction? If I have transaction T1 that does write A, delete B, write C, can I reply on getting A, B, C, in that order? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From pst@REDACTED Thu Jul 5 17:20:34 2007 From: pst@REDACTED (Peter Steiner) Date: Thu, 05 Jul 2007 17:20:34 +0200 Subject: [erlang-questions] "epmd -daemon" on windows Message-ID: <468D0C42.6030404@pnetz.org> hi, i have developed a C-node as windows service, which is the first component of an erlang environment starting up. because of that, it has to initialize epmd, which is not running when the service is started. unfortunately, on my system "epmd -daemon" is not working at all - no epmd process is living after running this command. is there a way to enable epmd logging on windows, so that i might analyze this problem? what might be the reason that "epmd -daemon" does not work - neither being run from cmd with an administrative user, nor being forked from an service running as LOCALSYSTEM? is there another way, e.g. through the C API, to start epmd from a C node? regards, peter. From joelr1@REDACTED Thu Jul 5 16:20:52 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 5 Jul 2007 15:20:52 +0100 Subject: [erlang-questions] Mnesia table events: Issues after transaction completes? Message-ID: <01BBE7EF-A6C1-482D-A89E-788D2381A1C0@gmail.com> Folks, When I subscribe to Mnesia events do I get them once a transaction goes through? Do I get multiple events if a transaction fails after X writes out of Y and is then reissued? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From pat.eyler@REDACTED Thu Jul 5 17:22:43 2007 From: pat.eyler@REDACTED (pat eyler) Date: Thu, 5 Jul 2007 09:22:43 -0600 Subject: [erlang-questions] Provo Erlounge, July 10th Message-ID: <6fd0654b0707050822i71983ccu5d4ba94f284b2e7a@mail.gmail.com> We'll be meeting at the Novell OSTC in Provo, UT at 7PM to talk about, hack with, and generally have a good time with Erlang. If you're in the area, and have an interest in Erlang we'll hope to see you there. -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From valentin@REDACTED Thu Jul 5 21:30:47 2007 From: valentin@REDACTED (Valentin Micic) Date: Thu, 5 Jul 2007 21:30:47 +0200 Subject: [erlang-questions] surprising integer (external) encoding References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se><468A35A2.8070605@gmail.com> <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> Message-ID: <001701c7bf3b$012a3ef0$6401a8c0@moneymaker2> > 4 bits for the type tag. > 1 bit for sign. You're talking about *internal* term presentation, right? Because this explanation does not hold water for external format, where things are quite different. For example: (A) term_to_binary( 2 ) produces: <<131, 97, 2>> where: - 131 is a *magic* number - 97 represents external tag for one-byte integer - 2 represents the integer value, encoded in a single byte. According to your explanation one would not be able to encode single integer values higer that 2^3, and yet, (B) term_to_binary( 255 ) produces: <<131, 97, 255>> To make things even more confusing, the second complement encoding is using always 32, i.e. (C) term_to_binary( -2 ) produces: <<131,98,255,255,255,254>> - 131 is a *magic* number - 98 represents external tag for four-byte integer (actually, 2^27) - <<255,255,255,254>> -- second complement encoding for -2. How does "4 bits for tag and 1 bit for sign" fit this observation? V. PS Thanks for the reply. From andy.sloane@REDACTED Thu Jul 5 23:59:16 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Thu, 5 Jul 2007 16:59:16 -0500 Subject: [erlang-questions] surprising integer (external) encoding In-Reply-To: <001701c7bf3b$012a3ef0$6401a8c0@moneymaker2> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> <468A35A2.8070605@gmail.com> <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> <001701c7bf3b$012a3ef0$6401a8c0@moneymaker2> Message-ID: <5d34bb3f0707051459k59c595b2h39c539d29fafb545@mail.gmail.com> On 7/5/07, Valentin Micic wrote: > To make things even more confusing, the second complement encoding is using > always 32, i.e. > > (C) term_to_binary( -2 ) produces: <<131,98,255,255,255,254>> > > - 131 is a *magic* number > - 98 represents external tag for four-byte integer (actually, 2^27) > - <<255,255,255,254>> -- second complement encoding for -2. According to the code in erts/emulator/beam/external.c: /* * For backward compatibility reasons, only encode integers that * fit in 28 bits (signed) using INTEGER_EXT. */ #define IS_SSMALL28(x) (((Uint) (((x) >> (28-1)) + 1)) < 2) Since (x) here isn't cast to an unsigned, this check doesn't work for negative numbers. So it's apparently the combination of historical reasons and a bug. I have no idea what the historical reasons are, but I found your observation interesting. -Andy From andy.sloane@REDACTED Fri Jul 6 00:08:25 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Thu, 5 Jul 2007 17:08:25 -0500 Subject: [erlang-questions] surprising integer (external) encoding In-Reply-To: <5d34bb3f0707051459k59c595b2h39c539d29fafb545@mail.gmail.com> References: <6616D98C65DD514BA2E1DDC5F9223155023C29C1@esealmw115.eemea.ericsson.se> <468A35A2.8070605@gmail.com> <8209f740707030649g689a8171neaccf1cc8ec5ecb0@mail.gmail.com> <000001c7be68$bbcf4df0$6401a8c0@moneymaker2> <001701c7bf3b$012a3ef0$6401a8c0@moneymaker2> <5d34bb3f0707051459k59c595b2h39c539d29fafb545@mail.gmail.com> Message-ID: <5d34bb3f0707051508g1b4252f8j2a8b208d7807d816@mail.gmail.com> > So it's apparently the combination of historical reasons and a bug. I take that back; it works as advertised, I guess. Anyway, yes, it seems that the external format promotes to bigints too early presumably because some earlier version didn't double-check the size of the number when reading it. -Andy From andy.sloane@REDACTED Fri Jul 6 01:06:18 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Thu, 5 Jul 2007 18:06:18 -0500 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes Message-ID: <5d34bb3f0707051606t5319113bib034b3cb52df8364@mail.gmail.com> Hello, We recently integrated Erlang into our MMO game[1]'s cluster, and we're having a couple problems, but I want to address them one at a time. There are several simulation processes which, as they are needed, fork() on any of several machines and subsequently connect to beam (currently running only on one machine) as a C node, using erl_interface, with an sname of "cSSSS@REDACTED" where S is the integer sectorid and voc1-X is the machine it runs on, obviously. When the simulation of that sector of space is no longer needed, the process disconnects and dies. This works fine, except occasionally a process will fail to connect on our production cluster. It then aggressively retries every time an erl_send() is attempted, and after several consecutive failures will eventually succeed in connecting. We are logging nodeups and nodedowns to ensure that as sectors start up and shut down, they are properly connecting and disconnecting; my initial thought was that maybe a sector is trying to connect as "c200", for instance, but that name is taken. This doesn't appear to be the case. A node that has been down for several hours can still fail to connect. But certain sectors tend to fail more often, or at least it seems that way to me at a glance. To get more info, I increased ei_tracelevel during the erl_connect() call. This is what I see when there is a failure: ei_xconnect: Wed Jul 4 10:25:04 2007: -> CONNECT attempt to connect to yt ei_epmd_r4_port: Wed Jul 4 10:25:04 2007: -> PORT2_REQ alive=yt ip=204.11.209.42 ei_epmd_r4_port: Wed Jul 4 10:25:04 2007: <- PORT2_RESP result=0 (ok) ei_epmd_r4_port: Wed Jul 4 10:25:04 2007: port=4000 ntype=77 proto=0 dist-high=5 dist-low=5 ei_xconnect: Wed Jul 4 10:25:04 2007: -> CONNECT connected to remote ei_xconnect: Wed Jul 4 10:25:04 2007: -> CONNECT failed erl_connect: Input/output error So it's obviously making the TCP connection, getting through send_name without any errors, and then recv_status is reading a response other than "sok" but, unhelpfully, doesn't tell me what the response actually was and just bombs with EIO. This is what led me to believe beam thinks there's something wrong with the sname. The server is using R11B2 on FreeBSD, built from /usr/ports. The clients are Linux using the erl_interface library 3.5.5.3 from R11B3 currently. (The changelog between 3.5.5.2 and 3.5.5.3 seems like it wouldn't make any difference here). I'm going to patch ei_connect.c to log the actual response in recv_status to get some insight, but in the meantime I would appreciate any advice. In particular: is there any way to get more verbose information from erlang of any attempts to connect? Something like net_kernel:monitor_nodes but more low-level? I intend to upgrade both client and server to R11B5 at some point in the near future, but I don't believe that that will solve this issue, given the changelogs. [1] www.vendetta-online.com -Andy From jeffm@REDACTED Fri Jul 6 01:59:19 2007 From: jeffm@REDACTED (jm) Date: Fri, 06 Jul 2007 09:59:19 +1000 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <5d34bb3f0707051606t5319113bib034b3cb52df8364@mail.gmail.com> References: <5d34bb3f0707051606t5319113bib034b3cb52df8364@mail.gmail.com> Message-ID: <468D85D7.70401@ghostgun.com> Andy Sloane wrote: > So it's obviously making the TCP connection, getting through send_name > without any errors, and then recv_status is reading a response other > than "sok" but, unhelpfully, doesn't tell me what the response > actually was and just bombs with EIO. This is what led me to believe > beam thinks there's something wrong with the sname. > I'd suggest reading someone else's suggests first :-), but if really get stuck try, * Can you add a net_adm:ping/1 to the c-node and get it to periodically pole the server so you can see how often the problem occurs? This may help you see correlations with other events(eg load, open sockets, etc). * Is the problem isolated to erlang or other protocol affected? * Double checking that the switches between the two machines are locks at the correct speed, eg 100Mps full-duplex. * That the switches aren't overload in someway. I have not had this particular problem but have had cases where upgrading a switch did wonders. * Check the interface stats on the switch and computers to see if there are any errors CRC, frame errors, etc. * Check MTU. Strange I know but has been known to cause problems. Mostly on WAN links though. * Check that subnets/netmask/broadcast addresses agree. * Get Ethereal ( http://www.ethereal.com/ ) and mirror the ports of interest to another port on the switch. Plug a laptop with ethereal on it in and see what is actually on the network. * Check and replace cables if your seeing errors on the interfaces. I now this sounds like over kill and really basic stuff plus I don't know how much access you have to you own servers and network, but if the lower layer aren't working the higher layers can't. As I said see what other people on the list have to say. The above is more a set of random thought of general things to try. Jeff. From opfer@REDACTED Fri Jul 6 07:57:18 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Fri, 6 Jul 2007 07:57:18 +0200 Subject: [erlang-questions] Using system's zlib In-Reply-To: <468D0082.4060908@web.am> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> Message-ID: <20070706075718.52519b53@luna.home> Gaspar Chilingarov : > Christian Faulhammer wrote: > > is there an easy way to avoid building against erlang's internal > > zlib so the one from the system is used? If not, could a simple > > way be added? > AFAIK no, because erlang's zlib is heavily patched :) Doh. I don't really like that...is there any chance that one day erlang can use vanilla zlib? How heavy are the patches? Could zlib upstream integrate them? V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From valentin@REDACTED Fri Jul 6 08:21:02 2007 From: valentin@REDACTED (Valentin Micic) Date: Fri, 6 Jul 2007 08:21:02 +0200 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes References: <5d34bb3f0707051606t5319113bib034b3cb52df8364@mail.gmail.com> Message-ID: <002a01c7bf95$d64002a0$6401a8c0@moneymaker2> I had a situation where erlang listener on a particular node would refuse any new, whilst maintaining existing connections. How did we fix that... Well, we've recompiled the ERTS for that particular OS patch level, and I do not recall having such a problem ever since. In other words, it might be that you're looking for a problem/solution in a wrong place. The question you should ask: does the problem always occurs on a particular server. If so -- find what is the difference (OS patch level) between this server and others, and if there is any, verify that the run-time (ERTS) has been build for that particular machine. * * * > The server is using R11B2 on FreeBSD, built from /usr/ports. > > The clients are Linux using the erl_interface library 3.5.5.3 from > R11B3 currently. (The changelog between 3.5.5.2 and 3.5.5.3 seems > like it wouldn't make any difference here). > This is a brave assumption, and occasionally a wrong one... I suggest that you do recompile & re-link using 3.5.5.3 if your target is R11B3, if nothing else, just to eliminate this as a potential cause. V. From bengt.kleberg@REDACTED Fri Jul 6 09:02:35 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 06 Jul 2007 09:02:35 +0200 Subject: [erlang-questions] CEAN 1.3 is out In-Reply-To: <25acdd550707050409q6b205fe3s5d02a83c2d1f140@mail.gmail.com> References: <4645B4E1-1EF9-4807-948E-B579D740B5B8@process-one.net> <25acdd550707050409q6b205fe3s5d02a83c2d1f140@mail.gmail.com> Message-ID: <468DE90B.8070603@ericsson.com> On 2007-07-05 13:09, Vesa Kaihlavirta wrote: ...deleted > 1> cean:upgrade(os_mon). > + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> > ok > 2> cean:upgrade(os_mon). > + os_mon md5=<<23,146,73,183,178,80,252,187,133,113,44,5,178,69,231,100>> > ok > 3> cean:upgrade(cean). > cean: no newer package available > ok > > Am I reading this right? Shouldn't os_mon be properly upgraded after the > first command, and > shouldn't therefore the second command output "os_mon: no newer package > available"? What does greetings, i am unfortunately unable to reproduce this bug. can you get it to appear again? 12> cean:is_installed(os_mon). false 13> cean:upgrade(os_mon). + os_mon md5=<<116,142,117,173,25,108,105,195,9,22,132,13,100,171,37,122>> ok 14> cean:upgrade(os_mon). os_mon: no newer package available ok however, i have a question. should upgrade only upgrade, or is it ok that upgrade installs something that you do not have already? bengt -- Those were the days... 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 nm@REDACTED Fri Jul 6 09:04:11 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Fri, 06 Jul 2007 12:04:11 +0500 Subject: [erlang-questions] Using system's zlib In-Reply-To: <20070706075718.52519b53@luna.home> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> Message-ID: <468DE96B.2030703@web.am> Christian Faulhammer wrote: > Gaspar Chilingarov : > >> Christian Faulhammer wrote: >>> is there an easy way to avoid building against erlang's internal >>> zlib so the one from the system is used? If not, could a simple >>> way be added? >> AFAIK no, because erlang's zlib is heavily patched :) > > Doh. I don't really like that...is there any chance that one day > erlang can use vanilla zlib? How heavy are the patches? Could zlib > upstream integrate them? > > V-Li > at current moment erlang uses zlib v. 1.2.3, which is the latest according to zlib's official site. About patches -- it took me about 1-2 day to merge in new version of zlib to erlang sources :) In other hand -- what's the reason to include system zlib, if now it's shipped with latest version of zlib? /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From matthias@REDACTED Fri Jul 6 09:37:13 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 6 Jul 2007 09:37:13 +0200 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <468D85D7.70401@ghostgun.com> References: <5d34bb3f0707051606t5319113bib034b3cb52df8364@mail.gmail.com> <468D85D7.70401@ghostgun.com> Message-ID: <18061.61737.762910.769723@antilipe.corelatus.se> jm writes: > * Double checking that the switches between the two machines are locks > at the correct speed, eg 100Mps full-duplex. This is good advice for people who know what they're doing. But it's prone to misinterpretation by gefingerpokers. Verifying that the interfaces are running as expected, e.g. that both ends have the same idea about what they're doing, is good. Manually meddling with the settings is trouble prone. The root problem is that IEEE 802.3:2000 autonegotiation and manual configuration do not play nicely together. There are three main cases: 1. Both ethernet interfaces (e.g. your server and your switch) use autonegotiation). No problem. 2. Both interfaces manually configured to the same settings. No problem. 3. One interface is manually configured to 100Mbit/s full duplex and the other to autonegotiate. This is bad. In the third case, the autonegotiating end is required to select 100Mbit/s _half_ duplex. But other end is using full duplex. The autonegotiating end will now get _late_ collisions, which will cause packets to get lost, which causes TCP to behave erratically. Matthias From joelr1@REDACTED Fri Jul 6 11:57:13 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 6 Jul 2007 10:57:13 +0100 Subject: [erlang-questions] How do Mnesia commits and rollbacks work? Message-ID: <9BC822D6-89AB-4560-A405-FE477B549221@gmail.com> Folks, Does anyone know the exact details of how Mnesia commits and rolls back? Does it somehow figure out the locks, writes to temp tables and then commits the whole transaction once to the underlying ets and dets tables? Does it write to ets and dets multiple times and knows how to roll back the changes? The reason I ask is that if the underlying table is Amazon S3 or any other backend that has no roll back functionality then Mnesia may be writing each time a transaction fails and is restarted. Imagine that I'm trying to give employees a raise and the transaction first fetches from the backend and then updates. Suppose I'm updating a group of employees in the same transaction. I'm specially wary of the situation where half of the raises may go through to S3 and then would be repeated once the transaction fails. Multiple raises! Oh, /management/ horror! Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From shehan@REDACTED Fri Jul 6 13:23:45 2007 From: shehan@REDACTED (shehan) Date: Fri, 6 Jul 2007 16:53:45 +0530 Subject: [erlang-questions] mnesia database usage Message-ID: <002301c7bfc0$2179b980$2f0710ac@wavenet.lk> Hi all, I want to use mnesia as alternative to GB trees. i.e. So how to use mnesia as fast as GB-tree ?? Basically I want to store data in ram copies. Also I want to avoid write data to hard disk when saving in mnesia. Hope your feedback regarding this. BR, Shehan -------------- next part -------------- An HTML attachment was scrubbed... URL: From bbmaj7@REDACTED Fri Jul 6 13:07:29 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Fri, 6 Jul 2007 21:07:29 +1000 (EST) Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <18061.61737.762910.769723@antilipe.corelatus.se> Message-ID: <944000.17993.qm@web52009.mail.re2.yahoo.com> --- Matthias Lang wrote: > > * Double checking that the switches between the two machines are locks > > at the correct speed, eg 100Mps full-duplex. > > Verifying that the interfaces are running as expected, e.g. that both > ends have the same idea about what they're doing, is good. TCP should take care of collisions and it is already established that data is being exchanged between the two hosts as TCP connect succeeds which requires SYN, SYN-ACK, ACK. Ethernet is obviously OK. I would suggest 1) attach strace - you get a mountain of data but you can see what your EIO is at the socket level. 2) tcpdump - try and get packet trace of the connection; you can use "tcpdump -w -X -s0 ..." and just log everything and post-process it later. It could be a firewall or NAT issue; I've seen stateful firewalls get confused and block connections for a long time. It is important to find out what is happening around the connection retries ( I'm assuming this means making new TCP connections). I think packet logs are your most important tool. Maybe you have an intermittent IP address conflict. It might be another host outside the client and server which is causing the problem. Might not even be connected to an erlang node - of course the response won't make sense then. You'll slap yourself on the forehead when you see it. Send instant messages to your online friends http://au.messenger.yahoo.com From casper2000a@REDACTED Fri Jul 6 14:13:09 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 6 Jul 2007 17:43:09 +0530 Subject: [erlang-questions] Priority queue In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155023244ED@esealmw115.eemea.ericsson.se> Message-ID: <20070706121310.CA67019DC451@mail.wavenet.lk> How to handle Priority Queues between processes, while keeping efficient message retrieval? BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) Sent: Thursday, June 28, 2007 2:17 AM To: Yerl; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue You can use a gb_trees structure: in(Item, Prio, Q) -> gb_trees:insert({Prio,now()}, Item, Q). out(Q) -> gb_trees:take_smallest(Q). peek(Q) -> gb_trees:smallest(Q). The order will be FIFO. If you want LIFO, you could negate the Prio value and take_largest instead. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl > Sent: den 27 juni 2007 20:56 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Priority queue > > Hi Folks! > > I'm looking for a robust implementation of "Priority queue" > (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. > > Any pointer? > > cheers > Y. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dmercer@REDACTED Fri Jul 6 15:37:18 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 6 Jul 2007 08:37:18 -0500 Subject: [erlang-questions] Intermittent failures connecting C hiddennodes In-Reply-To: <944000.17993.qm@web52009.mail.re2.yahoo.com> References: <18061.61737.762910.769723@antilipe.corelatus.se> <944000.17993.qm@web52009.mail.re2.yahoo.com> Message-ID: <006901c7bfd2$c5ff2aa0$891ea8c0@SSI.CORP> Richard Andrews wrote: > It could be a firewall or NAT issue; I've seen stateful firewalls get confused > and block connections for a long time. This indeed has happened to me, and it is quite frustrating and difficult to detect for application-level software developers like myself. I am no network expert by any extent of the imagination, but I have learned a lot about TCP just because I've had to prove to our network services team that problems are network issues rather than application. In a recent case (a few weeks ago), two separate networks were joined by a firewall, but to me they appeared as one network, so I was not even aware that there was a firewall in between. Anyway, the firewall didn't really like long periods of inactivity on a TCP connection and would cause errors and then block future connections for some reason. I don't know the specifics, I only know that once one of the network guys figured it out, it magically fixed itself. David From dmercer@REDACTED Fri Jul 6 15:39:18 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 6 Jul 2007 08:39:18 -0500 Subject: [erlang-questions] Priority queue In-Reply-To: <20070706121310.CA67019DC451@mail.wavenet.lk> References: <6616D98C65DD514BA2E1DDC5F9223155023244ED@esealmw115.eemea.ericsson.se> <20070706121310.CA67019DC451@mail.wavenet.lk> Message-ID: <006a01c7bfd3$0d7710a0$891ea8c0@SSI.CORP> What was wrong with Mr. Wiger's solution? I thought his was quite good (and I filed it away in my brain for future use). David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Friday, July 06, 2007 07:13 To: 'Ulf Wiger (TN/EAB)'; 'Yerl'; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue How to handle Priority Queues between processes, while keeping efficient message retrieval? BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) Sent: Thursday, June 28, 2007 2:17 AM To: Yerl; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue You can use a gb_trees structure: in(Item, Prio, Q) -> gb_trees:insert({Prio,now()}, Item, Q). out(Q) -> gb_trees:take_smallest(Q). peek(Q) -> gb_trees:smallest(Q). The order will be FIFO. If you want LIFO, you could negate the Prio value and take_largest instead. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl > Sent: den 27 juni 2007 20:56 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Priority queue > > Hi Folks! > > I'm looking for a robust implementation of "Priority queue" > (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. > > Any pointer? > > cheers > Y. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From yerl@REDACTED Fri Jul 6 15:11:43 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 6 Jul 2007 15:11:43 +0200 Subject: [erlang-questions] Priority queue Message-ID: As pointed by Ulf for priority queues, just use "gb_trees". What do you mean by "efficient message retrieval" ? Explain further your problem. cheers Y. Explain further your problem? What do you want to ----Message d'origine---- >De: "Eranga Udesh" >A: "'Ulf Wiger \(TN/EAB\)'" , > "'Yerl'" , > >Sujet: RE: [erlang-questions] Priority queue >Date: Fri, 6 Jul 2007 17:43:09 +0530 > >How to handle Priority Queues between processes, while keeping efficient >message retrieval? > >BRgds, >- Eranga > > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) >Sent: Thursday, June 28, 2007 2:17 AM >To: Yerl; erlang-questions@REDACTED >Subject: Re: [erlang-questions] Priority queue > > >You can use a gb_trees structure: > >in(Item, Prio, Q) -> > gb_trees:insert({Prio,now()}, Item, Q). > >out(Q) -> > gb_trees:take_smallest(Q). > >peek(Q) -> > gb_trees:smallest(Q). > >The order will be FIFO. If you want LIFO, you >could negate the Prio value and take_largest >instead. > >BR, >Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl >> Sent: den 27 juni 2007 20:56 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Priority queue >> >> Hi Folks! >> >> I'm looking for a robust implementation of "Priority queue" >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. >> >> Any pointer? >> >> cheers >> Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > From andy.sloane@REDACTED Fri Jul 6 16:12:25 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Fri, 6 Jul 2007 09:12:25 -0500 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <944000.17993.qm@web52009.mail.re2.yahoo.com> References: <18061.61737.762910.769723@antilipe.corelatus.se> <944000.17993.qm@web52009.mail.re2.yahoo.com> Message-ID: <5d34bb3f0707060712l35f0cba0jbbfad661eb139693@mail.gmail.com> Thanks for the replies. Just to clarify something, though: there is no real I/O error. erl_interface sets errno to EIO if *anything* goes slightly wrong -- in this case, simply because the remote end sent something in response other than an "sok" packet. It is not timing out; it fails instantly, so as you said, the TCP connection is obviously correctly established. There are also several other connections to beam from different cnodes on the same machine at the time of the failure. So the only possibility of a firewall issue is if a firewall were resetting connections right after they were established, which I've never heard of before. The firewall rules are not stateful among the cluster nodes, anyway, and there is no NAT. I also discovered that I was indeed using 3.5.5.2 on the client and R11B-2 on the server. strace - well, a mountain of data is an understatement; it would give me more like a planet of data. The whole cluster has to be running for at least a day or so before this shows up for the first time, and it can happen on any machine, after thousands of simultaneous player-hours. tcpdump on the erlang port is feasible though and I'll do that next time. The important missing piece of data is what the actual response from beam is when the connection failed, and I am now logging that, but haven't seen the problem recur yet. During the time that the erlang connection fails, other connections continue to work and the rest of the system proceeds normally. The simulator process that tried to connect gives up each time and goes about its business for a while before attempting to reconnect to the erlang part of the system, and each connection attempt either succeeds or fails within a second. Another interesting thing to note is that I was manufacturing process ids from the cnode which were referenced by other processes in the system, and there was a bug where those processes wouldn't stop sending messages to them after the cnode went down. This bug has now been fixed, but I wonder if that had anything to do with it. Guess I'll find out soon. From casper2000a@REDACTED Fri Jul 6 17:17:15 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 6 Jul 2007 20:47:15 +0530 Subject: [erlang-questions] Priority queue In-Reply-To: Message-ID: <20070706151716.8136619DC431@mail.wavenet.lk> Well, gb_trees are created in process heap. Therefore between 2 processes you cannot have a shared gb_tree. So, one process cannot add messages while the other retrieves. Also gb_trees is O(log n) complex. Hence it's not like queue where messages are entered from one side (tail) and read from the other side (head). It's a complex task than a plain message queue, which is O(1). Also a process has to constantly query a gb_tree to see if a message is available. Ideally, a process waits until a message is put in to its input stream. Pls correct me if I am wrong. BRgds, - Eranga -----Original Message----- From: yerl@REDACTED [mailto:yerl@REDACTED] Sent: Friday, July 06, 2007 6:42 PM To: casper2000a@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: RE: [erlang-questions] Priority queue As pointed by Ulf for priority queues, just use "gb_trees". What do you mean by "efficient message retrieval" ? Explain further your problem. cheers Y. Explain further your problem? What do you want to ----Message d'origine---- >De: "Eranga Udesh" >A: "'Ulf Wiger \(TN/EAB\)'" , > "'Yerl'" , > >Sujet: RE: [erlang-questions] Priority queue >Date: Fri, 6 Jul 2007 17:43:09 +0530 > >How to handle Priority Queues between processes, while keeping efficient >message retrieval? > >BRgds, >- Eranga > > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) >Sent: Thursday, June 28, 2007 2:17 AM >To: Yerl; erlang-questions@REDACTED >Subject: Re: [erlang-questions] Priority queue > > >You can use a gb_trees structure: > >in(Item, Prio, Q) -> > gb_trees:insert({Prio,now()}, Item, Q). > >out(Q) -> > gb_trees:take_smallest(Q). > >peek(Q) -> > gb_trees:smallest(Q). > >The order will be FIFO. If you want LIFO, you >could negate the Prio value and take_largest >instead. > >BR, >Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl >> Sent: den 27 juni 2007 20:56 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Priority queue >> >> Hi Folks! >> >> I'm looking for a robust implementation of "Priority queue" >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. >> >> Any pointer? >> >> cheers >> Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > From dmercer@REDACTED Fri Jul 6 17:46:19 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 6 Jul 2007 10:46:19 -0500 Subject: [erlang-questions] Priority queue In-Reply-To: <20070706151716.8136619DC431@mail.wavenet.lk> References: <20070706151716.8136619DC431@mail.wavenet.lk> Message-ID: <006e01c7bfe4$ccc045b0$891ea8c0@SSI.CORP> I would guess you'd use Mr. Wiger's functions in some sort of receive loop. Something like (I did not test this or even make sure it compiles, but it gives an idea of what I thought Mr. Wiger was saying): priority_receive(Queue) -> receive {Priority, Message} -> in(Message, Priority, Queue) after 0 -> process_message(out(Queue)) end, priority_receive(Queue). -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Friday, July 06, 2007 10:17 To: yerl@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue Well, gb_trees are created in process heap. Therefore between 2 processes you cannot have a shared gb_tree. So, one process cannot add messages while the other retrieves. Also gb_trees is O(log n) complex. Hence it's not like queue where messages are entered from one side (tail) and read from the other side (head). It's a complex task than a plain message queue, which is O(1). Also a process has to constantly query a gb_tree to see if a message is available. Ideally, a process waits until a message is put in to its input stream. Pls correct me if I am wrong. BRgds, - Eranga -----Original Message----- From: yerl@REDACTED [mailto:yerl@REDACTED] Sent: Friday, July 06, 2007 6:42 PM To: casper2000a@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: RE: [erlang-questions] Priority queue As pointed by Ulf for priority queues, just use "gb_trees". What do you mean by "efficient message retrieval" ? Explain further your problem. cheers Y. Explain further your problem? What do you want to ----Message d'origine---- >De: "Eranga Udesh" >A: "'Ulf Wiger \(TN/EAB\)'" , > "'Yerl'" , > >Sujet: RE: [erlang-questions] Priority queue >Date: Fri, 6 Jul 2007 17:43:09 +0530 > >How to handle Priority Queues between processes, while keeping efficient >message retrieval? > >BRgds, >- Eranga > > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) >Sent: Thursday, June 28, 2007 2:17 AM >To: Yerl; erlang-questions@REDACTED >Subject: Re: [erlang-questions] Priority queue > > >You can use a gb_trees structure: > >in(Item, Prio, Q) -> > gb_trees:insert({Prio,now()}, Item, Q). > >out(Q) -> > gb_trees:take_smallest(Q). > >peek(Q) -> > gb_trees:smallest(Q). > >The order will be FIFO. If you want LIFO, you >could negate the Prio value and take_largest >instead. > >BR, >Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl >> Sent: den 27 juni 2007 20:56 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Priority queue >> >> Hi Folks! >> >> I'm looking for a robust implementation of "Priority queue" >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. >> >> Any pointer? >> >> cheers >> Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From casper2000a@REDACTED Fri Jul 6 17:53:49 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 6 Jul 2007 21:23:49 +0530 Subject: [erlang-questions] Priority queue In-Reply-To: <20070706151716.8136619DC431@mail.wavenet.lk> Message-ID: <20070706155350.91E5319DC393@mail.wavenet.lk> Instead you can use an ets table with ordered_set and use ets:first/1 or ets:last/1 to get the prioritized messages. But still this is an expensive task in terms of insertion and retrieval (2nd and 3rd reasons below). A simple solution would be to extend Erlang process/message passing model to enable to originate priority and normal type messages. When it's a priority message, the message is placed at the beginning (head) of the queue. When it's a normal message, it's placed at the end of the queue. Taking gen_server as an exmaple there're 2 functions, gen_server:pri_call/2/3 gen_server:pri_cast/2 when run, it places the new message at the beginning of the message queue to the gen_server process? This doesn't preserve the FIFO for priority messages (but LIFO), but at least it could give the facility to deliver a high priority message to a process without waiting for its turn in the message queue. BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Friday, July 06, 2007 8:47 PM To: yerl@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue Well, gb_trees are created in process heap. Therefore between 2 processes you cannot have a shared gb_tree. So, one process cannot add messages while the other retrieves. Also gb_trees is O(log n) complex. Hence it's not like queue where messages are entered from one side (tail) and read from the other side (head). It's a complex task than a plain message queue, which is O(1). Also a process has to constantly query a gb_tree to see if a message is available. Ideally, a process waits until a message is put in to its input stream. Pls correct me if I am wrong. BRgds, - Eranga -----Original Message----- From: yerl@REDACTED [mailto:yerl@REDACTED] Sent: Friday, July 06, 2007 6:42 PM To: casper2000a@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: RE: [erlang-questions] Priority queue As pointed by Ulf for priority queues, just use "gb_trees". What do you mean by "efficient message retrieval" ? Explain further your problem. cheers Y. Explain further your problem? What do you want to ----Message d'origine---- >De: "Eranga Udesh" >A: "'Ulf Wiger \(TN/EAB\)'" , > "'Yerl'" , > >Sujet: RE: [erlang-questions] Priority queue >Date: Fri, 6 Jul 2007 17:43:09 +0530 > >How to handle Priority Queues between processes, while keeping efficient >message retrieval? > >BRgds, >- Eranga > > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) >Sent: Thursday, June 28, 2007 2:17 AM >To: Yerl; erlang-questions@REDACTED >Subject: Re: [erlang-questions] Priority queue > > >You can use a gb_trees structure: > >in(Item, Prio, Q) -> > gb_trees:insert({Prio,now()}, Item, Q). > >out(Q) -> > gb_trees:take_smallest(Q). > >peek(Q) -> > gb_trees:smallest(Q). > >The order will be FIFO. If you want LIFO, you >could negate the Prio value and take_largest >instead. > >BR, >Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl >> Sent: den 27 juni 2007 20:56 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Priority queue >> >> Hi Folks! >> >> I'm looking for a robust implementation of "Priority queue" >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. >> >> Any pointer? >> >> cheers >> Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From paul-trapexit@REDACTED Fri Jul 6 18:16:41 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 6 Jul 2007 09:16:41 -0700 (PDT) Subject: [erlang-questions] Priority queue In-Reply-To: <20070706155350.91E5319DC393@mail.wavenet.lk> References: <20070706155350.91E5319DC393@mail.wavenet.lk> Message-ID: With just a binary model of priority (high, normal), you can already achieve this with a selective receive and your own protocol. loop () -> receive { high, Mesg } -> process_message (high, Mesg) after 0 -> receive { Prio, Mesg } -> process_message (Prio, Mesg) end end, loop (). I agree it does get more interesting when there is a more granular notion of priority. For multiple levels of priority one could do nested receives but it would get unwieldy, and for a continuous notion of priority this definitely won't work. -- p On Fri, 6 Jul 2007, Eranga Udesh wrote: > Instead you can use an ets table with ordered_set and use ets:first/1 or > ets:last/1 to get the prioritized messages. But still this is an expensive > task in terms of insertion and retrieval (2nd and 3rd reasons below). > > A simple solution would be to extend Erlang process/message passing model to > enable to originate priority and normal type messages. When it's a priority > message, the message is placed at the beginning (head) of the queue. When > it's a normal message, it's placed at the end of the queue. > > Taking gen_server as an exmaple there're 2 functions, > gen_server:pri_call/2/3 > gen_server:pri_cast/2 > when run, it places the new message at the beginning of the message queue to > the gen_server process? > > This doesn't preserve the FIFO for priority messages (but LIFO), but at > least it could give the facility to deliver a high priority message to a > process without waiting for its turn in the message queue. > > BRgds, > - Eranga > > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh > Sent: Friday, July 06, 2007 8:47 PM > To: yerl@REDACTED; ulf.wiger@REDACTED; > erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority queue > > Well, gb_trees are created in process heap. Therefore between 2 processes > you cannot have a shared gb_tree. So, one process cannot add messages while > the other retrieves. > > Also gb_trees is O(log n) complex. Hence it's not like queue where messages > are entered from one side (tail) and read from the other side (head). It's a > complex task than a plain message queue, which is O(1). Also a process has > to constantly query a gb_tree to see if a message is available. > > Ideally, a process waits until a message is put in to its input stream. > > Pls correct me if I am wrong. > > BRgds, > - Eranga > > > > -----Original Message----- > From: yerl@REDACTED [mailto:yerl@REDACTED] > Sent: Friday, July 06, 2007 6:42 PM > To: casper2000a@REDACTED; ulf.wiger@REDACTED; > erlang-questions@REDACTED > Subject: Re: RE: [erlang-questions] Priority queue > > As pointed by Ulf for priority queues, just use "gb_trees". > > What do you mean by "efficient message retrieval" ? > Explain further your problem. > > cheers > Y. > > Explain further your problem? What do you want to > > ----Message d'origine---- > >De: "Eranga Udesh" > >A: "'Ulf Wiger \(TN/EAB\)'" , > > "'Yerl'" , > > > >Sujet: RE: [erlang-questions] Priority queue > >Date: Fri, 6 Jul 2007 17:43:09 +0530 > > > >How to handle Priority Queues between processes, while keeping efficient > >message retrieval? > > > >BRgds, > >- Eranga > > > > > >-----Original Message----- > >From: erlang-questions-bounces@REDACTED > >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger > (TN/EAB) > >Sent: Thursday, June 28, 2007 2:17 AM > >To: Yerl; erlang-questions@REDACTED > >Subject: Re: [erlang-questions] Priority queue > > > > > >You can use a gb_trees structure: > > > >in(Item, Prio, Q) -> > > gb_trees:insert({Prio,now()}, Item, Q). > > > >out(Q) -> > > gb_trees:take_smallest(Q). > > > >peek(Q) -> > > gb_trees:smallest(Q). > > > >The order will be FIFO. If you want LIFO, you > >could negate the Prio value and take_largest > >instead. > > > >BR, > >Ulf W > > > >> -----Original Message----- > >> From: erlang-questions-bounces@REDACTED > >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl > >> Sent: den 27 juni 2007 20:56 > >> To: erlang-questions@REDACTED > >> Subject: [erlang-questions] Priority queue > >> > >> Hi Folks! > >> > >> I'm looking for a robust implementation of "Priority queue" > >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. > >> > >> Any pointer? > >> > >> cheers > >> Y. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >_______________________________________________ > >erlang-questions mailing list > >erlang-questions@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Ignorance of what is going on is no barrier to confidence. From casper2000a@REDACTED Fri Jul 6 18:47:35 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 6 Jul 2007 22:17:35 +0530 Subject: [erlang-questions] Priority queue In-Reply-To: <006e01c7bfe4$ccc045b0$891ea8c0@SSI.CORP> Message-ID: <20070706164739.C2D7019DC218@mail.wavenet.lk> Alright, I wasn't thinking this model. This receive loop doesn't wait at any level, hence seems CPU intensive. However this can be improved. Thanks, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of David Mercer Sent: Friday, July 06, 2007 9:16 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue I would guess you'd use Mr. Wiger's functions in some sort of receive loop. Something like (I did not test this or even make sure it compiles, but it gives an idea of what I thought Mr. Wiger was saying): priority_receive(Queue) -> receive {Priority, Message} -> in(Message, Priority, Queue) after 0 -> process_message(out(Queue)) end, priority_receive(Queue). -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Friday, July 06, 2007 10:17 To: yerl@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue Well, gb_trees are created in process heap. Therefore between 2 processes you cannot have a shared gb_tree. So, one process cannot add messages while the other retrieves. Also gb_trees is O(log n) complex. Hence it's not like queue where messages are entered from one side (tail) and read from the other side (head). It's a complex task than a plain message queue, which is O(1). Also a process has to constantly query a gb_tree to see if a message is available. Ideally, a process waits until a message is put in to its input stream. Pls correct me if I am wrong. BRgds, - Eranga -----Original Message----- From: yerl@REDACTED [mailto:yerl@REDACTED] Sent: Friday, July 06, 2007 6:42 PM To: casper2000a@REDACTED; ulf.wiger@REDACTED; erlang-questions@REDACTED Subject: Re: RE: [erlang-questions] Priority queue As pointed by Ulf for priority queues, just use "gb_trees". What do you mean by "efficient message retrieval" ? Explain further your problem. cheers Y. Explain further your problem? What do you want to ----Message d'origine---- >De: "Eranga Udesh" >A: "'Ulf Wiger \(TN/EAB\)'" , > "'Yerl'" , > >Sujet: RE: [erlang-questions] Priority queue >Date: Fri, 6 Jul 2007 17:43:09 +0530 > >How to handle Priority Queues between processes, while keeping efficient >message retrieval? > >BRgds, >- Eranga > > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger (TN/EAB) >Sent: Thursday, June 28, 2007 2:17 AM >To: Yerl; erlang-questions@REDACTED >Subject: Re: [erlang-questions] Priority queue > > >You can use a gb_trees structure: > >in(Item, Prio, Q) -> > gb_trees:insert({Prio,now()}, Item, Q). > >out(Q) -> > gb_trees:take_smallest(Q). > >peek(Q) -> > gb_trees:smallest(Q). > >The order will be FIFO. If you want LIFO, you >could negate the Prio value and take_largest >instead. > >BR, >Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl >> Sent: den 27 juni 2007 20:56 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Priority queue >> >> Hi Folks! >> >> I'm looking for a robust implementation of "Priority queue" >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. >> >> Any pointer? >> >> cheers >> Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From casper2000a@REDACTED Fri Jul 6 18:51:54 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 6 Jul 2007 22:21:54 +0530 Subject: [erlang-questions] Priority queue In-Reply-To: Message-ID: <20070706165155.E793719DC3E6@mail.wavenet.lk> This is a better code. 1st "receive after 0" block also takes some CPU cycles. I wonder if this can be significant when handling a high throughput of low priority messages. Thanks, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Paul Mineiro Sent: Friday, July 06, 2007 9:47 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority queue With just a binary model of priority (high, normal), you can already achieve this with a selective receive and your own protocol. loop () -> receive { high, Mesg } -> process_message (high, Mesg) after 0 -> receive { Prio, Mesg } -> process_message (Prio, Mesg) end end, loop (). I agree it does get more interesting when there is a more granular notion of priority. For multiple levels of priority one could do nested receives but it would get unwieldy, and for a continuous notion of priority this definitely won't work. -- p On Fri, 6 Jul 2007, Eranga Udesh wrote: > Instead you can use an ets table with ordered_set and use ets:first/1 or > ets:last/1 to get the prioritized messages. But still this is an expensive > task in terms of insertion and retrieval (2nd and 3rd reasons below). > > A simple solution would be to extend Erlang process/message passing model to > enable to originate priority and normal type messages. When it's a priority > message, the message is placed at the beginning (head) of the queue. When > it's a normal message, it's placed at the end of the queue. > > Taking gen_server as an exmaple there're 2 functions, > gen_server:pri_call/2/3 > gen_server:pri_cast/2 > when run, it places the new message at the beginning of the message queue to > the gen_server process? > > This doesn't preserve the FIFO for priority messages (but LIFO), but at > least it could give the facility to deliver a high priority message to a > process without waiting for its turn in the message queue. > > BRgds, > - Eranga > > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh > Sent: Friday, July 06, 2007 8:47 PM > To: yerl@REDACTED; ulf.wiger@REDACTED; > erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority queue > > Well, gb_trees are created in process heap. Therefore between 2 processes > you cannot have a shared gb_tree. So, one process cannot add messages while > the other retrieves. > > Also gb_trees is O(log n) complex. Hence it's not like queue where messages > are entered from one side (tail) and read from the other side (head). It's a > complex task than a plain message queue, which is O(1). Also a process has > to constantly query a gb_tree to see if a message is available. > > Ideally, a process waits until a message is put in to its input stream. > > Pls correct me if I am wrong. > > BRgds, > - Eranga > > > > -----Original Message----- > From: yerl@REDACTED [mailto:yerl@REDACTED] > Sent: Friday, July 06, 2007 6:42 PM > To: casper2000a@REDACTED; ulf.wiger@REDACTED; > erlang-questions@REDACTED > Subject: Re: RE: [erlang-questions] Priority queue > > As pointed by Ulf for priority queues, just use "gb_trees". > > What do you mean by "efficient message retrieval" ? > Explain further your problem. > > cheers > Y. > > Explain further your problem? What do you want to > > ----Message d'origine---- > >De: "Eranga Udesh" > >A: "'Ulf Wiger \(TN/EAB\)'" , > > "'Yerl'" , > > > >Sujet: RE: [erlang-questions] Priority queue > >Date: Fri, 6 Jul 2007 17:43:09 +0530 > > > >How to handle Priority Queues between processes, while keeping efficient > >message retrieval? > > > >BRgds, > >- Eranga > > > > > >-----Original Message----- > >From: erlang-questions-bounces@REDACTED > >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger > (TN/EAB) > >Sent: Thursday, June 28, 2007 2:17 AM > >To: Yerl; erlang-questions@REDACTED > >Subject: Re: [erlang-questions] Priority queue > > > > > >You can use a gb_trees structure: > > > >in(Item, Prio, Q) -> > > gb_trees:insert({Prio,now()}, Item, Q). > > > >out(Q) -> > > gb_trees:take_smallest(Q). > > > >peek(Q) -> > > gb_trees:smallest(Q). > > > >The order will be FIFO. If you want LIFO, you > >could negate the Prio value and take_largest > >instead. > > > >BR, > >Ulf W > > > >> -----Original Message----- > >> From: erlang-questions-bounces@REDACTED > >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl > >> Sent: den 27 juni 2007 20:56 > >> To: erlang-questions@REDACTED > >> Subject: [erlang-questions] Priority queue > >> > >> Hi Folks! > >> > >> I'm looking for a robust implementation of "Priority queue" > >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. > >> > >> Any pointer? > >> > >> cheers > >> Y. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >_______________________________________________ > >erlang-questions mailing list > >erlang-questions@REDACTED > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Ignorance of what is going on is no barrier to confidence. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From matthias@REDACTED Fri Jul 6 17:47:11 2007 From: matthias@REDACTED (Matthias Lang) Date: Fri, 6 Jul 2007 17:47:11 +0200 Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <944000.17993.qm@web52009.mail.re2.yahoo.com> References: <18061.61737.762910.769723@antilipe.corelatus.se> <944000.17993.qm@web52009.mail.re2.yahoo.com> Message-ID: <18062.25599.829466.888933@antilipe.corelatus.se> Jeff >> * Double checking that the switches between the two machines are locks Jeff >> at the correct speed, eg 100Mps full-duplex. Matthias > Verifying that the interfaces are running as expected, e.g. that both Matthias > ends have the same idea about what they're doing, is good. Chasing possible ethernet problems is not the first thing I'd do if presented with the evidence Andy gave. I posted because a small part of Jeff's advice (above) is prone to misinterpretation. And also because my calling in life is to prevent people from making that particular mistake. Richard Andrews writes: > TCP should take care of collisions and it is already established > that data is being exchanged between the two hosts as TCP connect > succeeds which requires SYN, SYN-ACK, ACK. Ethernet is obviously > OK. This is misleading. Collisions are part of the normal operation of a half-duplex ethernet. TCP does not take care of them. Collisions are normally taken care of by ethernet itself (by retransmission*). Late collisions are not a normal part of ethernet. Late collisions result in lost packets. TCP will take care of packet losses, but throughput will often suffer dramatically. Timeouts chosen to be reasonable for a LAN will also be exceeded. Getting a successful TCP connection is a necessary condition for having an OK ethernet, but it's not sufficient. The rest of your advice is pretty good. Matthias > I would suggest > 1) attach strace - you get a mountain of data but you can see what your EIO is > at the socket level. > 2) tcpdump - try and get packet trace of the connection; you can use "tcpdump > -w -X -s0 ..." and just log everything and post-process it later. > > It could be a firewall or NAT issue; I've seen stateful firewalls get confused > and block connections for a long time. > > It is important to find out what is happening around the connection retries ( > I'm assuming this means making new TCP connections). I think packet logs are > your most important tool. Maybe you have an intermittent IP address conflict. > It might be another host outside the client and server which is causing the > problem. Might not even be connected to an erlang node - of course the response > won't make sense then. > > You'll slap yourself on the forehead when you see it. * There is a limit to the number of retransmission attempts. Exceeding that limit is unusual. From opfer@REDACTED Fri Jul 6 19:50:50 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Fri, 6 Jul 2007 19:50:50 +0200 Subject: [erlang-questions] Using system's zlib In-Reply-To: <468DE96B.2030703@web.am> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> Message-ID: <20070706195050.298bd47e@luna.home> Gaspar Chilingarov : > Christian Faulhammer wrote: > > Gaspar Chilingarov : > >> AFAIK no, because erlang's zlib is heavily patched :) > > Doh. I don't really like that...is there any chance that one day > > erlang can use vanilla zlib? How heavy are the patches? Could zlib > > upstream integrate them? > at current moment erlang uses zlib v. 1.2.3, which is the latest > according to zlib's official site. Good to know. > About patches -- it took me about 1-2 day to merge in new version of > zlib to erlang sources :) Still, are those patches very special or could upstream provide your needed features? > In other hand -- what's the reason to include system zlib, if now > it's shipped with latest version of zlib? As I am maintainer of erlang in Gentoo Linux, I have a bug open asking for using system's zlib, but that is not important to you. :) Take it that there is a security flaw in zlib. zlib in Gentoo is updated, stabled and done. Nobody thinks of erlang (or any other package shipping a custom version of zlib instead of linking against the system one), so we have a possibly vulnerable version in the tree. Which is baaaaad. Backporting patches from vanilla zlib to erlang is just needless work in my eyes, and I have to be aware of these fixes or even of an included library (there may be more I don't know about). V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From ulf@REDACTED Fri Jul 6 21:15:26 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 6 Jul 2007 21:15:26 +0200 Subject: [erlang-questions] How do Mnesia commits and rollbacks work? In-Reply-To: <9BC822D6-89AB-4560-A405-FE477B549221@gmail.com> References: <9BC822D6-89AB-4560-A405-FE477B549221@gmail.com> Message-ID: <8209f740707061215m3fa9b487n3d1c8c4982082f35@mail.gmail.com> 2007/7/6, Joel Reymont : > Folks, > > Does anyone know the exact details of how Mnesia commits and rolls back? > > Does it somehow figure out the locks, writes to temp tables and then > commits the whole transaction once to the underlying ets and dets > tables? Pretty much, yes. If you haven't already, you might want to look through the 'mnesia internals' slides: http://www.erlang-projects.org/Groups/erlang_frameworks/mnesia_internals_sli/block_11394822732946/file BR, Ulf W From per@REDACTED Fri Jul 6 22:21:27 2007 From: per@REDACTED (Per Hedeland) Date: Fri, 6 Jul 2007 22:21:27 +0200 (CEST) Subject: [erlang-questions] : : [SOLVED] Can't set long node name on windows In-Reply-To: <468CA19E.5020407@gmail.com> Message-ID: <200707062021.l66KLRdh070181@pluto.hedeland.org> "Dmitrii 'Mamut' Dimandt" wrote: > >I should really be careful when reading books :) : > > "We can also use -sname on two different machines when they are > on the same subnet. Using -sname is also the only method that will > work if no DNS service is available." Uh, unfortunately basically everything in that quote is wrong. -name vs -sname is a matter of host/domain names, a concept that is quite orthogonal to the concept of subnets. And -name works just fine without DNS, as long as you put fully-qualified names in /etc/hosts or whatever you're using. The erl(1) man page has it right of course, but is maybe a bit terse. The important thing is that the hostname part of a node name must be unique (among hosts), predictable, and usable by all involved. If your Windows box thinks that its name is foo.WORKGROUP, while your Unix box thinks that the Windows box is called foo.your.domain, and has no idea how to reach a host called foo.WORKGROUP, you will have problems. In some cases they may agree on the "foo" part, which is where -sname helps (at the cost of messing things up when you want foo.example.org and foo.example.com to be able to communicate). But the Windows box may actually think that its name is DMITRIIS_COMPUTER, a name that isn't known by anything outside (at best) the bunch of Windows boxes on your network. The clear and obvious way out of this mess is "everything should use DNS", which amazingly still seems to be a problem in the Windows world. >Apart from that, Kirill Zaborski suggested that I directly write >nodename@REDACTED So I ran > > erl -name another_name@REDACTED This is actually quite a good workaround when you have a "Windows mess" - or for that matter a private home network where you can't be bothered to set up DNS or even distribute hosts files. Using IP addresses clearly fulfills the unique&predictable&usable requirement. Unfortunately it's not documented that you can specify the hostname part at all with -name, let alone that the IP address can be used for it (I think at least the latter may actually be an "accidental" feature). The downside is that there is zero sanity check on the hostname part, you can give anything you want there (whether name or IP address), and so can easily create a different kind of mess. --Per Hedeland From per@REDACTED Fri Jul 6 22:52:40 2007 From: per@REDACTED (Per Hedeland) Date: Fri, 6 Jul 2007 22:52:40 +0200 (CEST) Subject: [erlang-questions] Intermittent failures connecting C hidden nodes In-Reply-To: <18062.25599.829466.888933@antilipe.corelatus.se> Message-ID: <200707062052.l66KqeMY070960@pluto.hedeland.org> Matthias Lang wrote: > > Jeff >> * Double checking that the switches between the two machines are locks > Jeff >> at the correct speed, eg 100Mps full-duplex. > > Matthias > Verifying that the interfaces are running as expected, e.g. that both > Matthias > ends have the same idea about what they're doing, is good. > >Chasing possible ethernet problems is not the first thing I'd do if >presented with the evidence Andy gave. > >I posted because a small part of Jeff's advice (above) is prone to >misinterpretation. And also because my calling in life is to prevent >people from making that particular mistake. I wouldn't consider it my calling in life:-), but it's a pet peeve for me too (for a number of reasons) - and I think your "causes TCP to behave erratically" is quite an understatement. The type of broken setup you're describing can effectively kill a network segment when the traffic load is high, while it seems to work just fine in light testing - extremely nasty. And the amount of myth propagation or downright misinformation is immense - just earlier today I happened to be googling for how to configure speed/duplex on Solaris (it seems to be arguably even more bizarre than Linux in this area), and on one of the first hits I found this: "Solaris is often unable to correctly auto-negotiate duplex settings with a link partner (e.g. switch), especially when the switch is set to 100Mbit full-duplex." Sigh... --Per Hedeland From ulf@REDACTED Fri Jul 6 23:13:20 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 6 Jul 2007 23:13:20 +0200 Subject: [erlang-questions] How do Mnesia commits and rollbacks work? In-Reply-To: References: <9BC822D6-89AB-4560-A405-FE477B549221@gmail.com> <8209f740707061215m3fa9b487n3d1c8c4982082f35@mail.gmail.com> Message-ID: <8209f740707061413i4d6c3212x14b73695630728df@mail.gmail.com> I doubt that too many have studied the external_copies implementation. It's not an original mnesia feature. (-: The callback module is called at commit. Before commit, the data is written to the transaction store. So if the transaction fails, the callback module shouldn't be called at all. BR, Ulf W 2007/7/6, Joel Reymont : > This is the gist of my question... > > If you set up an external_copies table and your transaction fails, > will the external write callback be called twice? > > I will try to trace Mnesia to see what happens but I thought someone > may have the answer. > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > From ulf.wiger@REDACTED Fri Jul 6 23:27:58 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 6 Jul 2007 23:27:58 +0200 Subject: [erlang-questions] Priority queue In-Reply-To: <20070706165155.E793719DC3E6@mail.wavenet.lk> References: <20070706165155.E793719DC3E6@mail.wavenet.lk> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550241D6F2@esealmw115.eemea.ericsson.se> I think Jay Nelson's slides on message passing fundamentals, prepared for EUC 2006, have a pretty thorough discussion on prioritizing messages: http://www.duomark.com/erlang/briefings/euc2006/pJ.html The whole presentation starts at: http://www.duomark.com/erlang/briefings/euc2006/ Adding priority receive on top of the erlang model is not easy, and it gets messy, which Jay's examples show. The one form of priority receive that works really well in Erlang is normal selective receive, which temporarily gives priority to messages matching a given set of patterns. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh > Sent: den 6 juli 2007 18:52 > To: 'Paul Mineiro'; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority queue > > This is a better code. > > 1st "receive after 0" block also takes some CPU cycles. I > wonder if this can be significant when handling a high > throughput of low priority messages. > > Thanks, > - Eranga > > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Paul Mineiro > Sent: Friday, July 06, 2007 9:47 PM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority queue > > With just a binary model of priority (high, normal), you can > already achieve this with a selective receive and your own protocol. > > loop () -> > receive > { high, Mesg } -> process_message (high, Mesg) > after 0 -> > receive > { Prio, Mesg } -> process_message (Prio, Mesg) > end > end, > loop (). > > I agree it does get more interesting when there is a more > granular notion of priority. For multiple levels of priority > one could do nested receives but it would get unwieldy, and > for a continuous notion of priority this definitely won't work. > > -- p > > On Fri, 6 Jul 2007, Eranga Udesh wrote: > > > Instead you can use an ets table with ordered_set and use > ets:first/1 > > or > > ets:last/1 to get the prioritized messages. But still this is an > > expensive task in terms of insertion and retrieval (2nd and > 3rd reasons below). > > > > A simple solution would be to extend Erlang process/message passing > > model > to > > enable to originate priority and normal type messages. When it's a > priority > > message, the message is placed at the beginning (head) of > the queue. > > When it's a normal message, it's placed at the end of the queue. > > > > Taking gen_server as an exmaple there're 2 functions, > > gen_server:pri_call/2/3 > > gen_server:pri_cast/2 > > when run, it places the new message at the beginning of the message > > queue > to > > the gen_server process? > > > > This doesn't preserve the FIFO for priority messages (but > LIFO), but > > at least it could give the facility to deliver a high > priority message > > to a process without waiting for its turn in the message queue. > > > > BRgds, > > - Eranga > > > > > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Eranga Udesh > > Sent: Friday, July 06, 2007 8:47 PM > > To: yerl@REDACTED; ulf.wiger@REDACTED; > > erlang-questions@REDACTED > > Subject: Re: [erlang-questions] Priority queue > > > > Well, gb_trees are created in process heap. Therefore between 2 > > processes you cannot have a shared gb_tree. So, one process > cannot add > > messages > while > > the other retrieves. > > > > Also gb_trees is O(log n) complex. Hence it's not like queue where > messages > > are entered from one side (tail) and read from the other > side (head). > > It's > a > > complex task than a plain message queue, which is O(1). > Also a process > > has to constantly query a gb_tree to see if a message is available. > > > > Ideally, a process waits until a message is put in to its > input stream. > > > > Pls correct me if I am wrong. > > > > BRgds, > > - Eranga > > > > > > > > -----Original Message----- > > From: yerl@REDACTED [mailto:yerl@REDACTED] > > Sent: Friday, July 06, 2007 6:42 PM > > To: casper2000a@REDACTED; ulf.wiger@REDACTED; > > erlang-questions@REDACTED > > Subject: Re: RE: [erlang-questions] Priority queue > > > > As pointed by Ulf for priority queues, just use "gb_trees". > > > > What do you mean by "efficient message retrieval" ? > > Explain further your problem. > > > > cheers > > Y. > > > > Explain further your problem? What do you want to > > > > ----Message d'origine---- > > >De: "Eranga Udesh" > > >A: "'Ulf Wiger \(TN/EAB\)'" , > > > "'Yerl'" , > > > > > >Sujet: RE: [erlang-questions] Priority queue > > >Date: Fri, 6 Jul 2007 17:43:09 +0530 > > > > > >How to handle Priority Queues between processes, while keeping > > >efficient message retrieval? > > > > > >BRgds, > > >- Eranga > > > > > > > > >-----Original Message----- > > >From: erlang-questions-bounces@REDACTED > > >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ulf Wiger > > (TN/EAB) > > >Sent: Thursday, June 28, 2007 2:17 AM > > >To: Yerl; erlang-questions@REDACTED > > >Subject: Re: [erlang-questions] Priority queue > > > > > > > > >You can use a gb_trees structure: > > > > > >in(Item, Prio, Q) -> > > > gb_trees:insert({Prio,now()}, Item, Q). > > > > > >out(Q) -> > > > gb_trees:take_smallest(Q). > > > > > >peek(Q) -> > > > gb_trees:smallest(Q). > > > > > >The order will be FIFO. If you want LIFO, you could negate > the Prio > > >value and take_largest instead. > > > > > >BR, > > >Ulf W > > > > > >> -----Original Message----- > > >> From: erlang-questions-bounces@REDACTED > > >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Yerl > > >> Sent: den 27 juni 2007 20:56 > > >> To: erlang-questions@REDACTED > > >> Subject: [erlang-questions] Priority queue > > >> > > >> Hi Folks! > > >> > > >> I'm looking for a robust implementation of "Priority queue" > > >> (http://en.wikipedia.org/wiki/Priority_queue) in Erlang. > > >> > > >> Any pointer? > > >> > > >> cheers > > >> Y. > > >> _______________________________________________ > > >> erlang-questions mailing list > > >> erlang-questions@REDACTED > > >> http://www.erlang.org/mailman/listinfo/erlang-questions > > >> > > >_______________________________________________ > > >erlang-questions mailing list > > >erlang-questions@REDACTED > > >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > Ignorance of what is going on is no barrier to confidence. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From joelr1@REDACTED Fri Jul 6 22:00:43 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 6 Jul 2007 21:00:43 +0100 Subject: [erlang-questions] How do Mnesia commits and rollbacks work? In-Reply-To: <8209f740707061215m3fa9b487n3d1c8c4982082f35@mail.gmail.com> References: <9BC822D6-89AB-4560-A405-FE477B549221@gmail.com> <8209f740707061215m3fa9b487n3d1c8c4982082f35@mail.gmail.com> Message-ID: This is the gist of my question... If you set up an external_copies table and your transaction fails, will the external write callback be called twice? I will try to trace Mnesia to see what happens but I thought someone may have the answer. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From cyberlync@REDACTED Sat Jul 7 00:07:20 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 6 Jul 2007 15:07:20 -0700 Subject: [erlang-questions] Automated Code Scanning of Erlang Source for Security Message-ID: Guys, Over the last month or so I have come across a need for a security scanning tool. There isn't any point in asking why, it really wouldn't matter anyway. In any case, no tool like this seems to exist. I think the reason for that is because the simple problems these tools detect generally don't exist in Erlang. I was setting down, trying to come up with a list of possible detectable defects in preparation for writing my own scanner or extending Dialyzer. The only problems I could think of was use of eval and related constructs and sql injection style attacks. Other then that I can't think of a single thing. So here is my question, finally. What type of, possibly detectable, security issues are related to Erlang? aside from the ones already mentioned. Thanks, Eric From Bruce@REDACTED Sat Jul 7 00:47:28 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sat, 07 Jul 2007 10:47:28 +1200 Subject: [erlang-questions] Automated Code Scanning of Erlang Source for Security In-Reply-To: References: Message-ID: <468EC680.3050002@Fitzsimons.org> Eric Merritt wrote: > So here is my question, finally. What type of, possibly detectable, > security issues are related to Erlang? aside from the ones already > mentioned. > I think, given the distributed model that Erlang systems encourage, that the problem needs a little more definition. Are you defending against code you import containing [maliciousness, trojan horses, worms], compiled code you run on the same VM containign the same, systems you interwork with doing badness to your node, etc. It isn't just code, it is system architecture too, so my answer goes outside what Dialyzer may be able to analyse. 1. Someone started a discussion a while ago that pointed out the limitations of the distribution security; you can put a crispy shell over it (by changing the transport) but fundamentally the cookie system is a chewy centre. It is "good enough" for most systems but a defence-in-depth strategy would probably have a more secure mechanism for authentication, probably with some reaction mechanism for bad attempts (and that itself opening up DoS problems). I'm not aware that this exists today. I don't think you can scan for this automatically. "Good cookie" selection, possibly per-node pair, and using ssl transport mitigates it a bit. 2. Darius (I think) noted that if you give outside code a chance to run on the VM then it can peer inside other modules. This allows all kinds of mischief. A "blessed" security mode for some functions doesn't sound fine-grained enough, and shell only availability (yurk) would stop some useful programs from functioning. You could obviously scan for the use of these functions programmatically. 3. I think the list has previously noted the DoS potential of queue slowdowns by sending unmatched messages to a process. Defensively you could do a generic match->throw away in the receive loops (gen_xxx templates already do this). I think this is detectable, but it assumes the crispy shell has been penetrated. 4. OS calls of almost any type 5. File access, especially overwriting. 6. Port stuff, linked in drivers, etc 7. Hardcoded addresses/names in IP communication (e.g. getting the captured information out somewhere safe). This can be hidden quite well so that it is statically defined but not obviously so. 8. mnesia/dets destructive operations, mainly the "delete/clear the entire table/schema" ones 9. Access to commonly named mnesia tables ("user/s") from more than one module. Possibly human language dependent...so maybe broaden it to modules that write to the same table from different modules. There is the great risk of inflicting design guidelines on other people though, and I'm more cognisant that "other people are weird" after some of my discussions on #erlang. ;-) This is fun :-) I'm sure there are more. Cheers, Bruce From bob@REDACTED Sat Jul 7 01:05:54 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 6 Jul 2007 16:05:54 -0700 Subject: [erlang-questions] Automated Code Scanning of Erlang Source for Security In-Reply-To: References: Message-ID: <6a36e7290707061605k1e3170c9y6245d4e615eeade0@mail.gmail.com> On 7/6/07, Eric Merritt wrote: > Guys, > > Over the last month or so I have come across a need for a security > scanning tool. There isn't any point in asking why, it really wouldn't > matter anyway. In any case, no tool like this seems to exist. I think > the reason for that is because the simple problems these tools detect > generally don't exist in Erlang. I was setting down, trying to come up > with a list of possible detectable defects in preparation for writing > my own scanner or extending Dialyzer. The only problems I could think > of was use of eval and related constructs and sql injection style > attacks. Other then that I can't think of a single thing. > > So here is my question, finally. What type of, possibly detectable, > security issues are related to Erlang? aside from the ones already > mentioned. Well you could easily run out of memory using list_to_atom on arbitrary input or receive statements that don't eventually match everything (filling up mailboxes). -bob From bob@REDACTED Sat Jul 7 01:07:56 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 6 Jul 2007 16:07:56 -0700 Subject: [erlang-questions] Automated Code Scanning of Erlang Source for Security In-Reply-To: <6a36e7290707061605k1e3170c9y6245d4e615eeade0@mail.gmail.com> References: <6a36e7290707061605k1e3170c9y6245d4e615eeade0@mail.gmail.com> Message-ID: <6a36e7290707061607s5f80037br753f240a4e3fb80@mail.gmail.com> On 7/6/07, Bob Ippolito wrote: > On 7/6/07, Eric Merritt wrote: > > Guys, > > > > Over the last month or so I have come across a need for a security > > scanning tool. There isn't any point in asking why, it really wouldn't > > matter anyway. In any case, no tool like this seems to exist. I think > > the reason for that is because the simple problems these tools detect > > generally don't exist in Erlang. I was setting down, trying to come up > > with a list of possible detectable defects in preparation for writing > > my own scanner or extending Dialyzer. The only problems I could think > > of was use of eval and related constructs and sql injection style > > attacks. Other then that I can't think of a single thing. > > > > So here is my question, finally. What type of, possibly detectable, > > security issues are related to Erlang? aside from the ones already > > mentioned. > > Well you could easily run out of memory using list_to_atom on > arbitrary input or receive statements that don't eventually match > everything (filling up mailboxes). > also binary_to_term and anything else that turns input into atoms could fill up the atom table.. -bob From cyberlync@REDACTED Sat Jul 7 01:21:46 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 6 Jul 2007 16:21:46 -0700 Subject: [erlang-questions] Automated Code Scanning of Erlang Source for Security In-Reply-To: <468EC680.3050002@Fitzsimons.org> References: <468EC680.3050002@Fitzsimons.org> Message-ID: I think, given the distributed model that Erlang systems encourage, that > the problem needs a little more definition. Are you defending against > code you import containing [maliciousness, trojan horses, worms], > compiled code you run on the same VM containign the same, systems you > interwork with doing badness to your node, etc. It isn't just code, it > is system architecture too, so my answer goes outside what Dialyzer may > be able to analyse. This is mostly outside of what is possible with source code analysis so I wouldn't worry to much about it. > 1. Someone started a discussion a while ago that pointed out the > limitations of the distribution security; you can put a crispy shell > over it (by changing the transport) but fundamentally the cookie system > is a chewy centre. It is "good enough" for most systems but a > defence-in-depth strategy would probably have a more secure mechanism > for authentication, probably with some reaction mechanism for bad > attempts (and that itself opening up DoS problems). I'm not aware that > this exists today. For the most part Erlang's distribution model is just not suitable for production use in the comment network environment. There are pieces you can use if you are careful but I end up mostly rolling my own. I think this is due to the nature of the environment Distributed Erlang was built for. I think that this environment consisted of a small number of hardware nodes connected by a hardware tcp backbone. I think this is pretty common inside telecom switches. Unfortunately, things like network partitioning doesn't happen in that environment and so wasn't addressed in the design. So distributed erlang is right out as well ;) > I don't think you can scan for this automatically. "Good cookie" > selection, possibly per-node pair, and using ssl transport mitigates it > a bit. > > 2. Darius (I think) noted that if you give outside code a chance to run > on the VM then it can peer inside other modules. This allows all kinds > of mischief. A "blessed" security mode for some functions doesn't sound > fine-grained enough, and shell only availability (yurk) would stop some > useful programs from functioning. > > You could obviously scan for the use of these functions programmatically. > > 3. I think the list has previously noted the DoS potential of queue > slowdowns by sending unmatched messages to a process. Defensively you > could do a generic match->throw away in the receive loops (gen_xxx > templates already do this). > > > > I think this is detectable, but it assumes the crispy shell has been > penetrated. > > 4. OS calls of almost any type > > 5. File access, especially overwriting. > > 6. Port stuff, linked in drivers, etc > > 7. Hardcoded addresses/names in IP communication (e.g. getting the > captured information out somewhere safe). This can be hidden quite well > so that it is statically defined but not obviously so. > > 8. mnesia/dets destructive operations, mainly the "delete/clear the > entire table/schema" ones > > 9. Access to commonly named mnesia tables ("user/s") from more than one > module. Possibly human language dependent...so maybe broaden it to > modules that write to the same table from different modules. There is > the great risk of inflicting design guidelines on other people though, > and I'm more cognisant that "other people are weird" after some of my > discussions on #erlang. ;-) > > This is fun :-) I'm sure there are more. > > Cheers, > Bruce > From jspedron@REDACTED Sat Jul 7 01:43:08 2007 From: jspedron@REDACTED (=?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?=) Date: Sat, 07 Jul 2007 01:43:08 +0200 Subject: [erlang-questions] Patch to produce dependencies Makefile with erlc(1) Message-ID: <468ED38C.2070800@club-internet.fr> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, GCC's preprocessor offers a collection of flags to output Makefiles which describe sources dependencies. For instance, if hello.c includes hello.h, the preprocessor will output a Makefile like this: hello.o: hello.c hello.h Obviously, if hello.h is modified, hello.c will be recompiled. Automake uses this feature to track dependencies (but needs more than that to handle Erlang sources :) I made a patch that add a subset of GCC flag to compiler(3) and erlc(1). Supported flags are: -M generate a rule describing dependencies; output on stdout. -MF File rule(s) is(are) written to `File'. -MT Target change the name of the rule emitted. -MQ Target same as -MT but quote special characters for make(1). -MP add a phony target for each dependency. -MD same as -M -MT file.Pbeam I ignored the following GCC flag, but some may be useful: -MM ignore system headers -MG consider missing headers as generated files and add the to the dependencies -MMD same as -MD but ignore system headers You'll find more details in GCC documentation. Here for gcc 4.2.0: http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Preprocessor-Options.html#Preprocessor-Options The patch was tested with R11B-5 on FreeBSD and Linux. Best regards, - -- Jean-S?bastien P?dron http://www.dumbbell.fr/ PGP Key: http://www.dumbbell.fr/pgp/pubkey.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGjtOMa+xGJsFYOlMRAqX5AJ91wJhgcevith6qBluoJA+/qSKnsQCfR3U8 4HysS/IYSlsnqLGoIHcBpHY= =ltGv -----END PGP SIGNATURE----- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: otp_src_R11B-5-makedep-a.patch URL: From jspedron@REDACTED Sat Jul 7 01:39:58 2007 From: jspedron@REDACTED (=?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?=) Date: Sat, 07 Jul 2007 01:39:58 +0200 Subject: [erlang-questions] Patch to fix crypto and SCTP support on FreeBSD Message-ID: <468ED2CE.2040601@club-internet.fr> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, To build with SCTP support on FreeBSD, I had to make two fixes: 1. There's no libsctp. The patch had a check to erts/configure.in for libsctp; erts/emulator/Makefile.in is also updated to add -lsctp only when it's available. 2. `struct sctp_event_subscribe.sctp_adaptation_layer_event' doesn't use the previous spelling (`adaptation' in FreeBSD vs. `adaption' in Linux). A check is added to erts/configure.in for the structure member and erts/emulator/drivers/common/inet_drv.c is updated accordingly. The fix isn't FreeBSD-specific but I didn't tested it on other *BSD. Note that this only fix the build. I didn't ran any real testcases because I don't have one. The second point of the patch concerns the crypto application. By default, the link of the port driver is done with ld(1) but Erlang can't load it. If the link is made with gcc(1), it works again. The patch updates erts/configure.in to set DED_LD to `gcc' on FreeBSD too. This fix is FreeBSD-specific. Other *BSD may need it as well. After applying the patch, you must run autoconf(1) and autoheader(1) in erts/. A simpler patch is already committed to the FreeBSD ports collection in `erlang-r11b5_1,1'. Best regards, - -- Jean-S?bastien P?dron http://www.dumbbell.fr/ PGP Key: http://www.dumbbell.fr/pgp/pubkey.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGjtLOa+xGJsFYOlMRAi3VAJ40qLapzhpEBR9gk0mmBpUd8NhPggCfQTti PAVBW3vp6eKSWu9LtPUVBpw= =F15b -----END PGP SIGNATURE----- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: otp_src_R11B-5-freebsd_sctp-a.patch URL: From andy.sloane@REDACTED Sat Jul 7 04:30:13 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Fri, 6 Jul 2007 21:30:13 -0500 Subject: [erlang-questions] Intermittent failures *reconnecting* C hidden nodes Message-ID: <5d34bb3f0707061930o6b4eec2l3c5415e78cd049d2@mail.gmail.com> Here's the latest status, for anyone who cares. I'm getting the atom "nok" in response to sending my node name when the failure occurs. It's only happened once since we restarted yesterday. The node had been down for about eight minutes, and came back up on a different cluster machine. It failed connecting several times (receiving the packet "snok"), and then about a minute later it succeeded. here's our log from the erlang side (the times are in CDT): 16:16:45 - <0.73.0> : received nodedown for:'c4780@REDACTED' [{nodedown_reason, connection_closed},{node_type,hidden}] 16:25:24 - <0.73.0> : received nodeup for:'c4780@REDACTED' [{node_type, hidden}] I amended the erl_interface code to show the actual packet recv_status received. (the times are in GMT... don't ask) ei_xconnect: Fri Jul 6 21:24:18 2007: -> CONNECT attempt to connect to yt ei_epmd_r4_port: Fri Jul 6 21:24:18 2007: -> PORT2_REQ alive=yt ip=204.11.209.42 ei_epmd_r4_port: Fri Jul 6 21:24:18 2007: <- PORT2_RESP result=0 (ok) ei_epmd_r4_port: Fri Jul 6 21:24:18 2007: port=4000 ntype=77 proto=0 dist-high=5 dist-low=5 ei_xconnect: Fri Jul 6 21:24:18 2007: -> CONNECT connected to remote recv_status: Fri Jul 6 21:24:18 2007: <- RECV_STATUS not ok; got: 73 6e 6f 6b = "snok" ei_xconnect: Fri Jul 6 21:24:18 2007: -> CONNECT failed erl_connect: Input/output error Now... In my reading of the code, the only way the 'nok' can be sent is if handle_info({...,{accept_pending,...}},...) in net_kernel.erl returns 'nok_pending' to mark_pending/1 in dist_util.erl, like so: handle_info({AcceptPid, {accept_pending,MyNode,Node,Address,Type}}, State) -> case ets:lookup(sys_dist, Node) of [#connection{state=pending}=Conn] -> if MyNode > Node -> AcceptPid ! {self(),{accept_pending,nok_pending}}, {noreply,State}; true -> [...snip] If I'm reading that right, it's doing a *lexical comparison* of the local node name atom with the connecting one. I cannot fathom why you would want to do that... can someone clue me in? In our case, it is true that yt@REDACTED > c4780@REDACTED Regardless, it seems that my previous connection, even though I got the nodedown, was pending. I scoured the rest of my server logs for any place where some other c4780 could have made an abortive attempt to connect but I don't see anything. So my conjecture at this point is that some part of the previous connection is stuck for a little while but eventually clears out. I saw this in the changelog for R11B-4 and was curious: OTP-6447 Under rare circumstances a terminating connection between two nodes could cause an instantaneous reconnect between the two nodes to fail on the runtime system with SMP support. Might that change have any impact (we are running R11B-2 at present)? There were also extensive changes in B-5 for node monitoring. Is there a publicly-accessible Erlang bug tracker, by the way, where I could look up issue OTP-6447 specifically? Just grasping at straws. I am now compiling R11B-5 with dist_debug defined to true in net_kernel.erl and dist_util.hrl. So either the upgrade will fix the issue or I will have even more data, and then you guys can tell me how to configure my ethernet switch. From nm@REDACTED Sat Jul 7 10:04:52 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 07 Jul 2007 13:04:52 +0500 Subject: [erlang-questions] Using system's zlib In-Reply-To: <20070706195050.298bd47e@luna.home> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> <20070706195050.298bd47e@luna.home> Message-ID: <468F4924.3060903@web.am> >> About patches -- it took me about 1-2 day to merge in new version of >> zlib to erlang sources :) > > Still, are those patches very special or could upstream provide your > needed features? Well, I've refreshed my knowledge about this :) They only differ by memory allocation functions. Erlang version uses internal [mc]alloc functions and not the system wide ones. >> In other hand -- what's the reason to include system zlib, if now >> it's shipped with latest version of zlib? Well, erlang also runs on platforms, which have too many windows but no zlib ;) > > As I am maintainer of erlang in Gentoo Linux, I have a bug open asking > for using system's zlib, but that is not important to you. :) Well, I've tried to force it use freebsd's system library, but it seems not that easy. > Take it that there is a security flaw in zlib. zlib in Gentoo is > updated, stabled and done. Nobody thinks of erlang (or any other > package shipping a custom version of zlib instead of linking against > the system one), so we have a possibly vulnerable version in the tree. > Which is baaaaad. Backporting patches from vanilla zlib to erlang is > just needless work in my eyes, and I have to be aware of these fixes > or even of an included library (there may be more I don't know about). Zlib core patches are really small -- about 5-10 lines of code, but makefiles and etc are adopted from erlang's distribution and not zlib's. So in practice one can patch zlib easily in case of any errors. (In freebsd it's possible to have port's sources patched after extract phase and before configure/make). /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From nm@REDACTED Sat Jul 7 11:40:54 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 07 Jul 2007 14:40:54 +0500 Subject: [erlang-questions] SSL certificate question Message-ID: <468F5FA6.2050902@web.am> Hello all! I need to check if given x509 certificate/key file and password are valid and fit together well :) I will use them later to make connection to remote site and I would like to check certificates before making connections -- in separate utility tool. Are there any way to import/load certificate in erlang application and check if it's valid or not ? Reading ssl module manual provided no clues to me. Thanks in advance, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From opfer@REDACTED Sat Jul 7 12:16:23 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Sat, 7 Jul 2007 12:16:23 +0200 Subject: [erlang-questions] Using system's zlib In-Reply-To: <468F4924.3060903@web.am> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> <20070706195050.298bd47e@luna.home> <468F4924.3060903@web.am> Message-ID: <20070707121623.61040c09@luna.home> Gaspar Chilingarov : > >> About patches -- it took me about 1-2 day to merge in new > >> version of > >> zlib to erlang sources :) > > > > Still, are those patches very special or could upstream provide > > your needed features? > Well, I've refreshed my knowledge about this :) > They only differ by memory allocation functions. Erlang version uses > internal [mc]alloc functions and not the system wide ones. Gnah. So no chance to have a configure switch --with-system-zlib? > > As I am maintainer of erlang in Gentoo Linux, I have a bug open > > asking for using system's zlib, but that is not important to > > you. :) > Well, I've tried to force it use freebsd's system library, but it > seems not that easy. That's what I noticed, too. And before I heavily patch everything I just went to ask upstream. > > Take it that there is a security flaw in zlib. zlib in Gentoo is > > updated, stabled and done. Nobody thinks of erlang (or any other > > package shipping a custom version of zlib instead of linking > > against the system one), so we have a possibly vulnerable version > > in the tree. Which is baaaaad. Backporting patches from vanilla > > zlib to erlang is just needless work in my eyes, and I have to be > > aware of these fixes or even of an included library (there may be > > more I don't know about). > Zlib core patches are really small -- about 5-10 lines of code, but > makefiles and etc are adopted from erlang's distribution and not > zlib's. So in practice one can patch zlib easily in case of any > errors. (In freebsd it's possible to have port's sources patched > after extract phase and before configure/make). Gentoo is source based, and Portage is similar to ports...but I need to know about a vulnerability in zlib and then check erlang. In my eyes double work if one could benefit from the zlib everyone uses. V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From qrilka@REDACTED Sat Jul 7 15:54:04 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sat, 7 Jul 2007 17:54:04 +0400 Subject: [erlang-questions] Node connection Message-ID: <337538cb0707070654j51943362s1291c754b8f66a41@mail.gmail.com> For my application I have 2 applications: a slave and a master. They reside on different nodes. Master node is always up and slave applications (and nodes) can go offline and back online. And during slave application startup I need to register in master application and for that I need master node to be connected to the node where slave application runs. So I tried to do this with erl -eval "nte-kernel:connect_node(master_node@REDACTED _host),aplication:start(slave_app)." And It looks like master-node does not get connected when slave application start and I get an error :( It look like the handshake is done asynchronously to the net_kernel:connect_node/1. I can solve this by pasting timer:sleep/1 between the calls but it seems to me a bit ugly. Is there some way to ensure that the needed node is already connected and is accesible? Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Jul 7 16:55:38 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 7 Jul 2007 16:55:38 +0200 Subject: [erlang-questions] Mnesia table events: Issues after transaction completes? In-Reply-To: <01BBE7EF-A6C1-482D-A89E-788D2381A1C0@gmail.com> References: <01BBE7EF-A6C1-482D-A89E-788D2381A1C0@gmail.com> Message-ID: <8209f740707070755u6b2c425blecef43582d86719a@mail.gmail.com> 2007/7/5, Joel Reymont : > Folks, > > When I subscribe to Mnesia events do I get them once a transaction > goes through? Yes. > Do I get multiple events if a transaction fails after X writes out of > Y and is then reissued? No. Events are sent as part of commit. BR, Ulf W From ulf@REDACTED Sat Jul 7 16:59:32 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 7 Jul 2007 16:59:32 +0200 Subject: [erlang-questions] Order of Mnesia table events In-Reply-To: References: Message-ID: <8209f740707070759m2d141d60lfa61542ca98c1b9c@mail.gmail.com> 2007/7/5, Joel Reymont : > Does the order of Mnesia table events strictly correspond to the > order they happened in a transaction? > > If I have transaction T1 that does write A, delete B, write C, can I > reply on getting A, B, C, in that order? Well, since there is no documented guarantee, you should not rely on it in any case, but I'm pretty sure it's not even the case in the current implementation. But what you get is the data that will be committed. So if there are two consecutive writes, {t,K,V1} and {t,K,V2}, within the same transaction, you will only get an event about the last update. BR, Ulf W From longster@REDACTED Sat Jul 7 18:36:47 2007 From: longster@REDACTED (James Long) Date: Sat, 7 Jul 2007 12:36:47 -0400 Subject: [erlang-questions] Writing c nodes using c interfaces Message-ID: <954cc8bb0707070936t536e5150wa0a150662fb4bd7f@mail.gmail.com> Hey guys, I'm very new to Erlang, but I like it a lot so far. I have nodes up and running and communicating, and now the next step is to create a c node that can seamlessly join this network. This seemed straightforward at first when looking at the Interoperability Tutorial from erlang's website (http://www.erlang.org/doc/tutorial/part_frame.html). Using erl_interface, I wrote some code to start a c node server. However, when I tried to connect to it, erl_accept failed, and I couldn't figure out why. I did some more research and I found the ei_connect library, and it looks like that's the newer version of the c interface. Is that correct? I started rewriting my code to use the ei_* functions, however there isn't much documentation on them. The only page I could find is the library reference (http://web.mit.edu/erlang_vR10B-10/arch/sun4x_510/lib/erlang/lib/erl_interface-3.5.5/doc/html/ei_connect.html). The only thing I couldn't find on that page is a better explanation of ei_receive_msg(). The old erl_receive_msg function filled in a ErlMessage structure which had a member variable 'msg' which contained the msg. I can't find anything like that in the new erlang_msg structure that ei_receive_msg uses. Is the message in the ei_x_buff variable that it takes in, and if so, could someone show my how to use ei_x_buff as an erlang term? I can't find any documentation on that structure as it looks to be new. Here's the new erlang_msg structure, which looks like it's all information about the message, but no message itself: typedef struct { long msgtype; erlang_pid from; erlang_pid to; char toname[MAXATOMLEN+1]; char cookie[MAXATOMLEN+1]; erlang_trace token; } erlang_msg; From jay@REDACTED Sat Jul 7 18:42:05 2007 From: jay@REDACTED (Jay Nelson) Date: Sat, 7 Jul 2007 09:42:05 -0700 Subject: [erlang-questions] Priority Queue Message-ID: As Ulf pointed out I wrote some charts about priority messages for the 2006 EUC. While it covers the topic, some of the notes now seem a little cryptic because they are in briefing format rather than as a descriptive document. More embarrassingly the references to N! complexity should really be 2(N+1) (instead of multiplying the factors N, N-1, N-2 ... 1 they should be added to get the complexity since the position of messages in the queue is never modified). So in the end it turns out to be linear complexity, but with large queues the problem is big enough to cause serious delays as others pointed out earlier. The discussions about extending the language were concluded with no change because it really is an internal optimization issue. The current mechanism in the messaging system is simple and reliable, but could be improved to handle selective receive better -- although all the suggestions only sped up simple cases and made no difference in a complicated set of multiple selective receive statements. The main discussion in the slides was geared at beginner to intermediate erlang programmers, but was also intended for experts to step back and remember the fundamentals. It is easy to get overly sophisticated in messaging situations when adhering to a few simple principles can make a complicated solution simpler. And simplicity can often lead to the discovery of more efficient or better performing solutions. Selective receive is indeed the most powerful approach, however, it also is easier to make a mistake with by leaving messages in the queue that choke the system over time, or by creating too many scans across the message queue. When you find yourself confronted with multiple receive statements spread across separate functions and a poorly performing system, consider revisiting the problem and adding processes to filter the queue more finely. Especially now that we have SMP support. Eranga wrote: > A simple solution would be to extend Erlang process/message passing model to > enable to originate priority and normal type messages. When it's a priority > message, the message is placed at the beginning (head) of the queue. When > it's a normal message, it's placed at the end of the queue. > > Taking gen_server as an exmaple there're 2 functions, > gen_server:pri_call/2/3 > gen_server:pri_cast/2 > when run, it places the new message at the beginning of the message queue to > the gen_server process? Philosophically, I don't believe it is correct for the sender of a message to determine the priority. If I call Bill Gates and leave an urgent message on his answering machine, I may not be aware that he is currently in negotiations with Steve Jobs about a new product (my standing falls below Jobs but above Larry Ellison) and thus should not be urgent. The point is that the sender of the message has no information other than that it would like a response quickly. Only the aggregator or receiver has a global view (and even then it might not be inclusive, as new processes are added later) and can determine the proper priority. It would be even worse to rearrange the message order externally rather than tagging the messages, but even tags require the entire system to have global knowledge of all priorities. Any adjustments would ripple through every process that can send a message to the priority queue process. A better design encapsulates the knowledge in one place so that it can be tweaked and tuned to improve performance without modifying the rest of the system. Create a router process and send the undifferentiated stream of messages to it. The router can be a pure erlang implementation of the mailbox semantics you would like to see. It should immediately unload every message to an internal queue (with only two priorities you can use two queue instances, with more you may need the ets or gb_trees approach). The messages can then be forwarded from the router to different processes. The problem is that you need to pause all processes except the highest one that currently has messages in the queue, thus the need for control messages between router and workers and the desire to keep the worker queues empty so that the signals can be recognized without much overhead. The big advantage with a router process is that you don't have to allow high process to hog all the CPU. If you recognize the situation where high outnumbers low by a lot, you can periodically cede control to the low priority processes. You can only determine if this is necessary in a running system by measurement and tuning. So here is the real tradeoff when trying to do priority messaging: 1) The cost of selective receive could be high when a burst of messages arrives 2) Splitting to a router gives more control, but more latency in the message delivery and more overall resources used by the erlang node Use technique #1 and model your message traffic profile. If it is a problem your queue will get large and stay that way for a minute or more, and you will start to see large latency in the handling of messages. Switch to method #2 and see if you can reduce overall packet latency by managing the routing yourself. The key to getting this right will be the method used for controlling which process runs and how the traffic is doled out. If you have a problem in case #1, you should be able to improve latency using case #2 even though there is an intermediary for messages -- the problem will come if the router collects messages faster than it can get them serviced. jay From wglozer@REDACTED Sat Jul 7 19:47:16 2007 From: wglozer@REDACTED (Will) Date: Sat, 7 Jul 2007 10:47:16 -0700 Subject: [erlang-questions] SSL certificate question In-Reply-To: <468F5FA6.2050902@web.am> References: <468F5FA6.2050902@web.am> Message-ID: Hello Gaspar, On 7/7/07, Gaspar Chilingarov wrote: > > I need to check if given x509 certificate/key file and password > are valid and fit together well :) I will use them later to make > connection to remote site and I would like to check certificates before > making connections -- in separate utility tool. > > Are there any way to import/load certificate in erlang application and > check if it's valid or not ? Reading ssl module manual provided no > clues to me. Check out the ssl_pkix module for decoding PEM and BER encoded certificates, particularly ssl_pkix:decode_cert_file/2. The ssl_pem module can be used for lower-level decoding of RSA private keys into ASN.1 binaries, which you'll need to decode to get at the RSA parameters. Once you get the public key out of the cert, and the private key parameters, you can do a sign and verify to make sure the keys match. Unfortunately the crypto application lacks a RSA sign function, but you can find my patch adding sha1/md5 sign and verify here: http://article.gmane.org/gmane.comp.lang.erlang.patches/151 Regards, Will From casper2000a@REDACTED Sat Jul 7 20:30:40 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Sun, 8 Jul 2007 00:00:40 +0530 Subject: [erlang-questions] Priority Queue In-Reply-To: Message-ID: <20070707183043.60E7519DC2A4@mail.wavenet.lk> Thanks for the detailed explanation. However using a router process, I still don't see the priority queue problem resolved, other than using a selective receive. Let's say there's a router process, when received a message for processing, finds a free worker and pass the message for it to process. The worker sends a control message to the router when the processing finishes. Still that message comes to routers' message queue and to extract it by giving it priority, the router has to does a selective receive. Taking your answering machine example, you know your message is important and you are expecting Bill Gates to give priority for your message over the other. Let's say Steve Jobs, Larry Ellison and you, all left messages in Bill Gates answering machine, while he's out in Charity work. When Gates returns and plays his answering machine, unless he listens to all 3 messages, he has no way of knowing what is important to him. So it requires a mechanism for the message leaver to flag important messages (eg. key press). To retrieve the urgent messages first, the answering machine needs to have, 1. Have a second button to listen to urgent messages 2. Place the urgent message as the 1st message in listening queue 3. Gates will sound names or numbers of people or keywords in descending priority order or program answering machine with that order (ignores the priority flag by the message leaver) (3) above is very much impractical. It's like "Importance" flag in Email. It's up to the sender to mark the message as important, but it's always receivers' who will accept it's as important or not (for actioning). Therefore, 1. Sender should be able to say a message is important or not. 2. Sender flags the message is important or not. 3. Receiver gets the important message before non-important messages in the queue. BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Jay Nelson Sent: Saturday, July 07, 2007 10:12 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority Queue As Ulf pointed out I wrote some charts about priority messages for the 2006 EUC. While it covers the topic, some of the notes now seem a little cryptic because they are in briefing format rather than as a descriptive document. More embarrassingly the references to N! complexity should really be 2(N+1) (instead of multiplying the factors N, N-1, N-2 ... 1 they should be added to get the complexity since the position of messages in the queue is never modified). So in the end it turns out to be linear complexity, but with large queues the problem is big enough to cause serious delays as others pointed out earlier. The discussions about extending the language were concluded with no change because it really is an internal optimization issue. The current mechanism in the messaging system is simple and reliable, but could be improved to handle selective receive better -- although all the suggestions only sped up simple cases and made no difference in a complicated set of multiple selective receive statements. The main discussion in the slides was geared at beginner to intermediate erlang programmers, but was also intended for experts to step back and remember the fundamentals. It is easy to get overly sophisticated in messaging situations when adhering to a few simple principles can make a complicated solution simpler. And simplicity can often lead to the discovery of more efficient or better performing solutions. Selective receive is indeed the most powerful approach, however, it also is easier to make a mistake with by leaving messages in the queue that choke the system over time, or by creating too many scans across the message queue. When you find yourself confronted with multiple receive statements spread across separate functions and a poorly performing system, consider revisiting the problem and adding processes to filter the queue more finely. Especially now that we have SMP support. Eranga wrote: > A simple solution would be to extend Erlang process/message passing model to > enable to originate priority and normal type messages. When it's a priority > message, the message is placed at the beginning (head) of the queue. When > it's a normal message, it's placed at the end of the queue. > > Taking gen_server as an exmaple there're 2 functions, > gen_server:pri_call/2/3 > gen_server:pri_cast/2 > when run, it places the new message at the beginning of the message queue to > the gen_server process? Philosophically, I don't believe it is correct for the sender of a message to determine the priority. If I call Bill Gates and leave an urgent message on his answering machine, I may not be aware that he is currently in negotiations with Steve Jobs about a new product (my standing falls below Jobs but above Larry Ellison) and thus should not be urgent. The point is that the sender of the message has no information other than that it would like a response quickly. Only the aggregator or receiver has a global view (and even then it might not be inclusive, as new processes are added later) and can determine the proper priority. It would be even worse to rearrange the message order externally rather than tagging the messages, but even tags require the entire system to have global knowledge of all priorities. Any adjustments would ripple through every process that can send a message to the priority queue process. A better design encapsulates the knowledge in one place so that it can be tweaked and tuned to improve performance without modifying the rest of the system. Create a router process and send the undifferentiated stream of messages to it. The router can be a pure erlang implementation of the mailbox semantics you would like to see. It should immediately unload every message to an internal queue (with only two priorities you can use two queue instances, with more you may need the ets or gb_trees approach). The messages can then be forwarded from the router to different processes. The problem is that you need to pause all processes except the highest one that currently has messages in the queue, thus the need for control messages between router and workers and the desire to keep the worker queues empty so that the signals can be recognized without much overhead. The big advantage with a router process is that you don't have to allow high process to hog all the CPU. If you recognize the situation where high outnumbers low by a lot, you can periodically cede control to the low priority processes. You can only determine if this is necessary in a running system by measurement and tuning. So here is the real tradeoff when trying to do priority messaging: 1) The cost of selective receive could be high when a burst of messages arrives 2) Splitting to a router gives more control, but more latency in the message delivery and more overall resources used by the erlang node Use technique #1 and model your message traffic profile. If it is a problem your queue will get large and stay that way for a minute or more, and you will start to see large latency in the handling of messages. Switch to method #2 and see if you can reduce overall packet latency by managing the routing yourself. The key to getting this right will be the method used for controlling which process runs and how the traffic is doled out. If you have a problem in case #1, you should be able to improve latency using case #2 even though there is an intermediary for messages -- the problem will come if the router collects messages faster than it can get them serviced. jay _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From paul-trapexit@REDACTED Sat Jul 7 20:39:45 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sat, 7 Jul 2007 11:39:45 -0700 (PDT) Subject: [erlang-questions] Using system's zlib In-Reply-To: <20070707121623.61040c09@luna.home> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> <20070706195050.298bd47e@luna.home> <468F4924.3060903@web.am> <20070707121623.61040c09@luna.home> Message-ID: Perhaps instead a patch to zlib is in order? I envisioning a method that let's it take some function pointers to use for memory allocation. (BDB does that.) Maybe the upstream maintainer of zlib would go for that. -- p On Sat, 7 Jul 2007, Christian Faulhammer wrote: > Gaspar Chilingarov : > > > >> About patches -- it took me about 1-2 day to merge in new > > >> version of > > >> zlib to erlang sources :) > > > > > > Still, are those patches very special or could upstream provide > > > your needed features? > > Well, I've refreshed my knowledge about this :) > > They only differ by memory allocation functions. Erlang version uses > > internal [mc]alloc functions and not the system wide ones. > > Gnah. So no chance to have a configure switch --with-system-zlib? > > > > As I am maintainer of erlang in Gentoo Linux, I have a bug open > > > asking for using system's zlib, but that is not important to > > > you. :) > > Well, I've tried to force it use freebsd's system library, but it > > seems not that easy. > > That's what I noticed, too. And before I heavily patch everything I > just went to ask upstream. > > > > Take it that there is a security flaw in zlib. zlib in Gentoo is > > > updated, stabled and done. Nobody thinks of erlang (or any other > > > package shipping a custom version of zlib instead of linking > > > against the system one), so we have a possibly vulnerable version > > > in the tree. Which is baaaaad. Backporting patches from vanilla > > > zlib to erlang is just needless work in my eyes, and I have to be > > > aware of these fixes or even of an included library (there may be > > > more I don't know about). > > Zlib core patches are really small -- about 5-10 lines of code, but > > makefiles and etc are adopted from erlang's distribution and not > > zlib's. So in practice one can patch zlib easily in case of any > > errors. (In freebsd it's possible to have port's sources patched > > after extract phase and before configure/make). > > Gentoo is source based, and Portage is similar to ports...but I need > to know about a vulnerability in zlib and then check erlang. In my > eyes double work if one could benefit from the zlib everyone uses. > > V-Li > > -- > http://www.gentoo.org/ > http://www.faulhammer.org/ > http://www.gnupg.org/ > Ignorance of what is going on is no barrier to confidence. From jay@REDACTED Sat Jul 7 20:56:54 2007 From: jay@REDACTED (Jay Nelson) Date: Sat, 7 Jul 2007 11:56:54 -0700 Subject: [erlang-questions] Priority Queue In-Reply-To: <20070707183043.60E7519DC2A4@mail.wavenet.lk> References: <20070707183043.60E7519DC2A4@mail.wavenet.lk> Message-ID: <1AAF72E0-30A4-4AC2-BCD3-003E4B9CCEE8@duomark.com> > However using a router process, I still don't see the priority > queue problem > resolved, other than using a selective receive. The router _must_ unload all messages. In your example, you have 2 priorities so create two instances of queue, receive AnyMsg handle it as a worker Ack or put it in the correct queue. The trick is to make the recursive loop for next message smart enough to pass on messages so that work is done as we are receiving more messages, rather than just unloading all first because in a continuous environment you may never hand anything to a worker and will run out of memory. The key to using a router is to _not_ use selective receive at all. You are simulating a mailbox and distribution rules in erlang, so the entire message queue must be represented as erlang data structures in the router process. > > It's like "Importance" flag in Email. I I thought the answering machine example was self-expalantory, but maybe it was a bad example. In the case of email, every spammer sends me high priority messages. If I look at them first, I have ceded control of my time to others who are trying to manipulate my attention span for their own gain. This is the common approach to "performance tuning" as well. Given a particular problem spot in a system, tweak the approach to favor the problem I am trying to solve right now. Over time you end up with a bunch of localized hacks that collective make the system unpredictable and inconsistent. It is fundamental, priority is in the eyes of the receiver only. The sender has no sense, knowledge or standing as to whether a message is higher priority than any other. A decision today on priority will necessarily change when a new process or new message types are added to the system. You should not architect a system which depends on knowledge of that sort being distributed among many components -- you will encounter a policy change that is extremely difficult to make. The purpose of the router is not only to solve an erlang implementation challenge. It also isolates all knowledge of prioritization (which may be dependent on adaptive operational considerations) so that there is a separation of concerns. jay From casper2000a@REDACTED Sat Jul 7 21:00:33 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Sun, 8 Jul 2007 00:30:33 +0530 Subject: [erlang-questions] Priority Queue In-Reply-To: <20070707183043.60E7519DC2A4@mail.wavenet.lk> Message-ID: <20070707190048.0224B19DC320@mail.wavenet.lk> Sorry, in second round reading only I understood what Jay explains better. According to that router doesn't have a message queue, since as soon as a message comes to it's queue, it reads and if message is not a control message, it places the message in its internal priority queues. I think that's a good model. However I will still let the sender to set the message priority. I have to check the overhead involved in added message passing (3N) and queue management in this case. Originator -> Router (message) Router manages the it's internal priority queues Router -> Worker (message) Worker -> Router (control message) With this model, router can drop non-priority messages after a threshold, if the logic requires. This is not possible with Erlangs' processes' message queue. Thanks Jay & Ulf, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Sunday, July 08, 2007 12:01 AM To: 'Jay Nelson'; erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority Queue Thanks for the detailed explanation. However using a router process, I still don't see the priority queue problem resolved, other than using a selective receive. Let's say there's a router process, when received a message for processing, finds a free worker and pass the message for it to process. The worker sends a control message to the router when the processing finishes. Still that message comes to routers' message queue and to extract it by giving it priority, the router has to does a selective receive. Taking your answering machine example, you know your message is important and you are expecting Bill Gates to give priority for your message over the other. Let's say Steve Jobs, Larry Ellison and you, all left messages in Bill Gates answering machine, while he's out in Charity work. When Gates returns and plays his answering machine, unless he listens to all 3 messages, he has no way of knowing what is important to him. So it requires a mechanism for the message leaver to flag important messages (eg. key press). To retrieve the urgent messages first, the answering machine needs to have, 1. Have a second button to listen to urgent messages 2. Place the urgent message as the 1st message in listening queue 3. Gates will sound names or numbers of people or keywords in descending priority order or program answering machine with that order (ignores the priority flag by the message leaver) (3) above is very much impractical. It's like "Importance" flag in Email. It's up to the sender to mark the message as important, but it's always receivers' who will accept it's as important or not (for actioning). Therefore, 1. Sender should be able to say a message is important or not. 2. Sender flags the message is important or not. 3. Receiver gets the important message before non-important messages in the queue. BRgds, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Jay Nelson Sent: Saturday, July 07, 2007 10:12 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority Queue As Ulf pointed out I wrote some charts about priority messages for the 2006 EUC. While it covers the topic, some of the notes now seem a little cryptic because they are in briefing format rather than as a descriptive document. More embarrassingly the references to N! complexity should really be 2(N+1) (instead of multiplying the factors N, N-1, N-2 ... 1 they should be added to get the complexity since the position of messages in the queue is never modified). So in the end it turns out to be linear complexity, but with large queues the problem is big enough to cause serious delays as others pointed out earlier. The discussions about extending the language were concluded with no change because it really is an internal optimization issue. The current mechanism in the messaging system is simple and reliable, but could be improved to handle selective receive better -- although all the suggestions only sped up simple cases and made no difference in a complicated set of multiple selective receive statements. The main discussion in the slides was geared at beginner to intermediate erlang programmers, but was also intended for experts to step back and remember the fundamentals. It is easy to get overly sophisticated in messaging situations when adhering to a few simple principles can make a complicated solution simpler. And simplicity can often lead to the discovery of more efficient or better performing solutions. Selective receive is indeed the most powerful approach, however, it also is easier to make a mistake with by leaving messages in the queue that choke the system over time, or by creating too many scans across the message queue. When you find yourself confronted with multiple receive statements spread across separate functions and a poorly performing system, consider revisiting the problem and adding processes to filter the queue more finely. Especially now that we have SMP support. Eranga wrote: > A simple solution would be to extend Erlang process/message passing model to > enable to originate priority and normal type messages. When it's a priority > message, the message is placed at the beginning (head) of the queue. When > it's a normal message, it's placed at the end of the queue. > > Taking gen_server as an exmaple there're 2 functions, > gen_server:pri_call/2/3 > gen_server:pri_cast/2 > when run, it places the new message at the beginning of the message queue to > the gen_server process? Philosophically, I don't believe it is correct for the sender of a message to determine the priority. If I call Bill Gates and leave an urgent message on his answering machine, I may not be aware that he is currently in negotiations with Steve Jobs about a new product (my standing falls below Jobs but above Larry Ellison) and thus should not be urgent. The point is that the sender of the message has no information other than that it would like a response quickly. Only the aggregator or receiver has a global view (and even then it might not be inclusive, as new processes are added later) and can determine the proper priority. It would be even worse to rearrange the message order externally rather than tagging the messages, but even tags require the entire system to have global knowledge of all priorities. Any adjustments would ripple through every process that can send a message to the priority queue process. A better design encapsulates the knowledge in one place so that it can be tweaked and tuned to improve performance without modifying the rest of the system. Create a router process and send the undifferentiated stream of messages to it. The router can be a pure erlang implementation of the mailbox semantics you would like to see. It should immediately unload every message to an internal queue (with only two priorities you can use two queue instances, with more you may need the ets or gb_trees approach). The messages can then be forwarded from the router to different processes. The problem is that you need to pause all processes except the highest one that currently has messages in the queue, thus the need for control messages between router and workers and the desire to keep the worker queues empty so that the signals can be recognized without much overhead. The big advantage with a router process is that you don't have to allow high process to hog all the CPU. If you recognize the situation where high outnumbers low by a lot, you can periodically cede control to the low priority processes. You can only determine if this is necessary in a running system by measurement and tuning. So here is the real tradeoff when trying to do priority messaging: 1) The cost of selective receive could be high when a burst of messages arrives 2) Splitting to a router gives more control, but more latency in the message delivery and more overall resources used by the erlang node Use technique #1 and model your message traffic profile. If it is a problem your queue will get large and stay that way for a minute or more, and you will start to see large latency in the handling of messages. Switch to method #2 and see if you can reduce overall packet latency by managing the routing yourself. The key to getting this right will be the method used for controlling which process runs and how the traffic is doled out. If you have a problem in case #1, you should be able to improve latency using case #2 even though there is an intermediary for messages -- the problem will come if the router collects messages faster than it can get them serviced. jay _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From casper2000a@REDACTED Sat Jul 7 21:15:24 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Sun, 8 Jul 2007 00:45:24 +0530 Subject: [erlang-questions] Priority Queue Message-ID: <20070707191527.45A9419DC37E@mail.wavenet.lk> Thanks Jay, I got your point. Since most of the times the system is in controlled environment (eg. AXD301), I think the messages originating are all (or most) pre-known. Its unlikely spam is coming, but giving priority to control messages over data messages, multi-level priority data messages, etc., is most concerns. BRgds, - Eranga -----Original Message----- From: Jay Nelson [mailto:jay@REDACTED] Sent: Sunday, July 08, 2007 12:27 AM To: Eranga Udesh Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Priority Queue > However using a router process, I still don't see the priority > queue problem > resolved, other than using a selective receive. The router _must_ unload all messages. In your example, you have 2 priorities so create two instances of queue, receive AnyMsg handle it as a worker Ack or put it in the correct queue. The trick is to make the recursive loop for next message smart enough to pass on messages so that work is done as we are receiving more messages, rather than just unloading all first because in a continuous environment you may never hand anything to a worker and will run out of memory. The key to using a router is to _not_ use selective receive at all. You are simulating a mailbox and distribution rules in erlang, so the entire message queue must be represented as erlang data structures in the router process. > > It's like "Importance" flag in Email. I I thought the answering machine example was self-expalantory, but maybe it was a bad example. In the case of email, every spammer sends me high priority messages. If I look at them first, I have ceded control of my time to others who are trying to manipulate my attention span for their own gain. This is the common approach to "performance tuning" as well. Given a particular problem spot in a system, tweak the approach to favor the problem I am trying to solve right now. Over time you end up with a bunch of localized hacks that collective make the system unpredictable and inconsistent. It is fundamental, priority is in the eyes of the receiver only. The sender has no sense, knowledge or standing as to whether a message is higher priority than any other. A decision today on priority will necessarily change when a new process or new message types are added to the system. You should not architect a system which depends on knowledge of that sort being distributed among many components -- you will encounter a policy change that is extremely difficult to make. The purpose of the router is not only to solve an erlang implementation challenge. It also isolates all knowledge of prioritization (which may be dependent on adaptive operational considerations) so that there is a separation of concerns. jay From ulf.wiger@REDACTED Sat Jul 7 22:21:19 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Sat, 7 Jul 2007 22:21:19 +0200 Subject: [erlang-questions] Priority Queue In-Reply-To: <20070707191527.45A9419DC37E@mail.wavenet.lk> References: <20070707191527.45A9419DC37E@mail.wavenet.lk> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550241D718@esealmw115.eemea.ericsson.se> What the sender can do is label the message, and a priority flag can be part of the labling. Even in a controlled environment like the AXD 301 (recall that the messages handled by the AXD 301 come from the outside, which is not necessarily a controlled environment), messages are scanned and categorized as early as possible - then submitted to load control, where they are queued according to priority. The rule is that rejectable jobs are given lower priority than non-rejectable jobs (e.g. a request to terminate a call is non- rejectable), and messages that are related to work we've already committed to have higher priority than requests to start new jobs. The case where the sender gets to flag priority is really emergency calls (112, 911, etc.), and then you can actually be fined for abusing the priority. This is essentially Jay's routing model. Once messages are classified and jobs prioritized, we rely on Erlang's built-in message-passing semantics. It's a very simple and efficient model. The trick is to protect the system from being swamped by external stimuli. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh > Sent: den 7 juli 2007 21:15 > To: 'Jay Nelson' > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority Queue > > Thanks Jay, I got your point. > > Since most of the times the system is in controlled environment (eg. > AXD301), I think the messages originating are all (or most) > pre-known. Its unlikely spam is coming, but giving priority > to control messages over data messages, multi-level priority > data messages, etc., is most concerns. > > BRgds, > - Eranga > > > -----Original Message----- > From: Jay Nelson [mailto:jay@REDACTED] > Sent: Sunday, July 08, 2007 12:27 AM > To: Eranga Udesh > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Priority Queue > > > However using a router process, I still don't see the > priority queue > > problem resolved, other than using a selective receive. > > The router _must_ unload all messages. In your example, you > have 2 priorities so create two instances of queue, receive > AnyMsg handle it as a worker Ack or put it in the correct > queue. The trick is to make the recursive loop for next > message smart enough to pass on messages so that work is done > as we are receiving more messages, rather than just unloading > all first because in a continuous environment you may never > hand anything to a worker and will run out of memory. > > The key to using a router is to _not_ use selective receive at all. > You are simulating a mailbox and distribution rules in > erlang, so the entire message queue must be represented as > erlang data structures in the router process. > > > > > It's like "Importance" flag in Email. I > > I thought the answering machine example was self-expalantory, > but maybe it was a bad example. In the case of email, every > spammer sends me high priority messages. If I look at them > first, I have ceded control of my time to others who are > trying to manipulate my attention span for their own gain. > > This is the common approach to "performance tuning" as well. > Given a particular problem spot in a system, tweak the > approach to favor the problem I am trying to solve right now. > Over time you end up with a bunch of localized hacks that > collective make the system unpredictable and inconsistent. > > It is fundamental, priority is in the eyes of the receiver > only. The sender has no sense, knowledge or standing as to > whether a message is higher priority than any other. A > decision today on priority will necessarily change when a new > process or new message types are added to the system. You > should not architect a system which depends on knowledge of > that sort being distributed among many components -- you > will encounter a policy change that is extremely difficult to make. > The purpose of the router is not only to solve an erlang > implementation challenge. It also isolates all knowledge of > prioritization (which may be dependent on adaptive operational > considerations) so that there is a separation of concerns. > > jay > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yerl@REDACTED Sun Jul 8 01:59:05 2007 From: yerl@REDACTED (Yerl) Date: Sun, 08 Jul 2007 01:59:05 +0200 Subject: [erlang-questions] Erlang Graphics (gs module) Message-ID: <469028C9.9070907@club-internet.fr> Hi! I would like to know how "gs" proceeds to glue with "tcl/tk" APIs? I'm interested to change the default "gs" theme to something more elegant by using Tile engine (http://tktable.sourceforge.net/tile/news.html) for our products. Thanks in advance for any doc or pointer. cheers Y. From saleyn@REDACTED Sun Jul 8 05:08:11 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 07 Jul 2007 22:08:11 -0500 Subject: [erlang-questions] SNMP get-bulk Message-ID: <4690551B.9040102@gmail.com> I would like to use Erlang's SNMP agent for monitoring external OS processes written in C. For this purpose all get/set requests coming from an SNMP manager will be marshaled to the C process using Erlang external term serialization and ei on the C side (where the C processes would be either ports supervised by an Erlang node running the SNMP agent, or connected to Erlang via a socket). In order to optimize the number of IPC turnarounds between the the SNMP agent and a C process, I'd like to ensure that SNMP v2c GET-BULK requests are relayed to a C process as a whole (i.e. all N OIDs requested to get are forwarded to the C process as one transaction from the SNMP agent rather than N individual transactions). Is this doable? Serge From bjorn@REDACTED Sun Jul 8 10:19:02 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Jul 2007 10:19:02 +0200 Subject: [erlang-questions] Using system's zlib In-Reply-To: <20070706195050.298bd47e@luna.home> References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> <20070706195050.298bd47e@luna.home> Message-ID: We might do some changes in R12B to make it easier to use the system zlib. /Bjorn Christian Faulhammer writes: > * PGP Signed by an unknown key: 07/06/2007 at 07:50:50 PM > Gaspar Chilingarov : > > > Christian Faulhammer wrote: > > > Gaspar Chilingarov : > > >> AFAIK no, because erlang's zlib is heavily patched :) > > > Doh. I don't really like that...is there any chance that one day > > > erlang can use vanilla zlib? How heavy are the patches? Could zlib > > > upstream integrate them? > > at current moment erlang uses zlib v. 1.2.3, which is the latest > > according to zlib's official site. > > Good to know. > > > About patches -- it took me about 1-2 day to merge in new version of > > zlib to erlang sources :) > > Still, are those patches very special or could upstream provide your > needed features? > > > In other hand -- what's the reason to include system zlib, if now > > it's shipped with latest version of zlib? > > As I am maintainer of erlang in Gentoo Linux, I have a bug open asking > for using system's zlib, but that is not important to you. :) > Take it that there is a security flaw in zlib. zlib in Gentoo is > updated, stabled and done. Nobody thinks of erlang (or any other > package shipping a custom version of zlib instead of linking against > the system one), so we have a possibly vulnerable version in the tree. > Which is baaaaad. Backporting patches from vanilla zlib to erlang is > just needless work in my eyes, and I have to be aware of these fixes > or even of an included library (there may be more I don't know about). > > V-Li > > -- > http://www.gentoo.org/ > http://www.faulhammer.org/ > http://www.gnupg.org/ > * Unknown Key > * 0x2B859DE3 (L) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rsaccon@REDACTED Sun Jul 8 10:51:52 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 8 Jul 2007 05:51:52 -0300 Subject: [erlang-questions] erlang startup problem on Ubuntu Feisty / XEN Message-ID: Erlang: R11B5 from cean OS: Ubuntu Feisty under XEN the problem only happens when I automatically start an erlang VM at reboot (tried either with init.d scripts or from crontab). I get a crashdump which starts as follow: =erl_crash_dump:0.1 Sun Jul 8 04:19:09 2007 Slogan: Unexpected behaviour from operating system high resolution timerSystem version: Erlang (BEAM) emulator version 5.5.5 [source] [async-thread s:0] [hipe] [kernel-poll:false] I also tried just to add a sleep time to my shell start script, before starting erlang, it did not change anything. Again, when I start erlang from a shell, everything is normal Anybody an idea how I can get this working ? -- Roberto Saccon From rsaccon@REDACTED Sun Jul 8 11:04:45 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sun, 8 Jul 2007 06:04:45 -0300 Subject: [erlang-questions] erlang startup problem on Ubuntu Feisty / XEN In-Reply-To: References: Message-ID: Update: I increased the sleep time form 10 seconds to 60 and then it worked. Very strange. On 7/8/07, Roberto Saccon wrote: > Erlang: R11B5 from cean > OS: Ubuntu Feisty under XEN > > the problem only happens when I automatically start an erlang VM at > reboot (tried either with init.d scripts or from crontab). I get a > crashdump which starts as follow: > > =erl_crash_dump:0.1 > Sun Jul 8 04:19:09 2007 > Slogan: Unexpected behaviour from operating system high resolution > timerSystem version: Erlang (BEAM) emulator version 5.5.5 [source] > [async-thread > s:0] [hipe] [kernel-poll:false] > > I also tried just to add a sleep time to my shell start script, > before starting erlang, it did not change anything. > > Again, when I start erlang from a shell, everything is normal > > Anybody an idea how I can get this working ? > > -- > Roberto Saccon > -- Roberto Saccon From bbmaj7@REDACTED Sun Jul 8 12:03:02 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Sun, 8 Jul 2007 20:03:02 +1000 (EST) Subject: [erlang-questions] erlang startup problem on Ubuntu Feisty / XEN In-Reply-To: Message-ID: <22415.92687.qm@web52002.mail.re2.yahoo.com> --- Roberto Saccon wrote: > OS: Ubuntu Feisty under XEN *headslap* Ya ... replied before I read it thoroughly. So ntp isn't going to be the issue if it is only the VM which is restarting. It could be a CPU starvation issue, as the clock in the guest can only be updated when the guest process is scheduled to run. Boot time is typically one of the most intense CPU usage times - the host needs to read a lot of data for the guest from disk. If it's starvation this might be aleviated by using a (-)ve nice value on the guest OS process, or within the guest with a (-v) nice on the erlang machine (this one particularly if it runs OK in a terminal which get an interactive scheduling boost - although I'm not sure how you get a terminal before boot completes). Is there only one guest starting or many? ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From bbmaj7@REDACTED Sun Jul 8 11:53:37 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Sun, 8 Jul 2007 19:53:37 +1000 (EST) Subject: [erlang-questions] erlang startup problem on Ubuntu Feisty / XEN In-Reply-To: Message-ID: <687148.81777.qm@web52003.mail.re2.yahoo.com> --- Roberto Saccon wrote: > I also tried just to add a sleep time to my shell start script, > before starting erlang, it did not change anything. > > Again, when I start erlang from a shell, everything is normal > > Anybody an idea how I can get this working ? Maybe ntp; something changing your system clock after boot time. Since it takes time to occur (you said 60 sec is OK) then it very likely ntp as it takes at least this long to start drifting the system clock toward UTC. If it is ntp, you could use ntpdate to change the clock once before starting erlang, but be warned this may be destructive to other components. Waiting on ntpstat to indicate a "close enough" time match might be your most reliable option. ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From opfer@REDACTED Sun Jul 8 13:00:13 2007 From: opfer@REDACTED (Christian Faulhammer) Date: Sun, 8 Jul 2007 13:00:13 +0200 Subject: [erlang-questions] Using system's zlib In-Reply-To: References: <20070705111951.2ec4bef8@luna.home> <468D0082.4060908@web.am> <20070706075718.52519b53@luna.home> <468DE96B.2030703@web.am> <20070706195050.298bd47e@luna.home> Message-ID: <20070708130013.20792618@luna.home> Bjorn Gustavsson : > We might do some changes in R12B to make it easier to use > the system zlib. How might those changes look like? V-Li -- http://www.gentoo.org/ http://www.faulhammer.org/ http://www.gnupg.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From babo.online@REDACTED Sun Jul 8 14:26:06 2007 From: babo.online@REDACTED (Attila Babo) Date: Sun, 8 Jul 2007 15:26:06 +0300 Subject: [erlang-questions] erlang startup problem on Ubuntu Feisty / XEN In-Reply-To: References: Message-ID: <597c69660707080526t24e26761tf84f4a8e68dd0f30@mail.gmail.com> On Feisty Fawn I'm using upstart - http://upstart.ubuntu.com/ - to start my code without any problem with R11B5. Never tried tried the CEAN version, but either official or locally complied erlangs are fine in this way. Here is a simple version, just add add a similar text file with 644 privileges to your /etc/event.d folder like this: start on my-service start on runlevel 2 start on runlevel 3 stop on runlevel 0 stop on runlevel 1 stop on runlevel 4 stop on runlevel 5 stop on runlevel 6 script HOME=/usr/local/my-service export HOME cd $HOME /erlang/bin/erl -noshell -s main end script To start it for test use sudo initctl emit my-service or sudo initctl start xxx, where xxx is your scripts file name from event.d folder. I hope this helps, any comments are welcome! Attila -------------- next part -------------- An HTML attachment was scrubbed... URL: From m5@REDACTED Sun Jul 8 18:25:32 2007 From: m5@REDACTED (Mike McNally) Date: Sun, 8 Jul 2007 11:25:32 -0500 Subject: [erlang-questions] split_binary simple question Message-ID: <20070708162532.GA17484@works.com> Does split_binary/2 make two new copies of the pieces of the binary that's split? I would think not, but the documentation (which, it should be noted, I have a history of misunderstanding) doesn't say explicitly. -- [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED From per.gustafsson@REDACTED Sun Jul 8 19:01:45 2007 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Sun, 08 Jul 2007 19:01:45 +0200 Subject: [erlang-questions] split_binary simple question In-Reply-To: <20070708162532.GA17484@works.com> References: <20070708162532.GA17484@works.com> Message-ID: <46911879.5010904@it.uu.se> Mike McNally wrote: > Does split_binary/2 make two new copies of the pieces of the binary > that's split? I would think not, but the documentation (which, it should > be noted, I have a history of misunderstanding) doesn't say explicitly. > > > -- > [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > split_binary/2 does not create two new copies. It creates pointers into the original binary. Per From ulf@REDACTED Sun Jul 8 19:47:21 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 8 Jul 2007 19:47:21 +0200 Subject: [erlang-questions] split_binary simple question In-Reply-To: <20070708162532.GA17484@works.com> References: <20070708162532.GA17484@works.com> Message-ID: <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> No, you will get two references into the original binary. BR, Ulf W 2007/7/8, Mike McNally : > Does split_binary/2 make two new copies of the pieces of the binary > that's split? I would think not, but the documentation (which, it should > be noted, I have a history of misunderstanding) doesn't say explicitly. > > > -- > [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From saleyn@REDACTED Sun Jul 8 21:48:00 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 08 Jul 2007 14:48:00 -0500 Subject: [erlang-questions] SNMP get-bulk In-Reply-To: <4690551B.9040102@gmail.com> References: <4690551B.9040102@gmail.com> Message-ID: <46913F70.2010509@gmail.com> I realized that an SNMP sub-agent can accomplish this goal. Are there any examples of how to write a sub-agent? Serge Aleynikov wrote: > I would like to use Erlang's SNMP agent for monitoring external OS > processes written in C. For this purpose all get/set requests coming > from an SNMP manager will be marshaled to the C process using Erlang > external term serialization and ei on the C side (where the C processes > would be either ports supervised by an Erlang node running the SNMP > agent, or connected to Erlang via a socket). In order to optimize the > number of IPC turnarounds between the the SNMP agent and a C process, > I'd like to ensure that SNMP v2c GET-BULK requests are relayed to a C > process as a whole (i.e. all N OIDs requested to get are forwarded to > the C process as one transaction from the SNMP agent rather than N > individual transactions). > > Is this doable? > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From anthony.hw.kong@REDACTED Sun Jul 8 23:56:38 2007 From: anthony.hw.kong@REDACTED (Anthony Kong) Date: Mon, 9 Jul 2007 07:56:38 +1000 Subject: [erlang-questions] Erlang programming question: "record abc already defined" Message-ID: Hi, all, It is a erlang question form a firsttime beginner. So, bear with me if the source of problem is obvious. I got a bunch of message like this when I run erlc against a number of erl files. Here are some examples: ./reqmgt.hrl:14: record project already defined ./reqmgt.hrl:14: record project already defined ./reqmgt.hrl:14: record project already defined ./reqmgt.hrl:14: record project already defined ./reqmgt.hrl:14: record project already defined ./reqmgt.hrl:14: record project already defined Let's say I have these files regmgt.erl, regmgt.hrl, project.erl, abc.erl, def.erl. Except for the hrl files, they are all 1) based on the gen_server_template.mini from Joe's book 2) project, abc, def contains logic related to a particular record class. So, project.erl knows how to handle -record(proect, {...}) 3) I am a java programmer, so the design of the project.erl, abc, def are basically to handle CRUD. 4) reqmgt.erl is an implementation following a Facade pattern. 5) each of these erl files has a line "-include (reqmgt.hrl)" in reqmgt.hrl I have define "-record(project, {...})" and abc, def etc. (Yes, I am using hrl as if it is a C include file but not knowing how to do "#ifndef" :-) ) So, questions: 1) Is it wrong to use "-include" this way? If so, how to fix it? 2) Does this 'design' sound OK in erlang? Sorry, googling using erlang and "-include" come up with a lot of noise. If it is already mentioned in OTP manual, pls kindly let me know the relevant url/section. Cheers, Anthony -- /*--*/ Experience is simply the name we give our mistakes. ---- Oscar Wilde From anthony.hw.kong@REDACTED Mon Jul 9 00:00:46 2007 From: anthony.hw.kong@REDACTED (Anthony Kong) Date: Mon, 9 Jul 2007 08:00:46 +1000 Subject: [erlang-questions] avoid -import. Why? Message-ID: Hi, all, In reading this resource ( http://www.erlang.se/doc/programming_rules.shtml, ), I found this statement, Don't use -import, using it makes the code harder to read since you cannot directly see in what module a function is defined. Use exref (Cross Reference Tool) to find module dependencies. I do not think I understand why it is the case, and could not find the tool exref from the erlang distribution. If anyone can shed some light, most appreciate. Cheers, Anthony -- /*--*/ Experience is simply the name we give our mistakes. ---- Oscar Wilde From kenneth.lundin@REDACTED Mon Jul 9 00:16:37 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 9 Jul 2007 00:16:37 +0200 Subject: [erlang-questions] avoid -import. Why? In-Reply-To: References: Message-ID: Hi, The programming_rules document is quite old and need to be updated but I think most of it is still valid. I think the "don't use import is still as valid as it was when the recommendation was written. The code is usually much easier to read when you can see from the syntax which module the function you are calling resides in and that all calls without module qualifier is local calls. I know other variant of this rule where only very well known modules in stdlib like lists are imported and all other calls uses explicit module qualifier. The tool exref is replaced with xref since several years. /Kenneth (OTP team at Ericsson) On 7/9/07, Anthony Kong wrote: > Hi, all, > > In reading this resource ( > http://www.erlang.se/doc/programming_rules.shtml, > ), I found this statement, > > Don't use -import, using it makes the code harder to read since you > cannot directly see in what module a function is defined. Use exref > (Cross Reference Tool) to find module dependencies. > > I do not think I understand why it is the case, and could not find the > tool exref from the erlang distribution. > > If anyone can shed some light, most appreciate. > > Cheers, Anthony > > -- > /*--*/ > Experience is simply the name we give our mistakes. > ---- Oscar Wilde > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Mon Jul 9 00:21:19 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 09 Jul 2007 00:21:19 +0200 Subject: [erlang-questions] avoid -import. Why? In-Reply-To: References: Message-ID: <4691635F.3000907@cs.ntua.gr> Anthony Kong wrote: > Hi, all, > > In reading this resource ( > http://www.erlang.se/doc/programming_rules.shtml, > ), I found this statement, > > Don't use -import, using it makes the code harder to read since you > cannot directly see in what module a function is defined. Use exref > (Cross Reference Tool) to find module dependencies. > > I do not think I understand why it is the case, and could not find the > tool exref from the erlang distribution. > > If anyone can shed some light, most appreciate. Different people might give you different answers to this question. Below are mine: 1. In general, I do not like imports because they obscure they syntactic distinction of local vs. remote function calls. In Erlang, local function calls are of the form f(...) while remote ones of the form m:f(...). With imports even remote function calls look of the form f(...) (I believe this is what the above statement is in the manual is referring to.) 2. Occasionally, I want to find all calls to a function m:f/a and for that I use 'grep'. Because of #1, there is no convenient one liner that can give me the places of all these calls. Btw, the reference to the "exref" tool is most probably a reference ro "xref". Kostis From bengt.kleberg@REDACTED Mon Jul 9 12:27:02 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 09 Jul 2007 12:27:02 +0200 Subject: [erlang-questions] Erlang programming question: "record abc already defined" In-Reply-To: References: Message-ID: <46920D76.1050906@ericsson.com> On 2007-07-08 23:56, Anthony Kong wrote: > Hi, all, > > It is a erlang question form a firsttime beginner. So, bear with me if > the source of problem is obvious. no problem, everybody was a beginner at some time. > I got a bunch of message like this when I run erlc against a number of > erl files. Here are some examples: > > ./reqmgt.hrl:14: record project already defined > ./reqmgt.hrl:14: record project already defined > ./reqmgt.hrl:14: record project already defined > ./reqmgt.hrl:14: record project already defined > ./reqmgt.hrl:14: record project already defined > ./reqmgt.hrl:14: record project already defined next time, could you give the whole command line? and perhaps just one example if they all look the same? > Let's say I have these files regmgt.erl, regmgt.hrl, project.erl, > abc.erl, def.erl. > > Except for the hrl files, they are all have you other hrl files, too? there is only one hrl file in you example, but you mention ''hrl files''. > 1) based on the gen_server_template.mini from Joe's book > 2) project, abc, def contains logic related to a particular record > class. So, project.erl knows how to handle -record(proect, {...}) > 3) I am a java programmer, so the design of the project.erl, abc, def > are basically to handle CRUD. > 4) reqmgt.erl is an implementation following a Facade pattern. > 5) each of these erl files has a line "-include (reqmgt.hrl)" > > in reqmgt.hrl I have define "-record(project, {...})" and abc, def etc. > > (Yes, I am using hrl as if it is a C include file but not knowing how > to do "#ifndef" :-) ) in erlang you can do: -ifndef(MNESIA_TABLES_HRL). -define(MNESIA_TABLES_HRL, 1). %% lots of defines/records/etc -endif. % NIBS_MNESIA_TABLES_HRL defined > So, questions: > > 1) Is it wrong to use "-include" this way? If so, how to fix it? since you get a compile time error it sure is wrong :-) seriously, lots (a large majority, at a guess) of very good erlang programmers like to have records defined in common hrl files and shared in several erl files. i do not like the idea and try to avoid it if i can. > 2) Does this 'design' sound OK in erlang? one possibility is to hide your record in an erl file and have table create/access functions. that helps when loading new modules after upgrading records. bengt -- Those were the days... 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 joelr1@REDACTED Mon Jul 9 16:36:17 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 9 Jul 2007 15:36:17 +0100 Subject: [erlang-questions] JavaScript compiler for Erlang Message-ID: Folks, Is Erlang a good platform to compile JavaScript to? Just gathering opinions. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From david.hopwood@REDACTED Mon Jul 9 18:11:00 2007 From: david.hopwood@REDACTED (David Hopwood) Date: Mon, 09 Jul 2007 17:11:00 +0100 Subject: [erlang-questions] Intermittent failures *reconnecting* C hidden nodes In-Reply-To: <5d34bb3f0707061930o6b4eec2l3c5415e78cd049d2@mail.gmail.com> References: <5d34bb3f0707061930o6b4eec2l3c5415e78cd049d2@mail.gmail.com> Message-ID: <46925E14.4020301@industrial-designers.co.uk> Andy Sloane wrote:- > Now... In my reading of the code, the only way the 'nok' can be sent > is if handle_info({...,{accept_pending,...}},...) in net_kernel.erl > returns 'nok_pending' to mark_pending/1 in dist_util.erl, like so: > > handle_info({AcceptPid, {accept_pending,MyNode,Node,Address,Type}}, State) -> > case ets:lookup(sys_dist, Node) of > [#connection{state=pending}=Conn] -> > if > MyNode > Node -> > AcceptPid ! {self(),{accept_pending,nok_pending}}, > {noreply,State}; > true -> > [...snip] > > If I'm reading that right, it's doing a *lexical comparison* of the > local node name atom with the connecting one. I cannot fathom why you > would want to do that... It's quite a common technique in distribution protocols to impose a priority order on nodes, so that when a given pair of nodes communicate, one consistently has the higher priority, and the other the lower. Here it seems that node names are being used for this ordering. Perhaps when the node comes back up with a different name, some assumption made by the distribution protocol is being violated. This is just speculation, though; I don't know the protocol in detail. -- David Hopwood From vamlists@REDACTED Tue Jul 10 00:38:53 2007 From: vamlists@REDACTED (Vamsee Kanakala) Date: Tue, 10 Jul 2007 04:08:53 +0530 Subject: [erlang-questions] cean:available(). not working? Message-ID: <4692B8FD.2000105@gmail.com> Hi, An Erlang noob here. I am trying to get cean working under my existing Erlang install in Ubuntu Feisty. I installed the cean library, set up the export commands in the erl script, cean seems to be installed properly, but when I do type cean:available()., I get this instead of the package listing: 1> cean:available(). [" _uacct = \"UA", " urchinTracker();", " \"Valid", "", "", "", "", "", "Documentation", "FAQ", "Stats", "About", "Contribute", "Packages", "Download", "", "", "", "", "
", "
"|...] However, cean:search seems to be working properly, but when I try to install a found package through cean:install, it says the package is not found: 3> cean:search("mysql"). [{"mysql","MySQL native driver"}] 4> cean:install(mysql). error: mysql not found in download error Any pointers? Thanks, Vamsee. From beepblip@REDACTED Tue Jul 10 08:23:12 2007 From: beepblip@REDACTED (beepblip@REDACTED) Date: Mon, 9 Jul 2007 23:23:12 -0700 Subject: [erlang-questions] best way to do live code update Message-ID: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> hi, what is the best way to do design a system for live code update? in theory, i would like to ship a tar/bundle/etc with all the necessary code. the end user should be able to load that while the system is running and then proceed as thogh nothing much has changed. this should be similar to a live code update that was done on the network gear that erlang ran on. how does one structure their project to accomplish this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Tue Jul 10 08:41:40 2007 From: jeffm@REDACTED (jm) Date: Tue, 10 Jul 2007 16:41:40 +1000 Subject: [erlang-questions] best way to do live code update In-Reply-To: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> References: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> Message-ID: <46932A24.6040708@ghostgun.com> beepblip@REDACTED wrote: > hi, > > what is the best way to do design a system for live code update? > in theory, i would like to ship a tar/bundle/etc with all the necessary > code. the end user should be able to load that while the system > is running and then proceed as thogh nothing much has changed. > > this should be similar to a live code update that was done on the > network gear that erlang ran on. > > how does one structure their project to accomplish this? If you don't mind the blind leading the blind...There's a section in "OTP Design Principles" ( http://www.erlang.org/doc/pdf/design_principles.pdf ) that covers releases starts around page 46. http://www.trapexit.org/index.php/Building_An_OTP_Application also has a section on releases. I've done niether myself though. Is this what your referring to or some finer point I've missed? Jeff. From christophe.romain@REDACTED Tue Jul 10 09:14:28 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Tue, 10 Jul 2007 09:14:28 +0200 Subject: [erlang-questions] cean:available(). not working? In-Reply-To: <4692B8FD.2000105@gmail.com> References: <4692B8FD.2000105@gmail.com> Message-ID: <616435DC-D6B0-495D-AD10-516DE5B76D22@process-one.net> Hi You are using a freshly new usage of CEAN. your problem is due to a lack of the VERSION file. I forgot that point on the FAQ and will correct that. you have to create the erlang/VERSION file containing this: CEAN Erlang/OTP R11B 5.5.5 you must replace by your effective system architecture (windows,linux-x86,darwin-x86,...) you must choose a distrib, which should be devel on a standard erlang installation example: CEAN Erlang/OTP R11B 5.5.5 linux-x86 devel From casper2000a@REDACTED Tue Jul 10 09:16:56 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 10 Jul 2007 12:46:56 +0530 Subject: [erlang-questions] Erlang OTP design principle In-Reply-To: <6616D98C65DD514BA2E1DDC5F92231550212C0E2@esealmw115.eemea.ericsson.se> Message-ID: <20070710071658.2735A19DC2C7@mail.wavenet.lk> Using {active, once} or {active, true} instead of gen_tcp:recv, I can use a gen_server or my own OTP compliant process to receive TCP messages. But what about gen_tcp:accept? Since this is a blocking function, if I try to do a code load, the Acceptor Thread gets killed? Is there anyway that I can write this better? BRgds, - Eranga -----Original Message----- From: Ulf Wiger (TN/EAB) [mailto:ulf.wiger@REDACTED] Sent: Monday, June 11, 2007 2:48 PM To: Eranga Udesh; erlang-questions@REDACTED Subject: RE: [erlang-questions] Erlang OTP design principle If you want to be able to handle messages while waiting for a TCP message, you may want to use inet:setopts(Sock, [{active, once}]), and then wait for the packet in a normal receive clause. If the waiting is done in e.g. a gen_server, you get the handling of system messages for free. Otherwise, you need to read the OTP Design Principles document, http://www.erlang.org/doc/doc-5.5.4/doc/design_principles/part_frame.htm l chapter 6.2 "Special Processes", on how to handle system messages on your own. (or use something like plain_fsm in Jungerl, if you really want to write textbook receive clauses.) BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh > Sent: den 11 juni 2007 07:08 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Erlang OTP design principle > > Hi, > > What's the best way to make do_recv/2 function below, OTP > compliant? I.e. it should receive messages from other > processes, handle code update requests, terminate, etc. > > Why gen_tcp, gen_udp, etc., are written as behaviors like > gen_server, so that in a handle_*, it will receive incoming > messages, etc? > > Thanks, > - Eranga > > > > > server() -> > {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, > {active, false}]), > {ok, Sock} = gen_tcp:accept(LSock), > {ok, Bin} = do_recv(Sock, []), > ok = gen_tcp:close(Sock), > Bin. > > do_recv(Sock, Bs) -> > case gen_tcp:recv(Sock, 0) of > {ok, B} -> > do_recv(Sock, [Bs, B]); > {error, closed} -> > {ok, list_to_binary(Bs)} > end. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From andy.sloane@REDACTED Tue Jul 10 00:20:02 2007 From: andy.sloane@REDACTED (Andy Sloane) Date: Mon, 9 Jul 2007 17:20:02 -0500 Subject: [erlang-questions] Intermittent failures *reconnecting* C hidden nodes In-Reply-To: <46925E14.4020301@industrial-designers.co.uk> References: <5d34bb3f0707061930o6b4eec2l3c5415e78cd049d2@mail.gmail.com> <46925E14.4020301@industrial-designers.co.uk> Message-ID: <5d34bb3f0707091520j4262a2c2l5459dcd3133779cc@mail.gmail.com> On 7/9/07, David Hopwood wrote: > Perhaps when the node comes back up with a different name, some > assumption made by the distribution protocol is being violated. This > is just speculation, though; I don't know the protocol in detail. I thought of that, and upon further reflection it makes a little sense at least -- it would determine who connects to whom in cases where there might be some ambiguity. In the case of hidden nodes, though, it shouldn't really apply -- our C nodes always have the same name every time they come back up. Regardless, patching up to R11B-5 seems to have solved this issue; at least, it has not recurred yet. So... please disregard my clamoring! As for the other issues I mentioned: our beam instance ran itself out of memory this morning, leaving an incredibly detailed crash dump which has been quite helpful so far -- thank you for making it mostly-human-readable! But the numbers on memory usage don't add up (it had 2.1 gigs allocated, and it tried to allocate an additional 900some megs, but the largest Stack+Heap size is about 130 megs, all backlogged messages, and none of the other processes were above 20k). I'll post a new thread after some more investigation. One other thing: the crash dump may have revealed references to process ids on dead C nodes, which may be a source of many of our problems. -Andy From vamlists@REDACTED Tue Jul 10 10:13:01 2007 From: vamlists@REDACTED (Vamsee Kanakala) Date: Tue, 10 Jul 2007 13:43:01 +0530 Subject: [erlang-questions] cean:available(). not working? References: 4692B8FD.2000105@gmail.com Message-ID: <46933F8D.5080205@gmail.com> Thanks Christophe, that solved my problem. Vamsee. P.S: Sorry for cutting off the context - seems like your reply wasn't delivered to my mail account, so I had to reply from the archive. From joelr1@REDACTED Tue Jul 10 12:08:31 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 10 Jul 2007 11:08:31 +0100 Subject: [erlang-questions] case and pattern matching Message-ID: <54E99B8C-A4E1-4343-89C2-63A9F16659AC@gmail.com> Folks, What do you do when two clauses in your case statement need to share the code? Do you create an anonymous function and reuse it? I really wish there was a way to combine patterns but I can't seem to find any. Consider the following bit of Mnesia code: init_indecies(Tab, Storage, PosList) -> case Storage of unknown -> ignore; s3_copies -> ignore; disc_only_copies -> init_disc_index(Tab, PosList); ram_copies -> make_ram_index(Tab, PosList); disc_copies -> make_ram_index(Tab, PosList) end. What I would like to do is join unknown and s3_copies or maybe ram_copies and disc_copies in a single pattern match like uknown | s3_copies -> ... Is this possible? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From bengt.kleberg@REDACTED Tue Jul 10 12:40:38 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 10 Jul 2007 12:40:38 +0200 Subject: [erlang-questions] case and pattern matching In-Reply-To: <54E99B8C-A4E1-4343-89C2-63A9F16659AC@gmail.com> References: <54E99B8C-A4E1-4343-89C2-63A9F16659AC@gmail.com> Message-ID: <46936226.1030907@ericsson.com> On 2007-07-10 12:08, Joel Reymont wrote: > Folks, > > What do you do when two clauses in your case statement need to share > the code? Do you create an anonymous function and reuse it? > > I really wish there was a way to combine patterns but I can't seem to > find any. Consider the following bit of Mnesia code: > > init_indecies(Tab, Storage, PosList) -> > case Storage of > unknown -> > ignore; > s3_copies -> > ignore; > disc_only_copies -> > init_disc_index(Tab, PosList); > ram_copies -> > make_ram_index(Tab, PosList); > disc_copies -> > make_ram_index(Tab, PosList) > end. > > What I would like to do is join unknown and s3_copies or maybe > ram_copies and disc_copies in a single pattern match like > > uknown | s3_copies -> ... > > Is this possible? perhaps this is what you want: case Storage of unknown -> ignore; %% ... Copies when (Copies =:= ram_copies) orelse (Copies =:= disc_copies) -> make_ram_index(Tab, PosList) end. bengt -- Those were the days... 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 igwan@REDACTED Tue Jul 10 12:41:40 2007 From: igwan@REDACTED (igwan) Date: Tue, 10 Jul 2007 12:41:40 +0200 Subject: [erlang-questions] case and pattern matching In-Reply-To: <54E99B8C-A4E1-4343-89C2-63A9F16659AC@gmail.com> References: <54E99B8C-A4E1-4343-89C2-63A9F16659AC@gmail.com> Message-ID: <46936264.3070905@free.fr> Hi, You can use guards as below : init_indecies(Tab, Storage, PosList) -> case Storage of S when S==unknown;S==s3_copies -> ignore; disc_only_copies -> init_disc_index(Tab, PosList); S when S==ram_copies;S==disc_copies -> make_ram_index(Tab, PosList) end. You're forced to bind a variable and I also sometimes wish there was a shorter way of writing it too. igwan Joel Reymont a ?crit : > Folks, > > What do you do when two clauses in your case statement need to share > the code? Do you create an anonymous function and reuse it? > > I really wish there was a way to combine patterns but I can't seem to > find any. Consider the following bit of Mnesia code: > > init_indecies(Tab, Storage, PosList) -> > case Storage of > unknown -> > ignore; > s3_copies -> > ignore; > disc_only_copies -> > init_disc_index(Tab, PosList); > ram_copies -> > make_ram_index(Tab, PosList); > disc_copies -> > make_ram_index(Tab, PosList) > end. > > What I would like to do is join unknown and s3_copies or maybe > ram_copies and disc_copies in a single pattern match like > > uknown | s3_copies -> ... > > Is this possible? > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From saleyn@REDACTED Tue Jul 10 13:56:25 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Tue, 10 Jul 2007 06:56:25 -0500 Subject: [erlang-questions] Erlang OTP design principle In-Reply-To: <20070710071658.2735A19DC2C7@mail.wavenet.lk> References: <20070710071658.2735A19DC2C7@mail.wavenet.lk> Message-ID: <469373E9.1040906@gmail.com> There's a prim_inet:async_accept/2 function that does what you need: {ok, Ref} = prim_inet:async_accept(Listen_socket, -1), Here's a snippet from a non-blocking tcp gen_server that exploits this feature: init(Port, Module) -> process_flag(trap_exit, true), case gen_tcp:listen(Port, ?LISTEN_SOCK_OPTIONS) of {ok, Listen_socket} -> %%Create first accepting process {ok, Ref} = prim_inet:async_accept(Listen_socket, -1), {ok, #state{module=Module, listener=Listen_socket, acceptor=Ref}}; {error, Reason} -> {stop, Reason} end. handle_info({inet_async, ListSock, Ref, {ok, CliSocket}}, #state{module=Module, listener=ListSock, acceptor=Ref} = State) -> %% New client connected {ok, Pid} = erlang:apply(Module, start_link, [CliSocket]), gen_tcp:controlling_process(CliSocket, Pid), %% Instruct the new TCP server that it owns the socket Pid ! socket_ready, {ok, NewRef} = prim_inet:async_accept(ListSock, -1), {noreply, State#state{acceptor=NewRef}}; handle_info({inet_async, ListSock, Ref, Error}, #state{listener=ListSock, acceptor=Ref} = State) -> error_logger:error_msg("Error in socket acceptor: ~p. Retrying.\n", [Error]), {stop, {acceptor, Error}}; Eranga Udesh wrote: > Using {active, once} or {active, true} instead of gen_tcp:recv, I can use a > gen_server or my own OTP compliant process to receive TCP messages. > > But what about gen_tcp:accept? Since this is a blocking function, if I try > to do a code load, the Acceptor Thread gets killed? Is there anyway that I > can write this better? > > BRgds, > - Eranga > > > > > -----Original Message----- > From: Ulf Wiger (TN/EAB) [mailto:ulf.wiger@REDACTED] > Sent: Monday, June 11, 2007 2:48 PM > To: Eranga Udesh; erlang-questions@REDACTED > Subject: RE: [erlang-questions] Erlang OTP design principle > > > If you want to be able to handle messages while > waiting for a TCP message, you may want to use > inet:setopts(Sock, [{active, once}]), and then > wait for the packet in a normal receive clause. > > If the waiting is done in e.g. a gen_server, you > get the handling of system messages for free. > Otherwise, you need to read the OTP Design Principles > document, > > http://www.erlang.org/doc/doc-5.5.4/doc/design_principles/part_frame.htm > l > > chapter 6.2 "Special Processes", on how to handle > system messages on your own. > > (or use something like plain_fsm in Jungerl, if > you really want to write textbook receive clauses.) > > BR, > Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh >> Sent: den 11 juni 2007 07:08 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Erlang OTP design principle >> >> Hi, >> >> What's the best way to make do_recv/2 function below, OTP >> compliant? I.e. it should receive messages from other >> processes, handle code update requests, terminate, etc. >> >> Why gen_tcp, gen_udp, etc., are written as behaviors like >> gen_server, so that in a handle_*, it will receive incoming >> messages, etc? >> >> Thanks, >> - Eranga >> >> >> >> >> server() -> >> {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, >> {active, false}]), >> {ok, Sock} = gen_tcp:accept(LSock), >> {ok, Bin} = do_recv(Sock, []), >> ok = gen_tcp:close(Sock), >> Bin. >> >> do_recv(Sock, Bs) -> >> case gen_tcp:recv(Sock, 0) of >> {ok, B} -> >> do_recv(Sock, [Bs, B]); >> {error, closed} -> >> {ok, list_to_binary(Bs)} >> end. >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From igwan@REDACTED Tue Jul 10 12:58:08 2007 From: igwan@REDACTED (igwan) Date: Tue, 10 Jul 2007 12:58:08 +0200 Subject: [erlang-questions] Erlang OTP design principle In-Reply-To: <20070710071658.2735A19DC2C7@mail.wavenet.lk> References: <20070710071658.2735A19DC2C7@mail.wavenet.lk> Message-ID: <46936640.8070203@free.fr> Hi, I had a similar issue last month. This post might be of interest to you : http://www.erlang.org/pipermail/erlang-questions/2007-June/027555.html In short, you can make the accept mechanism asynchronous, but at the price of using internal undocumented functions (prim_inet:async_accept/2). It returns immediately and sends your process a message when a new connection arrives on your listening socket. For the format of the message received, it's best to look in the prim_inet.erl, especially how the accept (synchronous) function works. It seems that upon receiving the message you have to get opts from the listening socket, and set them to the new connection socket. igwan Eranga Udesh a ?crit : > Using {active, once} or {active, true} instead of gen_tcp:recv, I can use a > gen_server or my own OTP compliant process to receive TCP messages. > > But what about gen_tcp:accept? Since this is a blocking function, if I try > to do a code load, the Acceptor Thread gets killed? Is there anyway that I > can write this better? > > BRgds, > - Eranga > > > > > -----Original Message----- > From: Ulf Wiger (TN/EAB) [mailto:ulf.wiger@REDACTED] > Sent: Monday, June 11, 2007 2:48 PM > To: Eranga Udesh; erlang-questions@REDACTED > Subject: RE: [erlang-questions] Erlang OTP design principle > > > If you want to be able to handle messages while > waiting for a TCP message, you may want to use > inet:setopts(Sock, [{active, once}]), and then > wait for the packet in a normal receive clause. > > If the waiting is done in e.g. a gen_server, you > get the handling of system messages for free. > Otherwise, you need to read the OTP Design Principles > document, > > http://www.erlang.org/doc/doc-5.5.4/doc/design_principles/part_frame.htm > l > > chapter 6.2 "Special Processes", on how to handle > system messages on your own. > > (or use something like plain_fsm in Jungerl, if > you really want to write textbook receive clauses.) > > BR, > Ulf W > > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh >> Sent: den 11 juni 2007 07:08 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Erlang OTP design principle >> >> Hi, >> >> What's the best way to make do_recv/2 function below, OTP >> compliant? I.e. it should receive messages from other >> processes, handle code update requests, terminate, etc. >> >> Why gen_tcp, gen_udp, etc., are written as behaviors like >> gen_server, so that in a handle_*, it will receive incoming >> messages, etc? >> >> Thanks, >> - Eranga >> >> >> >> >> server() -> >> {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, >> {active, false}]), >> {ok, Sock} = gen_tcp:accept(LSock), >> {ok, Bin} = do_recv(Sock, []), >> ok = gen_tcp:close(Sock), >> Bin. >> >> do_recv(Sock, Bs) -> >> case gen_tcp:recv(Sock, 0) of >> {ok, B} -> >> do_recv(Sock, [Bs, B]); >> {error, closed} -> >> {ok, list_to_binary(Bs)} >> end. >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tobbe@REDACTED Tue Jul 10 13:07:18 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 10 Jul 2007 13:07:18 +0200 Subject: [erlang-questions] core erlang ? Message-ID: Hi, Is is possible to make the compiler to output the Core Erlang for inspection somehow ? Also, is it possible to inject some Core Erlang into the compiler for compilation ? Are there a nice API for this? Cheers, Tobbe From casper2000a@REDACTED Tue Jul 10 13:11:37 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 10 Jul 2007 16:41:37 +0530 Subject: [erlang-questions] Erlang OTP design principle In-Reply-To: <469373E9.1040906@gmail.com> Message-ID: <20070710111140.0E19819DC3E2@mail.wavenet.lk> Thanks. This is exactly what I was looking for :) BRgds, - Eranga -----Original Message----- From: Serge Aleynikov [mailto:saleyn@REDACTED] Sent: Tuesday, July 10, 2007 5:26 PM To: Eranga Udesh Cc: 'Ulf Wiger (TN/EAB)'; 'Jay Nelson'; erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang OTP design principle There's a prim_inet:async_accept/2 function that does what you need: {ok, Ref} = prim_inet:async_accept(Listen_socket, -1), Here's a snippet from a non-blocking tcp gen_server that exploits this feature: init(Port, Module) -> process_flag(trap_exit, true), case gen_tcp:listen(Port, ?LISTEN_SOCK_OPTIONS) of {ok, Listen_socket} -> %%Create first accepting process {ok, Ref} = prim_inet:async_accept(Listen_socket, -1), {ok, #state{module=Module, listener=Listen_socket, acceptor=Ref}}; {error, Reason} -> {stop, Reason} end. handle_info({inet_async, ListSock, Ref, {ok, CliSocket}}, #state{module=Module, listener=ListSock, acceptor=Ref} = State) -> %% New client connected {ok, Pid} = erlang:apply(Module, start_link, [CliSocket]), gen_tcp:controlling_process(CliSocket, Pid), %% Instruct the new TCP server that it owns the socket Pid ! socket_ready, {ok, NewRef} = prim_inet:async_accept(ListSock, -1), {noreply, State#state{acceptor=NewRef}}; handle_info({inet_async, ListSock, Ref, Error}, #state{listener=ListSock, acceptor=Ref} = State) -> error_logger:error_msg("Error in socket acceptor: ~p. Retrying.\n", [Error]), {stop, {acceptor, Error}}; Eranga Udesh wrote: > Using {active, once} or {active, true} instead of gen_tcp:recv, I can use a > gen_server or my own OTP compliant process to receive TCP messages. > > But what about gen_tcp:accept? Since this is a blocking function, if I try > to do a code load, the Acceptor Thread gets killed? Is there anyway that I > can write this better? > > BRgds, > - Eranga > > > > > -----Original Message----- > From: Ulf Wiger (TN/EAB) [mailto:ulf.wiger@REDACTED] > Sent: Monday, June 11, 2007 2:48 PM > To: Eranga Udesh; erlang-questions@REDACTED > Subject: RE: [erlang-questions] Erlang OTP design principle > > > If you want to be able to handle messages while > waiting for a TCP message, you may want to use > inet:setopts(Sock, [{active, once}]), and then > wait for the packet in a normal receive clause. > > If the waiting is done in e.g. a gen_server, you > get the handling of system messages for free. > Otherwise, you need to read the OTP Design Principles > document, > > http://www.erlang.org/doc/doc-5.5.4/doc/design_principles/part_frame.htm > l > > chapter 6.2 "Special Processes", on how to handle > system messages on your own. > > (or use something like plain_fsm in Jungerl, if > you really want to write textbook receive clauses.) > > BR, > Ulf W > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh >> Sent: den 11 juni 2007 07:08 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Erlang OTP design principle >> >> Hi, >> >> What's the best way to make do_recv/2 function below, OTP >> compliant? I.e. it should receive messages from other >> processes, handle code update requests, terminate, etc. >> >> Why gen_tcp, gen_udp, etc., are written as behaviors like >> gen_server, so that in a handle_*, it will receive incoming >> messages, etc? >> >> Thanks, >> - Eranga >> >> >> >> >> server() -> >> {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, >> {active, false}]), >> {ok, Sock} = gen_tcp:accept(LSock), >> {ok, Bin} = do_recv(Sock, []), >> ok = gen_tcp:close(Sock), >> Bin. >> >> do_recv(Sock, Bs) -> >> case gen_tcp:recv(Sock, 0) of >> {ok, B} -> >> do_recv(Sock, [Bs, B]); >> {error, closed} -> >> {ok, list_to_binary(Bs)} >> end. >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From richardc@REDACTED Tue Jul 10 13:27:21 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 10 Jul 2007 13:27:21 +0200 Subject: [erlang-questions] core erlang ? In-Reply-To: References: Message-ID: <46936D19.9040703@it.uu.se> Torbjorn Tornkvist wrote: > Is is possible to make the compiler to output the > Core Erlang for inspection somehow ? > > Also, is it possible to inject some Core Erlang into > the compiler for compilation ? > > Are there a nice API for this? Yes, there are (undocumented) compiler options "to_core" and "from_core". Look around in lib/compiler/compile.erl for details. /Richard From jez@REDACTED Tue Jul 10 14:48:37 2007 From: jez@REDACTED (jez) Date: Tue, 10 Jul 2007 14:48:37 +0200 Subject: [erlang-questions] Turning off parenthesis matching (erl on debian) Message-ID: <20070710124837.GA17264@almeida.jinsky.com> Hi List, just picked up a copy of Joe's "Programming Erlang". I'm still in the early chapters, but I like what I see so far. Unfortunatly the parens matching feature on the erlang shell is driving me nuts. Don't take this to heart, I'm easily distracted. I couldn't find a solution to this on google, so I was hoping someone on this list could shed some light. I'm running 'Erlang (BEAM) emulator version 5.5.4' on debian (lenny). Thanks, jez From per@REDACTED Tue Jul 10 15:02:32 2007 From: per@REDACTED (Per Hedeland) Date: Tue, 10 Jul 2007 15:02:32 +0200 (CEST) Subject: [erlang-questions] Erlang OTP design principle In-Reply-To: <46936640.8070203@free.fr> Message-ID: <200707101302.l6AD2WHt075707@pluto.hedeland.org> igwan wrote: > >I had a similar issue last month. This post might be of interest to you >: http://www.erlang.org/pipermail/erlang-questions/2007-June/027555.html [snip] >It seems that upon receiving the message you have to get opts from the >listening socket, and set them to the new connection socket. That's entirely optional (but may be a good idea in generic code). It's just that gen_tcp wants to present an interface where all options set on the listen socket are "inherited" by the connection socket. E.g. you can include {active, once} in the options given to gen_tcp:listen/2 even though it's meaningless for the listen socket, and all the connection sockets resulting from 'accept' calls will have {active, once} set from the start - no need to do inet:setopts/2 on them. Kind of nice if you know about it and can rely on it, but I don't see it mentioned in the man page other than implicitly by way of the example. So, if you know that you haven't set any of the options in the fairly short list in prim_inet:accept_opts/2 on the listen socket, or if you are going to set them on the connection socket anyway, there's no need to retrieve them from the listen socket and set them on the connection socket. --Per Hedeland From qrilka@REDACTED Tue Jul 10 15:10:29 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 10 Jul 2007 13:10:29 +0000 Subject: [erlang-questions] Persistent processes Message-ID: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> Is there some way to do subj? I.e. I'd like to spawn a process, then I turn off Erlang emulator and just before that I write the state of the process to the disk. I see erlang:hibernate and sys:suspend but no info about processes surviving emulator restart. The question may seem strange but how can I implement such a behaviour? Regards, Kirill. From lenartlad@REDACTED Tue Jul 10 15:46:14 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 10 Jul 2007 15:46:14 +0200 Subject: [erlang-questions] Persistent processes In-Reply-To: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> References: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> Message-ID: <46938DA6.7040005@volny.cz> Kirill Zaborski wrote: > Is there some way to do subj? I.e. I'd like to spawn a process, then I > turn off Erlang emulator and just before that I write the state of the > process to the disk. I see erlang:hibernate and sys:suspend but no > info about processes surviving emulator restart. > The question may seem strange but how can I implement such a behaviour? Hello, as far as I know there is no BIF that can do that. But process in question can store persistent portion of its state in a mnesia table (identified by unique address) after each checkpoint (for example after each request or after some period of time). Then you can have another (ram_copies) table which maps addresses to actual process pids. If the process state table is of type disc_copies you have persistent processes. At least this is how we are doing it (work still in progress). Hope this helps, Ladislav Lenart From qrilka@REDACTED Tue Jul 10 16:06:40 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Tue, 10 Jul 2007 14:06:40 +0000 Subject: [erlang-questions] Persistent processes In-Reply-To: <46938DA6.7040005@volny.cz> References: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> <46938DA6.7040005@volny.cz> Message-ID: <337538cb0707100706g31be837fo2f4fd4ca8cf7dd83@mail.gmail.com> So the persistent process calls some module:perstist_state(SomeState)? And then after restart some utility process runs persistent_process:start(SomeState)? Quite reasonable, thanks. Regards, Kirill. On 7/10/07, Ladislav Lenart wrote: Kirill Zaborski wrote: > > Is there some way to do subj? I.e. I'd like to spawn a process, then I > > turn off Erlang emulator and just before that I write the state of the > > process to the disk. I see erlang:hibernate and sys:suspend but no > > info about processes surviving emulator restart. > > The question may seem strange but how can I implement such a behaviour? > > Hello, > > as far as I know there is no BIF that can do that. But > process in question can store persistent portion of its > state in a mnesia table (identified by unique address) > after each checkpoint (for example after each request > or after some period of time). Then you can have another > (ram_copies) table which maps addresses to actual process > pids. If the process state table is of type disc_copies > you have persistent processes. > > At least this is how we are doing it (work still in progress). > > Hope this helps, > > Ladislav Lenart > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jay@REDACTED Tue Jul 10 17:00:20 2007 From: jay@REDACTED (Jay Nelson) Date: Tue, 10 Jul 2007 08:00:20 -0700 Subject: [erlang-questions] case and pattern matching Message-ID: Two other choices than using compound guards in case statements: if Storage =:= unknown; Storage =:= s3_copies -> ignore; Storage =:= ram_copies; Storage =:= disc_copies -> make_ram_index (Tab, PosList); Storage =:= disc_only_copies -> init_disc_index(Tab, PosList) end I only use if statements when the guards are applied to different variables in at least two clauses. The case state indicates you are differentiating on a single variable. 2) Write a function to tag the cases properly, then work off the tags: tag_action(unknown) -> ignore; tag_action(s3_copies) -> ignore; tag_action(ram_copies) -> ram_index; tag_action(disc_copies) -> ram_index; tag_action(disc_only_copies) -> disc_index. case tag_action(Storage) of ignore -> ignore; ram_index -> make_ram_index(Tab, PosList); disc_index -> init_disc_index(Tab, PosList) end. The second approach in my mind is clearer and allows you to be more descriptive in the tag_action function with comments as to why the different cases subsume to shared events. It also can grow more easily without becoming unwieldy, as would happen in the compound guard case statments. jay > Joel wrote: > What do you do when two clauses in your case statement need to share > the code? Do you create an anonymous function and reuse it? > I really wish there was a way to combine patterns but I can't seem to > find any. Consider the following bit of Mnesia code: > init_indecies(Tab, Storage, PosList) -> > case Storage of > unknown -> > ignore; > s3_copies -> > ignore; > disc_only_copies -> > init_disc_index(Tab, PosList); > ram_copies -> > make_ram_index(Tab, PosList); > disc_copies -> > make_ram_index(Tab, PosList) > end. From pat.eyler@REDACTED Tue Jul 10 16:17:39 2007 From: pat.eyler@REDACTED (pat eyler) Date: Tue, 10 Jul 2007 08:17:39 -0600 Subject: [erlang-questions] last call -- Utah County Erlounge tonight Message-ID: <6fd0654b0707100717p77a70742lb58cdfe9087e4f21@mail.gmail.com> The Utah County Erlounge will be tonight (July 10th), 7PM at the Novell OSTC. Nothing firm on the schedule, but whatever we do, it'll revolve around erlang. Hope to see some of you there. -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From lenartlad@REDACTED Tue Jul 10 18:00:57 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 10 Jul 2007 18:00:57 +0200 Subject: [erlang-questions] Persistent processes In-Reply-To: <337538cb0707100706g31be837fo2f4fd4ca8cf7dd83@mail.gmail.com> References: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> <46938DA6.7040005@volny.cz> <337538cb0707100706g31be837fo2f4fd4ca8cf7dd83@mail.gmail.com> Message-ID: <4693AD39.2040502@volny.cz> Kirill Zaborski wrote: > So the persistent process calls some module:perstist_state(SomeState)? > And then after restart some utility process runs > persistent_process:start(SomeState)? > Quite reasonable, thanks. Well, in our case each persistent entity is uniquely identified by an address. So the process itself stores its state using something like module:persist_state(Address, State) and is (re)started by persistent_process:start(Address) or persistent_process:start_link(Address) Newly started process (a gen_server) fetches and restores its state during its init. It also writes Address -> self() to second (ram_copies) mapping table. Ladislav Lenart From nm@REDACTED Tue Jul 10 18:57:33 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 10 Jul 2007 21:57:33 +0500 Subject: [erlang-questions] Persistent processes In-Reply-To: <4693AD39.2040502@volny.cz> References: <337538cb0707100610w39d9c7daw3535b4db8e6016f9@mail.gmail.com> <46938DA6.7040005@volny.cz> <337538cb0707100706g31be837fo2f4fd4ca8cf7dd83@mail.gmail.com> <4693AD39.2040502@volny.cz> Message-ID: <4693BA7D.405@web.am> We have added some persistence to our application processes by creating fun (closure), which holds all necessary environment to continue execution later and saving it to the mnesia. I've found that this was a great opportunity to us to make our application delayed jobs management much more simple than in other languages. So we have implemented some generic module -- cron daemon, which takes case of restarting processes after reboot and scheduling them for periodic execution, which takes arguments like a fun, how often to run process and how long keep the task, before throwing it away. /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From anthony.hw.kong@REDACTED Tue Jul 10 20:20:36 2007 From: anthony.hw.kong@REDACTED (Anthony Kong) Date: Wed, 11 Jul 2007 04:20:36 +1000 Subject: [erlang-questions] Erlang programming question: "record abc already defined" In-Reply-To: <46920D76.1050906@ericsson.com> References: <46920D76.1050906@ericsson.com> Message-ID: Hi, all, Thanks very much for your help. -ifndef is a very useful device. I understand I did not give a lot of info in my first post, so I tried to come up with a set of simpler scripts. In the process I realized the mistake I made: In addition to the hrl, I have -include() other erl files as well! Now I understand why I were also getting "redefining module" error message. Will do a better job in describing my problem next time. Cheers, Anthony On 7/9/07, Bengt Kleberg wrote: > On 2007-07-08 23:56, Anthony Kong wrote: > > Hi, all, > > > > It is a erlang question form a firsttime beginner. So, bear with me if > > the source of problem is obvious. > > no problem, everybody was a beginner at some time. > > > > I got a bunch of message like this when I run erlc against a number of > > erl files. Here are some examples: > > > > ./reqmgt.hrl:14: record project already defined > > ./reqmgt.hrl:14: record project already defined > > ./reqmgt.hrl:14: record project already defined > > ./reqmgt.hrl:14: record project already defined > > ./reqmgt.hrl:14: record project already defined > > ./reqmgt.hrl:14: record project already defined > > next time, could you give the whole command line? > and perhaps just one example if they all look the same? > > > > Let's say I have these files regmgt.erl, regmgt.hrl, project.erl, > > abc.erl, def.erl. > > > > Except for the hrl files, they are all > > have you other hrl files, too? > there is only one hrl file in you example, but you mention ''hrl files''. > > > > 1) based on the gen_server_template.mini from Joe's book > > 2) project, abc, def contains logic related to a particular record > > class. So, project.erl knows how to handle -record(proect, {...}) > > 3) I am a java programmer, so the design of the project.erl, abc, def > > are basically to handle CRUD. > > 4) reqmgt.erl is an implementation following a Facade pattern. > > 5) each of these erl files has a line "-include (reqmgt.hrl)" > > > > in reqmgt.hrl I have define "-record(project, {...})" and abc, def etc. > > > > (Yes, I am using hrl as if it is a C include file but not knowing how > > to do "#ifndef" :-) ) > > in erlang you can do: > > -ifndef(MNESIA_TABLES_HRL). > -define(MNESIA_TABLES_HRL, 1). > > %% lots of defines/records/etc > > -endif. % NIBS_MNESIA_TABLES_HRL defined > > > So, questions: > > > > 1) Is it wrong to use "-include" this way? If so, how to fix it? > > since you get a compile time error it sure is wrong :-) > seriously, lots (a large majority, at a guess) of very good erlang > programmers like to have records defined in common hrl files and shared > in several erl files. > i do not like the idea and try to avoid it if i can. > > > 2) Does this 'design' sound OK in erlang? > > one possibility is to hide your record in an erl file and have table > create/access functions. that helps when loading new modules after > upgrading records. > > > bengt > -- > Those were the days... > 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." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- /*--*/ Experience is simply the name we give our mistakes. ---- Oscar Wilde From robert.virding@REDACTED Wed Jul 11 00:29:54 2007 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 11 Jul 2007 00:29:54 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: References: Message-ID: <46940862.3050202@telia.com> Joel Reymont wrote: > Folks, > > Is Erlang a good platform to compile JavaScript to? > > Just gathering opinions. > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog Yes, I think Erlang would be a good platform to compile JavaScript to. I have been thinking about how to do a PHP implementation and arrived at the same conclusion. The main difficulties would be the large libraires and the rather crappy syntax and semantics (of PHP). Robert From surindar.shanthi@REDACTED Wed Jul 11 03:47:22 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 11 Jul 2007 07:17:22 +0530 Subject: [erlang-questions] enfile error in socket Message-ID: <42ea5fb60707101847m2f9fb8bcic37fb4edd98a165f@mail.gmail.com> Dear all, We are using client server program in erlang using TCP/IP (gen_tcp). When more clients (around 100) are connected to the erlang server, the server willnot accept the connection and returns {error,enfile}. What is the reason of this error. Is there any way available to mitigate this error. Please give your inputs. Thanks in advance -- Best regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From surindar.shanthi@REDACTED Wed Jul 11 04:23:04 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 11 Jul 2007 07:53:04 +0530 Subject: [erlang-questions] enfile error in socket In-Reply-To: <4694C7D9.664A.00DD.0@stgeorge.com.au> References: <42ea5fb60707101847m2f9fb8bcic37fb4edd98a165f@mail.gmail.com> <4694C7D9.664A.00DD.0@stgeorge.com.au> Message-ID: <42ea5fb60707101923o444be131p425e795c0b9c9fae@mail.gmail.com> Our server will not close the socket. The client itself closes the socket. Do we need to close the socket even after the client closes the socket? Is that be the reason of enfile error? Because, in the below link, it is said that,*You're continously opening either files or sockets and not closing them.* On 7/11/07, Anthony Kong wrote: > > Maybe this answer your question: > > http://www.erlang.org/pipermail/erlang-questions/2006-January/018733.html > > Cheers, Anthony > > >>> "Surindar Sivanesan" 11/07/2007 11:47 am > >>> > > Dear all, > > We are using client server program in erlang using TCP/IP (gen_tcp). > When more clients (around 100) are connected to the erlang server, the > server willnot accept the connection and returns {error,enfile}. > What is the reason of this error. Is there any way available to mitigate > this error. Please give your inputs. > Thanks in advance > -- > Best regards, > S.Surindar > > ********************************************************************** > > ***** IMPORTANT INFORMATION ***** > > This document should be read only by those persons to whom it is > > addressed and its content is not intended for use by any other > > persons. If you have received this message in error, please notify > > us immediately. Please also destroy and delete the message from > > your computer. Any unauthorised form of reproduction of this message > > is strictly prohibited. > > > > St.George Bank Limited AFSL 240997, Advance Asset Management Limited > > AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management > Limited > > AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not > liable for > > the proper and complete transmission of the information contained in > > this communication, nor for any delay in its receipt. > > ********************************************************************** > > > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlanging@REDACTED Wed Jul 11 08:06:43 2007 From: erlanging@REDACTED (Jeremy Chow) Date: Wed, 11 Jul 2007 14:06:43 +0800 Subject: [erlang-questions] how to call os:cmd("ls") from shell? Message-ID: <6cef17180707102306r70d768a2r4a749036cc83dee@mail.gmail.com> hi list, I fellowed the otp document, but it failed. # erl -s os cmd ls Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] [lock-checking] {"init terminating in do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump Thx, Jeremy From beepblip@REDACTED Wed Jul 11 09:13:19 2007 From: beepblip@REDACTED (beepblip@REDACTED) Date: Wed, 11 Jul 2007 00:13:19 -0700 Subject: [erlang-questions] best way to do live code update In-Reply-To: <46932A24.6040708@ghostgun.com> References: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> <46932A24.6040708@ghostgun.com> Message-ID: <7cb7cf500707110013i2cade32cka932b3bc093944c9@mail.gmail.com> Possibly. Is that the only way to go... is OTP the answer or is there another paradigm/behaviour/pattern that works for these situations. Hot code loading is one of the reasons I like Erlang and quite often my processes crash because of dependencies on the old code. On 7/9/07, jm wrote: > > beepblip@REDACTED wrote: > > hi, > > > > what is the best way to do design a system for live code update? > > in theory, i would like to ship a tar/bundle/etc with all the necessary > > code. the end user should be able to load that while the system > > is running and then proceed as thogh nothing much has changed. > > > > this should be similar to a live code update that was done on the > > network gear that erlang ran on. > > > > how does one structure their project to accomplish this? > > > > > If you don't mind the blind leading the blind...There's a section in > "OTP Design Principles" ( > http://www.erlang.org/doc/pdf/design_principles.pdf ) that covers > releases starts around page 46. > http://www.trapexit.org/index.php/Building_An_OTP_Application also has a > section on releases. I've done niether myself though. Is this what your > referring to or some finer point I've missed? > > > Jeff. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffm@REDACTED Wed Jul 11 09:31:19 2007 From: jeffm@REDACTED (jm) Date: Wed, 11 Jul 2007 17:31:19 +1000 Subject: [erlang-questions] best way to do live code update In-Reply-To: <7cb7cf500707110013i2cade32cka932b3bc093944c9@mail.gmail.com> References: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> <46932A24.6040708@ghostgun.com> <7cb7cf500707110013i2cade32cka932b3bc093944c9@mail.gmail.com> Message-ID: <46948747.8020909@ghostgun.com> beepblip@REDACTED wrote: > Possibly. Is that the only way to go... is OTP the answer > or is there another paradigm/behaviour/pattern that works > for these situations. Hot code loading is one of the reasons > I like Erlang and quite often my processes crash because > of dependencies on the old code. > At this point I might leave it to the experts to answer. I've only really used it during development so far in the shell. Jeff. From Bob.Cowdery@REDACTED Wed Jul 11 09:26:10 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Wed, 11 Jul 2007 08:26:10 +0100 Subject: [erlang-questions] Application resource file Message-ID: <3A76756EED583B43A4AD704E29CCD079715DD4@mail.smartlogic.com> Hi all I have been using an application resource file for some time. Starting my application as in 'application:start(erlinksr).' picks up the default file and consumes it without problems. This file is called erlinksr.app. Now I want to feed different resource files according to a profile. Looking at the erl switches documentation I see a -config switch which points me to (app(4) and application(3)) which talk about resource files. If I say '-config erlinksr' (having copied the file to be erlinksr.config as it expects this extension) it complains: {"could not start kernel pid",application_controller,"error in config file \"./erlinksr.config\" (none): configuration file must contain ONE list ended by "} Clearly these are different config files. Is the documentation wrong or did I read it wrong? How can I have my application start with different resource files apart from copying over the right one before starting erl. Thanks Bob From jan@REDACTED Wed Jul 11 10:46:58 2007 From: jan@REDACTED (Jan Henry Nystrom) Date: Wed, 11 Jul 2007 10:46:58 +0200 Subject: [erlang-questions] Application resource file In-Reply-To: <3A76756EED583B43A4AD704E29CCD079715DD4@mail.smartlogic.com> References: <3A76756EED583B43A4AD704E29CCD079715DD4@mail.smartlogic.com> Message-ID: <46949902.6020203@erlang-consulting.com> Hi Bob, If you had looked a bit closer in app(4) you would have found that the next man page to look in is config(4) which states the intent an format of the the_name_of_your_config_file.config. All the information you need can be found in that man page. /Cheers Henry Bob Cowdery wrote: > Hi all > > I have been using an application resource file for some time. Starting my application as in 'application:start(erlinksr).' picks up the default file and consumes it without problems. This file is called erlinksr.app. Now I want to feed different resource files according to a profile. Looking at the erl switches documentation I see a -config switch which points me to (app(4) and application(3)) which talk about resource files. If I say '-config erlinksr' (having copied the file to be erlinksr.config as it expects this extension) it complains: > > {"could not start kernel pid",application_controller,"error in config file \"./erlinksr.config\" (none): configuration file must contain ONE list ended by "} > > Clearly these are different config files. Is the documentation wrong or did I read it wrong? How can I have my application start with different resource files apart from copying over the right one before starting erl. > > Thanks > > Bob > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Jan Henry Nystrom Training Manager @ Erlang Training and Consulting Ltd jan@REDACTED From yerl@REDACTED Wed Jul 11 11:06:25 2007 From: yerl@REDACTED (yerl@REDACTED) Date: Wed, 11 Jul 2007 11:06:25 +0200 Subject: [erlang-questions] how to call os:cmd("ls") from shell? Message-ID: echo 'os:cmd("ls").' | erl cheers Y. ----Message d'origine---- >Date: Wed, 11 Jul 2007 14:06:43 +0800 >De: "Jeremy Chow" >A: erlang-questions@REDACTED >Sujet: [erlang-questions] how to call os:cmd("ls") from shell? > >hi list, > >I fellowed the otp document, but it failed. > ># erl -s os cmd ls > >Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] >[kernel-poll:false] [lock-checking] > >{"init terminating in >do_boot",{function_clause,[{os,validate1,[[ls]]},{os,cmd,1},{init,start_it,1},{init,start_em,1}]}} > >Crash dump was written to: erl_crash.dump > > >Thx, >Jeremy >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Wed Jul 11 12:10:09 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 11 Jul 2007 12:10:09 +0200 Subject: [erlang-questions] best way to do live code update In-Reply-To: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> References: <7cb7cf500707092323s5c8ef6c6pcebac7302d7400a7@mail.gmail.com> Message-ID: <9b08084c0707110310k46cde79dtaeee4bf5d832b820@mail.gmail.com> Live code upgrading is one of the things Erlang was designed for :-) You have to distinguish between language primitives for live upgrade and library support for live upgrade. Erlang (the language) has very few mechanisms to support live code upgrade - there is a minimal subset of mechanisms that you can use to build system that can be upgraded on the fly. The OTP libraries uses these mechanisms to make a particular form of live upgrade - there are actually many different ways to do this the OTP libraries represent one such way. Live upgrade can be programmed in "pure erlang" just as any other application. If you code the inner loop of a server like this: loop(Fun, State) -> receive {From, {rpc, Tag, Q}} -> {Reply, State1} = Fun(Q, State), From ! {Tag, Reply}, loop(Fun, State1); {code_upgrade, Fun1} -> loop(Fun1, State) end. Then you can get a simple form of code upgrade ... nothing fancy but it works Then you have to co-ordinate things so that you know which processes to upgrade. In a more realistic system you need notions of a "stable state" and of state transformers You should view versions of your systems as progressing from state1 to state2 to state3 and so on. Then you need transformation functions that take state N to state N+1 AND (importantly) state N+1 to state N. To make a state change in you system your put it into a stable state, then roll the state forwards or backwards then resume operations. Meta code for this is: suspend all relevant processes roll to state I+1 or I-1 resume all relevant processes This is (basically) what the OTP release structure does if you think about it upgrading/downgrading a system is pretty much like making a fault-tolerant system (or a scable system) Paradoxically I think code upgrade in a massively distributed system is much easier than in a monolithic system. In a large distributed system we stop node1 - change the code - restart it, go to node 2 and so on. We also arrange that when node 1 is stopped some over node can handle the traffic. Note that were node 1 to crash, some other node should take over, so we should have programmed this as part of the application. In a single-node system things are much more difficult - no other nodes can take over while we upgrade the code. So as the number of nodes increases things get easier - other nodes can take over while we change the code. In fact we can imagine that the system is always inconsistent - some of the nodes will never get the new upgrades. What we've said about nodes is also true for processes. Image a large system with thousands of nodes. Such a system will probably always be in a mixture of versions. When we do code upgrade some systems will be in the old state, others in the new state. When a crashed node is brought back on-line it might be several versions out of date. None of this matters if the protocols between the nodes can handle versions. Let's suppose we have 100 nodes in state 34. To upgrade to state 35 we suspend machine 1, upgrade it to state 35 then restart it. Then we do machine 2 and so on. While we are upgrading machine 1 we might move the traffic to machine 2. How does code upgrade differ from a crash? If machine 1 crashes what should happen? - another machine should take over. So another way to do code upgrade might be crash machine 1 (some other machine will take over) upgrade the code in machine 1 bring machine 1 back on line crash machine 2 ... and so on The point I want to make is that code-upgrade is a part of the application which needs to be designed (like anything else) - it should to be designed together with the fail-over and scalability issues. Personally I think the best way to do things is to view the system as being permanently inconsistent and write code that always tries to make things consistent. We assume that we have N nodes and that they will all be running code in different versions - if we assume that any node can crash and the other nodes can take over if we assume that we can add nodes to increase capacity. Then we make an architecture for this - then to change code we just crash nodes in a systematic manner (other nodes will take over) change the code and restart them. The key to this is using defined protocols between nodes which contain version numbers. Also the notion of stable state which can be replicated and survive a crash. Basically the OTP behaviors hide and package mechanisms like these into a convenient form. The mechanisms themselves are pretty simple. You need to think about 1) How to suspend the system and put it into a stable state 2) How to replicate the stable state 3) How to restart from a stable state 4) How to detect failure 5) How to upgrade and downgrade the stable state Once you've done this you've done most of the work - then you can program this in pure Erlang or use the OTP libraries - be warned there's a lot of reading to do :-) Cheers /Joe On 7/10/07, beepblip@REDACTED wrote: > hi, > > what is the best way to do design a system for live code update? > in theory, i would like to ship a tar/bundle/etc with all the necessary > code. the end user should be able to load that while the system > is running and then proceed as thogh nothing much has changed. > > this should be similar to a live code update that was done on the > network gear that erlang ran on. > > how does one structure their project to accomplish this? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From alex.arnon@REDACTED Wed Jul 11 12:18:15 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 11 Jul 2007 13:18:15 +0300 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <46940862.3050202@telia.com> References: <46940862.3050202@telia.com> Message-ID: <944da41d0707110318x6c91b71ay993660c3de8142a7@mail.gmail.com> What version(s) of the JavaScript/PHP would you guys target? On 7/11/07, Robert Virding wrote: > > Joel Reymont wrote: > > Folks, > > > > Is Erlang a good platform to compile JavaScript to? > > > > Just gathering opinions. > > > > Thanks, Joel > > > > -- > > http://topdog.cc - EasyLanguage to C# compiler > > http://wagerlabs.com - Blog > > Yes, I think Erlang would be a good platform to compile JavaScript to. I > have been thinking about how to do a PHP implementation and arrived at > the same conclusion. The main difficulties would be the large libraires > and the rather crappy syntax and semantics (of PHP). > > Robert > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.arnon@REDACTED Wed Jul 11 12:22:35 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 11 Jul 2007 13:22:35 +0300 Subject: [erlang-questions] Telnet Server Message-ID: <944da41d0707110322s7b0e2b87xd21d8f016aa214a7@mail.gmail.com> Hi Guys, Is there a need for a telnet server? If so, what level of service would you need from it, for example: - Switching between line and character modes. - Transfer of environment variables and such. - pty emulation, e.g. - Escape sequences, - Events (window resize etc.) - Curses-like library. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bob.Cowdery@REDACTED Wed Jul 11 13:08:26 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Wed, 11 Jul 2007 12:08:26 +0100 Subject: [erlang-questions] Application resource file Message-ID: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> Thanks That will teach me to use the man pages and not the html docs which don't seem to have any reference to config(4). By overidding parameters, which appears to be the way of doing things I can achieve what I need. Bob Henry wrote: > Hi Bob, > If you had looked a bit closer in app(4) you would have found that the next man page to look in is config(4) which states the intent an format of the the_name_of_your_config_file.config. All the information you need can be found in that man page. /Cheers Henry Bob Cowdery wrote: > Hi all > > I have been using an application resource file for some time. Starting my application as in 'application:start(erlinksr).' picks up the default file and consumes it without problems. This file is called erlinksr.app. Now I want to feed different resource files according to a profile. Looking at the erl switches documentation I see a -config switch which points me to (app(4) and application(3)) which talk about resource files. If I say '-config erlinksr' (having copied the file to be erlinksr.config as it expects this extension) it complains: > > {"could not start kernel pid",application_controller,"error in config file \"./erlinksr.config\" (none): configuration file must contain ONE list ended by "} > > Clearly these are different config files. Is the documentation wrong or did I read it wrong? How can I have my application start with different resource files apart from copying over the right one before starting erl. > > Thanks > > Bob > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Jan Henry Nystrom Training Manager @ Erlang Training and Consulting Ltd jan@REDACTED _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From tobbe@REDACTED Wed Jul 11 13:50:26 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 11 Jul 2007 13:50:26 +0200 Subject: [erlang-questions] Telnet Server In-Reply-To: <944da41d0707110322s7b0e2b87xd21d8f016aa214a7@mail.gmail.com> References: <944da41d0707110322s7b0e2b87xd21d8f016aa214a7@mail.gmail.com> Message-ID: Alex Arnon wrote: > Hi Guys, > > Is there a need for a telnet server? If so, what level of service would > you need from it, for example: > - Switching between line and character modes. > - Transfer of environment variables and such. > - pty emulation, e.g. > - Escape sequences, > - Events (window resize etc.) > - Curses-like library. > > Apparently there exist something like that in jungerl: jungerl/lib/ce/src/ce_telnet.erl Never used it though... --Tobbe From bengt.kleberg@REDACTED Wed Jul 11 13:54:20 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 11 Jul 2007 13:54:20 +0200 Subject: [erlang-questions] how to call os:cmd("ls") from shell? In-Reply-To: <6cef17180707102306r70d768a2r4a749036cc83dee@mail.gmail.com> References: <6cef17180707102306r70d768a2r4a749036cc83dee@mail.gmail.com> Message-ID: <4694C4EC.2040907@ericsson.com> On 2007-07-11 08:06, Jeremy Chow wrote: > hi list, > > I fellowed the otp document, but it failed. > > # erl -s os cmd ls this will not work. 1 erl -s will bundle the arguments (ls) into a list as atoms. os:cmd( [ls] ). 2 os:cmd/1 wants a string. os:cmd("ls"). one might think that erl -run os cmd ls will work since -run keeps the arguments as strings, but -run also bundles all arguments into a single string. so you have to write an interface module that calls os:cmd/1 for you. bengt -- Those were the days... 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 ranitrue@REDACTED Wed Jul 11 15:10:29 2007 From: ranitrue@REDACTED (selva rani) Date: Wed, 11 Jul 2007 18:40:29 +0530 Subject: [erlang-questions] Number of tcp/ip connections Message-ID: <6b79c4a90707110610k43783671ha8f45d7066734ece@mail.gmail.com> Hi all, I am running a server application in Windows 2003 with multiple clients connecting to server. In my application i would like to connect more than 1024 tcp/ip connections with the server. But when the connection just exceeds 1024 i get enfile error in server. I tried changing the maximum number of connections using ERL_MAX_PORTS. I changed this using os:putenv("ERL_MAX_PORTS","value"). But even then i got enfile error. Then i changed the parameter TcpNumConnections (HKEY_LOCAL_MACHINE \System \CurrentControlSet \Services \Tcpip \Parameters) that limits the maximum number of connections that TCP may have open simultaneously. After changing this parameter also the server is unable to accept more than 1024 connections and generates enfile error. Tell me what should be done to increase the number of tcp/ip connections with the server (more than 1024). Thanks, Rani -------------- next part -------------- An HTML attachment was scrubbed... URL: From oscar@REDACTED Wed Jul 11 15:19:14 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Wed, 11 Jul 2007 14:19:14 +0100 Subject: [erlang-questions] Number of tcp/ip connections In-Reply-To: <6b79c4a90707110610k43783671ha8f45d7066734ece@mail.gmail.com> References: <6b79c4a90707110610k43783671ha8f45d7066734ece@mail.gmail.com> Message-ID: <4694D8D2.808@erlang-consulting.com> selva rani wrote: > Hi all, > I am running a server application in Windows 2003 with multiple > clients connecting to server. In my application i would like to connect > more > than 1024 tcp/ip connections with the server. But when the connection just > exceeds 1024 i get enfile error in server. I tried changing the maximum > number of connections using ERL_MAX_PORTS. I changed this using > os:putenv("ERL_MAX_PORTS","value"). But even then i got enfile error. > Then i > changed the parameter TcpNumConnections (HKEY_LOCAL_MACHINE \System > \CurrentControlSet \Services \Tcpip \Parameters) that limits the maximum > number of connections that TCP may have open simultaneously. After changing > this parameter also the server is unable to accept more than 1024 > connections and generates enfile error. Tell me what should be done to > increase the number of tcp/ip connections with the server (more than 1024). What kind of server is this? Windows, Linux, BSD, Solaris? There are usually settings for how many file descriptors one process may open. These can also be changed for the user running the server process. In some OS you also have a limits on sockets. This limit is however still dependent on the number of fd:s. If you tell me what OS you are using I (or someone else) can probably point you to the settings. > Thanks, > Rani > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From alex.arnon@REDACTED Wed Jul 11 19:08:17 2007 From: alex.arnon@REDACTED (Alex Arnon) Date: Wed, 11 Jul 2007 20:08:17 +0300 Subject: [erlang-questions] Telnet Server In-Reply-To: References: <944da41d0707110322s7b0e2b87xd21d8f016aa214a7@mail.gmail.com> Message-ID: <944da41d0707111008q6aa05de6xaf4868b8513e8c0a@mail.gmail.com> Thanks, I'll look into it. On 7/11/07, Torbjorn Tornkvist wrote: > > Alex Arnon wrote: > > Hi Guys, > > > > Is there a need for a telnet server? If so, what level of service would > > you need from it, for example: > > - Switching between line and character modes. > > - Transfer of environment variables and such. > > - pty emulation, e.g. > > - Escape sequences, > > - Events (window resize etc.) > > - Curses-like library. > > > > > > Apparently there exist something like that in jungerl: > > jungerl/lib/ce/src/ce_telnet.erl > > Never used it though... > > --Tobbe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Wed Jul 11 21:11:12 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 11 Jul 2007 14:11:12 -0500 Subject: [erlang-questions] HTML Docs vs. Man Pages In-Reply-To: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> References: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> Message-ID: <000601c7c3ef$3fb9cdd0$891ea8c0@SSI.CORP> Jan Henry Nystrom wrote: > If you had looked a bit closer in app(4) you would have found that the > next man page to look in is config(4) which states the intent an format > of the the_name_of_your_config_file.config. All the information you need > can be found in that man page. Bob Cowdery wrote: > That will teach me to use the man pages and not the html docs which don't > seem to have any reference to config(4). Is there a way to read the man pages for those of us on Windows? I assumed the HTML documents had the same information as the man pages... Cheers, David From qrilka@REDACTED Wed Jul 11 22:23:23 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 12 Jul 2007 00:23:23 +0400 Subject: [erlang-questions] HTML Docs vs. Man Pages In-Reply-To: <000601c7c3ef$3fb9cdd0$891ea8c0@SSI.CORP> References: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> <000601c7c3ef$3fb9cdd0$891ea8c0@SSI.CORP> Message-ID: <337538cb0707111323r468f10cas395d7b660f203519@mail.gmail.com> Does not http://www.erlang.org/doc/man/ has the same info as the man pages? Regards, Kirill. On 7/11/07, David Mercer wrote: > > Jan Henry Nystrom wrote: > > If you had looked a bit closer in app(4) you would have found that the > > next man page to look in is config(4) which states the intent an format > > of the the_name_of_your_config_file.config. All the information you need > > can be found in that man page. > > Bob Cowdery wrote: > > That will teach me to use the man pages and not the html docs which > don't > > seem to have any reference to config(4). > > Is there a way to read the man pages for those of us on Windows? I > assumed > the HTML documents had the same information as the man pages... > > Cheers, > > David > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Wed Jul 11 23:05:13 2007 From: matthias@REDACTED (Matthias Lang) Date: Wed, 11 Jul 2007 23:05:13 +0200 Subject: [erlang-questions] HTML Docs vs. Man Pages In-Reply-To: <337538cb0707111323r468f10cas395d7b660f203519@mail.gmail.com> References: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> <000601c7c3ef$3fb9cdd0$891ea8c0@SSI.CORP> <337538cb0707111323r468f10cas395d7b660f203519@mail.gmail.com> Message-ID: <18069.17929.36238.873003@antilipe.corelatus.se> Kirill Zaborski writes: > Does not http://www.erlang.org/doc/man/ has the same info as the man pages? I'm not aware of any difference in content. In the specific case of the 'app' manpage, both the HTML and the manpage version refer to config(4). (This is contrary to what Bob Cowdery wrote below. Wild guess: Bob missed the reference because he only looked in the "See Also" section. The reference is actually in the body, both in the man and HTML version, at least on the copies on my machine, which I got from erlang.org) Matthias ---------------------------------------------------------------------- > Regards, > Kirill. > > On 7/11/07, David Mercer wrote: > > > > Jan Henry Nystrom wrote: > > > If you had looked a bit closer in app(4) you would have found that the > > > next man page to look in is config(4) which states the intent an format > > > of the the_name_of_your_config_file.config. All the information you need > > > can be found in that man page. > > > > Bob Cowdery wrote: > > > That will teach me to use the man pages and not the html docs which > > don't > > > seem to have any reference to config(4). > > > > Is there a way to read the man pages for those of us on Windows? I > > assumed > > the HTML documents had the same information as the man pages... > > > > Cheers, > > > > David > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > Does not http://www.erlang.org/doc/man/ has the same info as the man pages?

Regards,
Kirill.

On 7/11/07, > David Mercer <dmercer@REDACTED> wrote:
> Jan Henry Nystrom wrote:
> If you had looked a bit closer in app(4) you would have found that the
> next man page to look in is config(4) which states the intent an format
> of the the_name_of_your_config_file.config. All the information you need >
> can be found in that man page.

Bob Cowdery wrote:
> That will teach me to use the man pages and not the html docs which don't
> seem to have any reference to config(4).

Is there a way to read the man pages for those of us on Windows?  I assumed >
the HTML documents had the same information as the man pages...

Cheers,

David

_______________________________________________
erlang-questions mailing list
> erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions

> _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ryan@REDACTED Thu Jul 12 02:27:53 2007 From: ryan@REDACTED (Ryan Tecco) Date: Wed, 11 Jul 2007 17:27:53 -0700 Subject: [erlang-questions] San Francisco Bay Area ErlLounge Message-ID: The San Francisco Bay Area ErlLounge is Wed. July 18th at 7:00 PM at the District Bar (www.districtsf.com) in downtown San Francisco. District is less than a block away from the 4th/King Caltrain station. Drinks and food will be provided by my employer. The Facebook event is here: http://umichigan.facebook.com/event.php?eid=2419072296 or feel free to e-mail me to RSVP. Based on everyone's preferences, we should have between 10-15 people there. Cheers, rt -------------- next part -------------- An HTML attachment was scrubbed... URL: From beepblip@REDACTED Thu Jul 12 02:27:31 2007 From: beepblip@REDACTED (beepblip@REDACTED) Date: Wed, 11 Jul 2007 17:27:31 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <46940862.3050202@telia.com> References: <46940862.3050202@telia.com> Message-ID: <7cb7cf500707111727w97da3ebrde056faf8181dfa3@mail.gmail.com> There is a great paper by Florian Loitsch where he attempted to translate javascript to scheme. The performance was actually better than most javascript implementations. I don't think that he had 100% language compatability, but it should be a great start for a JS -> Erlang project. On 7/10/07, Robert Virding wrote: > > Joel Reymont wrote: > > Folks, > > > > Is Erlang a good platform to compile JavaScript to? > > > > Just gathering opinions. > > > > Thanks, Joel > > > > -- > > http://topdog.cc - EasyLanguage to C# compiler > > http://wagerlabs.com - Blog > > Yes, I think Erlang would be a good platform to compile JavaScript to. I > have been thinking about how to do a PHP implementation and arrived at > the same conclusion. The main difficulties would be the large libraires > and the rather crappy syntax and semantics (of PHP). > > Robert > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcabana@REDACTED Thu Jul 12 05:24:30 2007 From: dcabana@REDACTED (David Cabana) Date: Wed, 11 Jul 2007 23:24:30 -0400 Subject: [erlang-questions] Question concerning the use of -export Message-ID: I have a question regarding the -export module attribute; it arose as a result of playing with this code, taken from the section 3.2 of the Erlang Getting Started document available at http://www.erlang.org/doc/getting_started/part_frame.html Here is the code: %--------------------------------------------------- -module(tut15). -export([start/0, ping/2, pong/0]). ping(0, Pong_PID) -> Pong_PID ! finished, io:format("ping finished~n", []); ping(N, Pong_PID) -> Pong_PID ! {ping, self()}, receive pong -> io:format("Ping received pong~n", []) end, ping(N - 1, Pong_PID). pong() -> receive finished -> io:format("Pong finished~n", []); {ping, Ping_PID} -> io:format("Pong received ping~n", []), Ping_PID ! pong, pong() end. start() -> Pong_PID = spawn(tut15, pong, []), spawn(tut15, ping, [3, Pong_PID]). %--------------------------------------------------- My question is this: why do ping/2 and pong/0 have to be exported? The code is invoked from a command line by tut15:start(), so I can see that start/0 has to be exported. I tried not exporting pong/0, and got a compiler warning: ./tut15.erl:17: Warning: function pong/0 is unused I disregarded the warning and executed the code, producing a runtime error: Error in process <0.141.0> with exit value: {undef,[{tut15,pong,[]}]} It seems to me that pong/0 is not being called from outside the tut15 module, so I should not have to export it. What am I missing here? From sanjaya@REDACTED Thu Jul 12 07:38:54 2007 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Thu, 12 Jul 2007 11:08:54 +0530 Subject: [erlang-questions] inets http --- httpc_handler, retry_pipline - Bug - Patch References: <017c01c7be06$898f7570$9a0810ac@wavenet.lk> Message-ID: <074501c7c446$ef839000$9a0810ac@wavenet.lk> Hi All, This seems a Bug in inets. Refer with httpc_handler:retry_pipline/3 and http_util:key1search/3. Find the attached log part with error details. Quick Patch: httpc_handler:retry_pipline/3 785c 787 < Timer = {_, TimerRef} = http_util:key1search(RequestTimers, Request#request.id, {undefined, undefined}), --- > case lists:keysearch(Request#request.id, 1, RequestTimers) of {value, Timer} -> {_, TimerRef} = Timer; _ -> Timer = {_, TimerRef} = {undefined, undefined} end, Test Details: 1> RequestTimers = [{make_ref(),make_ref()},{make_ref(),make_ref()}]. [{#Ref<0.0.0.31>,#Ref<0.0.0.32>},{#Ref<0.0.0.33>,#Ref<0.0.0.34>}] 2> [{_,_},{RequestID,_}] = RequestTimers. [{#Ref<0.0.0.31>,#Ref<0.0.0.32>},{#Ref<0.0.0.33>,#Ref<0.0.0.34>}] 3> RequestID. #Ref<0.0.0.33> 4> Timer = {_, TimerRef} =http_util:key1search(RequestTimers, RequestID,{undefined, undefined}). =ERROR REPORT==== 9-Jul-2007::21:56:09 === Error in process <0.29.0> with exit value: {{badmatch,#Ref<0.0.0.34>},[{erl_eval,expr,3}]} ** exited: {{badmatch,#Ref<0.0.0.34>},[{erl_eval,expr,3}]} ** 5> 5> http_util:key1search(RequestTimers, RequestID,{undefined, undefined}). #Ref<0.0.0.34> 6> Thanks, Sanjaya Vitharana. ----- Original Message ----- From: Sanjaya Vitharana To: erlang-questions@REDACTED Sent: Wednesday, 04 July 2007 12:12 pm Subject: [erlang-questions] inets http --- httpc_handler, retry_pipline Hi all, Anyone has a idea about below error & why it gets with http:request(get, {URL, []}, [{timeout, ?REQUEST_TIMEOUT},{autoredirect, true}], [{sync, false}]) ??? I have get it with R11B-4 (emulator version 5.5.4 - inets-4.7.11). Is this a bug in in inets ?? regards, Sanjaya Vitharana ** Reason for termination == ** {{badmatch,#Ref<0.0.43.103898>}, [{httpc_handler,retry_pipline,2}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} =CRASH REPORT==== 4-Jul-2007::10:16:10 === crasher: pid: <0.25066.9> registered_name: [] error_info: {{badmatch,#Ref<0.0.43.103898>}, [{httpc_handler,retry_pipline,2}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} initial_call: {gen, init_it, [gen_server, <0.54.0>, <0.54.0>, httpc_handler, [{request, #Ref<0.0.43.103750>, <0.63.0>, 0, http, {"scrb.int",80}, "/vmail/vmStart.php", "?key=c&session=a1183524542772308306&ch=56&serverid=3", get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "scrb.int", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,18000,true,[],undefined,false}, "http://scrb.int/vmail/vmStart.php?key=c&session=a1183524542772308306&ch=56&serverid=3", [], none, []}, {options,{undefined,[]},0,2,2,disabled,enabled,false}], []]} ancestors: [httpc_manager,httpc_sup,inets_sup,<0.50.0>] messages: [] links: [<0.54.0>,#Port<0.390595>] dictionary: [] trap_exit: true status: running heap_size: 4181 stack_size: 21 reductions: 12757 neighbours: ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: error_details.txt URL: From nm@REDACTED Thu Jul 12 08:01:37 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 12 Jul 2007 11:01:37 +0500 Subject: [erlang-questions] Question concerning the use of -export In-Reply-To: References: Message-ID: <4695C3C1.702@web.am> David Cabana wrote: > I have a question regarding the -export module attribute; it arose as > a result of playing with this code, > taken from the section 3.2 of the Erlang Getting Started document > available at > http://www.erlang.org/doc/getting_started/part_frame.html > > Here is the code: > %--------------------------------------------------- > -module(tut15). > > -export([start/0, ping/2, pong/0]). > > ping(0, Pong_PID) -> > Pong_PID ! finished, > io:format("ping finished~n", []); > > ping(N, Pong_PID) -> > Pong_PID ! {ping, self()}, > receive > pong -> > io:format("Ping received pong~n", []) > end, > ping(N - 1, Pong_PID). > > pong() -> > receive > finished -> > io:format("Pong finished~n", []); > {ping, Ping_PID} -> > io:format("Pong received ping~n", []), > Ping_PID ! pong, > pong() > end. > > start() -> > Pong_PID = spawn(tut15, pong, []), > spawn(tut15, ping, [3, Pong_PID]). > %--------------------------------------------------- > > My question is this: why do ping/2 and pong/0 have to be exported? > The code is invoked from a command line by tut15:start(), > so I can see that start/0 has to be exported. I tried not exporting > pong/0, and got a compiler warning: > ./tut15.erl:17: Warning: function pong/0 is unused > > I disregarded the warning and executed the code, producing a runtime > error: > Error in process <0.141.0> with exit value: {undef,[{tut15,pong,[]}]} > > It seems to me that pong/0 is not being called from outside the > tut15 module, so I should not have to export it. What am I missing here? I had the same questions, when I first started programming erlang -- the annswer is that spawn'ed functions should be exported. or you should do spawn(fun pong() end ) or spawn(fun pong/0) which will not require exporting of function ping -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From dking@REDACTED Thu Jul 12 08:46:17 2007 From: dking@REDACTED (David King) Date: Wed, 11 Jul 2007 23:46:17 -0700 Subject: [erlang-questions] Question concerning the use of -export In-Reply-To: References: Message-ID: > My question is this: why do ping/2 and pong/0 have to be exported? ping/2 and pong/0 have to be exported because they are called from within the erlang module. erlang:spawn/3 is a BIF that ends up calling that function, and since it's called from outside tut15, it has to be exported. Later in that tutorial it mentions that you should differentiate these for readability, like this: % exports for external callers -export([start/0]). % exports for spawn -export([ping/2,pong/0]). > The code is invoked from a command line by tut15:start(), > so I can see that start/0 has to be exported. I tried not exporting > pong/0, and got a compiler warning: > ./tut15.erl:17: Warning: function pong/0 is unused > > I disregarded the warning and executed the code, producing a runtime > error: > Error in process <0.141.0> with exit value: {undef,[{tut15,pong,[]}]} > > It seems to me that pong/0 is not being called from outside the > tut15 module, so I should not have to export it. What am I missing > here? From oscar@REDACTED Thu Jul 12 10:44:10 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Thu, 12 Jul 2007 09:44:10 +0100 Subject: [erlang-questions] Number of tcp/ip connections In-Reply-To: <6b79c4a90707111943s73e03b9cpf8827df7d205e3e0@mail.gmail.com> References: <6b79c4a90707110610k43783671ha8f45d7066734ece@mail.gmail.com> <4694D8D2.808@erlang-consulting.com> <6b79c4a90707111943s73e03b9cpf8827df7d205e3e0@mail.gmail.com> Message-ID: <4695E9DA.9@erlang-consulting.com> selva rani wrote: > Hi , > I am using Windows 2003. > > Thanks, > Rani > Sorry, I got the impression that the actual server was running something else since you said it also started to behave as described after changing the registry values. I'm afraid I don't have any experience of this kind of tweaking on Windows 2003. You should look for the maximum number of open files ad sockets though. > On 7/11/07, Oscar Hellstr?m wrote: >> >> selva rani wrote: >> > Hi all, >> > I am running a server application in Windows 2003 with multiple >> > clients connecting to server. In my application i would like to connect >> > more >> > than 1024 tcp/ip connections with the server. But when the connection >> just >> > exceeds 1024 i get enfile error in server. I tried changing the maximum >> > number of connections using ERL_MAX_PORTS. I changed this using >> > os:putenv("ERL_MAX_PORTS","value"). But even then i got enfile error. >> > Then i >> > changed the parameter TcpNumConnections (HKEY_LOCAL_MACHINE \System >> > \CurrentControlSet \Services \Tcpip \Parameters) that limits the >> maximum >> > number of connections that TCP may have open simultaneously. After >> changing >> > this parameter also the server is unable to accept more than 1024 >> > connections and generates enfile error. Tell me what should be done to >> > increase the number of tcp/ip connections with the server (more than >> 1024). >> >> What kind of server is this? Windows, Linux, BSD, Solaris? >> >> There are usually settings for how many file descriptors one process may >> open. These can also be changed for the user running the server process. >> In some OS you also have a limits on sockets. This limit is however >> still dependent on the number of fd:s. >> >> If you tell me what OS you are using I (or someone else) can probably >> point you to the settings. >> >> > Thanks, >> > Rani >> > >> > >> > >> ------------------------------------------------------------------------ >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> >> Best Regards >> -- >> Oscar Hellstr?m, oscar@REDACTED >> Erlang Training and Consulting >> http://www.erlang-consulting.com/ >> > Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From ulf@REDACTED Thu Jul 12 12:37:07 2007 From: ulf@REDACTED (Ulf Eliasson) Date: Thu, 12 Jul 2007 11:37:07 +0100 (BST) Subject: [erlang-questions] New Trapexit: Help design logo and contest Message-ID: <2380.81.149.81.161.1184236627.squirrel@webmail.erlangsystems.com> Hi All, if you are unsure over what to do during your summer vacation you might consider adding designing a new trapexit logo and thinking up of a new slogan on your list. Based on the logo, we will design a new look and feel for the site. Winners will receive an Erlang laptop backpack and an Erlang Rosewood pen set. We need your submissions by August 1st, after which the Erlang community will have their say. For more informations and questions, visit http://www.trapexit.org/forum/viewforum.php?f=5 For those of you who have not visited in a while, drop by at http://www.trapexit.org as we've updated the site. Highlights include * Reorganization of the menus, forums, tutorials and contents with a new dynamic front page * Single login for the Wiki, Forums and RSS admin page * New RSS feed aggregation where users can add their own feeds in one of three categories If you want us to syndicate the RSS feeds you can either add them yourself in the category commercial, software or general (including blogs) at http://www.trapexit.org/index.php/Special:PlanetAdmin If you have tutorials and articles you want to contribute, add them to the largest Erlang HowTo connection. For more information, see http://www.trapexit.org/index.php/How_to_write_HowTo's and All articles can contain a link to the original one, author and copyright notices. If you do not want others to edit them, we can lock the pages. If you do not have time to migrate them, pass the material on to us and we will do it for you. All the best, Ulf and the Trapexit team. -- Ulf Eliasson, ulf@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From kevin@REDACTED Thu Jul 12 16:08:02 2007 From: kevin@REDACTED (Kevin A. Smith) Date: Thu, 12 Jul 2007 10:08:02 -0400 Subject: [erlang-questions] erlounge RDU Tonight Message-ID: <469635C2.4090005@hypotheticalabs.com> The first meeting of erlounge RDU is tonight: Where: Carolina Cafe and Bakery Corner of Weston and Harrison Cary, NC When: 7:00 PM The restaurant has free Wi-Fi so bring your laptop! The meetup group is here: http://ruby.meetup.com/109/ Based on meetup RSVPs, looks like we should have 8-10 people attending. --Kevin From lcoquelle@REDACTED Thu Jul 12 16:10:06 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Thu, 12 Jul 2007 22:10:06 +0800 Subject: [erlang-questions] list of available data structures Message-ID: Hi, I'm writing a list of available data structures in Erlang (from tuple, list, dict, gb_tree to array, priority queue...). I intend to do the same sort of list with available "basic" algorithms (sort, graph ...). Hopefully it can help beginners like me: http://lcoquelle.googlepages.com/erlangdatastructures (this page is not really new, I'm moving it from my blog) Did I miss something? Sorry, maybe it is not the correct place to post this info. Would trapexit forum be a better place? Should I proposed this list page for trapexit wiki? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Thu Jul 12 16:51:22 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 12 Jul 2007 16:51:22 +0200 Subject: [erlang-questions] [Q] prim_inet:async_accept and gen_tcp:send Message-ID: <46963FEA.6010309@volny.cz> Hello, based on a previous thread about prim_inet:async_accept we tried to use it ourselves but the connection socket we get is unusable. To repeat do following in the erlang shell: $> {ok, Port} = gen_tcp:listen(6667, [list, {packet, line}, {active, false}]). {ok, #Port<0.70890>} $> {ok, Ref} = prim_inet:async_accept(P, -1). {ok, 0} Now telnet to localhost:6667 and continue: $> receive {inet_async, Port, Ref, {ok, Socket}} -> {ok, Socket} end. {ok, #Port<0.70891>} However evaluating gen_tcp:send(Socket, Data) crashes with {undef, [{undefined, send, [Socket, Data]}, ...]} We found out that problem is in gen_tcp:send/2 which in turn calls inet_db:lookup_socket(Socket) which calls erlang:port_get_data(Socket) which returns undefined (instead of inet_tcp?). Any clues to what we are doing wrong? Thanks, Ladislav Lenart From tony@REDACTED Thu Jul 12 17:21:41 2007 From: tony@REDACTED (Tony Rogvall) Date: Thu, 12 Jul 2007 17:21:41 +0200 Subject: [erlang-questions] [Q] prim_inet:async_accept and gen_tcp:send In-Reply-To: <46963FEA.6010309@volny.cz> References: <46963FEA.6010309@volny.cz> Message-ID: <589632AD-C7C9-42CE-A8E7-DA5A2AD348E2@rogvall.com> Reading the code for accept in the module inet_tcp.erl (in lib/kernel) accept makes a call to inet_db:register_socket(S, ?MODULE). you need to call it with ?MODULE replaced by the atom inet_tcp. /Tony On 12 jul 2007, at 16.51, Ladislav Lenart wrote: > Hello, > > based on a previous thread about prim_inet:async_accept we tried to > use it ourselves but the connection socket we get is unusable. To > repeat do following in the erlang shell: > > $> {ok, Port} = gen_tcp:listen(6667, [list, {packet, line}, > {active, false}]). > {ok, #Port<0.70890>} > $> {ok, Ref} = prim_inet:async_accept(P, -1). > {ok, 0} > > Now telnet to localhost:6667 and continue: > > $> receive {inet_async, Port, Ref, {ok, Socket}} -> {ok, Socket} end. > {ok, #Port<0.70891>} > > However evaluating gen_tcp:send(Socket, Data) crashes with > {undef, [{undefined, send, [Socket, Data]}, ...]} > > We found out that problem is in gen_tcp:send/2 which > in turn calls inet_db:lookup_socket(Socket) which calls > erlang:port_get_data(Socket) which returns undefined > (instead of inet_tcp?). > > Any clues to what we are doing wrong? > > Thanks, > > Ladislav Lenart > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From yerl@REDACTED Thu Jul 12 21:55:24 2007 From: yerl@REDACTED (Yerl) Date: Thu, 12 Jul 2007 21:55:24 +0200 Subject: [erlang-questions] Leex source code In-Reply-To: <20070801224845.GA8047@continuum.localdomain> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> <20070801224845.GA8047@continuum.localdomain> Message-ID: <4696872C.4090604@club-internet.fr> Hi All, Hi Robert! Where can I find the latest version of "leex" source code please ? cheers Y. From kenneth.lundin@REDACTED Thu Jul 12 23:25:12 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 12 Jul 2007 23:25:12 +0200 Subject: [erlang-questions] HTML Docs vs. Man Pages In-Reply-To: <18069.17929.36238.873003@antilipe.corelatus.se> References: <3A76756EED583B43A4AD704E29CCD079741230@mail.smartlogic.com> <000601c7c3ef$3fb9cdd0$891ea8c0@SSI.CORP> <337538cb0707111323r468f10cas395d7b660f203519@mail.gmail.com> <18069.17929.36238.873003@antilipe.corelatus.se> Message-ID: Hi, The man pages in "man" format and the corresponding html format are built from the same source so they should contain exactly the same information. If not, there is a bug in our SW that produces the 2 formats, please report such cases if you find any. /Kenneth Erlang/OTP team at Ericsson On 7/11/07, Matthias Lang wrote: > Kirill Zaborski writes: > > Does not http://www.erlang.org/doc/man/ has the same info as the man pages? > > I'm not aware of any difference in content. > > In the specific case of the 'app' manpage, both the HTML and the > manpage version refer to config(4). > > (This is contrary to what Bob Cowdery wrote below. Wild guess: Bob > missed the reference because he only looked in the "See Also" > section. The reference is actually in the body, both in the man and > HTML version, at least on the copies on my machine, which I got from > erlang.org) > > Matthias > > ---------------------------------------------------------------------- > > > Regards, > > Kirill. > > > > On 7/11/07, David Mercer wrote: > > > > > > Jan Henry Nystrom wrote: > > > > If you had looked a bit closer in app(4) you would have found that the > > > > next man page to look in is config(4) which states the intent an format > > > > of the the_name_of_your_config_file.config. All the information you need > > > > can be found in that man page. > > > > > > Bob Cowdery wrote: > > > > That will teach me to use the man pages and not the html docs which > > > don't > > > > seem to have any reference to config(4). > > > > > > Is there a way to read the man pages for those of us on Windows? I > > > assumed > > > the HTML documents had the same information as the man pages... > > > > > > Cheers, > > > > > > David > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > Does not http://www.erlang.org/doc/man/ has the same info as the man pages?

Regards,
Kirill.

On 7/11/07, > > David Mercer <dmercer@REDACTED> wrote:
> > Jan Henry Nystrom wrote:
> If you had looked a bit closer in app(4) you would have found that the
> next man page to look in is config(4) which states the intent an format
> of the the_name_of_your_config_file.config. All the information you need > >
> can be found in that man page.

Bob Cowdery wrote:
> That will teach me to use the man pages and not the html docs which don't
> seem to have any reference to config(4).

Is there a way to read the man pages for those of us on Windows?  I assumed > >
the HTML documents had the same information as the man pages...

Cheers,

David

_______________________________________________
erlang-questions mailing list
> > erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions

> > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From chsu79@REDACTED Thu Jul 12 23:26:44 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 12 Jul 2007 23:26:44 +0200 Subject: [erlang-questions] Leex source code In-Reply-To: <4696872C.4090604@club-internet.fr> References: <013d01c7bced$19dc5690$891ea8c0@SSI.CORP> <20070801224845.GA8047@continuum.localdomain> <4696872C.4090604@club-internet.fr> Message-ID: Look in the trapexit.org User Contributions forum. It is attached to a post from rvirding. It is the latest. 2007/7/12, Yerl : > Hi All, Hi Robert! > > Where can I find the latest version of "leex" source code please ? > > cheers > Y. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Fri Jul 13 02:40:16 2007 From: ok@REDACTED (ok) Date: Fri, 13 Jul 2007 12:40:16 +1200 Subject: [erlang-questions] Question concerning the use of -export In-Reply-To: References: Message-ID: <4E1D83A6-7583-4B80-B65A-5A7CFF15904C@cs.otago.ac.nz> erlang:spawn/3 is outside your module, so in a call spawn(?MODULE, foo, [.....]) the foo function _is_ called from outside ?MODULE and therefore has to be exported. Several years ago I proposed a form of limited export (inspired by Eiffel): -export_to(Module, [F/N, ..., F/N]). which would export the named functions to that module only. In particular, -export_to(erlang, [foo/2]). ... spawn(?MODULE, foo, [X,Y]) would make it possible to call a function through spawn/3 without making it visible absolutely everywhere. (Exporting to the shell module would also make it possible to call debugging functions without making them visible everywhere.) -export_to is particularly important for applications whose modules need to make stuff available to each other without making it available outside the application. From saleyn@REDACTED Fri Jul 13 04:54:16 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 12 Jul 2007 21:54:16 -0500 Subject: [erlang-questions] Bug in ei Message-ID: <4696E958.4030007@gmail.com> Hi, There seems to be a double freeing of a pointer causing segfault in ei when the following two functions are called one after another: ei_x_buff x; ei_x_new(&x); ei_x_format_wo_version(&x, "[{~a,~s},{~a,~i}]", "a", "b", "c", 10); I haven't tried the call above with these particular parameters, but I think the bug is pretty obvious in ei_format.c and should be reproducible in all cases. The following works as expected: ei_x_buff x; ei_x_new(&x); ei_x_format(&x, "[{~a,~s},{~a,~i}]", "a", "b", "c", 10); Serge From saleyn@REDACTED Fri Jul 13 05:19:20 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 12 Jul 2007 22:19:20 -0500 Subject: [erlang-questions] [Q] prim_inet:async_accept and gen_tcp:send In-Reply-To: <589632AD-C7C9-42CE-A8E7-DA5A2AD348E2@rogvall.com> References: <46963FEA.6010309@volny.cz> <589632AD-C7C9-42CE-A8E7-DA5A2AD348E2@rogvall.com> Message-ID: <4696EF38.6070204@gmail.com> You may also want to copy some socket options on the accepted socket the same way it's done in prim_inet. Here's a more complete extract (slightly trimmed) from a non-blocking TCP gen_server extracted from one of working projects. A couple of points to note are: 1. Initially the listening socket is set to passive mode, so that the accepted socket wouldn't attempt to send messages to the listener's gen_server process. As soon as the ownership is switched to the Module's handler Pid, it's safe to switch it to the {accept, once} mode in that module. 2. I am not a 100% sure if it's a good idea to retry accept attempts in case when acceptor returns an error {inet_async, ListSock, Ref, Error}. So we might as well crash the listener and let supervisor handle listener's restart. init(Port, Module) -> process_flag(trap_exit, true), %% The socket options will be set on the acceptor socket automatically case gen_tcp:listen(Port,[binary, {packet, 2}, {reuseaddr, true}, {keepalive, true}, {backlog, 128}, {active, false}]) of {ok, Listen_socket} -> %%Create first accepting process {ok, Ref} = prim_inet:async_accept(Listen_socket, -1), {ok, #state{listener = Listen_socket, acceptor = Ref, module = Module}}; {error, Reason} -> {stop, Reason} end. handle_info({inet_async, ListSock, Ref, {ok, CliSocket}}, #state{listener=ListSock, acceptor=Ref, module=M} = State) -> case set_sockopt(ListSock, CliSocket) of ok -> %% New client connected {ok, Pid} = erlang:apply(Module, start_link, [CliSocket]), gen_tcp:controlling_process(CliSocket, Pid), %% Instruct the new FSM that it owns the socket. gen_fsm:send_event(Pid, socket_ready), {ok, NewRef} = prim_inet:async_accept(ListSock, -1), {noreply, State#state{acceptor=NewRef}}; {error, Reason} -> error_logger:error_msg("Error setting socket options: ~p.\n", [Reason]), {stop, Reason, State} end; handle_info({inet_async, ListSock, Ref, Error}, #state{listener=ListSock, acceptor=Ref} = State) -> error_logger:error_msg("Error in socket acceptor: ~p.\n", [Error]), {stop, exceeded_accept_retry_count, State}; set_sockopt(ListSock, CliSocket) -> true = inet_db:register_socket(CliSocket, inet_tcp), case prim_inet:getopts(ListSock, [active, nodelay, keepalive, delay_send, priority, tos]) of {ok, Opts} -> case prim_inet:setopts(CliSocket, Opts) of ok -> ok; Error -> gen_tcp:close(CliSocket), Error end; Error -> gen_tcp:close(CliSocket), Error end. Tony Rogvall wrote: > Reading the code for accept in the module inet_tcp.erl (in lib/kernel) > accept makes a call to inet_db:register_socket(S, ?MODULE). > > you need to call it with ?MODULE replaced by the atom inet_tcp. > > /Tony > > > On 12 jul 2007, at 16.51, Ladislav Lenart wrote: > >> Hello, >> >> based on a previous thread about prim_inet:async_accept we tried to >> use it ourselves but the connection socket we get is unusable. To >> repeat do following in the erlang shell: >> >> $> {ok, Port} = gen_tcp:listen(6667, [list, {packet, line}, >> {active, false}]). >> {ok, #Port<0.70890>} >> $> {ok, Ref} = prim_inet:async_accept(P, -1). >> {ok, 0} >> >> Now telnet to localhost:6667 and continue: >> >> $> receive {inet_async, Port, Ref, {ok, Socket}} -> {ok, Socket} end. >> {ok, #Port<0.70891>} >> >> However evaluating gen_tcp:send(Socket, Data) crashes with >> {undef, [{undefined, send, [Socket, Data]}, ...]} >> >> We found out that problem is in gen_tcp:send/2 which >> in turn calls inet_db:lookup_socket(Socket) which calls >> erlang:port_get_data(Socket) which returns undefined >> (instead of inet_tcp?). >> >> Any clues to what we are doing wrong? >> >> Thanks, >> >> Ladislav Lenart >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From oscar@REDACTED Fri Jul 13 11:29:27 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Fri, 13 Jul 2007 10:29:27 +0100 Subject: [erlang-questions] enfile error in socket In-Reply-To: <42ea5fb60707101847m2f9fb8bcic37fb4edd98a165f@mail.gmail.com> References: <42ea5fb60707101847m2f9fb8bcic37fb4edd98a165f@mail.gmail.com> Message-ID: <469745F7.2050706@erlang-consulting.com> Surindar Sivanesan wrote: > Dear all, > > We are using client server program in erlang using TCP/IP (gen_tcp). > When more clients (around 100) are connected to the erlang server, the > server willnot accept the connection and returns {error,enfile}. > What is the reason of this error. Is there any way available to mitigate > this error. Please give your inputs. > Thanks in advance {error,enfile} means that you are using as many file descriptors as your process is allowed on your operating system. Some OS has limits for both sockets and file descriptors. Try raising the appropriate limits in your OS. > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From ulf@REDACTED Fri Jul 13 12:25:40 2007 From: ulf@REDACTED (Ulf Eliasson) Date: Fri, 13 Jul 2007 11:25:40 +0100 (BST) Subject: [erlang-questions] list of available data structures In-Reply-To: References: Message-ID: <41318.81.149.81.161.1184322340.squirrel@webmail.erlangsystems.com> Hi Ludovic, On Thu, July 12, 2007 15:10, Ludovic Coquelle wrote: > Sorry, maybe it is not the correct place to post this info. > Would trapexit forum be a better place? > Should I proposed this list page for trapexit wiki? I think that would be perfect to have in the Trapexit wiki, feel free to add it. If you have any trouble or need any help just contact me, there is information in the wiki about how to create pages here: http://www.trapexit.org/index.php/How_to_write_HowTo%27s Regards, -- Ulf Eliasson, ulf@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From daniel.kwiecinski@REDACTED Fri Jul 13 14:17:53 2007 From: daniel.kwiecinski@REDACTED (Daniel Kwiecinski) Date: Fri, 13 Jul 2007 13:17:53 +0100 Subject: [erlang-questions] input too fast In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> Message-ID: Hi, For me it look as messages comes from port really fast. They coming fast because eof couldn't be detected and most of the messages are {data, []}. It is because *****PortSettings *in ***open_port(PortName, PortSettings) *have to contain something more than *[eof]*. Like for example *[eof, {line, 1000}]*. Then eof is detected and no more data is delivered by port. The above is based on my observations. I am not an expert in erlang field so please forgive my ignorance in case if I missed something obvious. -- Kind Regards, Daniel Kwiecinski ** 2007/6/29, Fredrik Svahn : > > Sorry for double posting, it seems I have misconfigured something at > trapexit... > > Fredrik Svahn wrote: > I have also been frustrated by the way the io operations work when > attempting to speed up a few of the example programs for the language > shootout. The reverse-complement program for instance (which is approx. 60 > times slower than the corresponding c program) spends 80% of its time > reading from stdio, and I assume writing out the results are quite costly > too. > > Just for fun I made a small patch to efile to allow for stdin/stdout to be > opened as files. It probably has a lot of nasty side effects which I cannot > even imagine in the worst of my nightmares, but the results for reading and > writing are stunning. The "file" approach clocks in at 0.26 seconds for > reading a large file from stdin and writing it to stdout. Corresponding > results for a port program is 1.2 seconds with the normal io approach > measuring in at 16.9 seconds. > > I guess reading from stdin is not much of a problem for most Erlang > applications which are supposed to be robust scalable systems staying up for > years. I also think that this has been discussed before, probably at great > length, although I cannot find any relevant posts at the moment. But now > with escript maybe it might be a bit more interesting to have fast io > operations for stdin/stdout, at least for unix systems? > > I haven't looked at memory consumption, yet, but I expect the result > should be the same as for Ulf, i.e. port programs build up large heaps if > they cannot handle the messages really really really fast, while the file > and normal io approach should not really consume much more memory than the > buffer. > > BR /Fredrik > > Test-program: > > -module(io_test). > -export([file/0,port/0,normal/0,fileio/0,portio/0,normalio/0]). > -define(bufsize, 2048). > > file()-> io:format("~n~p~n",[timer:tc(?MODULE, fileio, [])]), halt(). > port()-> io:format("~n~p~n",[timer:tc(?MODULE, portio, [])]), halt(). > normal()-> io:format("~n~p~n",[timer:tc(?MODULE, normalio, [])]), halt(). > > fileio()-> > {ok,StdIn}=file:open("",[raw, binary, read]), > {ok,StdOut}=file:open("",[raw, binary, write]), > fileio(StdIn, StdOut). > > fileio(StdIn, StdOut) -> > case file:read(StdIn,?bufsize) of > eof -> ok; > {ok, Data} -> > file:write(StdOut, Data), > fileio(StdIn, StdOut) > end. > > portio()-> > Port=open_port({fd, 0, 1},[eof]), > portio(Port), > port_close(Port). > > portio(Port)-> > receive > {Port, {data, Data}} -> > port_command(Port, Data), > portio(Port); > {_Port, eof} -> ok > end. > > normalio() -> > case io:get_chars('',?bufsize) of > eof -> ok; > Data -> > io:put_chars(Data), > normalio() > end. > > > > Command-lines: > > $ erl -noinput -run io_test file < txt > tmp-file ; tail -n 1 tmp-file > {259951,ok} > $ erl -noinput -run io_test port < txt > tmp-port ; tail -n 1 tmp-port > {1193521,true} > $ erl -noinput -noshell -run io_test normal < txt > tmp-normal ; tail -n > 1 tmp-normal > {16946068,ok} > > > Patch for unix on R11B-5: > diff ./erts/emulator/drivers/unix/unix_efile.c > ./erts/emulator/drivers/unix/unix_efile.c.old > 781,789c781 > < > < if (strcmp(name, "") == 0) { > < fd = 0; > < } else if (strcmp(name, "") == 0) { > < fd = 1; > < } else { > < fd = open(name, mode, FILE_MODE); > < } > < > --- > > fd = open(name, mode, FILE_MODE); > > > > > On 6/26/07, Ulf Wiger (TN/EAB) < ulf.wiger@REDACTED > wrote: > > > > > I submitted a sum-file entry to the shootout, which worked > > nicely in my environment(*), but failed miserably in the > > official benchmark. > > > > *http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&lang=hipe&id=2 > > * > > > > It uses the (admittedly undocumented) command-line flag for > > installing a custom user process, and opens stdin in line- > > oriented mode. > > > > The problem is that it runs out of memory. As far as I can make > > out, it's because the emulator chops up lines and sends them > > to the process at such a high rate that, even though the > > process is in a tight loop and doing minimal work on each item, > > it can't stop the message queue from building up. > > > > This has disastrous effects when the input file is large enough. > > > > I realise that the feature is undocumented, but perhaps it's still > > a valid point - some sort of generic flow-control on ports, > > similar to the {active, bool()} on sockets, would be just the > > thing here. > > > > (*) I realise that I tested it in an NFS-mounted disk (on a clearcase- > > enabled file system at that). This might have given the port > > sufficient flow control that the program lasted a bit longer, at least. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.kwiecinski@REDACTED Fri Jul 13 15:00:09 2007 From: daniel.kwiecinski@REDACTED (Daniel Kwiecinski) Date: Fri, 13 Jul 2007 14:00:09 +0100 Subject: [erlang-questions] input too fast In-Reply-To: References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> Message-ID: Hi, After further investigation I can see that under Windows eof is not detected at all :(. In fact the only thing changed after adding {line, 1000} is one single empty message {Data, {eol, []}} instead of infinite number of such messages coming from port. Any ideas? -- Kind Regards, Daniel Kwiecinski 2007/7/13, Daniel Kwiecinski : > > Hi, > > For me it look as messages comes from port really fast. They coming > fast because eof couldn't be detected and most of the messages are {data, > []}. It is because * ******PortSettings *in * **open_port(PortName, > PortSettings) *have to contain something more than *[eof]*. Like for > example * [eof, {line, 1000}]*. Then eof is detected and no more data is > delivered by port. > > The above is based on my observations. I am not an expert in erlang > field so please forgive my ignorance in case if I missed something obvious. > > -- > Kind Regards, > Daniel Kwiecinski > * * > > 2007/6/29, Fredrik Svahn : > > > > Sorry for double posting, it seems I have misconfigured something at > > trapexit... > > > > Fredrik Svahn wrote: > > I have also been frustrated by the way the io operations work when > > attempting to speed up a few of the example programs for the language > > shootout. The reverse-complement program for instance (which is approx. 60 > > times slower than the corresponding c program) spends 80% of its time > > reading from stdio, and I assume writing out the results are quite costly > > too. > > > > Just for fun I made a small patch to efile to allow for stdin/stdout to > > be opened as files. It probably has a lot of nasty side effects which I > > cannot even imagine in the worst of my nightmares, but the results for > > reading and writing are stunning. The "file" approach clocks in at 0.26seconds for reading a large file from stdin and writing it to stdout. > > Corresponding results for a port program is 1.2 seconds with the normal > > io approach measuring in at 16.9 seconds. > > > > I guess reading from stdin is not much of a problem for most Erlang > > applications which are supposed to be robust scalable systems staying up for > > years. I also think that this has been discussed before, probably at great > > length, although I cannot find any relevant posts at the moment. But now > > with escript maybe it might be a bit more interesting to have fast io > > operations for stdin/stdout, at least for unix systems? > > > > I haven't looked at memory consumption, yet, but I expect the result > > should be the same as for Ulf, i.e. port programs build up large heaps > > if they cannot handle the messages really really really fast, while the > > file and normal io approach should not really consume much more memory than > > the buffer. > > > > BR /Fredrik > > > > Test-program: > > > > -module(io_test). > > -export([file/0,port/0,normal/0,fileio/0,portio/0,normalio/0]). > > -define(bufsize, 2048). > > > > file()-> io:format("~n~p~n",[timer:tc(?MODULE, fileio, [])]), halt(). > > port()-> io:format("~n~p~n",[timer:tc(?MODULE, portio, [])]), halt(). > > normal()-> io:format("~n~p~n",[timer:tc(?MODULE, normalio, [])]), > > halt(). > > > > fileio()-> > > {ok,StdIn}=file:open("",[raw, binary, read]), > > {ok,StdOut}=file:open("",[raw, binary, write]), > > fileio(StdIn, StdOut). > > > > fileio(StdIn, StdOut) -> > > case file:read(StdIn,?bufsize) of > > eof -> ok; > > {ok, Data} -> > > file:write(StdOut, Data), > > fileio(StdIn, StdOut) > > end. > > > > portio()-> > > Port=open_port({fd, 0, 1},[eof]), > > portio(Port), > > port_close(Port). > > > > portio(Port)-> > > receive > > {Port, {data, Data}} -> > > port_command(Port, Data), > > portio(Port); > > {_Port, eof} -> ok > > end. > > > > normalio() -> > > case io:get_chars('',?bufsize) of > > eof -> ok; > > Data -> > > io:put_chars(Data), > > normalio() > > end. > > > > > > > > Command-lines: > > > > $ erl -noinput -run io_test file < txt > tmp-file ; tail -n 1 tmp-file > > {259951,ok} > > $ erl -noinput -run io_test port < txt > tmp-port ; tail -n 1 tmp-port > > {1193521,true} > > $ erl -noinput -noshell -run io_test normal < txt > tmp-normal ; tail > > -n 1 tmp-normal > > {16946068,ok} > > > > > > Patch for unix on R11B-5: > > diff ./erts/emulator/drivers/unix/unix_efile.c > > ./erts/emulator/drivers/unix/unix_efile.c.old > > 781,789c781 > > < > > < if (strcmp(name, "") == 0) { > > < fd = 0; > > < } else if (strcmp(name, "") == 0) { > > < fd = 1; > > < } else { > > < fd = open(name, mode, FILE_MODE); > > < } > > < > > --- > > > fd = open(name, mode, FILE_MODE); > > > > > > > > > > On 6/26/07, Ulf Wiger (TN/EAB) < ulf.wiger@REDACTED > wrote: > > > > > > > > I submitted a sum-file entry to the shootout, which worked > > > nicely in my environment(*), but failed miserably in the > > > official benchmark. > > > > > > *http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&lang=hipe&id=2 > > > * > > > > > > It uses the (admittedly undocumented) command-line flag for > > > installing a custom user process, and opens stdin in line- > > > oriented mode. > > > > > > The problem is that it runs out of memory. As far as I can make > > > out, it's because the emulator chops up lines and sends them > > > to the process at such a high rate that, even though the > > > process is in a tight loop and doing minimal work on each item, > > > it can't stop the message queue from building up. > > > > > > This has disastrous effects when the input file is large enough. > > > > > > I realise that the feature is undocumented, but perhaps it's still > > > a valid point - some sort of generic flow-control on ports, > > > similar to the {active, bool()} on sockets, would be just the > > > thing here. > > > > > > (*) I realise that I tested it in an NFS-mounted disk (on a clearcase- > > > enabled file system at that). This might have given the port > > > sufficient flow control that the program lasted a bit longer, at > > > least. > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oscar@REDACTED Fri Jul 13 17:43:02 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Fri, 13 Jul 2007 16:43:02 +0100 Subject: [erlang-questions] Link error when compiling ssl Message-ID: <46979D86.1070601@erlang-consulting.com> Hi, I've just tried to compile the OTP source (R11B-5) on a Intel(R) Pentium(R) III running SuSE 10.2 (or 10.1, not exactly sure) and ran in to some problems. I had to add -lz after -ldl to to the LIBS variable in lib/ssl/c_src/i686-pc-linux-gnu/Makefile. I'm guessing this is generated by configure though. Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From oscar@REDACTED Fri Jul 13 19:06:56 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Fri, 13 Jul 2007 18:06:56 +0100 Subject: [erlang-questions] Link error when compiling ssl In-Reply-To: <46979D86.1070601@erlang-consulting.com> References: <46979D86.1070601@erlang-consulting.com> Message-ID: <4697B130.6000900@erlang-consulting.com> Oscar Hellstr?m wrote: > Hi, > > I've just tried to compile the OTP source (R11B-5) on a Intel(R) > Pentium(R) III running SuSE 10.2 (or 10.1, not exactly sure) and ran in > to some problems. > > I had to add -lz after -ldl to to the LIBS variable in > lib/ssl/c_src/i686-pc-linux-gnu/Makefile. I'm guessing this is generated > by configure though. > > Best Regards Forgot to mention that the build system did not halt at this error, and I only found out when I couldn't use ssl. Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From dmercer@REDACTED Fri Jul 13 19:15:56 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 13 Jul 2007 12:15:56 -0500 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <7cb7cf500707111727w97da3ebrde056faf8181dfa3@mail.gmail.com> References: <46940862.3050202@telia.com> <7cb7cf500707111727w97da3ebrde056faf8181dfa3@mail.gmail.com> Message-ID: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> I read Virding's paper out of interest, and it is quite interesting, and I was playing around in my head how to implement Javascript in Erlang, when it struck me: why? Is it that you want to embed code written in Javascript into an Erlang program? That you think an Erlang implementation would be faster (or better in some other way) than existing ones? Or is it just out of intellectual curiosity? I ask because I do a lot of Javascript programming (server-type applications, not part of any browser). One of the things I like about Javascript, however, is its portability. I can use the libraries I develop for my applications (say, an implementation of a heap, or scheduler, or a parser) on a web page without any problem. (I don't generally program web pages, but others in my team do.) But I would never want to compile my Javascript libraries to Erlang; it would be much better to rewrite them. So for me the opposite would seem to be more interesting: compiling Erlang to Javascript. So long as you're willing to take the performance hit. That being said, since most Javascript development is done for the browser, concurrent programming isn't as big an issue for most Javascript programmers, so I know I am in the great minority as one of the few Javascript programmers who doesn't care about web programming. Cheers, David _____ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of beepblip@REDACTED Sent: Wednesday, July 11, 2007 19:28 To: Erlang Questions Subject: Re: [erlang-questions] JavaScript compiler for Erlang There is a great paper by Florian Loitsch where he attempted to translate javascript to scheme. The performance was actually better than most javascript implementations. I don't think that he had 100% language compatability, but it should be a great start for a JS -> Erlang project. On 7/10/07, Robert Virding wrote: Joel Reymont wrote: > Folks, > > Is Erlang a good platform to compile JavaScript to? > > Just gathering opinions. > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog Yes, I think Erlang would be a good platform to compile JavaScript to. I have been thinking about how to do a PHP implementation and arrived at the same conclusion. The main difficulties would be the large libraires and the rather crappy syntax and semantics (of PHP). Robert _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From forsyth@REDACTED Fri Jul 13 19:40:21 2007 From: forsyth@REDACTED (Charles Forsyth) Date: Fri, 13 Jul 2007 18:40:21 +0100 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> Message-ID: <32b96478b2e76de527050780d4bae17d@terzarima.net> > being said, since most Javascript development is done for the browser, > concurrent programming isn't as big an issue for most Javascript > programmers, ... that's changing: most interactive environments are concurrent environments, although the support for it in Javascript seems dismal. (but then, it's dismal in most windowing systems, too.) that seems to force slightly unusual approaches (but those might anyway be interesting in themselves), such as: MapJAX: Data Structure Abstractions for Asynchronous Web Applications http://www.usenix.org/events/usenix07/tech/myers.html From dmercer@REDACTED Fri Jul 13 20:21:30 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 13 Jul 2007 13:21:30 -0500 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <32b96478b2e76de527050780d4bae17d@terzarima.net> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> Message-ID: <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> True, it is quite annoying to have to code AJAX with event handlers as opposed to just writing code linearly as you would in Erlang. That, however, would justify compiling Erlang to Javascript, instead of vice cersa, so you can write your code in Erlang but distribute it to browsers in a language they understand. So my question stands: other than for intellectual edification, why would you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping the answer will cause me to think about it on my drive home this evening... David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Charles Forsyth Sent: Friday, July 13, 2007 12:40 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] JavaScript compiler for Erlang > being said, since most Javascript development is done for the browser, > concurrent programming isn't as big an issue for most Javascript > programmers, ... that's changing: most interactive environments are concurrent environments, although the support for it in Javascript seems dismal. (but then, it's dismal in most windowing systems, too.) that seems to force slightly unusual approaches (but those might anyway be interesting in themselves), such as: MapJAX: Data Structure Abstractions for Asynchronous Web Applications http://www.usenix.org/events/usenix07/tech/myers.html _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dominique.boucher@REDACTED Fri Jul 13 20:52:47 2007 From: dominique.boucher@REDACTED (Dominique Boucher) Date: Fri, 13 Jul 2007 14:52:47 -0400 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP><32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> Message-ID: <003f01c7c57f$017f8000$6400a8c0@lelouch> Maybe a JavaScript interpreter in Erlang would be more interesting? I know of several XML-based languages requiring a JavaScript interpreter that could benefit from being implemented in Erlang (VoiceXML, GrXML, CCXML, etc, all in the speech-recognition industry). Dominique > True, it is quite annoying to have to code AJAX with event handlers as > opposed to just writing code linearly as you would in Erlang. That, > however, would justify compiling Erlang to Javascript, instead of vice > cersa, so you can write your code in Erlang but distribute it to browsers > in > a language they understand. > > So my question stands: other than for intellectual edification, why would > you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping > the answer will cause me to think about it on my drive home this > evening... From fig@REDACTED Fri Jul 13 21:35:47 2007 From: fig@REDACTED (Michael FIG) Date: Fri, 13 Jul 2007 13:35:47 -0600 (CST) Subject: [erlang-questions] input too fast In-Reply-To: Message-ID: <6296397.3321184355347805.JavaMail.root@zimbra> Fredrik Svahn writes: >While I agree that "" seems to be a perfectly valid (although not >recommended) filename in all(?) unix systems I do not think that using an atom will >help. Why not use a Unix convention, "/dev/stdin" and "/dev/stdout"? -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From dmercer@REDACTED Fri Jul 13 21:42:43 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 13 Jul 2007 14:42:43 -0500 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> Message-ID: <004c01c7c585$fb9b4e10$891ea8c0@SSI.CORP> Gotcha. Perfect explanation as to why. Now I can think on my drive home this evening. David _____ From: denis [mailto:dloutrein.lists@REDACTED] Sent: Friday, July 13, 2007 14:12 To: dmercer@REDACTED Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] JavaScript compiler for Erlang I started thinking about compiling javascript into erlang one month ago, as a possible need for a project in my company. We are building an infrastructure allowing giving some services to our users. But external developers (same company, but other teams) could build their own custom services inside the infrastructure. Having these new users to learn a new language to build a custom services (which can be quite simple) can be badly perceived. Especially to some "average" developers which even don't know what is a functional language; so when you have to explain them that there is no for loops, that you can't change the value of a variable... You see what I mean. I thought of javascript because is syntax is quite similar to java and c++, and because it can be quite powerful if you want to use advanced constructions. Also, having done a lot of web development before, I remember that I was fed up to switch from one language to another, when working on the client or the server part, and not being able to share code. So for me, having a platform able to use concurrency and distributing power of Erlang, allowing me to use the same language for the client and server side seems appealing. But it's true that compiling javascript into erlang isn't straighforward, which is intellectualy interesting and challenging ;-) Denis 2007/7/13, David Mercer : True, it is quite annoying to have to code AJAX with event handlers as opposed to just writing code linearly as you would in Erlang. That, however, would justify compiling Erlang to Javascript, instead of vice cersa, so you can write your code in Erlang but distribute it to browsers in a language they understand. So my question stands: other than for intellectual edification, why would you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping the answer will cause me to think about it on my drive home this evening... David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED ] On Behalf Of Charles Forsyth Sent: Friday, July 13, 2007 12:40 To: erlang-questions@REDACTED Subject: Re: [erlang-questions] JavaScript compiler for Erlang > being said, since most Javascript development is done for the browser, > concurrent programming isn't as big an issue for most Javascript > programmers, ... that's changing: most interactive environments are concurrent environments, although the support for it in Javascript seems dismal. (but then, it's dismal in most windowing systems, too.) that seems to force slightly unusual approaches (but those might anyway be interesting in themselves), such as: MapJAX: Data Structure Abstractions for Asynchronous Web Applications http://www.usenix.org/events/usenix07/tech/myers.html _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From haoboy@REDACTED Fri Jul 13 21:44:58 2007 From: haoboy@REDACTED (Haobo Yu) Date: Fri, 13 Jul 2007 12:44:58 -0700 Subject: [erlang-questions] using variable in bit syntax Message-ID: <5DB22E24-5BE1-451A-9824-251CE64D1AEE@gmail.com> Hi, I'm rather new to erlang, so please pardon my ignorance. I'm trying to parse a packet header using the bit syntax. There is a byte in the header that indicates the endianness of the subsequent integers in the packet header. For example: endianness : 8/unsigned-integer %% The following integers follow the above endianness value1 : 32/integer value2 : 32/integer ... Because the endianness is specified in the bit syntax, such as unsigned-little-integer, it would be nice to encode the endianness in a variable when I parse that byte, then use this variable to parse the following integers in the packet header. I would like to have something like this: if Endianness == 1 -> Spec = "32/little-integer"; true -> Spec = "32/big-integer"; end, <> = Header, However, putting a variable in the place of bit type specifier does not seem to work. I can't put a BIF, such as list_to_atom, there either. Any suggestions whether and how this might be done? Thanks very much. - Haobo From dloutrein.lists@REDACTED Fri Jul 13 21:11:52 2007 From: dloutrein.lists@REDACTED (denis) Date: Fri, 13 Jul 2007 15:11:52 -0400 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> Message-ID: <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> I started thinking about compiling javascript into erlang one month ago, as a possible need for a project in my company. We are building an infrastructure allowing giving some services to our users. But external developers (same company, but other teams) could build their own custom services inside the infrastructure. Having these new users to learn a new language to build a custom services (which can be quite simple) can be badly perceived. Especially to some "average" developers which even don't know what is a functional language; so when you have to explain them that there is no for loops, that you can't change the value of a variable... You see what I mean. I thought of javascript because is syntax is quite similar to java and c++, and because it can be quite powerful if you want to use advanced constructions. Also, having done a lot of web development before, I remember that I was fed up to switch from one language to another, when working on the client or the server part, and not being able to share code. So for me, having a platform able to use concurrency and distributing power of Erlang, allowing me to use the same language for the client and server side seems appealing. But it's true that compiling javascript into erlang isn't straighforward, which is intellectualy interesting and challenging ;-) Denis 2007/7/13, David Mercer : > > True, it is quite annoying to have to code AJAX with event handlers as > opposed to just writing code linearly as you would in Erlang. That, > however, would justify compiling Erlang to Javascript, instead of vice > cersa, so you can write your code in Erlang but distribute it to browsers > in > a language they understand. > > So my question stands: other than for intellectual edification, why would > you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping > the answer will cause me to think about it on my drive home this > evening... > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Charles Forsyth > Sent: Friday, July 13, 2007 12:40 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] JavaScript compiler for Erlang > > > being said, since most Javascript development is done for the browser, > > concurrent programming isn't as big an issue for most Javascript > > programmers, ... > > that's changing: most interactive environments are concurrent > environments, > although the support > for it in Javascript seems dismal. (but then, it's dismal in most > windowing > systems, too.) > that seems to force slightly unusual approaches > (but those might anyway be interesting in themselves), such as: > > MapJAX: Data Structure Abstractions for Asynchronous Web Applications > http://www.usenix.org/events/usenix07/tech/myers.html > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Fri Jul 13 20:38:39 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 13 Jul 2007 11:38:39 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> Message-ID: <6a36e7290707131138n1ef9c5e6v9ac7d44cb2fc806d@mail.gmail.com> It seems like it would be practical to allow users of a large Erlang system to write things like business rules or game logic in JavaScript... basically for the same reasons people use Rhino in Java. I think compiling Erlang to JavaScript is less practical because debugging JavaScript is hard enough as it is, since the VMs are all broken in slightly different ways... -bob On 7/13/07, David Mercer wrote: > True, it is quite annoying to have to code AJAX with event handlers as > opposed to just writing code linearly as you would in Erlang. That, > however, would justify compiling Erlang to Javascript, instead of vice > cersa, so you can write your code in Erlang but distribute it to browsers in > a language they understand. > > So my question stands: other than for intellectual edification, why would > you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping > the answer will cause me to think about it on my drive home this evening... > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Charles Forsyth > Sent: Friday, July 13, 2007 12:40 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] JavaScript compiler for Erlang > > > being said, since most Javascript development is done for the browser, > > concurrent programming isn't as big an issue for most Javascript > > programmers, ... > > that's changing: most interactive environments are concurrent environments, > although the support > for it in Javascript seems dismal. (but then, it's dismal in most windowing > systems, too.) > that seems to force slightly unusual approaches > (but those might anyway be interesting in themselves), such as: > > MapJAX: Data Structure Abstractions for Asynchronous Web Applications > http://www.usenix.org/events/usenix07/tech/myers.html > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Sat Jul 14 00:32:42 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 14 Jul 2007 00:32:42 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004c01c7c585$fb9b4e10$891ea8c0@SSI.CORP> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <004c01c7c585$fb9b4e10$891ea8c0@SSI.CORP> Message-ID: <4697FD8A.7040906@telia.com> Implementing languages is fun! After doing Erlog (Prolog in and for Erlang), which you can find on trapexit, we were building a new webpage for our project at work and the platform we decided to use was written in PHP (as so many are). I then thought that if you wrote a PHP interpreter in Erlang then you could easily and efficiently integrate into Yaws for example and get the best of both worlds. So I started looking at PHP. Now PHP sucks in many ways, the syntax for example is a right mess. But apart from that it doesn't seem too difficult. The main problem is probably doing all the libraries. PHP has one advantage in that you generate HTML so you don't really need any windowing interfaces. I see now that perhaps I should start with Javascript. However, I have not really looked at the language but I can't imagine that there could any real problems. I would say that it should not be too difficult to interpret/compile almost any language as long as it does have its own windowing interface. Whether it's really worth it is another question. But as I said "implementing languages is fun". :-) Robert David Mercer wrote: > Gotcha. Perfect explanation as to why. Now I can think on my drive > home this evening? > > > > David > > > > ------------------------------------------------------------------------ > > *From:* denis [mailto:dloutrein.lists@REDACTED] > *Sent:* Friday, July 13, 2007 14:12 > *To:* dmercer@REDACTED > *Cc:* erlang-questions@REDACTED > *Subject:* Re: [erlang-questions] JavaScript compiler for Erlang > > > > I started thinking about compiling javascript into erlang one month ago, > as a possible need for a project in my company. > > We are building an infrastructure allowing giving some services to our > users. But external developers (same company, but other teams) could > build their own custom services inside the infrastructure. Having these > new users to learn a new language to build a custom services (which can > be quite simple) can be badly perceived. Especially to some "average" > developers which even don't know what is a functional language; so when > you have to explain them that there is no for loops, that you can't > change the value of a variable... You see what I mean. I thought of > javascript because is syntax is quite similar to java and c++, and > because it can be quite powerful if you want to use advanced constructions. > > Also, having done a lot of web development before, I remember that I was > fed up to switch from one language to another, when working on the > client or the server part, and not being able to share code. So for me, > having a platform able to use concurrency and distributing power of > Erlang, allowing me to use the same language for the client and server > side seems appealing. > > But it's true that compiling javascript into erlang isn't > straighforward, which is intellectualy interesting and challenging ;-) > > Denis > > > > 2007/7/13, David Mercer >: > > True, it is quite annoying to have to code AJAX with event handlers as > opposed to just writing code linearly as you would in Erlang. That, > however, would justify compiling Erlang to Javascript, instead of vice > cersa, so you can write your code in Erlang but distribute it to > browsers in > a language they understand. > > So my question stands: other than for intellectual edification, why would > you compile Javascript to Erlang? I'm not asking rhetorically; I'm hoping > the answer will cause me to think about it on my drive home this evening... > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED > ] On Behalf Of Charles Forsyth > Sent: Friday, July 13, 2007 12:40 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] JavaScript compiler for Erlang > > > being said, since most Javascript development is done for the browser, > > concurrent programming isn't as big an issue for most Javascript > > programmers, ... > > that's changing: most interactive environments are concurrent environments, > although the support > for it in Javascript seems dismal. (but then, it's dismal in most windowing > systems, too.) > that seems to force slightly unusual approaches > (but those might anyway be interesting in themselves), such as: > > MapJAX: Data Structure Abstractions for Asynchronous Web Applications > http://www.usenix.org/events/usenix07/tech/myers.html > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Sat Jul 14 01:17:08 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 14 Jul 2007 00:17:08 +0100 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> Message-ID: <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> This is the reason I asked. Think scalable web development for the masses. In Javascript. On top of Erlang. On Jul 13, 2007, at 8:11 PM, denis wrote: > We are building an infrastructure allowing giving some services to our > users. But external developers (same company, but other teams) > could build > their own custom services inside the infrastructure. Having these > new users > to learn a new language to build a custom services (which can be quite > simple) can be badly perceived. -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From christopher@REDACTED Sat Jul 14 00:43:49 2007 From: christopher@REDACTED (Christopher Baus) Date: Fri, 13 Jul 2007 15:43:49 -0700 (PDT) Subject: [erlang-questions] Binary matching implementation / performance Message-ID: <41361.12.146.21.162.1184366629.squirrel@webmail.tuffmail.net> Hi, I'm learning erlang, and I have a question regarding binary matching performance and implementation. Consider: <> = <<"somebinarydata">>. Are X and Rest constructed by copying and reallocating the underlying buffer (I suspect they are), or do the new variables just contain pointers to the original data? If rest is sufficiently long, reallocating could be very slow and would probably require converting the binary to a list. Thanks, Chris From hokan.stenholm@REDACTED Sat Jul 14 02:12:56 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 14 Jul 2007 02:12:56 +0200 Subject: [erlang-questions] Binary matching implementation / performance In-Reply-To: <41361.12.146.21.162.1184366629.squirrel@webmail.tuffmail.net> References: <41361.12.146.21.162.1184366629.squirrel@webmail.tuffmail.net> Message-ID: <46981508.8040802@bredband.net> Christopher Baus wrote: > Hi, > > I'm learning erlang, and I have a question regarding binary matching > performance and implementation. > > Consider: > > <> = <<"somebinarydata">>. > > Are X and Rest constructed by copying and reallocating the underlying > buffer (I suspect they are), or do the new variables just contain pointers > to the original data? > > They are just pointers, this has been mentioned on the mailing list a couple of days ago - erlang.org and trapexit should have a searchable archive. Erlang only copies data when you build a new binary, not when you pattern match against a existing binary. As Erlang memory "objects" are imutable once created - it would (generally) make little sense to do a copy of their content. This is why for example updating a tuple will only create a new array of tuple member pointers in the erlang VM, or why doing L = [E | R] will only create a "cons box" (pair of pointers) to create L. > If rest is sufficiently long, reallocating could be very slow and would > probably require converting the binary to a list. > > Thanks, > > Chris > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From perrygeo@REDACTED Sat Jul 14 05:06:35 2007 From: perrygeo@REDACTED (Matthew Perry) Date: Fri, 13 Jul 2007 20:06:35 -0700 Subject: [erlang-questions] Erlang and geospatial data Message-ID: <5383fa5e0707132006y29d54f42p4a874f7f43fc387f@mail.gmail.com> Hi all, My main programming experience is working with geospatial data as either raster grids (easily expressed as 2D arrays) or vector data (points,lines or polygons expressed as a sequence of verticies with x/y coordinates). There are many great tools for geospatial data written in the C language family (numpy, GDAL, GRASS, etc). But most operations are cpu-bound and don't readily take advantage of multiple cores even though the algorithms themselves are quite friendly to parallel processing. Not coincidentally, this is why I started looking at Erlang. Has anyone had any experience using Erlang to analyze similar data structures? Do there exist any geometry or array processing modules? Or might it be possible to use these proven C libraries through Erlang? -- Matthew T. Perry http://www.perrygeo.net "You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete" - R. Buckminster Fuller From nm@REDACTED Sat Jul 14 09:01:23 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 14 Jul 2007 12:01:23 +0500 Subject: [erlang-questions] using variable in bit syntax In-Reply-To: <5DB22E24-5BE1-451A-9824-251CE64D1AEE@gmail.com> References: <5DB22E24-5BE1-451A-9824-251CE64D1AEE@gmail.com> Message-ID: <469874C3.3070004@web.am> Haobo Yu wrote: > Hi, > > I'm rather new to erlang, so please pardon my ignorance. > > I'm trying to parse a packet header using the bit syntax. There is a > byte in the header that indicates the endianness of the subsequent > integers in the packet header. For example: > > endianness : 8/unsigned-integer > %% The following integers follow the above endianness > value1 : 32/integer > value2 : 32/integer > ... > > Because the endianness is specified in the bit syntax, such as > unsigned-little-integer, it would be nice to encode the endianness in > a variable when I parse that byte, then use this variable to parse > the following integers in the packet header. I would like to have > something like this: > > if Endianness == 1 -> > Spec = "32/little-integer"; > true -> > Spec = "32/big-integer"; > end, > <> = Header, > > However, putting a variable in the place of bit type specifier does > not seem to work. I can't put a BIF, such as list_to_atom, there > either. > > Any suggestions whether and how this might be done? > The most straightforward method is something like this :) if Endianness == 1 -> <> = Header; true -> <> = Header; end, :) In other hand you can construct string and then transform it to erlang code, see http://www.erlang.org/pipermail/erlang-questions/2005-April/015274.html This will allow you construct fun before parsing data, and them apply that fun on each packet. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From Bruce@REDACTED Sat Jul 14 12:46:03 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sat, 14 Jul 2007 22:46:03 +1200 Subject: [erlang-questions] ssl failed during the time shaking hands In-Reply-To: <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> References: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> Message-ID: <4698A96B.8020502@Fitzsimons.org> Jeremy Chow wrote: > > > Apparently, there are still 142 bytes data stayed at the receive > queue. The receiver terminal program hasnot take any data from that > queue beacuse the right file descriptor has not been added yet. > > Who can explain that phenomenon and give me a solution? > Hi Jeremy, list, I'm assuming you didn't find the cause? I can't explain the phenomenon, but I am experiencing the same problem. Using standard distribution my two nodes talk fine, but if I introduce inet_ssl with all the correct options they refuse to communicate (on the local lan). Setting up normal ssl connections (ssl:listen etc) works between the nodes, using the same certificates. I'm seeing the same Recv-Q in netstat, and all my node<->dns<->ip resolution queries look fine. I'm going to try reinstalling without hipe (sorry hipe guys) and failing that dig into the source. All on gentoo linux x86, with R11B-5. Regards, Bruce From bbmaj7@REDACTED Sat Jul 14 13:27:26 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Sat, 14 Jul 2007 21:27:26 +1000 (EST) Subject: [erlang-questions] Erlang and geospatial data In-Reply-To: <5383fa5e0707132006y29d54f42p4a874f7f43fc387f@mail.gmail.com> Message-ID: <639944.75909.qm@web52010.mail.re2.yahoo.com> --- Matthew Perry wrote: > Not coincidentally, this is why I started looking at Erlang. Has > anyone had any experience using Erlang to analyze similar data > structures? Do there exist any geometry or array processing modules? > Or might it be possible to use these proven C libraries through > Erlang? I think you should probably design a processing model first and then when you know how it should operate go looking for the best platform. Erlang probably won't be it, more likely MPI or its ilk, simply because Erlang isn't designed to move large amounts of data (you're probably talking GB); but rather to be massively concurrent on small narrow tasks. Erlang can interact with programs in the host through "ports" which can be eg. IPC pipes or specially written shared libraries loaded by erlang. Read the Interoperability Tutorial for more info on this: http://www.erlang.org/doc/tutorial/part_frame.html ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From dking@REDACTED Sat Jul 14 22:12:29 2007 From: dking@REDACTED (David King) Date: Sat, 14 Jul 2007 13:12:29 -0700 Subject: [erlang-questions] Trouble compiling erlang on OS X intel Message-ID: <61159AF3-1955-4A62-94FE-0215E923C878@ketralnis.com> I'm having trouble compiling Erlang R11B-5 on OS X.4 on an Intel MacBook Pro. It fails saying that it can't find "mach_override.h", which doesn't appear anywhere on my machine. ~/Desktop/otp_src_R11B-5% ./configure --enable-smp-support --enable- threads --enable-kernel-poll --enable-hipe --prefix=/usr/local --with- ssl && make [...] gcc -mdynamic-no-pic -g -O2 -I/Users/dking/Desktop/otp_src_R11B-5/ erts/i386-apple-darwin8.10.1 -no-cpp-precomp -DUSE_THREADS - D_THREAD_SAFE -D_REENTRANT -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict- prototypes -Wmissing-prototypes -DUSE_THREADS -D_THREAD_SAFE - D_REENTRANT -Ibeam -Isys/unix -Isys/common -Ii386-apple-darwin8.10.1/ opt/hybrid -Ii386-apple-darwin8.10.1 -Izlib -Ihipe -I../include/ internal -I../include/internal/i386-apple-darwin8.10.1 -c i386-apple- darwin8.10.1/opt/hybrid/hipe_x86_bifs.S -o obj/i386-apple- darwin8.10.1/opt/hybrid/hipe_x86_bifs.o make[3]: *** No rule to make target `mach_override.h', needed by `obj/ i386-apple-darwin8.10.1/opt/hybrid/hipe_x86_signal.o'. Stop. make[2]: *** [opt] Error 2 make[1]: *** [hybrid] Error 2 make: *** [emulator] Error 2 If I do the same without --enable-hipe it works, but the Erlang from Darwinports has hipe and it works just fine (although it doesn't have SMP support, which is important to me), so I know hipe works with OS X. I see that Darwinports actually ships with mach_override.h: % find /opt -name mach_override.h /opt/local/var/db/dports/sources/ rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files/ mach_override.h I also see that Darwinports has some other files necessary for Erlang: % ls /opt/local/var/db/dports/sources/ rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files mach_override.c mach_override.h patch-toolbar.erl So is there a generalised OS X patchset that I'm missing? From haoboy@REDACTED Sat Jul 14 23:38:07 2007 From: haoboy@REDACTED (Haobo Yu) Date: Sat, 14 Jul 2007 14:38:07 -0700 Subject: [erlang-questions] using variable in bit syntax In-Reply-To: <469874C3.3070004@web.am> References: <5DB22E24-5BE1-451A-9824-251CE64D1AEE@gmail.com> <469874C3.3070004@web.am> Message-ID: That link is very helpful. Thanks! - Haobo On Jul 14, 2007, at 12:01 AM, Gaspar Chilingarov wrote: > Haobo Yu wrote: >> Hi, >> I'm rather new to erlang, so please pardon my ignorance. >> I'm trying to parse a packet header using the bit syntax. There >> is a byte in the header that indicates the endianness of the >> subsequent integers in the packet header. For example: >> endianness : 8/unsigned-integer >> %% The following integers follow the above endianness >> value1 : 32/integer >> value2 : 32/integer >> ... >> Because the endianness is specified in the bit syntax, such as >> unsigned-little-integer, it would be nice to encode the endianness >> in a variable when I parse that byte, then use this variable to >> parse the following integers in the packet header. I would like >> to have something like this: >> if Endianness == 1 -> >> Spec = "32/little-integer"; >> true -> >> Spec = "32/big-integer"; >> end, >> <> = Header, >> However, putting a variable in the place of bit type specifier >> does not seem to work. I can't put a BIF, such as list_to_atom, >> there either. >> Any suggestions whether and how this might be done? > > The most straightforward method is something like this :) > > > if Endianness == 1 -> > <> = Header; > true -> > <> = Header; > end, > > :) > > In other hand you can construct string and then > transform it to erlang code, see > http://www.erlang.org/pipermail/erlang-questions/2005-April/ > 015274.html > > This will allow you construct fun before parsing data, and them > apply that fun on each packet. > > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37493 419763 (mob) > i 63174784 > e nm@REDACTED > w http://zanazan.am/ From sunyin51@REDACTED Sat Jul 14 23:46:20 2007 From: sunyin51@REDACTED (yin sun) Date: Sat, 14 Jul 2007 17:46:20 -0400 Subject: [erlang-questions] question about regexp:gsub \& Message-ID: <8196381f0707141446u1b01caceh997988f69a920237@mail.gmail.com> in http://www.erlang.org//doc/apps/stdlib/index.html manual for regexp, \& puts a literal & into the replacement string. But 35> regexp:gsub("<>",">","\&"). {ok,"<>",1} Is the manual wrong or I miss something? Thanks /Yin From mikpe@REDACTED Sat Jul 14 23:54:36 2007 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 14 Jul 2007 23:54:36 +0200 (MEST) Subject: [erlang-questions] Trouble compiling erlang on OS X intel Message-ID: <200707142154.l6ELsaLC028194@harpo.it.uu.se> On Sat, 14 Jul 2007 13:12:29 -0700, David King wrote: > I'm having trouble compiling Erlang R11B-5 on OS X.4 on an Intel > MacBook Pro. It fails saying that it can't find "mach_override.h", > which doesn't appear anywhere on my machine. > > ~/Desktop/otp_src_R11B-5% ./configure --enable-smp-support --enable- > threads --enable-kernel-poll --enable-hipe --prefix=/usr/local --with- > ssl && make > [...] > gcc -mdynamic-no-pic -g -O2 -I/Users/dking/Desktop/otp_src_R11B-5/ > erts/i386-apple-darwin8.10.1 -no-cpp-precomp -DUSE_THREADS - > D_THREAD_SAFE -D_REENTRANT -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict- > prototypes -Wmissing-prototypes -DUSE_THREADS -D_THREAD_SAFE - > D_REENTRANT -Ibeam -Isys/unix -Isys/common -Ii386-apple-darwin8.10.1/ > opt/hybrid -Ii386-apple-darwin8.10.1 -Izlib -Ihipe -I../include/ > internal -I../include/internal/i386-apple-darwin8.10.1 -c i386-apple- > darwin8.10.1/opt/hybrid/hipe_x86_bifs.S -o obj/i386-apple- > darwin8.10.1/opt/hybrid/hipe_x86_bifs.o > make[3]: *** No rule to make target `mach_override.h', needed by `obj/ > i386-apple-darwin8.10.1/opt/hybrid/hipe_x86_signal.o'. Stop. > make[2]: *** [opt] Error 2 > make[1]: *** [hybrid] Error 2 > make: *** [emulator] Error 2 > > If I do the same without --enable-hipe it works, but the Erlang from > Darwinports has hipe and it works just fine (although it doesn't have > SMP support, which is important to me), so I know hipe works with OS X. > > I see that Darwinports actually ships with mach_override.h: > > % find /opt -name mach_override.h > /opt/local/var/db/dports/sources/ > rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files/ > mach_override.h > > I also see that Darwinports has some other files necessary for Erlang: > > % ls /opt/local/var/db/dports/sources/ > rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files > mach_override.c mach_override.h patch-toolbar.erl > > So is there a generalised OS X patchset that I'm missing? You just answered your own question. Use Darwinports (whatever that is). Support for HiPE on OSX/x86 in the vanilla OTP tarballs is only partial. It requires the mach_override stuff, and is totally unsupported since (1) it does weird things (mach_override), and (2) we (the HiPE group) don't have OSX/x86 machines. Just ask whoever's in charge of Erlang in Darwinports to enable SMP, or get the source code for their patched Erlang package and enable SMP yourself. It probably just needs ./configure --enable-smp-support. /Mikael From list.nabble@REDACTED Sun Jul 15 00:43:03 2007 From: list.nabble@REDACTED (Per Melin) Date: Sat, 14 Jul 2007 15:43:03 -0700 (PDT) Subject: [erlang-questions] question about regexp:gsub \& In-Reply-To: <8196381f0707141446u1b01caceh997988f69a920237@mail.gmail.com> References: <8196381f0707141446u1b01caceh997988f69a920237@mail.gmail.com> Message-ID: <11597974.post@talk.nabble.com> yin sun wrote: > > 35> regexp:gsub("<>",">","\&"). > {ok,"<>",1} > The first backslash is eaten by Erlang. 1> "\&". "&" 2> length("\&"). 1 So you need to use "\\&" instead. -- View this message in context: http://www.nabble.com/question-about-regexp%3Agsub-%5C--tf4080421.html#a11597974 Sent from the Erlang Questions mailing list archive at Nabble.com. From sunyin51@REDACTED Sun Jul 15 00:48:12 2007 From: sunyin51@REDACTED (yin sun) Date: Sat, 14 Jul 2007 18:48:12 -0400 Subject: [erlang-questions] question about regexp:gsub \& In-Reply-To: <8196381f0707141446u1b01caceh997988f69a920237@mail.gmail.com> References: <8196381f0707141446u1b01caceh997988f69a920237@mail.gmail.com> Message-ID: <8196381f0707141548h6b74aee4xc6c58da786376d3d@mail.gmail.com> after checking the source, I realized that I should use "\\&" instead of "\&". this should be put in manual, not straight forward to me. On 7/14/07, yin sun wrote: > in http://www.erlang.org//doc/apps/stdlib/index.html > manual for regexp, > \& puts a literal & into the replacement string. > > But > > 35> regexp:gsub("<>",">","\&"). > {ok,"<>",1} > > Is the manual wrong or I miss something? > > Thanks > /Yin > From bent@REDACTED Sun Jul 15 02:40:44 2007 From: bent@REDACTED (Ben Munat) Date: Sat, 14 Jul 2007 14:40:44 -1000 Subject: [erlang-questions] Trouble compiling erlang on OS X intel In-Reply-To: <200707142154.l6ELsaLC028194@harpo.it.uu.se> References: <200707142154.l6ELsaLC028194@harpo.it.uu.se> Message-ID: <46996D0C.1080106@munat.com> Darwin Ports has changed it's name to Mac Ports (http://www.macports.org/). I installed R11B-4 with Mac Ports without any problem. I'm just not up to date... R11B-5 is available. Also, there is an smp variant available for the Mac Ports erlang package... I think you would do: port install erlang +smp Or something like that. HTH, Ben Mikael Pettersson wrote: > On Sat, 14 Jul 2007 13:12:29 -0700, David King wrote: >> I'm having trouble compiling Erlang R11B-5 on OS X.4 on an Intel >> MacBook Pro. It fails saying that it can't find "mach_override.h", >> which doesn't appear anywhere on my machine. >> >> ~/Desktop/otp_src_R11B-5% ./configure --enable-smp-support --enable- >> threads --enable-kernel-poll --enable-hipe --prefix=/usr/local --with- >> ssl && make >> [...] >> gcc -mdynamic-no-pic -g -O2 -I/Users/dking/Desktop/otp_src_R11B-5/ >> erts/i386-apple-darwin8.10.1 -no-cpp-precomp -DUSE_THREADS - >> D_THREAD_SAFE -D_REENTRANT -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict- >> prototypes -Wmissing-prototypes -DUSE_THREADS -D_THREAD_SAFE - >> D_REENTRANT -Ibeam -Isys/unix -Isys/common -Ii386-apple-darwin8.10.1/ >> opt/hybrid -Ii386-apple-darwin8.10.1 -Izlib -Ihipe -I../include/ >> internal -I../include/internal/i386-apple-darwin8.10.1 -c i386-apple- >> darwin8.10.1/opt/hybrid/hipe_x86_bifs.S -o obj/i386-apple- >> darwin8.10.1/opt/hybrid/hipe_x86_bifs.o >> make[3]: *** No rule to make target `mach_override.h', needed by `obj/ >> i386-apple-darwin8.10.1/opt/hybrid/hipe_x86_signal.o'. Stop. >> make[2]: *** [opt] Error 2 >> make[1]: *** [hybrid] Error 2 >> make: *** [emulator] Error 2 >> >> If I do the same without --enable-hipe it works, but the Erlang from >> Darwinports has hipe and it works just fine (although it doesn't have >> SMP support, which is important to me), so I know hipe works with OS X. >> >> I see that Darwinports actually ships with mach_override.h: >> >> % find /opt -name mach_override.h >> /opt/local/var/db/dports/sources/ >> rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files/ >> mach_override.h >> >> I also see that Darwinports has some other files necessary for Erlang: >> >> % ls /opt/local/var/db/dports/sources/ >> rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files >> mach_override.c mach_override.h patch-toolbar.erl >> >> So is there a generalised OS X patchset that I'm missing? > > You just answered your own question. Use Darwinports (whatever that is). > > Support for HiPE on OSX/x86 in the vanilla OTP tarballs is only partial. > It requires the mach_override stuff, and is totally unsupported since > (1) it does weird things (mach_override), and (2) we (the HiPE group) > don't have OSX/x86 machines. > > Just ask whoever's in charge of Erlang in Darwinports to enable SMP, > or get the source code for their patched Erlang package and enable > SMP yourself. It probably just needs ./configure --enable-smp-support. > > /Mikael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From dking@REDACTED Sun Jul 15 07:15:58 2007 From: dking@REDACTED (David King) Date: Sat, 14 Jul 2007 22:15:58 -0700 Subject: [erlang-questions] Trouble compiling erlang on OS X intel In-Reply-To: <46996D0C.1080106@munat.com> References: <200707142154.l6ELsaLC028194@harpo.it.uu.se> <46996D0C.1080106@munat.com> Message-ID: <4FB3DDD0-DAAA-4417-8892-568514F14B47@ketralnis.com> > Darwin Ports has changed it's name to Mac Ports (http:// > www.macports.org/). I installed R11B-4 with > Mac Ports without any problem. I'm just not up to date... R11B-5 is > available. > Also, there is an smp variant available for the Mac Ports erlang > package... I think you would do: > port install erlang +smp > Or something like that. Ah, I wasn't aware of the variant-system in Macports, that saved me quite some time, thank you. FreeBSD's ports (on with Mac Ports is based) uses environment variables for that. Is there a way to convince Erlang that "-smp enable" should be the default once SMP support is included? > Mikael Pettersson wrote: >> On Sat, 14 Jul 2007 13:12:29 -0700, David King wrote: >>> I'm having trouble compiling Erlang R11B-5 on OS X.4 on an Intel >>> MacBook Pro. It fails saying that it can't find "mach_override.h", >>> which doesn't appear anywhere on my machine. >>> >>> ~/Desktop/otp_src_R11B-5% ./configure --enable-smp-support --enable- >>> threads --enable-kernel-poll --enable-hipe --prefix=/usr/local -- >>> with- >>> ssl && make >>> [...] >>> gcc -mdynamic-no-pic -g -O2 -I/Users/dking/Desktop/otp_src_R11B-5/ >>> erts/i386-apple-darwin8.10.1 -no-cpp-precomp -DUSE_THREADS - >>> D_THREAD_SAFE -D_REENTRANT -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict- >>> prototypes -Wmissing-prototypes -DUSE_THREADS -D_THREAD_SAFE - >>> D_REENTRANT -Ibeam -Isys/unix -Isys/common -Ii386-apple- >>> darwin8.10.1/ >>> opt/hybrid -Ii386-apple-darwin8.10.1 -Izlib -Ihipe -I../include/ >>> internal -I../include/internal/i386-apple-darwin8.10.1 -c i386- >>> apple- >>> darwin8.10.1/opt/hybrid/hipe_x86_bifs.S -o obj/i386-apple- >>> darwin8.10.1/opt/hybrid/hipe_x86_bifs.o >>> make[3]: *** No rule to make target `mach_override.h', needed by >>> `obj/ >>> i386-apple-darwin8.10.1/opt/hybrid/hipe_x86_signal.o'. Stop. >>> make[2]: *** [opt] Error 2 >>> make[1]: *** [hybrid] Error 2 >>> make: *** [emulator] Error 2 >>> >>> If I do the same without --enable-hipe it works, but the Erlang from >>> Darwinports has hipe and it works just fine (although it doesn't >>> have >>> SMP support, which is important to me), so I know hipe works with >>> OS X. >>> >>> I see that Darwinports actually ships with mach_override.h: >>> >>> % find /opt -name mach_override.h >>> /opt/local/var/db/dports/sources/ >>> rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files/ >>> mach_override.h >>> >>> I also see that Darwinports has some other files necessary for >>> Erlang: >>> >>> % ls /opt/local/var/db/dports/sources/ >>> rsync.rsync.darwinports.org_dpupdate_dports/lang/erlang/files >>> mach_override.c mach_override.h patch-toolbar.erl >>> >>> So is there a generalised OS X patchset that I'm missing? >> >> You just answered your own question. Use Darwinports (whatever >> that is). >> >> Support for HiPE on OSX/x86 in the vanilla OTP tarballs is only >> partial. >> It requires the mach_override stuff, and is totally unsupported since >> (1) it does weird things (mach_override), and (2) we (the HiPE group) >> don't have OSX/x86 machines. >> >> Just ask whoever's in charge of Erlang in Darwinports to enable SMP, >> or get the source code for their patched Erlang package and enable >> SMP yourself. It probably just needs ./configure --enable-smp- >> support. >> >> /Mikael >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From 0x6e6562@REDACTED Sun Jul 15 11:38:27 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Sun, 15 Jul 2007 10:38:27 +0100 Subject: [erlang-questions] prim_inet Message-ID: <269388e30707150238m35023117h35cfec5e914acd5a@mail.gmail.com> Hi, I've come accross the prim_inet module in some code and I'm trying to understand what it does as it doesn't seem to have a man page. Going by a few posts I've googled, it seems to handle socket connections in a non-blocking fashion and also seems to abstract UDP, TCP and SCTP to a common receiving/sending interface. Does anybody know of any documentation, examples or even a general explanation for prim_inet? Thanks, Ben From Bruce@REDACTED Sun Jul 15 12:13:46 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sun, 15 Jul 2007 22:13:46 +1200 Subject: [erlang-questions] ssl failed during the time shaking hands In-Reply-To: <4698A96B.8020502@Fitzsimons.org> References: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> <4698A96B.8020502@Fitzsimons.org> Message-ID: <4699F35A.2020705@Fitzsimons.org> Bruce Fitzsimons wrote: > Jeremy Chow wrote: > >> >> >> Apparently, there are still 142 bytes data stayed at the receive >> queue. The receiver terminal program hasnot take any data from that >> queue beacuse the right file descriptor has not been added yet. >> > All on gentoo linux x86, with R11B-5. > Right. I am closer to the problem, and now understand far too much about ssl, openssl, and the twisted brokerage to erlang. The problem appears to be that the server socket gets a connection which it transport_accepts immediately, and then erlang tells it to transport_accept again. I think. The other side times out. Certainly esock.c does not appear to reply to erlang when it is given a TRANSPORT_ACCEPT_CMD, which I think is odd. I'm rebuilding esock now with a hacked in reply. The erlang side certainly seems to expect a reply as it won't move on to the ssl_accept process without one. I've been testing with "openssl s_client" to the epmd listen port, and every time I connect it goes into the same state. Letting two erlang nodes talk to each other chewed up all available FDs after some time. Yurk. I've not had time to do a diff against previous versions, but something appears to have changed as I can't see how this ever works. I shall let the list know my results, but if anyone with knowledge of the erlang ssl code could give me some hints I'd appreciate it. There are quite a few layers of indirection...and the varargs usage was cute. Regards, Bruce Debug except below (note the lack of a write_cmd below the TRANSPORT_ACCEPT_CMD): --- cut here ----------------------------------- ACTIVE_LISTENING - trying to accept on 6 -> PASSIVE_LISTENING server accepted connection on fd 18 write_ctrl: len = 9 message (hex) : [ 00 00 00 09] [ 0c 00 00 00 06 00 00 00 12] message (char): [ . . . .] [ . . . . . . . . .] ==========LOOP============= MASKS SET FOR FD: CONNECTIONS: - TRANSPORT_ACCEPT [0x8156408] (fd = 18) - TRANSPORT_ACCEPT [0x8155e08] (fd = 17) - TRANSPORT_ACCEPT [0x8155808] (fd = 16) - TRANSPORT_ACCEPT [0x8155208] (fd = 15) - TRANSPORT_ACCEPT [0x8154c08] (fd = 14) - TRANSPORT_ACCEPT [0x8154608] (fd = 13) - TRANSPORT_ACCEPT [0x8154008] (fd = 12) - TRANSPORT_ACCEPT [0x8153a08] (fd = 11) - TRANSPORT_ACCEPT [0x8153408] (fd = 10) - TRANSPORT_ACCEPT [0x8152e08] (fd = 9) - TRANSPORT_ACCEPT [0x8152808] (fd = 8) - TRANSPORT_ACCEPT [0x8150ae0] (fd = 7) - PASSIVE_LISTENING [0x814fe08] (fd = 6) Before poll/select: 14 descriptors (total 18) ----------------------------------- read_ctrl: cc = 6 message (hex) : [ 0a 00 00 00 06 00] message (char): [ . . . . . .] [TRANSPORT_ACCEPT_CMD] listenfd = 6, flags = -> ACTIVE_LISTENING ==========LOOP============= MASKS SET FOR FD: 6 (read) CONNECTIONS: - TRANSPORT_ACCEPT [0x8156408] (fd = 18) - TRANSPORT_ACCEPT [0x8155e08] (fd = 17) - TRANSPORT_ACCEPT [0x8155808] (fd = 16) - TRANSPORT_ACCEPT [0x8155208] (fd = 15) - TRANSPORT_ACCEPT [0x8154c08] (fd = 14) - TRANSPORT_ACCEPT [0x8154608] (fd = 13) - TRANSPORT_ACCEPT [0x8154008] (fd = 12) - TRANSPORT_ACCEPT [0x8153a08] (fd = 11) - TRANSPORT_ACCEPT [0x8153408] (fd = 10) - TRANSPORT_ACCEPT [0x8152e08] (fd = 9) - TRANSPORT_ACCEPT [0x8152808] (fd = 8) - TRANSPORT_ACCEPT [0x8150ae0] (fd = 7) - ACTIVE_LISTENING [0x814fe08] (fd = 6, acceptors = 1) Before poll/select: 14 descriptors (total 18) --- cut here From Bruce@REDACTED Sun Jul 15 12:40:33 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sun, 15 Jul 2007 22:40:33 +1200 Subject: [erlang-questions] ssl failed during the time shaking hands In-Reply-To: <4699F35A.2020705@Fitzsimons.org> References: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> <4698A96B.8020502@Fitzsimons.org> <4699F35A.2020705@Fitzsimons.org> Message-ID: <4699F9A1.9030901@Fitzsimons.org> Bruce Fitzsimons wrote: > I've not had time to do a diff against previous versions, but something > appears to have changed as I can't see how this ever works. > Sorry list, I should know better than to say things like that, I can now see that the TRANSPORT_ACCEPT_REP is given, but the reply is lost for some reason. Turning debug on freezes erts (I've not looked at why) so I am still frustrated about why the state machine never progresses. /Bruce From kenneth.lundin@REDACTED Sun Jul 15 13:05:46 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sun, 15 Jul 2007 13:05:46 +0200 Subject: [erlang-questions] prim_inet In-Reply-To: <269388e30707150238m35023117h35cfec5e914acd5a@mail.gmail.com> References: <269388e30707150238m35023117h35cfec5e914acd5a@mail.gmail.com> Message-ID: Hi, prim_inet is not documented because it is not intended to be a supported/stable API which we will keep backwards compatible. prim_inet is only supposed to be used by modules such as gen_udp, gen_tcp, gen_sctp, inet etc. which are supported and documented API's. If important functionality is missing in the supported API's it should be added there and probably in a slightly different way than in prim_inet (but built on prim_inet). The general principle that we follow is that what's not documented is not supported and tested and might change, dissapear or whatever between releases. /Kenneth (Erlang/OTP team at Ericsson) On 7/15/07, Ben Hood <0x6e6562@REDACTED> wrote: > Hi, > > I've come accross the prim_inet module in some code and I'm trying to > understand what it does as it doesn't seem to have a man page. > > Going by a few posts I've googled, it seems to handle socket > connections in a non-blocking fashion and also seems to abstract UDP, > TCP and SCTP to a common receiving/sending interface. > > Does anybody know of any documentation, examples or even a general > explanation for prim_inet? > > Thanks, > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From Bruce@REDACTED Sun Jul 15 13:23:04 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sun, 15 Jul 2007 23:23:04 +1200 Subject: [erlang-questions] ssl failed during the time shaking hands - FIXED, patch attached In-Reply-To: <4699F9A1.9030901@Fitzsimons.org> References: <6cef17180707032239x6f0f133esb02abc151f281abd@mail.gmail.com> <6cef17180707042057x2d30310ex4618ac8b8d16bdaf@mail.gmail.com> <4698A96B.8020502@Fitzsimons.org> <4699F35A.2020705@Fitzsimons.org> <4699F9A1.9030901@Fitzsimons.org> Message-ID: <469A0398.4040109@Fitzsimons.org> Bruce Fitzsimons wrote: > Bruce Fitzsimons wrote: > >> I've not had time to do a diff against previous versions, but something >> appears to have changed as I can't see how this ever works. >> >> > Sorry list, I should know better than to say things like that, I can now > see that the TRANSPORT_ACCEPT_REP is given, but the reply is lost for > some reason. Problem resolved. ssl_prim.erl was passing an FD rather than an #sslsocket to ssl_broker:ssl_accept_prim golf src # diff ssl_prim.erl /tmp/ssl_prim.erl.patched 62d61 < ListenFd = ListenSocket#sslsocket.fd, 64c63 < ssl_server_prim, gen_tcp, self(), ListenFd, infinity, NewSt)). --- > ssl_server_prim, gen_tcp, self(), ListenSocket, infinity, NewSt)). Fixes it completely. This is in R11B-5. /Bruce From 0x6e6562@REDACTED Sun Jul 15 13:39:18 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Sun, 15 Jul 2007 12:39:18 +0100 Subject: [erlang-questions] prim_inet In-Reply-To: References: <269388e30707150238m35023117h35cfec5e914acd5a@mail.gmail.com> Message-ID: <269388e30707150439k6154bb0cpe81f9f72c9388bfe@mail.gmail.com> Hi, > prim_inet is not documented because it is not intended to be a > supported/stable API which we will keep backwards compatible. > prim_inet is only supposed to be used by modules such as gen_udp, > gen_tcp, gen_sctp, inet etc. which are supported and documented API's. Fair enough. > If important functionality is missing in the supported API's it should > be added there and probably in a slightly different way than in > prim_inet (but built on prim_inet). Is it possible though there is functionality prim_inet that is not exposed or consumed by the exported APIs (i.e. why would I find code that uses prim_inet directly)? Also, it is possible to summarize in a few lines what it does (just for interest's sake)? > The general principle that we follow is that what's not documented is > not supported and tested and might change, dissapear or whatever > between releases. Understood. Thanks, Ben From saleyn@REDACTED Sun Jul 15 15:23:28 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 15 Jul 2007 08:23:28 -0500 Subject: [erlang-questions] Trouble compiling erlang on OS X intel In-Reply-To: <4FB3DDD0-DAAA-4417-8892-568514F14B47@ketralnis.com> References: <200707142154.l6ELsaLC028194@harpo.it.uu.se> <46996D0C.1080106@munat.com> <4FB3DDD0-DAAA-4417-8892-568514F14B47@ketralnis.com> Message-ID: <469A1FD0.10607@gmail.com> David King wrote: > Is there a way to convince Erlang that "-smp enable" should be the > default once SMP support is included? Add it to the ERL_FLAGS environment variable before starting erl. Alternatively, copy erl script to erlsmp that would have that option set and use that script whenever needed to start erl with SMP support. Serge From joelr1@REDACTED Sun Jul 15 14:44:52 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sun, 15 Jul 2007 13:44:52 +0100 Subject: [erlang-questions] Maximum number of Mnesia nodes Message-ID: <5E938AAF-E6D6-4864-9D98-579C795BFE7F@gmail.com> Folks, How many Mnesia nodes are you running in your production installation? I'm looking to find the maximum here. I'm only dealing with ram_copies tables (cache), trying to figure out whether I can make every Yaws node a Mnesia node without slowing transactions down too much. My current thinking is to wait and gather statistics before trying to decouple Yaws and Mnesia . Still, I would love to know how much transactions slow down with the addition of every new Mnesia node. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From opendev@REDACTED Mon Jul 16 00:08:17 2007 From: opendev@REDACTED (Joern) Date: Mon, 16 Jul 2007 00:08:17 +0200 Subject: [erlang-questions] Reliable message passing / event management questions Message-ID: <9e009ad0707151508p6642020an58754a4d80cbe5c@mail.gmail.com> Dear erlang-questions, I am currently in the process of modelling an erlang application. This application concerns itself mainly with message routing - generic request (and answers to these) are send over a variety of unreliable carriers. As the carriers themselves decide wheater they will handle a message (or not - there are also carrier specific routing rules) the modelling of the router component as an event manager with persistence handling and carrier handling as supervised event handlers seemed natural. In order to guarantee that a generic message would get picked up by the persistence handler the API sync_notifies the attached event handlers. So far, so good. Now I have a bunch of questions / problems with this approach (obviously I am open for suggestions how to handle things differently): - How am I supposed to embed generic event handlers into a supervision tree? Implement a behaviour which adds the default handlers to the manager as part of it's initialization routine? - Is there any way for a event handler to signalize that a given event should not get further processed? I can think of a variety of workarounds but none seems attractive. - Are there any ideas how to handle individual message timeouts? Monitoring carriers from the carrier handlers and resending the (current) message if the carrier dies? Periodic polls to the persistence storage (mnesia)? - Is there maybe some hidden way to do this kind of reliable message transport over non-reliable carriers pattern hidden in the OTP which I am missing? Thanks for your consideration, rgs/joern -- From jcarrascal@REDACTED Mon Jul 16 01:39:18 2007 From: jcarrascal@REDACTED (=?UTF-8?Q?Julio_C=C3=A9sar_Carrascal_Urquijo_(MCTS)?=) Date: Sun, 15 Jul 2007 18:39:18 -0500 Subject: [erlang-questions] Working with dates. Message-ID: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> Hi, Two quick questions on functionality that I couldn't find on the documentation: 1) Are there functions in OTP to convert unix timestamp <--> the tuple format used in Erlang? 2) Are there functions for adding dates in this format? Thanks -- Julio C?sar Carrascal Urquijo Microsoft Certified Technology Specialist http://jcesar.3stecnoinformatica.com/ From erlangx@REDACTED Mon Jul 16 03:40:45 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 15 Jul 2007 18:40:45 -0700 Subject: [erlang-questions] Working with dates. In-Reply-To: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> References: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> Message-ID: <20070716014045.GT25952@delora.autosys.us> On Sun, Jul 15, 2007 at 06:39:18PM -0500, Julio C?sar Carrascal Urquijo (MCTS) wrote: > Hi, > > Two quick questions on functionality that I couldn't find on the documentation: > > 1) Are there functions in OTP to convert unix timestamp <--> the tuple > format used in Erlang? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (del@REDACTED)174> Seconds = os:cmd("../c/time"). "1184549721" (del@REDACTED)175> {Days, Time} = calendar:seconds_to_daystime( list_to_integer(Seconds) ). {13710,{1,35,21}} (del@REDACTED)176> Date = calendar:gregorian_days_to_date( Days ). {37,7,15} (del@REDACTED)177> calendar:datetime_to_gregorian_seconds( {Date, Time} ). 1184549721 (del@REDACTED)178> ~Michael > 2) Are there functions for adding dates in this format? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could add seconds and convert... ~Michael > > Thanks > > -- > Julio C?sar Carrascal Urquijo > Microsoft Certified Technology Specialist > http://jcesar.3stecnoinformatica.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,469ab05a73322052549877! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From erlangx@REDACTED Mon Jul 16 03:44:50 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 15 Jul 2007 18:44:50 -0700 Subject: [erlang-questions] Working with dates. In-Reply-To: <20070716014045.GT25952@delora.autosys.us> References: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> <20070716014045.GT25952@delora.autosys.us> Message-ID: <20070716014450.GW25952@delora.autosys.us> On Sun, Jul 15, 2007 at 06:40:45PM -0700, Michael McDaniel wrote: > > On Sun, Jul 15, 2007 at 06:39:18PM -0500, Julio C?sar Carrascal Urquijo (MCTS) wrote: > > Hi, > > > > Two quick questions on functionality that I couldn't find on the documentation: > > > > 1) Are there functions in OTP to convert unix timestamp <--> the tuple > > format used in Erlang? > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > (del@REDACTED)174> Seconds = os:cmd("../c/time"). > "1184549721" > (del@REDACTED)175> {Days, Time} = calendar:seconds_to_daystime( list_to_integer(Seconds) ). > {13710,{1,35,21}} > (del@REDACTED)176> Date = calendar:gregorian_days_to_date( Days ). > {37,7,15} ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ oops, 37 ? something's not right, obviously... ~M > (del@REDACTED)177> calendar:datetime_to_gregorian_seconds( {Date, Time} ). > 1184549721 > (del@REDACTED)178> > > ~Michael > > > 2) Are there functions for adding dates in this format? > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > could add seconds and convert... > > ~Michael > > > > > Thanks > > > > -- > > Julio C?sar Carrascal Urquijo > > Microsoft Certified Technology Specialist > > http://jcesar.3stecnoinformatica.com/ > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > +1 503 283 5284 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,469accd973329437730785! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From jeffm@REDACTED Mon Jul 16 04:08:25 2007 From: jeffm@REDACTED (jm) Date: Mon, 16 Jul 2007 12:08:25 +1000 Subject: [erlang-questions] Working with dates. In-Reply-To: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> References: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> Message-ID: <469AD319.2060308@ghostgun.com> Julio C?sar Carrascal Urquijo (MCTS) wrote: > Hi, > > Two quick questions on functionality that I couldn't find on the documentation: > > 1) Are there functions in OTP to convert unix timestamp <--> the tuple > format used in Erlang? Just to avoid confusion do you mean Mon Jul 16 12:04:31 EST 2007 or second since epoch? > 2) Are there functions for adding dates in this format? There's some stuff in calendar, erlang (module), and even timer, but I don't think it does exactly what your after. Jeff. From erlangx@REDACTED Mon Jul 16 04:07:34 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 15 Jul 2007 19:07:34 -0700 Subject: [erlang-questions] Working with dates. In-Reply-To: <20070716014450.GW25952@delora.autosys.us> References: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> <20070716014045.GT25952@delora.autosys.us> <20070716014450.GW25952@delora.autosys.us> Message-ID: <20070716020734.GX25952@delora.autosys.us> On Sun, Jul 15, 2007 at 06:44:50PM -0700, Michael McDaniel wrote: > On Sun, Jul 15, 2007 at 06:40:45PM -0700, Michael McDaniel wrote: > > > > On Sun, Jul 15, 2007 at 06:39:18PM -0500, Julio C?sar Carrascal Urquijo (MCTS) wrote: > > > Hi, > > > > > > Two quick questions on functionality that I couldn't find on the documentation: > > > > > > 1) Are there functions in OTP to convert unix timestamp <--> the tuple > > > format used in Erlang? > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > (del@REDACTED)174> Seconds = os:cmd("../c/time"). > > "1184549721" > > (del@REDACTED)175> {Days, Time} = calendar:seconds_to_daystime( list_to_integer(Seconds) ). > > {13710,{1,35,21}} > > (del@REDACTED)176> Date = calendar:gregorian_days_to_date( Days ). > > {37,7,15} > ^^^^^^^^^^^^^^ > ^^^^^^^^^^^^^^ > oops, 37 ? something's not right, obviously... > ~M ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Ok, because Unix time starts @1970 and Gregorian starts, apparently, at 0. Adding 1970+37 = 2007 but I wonder if there would be an "off by 1" somewhere down the road... ~M > > > (del@REDACTED)177> calendar:datetime_to_gregorian_seconds( {Date, Time} ). > > 1184549721 > > (del@REDACTED)178> > > > > ~Michael > > > > > 2) Are there functions for adding dates in this format? > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > could add seconds and convert... > > > > ~Michael > > > > > > > > Thanks > > > > > > -- > > > Julio C?sar Carrascal Urquijo > > > Microsoft Certified Technology Specialist > > > http://jcesar.3stecnoinformatica.com/ > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > > > > -- > > Michael McDaniel > > Portland, Oregon, USA > > http://autosys.us > > +1 503 283 5284 > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > -- > Michael McDaniel > Portland, Oregon, USA > http://autosys.us > +1 503 283 5284 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,469acda473321146342918! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From bbmaj7@REDACTED Mon Jul 16 06:05:12 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Mon, 16 Jul 2007 14:05:12 +1000 (EST) Subject: [erlang-questions] Reliable message passing / event management questions In-Reply-To: <9e009ad0707151508p6642020an58754a4d80cbe5c@mail.gmail.com> Message-ID: <10528.25499.qm@web52005.mail.re2.yahoo.com> --- Joern wrote: > Dear erlang-questions, > > I am currently in the process of modelling an erlang application. This > application concerns itself mainly with message routing - generic > request (and answers to these) are send over a variety of unreliable > carriers. > > As the carriers themselves decide wheater they will handle a message > (or not - there are also carrier specific routing rules) the modelling > of the router component as an event manager with persistence handling > and carrier handling as supervised event handlers seemed natural. OK I think I have a handle on this. So I restate what I think is the task: You are using a set of parallel comms channels to move a message from point A to point B. You don't care which route it takes provided it gets there by one of them, and when delivery is confirmed all the other channels can give up. It seems to me that one model would be as follows: For each message which is to be transported spawn an event transporter process, which in turn spawns a set of carrier processes (for each parallel comms channel), each carrier has the task of moving the same single message to the other end. Each carrier process exits after a timeout. The first carrier to report that the message was successfully delivered signals this to the transporter which then kills off all the children and reports up the tree that the message has been delivered. If all of the carriers are unsuccessful, then the transport process signals failure up the tree as it exits. -- Rich ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From 0x6e6562@REDACTED Mon Jul 16 08:24:14 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Mon, 16 Jul 2007 07:24:14 +0100 Subject: [erlang-questions] Working with dates. In-Reply-To: <269388e30707152323nc3d1982rc1bafc97cacdc1fa@mail.gmail.com> References: <7f3901c50707151639w3cfbea09rbb86c5205690611@mail.gmail.com> <269388e30707152323nc3d1982rc1bafc97cacdc1fa@mail.gmail.com> Message-ID: <269388e30707152324p72ff5c93n1174c93d1aed0c21@mail.gmail.com> -define(MegaSeconds, 1000000000). -define(Seconds, 1000). -define(MicroSeconds, 1000). -define(UnixEpoch, 62167219200). encode_timestamp({MegaSecs, Secs, MicroSecs}) -> MegaSecs * ?MegaSeconds + Secs * ?Seconds + MicroSecs / ?MicroSeconds. encode_localtime(DateTime={{Year,Month,Day},{Hour,Min,Sec}}) -> [Universal] = calendar:local_time_to_universal_time_dst(DateTime), Seconds = calendar:datetime_to_gregorian_seconds(Universal), (Seconds - ?UnixEpoch) * 1000. HTH, Ben > 1) Are there functions in OTP to convert unix timestamp <--> the tuple > format used in Erlang? From christopher@REDACTED Mon Jul 16 08:32:24 2007 From: christopher@REDACTED (Christopher Baus) Date: Sun, 15 Jul 2007 23:32:24 -0700 Subject: [erlang-questions] Performance of the append/reverse idiom Message-ID: <469B10F8.2030005@baus.net> Hi, I'm still going through Joe's book, but as a C/C++ hack, I can't help but have some reservations about performance. One common idiom is to append to the front of a list and then reverse the list when the append is complete. I assume this a O(n) operation. Is it common for reverse to be a bottleneck in many applications? Thanks, Chris From erlang@REDACTED Mon Jul 16 09:53:06 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 16 Jul 2007 09:53:06 +0200 Subject: [erlang-questions] Performance of the append/reverse idiom In-Reply-To: <469B10F8.2030005@baus.net> References: <469B10F8.2030005@baus.net> Message-ID: <9b08084c0707160053w3ddcc029wc73da0de6458ab94@mail.gmail.com> Is reverse a bottleneck? Very rarely. The are some *extremely* rare cases where people write code to handle both reversed and non-reverse lists (I think the library routines for sort remember if the current list being sorted is in normal or reversed order) but this is only useful when you're interested in making a tiny gain in efficiency (it also make the code a mess to read). The most common bottleneck are in the I/O system. Parsing inputs (in any language) is always a slow - other bottleneck are usually in the process structure - using a centralized server that serializes everything can make nasty bottlenecks. /Joe On 7/16/07, Christopher Baus wrote: > Hi, > > I'm still going through Joe's book, but as a C/C++ hack, I can't help > but have some reservations about performance. One common idiom is to > append to the front of a list and then reverse the list when the append > is complete. I assume this a O(n) operation. Is it common for reverse > to be a bottleneck in many applications? > > Thanks, > > Chris > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Mon Jul 16 09:57:03 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 16 Jul 2007 09:57:03 +0200 Subject: [erlang-questions] Erlang book now shipping Message-ID: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> The Erlang book has arrived at the publishers. The first batches of books to individual custormer will start shipping today. /Joe From erlang@REDACTED Mon Jul 16 10:35:49 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 16 Jul 2007 10:35:49 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> Message-ID: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> I have on occasion thought that it would be fun to implement Javascript. The idea of having lot's of little javascripts running in process and message parsing would be fun. The first step would be a simple interpretor - from that the compiler is easy :-) The difficulty of wring an interpretor seems mainly to do with getting an accurate parse tree of the js source into Erlang - the interpretor should be pretty easy. So now I wonder "how can I get a parse tree of some javascript" - Ideally there would be a javascript-parser-in-javascript that produced a JSON parse tree. If such a parser exists please tell me where to find it !! Failing this I guess the easiest approach is to take spidermonkey make the stand-alone version and fix the parser to dump the parse tree in some suitable format. Unfortunately I suspect that spidermonkey make C data structures suitable for compiling/interpreting rather than parse trees as such. The next alternative would be to find a yacc grammar for javascript and put this into yecc but I suspect this would be out-of-sync with real javascript. Failing that it's back to the ECMA-262 spec ( I suppose) and try to convert the grammar in the appendices to something sensible. In projects like this I always think that writing an accurate parser is the tricky bit. /Joe On 7/14/07, Joel Reymont wrote: > This is the reason I asked. > > Think scalable web development for the masses. > > In Javascript. > > On top of Erlang. > > On Jul 13, 2007, at 8:11 PM, denis wrote: > > > We are building an infrastructure allowing giving some services to our > > users. But external developers (same company, but other teams) > > could build > > their own custom services inside the infrastructure. Having these > > new users > > to learn a new language to build a custom services (which can be quite > > simple) can be badly perceived. > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dunceor@REDACTED Mon Jul 16 11:00:44 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Mon, 16 Jul 2007 11:00:44 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> Message-ID: <5d84cb30707160200n5903e733o6adc795f999bda73@mail.gmail.com> On 7/16/07, Joe Armstrong wrote: > The Erlang book has arrived at the publishers. > > The first batches of books to individual custormer will start shipping today. > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Cool, I have been waiting for the final version so I need to pick up one today. Congrats =) Br Karl From per@REDACTED Mon Jul 16 11:32:19 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 16 Jul 2007 11:32:19 +0200 (CEST) Subject: [erlang-questions] Working with dates. In-Reply-To: <20070716020734.GX25952@delora.autosys.us> Message-ID: <200707160932.l6G9WJ3p055487@pluto.hedeland.org> Michael McDaniel wrote: > >On Sun, Jul 15, 2007 at 06:44:50PM -0700, Michael McDaniel wrote: >> On Sun, Jul 15, 2007 at 06:40:45PM -0700, Michael McDaniel wrote: >> > >> > On Sun, Jul 15, 2007 at 06:39:18PM -0500, Julio C?sar Carrascal Urquijo (MCTS) wrote: >> > > Hi, >> > > >> > > Two quick questions on functionality that I couldn't find on the documentation: >> > > >> > > 1) Are there functions in OTP to convert unix timestamp <--> the tuple >> > > format used in Erlang? >> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > >> > (del@REDACTED)174> Seconds = os:cmd("../c/time"). >> > "1184549721" >> > (del@REDACTED)175> {Days, Time} = calendar:seconds_to_daystime( list_to_integer(Seconds) ). >> > {13710,{1,35,21}} >> > (del@REDACTED)176> Date = calendar:gregorian_days_to_date( Days ). >> > {37,7,15} >> ^^^^^^^^^^^^^^ >> ^^^^^^^^^^^^^^ >> oops, 37 ? something's not right, obviously... >> ~M >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Ok, because Unix time starts @1970 and Gregorian starts, apparently, at 0. > Adding 1970+37 = 2007 but I wonder if there would be an "off by 1" somewhere > down the road... Assuming that Julio meant what you think with "unix timestamp", i.e. the thing returned by the time() function, the way to go would be to first convert it to erlang:now() form: 1> T = 1184549721. 1184549721 2> Now = {T div 1000000, T rem 1000000, 0}. {1184,549721,0} And depending on what Julio meant with "the tuple format used in Erlang", that may be the answer.:-) Otherwise go on to use either 3> calendar:now_to_universal_time(Now). {{2007,7,16},{1,35,21}} or 4> calendar:now_to_local_time(Now). {{2007,7,16},{3,35,21}} - and then you can use whatever else you need from the calendar module. --Per Hedeland From ryanobjc@REDACTED Mon Jul 16 11:37:19 2007 From: ryanobjc@REDACTED (Ryan Rawson) Date: Mon, 16 Jul 2007 02:37:19 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: <78568af10707160237yfd516bev1df4fa084150c69a@mail.gmail.com> I've been working with JS and Rhino quite a bit lately. As I see it, there are 3 levels to making JS work: - Core language and semantics - Basic libraries (Array and the like) - DOM Rhino goes one step further and defines a so-called "LiveConnect" feature (which is part of the ECMA standard) that allows bridging to Java types. To get JS on Erlang, first is to define a similar feature to bridge to Erlang. Secondly, deal with some scary facts like there is only the 'Number' type in JS, and the language semantics makes it hard to introduce different number types. Be prepared to cry. All said and done, JS is a pretty powerful and cool language. Much better than Java! -ryan On 7/16/07, Joe Armstrong wrote: > I have on occasion thought that it would be fun to implement Javascript. > > The idea of having lot's of little javascripts running in process and > message parsing > would be fun. > > The first step would be a simple interpretor - from that the compiler > is easy :-) > > The difficulty of wring an interpretor seems mainly to do with getting > an accurate > parse tree of the js source into Erlang - the interpretor should be pretty easy. > > So now I wonder "how can I get a parse tree of some javascript" - Ideally > there would be a javascript-parser-in-javascript that produced a JSON > parse tree. > > If such a parser exists please tell me where to find it !! > > Failing this I guess the easiest approach is to take spidermonkey make > the stand-alone > version and fix the parser to dump the parse tree in some suitable > format. Unfortunately > I suspect that spidermonkey make C data structures suitable for > compiling/interpreting > rather than parse trees as such. > > The next alternative would be to find a yacc grammar for javascript > and put this into yecc > but I suspect this would be out-of-sync with real javascript. > > Failing that it's back to the ECMA-262 spec ( I suppose) and try to convert the > grammar in the appendices to something sensible. > > In projects like this I always think that writing an accurate parser > is the tricky bit. > > /Joe > > > > > On 7/14/07, Joel Reymont wrote: > > This is the reason I asked. > > > > Think scalable web development for the masses. > > > > In Javascript. > > > > On top of Erlang. > > > > On Jul 13, 2007, at 8:11 PM, denis wrote: > > > > > We are building an infrastructure allowing giving some services to our > > > users. But external developers (same company, but other teams) > > > could build > > > their own custom services inside the infrastructure. Having these > > > new users > > > to learn a new language to build a custom services (which can be quite > > > simple) can be badly perceived. > > > > -- > > http://topdog.cc - EasyLanguage to C# compiler > > http://wagerlabs.com - Blog > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From per@REDACTED Mon Jul 16 11:58:47 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 16 Jul 2007 11:58:47 +0200 (CEST) Subject: [erlang-questions] Working with dates. In-Reply-To: <269388e30707152324p72ff5c93n1174c93d1aed0c21@mail.gmail.com> Message-ID: <200707160958.l6G9wlpV055905@pluto.hedeland.org> "Ben Hood" <0x6e6562@REDACTED> wrote: > >-define(MegaSeconds, 1000000000). >-define(Seconds, 1000). >-define(MicroSeconds, 1000). Maybe those should rather be -define(MilliSecondsPerMegaSecond, 1000000000). -define(MilliSecondsPerSecond, 1000). -define(MicroSecondsPerMilliSecond, 1000). ?:-) >-define(UnixEpoch, 62167219200). (I.e. the value returned by calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}).) >encode_timestamp({MegaSecs, Secs, MicroSecs}) -> > MegaSecs * ?MegaSeconds + Secs * ?Seconds + MicroSecs / ?MicroSeconds. Well, this turns what is apparently an erlang:now() value into milliseconds as a floating-point number - I don't know of any Unix timestamps that are expressed as milliseconds, whether floating-point or integer... To get a time() timestamp, it would just be encode_timestamp({MegaSecs, Secs, _MicroSecs}) -> MegaSecs * 1000000 + Secs. (And if you want integer milliseconds, use 'div' instead of '/'.) >encode_localtime(DateTime={{Year,Month,Day},{Hour,Min,Sec}}) -> > [Universal] = calendar:local_time_to_universal_time_dst(DateTime), > Seconds = calendar:datetime_to_gregorian_seconds(Universal), > (Seconds - ?UnixEpoch) * 1000. This will be integer milliseconds - to get time() stamp, just drop the '* 1000'. --Per Hedeland From bob@REDACTED Mon Jul 16 14:36:44 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 16 Jul 2007 05:36:44 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: <6a36e7290707160536l4cfad379pdf593231dad54154@mail.gmail.com> On 7/16/07, Joe Armstrong wrote: > I have on occasion thought that it would be fun to implement Javascript. > > The idea of having lot's of little javascripts running in process and > message parsing > would be fun. > > The first step would be a simple interpretor - from that the compiler > is easy :-) > > The difficulty of wring an interpretor seems mainly to do with getting > an accurate > parse tree of the js source into Erlang - the interpretor should be pretty easy. > > So now I wonder "how can I get a parse tree of some javascript" - Ideally > there would be a javascript-parser-in-javascript that produced a JSON > parse tree. > > If such a parser exists please tell me where to find it !! Take a look at Narcissus: http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine) -bob From dmercer@REDACTED Mon Jul 16 16:40:22 2007 From: dmercer@REDACTED (David Mercer) Date: Mon, 16 Jul 2007 09:40:22 -0500 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP><32b96478b2e76de527050780d4bae17d@terzarima.net><004501c7c57a$a42c7f10$891ea8c0@SSI.CORP><349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com><44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: <000b01c7c7b7$3dfb4b10$891ea8c0@SSI.CORP> Joe Armstrong wrote: > The difficulty of wring an interpretor seems mainly to do with getting > an accurate > parse tree of the js source into Erlang - the interpretor should be pretty easy. So, for me, who is new to Erlang and thought about it on my drive home last Friday, is this the right approach to the implementation: have a separate process for each object and lexical environment. An object is then represented as a PID, and requests for properties and methods (which are basically the same in Javascript), would send a message to the process, which would return the appropriate value (which may also be an object/PID) or function. Nested lexical environments (e.g., with blocks, function blocks, and the global environment), therefore, can send forward a request to their higher level if the value is not found in their environment. Am I on the right track? Cheers, David From francesco@REDACTED Mon Jul 16 17:10:10 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 16 Jul 2007 16:10:10 +0100 Subject: [erlang-questions] The meaning of OTP... Message-ID: <469B8A52.10007@erlang-consulting.com> Or to T or not to T.. Sounds almost like a Monty Python film, but is something which has bugged me since 2000... OTP was chosen at a time when Open and Platform were buzzwords higher management loved and 4 years before Erlang was released as open source... There is a thread in the trapexit forum discussing the T in OTP. Should Telecom be renamed to something more neutral (Transaction as been suggested in some contexts) before Erlang hits exponential growth? It would be interesting to hear the opinion of some of the old E-dogs who have been around for some time, as the point of view of most newcomers is obvious (Even though they are just as welcome to chip in :-) ). It is now or never... The thread is at: http://www.trapexit.org/forum/viewtopic.php?t=8836 Francesco -- http://www.erlang-consulting.com From olivier.boudeville@REDACTED Mon Jul 16 18:16:11 2007 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Mon, 16 Jul 2007 18:16:11 +0200 Subject: [erlang-questions] Two little questions Message-ID: Hi, sorry if it's an obvious question, but how to specify to the erl interpreter which include directories should be scanned for *.hrl file when using 'c(my_module).' ? (a I tried with no luck '-code_path_cache' and '-pa'/'-pz' (I suppose both must be for precompiled modules (beam)), but I did not find header counterparts (I lack the C/C++ -I directive). Had to create a symlink instead. Another question : -ifdef/-endif clauses cannot be used inside functions apparently, instead they may be used around helper functions, but if a non-exported function just end up being defined as : """ f() -> ok. """ will calls to it (thus from the same module) be optimized away if they ignore its result ? Thanks in advance for any hint, best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau C-052 Office : 33 1 47 65 59 58 / Mobile : 33 6 16 83 37 22 / Fax : 33 1 47 65 34 24 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Lennart.Ohman@REDACTED Mon Jul 16 18:59:24 2007 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Mon, 16 Jul 2007 18:59:24 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469B8A52.10007@erlang-consulting.com> References: <469B8A52.10007@erlang-consulting.com> Message-ID: Hi, without even having read the thread :-) I think that one does not have to try to reinvent such acronyms. It is not uncommon that a company or "thing" becomes the acronym and what it really was a short for becomes irrelevant. CD (Compact Disc). It certainly still is a disc, but not very compact with todays standards. IBM (International Business Machines). I dont think anyone now days says that IBM is mainly a hardware company. Best Regards Lennart ------------------------------------------------------------------------------- Lennart ?hman phone: +46 8 587 623 27 Sj?land & Thyselius Telecom AB cell : +46 70 552 6735 H?lsingegatan 43, 10th floor fax : +46 8 667 8230 SE-113 31 STOCKHOLM, SWEDEN email: lennart.ohman@REDACTED -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Francesco Cesarini Sent: den 16 juli 2007 17:10 To: Erlang mailing list Subject: [erlang-questions] The meaning of OTP... Or to T or not to T.. Sounds almost like a Monty Python film, but is something which has bugged me since 2000... OTP was chosen at a time when Open and Platform were buzzwords higher management loved and 4 years before Erlang was released as open source... There is a thread in the trapexit forum discussing the T in OTP. Should Telecom be renamed to something more neutral (Transaction as been suggested in some contexts) before Erlang hits exponential growth? It would be interesting to hear the opinion of some of the old E-dogs who have been around for some time, as the point of view of most newcomers is obvious (Even though they are just as welcome to chip in :-) ). It is now or never... The thread is at: http://www.trapexit.org/forum/viewtopic.php?t=8836 Francesco -- http://www.erlang-consulting.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From lcastro@REDACTED Mon Jul 16 18:51:45 2007 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Mon, 16 Jul 2007 18:51:45 +0200 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP Message-ID: <200707161851.55933.lcastro@udc.es> Hello all, We have recently set up a web service using yaws soap capabilities. After the initial tests, we have now something that we could call a "working" web service with a not-so-funny behaviour. We have used both a Java client and SOAPUI (http://www.soapui.org/) to test it, and the funny behaviour proves to be client-independent and repeatable. The client calls one of the services of the web service, our handler is invoked, everything seems to be going smoothly but... then the process that should wait for the handler response dies with a "timeout". So even though everything works out fine as far as we are concerned, something is going on inside yaws that prevents the client to know what happened with its request. This is the error report we get (where 'ourwebservice' is our handler module): =ERROR REPORT==== 16-Jul-2007::18:25:47 === {yaws_rpc,162, {ourwebservice,handler, {'EXIT',{timeout, {gen_server, call, [yaws_soap_srv, {request, {ourwebserviceservice,handler}, "usernamepassword0102383372007-07-18T00:00+0200Descripcion", undefined, "\"urn:setParte\""}]}}}}} which is barely informative, since it just says there was a timeout for the yaws_soap_srv genserver and prints the request message. Has anybody faced something similar? Any clues what might be going on? Any hint or piece of information will be very much appreciated. Thanks in advance! -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From me@REDACTED Mon Jul 16 20:42:55 2007 From: me@REDACTED (KatolaZ) Date: Mon, 16 Jul 2007 20:42:55 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: <469B8A52.10007@erlang-consulting.com> Message-ID: <20070716184255.GG11545@katolaz.homeunix.net> On Mon, Jul 16, 2007 at 06:59:24PM +0200, Lennart ?hman wrote: > Hi, > without even having read the thread :-) I think that one does not have to try > to reinvent such acronyms. It is not uncommon that a company or "thing" becomes > the acronym and what it really was a short for becomes irrelevant. > > CD (Compact Disc). It certainly still is a disc, but not very compact with todays > standards. > IBM (International Business Machines). I dont think anyone now days says that IBM > is mainly a hardware company. > The matter is that OTP is not going to become as popular as CDs and IBM, ar at least it is not going to in the next ten years :-) I think that Francesco pointed out a serious issue. The risk of considering Erlang/OTP as a platform suitable only for "telecommunication" apps is over the corner, and can scare many programmers which could exploit Erlang capabilities in many other fields. The first time I told a friend that we were working on a robot driven by Erlang, he wispered "But Erlang is just for telecom! Why don't you use Lisp or Haskell. They would fit your task better...". And many many people think at Erlang that way, nowadays. HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From christopher@REDACTED Mon Jul 16 21:18:38 2007 From: christopher@REDACTED (Christopher Baus) Date: Mon, 16 Jul 2007 12:18:38 -0700 (PDT) Subject: [erlang-questions] Performance of the append/reverse idiom In-Reply-To: <9b08084c0707160053w3ddcc029wc73da0de6458ab94@mail.gmail.com> References: <469B10F8.2030005@baus.net> <9b08084c0707160053w3ddcc029wc73da0de6458ab94@mail.gmail.com> Message-ID: <57944.12.146.21.162.1184613518.squirrel@webmail.tuffmail.net> > The most common bottleneck are in the I/O system. Parsing inputs (in > any language) > is always a slow - other bottleneck are usually in the process > structure - using a centralized server that serializes everything can > make nasty bottlenecks. Joe, Thanks for your reply. I agree with you, but I can see why developers would pause when adding an additional O(n) operation to the end of a list accumulate operation when this could be handled at insertion time in a doubly linked list -- especially in CPU bound applications. I think a reasonable solution for most apps would be to manipulate the data in reversed order, unless reversing is required by an I/O operation. Chris From dvrsn@REDACTED Mon Jul 16 21:39:59 2007 From: dvrsn@REDACTED (Jeff Rogers) Date: Mon, 16 Jul 2007 12:39:59 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> Message-ID: <469BC98F.90503@diphi.com> Joel Reymont wrote: > This is the reason I asked. > > Think scalable web development for the masses. > > In Javascript. > > On top of Erlang. Not meaning to discourage any effort here - a JS implementation in erlang might be an interesting project and have some uses, and as others have pointed out implementing languages is fun - the goal of "... for the masses" is misguided. Syntax isn't the problem - if it was, we'd all be programming in COBOL. Sure, erlang syntax is a little different, but its the programming philosophy that is alot different, and putting a javascript face on that isn't going to make it any more accessible. Unless you're going to be able to accurately translate idiomatic javascript into idiomatic erlang you're going to have an erlang program that uses a single process with no message passing, no exception handling, no matching, etc., and then it really isn't erlang anymore. -J From joelr1@REDACTED Mon Jul 16 21:40:44 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 16 Jul 2007 20:40:44 +0100 Subject: [erlang-questions] Closures vs apply Message-ID: <57908DDB-DAC1-4AD2-AC32-5455FF5E0E0D@gmail.com> I have code that looks like this wrap(F) -> case catch F of {'EXIT', Error} -> {abort, Error}; Any -> Any end. db_put(Tab, Val) -> wrap(fun() -> s3:put_data(bucket(Tab), term_to_binary(element(2, Val)), "octet/stream", term_to_binary(Val), "") end). I wonder if db_put is better written as apply(s3, put_data, [args here]). Would this be more or less expensive than using a closure? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From bob@REDACTED Mon Jul 16 22:06:10 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 16 Jul 2007 13:06:10 -0700 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <469BC98F.90503@diphi.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <469BC98F.90503@diphi.com> Message-ID: <6a36e7290707161306o6f10e6d5rffe42115fda9e751@mail.gmail.com> On 7/16/07, Jeff Rogers wrote: > Joel Reymont wrote: > > This is the reason I asked. > > > > Think scalable web development for the masses. > > > > In Javascript. > > > > On top of Erlang. > > Not meaning to discourage any effort here - a JS implementation in > erlang might be an interesting project and have some uses, and as others > have pointed out implementing languages is fun - the goal of "... for > the masses" is misguided. Syntax isn't the problem - if it was, we'd > all be programming in COBOL. Sure, erlang syntax is a little different, > but its the programming philosophy that is alot different, and putting a > javascript face on that isn't going to make it any more accessible. > Unless you're going to be able to accurately translate idiomatic > javascript into idiomatic erlang you're going to have an erlang program > that uses a single process with no message passing, no exception > handling, no matching, etc., and then it really isn't erlang anymore. That argument only makes sense if you're talking about writing whole programs in JavaScript and then compiling them down to Erlang. Syntax is definitely a problem in certain contexts, and embedding a language in Erlang (one way or another) is an obvious solution to that. In the JavaScript case you're probably going to be having lots of little JS interpreters all over the place (e.g. one per HTTP request) so the imperative nature of how idiomatic JS works isn't really a big deal. They're all isolated from one another, and you've got plenty of them. -bob From joelr1@REDACTED Mon Jul 16 22:48:06 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 16 Jul 2007 21:48:06 +0100 Subject: [erlang-questions] Mnesia: aborting a transaction from within mnesia_lib:db_put (help!!!) Message-ID: <9D5F8023-441D-4CBA-9790-393EB7655D23@gmail.com> I extended mnesia_lib:db_put to look like this: db_put(ram_copies, Tab, Val) -> ?ets_insert(Tab, Val), ok; db_put(s3_copies, Tab, Val) -> s3db:db_put(Tab, Val); db_put(disc_copies, Tab, Val) -> ?ets_insert(Tab, Val), ok; db_put(disc_only_copies, Tab, Val) -> dets:insert(Tab, Val). Note the call to s3db:db_put. What do I return from this function to abort the enclosing Mnesia transaction? Whatever I return does not seem to make any effect. {aborted, ...} doesn't do it and erlang:error(...) doesn't do it either. Any clues? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From 0x6e6562@REDACTED Mon Jul 16 23:53:36 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Mon, 16 Jul 2007 22:53:36 +0100 Subject: [erlang-questions] Working with dates. In-Reply-To: <200707160958.l6G9wlpV055905@pluto.hedeland.org> References: <269388e30707152324p72ff5c93n1174c93d1aed0c21@mail.gmail.com> <200707160958.l6G9wlpV055905@pluto.hedeland.org> Message-ID: <269388e30707161453tc838ad7hd27febbe15c2e725@mail.gmail.com> > >-define(UnixEpoch, 62167219200). > > (I.e. the value returned by > calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}).) > > >encode_timestamp({MegaSecs, Secs, MicroSecs}) -> > > MegaSecs * ?MegaSeconds + Secs * ?Seconds + MicroSecs / ?MicroSeconds. > > Well, this turns what is apparently an erlang:now() value into > milliseconds as a floating-point number - I don't know of any Unix > timestamps that are expressed as milliseconds, whether floating-point or > integer... To get a time() timestamp, it would just be > > encode_timestamp({MegaSecs, Secs, _MicroSecs}) -> > MegaSecs * 1000000 + Secs. > > (And if you want integer milliseconds, use 'div' instead of '/'.) > > >encode_localtime(DateTime={{Year,Month,Day},{Hour,Min,Sec}}) -> > > [Universal] = calendar:local_time_to_universal_time_dst(DateTime), > > Seconds = calendar:datetime_to_gregorian_seconds(Universal), > > (Seconds - ?UnixEpoch) * 1000. > > This will be integer milliseconds - to get time() stamp, just drop the > '* 1000'. Fair point. It is rather conveluted. But at least I got some code reviewed.....;-) Thanks for your input, Ben From igwan@REDACTED Tue Jul 17 00:05:15 2007 From: igwan@REDACTED (igwan) Date: Tue, 17 Jul 2007 00:05:15 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <20070716184255.GG11545@katolaz.homeunix.net> References: <469B8A52.10007@erlang-consulting.com> <20070716184255.GG11545@katolaz.homeunix.net> Message-ID: <469BEB9B.3080806@free.fr> Hi, Well, I don't think people are going to stay away from a language because it has Telecom in its name. After all, the "Erlang" name in itself also carries the "Telecom" idea (if not the well-known unit used for telecom traffic, it's the Er = Ericsson = Telecom again in the mind of people), why not change the whole name then ? To the contrary, I think people have an idea of robustness and reliability when they think of telecoms (the good old and always working PSTN phone lines as opposed to the big unreliable internet :) and in the mind of programmers you can add fault-tolerance and distribution they 've been dreaming about all of their career :) Coming from the telecom industry my objectiveness may be flawed here :) , but IMAO, Erlang should not dismiss its telecom heritage, it's all but a turn-off. Explain people it's certainly not limitating the possible applications and show them what can be done ! I'm sure we're gonna have some killer apps as the best proofs soon. One doesn't have to explain the OTP acronym every where after all. It is a fantastic tool -and the only one for now- for structuring a complex application, it will never be too late to change the name when someone comes with a different/better framework. Just my two (euro)-cents igwan KatolaZ a ?crit : > On Mon, Jul 16, 2007 at 06:59:24PM +0200, Lennart ?hman wrote: > >> Hi, >> without even having read the thread :-) I think that one does not have to try >> to reinvent such acronyms. It is not uncommon that a company or "thing" becomes >> the acronym and what it really was a short for becomes irrelevant. >> >> CD (Compact Disc). It certainly still is a disc, but not very compact with todays >> standards. >> IBM (International Business Machines). I dont think anyone now days says that IBM >> is mainly a hardware company. >> >> > > The matter is that OTP is not going to become as popular as CDs and > IBM, ar at least it is not going to in the next ten years :-) > > I think that Francesco pointed out a serious issue. The risk of > considering Erlang/OTP as a platform suitable only for > "telecommunication" apps is over the corner, and can scare many > programmers which could exploit Erlang capabilities in many other > fields. > > The first time I told a friend that we were working on a robot driven > by Erlang, he wispered "But Erlang is just for telecom! Why don't you > use Lisp or Haskell. They would fit your task better...". And many > many people think at Erlang that way, nowadays. > > HND > > Enzo > > From dean@REDACTED Mon Jul 16 23:04:52 2007 From: dean@REDACTED (dean@REDACTED) Date: Mon, 16 Jul 2007 14:04:52 -0700 (PDT) Subject: [erlang-questions] "Error spawning .\epmd -daemon (error 0)" on Windows Message-ID: <14261.159.153.138.54.1184619892.squirrel@voidptr.com> I don't know what I did but in the process of trying to get distel going on my Windows XP box I broke something. When ever I run erl with a name argument to create a shared node I get the error response "Error spawning .\epmd -daemon (error 0)" and the process quits. I can run erl without -name or -sname without problem but of course I need the node behaviour :) Oh and currently running cean with erts-5.5.5. I've tried: - killing a epmd processes and starting over - cold reboot - hand running epmd and running erl/werl (with and without -no_epmd) I'm in the processing of setting up my box to compile cygwin to compile erl.exe to add more debugging to the Windows executable (the use of errno in "erlexec.c:919" is not enough it needs GetLastError() and FormatMessage()) but since that's going to take a little while I though I would parallelize and dispatch this message first. So I guess my question is, is there a log, PID file, pipe, or something that may have been lost to a dirty closed process? I've looked in the epmd source and can't find anything that sticks out. Thanks for the mental bandwith, Dean Giberson From igwan@REDACTED Tue Jul 17 00:13:09 2007 From: igwan@REDACTED (igwan) Date: Tue, 17 Jul 2007 00:13:09 +0200 Subject: [erlang-questions] Closures vs apply In-Reply-To: <57908DDB-DAC1-4AD2-AC32-5455FF5E0E0D@gmail.com> References: <57908DDB-DAC1-4AD2-AC32-5455FF5E0E0D@gmail.com> Message-ID: <469BED75.6040707@free.fr> Hi, From the Efficiency Guide http://www.erlang.org/doc/efficiency_guide/functions.html#3.2 : fun calls are about 3 times less expensive than apply(M,F,A) igwan Joel Reymont a ?crit : > I have code that looks like this > > wrap(F) -> > case catch F of > {'EXIT', Error} -> > {abort, Error}; > Any -> > Any > end. > > db_put(Tab, Val) -> > wrap(fun() -> s3:put_data(bucket(Tab), > term_to_binary(element(2, Val)), > "octet/stream", > term_to_binary(Val), > "") > end). > > I wonder if db_put is better written as apply(s3, put_data, [args > here]). > > Would this be more or less expensive than using a closure? > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dloutrein.lists@REDACTED Tue Jul 17 00:51:46 2007 From: dloutrein.lists@REDACTED (denis) Date: Mon, 16 Jul 2007 18:51:46 -0400 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: <001201c7c7fb$e3f9dbf0$b029030a@mtl.ubisoft.org> > The next alternative would be to find a yacc grammar for javascript > and put this into yecc > but I suspect this would be out-of-sync with real javascript. > > Failing that it's back to the ECMA-262 spec ( I suppose) and try to > convert the > grammar in the appendices to something sensible. I started some time ago to convert the LR(1) given on mozilla website (http://www.mozilla.org/js/language/grammar14.html) to a yeec one. I also use robert's leex module for the scanner. The problem is that my compiler courses are far away, so I resurrected my "red dragon" book to refresh my memory. I manage to parse a simple javascript file with a function declaration, and produce the AST tree for that. Okay, nothing really astonishing :-) I only roughly converted only a part of the grammar, and didn't managed the {normal, initial} and {allowIn, noIn} grammar arguments for now. I resolved one shift/reduce problem, but I'm not sure I did it the good way. That why I have to revise my lessons on grammar, It's more a patch than anything else. Denis From ulf.wiger@REDACTED Tue Jul 17 01:09:45 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 17 Jul 2007 01:09:45 +0200 Subject: [erlang-questions] Mnesia: aborting a transaction from withinmnesia_lib:db_put (help!!!) In-Reply-To: <9D5F8023-441D-4CBA-9790-393EB7655D23@gmail.com> References: <9D5F8023-441D-4CBA-9790-393EB7655D23@gmail.com> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155024DD98F@esealmw115.eemea.ericsson.se> You cannot abort a transaction from within these functions. The transaction has already been committed when they are called. The function is expected to work; if it fails, mnesia will dump core. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joel Reymont > Sent: den 16 juli 2007 22:48 > To: Erlang Questions > Subject: [erlang-questions] Mnesia: aborting a transaction > from withinmnesia_lib:db_put (help!!!) > > I extended mnesia_lib:db_put to look like this: > > db_put(ram_copies, Tab, Val) -> ?ets_insert(Tab, Val), ok; > db_put(s3_copies, Tab, Val) -> s3db:db_put(Tab, Val); > db_put(disc_copies, Tab, Val) -> ?ets_insert(Tab, Val), ok; > db_put(disc_only_copies, Tab, Val) -> dets:insert(Tab, Val). > > Note the call to s3db:db_put. > > What do I return from this function to abort the enclosing > Mnesia transaction? > > Whatever I return does not seem to make any effect. {aborted, > ...} doesn't do it and erlang:error(...) doesn't do it either. > > Any clues? > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Tue Jul 17 01:34:47 2007 From: ok@REDACTED (ok) Date: Tue, 17 Jul 2007 11:34:47 +1200 Subject: [erlang-questions] Performance of the append/reverse idiom In-Reply-To: <57944.12.146.21.162.1184613518.squirrel@webmail.tuffmail.net> References: <469B10F8.2030005@baus.net> <9b08084c0707160053w3ddcc029wc73da0de6458ab94@mail.gmail.com> <57944.12.146.21.162.1184613518.squirrel@webmail.tuffmail.net> Message-ID: On 17 Jul 2007, at 7:18 am, Christopher Baus wrote: > Thanks for your reply. I agree with you, but I can see why developers > would pause when adding an additional O(n) operation to the end of > a list > accumulate operation when this could be handled at insertion time in a > doubly linked list -- especially in CPU bound applications. I am having a little trouble understanding this. People are not willing to pay O(n) extra time to reverse a list, but *ARE* willing to pay O(n) extra time to maintain those Cthulhu-inspired backwards pointers? That doesn't make sense to me. > I think a reasonable solution for most apps would be to manipulate the > data in reversed order, unless reversing is required by an I/O > operation. You reverse when you need to reverse, obviously. It isn't always I/O operations that force a particular order. One solution is simply to use body recursion instead of tail recursion (which of course adds an O(n) overhead) or to use list comprehension (which is currently implemented using body recursion, so has an O(n) overhead). Really, the best thing to do is to write the clearest code you can so that you get it right and THEN PROFILE IT. In all programming languages, people usually start off worrying about the wrong things entirely when it comes to performance. From patrickdlogan@REDACTED Tue Jul 17 04:36:09 2007 From: patrickdlogan@REDACTED (Patrick D. Logan) Date: Mon, 16 Jul 2007 22:36:09 -0400 Subject: [erlang-questions] JavaScript compiler for Erlang Message-ID: <1184639769.5547@stardecisions.com> Douglas Crockford (original author of the JSON format) has a chapter in Beautiful Code (his chapter is online at http://javascript.crockford.com/tdop/tdop.html) which develops a simple Pratt parser for a reasonable subset of javascript. Crawford writes about javascript generally... "We don't have time in this short chapter to deal with the whole JavaScript language, and perhaps we wouldn't want to because the language is a mess. But it has some brilliant stuff in it that is well worth consideration. We will build a parser that can process Simplified JavaScript. We will write the parser in Simplified JavaScript. Simplified JavaScript is just the good stuff..." So perhaps a Pratt parser in Erlang would be useful, if one doesn't exist yet. And so developing a parser for Simplified Javascript would be a good starting point. Perhaps the implementation should stop at this subset, and so encourage it's widespread adoption just as Crawford stopped with the subset of Javascript data and called that "JSON"? From patrickdlogan@REDACTED Tue Jul 17 06:39:02 2007 From: patrickdlogan@REDACTED (Patrick D. Logan) Date: Tue, 17 Jul 2007 00:39:02 -0400 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: Message-ID: <1184647141.5769@stardecisions.com> > which develops a simple Pratt parser for a reasonable subset of javascript. BTW someone (Joel? Joe?) suggested using JSON as the parse tree might be helpful. The Pratt parser I just mentioned by Douglas Crawford parses Simplified Javascript into an almost-JSON parse tree. The difference is that the keys are symbols rather than strings. So it would be a trivial change to make the parse tree true JSON. Then a bootstrap would be fairly simple -- write the interpreter in Erlang to take the parse tree in JSON and execute it. Then writing a Pratt parser in Erlang would be unnecessary as Crawford's parser is itself written in Simplified Javascript. As long as the speed was acceptable. Of course the next step would be to write a translator from the JSON parse tree into Erlang, and there'd be a Simplified Javascript *compiler* for Erlang. From 0x6e6562@REDACTED Tue Jul 17 07:38:16 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Tue, 17 Jul 2007 06:38:16 +0100 Subject: [erlang-questions] Closures vs apply In-Reply-To: <469BED75.6040707@free.fr> References: <57908DDB-DAC1-4AD2-AC32-5455FF5E0E0D@gmail.com> <469BED75.6040707@free.fr> Message-ID: <269388e30707162238k7898b455p553b3de2b8eaffd3@mail.gmail.com> > From the Efficiency Guide > http://www.erlang.org/doc/efficiency_guide/functions.html#3.2 : > fun calls are about 3 times less expensive than apply(M,F,A) Interesting. Are there any descriptions or explainations about the internals of function invocation that explain where these differences arise from? Thx, Ben From erlang@REDACTED Tue Jul 17 09:20:47 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 17 Jul 2007 09:20:47 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <6a36e7290707160536l4cfad379pdf593231dad54154@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> <6a36e7290707160536l4cfad379pdf593231dad54154@mail.gmail.com> Message-ID: <9b08084c0707170020u2785c0e4l6b1b80f034524049@mail.gmail.com> Thanks - I found the narcissus code. Then I built the stand-alone version of spidermonkey - and tried to load the narcissus code into the stand-alone spidermoney and ... nothing happened. It just sat staring at me like an underfed cat and refused to purr. I read (well skimmed) the code for the javascript-in-javascript parser. This is neat code and not the kind of stuff you write after having read the first few chapters of the Dragon book. It's a mix of a lexer, a recursive descent parser and a operator precedence parser - all rolled together into a single file. Since it's a meta-interpreter I've no idea if the code is even correct and if it computes the same values as the embedded js interpreters. So the problem of a parser still remains - I suspect the easiest way is to make a library from spidermonkey and use the C parser, and hack this to dump the parse tree in a suitable form. Embedding spidermonkey in Erlang would have the added advantage of making any new js interpreter/compiler easy to test - just by running the same function in the real interpreter and in the Erlang version. /Joe On 7/16/07, Bob Ippolito wrote: > On 7/16/07, Joe Armstrong wrote: > > I have on occasion thought that it would be fun to implement Javascript. > > > > The idea of having lot's of little javascripts running in process and > > message parsing > > would be fun. > > > > The first step would be a simple interpretor - from that the compiler > > is easy :-) > > > > The difficulty of wring an interpretor seems mainly to do with getting > > an accurate > > parse tree of the js source into Erlang - the interpretor should be pretty easy. > > > > So now I wonder "how can I get a parse tree of some javascript" - Ideally > > there would be a javascript-parser-in-javascript that produced a JSON > > parse tree. > > > > If such a parser exists please tell me where to find it !! > > Take a look at Narcissus: > http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine) > > -bob > From ahmed.nawras@REDACTED Tue Jul 17 09:37:37 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 17 Jul 2007 11:37:37 +0400 Subject: [erlang-questions] (no subject) Message-ID: Hi all, I'm new to Erlang and trying to learn. I have the following notes/questions: 1) I didn't find any reference to http_uri module in erlang refernse documentation. I had to look into source code to understand what this module does. I found it while looking at erlsom source code. Just wanted to highlight this for the next release of the documentation :) 2) I'm trying to use yaws_soap_lib for calling some web service. when I call yaws_soap_lib:initModel(Url), I get the following error: exited: {{badmatch, {error, [{exception, {error, "Unexpected attribute (not namespace qualified): nillable"}}, I deleted all occurances of nillable="true" from the WSDL file and tried again and still get the following error: ** exited: {{badmatch, [{'wsdl:tTypes', [], undefined, [{schemaType, [], "http://util.java/xsd" .... Also, I tried the test function is yaws_soap_lib:qtest() and it failed. Any help/explenation is appreciated. Best regards, Ahmed Al-Issaei -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Jul 17 09:40:30 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 17 Jul 2007 09:40:30 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707170020u2785c0e4l6b1b80f034524049@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> <6a36e7290707160536l4cfad379pdf593231dad54154@mail.gmail.com> <9b08084c0707170020u2785c0e4l6b1b80f034524049@mail.gmail.com> Message-ID: <9b08084c0707170040v52cbe259lc719a5db874dbddf@mail.gmail.com> All little more digging revealed this to be a "Pratt parser" - I also found a simplified js parser at http://javascript.crockford.com/tdop/index.html. Things are looking up. Now I need to find a decent description of Pratt's parser. /Joe On 7/17/07, Joe Armstrong wrote: > Thanks - I found the narcissus code. > > Then I built the stand-alone version of spidermonkey - and tried to load the > narcissus code into the stand-alone spidermoney and ... nothing > happened. It just > sat staring at me like an underfed cat and refused to purr. > > I read (well skimmed) the code for the javascript-in-javascript parser. > > This is neat code and not the kind of stuff you write after having read the > first few chapters of the Dragon book. It's a mix of a lexer, a > recursive descent parser > and a operator precedence parser - all rolled together into a single file. > > Since it's a meta-interpreter I've no idea if the code is even correct > and if it computes > the same values as the embedded js interpreters. > > So the problem of a parser still remains - I suspect the easiest way > is to make a library from spidermonkey and use the C parser, and hack > this to dump the parse tree in > a suitable form. Embedding spidermonkey in Erlang would have the added > advantage of > making any new js interpreter/compiler easy to test - just by running > the same function in > the real interpreter and in the Erlang version. > > /Joe > > > > > On 7/16/07, Bob Ippolito wrote: > > On 7/16/07, Joe Armstrong wrote: > > > I have on occasion thought that it would be fun to implement Javascript. > > > > > > The idea of having lot's of little javascripts running in process and > > > message parsing > > > would be fun. > > > > > > The first step would be a simple interpretor - from that the compiler > > > is easy :-) > > > > > > The difficulty of wring an interpretor seems mainly to do with getting > > > an accurate > > > parse tree of the js source into Erlang - the interpretor should be pretty easy. > > > > > > So now I wonder "how can I get a parse tree of some javascript" - Ideally > > > there would be a javascript-parser-in-javascript that produced a JSON > > > parse tree. > > > > > > If such a parser exists please tell me where to find it !! > > > > Take a look at Narcissus: > > http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine) > > > > -bob > > > From w.a.de.jong@REDACTED Tue Jul 17 10:18:02 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 17 Jul 2007 10:18:02 +0200 Subject: [erlang-questions] (no subject) In-Reply-To: References: Message-ID: <407d9ef80707170118g6f203dafx9ba0006bb7ce86a3@mail.gmail.com> Hi, I could try to help you, but I would need to have some additional information. - Could you send me the WSDL? (the version with the 'nillable' still included, please) - Could you send me some additional info on the second error? When does it occur exactly? Could you send me the complete error message? - What error do you get when you try the 'qtest'? Regards, Willem On 7/17/07, Ahmed Ali wrote: > > Hi all, > > I'm new to Erlang and trying to learn. I have the following > notes/questions: > > 1) I didn't find any reference to http_uri module in erlang refernse > documentation. I had to look into source code to understand what this module > does. I found it while looking at erlsom source code. Just wanted to > highlight this for the next release of the documentation :) > > 2) I'm trying to use yaws_soap_lib for calling some web service. when I > call yaws_soap_lib:initModel(Url), I get the following error: > > exited: {{badmatch, > {error, > [{exception, > {error, > "Unexpected attribute (not namespace > qualified): nillable"}}, > > I deleted all occurances of nillable="true" from the WSDL file and tried > again and still get the following error: > > ** exited: {{badmatch, > [{'wsdl:tTypes', > [], > undefined, > [{schemaType, > [], > " http://util.java/xsd" .... > > Also, I tried the test function is yaws_soap_lib:qtest() and it failed. > Any help/explenation is appreciated. > > Best regards, > > Ahmed Al-Issaei > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Tue Jul 17 10:34:54 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 17 Jul 2007 09:34:54 +0100 Subject: [erlang-questions] Two little questions In-Reply-To: References: Message-ID: On 16/07/07, Olivier BOUDEVILLE wrote: > > Hi, > > sorry if it's an obvious question, but how to specify to the erl interpreter > which include directories should be scanned for *.hrl file when using > 'c(my_module).' ? (a I tried with no luck '-code_path_cache' and '-pa'/'-pz' > (I suppose both must be for precompiled modules (beam)), but I did not find > header counterparts (I lack the C/C++ -I directive). Had to create a symlink > instead. If you are using the -include directive: c(my_module, [{i, "../include1"}, {i, "../include2"}]). If you are using the -include_lib directive, as -include_lib("app1/include/some_file.hrl"). Then make sure that "app1/ebin" is in your code path. Chandru From ahmed.nawras@REDACTED Tue Jul 17 10:48:25 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Tue, 17 Jul 2007 12:48:25 +0400 Subject: [erlang-questions] (no subject) In-Reply-To: <407d9ef80707170118g6f203dafx9ba0006bb7ce86a3@mail.gmail.com> References: <407d9ef80707170118g6f203dafx9ba0006bb7ce86a3@mail.gmail.com> Message-ID: Hi Willem, This is probably one of the fastest replies I got in an internet forum. Thanks. You can find my reply below. On 7/17/07, Willem de Jong wrote: > > Hi, > > I could try to help you, but I would need to have some additional > information. > > - Could you send me the WSDL? (the version with the 'nillable' still > included, please) > I'll send you the WSDL file privately. - Could you send me some additional info on the second error? When does it > occur exactly? Could you send me the complete error message? > =ERROR REPORT==== 17-Jul-2007::12:20:23 === Error in process <0.52.0> with exit value: {{badmatch,{error,[{exception,{error,"Unexpected attribute (not namespace qualified): nillable"}},{stack,[sequenceType,extensionTypeC,complexContentType,globalComplexTypeType,schemaType,'wsdl:tTypes','wsdl:anyTopLevelOptionalElement'... ** exited: {{badmatch, {error, [{exception, {error, "Unexpected attribute (not namespace qualified): nillable"}}, {stack, [sequenceType, extensionTypeC, complexContentType, globalComplexTypeType, schemaType, 'wsdl:tTypes', 'wsdl:anyTopLevelOptionalElement', 'wsdl:tDefinitions']}, {received, {startElement, "http://www.w3.org/2001/XMLSchema", "element", "xs", [{attribute,"type","type",[],"xs:anyType"}, {attribute,"nillable","nillable",[],"true"}, {attribute,"name","name",[],"cause"}]}}]}}, [{yaws_soap_lib,initModel2,5}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** - What error do you get when you try the 'qtest'? > I got the following {error,{decoding,[{exception,{error,"unknown tag: HTML"}}, {stack,[undefined]}, {received,{startElement,[],"HTML",[],[]}}]}} Regards, > Willem > > On 7/17/07, Ahmed Ali wrote: > > > Hi all, > > > > I'm new to Erlang and trying to learn. I have the following > > notes/questions: > > > > 1) I didn't find any reference to http_uri module in erlang refernse > > documentation. I had to look into source code to understand what this module > > does. I found it while looking at erlsom source code. Just wanted to > > highlight this for the next release of the documentation :) > > > > 2) I'm trying to use yaws_soap_lib for calling some web service. when I > > call yaws_soap_lib:initModel(Url), I get the following error: > > > > exited: {{badmatch, > > {error, > > [{exception, > > {error, > > "Unexpected attribute (not namespace > > qualified): nillable"}}, > > > > I deleted all occurances of nillable="true" from the WSDL file and tried > > again and still get the following error: > > > > ** exited: {{badmatch, > > [{'wsdl:tTypes', > > [], > > undefined, > > [{schemaType, > > [], > > " http://util.java/xsd" .... > > > > Also, I tried the test function is yaws_soap_lib:qtest() and it failed. > > Any help/explenation is appreciated. > > > > Best regards, > > > > Ahmed Al-Issaei > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bruce@REDACTED Tue Jul 17 11:36:36 2007 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Tue, 17 Jul 2007 21:36:36 +1200 Subject: [erlang-questions] Dangerous typo of the month... Message-ID: <469C8DA4.3030607@Fitzsimons.org> undefiend While fixing inet_dist_ssl I found one of these (I think of no consequence, never tested), but there are a few more in the otp codebase, one of which looks significant. My last patch to ssl on R11B-5 was not complete, it only fixes half of the problem -- I'm building a new patch now. My only issue is that I'm not confident that I've left *normal* ssl untouched. Cheers, Bruce From lcastro@REDACTED Tue Jul 17 11:44:45 2007 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Tue, 17 Jul 2007 11:44:45 +0200 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP In-Reply-To: <407d9ef80707161147r14609533w6d10f7cef3733cf0@mail.gmail.com> References: <200707161851.55933.lcastro@udc.es> <407d9ef80707161147r14609533w6d10f7cef3733cf0@mail.gmail.com> Message-ID: <200707171144.50497.lcastro@udc.es> Hello Willem, hello list, > Can you give a little more background information? Of course. I should have in my email to the list, actually (sorry for that). > - Did you use the soap functionality that is packaged with YAWS? (as > described here: http://yaws.hyber.org/soap_intro.yaws) Yes, we are using yaws soap functionality (version is 1.68). And yes, what we did is essentially what is explained on the "The SOAP server side" section of that page. > - Do you use an WSDL? Could you send it to me (or to the list), so I could > do some tests? Yes, we do have an WSDL file. You can find it attached. > - Did you try to use the soap client that is provided with yaws? Does that > work? No, we didn't. Since we used our own client and also the SOAPUi client (and obtained the same results), we figured out that the problem shouldn't be involving the client. Do you think this is a possibility? If you do, where in the yaws distribution is that sample soap client located? We have also tried to increment the gen_server timeout, but there was no improvement. Even though the process seems to die due to a timeout (as the error message claims), the death is just inmediate, as if it were just receiving the client call, invoking our handler module and then crashing right after that. By the way, we had exactly the same problem that Ahmed Ali referred to, with the "nillable" property of the service parameters, but after we removed them (and also an "attributeFormDefault="qualified"" from the wsdl:definitions header) that problem dissapeared in our case (I am attaching the original WSDL file, too). Thank you very much for your time. Regards, -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html -------------- next part -------------- -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From joelr1@REDACTED Tue Jul 17 11:31:58 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 17 Jul 2007 10:31:58 +0100 Subject: [erlang-questions] Forcing Erlang to dump core Message-ID: <3AAAC7DA-7799-44D8-8B4B-A1D4C0CFCEB0@gmail.com> Is there a way to make the Erlang VM dump core? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From rvg@REDACTED Tue Jul 17 12:16:14 2007 From: rvg@REDACTED (Rudolph van Graan) Date: Tue, 17 Jul 2007 12:16:14 +0200 Subject: [erlang-questions] Forcing Erlang to dump core In-Reply-To: <3AAAC7DA-7799-44D8-8B4B-A1D4C0CFCEB0@gmail.com> References: <3AAAC7DA-7799-44D8-8B4B-A1D4C0CFCEB0@gmail.com> Message-ID: <8D3F3A5B-A1A6-4064-9675-2BB9A7770678@patternmatched.com> 3> erlang:halt("reason"). Crash dump was written to: erl_crash.dump reason Rudolph van Graan On Jul 17, 2007, at 11:31 AM, Joel Reymont wrote: > Is there a way to make the Erlang VM dump core? > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From joelr1@REDACTED Tue Jul 17 13:29:11 2007 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 17 Jul 2007 12:29:11 +0100 Subject: [erlang-questions] Mnesia: Replicating tables to nodes that do not participate in transactions Message-ID: Folks, Is there a way to make sure a given set of nodes receives table updates but _does not_ participate in transactions? Basically, is there a way to specify that a certain set of nodes is read-only and another is read-write? I'm asking because I would like to have all Yaws nodes in a web cluster to run Mnesia and host a read-only ram_copies cache table. At the same time, I would like to use just a few of these nodes to write to the cache to keep transaction times down. Any suggestions? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From csanto@REDACTED Tue Jul 17 13:46:32 2007 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 17 Jul 2007 13:46:32 +0200 Subject: [erlang-questions] Erlang and artificial intelligence: new article on trapexit Message-ID: <469CAC18.7000600@diit.unict.it> Hi all, Francesca Gangemi and myself started a section on trapexit of articles on Erlang and artificial intelligence; in particular they will cover the use of the ERESYE tool, developed by us, for AI applications. See: http://www.trapexit.org/index.php/Artificial_Intelligence_with_Erlang:_the_Domain_of_Relatives Comments are welcome. All the best, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From Mike.French@REDACTED Tue Jul 17 16:40:08 2007 From: Mike.French@REDACTED (French, Mike) Date: Tue, 17 Jul 2007 15:40:08 +0100 Subject: [erlang-questions] Erlang and artificial intelligence: new ar ticle on trapexit Message-ID: Interesting - you should link to your slides: http://www.erlang-consulting.com/erlangworkshop05/eresye.pdf How does your system perform ? Have you run any standard benchmarks ? How does your system scale to large knowledge base and/or large rule sets ? What possibility is there for fine-grain concurrency in a RETE system ? How could you stream facts into the server in non-Erlang format (XML) ? How could you load and update rules at runtime from non-Erlang format (XML) ? i.e. interpret rules, or on-the-fly compilation and loading of rules. Queries are a bit like dynamic rules, where the results are not asserted to the knowledge base but streamed back to the client. So having a dynamic rule compilation system would support optimized streaming queries, including event correlation and temporal pattern matching. Is your system still under active development ? e.g. in your presentation you mention adding negation What is the software license ? Thanks, Mik P.S. Good discussion of the Java Drools rule engine design, implementation and benchmarking here: http://labs.jboss.com/file-access/default/members/jbossrules/freezone/docs/3 .0.6/html/bk01-toc.html -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED]On Behalf Of Corrado Santoro Sent: 17 July 2007 12:47 To: Erlang Users' List Subject: [erlang-questions] Erlang and artificial intelligence: new article on trapexit Hi all, Francesca Gangemi and myself started a section on trapexit of articles on Erlang and artificial intelligence; in particular they will cover the use of the ERESYE tool, developed by us, for AI applications. See: http://www.trapexit.org/index.php/Artificial_Intelligence_with_Erlang:_the_D omain_of_Relatives Comments are welcome. All the best, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail is confidential. It may also be legally privileged. It is intended only for the stated addressee(s) and access to it by any other person is unauthorised. If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. Such unauthorised use may be unlawful. We may monitor all e-mail communications through our networks. If you have received this e-mail in error, please inform us immediately on +44 (0) 1749 672081 and delete it and all copies from your system. We accept no responsibility for changes to any e-mail which occur after it has been sent. Attachments to this e-mail may contain software viruses which could damage your system. We therefore recommend you virus-check all attachments before opening. A business of Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No. 868273 From lcoquelle@REDACTED Tue Jul 17 16:43:25 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Tue, 17 Jul 2007 22:43:25 +0800 Subject: [erlang-questions] Erlang and artificial intelligence: new article on trapexit In-Reply-To: <469CAC18.7000600@diit.unict.it> References: <469CAC18.7000600@diit.unict.it> Message-ID: That's really great! I have yet to read the ref you gave, but could you quickly explain what's the main difference with an inference engine like prolog? (or erlang implementation erlog). I'm hoping your inference engine can use the concurrency :) Thanks On 7/17/07, Corrado Santoro wrote: > > Hi all, > > Francesca Gangemi and myself started a section on trapexit of articles > on Erlang and artificial intelligence; in particular they will cover the > use of the ERESYE tool, developed by us, for AI applications. > > See: > > > http://www.trapexit.org/index.php/Artificial_Intelligence_with_Erlang:_the_Domain_of_Relatives > > Comments are welcome. > > All the best, > --Corrado > > -- > ================================================================== > Eng. Corrado Santoro, Ph.D. > University of Catania - ITALY - Engineering Faculty > > Tel: +39 095 7382380 VoIP: sip:7035@REDACTED > > Personal Home Page: http://www.diit.unict.it/users/csanto > NUXI Home Page: http://nuxi.diit.unict.it > ================================================================== > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Tue Jul 17 17:38:35 2007 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 17 Jul 2007 17:38:35 +0200 Subject: [erlang-questions] Erlang and artificial intelligence: new article on trapexit In-Reply-To: References: Message-ID: <469CE27B.7000108@diit.unict.it> Hi Mike, what a long list of questions!! .... :) French, Mike wrote: > Interesting - you should link to your slides: Done :) > How does your system perform ? Have you run any standard benchmarks ? > How does your system scale to large knowledge base and/or large rule sets ? Currently, ERESYE implements the basic RETE algorithm, with no particular optimizations. We are going to perform a set of benchmarks to evaluate performances and scalability. As a preliminary result, I can say that the "sieve" algorithm performs by executing approax 200 rules/second. > What possibility is there for fine-grain concurrency in a RETE system ? AFAIK, concurrency in RETE is hard and active rules are executed sequentially: the basic problem is that if you have rules A and B waiting for execution, the code in A could invalidate B that has to be no more executed; if you run A and B in parallel, you cannot control such a situation. But as far as I remember, there should be some papers on parallelising RETE. Francesca maybe remembers some of them?? > How could you stream facts into the server in non-Erlang format (XML) ? Well... decide a DTD, parse your XML file using xmerl, generate tuples and populate your ERESYE KB. > How could you load and update rules at runtime from non-Erlang format (XML) > ? > i.e. interpret rules, or on-the-fly compilation and loading of rules. See below. But you need a language to express the action to be done. Indeed the code of a rule can contain not only statements to assert or retract a fact, but also standard pieces of Erlang code. > Queries are a bit like dynamic rules, where the results are not asserted to > the knowledge base but streamed back to the client. Queries are not dynamic rules: in current implementation, the overall KB is filtered using the given template. > So having a dynamic rule > compilation system would support optimized streaming queries, > including event correlation and temporal pattern matching. But ERESYE supports dynamic rules, even if there isn't an explicit API. Function "wait_and_retract" waits for the assertion of a fact with a given template and atomically retracts it. Such a functionality is achieved by dynamically adding a rule and then removing it. > Is your system still under active development ? Yes, even if not at a constant rate. > e.g. in your presentation you mention adding negation Negation is supported in ERESYE; the issue is that the syntax is not so elegant. > What is the software license ? We release it with GPLv3. > P.S. Good discussion of the Java Drools rule engine > design, implementation and benchmarking here: Thank you very much!!! All the best, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From dmercer@REDACTED Tue Jul 17 16:46:32 2007 From: dmercer@REDACTED (David Mercer) Date: Tue, 17 Jul 2007 09:46:32 -0500 Subject: [erlang-questions] JavaScript compiler for Erlang References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP><32b96478b2e76de527050780d4bae17d@terzarima.net><004501c7c57a$a42c7f10$891ea8c0@SSI.CORP><349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com><44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: <004901c7c881$44c4e800$891ea8c0@SSI.CORP> Also, how would you handle garbage collection of the Javascript objects? DBM -----Original Message----- From: David Mercer [mailto:dmercer@REDACTED] Sent: Monday, July 16, 2007 09:40 To: 'erlang-questions@REDACTED' Subject: RE: [erlang-questions] JavaScript compiler for Erlang Joe Armstrong wrote: > The difficulty of wring an interpretor seems mainly to do with getting > an accurate > parse tree of the js source into Erlang - the interpretor should be pretty easy. So, for me, who is new to Erlang and thought about it on my drive home last Friday, is this the right approach to the implementation: have a separate process for each object and lexical environment. An object is then represented as a PID, and requests for properties and methods (which are basically the same in Javascript), would send a message to the process, which would return the appropriate value (which may also be an object/PID) or function. Nested lexical environments (e.g., with blocks, function blocks, and the global environment), therefore, can send forward a request to their higher level if the value is not found in their environment. Am I on the right track? Cheers, David From Marc.Vanwoerkom@REDACTED Tue Jul 17 18:55:16 2007 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Tue, 17 Jul 2007 18:55:16 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP> <32b96478b2e76de527050780d4bae17d@terzarima.net> <004501c7c57a$a42c7f10$891ea8c0@SSI.CORP> <349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com> <44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> Message-ID: Am Mon, 16 Jul 2007 10:35:49 +0200 hat "Joe Armstrong" geschrieben: > I have on occasion thought that it would be fun to >implement Javascript. You should be aware of http://lambda-the-ultimate.org/node/1784 Specifying ECMAScript via ML (Sorry, if somebody posted this already) Regards, Marc > > The idea of having lot's of little javascripts running >in process and > message parsing > would be fun. > > The first step would be a simple interpretor - from that >the compiler > is easy :-) > > The difficulty of wring an interpretor seems mainly to >do with getting > an accurate > parse tree of the js source into Erlang - the >interpretor should be pretty easy. > > So now I wonder "how can I get a parse tree of some >javascript" - Ideally > there would be a javascript-parser-in-javascript that >produced a JSON > parse tree. > > If such a parser exists please tell me where to find it >!! > >Failing this I guess the easiest approach is to take >spidermonkey make > the stand-alone > version and fix the parser to dump the parse tree in >some suitable > format. Unfortunately > I suspect that spidermonkey make C data structures >suitable for > compiling/interpreting > rather than parse trees as such. > > The next alternative would be to find a yacc grammar for >javascript > and put this into yecc > but I suspect this would be out-of-sync with real >javascript. > >Failing that it's back to the ECMA-262 spec ( I suppose) >and try to convert the > grammar in the appendices to something sensible. > > In projects like this I always think that writing an >accurate parser > is the tricky bit. > > /Joe > > > > > On 7/14/07, Joel Reymont wrote: >> This is the reason I asked. >> >> Think scalable web development for the masses. >> >> In Javascript. >> >> On top of Erlang. >> >> On Jul 13, 2007, at 8:11 PM, denis wrote: >> >> > We are building an infrastructure allowing giving some >>services to our >> > users. But external developers (same company, but >>other teams) >> > could build >> > their own custom services inside the infrastructure. >>Having these >> > new users >> > to learn a new language to build a custom services >>(which can be quite >> > simple) can be badly perceived. >> >> -- >> http://topdog.cc - EasyLanguage to C# compiler >> http://wagerlabs.com - Blog >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From psa@REDACTED Tue Jul 17 19:33:15 2007 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Tue, 17 Jul 2007 18:33:15 +0100 Subject: [erlang-questions] Input too fast, shootout and very weird behaviour with binaries In-Reply-To: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> Message-ID: <469CFD5B.7080803@di.uminho.pt> Hi all. Inspired by the discussion some time ago about using a line-oriented port getting data from stdin, I wrote a program for the language shootout's reverse complement. The first version, which I intend to submit, uses lists for input, and manages to finish (in my laptop) in 12 seconds, after using about 600MB of memory. Memory consumption was increasing very fast, but the input file was not too large and the program did ok. Then I wrote a version using binaries, thinking it would be better, and a very weird thing happened. Memory comsumption stayed very low, about 80MB, but it took almost 53 MINUTES to finish, always maxing CPU usage. The result was correct, as for the first version. Doing time erl -noinput -run revcomp main 1 < ../input-2500000 > ../o resulted, for the first version: real 0m12.179s user 0m9.557s sys 0m2.160s and for the second: real 52m44.740s user 51m51.432s sys 0m3.741s This is very weird and I cannot imagine what the erlang VM might be doing. It does not make sense and there must be some kind of bug either in the emulator or the code generated by HIPE. If someone has time to spare and wants to play around, I attach both versions here. Regards, Paulo Almeida -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: revcomp.erl-v1 URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: revcomp.erl-v2 URL: From w.a.de.jong@REDACTED Tue Jul 17 19:59:27 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 17 Jul 2007 19:59:27 +0200 Subject: [erlang-questions] (no subject) In-Reply-To: References: Message-ID: <407d9ef80707171059y8ea83dwe4905ecf3ed6525f@mail.gmail.com> Hi, I put some answers in between your questions. Good luck, Willem On 7/17/07, Ahmed Ali wrote: > > Hi all, > > I'm new to Erlang and trying to learn. I have the following > notes/questions: > > 1) I didn't find any reference to http_uri module in erlang refernse > documentation. I had to look into source code to understand what this module > does. I found it while looking at erlsom source code. Just wanted to > highlight this for the next release of the documentation :) > > 2) I'm trying to use yaws_soap_lib for calling some web service. when I > call yaws_soap_lib:initModel(Url), I get the following error: > > exited: {{badmatch, > {error, > [{exception, > {error, > "Unexpected attribute (not namespace > qualified): nillable"}}, Hm, I'll have to include support for "nillable" in erlsom. I have to confess that I was not aware of this limitation. It shouldn't be too add, I'll try to put it into a new release in the near future. I deleted all occurances of nillable="true" from the WSDL file and tried > again and still get the following error: > > ** exited: {{badmatch, > [{'wsdl:tTypes', > [], > undefined, > [{schemaType, > [], > " http://util.java/xsd" .... I looked at the WSDL you sent me, and I noticed that it contains a number of elements. I suppose that this is perfectly legal, but I never considered it. I'll try to fix this in a next release. In the mean time, you could try to reduce the number of elements to 1, using to include the additional schema's into this 1 remaining schema. This should work (I didn't try it...), and the effect should be the same. Also, I tried the test function is yaws_soap_lib:qtest() and it failed. Any > help/explenation is appreciated. I'm sorry, but I was not able to reproduce the error you sent me. I did find another error, related to the use of ibrowse. This can be fixed by commenting out lines 273-275 in the file yaws_soap_lib.erl. Best regards, > > Ahmed Al-Issaei > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From goryachev@REDACTED Tue Jul 17 21:03:51 2007 From: goryachev@REDACTED (Igor Goryachev) Date: Tue, 17 Jul 2007 23:03:51 +0400 Subject: [erlang-questions] http-client and Transfer-Encoding: Chunked header Message-ID: <87ir8ilunc.fsf@yandex-team.ru> Hello. Erlang's http-client fails with unknown_encoding error when it gets "Transfer-Encoding: Chunked" (value "Chunked" is with capital letter "C") header from httpd-server response: goryachev@REDACTED:~% erl Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) 1> http:request(get, {"http://falcon/public/state.xml", []}, [], []). =INFO REPORT==== 17-Jul-2007::22:52:49 === The inets application was not started. Has now been started as a temporary application. {error,unknown_encoding} 2> Is there a bug in http-client (which handles only "chunked") or in a server which responses with a wierd header value? -- Igor Goryachev Yandex development team. From daniel.goertzen@REDACTED Tue Jul 17 21:04:38 2007 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Tue, 17 Jul 2007 14:04:38 -0500 Subject: [erlang-questions] Is function clause selection O(n)? Message-ID: I am considering the design of a filtering function that will prevent some function calls and allow others. For example, such a function might look like this: filter(M,F,Args) -> apply(M,F,Args). Of course the above does no actual filtering, but for the use I'm envisioning there will be dozens or even hundreds of clauses for the filter function. So, I am wondering what the algorithmic complexity of runtime clause selection is. O(n)? O(log n)? O(1)? I've also considered an ets table lookup for this, but it does the opposite of what I want. With ets you can specify a pattern to match against a set of values, but I need a value to match against a list of patterns. Any other ideas? Thanks, Dan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From csanto@REDACTED Tue Jul 17 21:32:43 2007 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 17 Jul 2007 21:32:43 +0200 Subject: [erlang-questions] Erlang and artificial intelligence: new article on trapexit In-Reply-To: References: <469CAC18.7000600@diit.unict.it> Message-ID: <469D195B.7020300@diit.unict.it> Hi Ludovic, Ludovic Coquelle wrote: > I have yet to read the ref you gave, but could you quickly explain > what's the main difference with an inference engine like prolog? (or > erlang implementation erlog > ). AFAIK, in Prolog you don't have an explicit knowledge base; you write your initial facts and your rules by means of "implications". When you issue a query, the implications are processed using backtracing and the derived knowledge is obtained (returned, not stored in any place). Conversely, in a rule production system, rules are processed not during queries but each time you assert or retract a fact. So you have a knowledge base which explicitly contains (and stores) all your knowledge, basic and derived. Therefore, querying does not imply rule processing but only "taking a look" at the KB. > I'm hoping your inference engine can use the concurrency :) See my answer to Mike French on this issue. All the best, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From w.a.de.jong@REDACTED Tue Jul 17 21:45:47 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 17 Jul 2007 21:45:47 +0200 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP In-Reply-To: <200707171144.50497.lcastro@udc.es> References: <200707161851.55933.lcastro@udc.es> <407d9ef80707161147r14609533w6d10f7cef3733cf0@mail.gmail.com> <200707171144.50497.lcastro@udc.es> Message-ID: <407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> Hi Laura, I haven't been able to solve your problem, sorry. I created a very simple server and client that use your WSDL, and it works. I am copying them below. One thing that may be the cause of the problem is that one important statement is still missing in the documentation: you have to actually start the server... "yaws:start_embedded(Docroot, SL,GL)", assuming that Docroot, GL and SL have the right values, see http://yaws.hyber.org/soap_intro.yaws. However, from your error message I don't get the impression that this is your problem. Good luck, Willem A minimal server: -module(my_soap). -export([handler/4]). -record('p:CodigoVO', {anyAttribs, 'etiqueta', 'valor'}). -record('p:setParte', {anyAttribs, 'param0', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6'}). -record('p:setParteResponse', {anyAttribs, 'return'}). handler(_Header, [#'p:setParte'{'param0' = P0}], _Action, _SessionValue) -> {ok, undefined, setParte(P0)}. setParte(P0) -> CodigoVO = #'p:CodigoVO'{'etiqueta' = P0, 'valor' = 1}, #'p:setParteResponse'{'return' = CodigoVO}. A minimal client: -module(client). -export([run/1]). -record('p:CodigoVO', {anyAttribs, 'etiqueta', 'valor'}). -record('p:setParte', {anyAttribs, 'param0', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6'}). -record('p:setParteResponse', {anyAttribs, 'return'}). run(P0) -> Wsdl = yaws_soap_lib:initModel("file://Service.wsdl "), Request = #'p:setParte'{'param0' = P0, 'param1' = "P1", 'param2' = "P2", 'param3' = "P3", 'param4' = "P4", 'param5' = "P5", 'param6' = "P6"}, yaws_soap_lib:call(Wsdl, "setParte", [], [Request]). On 7/17/07, Laura M. Castro Souto wrote: > > > Hello Willem, hello list, > > > Can you give a little more background information? > > Of course. I should have in my email to the list, actually (sorry > for that). > > > - Did you use the soap functionality that is packaged with YAWS? (as > > described here: http://yaws.hyber.org/soap_intro.yaws) > > Yes, we are using yaws soap functionality (version is 1.68). And > yes, what we > did is essentially what is explained on the "The SOAP server side" section > of > that page. > > > - Do you use an WSDL? Could you send it to me (or to the list), so I > could > > do some tests? > > Yes, we do have an WSDL file. You can find it attached. > > > - Did you try to use the soap client that is provided with yaws? Does > that > > work? > > No, we didn't. Since we used our own client and also the SOAPUi > client (and > obtained the same results), we figured out that the problem shouldn't be > involving the client. Do you think this is a possibility? If you do, where > in > the yaws distribution is that sample soap client located? > > We have also tried to increment the gen_server timeout, but there > was no > improvement. Even though the process seems to die due to a timeout (as the > error message claims), the death is just inmediate, as if it were just > receiving the client call, invoking our handler module and then crashing > right after that. > > By the way, we had exactly the same problem that Ahmed Ali referred > to, with > the "nillable" property of the service parameters, but after we removed > them > (and also an "attributeFormDefault="qualified"" from the wsdl:definitions > header) that problem dissapeared in our case (I am attaching the original > WSDL file, too). > > Thank you very much for your time. > > Regards, > > -- > Laura M. Castro > MADS Group - Computer Science Department > University of A Corunna > http://www.madsgroup.org/staff/laura/index_en.html > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From list.nabble@REDACTED Tue Jul 17 23:50:20 2007 From: list.nabble@REDACTED (Per Melin) Date: Tue, 17 Jul 2007 14:50:20 -0700 (PDT) Subject: [erlang-questions] http-client and Transfer-Encoding: Chunked header In-Reply-To: <87ir8ilunc.fsf@yandex-team.ru> References: <87ir8ilunc.fsf@yandex-team.ru> Message-ID: <11658497.post@talk.nabble.com> Igor Goryachev-2 wrote: > > Is there a bug in http-client (which handles only "chunked") or in a > server which responses with a wierd header value? >From peeking at the http module quickly it looks like it requires "chunked" to be all lower case, though RFC2616 (which is referenced in the comments of http_chunk.erl) states that "All transfer-coding values are case-insensitive." I'd say that makes it a bug in the http client. -- View this message in context: http://www.nabble.com/http-client-and-Transfer-Encoding%3A-Chunked-header-tf4098968.html#a11658497 Sent from the Erlang Questions mailing list archive at Nabble.com. From raould@REDACTED Wed Jul 18 03:55:00 2007 From: raould@REDACTED (Raoul Duke) Date: Tue, 17 Jul 2007 18:55:00 -0700 Subject: [erlang-questions] state of FFI? Message-ID: <91a2ba3e0707171855h3294dfc9wb7135eab6c6a2b45@mail.gmail.com> hi, What is the latest greatest easiest way to do FFI in Erlang to C (and is there any chance of doing FFI to C++ w/out going through "extern C" hacks)? thanks for any opinions or pointers, sincerely. From list.nabble@REDACTED Wed Jul 18 04:24:19 2007 From: list.nabble@REDACTED (Per Melin) Date: Tue, 17 Jul 2007 19:24:19 -0700 (PDT) Subject: [erlang-questions] Input too fast, shootout and very weird behaviour with binaries In-Reply-To: <469CFD5B.7080803@di.uminho.pt> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> <469CFD5B.7080803@di.uminho.pt> Message-ID: <11661365.post@talk.nabble.com> Paulo S?rgio Almeida wrote: > > Then I wrote a version using binaries, thinking it would be better, and > a very weird thing happened. Memory comsumption stayed very low, about > 80MB, but it took almost 53 MINUTES to finish, always maxing CPU usage. > I recognize the problem. I've been trying to optimize a program that shuffles around a lot of binaries, and I've had a hard time making sense of the huge impact on performance the smallest change can have. The execution time of the second version of your program is far from linear. It's really visible once the input file is larger than ~300K. With a 320K file it spends 43% of the time in the garbage collector according to fprof. With a 640K file it's 61% time in the GC, 1280K makes it 80% and at 2560K it's 89%. I've tweaked the program so it runs about three times as fast, but I can't get rid of the exponential characteristics. I'm using R11B4 without HiPE. -- View this message in context: http://www.nabble.com/input-too-fast-tf3983101.html#a11661365 Sent from the Erlang Questions mailing list archive at Nabble.com. From lcoquelle@REDACTED Wed Jul 18 05:57:45 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 18 Jul 2007 11:57:45 +0800 Subject: [erlang-questions] fwrite on stdout Message-ID: Little question about io, I run a command printing text on default io device (stdout) printing one integer per line: shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()." 1 2 3 4 5 But if I try to pipe the result to "truncate it", this print "1 2 3" then crash! shell> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()." | head -n 3 1 2 3 Crash dump was written to: erl_crash.dump init terminating in do_boot () What's happening? There should be a simple explanation, but what is it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcarrascal@REDACTED Wed Jul 18 06:13:47 2007 From: jcarrascal@REDACTED (=?UTF-8?Q?Julio_C=C3=A9sar_Carrascal_Urquijo_(MCTS)?=) Date: Tue, 17 Jul 2007 23:13:47 -0500 Subject: [erlang-questions] Self referencing records. Message-ID: <7f3901c50707172113l5a51128cp5cf8c92c328103f2@mail.gmail.com> Hi, Is it possible at all to create a record that references it self? The following obviously doesn't work and I understand why but I'd like to know if there's a work around. -record(object, {class, props}). test() -> T = #object{class='Object', props=dict:new()}, T#object.props = dict:append("this", T, T#object.props), T. Thanks -- Julio C?sar Carrascal Urquijo Microsoft Certified Technology Specialist http://jcesar.3stecnoinformatica.com/ From lcoquelle@REDACTED Wed Jul 18 06:28:32 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 18 Jul 2007 12:28:32 +0800 Subject: [erlang-questions] Self referencing records. In-Reply-To: <7f3901c50707172113l5a51128cp5cf8c92c328103f2@mail.gmail.com> References: <7f3901c50707172113l5a51128cp5cf8c92c328103f2@mail.gmail.com> Message-ID: I'm not sure to understand the undelying problem, but I think there is a problem of syntax. Is the following what you're looking for? test() -> T = #object{class='Object', props=dict:new()}, NewProps = dict:append("this", T, T#object.props), T#object{props=NewProps}. On 7/18/07, Julio C?sar Carrascal Urquijo (MCTS) wrote: > > Hi, > > Is it possible at all to create a record that references it self? The > following obviously doesn't work and I understand why but I'd like to > know if there's a work around. > > -record(object, {class, props}). > > test() -> > T = #object{class='Object', props=dict:new()}, > T#object.props = dict:append("this", T, T#object.props), > T. > > Thanks > > -- > Julio C?sar Carrascal Urquijo > Microsoft Certified Technology Specialist > http://jcesar.3stecnoinformatica.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From nm@REDACTED Wed Jul 18 08:12:55 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 18 Jul 2007 11:12:55 +0500 Subject: [erlang-questions] Self referencing records. In-Reply-To: References: <7f3901c50707172113l5a51128cp5cf8c92c328103f2@mail.gmail.com> Message-ID: <469DAF67.7090005@web.am> Ludovic Coquelle wrote: > I'm not sure to understand the undelying problem, but I think there is a > problem of syntax. > Is the following what you're looking for? > > test() -> > T = #object{class='Object', props=dict:new()}, > NewProps = dict:append("this", T, T#object.props), > T#object{props=NewProps}. > Well, it will reference not to itself, but to copy of itself :) > On 7/18/07, Julio C?sar Carrascal Urquijo (MCTS) > wrote: >> >> Hi, >> >> Is it possible at all to create a record that references it self? IMHO, You can not have "references" in Erlang. All data structures are passed by value (at least from programmer's point of view, VM may optimize sometimes and pass pointers rather than value). -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From KONGA@REDACTED Wed Jul 18 08:17:33 2007 From: KONGA@REDACTED (Anthony Kong) Date: Wed, 18 Jul 2007 16:17:33 +1000 Subject: [erlang-questions] How to interpret this error message? Message-ID: <469E3D0F.664A.00DD.0@stgeorge.com.au> Hi, all, I read from the mailing list a few days ago about using mnesia:dirty_update_counter() to generate key. I want to use this feature as well, so I have come up with this little test script: ==== -module(db_seq). -record(counter, {tab, key, value}). -export([init_mnesia_db/0, get_next_seq/1, test/0, setup/0]). -define(SERVER, ?MODULE). get_next_seq(Key) -> mnesia:dirty_update_counter(counter, Key, 1). setup() -> mnesia:create_schema([node()]), mnesia:start(), mnesia:create_table(counter, [{disc_copies, [node()]}, {type, ordered_set}, {attributes, record_info(fields, counter)}]), mnesia:stop(). test() -> mnesia:start(), mnesia:wait_for_tables([counter], 20000), mnesia:dirty_update_counter(counter, a, 1). ==== I fired up erl with this command line "erl -mnesia dir local". Then I executed db_seq:setup() in order to create the schema and table. Then I run db_seq:test() in order to obtain an integer value, which failed with this message: 6> db_seq:test(). ** exited: {aborted,{combine_error,counter,update_counter}} ** So, what is a "combine_error"? What is the best way to find out the meaning of these error messages (apart from asking the question in mailing list)? Is reading the source code the only way? (Don't get me wrong, I do not mind reading them, but really would like to learn how you guys decipher this kind of error message normally during development...) Cheers, Anthony ********************************************************************** ***** IMPORTANT INFORMATION ***** This document should be read only by those persons to whom it is addressed and its content is not intended for use by any other persons. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. St.George Bank Limited AFSL 240997, Advance Asset Management Limited AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. ********************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Jul 18 09:58:32 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 18 Jul 2007 09:58:32 +0200 Subject: [erlang-questions] Is function clause selection O(n)? In-Reply-To: References: Message-ID: <9b08084c0707180058p11bc5514m867de6acc61205ad@mail.gmail.com> On 7/17/07, Daniel Goertzen wrote: > I am considering the design of a filtering function that will prevent some > function calls and allow others. For example, such a function might look > like this: > > filter(M,F,Args) -> apply(M,F,Args). > > Of course the above does no actual filtering, but for the use I'm > envisioning there will be dozens or even hundreds of clauses for the filter > function. So, I am wondering what the algorithmic complexity of runtime > clause selection is. O(n)? O(log n)? O(1)? It depends upon the set of patterns - how much they overlap. It might be O(1) it might be O(N). It also depends upon how large the patterns are. The pattern matching compiler tries to build an optimal decision tree, how well it does this depends upon the set of patterns. In your case, clause selection should be very fast - one hash lookup for the module and one for the function - assuming they are atoms and not variables. (It might be a linear search if the number of atoms is small - the system will choose the best method depending upon the number of atoms) "Hundred of clauses" is what I'd call a very small pattern set - it's always going to be faster compiling this than using ets. If know the number of arguments you can do away with the apply and make it even faster filter(foo,bar,A,B,C) -> foo:bar(A,B,C) But then you'd need a filter/2, filter/3, ... etc to take care of the different numbers of arguments. Basically I wouldn't out-guess the compiler. Try using clauses even if there are thousands, or millions of them. If you manage to break the system by writing a function with a million clauses then file a bug report. This has often happened in the past, often a simple fix to the compiler corrects the problem - but we need to know about the pathological cases. /Joe > > I've also considered an ets table lookup for this, but it does the opposite > of what I want. With ets you can specify a pattern to match against a set > of values, but I need a value to match against a list of patterns. > > Any other ideas? > > Thanks, > Dan. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Wed Jul 18 10:21:56 2007 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 18 Jul 2007 10:21:56 +0200 Subject: [erlang-questions] Input too fast, shootout and very weird behaviour with binaries In-Reply-To: <11661365.post@talk.nabble.com> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> <469CFD5B.7080803@di.uminho.pt> <11661365.post@talk.nabble.com> Message-ID: <9b08084c0707180121rc1bb247q3d5ee8cd07a1220@mail.gmail.com> Wierd - can you post the program that generates the input file? Thanks /Joe On 7/18/07, Per Melin wrote: > > > Paulo S?rgio Almeida wrote: > > > > Then I wrote a version using binaries, thinking it would be better, and > > a very weird thing happened. Memory comsumption stayed very low, about > > 80MB, but it took almost 53 MINUTES to finish, always maxing CPU usage. > > > > > I recognize the problem. I've been trying to optimize a program that > shuffles around a lot of binaries, and I've had a hard time making sense of > the huge impact on performance the smallest change can have. > > The execution time of the second version of your program is far from linear. > It's really visible once the input file is larger than ~300K. > > With a 320K file it spends 43% of the time in the garbage collector > according to fprof. > > With a 640K file it's 61% time in the GC, 1280K makes it 80% and at 2560K > it's 89%. > > I've tweaked the program so it runs about three times as fast, but I can't > get rid of the exponential characteristics. > > I'm using R11B4 without HiPE. > > -- > View this message in context: http://www.nabble.com/input-too-fast-tf3983101.html#a11661365 > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From olivier.boudeville@REDACTED Wed Jul 18 10:37:20 2007 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Wed, 18 Jul 2007 10:37:20 +0200 Subject: [erlang-questions] =?iso-8859-1?q?R=E9f=2E_=3A_Re=3A__Two_little_?= =?iso-8859-1?q?questions?= Message-ID: Hi, thanks for the information ! I did not know that c() could have a second parameter. That's what I needed. Actually I did not know that c was a module of its own, and that it was documented here : http://www.erlang.org/doc/man/c.html Thanks again, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau C-052 Office : 33 1 47 65 59 58 / Mobile : 33 6 16 83 37 22 / Fax : 33 1 47 65 34 24 chandrashekhar.mullaparthi@REDACTED 17/07/2007 10:34 Pour : olivier.boudeville@REDACTED cc : erlang-questions@REDACTED Objet : Re: [erlang-questions] Two little questions On 16/07/07, Olivier BOUDEVILLE wrote: > > Hi, > > sorry if it's an obvious question, but how to specify to the erl interpreter > which include directories should be scanned for *.hrl file when using > 'c(my_module).' ? (a I tried with no luck '-code_path_cache' and '-pa'/'-pz' > (I suppose both must be for precompiled modules (beam)), but I did not find > header counterparts (I lack the C/C++ -I directive). Had to create a symlink > instead. If you are using the -include directive: c(my_module, [{i, "../include1"}, {i, "../include2"}]). If you are using the -include_lib directive, as -include_lib("app1/include/some_file.hrl"). Then make sure that "app1/ebin" is in your code path. Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Wed Jul 18 10:53:12 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 18 Jul 2007 10:53:12 +0200 Subject: [erlang-questions] graphical xref tool ? Message-ID: Hi, Once upon a time (pre R6 I think) there was a graphical cross reference tool. Anyone know if there exist something like that today ? Cheers, Tobbe From ulf@REDACTED Wed Jul 18 11:04:04 2007 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 18 Jul 2007 11:04:04 +0200 Subject: [erlang-questions] Is function clause selection O(n)? In-Reply-To: <9b08084c0707180058p11bc5514m867de6acc61205ad@mail.gmail.com> References: <9b08084c0707180058p11bc5514m867de6acc61205ad@mail.gmail.com> Message-ID: <8209f740707180204l508068cfv128bb2352f524fbf@mail.gmail.com> 2007/7/18, Joe Armstrong : > Basically I wouldn't out-guess the compiler. Try using clauses even if there are > thousands, or millions of them. If you manage to break the system by > writing a function > with a million clauses then file a bug report. This has often happened > in the past, often > a simple fix to the compiler corrects the problem - but we need to > know about the pathological cases. So far, I think one of the toughest cases for the compiler is the SQL grammar, specified in yecc. I don't know exactly how big that is, but the megaco text parser module consists of some 23,000 lines of code, mainly in two functions. BR, Ulf W From psa@REDACTED Wed Jul 18 11:45:54 2007 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Wed, 18 Jul 2007 10:45:54 +0100 Subject: [erlang-questions] Input too fast, shootout and very weird behaviour with binaries In-Reply-To: <9b08084c0707180121rc1bb247q3d5ee8cd07a1220@mail.gmail.com> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.erics son.se><469CFD5B.7080803@di.uminho.pt> <11661365.post@talk.nabble.com> <9b08084c0707180121rc1bb247q3d5ee8cd07a1220@mail.gmail.com> Message-ID: <469DE152.30208@di.uminho.pt> Joe Armstrong wrote: > Wierd - can you post the program that generates the input file? You have a bunch of them available from the "fasta" benchmark: http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=all&sort=fullcpu You run it with the size as arg. For the revcomp benchmark: fasta 2500000 > input-2500000 I used the C gcc #2, as it's fast. But you can pick a version in Erlang, and even improve it ;) Regards, psa From lcastro@REDACTED Wed Jul 18 11:46:29 2007 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Wed, 18 Jul 2007 11:46:29 +0200 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP In-Reply-To: <407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> References: <200707161851.55933.lcastro@udc.es> <200707171144.50497.lcastro@udc.es> <407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> Message-ID: <200707181146.42811.lcastro@udc.es> Hello Willem, Thank you very much for trying, anyway. We keep looking for a reason for this behaviour, but starting to think it might not be a YAWS nor SOAP problem... > One thing that may be the cause of the problem is that one important > statement is still missing in the documentation: you have to actually start > the server... "yaws:start_embedded(Docroot, SL,GL)", assuming that Docroot, > GL and SL have the right values, see http://yaws.hyber.org/soap_intro.yaws. Yes, we realized that. However, that is not exactly how we start YAWS, but I think it must be equivalent. This is what we do: DGC = yaws_config:make_default_gconf(true, 'our-unique-id'), DGC#gconf{ logdir = "/var/log/our-application", tmpdir = "/tmp", enable_soap = true }, SC = #sconf{ port = 8888, docroot = "yaws", listen = {0,0,0,0}, servername = "Our HTTP server", partial_post_size=10000000 }, yaws_config:add_yaws_soap_srv(GC), yaws_api:setconf(GC, [[SC]]), yaws_soap_srv:setup({ourhandlermodule,handler},"file:///path/to/Service.wsdl"), I will let you know if we make any progress. Regards, -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From list.nabble@REDACTED Wed Jul 18 11:48:41 2007 From: list.nabble@REDACTED (Per Melin) Date: Wed, 18 Jul 2007 02:48:41 -0700 (PDT) Subject: [erlang-questions] Input too fast, shootout and very weird behaviour with binaries In-Reply-To: <9b08084c0707180121rc1bb247q3d5ee8cd07a1220@mail.gmail.com> References: <6616D98C65DD514BA2E1DDC5F9223155022F9A68@esealmw115.eemea.ericsson.se> <469CFD5B.7080803@di.uminho.pt> <11661365.post@talk.nabble.com> <9b08084c0707180121rc1bb247q3d5ee8cd07a1220@mail.gmail.com> Message-ID: <11665604.post@talk.nabble.com> Joe Armstrong wrote: > > Wierd - can you post the program that generates the input file? > http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=hipe&id=0 Or you can just use this 10K sample file and append it to itself to make a bigger one, which isn't exactly the same but close enough to yield the same strange result: http://shootout.alioth.debian.org/download/revcomp-input.txt -- View this message in context: http://www.nabble.com/input-too-fast-tf3983101.html#a11665604 Sent from the Erlang Questions mailing list archive at Nabble.com. From francesco@REDACTED Wed Jul 18 12:41:05 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 18 Jul 2007 11:41:05 +0100 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469BEB9B.3080806@free.fr> References: <469B8A52.10007@erlang-consulting.com> <20070716184255.GG11545@katolaz.homeunix.net> <469BEB9B.3080806@free.fr> Message-ID: <469DEE41.7080708@erlang-consulting.com> It is not a language I am worried people will stay away from, it is the middleware which for over a decade has been used to build distributed, massively concurrent soft real time systems with many 9s availability (Some of which, but not all, happen to be telecom applications) some people stay clear of until pointed in the right direction. Keeping the OTP acronym is a must, but giving it something more meaningful will help (And it will stop bugging me :-)). Francesco igwan wrote: > Hi, > > Well, I don't think people are going to stay away from a language > because it has Telecom in its name. After all, the "Erlang" name in > itself also carries the "Telecom" idea (if not the well-known unit used > for telecom traffic, it's the Er = Ericsson = Telecom again in the mind > of people), why not change the whole name then ? > To the contrary, I think people have an idea of robustness and > reliability when they think of telecoms (the good old and always working > PSTN phone lines as opposed to the big unreliable internet :) and in the > mind of programmers you can add fault-tolerance and distribution they > 've been dreaming about all of their career :) Coming from the telecom > industry my objectiveness may be flawed here :) , but IMAO, Erlang > should not dismiss its telecom heritage, it's all but a turn-off. > Explain people it's certainly not limitating the possible applications > and show them what can be done ! I'm sure we're gonna have some killer > apps as the best proofs soon. One doesn't have to explain the OTP > acronym every where after all. It is a fantastic tool -and the only one > for now- for structuring a complex application, it will never be too > late to change the name when someone comes with a different/better > framework. > Just my two (euro)-cents > > igwan > > KatolaZ a ?crit : > >> On Mon, Jul 16, 2007 at 06:59:24PM +0200, Lennart ?hman wrote: >> >> >>> Hi, >>> without even having read the thread :-) I think that one does not have to try >>> to reinvent such acronyms. It is not uncommon that a company or "thing" becomes >>> the acronym and what it really was a short for becomes irrelevant. >>> >>> CD (Compact Disc). It certainly still is a disc, but not very compact with todays >>> standards. >>> IBM (International Business Machines). I dont think anyone now days says that IBM >>> is mainly a hardware company. >>> >>> >>> >> The matter is that OTP is not going to become as popular as CDs and >> IBM, ar at least it is not going to in the next ten years :-) >> >> I think that Francesco pointed out a serious issue. The risk of >> considering Erlang/OTP as a platform suitable only for >> "telecommunication" apps is over the corner, and can scare many >> programmers which could exploit Erlang capabilities in many other >> fields. >> >> The first time I told a friend that we were working on a robot driven >> by Erlang, he wispered "But Erlang is just for telecom! Why don't you >> use Lisp or Haskell. They would fit your task better...". And many >> many people think at Erlang that way, nowadays. >> >> HND >> >> Enzo >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From chlorophil@REDACTED Wed Jul 18 14:44:23 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Wed, 18 Jul 2007 22:44:23 +1000 Subject: [erlang-questions] Dangerous typo of the month... In-Reply-To: <469C8DA4.3030607@Fitzsimons.org> References: <469C8DA4.3030607@Fitzsimons.org> Message-ID: On 7/17/07, Bruce Fitzsimons wrote: > undefiend > > While fixing inet_dist_ssl I found one of these (I think of no > consequence, never tested), but there are a few more in the otp > codebase, one of which looks significant. I produced enough of these typo errors that I put together a parse_transform to catch them in my code. (See http://chlorophil.blogspot.com/2007/04/atomiser-part-i.html) I would not suggest using this hack to check OTP code, but maybe something like this would be a worthwhile new (optional) language feature? Philip From dmercer@REDACTED Wed Jul 18 16:20:23 2007 From: dmercer@REDACTED (David Mercer) Date: Wed, 18 Jul 2007 09:20:23 -0500 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469BEB9B.3080806@free.fr> References: <469B8A52.10007@erlang-consulting.com> <20070716184255.GG11545@katolaz.homeunix.net> <469BEB9B.3080806@free.fr> Message-ID: <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> Igwan wrote: > To the contrary, I think people have an idea of robustness and > reliability when they think of telecoms (the good old and always working > PSTN phone lines as opposed to the big unreliable internet :) and in the > mind of programmers you can add fault-tolerance and distribution they > 've been dreaming about all of their career :) Coming from the telecom > industry my objectiveness may be flawed here :) , but IMAO, Erlang > should not dismiss its telecom heritage, it's all but a turn-off. I agree completely. I do not come from a telecom background, but when I found out that OTP is related to the running of telephone networks, I immediately thought of how reliable telephone networks are (when was the last time you were kicked off a telephone call because the entire telephone system had to be rebooted?) and how this might be a viable choice for my nontelecoms applications. I do not think it should be changed to Open Transaction Platform, because all that is doing is replacing the only meaningful word in the acronym with a buzzword, making the term completely meaningless. Not only that, OTP has nothing to do with transactions, so it is not only meaningless, but also deceptive. Cheers, DBM From minas.subs@REDACTED Wed Jul 18 15:52:51 2007 From: minas.subs@REDACTED (Minas Abrahamyan) Date: Wed, 18 Jul 2007 18:52:51 +0500 Subject: [erlang-questions] graphical xref tool ? In-Reply-To: References: Message-ID: <82423d8e0707180652s67897d86v2720b932625a2a06@mail.gmail.com> Hi, BTW I'm interesting in it too, since found that there was something like that, googling on [xref Erlang] brings, beside others, this doc: http://erlang.org/documentation/doc-4.8.1/pdf/xref-1.0.3.pdf with description of the tool. Dated to the 1997. Regards, Minas Abrahamyan On 7/18/07, Torbjorn Tornkvist wrote: > > Hi, > > Once upon a time (pre R6 I think) there was a graphical cross reference > tool. Anyone know if there exist something like that today ? > > Cheers, Tobbe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cyberlync@REDACTED Wed Jul 18 20:06:34 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 18 Jul 2007 11:06:34 -0700 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> References: <469B8A52.10007@erlang-consulting.com> <20070716184255.GG11545@katolaz.homeunix.net> <469BEB9B.3080806@free.fr> <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> Message-ID: > > I do not think it should be changed to Open Transaction Platform, because > all that is doing is replacing the only meaningful word in the acronym with > a buzzword, making the term completely meaningless. Not only that, OTP has > nothing to do with transactions, so it is not only meaningless, but also > deceptive. > Worse yet the term 'transaction' has negative connotations in large scale distributed systems. The fact that its essentially impossible to guarantee a transaction in that environment makes the use of the word quite negative. For people that understand these types of distributed systems the fact that transaction is in the title of OTP would almost immediately bias them against the platform. These are the types of people who would benefit most from Erlang and otp. If you must change the name just change the name forget about the acronym and find something more descriptive. From robert.virding@REDACTED Wed Jul 18 22:19:06 2007 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 18 Jul 2007 22:19:06 +0200 Subject: [erlang-questions] JavaScript compiler for Erlang In-Reply-To: <004901c7c881$44c4e800$891ea8c0@SSI.CORP> References: <004001c7c571$79ff2890$891ea8c0@SSI.CORP><32b96478b2e76de527050780d4bae17d@terzarima.net><004501c7c57a$a42c7f10$891ea8c0@SSI.CORP><349ebab60707131211r4702958eq5be1c23ee640dc0d@mail.gmail.com><44E29F31-D0B7-40D9-B316-20BCDAAA574E@gmail.com> <9b08084c0707160135m795ed40bi34aeb734b9377e6f@mail.gmail.com> <004901c7c881$44c4e800$891ea8c0@SSI.CORP> Message-ID: <469E75BA.4070504@telia.com> With the garbage collector of course! Sorry couldn't resist that. :-) I am in no way a js guru. How fine are js objects? I know Erlang processes are lightweight but are they lightweight enough? Would you get problems with implicit/explicit sequentiality in js? Otherwise just keep them in a table. Still thinking about doing PHP, there are an awful lot of applications. Someone asked earlier which versions we are thinking about. At this stage I would say the latest version for which I can get a decent description of the language and main libraries. It doesn't matter that much until you get users who would actually want to use it. Robert David Mercer wrote: > Also, how would you handle garbage collection of the Javascript objects? > > DBM > > -----Original Message----- > From: David Mercer [mailto:dmercer@REDACTED] > Sent: Monday, July 16, 2007 09:40 > To: 'erlang-questions@REDACTED' > Subject: RE: [erlang-questions] JavaScript compiler for Erlang > > Joe Armstrong wrote: >> The difficulty of wring an interpretor seems mainly to do with getting >> an accurate >> parse tree of the js source into Erlang - the interpretor should be pretty > easy. > > So, for me, who is new to Erlang and thought about it on my drive home last > Friday, is this the right approach to the implementation: have a separate > process for each object and lexical environment. An object is then > represented as a PID, and requests for properties and methods (which are > basically the same in Javascript), would send a message to the process, > which would return the appropriate value (which may also be an object/PID) > or function. Nested lexical environments (e.g., with blocks, function > blocks, and the global environment), therefore, can send forward a request > to their higher level if the value is not found in their environment. > > Am I on the right track? > > Cheers, > > David > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dking@REDACTED Wed Jul 18 22:26:08 2007 From: dking@REDACTED (David King) Date: Wed, 18 Jul 2007 13:26:08 -0700 Subject: [erlang-questions] input too fast In-Reply-To: <6296397.3321184355347805.JavaMail.root@zimbra> References: <6296397.3321184355347805.JavaMail.root@zimbra> Message-ID: <96A32543-A3EE-460C-9AD7-E737A909ABE2@ketralnis.com> > Fredrik Svahn writes: >> While I agree that "" seems to be a perfectly valid >> (although not >recommended) filename in all(?) unix systems I do >> not think that using an atom will >help. > Why not use a Unix convention, "/dev/stdin" and "/dev/stdout"? /dev/std{in,out} do not exist on all unices. On some, it's /dev/fd/ [01], and on some there isn't a device node for it. From mberrow1@REDACTED Wed Jul 18 23:03:41 2007 From: mberrow1@REDACTED (Mike Berrow) Date: Wed, 18 Jul 2007 14:03:41 -0700 Subject: [erlang-questions] The meaning of OTP... References: <469B8A52.10007@erlang-consulting.com><20070716184255.GG11545@katolaz.homeunix.net><469BEB9B.3080806@free.fr> <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> Message-ID: <001901c7c97f$20aebaa0$6401a8c0@rubicon> How about "Omnipotence Through Parallelism" -- Mike From dajo.mail@REDACTED Wed Jul 18 23:36:30 2007 From: dajo.mail@REDACTED (Johannes) Date: Wed, 18 Jul 2007 23:36:30 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> Message-ID: <469E87DE.1050304@web.de> when will the book arrive in germany ?? Joe Armstrong schrieb: > The Erlang book has arrived at the publishers. > > The first batches of books to individual custormer will start shipping today. > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmorton@REDACTED Thu Jul 19 00:41:10 2007 From: dmorton@REDACTED (Damien Morton) Date: Wed, 18 Jul 2007 23:41:10 +0100 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <001901c7c97f$20aebaa0$6401a8c0@rubicon> References: <469B8A52.10007@erlang-consulting.com><20070716184255.GG11545@katolaz.homeunix.net><469BEB9B.3080806@free.fr> <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> <001901c7c97f$20aebaa0$6401a8c0@rubicon> Message-ID: <469E9706.2020804@bitfurnace.com> And the logo is - a million tiny Odins wielding their hammers against a giant rock. > How about > "Omnipotence Through Parallelism" > > -- Mike > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From KONGA@REDACTED Thu Jul 19 01:42:54 2007 From: KONGA@REDACTED (Anthony Kong) Date: Thu, 19 Jul 2007 09:42:54 +1000 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <001901c7c97f$20aebaa0$6401a8c0@rubicon> References: <469B8A52.10007@erlang-consulting.com><20070716184255.GG11545@katolaz.homeunix.net><469BEB9B.3080806@free.fr> <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> <001901c7c97f$20aebaa0$6401a8c0@rubicon> Message-ID: <469F320F.664A.00DD.0@stgeorge.com.au> What about "Oh, That's Powerful!" :-) I think rebranding is usually a (meaningless) marketing exercise. Erlang excels by its technical merit and this alone has enough marketing power. OTP highlights where its heritage has come from and I think it is a good thing. For example, if you have read Joe's book, he mentioned about how Mnesia get her name: "The original name was Amnesia. One of our bosses didn?t like the name. He said, ?You can?t possibly call it Amnesia*you can?t have a database that forgets things!? So we dropped the A, and the name stuck." I cannot help laughing whenever i read this, This is this kind of little stories make erlange what it is today, I reckon. (+ other big technial/language design decision, of course) So, just keep OTP as it is, unless the same boss has something to say again (Actually I am too new to erlang to make comment as such, but that's just how I feel) Cheers, Anthony >>> "Mike Berrow" 19/07/2007 7:03 am >>> How about "Omnipotence Through Parallelism" -- Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ********************************************************************** ***** IMPORTANT INFORMATION ***** This document should be read only by those persons to whom it is addressed and its content is not intended for use by any other persons. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. St.George Bank Limited AFSL 240997, Advance Asset Management Limited AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. ********************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From me@REDACTED Thu Jul 19 07:40:31 2007 From: me@REDACTED (KatolaZ) Date: Thu, 19 Jul 2007 07:40:31 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469E9706.2020804@bitfurnace.com> References: <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> <001901c7c97f$20aebaa0$6401a8c0@rubicon> <469E9706.2020804@bitfurnace.com> Message-ID: <20070719054031.GG20738@katolaz.homeunix.net> On Wed, Jul 18, 2007 at 11:41:10PM +0100, Damien Morton wrote: > And the logo is - a million tiny Odins wielding their hammers against a > giant rock. > > How about > > "Omnipotence Through Parallelism" > > This is a marvellous idea! :-) HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From dunceor@REDACTED Thu Jul 19 07:47:29 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Thu, 19 Jul 2007 07:47:29 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <469E87DE.1050304@web.de> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> Message-ID: <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> On 7/18/07, Johannes wrote: > when will the book arrive in germany ?? > > Joe Armstrong schrieb: > > The Erlang book has arrived at the publishers. > > > > The first batches of books to individual custormer will start shipping today. > > > > /Joe Well amazon.de says 31 july. http://www.amazon.de/Programming-Erlang-Software-Concurrent-World/dp/193435600X So that is probobly a good guess. 267kr for it in Sweden, dang that is cheap =) Ordered mine yesterday. Thanks! Br Karl From chsu79@REDACTED Thu Jul 19 10:34:17 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 19 Jul 2007 10:34:17 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July Message-ID: Place: O'Learys sports bar, Stockholm Centralstation Time: 17:00-ish *** If you want to show up, please send me a private mail so I know how many we will be for, if necessary, table reservation. *** Though, my information source tells me there are no soccer games drawing people to sports bars on Tuesday. Location is chosen as a convenience for the Erlang fans living in Uppsala. From lcoquelle@REDACTED Thu Jul 19 11:16:12 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Thu, 19 Jul 2007 17:16:12 +0800 Subject: [erlang-questions] Erlang VM crashed due to io output? Message-ID: Sorry for posting again this question, but I think there is something important to know and I can't figure out what. I run a command printing simple text on default io device (stdout): bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()." 1 2 3 4 5 That's the behaviour I expected. But if I try to pipe the result, erlang crash: bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) end, lists:seq(1,5)), erlang:halt()." | head -n 3 1 2 3 Crash dump was written to: erl_crash.dump init terminating in do_boot () What's happening? Is it a normal behaviour? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Thu Jul 19 11:26:05 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 19 Jul 2007 11:26:05 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: References: Message-ID: A great initiative! May I just add that this event has been initiated via the #erlang channel at irc.freenode.net. So all you oldtimers (you know who you are :-), its time to join in on the channel from time to time. Currently the #erlang channel has, constantly, around 100 members but is rather silent. This can be compared to the #haskell channel which have around 350 people with a 24h (it seems) discussion going on. Cheers, Tobbe (Ps. I'll be at the ErlLounge of course) Christian S wrote: > Place: O'Learys sports bar, Stockholm Centralstation > Time: 17:00-ish > > *** If you want to show up, please send me a private mail so I know > how many we will be for, if necessary, table reservation. *** > > Though, my information source tells me there are no soccer games > drawing people to sports bars on Tuesday. > > Location is chosen as a convenience for the Erlang fans living in Uppsala. From tobbe@REDACTED Thu Jul 19 11:28:50 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 19 Jul 2007 11:28:50 +0200 Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: Ludovic Coquelle wrote: > Sorry for posting again this question, but I think there is something > important to know and I can't figure out what. > > I run a command printing simple text on default io device (stdout): > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", > [N]) end, lists:seq(1,5)), erlang:halt()." > 1 > 2 > 3 > 4 > 5 > > That's the behaviour I expected. > But if I try to pipe the result, erlang crash: > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", > [N]) end, lists:seq(1,5)), erlang:halt()." | head -n 3 > 1 > 2 > 3 I can't reproduce this behaviour. I'm running R11B2 on Debian and the above works perfectly. What OS are you running this on? --Tobbe > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > What's happening? > Is it a normal behaviour? > From lcoquelle@REDACTED Thu Jul 19 11:57:25 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Thu, 19 Jul 2007 17:57:25 +0800 Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: I checked again, and it crashes again. I'm using R11B4 and some more info on my config: bash> cat /proc/version Linux version 2.6.15-28-386 (buildd@REDACTED) (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) #1 PREEMPT Thu May 10 09:45:43 UTC 2007 bash> erl -version Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.5.4 On 7/19/07, Torbjorn Tornkvist wrote: > > Ludovic Coquelle wrote: > > Sorry for posting again this question, but I think there is something > > important to know and I can't figure out what. > > > > I run a command printing simple text on default io device (stdout): > > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", > > [N]) end, lists:seq(1,5)), erlang:halt()." > > 1 > > 2 > > 3 > > 4 > > 5 > > > > That's the behaviour I expected. > > But if I try to pipe the result, erlang crash: > > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", > > [N]) end, lists:seq(1,5)), erlang:halt()." | head -n 3 > > 1 > > 2 > > 3 > > I can't reproduce this behaviour. > I'm running R11B2 on Debian and the above works perfectly. > What OS are you running this on? > > --Tobbe > > > Crash dump was written to: erl_crash.dump > > init terminating in do_boot () > > > > What's happening? > > Is it a normal behaviour? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bbmaj7@REDACTED Thu Jul 19 12:31:22 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Thu, 19 Jul 2007 20:31:22 +1000 (EST) Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: Message-ID: <798123.65047.qm@web52007.mail.re2.yahoo.com> Works OK for me. R11B5 on FC4 built with gcc-4.0.2 Linux localhost.localdomain 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 i686 i386 GNU/Linux --- Ludovic Coquelle wrote: > Sorry for posting again this question, but I think there is something > important to know and I can't figure out what. > > I run a command printing simple text on default io device (stdout): > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." > 1 > 2 > 3 > 4 > 5 > > That's the behaviour I expected. > But if I try to pipe the result, erlang crash: > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." | head -n 3 > 1 > 2 > 3 > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > What's happening? > Is it a normal behaviour? ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From luna@REDACTED Thu Jul 19 13:32:58 2007 From: luna@REDACTED (Daniel Luna) Date: Thu, 19 Jul 2007 13:32:58 +0200 (CEST) Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: On Thu, 19 Jul 2007, Ludovic Coquelle wrote: > Sorry for posting again this question, but I think there is something > important to know and I can't figure out what. > > I run a command printing simple text on default io device (stdout): > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." > 1 > 2 > 3 > 4 > 5 > > That's the behaviour I expected. > But if I try to pipe the result, erlang crash: > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." | head -n 3 > 1 > 2 > 3 > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > What's happening? > Is it a normal behaviour? I was hoping someone else would answer, and thus didn't reply to your first message. I'm not suprised at all, but my answer should still be taken with a grain of salt. My guess is that 'head -n 3' will take the first three lines of output and then kill the pipe. Erlang will be very upset about someone killing its standard out, and thus crash (and of course the error message is written to stderr and thus not caught by head). If it's ok that erlang crashes, you could pipe also stderr, otherwise I recommend that you do the head thingie inside erlang. HTH /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 nick@REDACTED Thu Jul 19 13:35:35 2007 From: nick@REDACTED (Niclas Eklund) Date: Thu, 19 Jul 2007 13:35:35 +0200 (MEST) Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469F320F.664A.00DD.0@stgeorge.com.au> Message-ID: Hello! If you search the documentation you find stuff like net_adm:ping/1 pong | pang, the Event Trace (E.T.) function et:phone_home/5: http://www.erlang.org/doc/man/et.html BTW, I noticed that on http://www.trapexit.org/ start page Telecom has been replaced by Transaction. For example: "The Open Transaction Platform (OTP) is set of ..." Isn't it a bit confusing if we use different explanations of what the OTP acronym stands for? /Nick On Thu, 19 Jul 2007, Anthony Kong wrote: > What about "Oh, That's Powerful!" :-) > I think rebranding is usually a (meaningless) marketing exercise. > Erlang excels by its technical merit and this alone has enough > marketing power. OTP highlights where its heritage has come from and I > think it is a good thing. > For example, if you have read Joe's book, he mentioned about how > Mnesia get her name: "The original name was Amnesia. One of our bosses > didn???t like the name. He said, ??You can???t possibly call it > Amnesia*you can???t have a database that forgets things!?? So we > dropped the A, and the name stuck." > > I cannot help laughing whenever i read this, > This is this kind of little stories make erlange what it is today, I > reckon. (+ other big technial/language design decision, of course) > > So, just keep OTP as it is, unless the same boss has something to say again > (Actually I am too new to erlang to make comment as such, but that's > just how I feel) > > Cheers, Anthony > > > >>> "Mike Berrow" 19/07/2007 7:03 am >>> > How about > "Omnipotence Through Parallelism" > > -- Mike > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > ********************************************************************** > ***** IMPORTANT INFORMATION ***** > This document should be read only by those persons to whom it is > addressed and its content is not intended for use by any other > persons. If you have received this message in error, please notify > us immediately. Please also destroy and delete the message from > your computer. Any unauthorised form of reproduction of this message > is strictly prohibited. > > St.George Bank Limited AFSL 240997, Advance Asset Management Limited > AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited > AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for > the proper and complete transmission of the information contained in > this communication, nor for any delay in its receipt. > ********************************************************************** > > From erlang@REDACTED Thu Jul 19 14:15:58 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 19 Jul 2007 14:15:58 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> References: <469B8A52.10007@erlang-consulting.com> <20070716184255.GG11545@katolaz.homeunix.net> <469BEB9B.3080806@free.fr> <009601c7c946$c7cfb340$891ea8c0@SSI.CORP> Message-ID: <9b08084c0707190515m14543act5787819077eadcc6@mail.gmail.com> Don't change the name - nobody knows or cares what OTP stands for. Personally I hate name change, especially when they are fueled by political correctness. The good 'ol word "problem" mutated though several versions. vsn 1 - "problem" (hundreds of years old, I guess) vsn 2 - "issue" (4-5 years old, "problem" virtually vanished after rebranding) vsn 3 - "challenge" (2 years ago? - short lived - still heard occasionally) vsn 4 - "opportunity" (2 years ago - seems to have stuck) example: We have a number of opportunities in our product. Some of colleagues even don't seem to mind being called chairs when they are in meetings. I have a "brilliant idea for a program that will earn a million dollars" [1] so I can't spend idle time writing this. /Joe [1] = problem (vsn 5) On 7/18/07, David Mercer wrote: > Igwan wrote: > > To the contrary, I think people have an idea of robustness and > > reliability when they think of telecoms (the good old and always working > > PSTN phone lines as opposed to the big unreliable internet :) and in the > > mind of programmers you can add fault-tolerance and distribution they > > 've been dreaming about all of their career :) Coming from the telecom > > industry my objectiveness may be flawed here :) , but IMAO, Erlang > > should not dismiss its telecom heritage, it's all but a turn-off. > > I agree completely. I do not come from a telecom background, but when I > found out that OTP is related to the running of telephone networks, I > immediately thought of how reliable telephone networks are (when was the > last time you were kicked off a telephone call because the entire telephone > system had to be rebooted?) and how this might be a viable choice for my > nontelecoms applications. > > I do not think it should be changed to Open Transaction Platform, because > all that is doing is replacing the only meaningful word in the acronym with > a buzzword, making the term completely meaningless. Not only that, OTP has > nothing to do with transactions, so it is not only meaningless, but also > deceptive. > > Cheers, > > DBM > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tobbe@REDACTED Thu Jul 19 16:47:42 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 19 Jul 2007 16:47:42 +0200 Subject: [erlang-questions] Nice article in Dr.Dobbs Message-ID: http://ddj.com/dept/opensource/201001928?cid=RSSfeed_DDJ_OpenSource --Tobbe From joelr1@REDACTED Thu Jul 19 16:48:25 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 19 Jul 2007 15:48:25 +0100 Subject: [erlang-questions] Automatically getting table replicas with Mnesia Message-ID: <705A251A-FB9E-4574-B0AF-A71EE4737C03@gmail.com> Is there a way to automatically get all tables from a master node when you are starting up with -mnesia extra_db_nodes ... ? Right now I manually invoke mnesia:add_table_copy for each table on the master (on the new node) but I'm wondering if there's an easy way. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From lcastro@REDACTED Thu Jul 19 17:19:27 2007 From: lcastro@REDACTED (Laura M. Castro Souto) Date: Thu, 19 Jul 2007 17:19:27 +0200 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP In-Reply-To: <407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> References: <200707161851.55933.lcastro@udc.es> <200707171144.50497.lcastro@udc.es> <407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> Message-ID: <200707191719.31544.lcastro@udc.es> Hello all, It seems that we finally found the source of the problem. In the end, it has something to do with yaws_soap_srv module, which is the genserver that was dying with the timeout error. And the reason was in front of our eyes all the time, as happens so many times. Let me explain it here for the record. Remember the "minimal" server that Willem posted in his mail? > -module(my_soap). > -export([handler/4]). > > -record('p:CodigoVO', {anyAttribs, 'etiqueta', 'valor'}). > -record('p:setParte', {anyAttribs, 'param0', 'param1', 'param2', 'param3', > 'param4', 'param5', 'param6'}). > -record('p:setParteResponse', {anyAttribs, 'return'}). > > handler(_Header, > [#'p:setParte'{'param0' = P0}], > _Action, > _SessionValue) -> > {ok, undefined, setParte(P0)}. > > setParte(P0) -> > CodigoVO = #'p:CodigoVO'{'etiqueta' = P0, 'valor' = 1}, > #'p:setParteResponse'{'return' = CodigoVO}. As Willem said, this server works out perfectly well, but this is just because is *that minimal*. The issue is that the operation being invoked through the web service (setParte) might not be *that simple*, meaning that it could potentially be a function that consumes some time to get its result. If "some time" is less than 5000 milliseconds, everything is fine. But what happens if it's not? Well, the yaws_soap_srv genserver dies. As simple as that. Why? Because whenever the gen_server:call function is used inside that module, its third optional parameter (Timeout) is never specified, thus assuming a default value (guess what: 5000 milliseconds). Check out the source code: handler(Args, Id, Payload, SessionValue) -> (...) case gen_server:call(?SERVER, {request, Id, Payload, SessionValue, SoapAction}) of {ok, XmlDoc, ResCode, undefined} -> {false, XmlDoc, ResCode}; {ok, XmlDoc, ResCode, SessVal} -> {true, 0, SessVal, XmlDoc, ResCode}; {error, _, _} = Error -> Error; false -> false end. So what we did is to add the third parameter to the gen_server:call function and now everything is working! handler(Args, Id, Payload, SessionValue) -> (...) case gen_server:call(?SERVER, {request, Id, Payload, SessionValue, SoapAction}, infinity) of {ok, XmlDoc, ResCode, undefined} -> {false, XmlDoc, ResCode}; {ok, XmlDoc, ResCode, SessVal} -> {true, 0, SessVal, XmlDoc, ResCode}; {error, _, _} = Error -> Error; false -> false end. I understand that an infinite timeout might not be reasonable in all cases, maybe even in most of the cases, but you will agree with me that the need for a timeout greather than 5000 might not be that strange... Perhaps, a general solution for this will be to let the client modules of yaws+soap configure that timeout option, maybe by means of another field in the gconf struct. Regards, -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From codeslinger@REDACTED Thu Jul 19 17:37:07 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Thu, 19 Jul 2007 11:37:07 -0400 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> Message-ID: <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> On 7/19/07, Karl Sj?dahl - dunceor wrote: > Well amazon.de says 31 july. > http://www.amazon.de/Programming-Erlang-Software-Concurrent-World/dp/193435600X > > So that is probobly a good guess. Personally, I'll be pissed if I have to wait that long. I'm also quite upset that I ordered it via the beta and haven't received a notification of shipping or what carrier/tracking number it carries. This is pretty amateurish, IMO. Not that I'm bashing Joe: the book is great! -- Toby DiPasquale From thomasl_erlang@REDACTED Thu Jul 19 17:48:25 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 19 Jul 2007 08:48:25 -0700 (PDT) Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <9b08084c0707190515m14543act5787819077eadcc6@mail.gmail.com> Message-ID: <400357.95714.qm@web38810.mail.mud.yahoo.com> --- Joe Armstrong wrote: > Don't change the name - nobody knows or cares what > OTP stands for. > > Personally I hate name change, especially when they > are fueled by political correctness. /.../ I'm inclined to agree, but nevertheless, hey, it's summertime. So, my suggestion is (in the spirit of GNU inscrutability) "OTP Technical Platform". Or, why not, "Open Technical Problem". To which one can add, after a suitable pause, "Well, you did ask." Best, Thomas PS. Or maybe "Oscar T. Peterson"? Warning: this could drive jazz fanatics crazy. ____________________________________________________________________________________ Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar.yahoo.com/toolbar/features/mail/index.php From dmercer@REDACTED Thu Jul 19 18:05:52 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 19 Jul 2007 11:05:52 -0500 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <400357.95714.qm@web38810.mail.mud.yahoo.com> References: <9b08084c0707190515m14543act5787819077eadcc6@mail.gmail.com> <400357.95714.qm@web38810.mail.mud.yahoo.com> Message-ID: <00ce01c7ca1e$af303430$891ea8c0@SSI.CORP> > So, my suggestion is (in the spirit of GNU > inscrutability) "OTP Technical Platform". I love it! DBM From dmercer@REDACTED Thu Jul 19 18:10:32 2007 From: dmercer@REDACTED (David Mercer) Date: Thu, 19 Jul 2007 11:10:32 -0500 Subject: [erlang-questions] Troubleshooting using YAWS + SOAP In-Reply-To: <200707191719.31544.lcastro@udc.es> References: <200707161851.55933.lcastro@udc.es><200707171144.50497.lcastro@udc.es><407d9ef80707171245v3a481c1agac8c9fa685b6ac78@mail.gmail.com> <200707191719.31544.lcastro@udc.es> Message-ID: <00cf01c7ca1f$556f8f80$891ea8c0@SSI.CORP> This kind of email is excellent, describing the problem and explaining the solution. Thanks for sharing it with us. Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Laura M. Castro Souto Sent: Thursday, July 19, 2007 10:19 To: Willem de Jong Cc: Lista de Erlang Subject: Re: [erlang-questions] Troubleshooting using YAWS + SOAP Hello all, It seems that we finally found the source of the problem. In the end, it has something to do with yaws_soap_srv module, which is the genserver that was dying with the timeout error. And the reason was in front of our eyes all the time, as happens so many times. Let me explain it here for the record. Remember the "minimal" server that Willem posted in his mail? > -module(my_soap). > -export([handler/4]). > > -record('p:CodigoVO', {anyAttribs, 'etiqueta', 'valor'}). > -record('p:setParte', {anyAttribs, 'param0', 'param1', 'param2', 'param3', > 'param4', 'param5', 'param6'}). > -record('p:setParteResponse', {anyAttribs, 'return'}). > > handler(_Header, > [#'p:setParte'{'param0' = P0}], > _Action, > _SessionValue) -> > {ok, undefined, setParte(P0)}. > > setParte(P0) -> > CodigoVO = #'p:CodigoVO'{'etiqueta' = P0, 'valor' = 1}, > #'p:setParteResponse'{'return' = CodigoVO}. As Willem said, this server works out perfectly well, but this is just because is *that minimal*. The issue is that the operation being invoked through the web service (setParte) might not be *that simple*, meaning that it could potentially be a function that consumes some time to get its result. If "some time" is less than 5000 milliseconds, everything is fine. But what happens if it's not? Well, the yaws_soap_srv genserver dies. As simple as that. Why? Because whenever the gen_server:call function is used inside that module, its third optional parameter (Timeout) is never specified, thus assuming a default value (guess what: 5000 milliseconds). Check out the source code: handler(Args, Id, Payload, SessionValue) -> (...) case gen_server:call(?SERVER, {request, Id, Payload, SessionValue, SoapAction}) of {ok, XmlDoc, ResCode, undefined} -> {false, XmlDoc, ResCode}; {ok, XmlDoc, ResCode, SessVal} -> {true, 0, SessVal, XmlDoc, ResCode}; {error, _, _} = Error -> Error; false -> false end. So what we did is to add the third parameter to the gen_server:call function and now everything is working! handler(Args, Id, Payload, SessionValue) -> (...) case gen_server:call(?SERVER, {request, Id, Payload, SessionValue, SoapAction}, infinity) of {ok, XmlDoc, ResCode, undefined} -> {false, XmlDoc, ResCode}; {ok, XmlDoc, ResCode, SessVal} -> {true, 0, SessVal, XmlDoc, ResCode}; {error, _, _} = Error -> Error; false -> false end. I understand that an infinite timeout might not be reasonable in all cases, maybe even in most of the cases, but you will agree with me that the need for a timeout greather than 5000 might not be that strange... Perhaps, a general solution for this will be to let the client modules of yaws+soap configure that timeout option, maybe by means of another field in the gconf struct. Regards, -- Laura M. Castro MADS Group - Computer Science Department University of A Corunna http://www.madsgroup.org/staff/laura/index_en.html From tsuraan@REDACTED Thu Jul 19 19:18:03 2007 From: tsuraan@REDACTED (tsuraan) Date: Thu, 19 Jul 2007 12:18:03 -0500 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> Message-ID: <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> > Personally, I'll be pissed if I have to wait that long. I'm also quite > upset that I ordered it via the beta and haven't received a > notification of shipping or what carrier/tracking number it carries. > This is pretty amateurish, IMO. Not that I'm bashing Joe: the book is > great! About a week ago, pragprog sent me a mailing address confirmation email, but still no shipping info. Did you receive the address confirmation yet? -------------- next part -------------- An HTML attachment was scrubbed... URL: From codeslinger@REDACTED Thu Jul 19 19:45:53 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Thu, 19 Jul 2007 13:45:53 -0400 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> Message-ID: <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> On 7/19/07, tsuraan wrote: > About a week ago, pragprog sent me a mailing address confirmation email, but > still no shipping info. Did you receive the address confirmation yet? I did and I now rescind all the bad things I said about PragProg, as I just got finished ripping open the package with my copy of Programming Erlang in it ;-) Thanks, Joe! -- Toby DiPasquale From bent@REDACTED Thu Jul 19 19:49:57 2007 From: bent@REDACTED (Ben Munat) Date: Thu, 19 Jul 2007 07:49:57 -1000 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <00ce01c7ca1e$af303430$891ea8c0@SSI.CORP> References: <9b08084c0707190515m14543act5787819077eadcc6@mail.gmail.com> <400357.95714.qm@web38810.mail.mud.yahoo.com> <00ce01c7ca1e$af303430$891ea8c0@SSI.CORP> Message-ID: <469FA445.4070905@munat.com> Ooh, ooh... I've got it: "OTP is not a Telecom Platform". :-) Ben David Mercer wrote: >> So, my suggestion is (in the spirit of GNU >> inscrutability) "OTP Technical Platform". > > I love it! > > DBM > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From erlangx@REDACTED Thu Jul 19 21:12:00 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Thu, 19 Jul 2007 12:12:00 -0700 Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: <20070719191200.GT25952@delora.autosys.us> On Thu, Jul 19, 2007 at 01:32:58PM +0200, Daniel Luna wrote: > On Thu, 19 Jul 2007, Ludovic Coquelle wrote: > > Sorry for posting again this question, but I think there is something > > important to know and I can't figure out what. > > > > I run a command printing simple text on default io device (stdout): > > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > > end, lists:seq(1,5)), erlang:halt()." > > 1 > > 2 > > 3 > > 4 > > 5 > > > > That's the behaviour I expected. > > But if I try to pipe the result, erlang crash: > > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > > end, lists:seq(1,5)), erlang:halt()." | head -n 3 > > 1 > > 2 > > 3 > > Crash dump was written to: erl_crash.dump > > init terminating in do_boot () > > > > What's happening? > > Is it a normal behaviour? > > I was hoping someone else would answer, and thus didn't reply to your > first message. > > I'm not suprised at all, but my answer should still be taken with a grain > of salt. > > My guess is that 'head -n 3' will take the first three lines of output and > then kill the pipe. Erlang will be very upset about someone killing its > standard out, and thus crash (and of course the error message is written > to stderr and thus not caught by head). > > If it's ok that erlang crashes, you could pipe also stderr, otherwise I > recommend that you do the head thingie inside erlang. > > HTH > > /Luna ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ And, in fact, using 'head -n 7' succeeds, adding support for your analysis. My Ubuntu system, Linux delora 2.6.20-15-386 #2 Sun Apr 15 07:34:00 UTC 2007 i686 GNU/Linux using R11B-5, exhibits same crashing behaviour using 'head -n 3'. ~Michael From erlang@REDACTED Thu Jul 19 21:13:08 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 19 Jul 2007 21:13:08 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> Message-ID: <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> Ah - the first recorded copy - I still haven't seen it ... BTW - The Erlang book is now ranked #935 in the amazon sales lists it's in the top 1000 of all books! and #9 in computer science books. The rights have been sold for translations into Japanese, Chinese and Korean. /JOe On 7/19/07, Toby DiPasquale wrote: > On 7/19/07, tsuraan wrote: > > About a week ago, pragprog sent me a mailing address confirmation email, but > > still no shipping info. Did you receive the address confirmation yet? > > I did and I now rescind all the bad things I said about PragProg, as I > just got finished ripping open the package with my copy of Programming > Erlang in it ;-) Thanks, Joe! > > -- > Toby DiPasquale > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dunceor@REDACTED Thu Jul 19 21:58:22 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Thu, 19 Jul 2007 21:58:22 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> Message-ID: <5d84cb30707191258p4490c7bflf312d050cd8ad6e7@mail.gmail.com> That is awesome! Never though Erlang would be that big. Really cool! I will get my copy on monday the bookstore claimed so we'll see. On 7/19/07, Joe Armstrong wrote: > Ah - the first recorded copy - I still haven't seen it ... > > BTW - The Erlang book is now ranked #935 in the amazon sales lists > it's in the top 1000 of all books! and #9 in computer science books. > > The rights have been sold for translations into Japanese, Chinese and Korean. > > /JOe > > > On 7/19/07, Toby DiPasquale wrote: > > On 7/19/07, tsuraan wrote: > > > About a week ago, pragprog sent me a mailing address confirmation email, but > > > still no shipping info. Did you receive the address confirmation yet? > > > > I did and I now rescind all the bad things I said about PragProg, as I > > just got finished ripping open the package with my copy of Programming > > Erlang in it ;-) Thanks, Joe! > > > > -- > > Toby DiPasquale > > _______________________________________________ estions > From cyberlync@REDACTED Thu Jul 19 23:19:21 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 19 Jul 2007 14:19:21 -0700 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: <469F320F.664A.00DD.0@stgeorge.com.au> Message-ID: Regardless of what is decided on the name, Trap Exit shouldn't go off in it's own tangent. On 7/19/07, Niclas Eklund wrote: > > Hello! > > If you search the documentation you find stuff like net_adm:ping/1 pong | > pang, the Event Trace (E.T.) function et:phone_home/5: > > http://www.erlang.org/doc/man/et.html > > BTW, I noticed that on http://www.trapexit.org/ start page Telecom has > been replaced by Transaction. For example: > > "The Open Transaction Platform (OTP) is set of ..." > > Isn't it a bit confusing if we use different explanations of what the > OTP acronym stands for? > > /Nick > > On Thu, 19 Jul 2007, Anthony Kong wrote: > > > What about "Oh, That's Powerful!" :-) > > I think rebranding is usually a (meaningless) marketing exercise. > > Erlang excels by its technical merit and this alone has enough > > marketing power. OTP highlights where its heritage has come from and I > > think it is a good thing. > > For example, if you have read Joe's book, he mentioned about how > > Mnesia get her name: "The original name was Amnesia. One of our bosses > > didn't like the name. He said, "You can't possibly call it > > Amnesia*you can't have a database that forgets things!" So we > > dropped the A, and the name stuck." > > > > I cannot help laughing whenever i read this, > > This is this kind of little stories make erlange what it is today, I > > reckon. (+ other big technial/language design decision, of course) > > > > So, just keep OTP as it is, unless the same boss has something to say again > > (Actually I am too new to erlang to make comment as such, but that's > > just how I feel) > > > > Cheers, Anthony > > > > > > >>> "Mike Berrow" 19/07/2007 7:03 am >>> > > How about > > "Omnipotence Through Parallelism" > > > > -- Mike > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ********************************************************************** > > ***** IMPORTANT INFORMATION ***** > > This document should be read only by those persons to whom it is > > addressed and its content is not intended for use by any other > > persons. If you have received this message in error, please notify > > us immediately. Please also destroy and delete the message from > > your computer. Any unauthorised form of reproduction of this message > > is strictly prohibited. > > > > St.George Bank Limited AFSL 240997, Advance Asset Management Limited > > AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited > > AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for > > the proper and complete transmission of the information contained in > > this communication, nor for any delay in its receipt. > > ********************************************************************** > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlangx@REDACTED Thu Jul 19 23:29:20 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Thu, 19 Jul 2007 14:29:20 -0700 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> Message-ID: <20070719212920.GV25952@delora.autosys.us> Congratulations, Joe Armstrong - in the top ten, indeed ! ~Michael On Thu, Jul 19, 2007 at 09:13:08PM +0200, Joe Armstrong wrote: > Ah - the first recorded copy - I still haven't seen it ... > > BTW - The Erlang book is now ranked #935 in the amazon sales lists > it's in the top 1000 of all books! and #9 in computer science books. > > The rights have been sold for translations into Japanese, Chinese and Korean. > > /JOe > > > On 7/19/07, Toby DiPasquale wrote: > > On 7/19/07, tsuraan wrote: > > > About a week ago, pragprog sent me a mailing address confirmation email, but > > > still no shipping info. Did you receive the address confirmation yet? > > > > I did and I now rescind all the bad things I said about PragProg, as I > > just got finished ripping open the package with my copy of Programming > > Erlang in it ;-) Thanks, Joe! > > > > -- > > Toby DiPasquale > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,469fb98673321079616063! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From haoboy@REDACTED Thu Jul 19 23:10:52 2007 From: haoboy@REDACTED (Haobo Yu) Date: Thu, 19 Jul 2007 14:10:52 -0700 Subject: [erlang-questions] xmerl parsing of DTD Message-ID: Hi, I ran into a problem of parsing XML files with an external DTD. For example, the following XML file: Tove Jani Reminder Don't forget me this weekend! When parsed by xmerl 1.1.4, gives an error (I have t2.dtd in the same dir) ** exited: {{case_clause,{error,enoent}}, [{xmerl_scan,fetch_DTD,2}, {xmerl_scan,scan_doctype2,3}, {xmerl_scan,scan_prolog,3}, {xmerl_scan,scan_document,2}, {xmerl_scan,string,2}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** The test code is here: test_check_dtd() -> Xml = "\n \n\nTove\nJani\nReminder\nDon't forget me this weekend!\n\n", xmerl_scan:string(Xml, [{validation, off}]). I found that if I apply the attached patch to xmerl_scan.erl, which uncomments two lines that appear to prevent DTD loading if validation is off, it works fine. However, I don't know enough to tell what is the right patch. Would appreciate suggestions. Thanks. - Haobo --- /opt/local/lib/erlang/lib/xmerl-1.1.4/src/xmerl_scan.erl 2007-04-12 07:28:36.000000000 -0700 +++ xmerl_scan.erl 2007-07-19 11:21:11.000000000 -0700 @@ -715,6 +715,7 @@ ?dbg("prolog(\"<\")~n", []), %% Here we consider the DTD provided by doctype_DTD option, + io:format("~p~n", [S0]), S1 = case S0 of #xmerl_scanner{validation=dtd,doctype_DTD=DTD} when list (DTD) -> @@ -1202,8 +1203,8 @@ fetch_DTD({system,URI},S#xmerl_scanner {doctype_DTD=option_provided}); fetch_DTD(undefined, S) -> S; -% fetch_DTD(_,S=#xmerl_scanner{validation=false}) -> -% S; +fetch_DTD(_,S=#xmerl_scanner{validation=off}) -> + S; fetch_DTD(DTDSpec, S)-> case fetch_and_parse(DTDSpec,S,[{text_decl,true}, {environment, {external,subset}}]) of From hokan.stenholm@REDACTED Fri Jul 20 00:07:58 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 20 Jul 2007 00:07:58 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: <469F320F.664A.00DD.0@stgeorge.com.au> Message-ID: <469FE0BE.7040603@bredband.net> Eric Merritt wrote: > Regardless of what is decided on the name, Trap Exit shouldn't go off > in it's own tangent. > > That indeed is rather stupid, never mind that not even the Trapexit site can get it right (hint - the FAQ still says OTP = Open Telecom Platform). I agree that the current name is kind of bland and somewhat misleading but please choose a name that at least makes some kind of sense: * "Open Telecom Platform" - to narrow but at least historically accurate * "Open Transaction Platform" - is just plain confusing, is OTP some kind of database ? I rather like these: * "OTP is not a Telecom Platform" - recursive rewrite in the spirit of GNU * "OTP Technical Platform" - recursive definition for a recursive language * "Omnipotence Through Parallelism" - just plain silly :) Other choices may be: * "Open Technical Platform" - if you want to stick to the acronym * Erlang/OTP = Erlang develOpmenT Platform - creative acronym > On 7/19/07, Niclas Eklund wrote: > >> Hello! >> >> If you search the documentation you find stuff like net_adm:ping/1 pong | >> pang, the Event Trace (E.T.) function et:phone_home/5: >> >> http://www.erlang.org/doc/man/et.html >> >> BTW, I noticed that on http://www.trapexit.org/ start page Telecom has >> been replaced by Transaction. For example: >> >> "The Open Transaction Platform (OTP) is set of ..." >> >> Isn't it a bit confusing if we use different explanations of what the >> OTP acronym stands for? >> >> /Nick >> >> On Thu, 19 Jul 2007, Anthony Kong wrote: >> >> >>> What about "Oh, That's Powerful!" :-) >>> I think rebranding is usually a (meaningless) marketing exercise. >>> Erlang excels by its technical merit and this alone has enough >>> marketing power. OTP highlights where its heritage has come from and I >>> think it is a good thing. >>> For example, if you have read Joe's book, he mentioned about how >>> Mnesia get her name: "The original name was Amnesia. One of our bosses >>> didn't like the name. He said, "You can't possibly call it >>> Amnesia*you can't have a database that forgets things!" So we >>> dropped the A, and the name stuck." >>> >>> I cannot help laughing whenever i read this, >>> This is this kind of little stories make erlange what it is today, I >>> reckon. (+ other big technial/language design decision, of course) >>> >>> So, just keep OTP as it is, unless the same boss has something to say again >>> (Actually I am too new to erlang to make comment as such, but that's >>> just how I feel) >>> >>> Cheers, Anthony >>> >>> >>> >>>>>> "Mike Berrow" 19/07/2007 7:03 am >>> >>>>>> >>> How about >>> "Omnipotence Through Parallelism" >>> >>> -- Mike >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> ********************************************************************** >>> ***** IMPORTANT INFORMATION ***** >>> This document should be read only by those persons to whom it is >>> addressed and its content is not intended for use by any other >>> persons. If you have received this message in error, please notify >>> us immediately. Please also destroy and delete the message from >>> your computer. Any unauthorised form of reproduction of this message >>> is strictly prohibited. >>> >>> St.George Bank Limited AFSL 240997, Advance Asset Management Limited >>> AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited >>> AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for >>> the proper and complete transmission of the information contained in >>> this communication, nor for any delay in its receipt. >>> ********************************************************************** >>> >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From hokan.stenholm@REDACTED Fri Jul 20 00:25:36 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 20 Jul 2007 00:25:36 +0200 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <469FE0BE.7040603@bredband.net> References: <469F320F.664A.00DD.0@stgeorge.com.au> <469FE0BE.7040603@bredband.net> Message-ID: <469FE4E0.2070709@bredband.net> H?kan Stenholm wrote: > Eric Merritt wrote: > >> Regardless of what is decided on the name, Trap Exit shouldn't go off >> in it's own tangent. >> >> >> > That indeed is rather stupid, never mind that not even the Trapexit site can get > it right (hint - the FAQ still says OTP = Open Telecom Platform). > I just noticed that the FAQ isn't really part of the trapexit site (it's a erlang.org page), but the point still stands - using different names is plain confusing. > > I agree that the current name is kind of bland and somewhat misleading but please > choose a name that at least makes some kind of sense: > > * "Open Telecom Platform" - to narrow but at least historically accurate > * "Open Transaction Platform" - is just plain confusing, is OTP some kind of database ? > > > I rather like these: > > * "OTP is not a Telecom Platform" - recursive rewrite in the spirit of GNU > * "OTP Technical Platform" - recursive definition for a recursive language > * "Omnipotence Through Parallelism" - just plain silly :) > > > Other choices may be: > > * "Open Technical Platform" - if you want to stick to the acronym > * Erlang/OTP = Erlang develOpmenT Platform - creative acronym > > > > >> On 7/19/07, Niclas Eklund wrote: >> >> >>> Hello! >>> >>> If you search the documentation you find stuff like net_adm:ping/1 pong | >>> pang, the Event Trace (E.T.) function et:phone_home/5: >>> >>> http://www.erlang.org/doc/man/et.html >>> >>> BTW, I noticed that on http://www.trapexit.org/ start page Telecom has >>> been replaced by Transaction. For example: >>> >>> "The Open Transaction Platform (OTP) is set of ..." >>> >>> Isn't it a bit confusing if we use different explanations of what the >>> OTP acronym stands for? >>> >>> /Nick >>> >>> On Thu, 19 Jul 2007, Anthony Kong wrote: >>> >>> >>> >>>> What about "Oh, That's Powerful!" :-) >>>> I think rebranding is usually a (meaningless) marketing exercise. >>>> Erlang excels by its technical merit and this alone has enough >>>> marketing power. OTP highlights where its heritage has come from and I >>>> think it is a good thing. >>>> For example, if you have read Joe's book, he mentioned about how >>>> Mnesia get her name: "The original name was Amnesia. One of our bosses >>>> didn't like the name. He said, "You can't possibly call it >>>> Amnesia*you can't have a database that forgets things!" So we >>>> dropped the A, and the name stuck." >>>> >>>> I cannot help laughing whenever i read this, >>>> This is this kind of little stories make erlange what it is today, I >>>> reckon. (+ other big technial/language design decision, of course) >>>> >>>> So, just keep OTP as it is, unless the same boss has something to say again >>>> (Actually I am too new to erlang to make comment as such, but that's >>>> just how I feel) >>>> >>>> Cheers, Anthony >>>> >>>> >>>> >>>> >>>>>>> "Mike Berrow" 19/07/2007 7:03 am >>> >>>>>>> >>>>>>> >>>> How about >>>> "Omnipotence Through Parallelism" >>>> >>>> -- Mike >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >>>> ********************************************************************** >>>> ***** IMPORTANT INFORMATION ***** >>>> This document should be read only by those persons to whom it is >>>> addressed and its content is not intended for use by any other >>>> persons. If you have received this message in error, please notify >>>> us immediately. Please also destroy and delete the message from >>>> your computer. Any unauthorised form of reproduction of this message >>>> is strictly prohibited. >>>> >>>> St.George Bank Limited AFSL 240997, Advance Asset Management Limited >>>> AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited >>>> AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for >>>> the proper and complete transmission of the information contained in >>>> this communication, nor for any delay in its receipt. >>>> ********************************************************************** >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://www.erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From 0x6e6562@REDACTED Fri Jul 20 00:42:05 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Thu, 19 Jul 2007 23:42:05 +0100 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <20070719212920.GV25952@delora.autosys.us> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <20070719212920.GV25952@delora.autosys.us> Message-ID: <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> Great book, Joe, really well written and to the point......are there any plans to write a book about advanced Erlang topics (nothing in particular, but something that assumes prior experience with Erlang, or maybe something about how not to code in Erlang )? Ben From joelr1@REDACTED Fri Jul 20 00:57:19 2007 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 19 Jul 2007 23:57:19 +0100 Subject: [erlang-questions] Operating on remote replicas Message-ID: <747E2C8F-BA64-4ABE-B729-C9AA6ED6B7DA@gmail.com> Suppose I have a node with a bunch of tables and I point another node to it with extra_db_nodes. The new node will see the schema of the first node but will not have local replicas unless added with mnesia:add_table_copy/3. Still, I can read from and write to these remote tables as if they were local. Is this by design? Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From brad@REDACTED Thu Jul 19 19:49:37 2007 From: brad@REDACTED (Brad Anderson) Date: Thu, 19 Jul 2007 13:49:37 -0400 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> Message-ID: <469FA431.9090600@sankatygroup.com> Toby DiPasquale wrote: > On 7/19/07, Karl Sj?dahl - dunceor wrote: >> Well amazon.de says 31 july. >> http://www.amazon.de/Programming-Erlang-Software-Concurrent-World/dp/193435600X >> >> So that is probobly a good guess. > > Personally, I'll be pissed if I have to wait that long. I'm also quite > upset that I ordered it via the beta and haven't received a > notification of shipping or what carrier/tracking number it carries. > This is pretty amateurish, IMO. Not that I'm bashing Joe: the book is > great! > I received mine to day in Atlanta, GA, USA. It came via USPS mail, no tracking information. BA From christopher@REDACTED Fri Jul 20 01:21:48 2007 From: christopher@REDACTED (Christopher Baus) Date: Thu, 19 Jul 2007 16:21:48 -0700 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <469FA431.9090600@sankatygroup.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <469FA431.9090600@sankatygroup.com> Message-ID: <469FF20C.1060605@baus.net> > > I received mine to day in Atlanta, GA, USA. It came via USPS mail, no > tracking information. Uh oh. I can't receive USPS mail at the address I provided them. Chris From ulf.wiger@REDACTED Fri Jul 20 02:03:21 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 20 Jul 2007 02:03:21 +0200 Subject: [erlang-questions] Operating on remote replicas In-Reply-To: <747E2C8F-BA64-4ABE-B729-C9AA6ED6B7DA@gmail.com> References: <747E2C8F-BA64-4ABE-B729-C9AA6ED6B7DA@gmail.com> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155024DE500@esealmw115.eemea.ericsson.se> Joel Reymont wrote: > > Suppose I have a node with a bunch of tables and I point > another node to it with extra_db_nodes. The new node will see > the schema of the first node but will not have local replicas > unless added with mnesia:add_table_copy/3. > > Still, I can read from and write to these remote tables as if > they were local. Is this by design? Yep. >From the User's Guide, chapter 1.2.1 (Features): "Table locations are transparent to the programmer. Programs address table names and the system itself keeps track of table locations." The most common way of dealing with extra_db_nodes is to not give them local replicas, but if you want to, you can, of course (and as far as I recall, AXD 301 does it sometimes.) It's not necessary in order to access the data, but does speed up read access (but slows down write access due to increased replication overhead.) BR, Ulf W From joelr1@REDACTED Fri Jul 20 02:42:47 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 20 Jul 2007 01:42:47 +0100 Subject: [erlang-questions] Amazon S3: Now with locking, transactions and caching Message-ID: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> Folks, This is a status update on what I've been working for the past few weeks. You are probably well aware that Amazon S3 provides unlimited scalability but does not have locking and transactions. There's also a delay between the time when data is written to S3 and when it becomes available for reading. I tried several approaches but the best one turned out to be one of hacking Mnesia internals to add s3_copies as a table type. I started from scratch, as opposed to building up on Ulf Wiger's RDBMS but I doubt I could have done it without reading the RDBMS code and asking lots of questions, all of which Uffe was kind enough to asnwer. Hacking Mnesia turned out to be a veritable pain in the rear as I had to touch most of the modules, including today's extensive modding session with mnesia_loader.erl. I will also need to apply the changes to any upcoming releases of Mnesia. I would say it was worth it, though, as I now can - lock S3 buckets or "records" using {Bucket, Key} - update several S3 records in a single transaction - set up additional s3_copies replicas using mnesia:add_table_copy/3 - ensure that data is only written to S3 once - have a large cluster of Yaws nodes use a small cluster of "master" Mnesia nodes with s3_copies replicas, thus keeping replication and transaction costs down. I also coupled the virtual S3 table with a fixed-size cache that is built on top of a regular Mnesia table. All writes go trough the cache, which ensures that hot data is available immediately. So long as the cache API is used, any cache misses are automatically redirected to S3. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From christopher@REDACTED Fri Jul 20 03:41:45 2007 From: christopher@REDACTED (Christopher Baus) Date: Thu, 19 Jul 2007 18:41:45 -0700 (PDT) Subject: [erlang-questions] Amazon S3: Now with locking, transactions and caching In-Reply-To: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> References: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> Message-ID: <58305.12.146.21.162.1184895705.squirrel@webmail.tuffmail.net> > I also coupled the virtual S3 table with a fixed-size cache that is > built on top of a regular Mnesia table. All writes go trough the > cache, which ensures that hot data is available immediately. So long > as the cache API is used, any cache misses are automatically > redirected to S3. So all writes are written directly to S3? Are you putting each write into a separate object? I've been doing some research into using S3 as a general purpose data store which lead me to mnesia and erlang. It seems to me that the limiting factor is the transactional costs per write. I thought not being able to do record appends was a real deal killer for more structured data stores, but it sounds like you've figured out some way around this. I'd love to hear more about this. Chris From erlang@REDACTED Fri Jul 20 09:29:20 2007 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 20 Jul 2007 09:29:20 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <20070719212920.GV25952@delora.autosys.us> <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> Message-ID: <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> My original chapter plan was a lot more ambitious - at one stage I thought about calling this "volume 1" I certainly have enough material for a second volume ; What I would like to encourage are other people to write Erlang books, especially covering the applications. Assuming a ruby-like spreading model about one year from now we might see a new wave of Erlang applications. The book introduces a new audience to Erlang. It takes six moths to read the book and get proficient Six moths to write a decent app and get it spread. Things like "Erlang on rails" should therefore come out in about a year. So please, guy, get your pens out - there are books to be written - yaws - ejabberd - mnesia BTW - I see this as part of a "new wave" Erlang will not succeed on it's own - people have to invest a significant amount of effort in learning FP - if this can be amortized over several languages then things become a lot easier. I see Erlang + Haskell + OCaml as a collection of languages with similar roots. They are all based on the lambda calculus and don't have mutable data. This way of thinking is strange at first - since you have to learn to program without side-effects (or at least with minimal side effects) - these three languages differ in interpretation (strong/dynamic types) (lazy/eager evaluation) but lambda calculus is not about types or evaluation strategies. An erlang book all by itself in a bookshop will get rather lonely. I want to see an entire shelf full of Erlang/Haskell/OCaml books *and their applications* Only then will we have a realistic alternative to Java/C++/C# or python/ruby/perl If we want to challenge OOPs then it must be through the concerted efforts of an entire school of languages. So Guys - sharpen your pencils! /Joe On 7/20/07, Ben Hood <0x6e6562@REDACTED> wrote: > Great book, Joe, really well written and to the point......are there > any plans to write a book about advanced Erlang topics (nothing in > particular, but something that assumes prior experience with Erlang, > or maybe something about how not to code in Erlang )? > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmitriid@REDACTED Fri Jul 20 09:54:57 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Fri, 20 Jul 2007 10:54:57 +0300 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <5d84cb30707191258p4490c7bflf312d050cd8ad6e7@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <5d84cb30707191258p4490c7bflf312d050cd8ad6e7@mail.gmail.com> Message-ID: <46A06A51.6070903@gmail.com> >> The rights have been sold for translations into Japanese, Chinese and Korean. >> I wish it were translated into Russian as well... From me@REDACTED Fri Jul 20 10:07:03 2007 From: me@REDACTED (KatolaZ) Date: Fri, 20 Jul 2007 10:07:03 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <20070719212920.GV25952@delora.autosys.us> <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> Message-ID: <20070720080703.GA5187@katolaz.homeunix.net> On Fri, Jul 20, 2007 at 09:29:20AM +0200, Joe Armstrong wrote: > > I see Erlang + Haskell + OCaml as a collection of languages with similar roots. > They are all based on the lambda calculus and don't have mutable data. This way > of thinking is strange at first - since you have to learn to program > without side-effects > (or at least with minimal side effects) - these three languages differ > in interpretation > (strong/dynamic types) (lazy/eager evaluation) but lambda calculus is > not about types > or evaluation strategies. > > An erlang book all by itself in a bookshop will get rather lonely. > > I want to see an entire shelf full of Erlang/Haskell/OCaml books *and > their applications* > Only then will we have a realistic alternative to Java/C++/C# or > python/ruby/perl > > If we want to challenge OOPs then it must be through the concerted efforts of an > entire school of languages. I totally agree with you, joe. It is not simply a matter of pushing Erlang/OTP. A deeper change of minds is requested in order to get people writing faster, cleaner, simpler, smarter and cooler code. And what I call "The functional way" is more or less your point of view: we need to show people that THOSE languages (mainly Erlang/Haskell/OCaml) are not just suitable for academic purposes, but can really and effectively change the way of writing, debugging, refactoring code. More books explaining this (indeed not so) new paradigm should be written, explaining coders and hackers how to spend less time, less efforts and less pains obtaining better code and/or getting more fun, and explaining software farms that Java/C#/C++ are not the best solution all the way. I'm actually not able to write any chapter of such books, since I've still a lot to learn about those languages and platforms, but many gurus here could start such a project, and should do so. Waterstone's have full shelves of Java and C# books, and less than ten books about functional languages, the majority of them being really old..... It's too few. HND Enzo -- [ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ] [ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ] [ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ] [ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ] From joelr1@REDACTED Fri Jul 20 12:16:16 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 20 Jul 2007 11:16:16 +0100 Subject: [erlang-questions] Amazon S3: Now with locking, transactions and caching In-Reply-To: <58305.12.146.21.162.1184895705.squirrel@webmail.tuffmail.net> References: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> <58305.12.146.21.162.1184895705.squirrel@webmail.tuffmail.net> Message-ID: On Jul 20, 2007, at 2:41 AM, Christopher Baus wrote: > So all writes are written directly to S3? Correct. > Are you putting each write into a separate object? Not sure what you mean. Each object is identified by a combination of bucket and key, just like in S3. > It seems to me that the limiting factor is the transactional costs > per write. There will always be a cost per write. You could minimize it by syncing the cache with S3 periodically but ... why bother? You are saving the cost per read for sure, at least for cached items. > I thought not being able to do record appends was a real deal > killer for > more structured data stores, but it sounds like you've figured out > some > way around this. Not really. Read, append, put back. I don't see a problem. Joel -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From adam@REDACTED Fri Jul 20 12:42:25 2007 From: adam@REDACTED (Adam Lindberg) Date: Fri, 20 Jul 2007 12:42:25 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: References: Message-ID: <6344005f0707200342r5a2adc90s492cb2f2da930960@mail.gmail.com> I'll be there too! Should be plenty of Erlang hackers here in Stockholm? Come on guys! Cheers! Adam On 7/19/07, Torbjorn Tornkvist wrote: > > > A great initiative! > > May I just add that this event has been initiated via the > #erlang channel at irc.freenode.net. So all you oldtimers > (you know who you are :-), its time to join in on the channel > from time to time. > > Currently the #erlang channel has, constantly, around 100 > members but is rather silent. This can be compared to > the #haskell channel which have around 350 people with a > 24h (it seems) discussion going on. > > Cheers, Tobbe > (Ps. I'll be at the ErlLounge of course) > > Christian S wrote: > > Place: O'Learys sports bar, Stockholm Centralstation > > Time: 17:00-ish > > > > *** If you want to show up, please send me a private mail so I know > > how many we will be for, if necessary, table reservation. *** > > > > Though, my information source tells me there are no soccer games > > drawing people to sports bars on Tuesday. > > > > Location is chosen as a convenience for the Erlang fans living in > Uppsala. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Fri Jul 20 13:22:41 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 20 Jul 2007 12:22:41 +0100 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: <469F320F.664A.00DD.0@stgeorge.com.au> Message-ID: <46A09B01.2000500@erlang-consulting.com> Eric Merritt wrote: > Regardless of what is decided on the name, Trap Exit shouldn't go off > in it's own tangent. *We haven't*. It clearly states in the first forum post that we did it to provoke a reaction and see what the Erlang community thinks, and that any ultimate decision is not ours, not the community, but Ericsson's. This reaction has now occurred. I will put together the feedback later today. Cheers, Francesco PS. Love some of the suggestions :-) From christopher@REDACTED Fri Jul 20 13:48:18 2007 From: christopher@REDACTED (Christopher Baus) Date: Fri, 20 Jul 2007 04:48:18 -0700 (PDT) Subject: [erlang-questions] Amazon S3: Now with locking, transactions and caching In-Reply-To: References: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> <58305.12.146.21.162.1184895705.squirrel@webmail.tuffmail.net> Message-ID: <49268.24.180.39.173.1184932098.squirrel@webmail.tuffmail.net> > There will always be a cost per write. You could minimize it by > syncing the cache with S3 periodically but ... why bother? You are > saving the cost per read for sure, at least for cached items. Out of curiosity, how big are your writes? $0.01 per 1000 writes isn't exactly dirt cheap. I've been wondering if S3 could be used for a high frequency site like Twitter. http://baus.net/s3-twitter-back-of-napkin But even at 1000 writes/second you are starting to put some serious money in Jeff Bezo's pocket. From christophe.romain@REDACTED Fri Jul 20 14:01:33 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Fri, 20 Jul 2007 14:01:33 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <20070719212920.GV25952@delora.autosys.us> <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> Message-ID: On 20 juil. 07, at 09:29, Joe Armstrong wrote: > I want to see an entire shelf full of Erlang/Haskell/OCaml books ;-) Functional, generic and object-oriented programming An introduction with OCaml http://dept-info.labri.u-bordeaux.fr/~narbel/PFGO/ OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/ From chsu79@REDACTED Fri Jul 20 14:13:16 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 20 Jul 2007 14:13:16 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: References: <6344005f0707200342r5a2adc90s492cb2f2da930960@mail.gmail.com> Message-ID: 2007/7/20, Adam Lindberg : > Should be plenty of Erlang hackers here in Stockholm? Come on guys! Including you and me, there is now seven participants. Plus two additional maybes. We will vary from the famous of the famous Erlang hackers to, well... me. :) From joelr1@REDACTED Fri Jul 20 13:51:53 2007 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 20 Jul 2007 12:51:53 +0100 Subject: [erlang-questions] Amazon S3: Now with locking, transactions and caching In-Reply-To: <49268.24.180.39.173.1184932098.squirrel@webmail.tuffmail.net> References: <8E7799D1-5FE6-43BF-BD13-517C3B277D9F@gmail.com> <58305.12.146.21.162.1184895705.squirrel@webmail.tuffmail.net> <49268.24.180.39.173.1184932098.squirrel@webmail.tuffmail.net> Message-ID: <38B0B473-8304-4D0C-9F7B-FE820C80DAA8@gmail.com> On Jul 20, 2007, at 12:48 PM, Christopher Baus wrote: > Out of curiosity, how big are your writes? $0.01 per 1000 writes > isn't > exactly dirt cheap. I have no idea. The startup I did this for is, apparently, not very concerned with the cost of writes. -- http://topdog.cc - EasyLanguage to C# compiler http://wagerlabs.com - Blog From roger.larsson@REDACTED Thu Jul 19 12:22:46 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 19 Jul 2007 12:22:46 +0200 Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: <200707191222.46625.roger.larsson@norran.net> On Thursday 19 July 2007 11:16, Ludovic Coquelle wrote: > - - - > That's the behaviour I expected. > But if I try to pipe the result, erlang crash: > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." | head -n 3 > 1 > 2 > 3 > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > What's happening? To see this you need to have core file size != 0 bash> ulimit -c 1000 My guess: When head has received three values it exits. (try with "tail -n 3", it works) This cause the pipe (stdout) to terminate. Erlang misinterprets this as an abnormal situation and dumps core. > Is it a normal behaviour? Maybe. But I rewrote it and tried to run it as a script --------------- #!/usr/bin/env escript %% -*- erlang -*- main([]) -> lists:foreach(fun(N) -> io:format("~w~n", [N]) end, lists:seq(1,5)). ------------------ And it still dumps core - not OK! /RogerL From roger.larsson@REDACTED Thu Jul 19 21:43:43 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 19 Jul 2007 21:43:43 +0200 Subject: [erlang-questions] Erlang VM crashed due to io output? In-Reply-To: References: Message-ID: <200707192143.43476.roger.larsson@norran.net> Resending this since it has not appeared on the list... (This time with CC to reporter and Torbj?rn about how to reproduce) /RogerL On Thursday 19 July 2007 11:16, Ludovic Coquelle wrote: > - - - > That's the behaviour I expected. > But if I try to pipe the result, erlang crash: > bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N]) > end, lists:seq(1,5)), erlang:halt()." | head -n 3 > 1 > 2 > 3 > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > What's happening? To see this you need to have core file size != 0 bash> ulimit -c 1000 My guess: When head has received three values it exits. (try with "tail -n 3", it works) This cause the pipe (stdout) to terminate. Erlang misinterprets this as an abnormal situation and dumps core. > Is it a normal behaviour? Maybe. But I rewrote it and tried to run it as a script --------------- #!/usr/bin/env escript %% -*- erlang -*- main([]) -> lists:foreach(fun(N) -> io:format("~w~n", [N]) end, lists:seq(1,5)). ------------------ And it still dumps core - not OK! /RogerL From nick@REDACTED Fri Jul 20 15:11:54 2007 From: nick@REDACTED (Niclas Eklund) Date: Fri, 20 Jul 2007 15:11:54 +0200 (MEST) Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <46A09B01.2000500@erlang-consulting.com> Message-ID: Hello! Since, for example, the article in Dr.Dobbs, posted by Tobbe, refers to www.erlang.org and www.trapexit.org, it might attract new people (http://ddj.com/dept/opensource/201001928?cid=RSSfeed_DDJ_OpenSource) and they might not read that thread. But they will for sure read what's on the start page: "What is Erlang and OTP? Erlang is a programming language and a runtime system with strong built-in support for concurrency, distribution and fault tolerance. Originally developed at Ericsson, Erlang was released as open source in 1998. The Open Transaction Platform (OTP) is set of Erlang libraries and design principles providing middle-ware to develop distributed, fault tolerant, massively concurrent soft real-time systems." IMHO, that might be confusing. /Niclas On Fri, 20 Jul 2007, Francesco Cesarini wrote: > Eric Merritt wrote: > > Regardless of what is decided on the name, Trap Exit shouldn't go off > > in it's own tangent. > *We haven't*. It clearly states in the first forum post that we did it > to provoke a reaction and see what the Erlang community thinks, and that > any ultimate decision is not ours, not the community, but Ericsson's. > This reaction has now occurred. I will put together the feedback later > today. > > Cheers, > Francesco > > PS. Love some of the suggestions :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From rprice@REDACTED Fri Jul 20 15:42:23 2007 From: rprice@REDACTED (Roger Price) Date: Fri, 20 Jul 2007 15:42:23 +0200 (CEST) Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <84fb38e30707191018v7a10f3e7n37c88a78a75a52e9@mail.gmail.com> <876ef97a0707191045s301e750al4618e383c5a00955@mail.gmail.com> <9b08084c0707191213w6d649ffel1ff8d8fbcafa48d4@mail.gmail.com> <20070719212920.GV25952@delora.autosys.us> <269388e30707191542t1b89b752xe773b65c8add1690@mail.gmail.com> <9b08084c0707200029s1061b3bfj304555c25c83d3f@mail.gmail.com> Message-ID: On Fri, 20 Jul 2007, Joe Armstrong wrote: > I see Erlang + Haskell + OCaml as a collection of languages with similar roots. It might be more attractive to say "Erlang + Haskell + the ML family". That includes a lot more people who believe in the virtues of typed functional programming. Roger Price From francesco@REDACTED Fri Jul 20 15:57:49 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 20 Jul 2007 14:57:49 +0100 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: Message-ID: <46A0BF5D.2000809@erlang-consulting.com> Hi, I agree, but think it is just as confusing as having Telecom in there... What is in bold and we have not changed, however, is OTP. We will change it back when this debate comes to an end. As mentioned, I want to summarize all the comments as soon as I have a second over. Francesco PS. The Dr. Dobbs article is generating about 200 unique users a day, bringing the average number of unique users to the site to about 500. Thanks to the reddit effect on all the new articles, tutorials, how tos, we've had a constant influx of 400 - 500 users a day, 50% of which are returning ones. Niclas Eklund wrote: > Hello! > > Since, for example, the article in Dr.Dobbs, posted by Tobbe, refers to > www.erlang.org and www.trapexit.org, it might attract new people > (http://ddj.com/dept/opensource/201001928?cid=RSSfeed_DDJ_OpenSource) and > they might not read that thread. But they will for sure read what's on the > start page: > > "What is Erlang and OTP? > > Erlang is a programming language and a runtime system with strong > built-in support for concurrency, distribution and fault tolerance. > Originally developed at Ericsson, Erlang was released as open source in > 1998. > > The Open Transaction Platform (OTP) is set of Erlang libraries and design > principles providing middle-ware to develop distributed, fault tolerant, > massively concurrent soft real-time systems." > > IMHO, that might be confusing. > > /Niclas > > > > On Fri, 20 Jul 2007, Francesco Cesarini wrote: > > >> Eric Merritt wrote: >> >>> Regardless of what is decided on the name, Trap Exit shouldn't go off >>> in it's own tangent. >>> >> *We haven't*. It clearly states in the first forum post that we did it >> to provoke a reaction and see what the Erlang community thinks, and that >> any ultimate decision is not ours, not the community, but Ericsson's. >> This reaction has now occurred. I will put together the feedback later >> today. >> >> Cheers, >> Francesco >> >> PS. Love some of the suggestions :-) >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > > > > From tobbe@REDACTED Fri Jul 20 18:40:10 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 20 Jul 2007 18:40:10 +0200 Subject: [erlang-questions] core erlang ? In-Reply-To: <46936D19.9040703@it.uu.se> References: <46936D19.9040703@it.uu.se> Message-ID: <46A0E56A.5020706@tornkvist.org> I found the nice erlc switches +to_core and +from_core. However, I get compiler error with +from_core using the included program: $ erlc +to_core add.erl $ erlc +from_core add.core ./add.core:13: syntax error before: LITERAL $ cat add.erl -module(add). -export([add/0,add/1,add/2]). add() -> fun(X) -> add(X) end. add(X) -> fun(Y) -> add(X,Y) end. add(X,Y) -> X+Y. Any ideas on what's going wrong ? Cheers, Tobbe Richard Carlsson wrote: > Torbjorn Tornkvist wrote: >> Is is possible to make the compiler to output the >> Core Erlang for inspection somehow ? >> >> Also, is it possible to inject some Core Erlang into >> the compiler for compilation ? >> >> Are there a nice API for this? > > Yes, there are (undocumented) compiler options "to_core" and > "from_core". Look around in lib/compiler/compile.erl for details. > > /Richard > From chris.newcombe@REDACTED Fri Jul 20 18:38:33 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Fri, 20 Jul 2007 09:38:33 -0700 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45F11261.60003@ericsson.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F11261.60003@ericsson.com> Message-ID: <781dd98c0707200938p474f2af3ofd9fab1f8ec0f406@mail.gmail.com> A while back I asked about compiling code on the fly from a string. Mats Cronqvist kindly posted some working code. On 3/9/07, Mats Cronqvist wrote: > btw, i would appreciate if you feed back your improvements. I forgot to post my changes at the time, so here they are now. I didn't add very much, but it does now support -include directives, and supports at least one more type of macro usage. Caveat Emptor: the -include support (and macro expansion) does not yet detect/prevent cycles; it will spin until it exhausts memory. This is obviously fairly easy to fix, but I couldn't justify the time to enhance this any more than I absolutely needed. Also I didn't finish support for standard macros like ?FILE, ?MODULE, etc. There is some support for ?LINE but it's mostly untested (e.g. I didn't check that it behaves correctly in included files). So it's far from complete, but it is still pretty useful. Chris %%%------------------------------------------------------------------- %%% File : compile_module_from_string.erl %%% Description : %%% %%% TODO %%% - add support for %%% limit include-file depth (and prevent circular references) %%% prevent circular macro expansion %%% set FILE correctly when -module() is found %%% -include_lib %%% support $ENVVAR in include filenames %%% substitute-stringize (??MACRO) %%% -undef/-ifdef/-ifndef/-else/-endif %%% -file(File, Line) %%%------------------------------------------------------------------- -module(compile_module_from_string). %% API -export([compile/1, compile/2, % takes Options as for compile:forms/2 test/0]). -import(lists,[reverse/1,keyreplace/4]). %%==================================================================== %% API %%==================================================================== %%-------------------------------------------------------------------- %% Function: %% Description: %% Returns a binary that can be used with %% code:load_binary(Module, ModuleFilenameForInternalRecords, Binary). %%-------------------------------------------------------------------- compile(CodeStr) -> compile(CodeStr, []). compile(CodeStr, CompileFormsOptions) -> %% Initialise the macro dictionary with the default predefined macros, %% (adapted from epp.erl:predef_macros/1 Filename = "compiled_from_string", %%Machine = list_to_atom(erlang:system_info(machine)), Ms0 = dict:new(), %% Ms1 = dict:store('FILE', {[], "compiled_from_string"}, Ms0), %% Ms2 = dict:store('LINE', {[], 1}, Ms1), % actually we might add special code for this %% Ms3 = dict:store('MODULE', {[], undefined}, Ms2), %% Ms4 = dict:store('MODULE_STRING', {[], undefined}, Ms3), %% Ms5 = dict:store('MACHINE', {[], Machine}, Ms4), %% InitMD = dict:store(Machine, {[], true}, Ms5), InitMD = Ms0, %% From the docs for compile:forms: %% When encountering an -include or -include_dir directive, the compiler searches for header files in the following directories: %% 1. ".", the current working directory of the file server; %% 2. the base name of the compiled file; %% 3. the directories specified using the i option. The directory specified last is searched first. %% In this case, #2 is meaningless. IncludeSearchPath = ["." | reverse([Dir || {i, Dir} <- CompileFormsOptions])], {RevForms, _OutMacroDict} = scan_and_parse(CodeStr, Filename, 1, [], InitMD, IncludeSearchPath), Forms = reverse(RevForms), %% note: 'binary' is forced as an implicit option, whether it is provided or not. case compile:forms(Forms, CompileFormsOptions) of {ok, ModuleName, CompiledCodeBinary} when is_binary(CompiledCodeBinary) -> {ModuleName, CompiledCodeBinary}; {ok, ModuleName, CompiledCodeBinary, []} when is_binary(CompiledCodeBinary) -> % empty warnings list {ModuleName, CompiledCodeBinary}; {ok, _ModuleName, _CompiledCodeBinary, Warnings} -> throw({?MODULE, warnings, Warnings}); Other -> throw({?MODULE, compile_forms, Other}) end. %%==================================================================== %% Internal functions %%==================================================================== %%% Code from Mats Cronqvist %%% See http://www.erlang.org/pipermail/erlang-questions/2007-March/025507.html %%%## 'scan_and_parse' %%% %%% basically we call the OTP scanner and parser (erl_scan and %%% erl_parse) line-by-line, but check each scanned line for (or %%% definitions of) macros before parsing. %% returns {ReverseForms, FinalMacroDict} scan_and_parse([], _CurrFilename, _CurrLine, RevForms, MacroDict, _IncludeSearchPath) -> {RevForms, MacroDict}; scan_and_parse(RemainingText, CurrFilename, CurrLine, RevForms, MacroDict, IncludeSearchPath) -> case scanner(RemainingText, CurrLine, MacroDict) of {tokens, NLine, NRemainingText, Toks} -> {ok, Form} = erl_parse:parse_form(Toks), scan_and_parse(NRemainingText, CurrFilename, NLine, [Form | RevForms], MacroDict, IncludeSearchPath); {macro, NLine, NRemainingText, NMacroDict} -> scan_and_parse(NRemainingText, CurrFilename, NLine, RevForms, NMacroDict, IncludeSearchPath); {include, NLine, NRemainingText, IncludeFilename} -> IncludeFileRemainingTextents = read_include_file(IncludeFilename, IncludeSearchPath), %%io:format("include file ~p contents: ~n ~p~nRemainingText = ~p~n", [IncludeFilename, IncludeFileRemainingTextents, RemainingText]), %% Modify the FILE macro to reflect the filename %%IncludeMacroDict = dict:store('FILE', {[],IncludeFilename}, MacroDict), IncludeMacroDict = MacroDict, %% Process the header file (inc. any nested header files) {RevIncludeForms, IncludedMacroDict} = scan_and_parse(IncludeFileRemainingTextents, IncludeFilename, 1, [], IncludeMacroDict, IncludeSearchPath), %io:format("include file results = ~p~n", [R]), %% Restore the FILE macro in the NEW MacroDict (so we keep any macros defined in the header file) %%NMacroDict = dict:store('FILE', {[],CurrFilename}, IncludedMacroDict), NMacroDict = IncludedMacroDict, %% Continue with the original file scan_and_parse(NRemainingText, CurrFilename, NLine, RevIncludeForms ++ RevForms, NMacroDict, IncludeSearchPath); done -> scan_and_parse([], CurrFilename, CurrLine, RevForms, MacroDict, IncludeSearchPath) end. scanner(Text, Line, MacroDict) -> case erl_scan:tokens([],Text,Line) of {done, {ok,Toks,NLine}, LeftOverChars} -> case pre_proc(Toks, MacroDict) of {tokens, NToks} -> {tokens, NLine, LeftOverChars, NToks}; {macro, NMacroDict} -> {macro, NLine, LeftOverChars, NMacroDict}; {include, Filename} -> {include, NLine, LeftOverChars, Filename} end; {more, _Continuation} -> %% This is supposed to mean "term is not yet complete" (i.e. a '.' has %% not been reached yet). %% However, for some bizarre reason we also get this if there is a comment after the final '.' in a file. %% So we check to see if Text only consists of comments. case is_only_comments(Text) of true -> done; false -> throw({incomplete_term, Text, Line}) end end. is_only_comments(Text) -> is_only_comments(Text, not_in_comment). is_only_comments([], _) -> true; is_only_comments([$ |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment is_only_comments([$\t |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment is_only_comments([$\n |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment is_only_comments([$% |T], not_in_comment) -> is_only_comments(T, in_comment); % found start of a comment is_only_comments(_, not_in_comment) -> false; % found any significant char NOT in a comment is_only_comments([$\n |T], in_comment) -> is_only_comments(T, not_in_comment); % found end of a comment is_only_comments([_ |T], in_comment) -> is_only_comments(T, in_comment). % skipping over in-comment chars %%%## 'pre-proc' %%% %%% have to implement a subset of the pre-processor, since epp insists %%% on running on a file. %%% only handles 2 cases; %% -define(MACRO, something). %% -define(MACRO(VAR1,VARN),{stuff,VAR1,more,stuff,VARN,extra,stuff}). pre_proc([{'-',_},{atom,_,define},{'(',_},{_,_,Name}|DefToks],MacroDict) -> false = dict:is_key(Name, MacroDict), case DefToks of [{',',_} | Macro] -> {macro, dict:store(Name, {[], macro_body_def(Macro, [])}, MacroDict)}; [{'(',_} | Macro] -> {macro, dict:store(Name, macro_params_body_def(Macro, []), MacroDict)} end; pre_proc([{'-',_}, {atom,_,include}, {'(',_}, {string,_,Filename}, {')',_}, {dot,_}], _MacroDict) -> {include, Filename}; pre_proc(Toks,MacroDict) -> {tokens, subst_macros(Toks, MacroDict)}. macro_params_body_def([{')',_},{',',_} | Toks], RevParams) -> {reverse(RevParams), macro_body_def(Toks, [])}; macro_params_body_def([{var,_,Param} | Toks], RevParams) -> macro_params_body_def(Toks, [Param | RevParams]); macro_params_body_def([{',',_}, {var,_,Param} | Toks], RevParams) -> macro_params_body_def(Toks, [Param | RevParams]). macro_body_def([{')',_}, {dot,_}], RevMacroBodyToks) -> reverse(RevMacroBodyToks); macro_body_def([Tok|Toks], RevMacroBodyToks) -> macro_body_def(Toks, [Tok | RevMacroBodyToks]). subst_macros(Toks, MacroDict) -> reverse(subst_macros_rev(Toks, MacroDict, [])). %% returns a reversed list of tokes subst_macros_rev([{'?',_}, {_,LineNum,'LINE'} | Toks], MacroDict, RevOutToks) -> %% special-case for ?LINE, to avoid creating a new MacroDict for every line in the source file subst_macros_rev(Toks, MacroDict, [{integer,LineNum,LineNum}] ++ RevOutToks); subst_macros_rev([{'?',_}, {_,_,Name}, {'(',_} = Paren | Toks], MacroDict, RevOutToks) -> case dict:fetch(Name, MacroDict) of {[], MacroValue} -> %% This macro does not have any vars, so ignore the fact that the invocation is followed by "(...stuff" %% Recursively expand any macro calls inside this macro's value %% TODO: avoid infinite expansion due to circular references (even indirect ones) RevExpandedOtherMacrosToks = subst_macros_rev(MacroValue, MacroDict, []), subst_macros_rev([Paren|Toks], MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks); ParamsAndBody -> %% This macro does have vars. %% Collect all of the passe arguments, in an ordered list {NToks, Arguments} = subst_macros_get_args(Toks, []), %% Expand the varibles ExpandedParamsToks = subst_macros_subst_args_for_vars(ParamsAndBody, Arguments), %% Recursively expand any macro calls inside this macro's value %% TODO: avoid infinite expansion due to circular references (even indirect ones) RevExpandedOtherMacrosToks = subst_macros_rev(ExpandedParamsToks, MacroDict, []), subst_macros_rev(NToks, MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks) end; subst_macros_rev([{'?',_}, {_,_,Name} | Toks], MacroDict, RevOutToks) -> %% This macro invocation does not have arguments. %% Therefore the definition should not have parameters {[], MacroValue} = dict:fetch(Name, MacroDict), %% Recursively expand any macro calls inside this macro's value %% TODO: avoid infinite expansion due to circular references (even indirect ones) RevExpandedOtherMacrosToks = subst_macros_rev(MacroValue, MacroDict, []), subst_macros_rev(Toks, MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks); subst_macros_rev([Tok|Toks], MacroDict, RevOutToks) -> subst_macros_rev(Toks, MacroDict, [Tok|RevOutToks]); subst_macros_rev([], _MacroDict, RevOutToks) -> RevOutToks. subst_macros_get_args([{')',_} | Toks], RevArgs) -> {Toks, reverse(RevArgs)}; subst_macros_get_args([{',',_}, {var,_,ArgName} | Toks], RevArgs) -> subst_macros_get_args(Toks, [ArgName| RevArgs]); subst_macros_get_args([{var,_,ArgName} | Toks], RevArgs) -> subst_macros_get_args(Toks, [ArgName | RevArgs]). subst_macros_subst_args_for_vars({[], BodyToks}, []) -> BodyToks; subst_macros_subst_args_for_vars({[Param | Params], BodyToks}, [Arg|Args]) -> NBodyToks = keyreplace(Param, 3, BodyToks, {var,1,Arg}), subst_macros_subst_args_for_vars({Params, NBodyToks}, Args). read_include_file(Filename, IncludeSearchPath) -> case file:path_open(IncludeSearchPath, Filename, [read, raw, binary]) of {ok, IoDevice, FullName} -> {ok, Data} = file:read(IoDevice, filelib:file_size(FullName)), file:close(IoDevice), binary_to_list(Data); {error, Reason} -> throw({failed_to_read_include_file, Reason, Filename, IncludeSearchPath}) end. %% TODO: support $ENVVAR in Filename %% File name may start with a path component $VAR, for some string VAR. If that is the case, the value of the environment variable VAR as returned by os:getenv(VAR) is substituted for $VAR. If os:getenv(VAR) returns false, $VAR is left as is. %% %% TODO: support -include_lib %% include_lib is similar to include, but should not point out an absolute file. Instead, the first path component (possibly after variable substitution) is assumed to be the name of an application. Example: %% -include_lib("kernel/include/file.hrl"). %% The code server uses code:lib_dir(kernel) to find the directory of the current (latest) version of Kernel, and then the subdirectory include is searched for the file file.hrl. From chris.newcombe@REDACTED Fri Jul 20 18:54:21 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Fri, 20 Jul 2007 09:54:21 -0700 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0707200938p474f2af3ofd9fab1f8ec0f406@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F11261.60003@ericsson.com> <781dd98c0707200938p474f2af3ofd9fab1f8ec0f406@mail.gmail.com> Message-ID: <781dd98c0707200954h7d76c611h137af280fdf9b206@mail.gmail.com> > it does now support -include directives, As I mentioned, I'm using this as a admin/diagnostic/support facility for a service. I can send code to a private port, which compiles it, loads it (on multiple nodes if necessary) and spawns a process to run it. In that context it is not clear what the search path for -include directives should be. This is what I ended up with: ... snip ... %% Generate reasonable include path -- the 'include' directory that is a sibling of every ebin directory that contains a loaded module Directories = lists:usort( lists:foldl( fun({_Module, AbsolutePath}, Acc) when is_list(AbsolutePath) -> case split_string_on_delimiter("/ebin/", AbsolutePath) of no_delimiter_found -> ?INFO_LOGGER("compile_and_execute_code (building include path) ignoring module ~p~n", [AbsolutePath]), Acc; {Directory, _BeamFile} -> [Directory|Acc] end; (_, Acc) -> Acc % some may have 'preloaded' or 'cover_compiled' etc end, [], code:all_loaded())), %% We don't currently bother to filter out any that don't exist %% (most uploaded modules won't even have a -include directive anyway) IncludePathOptions = lists:map(fun(Dir) -> {i, Dir ++ "/include"} end, Directories), try compile_module_from_string:compile(binary_to_list(CodeBinary), [return_errors, return_warnings, verbose] ++ IncludePathOptions) of {ModuleName, CompiledCode} -> ?INFO_LOGGER("compile_and_execute_code: successfully compiled module ~w~n", [ModuleName]), ... snip ... With this small helper function: %% returns {BeforeDelimiter, AfterDelimiter} i.e. the first occurance if Delimiter is dropped -- but 'After' may contain other instances of Delimiter %% or no_delimiter_found split_string_on_delimiter("", Str) when is_list(Str) -> {"", Str}; split_string_on_delimiter(Delimiter, Str) when is_list(Delimiter) andalso is_list(Str) -> case string:str(Str, Delimiter) of 0 -> no_delimiter_found; Pos -> {string:substr(Str, 1, Pos - 1), string:substr(Str, Pos + length(Delimiter))} end. From christopher@REDACTED Fri Jul 20 21:36:05 2007 From: christopher@REDACTED (Christopher Baus) Date: Fri, 20 Jul 2007 12:36:05 -0700 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <469FF20C.1060605@baus.net> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <469FA431.9090600@sankatygroup.com> <469FF20C.1060605@baus.net> Message-ID: <46A10EA5.4010306@baus.net> >> I received mine to day in Atlanta, GA, USA. It came via USPS mail, no >> tracking information. > > Uh oh. I can't receive USPS mail at the address I provided them. Sorry for the digression, but... I've gotten multiple direct emails regarding this, so it might be worth noting that if you work for an e-commerce company that the US Postal Service can not deliver to all addresses in the US. Specifically they do not deliver to residences in Lake Tahoe. E-commerce forms should specify the method of shipping. I've gotten burned numerable times on this. From dmercer@REDACTED Fri Jul 20 21:57:16 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 20 Jul 2007 14:57:16 -0500 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <46A10EA5.4010306@baus.net> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <469FA431.9090600@sankatygroup.com><469FF20C.1060605@baus.net> <46A10EA5.4010306@baus.net> Message-ID: <002d01c7cb08$2ca842b0$891ea8c0@SSI.CORP> What does the USPS do with it? Do they send it back or hold it at the PO? I used to live in a small town which did not have mail delivery, but there the PO would hold your mail and you'd stop in a couple of times a week and ask the mailman for your mail. Nice and friendly-like. David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Christopher Baus Sent: Friday, July 20, 2007 14:36 To: Erlang Questions Subject: Re: [erlang-questions] Erlang book now shipping >> I received mine to day in Atlanta, GA, USA. It came via USPS mail, no >> tracking information. > > Uh oh. I can't receive USPS mail at the address I provided them. Sorry for the digression, but... I've gotten multiple direct emails regarding this, so it might be worth noting that if you work for an e-commerce company that the US Postal Service can not deliver to all addresses in the US. Specifically they do not deliver to residences in Lake Tahoe. E-commerce forms should specify the method of shipping. I've gotten burned numerable times on this. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From christopher@REDACTED Fri Jul 20 23:57:41 2007 From: christopher@REDACTED (Christopher Baus) Date: Fri, 20 Jul 2007 14:57:41 -0700 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <002d01c7cb08$2ca842b0$891ea8c0@SSI.CORP> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <469E87DE.1050304@web.de> <5d84cb30707182247h75dc04f8s36d5be133868340a@mail.gmail.com> <876ef97a0707190837u7f5037c3yeca2f78b7d8a3ce6@mail.gmail.com> <469FA431.9090600@sankatygroup.com><469FF20C.1060605@baus.net> <46A10EA5.4010306@baus.net> <002d01c7cb08$2ca842b0$891ea8c0@SSI.CORP> Message-ID: <46A12FD5.9030202@baus.net> David Mercer wrote: > What does the USPS do with it? Do they send it back or hold it at the PO? > I used to live in a small town which did not have mail delivery, but there > the PO would hold your mail and you'd stop in a couple of times a week and > ask the mailman for your mail. Nice and friendly-like. > > David Ok this deviating totally off the subject, and I will drop it after this, but they do not associate a PO BOX with a physical address in Tahoe. I gave PragProg my physical address assuming it would be shipped via FedEx or UPS. I used to work around this by providing my PO BOX in the second line of the address, but now my PO BOX and Physical address are in two different zip codes, so this doesn't work anymore. I've had stuff shipped all the way to the local PO w/out a PO BOX and then shipped all they way back. This is a big PITA up here. Chris From simonpeterchappell@REDACTED Sat Jul 21 00:22:43 2007 From: simonpeterchappell@REDACTED (Simon Chappell) Date: Fri, 20 Jul 2007 17:22:43 -0500 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> Message-ID: <8ed733900707201522x2c281c93i22cb7ab9bf99e8a7@mail.gmail.com> On 7/16/07, Joe Armstrong wrote: > The Erlang book has arrived at the publishers. > > The first batches of books to individual custormer will start shipping today. > > /Joe Got mine this morning. :-) Simon -- simonpeter.org | simonpeter.com | techbook.info From haoboy@REDACTED Sat Jul 21 08:23:41 2007 From: haoboy@REDACTED (Haobo Yu) Date: Fri, 20 Jul 2007 23:23:41 -0700 Subject: [erlang-questions] Image processing driver? Message-ID: <6665E966-AAAC-4871-A984-A207ED8FB050@gmail.com> Was there any previous work on adding image processing library, such as ImageMagick, into erlang? I searched in google/yahoo/live but found none. If I have to write one, would an erlang driver for ImageMagick would be an acceptable idea? Thanks in advance! - Haobo From dmitriid@REDACTED Sat Jul 21 09:39:51 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Sat, 21 Jul 2007 10:39:51 +0300 Subject: [erlang-questions] Image processing driver? In-Reply-To: <6665E966-AAAC-4871-A984-A207ED8FB050@gmail.com> References: <6665E966-AAAC-4871-A984-A207ED8FB050@gmail.com> Message-ID: <46A1B847.3040708@gmail.com> Haobo Yu wrote: > Was there any previous work on adding image processing library, such > as ImageMagick, into erlang? I searched in google/yahoo/live but > found none. If I have to write one, would an erlang driver for > ImageMagick would be an acceptable idea? > > Or may be a port of/binding to Python's Imaging Library via http://www.lysator.liu.se/~tab/erlang/py_interface/ ? Though this would require a separate installation of python... From rsaccon@REDACTED Sat Jul 21 13:38:15 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Sat, 21 Jul 2007 08:38:15 -0300 Subject: [erlang-questions] Image processing driver? In-Reply-To: <6665E966-AAAC-4871-A984-A207ED8FB050@gmail.com> References: <6665E966-AAAC-4871-A984-A207ED8FB050@gmail.com> Message-ID: I have written one with erl_interface for cairo. Just need to clean it up a little bit, so it builds on all plattforms (WIndows XP, Mac Intel, Ubuntu) and put it on googlecode. I actuallz want to put it on cean so you don't have to build the driver yourself. Be aware, cairo only handles PNG. regards -- Roberto Saccon From 0x6e6562@REDACTED Sat Jul 21 15:57:55 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Sat, 21 Jul 2007 14:57:55 +0100 Subject: [erlang-questions] Sending messages to gen_event manager Message-ID: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> Hi, I'm trying to use the gen_event behaviour to manage some event driven logic and the process seems to be pretty straight forward. 1. As a alternative to the notify/2 call, if if store the Pid of the event manager when it is started, i.e. {ok, Pid } = gen_event:start_link( {local, man} ). can I just implement a handle_info/2 callback on my handler and then I can send it events as such: Pid ! { my_message } Are these approaches equivalent apart from the fact that one is a by-name invocation and the other is a by-pid invocation? Does the by-pid invocation have any implications on the state, lifecycle or supervision tree of the handler? 2. Say I have multiple event handlers that need to respond differently to different types of events, it is a sounder design to add multiple callbacks to one event manager and then pattern match on the handle_event/2 callback, or does it make more sense to just create a new event manager for each event type? Naively I would go for the latter option, but this may create lots of event manager processes. Is this problematic? Thx, Ben From cthulahoops@REDACTED Sat Jul 21 16:45:09 2007 From: cthulahoops@REDACTED (Adam Kelly) Date: Sat, 21 Jul 2007 15:45:09 +0100 Subject: [erlang-questions] Sending messages to gen_event manager In-Reply-To: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> References: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> Message-ID: <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> On 7/21/07, Ben Hood <0x6e6562@REDACTED> wrote: > 1. As a alternative to the notify/2 call, if if store the Pid of the > event manager when it is started, i.e. > > {ok, Pid } = gen_event:start_link( {local, man} ). > > can I just implement a handle_info/2 callback on my handler and then I > can send it events as such: > > Pid ! { my_message } You can choose to use names and events with either method. All of these are equivalent: Pid ! {notify, Event}. man ! {notify, Event}. gen_event:notify( Pid, Event ). gen_event:notify( man, Event ). I'd advise you to use gen_event:notify, as it hides the implementation details of the event manager. If something is an event, it's also clearer to use handle_event rather than handle_info. > Are these approaches equivalent apart from the fact that one is a > by-name invocation and the other is a by-pid invocation? > > Does the by-pid invocation have any implications on the state, > lifecycle or supervision tree of the handler? The Pid approach doesn't really work once you place the event manager in a supervision tree. When the event manager dies it will be respawned using a different Pid, and you'll have to rediscover the Pid, Using a name avoids this problem. On the other hand if you wish to have multiple instances of the event manager, you might be better off using the Pid. (I'm not sure why you might do this, but you never know...) > 2. Say I have multiple event handlers that need to respond differently > to different types of events, it is a sounder design to add multiple > callbacks to one event manager and then pattern match on the > handle_event/2 callback, or does it make more sense to just create a > new event manager for each event type? > > Naively I would go for the latter option, but this may create lots of > event manager processes. Is this problematic? This is pretty much a design decision depending on the types of events, and what you do with them. Either approach will work fine, it's just a matter of figuring out which is simplest in your case. Be aware that all event handlers run in series in the process of the event manager. An event handler which crashes is silently deleted from the event manager - use add_sup_handler to get notifications of this. Adam. From 0x6e6562@REDACTED Sat Jul 21 17:59:56 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Sat, 21 Jul 2007 16:59:56 +0100 Subject: [erlang-questions] Sending messages to gen_event manager In-Reply-To: <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> References: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> Message-ID: <269388e30707210859h2d840d8bq27bf1357fa844c50@mail.gmail.com> Thanks for clarifying point 1 so concisely. > > 2. Say I have multiple event handlers that need to respond differently > > to different types of events, it is a sounder design to add multiple > > callbacks to one event manager and then pattern match on the > > handle_event/2 callback, or does it make more sense to just create a > > new event manager for each event type? > > > > Naively I would go for the latter option, but this may create lots of > > event manager processes. Is this problematic? > > This is pretty much a design decision depending on the types of > events, and what you do with them. Either approach will work fine, > it's just a matter of figuring out which is simplest in your case. > > Be aware that all event handlers run in series in the process of the > event manager. An event handler which crashes is silently deleted > from the event manager - use add_sup_handler to get notifications of > this. So the implication of the serial execution is that if you wanted different events to be handled by different handlers concurrently, you would have to use separate manager processes, right? Thx, Ben From ulf@REDACTED Sat Jul 21 18:56:48 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 21 Jul 2007 18:56:48 +0200 Subject: [erlang-questions] Sending messages to gen_event manager In-Reply-To: <269388e30707210859h2d840d8bq27bf1357fa844c50@mail.gmail.com> References: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> <269388e30707210859h2d840d8bq27bf1357fa844c50@mail.gmail.com> Message-ID: <8209f740707210956l53d9d3cfy67909fe0f321686e@mail.gmail.com> 2007/7/21, Ben Hood <0x6e6562@REDACTED>: > > So the implication of the serial execution is that if you wanted > different events to be handled by different handlers concurrently, you > would have to use separate manager processes, right? The usual way to solve that is to have one event manager, and handlers which do as little as possible - in that case only forwarding the event to some server which does the actual processing. The event handler becomes an interrupt driver of sorts. BR, Ulf W From 0x6e6562@REDACTED Sat Jul 21 19:14:29 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Sat, 21 Jul 2007 18:14:29 +0100 Subject: [erlang-questions] Sending messages to gen_event manager In-Reply-To: <8209f740707210956l53d9d3cfy67909fe0f321686e@mail.gmail.com> References: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> <269388e30707210859h2d840d8bq27bf1357fa844c50@mail.gmail.com> <8209f740707210956l53d9d3cfy67909fe0f321686e@mail.gmail.com> Message-ID: <269388e30707211014i2ac45a00i4b4ffcc459d42bb@mail.gmail.com> > > So the implication of the serial execution is that if you wanted > > different events to be handled by different handlers concurrently, you > > would have to use separate manager processes, right? > > The usual way to solve that is to have one event manager, and > handlers which do as little as possible - in that case only > forwarding the event to some server which does the actual > processing. The event handler becomes an interrupt driver > of sorts. OK, so what you are saying is the events get dispatched sequentially but they immediately spawn off server processes which execute asynchronously, thereby parallelizing the actual processing work. Ben From ahmed.nawras@REDACTED Sat Jul 21 21:50:20 2007 From: ahmed.nawras@REDACTED (Ahmed Ali) Date: Sat, 21 Jul 2007 23:50:20 +0400 Subject: [erlang-questions] The meaning of OTP... In-Reply-To: <46A0BF5D.2000809@erlang-consulting.com> References: <46A0BF5D.2000809@erlang-consulting.com> Message-ID: Hey, I keep reading these emails about OTP naming but can't stop asking who named it OTP in the first place? I guess s/he needs to give us an explanation for the name.... Ahmed Al-Issaei On 7/20/07, Francesco Cesarini wrote: > > Hi, > > I agree, but think it is just as confusing as having Telecom in there... > What is in bold and we have not changed, however, is OTP. We will change > it back when this debate comes to an end. As mentioned, I want to > summarize all the comments as soon as I have a second over. > > Francesco > > PS. The Dr. Dobbs article is generating about 200 unique users a day, > bringing the average number of unique users to the site to about 500. > Thanks to the reddit effect on all the new articles, tutorials, how tos, > we've had a constant influx of 400 - 500 users a day, 50% of which are > returning ones. > > Niclas Eklund wrote: > > Hello! > > > > Since, for example, the article in Dr.Dobbs, posted by Tobbe, refers to > > www.erlang.org and www.trapexit.org, it might attract new people > > (http://ddj.com/dept/opensource/201001928?cid=RSSfeed_DDJ_OpenSource) > and > > they might not read that thread. But they will for sure read what's on > the > > start page: > > > > "What is Erlang and OTP? > > > > Erlang is a programming language and a runtime system with strong > > built-in support for concurrency, distribution and fault tolerance. > > Originally developed at Ericsson, Erlang was released as open source in > > 1998. > > > > The Open Transaction Platform (OTP) is set of Erlang libraries and > design > > principles providing middle-ware to develop distributed, fault > tolerant, > > massively concurrent soft real-time systems." > > > > IMHO, that might be confusing. > > > > /Niclas > > > > > > > > On Fri, 20 Jul 2007, Francesco Cesarini wrote: > > > > > >> Eric Merritt wrote: > >> > >>> Regardless of what is decided on the name, Trap Exit shouldn't go off > >>> in it's own tangent. > >>> > >> *We haven't*. It clearly states in the first forum post that we did it > >> to provoke a reaction and see what the Erlang community thinks, and > that > >> any ultimate decision is not ours, not the community, but Ericsson's. > >> This reaction has now occurred. I will put together the feedback later > >> today. > >> > >> Cheers, > >> Francesco > >> > >> PS. Love some of the suggestions :-) > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > >> > > > > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Jul 21 22:28:43 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 21 Jul 2007 22:28:43 +0200 Subject: [erlang-questions] Sending messages to gen_event manager In-Reply-To: <269388e30707211014i2ac45a00i4b4ffcc459d42bb@mail.gmail.com> References: <269388e30707210657s7ea2b5f0v30d4dc6e173d696c@mail.gmail.com> <8d1798e90707210745g190b69d2ke6ecb0ec996e163d@mail.gmail.com> <269388e30707210859h2d840d8bq27bf1357fa844c50@mail.gmail.com> <8209f740707210956l53d9d3cfy67909fe0f321686e@mail.gmail.com> <269388e30707211014i2ac45a00i4b4ffcc459d42bb@mail.gmail.com> Message-ID: <8209f740707211328hef2386dr1be8569c4b885694@mail.gmail.com> Yes, or perhaps more commonly, send messages to pre-existing servers. BR, Ulf W 2007/7/21, Ben Hood <0x6e6562@REDACTED>: > > > So the implication of the serial execution is that if you wanted > > > different events to be handled by different handlers concurrently, you > > > would have to use separate manager processes, right? > > > > The usual way to solve that is to have one event manager, and > > handlers which do as little as possible - in that case only > > forwarding the event to some server which does the actual > > processing. The event handler becomes an interrupt driver > > of sorts. > > OK, so what you are saying is the events get dispatched sequentially > but they immediately spawn off server processes which execute > asynchronously, thereby parallelizing the actual processing work. > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dcabana@REDACTED Sat Jul 21 23:02:30 2007 From: dcabana@REDACTED (David Cabana) Date: Sat, 21 Jul 2007 17:02:30 -0400 Subject: [erlang-questions] ring benchmark results: Is Erlang crazy fast? Message-ID: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> Joe Armstrong proposed an exercise in Programming Erlang : "Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times. So that a total of N * M messages get sent. Time how long this takes for different values of N and M." I did so, but I am having a hard time accepting the results. I am running latest the DarwinPorts build of Eralang on a G4 PowerBook. I'll post results, my reservations, and source code in that order. %% --- results, pasted from console session Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> c(ring). {ok,ring} 2> ring:start(5000,10). Total time=10 (32) milliseconds ok 3> ring:start(5000,10000). Total time=20 (26) milliseconds ok 4> ring:start(5000,10000000). Total time=10 (36) milliseconds I find it hard to believe Erlang can send 5*10^10 messages in .036 seconds on my hardware. Can anyone give me a sanity check here? Here's the code. I left in some (commented out) diagnostic code; using it with small values of M and N leads me to think the program is doing what it is supposed to do. I am an Erlang newb; this is the longest and least trivial Erlang program I've written. Any observations on better style would be welcome. -module(ring). -export([start/2, foo/1, bar/0]). %% %% per Armstrong's "Programming Erlang" %% Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times. %% So that a total of N * M messages get sent. Time how long this takes for different values of N and M. %% foo(Next) -> receive %% foo does not care about the value of 2nd element in {x,y}, only bar does {0, Any} -> % io:format("foo done ~n",[]), Next ! {0, Any}; %% send the 0 along to tell everyone to shut down {N, Any} -> % io:format(" foo ~p ~n", [N]), Next ! {N-1, Any}, foo(Next); Other -> io:format("foo: huh? ~p ~n", [Other]) end. bar() -> receive {0, Next} -> % io:format("bar done ~n",[]), Next ! {0, Next}; {N, Next} -> % io:format("bar ~p ~n", [N]), Next ! {N-1, Next}, bar(); Other -> io:format("bar: huh? ~p ~n", [Other]) end. %% construct a chain of processes %% process J-1 routes msgs to process J for all J < K chain(0, Pid) -> Pid; chain(K, Pid) -> chain(K-1, spawn(ring,foo,[Pid])). %% N is the number of processes in the ring %% M is the number of times msgs circle the ring start(N, M) -> statistics(runtime), statistics(wall_clock), A= spawn(ring, bar, []), B= chain(N-1, A), A ! {N*M, B}, {_, RT} = statistics(runtime), {_, WC} = statistics(wall_clock), io:format("Total time=~p (~p) milliseconds~n", [RT, WC]). From ulf@REDACTED Sun Jul 22 00:07:14 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 22 Jul 2007 00:07:14 +0200 Subject: [erlang-questions] ring benchmark results: Is Erlang crazy fast? In-Reply-To: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> References: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> Message-ID: <8209f740707211507m61b3cd85q89152ecf9719286f@mail.gmail.com> You must also wait for the message to pass through the entire ring. BR, Ulf W 2007/7/21, David Cabana : > Joe Armstrong proposed an exercise in Programming Erlang : > "Write a ring benchmark. Create N processes in a ring. Send a message > round the ring M times. So that a total of N * M messages get sent. > Time how long this takes for different values of N and M." > > I did so, but I am having a hard time accepting the results. I am > running latest the DarwinPorts build of Eralang on a G4 PowerBook. > I'll post results, my reservations, and source code in that order. > > %% --- results, pasted from console session > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.5.5 (abort with ^G) > 1> c(ring). > {ok,ring} > 2> ring:start(5000,10). > Total time=10 (32) milliseconds > ok > 3> ring:start(5000,10000). > Total time=20 (26) milliseconds > ok > 4> ring:start(5000,10000000). > Total time=10 (36) milliseconds > > I find it hard to believe Erlang can send 5*10^10 messages in .036 > seconds on my hardware. Can anyone give me a sanity check here? > > Here's the code. I left in some (commented out) diagnostic code; > using it with small values of M and N leads me to think the program > is doing what it is supposed to do. I am an Erlang newb; this is the > longest and least trivial Erlang program I've written. Any > observations on better style would be welcome. > > > -module(ring). > -export([start/2, foo/1, bar/0]). > %% > %% per Armstrong's "Programming Erlang" > %% Write a ring benchmark. Create N processes in a ring. Send a > message round the ring M times. > %% So that a total of N * M messages get sent. Time how long this > takes for different values of N and M. > %% > > foo(Next) -> > receive %% foo does not care about the value of 2nd > element in {x,y}, only bar does > {0, Any} -> > % io:format("foo done ~n",[]), > Next ! {0, Any}; %% send the 0 along to tell everyone to shut down > {N, Any} -> > % io:format(" foo ~p ~n", [N]), > Next ! {N-1, Any}, > foo(Next); > Other -> io:format("foo: huh? ~p ~n", [Other]) > end. > > bar() -> > receive > {0, Next} -> > % io:format("bar done ~n",[]), > Next ! {0, Next}; > {N, Next} -> > % io:format("bar ~p ~n", [N]), > Next ! {N-1, Next}, > bar(); > Other -> io:format("bar: huh? ~p ~n", [Other]) > end. > > %% construct a chain of processes > %% process J-1 routes msgs to process J for all J < K > chain(0, Pid) -> Pid; > chain(K, Pid) -> chain(K-1, spawn(ring,foo,[Pid])). > > %% N is the number of processes in the ring > %% M is the number of times msgs circle the ring > start(N, M) -> > statistics(runtime), > statistics(wall_clock), > > A= spawn(ring, bar, []), > B= chain(N-1, A), > A ! {N*M, B}, > > {_, RT} = statistics(runtime), > {_, WC} = statistics(wall_clock), > io:format("Total time=~p (~p) milliseconds~n", [RT, WC]). > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From peter@REDACTED Sun Jul 22 03:57:09 2007 From: peter@REDACTED (Peter Donald) Date: Sun, 22 Jul 2007 11:57:09 +1000 Subject: [erlang-questions] ring benchmark results: Is Erlang crazy fast? In-Reply-To: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> References: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> Message-ID: <125c0c0d0707211857j73bbea04hae7c0085b732e58a@mail.gmail.com> Hi, On 7/22/07, David Cabana wrote: > Joe Armstrong proposed an exercise in Programming Erlang : > "Write a ring benchmark. Create N processes in a ring. Send a message > round the ring M times. So that a total of N * M messages get sent. > Time how long this takes for different values of N and M." This is probably the same benchmark as described in the following report (that also has source code). http://www.sics.se/~joe/ericsson/du98024.html -- Cheers, Peter Donald From brad@REDACTED Sun Jul 22 07:00:35 2007 From: brad@REDACTED (Brad Anderson) Date: Sun, 22 Jul 2007 01:00:35 -0400 Subject: [erlang-questions] xmerl question Message-ID: <46A2E473.5070405@sankatygroup.com> Hi, I am not getting a match correct... For the #xmlElement like: I'm trying to parse it with: parse_matchup(Matchup) -> #xmlElement{attributes=Attribs, content=Content} = Matchup, [ #xmlAttribute{name=kickoff, value=Kickoff} ] = Attribs, Kickoff. I'm getting a badmatch [1] when I try to get the value of the 'kickoff' attribute. Any idea what I'm doing wrong? I used Matchups = [parse_matchup(M) || M <- xmerl_xpath:string("//matchup", Xml)], to send Matchup to the fn, but I didn't want to keep using xpath on each attrib and child node, because of efficiency. Should I not worry about that? Cheers, BA [1] =ERROR REPORT==== 22-Jul-2007::00:56:55 === Error in process <0.341.0> with exit value: {{badmatch,[{xmlAttribute,kickoff,[],[],[],[],1,[],"1189125000",fals\e},{xmlAttribute,gameSecondsRemaining,[],[],[],[],2,[],"3600",false}]},[{schedule,parse_matchup,1},{erl_eval,do_\apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {{badmatch,[{xmlAttribute,kickoff, [], [], [], [], 1, [], "1189125000", false}, {xmlAttribute,gameSecondsRemaining, [], [], [], [], 2, [], "3600", false}]}, [{schedule,parse_matchup,1}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** From jla415@REDACTED Sun Jul 22 10:18:23 2007 From: jla415@REDACTED (jla415) Date: Sun, 22 Jul 2007 01:18:23 -0700 (PDT) Subject: [erlang-questions] xmerl question In-Reply-To: <46A2E473.5070405@sankatygroup.com> References: <46A2E473.5070405@sankatygroup.com> Message-ID: <11729169.post@talk.nabble.com> Brad Anderson-3 wrote: > > Hi, > > I am not getting a match correct... > > For the #xmlElement like: > > > > > > > I'm trying to parse it with: > > parse_matchup(Matchup) -> > #xmlElement{attributes=Attribs, content=Content} = Matchup, > [ #xmlAttribute{name=kickoff, value=Kickoff} ] = Attribs, > Kickoff. > > > I'm getting a badmatch [1] when I try to get the value of the 'kickoff' > attribute. Any idea what I'm doing wrong? > In that particular instance of xml you have multiple attributes, so the pattern match would need to be something along the lines of: [#xmlAttribute{name=kickoff, value=Kickoff}|_] = Attribs, but be aware this way depends on the kickoff attribute being first in the element so its still pretty fragile. -- View this message in context: http://www.nabble.com/xmerl-question-tf4124134.html#a11729169 Sent from the Erlang Questions mailing list archive at Nabble.com. From qrilka@REDACTED Sun Jul 22 12:18:18 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sun, 22 Jul 2007 14:18:18 +0400 Subject: [erlang-questions] Split integer into bytes Message-ID: <337538cb0707220318r2dfffc35qb3d3d20cba11407a@mail.gmail.com> Is there some 'normal' way to split integer (32 bits) into bytes? Right now I do this using [ X band 255, (X band (255 bsl 8)) bsr 8, (X band (255 bsl 16)) bsr 16, (X band (255 bsl 24)) bsr 24] Regard, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From headspin@REDACTED Sun Jul 22 12:37:56 2007 From: headspin@REDACTED (dda) Date: Sun, 22 Jul 2007 18:37:56 +0800 Subject: [erlang-questions] Split integer into bytes In-Reply-To: <337538cb0707220318r2dfffc35qb3d3d20cba11407a@mail.gmail.com> References: <337538cb0707220318r2dfffc35qb3d3d20cba11407a@mail.gmail.com> Message-ID: <> = <>. -- dda On 7/22/07, Kirill Zaborski wrote: > Is there some 'normal' way to split integer (32 bits) into bytes? > Right now I do this using > [ X band 255, > (X band (255 bsl 8)) bsr 8, > (X band (255 bsl 16)) bsr 16, > (X band (255 bsl 24)) bsr 24] > > > Regard, > Kirill. From mj@REDACTED Sun Jul 22 14:52:37 2007 From: mj@REDACTED (Mikkel Jensen) Date: Sun, 22 Jul 2007 14:52:37 +0200 Subject: [erlang-questions] Using Erlide with CEAN Message-ID: Hi there, I was wondering if anyone was using Erlide with CEAN? >From the source code it seems that Erlide requires the following to be present in a valid OTP home dir bin/erl bin/erlc lib Still, it does not want to recognize the CEAN base dir as a valid OTP home. Has anybody succesfully combined the two? - Mikkel -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier.boudeville@REDACTED Sun Jul 22 16:10:54 2007 From: olivier.boudeville@REDACTED (Olivier Boudeville) Date: Sun, 22 Jul 2007 16:10:54 +0200 Subject: [erlang-questions] WOOPER 0.1 announced! Message-ID: <46A3656E.3020103@online.fr> Hi, WOOPER (Wrapper for OOP in Erlang) version 0.1 is released and should be fully functional. WOOPER is an open source lightweight layer on top of the Erlang language offering constructs dedicated to Object-Oriented Programming, including classes, instances, methods (requests or oneways), life-cycle management (new/delete), multiple inheritance, polymorphism, state management, etc., with some efforts to preserve overall performances (hashtable-based virtual tables). All documentation, sources and full examples are available here : http://ceylan.sourceforge.net/main/documentation/wooper/ Any constructive feedback would be appreciated! Regards, Olivier Boudeville. From qrilka@REDACTED Sun Jul 22 21:17:31 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sun, 22 Jul 2007 23:17:31 +0400 Subject: [erlang-questions] emacs erlang shell issue Message-ID: <337538cb0707221217k316113bbj184338c6eb65cfa3@mail.gmail.com> In emacs erlang shell I can not enter M or C (capital letters), when I try press them they work like emacs META and CONTROL keys. Is this a normal behavior or it has something to do with my emacs setup? BTW I run emacs 22 on Windows XP Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dajo.mail@REDACTED Sun Jul 22 22:25:29 2007 From: dajo.mail@REDACTED (Johannes) Date: Sun, 22 Jul 2007 22:25:29 +0200 Subject: [erlang-questions] behavior of funktions Message-ID: <46A3BD39.2020100@web.de> hi, i have a question about the behavior of funktions. if theres a function: f(A,0) -> 1; f(A,B) -> [f(A,B-1),f(A,B-1)]. how often is f(A,B-1) evaluated then ? just one time, and erlang tooks the result everywhere where it fits, like f(A,B) -> TMP=f(A,B-1),[TMP;TMP]. or is it evaluated every time again ?? greatz Johannes From chsu79@REDACTED Sun Jul 22 23:32:52 2007 From: chsu79@REDACTED (Christian S) Date: Sun, 22 Jul 2007 23:32:52 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A3BD39.2020100@web.de> References: <46A3BD39.2020100@web.de> Message-ID: In your case it wont change the result since f is side-effect free (ignoring heat dissipation in the computer). Optimizing compilers might take advantage of this. The semantics is to call f twice, and as you write the way to get around it is to save the value into a temporary. 2007/7/22, Johannes : > hi, i have a question about the behavior of funktions. > if theres a function: > f(A,0) -> > 1; > f(A,B) -> > [f(A,B-1),f(A,B-1)]. > how often is f(A,B-1) evaluated then ? just one time, and erlang tooks > the result everywhere where it fits, like f(A,B) -> TMP=f(A,B-1),[TMP;TMP]. > or is it evaluated every time again ?? From robert.virding@REDACTED Sun Jul 22 23:38:21 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 22 Jul 2007 23:38:21 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: <6344005f0707200342r5a2adc90s492cb2f2da930960@mail.gmail.com> References: <6344005f0707200342r5a2adc90s492cb2f2da930960@mail.gmail.com> Message-ID: <46A3CE4D.3020306@telia.com> Sorry guys, wrong week right in the middle of vacation, otherwise I would be there. Robert Adam Lindberg wrote: > I'll be there too! > > Should be plenty of Erlang hackers here in Stockholm? Come on guys! > > Cheers! > Adam > > On 7/19/07, *Torbjorn Tornkvist* < tobbe@REDACTED > > wrote: > > > A great initiative! > > May I just add that this event has been initiated via the > #erlang channel at irc.freenode.net . So > all you oldtimers > (you know who you are :-), its time to join in on the channel > from time to time. > > Currently the #erlang channel has, constantly, around 100 > members but is rather silent. This can be compared to > the #haskell channel which have around 350 people with a > 24h (it seems) discussion going on. > > Cheers, Tobbe > (Ps. I'll be at the ErlLounge of course) > > Christian S wrote: > > Place: O'Learys sports bar, Stockholm Centralstation > > Time: 17:00-ish > > > > *** If you want to show up, please send me a private mail so I know > > how many we will be for, if necessary, table reservation. *** > > > > Though, my information source tells me there are no soccer games > > drawing people to sports bars on Tuesday. > > > > Location is chosen as a convenience for the Erlang fans living in > Uppsala. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chsu79@REDACTED Mon Jul 23 00:55:18 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 23 Jul 2007 00:55:18 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A3D72C.2090506@web.de> References: <46A3BD39.2020100@web.de> <46A3D72C.2090506@web.de> Message-ID: A good example is probably this erlang implementation of fibonacci: fib(0) -> 0; fib(1) -> 1; fib(N) -> fib(N-1) + fib(N-2). Pretty much verbatim from http://en.wikipedia.org/wiki/Fibonacci_number If you call f(10), it will in turn call f(9) and f(8), and f(9) will call f(8) (again) and f(7), it then continues like this. A whole lot of redundant computations to get values we already computed once. Erlang does nothing to help you here, the number of calls to compute f(N) will be (2^N)-1 and most of them redundant. Adding 'memoization' explicitly to cache the values of f(N) isnt that easy in Erlang, if you still want to have pretty/clear/succinct code. 2007/7/23, Johannes : > i never thought of not-side-effect-free functions in that case ;) > maybe i chosed a bad example. > My question is, if there is a function, wich is called more than one > time with the same arguments, how often is it evaluated(not 'called')? > it's clear, that a its impossible to save all function results the whole > time a programm is running, but how is it for example in a rekursion ?? From dajo.mail@REDACTED Mon Jul 23 00:16:12 2007 From: dajo.mail@REDACTED (Johannes) Date: Mon, 23 Jul 2007 00:16:12 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: References: <46A3BD39.2020100@web.de> Message-ID: <46A3D72C.2090506@web.de> i never thought of not-side-effect-free functions in that case ;) maybe i chosed a bad example. My question is, if there is a function, wich is called more than one time with the same arguments, how often is it evaluated(not 'called')? it's clear, that a its impossible to save all function results the whole time a programm is running, but how is it for example in a rekursion ?? Johannes Christian S schrieb: > In your case it wont change the result since f is side-effect free > (ignoring heat dissipation in the computer). Optimizing compilers > might take advantage of this. > > The semantics is to call f twice, and as you write the way to get > around it is to > save the value into a temporary. > > 2007/7/22, Johannes : >> hi, i have a question about the behavior of funktions. >> if theres a function: >> f(A,0) -> >> 1; >> f(A,B) -> >> [f(A,B-1),f(A,B-1)]. >> how often is f(A,B-1) evaluated then ? just one time, and erlang tooks >> the result everywhere where it fits, like f(A,B) -> >> TMP=f(A,B-1),[TMP;TMP]. >> or is it evaluated every time again ?? > From olopierpa@REDACTED Mon Jul 23 01:50:41 2007 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Mon, 23 Jul 2007 01:50:41 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A3D72C.2090506@web.de> References: <46A3BD39.2020100@web.de> <46A3D72C.2090506@web.de> Message-ID: <7352e43a0707221650l539b6601y2c8905c00538e6b2@mail.gmail.com> On 7/23/07, Johannes wrote: > i never thought of not-side-effect-free functions in that case ;) > maybe i chosed a bad example. > My question is, if there is a function, wich is called more than one > time with the same arguments, how often is it evaluated(not 'called')? > it's clear, that a its impossible to save all function results the whole > time a programm is running, but how is it for example in a rekursion ?? It's easy to test. Try this function: foo(0) -> 1; foo(N) -> foo(N-1) + foo(N-1). time foo(100), and if it takes only a few microseconds then F(N-1) is evaluated only once. If it takes thousands of years, then it is evaluated twice. Cheers P. From paul-trapexit@REDACTED Mon Jul 23 01:55:19 2007 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Sun, 22 Jul 2007 16:55:19 -0700 (PDT) Subject: [erlang-questions] behavior of funktions In-Reply-To: References: <46A3BD39.2020100@web.de> <46A3D72C.2090506@web.de> Message-ID: To summarize a previous thread, using the y combinator one can make a generic memoization routine in Erlang, which can be used with different recursive functions. Attached is an example with fib. -- p On Mon, 23 Jul 2007, Christian S wrote: > A good example is probably this erlang implementation of fibonacci: > > fib(0) -> 0; > fib(1) -> 1; > fib(N) -> fib(N-1) + fib(N-2). > > Pretty much verbatim from http://en.wikipedia.org/wiki/Fibonacci_number > > If you call f(10), it will in turn call f(9) and f(8), and f(9) will > call f(8) (again) and f(7), it then continues like this. A whole lot > of redundant computations to get values we already > computed once. > > Erlang does nothing to help you here, the number of calls to compute > f(N) will be > (2^N)-1 and most of them redundant. Adding 'memoization' explicitly to > cache the values of > f(N) isnt that easy in Erlang, if you still want to have > pretty/clear/succinct code. > > 2007/7/23, Johannes : > > i never thought of not-side-effect-free functions in that case ;) > > maybe i chosed a bad example. > > My question is, if there is a function, wich is called more than one > > time with the same arguments, how often is it evaluated(not 'called')? > > it's clear, that a its impossible to save all function results the whole > > time a programm is running, but how is it for example in a rekursion ?? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > "A hot dog and bun, you have to have a style and strategy that's different from a chicken wing, which is different from a matzo ball," he says. "Athletics are not really about superior fitness. They're about superior refinement of skill. That's what Babe Ruth did. That's what this is." http://en.wikipedia.org/wiki/Competitive_eating -------------- next part -------------- -module (memo). -export ([y/1, memoize/1, fib/1]). y (F) -> F (fun (X) -> (y (F)) (X) end). memoize (Tab, F) -> fun (B) -> fun (C) -> case ets:lookup (Tab, C) of [] -> R = (F (B)) (C), ets:insert (Tab, { C, R }), R; [ { C, R } ] -> R end end end. memoize (F) -> fun (X) -> Tab = ets:new (?MODULE, [ private ]), Ans = (y (memoize (Tab, F))) (X), ets:delete (Tab), Ans end. fibimpl (P) -> fun (0) -> 1; (1) -> 1; (N) when N > 1 -> P (N - 1) + P (N - 2) end. fib (N) -> (memoize (fun fibimpl/1)) (N). From rnewman@REDACTED Mon Jul 23 03:07:23 2007 From: rnewman@REDACTED (Richard Newman) Date: Sun, 22 Jul 2007 18:07:23 -0700 Subject: [erlang-questions] WOOPER 0.1 announced! In-Reply-To: References: Message-ID: <573E710E-516E-4E97-B06D-6CF98C6E4471@twinql.com> > WOOPER (Wrapper for OOP in Erlang) version 0.1 is released and > should be > fully functional. That is the best pun I've seen in days. Thank you! From jla415@REDACTED Mon Jul 23 06:29:51 2007 From: jla415@REDACTED (jla415) Date: Sun, 22 Jul 2007 21:29:51 -0700 (PDT) Subject: [erlang-questions] emacs erlang shell issue In-Reply-To: <337538cb0707221217k316113bbj184338c6eb65cfa3@mail.gmail.com> References: <337538cb0707221217k316113bbj184338c6eb65cfa3@mail.gmail.com> Message-ID: <11737737.post@talk.nabble.com> Kirill Zaborski wrote: > > In emacs erlang shell I can not enter M or C (capital letters), when I try > press them they work like emacs META and CONTROL keys. > Is this a normal behavior or it has something to do with my emacs setup? > BTW I run emacs 22 on Windows XP > > Best regards, > Kirill. > last time someone asked about this problem on irc it was a result of some distel documentation somewhere saying to put something similar to this in your .emacs: ;; A number of the erlang-extended-mode key bindings are useful in the shell too (defconst distel-shell-keys '(("C-M-i" erl-complete) ("M-?" erl-complete) ("M-." erl-find-source-under-point) ("M-," erl-find-source-unwind) ("M-*" erl-find-source-unwind) ) "Additional keys to bind when in Erlang shell.") (add-hook 'erlang-shell-mode-hook (lambda () ;; add some Distel bindings to the Erlang shell (dolist (spec distel-shell-keys) (define-key erlang-shell-mode-map (car spec) (cadr spec))))) if you recently tried to install distel try commenting out this section and seeing if it helps... -- View this message in context: http://www.nabble.com/emacs-erlang-shell-issue-tf4126175.html#a11737737 Sent from the Erlang Questions mailing list archive at Nabble.com. From olivier.boudeville@REDACTED Mon Jul 23 08:03:25 2007 From: olivier.boudeville@REDACTED (Olivier Boudeville) Date: Mon, 23 Jul 2007 08:03:25 +0200 Subject: [erlang-questions] WOOPER 0.1 announced! In-Reply-To: <573E710E-516E-4E97-B06D-6CF98C6E4471@twinql.com> References: <573E710E-516E-4E97-B06D-6CF98C6E4471@twinql.com> Message-ID: <46A444AD.1080000@online.fr> Richard Newman a ?crit : >> WOOPER (Wrapper for OOP in Erlang) version 0.1 is released and >> should be >> fully functional. >> > > That is the best pun I've seen in days. Thank you! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > I couldn't resist, even it must be a rather classical pun on this mailing-list (besides it works in several languages, including French). Next fronteer would involve doing something alike with "concurrent". That should be done hopefully no later than on WOOPER 0.2 release! Have a good week, Olivier. From rsaccon@REDACTED Mon Jul 23 08:48:27 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Mon, 23 Jul 2007 03:48:27 -0300 Subject: [erlang-questions] Bindings for Cairo 2D graphics library Message-ID: I just uploaded erlang bindings for a subset of the Cairo 2D graphics (http://cairographics.org) library to googlecode: http://code.google.com/p/erlycairo/ It's implemented as a c-node, and I tested the Makefile on Mac and Ubuntu, with a recent cairo lib installed. I plan to make it compile on windows with MinGW sometimes in the nexts days or weeks. this is work in progress and documentation is at early stage. patches are welcome regards -- Roberto Saccon From bjorn@REDACTED Mon Jul 23 11:29:28 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Jul 2007 11:29:28 +0200 Subject: [erlang-questions] Closures vs apply In-Reply-To: <269388e30707162238k7898b455p553b3de2b8eaffd3@mail.gmail.com> References: <57908DDB-DAC1-4AD2-AC32-5455FF5E0E0D@gmail.com> <469BED75.6040707@free.fr> <269388e30707162238k7898b455p553b3de2b8eaffd3@mail.gmail.com> Message-ID: "Ben Hood" <0x6e6562@REDACTED> writes: > Interesting. Are there any descriptions or explainations about the > internals of function invocation that explain where these differences > arise from? A funs contains a pointer to the code (actually, a pointer to a struct which itself contains a pointer to the code), while apply/3 must look up the pointer to the code in a hash table. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From dcabana@REDACTED Sat Jul 21 15:58:14 2007 From: dcabana@REDACTED (David Cabana) Date: Sat, 21 Jul 2007 09:58:14 -0400 Subject: [erlang-questions] ring benchmark results: Is Erlang crazy fast? Message-ID: <8EF15E11-1616-4423-8F98-07D3DEB2E27C@nc.rr.com> Joe Armstrong proposed an exercise in Programming Erlang : "Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times. So that a total of N * M messages get sent. Time how long this takes for different values of N and M." I did so, but I am having a hard time accepting the results. I am running latest the DarwinPorts build of Eralang on a G4 PowerBook. I'll post results, my reservations, and source code in that order. %% --- results, pasted from console session Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> c(ring). {ok,ring} 2> ring:start(5000,10). Total time=10 (32) milliseconds ok 3> ring:start(5000,10000). Total time=20 (26) milliseconds ok 4> ring:start(5000,10000000). Total time=10 (36) milliseconds I find it hard to believe Erlang can send 50 billion messages in 36 milliseconds on my hardware. Can anyone give me a sanity check here? Here's the code. I left in some (commented out) diagnostic code; using it with small values of M and N leads me to think the program is doing what it is supposed to do. I am an Erlang newb; this is the longest and least trivial Erlang program I've written. Any observations on better style would be welcome. -module(ring). -export([start/2, foo/1, bar/0]). %% %% per Armstrong's "Programming Erlang" %% Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times. %% So that a total of N * M messages get sent. Time how long this takes for different values of N and M. %% foo(Next) -> receive %% foo does not care about the value of 2nd element in {x,y}, only bar does {0, Any} -> % io:format("foo done ~n",[]), Next ! {0, Any}; %% send the 0 along to tell everyone to shut down {N, Any} -> % io:format(" foo ~p ~n", [N]), Next ! {N-1, Any}, foo(Next); Other -> io:format("foo: huh? ~p ~n", [Other]) end. bar() -> receive {0, Next} -> % io:format("bar done ~n",[]), Next ! {0, Next}; {N, Next} -> % io:format("bar ~p ~n", [N]), Next ! {N-1, Next}, bar(); Other -> io:format("bar: huh? ~p ~n", [Other]) end. %% construct a chain of processes %% process J-1 routes msgs to process J for all J < K chain(0, Pid) -> Pid; chain(K, Pid) -> chain(K-1, spawn(ring,foo,[Pid])). %% N is the number of processes in the ring %% M is the number of times msgs circle the ring start(N, M) -> statistics(runtime), statistics(wall_clock), A= spawn(ring, bar, []), B= chain(N-1, A), A ! {N*M, B}, {_, RT} = statistics(runtime), {_, WC} = statistics(wall_clock), io:format("Total time=~p (~p) milliseconds~n", [RT, WC]). From chsu79@REDACTED Mon Jul 23 14:00:32 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 23 Jul 2007 14:00:32 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: References: Message-ID: This ErlLounge is going to be crowded, participant list so far: http://spreadsheets.google.com/pub?key=pJoX1bcCxqs_i-P33GkzhbA I asked them on Friday to reserve 18 seats for us. If we're going to end up being more than 18 we can implement some kind of FIFO in the bar. :) 2007/7/19, Christian S : > Place: O'Learys sports bar, Stockholm Centralstation > Time: 17:00-ish From billclem@REDACTED Mon Jul 23 21:17:38 2007 From: billclem@REDACTED (Bill Clementson) Date: Mon, 23 Jul 2007 12:17:38 -0700 Subject: [erlang-questions] emacs erlang shell issue References: <337538cb0707221217k316113bbj184338c6eb65cfa3@mail.gmail.com> <11737737.post@talk.nabble.com> Message-ID: jla415 writes: > Kirill Zaborski wrote: >> >> In emacs erlang shell I can not enter M or C (capital letters), when I try >> press them they work like emacs META and CONTROL keys. >> Is this a normal behavior or it has something to do with my emacs setup? >> BTW I run emacs 22 on Windows XP >> >> Best regards, >> Kirill. >> > > last time someone asked about this problem on irc it was a result of some > distel documentation somewhere saying to put something similar to this in > your .emacs: The following code snippet is from a blog posting I wrote, not the distel documentation. The full blog post is here: http://bc.tech.coop/blog/070528.html > ;; A number of the erlang-extended-mode key bindings are useful in the shell > too > (defconst distel-shell-keys > '(("C-M-i" erl-complete) > ("M-?" erl-complete) > ("M-." erl-find-source-under-point) > ("M-," erl-find-source-unwind) > ("M-*" erl-find-source-unwind) > ) > "Additional keys to bind when in Erlang shell.") > > (add-hook 'erlang-shell-mode-hook > (lambda () > ;; add some Distel bindings to the Erlang shell > (dolist (spec distel-shell-keys) > (define-key erlang-shell-mode-map (car spec) (cadr spec))))) > > > if you recently tried to install distel try commenting out this section and > seeing if it helps... The above code snippet adds some additional key bindings to erlang-shell-mode. There should actually be a backslash if front of each of the meta and control key definitions in this code snippet. Unfortunately, I forgot to escape the backslashes in the HTML code, so they didn't show up in my blog post. I've corrected this now on the blog page. My apologies for any confusion/hassles this might have caused. -- Bill Clementson From hpjcon@REDACTED Mon Jul 23 23:54:25 2007 From: hpjcon@REDACTED (Jan Jacobs) Date: Mon, 23 Jul 2007 23:54:25 +0200 Subject: [erlang-questions] erlang and windoes 2003? Message-ID: <006d01c7cd74$094bc710$c800a8c0@jan03> Hi, I have an application which works when running it on Windows XP. If I test the same software on Windows 2003 it just exits, no crash dump, no reason, it disapears? Dump from the windows event viewer: Event Type: Information Event Source: Application Error Event Category: (100) Event ID: 1004 Date: 2007/07/23 Time: 08:09:10 PM User: N/A Computer: DFG-SRV Description: Reporting queued error: faulting application erl.exe, version 0.0.0.0, faulting module beam.dll, version 0.0.0.0, fault address 0x0003c4d5. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 41 70 70 6c 69 63 61 74 Applicat 0008: 69 6f 6e 20 46 61 69 6c ion Fail 0010: 75 72 65 20 20 65 72 6c ure erl 0018: 2e 65 78 65 20 30 2e 30 .exe 0.0 0020: 2e 30 2e 30 20 69 6e 20 .0.0 in 0028: 62 65 61 6d 2e 64 6c 6c beam.dll 0030: 20 30 2e 30 2e 30 2e 30 0.0.0.0 0038: 20 61 74 20 6f 66 66 73 at offs 0040: 65 74 20 30 30 30 33 63 et 0003c 0048: 34 64 35 4d5 Do anyone know where this file "erl_alloc_types.h" is? I am trying to recompile the beam.dll to test on Windows 2003 Any suggestions? Cheers Jan Jacobs -------------- next part -------------- An HTML attachment was scrubbed... URL: From hpjcon@REDACTED Mon Jul 23 22:30:30 2007 From: hpjcon@REDACTED (Jan Jacobs) Date: Mon, 23 Jul 2007 22:30:30 +0200 Subject: [erlang-questions] Compilening beam.dll Message-ID: <003901c7cd68$504dfe50$c800a8c0@jan03> Hi, Do any ione know where this file "erl_alloc_types.h" is? I am trying to recompile the beam.dll to test on Windows 2003. Cheers Jan Jacobs -------------- next part -------------- An HTML attachment was scrubbed... URL: From dajo.mail@REDACTED Tue Jul 24 01:02:55 2007 From: dajo.mail@REDACTED (Johannes) Date: Tue, 24 Jul 2007 01:02:55 +0200 Subject: [erlang-questions] ring benchmark results: Is Erlang crazy fast? In-Reply-To: <125c0c0d0707211857j73bbea04hae7c0085b732e58a@mail.gmail.com> References: <08B50E67-FC55-4DD6-8DDC-5A4DB33D0EAB@nc.rr.com> <125c0c0d0707211857j73bbea04hae7c0085b732e58a@mail.gmail.com> Message-ID: <46A5339F.3070504@web.de> i checkd it with joes code and got this results: Setup : 0.181000 s (11.3132 us per spawn) (15999 spawns) Run : 1.35300 s (1.34226 us per msg) (1007999 msgs) and i tried with ecc/elink: j_schn14@REDACTED:~/tmp/erlang/ring$ ecc zog.erl j_schn14@REDACTED:~/tmp/erlang/ring$ elink zog.beam j_schn14@REDACTED:~/tmp/erlang/ring$ !. ./zog real 0m0.386s user 0m0.164s sys 0m0.020s j_schn14@REDACTED:~/tmp/erlang/ring$ why does this happen ?? why is there a different result if i use ecc&elink or if i use erl ?? Johannes Peter Donald schrieb: > Hi, > > On 7/22/07, David Cabana wrote: >> Joe Armstrong proposed an exercise in Programming Erlang : >> "Write a ring benchmark. Create N processes in a ring. Send a message >> round the ring M times. So that a total of N * M messages get sent. >> Time how long this takes for different values of N and M." > > This is probably the same benchmark as described in the following > report (that also has source code). > > http://www.sics.se/~joe/ericsson/du98024.html > From dking@REDACTED Tue Jul 24 03:23:50 2007 From: dking@REDACTED (David King) Date: Mon, 23 Jul 2007 18:23:50 -0700 Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: <5E938AAF-E6D6-4864-9D98-579C795BFE7F@gmail.com> References: <5E938AAF-E6D6-4864-9D98-579C795BFE7F@gmail.com> Message-ID: Did you ever get any off-list responses to this? I'm curious too. On 15 Jul 2007, at 05:44, Joel Reymont wrote: > Folks, > > How many Mnesia nodes are you running in your production > installation? I'm looking to find the maximum here. > > I'm only dealing with ram_copies tables (cache), trying to figure out > whether I can make every Yaws node a Mnesia node without slowing > transactions down too much. > > My current thinking is to wait and gather statistics before trying to > decouple Yaws and Mnesia . Still, I would love to know how much > transactions slow down with the addition of every new Mnesia node. > > Thanks, Joel > > -- > http://topdog.cc - EasyLanguage to C# compiler > http://wagerlabs.com - Blog > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jozsef.berces@REDACTED Tue Jul 24 15:16:17 2007 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces_=28LA/ETH=29?=) Date: Tue, 24 Jul 2007 15:16:17 +0200 Subject: [erlang-questions] Port driver in windows message loop Message-ID: Hi, Though this might be rather a windows question than Erlang, I hope someone could help me. I wanted to write a port driver in C++ under windows but I had to enter the windows message loop. Once the message loop is running I do not really know how to handle standard IO for Erlang communication. The best would be if data from the standard input would appear as a windows message. Is there anyone who has experience with this? Thanks, Jozsef From klacke@REDACTED Tue Jul 24 14:24:50 2007 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 24 Jul 2007 14:24:50 +0200 Subject: [erlang-questions] ErlLounge in Stockholm on Tuesday, 24th of July In-Reply-To: References: Message-ID: <46A5EF92.8020500@hyber.org> Christian S wrote: > This ErlLounge is going to be crowded, participant list so far: > > http://spreadsheets.google.com/pub?key=pJoX1bcCxqs_i-P33GkzhbA > > I asked them on Friday to reserve 18 seats for us. If we're going to > end up being more than 18 we can implement some kind of FIFO in the > bar. :) > Johan Bevemyr and I will show up. /klacke From vladdu55@REDACTED Tue Jul 24 21:44:12 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 24 Jul 2007 19:44:12 +0000 Subject: [erlang-questions] Using Erlide with CEAN In-Reply-To: References: Message-ID: <95be1d3b0707241244h6e69cb61h851830f22256c292@mail.gmail.com> Hi, On 7/22/07, Mikkel Jensen wrote: > I was wondering if anyone was using Erlide with CEAN? > > From the source code it seems that Erlide requires the following to be > present in a valid OTP home dir > > bin/erl > bin/erlc > lib This is correct. > Still, it does not want to recognize the CEAN base dir as a valid OTP home. I only tested on Windows, and there there aren't any files under cean\bin, which explains why the place isn't recognized as a valid erlang installation directory. On other OSs, I suppose that bin/erl and bin/erlc are just symbolic links and it's possible that the code in erlide doesn't recognize them. Please file a bug report if this problem is important to you. best regards, Vlad From dajo.mail@REDACTED Tue Jul 24 22:36:49 2007 From: dajo.mail@REDACTED (Johannes) Date: Tue, 24 Jul 2007 22:36:49 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A3BD39.2020100@web.de> References: <46A3BD39.2020100@web.de> Message-ID: <46A662E1.7000303@web.de> i thought bout adding this future to the erts. to handle functions with side effekts i thought of useing ::funname or module::funname to enable this future. Is there any problem with using '::'? or should i use other letters ? today i got the sourecode of erlang from http://www.erlang.org/download/otp_src_R7B-1.tar.gz and started to search for the code of erl. What is the file i have to modify ?? and what are the files assigned to erl ?? greatz Johannes Johannes schrieb: > hi, i have a question about the behavior of funktions. > if theres a function: > f(A,0) -> > 1; > f(A,B) -> > [f(A,B-1),f(A,B-1)]. > how often is f(A,B-1) evaluated then ? just one time, and erlang tooks > the result everywhere where it fits, like f(A,B) -> TMP=f(A,B-1),[TMP;TMP]. > or is it evaluated every time again ?? > > greatz Johannes > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From anders.nygren@REDACTED Tue Jul 24 23:30:41 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 24 Jul 2007 16:30:41 -0500 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A662E1.7000303@web.de> References: <46A3BD39.2020100@web.de> <46A662E1.7000303@web.de> Message-ID: On 7/24/07, Johannes wrote: > i thought bout adding this future to the erts. > to handle functions with side effekts i thought of useing > ::funname or module::funname > to enable this future. > Is there any problem with using '::'? or should i use other letters ? > > today i got the sourecode of erlang from > http://www.erlang.org/download/otp_src_R7B-1.tar.gz and started to > search for the code of erl. Do You have any special reason to chose a 7 year old version of Erlang? /Anders > What is the file i have to modify ?? and what are the files assigned to > erl ?? > > greatz Johannes > Johannes schrieb: > > hi, i have a question about the behavior of funktions. > > if theres a function: > > f(A,0) -> > > 1; > > f(A,B) -> > > [f(A,B-1),f(A,B-1)]. > > how often is f(A,B-1) evaluated then ? just one time, and erlang tooks > > the result everywhere where it fits, like f(A,B) -> TMP=f(A,B-1),[TMP;TMP]. > > or is it evaluated every time again ?? > > > > greatz Johannes > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dajo.mail@REDACTED Tue Jul 24 23:43:28 2007 From: dajo.mail@REDACTED (Johannes) Date: Tue, 24 Jul 2007 23:43:28 +0200 Subject: [erlang-questions] behavior of funktions In-Reply-To: <46A662E1.7000303@web.de> References: <46A3BD39.2020100@web.de> <46A662E1.7000303@web.de> Message-ID: <46A67280.7080104@web.de> anders told me that the source i wanted to use is very old. i searched just a few minutes today, so i did not recognize. of course ill use a newer version, ill try this one http://www.erlang.org/download/otp_src_R11B-5.tar.gz i recognized that i got a very old version Johannes schrieb: > i thought bout adding this future to the erts. > to handle functions with side effekts i thought of useing > ::funname or module::funname > to enable this future. > Is there any problem with using '::'? or should i use other letters ? > > today i got the sourecode of erlang from > http://www.erlang.org/download/otp_src_R7B-1.tar.gz and started to > search for the code of erl. > What is the file i have to modify ?? and what are the files assigned to > erl ?? > > greatz Johannes > Johannes schrieb: >> hi, i have a question about the behavior of funktions. >> if theres a function: >> f(A,0) -> >> 1; >> f(A,B) -> >> [f(A,B-1),f(A,B-1)]. >> how often is f(A,B-1) evaluated then ? just one time, and erlang tooks >> the result everywhere where it fits, like f(A,B) -> TMP=f(A,B-1),[TMP;TMP]. >> or is it evaluated every time again ?? >> >> greatz Johannes >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From als@REDACTED Wed Jul 25 02:56:34 2007 From: als@REDACTED (Anthony Shipman) Date: Wed, 25 Jul 2007 10:56:34 +1000 Subject: [erlang-questions] application modules uniquely named? Message-ID: <200707251056.34272.als@iinet.net.au> From my reading of the doc, if a node has multiple applications then their module names must be unique across all applications. Is this true? Do people find this a problem? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From ok@REDACTED Wed Jul 25 04:13:27 2007 From: ok@REDACTED (ok) Date: Wed, 25 Jul 2007 14:13:27 +1200 Subject: [erlang-questions] View patterns In-Reply-To: <200707251056.34272.als@iinet.net.au> References: <200707251056.34272.als@iinet.net.au> Message-ID: <59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz> Haskell is starting to eat Erlang's lunch, except for hot loading. Data.ByteString (and especially Data.ByteString.Lazy) is an effective replacement for Erlang binaries, with support for packing and unpacking stuff. There's even talk about an analogue of 'bit syntax'. One of the things which is about to be added to GHC is view patterns. The idea is that if E is an expression and P is a pattern, then (E -> P) is a pattern. This pattern matches a value V if and only if P = (E)(V). Here's an example in Erlang syntax. min_list([]) -> empty; min_list([X|Xs]) -> min_list_loop(Xs, X, []). min_list_loop([], X, Zs) -> {min,X,Zs}; min_list_loop([Y|Ys], X, Zs) when Y < X -> min_list_loop(Ys, Y, [X|Zs]); min_list_loop([Y|Ys], X, Zs) -> min_list_loop(Ys, X, [Y|Zs]). Given the function min_list/1, we can now write selection sort: selection_sort((min_list -> empty)) -> []; selection_sort((min_list -> {min,X,Xs})) -> [X | selection_sort(Xs)]. This renders "as"-patterns obsolete. With the aid of both(X) -> {X,X}. we can write add_leaf(Datum, Tree = {fork,Size,Left,Right}) -> ... as add_leaf(Datum, (both -> {Tree,{fork,Size,Left,Right}})) -> ... People who dislike n+k patterns in Haskell can no longer hurt us much by taking them out. With the aid of np(K, X) when integer(X), integer(K), X >= K -> {X}; np(_, _) -> false. we can rewrite factorial(0) -> 1; factorial(N+1) -> (N+1)*factorial(N). as factorial(0) -> 1; factorial((np(1) -> {N})) -> (N+1)*factorial(N). Haskell view patterns are both more and less general than my abstract patterns (which turned out to have been a reinvention of the original view idea). They are less general because they cannot be used as constructors. Apparently every view proposal that does that has run into trouble, although reading some of the papers it doesn't seem to me that the trouble would be anywhere near as acute in Erlang, in which equational reasoning isn't valid anyway. They are more general in that the functions can be any function at all, whereas abstract patterns are limited to non-recursive stuff, so cannot do the selection sort example at all (probably a Good Thing). I haven't told the whole story about Haskell view patterns; you'll find that on the Haskell wiki. But it suggests to me that we might want to think about moving abstract patterns in Erlang a little higher up the agenda. From cyberlync@REDACTED Wed Jul 25 04:22:38 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 24 Jul 2007 19:22:38 -0700 Subject: [erlang-questions] application modules uniquely named? In-Reply-To: <200707251056.34272.als@iinet.net.au> References: <200707251056.34272.als@iinet.net.au> Message-ID: In general its not a problem. That said its not uncommon for developers to prefix module names with an adhoc 'namespace', usually based on the application name. For example, I develop on a project called sinan, all modules in the sinan application are prefixed with the name sin_. It mitigates the possibility of namespace collision. There is a package system, but it is unsupported and more or less deprecated. You can take look at a recent thread around the topic here -> http://www.erlang.org/pipermail/erlang-questions/2006-October/023728.html. The thread is spread over two months and not well connected in the mailing list ui so you may need to dig around a bit if you want to read the whole thread. On 7/24/07, Anthony Shipman wrote: > >From my reading of the doc, if a node has multiple applications then their > module names must be unique across all applications. Is this true? Do people > find this a problem? > > -- > Anthony Shipman Mamas don't let your babies > als@REDACTED grow up to be outsourced. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From peter@REDACTED Wed Jul 25 08:23:05 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 25 Jul 2007 02:23:05 -0400 Subject: [erlang-questions] Stand Alone Erlang Still Updated? Message-ID: Hello, I have been playing with erlang for the past few months and I really enjoyed it. I am now looking to do more production work with it. One of the things that I would like to do is to deploy erlang programs to desktop clients (Windows, Macs, and Linux). I saw that there is SAE, but it doesn't seem to have been updated since R9. I haven't actually tried it yet, but would it work for R11? Alternatively, how hard would it be to strip the erlang distribution down to the essentials? Thanks, Peter From christophe.romain@REDACTED Wed Jul 25 09:05:47 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 25 Jul 2007 09:05:47 +0200 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: References: Message-ID: Hello Using CEAN production distribution, you can deploy the strict minimum for all your platforms. it comes with a 3Mb installer that contains erts and minimal requirements. it runs R11B-5. http://cean.process-one.net/ enjoy. From bjt@REDACTED Wed Jul 25 09:15:13 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Wed, 25 Jul 2007 17:15:13 +1000 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: References: Message-ID: <46A6F881.5070208@pmp.com.au> G'day Peter, The "standard" for stripped-down, only-the-essentials Erlang would be the CEAN distribution. It is also about as close to SAE as I have seen for a while. I personally would prefer the ability to distribute Erlang in an SAE manner (i.e. exe with single zip), but CEAN comes close. You might alo wish to look at how Wings3D handles distribution. It is written in Erlang and happens to be a very capable mesh modelling tool (i.e. 3D graphics modeling). Regards, B.J.Tolputt Peter K Chan wrote: > Hello, > I have been playing with erlang for the past few months and I > really enjoyed it. I am now looking to do more production work with it. > One of the things that I would like to do is to deploy erlang programs > to desktop clients (Windows, Macs, and Linux). I saw that there is SAE, > but it doesn't seem to have been updated since R9. I haven't actually > tried it yet, but would it work for R11? > > Alternatively, how hard would it be to strip the erlang > distribution down to the essentials? > > Thanks, > > Peter > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From ulf.wiger@REDACTED Wed Jul 25 15:40:30 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 25 Jul 2007 15:40:30 +0200 Subject: [erlang-questions] View patterns In-Reply-To: <59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz> References: <200707251056.34272.als@iinet.net.au> <59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550254651B@esealmw115.eemea.ericsson.se> ok wrote: > > One of the things which is about to be added to GHC > is view patterns. > The idea is that if E is an expression and P is a > pattern, then > (E -> P) > is a pattern. This pattern matches a value V if > and only if P = (E)(V). > [...] > > People who dislike n+k patterns in Haskell can no longer hurt > us much by taking them out. With the aid of > > np(K, X) when integer(X), integer(K), X >= K -> > {X}; > np(_, _) -> > false. > > we can rewrite > > factorial(0) -> 1; > factorial(N+1) -> (N+1)*factorial(N). > > as > > factorial(0) -> 1; > factorial((np(1) -> {N})) -> (N+1)*factorial(N). Interesting stuff. I'm a bit unsure about the semantics of this last one. I wrote a parse transform to allow for experimentation with view patterns without revising the Erlang grammar, and changed the above to: factorial(0) -> 1; factorial(_:_(np, [1], {N}) -> (N+1)*factorial(N). (Obviously not an improvement over your syntax) which was transformed into: np(K, X) when integer(X), integer(K), X >= K -> {X}; np(_, _) -> false. factorial(0) -> 1; factorial(V73) -> case np(1, V73) of {N} -> (N + 1) * factorial(N); _ -> erlang:error(function_clause) end. But something is obviously wrong, since this will not terminate. Could you please enlighten me? BR, Ulf W From lenartlad@REDACTED Wed Jul 25 16:07:42 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 25 Jul 2007 16:07:42 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers Message-ID: <46A7592E.4090904@volny.cz> Hello, I have a supervisor that has one worker child (a gen_server) which has an ODBC session to a database. When I terminate the supervisor by evaluating exit(Sup, shutdown), ODBC session terminates with error saying that its client (my worker) was terminated "abnormally". I thought that exit(Sup, shutdown) is the proper (normal) way how to gracefully terminate a supervision tree, meaning that gen_server terminate/2 callback function of my worker will be called... So my question is, how to terminate a supervision tree so that a worker has a chance to clean up after itself? Thanks, Ladislav Lenart From Lennart.Ohman@REDACTED Wed Jul 25 17:35:29 2007 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Wed, 25 Jul 2007 17:35:29 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers In-Reply-To: <46A7592E.4090904@volny.cz> Message-ID: Hi, have you turned trap_exit to true in your worker? A gen_server process does not automatically start trapping exits and will therefore of course respond immediately to an exit signal from its supervisor (an exit signal other than normal that is) unless trapping exits. Best Regards Lennart ------------------------------------------------------------------------------- Lennart ?hman phone: +46 8 587 623 27 Sj?land & Thyselius Telecom AB cell : +46 70 552 6735 H?lsingegatan 43, 10th floor fax : +46 8 667 8230 SE-113 31 STOCKHOLM, SWEDEN email: lennart.ohman@REDACTED -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ladislav Lenart Sent: den 25 juli 2007 16:08 To: Erlang-Questions (E-mail) Subject: [erlang-questions] [Q]: Terminating supervisor and its workers Hello, I have a supervisor that has one worker child (a gen_server) which has an ODBC session to a database. When I terminate the supervisor by evaluating exit(Sup, shutdown), ODBC session terminates with error saying that its client (my worker) was terminated "abnormally". I thought that exit(Sup, shutdown) is the proper (normal) way how to gracefully terminate a supervision tree, meaning that gen_server terminate/2 callback function of my worker will be called... So my question is, how to terminate a supervision tree so that a worker has a chance to clean up after itself? Thanks, Ladislav Lenart _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From lenartlad@REDACTED Wed Jul 25 17:48:10 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 25 Jul 2007 17:48:10 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers In-Reply-To: References: Message-ID: <46A770BA.3010602@volny.cz> Lennart ?hman wrote: > have you turned trap_exit to true in your worker? No, I haven't. And frankly I don't want to. I am using a standard piece of library functionality so why I have to tweak my callback module to make it work? (I was hoping that gen_server:start and gen_server:start_link will make the difference.) But if this is the Erlang way, I will do it. Thanks for your prompt reply, Ladislav Lenart > A gen_server process does not automatically start trapping exits > and will therefore of course respond immediately to an exit signal > from its supervisor (an exit signal other than normal that is) unless > trapping exits. > > Best Regards > Lennart > > ------------------------------------------------------------------------------- > Lennart ?hman phone: +46 8 587 623 27 > Sj?land & Thyselius Telecom AB cell : +46 70 552 6735 > H?lsingegatan 43, 10th floor fax : +46 8 667 8230 > SE-113 31 STOCKHOLM, SWEDEN email: lennart.ohman@REDACTED > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ladislav Lenart > Sent: den 25 juli 2007 16:08 > To: Erlang-Questions (E-mail) > Subject: [erlang-questions] [Q]: Terminating supervisor and its workers > > Hello, > > I have a supervisor that has one worker child (a gen_server) which has an ODBC session to a database. When I terminate the supervisor by evaluating exit(Sup, shutdown), ODBC session terminates with error saying that its client (my worker) was terminated "abnormally". > > I thought that exit(Sup, shutdown) is the proper (normal) way how to gracefully terminate a supervision tree, meaning that gen_server terminate/2 callback function of my worker will be called... > > So my question is, how to terminate a supervision tree so that a worker has a chance to clean up after itself? > > Thanks, > > Ladislav Lenart > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From peter@REDACTED Wed Jul 25 18:14:55 2007 From: peter@REDACTED (Peter K Chan) Date: Wed, 25 Jul 2007 12:14:55 -0400 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <46A6F881.5070208@pmp.com.au> References: <46A6F881.5070208@pmp.com.au> Message-ID: Thank you, Ben and Chris. I am already using CEAN but didn't realize that it could be used for distribution. I will have to check out Wings3D too. Thanks, Peter -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Benjamin Tolputt Sent: Wednesday, July 25, 2007 2:15 AM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Stand Alone Erlang Still Updated? G'day Peter, The "standard" for stripped-down, only-the-essentials Erlang would be the CEAN distribution. It is also about as close to SAE as I have seen for a while. I personally would prefer the ability to distribute Erlang in an SAE manner (i.e. exe with single zip), but CEAN comes close. You might alo wish to look at how Wings3D handles distribution. It is written in Erlang and happens to be a very capable mesh modelling tool (i.e. 3D graphics modeling). Regards, B.J.Tolputt Peter K Chan wrote: > Hello, > I have been playing with erlang for the past few months and I > really enjoyed it. I am now looking to do more production work with it. > One of the things that I would like to do is to deploy erlang programs > to desktop clients (Windows, Macs, and Linux). I saw that there is SAE, > but it doesn't seem to have been updated since R9. I haven't actually > tried it yet, but would it work for R11? > > Alternatively, how hard would it be to strip the erlang > distribution down to the essentials? > > Thanks, > > Peter > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From thomasl_erlang@REDACTED Wed Jul 25 18:34:30 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 25 Jul 2007 09:34:30 -0700 (PDT) Subject: [erlang-questions] View patterns In-Reply-To: <59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz> Message-ID: <547105.67521.qm@web38804.mail.mud.yahoo.com> --- ok wrote: > Haskell is starting to eat Erlang's lunch, except > for hot loading. > Data.ByteString (and especially > Data.ByteString.Lazy) is an effective > replacement for Erlang binaries, with support for > packing and unpacking > stuff. There's even talk about an analogue of 'bit > syntax'. If this also involved monads, what I've seen of it looked interesting, but figuring out the details made my head hurt. (I've in recent years seen at least a handful of distinct non-Erlang efforts on translating between bits and tree data, actually. PADS and Packettypes are two examples. Also, "high level views of low level representations" in ICFP 2005.) > One of the things which is about to be added to GHC > is view patterns. > The idea is that if E is an expression and P is a > pattern, then > (E -> P) > is a pattern. This pattern matches a value V if and > only if > P = (E)(V). So a simple compilation scheme would be: case X of (E -> P) -> B; Clss end => case (catch E(X)) of P -> B; _ -> case X of Clss end end Clearly a pattern appearing several times, like min_list in the example, will need factoring or it will be dog slow from repeated evaluation. If patterns can be known to be side-effect free, a compiler could treat them as common subexpressions and eliminate them accordingly. (A haskell compiler would probably do that immediately.) But let's leave such considerations for later. A pattern can then be an expression pattern or a conventional pattern, with conventional or expression subpatterns, and so on. The best approach to evaluating these is probably to defer expression patterns as late as possible. So, replace an expression pattern with a placeholder, then match the placeholder later: {a, (E1->P1), {b, 4711}, (E2->P2)} => {a, X1, {b, 4711}, X2} + subsequent expression matching of (E1->P1)(X1) and (E2->P2)(X2). We can then probably break mixed patterns up into bouts of pattern matching and expression evaluation. Here is a very simple approach (which certainly could be improved, but it's concise): match all of (E1->P1)(X1),...,(En->Pn)(Xn) => case {E1(X1), ..., En(Xn)} of {P1,...,Pn} -> ...; ... end You can throw in some conventional pattern matches there too, I'd guess, but it's probably better to do them before expression matches (avoid evaluating the expressions E if possible). Given this approach, the previous pattern above would then be compiled into: case X of {a, T1, {b, 4711}, T2} -> case {E1(T1), E2(T2)} of {P1, P2} -> Body; ... end ... end Where the ellipses "..." indicate where we might run into code duplication: the 'failure continuation' is duplicated. Avoiding code duplication is probably a key issue for a successful compilation scheme. Think what happens when the duplications start stacking up. Obviously, this is just a rough sketch, and may well run into problems when we start looking at corner cases. (On the other hand, _we_ won't have to worry about being maximally lazy or not :-). But on consideration, implementing expression patterns as a source-to-source (or core Erlang) transformation doesn't seem insurmountable. I think there could be some nice optimizations in there too, e.g., eliminating repeated evaluation, avoiding code duplication, choosing which expression to evaluate first, ... All in all, it seems like, say, a good, publishable final project for a clever student. Best, Thomas ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ From fritchie@REDACTED Wed Jul 25 23:14:48 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 25 Jul 2007 16:14:48 -0500 Subject: [erlang-questions] Lennart Ohman's Erlang Tech Talk now on Google Video Message-ID: <200707252114.l6PLEmVi040157@snookles.snookles.com> Greetings. Last week, Lennart Ohman gave a talk at Google's headquarters in Mountain View, California. The video recording of his presentation is now available on Google Video. Many thanks to John Brewer for orignally inviting me to give give a tech talk at Google, to Lennart for graciously being the waaaay more experienced person to actually deliver the talk, the tech talk support staff for some technical gymnastics for the recording and editing, and to Google's Video service for making it possible to share the tech talk with a much larger audience. -Scott ------- Forwarded Message Date: Wed, 25 Jul 2007 13:38:03 -0700 From: "John Brewer" To: "Lennart Ohman", "Scott Lystig Fritchie" Subject: Erlang Tech Talk now on Google Video Lennart's tech talk is now posted to Google Video: http://video.google.com/videoplay?docid=240707194662243675 Thanks again for coming. -- const John const Brewer const ------- End of Forwarded Message From ok@REDACTED Thu Jul 26 05:12:56 2007 From: ok@REDACTED (ok) Date: Thu, 26 Jul 2007 15:12:56 +1200 Subject: [erlang-questions] View patterns In-Reply-To: <6616D98C65DD514BA2E1DDC5F92231550254651B@esealmw115.eemea.ericsson.se> References: <200707251056.34272.als@iinet.net.au> <59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz> <6616D98C65DD514BA2E1DDC5F92231550254651B@esealmw115.eemea.ericsson.se> Message-ID: <84D3A5FE-5076-443A-95B9-DCBEB00D10EE@cs.otago.ac.nz> I made a mistake. np(K, X) when integer(X), integer(K), X >= K -> {X}; %%%% HERE np(_, _) -> false. should of course be np(K, X) when integer(X), integer(K), X >= K -> {X - K}; np(_, _) -> false. Fix that and all is well. The real trick with view patterns is to compile them so that you do not do too much repeated work. From sanjaya@REDACTED Thu Jul 26 07:04:44 2007 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Thu, 26 Jul 2007 10:34:44 +0530 Subject: [erlang-questions] Erlang Shell and record_info ?? Message-ID: <042101c7cf42$7b2ce740$9a0810ac@wavenet.lk> Hi, Reference Manual says: To each module using records, a pseudo function is added >> during compilation << to obtain information about records: record_info(fields, Record) -> [Field] record_info(size, Record) -> Size It's understandable, but is it not a good idea to include it to erlang shell?? thanks Sanjaya Vitharana. 2> rl(). ok 3> 3> A=rd(a,{b,c,d}). a 4> A. a 5> rl(). -record(a,{b,c,d}). ok 6> B=#a{}. #a{b = undefined,c = undefined,d = undefined} 7> 7> 7> 7> B#a.c. undefined 8> 8> record_info(fields,B). ** 2: illegal record info ** 9> 9> record_info(size, B). ** 2: illegal record info ** 10> 10> C=B#a{c=rtest}. #a{b = undefined,c = rtest,d = undefined} 11> 11> B#a.c. undefined 12> C#a.c. rtest 13> -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrickdlogan@REDACTED Thu Jul 26 08:58:45 2007 From: patrickdlogan@REDACTED (Patrick D. Logan) Date: Thu, 26 Jul 2007 02:58:45 -0400 Subject: [erlang-questions] Report from OSCON Message-ID: <1185433125.1526@stardecisions.com> I am at OSCON 2007 in Portland, Oregon. Here's a quick report... Erlang BOF -- I hosted a 1 hour BOF session on Monday night. Mainly with the book, and all, I wondered who and how many might show up for such a thing, especially on the first night of tutorials and not a main conference night. About 20 people turned up, significantly more than I had estimated. I only had one co-worker there so I did not inflate the number with friends or anything. A few had tried Erlang at least once. Everyone was interested as a beginner to understand something about it. So I spent the hour with erl and some files in emacs, 30 min. on sequential stuff and 30 min. on concurrency. Given questions, etc. the sequential part touched on basic data types, esp. lists and just a bit on tuples. Nothing about records. Most of the sequential section I spent on single-assignment, pattern matching, and pattern clauses to define funtions. A bit on tail recursion, esp. in the absence of imperative assignment and iteration statements. The concurrency section I spent on simple spawning, asynchronous send, pattern-matching clauses to receive, and piecing together an rpc. It seemed to go over well at the time, and I've talked with a few people since and they confirmed that too. The new book -- Joe Armstrong's book is getting a lot of attention. First people at the BOF knew of it and I had it on hand to recommend. It is also for sale at the O'Reilly / Powells.com on-site book "store" in the main hallway. On the vendor exhibit floor the Pragmatic Programmer's booth has the Erlang book cover as a big banner taking up the back wall of their booth. So pretty good visibility there. One additional observation -- Simon Peyton Jones of the Haskell world gave a 15 minute keynote on "software transactional memory". My opinion is most of the programmers there would benefit more from Erlang's shared-nothing asynchronous message passing. Getting Joe Armstrong or someone to do a keynote on *that* next year would be something. Also given the number of curious beginners at the BOF an additional event next year would seem to be a half-day tutorial on Erlang. Again Simon PJ did this for Haskell, so every reason to think it would work for Erlang next time. I'm going to check in with the publisher's booth this week to see how the book is being received. Finally -- a friend from another publishing company said something based on erlang would be interesting to him, so if anyone has ideas I can pass his contact information along. From samuelrivas@REDACTED Thu Jul 26 09:10:00 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Thu, 26 Jul 2007 09:10:00 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers In-Reply-To: <46A770BA.3010602@volny.cz> References: <46A770BA.3010602@volny.cz> Message-ID: <20070726071000.GA21573@lambdastream.com> Ladislav Lenart wrote: > Lennart ?hman wrote: > > have you turned trap_exit to true in your worker? > > No, I haven't. And frankly I don't want to. I am using > a standard piece of library functionality so why I have > to tweak my callback module to make it work? (I was > hoping that gen_server:start and gen_server:start_link > will make the difference.) > > But if this is the Erlang way, I will do it. If you do not trap exits, the process will die at the moment it receives the 'EXIT' signal. The OTP-way is putting a process_flag(trap_exit, true) in the gen_server's init function and write your cleanup code in the gen_server's terminate/2 function. Regards -- Samuel From ulf.wiger@REDACTED Thu Jul 26 09:30:15 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 26 Jul 2007 09:30:15 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers In-Reply-To: <46A7592E.4090904@volny.cz> References: <46A7592E.4090904@volny.cz> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550254660F@esealmw115.eemea.ericsson.se> The OTP behaviours will only recognize {'EXIT',Pid,shutdown} as a "normal" exit if Pid is the parent process. You might want to try supervisor:terminate_child/2. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Ladislav Lenart > Sent: den 25 juli 2007 16:08 > To: Erlang-Questions (E-mail) > Subject: [erlang-questions] [Q]: Terminating supervisor and > its workers > > Hello, > > I have a supervisor that has one worker child (a gen_server) > which has an ODBC session to a database. When I terminate the > supervisor by evaluating exit(Sup, shutdown), ODBC session > terminates with error saying that its client (my worker) was > terminated "abnormally". > > I thought that exit(Sup, shutdown) is the proper (normal) way > how to gracefully terminate a supervision tree, meaning that > gen_server terminate/2 callback function of my worker will be > called... > > So my question is, how to terminate a supervision tree so > that a worker has a chance to clean up after itself? > > Thanks, > > Ladislav Lenart > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Thu Jul 26 10:04:37 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 26 Jul 2007 10:04:37 +0200 Subject: [erlang-questions] View patterns In-Reply-To: <84D3A5FE-5076-443A-95B9-DCBEB00D10EE@cs.otago.ac.nz> References: <200707251056.34272.als@iinet.net.au><59101FF2-CF4F-4B4B-9C51-C1DBAB1B03C5@cs.otago.ac.nz><6616D98C65DD514BA2E1DDC5F92231550254651B@esealmw115.eemea.ericsson.se> <84D3A5FE-5076-443A-95B9-DCBEB00D10EE@cs.otago.ac.nz> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550254663E@esealmw115.eemea.ericsson.se> Hmph! Some parentheses were also missing in my transcription. Luckily, I received the Erlang book yesterday, so I can read up how to do basic Erlang programming... I've attached my parse transform. Compiling with 'P' gives a good idea of what transformation is done. It only handles patterns in function clauses, and doesn't attempt to reduce repeated work. It's just intended as a starting point for some experimentation. == Example -module(test) -compile({parse_transform, vp_expand}). -export([factorial/1]). np(K, X) when integer(X), integer(K), X >= K -> {X-K}; np(_, _) -> false. factorial(0) -> 1; factorial(_:_(np,[1], {N})) -> (N+1)*factorial(N). == The nice thing about the _:_(...) pattern is that it's syntactically valid, but wholly illegal in all contexts. If you forget to do the parse transform, the code will not compile. (: BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ok > Sent: den 26 juli 2007 05:13 > To: Erlang Questions > Subject: Re: [erlang-questions] View patterns > > I made a mistake. > > np(K, X) when integer(X), integer(K), X >= K -> > {X}; %%%% HERE > np(_, _) -> > false. > > should of course be > > np(K, X) when integer(X), integer(K), X >= K -> > {X - K}; > np(_, _) -> > false. > > Fix that and all is well. > > The real trick with view patterns is to compile them so that > you do not do too much repeated work. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- A non-text attachment was scrubbed... Name: vp_expand.erl Type: application/octet-stream Size: 6669 bytes Desc: vp_expand.erl URL: From lenartlad@REDACTED Thu Jul 26 10:56:44 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 26 Jul 2007 10:56:44 +0200 Subject: [erlang-questions] [Q]: Terminating supervisor and its workers In-Reply-To: <20070726071000.GA21573@lambdastream.com> References: <46A770BA.3010602@volny.cz> <20070726071000.GA21573@lambdastream.com> Message-ID: <46A861CC.3040008@volny.cz> Samuel Rivas wrote: > Ladislav Lenart wrote: >> Lennart ?hman wrote: >>> have you turned trap_exit to true in your worker? >> No, I haven't. And frankly I don't want to. I am using >> a standard piece of library functionality so why I have >> to tweak my callback module to make it work? (I was >> hoping that gen_server:start and gen_server:start_link >> will make the difference.) >> >> But if this is the Erlang way, I will do it. > > If you do not trap exits, the process will die at the moment it receives the > 'EXIT' signal. The OTP-way is putting a process_flag(trap_exit, true) in the > gen_server's init function and write your cleanup code in the gen_server's > terminate/2 function. I browsed gen_server sources and found that it explicitly catches any exit signal from its parent (not only shutdown) and terminates itself with same reason (just like OTP doc says). So the only thing missing is the trap_exit flag as you all pointed me out. But what I dislike (a little) about trapping exits in general is that it can easily "hide errors". For example, if my process is linked with something else and that something crashes, my process would normally crash but because it is trapping exits now, I must explicitly handle the exit signal (either to crash as before or to restart that buggy thingy). Thank you all once again for your replies. Ladislav Lenart From francesco@REDACTED Thu Jul 26 12:13:09 2007 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 26 Jul 2007 11:13:09 +0100 Subject: [erlang-questions] Erlang and Neural Networks Message-ID: <46A873B5.8050102@erlang-consulting.com> Having been a firm believer that Erlang is a perfect fit for AI for quite some time, I was over the moon when I found a blog entry on Erlang being used in a context of Neural Networks. Wil has kindly ported his series of blog articles to trapexit, adding to the existing AI category. I am sure those of you interested in AI will find it interesting. The URL is http://www.trapexit.org/index.php/Erlang_and_Neural_Networks Regards, Francesco -- http://www.erlang-consulting.com From erlanging@REDACTED Thu Jul 26 08:20:43 2007 From: erlanging@REDACTED (Jeremy Chow) Date: Thu, 26 Jul 2007 14:20:43 +0800 Subject: [erlang-questions] what the macro OSE stands for ? Message-ID: <6cef17180707252320x74d77ee1ye5b74856b6194afe@mail.gmail.com> Hi all, I dedicated into studing the otp source codes these days, and get a question . what the macro OSE stands for ? Thx Jeremy From ulf.wiger@REDACTED Thu Jul 26 12:44:00 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 26 Jul 2007 12:44:00 +0200 Subject: [erlang-questions] what the macro OSE stands for ? In-Reply-To: <6cef17180707252320x74d77ee1ye5b74856b6194afe@mail.gmail.com> References: <6cef17180707252320x74d77ee1ye5b74856b6194afe@mail.gmail.com> Message-ID: <6616D98C65DD514BA2E1DDC5F9223155025466EA@esealmw115.eemea.ericsson.se> The macro? OSE = Open Source Erlang (in this community) To most telco people, it will likely mean the OSE real-time operating system from Enea. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Jeremy Chow > Sent: den 26 juli 2007 08:21 > To: erlang-questions@REDACTED > Subject: [erlang-questions] what the macro OSE stands for ? > > Hi all, > I dedicated into studing the otp source codes these days, > and get a question . what the macro OSE stands for ? > > > Thx > Jeremy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lukas@REDACTED Thu Jul 26 14:27:34 2007 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 26 Jul 2007 14:27:34 +0200 Subject: [erlang-questions] Erlang Shell and record_info ?? In-Reply-To: <042101c7cf42$7b2ce740$9a0810ac@wavenet.lk> References: <042101c7cf42$7b2ce740$9a0810ac@wavenet.lk> Message-ID: <6a2eaa910707260527k1f54cac6n5abeaa2ecb94f744@mail.gmail.com> Hi, You are supposed to use the name of the record as the last argument in record_info and not the record it self. So in your example that would be record_info(fields, a). Used like this record_info works perfectly in the shell. On 7/26/07, Sanjaya Vitharana wrote: > > > Hi, > > Reference Manual says: > > > To each module using records, a pseudo function is added >> during > compilation << to obtain information about records: record_info(fields, > Record) -> [Field] > record_info(size, Record) -> Size > > It's understandable, but is it not a good idea to include it to erlang > shell?? > > > thanks > > Sanjaya Vitharana. > > 2> rl(). > ok > 3> > 3> A=rd(a,{b,c,d}). > a > 4> A. > a > 5> rl(). > -record(a,{b,c,d}). > ok > 6> B=#a{}. > #a{b = undefined,c = undefined,d = undefined} > 7> > 7> > 7> > 7> B#a.c. > undefined > 8> > 8> record_info(fields,B). > ** 2: illegal record info ** > 9> > 9> record_info(size, B). > ** 2: illegal record info ** > 10> > 10> C=B#a{c=rtest}. > #a{b = undefined,c = rtest,d = undefined} > 11> > 11> B#a.c. > undefined > 12> C#a.c. > rtest > 13> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Lukas Larsson Software Engineer Erlang Training and Consulting Ltd From dunceor@REDACTED Thu Jul 26 12:39:48 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Thu, 26 Jul 2007 12:39:48 +0200 Subject: [erlang-questions] what the macro OSE stands for ? In-Reply-To: <6cef17180707252320x74d77ee1ye5b74856b6194afe@mail.gmail.com> References: <6cef17180707252320x74d77ee1ye5b74856b6194afe@mail.gmail.com> Message-ID: <5d84cb30707260339q648eb9fcyaefcef7824c348f5@mail.gmail.com> On 7/26/07, Jeremy Chow wrote: > Hi all, > I dedicated into studing the otp source codes these days, and get a > question . what the macro OSE stands for ? > > > Thx > Jeremy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > Well since we are talking Erlang and Ericsson my guess is that it stands for Operating System Embedded, an OS that is used widely on Ericsson. http://en.wikipedia.org/wiki/Operating_System_Embedded. Maybe operating system specific macros? br Karl From dunceor@REDACTED Thu Jul 26 16:38:51 2007 From: dunceor@REDACTED (=?UTF-8?Q?Karl_Sj=C3=B6dahl_-_dunceor?=) Date: Thu, 26 Jul 2007 16:38:51 +0200 Subject: [erlang-questions] Erlang book now shipping In-Reply-To: <8ed733900707201522x2c281c93i22cb7ab9bf99e8a7@mail.gmail.com> References: <9b08084c0707160057s4a2549d7w5967d10eef7322e1@mail.gmail.com> <8ed733900707201522x2c281c93i22cb7ab9bf99e8a7@mail.gmail.com> Message-ID: <5d84cb30707260738l2415f70dlcbfe3fcf998a7189@mail.gmail.com> On 7/21/07, Simon Chappell wrote: > On 7/16/07, Joe Armstrong wrote: > > The Erlang book has arrived at the publishers. > > > > The first batches of books to individual custormer will start shipping today. > > > > /Joe > > Got mine this morning. :-) > > Simon > > -- > simonpeter.org | simonpeter.com | techbook.info > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > My book arrived today in Sweden, looking forward to try some examples tonight. Thanks! From samuelrivas@REDACTED Thu Jul 26 17:16:21 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Thu, 26 Jul 2007 17:16:21 +0200 Subject: [erlang-questions] Distributed application on unreliable network Message-ID: <20070726151621.GA31552@lambdastream.com> Hi, Suppose I have one application distributed in two nodes, node1 and node2, in two different hosts. node1@REDACTED has higher priority than node2@REDACTED While communication between host1 and host2 is ok everything works right, whenever node1 is up and the application started in that node, the application is not running in node2. If node1 crashes, node2 takes it over. But, if communication between host1 and host2 breaks down, after a timeout node2 reports it and starts the application. That is fine, but if communication returns, application is no longer distributed, it is running on both nodes. Even if I connect node1 and node2 (e.g. with net:ping/1). The only way I found to restore it is tearing one of the nodes down ... Is this correct or am I doing something dumb? -- Samuel From Chris.Curtis@REDACTED Thu Jul 26 18:01:46 2007 From: Chris.Curtis@REDACTED (Chris Curtis) Date: Thu, 26 Jul 2007 12:01:46 -0400 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <46A6F881.5070208@pmp.com.au> References: <46A6F881.5070208@pmp.com.au> Message-ID: <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> Is there any good place to start to get into what needs to happen for SAE to work for R11? --chris -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Benjamin Tolputt Sent: Wednesday, July 25, 2007 3:15 AM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Stand Alone Erlang Still Updated? G'day Peter, The "standard" for stripped-down, only-the-essentials Erlang would be the CEAN distribution. It is also about as close to SAE as I have seen for a while. I personally would prefer the ability to distribute Erlang in an SAE manner (i.e. exe with single zip), but CEAN comes close. You might alo wish to look at how Wings3D handles distribution. It is written in Erlang and happens to be a very capable mesh modelling tool (i.e. 3D graphics modeling). Regards, B.J.Tolputt Peter K Chan wrote: > Hello, > I have been playing with erlang for the past few months and I > really enjoyed it. I am now looking to do more production work with it. > One of the things that I would like to do is to deploy erlang programs > to desktop clients (Windows, Macs, and Linux). I saw that there is SAE, > but it doesn't seem to have been updated since R9. I haven't actually > tried it yet, but would it work for R11? > > Alternatively, how hard would it be to strip the erlang > distribution down to the essentials? > > Thanks, > > Peter > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From tty.erlang@REDACTED Thu Jul 26 18:25:38 2007 From: tty.erlang@REDACTED (t ty) Date: Thu, 26 Jul 2007 12:25:38 -0400 Subject: [erlang-questions] Distributed application on unreliable network In-Reply-To: <20070726151621.GA31552@lambdastream.com> References: <20070726151621.GA31552@lambdastream.com> Message-ID: <290b3ba10707260925q7546901fs562c0de354b4b014@mail.gmail.com> this is correct. you can search this mailing list for similar discussions especially related to mnesia. t On 7/26/07, Samuel Rivas wrote: [snip] > But, if communication between host1 and host2 breaks down, after a timeout > node2 reports it and starts the application. That is fine, but if communication > returns, application is no longer distributed, it is running on both nodes. Even > if I connect node1 and node2 (e.g. with net:ping/1). The only way I found to > restore it is tearing one of the nodes down ... > > Is this correct or am I doing something dumb? > -- > Samuel > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From christophe.romain@REDACTED Thu Jul 26 22:12:54 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Thu, 26 Jul 2007 22:12:54 +0200 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> References: <46A6F881.5070208@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> Message-ID: well, just tell me what you need, i'll include cean the ability to. i may have a look at sae anyway. From vpkaihla@REDACTED Fri Jul 27 06:59:55 2007 From: vpkaihla@REDACTED (Vesa Kaihlavirta) Date: Thu, 26 Jul 2007 21:59:55 -0700 Subject: [erlang-questions] Emakefile confusion Message-ID: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> Emake is not acting as I think it should be. This works as expected. # ls *.erl | wc -l 5 # erlc -o beam/ *erl # ls beam/ | wc -l 5 # rm beam/* But if I try the same with emake, the beams end up in the same directory: # cat Emakefile {'*', [{o, "beam/"}]}. # erl Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.5 (abort with ^G) 1> make:all(). Recompile: ... Recompile: ... ... up_to_date 2> q(). ok # ls -l beam/ # ls *.beam | wc -l 5 Am I using it wrong or is it broken? erl -man make suggests that giving the 'o' parameter should work like that. --vk -------------- next part -------------- An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Fri Jul 27 09:17:37 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Fri, 27 Jul 2007 15:17:37 +0800 Subject: [erlang-questions] Emakefile confusion In-Reply-To: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> References: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> Message-ID: I'm not sure what the problem ('o' vs 'outdir', or the inital path './'), but the following line works as expected on my machine: {"*", [{outdir, "./beam/"}]}. br On 7/27/07, Vesa Kaihlavirta wrote: > > > Emake is not acting as I think it should be. > > This works as expected. > > # ls *.erl | wc -l > 5 > # erlc -o beam/ *erl > # ls beam/ | wc -l > 5 > # rm beam/* > > > But if I try the same with emake, the beams end up in the same directory: > > > # cat Emakefile > {'*', [{o, "beam/"}]}. > # erl > Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.5.5 (abort with ^G) > 1> make:all(). > Recompile: ... > Recompile: ... > ... > up_to_date > 2> q(). > ok > > # ls -l beam/ > # ls *.beam | wc -l > 5 > > > > Am I using it wrong or is it broken? erl -man make suggests that giving > the 'o' parameter should work like that. > > --vk > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dcaoyuan@REDACTED Fri Jul 27 13:43:13 2007 From: dcaoyuan@REDACTED (Caoyuan) Date: Fri, 27 Jul 2007 19:43:13 +0800 Subject: [erlang-questions] split_binary simple question In-Reply-To: <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> References: <20070708162532.GA17484@works.com> <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> Message-ID: Is there any difference between split_binary/2 and using binary match to split it? > B = <<48,49,50,51,52,53,54,55,56,57>>. <<"0123456789">> > {B1, B2} = split_binary(B,3). {<<"012">>,<<"3456789">>} > <> = B. <<"0123456789">> > {B3, B4}. {<<"012">>,<<"3456789">>} I mean the implementation, efficiency, and GC behavior etc. Thanks. On 7/9/07, Ulf Wiger wrote: > No, you will get two references into the original binary. > > BR, > Ulf W > > 2007/7/8, Mike McNally : > > Does split_binary/2 make two new copies of the pieces of the binary > > that's split? I would think not, but the documentation (which, it should > > be noted, I have a history of misunderstanding) doesn't say explicitly. > > > > > > -- > > [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- - Caoyuan From vpkaihla@REDACTED Fri Jul 27 15:11:11 2007 From: vpkaihla@REDACTED (Vesa Kaihlavirta) Date: Fri, 27 Jul 2007 16:11:11 +0300 Subject: [erlang-questions] Emakefile confusion In-Reply-To: References: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> Message-ID: <25acdd550707270611r430186fbt9a78a0c15688bf7c@mail.gmail.com> On 7/27/07, Ludovic Coquelle wrote: > > I'm not sure what the problem ('o' vs 'outdir', or the inital path './'), > but the following line works as expected on my machine: > {"*", [{outdir, "./beam/"}]}. > br That indeed helped. Thanks. What should I have been reading instead of erl -man make and erl -man erlc to figure out that by myself? --vk -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan@REDACTED Fri Jul 27 16:30:27 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 27 Jul 2007 16:30:27 +0200 (CEST) Subject: [erlang-questions] The meaning of OTP... In-Reply-To: References: <469F320F.664A.00DD.0@stgeorge.com.au> Message-ID: Yes, I really agree that the terminology used at Trap Exit ought to be consistent with the one used by the rest of the Erlang community. If the mastermind at Trap Exit persists, I suggest he/she should use the wording "Open TrapExit Platform". Then it would at least be obvious that the new meaning of the acronym is a local Trap Exit joke. ;-) If the Erlang community cannot agree of a new meaning of the acronym, we could adopt "Open TBD Platform" for the time being. ;-) /H?kan On Thu, 19 Jul 2007, Eric Merritt wrote: > Regardless of what is decided on the name, Trap Exit shouldn't go off > in it's own tangent. > > On 7/19/07, Niclas Eklund wrote: > > > > Hello! > > > > If you search the documentation you find stuff like net_adm:ping/1 pong | > > pang, the Event Trace (E.T.) function et:phone_home/5: > > > > http://www.erlang.org/doc/man/et.html > > > > BTW, I noticed that on http://www.trapexit.org/ start page Telecom has > > been replaced by Transaction. For example: > > > > "The Open Transaction Platform (OTP) is set of ..." > > > > Isn't it a bit confusing if we use different explanations of what the > > OTP acronym stands for? > > > > /Nick > > > > On Thu, 19 Jul 2007, Anthony Kong wrote: > > > > > What about "Oh, That's Powerful!" :-) > > > I think rebranding is usually a (meaningless) marketing exercise. > > > Erlang excels by its technical merit and this alone has enough > > > marketing power. OTP highlights where its heritage has come from and I > > > think it is a good thing. > > > For example, if you have read Joe's book, he mentioned about how > > > Mnesia get her name: "The original name was Amnesia. One of our bosses > > > didn't like the name. He said, "You can't possibly call it > > > Amnesia*you can't have a database that forgets things!" So we > > > dropped the A, and the name stuck." > > > > > > I cannot help laughing whenever i read this, > > > This is this kind of little stories make erlange what it is today, I > > > reckon. (+ other big technial/language design decision, of course) > > > > > > So, just keep OTP as it is, unless the same boss has something to say again > > > (Actually I am too new to erlang to make comment as such, but that's > > > just how I feel) > > > > > > Cheers, Anthony > > > > > > > > > >>> "Mike Berrow" 19/07/2007 7:03 am >>> > > > How about > > > "Omnipotence Through Parallelism" > > > > > > -- Mike > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > ********************************************************************** > > > ***** IMPORTANT INFORMATION ***** > > > This document should be read only by those persons to whom it is > > > addressed and its content is not intended for use by any other > > > persons. If you have received this message in error, please notify > > > us immediately. Please also destroy and delete the message from > > > your computer. Any unauthorised form of reproduction of this message > > > is strictly prohibited. > > > > > > St.George Bank Limited AFSL 240997, Advance Asset Management Limited > > > AFSL 240902, St.George Life Limited AFSL 240900, ASGARD Capital Management Limited > > > AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for > > > the proper and complete transmission of the information contained in > > > this communication, nor for any delay in its receipt. > > > ********************************************************************** From kosik@REDACTED Fri Jul 27 16:47:18 2007 From: kosik@REDACTED (Matej Kosik) Date: Fri, 27 Jul 2007 16:47:18 +0200 Subject: [erlang-questions] concerning exit Message-ID: <46AA0576.3090306@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, Concerning recursive processes, when I want to terminate (stop) some process, is it safe simply not to perform the recursive call? Do I have to perform the exit(normal) call? Is there any difference? What are sideffects of `exit'? Regards - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGqgV2L+CaXfJI/hgRAgmvAKDbP+VcAPHSmPE67UKWc0y+wYvkMwCgubH2 gjLVEB6SKN5/QUvZpBvKqRE= =G/R2 -----END PGP SIGNATURE----- From dloutrein.lists@REDACTED Fri Jul 27 17:15:18 2007 From: dloutrein.lists@REDACTED (denis) Date: Fri, 27 Jul 2007 11:15:18 -0400 Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: Message-ID: <001801c7d060$f18e6f70$b029030a@mtl.ubisoft.org> Still nobody have a response for this? I'm in the case of designing a server embedding mnesia with ram_copies tables. Several instances of the server can be launched, and the mnesia tables are replicated. I'm having the same concern with how many instances I can run before the transaction committing in mnesia becomes a problem. If someone already used several replicated mnesia instances, I would like to have some numbers. Thanks Denis > -----Message d'origine----- > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] De la part de David King > Envoy??: lundi 23 juillet 2007 21:24 > ??: Joel Reymont > Cc?: Erlang Questions > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > Did you ever get any off-list responses to this? I'm curious too. > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > Folks, > > > > How many Mnesia nodes are you running in your production > > installation? I'm looking to find the maximum here. > > > > I'm only dealing with ram_copies tables (cache), trying to figure out > > whether I can make every Yaws node a Mnesia node without slowing > > transactions down too much. > > > > My current thinking is to wait and gather statistics before trying to > > decouple Yaws and Mnesia . Still, I would love to know how much > > transactions slow down with the addition of every new Mnesia node. > > > > Thanks, Joel > > > > -- > > http://topdog.cc - EasyLanguage to C# compiler > > http://wagerlabs.com - Blog > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From hakan@REDACTED Fri Jul 27 17:39:57 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 27 Jul 2007 17:39:57 +0200 (CEST) Subject: [erlang-questions] concerning exit In-Reply-To: <46AA0576.3090306@fiit.stuba.sk> References: <46AA0576.3090306@fiit.stuba.sk> Message-ID: On Fri, 27 Jul 2007, Matej Kosik wrote: MK> Concerning recursive processes, when I want to terminate (stop) some MK> process, is it safe simply not to perform the recursive call? Do I MK> have to perform the MK> MK> exit(normal) MK> MK> call? Is there any difference? What are sideffects of `exit'? There are no difference. /H?kan From henrique.ferreiro@REDACTED Fri Jul 27 18:41:38 2007 From: henrique.ferreiro@REDACTED (Henrique Ferreiro) Date: Fri, 27 Jul 2007 18:41:38 +0200 Subject: [erlang-questions] apply/2 Message-ID: <1185554499.6226.2.camel@macbook> Hello, I noticed some extrange behaviour that this list surely can explain: 1> round(2.3). 2 2> apply(round, [2.3]). =ERROR REPORT==== 27-Jul-2007::18:40:22 === Error in process <0.31.0> with exit value: {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {{badfun,round}, [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** Thanks in advance, Henrique Ferreiro From jerith@REDACTED Fri Jul 27 18:51:22 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Fri, 27 Jul 2007 18:51:22 +0200 Subject: [erlang-questions] apply/2 In-Reply-To: <1185554499.6226.2.camel@macbook> References: <1185554499.6226.2.camel@macbook> Message-ID: <46AA228A.9060803@jerith.za.net> Henrique Ferreiro wrote: > Hello, > > I noticed some extrange behaviour that this list surely can explain: 1> round(2.3). 2 2> apply(round, [2.3]). =ERROR REPORT==== 27-Jul-2007::18:47:02 === Error in process <0.29.0> with exit value: {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {{badfun,round}, [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** 3> apply(erlang, round, [2.3]). 2 Looks like you need to specify the module... I'm not comfortable enough with the docs to find the reason in the time I have available, however. Sorry. :-/ --J From henrique.ferreiro@REDACTED Fri Jul 27 18:54:47 2007 From: henrique.ferreiro@REDACTED (Henrique Ferreiro) Date: Fri, 27 Jul 2007 18:54:47 +0200 Subject: [erlang-questions] apply/2 In-Reply-To: <46AA228A.9060803@jerith.za.net> References: <1185554499.6226.2.camel@macbook> <46AA228A.9060803@jerith.za.net> Message-ID: <1185555287.6226.5.camel@macbook> O Ven, 27-07-2007 ?s 18:51 +0200, Jeremy Thurgood escribiu: > Henrique Ferreiro wrote: > > Hello, > > > > I noticed some extrange behaviour that this list surely can explain: > > 1> round(2.3). > 2 > 2> apply(round, [2.3]). > > =ERROR REPORT==== 27-Jul-2007::18:47:02 === > Error in process <0.29.0> with exit value: > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {{badfun,round}, > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** > 3> apply(erlang, round, [2.3]). > 2 > > Looks like you need to specify the module... Taken from man erlang: apply(Fun, Args) -> term() | empty() Types Fun = fun() Args = [term()] Call a fun, passing the elements in Args as arguments. > I'm not comfortable enough with the docs to find the reason in the time > I have available, however. Sorry. :-/ > > --J From dmercer@REDACTED Fri Jul 27 18:58:52 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 27 Jul 2007 11:58:52 -0500 Subject: [erlang-questions] apply/2 In-Reply-To: <1185554499.6226.2.camel@macbook> References: <1185554499.6226.2.camel@macbook> Message-ID: <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> Fun round is in the erlang module. This should work: > apply(erlang, round, [2.3]). Cheers, David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique Ferreiro Sent: Friday, July 27, 2007 11:42 To: erlang-questions@REDACTED Subject: [erlang-questions] apply/2 Hello, I noticed some extrange behaviour that this list surely can explain: 1> round(2.3). 2 2> apply(round, [2.3]). =ERROR REPORT==== 27-Jul-2007::18:40:22 === Error in process <0.31.0> with exit value: {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {{badfun,round}, [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** Thanks in advance, Henrique Ferreiro _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vpkaihla@REDACTED Fri Jul 27 15:12:21 2007 From: vpkaihla@REDACTED (Vesa Kaihlavirta) Date: Fri, 27 Jul 2007 16:12:21 +0300 Subject: [erlang-questions] Emakefile confusion In-Reply-To: <25acdd550707270611r430186fbt9a78a0c15688bf7c@mail.gmail.com> References: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> <25acdd550707270611r430186fbt9a78a0c15688bf7c@mail.gmail.com> Message-ID: <25acdd550707270612t451b4614y55852df7fa10032d@mail.gmail.com> > On 7/27/07, Ludovic Coquelle wrote: > > > > I'm not sure what the problem ('o' vs 'outdir', or the inital path > > './'), but the following line works as expected on my machine: > > {"*", [{outdir, "./beam/"}]}. > > br > > > That indeed helped. Thanks. > To clarify: changing the first part of the tuple from 'o' to 'outdir' helped. --vk -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan@REDACTED Fri Jul 27 19:08:52 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 27 Jul 2007 19:08:52 +0200 (CEST) Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: <001801c7d060$f18e6f70$b029030a@mtl.ubisoft.org> References: <001801c7d060$f18e6f70$b029030a@mtl.ubisoft.org> Message-ID: The scalability of Mnesia depends heavily of your access patterns and how you have configured Mnesia. If you ensure that the number of nodes involved in a typical transaction is constant, Mnesia should scale very well. One way of achieving linear scalability characteristics, is to use the concept called "foreign_key" in the chapter about fragmented tables. The bench example (mnesia/examples/bench) utilizes this technique. When I wrote the "bench" benchmark example it turned out to scale almost perfectly linear. (By distributing the Mnesia tables over twice as many computers, the number of processed transactions per second also doubled.) But by that time I only had access to 10 (or was it 16?) identical computers, so I cannot say anything about how Mnesia scales beyond that. Worth to mentition is that I also did successfully run the bench example with fragmented tables distributed over all our machines at the office (50+). But as those computers had so different characteristics, it is impossible to say anything about the scalability. It was fun that it worked though. Chandru, do you still have the highscore of the number of Mnesia nodes in a production environment? /H?kan On Fri, 27 Jul 2007, denis wrote: > Date: Fri, 27 Jul 2007 11:15:18 -0400 > From: denis > To: 'David King' , 'Joel Reymont' > Cc: 'Erlang Questions' > Subject: Re: [erlang-questions] Maximum number of Mnesia nodes > > Still nobody have a response for this? > > I'm in the case of designing a server embedding mnesia with ram_copies > tables. Several instances of the server can be launched, and the mnesia > tables are replicated. > I'm having the same concern with how many instances I can run before the > transaction committing in mnesia becomes a problem. > > If someone already used several replicated mnesia instances, I would like to > have some numbers. > > Thanks > Denis > > > -----Message d'origine----- > > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > > bounces@REDACTED] De la part de David King > > Envoy??: lundi 23 juillet 2007 21:24 > > ??: Joel Reymont > > Cc?: Erlang Questions > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > Did you ever get any off-list responses to this? I'm curious too. > > > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > > > Folks, > > > > > > How many Mnesia nodes are you running in your production > > > installation? I'm looking to find the maximum here. > > > > > > I'm only dealing with ram_copies tables (cache), trying to figure out > > > whether I can make every Yaws node a Mnesia node without slowing > > > transactions down too much. > > > > > > My current thinking is to wait and gather statistics before trying to > > > decouple Yaws and Mnesia . Still, I would love to know how much > > > transactions slow down with the addition of every new Mnesia node. > > > > > > Thanks, Joel > > > > > > -- > > > http://topdog.cc - EasyLanguage to C# compiler > > > http://wagerlabs.com - Blog From bob@REDACTED Fri Jul 27 19:16:52 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 27 Jul 2007 10:16:52 -0700 Subject: [erlang-questions] apply/2 In-Reply-To: <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> References: <1185554499.6226.2.camel@macbook> <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> Message-ID: <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> apply/2 takes a fun, not the name of the function (an atom)... to use apply/2 you'd do this: apply(fun erlang:round/1, [2.3]). apply/3 takes the name of the module, the name of the function (both atoms), and the arguments as demonstrated. -bob On 7/27/07, David Mercer wrote: > Fun round is in the erlang module. This should work: > > > apply(erlang, round, [2.3]). > > Cheers, > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique Ferreiro > Sent: Friday, July 27, 2007 11:42 > To: erlang-questions@REDACTED > Subject: [erlang-questions] apply/2 > > Hello, > > I noticed some extrange behaviour that this list surely can explain: > > 1> round(2.3). > 2 > 2> apply(round, [2.3]). > > =ERROR REPORT==== 27-Jul-2007::18:40:22 === > Error in process <0.31.0> with exit value: > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {{badfun,round}, > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > ** > > Thanks in advance, > Henrique Ferreiro > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dmercer@REDACTED Fri Jul 27 19:25:57 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 27 Jul 2007 12:25:57 -0500 Subject: [erlang-questions] apply/2 In-Reply-To: <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> References: <1185554499.6226.2.camel@macbook> <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> Message-ID: <00fd01c7d073$31c92230$891ea8c0@SSI.CORP> Bob, I think you misinterpreted. I wasn't saying that it SHOULD work but does not. I was saying it should work AND DOES. I was showing the original poster how to modify his statement to get the answer he desires. That being said, as the poster seems adamant about not specifying the module name, the following should work AND DOES: > apply(fun(X) -> round(X) end, [2.3]). DBM -----Original Message----- From: Bob Ippolito [mailto:bob@REDACTED] Sent: Friday, July 27, 2007 12:17 To: dmercer@REDACTED Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] apply/2 apply/2 takes a fun, not the name of the function (an atom)... to use apply/2 you'd do this: apply(fun erlang:round/1, [2.3]). apply/3 takes the name of the module, the name of the function (both atoms), and the arguments as demonstrated. -bob On 7/27/07, David Mercer wrote: > Fun round is in the erlang module. This should work: > > > apply(erlang, round, [2.3]). > > Cheers, > > David > > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique Ferreiro > Sent: Friday, July 27, 2007 11:42 > To: erlang-questions@REDACTED > Subject: [erlang-questions] apply/2 > > Hello, > > I noticed some extrange behaviour that this list surely can explain: > > 1> round(2.3). > 2 > 2> apply(round, [2.3]). > > =ERROR REPORT==== 27-Jul-2007::18:40:22 === > Error in process <0.31.0> with exit value: > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {{badfun,round}, > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > ** > > Thanks in advance, > Henrique Ferreiro > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bob@REDACTED Fri Jul 27 20:31:29 2007 From: bob@REDACTED (Bob Ippolito) Date: Fri, 27 Jul 2007 11:31:29 -0700 Subject: [erlang-questions] apply/2 In-Reply-To: <00fd01c7d073$31c92230$891ea8c0@SSI.CORP> References: <1185554499.6226.2.camel@macbook> <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> <00fd01c7d073$31c92230$891ea8c0@SSI.CORP> Message-ID: <6a36e7290707271131h7d9fac63ib1ec733761179fbb@mail.gmail.com> I wasn't disagreeing with you, I was clarifying the previous misinterpretation of how apply/2 should work and using your message as a correct example of apply/3. Coffee much? On 7/27/07, David Mercer wrote: > Bob, I think you misinterpreted. I wasn't saying that it SHOULD work but > does not. I was saying it should work AND DOES. I was showing the original > poster how to modify his statement to get the answer he desires. > > That being said, as the poster seems adamant about not specifying the module > name, the following should work AND DOES: > > > apply(fun(X) -> round(X) end, [2.3]). > > DBM > > -----Original Message----- > From: Bob Ippolito [mailto:bob@REDACTED] > Sent: Friday, July 27, 2007 12:17 > To: dmercer@REDACTED > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] apply/2 > > apply/2 takes a fun, not the name of the function (an atom)... to use > apply/2 you'd do this: > > apply(fun erlang:round/1, [2.3]). > > apply/3 takes the name of the module, the name of the function (both > atoms), and the arguments as demonstrated. > > -bob > > On 7/27/07, David Mercer wrote: > > Fun round is in the erlang module. This should work: > > > > > apply(erlang, round, [2.3]). > > > > Cheers, > > > > David > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique > Ferreiro > > Sent: Friday, July 27, 2007 11:42 > > To: erlang-questions@REDACTED > > Subject: [erlang-questions] apply/2 > > > > Hello, > > > > I noticed some extrange behaviour that this list surely can explain: > > > > 1> round(2.3). > > 2 > > 2> apply(round, [2.3]). > > > > =ERROR REPORT==== 27-Jul-2007::18:40:22 === > > Error in process <0.31.0> with exit value: > > > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > > > ** exited: {{badfun,round}, > > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** > > > > Thanks in advance, > > Henrique Ferreiro > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From dloutrein.lists@REDACTED Fri Jul 27 20:57:14 2007 From: dloutrein.lists@REDACTED (denis) Date: Fri, 27 Jul 2007 14:57:14 -0400 Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: Message-ID: <002801c7d07f$f2f27b30$b029030a@mtl.ubisoft.org> Thanks Hakan for your response. If I understand well, fragmented tables are interesting when we have high volume of data. In my case, that's not the case, around 100000 records on 5 tables. I plan to have one mnesia instance per server (and one server per machine), each having each table in ram_copies replicated with the others servers. Each server uses his local mnesia instance (maybe that's not the better architecture?) My concern is when for instance I do a delete or an insert into a table. The transaction succeeds only when the insert or delete are done on each replicated table. If I have only one server, the transaction time will be for instance 10ms. If I have two server replicated, will it be 2*10ms ? For N servers, what kind of factor can I expect? N, log(n), exp(N) ...? I'm not sure that I can run 20 servers for instance, and keep good performance, depending on the response time of the transaction commitment on each node. Thanks Denis > -----Message d'origine----- > De?: Hakan Mattsson [mailto:hakan@REDACTED] > Envoy??: vendredi 27 juillet 2007 13:09 > ??: denis > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > The scalability of Mnesia depends heavily of your > access patterns and how you have configured Mnesia. > > If you ensure that the number of nodes involved in a > typical transaction is constant, Mnesia should scale > very well. One way of achieving linear scalability > characteristics, is to use the concept called > "foreign_key" in the chapter about fragmented > tables. The bench example (mnesia/examples/bench) > utilizes this technique. > > When I wrote the "bench" benchmark example it turned > out to scale almost perfectly linear. (By distributing > the Mnesia tables over twice as many computers, the > number of processed transactions per second also > doubled.) But by that time I only had access to 10 (or > was it 16?) identical computers, so I cannot say > anything about how Mnesia scales beyond that. Worth to > mentition is that I also did successfully run the bench > example with fragmented tables distributed over all our > machines at the office (50+). But as those computers > had so different characteristics, it is impossible to > say anything about the scalability. It was fun that it > worked though. > > Chandru, do you still have the highscore of the number > of Mnesia nodes in a production environment? > > /H?kan > > On Fri, 27 Jul 2007, denis wrote: > > > Date: Fri, 27 Jul 2007 11:15:18 -0400 > > From: denis > > To: 'David King' , 'Joel Reymont' > > > Cc: 'Erlang Questions' > > Subject: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > Still nobody have a response for this? > > > > I'm in the case of designing a server embedding mnesia with ram_copies > > tables. Several instances of the server can be launched, and the mnesia > > tables are replicated. > > I'm having the same concern with how many instances I can run before the > > transaction committing in mnesia becomes a problem. > > > > If someone already used several replicated mnesia instances, I would > like to > > have some numbers. > > > > Thanks > > Denis > > > > > -----Message d'origine----- > > > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > > > bounces@REDACTED] De la part de David King > > > Envoy??: lundi 23 juillet 2007 21:24 > > > ??: Joel Reymont > > > Cc?: Erlang Questions > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > Did you ever get any off-list responses to this? I'm curious too. > > > > > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > > > > > Folks, > > > > > > > > How many Mnesia nodes are you running in your production > > > > installation? I'm looking to find the maximum here. > > > > > > > > I'm only dealing with ram_copies tables (cache), trying to figure > out > > > > whether I can make every Yaws node a Mnesia node without slowing > > > > transactions down too much. > > > > > > > > My current thinking is to wait and gather statistics before trying > to > > > > decouple Yaws and Mnesia . Still, I would love to know how much > > > > transactions slow down with the addition of every new Mnesia node. > > > > > > > > Thanks, Joel > > > > > > > > -- > > > > http://topdog.cc - EasyLanguage to C# compiler > > > > http://wagerlabs.com - Blog From prakashswami@REDACTED Fri Jul 27 22:15:59 2007 From: prakashswami@REDACTED (Prakash Swaminathan) Date: Sat, 28 Jul 2007 01:45:59 +0530 Subject: [erlang-questions] Question on pattern matching from Joe's book Message-ID: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> On page 43 of the pdf book, under section 2.12 "Pattern Matching again", the second-to-last example: [H T] "cat" Succeeds H ->99, T ->"at". Why is the value assigned to T-> "at" and not "97116"? thanks, --Prakash From dmercer@REDACTED Fri Jul 27 22:55:59 2007 From: dmercer@REDACTED (David Mercer) Date: Fri, 27 Jul 2007 15:55:59 -0500 Subject: [erlang-questions] Question on pattern matching from Joe's book In-Reply-To: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> References: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> Message-ID: <00fe01c7d090$898cc2c0$891ea8c0@SSI.CORP> I don't have the book, but the string "cat" is stored as the list [99, 97, 116]. The shell is nice enough to print lists of digits that look like strings as strings. [H|T] = "cat" is equivalent to [H|T] = [99, 97, 116], so H is 99 and T is [97, 116], which the shell thinks is a string, so outputs "at". Does this answer your question? David -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Prakash Swaminathan Sent: Friday, July 27, 2007 15:16 To: erlang-questions@REDACTED Subject: [erlang-questions] Question on pattern matching from Joe's book On page 43 of the pdf book, under section 2.12 "Pattern Matching again", the second-to-last example: [H T] "cat" Succeeds H ->99, T ->"at". Why is the value assigned to T-> "at" and not "97116"? thanks, --Prakash _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From matthew@REDACTED Fri Jul 27 22:49:33 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 27 Jul 2007 13:49:33 -0700 Subject: [erlang-questions] Question on pattern matching from Joe's book In-Reply-To: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> References: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> Message-ID: On 7/27/07, Prakash Swaminathan wrote: > Why is the value assigned to T-> "at" and not "97116"? "cat" is short-hand notation for the list [99, 97, 116]. The statement [H|T] = "cat" is equivalent to [H|T] = [99, 97, 116], which binds H to 99 and T to [97, 116] or "at". From henrique.ferreiro@REDACTED Fri Jul 27 23:13:02 2007 From: henrique.ferreiro@REDACTED (Henrique Ferreiro) Date: Fri, 27 Jul 2007 23:13:02 +0200 Subject: [erlang-questions] apply/2 In-Reply-To: <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> References: <1185554499.6226.2.camel@macbook> <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> Message-ID: <1185570782.6226.8.camel@macbook> Thanks. Next time I'll read the docs more carefully. O Ven, 27-07-2007 ?s 10:16 -0700, Bob Ippolito escribiu: > apply/2 takes a fun, not the name of the function (an atom)... to use > apply/2 you'd do this: > > apply(fun erlang:round/1, [2.3]). > > apply/3 takes the name of the module, the name of the function (both > atoms), and the arguments as demonstrated. > > -bob > > On 7/27/07, David Mercer wrote: > > Fun round is in the erlang module. This should work: > > > > > apply(erlang, round, [2.3]). > > > > Cheers, > > > > David > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique Ferreiro > > Sent: Friday, July 27, 2007 11:42 > > To: erlang-questions@REDACTED > > Subject: [erlang-questions] apply/2 > > > > Hello, > > > > I noticed some extrange behaviour that this list surely can explain: > > > > 1> round(2.3). > > 2 > > 2> apply(round, [2.3]). > > > > =ERROR REPORT==== 27-Jul-2007::18:40:22 === > > Error in process <0.31.0> with exit value: > > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > > > ** exited: {{badfun,round}, > > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** > > > > Thanks in advance, > > Henrique Ferreiro > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From zac@REDACTED Fri Jul 27 23:48:42 2007 From: zac@REDACTED (Zac Brown) Date: Fri, 27 Jul 2007 17:48:42 -0400 Subject: [erlang-questions] Question regarding problems in Joe's book Message-ID: Hi, New erlanger (is that kosher?) here. I just got my copy of Joe's book and I've been reading it voraciously. Its really well written but I wonder if anyone knows if there are answers posted for the problems at the end of section 8? I've been struggling with working out these problems and am looking to learn from an example. I'm new to functional programming, but not programming itself but from what I've seen I feel like functional programming is definitely the future, so thats why I'm learning Erlang. Just looking for a little guidance. Thanks in advance! Cheers, Zac From chlorophil@REDACTED Sat Jul 28 01:37:49 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Sat, 28 Jul 2007 09:37:49 +1000 Subject: [erlang-questions] split_binary simple question In-Reply-To: References: <20070708162532.GA17484@works.com> <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> Message-ID: On 7/27/07, Caoyuan wrote: > Is there any difference between split_binary/2 and using binary match > to split it? Use split_binary/2 if you have binaries larger than about 128MB: there is a bignum bug in the current binary match code. (I understand that this will be fixed in the next point release.) > I mean the implementation, efficiency, and GC behavior etc. Interesting question! Cheers, Philip From jim.mccoy@REDACTED Sat Jul 28 00:59:37 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Fri, 27 Jul 2007 15:59:37 -0700 Subject: [erlang-questions] Message multiplexing Message-ID: Can anyone out there save me from diving into the Erlang source to determine whether or not Erlang does any multiplexing of messages being sent between processes (esp. processes on different nodes)? The fact that there are no ordering assurances for message sending gives me a bit of hope, but I would love to know any low-level details that would answer this question. The basic case I am thinking of is sending messages A, B, and C from node 1 to node 2. Message A is 10M and messages B and C are 10 bytes. Assuming the messages are all sent from the same process in the order node2 ! A, node2 ! B, node2 ! C, is there any hope that messages B and C might not have to wait around for all 10M of message A to get delivered to node 2 before they hop on to the wire? Regards, Jim From ryanobjc@REDACTED Sat Jul 28 02:35:24 2007 From: ryanobjc@REDACTED (Ryan Rawson) Date: Fri, 27 Jul 2007 17:35:24 -0700 Subject: [erlang-questions] Message multiplexing In-Reply-To: References: Message-ID: <2EB66106-53A5-4E82-AA99-F0A932206E7E@gmail.com> Sounds like the real question is, does the distribution protocol use 1 or more tcp sockets? Perhaps netstat and an experiment can answer this question? I'm also curious. -ryan Sent from my iPhone On Jul 27, 2007, at 3:59 PM, "Jim McCoy" wrote: > Can anyone out there save me from diving into the Erlang source to > determine whether or not Erlang does any multiplexing of messages > being sent between processes (esp. processes on different nodes)? The > fact that there are no ordering assurances for message sending gives > me a bit of hope, but I would love to know any low-level details that > would answer this question. > > The basic case I am thinking of is sending messages A, B, and C from > node 1 to node 2. Message A is 10M and messages B and C are 10 bytes. > Assuming the messages are all sent from the same process in the order > node2 ! A, node2 ! B, node2 ! C, is there any hope that messages B and > C might not have to wait around for all 10M of message A to get > delivered to node 2 before they hop on to the wire? > > Regards, > > Jim > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chadrwilson@REDACTED Sat Jul 28 02:42:23 2007 From: chadrwilson@REDACTED (Chad Wilson) Date: Fri, 27 Jul 2007 20:42:23 -0400 Subject: [erlang-questions] Funs! Message-ID: I have programmed my first function in Erlang! It just had to get that off my chest. I felt it was an accomplishment worth drinking a Pepsi for because I remembered that capitalization part. Speaking of which, why case sensitive language parts? Does it make designing the parser and compiler easier? Reading the code? Something else? -- Chad Wilson chadrwilson@REDACTED http://mysite.verizon.net/interkingdom/ Power. Prowess. Presence. From hokan.stenholm@REDACTED Sat Jul 28 03:47:24 2007 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 28 Jul 2007 03:47:24 +0200 Subject: [erlang-questions] Funs! In-Reply-To: References: Message-ID: <46AAA02C.9010002@bredband.net> Chad Wilson wrote: > I have programmed my first function in Erlang! > > It just had to get that off my chest. I felt it was an accomplishment > worth drinking a Pepsi for because I remembered that capitalization > part. Speaking of which, why case sensitive language parts? Does it > make designing the parser and compiler easier? Reading the code? > Something else? > > It may partly be a inheritance from the orginal erlang implementation, that was based on Prolog. Prolog uses upper case to mark something as a varibale. It is also probably a parser/complier issue, it might otherwise be hard to distinguish variables from atoms, as well as differentiate a regular function call like foo(...) from the function call Foo(...) (where Foo is a fun()). Other languages like bash (and PHP ?) that have no or only rarely used constructs to declare variables, also act in a similar manner - bash for example requires $VarName to get the value of a varible rather than just the string VarName. From mberrow1@REDACTED Sat Jul 28 05:54:33 2007 From: mberrow1@REDACTED (Mike Berrow) Date: Fri, 27 Jul 2007 20:54:33 -0700 Subject: [erlang-questions] Question regarding problems in Joe's book References: Message-ID: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> > ..... but I wonder if anyone knows if there are answers posted > for the problems at the end of section 8? I've been struggling with > working out these problems and am looking to learn from an example. I wondered the same thing. The first problem seems simple, but I am not sure how to prove that it works when "two parallel processes simultaneously evaluate start/2" Anyway, here is my attempt so far (and a session transcript) % Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). % Make sure your program works correctly in the case when two % parallel processes simultaneously evaluate start/2. In this case, % you must guarantee that one of these processes succeeds and the % other fails. -module(sfun). -export([start/2]). start(AnAtom, Fun) -> case whereis(AnAtom) of undefined -> register(AnAtom, spawn(Fun)), succeed; _Else -> fail %_Else -> throw(already_started) end. % 1> c(sfun). % {ok,sfun} % 2> sfun:start(area0, fun area_server0:loop/0). % succeed % 3> area0 ! {rectangle, 4, 15}. % Area of rectangle is 60 % {rectangle,4,15} % 4> area0 ! {rectangle, 4, 20}. % Area of rectangle is 80 % {rectangle,4,20} % 5> sfun:start(area0, fun area_server0:loop/0). % fail % 6> sfun:start(area1, fun area_server1:loop/0). % succeed % 7> area1 ! {rectangle, 4, 30}. % {rectangle,4,30} % 8> sfun:start(area1, fun area_server1:loop/0). % fail As for the second problem, the "ring benchmark". I've dug up (around the net) 4 different apparent solutions to that, but they all produce very different timings. If there is interest, I can post what I found here. I rather felt "thrown into the deep end" on that one, -- Mike Berrow From codeslinger@REDACTED Sat Jul 28 08:07:12 2007 From: codeslinger@REDACTED (Toby DiPasquale) Date: Sat, 28 Jul 2007 02:07:12 -0400 Subject: [erlang-questions] Question regarding problems in Joe's book In-Reply-To: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> References: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> Message-ID: <876ef97a0707272307g68736991g7b09ff6e629e7de@mail.gmail.com> On 7/27/07, Mike Berrow wrote: > > ..... but I wonder if anyone knows if there are answers posted > > for the problems at the end of section 8? I've been struggling with > > working out these problems and am looking to learn from an example. > > I wondered the same thing. The first problem seems simple, but I am not > sure how to prove that it works when "two parallel processes simultaneously evaluate start/2" I believe the answer Joe was looking for was to have a separate process that the first n processes send messages to in order to enact start(AnAtom, Fun). This guarantees that whichever is first gets the success message and those coming afterwards receive the failure message in response. This relies on Erlang's message passing concurrency to provide a sequencing of events in a parallel environment, rather than using shared state. In essence, I think its a clever question to make sure you were paying the proper attention to the preceding chapter's material ;-) Joe can, of course, embellish or correct me if I'm wrong. Joe? -- Toby DiPasquale From bjorn@REDACTED Sat Jul 28 08:30:03 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 28 Jul 2007 08:30:03 +0200 Subject: [erlang-questions] split_binary simple question In-Reply-To: References: <20070708162532.GA17484@works.com> <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> Message-ID: "Philip Robinson" writes: > Use split_binary/2 if you have binaries larger than about 128MB: there > is a bignum bug in the current binary match code. (I understand that > this will be fixed in the next point release.) The bug was fixed in R11B-5. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From lcoquelle@REDACTED Sat Jul 28 10:33:14 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Sat, 28 Jul 2007 16:33:14 +0800 Subject: [erlang-questions] Emakefile confusion In-Reply-To: <25acdd550707270611r430186fbt9a78a0c15688bf7c@mail.gmail.com> References: <25acdd550707262159q68e59f6bqfe9b93e1f740fce3@mail.gmail.com> <25acdd550707270611r430186fbt9a78a0c15688bf7c@mail.gmail.com> Message-ID: The compile module documentation is here: http://www.erlang.org/doc/apps/compiler/index.html On 7/27/07, Vesa Kaihlavirta wrote: > > > > On 7/27/07, Ludovic Coquelle wrote: > > > > I'm not sure what the problem ('o' vs 'outdir', or the inital path > > './'), but the following line works as expected on my machine: > > {"*", [{outdir, "./beam/"}]}. > > br > > > That indeed helped. Thanks. > > What should I have been reading instead of erl -man make and erl -man erlc > to figure out that by myself? > > --vk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Sat Jul 28 09:44:54 2007 From: matthias@REDACTED (Matthias Lang) Date: Sat, 28 Jul 2007 09:44:54 +0200 Subject: [erlang-questions] Message multiplexing In-Reply-To: <2EB66106-53A5-4E82-AA99-F0A932206E7E@gmail.com> References: <2EB66106-53A5-4E82-AA99-F0A932206E7E@gmail.com> Message-ID: <18090.62454.922811.706861@antilipe.corelatus.se> > On Jul 27, 2007, at 3:59 PM, "Jim McCoy" wrote: > ... whether or not Erlang does any multiplexing of messages > being sent between processes (esp. processes on different nodes)? The > fact that there are no ordering assurances for message sending I'm aware of just one guarantee. It's not strong enough to cover your case. (Two processes P and Q. P sends two messages to Q. Those messages are guaranteed to arrive in the same order as transmitted.) Looking at the distribution protocol spec (./erts/emulator/internal_doc/erl_ext_dist.txt), there's no mechanism for sending partial messages, so given TCP's properties there's not going to be any reordering. Looking at the source (in dist.c, pack_and_send(), dist_send()), I don't see any reordering or fragmenting code either, though this is the first time I've looked at that part of the source. Conclusion: I don't think there's any multiplexing. Ryan Rawson writes: > Sounds like the real question is, does the distribution protocol use 1 > or more tcp sockets? That is not an equivalent question. It would be _possible_ to send erlang messages over a single TCP socket in such a way that a short erlang message sent (shortly) after a long one would arrive before the long one. RFC3080/RFC3081 is an example of a protocol which allows (requires!) that complication. The accompanying waffle in RFC3117 is classic. In case I created the wrong impression: I am not recommending BEEP! Matthias From jla415@REDACTED Sat Jul 28 11:34:03 2007 From: jla415@REDACTED (jla415) Date: Sat, 28 Jul 2007 02:34:03 -0700 (PDT) Subject: [erlang-questions] Question regarding problems in Joe's book In-Reply-To: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> References: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> Message-ID: <11841008.post@talk.nabble.com> Mike Berrow wrote: > > % Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). > % Make sure your program works correctly in the case when two > % parallel processes simultaneously evaluate start/2. In this case, > % you must guarantee that one of these processes succeeds and the > % other fails. > -module(sfun). > -export([start/2]). > > start(AnAtom, Fun) -> > case whereis(AnAtom) of > undefined -> register(AnAtom, spawn(Fun)), succeed; > _Else -> fail > %_Else -> throw(already_started) > end. > The problem with this particular example is that it's possible for another process to register the name between the time this one checks and does its registration (and if that happens the spawned process is still left running unregistered and you have 2 processes running.) I believe Joe was looking for something more along the lines of: start(Name, Fun) -> spawn(Fun() -> register(Name, self()), Fun() end). Which first starts the new process, tries to register itself then continues on with the Fun when it succeeds. If it was already registered it will fail with a badarg thrown and the newly spawned process will die. It seems like there should be something in otp that handles this sort of pattern for us but if there is I can't recall off the top of my head... I'm generally using gen_servers and the like when dealing with registered processes so this issue doesn't seem to come up much in practice. -- View this message in context: http://www.nabble.com/Question-regarding-problems-in-Joe%27s-book-tf4160373.html#a11841008 Sent from the Erlang Questions mailing list archive at Nabble.com. From sean.hinde@REDACTED Sat Jul 28 11:21:08 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Sat, 28 Jul 2007 10:21:08 +0100 Subject: [erlang-questions] Message multiplexing In-Reply-To: <2EB66106-53A5-4E82-AA99-F0A932206E7E@gmail.com> References: <2EB66106-53A5-4E82-AA99-F0A932206E7E@gmail.com> Message-ID: The answer is that you will have to wait until all of message A has been delivered. This is required because erlang DOES make ordering assurances for message sending from the same process. This issue is a problem is when you are sending a large message from one process and small messages from other processes. One solution would be for the distribution protocol to multiplex in chunks of X bytes rather than whole messages (while retaining the order of messages on a per process basis) , and then re-assemble the messages at the other end before delivery. Some work to do at a quite low level to make this happen. Sean On 28 Jul 2007, at 01:35, Ryan Rawson wrote: > Sounds like the real question is, does the distribution protocol use 1 > or more tcp sockets? Perhaps netstat and an experiment can answer > this question? I'm also curious. > > -ryan > > Sent from my iPhone > > On Jul 27, 2007, at 3:59 PM, "Jim McCoy" wrote: > >> Can anyone out there save me from diving into the Erlang source to >> determine whether or not Erlang does any multiplexing of messages >> being sent between processes (esp. processes on different nodes)? >> The >> fact that there are no ordering assurances for message sending gives >> me a bit of hope, but I would love to know any low-level details that >> would answer this question. >> >> The basic case I am thinking of is sending messages A, B, and C from >> node 1 to node 2. Message A is 10M and messages B and C are 10 >> bytes. >> Assuming the messages are all sent from the same process in the order >> node2 ! A, node2 ! B, node2 ! C, is there any hope that messages B >> and >> C might not have to wait around for all 10M of message A to get >> delivered to node 2 before they hop on to the wire? >> >> Regards, >> >> Jim >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chlorophil@REDACTED Sat Jul 28 13:00:58 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Sat, 28 Jul 2007 21:00:58 +1000 Subject: [erlang-questions] split_binary simple question In-Reply-To: References: <20070708162532.GA17484@works.com> <8209f740707081047i85c9151k2dc4bfc4510f62cf@mail.gmail.com> Message-ID: On 28 Jul 2007 08:30:03 +0200, Bjorn Gustavsson wrote: > "Philip Robinson" writes: > > > Use split_binary/2 if you have binaries larger than about 128MB: there > > is a bignum bug in the current binary match code. (I understand that > > this will be fixed in the next point release.) > > The bug was fixed in R11B-5. Aw man, you Erlang guys are too quick for me. I am not used to my workarounds being made obsolete so quickly... Thanks, Philip From realaqura@REDACTED Thu Jul 26 08:08:13 2007 From: realaqura@REDACTED (Leon) Date: Thu, 26 Jul 2007 14:08:13 +0800 Subject: [erlang-questions] ebadf error of gen_tcp:send() In-Reply-To: Message-ID: <000f01c7cf4b$5f565a20$4d02000a@matrixioiaouel> Hi Are there any standard reasons why I might get a ebadf error when writing to a previously opened socket by the function gen_tcp:send()/2 ? Thanks, Leon From zac@REDACTED Sat Jul 28 13:52:33 2007 From: zac@REDACTED (Zac Brown) Date: Sat, 28 Jul 2007 07:52:33 -0400 Subject: [erlang-questions] Question regarding problems in Joe's book References: <004a01c7d0cb$04da6ab0$6401a8c0@rubicon> <876ef97a0707272307g68736991g7b09ff6e629e7de@mail.gmail.com> Message-ID: Thanks for the responses guys. I guess I felt almost thrown into the wild when I saw that there were problems at the end. I actually figured out the start(AnAtom, Fun) one, but the ring problem I've made some head way in but I'm getting stuck with it. I'll post what I have so far and see if there are any comments. -module(ring). -export([start/0, submit/2, loop/0]). start() -> spawn(fun loop/0). submit(Pid, What) -> rpc(Pid, What). loop() -> receive {data, Msg, PidList, Curr, Lim} -> case Curr =< Lim of true -> [H|T] = PidList, rpc(H, {data, Msg, T++H, Curr+1, Lim}); false -> Msg end, loop(); _ -> io:format("Error.~n"), exit("error") end. rpc(Pid, Request) -> Pid ! {self(), Request}, receive Response -> Response end. On Sat, 28 Jul 2007 02:07:12 -0400, Toby DiPasquale wrote: > On 7/27/07, Mike Berrow wrote: >> > ..... but I wonder if anyone knows if there are answers posted >> > for the problems at the end of section 8? I've been struggling with >> > working out these problems and am looking to learn from an example. >> >> I wondered the same thing. The first problem seems simple, but I am not >> sure how to prove that it works when "two parallel processes simultaneously evaluate start/2" > > I believe the answer Joe was looking for was to have a separate > process that the first n processes send messages to in order to enact > start(AnAtom, Fun). This guarantees that whichever is first gets the > success message and those coming afterwards receive the failure > message in response. This relies on Erlang's message passing > concurrency to provide a sequencing of events in a parallel > environment, rather than using shared state. > > In essence, I think its a clever question to make sure you were paying > the proper attention to the preceding chapter's material ;-) Joe can, > of course, embellish or correct me if I'm wrong. Joe? From saleyn@REDACTED Sat Jul 28 15:11:36 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Sat, 28 Jul 2007 08:11:36 -0500 Subject: [erlang-questions] bit syntax feature request Message-ID: <46AB4088.2050707@gmail.com> When parsing some protocols I run into cases when I needed to convert parts of a binary to strings (i.e. lists). Unfortunately current bit syntax expressions don't support Value:Size/string or Value:Size/list types: Ei = Value | Value:Size | Value/TypeSpecifierList | Value:Size/TypeSpecifierList Type = integer | float | binary The default is integer. Example: I need to parse an integer, and string from a binary: 1> <> = <<1,2,$a,$b,$c,$d,3,4>>. <<1,2,97,98,99,100,3,4>> 2> S = binary_to_list(S1). "abc" what I'd like to be able to do is: 1> <> = <<1,2,$a,$b,$c,$d,3,4>>. <<1,2,97,98,99,100,3,4>> 2> io:format("~p, ~p\n", [X, S]). 258, "abc". When most parts of the binary are strings, it becomes quite verbose to introduce many binary_to_list/1 calls and diminishes the value of pattern matching syntax. Any particular reason this is not currently implemented? If not, how hard would it be to add such a feature? Serge From nm@REDACTED Sat Jul 28 21:49:10 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 29 Jul 2007 00:49:10 +0500 Subject: [erlang-questions] Typo in erlang documentation Message-ID: <46AB9DB6.5080307@web.am> Hello! On http://www.erlang.org/doc/man/erl_ddll.html page there is a typo in "i. e. .so files on most Unix systems and .ddl files on windows." phrase should by '.dll' instread of '.ddl' . If it is done intentionally and extension should be .ddl -- it should be stated explictly there, imho. /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED w http://zanazan.am/ From chsu79@REDACTED Sun Jul 29 00:06:56 2007 From: chsu79@REDACTED (Christian S) Date: Sun, 29 Jul 2007 00:06:56 +0200 Subject: [erlang-questions] bit syntax feature request In-Reply-To: <46AB4088.2050707@gmail.com> References: <46AB4088.2050707@gmail.com> Message-ID: I knew I had seen this request before: http://www.erlang.org/pipermail/erlang-questions/2006-July/021430.html Some interesting questions are raised in the thread. 2007/7/28, Serge Aleynikov : > When parsing some protocols I run into cases when I needed to convert > parts of a binary to strings (i.e. lists). Unfortunately current bit > syntax expressions don't support Value:Size/string or Value:Size/list types: > > Ei = Value | > Value:Size | > Value/TypeSpecifierList | > Value:Size/TypeSpecifierList > > Type = integer | float | binary > The default is integer. > > > Example: > > I need to parse an integer, and string from a binary: > > 1> <> = <<1,2,$a,$b,$c,$d,3,4>>. > <<1,2,97,98,99,100,3,4>> > 2> S = binary_to_list(S1). > "abc" > > what I'd like to be able to do is: > > 1> <> = <<1,2,$a,$b,$c,$d,3,4>>. > <<1,2,97,98,99,100,3,4>> > > 2> io:format("~p, ~p\n", [X, S]). > 258, "abc". > > When most parts of the binary are strings, it becomes quite verbose to > introduce many binary_to_list/1 calls and diminishes the value of > pattern matching syntax. > > Any particular reason this is not currently implemented? If not, how > hard would it be to add such a feature? > > Serge > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From n.favrefelix@REDACTED Sun Jul 29 01:28:17 2007 From: n.favrefelix@REDACTED (=?ISO-8859-1?Q?Nicolas_Favre-F=E9lix?=) Date: Sun, 29 Jul 2007 01:28:17 +0200 Subject: [erlang-questions] Xmerl questions Message-ID: <46ABD111.5090406@gmail.com> Hello, I have encountered a few problems with xmerl and have a some questions: * How is it possible to find out which encoding the file is written with? As far as I can see, the tag is not present in the xmlDocument record. So far I'm using a regular expression, but this is a quick hack and I would prefer a cleaner solution. * I am using RSS feeds and have encoding problems with some of them. For example, the current feeds at http://linuxfr.org/backend/journaux/rss20.rss and http://www.lewistrondheim.com/blog/rss/fil_rss.xml trigger an exit when given to xmerl_scan:file/1 or string/1: ** exited: {bad_character_code,""}. I tested both these files using xmlproc_parse, which reported no XML error. What is the problem here? * Why are text elements sometimes split in several xmlElement records? For example, one XML file was returned as an xmlDocument record containing the following: {xmlText,[{content,12},{entry,24},{feed,1}],72,[]," : ",text}, {xmlText,[{content,12},{entry,24},{feed,1}],74,[]," References: <58f5ed000707271315p14bbf8dexce50c817b116de95@mail.gmail.com> Message-ID: <20070728132227.GA7550@little-black-book.motivity.ca> On Sat, Jul 28, 2007 at 01:45:59AM +0530, Prakash Swaminathan wrote: } On page 43 of the pdf book, under section 2.12 "Pattern Matching } again", the second-to-last example: [H T] "cat" Succeeds H ->99, T } ->"at". } } Why is the value assigned to T-> "at" and not "97116"? The list [97,116] is quite different from the string "97116". Strings are really just lists, it's only a shorthand and the shell will attempt to help you by displaying lists which are all character values as strings. Characters are really just numbers. You may use the notation $char as a shorthand to deal with characters as numbers. So the following three representations are equivalent: 1> "cat" = [$c,$a,$t] = [99,97,116]. "cat" ... as are these three: 2> "97116" = [$9,$7,$1,$1,$6] = [57,55,49,49,54]. "97116" So when you evaulate the example: 3> [H|T] = "cat". "cat" ... H is assigned the first character in the list: 4> H = $c = 99. 99 ... while T is assigned the tail of the list: 5> T = [$a,$t] = [97,116]. "at" -Vance From kosik@REDACTED Sun Jul 29 10:51:25 2007 From: kosik@REDACTED (Matej Kosik) Date: Sun, 29 Jul 2007 10:51:25 +0200 Subject: [erlang-questions] [BUG?] superfluous values for io:format cause process to block Message-ID: <46AC550D.9080703@fiit.stuba.sk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I would like to ask whether it is OK to count with the fact commands such as: -export([t21/0, t22/0]). t21() -> spawn(?MODULE, t22, []). t22() -> io:format("DEBUG before~n"), io:format("", [whatever]), io:format("DEBUG after~n"). will spawn a new process that will block at its second statement. That is, it will not print DEBUG after ? Thanks for help, Regards - -- Matej Kosik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGrFUNL+CaXfJI/hgRAklUAJwKlf0Q/29NqaxCgURHIirVClv/OgCfXPOj x9xw1OrJQR+bavUWUcw+nxE= =wpnn -----END PGP SIGNATURE----- From vladdu55@REDACTED Sun Jul 29 11:48:16 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 29 Jul 2007 09:48:16 +0000 Subject: [erlang-questions] [BUG?] superfluous values for io:format cause process to block In-Reply-To: <46AC550D.9080703@fiit.stuba.sk> References: <46AC550D.9080703@fiit.stuba.sk> Message-ID: <95be1d3b0707290248va98424ex23df0eca71ee388d@mail.gmail.com> Hi, On 7/29/07, Matej Kosik wrote: > t22() -> > io:format("DEBUG before~n"), > io:format("", [whatever]), > io:format("DEBUG after~n"). What happens is that the second io:format crashes the process. Try it in the shell and you'll see the exact error: the format string can't be empty. You might want to have a "~w" instead. best regards, Vlad From gleber.p@REDACTED Sun Jul 29 15:17:56 2007 From: gleber.p@REDACTED (Gleber) Date: Sun, 29 Jul 2007 15:17:56 +0200 Subject: [erlang-questions] A* algorithm Message-ID: <14f0e3620707290617rda259acq6167baa546c81173@mail.gmail.com> Hello. Do anyone know where to find an implementation of the A* algorithm in Erlang or some other functional language? I'm interested in implementing it in Erlang (not necessary as parallel algorithm). Any clues on this topic would be appreciated :) -- Regards, Gleb Peregud "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein From mickael.remond@REDACTED Sun Jul 29 16:26:09 2007 From: mickael.remond@REDACTED (=?UTF-8?Q?Micka=C3=ABl_R=C3=A9mond?=) Date: Sun, 29 Jul 2007 16:26:09 +0200 Subject: [erlang-questions] New Planet Erlang Site Message-ID: <8CF702DA-4E98-46C1-8238-998D139FC116@process-one.net> Hello, We have rebuilt the Erlang Planet web site in a more 2.0 fashion. It still does the basics: Various feed from different bloggers are automatically submitted there and you can subscribe to the aggregated feed in your RSS reader. However, the new site does much more. We fell that with all that happen around Erlang every day and the growing community, it would now be possible to strengthen the community aspects around Erlang Planet. The new site is a digg or reddit like site (we won't annoy those community anymore ;). You can vote for news, links, pages, documentations, tutorials, video, etc. The upcoming submissions reach the main page when they have gather enough votes. It allows people with little time to focus on link from the main page (published news) while others can partipate in voting for and submitting their favorite pages. With this collaborative effort a good and up to date map of what is happening on Erlang on the web should emerge. You can join now to participate to this collaborative effort. Your comments, and suggestions are welcome. http://www.planeterlang.org/ There is still a lot to do on categorizing and tagging all the resources that are already available (most of them coming from all RSS feed gathered on Planet Erlang). Suggestions on new tag and categories are welcome. Do not forget to update your RSS subscriptions ! -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Sun Jul 29 18:39:39 2007 From: james.hague@REDACTED (James Hague) Date: Sun, 29 Jul 2007 11:39:39 -0500 Subject: [erlang-questions] Funs! In-Reply-To: References: Message-ID: > Speaking of which, why case sensitive language parts? Does it > make designing the parser and compiler easier? Reading the code? > Something else? It's convenient not to need punctuation to differentiate variables and atoms. A variable starts with an uppercase letter, an atom does not. The downside is that you run the risk of a new keyword being added to the language and conflicting with atoms you've used in previous code (such as "cond"), but that's a minor worry. James From juneaftn@REDACTED Sun Jul 29 19:29:17 2007 From: juneaftn@REDACTED (June Kim) Date: Mon, 30 Jul 2007 02:29:17 +0900 Subject: [erlang-questions] continuation vs. accumulator Message-ID: <6f80c1520707291029tcb72213n1452351e2e372fa3@mail.gmail.com> Why is continuation passing style faster than accumulator passing style in erlang? Factorial In non-tail-recursive-style: fact(1)-> 1; fact(N)->N*fact(N-1). In accumulator-passing-style: fact_aps(1,Acc)-> Acc; fact_aps(N,Acc)-> fact_aps(N-1,N*Acc). fact_aps(N)-> fact_aps(N,1). In continuation-passing-style: fact_cps(1,K)-> K(1); fact_cps(N,K)-> fact_cps(N-1, fun(X) -> K(X*N) end). fact_cps(N)-> fact_cps(N, fun(X)->X end). With small numbers, the running time for each style of factorial calculation is in the order of fact < fact_cps < fact_aps (fact being the fastest). For example, when N is 30000: fact : 2,484,000 us fact_cps: 2,593,000 us fact_aps: 2,828,000 us Of course, fact being non-tail-recursive, it uses a huge amount of memory (but it didn't reach the point to the page swap). When the number grows bigger, for instance over 80000, the order is exactly reversed : fact_aps References: <6f80c1520707291029tcb72213n1452351e2e372fa3@mail.gmail.com> Message-ID: <46ACDA24.9000100@millstream.com> June Kim wrote: > ... > In addition to that, is there an easy way of measuring the used memory > during a function call in erlang(other than using unix's top or > windows task manager)? Hello June, Having just read the FAQ myself, I'll point you to the "measure memory consumption in an Erlang system?" in the FAQ which is here http://www.erlang.org/faq/faq.html#AEN595 which might help you measure the memory. I'm not clever enough yet at Erlang to answer your other questions :) Richard Kelsall. From ok@REDACTED Mon Jul 30 01:40:21 2007 From: ok@REDACTED (ok) Date: Mon, 30 Jul 2007 11:40:21 +1200 Subject: [erlang-questions] Funs! In-Reply-To: <46AAA02C.9010002@bredband.net> References: <46AAA02C.9010002@bredband.net> Message-ID: <1187F0BF-5FB4-4987-B6F6-55C1BA314B28@cs.otago.ac.nz> Concerning the use of capitalisation in functional programming, note that Standard ML and Haskell both insist on specific use of capitals. "There are six kinds of names in Kaskell: those for _variables_ and _constructors_ denote values; those for _type variables_, _type constructors_, and _type classes_ refer to entities related to the type system; and _module names_ refer to modules. There are three constraints on naming: ==> 1. Names for variables and type variables are identifiers beginning with lower case letters or underscores; the other four kinds of names are identifiers beginning with upper case letters. 2. Constructor operators are operators beginning with ":"; variable operators are operators not beginning with ":". 3. An identifier must not be used as the name of a type constructor and a class in the same scope." Basically, things that can appear in the same syntactic position are distinguished by their first character. Note that this is DESPITE Haskell and SML having "rich" syntax (compared with Erlang) and strong static type systems. From realaqura@REDACTED Mon Jul 30 05:20:27 2007 From: realaqura@REDACTED (leon zhao) Date: Mon, 30 Jul 2007 11:20:27 +0800 Subject: [erlang-questions] ebadf error of gen_tcp:send() Message-ID: <2f39bec70707292020s2d9283aejfb32201fd963cc8a@mail.gmail.com> Hi Are there any standard reasons why I might get a ebadf error when writing to a previously opened socket by the function gen_tcp:send()/2 ? Thanks, Leon -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Mon Jul 30 08:40:13 2007 From: matthew@REDACTED (Matthew Dempsky) Date: Sun, 29 Jul 2007 23:40:13 -0700 Subject: [erlang-questions] continuation vs. accumulator In-Reply-To: <6f80c1520707291029tcb72213n1452351e2e372fa3@mail.gmail.com> References: <6f80c1520707291029tcb72213n1452351e2e372fa3@mail.gmail.com> Message-ID: On 7/29/07, June Kim wrote: > Why is continuation passing style faster than accumulator passing > style in erlang? It's not. Your CPS implementation evaluates (...(((1 * 2) * 3) * 4) * ...) while your APS implementation evaluates 1 * (2 * (3 * (4 * ...))). Your APS implementation handles larger integers during its execution, which accounts for the slow down. On my laptop, the following code outperforms all three of your implementations. fact_aps2(N) -> fact_aps2(N,1,1). fact_aps2(N,M,Acc) -> Acc2 = M * Acc, if N == M -> Acc2; true -> fact_aps2(N,M + 1,Acc2) end. From juneaftn@REDACTED Mon Jul 30 11:49:59 2007 From: juneaftn@REDACTED (June Kim) Date: Mon, 30 Jul 2007 18:49:59 +0900 Subject: [erlang-questions] continuation vs. accumulator In-Reply-To: References: <6f80c1520707291029tcb72213n1452351e2e372fa3@mail.gmail.com> Message-ID: <6f80c1520707300249k33fdd76bwe444a686a06588f0@mail.gmail.com> 2007/7/30, Matthew Dempsky : > On 7/29/07, June Kim wrote: > > Why is continuation passing style faster than accumulator passing > > style in erlang? > > It's not. Your CPS implementation evaluates (...(((1 * 2) * 3) * 4) * > ...) while your APS implementation evaluates 1 * (2 * (3 * (4 * > ...))). Your APS implementation handles larger integers during its > execution, which accounts for the slow down. > > On my laptop, the following code outperforms all three of your implementations. > > fact_aps2(N) -> fact_aps2(N,1,1). > fact_aps2(N,M,Acc) -> > Acc2 = M * Acc, > if N == M -> Acc2; > true -> fact_aps2(N,M + 1,Acc2) > end. Yeah, when N is small, but again, there isn't a big difference. When N=30000: fact: 2516000 us fact_aps: 2875000 us fact_aps2:2562000 us fact_cps: 2672000 us As you see fact is stil the fastest. (but when there isn't enough memory the page swap might happen and fact gets the last rank) On the other hand, when N is, for instance, 80000, fact_aps takes 28 secs whereas fact_aps2 takes about 49 secs and fact_cps takes about 50 secs. From Chris.Curtis@REDACTED Mon Jul 30 15:59:46 2007 From: Chris.Curtis@REDACTED (Chris Curtis) Date: Mon, 30 Jul 2007 09:59:46 -0400 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: References: <46A6F881.5070208@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> Message-ID: <36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com> Well, the main feature is being able to build a stand-alone executable for {windows, linux, macosx, ...}. --chris -----Original Message----- From: Christophe Romain [mailto:christophe.romain@REDACTED] Sent: Thursday, July 26, 2007 4:13 PM To: Chris Curtis Cc: Benjamin Tolputt; erlang-questions@REDACTED Subject: Re: [erlang-questions] Stand Alone Erlang Still Updated? well, just tell me what you need, i'll include cean the ability to. i may have a look at sae anyway. From tsuraan@REDACTED Mon Jul 30 16:56:59 2007 From: tsuraan@REDACTED (tsuraan) Date: Mon, 30 Jul 2007 09:56:59 -0500 Subject: [erlang-questions] Generators? Message-ID: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> While reading the Erlang and Neural Networks paper, I noticed that the created dot product function was (in my eye) not a terribly good example of functional programming. A more "functional style" would be something like: dot_prod(L1, L2) -> lists:sum(lists:zipwith(fun(X,Y) -> X*Y end, L1, L2)). So we're basically mapping a function across a pair of lists, and then summing it. This looks pretty inefficient though; I don't think you can do any better than the function given in the paper, so I'm just trying to satisfy my curiosity here. The most offensive thing that I see about my function is that it creates a temporary list of products, and then sums that. If L1 and L2 are large, itwill also create a large temporary list that is a total waste. In python, you could write a zipwith function as a generator that yields values as they are requested. Any standard function that takes a list will also take a generator because they both just expose the looping interface (__iter__). Is it possible to create a generator function in erlang that can be used with the list functions? -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan@REDACTED Mon Jul 30 17:25:35 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Mon, 30 Jul 2007 17:25:35 +0200 (CEST) Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: <002801c7d07f$f2f27b30$b029030a@mtl.ubisoft.org> References: <002801c7d07f$f2f27b30$b029030a@mtl.ubisoft.org> Message-ID: If you replicate the tables to all nodes, the performance of updates will be worse for each new node that you add. I think that the performance characteristics of such a transaction will aproximately follow this formula: C + N * P. Where N is the number of nodes, P is the work performed for each (remote) transaction participant and C is the (local) transaction coordinator work that is independent of the number of nodes. But do you really need to replicate the data to all nodes? Even if you have relatively few records in your database, fragmented tables can be very useful in order to distribute the load over many nodes. If you can identify some type of record in your application that is being accessed in the majority of your transactions, it is a good candidate for fragmented table storage. This could be a bank account, a subscriber, a session etc. etc. You can also co-locate records in other tables with your main record (see "foreign_key" in Mnesia). When your application needs to access such a record it should determine one of the replica nodes for the table and run the transaction on that node. If this can be achieved for all transactions there will always be a fixed number of (2-3?) nodes involved in each transaction. That is the (2?) nodes where the table is replicated plus one of the nodes from where transactions are forwarded. If you distribute the fragments over more nodes it will scale smoothly. Of course it is not possible to achieve this for all types of applications. But you should strive for that kind of access patterns in order to achieve better scalability. /H?kan On Fri, 27 Jul 2007, denis wrote: > Date: Fri, 27 Jul 2007 14:57:14 -0400 > From: denis > To: 'Hakan Mattsson' > Cc: 'David King' , 'Joel Reymont' , > 'Erlang Questions' > Subject: RE: [erlang-questions] Maximum number of Mnesia nodes > > Thanks Hakan for your response. > > If I understand well, fragmented tables are interesting when we have high > volume of data. In my case, that's not the case, around 100000 records on 5 > tables. > I plan to have one mnesia instance per server (and one server per machine), > each having each table in ram_copies replicated with the others servers. > Each server uses his local mnesia instance (maybe that's not the better > architecture?) > > My concern is when for instance I do a delete or an insert into a table. The > transaction succeeds only when the insert or delete are done on each > replicated table. If I have only one server, the transaction time will be > for instance 10ms. If I have two server replicated, will it be 2*10ms ? For > N servers, what kind of factor can I expect? N, log(n), exp(N) ...? > I'm not sure that I can run 20 servers for instance, and keep good > performance, depending on the response time of the transaction commitment on > each node. > > Thanks > Denis > > > > -----Message d'origine----- > > De?: Hakan Mattsson [mailto:hakan@REDACTED] > > Envoy??: vendredi 27 juillet 2007 13:09 > > ??: denis > > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > The scalability of Mnesia depends heavily of your > > access patterns and how you have configured Mnesia. > > > > If you ensure that the number of nodes involved in a > > typical transaction is constant, Mnesia should scale > > very well. One way of achieving linear scalability > > characteristics, is to use the concept called > > "foreign_key" in the chapter about fragmented > > tables. The bench example (mnesia/examples/bench) > > utilizes this technique. > > > > When I wrote the "bench" benchmark example it turned > > out to scale almost perfectly linear. (By distributing > > the Mnesia tables over twice as many computers, the > > number of processed transactions per second also > > doubled.) But by that time I only had access to 10 (or > > was it 16?) identical computers, so I cannot say > > anything about how Mnesia scales beyond that. Worth to > > mentition is that I also did successfully run the bench > > example with fragmented tables distributed over all our > > machines at the office (50+). But as those computers > > had so different characteristics, it is impossible to > > say anything about the scalability. It was fun that it > > worked though. > > > > Chandru, do you still have the highscore of the number > > of Mnesia nodes in a production environment? > > > > /H?kan > > > > On Fri, 27 Jul 2007, denis wrote: > > > > > Date: Fri, 27 Jul 2007 11:15:18 -0400 > > > From: denis > > > To: 'David King' , 'Joel Reymont' > > > > > Cc: 'Erlang Questions' > > > Subject: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > Still nobody have a response for this? > > > > > > I'm in the case of designing a server embedding mnesia with ram_copies > > > tables. Several instances of the server can be launched, and the mnesia > > > tables are replicated. > > > I'm having the same concern with how many instances I can run before the > > > transaction committing in mnesia becomes a problem. > > > > > > If someone already used several replicated mnesia instances, I would > > like to > > > have some numbers. > > > > > > Thanks > > > Denis > > > > > > > -----Message d'origine----- > > > > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > > > > bounces@REDACTED] De la part de David King > > > > Envoy??: lundi 23 juillet 2007 21:24 > > > > ??: Joel Reymont > > > > Cc?: Erlang Questions > > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > Did you ever get any off-list responses to this? I'm curious too. > > > > > > > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > > > > > > > Folks, > > > > > > > > > > How many Mnesia nodes are you running in your production > > > > > installation? I'm looking to find the maximum here. > > > > > > > > > > I'm only dealing with ram_copies tables (cache), trying to figure > > out > > > > > whether I can make every Yaws node a Mnesia node without slowing > > > > > transactions down too much. > > > > > > > > > > My current thinking is to wait and gather statistics before trying > > to > > > > > decouple Yaws and Mnesia . Still, I would love to know how much > > > > > transactions slow down with the addition of every new Mnesia node. > > > > > > > > > > Thanks, Joel > > > > > > > > > > -- > > > > > http://topdog.cc - EasyLanguage to C# compiler > > > > > http://wagerlabs.com - Blog From dloutrein.lists@REDACTED Mon Jul 30 19:48:31 2007 From: dloutrein.lists@REDACTED (denis) Date: Mon, 30 Jul 2007 13:48:31 -0400 Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: Message-ID: <002201c7d2d1$d8ced560$b029030a@mtl.ubisoft.org> > -----Message d'origine----- > De?: Hakan Mattsson [mailto:hakan@REDACTED] > Envoy??: lundi 30 juillet 2007 11:26 > ??: denis > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > Objet?: RE: [erlang-questions] Maximum number of Mnesia nodes > > > If you replicate the tables to all nodes, the > performance of updates will be worse for each new node > that you add. I think that the performance characteristics > of such a transaction will aproximately follow this > formula: C + N * P. Where N is the number of nodes, P > is the work performed for each (remote) transaction > participant and C is the (local) transaction coordinator > work that is independent of the number of nodes. > I thought that the transaction time increase was less than that. Isn't the replication done in parallel? I mean, if we have 3 nodes, and we do an insert, for instance, the insert is forwarded to each node at the same time, and the coordinator wait for the confirmation of each node to validate the transaction. In this case, the formula would be approximately: C + max(P) > But do you really need to replicate the data to all nodes? In fact, the load is dispatched by a load balancer which dispatches requests to different servers. That's why we have one mnesia instance per server, with tables replicated. If one server crash, the others servers have all data to take the load of the crashed one. The problem with this architecture is if we add to many servers, we increase the load of mnesia replication. I'll try to find if we can use fragments in our case, or rethink the architecture. Denis > Even if you have relatively few records in your database, > fragmented tables can be very useful in order to distribute > the load over many nodes. > > If you can identify some type of record in your > application that is being accessed in the majority of > your transactions, it is a good candidate for fragmented > table storage. This could be a bank account, a subscriber, > a session etc. etc. You can also co-locate records in other > tables with your main record (see "foreign_key" in Mnesia). > > When your application needs to access such a record it > should determine one of the replica nodes for the table > and run the transaction on that node. If this can be > achieved for all transactions there will always be a > fixed number of (2-3?) nodes involved in each transaction. > That is the (2?) nodes where the table is replicated plus > one of the nodes from where transactions are forwarded. > If you distribute the fragments over more nodes it will > scale smoothly. > > Of course it is not possible to achieve this for all > types of applications. But you should strive for that > kind of access patterns in order to achieve better > scalability. > > /H?kan > > On Fri, 27 Jul 2007, denis wrote: > > > Date: Fri, 27 Jul 2007 14:57:14 -0400 > > From: denis > > To: 'Hakan Mattsson' > > Cc: 'David King' , 'Joel Reymont' > , > > 'Erlang Questions' > > Subject: RE: [erlang-questions] Maximum number of Mnesia nodes > > > > Thanks Hakan for your response. > > > > If I understand well, fragmented tables are interesting when we have > high > > volume of data. In my case, that's not the case, around 100000 records > on 5 > > tables. > > I plan to have one mnesia instance per server (and one server per > machine), > > each having each table in ram_copies replicated with the others servers. > > Each server uses his local mnesia instance (maybe that's not the better > > architecture?) > > > > My concern is when for instance I do a delete or an insert into a table. > The > > transaction succeeds only when the insert or delete are done on each > > replicated table. If I have only one server, the transaction time will > be > > for instance 10ms. If I have two server replicated, will it be 2*10ms ? > For > > N servers, what kind of factor can I expect? N, log(n), exp(N) ...? > > I'm not sure that I can run 20 servers for instance, and keep good > > performance, depending on the response time of the transaction > commitment on > > each node. > > > > Thanks > > Denis > > > > > > > -----Message d'origine----- > > > De?: Hakan Mattsson [mailto:hakan@REDACTED] > > > Envoy??: vendredi 27 juillet 2007 13:09 > > > ??: denis > > > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > > The scalability of Mnesia depends heavily of your > > > access patterns and how you have configured Mnesia. > > > > > > If you ensure that the number of nodes involved in a > > > typical transaction is constant, Mnesia should scale > > > very well. One way of achieving linear scalability > > > characteristics, is to use the concept called > > > "foreign_key" in the chapter about fragmented > > > tables. The bench example (mnesia/examples/bench) > > > utilizes this technique. > > > > > > When I wrote the "bench" benchmark example it turned > > > out to scale almost perfectly linear. (By distributing > > > the Mnesia tables over twice as many computers, the > > > number of processed transactions per second also > > > doubled.) But by that time I only had access to 10 (or > > > was it 16?) identical computers, so I cannot say > > > anything about how Mnesia scales beyond that. Worth to > > > mentition is that I also did successfully run the bench > > > example with fragmented tables distributed over all our > > > machines at the office (50+). But as those computers > > > had so different characteristics, it is impossible to > > > say anything about the scalability. It was fun that it > > > worked though. > > > > > > Chandru, do you still have the highscore of the number > > > of Mnesia nodes in a production environment? > > > > > > /H?kan > > > > > > On Fri, 27 Jul 2007, denis wrote: > > > > > > > Date: Fri, 27 Jul 2007 11:15:18 -0400 > > > > From: denis > > > > To: 'David King' , 'Joel Reymont' > > > > > > > Cc: 'Erlang Questions' > > > > Subject: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > Still nobody have a response for this? > > > > > > > > I'm in the case of designing a server embedding mnesia with > ram_copies > > > > tables. Several instances of the server can be launched, and the > mnesia > > > > tables are replicated. > > > > I'm having the same concern with how many instances I can run before > the > > > > transaction committing in mnesia becomes a problem. > > > > > > > > If someone already used several replicated mnesia instances, I would > > > like to > > > > have some numbers. > > > > > > > > Thanks > > > > Denis > > > > > > > > > -----Message d'origine----- > > > > > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > > > > > bounces@REDACTED] De la part de David King > > > > > Envoy??: lundi 23 juillet 2007 21:24 > > > > > ??: Joel Reymont > > > > > Cc?: Erlang Questions > > > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > > > Did you ever get any off-list responses to this? I'm curious too. > > > > > > > > > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > > > > > > > > > Folks, > > > > > > > > > > > > How many Mnesia nodes are you running in your production > > > > > > installation? I'm looking to find the maximum here. > > > > > > > > > > > > I'm only dealing with ram_copies tables (cache), trying to > figure > > > out > > > > > > whether I can make every Yaws node a Mnesia node without slowing > > > > > > transactions down too much. > > > > > > > > > > > > My current thinking is to wait and gather statistics before > trying > > > to > > > > > > decouple Yaws and Mnesia . Still, I would love to know how much > > > > > > transactions slow down with the addition of every new Mnesia > node. > > > > > > > > > > > > Thanks, Joel > > > > > > > > > > > > -- > > > > > > http://topdog.cc - EasyLanguage to C# compiler > > > > > > http://wagerlabs.com - Blog From igwan@REDACTED Mon Jul 30 20:56:53 2007 From: igwan@REDACTED (igwan) Date: Mon, 30 Jul 2007 20:56:53 +0200 Subject: [erlang-questions] sending packets using gen_udp Message-ID: <46AE3475.9040706@free.fr> Hi, I have a process that sends a number of UDP packets at a time using gen_udp:send/2 . I open the socket with : {ok, Socket} = gen_udp:open(Local_port, [binary, {sndbuf, 16#100000}]) then I send my 100 binary packets in a loop (1472 * 100 = 147200 bytes so this shouldn't fill my send buffer). gen_udp:send/2 returns 'ok' each time, but only 9 packets reach my network interface. Only when I send 200 or more packets at a time I get {error, eagain} but still only 9 packets reach the interface. Why do packets get lost before being sent and without an error ? The systems seems to limit my send buffer ... >inet:getopts(Socket, [sndbuf]). {ok,[{sndbuf,262142}]} ... but there is room for a lot more than 9 packets. My server is (Debian) Linux 2.6.18.1 i686 GNU/Linux and OTP R11B-5 [source] [async-threads:0] [hipe] [kernel-poll:false] [hybrid heap] Thanks for your help igwan From jla415@REDACTED Mon Jul 30 22:03:28 2007 From: jla415@REDACTED (jla415) Date: Mon, 30 Jul 2007 13:03:28 -0700 (PDT) Subject: [erlang-questions] Generators? In-Reply-To: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> Message-ID: <11882920.post@talk.nabble.com> tsuraan wrote: > > While reading the Erlang and Neural Networks paper, I noticed that the > created dot product function was (in my eye) not a terribly good example > of > functional programming. A more "functional style" would be something > like: > > dot_prod(L1, L2) -> lists:sum(lists:zipwith(fun(X,Y) -> X*Y end, L1, L2)). > > So we're basically mapping a function across a pair of lists, and then > summing it. This looks pretty inefficient though; I don't think you can > do > any better than the function given in the paper, so I'm just > trying to satisfy my curiosity here. The most offensive thing that I see > about my function is that it creates a temporary list of products, and > then > sums that. If L1 and L2 are large, itwill also create a large temporary > list that is a total waste. In python, you could write a zipwith function > as a generator that yields values as they are requested. Any standard > function that takes a list will also take a generator because they both > just > expose the looping interface (__iter__). Is it possible to create a > generator function in erlang that can be used with the list functions? > I didn't read the article so I'm not sure which way he implemented it but to avoid making the temp list to sum I'd prolly implement it something along the lines of: dot_prod(L1, L2) -> dot_prod(L1, L2, 0). dot_prod([],_,Acc) -> Acc; dot_prod([H1|T1], [H2|T2], Acc) -> dot_prod(T1, T2, H1*H2 + Acc). As far as generators go I haven't seen much in OTP that resembles such besides say the *:table() functions used in QLC and whatnot. -- View this message in context: http://www.nabble.com/Generators--tf4170850.html#a11882920 Sent from the Erlang Questions mailing list archive at Nabble.com. From bryan.burgers@REDACTED Mon Jul 30 22:22:16 2007 From: bryan.burgers@REDACTED (Bryan Burgers) Date: Mon, 30 Jul 2007 22:22:16 +0200 Subject: [erlang-questions] Generators? In-Reply-To: <11882920.post@talk.nabble.com> References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: On 7/30/07, jla415 wrote: > tsuraan wrote: > > > > While reading the Erlang and Neural Networks paper, I noticed that the > > created dot product function was (in my eye) not a terribly good example > > of > > functional programming. A more "functional style" would be something > > like: > > > > dot_prod(L1, L2) -> lists:sum(lists:zipwith(fun(X,Y) -> X*Y end, L1, L2)). > > > > So we're basically mapping a function across a pair of lists, and then > > summing it. This looks pretty inefficient though; I don't think you can > > do > > any better than the function given in the paper, so I'm just > > trying to satisfy my curiosity here. The most offensive thing that I see > > about my function is that it creates a temporary list of products, and > > then > > sums that. If L1 and L2 are large, itwill also create a large temporary > > list that is a total waste. In python, you could write a zipwith function > > as a generator that yields values as they are requested. Any standard > > function that takes a list will also take a generator because they both > > just > > expose the looping interface (__iter__). Is it possible to create a > > generator function in erlang that can be used with the list functions? > > > > I didn't read the article so I'm not sure which way he implemented it but to > avoid making the temp list to sum I'd prolly implement it something along > the lines of: > > dot_prod(L1, L2) -> dot_prod(L1, L2, 0). > dot_prod([],_,Acc) -> Acc; > dot_prod([H1|T1], [H2|T2], Acc) -> dot_prod(T1, T2, H1*H2 + Acc). > > > As far as generators go I haven't seen much in OTP that resembles such > besides say the *:table() functions used in QLC and whatnot. I think the point tsuraan is making here (correct me if I'm wrong, tsuraan) is that the combination of prebuilt abstractions (zipwith and sum (or more generally, fold)) is more desirable than a hand-coded explicitly recursive function because the abstractions are more 'functional style' (something I would agree with--in other communities (Haskell coming to mind), it is strongly encouraged to use common abstractions, even to the point where using explicit recursion is sometimes discouraged). But the problem is that these abstractions, or at least the combination of them, are slower than a hand-coded function explicit recursion function. So, is there any way to make the natural abstractions work as fast as the hand-coded version? Bryan From tsuraan@REDACTED Mon Jul 30 22:59:11 2007 From: tsuraan@REDACTED (tsuraan) Date: Mon, 30 Jul 2007 15:59:11 -0500 Subject: [erlang-questions] Generators? In-Reply-To: References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: <84fb38e30707301359q23bda4f3ia1bef83165663a34@mail.gmail.com> > > I think the point tsuraan is making here (correct me if I'm wrong, > tsuraan) is that the combination of prebuilt abstractions (zipwith and > sum (or more generally, fold)) is more desirable than a hand-coded > explicitly recursive function because the abstractions are more > 'functional style' (something I would agree with--in other communities > (Haskell coming to mind), it is strongly encouraged to use common > abstractions, even to the point where using explicit recursion is > sometimes discouraged). But the problem is that these abstractions, or > at least the combination of them, are slower than a hand-coded > function explicit recursion function. So, is there any way to make the > natural abstractions work as fast as the hand-coded version? > > Bryan > Yeah, that's the question I'm going for :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Mon Jul 30 23:27:03 2007 From: james.hague@REDACTED (James Hague) Date: Mon, 30 Jul 2007 16:27:03 -0500 Subject: [erlang-questions] Generators? In-Reply-To: References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: > But the problem is that these abstractions, or > at least the combination of them, are slower than a hand-coded > function explicit recursion function. So, is there any way to make the > natural abstractions work as fast as the hand-coded version? It's interesting that list comprehensions are compiled into code that acts the same as hand-coded functions, but uses of similar functions like lists:foldl, lists:flatmap, and lists:partition are not. James From 0x6e6562@REDACTED Tue Jul 31 00:29:00 2007 From: 0x6e6562@REDACTED (Ben Hood) Date: Mon, 30 Jul 2007 23:29:00 +0100 Subject: [erlang-questions] Sending message to process already listening on a socket Message-ID: <269388e30707301529u74ec7f98l4621674419948055@mail.gmail.com> Hi, If I have a process that is already listening on a socket e.g. loop(Sock,Length) -> case gen_tcp:recv(Sock, Length, -1) of {ok, Data} -> ......% Do something and calculate the next frame length loop(Sock, NewLength); _ -> ...... end. is there anyway to send an erlang message to this process? Do messages get queued up until they are consumed by a receiving process, e.g. loop(Sock,Length) -> case gen_tcp:recv(Sock, Length, -1) of {ok, Data} -> ......% Do something receive foo -> ......% Add something to the internal state of this process end, loop(Sock, NewLength); _ -> ...... end. Or can turn the loop into receive {tcp, Sock, Bin} -> ...... and somehow specify that I want to only take a frame of x bytes from the tcp buffer? Thx, Ben From ryanobjc@REDACTED Tue Jul 31 01:32:04 2007 From: ryanobjc@REDACTED (Ryan Rawson) Date: Mon, 30 Jul 2007 16:32:04 -0700 Subject: [erlang-questions] Generators? In-Reply-To: References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: <782AA681-2F25-4C7A-BE74-84F3E09DF54E@gmail.com> This is why language features > libraries generally. The compiler knows nothing, so it has limited optimization abilities. On a side note, most optimization strategies involve obtaining more info. Type system, pragmas, explicit syntax support, etc. Its cool stuff. -ryan On Jul 30, 2007, at 2:27 PM, "James Hague" wrote: >> But the problem is that these abstractions, or >> at least the combination of them, are slower than a hand-coded >> function explicit recursion function. So, is there any way to make >> the >> natural abstractions work as fast as the hand-coded version? > > It's interesting that list comprehensions are compiled into code that > acts the same as hand-coded functions, but uses of similar functions > like lists:foldl, lists:flatmap, and lists:partition are not. > > James > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bjt@REDACTED Tue Jul 31 03:28:55 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 31 Jul 2007 11:28:55 +1000 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com> References: <46A6F881.5070208@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> <36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com> Message-ID: <46AE9057.0@pmp.com.au> Chris Curtis wrote: > Well, the main feature is being able to build a stand-alone executable > for {windows, linux, macosx, ...}. > > --chris And this is (for more casual deployments) a feature that cannot be over-praised. CEAN is much better than the "standard" Erlang install process, but the issue still is that it is a variety of executables, preset directory structure, and a bunch of beam files. SAE was cool because there was simply the exe, any required DLL's, and a single zip of compiled beam files. Still the "minimal build" method CEAN is based around is pretty useful and is somewhat like Wings3D (which installs pretty easily and cleanly). Regards, B.J.Tolputt From bjt@REDACTED Tue Jul 31 03:33:22 2007 From: bjt@REDACTED (Benjamin Tolputt) Date: Tue, 31 Jul 2007 11:33:22 +1000 Subject: [erlang-questions] A* algorithm In-Reply-To: <14f0e3620707290617rda259acq6167baa546c81173@mail.gmail.com> References: <14f0e3620707290617rda259acq6167baa546c81173@mail.gmail.com> Message-ID: <46AE9162.1040008@pmp.com.au> Gleber wrote: > Do anyone know where to find an implementation of the A* algorithm in > Erlang or some other functional language? I'm interested in > implementing it in Erlang (not necessary as parallel algorithm). Any > clues on this topic would be appreciated :) I too am interested in this area of work. While a parallel version is my ultimate aim (or at the very least - two processes running a bidirectional dijkstra algorithm), having a standard A* functional base to work from would be nice. On the other hand, algorithms like this have tended to be implemented in native code from my experience, so I would not be surprised if there is no functional version out there (as in usable source code) as yet. Regards, B.J.Tolputt From jla415@REDACTED Tue Jul 31 05:58:31 2007 From: jla415@REDACTED (jla415) Date: Mon, 30 Jul 2007 20:58:31 -0700 (PDT) Subject: [erlang-questions] Generators? In-Reply-To: References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: <11917859.post@talk.nabble.com> Bryan Burgers wrote: > > I think the point tsuraan is making here (correct me if I'm wrong, > tsuraan) is that the combination of prebuilt abstractions (zipwith and > sum (or more generally, fold)) is more desirable than a hand-coded > explicitly recursive function because the abstractions are more > 'functional style' (something I would agree with--in other communities > (Haskell coming to mind), it is strongly encouraged to use common > abstractions, even to the point where using explicit recursion is > sometimes discouraged). But the problem is that these abstractions, or > at least the combination of them, are slower than a hand-coded > function explicit recursion function. So, is there any way to make the > natural abstractions work as fast as the hand-coded version? > I was curious about the speed aspects and whipped up a quick generator version fold_gen(F,Acc,G) -> case G() of {I,N} when is_function(N) -> fold_gen(F, F(I,Acc), N); {I,eos} -> F(I,Acc) end. sum_gen(G) -> fold_gen(fun(Val,Acc) -> Val + Acc end, 0, G). zip_cont([],_) -> eos; zip_cont(L1, L2) -> fun() -> zip_gen(L1, L2) end. zip_gen([H1|T1], [H2|T2]) -> {H1 * H2, zip_cont(T1, T2)}. dot_prod_gen(L1, L2) -> sum_gen(zip_cont(L1, L2)). In my micro benchmarks it looks like the original recursive hand coded one starts out about 2x as fast with small lists and scales to around 10x as fast toward 10 million elements from one based on lists:sum(lists:zipwith(...)). The surprising part is that the the zipwith version beats this generator version by around 2x until you get up toward tens of millions of elements and creating the large temporary array starts to slow things down. Anyway, unless the data sets are really huge the difference between these all are measured in microseconds so whichever is most readable and maintainable is probably the best. Save the optimizing for when it really matters. -- View this message in context: http://www.nabble.com/Generators--tf4170850.html#a11917859 Sent from the Erlang Questions mailing list archive at Nabble.com. From lcoquelle@REDACTED Tue Jul 31 06:05:11 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Tue, 31 Jul 2007 12:05:11 +0800 Subject: [erlang-questions] Generators? In-Reply-To: <782AA681-2F25-4C7A-BE74-84F3E09DF54E@gmail.com> References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> <782AA681-2F25-4C7A-BE74-84F3E09DF54E@gmail.com> Message-ID: How would you write it with python generator? And yet another solution: dot(L1,L2) -> {R, _} = lists:foldl(fun(X, {Acc, [Y|YT]}) -> {Acc + X*Y, YT} end, {0, L2}, L1), R. On 7/31/07, Ryan Rawson wrote: > > This is why language features > libraries generally. The compiler > knows nothing, so it has limited optimization abilities. > > On a side note, most optimization strategies involve obtaining more > info. Type system, pragmas, explicit syntax support, etc. Its cool > stuff. > > -ryan > > > On Jul 30, 2007, at 2:27 PM, "James Hague" > wrote: > > >> But the problem is that these abstractions, or > >> at least the combination of them, are slower than a hand-coded > >> function explicit recursion function. So, is there any way to make > >> the > >> natural abstractions work as fast as the hand-coded version? > > > > It's interesting that list comprehensions are compiled into code that > > acts the same as hand-coded functions, but uses of similar functions > > like lists:foldl, lists:flatmap, and lists:partition are not. > > > > James > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Tue Jul 31 07:26:13 2007 From: peter@REDACTED (Peter K Chan) Date: Tue, 31 Jul 2007 07:26:13 +0200 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <46AE9057.0@pmp.com.au> References: <46A6F881.5070208@pmp.com.au><36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com><36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com> <46AE9057.0@pmp.com.au> Message-ID: I would put my vote in a native executable too. CEAN is very nice for managing all the dependencies, but when deployed to the target system, it is still a big pile of directories. I took the earlier suggestion and looked at Wings3D, and I really like how minimal and straightforward the Wings3D distribution is. CEAN is great for package management, but the myriad files are still confusing me, who is a novice. Looking at it, SAE would seems to be the ideal deployment form. It would be nice to see SAE updated for current Erlang, or somehow be able to compile a CEAN to a SAE (with only a .exe, a few .dll, and a .zip). Peter -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Benjamin Tolputt Sent: Monday, July 30, 2007 8:29 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] Stand Alone Erlang Still Updated? Chris Curtis wrote: > Well, the main feature is being able to build a stand-alone executable > for {windows, linux, macosx, ...}. > > --chris And this is (for more casual deployments) a feature that cannot be over-praised. CEAN is much better than the "standard" Erlang install process, but the issue still is that it is a variety of executables, preset directory structure, and a bunch of beam files. SAE was cool because there was simply the exe, any required DLL's, and a single zip of compiled beam files. Still the "minimal build" method CEAN is based around is pretty useful and is somewhat like Wings3D (which installs pretty easily and cleanly). Regards, B.J.Tolputt _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From bryan.burgers@REDACTED Tue Jul 31 09:01:10 2007 From: bryan.burgers@REDACTED (Bryan Burgers) Date: Tue, 31 Jul 2007 09:01:10 +0200 Subject: [erlang-questions] mnesia table layout suggestion Message-ID: Hi. In part of my program, I want to store lists of objects in mnesia. So I have these functions: > add_to_list( User, Object, List ) -> ... > retrieve_from_list( User, List ) -> ... So I can do: > lists:add_to_list( bryan, milk, shopping ). > lists:add_to_list( bryan, eggs, shopping ). > lists:add_to_list( bryan, todo, ask_question ). > retrieve_from_list( bryan, shopping ). [milk,eggs] My question is about how to store this in mnesia. Currently, I have a: > -record( listitem, { key, object } ). > % where key is a tuple of a user and a list and I am using a bag. This way, it seems that each user has her own set of lists, and she can put as many things in the lists. (There will never be the same item twice in a list, which is the way I want it, and there is no sharing of lists.) The problem comes when I want to do queries with QLC, though, because what I want is: > qlc:q([ X#listitem.user || X <- mnesia:tables( listitem ), ... ]). but since I don't have a 'user' field, I can't do that. It seems one solution would be to make my: > -record(listitem, { key, user, list, item }). with redundant information, but that seems like overkill. Is there a better way to do this? I'm wondering if there is a good way to set up my mnesia table to handle a > -record(listitem, { user, list, item }). with the semantics that I want? Or should I just use the redundant information, and if I ever want to use the record outside of the function, I can transform it: > -record(dblistitem, { key, user, list, item } ). > -record(listitem, { user, list, item } ). > transform_listitem( #dblistitem{ key = {User,List}, item = Item ) -> > #listitem{ user = User, list = List, item = Item }. So, do you have any good ideas on the best way to handle this situation? Thanks in advance, Bryan From hakan@REDACTED Tue Jul 31 10:14:47 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 31 Jul 2007 10:14:47 +0200 (CEST) Subject: [erlang-questions] Maximum number of Mnesia nodes In-Reply-To: <002201c7d2d1$d8ced560$b029030a@mtl.ubisoft.org> References: <002201c7d2d1$d8ced560$b029030a@mtl.ubisoft.org> Message-ID: On Mon, 30 Jul 2007, denis wrote: > Date: Mon, 30 Jul 2007 13:48:31 -0400 > From: denis > To: 'Hakan Mattsson' > Cc: 'David King' , 'Joel Reymont' , > 'Erlang Questions' > Subject: RE: [erlang-questions] Maximum number of Mnesia nodes > > > > > -----Message d'origine----- > > De?: Hakan Mattsson [mailto:hakan@REDACTED] > > Envoy??: lundi 30 juillet 2007 11:26 > > ??: denis > > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > > Objet?: RE: [erlang-questions] Maximum number of Mnesia nodes > > > > > > If you replicate the tables to all nodes, the > > performance of updates will be worse for each new node > > that you add. I think that the performance characteristics > > of such a transaction will aproximately follow this > > formula: C + N * P. Where N is the number of nodes, P > > is the work performed for each (remote) transaction > > participant and C is the (local) transaction coordinator > > work that is independent of the number of nodes. > > > > I thought that the transaction time increase was less > than that. Isn't the replication done in parallel? I > mean, if we have 3 nodes, and we do an insert, for > instance, the insert is forwarded to each node at the > same time, and the coordinator wait for the > confirmation of each node to validate the > transaction. In this case, the formula would be > approximately: > C + max(P) Yes you are right, much of the work that is performed on byhalf of the participants are done in parallel on the remote nodes. But parts of the work that the coordinator performs is also dependent of how many paricipants that are involved. So if we split P into the the coordinator work that is dependent of the number of participants (CP) and the work (PP) that is done remotely by the participant itself we can come up with a more precise formula: C + N * CP + max(PP). > > But do you really need to replicate the data to all nodes? > > In fact, the load is dispatched by a load balancer > which dispatches requests to different servers. That's > why we have one mnesia instance per server, with tables > replicated. If one server crash, the others servers > have all data to take the load of the crashed one.The > problem with this architecture is if we add to many > servers, we increase the load of mnesia replication. > I'll try to find if we can use fragments in our case, > or rethink the architecture. Good luck! /H?kan > Denis > > > > Even if you have relatively few records in your database, > > fragmented tables can be very useful in order to distribute > > the load over many nodes. > > > > If you can identify some type of record in your > > application that is being accessed in the majority of > > your transactions, it is a good candidate for fragmented > > table storage. This could be a bank account, a subscriber, > > a session etc. etc. You can also co-locate records in other > > tables with your main record (see "foreign_key" in Mnesia). > > > > When your application needs to access such a record it > > should determine one of the replica nodes for the table > > and run the transaction on that node. If this can be > > achieved for all transactions there will always be a > > fixed number of (2-3?) nodes involved in each transaction. > > That is the (2?) nodes where the table is replicated plus > > one of the nodes from where transactions are forwarded. > > If you distribute the fragments over more nodes it will > > scale smoothly. > > > > Of course it is not possible to achieve this for all > > types of applications. But you should strive for that > > kind of access patterns in order to achieve better > > scalability. > > > > /H?kan > > > > On Fri, 27 Jul 2007, denis wrote: > > > > > Date: Fri, 27 Jul 2007 14:57:14 -0400 > > > From: denis > > > To: 'Hakan Mattsson' > > > Cc: 'David King' , 'Joel Reymont' > > , > > > 'Erlang Questions' > > > Subject: RE: [erlang-questions] Maximum number of Mnesia nodes > > > > > > Thanks Hakan for your response. > > > > > > If I understand well, fragmented tables are interesting when we have > > high > > > volume of data. In my case, that's not the case, around 100000 records > > on 5 > > > tables. > > > I plan to have one mnesia instance per server (and one server per > > machine), > > > each having each table in ram_copies replicated with the others servers. > > > Each server uses his local mnesia instance (maybe that's not the better > > > architecture?) > > > > > > My concern is when for instance I do a delete or an insert into a table. > > The > > > transaction succeeds only when the insert or delete are done on each > > > replicated table. If I have only one server, the transaction time will > > be > > > for instance 10ms. If I have two server replicated, will it be 2*10ms ? > > For > > > N servers, what kind of factor can I expect? N, log(n), exp(N) ...? > > > I'm not sure that I can run 20 servers for instance, and keep good > > > performance, depending on the response time of the transaction > > commitment on > > > each node. > > > > > > Thanks > > > Denis > > > > > > > > > > -----Message d'origine----- > > > > De?: Hakan Mattsson [mailto:hakan@REDACTED] > > > > Envoy??: vendredi 27 juillet 2007 13:09 > > > > ??: denis > > > > Cc?: 'David King'; 'Joel Reymont'; 'Erlang Questions' > > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > > > > > The scalability of Mnesia depends heavily of your > > > > access patterns and how you have configured Mnesia. > > > > > > > > If you ensure that the number of nodes involved in a > > > > typical transaction is constant, Mnesia should scale > > > > very well. One way of achieving linear scalability > > > > characteristics, is to use the concept called > > > > "foreign_key" in the chapter about fragmented > > > > tables. The bench example (mnesia/examples/bench) > > > > utilizes this technique. > > > > > > > > When I wrote the "bench" benchmark example it turned > > > > out to scale almost perfectly linear. (By distributing > > > > the Mnesia tables over twice as many computers, the > > > > number of processed transactions per second also > > > > doubled.) But by that time I only had access to 10 (or > > > > was it 16?) identical computers, so I cannot say > > > > anything about how Mnesia scales beyond that. Worth to > > > > mentition is that I also did successfully run the bench > > > > example with fragmented tables distributed over all our > > > > machines at the office (50+). But as those computers > > > > had so different characteristics, it is impossible to > > > > say anything about the scalability. It was fun that it > > > > worked though. > > > > > > > > Chandru, do you still have the highscore of the number > > > > of Mnesia nodes in a production environment? > > > > > > > > /H?kan > > > > > > > > On Fri, 27 Jul 2007, denis wrote: > > > > > > > > > Date: Fri, 27 Jul 2007 11:15:18 -0400 > > > > > From: denis > > > > > To: 'David King' , 'Joel Reymont' > > > > > > > > > Cc: 'Erlang Questions' > > > > > Subject: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > > > Still nobody have a response for this? > > > > > > > > > > I'm in the case of designing a server embedding mnesia with > > ram_copies > > > > > tables. Several instances of the server can be launched, and the > > mnesia > > > > > tables are replicated. > > > > > I'm having the same concern with how many instances I can run before > > the > > > > > transaction committing in mnesia becomes a problem. > > > > > > > > > > If someone already used several replicated mnesia instances, I would > > > > like to > > > > > have some numbers. > > > > > > > > > > Thanks > > > > > Denis > > > > > > > > > > > -----Message d'origine----- > > > > > > De?: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > > > > > > bounces@REDACTED] De la part de David King > > > > > > Envoy??: lundi 23 juillet 2007 21:24 > > > > > > ??: Joel Reymont > > > > > > Cc?: Erlang Questions > > > > > > Objet?: Re: [erlang-questions] Maximum number of Mnesia nodes > > > > > > > > > > > > Did you ever get any off-list responses to this? I'm curious too. > > > > > > > > > > > > On 15 Jul 2007, at 05:44, Joel Reymont wrote: > > > > > > > > > > > > > Folks, > > > > > > > > > > > > > > How many Mnesia nodes are you running in your production > > > > > > > installation? I'm looking to find the maximum here. > > > > > > > > > > > > > > I'm only dealing with ram_copies tables (cache), trying to > > figure > > > > out > > > > > > > whether I can make every Yaws node a Mnesia node without slowing > > > > > > > transactions down too much. > > > > > > > > > > > > > > My current thinking is to wait and gather statistics before > > trying > > > > to > > > > > > > decouple Yaws and Mnesia . Still, I would love to know how much > > > > > > > transactions slow down with the addition of every new Mnesia > > node. > > > > > > > > > > > > > > Thanks, Joel > > > > > > > > > > > > > > -- > > > > > > > http://topdog.cc - EasyLanguage to C# compiler > > > > > > > http://wagerlabs.com - Blog From hakan@REDACTED Tue Jul 31 11:03:18 2007 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 31 Jul 2007 11:03:18 +0200 (CEST) Subject: [erlang-questions] Sending message to process already listening on a socket In-Reply-To: <269388e30707301529u74ec7f98l4621674419948055@mail.gmail.com> References: <269388e30707301529u74ec7f98l4621674419948055@mail.gmail.com> Message-ID: If you use the socket option {active, once} you will get the TCP data in the process mailbox. See the man pages for inet and gen_tcp. /H?kan On Mon, 30 Jul 2007, Ben Hood wrote: BH> Date: Mon, 30 Jul 2007 23:29:00 +0100 BH> From: Ben Hood <0x6e6562@REDACTED> BH> To: erlang-questions@REDACTED BH> Subject: [erlang-questions] Sending message to process already listening on BH> a socket BH> BH> Hi, BH> BH> If I have a process that is already listening on a socket e.g. BH> BH> loop(Sock,Length) -> BH> case gen_tcp:recv(Sock, Length, -1) of BH> {ok, Data} -> BH> ......% Do something and calculate the next frame length BH> loop(Sock, NewLength); BH> _ -> BH> ...... BH> end. BH> BH> is there anyway to send an erlang message to this process? Do messages BH> get queued up until they are consumed by a receiving process, e.g. BH> BH> loop(Sock,Length) -> BH> case gen_tcp:recv(Sock, Length, -1) of BH> {ok, Data} -> BH> ......% Do something BH> receive BH> foo -> BH> ......% Add something to the internal state of this process BH> end, BH> loop(Sock, NewLength); BH> _ -> BH> ...... BH> end. BH> BH> Or can turn the loop into BH> BH> receive BH> {tcp, Sock, Bin} -> BH> ...... BH> BH> and somehow specify that I want to only take a frame of x bytes from BH> the tcp buffer? BH> BH> Thx, BH> BH> Ben From casper2000a@REDACTED Tue Jul 31 11:07:53 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 31 Jul 2007 14:37:53 +0530 Subject: [erlang-questions] ErlIde In-Reply-To: Message-ID: <20070731090755.E881719DC33B@mail.wavenet.lk> Hi, In Eclipse ErlIde, how do I specify External Header files? For eg. in my source file, if I refer an include file as below, -include_lib("kernel/include/inet_sctp.hrl"). ErlIde doesn't seems to get that include file from below ERTS kernel include directory. D:\erl5.5.5\lib\kernel-2.11.5\include D:\erl5.5.5 is the $ERL_TOP directory. Thanks, - Eranga From henrique.ferreiro@REDACTED Fri Jul 27 23:13:02 2007 From: henrique.ferreiro@REDACTED (Henrique Ferreiro) Date: Fri, 27 Jul 2007 23:13:02 +0200 Subject: [erlang-questions] apply/2 In-Reply-To: <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> References: <1185554499.6226.2.camel@macbook> <00f001c7d06f$69d7dc10$891ea8c0@SSI.CORP> <6a36e7290707271016w79167092g382a05e1a5a8795d@mail.gmail.com> Message-ID: <1185570782.6226.8.camel@macbook> Thanks. Next time I'll read the docs more carefully. O Ven, 27-07-2007 ?s 10:16 -0700, Bob Ippolito escribiu: > apply/2 takes a fun, not the name of the function (an atom)... to use > apply/2 you'd do this: > > apply(fun erlang:round/1, [2.3]). > > apply/3 takes the name of the module, the name of the function (both > atoms), and the arguments as demonstrated. > > -bob > > On 7/27/07, David Mercer wrote: > > Fun round is in the erlang module. This should work: > > > > > apply(erlang, round, [2.3]). > > > > Cheers, > > > > David > > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Henrique Ferreiro > > Sent: Friday, July 27, 2007 11:42 > > To: erlang-questions@REDACTED > > Subject: [erlang-questions] apply/2 > > > > Hello, > > > > I noticed some extrange behaviour that this list surely can explain: > > > > 1> round(2.3). > > 2 > > 2> apply(round, [2.3]). > > > > =ERROR REPORT==== 27-Jul-2007::18:40:22 === > > Error in process <0.31.0> with exit value: > > {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > > > ** exited: {{badfun,round}, > > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** > > > > Thanks in advance, > > Henrique Ferreiro > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From matthias@REDACTED Tue Jul 31 10:32:44 2007 From: matthias@REDACTED (Matthias Lang) Date: Tue, 31 Jul 2007 10:32:44 +0200 Subject: [erlang-questions] Sending message to process already listening on a socket In-Reply-To: <269388e30707301529u74ec7f98l4621674419948055@mail.gmail.com> References: <269388e30707301529u74ec7f98l4621674419948055@mail.gmail.com> Message-ID: <18094.62380.145458.235142@antilipe.corelatus.se> 1. Yes, messages are queued up until consumed. 2. Take a look at the {active, once} option for TCP sockets. It's documented on the inet manpage. 3. If your message handling starts getting complicated and you complicate your code to try and prevent blocking, then that's often a sign that you're trying to get one process to solve a problem which would be more cleanly solved by two or more processes. Matthias -------------------- Ben Hood writes: > Hi, > > If I have a process that is already listening on a socket e.g. > > loop(Sock,Length) -> > case gen_tcp:recv(Sock, Length, -1) of > {ok, Data} -> > ......% Do something and calculate the next frame length > loop(Sock, NewLength); > _ -> > ...... > end. > > is there anyway to send an erlang message to this process? Do messages > get queued up until they are consumed by a receiving process, e.g. > > loop(Sock,Length) -> > case gen_tcp:recv(Sock, Length, -1) of > {ok, Data} -> > ......% Do something > receive > foo -> > ......% Add something to the internal state of this process > end, > loop(Sock, NewLength); > _ -> > ...... > end. > > Or can turn the loop into > > receive > {tcp, Sock, Bin} -> > ...... > > and somehow specify that I want to only take a frame of x bytes from > the tcp buffer? > > Thx, > > Ben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From casper2000a@REDACTED Tue Jul 31 12:17:00 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 31 Jul 2007 15:47:00 +0530 Subject: [erlang-questions] ErlIde In-Reply-To: <20070731090755.E881719DC33B@mail.wavenet.lk> Message-ID: <20070731101704.26ECA19DC07A@mail.wavenet.lk> I found out, that this happens when a project exists with the same name. The ErlIde sets the project directory as a code:lib_dir prior to ERTS directory. For eg. "d:/Development/workspace/genlibs/branches/property_file-0.1/ebin" Comes before, "d:/DEVELO~1/ERL55~1.5/lib/property_file-1.0/ebin" Is it possible to do this the other way? This is important, since some packages generates Erl header files and I don't like to save them in the Projects' include directory, but rather at ERTS/lib//include directory. Is that possible? Also below inet_sctp.hrl file was successfully recovered by the ErlIde, once I removed that line and re-entered. Thanks, - Eranga -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Eranga Udesh Sent: Tuesday, July 31, 2007 2:38 PM To: 'Erlang Questions' Subject: [erlang-questions] ErlIde Hi, In Eclipse ErlIde, how do I specify External Header files? For eg. in my source file, if I refer an include file as below, -include_lib("kernel/include/inet_sctp.hrl"). ErlIde doesn't seems to get that include file from below ERTS kernel include directory. D:\erl5.5.5\lib\kernel-2.11.5\include D:\erl5.5.5 is the $ERL_TOP directory. Thanks, - Eranga _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Tue Jul 31 12:38:52 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 31 Jul 2007 12:38:52 +0200 Subject: [erlang-questions] ErlIde In-Reply-To: <20070731101704.26ECA19DC07A@mail.wavenet.lk> References: <20070731090755.E881719DC33B@mail.wavenet.lk> <20070731101704.26ECA19DC07A@mail.wavenet.lk> Message-ID: <95be1d3b0707310338n70773183n4bf103b428d18742@mail.gmail.com> Hi, On 7/31/07, Eranga Udesh wrote: > I found out, that this happens when a project exists with the same name. The > ErlIde sets the project directory as a code:lib_dir prior to ERTS directory. > For eg. > "d:/Development/workspace/genlibs/branches/property_file-0.1/ebin" > Comes before, > "d:/DEVELO~1/ERL55~1.5/lib/property_file-1.0/ebin" > > Is it possible to do this the other way? This is important, since some > packages generates Erl header files and I don't like to save them in the > Projects' include directory, but rather at ERTS/lib//include directory. > Is that possible? Yes, of course it is possible to do it the other way. Trouble is that there are other cases when that won't work (for example when one needs to override a module from ERTS/lib/ in one's project). So the solution would be to have a project option as to whether to use add_patha or add_pathz on the project's ebin directory. It might take a couple of days to fix it. If you add a bug report, it will be easier to get notified when the fix is in place. best regards, Vlad From casper2000a@REDACTED Tue Jul 31 14:21:24 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 31 Jul 2007 17:51:24 +0530 Subject: [erlang-questions] ErlIde In-Reply-To: <95be1d3b0707310338n70773183n4bf103b428d18742@mail.gmail.com> Message-ID: <20070731122127.437DD19DC400@mail.wavenet.lk> Thanks for the reply. I saw PathA and PathZ parameters in the ERTS config in the ErlIde, but they don't seem to be working. Also in Project Properties there's "ext inc", probably to include external include files, but doesn't seems to be working either (is it to include directory or file?). I'll create a bug report. Even with here and there glitches, ErlIde is an excellent IDE for Erlang development. Thanks, - Eranga -----Original Message----- From: Vlad Dumitrescu [mailto:vladdu55@REDACTED] Sent: Tuesday, July 31, 2007 4:09 PM To: Eranga Udesh Cc: Erlang Questions Subject: Re: [erlang-questions] ErlIde Hi, On 7/31/07, Eranga Udesh wrote: > I found out, that this happens when a project exists with the same name. The > ErlIde sets the project directory as a code:lib_dir prior to ERTS directory. > For eg. > "d:/Development/workspace/genlibs/branches/property_file-0.1/ebin" > Comes before, > "d:/DEVELO~1/ERL55~1.5/lib/property_file-1.0/ebin" > > Is it possible to do this the other way? This is important, since some > packages generates Erl header files and I don't like to save them in the > Projects' include directory, but rather at ERTS/lib//include directory. > Is that possible? Yes, of course it is possible to do it the other way. Trouble is that there are other cases when that won't work (for example when one needs to override a module from ERTS/lib/ in one's project). So the solution would be to have a project option as to whether to use add_patha or add_pathz on the project's ebin directory. It might take a couple of days to fix it. If you add a bug report, it will be easier to get notified when the fix is in place. best regards, Vlad From Chris.Curtis@REDACTED Tue Jul 31 15:22:01 2007 From: Chris.Curtis@REDACTED (Chris Curtis) Date: Tue, 31 Jul 2007 09:22:01 -0400 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: References: <46A6F881.5070208@pmp.com.au><36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com><36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com><46AE9057.0@pmp.com.au> Message-ID: <36E4692623C5974BA6661C0B18EE8EDF7FF9EC@MAILSERV.hcrest.com> Peter Chan wrote: > I would put my vote in a native executable too. CEAN is very nice for > managing all the dependencies, but when deployed to the target system, > it is still a big pile of directories. > I took the earlier suggestion and looked at Wings3D, and I really like > how minimal and straightforward the Wings3D distribution is. CEAN is > great for package management, but the myriad files are still confusing > me, who is a novice. > Looking at it, SAE would seems to be the ideal deployment form. It would > be nice to see SAE updated for current Erlang, or somehow be able to > compile a CEAN to a SAE (with only a .exe, a few .dll, and a .zip). Yep, that's pretty much what I'm hoping for. A comparable model (sort of) comes from the Ruby world... Ruby Gems are kind of like CEAN, and there's a tool RubyScript2Exe that can generate the executable and associated support files. [I haven't personally used this, just know it exists.] Another, slightly-different model is from the Lisp world, where (for example) SBCL has (sb-ext:save-lisp-and-die ... :executable t ...) that saves things as they are. OTOH, dealing with updates and hot code replacement may be a much larger problem without a "pile of directories and BEAM files". I also need to go back and look at the Wings3D code... it's been a while since I poked at it. The end goal, as I see it, is the ability to produce a complete installable application that can be dealt with by a normal consumer-type end-user. --chris From bbmaj7@REDACTED Tue Jul 31 14:49:23 2007 From: bbmaj7@REDACTED (Richard Andrews) Date: Tue, 31 Jul 2007 22:49:23 +1000 (EST) Subject: [erlang-questions] Efficiency of passing data through port owner Message-ID: <862881.42609.qm@web52006.mail.re2.yahoo.com> I have a set of processes in mind: Receiver process assembles out-of-sequence parts of a large message sent by other processes so the whole message can go out a port as a binary when assembled. PortIO process handles data coming back from the port ExternalPort and as such is the port owner. I'm inexperienced with using ports and I'm looking for hints on how to efficiently get the data accumulated in Receiver out through ExternalPort. The obvious approach is to send the full message to PortIO which then sends it to ExternalPort, but I am concerned that this introduces inefficiency due to the size of the message. Would the above strategy result in a copy of the message binary being made from Receiver to PortIO prior to being pushed out the port? Is is possible to send directly from Receiver to ExternalPort (eg. registered port), but have data come back from ExternalPort into PortIO? If possible, is it a recommended approach? Is it possible for PortIO to also reliably send messages and admin commands to ExternalPort in this situation? Is there a potential for messages to get corrupted by interleaving if sent to the port from different processes at the same time? Would TCP be better than a pipe-based port? The system will be running on a linux 2.6.x kernel. Thanks for any input. -- Rich ____________________________________________________________________________________ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html From gleber.p@REDACTED Tue Jul 31 16:29:48 2007 From: gleber.p@REDACTED (Gleber) Date: Tue, 31 Jul 2007 16:29:48 +0200 Subject: [erlang-questions] A* algorithm In-Reply-To: <46AE9162.1040008@pmp.com.au> References: <14f0e3620707290617rda259acq6167baa546c81173@mail.gmail.com> <46AE9162.1040008@pmp.com.au> Message-ID: <14f0e3620707310729r6dc6569cyd30c2f0faa377a68@mail.gmail.com> On 7/31/07, Benjamin Tolputt wrote: > Gleber wrote: > > Do anyone know where to find an implementation of the A* algorithm in > > Erlang or some other functional language? I'm interested in > > implementing it in Erlang (not necessary as parallel algorithm). Any > > clues on this topic would be appreciated :) > I too am interested in this area of work. While a parallel version is my > ultimate aim (or at the very least - two processes running a > bidirectional dijkstra algorithm), having a standard A* functional base > to work from would be nice. > > On the other hand, algorithms like this have tended to be implemented in > native code from my experience, so I would not be surprised if there is > no functional version out there (as in usable source code) as yet. I've found an implementation in Haskell [1], but had no time to read and understand it... Benjamin, if you will be able to rewrite it to Erlang, i would appreciate if you share it with us. [1] http://www.haskell.org/haskellwiki/Haskell_Quiz/Astar/Solution_Dolio > Regards, > B.J.Tolputt > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Regards, Gleb Peregud "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein From james.hague@REDACTED Tue Jul 31 17:43:01 2007 From: james.hague@REDACTED (James Hague) Date: Tue, 31 Jul 2007 10:43:01 -0500 Subject: [erlang-questions] Generators? In-Reply-To: <782AA681-2F25-4C7A-BE74-84F3E09DF54E@gmail.com> References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> <782AA681-2F25-4C7A-BE74-84F3E09DF54E@gmail.com> Message-ID: On 7/30/07, Ryan Rawson wrote: > This is why language features > libraries generally. The compiler > knows nothing, so it has limited optimization abilities. The BEAM compiler already special-cases some library functions, redirecting the code to a BIF. lists:reverse is one example. James From saifi@REDACTED Tue Jul 31 17:59:50 2007 From: saifi@REDACTED (Saifi Khan) Date: Tue, 31 Jul 2007 21:29:50 +0530 (IST) Subject: [erlang-questions] example of race conditions ? Message-ID: Hello: The last section in Chap 9 (Errors in Concurrent prog) of Programming Erlang book by Dr. Armstrong, says the following: "When you combine the Erlang primitives spawn(), spawn_link(), register() ..., you must think carefully about possible race conditions. Write your code in such a way that race conditions cannot happen" To me, it seemed like an anti-climax of the whole 'lock free prog' model. Please correct me, if I am wrong. Can somebody share sample code that *has* race conditions ? Appreciate a response from the experienced erlangers. thanks Saifi. TWINCLING Society freedom of innovation http://www.twincling.org/ From ulf@REDACTED Tue Jul 31 18:18:24 2007 From: ulf@REDACTED (Ulf Eliasson) Date: Tue, 31 Jul 2007 17:18:24 +0100 (BST) Subject: [erlang-questions] example of race conditions ? In-Reply-To: References: Message-ID: <1085.81.149.81.161.1185898704.squirrel@webmail.erlangsystems.com> Hi, The problem is that only one process can have a certain name and what happens if more then one process want a certain name? For example, you want to spawn several processes and have one as master and the rest as slaves. You do this by having this start function for a module. start() -> % Check if any process is already registered as master case whereis(master) of undefined -> % No master, I register as master and start looping register(master, self()), loop(as_master); MasterPid % Already exist one master, I report in as slave MasterPid ! {newslave, self()}, loop(as_slave) end. This will work as long as one process get to execute both whereis and register without any other processes getting time to execute. If you now spawn let say ten of these processes, you will likely ending up with processes checking if master is registered, getting undefined back, but then some other process execute and register the name, the next time the first process get to execute it try to register the name master, which wont work. A quick and dirty example of a race condition, code is untested and might contain syntax errors. Regards, Ulf On Tue, July 31, 2007 16:59, Saifi Khan wrote: > Hello: > > The last section in Chap 9 (Errors in Concurrent prog) of > Programming Erlang book by Dr. Armstrong, says the following: > > "When you combine the Erlang primitives spawn(), spawn_link(), > register() ..., you must think carefully about possible race > conditions. > Write your code in such a way that race conditions cannot happen" > > To me, it seemed like an anti-climax of the whole 'lock free prog' > model. Please correct me, if I am wrong. > > Can somebody share sample code that *has* race conditions ? > > Appreciate a response from the experienced erlangers. > > > thanks > Saifi. > > TWINCLING Society > freedom of innovation > http://www.twincling.org/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Ulf Eliasson, ulf@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From richardc@REDACTED Tue Jul 31 18:27:57 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 31 Jul 2007 18:27:57 +0200 Subject: [erlang-questions] Generators? In-Reply-To: References: <84fb38e30707300756y6a4e792fke23a4cd428564340@mail.gmail.com> <11882920.post@talk.nabble.com> Message-ID: <46AF630D.3000905@it.uu.se> James Hague wrote: >> But the problem is that these abstractions, or >> at least the combination of them, are slower than a hand-coded >> function explicit recursion function. So, is there any way to make the >> natural abstractions work as fast as the hand-coded version? > > It's interesting that list comprehensions are compiled into code that > acts the same as hand-coded functions, but uses of similar functions > like lists:foldl, lists:flatmap, and lists:partition are not. Actually, there is a compiler option (undocumented, I think) 'inline_list_funcs' that creates inline versions of the most common higher order list functions. It's not well tested, though, so there may be some lurking bugs. Since it is a semantic-changing optimization (inlines hard knowledge of the semantics of functions in another module) it is not turned on by default and has been regarded with some suspicion by OTP. Do make some noise if you want it to be a documented feature. In combination with the generic inliner (the 'inline' option), it should be able to produce code similar to the corresponding hand-coded functions in cases where the fun is provided explicitly. (Try increasing the {inline_size, N} and/or {inline_effort, N} values if not.) Hint: use the 'to_cerl' flag to inspect the resulting code. /Richard From dking@REDACTED Tue Jul 31 18:48:27 2007 From: dking@REDACTED (David King) Date: Tue, 31 Jul 2007 09:48:27 -0700 Subject: [erlang-questions] example of race conditions ? In-Reply-To: References: Message-ID: <7EC6029D-CC8D-4ED2-9EDE-476D40870607@ketralnis.com> > Can somebody share sample code that *has* race conditions ? > Appreciate a response from the experienced erlangers. I'm not that experienced, but here goes: -module(foo). -export([get/0,set/1]). % external callers -export([daemon_loop/1]). % for spawn() -define(initial_value,0). daemon_loop(CurrentValue) -> receive {get,Callback} -> CallBack ! {value,CurrentValue}, daemon_loop(CurrentValue); {set,Value} daemon_loop(Value); die -> ok; end. get() -> ensure_running(), daemon ! {get,self()}, receive {value,Value} -> Value end. set(Value) ensure_running(), daemon ! {set,Value}. ensure_running() -> case erlang:whereis(daemon) of undefined -> start_daemon(); Pid -> ok end. start_daemon() -> DaemonPid=spawn(?MODULE,daemon_loop,[?initial_value]), register(daemon_loop,DaemonPid). So that's a simple program that allows you to set some global variable by spawning a daemon to maintain its value and communicate it, like this: foo:set(cheese), true=(cheese==foo:get()). You can call these from separate processes and get/set their values correctly. Since only one process enters the daemon_loop at a time (because messages to it are queued until retrieved), gets and sets of "Value" are thread-safe. However, if I call get/0 and set/1 at the same time, ensure_running/0 will be called twice, at the same time. The first instance of "whereis" will return undefined, and the second instance of "whereis" may also return undefined if the first process is pre-empted (or running on another CPU at the same time) in between the "whereis" and the "register". What can happen is that you can get two daemon_loops running, one which becomes unreachable, which could be the initial value that you set. From the perspective of a user of this module, you could get a case where running foo:set(1), true=(1==foo:get()). and TheValue=foo:get(). at the same time can cause the first process to die with a badmatch. Notice how the thread-unsafe part of this is the global data that is shared: the table of registered name/PIDs. The "Value" is not shared, and its accesses are thread-safe. Does that all make sense? From dking@REDACTED Tue Jul 31 19:16:21 2007 From: dking@REDACTED (David King) Date: Tue, 31 Jul 2007 10:16:21 -0700 Subject: [erlang-questions] example of race conditions ? In-Reply-To: <1085.81.149.81.161.1185898704.squirrel@webmail.erlangsystems.com> References: <1085.81.149.81.161.1185898704.squirrel@webmail.erlangsystems.com> Message-ID: <89C58813-7413-4BC3-95F9-1C0D60A8FFB5@ketralnis.com> > The problem is that only one process can have a certain name and what > happens if more then one process want a certain name? This example is basically identical to mine (and sent a few minutes before mine), so I'm glad to see that my concern about it is warranted. What is considered "the" solution to this? To create these processes before calling functions that may use them? What if you're writing a module that others may use, and don't have control over their startup process? Or what if a given daemon process is rarely used? It seems a waste of resources to spawn it if it may never be used. Can the process-table be locked? That doesn't seem very Erlang-ish either. > For example, you want to spawn several processes and have one as > master > and the rest as slaves. > > You do this by having this start function for a module. > > start() -> > % Check if any process is already registered as master > case whereis(master) of > undefined -> > % No master, I register as master and start looping > register(master, self()), > loop(as_master); > MasterPid > % Already exist one master, I report in as slave > MasterPid ! {newslave, self()}, > loop(as_slave) > end. > > This will work as long as one process get to execute both whereis and > register without any other processes getting time to execute. > > If you now spawn let say ten of these processes, you will likely > ending up > with processes checking if master is registered, getting undefined > back, > but then some other process execute and register the name, the next > time > the first process get to execute it try to register the name > master, which > wont work. > > A quick and dirty example of a race condition, code is untested and > might > contain syntax errors. > > Regards, > Ulf > > On Tue, July 31, 2007 16:59, Saifi Khan wrote: >> Hello: >> >> The last section in Chap 9 (Errors in Concurrent prog) of >> Programming Erlang book by Dr. Armstrong, says the following: >> >> "When you combine the Erlang primitives spawn(), spawn_link(), >> register() ..., you must think carefully about possible race >> conditions. >> Write your code in such a way that race conditions cannot happen" >> >> To me, it seemed like an anti-climax of the whole 'lock free prog' >> model. Please correct me, if I am wrong. >> >> Can somebody share sample code that *has* race conditions ? >> >> Appreciate a response from the experienced erlangers. >> >> >> thanks >> Saifi. >> >> TWINCLING Society >> freedom of innovation >> http://www.twincling.org/ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > -- > Ulf Eliasson, ulf@REDACTED > Erlang Training and Consulting > http://www.erlang-consulting.com/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From thomasl_erlang@REDACTED Tue Jul 31 19:55:26 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 31 Jul 2007 10:55:26 -0700 (PDT) Subject: [erlang-questions] Generators? In-Reply-To: <84fb38e30707301359q23bda4f3ia1bef83165663a34@mail.gmail.com> Message-ID: <333931.89407.qm@web38803.mail.mud.yahoo.com> --- tsuraan wrote: > > > > I think the point tsuraan is making here (correct > me if I'm wrong, > > tsuraan) is that the combination of prebuilt > abstractions (zipwith and > > sum (or more generally, fold)) is more desirable > than a hand-coded > > explicitly recursive function because the > abstractions are more > > 'functional style' (something I would agree > with--in other communities > > (Haskell coming to mind), it is strongly > encouraged to use common > > abstractions, even to the point where using > explicit recursion is > > sometimes discouraged). But the problem is that > these abstractions, or > > at least the combination of them, are slower than > a hand-coded > > function explicit recursion function. So, is there > any way to make the > > natural abstractions work as fast as the > hand-coded version? > > > > Bryan > > > > Yeah, that's the question I'm going for :) Creating local copies of higher-order functions and plugging in function arguments can be very effective, and a suitable optimizer can easily do it automagically (see my paper in EUC 2001 for an example; it appears that the beam compiler can do it too nowadays). Doing this can sometimes yield satisfying integer speedups on real code. It seems quite feasible to take this approach further, though. In particular, compositions of several higher-order functions could also be turned into specialized code and optimized in various ways. For Haskell, this has been explored in the context of deforestation (e.g, "A Shortcut to Deforestation"). The equivalent still remains to be done for Erlang. Best, Thomas ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ From richardc@REDACTED Tue Jul 31 23:06:20 2007 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 31 Jul 2007 23:06:20 +0200 Subject: [erlang-questions] Generators? In-Reply-To: <333931.89407.qm@web38803.mail.mud.yahoo.com> References: <333931.89407.qm@web38803.mail.mud.yahoo.com> Message-ID: <46AFA44C.80802@it.uu.se> Thomas Lindgren wrote: > It seems quite feasible to take this approach further, > though. In particular, compositions of several > higher-order functions could also be turned into > specialized code and optimized in various ways. For > Haskell, this has been explored in the context of > deforestation (e.g, "A Shortcut to Deforestation"). > The equivalent still remains to be done for Erlang. We had a couple of students implement the S. to D. (or if it was plain old Deforestation... my memory fails me), but their results were not very encouraging, and I had no time to try to improve on their work. It's hard to find existing real code where deforestation gives an improvement. The problem is generally that the producer and consumer code tends to be too far away from each other, so the optimization can rarely (read "never") be applied. It could be argued, though (and I would agree), that Deforestation is an optimization that simply _should_ be available in the compiler, so that you can rely on it when you write your code. If anyone (perhaps Thomas, in his proverbial Copious Spare Time) could implement it as a compiler pass on the Core Erlang level, I would applaud them. I might even be able to dig up the student project source code from my archives if that would be of use. /Richard From peter@REDACTED Tue Jul 31 23:48:47 2007 From: peter@REDACTED (Peter K Chan) Date: Tue, 31 Jul 2007 23:48:47 +0200 Subject: [erlang-questions] Stand Alone Erlang Still Updated? References: <46A6F881.5070208@pmp.com.au><36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com><36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com><46AE9057.0@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9EC@MAILSERV.hcrest.com> Message-ID: I understand how a fully packaged executable could be difficult to do hot code replacement and updates. It may be an issue of deployment scenario. If I am deploying on the server, I value hot code replacement, but if I am deploying on client side, I value compactness. I personally think that for a client side deployment with no need to do hot code replacement or package updates, something like the RubyScript2Exe would be perfect (for me, anyway). Peter (Note: originally message was mistakenly sent only to Chris. I included the list in this message). -----Original Message----- From: Chris Curtis [mailto:Chris.Curtis@REDACTED] Sent: Tuesday, July 31, 2007 8:22 AM To: Peter K Chan; erlang-questions@REDACTED Subject: RE: [erlang-questions] Stand Alone Erlang Still Updated? Peter Chan wrote: > I would put my vote in a native executable too. CEAN is very nice for > managing all the dependencies, but when deployed to the target system, > it is still a big pile of directories. > I took the earlier suggestion and looked at Wings3D, and I really like > how minimal and straightforward the Wings3D distribution is. CEAN is > great for package management, but the myriad files are still confusing > me, who is a novice. > Looking at it, SAE would seems to be the ideal deployment form. It would > be nice to see SAE updated for current Erlang, or somehow be able to > compile a CEAN to a SAE (with only a .exe, a few .dll, and a .zip). Yep, that's pretty much what I'm hoping for. A comparable model (sort of) comes from the Ruby world... Ruby Gems are kind of like CEAN, and there's a tool RubyScript2Exe that can generate the executable and associated support files. [I haven't personally used this, just know it exists.] Another, slightly-different model is from the Lisp world, where (for example) SBCL has (sb-ext:save-lisp-and-die ... :executable t ...) that saves things as they are. OTOH, dealing with updates and hot code replacement may be a much larger problem without a "pile of directories and BEAM files". I also need to go back and look at the Wings3D code... it's been a while since I poked at it. The end goal, as I see it, is the ability to produce a complete installable application that can be dealt with by a normal consumer-type end-user. --chris From jim.mccoy@REDACTED Tue Jul 31 23:35:40 2007 From: jim.mccoy@REDACTED (Jim McCoy) Date: Tue, 31 Jul 2007 14:35:40 -0700 Subject: [erlang-questions] Stand Alone Erlang Still Updated? In-Reply-To: <36E4692623C5974BA6661C0B18EE8EDF7FF9EC@MAILSERV.hcrest.com> References: <46A6F881.5070208@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9DF@MAILSERV.hcrest.com> <36E4692623C5974BA6661C0B18EE8EDF7FF9E6@MAILSERV.hcrest.com> <46AE9057.0@pmp.com.au> <36E4692623C5974BA6661C0B18EE8EDF7FF9EC@MAILSERV.hcrest.com> Message-ID: I am not familiar with RubyScript2exe but more with its progenitor py2exe, and there are a variety of options and ideas that could be mined from the various scripting language "compilers." One interesting bit that py2exe enables is a variety of options regarding how to handle the archive file itself; python imports are pulled out of the zip archive, but DLLs can be provided as individual files that are distributed with the collection of file or can be loaded directly out of the zip file, and the entire zip file can also be appended to the exe file so that you are truly distributing a single file. >From an erlang perspective you would need to be able to import/load the beam files out of the zip file, the rest of the magic is just knowing the platform-specific calls to make to deal with library loading. There is nothing that I can think of which would prevent you from adding additional chunks of data to the file at a later point to deal with updating and hot-swapping of code. Getting this feature available to Erlang developers has some pretty nice long-term benefits: until an Erlang app can be easily distributed to end users it will not have many people working on tasks outside of the standard "server room" applications, and until someone has an itch to scratch there is a lot less effort going into things like improving os-specific features and libraries... Jim