From mickael.remond@REDACTED Thu Aug 1 15:42:08 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 1 Aug 2002 15:42:08 +0200 Subject: Gag ? Erlang as /dev/null Accelerator ? Message-ID: <1028209328.3d493ab01da0f@webmail.spamcop.net> Strange whitepaper for the /dev/null accelerator product,isn't it ? http://www.fistfullofunix.com/dev/null/white.html -- Micka?l R?mond From bjorn@REDACTED Thu Aug 1 17:44:07 2002 From: bjorn@REDACTED (=?ISO-8859-15?Q?Bj=F6rn_Bylander?=) Date: Thu, 01 Aug 2002 17:44:07 +0200 Subject: Search function of the Erlang-questions Mailing List Archive Message-ID: <3D495747.5010008@loxysoft.se> Hello, Who is the maintainer of the search function of the Erlang-questions Mailing List Archive (http://www.erlang.org/cgi-bin/marc-search.cgi?ml-archive%2Ferlang-questions)? That page contains a HTML error which makes Mozilla display it in a way that the author probably did not intend. See http://bugzilla.mozilla.org/show_bug.cgi?id=160507 and http://bugzilla.mozilla.org/show_bug.cgi?id=2749 for a more detailed description of the error. A while ago, when I first discovered this I sent an e-mail to eee@REDACTED and possible friedman@REDACTED but received no reply. -- Bj?rn Bylander From kent@REDACTED Thu Aug 1 18:44:08 2002 From: kent@REDACTED (Kent Boortz) Date: 01 Aug 2002 18:44:08 +0200 Subject: Search function of the Erlang-questions Mailing List Archive In-Reply-To: <3D495747.5010008@loxysoft.se> References: <3D495747.5010008@loxysoft.se> Message-ID: =?ISO-8859-15?Q?Bj=F6rn_Bylander?= writes: > Who is the maintainer of the search function of the Erlang-questions > Mailing List Archive > (http://www.erlang.org/cgi-bin/marc-search.cgi?ml-archive%2Ferlang-questions)? > That page contains a HTML error which makes Mozilla display it in a > way that the author probably did not intend. See > http://bugzilla.mozilla.org/show_bug.cgi?id=160507 and > http://bugzilla.mozilla.org/show_bug.cgi?id=2749 for a more detailed > description of the error. I corrected this. The HTML generated from the verion of marc-search we use is very bad, let me know if there are other problems, kent From cyberlync@REDACTED Thu Aug 1 21:34:58 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 1 Aug 2002 12:34:58 -0700 (PDT) Subject: Erlang Grammer In-Reply-To: Message-ID: <20020801193458.69702.qmail@web40207.mail.yahoo.com> Hello All, Does anyone know if there is an update Erlang grammer available? I have been able to find one dated 1999 as an appendix to the spec located at the URL below. http://www.bluetail.com/~rv/Erlang-spec/index.shtml Is this Spec/Grammer still good? Has it been replaced? If so where is the new version? Thanks for your help, Eric __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From bjorn.bylander@REDACTED Thu Aug 1 22:38:11 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Thu, 01 Aug 2002 22:38:11 +0200 Subject: "Registering" an application Message-ID: <3D499C33.6060206@telia.com> Hello, I've created an application, foo, with a supervisor, gen_server etc according to the design principles. I've also created a directory structure for the application: f:\code\foo\ebin f:\code\foo\src f:\code\foo\include f:\code\foo\priv I've put all of the erl files in the src directory and an foo.app file in ebin. How do I "register" my app with the erlang system so that I, while developing, can start it with "application:start(foo)"? Right now, all I get is "{error,{"no such file or directory","foo.app"}}". TIA, Bj?rn From per@REDACTED Thu Aug 1 23:47:53 2002 From: per@REDACTED (Per Bergqvist) Date: Thu, 01 Aug 2002 22:47:53 +0100 Subject: Plan and preparation for R8B-2 In-Reply-To: Message-ID: <200208012047.g71Klb912369@hunden.levonline.com> Hi, attached is a small patch for elib_malloc.c. Also the file lib/hipe/rtl/hipe_literals.hrl should not be included in the distribution since it is generated. Regards Per > > Sorry that the R8B-2 is taking such a long time. Now it close to what > is to be released. There are some version number changes and some minor > Windows build issues left. A new snapshot can be found at > > http://www.erlang.org/otp_src_R8B_2002-07-31.tar.gz > > Some of the changes since the last snapshot are > > Updated applications, ic-4.1.3, orber-3.2.13 and cosNotification-1.0.6 > > Corrected to the fun handling in the erlang shell > > HPUX build configure changes > > Kernel poll support (--enable-kernel-poll configure flag) > > kent > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: otp_src_R8B_2002-07-31.patch Type: application/octet-stream Size: 1124 bytes Desc: not available URL: From lennart.ohman@REDACTED Thu Aug 1 22:56:22 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Thu, 01 Aug 2002 22:56:22 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> Message-ID: <3D49A076.E8CE1454@st.se> Hi Bj?rn, first, the general idea is that the application directory shall be name-version. E.g foo-1.0. The version may actually be any string acceptable to the file system. As you correctly found out, a correct .app file must exist for the application controller to understand what to do when you try application:start/1. But the application controller uses the code-path, kept by the code-server to locate .app files (and the code-server will then also use the code-path to load the modules). See the man-page for the code module, especially code:patha. You do not have to register the application in any specific way, other than that you can build releases pointing out certain versions of certain applications. You can then build boot-scripts starting that particular release. /Lennart Bj?rn Bylander wrote: > > Hello, > > I've created an application, foo, with a supervisor, gen_server etc > according to the design principles. I've also created a directory > structure for the application: > f:\code\foo\ebin > f:\code\foo\src > f:\code\foo\include > f:\code\foo\priv > I've put all of the erl files in the src directory and an foo.app file > in ebin. > > How do I "register" my app with the erlang system so that I, while > developing, can start it with "application:start(foo)"? > Right now, all I get is "{error,{"no such file or directory","foo.app"}}". > > TIA, > Bj?rn -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From per@REDACTED Fri Aug 2 00:11:23 2002 From: per@REDACTED (Per Bergqvist) Date: Thu, 01 Aug 2002 23:11:23 +0100 Subject: Plan and preparation for R8B-2 In-Reply-To: <200208012047.g71Klb912369@hunden.levonline.com> Message-ID: <200208012111.g71LB7927969@hunden.levonline.com> > Also the file lib/hipe/rtl/hipe_literals.hrl should not be included > in the distribution since it is generated. Great, you fixed it even before I complained ... :-) This is not a problem, a broken build caused by a full filesystem got me on the wrong track. /Per From bjorn.bylander@REDACTED Thu Aug 1 23:15:47 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Thu, 01 Aug 2002 23:15:47 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> Message-ID: <3D49A503.9000406@telia.com> Hi, Lennart ?hman wrote: > Hi Bj?rn, > > first, the general idea is that the application directory shall be name-version. > E.g foo-1.0. The version may actually be any string acceptable to the file > system. > > As you correctly found out, a correct .app file must exist for the application > controller to understand what to do when you try application:start/1. > But the application controller uses the code-path, kept by the code-server to > locate .app files (and the code-server will then also use the code-path to load > the modules). > > See the man-page for the code module, especially code:patha. I couldn't find code:patha, I did find code:add_patha however. I assume that's what you meant. Which path should I add? "f:/code/foo" or "f:/code"? I've tried both to no avail. Do I need to compile the erl-file to beam first? On a related note (as in the "trying to figure out what wrong" note), is there any way I can trace the calls made when evaluating application:start? I've tried to trace the shell process through the graphical Process Manager but the part where it actually tries to find my app file is not displayed. I guess I could use some Win32 utility to trace the system calls, but an Erlang way would be nicer... > > > /Lennart > > /Bj?rn From per@REDACTED Fri Aug 2 00:20:51 2002 From: per@REDACTED (Per Bergqvist) Date: Thu, 01 Aug 2002 23:20:51 +0100 Subject: "Registering" an application In-Reply-To: <3D49A076.E8CE1454@st.se> Message-ID: <200208012120.g71LKY901939@hunden.levonline.com> > first, the general idea is that the application directory shall be name-version. > E.g foo-1.0. The version may actually be any string acceptable to the file > system. Well, it depends on where in the development cycle you are. I always keep my revision controlled development source in a appname only directory and let make install generate a target with appname-version by consulting the file appname/vsn.mk. This is the common way to do it (for otp as well). /Per From kent@REDACTED Thu Aug 1 23:29:51 2002 From: kent@REDACTED (Kent Boortz) Date: 01 Aug 2002 23:29:51 +0200 Subject: Plan and preparation for R8B-2 In-Reply-To: <200208012047.g71Klb912369@hunden.levonline.com> References: <200208012047.g71Klb912369@hunden.levonline.com> Message-ID: Per Bergqvist writes: > attached is a small patch for elib_malloc.c. Thanks! > Also the file lib/hipe/rtl/hipe_literals.hrl should not be included > in the distribution since it is generated. It is not in "otp_src_R8B_2002-07-31.tar.gz", what do you mean? kent From kent@REDACTED Thu Aug 1 23:38:22 2002 From: kent@REDACTED (Kent Boortz) Date: 01 Aug 2002 23:38:22 +0200 Subject: Erlang Grammer In-Reply-To: <20020801193458.69702.qmail@web40207.mail.yahoo.com> References: <20020801193458.69702.qmail@web40207.mail.yahoo.com> Message-ID: Eric Merritt writes: > Does anyone know if there is an update Erlang grammer > available? I have been able to find one dated 1999 as > an appendix to the spec located at the URL below. > > http://www.bluetail.com/~rv/Erlang-spec/index.shtml > > Is this Spec/Grammer still good? Has it been replaced? > If so where is the new version? Maybe not as easy to read as the the grammar in the specification but you can always look at the grammar in use in the source distribution of Erlang/OTP. The latest P9 snapshot http://www.erlang.org/download/snapshots/otp_src_P9_2002-07-31.tar.gz contains the grammar definition in the file otp_src_P9_2002-07-31/lib/stdlib/src/erl_parse.yrl kent From francesco@REDACTED Thu Aug 1 23:41:21 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 01 Aug 2002 22:41:21 +0100 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> <3D49A503.9000406@telia.com> Message-ID: <3D49AB01.9020008@erlang-consulting.com> > I couldn't find code:patha, I did find code:add_patha however. I > assume that's what you meant. > Which path should I add? "f:/code/foo" or "f:/code"? > I've tried both to no avail. > Do I need to compile the erl-file to beam first? A. You need to compile your files and generate beam files. B. You need to add the paths to the directories where you have stored your *.beam and your *.app files, namely the ebin directory. > On a related note (as in the "trying to figure out what wrong" note), > is there any way I can trace the calls made when evaluating > application:start? Excellent trace capabilities were added with the OTP R7 release. You can read more about them in the dbg module at http://www.erlang.org/doc/r8b/doc/index.html It is based on functionality implemented in the trace BIF (Which you can read about in the erlang module man page). If you are not faint of heart, you could also look at match specifications, but I would not recommend it. > I've tried to trace the shell process through the graphical Process > Manager but the part where it actually tries to find my app file is > not displayed. I guess I could use some Win32 utility to trace the > system calls, but an Erlang way would be nicer... Unfortunately, the ability to trace modules has not been integrated in full in pman. There is much more available through the text based debugger. Regards, Francesco -- http://www.erlang-consulting.com From lennart.ohman@REDACTED Thu Aug 1 23:39:09 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Thu, 01 Aug 2002 23:39:09 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> <3D49A503.9000406@telia.com> Message-ID: <3D49AA7D.D5375B06@st.se> Bj?rn Bylander wrote: > > Hi, > > Lennart ?hman wrote: > > Hi Bj?rn, > > > > first, the general idea is that the application directory shall be name-version. > > E.g foo-1.0. The version may actually be any string acceptable to the file > > system. > > > > As you correctly found out, a correct .app file must exist for the application > > controller to understand what to do when you try application:start/1. > > But the application controller uses the code-path, kept by the code-server to > > locate .app files (and the code-server will then also use the code-path to load > > the modules). > > > > See the man-page for the code module, especially code:patha. > I couldn't find code:patha, I did find code:add_patha however. I assume > that's what you meant. Sorry, yes of course, add_patha adds a code path to the beginning, in contrast to add_pathz. > Which path should I add? "f:/code/foo" or "f:/code"? It is the full path to the ebin directory (or directories if you wish to try more than one application). > I've tried both to no avail. > Do I need to compile the erl-file to beam first? Yes, you must compile your source code. And as Per Bergqvist mentions there are more sofisticated ways to work when developing larger systems. But to just try it out, start a shell, use the shell command cwd/1 to "go" to your source directory. Use the c/1 shell command to compile each file. You can also use make:all/0 but be aware of that this will not load modules (can easily fool you when editing, compiling, trying and then editing, compiling, trying again). Either move the .beam files to the ebin directory, but why not move the .app file "here" instead and do code:add_path/1 to the src directory instead. Or you can simply "remain" in the src directory since "." is included in the code-path. > > On a related note (as in the "trying to figure out what wrong" note), is > there any way I can trace the calls made when evaluating application:start? > I've tried to trace the shell process through the graphical Process > Manager but the part where it actually tries to find my app file is not > displayed. I guess I could use some Win32 utility to trace the system > calls, but an Erlang way would be nicer... Just checking, you have a module of behaviour application (containing a start and a stop function, pointed out by the .app file)? You need to use pman on the application controller and turn on (I do not remember which button) trace all spawned processes too. The application controller will spawn one (or was it two?) processes between itself and the top-most supervisor of your application. /Lennart ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From bjorn.bylander@REDACTED Thu Aug 1 23:52:01 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Thu, 01 Aug 2002 23:52:01 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> <3D49A503.9000406@telia.com> <3D49AA7D.D5375B06@st.se> Message-ID: <3D49AD81.8060104@telia.com> Lennart ?hman wrote: >>On a related note (as in the "trying to figure out what wrong" note), is >>there any way I can trace the calls made when evaluating application:start? >>I've tried to trace the shell process through the graphical Process >>Manager but the part where it actually tries to find my app file is not >>displayed. I guess I could use some Win32 utility to trace the system >>calls, but an Erlang way would be nicer... > > > Just checking, you have a module of behaviour application (containing a start > and > a stop function, pointed out by the .app file)? Yes. > > You need to use pman on the application controller and turn on (I do not > remember > which button) trace all spawned processes too. The application controller will > spawn one (or was it two?) processes between itself and the top-most supervisor > of your application. I do get a fairly descriptive trace. I can see the call to application_controller but I don't see what application_controller does, where it tries to find the files etc. That said, I'm rather certain some of my problems will go away once I compile my files and set the path correctly. :-) > > /Lennart > > > > ------------------------------------------------------------- > Lennart Ohman phone : +46-8-587 623 27 > Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 > Sehlstedtsgatan 6 fax : +46-8-667 8230 > SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > /Bj?rn From cyberlync@REDACTED Fri Aug 2 00:18:21 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 1 Aug 2002 15:18:21 -0700 (PDT) Subject: Erlang Grammer In-Reply-To: Message-ID: <20020801221821.38537.qmail@web40204.mail.yahoo.com> Kent, Thanks, your right its not exactly and EBNF but it should work. If nothing else translating it to an ANTLR grammer will be interesting. Thanks, Eric --- Kent Boortz wrote: > > Eric Merritt writes: > > Does anyone know if there is an update Erlang > grammer > > available? I have been able to find one dated 1999 > as > > an appendix to the spec located at the URL below. > > > > > http://www.bluetail.com/~rv/Erlang-spec/index.shtml > > > > Is this Spec/Grammer still good? Has it been > replaced? > > If so where is the new version? > > Maybe not as easy to read as the the grammar in the > specification but > you can always look at the grammar in use in the > source distribution > of Erlang/OTP. The latest P9 snapshot > > > http://www.erlang.org/download/snapshots/otp_src_P9_2002-07-31.tar.gz > > contains the grammar definition in the file > > otp_src_P9_2002-07-31/lib/stdlib/src/erl_parse.yrl > > kent __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From erikp@REDACTED Fri Aug 2 01:28:56 2002 From: erikp@REDACTED (Erik Pearson) Date: Thu, 1 Aug 2002 16:28:56 -0700 Subject: Current status of P9 snapshot? Message-ID: <829D1ECB9047E945A91FCB1AFBA097B801E6@ctsmail1.celtech.com> I know it's not the *official* release just yet, but I figured I'd build the P9 snapshot on Sparc Solaris 8 just to see how things are going. This is from the P9_2002-07-31 snapshot. HiPE for UltraSparc errored out and stopped the build. I didn't know if this is known in the P9 build, but figured I'd pass the word along. gcc -g -O3 -I/export/home/erikp/tmp/erlang/otp_src_P9_2002-07-31/erts/sparc-sun-solaris 2.8 -DINSTRUMENT -DHAVE_CONFIG_H -Wall -DUSE_THREADS -D_REENTRANT -DPOSIX_THREADS -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -DHIPE_ARCHITECTURE=ultrasparc -Wa,-xarch=v8plusa -Ibeam -Isys/unix -Isparc-sun-solaris2.8 -Izlib -Ihipe -c hipe/hipe_debug.c -o /export/home/erikp/tmp/erlang/otp_src_P9_2002-07-31/erts/obj.instr.beam/spar c-sun-solaris2.8/hipe_debug.o hipe/hipe_debug.c: In function `hipe_print_pcb': hipe/hipe_debug.c:228: structure has no member named `dslot' hipe/hipe_debug.c:228: structure has no member named `dslot' The offending line is: U("dslot ", dslot); which gets expanded to a printf() call. After removing the line, things built fine. --erikp-- From happi@REDACTED Fri Aug 2 09:19:25 2002 From: happi@REDACTED (Happi) Date: Fri, 2 Aug 2002 09:19:25 +0200 Subject: Current status of P9 snapshot? References: <829D1ECB9047E945A91FCB1AFBA097B801E6@ctsmail1.celtech.com> Message-ID: <00b901c239f4$f001abc0$c90b0a0a@LISA> The P9 snapshots are used for propagating code changes between the two development teams (HiPE and OTP). In the latest snapshots the OTP team has just made some major changes in their part of the code and 'sent' them to us (HiPE) by releasing the snapshot. This snapshot does not work with HiPE, we are now working on the HiPE part to bring it up to date with the latest OTP changes, then we will release a snapshot with our changes to OTP. (One change is that a field (dslot) in the process control block has been removed, this is what you see below, this can be fixed by just removing the reference from the debug code...) The HiPE system will still not work because the garbage collector has been completely rewritten by OTP, this will take a little longer to fix in the HiPE system. /Erik ----- Original Message ----- From: "Erik Pearson" > I know it's not the *official* release just yet, but I figured I'd build > the P9 snapshot on Sparc Solaris 8 just to see how things are > going. This is from the P9_2002-07-31 snapshot. > > HiPE for UltraSparc errored out and stopped the build. > > I didn't know if this is known in the P9 build, but figured I'd > pass the word along. > > gcc -g -O3 > -I/export/home/erikp/tmp/erlang/otp_src_P9_2002-07-31/erts/sparc-sun-solar is > 2.8 -DINSTRUMENT -DHAVE_CONFIG_H -Wall -DUSE_THREADS -D_REENTRANT > -DPOSIX_THREADS -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS > -DHIPE_ARCHITECTURE=ultrasparc -Wa,-xarch=v8plusa -Ibeam -Isys/unix > -Isparc-sun-solaris2.8 -Izlib -Ihipe -c hipe/hipe_debug.c -o > /export/home/erikp/tmp/erlang/otp_src_P9_2002-07-31/erts/obj.instr.beam/spar > c-sun-solaris2.8/hipe_debug.o > hipe/hipe_debug.c: In function `hipe_print_pcb': > hipe/hipe_debug.c:228: structure has no member named `dslot' > hipe/hipe_debug.c:228: structure has no member named `dslot' > > The offending line is: > > U("dslot ", dslot); > > which gets expanded to a printf() call. After removing the line, things > built fine. > > --erikp-- > From bjorn.bylander@REDACTED Fri Aug 2 10:58:08 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Fri, 02 Aug 2002 10:58:08 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> <3D49A503.9000406@telia.com> <3D49AA7D.D5375B06@st.se> Message-ID: <3D4A49A0.2000202@telia.com> Lennart ?hman wrote: > > > Yes, you must compile your source code. And as Per Bergqvist mentions there are > more sofisticated ways to work when developing larger systems. But to just try > it > out, start a shell, use the shell command cwd/1 to "go" to your source > directory. > Use the c/1 shell command to compile each file. You can also use make:all/0 but > be aware of that this will not load modules (can easily fool you when editing, > compiling, trying and then editing, compiling, trying again). > Either move the .beam files to the ebin directory, but why not move the .app > file > "here" instead and do code:add_path/1 to the src directory instead. Or you can > simply > "remain" in the src directory since "." is included in the code-path. > Regarding make:all() not loading modules... wouldn't make:all([load]) solve that problem? /Bj?rn From lennart.ohman@REDACTED Fri Aug 2 11:19:59 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Fri, 02 Aug 2002 11:19:59 +0200 Subject: "Registering" an application References: <3D499C33.6060206@telia.com> <3D49A076.E8CE1454@st.se> <3D49A503.9000406@telia.com> <3D49AA7D.D5375B06@st.se> <3D4A49A0.2000202@telia.com> Message-ID: <3D4A4EBF.25A4F10C@st.se> Without consulting the manual, I believe so. /Lennart Bj?rn Bylander wrote: > > Lennart ?hman wrote: > > > > > > Yes, you must compile your source code. And as Per Bergqvist mentions there are > > more sofisticated ways to work when developing larger systems. But to just try > > it > > out, start a shell, use the shell command cwd/1 to "go" to your source > > directory. > > Use the c/1 shell command to compile each file. You can also use make:all/0 but > > be aware of that this will not load modules (can easily fool you when editing, > > compiling, trying and then editing, compiling, trying again). > > Either move the .beam files to the ebin directory, but why not move the .app > > file > > "here" instead and do code:add_path/1 to the src directory instead. Or you can > > simply > > "remain" in the src directory since "." is included in the code-path. > > > Regarding make:all() not loading modules... wouldn't make:all([load]) > solve that problem? > > /Bj?rn ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From luke@REDACTED Fri Aug 2 13:14:23 2002 From: luke@REDACTED (Luke Gorrie) Date: 02 Aug 2002 13:14:23 +0200 Subject: Erlang Grammer In-Reply-To: <20020801193458.69702.qmail@web40207.mail.yahoo.com> References: <20020801193458.69702.qmail@web40207.mail.yahoo.com> Message-ID: Eric Merritt writes: > Hello All, > > Does anyone know if there is an update Erlang grammer > available? I have been able to find one dated 1999 as > an appendix to the spec located at the URL below. > > http://www.bluetail.com/~rv/Erlang-spec/index.shtml > > Is this Spec/Grammer still good? Has it been replaced? > If so where is the new version? $OTP/lib/stdlib/src/erl_parse.yrl is the actual yecc grammar file, it's probably the definitive reference. Cheers, Luke From bjorn@REDACTED Fri Aug 2 14:28:14 2002 From: bjorn@REDACTED (=?ISO-8859-15?Q?Bj=F6rn_Bylander?=) Date: Fri, 02 Aug 2002 14:28:14 +0200 Subject: Misspellt atom in error_logger.erl Message-ID: <3D4A7ADE.9010803@loxysoft.se> Hello, From erl5.1.1/lib/kernel-2.7.2/src/error_logger.erl: %% Log all errors to File for all eternity logfile({open, File}) -> case lists:member(error_logger_file_h, gen_event:which_handlers(error_logger)) of true -> {error, allready_have_logfile}; _ -> gen_event:add_handler(error_logger, error_logger_file_h, File) end; Any chance of getting "allready_have_logfile" changed to "already_have_logfile" for the next release? :-) /Bj?rn From bjorn.bylander@REDACTED Fri Aug 2 15:05:46 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Fri, 02 Aug 2002 15:05:46 +0200 Subject: gen_server References: <001701c1d188$f488ad80$5864a8c0@softerra.int> <3C9B0E27.2020707@erlang-consulting.com> Message-ID: <3D4A83AA.4040605@telia.com> Hi, On 2002-03-22, Francesco Cesarini wrote: > Hi Yurii, > When your client makes a call to the server, it times out as your server > is busy listening to the socket in passive mode (It sounds like you > specified {active, false} and are retrieving your messages using recv). > The gen_server:call function has a default timeout of 5 seconds, after > which it crashes with the reason {timeout, {gen_server,....}} > > A solution to your problem is to have your socket run in active mode > specifying {active, true}. This will result in all the incoming packages > to be send to the server in the format {tcp, Socket, Data}. You would > have to handle them in your handle_info call back function. > > Another (and more common solution) is to have one process listen to the > socket, parse the messages, and forward them to the server which handles > the requests from the client. In this case, the server should be able to > handle many simultaneous clients. Is there any way to design a process using passive sockets so that it supports code replacement without using shortish timeouts to recv? The process would mostly spend time in a passive recv, much like you describe in the last paragraph. > > Hope this helps. > > Regards, > Francesco > -- > http://www.erlang-consulting.com > > Yurii A. Rashkovskii wrote: > >> Ladies and Gentlemen, >> >> I have a question concerning gen_server and related things. >> >> I have supervised gen_server running and usual process that listens >> socket, receives messages, parses them, pass to that gen_server and then >> returns replies back. Also I have another client application that sends >> messages to gen_server directly w/ gen_server:call, do not using that >> TCP wrapper. Then, if only of these clients is working with gen_server, >> all is ok. But if there both of these clients, behaviour significantly >> changes - for example, application that connects directly by >> gen_server:call fails w/ {'EXIT', { timeout, . >> >> What can be the problem of two (and probably more) clients working w/ >> gen_server simultaneously? >> >> I understand that question looks very indefinably, so I need any advices >> :-) >> >> Thank you in advance. >> /Bj?rn From bjorn.bylander@REDACTED Fri Aug 2 15:16:33 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Fri, 02 Aug 2002 15:16:33 +0200 Subject: gen_server References: <001701c1d188$f488ad80$5864a8c0@softerra.int> <3C9B0E27.2020707@erlang-consulting.com> <3D4A83AA.4040605@telia.com> Message-ID: <3D4A8631.5050407@telia.com> Bj?rn Bylander wrote: > > Is there any way to design a process using passive sockets so that it > supports code replacement without using shortish timeouts to recv? > The process would mostly spend time in a passive recv, much like you > describe in the last paragraph. > Never mind, I found the thread "gen_server, gen_tcp question". > > /Bj?rn > > From Sean.Hinde@REDACTED Fri Aug 2 15:29:56 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 2 Aug 2002 14:29:56 +0100 Subject: gen_server Message-ID: <04D356A3B172D611981B0008C791C3126BF218@imp02mbx.t-mobile.co.uk> > > Is there any way to design a process using passive sockets > so that it > > supports code replacement without using shortish timeouts to recv? > > The process would mostly spend time in a passive recv, much > like you > > describe in the last paragraph. > > > Never mind, I found the thread "gen_server, gen_tcp question". Without re-reading that thread, there is a very neat mechanism for this where a socket can be set to mode {active, once}. The next packet will be sent to the process sitting in it's normal receive loop but no more will be sent until inet:setops(S, [{active, once}]) is set again. This provides the control aspect of gen_tcp:recv without the need to block. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From bjorn@REDACTED Fri Aug 2 16:04:36 2002 From: bjorn@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Fri, 02 Aug 2002 16:04:36 +0200 Subject: gen_server References: <04D356A3B172D611981B0008C791C3126BF218@imp02mbx.t-mobile.co.uk> Message-ID: <3D4A9174.4070301@loxysoft.se> Sean Hinde wrote: > >>>Is there any way to design a process using passive sockets >> >>so that it >> >>>supports code replacement without using shortish timeouts to recv? >>>The process would mostly spend time in a passive recv, much >> >>like you >> >>>describe in the last paragraph. >>> >> >>Never mind, I found the thread "gen_server, gen_tcp question". > > > Without re-reading that thread, there is a very neat mechanism for this > where a socket can be set to mode {active, once}. The next packet will be > sent to the process sitting in it's normal receive loop but no more will be > sent until inet:setops(S, [{active, once}]) is set again. This provides the > control aspect of gen_tcp:recv without the need to block. Oh, that would be a recent addition then? The active option to setopts is documented as only Boolean even in the online documentation. Really nice anyway, I'll try it out. > > Sean > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have received > this email in error please notify the sender immediately and delete this > email from your system without copying or disseminating it or placing any > reliance upon its contents. We cannot accept liability for any breaches of > confidence arising through use of email. Any opinions expressed in this > email (including attachments) are those of the author and do not necessarily > reflect our opinions. We will not accept responsibility for any commitments > made by our employees outside the scope of our business. We do not warrant > the accuracy or completeness of such information. /Bj?rn From igouy@REDACTED Fri Aug 2 22:08:09 2002 From: igouy@REDACTED (isaac gouy) Date: Fri, 2 Aug 2002 13:08:09 -0700 (PDT) Subject: eof not handled in Windows files? Message-ID: <20020802200810.72268.qmail@web20503.mail.yahoo.com> It seems that several people have had problems redirecting files to stdio using the Windows Console. In this program, eof never seems to match in the receive loop but [] will match? I've tried creating the file with notepad (which doesn't use an eof char) and edlin which does insert an eof char. The eof char inserted by edlin doesn't match with eof. %% erl -noinput -s pipe start < data.txt -module(pipe). -compile(export_all). start() -> spawn(pipe,init,[]). init() -> Port = open_port({fd, 0, 1},[eof]), loop(Port). loop(Port) -> receive {Port, eof} -> %% never matches ! io:format("~n~s ~n", ["Matched eof"]), halt(); {Port, {data, []}} -> io:format("~n~s ~n", ["Matched []"]), halt(); {Port, {data, What}} -> Port ! {self(), {command, What}}, loop(Port) end. Any suggestions on how to get eof to work? cheers Isaac __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From bjorn.bylander@REDACTED Sat Aug 3 13:23:04 2002 From: bjorn.bylander@REDACTED (=?ISO-8859-1?Q?Bj=F6rn_Bylander?=) Date: Sat, 03 Aug 2002 13:23:04 +0200 Subject: Bad error: flame the responsible from appmon. Message-ID: <3D4BBD18.6080901@telia.com> Hi, I've encountered a few of these: Bad error: flame the responsible {'EXIT', {badarg, [{appmon_info,format,1}, {appmon_info,calc_app_tree,5}, {appmon_info,do_work,2}, {appmon_info,handle_info,2}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}} recently. It looks like they are triggered in some way when I close down one side of a TCP connection that my Erlang app is connected to. Should I care? Is it a common error in AppMon? I'm using Erlang OTP R8B under Windows 2000. /Bj?rn From fritchie@REDACTED Sun Aug 4 07:44:45 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 04 Aug 2002 00:44:45 -0500 Subject: Asynchronous thread pool, scheduling Message-ID: <200208040544.g745ija10046@snookles.snookles.com> I've been bitten by a problem with how threads in the asynchronous thread pool are scheduled. I've got a suggestion for how they ought to be scheduled, how not to use them, and some corrections for the "driver_entry" page in the ERTS Reference Manual. The root of the scheduling problem, IMO, is that each thread has its own work queue, instead of a single shared queue. A work item is scheduled along with a scheduling "key". The value of that key modulo the number of work threads determines which thread will execute that item, and the item is added to that thread's work queue. If there is no key specified, the thread is chosen "round robin", and the item is added to that thread's work queue. The net effect of this round robin thread scheduling is that the chosen thread may be busy doing something else, whereas there may be other threads sitting idle. If I cared about which thread executed my work item, I would specify a key. But if I don't care, I'd like to be able to use "the first available thread".(*) I'm playing with a driver with async work threads that block for 30 seconds or more. It's disconcerting to have such a thread block, then try running "debugger:start()" and have it fail (timeout) because a "efile_drv" driver's work item is blocked because it's assigned to the same thread that is working on the long-blocking item.(**) (***) Perhaps a better answer is to have two thread pools: one for use by items with a key specified, and another for "first available thread" scheduling? Or perhaps the answer is that driver writers will simply need to manage their own private work threads in more situations? The end of the ERTS Reference Manual (version 5.1.1) "erl_driver" doc has some incorrect information in its description of driver_async(). "A specific instance of the driver always uses the same thread," is incorrect. It correctly describes how the "efile_drv" is currently implmented, but it is not generally true. The value of driver_async()'s "key" argument determines whether or not a subsequent work item may be executed by the same thread. Any better ideas? -Scott (*) If I _really_ cared about what thread executed my work item, my driver would maintain its own private thread(s). However, it would be nice to see the existing shared thread pool be as useful as possible so that driver writers are forced to use their own private thread(s) only when they have really weird threading constraints. (**) An answer to this problem is the same as the answer to the question "Doctor, it hurts when I do _this_": don't block for "long" periods of time. Unfortunately, it's difficult to get consensus on what "long" means for all situations. There is incentive to avoiding long-blocking threads: since you can't simply kill a thread (on most platforms), you have to wait for it to unblock before it can be told that it must shut itself down. {sigh} And managing the resource problems that can cause (whether in other threads or in other OS processes) can cause headaches and loss of sleep. :-) (***) FreeBSD 4.5 behaves even more badly than Linux does in this situation. The main thread gets blocked somehow: the process that deals with the tty freezes. Typed characters don't get echoed until the work thread finishes, including Control-g. This doesn't make much sense, given how the async work thread stuff is supposed to work. I haven't found the root problem yet.... From igouy@REDACTED Mon Aug 5 02:34:55 2002 From: igouy@REDACTED (isaac gouy) Date: Sun, 4 Aug 2002 17:34:55 -0700 (PDT) Subject: port setting for fixed size message? Message-ID: <20020805003455.72719.qmail@web20513.mail.yahoo.com> Is there a Port setting that will make the Port send data in arbitrary fixed size blocks? For instance, get 100 bytes of data at a time? thanks, Isaac __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From Chandrashekhar.Mullaparthi@REDACTED Mon Aug 5 02:50:06 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 5 Aug 2002 01:50:06 +0100 Subject: Compiler crash Message-ID: <04D356A3B172D611981B0008C791C31240499B@imp02mbx.t-mobile.co.uk> test({type=interim}=DelRep, State) -> State; The compiler with R7B, R8B, R8B-1 crashes when compiling a illegal clause like the above. /export/home/chandru/temp/esas/src/esas_reply_handler.erl:none: internal error in v3_core; crash reason: {{case_clause,{'EXIT',{function_clause, [{v3_core, pat_alias, [{c_atom,[],type}, {c_atom,[],interim}]}, {lists,map,2}, {v3_core,pattern,1}, {lists,map,2}, {v3_core,clause,2}, {lists,mapfoldl,3}, {v3_core,body,3}, {v3_core,function,1}| more]}}}, [{compile,'-select_passes/2-fun-2-',2}, {compile,'-internal_comp/4-fun-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} The correct version of the function is: test(#delivery_report{type=interim}=DelRep, State) -> State; Is this a known bug? cheers Chandru NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From matthias@REDACTED Mon Aug 5 13:57:02 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 5 Aug 2002 13:57:02 +0200 Subject: 'compressed' flag in file:open/2 Message-ID: <15694.26638.59832.966091@antilipe.corelatus.se> Hi, A month or two ago, there was some discussion about using the 'compressed' flag in file:open to access gzip-compressed files. http://www.erlang.org/ml-archive/erlang-questions/200206/msg00115.html I just had a bit of a play with this, and I can see a possible reason for why it isn't documented. In R8B-1 on linux: 1> {ok, F} = file:open("blaha.gz", [compressed]). {ok,<0.39.0>} 2> file:position(F, 1000). this hangs the emulator (100% CPU, ^G doesn't work, ^C twice kills the emulator). 'blaha.gz' is much shorter than 1000 bytes, compressed or not. I haven't investigated why beyond checking that zlib.h supports seeking forwards and backwards (it does). The 'ram' flag discussed in the same thread also isn't documented. BTW, lovely ASCII art diagrams in file.erl, whoever drew them! Matthias From roberto.portugal@REDACTED Mon Aug 5 19:14:53 2002 From: roberto.portugal@REDACTED (Roberto Portugal (CEC)) Date: Mon, 5 Aug 2002 12:14:53 -0500 Subject: java corba error Message-ID: <9777764CE9E3D311A97600508B63B91603E73239@eamsant700.cec.ericsson.se> Hi, I built a java program to get data from mnesia erlang database. I can get this information: ------------------------------------------------ Mnesia is_running? true backup_module: mnesia_backup Directory: /opt/ANx/Site-data/db/Mnesia.anx_cp@REDACTED Dump Log time time threshold 300000 ms. Local_tables orber_CosNaming Num Local_tables 52 mnesia tables: orber_CosNaming - orber_objkeys - ir_ORB - ir_InterfaceDef - ir_OperationDef - i r_AttributeDef - ir_ExceptionDef - ir_ArrayDef - ir_SequenceDef - ir_StringDef - ir_PrimitiveDef - ir_AliasDef - ir_EnumDef - ir_UnionDef - ir_StructDef - ir_Ty pedefDef - ir_ConstantDef - ir_ModuleDef - ir_Repository - ir_IDLType - ir_Conta iner - ir_Contained - ir_IRObject - me_service - me_adsl_perf_log_db - subrack - vartable - rcPhPoints - network_element - pvc - adsl_nt_board - atm_perf_cellmu x - cellbus_bw - atm_perf_et - adsl - treattable - me_td_db - board - adsl_conf_ prof - slot - rcInterfaces - rcTop - sr_nb - adsl_pm_prof - schema - audit_table - adsl_nt_line - logtable - system_node - dbh_NameTable - dbh_VersionTable - subscribers ------------------------------------------------ However when I try to get information on some particular table, the following error appear: Error: reason.value: {undef,{subrack,tc,[]}} This is the sentence used to get data from "subrack" table: if(mnesia.Status.ok == mcsRef.dirty_match_all("subrack", result, reason)) After a trace on server code, error is generated on "mnesia_session_impl" file, exactly on: %% Corba records remapping! remap_anytype([]) -> []; remap_anytype([L |Lrest]) -> RecName = element(1, L), Type = RecName:tc(), [Here...] [#any{typecode = Type, value = Obj} || Obj <- [L |Lrest]]. any suggestion are welcome. Thanks Best regards, Roberto Roberto Portugal System Integrator Regional Competence Center Ericsson Chile, S.A. Av. Vitacura 2808, Las Condes, Santiago, Chile Telf.: +56 2 372 53 95 Fax: +56 2 372 50 57 E-mail: roberto.portugal@REDACTED http://www.ericsson.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Niclas.Eklund@REDACTED Tue Aug 6 09:44:22 2002 From: Niclas.Eklund@REDACTED (Niclas Eklund) Date: Tue, 6 Aug 2002 09:44:22 +0200 (MEST) Subject: java corba error In-Reply-To: <9777764CE9E3D311A97600508B63B91603E73239@eamsant700.cec.ericsson.se> Message-ID: Hello! When compiling your IDL-file (using IC), modules are generated for some datatypes (e.g. struct). The modules exports the following functions: * tc/0 - returns the type code. * id/0 - returns the IFR identity. * name/0 - returns the scoped name. The error message {undef,{subrack,tc,[]}} indicates that subrack.beam doesn't exist (never compiled or not in the path). /Nick > Hi, > > I built a java program to get data from mnesia erlang database. I can get this information: > > However when I try to get information on some particular table, the following error appear: > > Error: reason.value: {undef,{subrack,tc,[]}} > > > This is the sentence used to get data from "subrack" table: > > if(mnesia.Status.ok == mcsRef.dirty_match_all("subrack", result, reason)) > > After a trace on server code, error is generated on "mnesia_session_impl" file, exactly on: > > %% Corba records remapping! > remap_anytype([]) -> []; > remap_anytype([L |Lrest]) -> > RecName = element(1, L), > Type = RecName:tc(), [Here...] > [#any{typecode = Type, value = Obj} || Obj <- [L |Lrest]]. > > any suggestion are welcome. Thanks > > Best regards, > > Roberto From kent@REDACTED Thu Aug 8 17:00:20 2002 From: kent@REDACTED (Kent Boortz) Date: 08 Aug 2002 17:00:20 +0200 Subject: The update R8B-2 is released Message-ID: Bug fix release : otp_src_R8B-2 Build from snapshot : 20020807 This is a bug fix release R8B-2. You can download the full source distribution or the patch that take R8B-1 up to R8B-2. http://www.erlang.org/download/otp_src_R8B-2.tar.gz http://www.erlang.org/download/otp_src_R8B-1to2.patch.gz The bug fixes and improvements in this release is described in the release notes http://www.erlang.org/download/otp_src_R8B-2.readme If you have access to the Ericsson intranet you can find the same files at http://erlang.ericsson.se/opensource/download/ Note that to unpack the TAR archive you need a GNU TAR compatible program. For example on MacOS X you need to use the 'gnutar' command, you can't use the 'tar' command or StuffIt to unpack the sources. To patch the previos release "otp_src_R8B-1" you use a patch program that understand the "unified" patch format and do % cd otp_src_R8B-X % gzip -dc /location/of/patch/file/otp_src_R8B-1to2.patch.gz | patch -p1 For installation instructions please read the README that is part of the distribution. There is no support for building a Windows version from source. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R8B-2.exe The documentation at http://www.erlang.org will be updated. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_html_R8B-2.tar.gz http://www.erlang.org/download/otp_man_R8B-2.tar.gz For some OTP applications there are more detailed release notes in the HTML documentation. We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team From ksivakumar@REDACTED Sat Aug 10 12:00:13 2002 From: ksivakumar@REDACTED (Sivakumar Krishnasamy) Date: Sat, 10 Aug 2002 15:30:13 +0530 Subject: ErLang newbie questions Message-ID: <000a01c24054$b8c0f880$fa01010a@calsoft.co.in> Hi All, I am sorry if all these questions are very basic. I am a newbie to ErLang. Please clarify my questions. 1) I want to use Port driver's callback function in a C Node. To call back this function I need to use port_command/3 BIF from ErLang Node. But I am able to find port_command/2 BIF only. What are arguments in port_command/3 BIF? 2) I have two ErLang nodes (For example) Node_A , Node_B. Both these nodes have C Node Interface. I have written a ErLang process which sends a message from ErLang process to C Interface program in Node_A, which is then echo'd back to ErLang process, which in turn send this message to ErLang process in Node_B. Message communication between these two nodes are normal. But when I disconnect a node (Node_B) and try sending a message to the Node_B from Node_A, it fails by giving proper error. But when the connection is retained back (to Node_B), Node_A sends the old messages, i.e the messages which were send to Node_B, when it was disconnected from Node_A. I think somekind of Message queuing is happening in Node_A. How to prevent this?. Is this queuing happening in Node_A's C Interface ?? (or) is it by ErLang process in Node_A?. 3) Why does open_port({spawn,command},[{packet,2},binary]) fails while open_port({spawn,command},[{packet,2}]) succeeds ?. Thanks in Advance. Regards, Sivakumar Krishnasamy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Mon Aug 12 13:31:16 2002 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Aug 2002 13:31:16 +0200 (MET DST) Subject: Changing Code In-Reply-To: Message-ID: The dynamic code update semantics of Erlang is a nice feature when you're in prototyping mode, but for production code, the fact that any inter-module ("remote") call can be redirected at any time to a new version of the called module is a big obstacle for the compiler when it comes to generating efficient code. To be able to maybe do something about this, we'd like to know more about how code update is actually being used (and handled) in real Erlang systems of today. Things we would like to hear about include: - Is it necessary to be able to exchange any single module? (E.g., if your application consists of a number of modules, do you always replace all these modules anyway?) - Could code migration be limited to specific functions, or is it necessary to be able to switch to a new version at all "remote" calls. (E.g., one could imagine a new declaration for specifying only certain functions as code update points.) - Do you always use the OTP release handler or similar to do code updates, or do you do it by hand, or with your own in-house tools, etc? Do you find it simple as it is today, or is code update so difficult that you try to avoid it? - How much of a problem are circular module dependencies in practice? - Is the flexibility of being able to change any module at any time (even in production code) worth more to you than the speed of the code? - When you make a (remote) call that is expected to switch to new code whenever it has been loaded, could you guarantee that the call stack is empty at that point, i.e., you will not return to the old code, nor to the code that called it? (If so, the code purging stage would not have to scan the stacks of processes to find out if they must be killed.) This pretty much equals saying that code change always starts a fresh process, but keeps the old Pid. - Anything else that you find important. Thanks, /Richard & the HiPE posse Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From Chandrashekhar.Mullaparthi@REDACTED Mon Aug 12 14:35:44 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 12 Aug 2002 13:35:44 +0100 Subject: Changing Code Message-ID: <04D356A3B172D611981B0008C791C3124049D8@imp02mbx.t-mobile.co.uk> Hi, We have a lot of code on production systems (too many to count fast). > - Is it necessary to be able to exchange any single module? Yes. > (E.g., if your application consists of a number of modules, > do you always replace all these modules anyway?) No. > - Could code migration be limited to specific functions, or > is it necessary to be able to switch to a new version at all > "remote" calls. (E.g., one could imagine a new declaration > for specifying only certain functions as code update points.) No. > - Do you always use the OTP release handler or similar to > do code updates, or do you do it by hand, or with your own > in-house tools, etc? Do you find it simple as it is today, > or is code update so difficult that you try to avoid it? Pretty much all our changes are done by hand. Reasons being, sometimes the complexity of the change and lack of time to understand the release handler fully and use it correctly. > - How much of a problem are circular module dependencies in > practice? We haven't encountered this problem in our applications. > - Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? To put a lot of emphasis - YES! Speed has never been a problem for us - we exceed the requirements put to us by a few orders of magnitude. This feature is invaluable. > - When you make a (remote) call that is expected to switch > to new code whenever it has been loaded, could you guarantee > that the call stack is empty at that point, i.e., you will > not return to the old code, nor to the code that called it? > (If so, the code purging stage would not have to scan the > stacks of processes to find out if they must be killed.) > This pretty much equals saying that code change always starts > a fresh process, but keeps the old Pid. NO. regards Chandru NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Sean.Hinde@REDACTED Mon Aug 12 14:31:33 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 12 Aug 2002 13:31:33 +0100 Subject: Changing Code Message-ID: <04D356A3B172D611981B0008C791C3126BF284@imp02mbx.t-mobile.co.uk> Hi, Some feedback from our systems used in an in house development model with separate support teams who manage the live systems. > - Is it necessary to be able to exchange any single module? > (E.g., if your application consists of a number of modules, > do you always replace all these modules anyway?) We use the ability to change a single module pretty regularly. We tend to put stuff which is kinda config but not really into a single module and issue a new version when something changes. We also update general library modules quite often. > > - Could code migration be limited to specific functions, or > is it necessary to be able to switch to a new version at all > "remote" calls. (E.g., one could imagine a new declaration > for specifying only certain functions as code update points.) I would never like to have to predict where something is likely to change. Neither bugs nor Marketing are friendly to such predictions! > > - Do you always use the OTP release handler or similar to > do code updates, or do you do it by hand, or with your own > in-house tools, etc? Do you find it simple as it is today, > or is code update so difficult that you try to avoid it? When we are just changing a few library modules we load them with code:load/1, otherwise we tend to have the node restarted - unless it is a big mnesia database where we can just do an application:stop/1 on the offending application, code:load/1 and then application:start/1. We do not use the .appup etc stuff from OTP at all - mainly because it is just a little too scary (from the point of view that you don't quite know what it is up to). > > - How much of a problem are circular module dependencies in > practice? We've not hit this one yet > - Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? Yes, I'd say do for us. Code change at that level is one of the killer feaures which makes Erlang so astonishing.. We are not currently CPU limited for any of our apps. The only times for us where profiling tends to throw out problems are when there is simply a lot of data to chug through 1 octet at a time - but these types of code tend to not call external modules that often, and will probably respond well to straight HIPE compiling (or a driver, or a fixed algorithm). How much speedup do you think would be achievable? > - When you make a (remote) call that is expected to switch > to new code whenever it has been loaded, could you guarantee > that the call stack is empty at that point, i.e., you will > not return to the old code, nor to the code that called it? > (If so, the code purging stage would not have to scan the > stacks of processes to find out if they must be killed.) > This pretty much equals saying that code change always starts > a fresh process, but keeps the old Pid. I really like the fact that Erlang doesn't have many gotchas. This sounds like it would very rarely happen but could be a right pain if it did. > - Anything else that you find important. 64 bit erlang :). Seriously, memory per node is our bottleneck at the moment, not CPU Regards, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From jamesh@REDACTED Mon Aug 12 18:24:01 2002 From: jamesh@REDACTED (James Hague) Date: Mon, 12 Aug 2002 11:24:01 -0500 Subject: Changing Code Message-ID: >- Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? For many simple, core modules, I don't need code updates at all. For example, Wings3D has vector and matrix modules. In practice, those rarely change. And since they're such fundamental modules, it would be nice to tag them somehow as "doesn't need to support code changing," if it resulted in a notable performance increase. From Sean.Hinde@REDACTED Mon Aug 12 19:18:37 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 12 Aug 2002 18:18:37 +0100 Subject: Changing Code Message-ID: <04D356A3B172D611981B0008C791C3126BF290@imp02mbx.t-mobile.co.uk> > >- Is the flexibility of being able to change any module at any > > time (even in production code) worth more to you than the > > speed of the code? > > For many simple, core modules, I don't need code updates at all. For > example, Wings3D has vector and matrix modules. In practice, > those rarely > change. And since they're such fundamental modules, it would > be nice to tag > them somehow as "doesn't need to support code changing," if > it resulted in a > notable performance increase. In these cases it could be possible to use the igor re-factoring tools as part of the build process to make a huge temporary single source file which can be compiled with full "in module" compiler optimisations. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From erikp@REDACTED Mon Aug 12 20:07:27 2002 From: erikp@REDACTED (Erik Pearson) Date: Mon, 12 Aug 2002 11:07:27 -0700 Subject: Changing Code Message-ID: <829D1ECB9047E945A91FCB1AFBA097B80211@ctsmail1.celtech.com> Don't some OOP languages support the concept of "sealed" classes and methods, and the compiler can use that information for optimization? (I'm trying to remember a few years back when I read something on Dylan, but that was some time ago). I think I agree with James Hague; it would be nice if modules could be tagged as such and the compiler could do whatever it wants using the information. --erikp-- From Sean.Hinde@REDACTED Tue Aug 13 00:29:57 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 12 Aug 2002 23:29:57 +0100 Subject: Changing Code Message-ID: <04D356A3B172D611981B0008C791C3126BF292@imp02mbx.t-mobile.co.uk> > Don't some OOP languages support the concept of "sealed" > classes and methods, and the compiler can use that information > for optimization? > > (I'm trying to remember a few years back when I read > something on Dylan, but that was some time ago). > > I think I agree with James Hague; it would be nice if modules > could be tagged as such and the compiler could do whatever > it wants using the information. This is quite an interesting angle, prompting more thought. We have never yet replaced "just one module" of any of the OTP libs. Partly because we have no wish to affect our support agreement, and actually also because we have only once ever had a need to.. So if there were a way to make the optimisations unidirectional - we could still replace our own stuff one module at a time but the OTP stuff was optionally "sealed" then that would be all for the good (so long as the speed benefits were still realised). Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From matthias@REDACTED Tue Aug 13 01:18:04 2002 From: matthias@REDACTED (Matthias Lang) Date: Tue, 13 Aug 2002 01:18:04 +0200 Subject: Changing Code In-Reply-To: References: Message-ID: <15704.16940.534522.276975@antilipe.corelatus.se> Hi, For what it's worth, our little SS7 box has a fair bit of Erlang in it and we have never used hot code loading to upgrade live systems. Richard Carlsson writes: > The dynamic code update semantics of Erlang is a nice feature when > you're in prototyping mode, but for production code, the fact that any The difference between production and prototyping isn't always clearcut. It may take a long time during testing to get a system to behave strangely (e.g. performance degradation after a week of load testing). It's nice to run that sort of testing on code intended for production, but convenient to then load in instrumented code without having to restart the system and wait another week for the problem to show. That goes double if the misbehaving system is in a customer's test lab. > - Is it necessary to be able to exchange any single module? > (E.g., if your application consists of a number of modules, > do you always replace all these modules anyway?) Doesn't replacing all but one module in a system with the same code as is currently running amount to the same behaviour from the user's point of view? I guess it requires more confidence in your CVS setup if those 'identical' files are recompiled. > - Could code migration be limited to specific functions, or > is it necessary to be able to switch to a new version at all > "remote" calls. (E.g., one could imagine a new declaration > for specifying only certain functions as code update points.) The most common code load for me is loading new code for a gen_server. I usually don't care exactly when the switch happens, as long as (a) it happens within a few seconds and (b) I know that it happened. > - Do you always use the OTP release handler or similar to > do code updates, or do you do it by hand, or with your own > in-house tools, etc? Do you find it simple as it is today, > or is code update so difficult that you try to avoid it? I do code update by hand. > - How much of a problem are circular module dependencies in > practice? Never bumped into this problem. > - Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? All the bottleneck code in our system is written in C, either as a device driver or a port program, so for that code the "speed is more important than hot code loading" decision has already been taken. In most of the remaining Erlang code, I'd be loathe to give up hot code loading. If there was a compiler switch for "faster standard libraries but no hot code loading for them", I'd enable it. Matthias From matthias@REDACTED Tue Aug 13 10:00:23 2002 From: matthias@REDACTED (Matthias Lang) Date: Tue, 13 Aug 2002 10:00:23 +0200 Subject: error_logger unexpected behaviour & a patch to fix it Message-ID: <15704.48279.414281.235802@antilipe.corelatus.se> Hi, If error_logger:tty(true) is called when tty logging is already enabled, the error logger repeats itself on the tty repeats itself on the tty. Example: 3> error_logger:tty(true). ok 4> error_logger:info_report("sometimes I can't trust my ears"). =INFO REPORT==== 13-Aug-2002::09:42:25 === sometimes I can't trust my ears =INFO REPORT==== 13-Aug-2002::09:42:25 === sometimes I can't trust my eyes This happens on R8B-1 and the source hasn't changed in R8B-2. Trivial patch attached. Matt -------------- next part -------------- A non-text attachment was scrubbed... Name: error_logger_patch Type: application/octet-stream Size: 286 bytes Desc: not available URL: From gerd@REDACTED Tue Aug 13 13:25:28 2002 From: gerd@REDACTED (Gerd Flaig) Date: Tue, 13 Aug 2002 13:25:28 +0200 Subject: Changing Code In-Reply-To: (Richard Carlsson's message of "Mon, 12 Aug 2002 13:31:16 +0200 (MET DST)") References: Message-ID: Richard Carlsson writes: > - Is it necessary to be able to exchange any single module? > (E.g., if your application consists of a number of modules, > do you always replace all these modules anyway?) I use this feature frequently while in development mode. Sometimes even on production nodes to hot-fix bugs. > - Could code migration be limited to specific functions, or > is it necessary to be able to switch to a new version at all > "remote" calls. (E.g., one could imagine a new declaration > for specifying only certain functions as code update points.) As I use generic behaviours almost exclusively, this has not been an issue anyway. > - Do you always use the OTP release handler or similar to > do code updates, or do you do it by hand, or with your own > in-house tools, etc? Do you find it simple as it is today, > or is code update so difficult that you try to avoid it? We wrap our releases in Debian packages. I would like to have tight integration between the OTP release handler and the Debian package system. Most of the time, though, we just shut down the node while upgrading. > - How much of a problem are circular module dependencies in > practice? Not much of a problem for me, yet. > - Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? The speed of the code has not been an issue until now. > - When you make a (remote) call that is expected to switch > to new code whenever it has been loaded, could you guarantee > that the call stack is empty at that point, i.e., you will > not return to the old code, nor to the code that called it? > (If so, the code purging stage would not have to scan the > stacks of processes to find out if they must be killed.) > This pretty much equals saying that code change always starts > a fresh process, but keeps the old Pid. I'm not sure. Would it be enough to only make qualified intra-module-calls when they're tail-calls? Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From vlad_dumitrescu@REDACTED Wed Aug 14 07:15:32 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Aug 2002 07:15:32 +0200 Subject: undocumented modules in OTP Message-ID: Hi all, I just noticed (better late than never!) that there are modules in the standard release (in stdlib!) that aren't documented. The example I have is the very useful property_lists.erl, but there might be others. Will they be documented? At the very least, I think their existence should be advertised... best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From vlad_dumitrescu@REDACTED Wed Aug 14 07:18:30 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Aug 2002 07:18:30 +0200 Subject: page templates Message-ID: Hi again, There were some discussions about Zope's template language and it's possible use with Erlang web servers. I plan to use it for EDoc, the documentation tool, and thus begun implementing a simple version. Is there anyone else working on this at the moment? It would be useful to share experience and/or work. best regards, Vlad _________________________________________________________________ Skicka snabbmeddelanden till dina v?nner online med MSN Messenger: http://messenger.msn.se From mrsanna@REDACTED Wed Aug 14 01:12:35 2002 From: mrsanna@REDACTED (Mauro) Date: 14 Aug 2002 01:12:35 +0200 Subject: an advice. Message-ID: <1029280355.731.2.camel@msan> Hallo. I am italian so sorry for my bad english. I need an advice. I am planning an intranet application for the personnel management of a company. I am a beginner programmer and I know nothing about a suitable tecnology or a language for the purpose. What about erlang with mnesia? Is it a suitable solution? There is anyone that want to collaborate in this plan? The purpose for me is to know more about some tecnologies and languages. Thank you. From richardc@REDACTED Wed Aug 14 10:56:27 2002 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Aug 2002 10:56:27 +0200 (MET DST) Subject: undocumented modules in OTP In-Reply-To: Message-ID: On Wed, 14 Aug 2002, Vlad Dumitrescu wrote: > I just noticed (better late than never!) that there are modules in > the standard release (in stdlib!) that aren't documented. The > example I have is the very useful property_lists.erl, but there > might be others. It was highly unofficial in R8. For R9, we have renamed it to the shorter "proplists", and done some small changes. > Will they be documented? At the very least, I think their existence > should be advertised... The idea was that for R9 it would at least be stable as far as naming and API is concerned. Documentation and so forth is up to the OTP people. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From bjorn@REDACTED Wed Aug 14 11:22:58 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Aug 2002 11:22:58 +0200 Subject: undocumented modules in OTP In-Reply-To: "Vlad Dumitrescu"'s message of "Wed, 14 Aug 2002 07:15:32 +0200" References: Message-ID: Other useful modules are erl_tar (a tar utility) and filelib (file utilities). We do plan to document them, but not necesserily for R9. /Bjorn "Vlad Dumitrescu" writes: > Hi all, > > I just noticed (better late than never!) that there are modules in the > standard release (in stdlib!) that aren't documented. The example I have is > the very useful property_lists.erl, but there might be others. > > Will they be documented? At the very least, I think their existence should > be advertised... > > best regards, > Vlad > > > > _________________________________________________________________ > MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto > du ocks?: http://www.hotmail.com > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From vlad_dumitrescu@REDACTED Wed Aug 14 11:43:35 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Aug 2002 11:43:35 +0200 Subject: undocumented modules in OTP Message-ID: >From: Bjorn Gustavsson > >Other useful modules are erl_tar (a tar utility) and filelib (file >utilities). >We do plan to document them, but not necesserily for R9. That's great! I think these new modules deserve at least to be mentioned somewhere. Browsing the release directories for new modules isn't very friendly :-) Speaking of documentation: when reading the Zope docs, I noticed the online version is a Wiki one, where people can add comments to (about) every paragraph. It looks like a good way to get input on documentation. What do you think? best regards, Vlad _________________________________________________________________ Skicka snabbmeddelanden till dina v?nner online med MSN Messenger: http://messenger.msn.se From daniel.neri@REDACTED Wed Aug 14 11:49:19 2002 From: daniel.neri@REDACTED (Daniel =?iso-8859-1?q?N=E9ri?=) Date: 14 Aug 2002 09:49:19 +0000 Subject: undocumented modules in OTP In-Reply-To: References: Message-ID: Richard Carlsson writes: > It was highly unofficial in R8. For R9, we have renamed it to the > shorter "proplists" I've complained about this before, but anyway here it goes again... Wouldn't it be nice if this kind of module was named consistently? We now have, on one hand: dict, digraph, ets, dets, orddict, queue, string, sofs. On the other: sets, ordsets, lists, gb_sets, gb_trees, proplists. IMNSHO, the plural "s" in the latter group is ugly and should go away as soon as possible. Best wishes, --Daniel -- Daniel N?ri Sigicom AB, Stockholm, Sweden From vlad_dumitrescu@REDACTED Wed Aug 14 11:54:50 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Aug 2002 11:54:50 +0200 Subject: small windows install bug Message-ID: Hi, In R8-2 on Windows, the installation sets the .hrl and .erl file shell icons to $ERL_TOP\erts-5.1.2\bin\beam.exe,n. Instead, there should be beam.dll, I think. regards, Vlad _________________________________________________________________ Skicka snabbmeddelanden till dina v?nner online med MSN Messenger: http://messenger.msn.se From bjarne@REDACTED Wed Aug 14 12:05:16 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Wed, 14 Aug 2002 12:05:16 +0200 Subject: ACM SIGPLAN Erlang Workshop References: Message-ID: <3D5A2B5C.E5572329@erix.ericsson.se> Call for participation ACM SIGPLAN Erlang Workshop, Pittsburgh, PA, USA, October 7. Satellite event of PLI'2002. Please see the program on http://www.erlang.se/workshop/2002/ The workshop home page also indicates how you can register and make hotel reservations. Best wishes Bjarne D?cker Ericsson AB From ingela@REDACTED Wed Aug 14 13:17:34 2002 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 14 Aug 2002 13:17:34 +0200 (MEST) Subject: undocumented modules in OTP References: Message-ID: <200208141117.NAA06859@gildor.du.uab.ericsson.se> daniel.neri@REDACTED wrote: > Richard Carlsson writes: > > > It was highly unofficial in R8. For R9, we have renamed it to the > > shorter "proplists" > > I've complained about this before, but anyway here it goes again... > > Wouldn't it be nice if this kind of module was named consistently? We > now have, on one hand: > > dict, digraph, ets, dets, orddict, queue, string, sofs. > > On the other: > > sets, ordsets, lists, gb_sets, gb_trees, proplists. > > > IMNSHO, the plural "s" in the latter group is ugly and should go away > as soon as possible. Well I will agree that being consistent is very nice. But this should have been thought of a long time ago, alas it was not. Changing it now is just going to cause much more trouble than it is worth. Think of the millions of lines of code that would have to be changed. You could have a solution where you have a wrapper moudule lists for list but how ugly would not that be ... so you will just have to live with it. -- /m.v.h Ingela Ericsson AB - OTP team From eleberg@REDACTED Wed Aug 14 13:28:28 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Wed, 14 Aug 2002 13:28:28 +0200 (MET DST) Subject: undocumented modules in OTP Message-ID: <200208141128.g7EBSSr17893@cbe.ericsson.se> > Date: Wed, 14 Aug 2002 13:17:34 +0200 (MEST) > From: Ingela Anderton > To: daniel.neri@REDACTED > cc: erlang-questions@REDACTED > Subject: Re: undocumented modules in OTP > > daniel.neri@REDACTED wrote: ...deleted > > > > I've complained about this before, but anyway here it goes again... > > > > Wouldn't it be nice if this kind of module was named consistently? We > > now have, on one hand: > > > > dict, digraph, ets, dets, orddict, queue, string, sofs. > > > > On the other: > > > > sets, ordsets, lists, gb_sets, gb_trees, proplists. > > > > > > IMNSHO, the plural "s" in the latter group is ugly and should go away > > as soon as possible. > Well I will agree that being consistent is very nice. But this should > have been thought of a long time ago, alas it was not. Changing it now perhaps it is possible to think of it now? there where mistakes made in the beginning (impossible to correct now :-(, but it is not neccessary to repeat the same mistakes again. bengt From mickael.remond@REDACTED Wed Aug 14 13:38:00 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 14 Aug 2002 13:38:00 +0200 Subject: page templates Message-ID: <20020814113756.625E916C6@relay-5v.club-internet.fr> vlad_dumitrescu@REDACTED ?crit le 14/8/02 7:18: >Is there anyone else working >on this at the moment? It >would be useful to >share experience and/or >work. Here is what I did before going on vacation. I did implement simple ept as a module to generate Erlang code from a page template. I think this is the way to go for performance reason. I did implement the following attributes: - ept:content for inserting the result of the evaluation into the tag - ept:replace for replacing the current tag by the result of the attribute evaluation. Those two attributes are easy to implement. I have also started to implement the for loop, mapping it to Erlang code as lists:map. I can send you my work and help you when I will be back from vacation on the 2 september. Does this match with what you have in mind ? -- Micka?l R?mond From vlad_dumitrescu@REDACTED Wed Aug 14 13:50:06 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Aug 2002 13:50:06 +0200 Subject: page templates Message-ID: >From: "Mickael Remond" > >Is there anyone else working > >on this at the moment? It > >would be useful to > >share experience and/or > >work. > >Here is what I did before going on vacation. I did implement simple ept as >a module to generate Erlang code from a page template. I think this is the >way to go for performance reason. I begun another way, using xmerl to parse the template and then go through it, executing the TAL statements. For Edoc I am not really affected by the performance problem, but it is possible to compile a template into an Erlang module containing its parsed XML tree... I think it would be interesting to look at your ideas, I can send you my code too if you want to browse it during your vacation. best regards, Vlad _________________________________________________________________ P? MSN hittar du det roliga, intressanta och anv?ndbara p? internet: http://www.msn.se From jamesh@REDACTED Wed Aug 14 16:13:02 2002 From: jamesh@REDACTED (James Hague) Date: Wed, 14 Aug 2002 09:13:02 -0500 Subject: undocumented modules in OTP Message-ID: >perhaps it is possible to think of it now? there where mistakes made in the beginning (impossible >to correct now :-(, but it is not neccessary to repeat >the same mistakes again. On that note, are we ever going to be able to get rid of deprecated modules like crypto and some of the others? And what about all the ancient functions in lists, for example, that are from the pre-fun days? It would be nice to get rid of them at some point. The Erlang distribution keeps growing in size; it would be pleasant to reverse the trend a bit. The more stuff that's in there, the more daunting it is. From achay@REDACTED Wed Aug 14 12:44:25 2002 From: achay@REDACTED (Antonio Chay Hidalgo) Date: Wed, 14 Aug 2002 10:44:25 +0000 Subject: Newbie questions, information required Message-ID: <20020814104425.3a94e321.achay@its.cl> Hi! I'm currently learnig erlang, at my work. I found the book "Concurrent Programing in Erlang", but it is not actualized. is there another book ? (i'm looking for exercises, tips, etc). I also have the html documentation, it serves well but only when you need something specific. exist some more information, for learning the language ? i'm looking for examples, exercises and tips. Thanks in advance. Saludos desde Chile. -- Antonio Chay Hidalgo. From richardc@REDACTED Wed Aug 14 16:48:37 2002 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Aug 2002 16:48:37 +0200 (MET DST) Subject: undocumented modules in OTP In-Reply-To: Message-ID: On Wed, 14 Aug 2002, James Hague wrote: > On that note, are we ever going to be able to get rid of deprecated > modules like crypto and some of the others? And what about all the > ancient functions in lists, for example, that are from the pre-fun > days? > > It would be nice to get rid of them at some point. The Erlang > distribution keeps growing in size; it would be pleasant to reverse > the trend a bit. The more stuff that's in there, the more daunting > it is. The answer to all this - I hope - is the package system for modules that is included in R9. This is analogous to packages in Java, and will make it possible to create a completely new set of standard modules, only keeping the old ones for backwards compatibility. For example, "lists" could/will be replaced by something like "erl.lang.list". (For those of you who know Java, all old Erlang modules will simply exist in the "empty" package; there are no problems with backwards compatibility.) However, such a thing should be done with care, so that we don't just move old garbage to new modules. One should take the opportunity to clean up interfaces or even completely rewrite them, drop old baggage, and sort functionality into suitably named modules. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From ksivakumar@REDACTED Wed Aug 14 16:47:10 2002 From: ksivakumar@REDACTED (Sivakumar Krishnasamy) Date: Wed, 14 Aug 2002 20:17:10 +0530 Subject: Mnesia table events Message-ID: <000801c243a1$78db7880$fa01010a@calsoft.co.in> Hi all, I have created a table, which is replicated in 2 nodes ..say Node A and Node B. If I insert a value in Node A, then it's is replicated in Node B. Is it possible to subscribe for capturing table events in Node B, to capture table events When I perform table operations like write/delete in Node A for the replicated table. When I tried the above scenario, I am getting events only in Node A, and node B doesn't seems to generate any table events, when its replicated table is accessed in Node A. Regards, Sivakumar Krishnasamy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From peppe@REDACTED Thu Aug 15 09:41:58 2002 From: peppe@REDACTED (Peter Andersson) Date: Thu, 15 Aug 2002 09:41:58 +0200 Subject: Newbie questions, information required References: <20020814104425.3a94e321.achay@its.cl> Message-ID: <3D5B5B46.38E1F65B@erix.ericsson.se> Hi Antonio, I'd say reading the old Erlang book is still a great way to get introduced to the language and learn the basics. To learn about OTP, the applications and to get up to date with the latest features, changes and additions to Erlang, I recommend you read the "general" parts of the online documentation: http://www.erlang.se/doc/index.shtml Follow the R8B link and go through the "Some hints that may get you started faster" items (pay extra attention to the extensions since 4.4). Also make sure you have a look at "System documentation" and "Applications overview" (without necessarily going into the detailed manuals). At the Open Source site (http://www.erlang.org/) you'll find plenty of stuff to read to learn more. Documents, examples, code contributions, etc. Browse through the various items. I'm sure you'll find what you're looking for... and more! Good luck and have fun! Peter Antonio Chay Hidalgo wrote: > Hi! > > I'm currently learnig erlang, at my work. > I found the book "Concurrent Programing in Erlang", but it is not actualized. > is there another book ? (i'm looking for exercises, tips, etc). > I also have the html documentation, it serves well but only when you need something specific. > > exist some more information, for learning the language ? > i'm looking for examples, exercises and tips. > > Thanks in advance. > > Saludos desde Chile. > -- > Antonio Chay Hidalgo. From eedtag@REDACTED Thu Aug 15 10:39:56 2002 From: eedtag@REDACTED (Tanja Godau) Date: Thu, 15 Aug 2002 10:39:56 +0200 (MET DST) Subject: regexp Message-ID: <200208150839.KAA19644@granus41.eed.ericsson.se> Hi, I've been using the regexp module to match various strings and parts of strings. I would like to know how can I extract one or more variables from my match. For example: I receive a string "\000\005\abc" I identify the string due to the leading three zeros, but I need to extract the number "5" and the letters "abc" from the string. I've used regexp's with Perl and there I would bracket the parts I need and be able to use them later as the variables $1, $2, etc. I'd like to know how to do the same thing with Erlang. Something like this: String = "\000\005\abc", case regexp:match(String, "\\000.*\\00(.*)\\00(.*)") of {match,S,L} -> io:format("Number: ~p~n",[$1]), % this prints "Number: 5" io:format("Text: ~p~n",[$2]); % this prints "Text: abc" nomatch -> ... Question: How can I match a string and extract the variables I need in Erlang? Thankyou Tanja Godau From happi@REDACTED Thu Aug 15 12:04:54 2002 From: happi@REDACTED (Happi) Date: Thu, 15 Aug 2002 12:04:54 +0200 Subject: regexp References: <200208150839.KAA19644@granus41.eed.ericsson.se> Message-ID: <002001c24443$3409a4a0$c90b0a0a@LISA> This is perhaps not an answer to your question, but it looks to me like you don't really need a regexp for your match. If all your expressions are as easy as in your example you could use string:tokens/2 1> String = "\\000\\005\\abc". "\\000\\005\\abc" 2> string:tokens(String,"\\"). ["000","005","abc"] In Erlang I most often find it easier to write a recursive function that parses the string than to try to come up with the right regular expression. /Erik org: Eric Conspiracy Secret Laboratories I'm Happi, you should be happy! Praeterea censeo "0xCA" scribere Erlang posse. ----- Original Message ----- From: "Tanja Godau" > Hi, > > I've been using the regexp module to match various strings and parts of strings. > I would like to know how can I extract one or more variables from my match. > > For example: > > I receive a string "\000\005\abc" > > I identify the string due to the leading three zeros, but I need to extract > the number "5" and the letters "abc" from the string. > > I've used regexp's with Perl and there I would bracket the parts I need and be > able to use them later as the variables $1, $2, etc. I'd like to know how to > do the same thing with Erlang. > > Something like this: > > String = "\000\005\abc", > case regexp:match(String, "\\000.*\\00(.*)\\00(.*)") of > {match,S,L} -> > io:format("Number: ~p~n",[$1]), % this prints "Number: 5" > io:format("Text: ~p~n",[$2]); % this prints "Text: abc" > nomatch -> > ... > > Question: How can I match a string and extract the variables I need in Erlang? > > Thankyou > Tanja Godau > > From thierry@REDACTED Thu Aug 15 13:42:31 2002 From: thierry@REDACTED (Thierry Mallard) Date: Thu, 15 Aug 2002 13:42:31 +0200 (MEST) Subject: Erlang R8B-2 RPM for Mandrake 8.2 (beta1) Message-ID: <1029411751.3d5b93a76962b@imp.pro.proxad.net> Greetings everyone, I've tried to build a first mandrake 8.2 RPM for Erlang new release (R8B-2). Here's the corresponding webpage : http://www.vawis.net/mdk/erlang/ You should find there the i586 RPM, source RPM, SPEC file and log. When everything will be fine with it, I'll try to port it to RedHat and SuSE. Feedback most welcome, as always :-) With best regards, -- Thierry Mallard http://vawis.net From hans@REDACTED Thu Aug 15 15:56:13 2002 From: hans@REDACTED (Hans Nilsson) Date: Thu, 15 Aug 2002 15:56:13 +0200 (CEST) Subject: Distributed Erlang with only IP-address? Message-ID: Hi, is there any way to use distributed Erlang on hosts which does not have hostnames? It is not possible to have a DNS and not even a /etc/hosts file :-( I need to do things like net_adm:ping(foo@REDACTED) rpc:call(foo@REDACTED, M, F, A) : : /Hans Nilsson From martinjlogan@REDACTED Fri Aug 16 02:06:28 2002 From: martinjlogan@REDACTED (martin logan) Date: Thu, 15 Aug 2002 19:06:28 -0500 Subject: Mnesia fragmentation Message-ID: Hello All, I would like to preface this by saying that this question is not about telephony, so all those who read the first sentence and turn away, please keep reading. I have a call detail record collection system for a sip platform that needs to be monitored. The system has a non fixed collection of nodes that exist as state servers for all calls existing on the platform. I must be able to accuratly monitor calls on these servers. This task is complicated by the fact that servers are going to be hosting thousands of calls at any given time. The high volume of data and the high write to read ratio militates against efficiant standard mnesia replication. I need to come up with a system wherein I can veiw all of the servers as a single resource independent of the location of the various server instances. I was thinking that fragmentation would be the solution. Ideally each server would write all of its data to its local fragment but when queries are performed the table is treated as a whole. Perhaps I have missunderstood the purpose of fragmentation. It seems to me that without control over the fragments that I could incur a network hit on every write. This is obviously preferable to a full mesh of fully replicated mnesia nodes but still not adiquate for my system. If anyone out there has experiance with this type of problem please let me in on your solution. Thanks alot, Martin _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx From dgud@REDACTED Fri Aug 16 08:04:11 2002 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 16 Aug 2002 08:04:11 +0200 Subject: Mnesia table events In-Reply-To: <000801c243a1$78db7880$fa01010a@calsoft.co.in> References: <000801c243a1$78db7880$fa01010a@calsoft.co.in> Message-ID: <15708.38363.899897.256055@gargle.gargle.HOWL> You only get events on the node where you called the subscribe command: Node A Node B (A1) (a@REDACTED)1> mnesia:start(). (a1@REDACTED)1> mnesia:start(). ok ok (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]). {ok,[a1@REDACTED]} (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]). {atomic,ok} (a@REDACTED)4> (a1@REDACTED)3> mnesia:subscribe({table, a}). (a@REDACTED)4> {ok,a1@REDACTED} (a@REDACTED)4> mnesia:dirty_write({a,1,1}). ok (a@REDACTED)5> (a1@REDACTED)4> flush(). Shell got {mnesia_table_event, {write,{a,1,1},{dirty,<127.32.0>}}} /Dan Sivakumar Krishnasamy writes: > Hi all, > I have created a table, which is replicated in 2 nodes ..say Node A and Node B. If I insert a value in Node A, then it's is replicated in Node B. > Is it possible to subscribe for capturing table events in Node B, to capture table events When I perform table operations like write/delete in Node A for the replicated table. > When I tried the above scenario, I am getting events only in Node A, and node B doesn't seems to generate any table events, when its replicated table is accessed in Node A. > > Regards, > Sivakumar Krishnasamy. > > From ksivakumar@REDACTED Fri Aug 16 09:18:31 2002 From: ksivakumar@REDACTED (Sivakumar Krishnasamy) Date: Fri, 16 Aug 2002 12:48:31 +0530 Subject: Mnesia table events References: <000801c243a1$78db7880$fa01010a@calsoft.co.in> <15708.38363.899897.256055@gargle.gargle.HOWL> Message-ID: <000901c244f5$20b75fc0$fa01010a@calsoft.co.in> Hi Dan Gudmundsson, Thanks for your reply. What will happen if I subscribe for table events on both the nodes (a@REDACTED, a1@REDACTED), but perform replicated table operations in a@REDACTED ?. Will the events be distributed to both subscribed processes in a@REDACTED and a1@REDACTED ??. Node A Node B (A1) (a@REDACTED)1> mnesia:start(). (a1@REDACTED)1> mnesia:start(). ok ok (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]). {ok,[a1@REDACTED]} (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]). {atomic,ok} (a@REDACTED)4> mnesia:subscribe({table, a}). (a1@REDACTED)3> mnesia:subscribe({table, a}). {ok,a@REDACTED} {ok,a1@REDACTED} (a@REDACTED)4> mnesia:dirty_write({a,1,1}). ok Note: So performing table operation in a@REDACTED creates an event and it is captured by the subscribed process in a1@REDACTED Am I right ?? (a@REDACTED)5> (a1@REDACTED)4> flush(). Will I get event here too?? Shell got {mnesia_table_event, {write,{a,1,1},{dirty,<127.32.0>}}} Regards, Sivakumar Krishnasamy. ----- Original Message ----- From: "Dan Gudmundsson" To: "Sivakumar Krishnasamy" Cc: Sent: Friday, August 16, 2002 11:34 AM Subject: Mnesia table events > > You only get events on the node where you called the subscribe command: > > Node A Node B (A1) > > (a@REDACTED)1> mnesia:start(). (a1@REDACTED)1> mnesia:start(). > ok ok > (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]). > {ok,[a1@REDACTED]} > (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]). > {atomic,ok} > (a@REDACTED)4> (a1@REDACTED)3> mnesia:subscribe({table, a}). > (a@REDACTED)4> {ok,a1@REDACTED} > (a@REDACTED)4> mnesia:dirty_write({a,1,1}). > ok > (a@REDACTED)5> (a1@REDACTED)4> flush(). > Shell got {mnesia_table_event, > {write,{a,1,1},{dirty,<127.32.0>}}} > > /Dan > > > > > Sivakumar Krishnasamy writes: > > Hi all, > > I have created a table, which is replicated in 2 nodes ..say Node A and Node B. If I insert a value in Node A, then it's is replicated in Node B. > > Is it possible to subscribe for capturing table events in Node B, to capture table events When I perform table operations like write/delete in Node A for the replicated table. > > When I tried the above scenario, I am getting events only in Node A, and node B doesn't seems to generate any table events, when its replicated table is accessed in Node A. > > > > Regards, > > Sivakumar Krishnasamy. > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Fri Aug 16 10:14:01 2002 From: dgud@REDACTED (Dan Gudmundsson) Date: Fri, 16 Aug 2002 10:14:01 +0200 Subject: Mnesia table events In-Reply-To: <000901c244f5$20b75fc0$fa01010a@calsoft.co.in> References: <000801c243a1$78db7880$fa01010a@calsoft.co.in> <15708.38363.899897.256055@gargle.gargle.HOWL> <000901c244f5$20b75fc0$fa01010a@calsoft.co.in> Message-ID: <15708.46153.18626.915316@gargle.gargle.HOWL> Sivakumar Krishnasamy writes: > Hi Dan Gudmundsson, > Thanks for your reply. > What will happen if I subscribe for table events on both the nodes (a@REDACTED, a1@REDACTED), but perform replicated table operations in a@REDACTED ?. > Will the events be distributed to both subscribed processes in a@REDACTED and a1@REDACTED ??. Yes > > Node A Node B (A1) > (a@REDACTED)1> mnesia:start(). (a1@REDACTED)1> mnesia:start(). > ok ok > > (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]). > {ok,[a1@REDACTED]} > > (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]). > {atomic,ok} > > (a@REDACTED)4> mnesia:subscribe({table, a}). (a1@REDACTED)3> mnesia:subscribe({table, a}). > {ok,a@REDACTED} {ok,a1@REDACTED} > > (a@REDACTED)4> mnesia:dirty_write({a,1,1}). > ok > > Note: So performing table operation in a@REDACTED creates an event and it is captured by the subscribed process in a1@REDACTED Am I right ?? Well, the event(s) are created locally on the node(s) when data is written (or deleted), conceptually that the same thing. > > (a@REDACTED)5> (a1@REDACTED)4> flush(). > Will I get event here too?? Shell got {mnesia_table_event, > {write,{a,1,1},{dirty,<127.32.0>}}} Yes, if you had subscribed to events on a@REDACTED If you connect a third node (a2), but don't create a replica of table a on a2, then you can't subscribe to the events of table a. You can still read and write data from that node (a2). Events will be generated on the nodes with an replica. /Dan > > Regards, > Sivakumar Krishnasamy. > > > > ----- Original Message ----- > From: "Dan Gudmundsson" > To: "Sivakumar Krishnasamy" > Cc: > Sent: Friday, August 16, 2002 11:34 AM > Subject: Mnesia table events > > > > > > You only get events on the node where you called the subscribe command: > > > > Node A Node B (A1) > > > > (a@REDACTED)1> mnesia:start(). (a1@REDACTED)1> mnesia:start(). > > ok ok > > (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]). > > {ok,[a1@REDACTED]} > > (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]). > > {atomic,ok} > > (a@REDACTED)4> (a1@REDACTED)3> mnesia:subscribe({table, a}). > > (a@REDACTED)4> {ok,a1@REDACTED} > > (a@REDACTED)4> mnesia:dirty_write({a,1,1}). > > ok > > (a@REDACTED)5> (a1@REDACTED)4> flush(). > > Shell got {mnesia_table_event, > > {write,{a,1,1},{dirty,<127.32.0>}}} > > > > /Dan > > > > > > > > > > Sivakumar Krishnasamy writes: > > > Hi all, > > > I have created a table, which is replicated in 2 nodes ..say Node A and Node B. If I insert a value in Node A, then it's is replicated in Node B. > > > Is it possible to subscribe for capturing table events in Node B, to capture table events When I perform table operations like write/delete in Node A for the replicated table. > > > When I tried the above scenario, I am getting events only in Node A, and node B doesn't seems to generate any table events, when its replicated table is accessed in Node A. > > > > > > Regards, > > > Sivakumar Krishnasamy. > > > > > > From etxuwig@REDACTED Fri Aug 16 11:17:55 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 16 Aug 2002 11:17:55 +0200 (MET DST) Subject: Mnesia fragmentation In-Reply-To: Message-ID: On Thu, 15 Aug 2002, martin logan wrote: >I was thinking that fragmentation would be the solution. Ideally >each server would write all of its data to its local fragment >but when queries are performed the table is treated as a whole. >Perhaps I have missunderstood the purpose of fragmentation. It >seems to me that without control over the fragments that I could >incur a network hit on every write. I have written a small patch to mnesia_frag.erl that will give you control of the fragments. I've been given indications that it, or some modified version of it, will eventually be included in OTP... Perhaps you can give it a spin and offer some feedback? The idea is to offer a mnesia_frag behaviour, where one can map (Key -> FragmentNumber) and (FragmentNumber -> TableName). A short example: I'm working (slowly) on an XML database solution using fragmented tables. I want all elements in one XML document to be stored in the same fragment, but all XML documents to be spread out evenly using a hashing algorithm. The idea is that I want to control the fragments for one table (xmerldb_obj), and let the others use the default scheme. -module(xmerldb_frag_cb). -behaviour(mnesia_frag). -export([n_to_frag_name/3, key_to_n/3]). %% Returns name of fragment table n_to_frag_name(Tab, 1, FH) -> Tab; n_to_frag_name(Tab, N, FH) -> list_to_atom(atom_to_list(Tab) ++ "_frag" ++ integer_to_list(N)). %% Returns fragment number key_to_n(xmerldb_obj, {DocId, Pos}, FH) -> %% Keep the whole document together in one fragment. key_to_n_hash(DocId, FH); key_to_n(Tab, Key, FH) -> %% this would e.g. be the node types "index". %% What is the best fragmentation semantic here? %% We start by using the default semantics. key_to_n_hash(Key, FH). key_to_n_hash(Key, FH) -> L = mnesia_frag:n_doubles(FH), A = erlang:hash(Key, trunc(math:pow(2, L))), P = mnesia_frag:next_n_split(FH), if A < P -> erlang:hash(Key, trunc(math:pow(2, L + 1))); true -> A end. In the standard mnesia_frag_cb (implementing today's behaviour), key_to_n(Tab, Key, FH) -> key_to_n_hash(Key, FH). I can mail you the code, if you want to test it. Known flaw: match_object() and select() will always search all fragments. It would be nice to also have a callback function that can inspect the pattern and determine whether the search can be limited to only one or a few fragments. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From Sean.Hinde@REDACTED Fri Aug 16 14:24:52 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 16 Aug 2002 13:24:52 +0100 Subject: Mnesia table events Message-ID: <04D356A3B172D611981B0008C791C3126BF2BA@imp02mbx.t-mobile.co.uk> Hi, > > I have created a table, which is replicated in 2 nodes > ..say Node A and Node B. If I insert a value in Node A, then > it's is replicated in Node B. > > Is it possible to subscribe for capturing table events > in Node B, to capture table events When I perform table > operations like write/delete in Node A for the replicated table. > > When I tried the above scenario, I am getting events > only in Node A, and node B doesn't seems to generate any > table events, when its replicated table is accessed in Node A. I strikes me (without knowing anything at all about your application) that you might be better off using the normal erlang inter-node communication mechansims to communicate changes to the database to the rest of your system. I have seen table events used quite extensively in other database environments but have never really felt the need to use them in Erlang because there are usually much easier and more "native" ways to achieve the same aim. Good luck in your Erlanging Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From mickael.remond@REDACTED Sun Aug 18 18:26:00 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 18 Aug 2002 18:26:00 +0200 Subject: Minimalist Erlang system: only erts Message-ID: <20020818162508.ABFBF169B@relay-1v.club-internet.fr> Hello, I am trying to install a minimalist erts system. I did search in makefiles and configures but did not find such option. Do you know an easy way to do it ? Thank you in advance -- Micka?l R?mond From mickael.remond@REDACTED Sun Aug 18 19:13:00 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 18 Aug 2002 19:13:00 +0200 Subject: Erl script change Message-ID: <20020818171153.3368B1693@relay-1v.club-internet.fr> Hello, I found helpfull to make a little modification in the erl start script. I added after the line: ROOTDIR=/usr/local/erlang the following test: if [ -n "$ERLDIR"] then ROOTDIR=$ERLDIR fi This way in can package the erts/bin directory with my application and run erlang and the application directly from the install dir by setting the environment var ERLDIR. Maybe there are other way to do that but otherwise this little change could be integrated in the next release. Cheers, -- Micka?l R?mond From raimo@REDACTED Mon Aug 19 07:53:32 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Mon, 19 Aug 2002 07:53:32 +0200 Subject: Distributed Erlang with only IP-address? References: Message-ID: <3D6087DC.D0111C70@erix.ericsson.se> I think it will work just by giving the nodename explicitly when you start the node, -sname foo@REDACTED and then try net_adm:ping('foo@REDACTED') rpc:call('foo@REDACTED', M, F, A) note the single quotes. / Raimo Niskanen, Erlang/OTP, Ericsson AB Hans Nilsson wrote: > > Hi, > > is there any way to use distributed Erlang on hosts which does not have > hostnames? It is not possible to have a DNS and not even a /etc/hosts > file :-( > > I need to do things like > > net_adm:ping(foo@REDACTED) > rpc:call(foo@REDACTED, M, F, A) > : > : > > /Hans Nilsson > From raimo@REDACTED Mon Aug 19 08:22:33 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Mon, 19 Aug 2002 08:22:33 +0200 Subject: ErLang newbie questions References: <000a01c24054$b8c0f880$fa01010a@calsoft.co.in> Message-ID: <3D608EA9.D2E211CD@erix.ericsson.se> Hi. I am sorry that I do not understand your questions. Have you got Erlang nodes or C nodes or both? An Erlang node is a OS(Unix/Windows) process that is started with "erl -sname ..." and runs mostly Erlang code (compiled to .beam). A C node is a OS process that runs a program written in C using the 'ei' (or perhaps 'erl_interface') support library that helps the C program behave like an Erlang Node. A C node cannot use driver callbacks. It can only use the 'ei' support library (and OS calls, of course). The driver callbacks are used by linked-in drivers, and port_command/2 is an Erlang code call into a linked-in driver. A linked-in driver is an object file that is dynamically loaded from an erlang node using calls to the 'erl_ddll' module, and then can be used as a port, for example open_port({spawn, "linked_in_driver_name}, []), and later port_command/2. I hope this helps you rephrase your questions. / Raimo Niskanen, Erlang/OTP, Ericsson AB. > Sivakumar Krishnasamy wrote: > > Hi All, > I am sorry if all these questions are very basic. I am a newbie > to ErLang. Please clarify my questions. > > 1) I want to use Port driver's callback function in a C Node. To call > back this function I need to use port_command/3 BIF from ErLang Node. > But I am able to find port_command/2 BIF only. What are arguments in > port_command/3 BIF? > > 2) I have two ErLang nodes (For example) Node_A , Node_B. Both these > nodes have C Node Interface. > > I have written a ErLang process which sends a message from ErLang > process to C Interface program in Node_A, which is then echo'd back > to ErLang process, which in turn send this message to ErLang process > in Node_B. > > Message communication between these two nodes are normal. But when > I disconnect a node (Node_B) and try sending a message to the Node_B > from Node_A, it fails by giving proper error. But when the connection > is retained back (to Node_B), Node_A sends the old messages, i.e the > messages which were send to Node_B, when it was disconnected from > Node_A. I think somekind of Message queuing is happening in Node_A. > How to prevent this?. Is this queuing happening in Node_A's C > Interface ?? (or) is it by ErLang process in Node_A?. > > 3) Why does open_port({spawn,command},[{packet,2},binary]) fails while > open_port({spawn,command},[{packet,2}]) succeeds ?. > > Thanks in Advance. > > Regards, > Sivakumar Krishnasamy. > > > > > From sureshsaragadam@REDACTED Wed Aug 21 09:54:56 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Wed, 21 Aug 2002 08:54:56 +0100 (BST) Subject: Example in C for mnesia_session In-Reply-To: <200207261038.MAA20805@gildor.du.uab.ericsson.se> Message-ID: <20020821075456.86812.qmail@web8101.in.yahoo.com> Hi, I need to update mnesia tables from c language, There is an example programme in mnesia_session for accessing mnesia db from c language, mostly this example will help me. in c_session dir there r many files, what r the files required in that dir i need to run that example progrmme, can any one help me, i thank u ________________________________________________________________________ Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com From erlang@REDACTED Wed Aug 21 12:12:19 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 21 Aug 2002 11:12:19 +0100 Subject: MeGaCo PropertyParm formatting question Message-ID: <3D636783.6060604@manderp.freeserve.co.uk> Hello everyone, I've learnt and been using Erlang over the last couple of weeks to build a Gateway Emulator for testing purposes. So far it's been a successful project, with good results in staggeringly little time. But now I'm stuck and need some help, and I hope you'll forgive me if the answer is obvious. I'm having trouble when trying to construct a PropertyParm record. Up to now, all I needed to do was understand the ASN.1 specs and simply transfer that into records, and it all worked. Maybe I've misunderstood the ASN.1 for PropertyParm, or got the wrong idea about the corresponding record in Erlang. Here's the ASN.1: PropertyParm ::= SEQUENCE { name PkgdName, value SEQUENCE OF OCTET STRING, extraInfo CHOICE { relation Relation, range BOOLEAN, sublist BOOLEAN } OPTIONAL, ... } And here's the offending code: PropParm = #'PropertyParm'{ name = Name, value = Values, % extraInfo = {sublist, true} % extraInfo = {range, true} % extraInfo = {relation, greaterThan} }, My understanding is this: Without extraInfo (since it's optional) using: Name = "aName" Value = "aValue" should work, which it does. But when extraInfo = {range, true} I should supply exactly two values, so I assume that I should use: Name = "aName" Value = ["lower", "upper"] but it doesn't work, and I get: {error, { {badmatch,[[97,86,97,108,117,101],[117,112,112,101,114]]}, [ {megaco_pretty_text_encoder,enc_PropertyGroupParm,2}, {megaco_pretty_text_encoder,'-enc_PropertyGroup/3-lc^0/1-0-',2}, {megaco_pretty_text_encoder,enc_PropertyGroup,3}, {megaco_pretty_text_encoder,enc_LocalRemoteDescriptor,2}, {megaco_pretty_text_encoder,enc_localDescriptor,2}, {megaco_pretty_text_encoder,do_enc_list,5}, {megaco_pretty_text_encoder,enc_list,4}, {megaco_pretty_text_encoder,enc_MediaDescriptor,2}|more ]}} So what do I need to do for each case of extraInfo? Pete. From hakan@REDACTED Wed Aug 21 13:35:29 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 21 Aug 2002 13:35:29 +0200 (MEST) Subject: MeGaCo PropertyParm formatting question In-Reply-To: <3D636783.6060604@manderp.freeserve.co.uk> Message-ID: On Wed, 21 Aug 2002, Peter-Henry Mander wrote: pete> Hello everyone, pete> pete> I've learnt and been using Erlang over the last couple of weeks to build pete> a Gateway Emulator for testing purposes. So far it's been a successful pete> project, with good results in staggeringly little time. Great! Pete> So what do I need to do for each case of extraInfo? Nothing. In other contexts where extraInfo is allowed, you should use it exactly as you have done. You can however not use extraInfo in the context of local and remote descriptors. At least not when using the textual encoding. But I do not think that it should be used in the binary encoding either (even if it not is explicitly prohibited in the RFC). According to the RFC, the ABNF representation of local and remote descriptors are limited to be a plain octet string containing SDP info. This seems fair enough. Unfortunately the corresponding ASN.1 representation (in the RFC) is mapped to the more generic PropertyParm structure. This means that it it seems to be syntactically correct to use the extraInfo stuff when using ASN.1, while it is has no corresponding representation in ABNF. Even if our protocol stack allows the usage of extraInfo for the ASN.1 encoding, I suggest that you submit a question on the Megaco list before you use the extraInfo stuff in the context of local and remote descriptors. I doubt that it is allowed. /H?kan From erlang@REDACTED Wed Aug 21 15:08:59 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 21 Aug 2002 14:08:59 +0100 Subject: MeGaCo PropertyParm formatting question References: Message-ID: <3D6390EB.5080703@manderp.freeserve.co.uk> Hi Hakan, Thanks for that very pertinent remark about the local and remote descriptor, I may need to rethink how to acheive my aim. Could it be that the ASN.1 really ought to have a LocalRemotePropertyParm to avoid ambiguity? Pete. Hakan Mattsson wrote: >On Wed, 21 Aug 2002, Peter-Henry Mander wrote: > >pete> Hello everyone, >pete> >pete> I've learnt and been using Erlang over the last couple of weeks to build >pete> a Gateway Emulator for testing purposes. So far it's been a successful >pete> project, with good results in staggeringly little time. > >Great! > >Pete> So what do I need to do for each case of extraInfo? > >Nothing. In other contexts where extraInfo is allowed, you >should use it exactly as you have done. > >You can however not use extraInfo in the context of local >and remote descriptors. At least not when using the textual >encoding. But I do not think that it should be used in the >binary encoding either (even if it not is explicitly prohibited >in the RFC). > >According to the RFC, the ABNF representation of local and remote >descriptors are limited to be a plain octet string containing SDP >info. This seems fair enough. > >Unfortunately the corresponding ASN.1 representation (in the RFC) is >mapped to the more generic PropertyParm structure. This means that it >it seems to be syntactically correct to use the extraInfo stuff when >using ASN.1, while it is has no corresponding representation in ABNF. > >Even if our protocol stack allows the usage of extraInfo for the ASN.1 >encoding, I suggest that you submit a question on the Megaco list before >you use the extraInfo stuff in the context of local and remote descriptors. >I doubt that it is allowed. > >/H?kan > > > > > > > > > > From hakan@REDACTED Wed Aug 21 15:21:52 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 21 Aug 2002 15:21:52 +0200 (MEST) Subject: MeGaCo PropertyParm formatting question In-Reply-To: <3D6390EB.5080703@manderp.freeserve.co.uk> Message-ID: On Wed, 21 Aug 2002, Peter-Henry Mander wrote: Pete> Could it be that the ASN.1 really ought to have a Pete> LocalRemotePropertyParm to avoid ambiguity? Yes, but I think that it is a little bit late to introduce such an incompatible change in the RFC. As far as I can see, the new v2 draft does not contain any enhancements regarding this issue. /H?kan From erlang@REDACTED Wed Aug 21 19:13:28 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 21 Aug 2002 18:13:28 +0100 Subject: Megaco v2 compilation, files to update by hand? Message-ID: <3D63CA38.6010009@manderp.freeserve.co.uk> Hello everyone, I am using the Megaco protocol version 1 to build a Gateway Controller and Media Gateway in Erlang. Now I hope to compile the ASN.1 file for Megaco v2. The changes between the two version don't affect this project too much, it's mainly to prove the point of keeping up to the minute on the standard. Here's the problem: I have successfully compiled Megaco version 2 ASN.1 into Erlang using 'erlc'. At this point, it seems there maybe other source files in the Megaco project that need updating and kept synchronised with the new version of the protocol. Which other files in the source directories and include paths need updating after compiling the ASN.1 so that my application development will support Megaco version 2? Thanks Pete. From hakan@REDACTED Thu Aug 22 11:39:39 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 22 Aug 2002 11:39:39 +0200 (MEST) Subject: Megaco v2 compilation, files to update by hand? In-Reply-To: <3D63CA38.6010009@manderp.freeserve.co.uk> Message-ID: On Wed, 21 Aug 2002, Peter-Henry Mander wrote: Pete> I am using the Megaco protocol version 1 to build a Gateway Controller Pete> and Media Gateway in Erlang. Now I hope to compile the ASN.1 file for Pete> Megaco v2. The changes between the two version don't affect this Pete> project too much, it's mainly to prove the point of keeping up to the Pete> minute on the standard. Pete> Pete> Here's the problem: I have successfully compiled Megaco version 2 Pete> ASN.1 into Erlang using 'erlc'. At this point, it seems there maybe Pete> other source files in the Megaco project that need updating and kept Pete> synchronised with the new version of the protocol. No not really. It is possible to introduce a new encoding or a new version of an existing encoding without any doing any changes in the Megaco application. Pete> Which other files in the source directories and include paths need Pete> updating after compiling the ASN.1 so that my application development Pete> will support Megaco version 2? I would do the following: - Put the new ASN.1 stuff under megaco/src/binary - Copy the .hrl file that the ASN.1 compiler generated to megaco/include/megaco_message_v2.hrl and re-apply the convenient default values found in ...v1.hrl. - Manually verify that all records defined in megaco/src/engine/megaco_message_internal.hrl is compatible with the ones in the new ...v2.hrl file. This is needed in order to ensure that the Megaco engine is not affected by the new internal form. - Copy the megaco/src/binary/megaco_ber_encoder.erl to megaco/src/binary/megaco_ber_encoder_v2.erl and change the ASN.1 encoding/decoding module to the newly generated one. - Replace the ...v1.hrl the include statements in your application to ...v2.hrl. - Configure the Megaco application to use the megaco_ber_encoder_v2. Now you should be able to use v2 of the Megaco protocol. If you want to mix v1 and v2 messages it is more complex. You need to introduce yet another encoder module that decodes the version part of the message header. This code can be copied from the decoder that the ASN.1 compiler has generated. Then you simply switch on the version number in order to invoke the correct decoder. The corresponding change is also needed for encode. As the v1 and v2 internal forms are not fully compatible, you need to isolate the version dependent parts of your application and provide both a v1 and v2 implementation of them. Each one uses its corresponding megaco_message header file. Even if it is possible to treat the records as tuples I would avoid. In the megaco user callback module you can switch on the protocol version to do decide which application module that should do the work. What did I forget? /H?kan From jilani.khaldi@REDACTED Thu Aug 22 14:30:10 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Thu, 22 Aug 2002 14:30:10 +0200 Subject: Can't get YAWS installed In-Reply-To: Message-ID: Hi, I have this problem: "make" command runs without errors, but when I run "make install" I get this error: cd ..; tar cz ebin --) | (cd /usr/local/lib/yaws; tar xz --) gzip: stdin: decompression OK, trailing garbage ignored tar: Child returned status 2 tar: Error exit delayed from previous errors make[1]: *** [install] Error 2 make: *** [install] Error 1 How to solve it? Thanks. NB I have Erlang/OTP R8B-2 installed and works properly on a Linux (Slackware 7.0) box. -- Jilani Khaldi http://space.tin.it/scuola/jkhaldi From klacke@REDACTED Thu Aug 22 16:09:09 2002 From: klacke@REDACTED (Klacke) Date: Thu, 22 Aug 2002 16:09:09 +0200 Subject: Can't get YAWS installed In-Reply-To: ; from jilani.khaldi@tin.it on Thu, Aug 22, 2002 at 02:30:10PM +0200 References: Message-ID: <20020822160909.A1016@bluetail.com> On Thu, Aug 22, 2002 at 02:30:10PM +0200, Jilani Khaldi wrote: > Hi, > > I have this problem: > > "make" command runs without errors, but when I run "make install" I get this error: > > cd ..; tar cz ebin --) | (cd /usr/local/lib/yaws; tar xz --) > > gzip: stdin: decompression OK, trailing garbage ignored > tar: Child returned status 2 > tar: Error exit delayed from previous errors > make[1]: *** [install] Error 2 > make: *** [install] Error 1 > > How to solve it? Thanks. > At times, I've seen this too, automagically it disappeard .... I have no clue. Apparently there must be some error in the Makefile but I can't see it. Try to recompile .. Try to run the failing tar commands by hand ?? /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From eleberg@REDACTED Thu Aug 22 16:52:46 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Thu, 22 Aug 2002 16:52:46 +0200 (MET DST) Subject: Can't get YAWS installed Message-ID: <200208221452.g7MEqkr05143@cbe.ericsson.se> > On Thu, Aug 22, 2002 at 02:30:10PM +0200, Jilani Khaldi wrote: > > Hi, > > > > I have this problem: > > > > "make" command runs without errors, but when I run "make install" I get this error: > > > > cd ..; tar cz ebin --) | (cd /usr/local/lib/yaws; tar xz --) > > > > gzip: stdin: decompression OK, trailing garbage ignored > > tar: Child returned status 2 > > tar: Error exit delayed from previous errors > > make[1]: *** [install] Error 2 > > make: *** [install] Error 1 > > > > How to solve it? Thanks. it appears to me that this is not ones ordinary tar. the z flag is a novelty. the use of tar in a pipe usually looks like this: (cd ..; tar cf - ebin) | (cd /usr/local/lib/yaws; tar xf -) allow me to guess that this tar knows that 'tar c ebin --' is equivalent to 'tar cf - ebin'. second guess is that z is for compression. then i would guess from the error messages that there is something strange with the decompression. presumably the whole of the tar file have not been successfully decompressed. subsequently tar fails to extract everything correctly since the end of the file is missing. sorry about all the guesses. perhaps using 'cp -r ebin/*/usr/local/lib/yaws' would be an alternative to tar? bengt From mickael.remond@REDACTED Thu Aug 22 18:18:00 2002 From: mickael.remond@REDACTED (mickael.remond@REDACTED) Date: Thu, 22 Aug 2002 18:18:00 +0200 Subject: Can't get YAWS installed Message-ID: <20020822161742.9E30716DF@relay-2v.club-internet.fr> erlang-questions@REDACTED From: "Mickael Remond" Importance: Normal X-Priority: 3 (Normal) X-Mailer: iambic Mail jilani.khaldi@REDACTED ?crit le 22/8/02 14:30: >cd ..; tar cz ebin --) | (cd >/usr/local/lib/yaws; tar xz >--) I would use cp -R in the makefile instead of the tar / untar. I am not a makefile expert, so I am wondering why using tar in this particular stage. -- Micka?l R?mond From jilani.khaldi@REDACTED Thu Aug 22 19:09:30 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Thu, 22 Aug 2002 19:09:30 +0200 Subject: Can't get YAWS installed Message-ID: <3VFEYS32DATQWIE52985PJYXKJL4Z.3d651aca@deneb> >Try to run the failing tar commands by hand Ok. I have run the failing commands by hand and now it seems to work. -- Jilani Khaldi http://space.tin.it/scuola/jkhaldi From erikp@REDACTED Thu Aug 22 20:06:54 2002 From: erikp@REDACTED (Erik Pearson) Date: Thu, 22 Aug 2002 11:06:54 -0700 Subject: Can't get YAWS installed Message-ID: <0D595F5EC57C9D4B800DAF910C3DA98F058CD4@ctsmail1.celtech.com> Just a few comments on this thread --- The 'z' flag originated with GNU tar. Besides GNU tar, I don't really know how many OS vendors' tar command support it. Solaris' default tar doesn't. I also don't really know about compressing it to a pipe that decompresses it in the same shell. I wouldn't think the communication link (the pipe) is so slow that you need to spend the time compressing/decompressing it in order to send a smaller amount of data. Also, tar is usually prefered to copy directory structures like this because it is one of the most portable way to preserve symbolic links. GNU's cp does the right thing, but other OS vendors' cp might not: $ ls -l test lrwxrwxrwx 1 erikp devel 8 Aug 22 10:48 yaws -> yaws-1.0 drwxrwxr-x 2 erikp devel 512 Aug 22 10:48 yaws-1.0 $ cp -R test test1 $ ls -l test1 drwxrwxr-x 2 erikp devel 512 Aug 22 10:53 yaws drwxrwxr-x 2 erikp devel 512 Aug 22 10:53 yaws-1.0 --erikp-- From enano@REDACTED Thu Aug 22 18:41:21 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Thu, 22 Aug 2002 18:41:21 +0200 (CEST) Subject: Can't get YAWS installed In-Reply-To: <20020822161742.9E30716DF@relay-2v.club-internet.fr> Message-ID: > I would use cp -R in the makefile instead of the tar / untar. > > I am not a makefile expert, so I am wondering why using tar in this particular stage. Probably to keep permissions? - use cp -pR then. From sureshsaragadam@REDACTED Fri Aug 23 07:37:44 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Fri, 23 Aug 2002 06:37:44 +0100 (BST) Subject: Help me in mnesia_session In-Reply-To: <20020821075456.86812.qmail@web8101.in.yahoo.com> Message-ID: <20020823053744.31702.qmail@web8106.mail.in.yahoo.com> Hi, I need to update mnesia tables from c language, /usr/local/lib/erlang/lib/mnesia_session-1.1.3/examples/person/c_sessin There is an example programme in mnesia_session for accessing mnesia db from c language, mostly this example will help me. in c_session dir there r many files, what r the files required in that dir i need to run that example progrmme, can any one help me, i thank u ________________________________________________________________________ Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com From erlang@REDACTED Fri Aug 23 13:18:15 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 23 Aug 2002 12:18:15 +0100 Subject: Resource leak in graphics system? Message-ID: <3D6619F7.80903@manderp.freeserve.co.uk> Hi everyone, I've a query about the memory usage of the graphics system which appears to grow without end! The offending processes are gs_frontend, gstk, and et_viewer. Is there something I ought to be doing to plug what appears to be a resource leak? Is there a simple way I can ensure that a node will not employ any graphic system? Is this a known "feature" of Erlang/Tk? Pete. From erlang@REDACTED Fri Aug 23 13:52:30 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 23 Aug 2002 12:52:30 +0100 Subject: Resource leak in graphics system? References: <3D6619F7.80903@manderp.freeserve.co.uk> Message-ID: <3D6621FE.4020000@manderp.freeserve.co.uk> Hello again, It's Friday, I'm not thinking clearly. I've just turned of Event Tracer, and behold! Memory consumption has fallen to a much more reasonable rate. Sorry! Peter-Henry Mander wrote: > Hi everyone, > > I've a query about the memory usage of the graphics system which > appears to grow without end! The offending processes are gs_frontend, > gstk, and et_viewer. Is there something I ought to be doing to plug > what appears to be a resource leak? Is there a simple way I can ensure > that a node will not employ any graphic system? Is this a known > "feature" of Erlang/Tk? > > Pete. > > > > > From hakan@REDACTED Fri Aug 23 13:59:19 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 23 Aug 2002 13:59:19 +0200 (MEST) Subject: Resource leak in graphics system? In-Reply-To: <3D6619F7.80903@manderp.freeserve.co.uk> Message-ID: On Fri, 23 Aug 2002, Peter-Henry Mander wrote: Pete> I've a query about the memory usage of the graphics system which appears Pete> to grow without end! The offending processes are gs_frontend, gstk, and Pete> et_viewer. Is there something I ought to be doing to plug what appears Pete> to be a resource leak? Is there a simple way I can ensure that a node Pete> will not employ any graphic system? Is this a known "feature" of Erlang/Tk? Do you have lots of events in your et_viewer canvas? How big is the et_viewer process? How big is the et_events table? If you are viewing large amounts of trace data, the et_viewer tool can grow quite big (hundreds of megabyte). It should not not grow without end though. You may consider to use the max_events option of et_viewer, to limit the internal cache of the tool. Instead of having a huge canvas with a scrollbar, the max_events can be used to obtain a small canvas and instead scroll with the f/p/l/n/r keys. In this way the number of graphical objects will be much lesser. /H?kan From Jozsef.Berces@REDACTED Fri Aug 23 14:17:50 2002 From: Jozsef.Berces@REDACTED (Jozsef Berces (QCZ)) Date: Fri, 23 Aug 2002 14:17:50 +0200 Subject: Source from beam files? Message-ID: <9CC6CC2973F2D211B3580008C70DB2D203B04BD6@eatvint903.dsa.ericsson.se> Hi, Is it possible to reconstruct the erlang source from a beam file? Is the beam file format documented? Obviously, it must be, so is it public? Thanks, Jozsef From matthias@REDACTED Fri Aug 23 14:43:59 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 23 Aug 2002 14:43:59 +0200 Subject: Source from beam files? In-Reply-To: <9CC6CC2973F2D211B3580008C70DB2D203B04BD6@eatvint903.dsa.ericsson.se> References: <9CC6CC2973F2D211B3580008C70DB2D203B04BD6@eatvint903.dsa.ericsson.se> Message-ID: <15718.11791.359108.488087@antilipe.corelatus.se> Jozsef Berces (QCZ) writes: > Is it possible to reconstruct the erlang source from a beam file? > Is the beam file format documented? Obviously, it must be, so is it public? >From the FAQ: 3.6 [...] The internals of the BEAM file format are described on Bj?rn's homepage (http://www.ericsson.com/cslab/~bjorn/beam_file_format.html). There was some discussion about reconstructing source from .beam files on the mailing list a couple of years ago. A bit of searching through the online mailing list archive would probably get you some more clues. Maybe someone can remember when the discussion was. Matthias From erlang@REDACTED Fri Aug 23 15:33:53 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 23 Aug 2002 14:33:53 +0100 Subject: Resource leak in graphics system? References: Message-ID: <3D6639C1.6010804@manderp.freeserve.co.uk> Thanks H?kan, I solved the "problem" by disabling the Event Trace. I've made a note of what you said, but at this stage of the project, I'm relying less and less on ET, so I may leave it out in future. I'm now attempting to minimise variations in the callflow rate between a Media Gateway Controller and a Media Gateway. What I call a callflow is a series of Megaco transaction such as add, modify and subtract-all. The rate fluctuates between 200 and 350 per second, which isn't bad (I think). It may simply be caused by respawning processes instead of reusing them, causing unnecessary garbage collection. I'm still investigating this... Megaco performance-testing equipment I've looked at can achieve max 500/sec with dedicated hardware, but it lacks the flexibility I require. If I can achieve 300+ sustained using Erlang, I'll be sooooo pleased! The documentation mentions that the MGC may be implemented to run as distributed nodes, it looks as if this is the way for me to go. Do you know how much speed improvement can be achieved this way? Pete. Hakan Mattsson wrote: >On Fri, 23 Aug 2002, Peter-Henry Mander wrote: > >Pete> I've a query about the memory usage of the graphics system which appears >Pete> to grow without end! The offending processes are gs_frontend, gstk, and >Pete> et_viewer. Is there something I ought to be doing to plug what appears >Pete> to be a resource leak? Is there a simple way I can ensure that a node >Pete> will not employ any graphic system? Is this a known "feature" of Erlang/Tk? > >Do you have lots of events in your et_viewer canvas? >How big is the et_viewer process? >How big is the et_events table? > >If you are viewing large amounts of trace data, the et_viewer tool can >grow quite big (hundreds of megabyte). It should not not grow without >end though. > >You may consider to use the max_events option of et_viewer, to limit >the internal cache of the tool. Instead of having a huge canvas with a >scrollbar, the max_events can be used to obtain a small canvas and >instead scroll with the f/p/l/n/r keys. In this way the number of >graphical objects will be much lesser. > >/H?kan > > > > From Sean.Hinde@REDACTED Fri Aug 23 15:53:31 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 23 Aug 2002 14:53:31 +0100 Subject: Source from beam files? Message-ID: <04D356A3B172D611981B0008C791C3126BF2F8@imp02mbx.t-mobile.co.uk> > Jozsef Berces (QCZ) writes: > > > Is it possible to reconstruct the erlang source from a beam file? > > Is the beam file format documented? Obviously, it must be, > so is it public? > > From the FAQ: > > 3.6 [...] The internals of the BEAM file format are described > on Bj?rn's > homepage > (http://www.ericsson.com/cslab/~bjorn/beam_file_format.html). > > There was some discussion about reconstructing source from .beam files > on the mailing list a couple of years ago. A bit of searching through > the online mailing list archive would probably get you some more > clues. Maybe someone can remember when the discussion was. If you were using a version of the compiler which set the debug_info option by default, or you set this when you compiled the file the source code is included in the beam file. You can use the beam_lib module to re-extract the abstract code if it is in there Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From richardc@REDACTED Mon Aug 26 17:44:09 2002 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 26 Aug 2002 17:44:09 +0200 (MET DST) Subject: I/O streams In-Reply-To: Message-ID: Here is a hack that I put pogether since it surprised me that there does not seem to exist a generic stream/pipe implementation in Erlang. (This is probably because it's not quite as useful in Erlang as elsewhere, but it is good to have when you otherwise would be forced to write temporary files.) If you find this useful, you might want to help clean it up so that it could become a standard component in the Erlang libraries, or at least a decent User Contribution at www.erlang.org. It is supposed to work as a normal Erlang I/O stream, handle multiple readers/writers, and have an unactivity timeout limit for self-termination. Read-requests block until they can be satisfied, either by more characters being written, or by EOF. I don't claim to be an I/O expert, so please don't flame me too hard. (Especially if this is already implemented by someone else.) /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ -------------- next part -------------- %% Hack-ish implementation of I/O streams in Erlang. %% Copyright (C) 2002 Richard Carlsson -module(iostream). -export([open/0, open/1, open_link/0, open_link/1, string/1, string/2, close/1]). -compile(export_all). -define(DEF_TIMEOUT, 60000). open() -> open(?DEF_TIMEOUT). open(T) -> spawn(fun () -> loop({buffer, buf__new()}, T) end). open_link() -> open_link(?DEF_TIMEOUT). open_link(T) -> spawn_link(fun () -> loop({buffer, buf__new()}, T) end). string(Chars) -> string(Chars, ?DEF_TIMEOUT). string(Chars, T) -> spawn(fun () -> loop({buffer, buf__close(buf__new(Chars))}, T) end). close(Pid) -> Pid ! close, ok. kill(Pid) -> Pid ! halt, ok. loop(State, Timeout) -> receive {io_request, From, ReplyAs, Request} when pid(From) -> loop(io_request(Request, From, ReplyAs, State), Timeout); close -> loop(close_request(State), Timeout); halt -> exit(normal); _Other -> loop(State, Timeout) after Timeout -> exit(timed_out) end. close_request({buffer, Buf}) -> {buffer, buf__close(Buf)}; close_request({transfer, Reqs, Buf}) -> Buf1 = buf__close(Buf), {R, Reqs1} = buf__get(Reqs), transfer(R, eof, Buf1, Reqs1), {buffer, Buf1}. io_request(Req, From, ReplyAs, State) -> case handle_request(Req, From, ReplyAs, State) of {ok, Reply, State1} -> io_reply(From, ReplyAs, Reply), State1; {later, State1} -> State1; {error, _Reason, State1} -> State1 end. io_reply(From, ReplyAs, Reply) -> From ! {io_reply, ReplyAs, Reply}. handle_request({put_chars, Chars}, _From, _ReplyAs, {buffer, Buf} = State) -> case buf__is_open(Buf) of true -> Buf1 = buf__write(Chars, Buf), {ok, ok, {buffer, Buf1}}; false -> {ok, {error, closed}, State} end; handle_request({put_chars, Chars}, _From, _ReplyAs, {transfer, Reqs, Buf} = State) -> case buf__is_open(Buf) of true -> {R, Reqs1} = buf__get(Reqs), transfer(R, Chars, Buf, Reqs1); false -> {ok, {error, closed}, State} end; handle_request({put_chars, Mod, Func, Args}, From, ReplyAs, State) -> handle_request({put_chars, catch apply(Mod, Func, Args)}, From, ReplyAs, State); handle_request({get_until, _Prompt, M, F, As}, From, ReplyAs, {buffer, Buf}) -> get_until(From, ReplyAs, M, F, As, [], Buf); handle_request({get_until, _Prompt, M, F, As}, From, ReplyAs, {transfer, Reqs, Buf}) -> {later, {transfer, buf__put({From, ReplyAs, M, F, As, []}, Reqs), Buf}}; handle_request({requests, Reqs}, From, ReplyAs, State) -> io_requests(Reqs, From, ReplyAs, {ok, ok, State}); handle_request(R, _From, _ReplyAs, State) -> {ok, {error, {request, R}}, State}. %% Process a list of output requests as long as the status is 'ok'. io_requests([R | Rs], From, ReplyAs, {ok, _, State}) -> io_requests(Rs, From, ReplyAs, io_request(R, From, ReplyAs, State)); io_requests(_, _, _, Final) -> Final. %% Beginning a 'get_until' request received in "buffer" state. get_until(From, ReplyAs, Mod, Func, Args, Cont, Buf) -> {Chars, Buf1} = buf__read(Buf), case catch apply(Mod, Func, [Cont, Chars | Args]) of {done, Result, Chars1} -> {ok, Result, {buffer, buf__push(Chars1, Buf1)}}; {more, Cont1} -> case buf__is_open(Buf1) of true -> {later, {transfer, buf__new([{From, ReplyAs, Mod, Func, Args, Cont1}]), Buf1}}; false -> get_until(From, ReplyAs, Mod, Func, Args, Cont1, Buf1) end; _Other -> {error, {error, {Mod, Func, Args}}, {buffer, buf__push(Chars, Buf1)}} end. %% Resuming an active 'get_until' request when new chars (or EOF) have %% arrived. (Note that the buffer is empty here.) transfer(R, [], Buf, Reqs) -> %% Don't send empty strings to the consumer function; %% instead return directly and wait for more characters. {ok, ok, {transfer, buf__push([R], Reqs), Buf}}; transfer({From, ReplyAs, Mod, Func, Args, Cont}, Chars, Buf, Reqs) -> case catch apply(Mod, Func, [Cont, Chars | Args]) of {done, Result, Chars1} -> io_reply(From, ReplyAs, Result), %% reply to read-request case buf__get(Reqs) of {empty, _} -> {ok, ok, {buffer, buf__push(Chars1, Buf)}}; {R, Reqs1} -> transfer(R, Chars1, Buf, Reqs1) end; {more, Cont1} -> {ok, ok, {transfer, buf__push([{From, ReplyAs, Mod, Func, Args, Cont1}], Reqs), Buf}}; _Other -> {error, {error, {Mod, Func, Args}}, {buffer, buf__push(Chars, Buf)}} end. %% An efficient functional buffer with 1-level constant time push-back. buf__new() -> {[], [], [], true}. buf__new(Ps) -> {[], [], Ps, true}. buf__close({In, Out, Ps, _}) -> {In, Out, Ps, false}. buf__is_open({_, _, _, Open}) -> Open. buf__put(X, {In, Out, Ps, true}) -> {[X | In], Out, Ps, true}. buf__write(List, {In, Out, Ps, true}) -> {flatrev(List, In), Out, Ps, true}. buf__get({In, Out, [X | Ps], Open}) -> {X, {In, Out, Ps, Open}}; buf__get({In, [X | Out], [], Open}) -> {X, {In, Out, [], Open}}; buf__get({[], [], [], true} = Buf) -> {empty, Buf}; buf__get({[], [], [], false} = Buf) -> {eof, Buf}; buf__get({In, [], [], Open}) -> [X | Out] = lists:reverse(In), {X, {[], Out, [], Open}}. buf__read({[], [], [], false} = Buf) -> {eof, Buf}; buf__read({[], [], [], true} = Buf) -> {[], Buf}; buf__read({[], [], Ps, Open}) -> {Ps, {[], [], [], Open}}; buf__read({In, Out, Ps, Open}) -> {Ps ++ lists:reverse(In, Out), {[], [], [], Open}}. buf__push(Ps, {In, Out, [], Open}) -> {In, Out, Ps, Open}; buf__push(Ps, {In, Out, Ps1, Open}) -> {In, Out, Ps ++ Ps1, Open}. flatrev(Xs, Tail) -> flatrev(Xs, [], Tail). flatrev([L | Xs], Ls, Tail) when list(L) -> flatrev(L, [Xs | Ls], Tail); flatrev([X | Xs], Ls, Tail) -> flatrev(Xs, Ls, [X | Tail]); flatrev([], [Xs | Ls], Tail) -> flatrev(Xs, Ls, Tail); flatrev([], [], Tail) -> Tail. From cyberlync@REDACTED Mon Aug 26 17:46:04 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 26 Aug 2002 08:46:04 -0700 (PDT) Subject: Beam file format questions. Message-ID: <20020826154604.92844.qmail@web40205.mail.yahoo.com> Hello all, I am attempting to parse the beam files generated by the erlang 8-2 compiler. My purpose here is to extract a list of exported functions from the beam file. It is proving a bit interesting, overall. I looked at the information provided by Mr. Gustavsson here -> http://www.ericsson.com/cslab/~bjorn/beam_file_format.html I figured it should be pretty easy to parse, but I ran into some difficulties. First, the 'Atom' and 'Code' chunks seem to have an extra two null bytes padded onto the end of thier chunks (beyond the length specified in the chunk header). The other chunks seem to obey the format specified in the above document. It could very well be that I am just a bit off in the head and missing something. Hopefully, one of you will confirm. Second, the 'ExpT' chunks doesn't seem too useful to me at all. I am exporting two functions in my test code, so accoring to the spec there should be a total of 24 bytes (12 bytes per exported function '3*4') of information after the chunk header, in mine there are 52 bytes. I hope one of you with a little more insight and experience can explain where I am screwing up. Following is some code I am using to generate the beam file I am testing with, it doesn't do anything at all really except produce a beam file. ----------------------------------------------------- -module(test). -export([test/0, this_is_a_test/1]). test() -> {ok, this_is_a_test, 'google'}. this_is_a_test(Ok) -> ok. ----------------------------------------------------- Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From happi@REDACTED Mon Aug 26 18:04:33 2002 From: happi@REDACTED (Happi) Date: Mon, 26 Aug 2002 18:04:33 +0200 Subject: Beam file format questions. References: <20020826154604.92844.qmail@web40205.mail.yahoo.com> Message-ID: <002601c24d1a$44d392c0$c90b0a0a@LISA> The exported functions you can get by: > test:module_info(exports). [{test,0},{this_is_a_test,1},{module_info,0},{module_info,1}] If you want more info from the beam file you might want to look into beam_disasm: > beam_disasm:file(test). {beam_file,[{exports,[{module_info,1,8}, {module_info,0,6}, {this_is_a_test,1,4}, {test,0,2}]}, {imports,[]}, {code,[[{label,1}, {func_info,[{atom,test},{atom,test},0]}, {label,2}, {test_heap,4,0}, {put_tuple,3,{x,0}}, {put,{atom,ok}}, {put,{atom,this_is_a_test}}, {put,{atom,google}}, return], [{label,3}, {func_info,[{atom,test},{atom,this_is_a_test},1]}, {label,4}, {move,{atom,ok},{x,0}}, return], [{label,5}, {func_info,[{atom,test},{atom,module_info},0]}, {label,6}, {move,nil,{x,0}}, return], [{label,7}, {func_info,[{atom,test},{atom,module_info},1]}, {label,8}, {move,nil,{x,0}}, return]]}, {atoms,[{1,test}, {2,ok}, {3,this_is_a_test}, {4,google}, {5,module_info}]}, {local_funs,[]}, {strings,[]}, {attributes,[{vsn,[27859361916344551882987425212895222028]}]}, {comp_info,[{options,[v3,nowarn_shadow_vars,warn_unused_vars]}, {version,"2002.08.14"}, {time,{2002,8,26,15,54,54}}]}]} or if you have a hipe system and whant to see the beam code prettyprinted: > hipe:c(test,[pp_beam,no_load]). label 1: {func_info,[{atom,test},{atom,test},0]} label 2: {test_heap,4,0} {put_tuple,3,{x,0}} {put,{atom,ok}} {put,{atom,this_is_a_test}} {put,{atom,google}} return label 3: {func_info,[{atom,test},{atom,this_is_a_test},1]} label 4: {move,{atom,ok},{x,0}} return label 5: {func_info,[{atom,test},{atom,module_info},0]} label 6: {move,nil,{x,0}} return label 7: {func_info,[{atom,test},{atom,module_info},1]} label 8: {move,nil,{x,0}} return Good luck, Erik Stenman -------------------------------------- I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. ----- Original Message ----- From: "Eric Merritt" To: Sent: Monday, August 26, 2002 5:46 PM Subject: Beam file format questions. > Hello all, > > I am attempting to parse the beam files generated by > the erlang 8-2 compiler. My purpose here is to extract > a list of exported functions from the beam file. It is > proving a bit interesting, overall. I looked at the > information provided by Mr. Gustavsson here -> > > http://www.ericsson.com/cslab/~bjorn/beam_file_format.html > > I figured it should be pretty easy to parse, but I > ran into some difficulties. > > First, the 'Atom' and 'Code' chunks seem to have an > extra two null bytes padded onto the end of thier > chunks (beyond the length specified in the chunk > header). The other chunks seem to obey the format > specified in the above document. It could very well be > that I am just a bit off in the head and missing > something. Hopefully, one of you will confirm. > > Second, the 'ExpT' chunks doesn't seem too useful to > me at all. I am exporting two functions in my test > code, so accoring to the spec there should be a total > of 24 bytes (12 bytes per exported function '3*4') of > information after the chunk header, in mine there are > 52 bytes. I hope one of you with a little more insight > and experience can explain where I am screwing up. > Following is some code I am using to generate the beam > file I am testing with, it doesn't do anything at all > really except produce a beam file. > > ----------------------------------------------------- > > -module(test). > > -export([test/0, this_is_a_test/1]). > > test() -> > {ok, this_is_a_test, 'google'}. > > this_is_a_test(Ok) -> > ok. > > ----------------------------------------------------- > > Thanks, > Eric > > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > From kostis@REDACTED Mon Aug 26 18:08:09 2002 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 26 Aug 2002 18:08:09 +0200 (MET DST) Subject: Beam file format questions. In-Reply-To: Mail from 'Eric Merritt ' dated: Mon, 26 Aug 2002 08:46:04 -0700 (PDT) Message-ID: <200208261608.SAA17525@harpo.it.uu.se> Eric Merritt wrote: > I am attempting to parse the beam files generated by > the erlang 8-2 compiler. My purpose here is to extract > a list of exported functions from the beam file. It is > proving a bit interesting, overall. > .... > I figured it should be pretty easy to parse, but I > ran into some difficulties. For the purposes of the HiPE compiler, I've written a BEAM disassembler that is generic and is ever since R8 included in the Erlang/OTP distribution. It can be used as: beam_disasm:file(FileName). It does exactly what you are looking for, and can be a very good starting point for reconstructing the Erlang source from the BEAM file (as requested in some other thread). Since I am the author of the "beam_disasm" module, please let me know if extending its functionality is desirable. Cheers, Kostis. From cyberlync@REDACTED Mon Aug 26 19:52:40 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 26 Aug 2002 10:52:40 -0700 (PDT) Subject: Beam file format questions. In-Reply-To: <200208261608.SAA17525@harpo.it.uu.se> Message-ID: <20020826175240.22379.qmail@web40203.mail.yahoo.com> Kostis, Thanks guys this really helped me out, I couldn't use the code directly as I needed it for a java app, but it did point me in the right direction. One thing that is still up in the air though is the extra null bytes at the end of the Atom and Code chunks. For the moment, I am just skiping ahead to the next non-null bytes, but the fact that these bytes exist bother me a bit. Could someone explain why they are there? So far I have seen only one or two bytes. --- Kostis Sagonas wrote: > Eric Merritt wrote: > > > I am attempting to parse the beam files > generated by > > the erlang 8-2 compiler. My purpose here is to > extract > > a list of exported functions from the beam file. > It is > > proving a bit interesting, overall. > > .... > > I figured it should be pretty easy to parse, but > I > > ran into some difficulties. > > > For the purposes of the HiPE compiler, I've written > a BEAM > disassembler that is generic and is ever since R8 > included > in the Erlang/OTP distribution. It can be used as: > > beam_disasm:file(FileName). > > It does exactly what you are looking for, and can be > a very good > starting point for reconstructing the Erlang source > from the BEAM > file (as requested in some other thread). > > Since I am the author of the "beam_disasm" module, > please let me > know if extending its functionality is desirable. > > Cheers, > Kostis. > __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From cyberlync@REDACTED Mon Aug 26 19:53:55 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 26 Aug 2002 10:53:55 -0700 (PDT) Subject: Beam file format questions. Message-ID: <20020826175355.66188.qmail@web40202.mail.yahoo.com> Kostis, Thanks guys this really helped me out, I couldn't use the code directly as I needed it for a java app, but it did point me in the right direction. One thing that is still up in the air though is the extra null bytes at the end of the Atom and Code chunks. For the moment, I am just skiping ahead to the next non-null bytes, but the fact that these bytes exist bother me a bit. Could someone explain why they are there? So far I have seen only one or two bytes. --- Kostis Sagonas wrote: > Eric Merritt wrote: > > > I am attempting to parse the beam files > generated by > > the erlang 8-2 compiler. My purpose here is to > extract > > a list of exported functions from the beam file. > It is > > proving a bit interesting, overall. > > .... > > I figured it should be pretty easy to parse, but > I > > ran into some difficulties. > > > For the purposes of the HiPE compiler, I've written > a BEAM > disassembler that is generic and is ever since R8 > included > in the Erlang/OTP distribution. It can be used as: > > beam_disasm:file(FileName). > > It does exactly what you are looking for, and can be > a very good > starting point for reconstructing the Erlang source > from the BEAM > file (as requested in some other thread). > > Since I am the author of the "beam_disasm" module, > please let me > know if extending its functionality is desirable. > > Cheers, > Kostis. > __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From jamesh@REDACTED Mon Aug 26 20:53:55 2002 From: jamesh@REDACTED (James Hague) Date: Mon, 26 Aug 2002 13:53:55 -0500 Subject: Documentation suggestion Message-ID: In the list of applications in the left frame of the HTML docs, put "kernel" and "stdlib" at the top of the list, separated from the rest of the application by a blank line. Two reasons: 1. I don't think of "stdlib" or "kernel" as applications. 2. 99% of the time I use the docs it is for one of these two things. Arguably, there should be a section labeled "Erlang Core"--or somesuch--above "Applications," containing the entries "kernel" and "stdlib." This suggestion is motiviated by purely selfish reasons. From cyberlync@REDACTED Mon Aug 26 22:02:32 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 26 Aug 2002 13:02:32 -0700 (PDT) Subject: Beam file format questions. - boy am I an idiot Message-ID: <20020826200232.44723.qmail@web40203.mail.yahoo.com> Sorry guys, I finally figured out where the extra null bytes were coming from. It seems I missed this sentance in the spec 'I use four-byte alignment instead'. So the chunks are on a four byte boundry, that boundry material was where the null bytes were coming from. I should have noticed this particular piece of information but I didn't. I am sorry for cluttering your inbox. As for the other issue, thanks for pointing my to the beam_disasm module. That particular module clear up some things for me as well. Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From vances@REDACTED Tue Aug 27 05:08:29 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 26 Aug 2002 23:08:29 -0400 Subject: Building R8B-2 as a 64-bit application on sparcv9 Message-ID: <20020827030829.GD35854@frogman.motivity.ca> Has anyone built Erlang/OTP as a 64-bit application on the sparcv9? I need at least the erl_interface libraries to be built as 64-bit as it is not possible to link 32-bit libraries with 64-bit libraries. I have device driver API libraries which are, necessarily, 64-bit. -Vance From kent@REDACTED Tue Aug 27 06:25:13 2002 From: kent@REDACTED (Kent Boortz) Date: 27 Aug 2002 06:25:13 +0200 Subject: Building R8B-2 as a 64-bit application on sparcv9 In-Reply-To: <20020827030829.GD35854@frogman.motivity.ca> References: <20020827030829.GD35854@frogman.motivity.ca> Message-ID: Vance Shipley writes: > Has anyone built Erlang/OTP as a 64-bit application on the sparcv9? > > I need at least the erl_interface libraries to be built as 64-bit > as it is not possible to link 32-bit libraries with 64-bit libraries. > I have device driver API libraries which are, necessarily, 64-bit. We are as a first step doing an unoptimized port of Erlang/OTP to 64-bits but don't know how much will be ready when we release R9 in October. You can follow the progress in the P9 snapshots, some builds will be very broken for 64 bits, others will work quite well (a large part of the emulator test suites succeeds). We use gcc 3.1.1, sparcv9 and Solaris 8 for the daily build and test of the 64 bit Erlang/OTP. I don't think we have looked into erl_interface and 64 bits yet, kent From bjorn@REDACTED Tue Aug 27 08:49:51 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 27 Aug 2002 08:49:51 +0200 Subject: Beam file format questions. In-Reply-To: Eric Merritt's message of "Mon, 26 Aug 2002 08:46:04 -0700 (PDT)" References: <20020826154604.92844.qmail@web40205.mail.yahoo.com> Message-ID: You might find it easier to use the beam_lib module in stdlib instead of writing your own code. /Bjorn Eric Merritt writes: > > First, the 'Atom' and 'Code' chunks seem to have an > extra two null bytes padded onto the end of thier > chunks (beyond the length specified in the chunk > header). The other chunks seem to obey the format > specified in the above document. It could very well be > that I am just a bit off in the head and missing > something. Hopefully, one of you will confirm. Chunks are aligned to a four-byte boundary. I think that is mentioned in the specification. > > Second, the 'ExpT' chunks doesn't seem too useful to > me at all. I am exporting two functions in my test > code, so accoring to the spec there should be a total > of 24 bytes (12 bytes per exported function '3*4') of > information after the chunk header, in mine there are > 52 bytes. I hope one of you with a little more insight > and experience can explain where I am screwing up. > Following is some code I am using to generate the beam > file I am testing with, it doesn't do anything at all > really except produce a beam file. The compiler always generates two extra functions in each module: module_info/0,1. -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From tobbe@REDACTED Tue Aug 27 08:57:55 2002 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: 27 Aug 2002 08:57:55 +0200 Subject: I/O streams In-Reply-To: References: Message-ID: Talking about streams. Just for the fun of it, here's an old hack that the great Phil Wadler helped me out with once. Some examples: %% Get the first 7 primes 1> S=ns:first(7,ns:primes()). #Fun 2> ns:stream_to_list(S). [2,3,5,7,11,13,17] %% Example of appending streams 3> ns:stream_to_list(ns:first(8,ns:append(ns:first(5,ns:naturals()), ns:first(5,ns:naturals())))). [0,1,2,3,4,0,1,2] %% Random number generation 4> ns:stream_to_list( ns:first(10, ns:map(fun(X)-> round(X) end, ns:scale(100,ns:random_numbers(random:seed()))))). [9,44,72,95,50,31,60,92,67,48] %% Approx. of PI (the further you look into the stream the better approx.) 5> ns:stream_to_list(ns:first(10,ns:pi())). [2.44949, 2.44949, 2.44949, 2.82843, 2.73861, 3.00000, 3.24037, 3.46410, 3.28634, 3.16228] Cheers /Tobbe -module(ns). -author('tobbe@REDACTED'). %%-export([start/0]). -compile(export_all). -define( return(X) , fun() -> X end ). -define( force(X) , begin XXXfunnyvar=X, XXXfunnyvar() end ). -define( vforce(V,X) , begin V=X, V() end ). -define( bind(X,D,K) , fun() -> X=?vforce(XXXfunnyvar1,D), ?vforce(XXXfunnyvar2,K) end ). -define( cons(H,T) , ?return({cons,H,T}) ). -define( nil(), ?return(nil) ). %% A lazy first... first(0,_) -> ?nil(); first(N,S) when N>0 -> ?bind(S1,S, case S1 of nil -> ?nil(); {cons,H,T} -> ?cons(H,first(N-1,T)) end). %% 24> statistics(reductions),ns:first(7,ns:primes()),statistics(reductions). %% {1705891,61} %% 25> statistics(reductions),ns:stream_to_list(ns:first(7,ns:primes())),statistics(reductions). %% {1708314,616} %% 6> statistics(reductions),streams:first(7,streams:primes()),statistics(reductions). %% {1712785,576} nth(0,S) -> case ?force(S) of {cons,H,T} -> H end; nth(N,S) when N>0 -> case ?force(S) of {cons,_,T} -> nth(N-1,T) end. map(F,S) -> ?bind(S1,S, case S1 of nil -> ?nil(); {cons,H,T} -> ?cons(F(H),map(F,T)) end). scale(C,S) -> map(fun(X) -> X*C end,S). double(S) -> scale(2,S). %% Example: %% %% 15> ns:stream_to_list(ns:first(8,ns:append(ns:first(5,ns:naturals()),ns:first(5,ns:naturals())))). %% [0,1,2,3,4,0,1,2] %% 77> statistics(reductions),ns:stream_to_list(ns:first(8,ns:append(ns:naturals(),ns:naturals()))),statistics(reductions). %% {1909897,270} %% 78> statistics(reductions),ns:lf(8,lists:append(lists:seq(1,500),lists:seq(1,500))),statistics(reductions). %% {1919732,1157} append(S,R) -> ?bind(S1,S, case S1 of nil -> R; {cons,H,T} -> ?cons(H,append(T,R)) end). naturals() -> integers_starting_from(0). integers_starting_from(N) -> ?cons(N,integers_starting_from(N+1)). primes() -> sieve(integers_starting_from(2)). sieve(S) -> ?bind(S1,S, (case S1 of nil -> ?nil(); {cons,H,T} -> Pred = fun(X) -> 'not'(divisible(X,H)) end, ?cons(H,sieve(filter(Pred,T))) end)). filter(Pred,S) -> ?bind(S1,S, case S1 of nil -> ?nil(); {cons,H,T} -> case Pred(H) of true -> ?cons(H,filter(Pred,T)); false -> filter(Pred,T) end end). divisible(X,Y) -> if X rem Y == 0 -> true; true -> false end. 'not'(true) -> false; 'not'(false) -> true. gcd(A,0) -> A; gcd(A,B) -> gcd(B,A rem B). %% Try this: %% 22> ns:stream_to_list(ns:first(10,ns:map(fun(X)-> round(X) end,ns:scale(100,ns:random_numbers(random:seed()))))). %% [9,44,72,95,50,31,60,92,67,48] random_numbers(Seed) -> ?cons(random:uniform(),random_numbers(Seed)). cesaro_stream() -> F = fun(R1,R2) -> case gcd(R1,R2) of 1 -> true; _ -> false end end, map_successive_pairs(F,map(fun(X)-> round(X) end,scale(100,random_numbers(random:seed())))). map_successive_pairs(F,S) -> ?bind(S1,S, case S1 of {cons,H,T} -> case ?force(T) of {cons,H2,T2} -> ?cons(F(H,H2), map_successive_pairs(F,T2)) end end). monte_carlo(S,Nt,Nf) -> ?bind(S1,S, (case S1 of {cons,H,T} -> Next = fun(Nnt,Nnf) -> Q = Nnt+Nnf, ?cons(Nnt/Q,monte_carlo(T,Nnt,Nnf)) end, case H of true -> Next(Nt+1,Nf); false -> Next(Nt,Nf+1) end end)). %% An approximation of pi. %% We will use the fact that the probability that %% two integers choosen at random will have no factors %% in common (i.e their GCD is 1) is 6/pi**2. The %% fraction of times the test is passed gives us an %% estimate of this probability. So the further you %% look into the stream, the better approximation you'll get. pi() -> map(fun(P) -> math:sqrt(6/P) end, monte_carlo(cesaro_stream(),0,0)). %% Converting routines: streams <--> lists stream_to_list(S) -> case ?force(S) of {cons,H,T} -> [H|stream_to_list(T)]; nil -> [] end. list_to_stream([H|T]) -> ?cons(H,list_to_stream(T)); list_to_stream([]) -> ?nil(). %% Misc. routines rv(File,NewFile) when list(File) -> M = erl_kernel:file(File), {ok,T,_} = erl_kernel:module(M), {ok,F} = file:open(NewFile,write), erl_kernel:pp(T,F), file:close(F). lf(0,_) -> []; lf(N,[H|T]) -> [H|lf(N-1,T)]. From cyberlync@REDACTED Tue Aug 27 14:55:15 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 27 Aug 2002 05:55:15 -0700 (PDT) Subject: Beam file format questions. In-Reply-To: Message-ID: <20020827125515.89591.qmail@web40208.mail.yahoo.com> Bjorn, I now doubt would find it much easier. However, the application I am using it for (code assist in an eclipse plugin) is, becuase of Eclipse, all java. In any case, I am done now. I figured out my problem. It seams that that the beam file format uses a four byte boundry (I missed that the first time around) and thats where the nulls were coming in. Once I figured that out it only took me a little time to finish up the parser. The format itself is pretty easy to parse once you make that realization. Thanks, Eric --- Bjorn Gustavsson wrote: > You might find it easier to use the beam_lib module > in stdlib > instead of writing your own code. > > /Bjorn > > Eric Merritt writes: > > > > > First, the 'Atom' and 'Code' chunks seem to have > an > > extra two null bytes padded onto the end of thier > > chunks (beyond the length specified in the chunk > > header). The other chunks seem to obey the format > > specified in the above document. It could very > well be > > that I am just a bit off in the head and missing > > something. Hopefully, one of you will confirm. > > Chunks are aligned to a four-byte boundary. I think > that is mentioned in the specification. > > > > > Second, the 'ExpT' chunks doesn't seem too useful > to > > me at all. I am exporting two functions in my test > > code, so accoring to the spec there should be a > total > > of 24 bytes (12 bytes per exported function '3*4') > of > > information after the chunk header, in mine there > are > > 52 bytes. I hope one of you with a little more > insight > > and experience can explain where I am screwing up. > > Following is some code I am using to generate the > beam > > file I am testing with, it doesn't do anything at > all > > really except produce a beam file. > > The compiler always generates two extra functions in > each module: module_info/0,1. > > -- > Bj?rn Gustavsson Ericsson Utvecklings AB > bjorn@REDACTED ?T2/UAB/F/P > BOX 1505 > +46 8 727 56 87 125 25 ?lvsj? __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From erlang@REDACTED Tue Aug 27 16:05:49 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Tue, 27 Aug 2002 15:05:49 +0100 Subject: Megaco simple Media Gateway bleeds memory under load. Message-ID: <3D6B873D.1020705@manderp.freeserve.co.uk> Hi everyone, I hope you're not going to tire of my questions, as I have yet another one. In megaco_messenger.erl the receive_message/4 function spawns a process for each received message. The problem I have with this scheme is that memory is being consumed by processes spawned in receive_message/4 and garbage-collected at a crippling rate, leading to a bottleneck in the Media Gateway. The MG Controller and MG run on separate machines. The MGC is only consuming 50%-60% CPU and has a small stable memory footprint while issuing over 300 add-modify-subtract request cycles each second, whereas the MG is struggling at 99% and has a huge and ever expanding memory footprint. I managed to streamline the MGC by reusing processes instead of spawning new ones. This has made it efficient enough to potentially achieve over 500 call cycles a second, and I wonder if it were possible to use a similar scheme in receive_message/4 and use a pool of "process received message" processes instead of continually spawning new ones? Are there any issues I must be aware of before I start "hacking" megaco_messenger.erl? Is there a better way than my (possibly naive) proposal? Pete. From luke@REDACTED Tue Aug 27 16:45:31 2002 From: luke@REDACTED (Luke Gorrie) Date: 27 Aug 2002 16:45:31 +0200 Subject: Debugger API, compatibility between R7 and R8 In-Reply-To: <3D1AC457.E34CB91B@arendt.se> References: <3D1AC457.E34CB91B@arendt.se> Message-ID: In an old thread, Gunilla Arendt writes: > This means that it should now be a lot easier to write a new > interpreter front-end, but it also means that 2.0 is not compatible > at all with the older versions... It is indeed a nice and easy interface. One suggestion: perhaps some more functions in `int' that send messages to dbg_iserver should ensure that it's already started (by using e.g. safe_cast instead of cast). I had a bug where I was calling int:subscribe() first of all, which casts to dbg_iserver without checking that it's already started (and gen_server:cast traps/hides the send-to-unregistered-name error). I worked around by calling int:interpreted() first, which does ensure that the server is running, as a side-effect - but I think subscribe() should too. Cheers, Luke From hakan@REDACTED Tue Aug 27 17:30:29 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 27 Aug 2002 17:30:29 +0200 (MEST) Subject: Megaco simple Media Gateway bleeds memory under load. In-Reply-To: <3D6B873D.1020705@manderp.freeserve.co.uk> Message-ID: On Tue, 27 Aug 2002, Peter-Henry Mander wrote: Pete> In megaco_messenger.erl the receive_message/4 function spawns a process Pete> for each received message. The problem I have with this scheme is that Pete> memory is being consumed by processes spawned in receive_message/4 and Pete> garbage-collected at a crippling rate, leading to a bottleneck in the Pete> Media Gateway. Pete> Pete> The MG Controller and MG run on separate machines. The MGC is only Pete> consuming 50%-60% CPU and has a small stable memory footprint while Pete> issuing over 300 add-modify-subtract request cycles each second, whereas Pete> the MG is struggling at 99% and has a huge and ever expanding memory Pete> footprint. Pete> Pete> I managed to streamline the MGC by reusing processes instead of spawning Pete> new ones. This has made it efficient enough to potentially achieve over Pete> 500 call cycles a second, and I wonder if it were possible to use a Pete> similar scheme in receive_message/4 and use a pool of "process received Pete> message" processes instead of continually spawning new ones? Pete> Pete> Are there any issues I must be aware of before I start "hacking" Pete> megaco_messenger.erl? Is there a better way than my (possibly naive) Pete> proposal? There are two drawbacks with this: - GC. The system will need to perform more GC compared to the current solution, where the heaps of short lived processes cheaply can be removed instead of doing GC of long lived processes. The inital size of the processes can be regulated with options to megaco_messenger:receive_message/4. - Non-safe congestion handling. The pool solution does not really cope with the case when the MGC is able to outperform the MG. You may possible be able to raise the current limit, but the memory of the MG would eventually be exhausted if the MGC persists. I would try to push the congestion problem into the transport layer. By explicitly blocking the socket (use megaco_tcp:block/1 et al), the sender will back off and the receiver will not hog more resources until you unblock the socket again. It should be possible to keep track of the internal resources such as memory, number of currently handled requests (megaco:system_info(n_active_requests)) etc. and use that info to control the socket. If this is not precise enough, you could hack Megaco's transport modules or simply plug in a brand new one. A public and congestion proof megaco_sctp module would be nice. ;-) /H?kan From erlang@REDACTED Tue Aug 27 18:10:02 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Tue, 27 Aug 2002 17:10:02 +0100 Subject: Megaco simple Media Gateway bleeds memory under load. References: Message-ID: <3D6BA45A.2090405@manderp.freeserve.co.uk> Hi H?kan, Thanks for the speedy reply, you're quickly becoming my mentor! Hakan Mattsson wrote: >There are two drawbacks with this: > >- GC. The system will need to perform more GC compared to > the current solution, where the heaps of short lived > processes cheaply can be removed instead of doing GC of long > lived processes. The inital size of the processes can be > regulated with options to megaco_messenger:receive_message/4. > I'm not sure I understand you here. I know how many the maximum number of concurrent unacknowledged requests is going to be as I have full control over the MGC, so I expect to need a similar number of receive_message processes and possibly a similar number of timeout processes too, which I hope to avoid having collected at all for the duration of the test. I agree that in reality the MG ought to dynamically respond to surges of requests, and release resources when spent, and the current scheme is best for that, but I'm creating a MGC for use as a test tool, and the MG is only being used to simulate the product that will eventually be tested. I would like to push the MGC to the maximum rate to find where its limits are. At the moment I can only speculate that it may achieve 500+ setup/teardowns a second on a single physical PC. >- Non-safe congestion handling. The pool solution does not > really cope with the case when the MGC is able to outperform > the MG. You may possible be able to raise the current limit, > but the memory of the MG would eventually be exhausted if the > MGC persists. > > Well, at the moment the congestion handling may be safe, but I would like to remove all congestion at the MG end if this is possible. It seems to me that the solution may lie in distributing the MG over two or more physical nodes, but I'm unclear how I'm going to achieve this. The Megaco manuals hint at doing exactly this, but I haven't found an example of how to do it. I will need to use distributed nodes for the MGC anyway, to push performance into four-figure setup/teardown rates, so any information or instructions will be very welcome! >I would try to push the congestion problem into the >transport layer. By explicitly blocking the socket (use >megaco_tcp:block/1 et al), the sender will back off and the >receiver will not hog more resources until you unblock the >socket again. > >It should be possible to keep track of the internal resources >such as memory, number of currently handled requests >(megaco:system_info(n_active_requests)) etc. and use that >info to control the socket. > Well, my intentions preclude any use of throttling, so I'll pass on this solution. >If this is not precise enough, you could hack Megaco's >transport modules or simply plug in a brand new one. >A public and congestion proof megaco_sctp module would be >nice. ;-) > > It certainly would! If I had the time... On Tue, 27 Aug 2002, Peter-Henry Mander wrote: Pete> In megaco_messenger.erl the receive_message/4 function spawns a process Pete> for each received message. The problem I have with this scheme is that Pete> memory is being consumed by processes spawned in receive_message/4 and Pete> garbage-collected at a crippling rate, leading to a bottleneck in the Pete> Media Gateway. Pete> Pete> The MG Controller and MG run on separate machines. The MGC is only Pete> consuming 50%-60% CPU and has a small stable memory footprint while Pete> issuing over 300 add-modify-subtract request cycles each second, whereas Pete> the MG is struggling at 99% and has a huge and ever expanding memory Pete> footprint. Pete> Pete> I managed to streamline the MGC by reusing processes instead of spawning Pete> new ones. This has made it efficient enough to potentially achieve over Pete> 500 call cycles a second, and I wonder if it were possible to use a Pete> similar scheme in receive_message/4 and use a pool of "process received Pete> message" processes instead of continually spawning new ones? Pete> Pete> Are there any issues I must be aware of before I start "hacking" Pete> megaco_messenger.erl? Is there a better way than my (possibly naive) Pete> proposal? From cyberlync@REDACTED Tue Aug 27 20:50:35 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 27 Aug 2002 11:50:35 -0700 (PDT) Subject: Debugger API, compatibility between R7 and R8 In-Reply-To: Message-ID: <20020827185035.32301.qmail@web40207.mail.yahoo.com> Guys, There is a debugger API? Is it documented anywhere? Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From shrogers@REDACTED Wed Aug 28 03:37:41 2002 From: shrogers@REDACTED (Steven H. Rogers, Ph.D.) Date: Tue, 27 Aug 2002 20:37:41 -0500 Subject: [Fwd: Re: Erlang killer app?,] Message-ID: <3D6C2965.5090302@ionet.net> -------- Original Message -------- Subject: Re: Erlang killer app?, Date: Tue, 27 Aug 2002 20:36:01 -0500 From: "Steven H. Rogers, Ph.D." Reply-To: steve@REDACTED Organization: S. H. Rogers & Associates To: Mickael Remond References: <1027402777.3d3cec199e610@REDACTED> Mickael Remond wrote: > > I think we also need: > - A page templating system. I made preliminary tests of an Erlang Page > templating system based on ZPT (Zope) and I think it fits well to Erlang. It > seems to be a good choice. > - A way to described the logic of the web application itself. An MVC approach > might be a good choicefor this task. I still need to think about the way to do > it. In Erlang terms, we need a web application behaviour (like OTP behaviours). > - A way to be able to have several independant Web Application running > independantly. J2EE approach is good on this side. You can add a directory with > a config file describing the behaviour of your application and the service it > needs. This way we could for exemple run a new Erlang node to provide a mnesia > database to application that need serialisation mechanism. > > We would have here a good application server that can become a killer app here. > Page templates are one of Zope's better features. Perhaps a distributed weblog server supporting the "Blogger API":http://plant.blogger.com/api/index.html would be a good "killer app" for Erlang. "Weblogs":http://newhome.weblogs.com/historyOfWeblogs are a rapidly growing phenomenon. They could benefit from Erlang's distributed, robust cpabilities. Steve -- email: steve@REDACTED Weblog http://shrogers.com/portal/Members/steve/blog "A language that doesn't affect the way you think about programming is not worth knowing." - Alan Perlis -- email: steve@REDACTED Weblog http://shrogers.com/portal/Members/steve/blog "A language that doesn't affect the way you think about programming is not worth knowing." - Alan Perlis From thomas.lindgren@REDACTED Wed Aug 28 11:58:46 2002 From: thomas.lindgren@REDACTED (Thomas Lindgren) Date: Wed, 28 Aug 2002 11:58:46 +0200 Subject: Fun syntax & language feature poll In-Reply-To: <026801c237ad$8c5a8e50$980cee82@it.uu.se> Message-ID: > Speaking of which, why not remove this feature of Erlang (that a remote call > calls the latest version of loaded code) and instead introduce a special update > call like: > enter_latest foo(...) ? > > > Except in the shell who uses this feature? > If you want to write an application that really supports upgrades you have think this > through and design with it in mind from the beginning anyway. > > Removing this feature would do wonders to the possibilities of optimization... I'm being a month late in replying, but this is a hobby horse of mine and YES, permitting optimization across module boundaries helps quite a bit. Here's why, for those who are interested but not experts. Basically, a compiler does better the more code it has to work with, and it seems to me that in the case of Erlang, you need to cross module boundaries to get enough context. At least my own experience (e.g., EUC'01) shows this very clearly. Here is an example of what can be done. Type analysis is an optimization that permits simplification of primitive operations. When applicable, it yields excellent speedups for Erlang-style languages (Prolog, Lisp, ...). For example, take element(N,X). If nothing is known, the VM must check: - that X is a tuple of size K - that N is an integer in the range 1 =< N =< K - finally, select the appropriate word from the heap and return it. The same kind of tests are done in most BIFs. Often, the code is wrapped in a C function as well, yielding extra overhead for parameter passing. It makes you gnash your teeth to see it. Now assume the analyzer finds that N is a small integer and X is a tuple of known arity. A native-code optimizer can then remove the tests, reducing the element/2 call to a single load. This is good, but there's more: the important but somewhat subtle issue that the compiler can ALSO be more aggressive in inlining primitives (rather than doing C function calls) if it doesn't have to lay out lots of code for the failure cases. Even if the failure code is never executed, it requires more compile-time, reduces the effectiveness of optimizations and messes up the I-cache. I duly did an experiment with type analysis of Erlang several years ago (1997?) and found that PER-MODULE analysis of real code, meaning OTP, is largely useless for this purpose[*]. I furthermore believe this is the case for most real code, since modules are used to structure programs into reusable chunks as well as provide the unit for code loading. Thus, cross-module analysis and optimization are "on the roadmap" for high performance, at least in my book. What to do? A compiler can enable cross-module optimization, say with the transparent module aggregation method I described at EUC'01, AND/OR we can provide some mechanism for programmers to group modules on the language level. Perhaps Richard's hierarchical name spaces, or some suitably modified version thereof, could be drafted for this purpose? Depending on how such an extension is done, we may also have to fix records, since record names often are reused and the scope of a record declaration is somewhat ad hoc. Best, Thomas [*] What does this mean? The analyzer kept a single version of each function, and normally found that nearly all functions could be called with 'anything' for every function argument, i.e., no information. This is equivalent to saying that you could just analyze each function locally, which normally yields few opportunities for type-based optimization. (Another alternative to cross-module analysis is for the analyzer to keep multiple versions of functions; eminently possible, but there is no consensus on how to do this well, AFAIK, nor do we know how well it works.) From jamesh@REDACTED Wed Aug 28 18:21:12 2002 From: jamesh@REDACTED (James Hague) Date: Wed, 28 Aug 2002 11:21:12 -0500 Subject: Fun syntax & language feature poll Message-ID: >Depending on how such an extension is done, >we may also have to fix records, since record >names often are reused and the scope of a record >declaration is somewhat ad hoc. Are any record changes expected in R9? I've been hearing about records becoming separate types (not just tuples) and better record support in the shell for what seems like years now :) From erlang@REDACTED Wed Aug 28 18:39:43 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 28 Aug 2002 17:39:43 +0100 Subject: Megaco simple Media Gateway bleeds memory under load. References: Message-ID: <3D6CFCCF.3010904@manderp.freeserve.co.uk> Thanks again H?kan, I think understand you now, lets see if I got it. With a large enough heap, a spawned process will not require further chunks from system memory, and therefore will not cause garbage collection sweeps, but only while the process doesn't terminate. When the process itself terminates, garbage collection reclaims the process heap and anything else allocated from it in one sweep. Am I correct? If I am, I can understand why it would be more efficient than allocating and freeing small fragments of system memory, and that it would avoid memory fragmentation. But what if the megaco_messenger processes are spawned at a high rate, as they appear to be in the MG when receiving almost 1000 transactions/second? I suspect that memory will get eaten up very quickly by spawned processes with large heaps. Is it possible that the garbage collector process is starved (since CPU usage is 99%) due to the rate at which megaco_messenger processes are being spawned? My idea of maintaining a pool of megaco_messenger may not be an elegant solution, and I may be accused of micro-managing memory as would a C programmer! But I would like to persue it, simply to convince myself, either yes or no, whether this imperative pardigm may have value in a functional language. I'll try to keep you updated on this, and the distributed MG as you describe below, and the Megaco V2 work I mentioned earlier. I wonder, since you seem to still be developing the Megaco stack, whether my feedback is useful to you? I am extremely interested in the partial/distributed decoding you mentioned in the last paragraph. Is there a complementary distributed encoding project in the pipeline? Pete. Hakan Mattsson wrote: >On Tue, 27 Aug 2002, Peter-Henry Mander wrote: > >Pete> I'm not sure I understand you here. I know how many the maximum number >Pete> of concurrent unacknowledged requests is going to be as I have full >Pete> control over the MGC, so I expect to need a similar number of >Pete> receive_message processes and possibly a similar number of timeout >Pete> processes too, which I hope to avoid having collected at all for the >Pete> duration of the test. > >Sorry. What I was getting at, was that it is not obvious that spawning >new processes should be avoided by performance reasons. In the Megaco >application one process (megaco_tcp/megaco_udp) reads the bytes off a >socket and spawns a new process (megaco_messenger) with a binary as >argument. The new process decodes the binary and creates lots of >temporary data and eventually terminates. If the initial size of the >process heap is set large enough (see spawn_opt), no GC is needed at >all. > >Pete> Well, at the moment the congestion handling may be safe, but I would >Pete> like to remove all congestion at the MG end if this is possible. It >Pete> seems to me that the solution may lie in distributing the MG over two or >Pete> more physical nodes, but I'm unclear how I'm going to achieve this. The >Pete> Megaco manuals hint at doing exactly this, but I haven't found an >Pete> example of how to do it. I will need to use distributed nodes for the >Pete> MGC anyway, to push performance into four-figure setup/teardown rates, >Pete> so any information or instructions will be very welcome! > >There are some (limited) documentation about distributed MG's/MGC's in >the reference manual for megaco:connect/4. > >The basic idea is that you invoke megaco:connect/4 as usual on the >Erlang node (A) that holds the connection to the MGC. Then you may >invoke megaco:connect/4 on another node (B) using the SAME ControlPid. > >Now you have enabled usage of megaco:call/3 and megaco:cast/3 from the >B node (as well as from node A). The encoding work is performed on the >originating node (B) while the decoding work is performed on the node >holding the connection (A). > >In order to off-load the A node as much as possible, we have been >looking into a more sophisticated solution where the message is >partially decoded on the A node. And then based on the extracted >transaction id, the message is forwarded as a binary to node B where >the complete decoding is performed. The implementation of this is >however not complete yet. > >/H?kan > > > > > > From matthias@REDACTED Wed Aug 28 19:58:01 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 28 Aug 2002 19:58:01 +0200 Subject: Documentation suggestion In-Reply-To: References: Message-ID: <15725.3881.803369.241382@antilipe.corelatus.se> James Hague writes: > In the list of applications in the left frame of the HTML docs, put "kernel" > and "stdlib" at the top of the list, separated from the rest of the > application by a blank line. Two reasons: This isn't a direct answer to your question, but it's a solution to a combination of things which probably bug you too: 1. I want to look at Erlang man pages as HTML, not 'man' 2. Usually, I already know which man page I want to read, so choosing it from the (multi-page) modules index is a pain. I want to type it in, either in the browser or (better) on the command line. The attached erlang program generates a pair of HTML pages which give you a search box above the modules index. You type in, say, 'lis' and it shows you the manpage for the lists module. Works for me with Mozilla 1.1 and Netscape 4.7. It also generates a shell script, so you can do this from the unix shell: % eman gen_t and mozilla will open the manpage for gen_tcp. The latter only works with mozilla, but it's easy enough to make it work with netscape. No idea about IE. Matt http://www.corelatus.se/ -------------- next part -------------- A non-text attachment was scrubbed... Name: erlman.erl Type: application/octet-stream Size: 5468 bytes Desc: not available URL: From vlad_dumitrescu@REDACTED Wed Aug 28 21:09:54 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Aug 2002 21:09:54 +0200 Subject: Documentation suggestion Message-ID: >From: Matthias Lang >This isn't a direct answer to your question, but it's a solution to a >combination of things which probably bug you too: > 1. I want to look at Erlang man pages as HTML, not 'man' > 2. Usually, I already know which man page I want to read, so > choosing it from the (multi-page) modules index is a pain. I > want to type it in, either in the browser or (better) on the > command line. That's a great idea! I have a suggestion myself: I wonder if it wouldn't be possible (and not too difficult) to use lynx from emacs, to view the docs in a buffer... or maybe the man pages directly... I would get at try at it myself, but my Emacs-ish ;-) is bad. regards, Vlad _________________________________________________________________ P? MSN hittar du det roliga, intressanta och anv?ndbara p? internet: http://www.msn.se From luke@REDACTED Wed Aug 28 21:25:48 2002 From: luke@REDACTED (Luke Gorrie) Date: 28 Aug 2002 21:25:48 +0200 Subject: Documentation suggestion In-Reply-To: References: Message-ID: "Vlad Dumitrescu" writes: > I have a suggestion myself: I wonder if it wouldn't be possible (and > not too difficult) to use lynx from emacs, to view the docs in a > buffer... or maybe the man pages directly... I would get at try at it > myself, but my Emacs-ish ;-) is bad. You can do "C-h e " in an erlang-mode buffer to bring up a manual page inside Emacs. (You need to install the manual pages first!) Cheers, Luke From matthias@REDACTED Wed Aug 28 21:36:36 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 28 Aug 2002 21:36:36 +0200 Subject: Documentation suggestion In-Reply-To: References: Message-ID: <15725.9796.714651.448286@antilipe.corelatus.se> Vlad Dumitrescu writes: > I have a suggestion myself: I wonder if it wouldn't be possible (and not too > difficult) to use lynx from emacs, to view the docs in a buffer... or maybe > the man pages directly... I would get at try at it myself, but my Emacs-ish > ;-) is bad. The erlang mode already does this, more or less. At least in xemacs, the Erlang menu has all of the man pages and selecting one shows it in a buffer. Matthias From svg@REDACTED Wed Aug 28 21:49:38 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 29 Aug 2002 01:49:38 +0600 (YEKST) Subject: Documentation suggestion In-Reply-To: References: Message-ID: <20020829.014938.58440100.svg@surnet.ru> Good day, vlad_dumitrescu> I have a suggestion myself: I wonder if it wouldn't be possible (and not too vlad_dumitrescu> difficult) to use lynx from emacs, to view the docs in a buffer... or maybe vlad_dumitrescu> the man pages directly... I would get at try at it myself, but my Emacs-ish vlad_dumitrescu> ;-) is bad. vlad_dumitrescu> Install `w3m' and use emacs `w3m-mode' (http://emacs-w3m.namazu.org/). It is far better than `lynx' especially with frame formatted Erlang documentation - frames and tables as ascii-art tables and inline pictures under emacs-21. Best Regards, Vladimir Sekissov From vlad_dumitrescu@REDACTED Wed Aug 28 21:52:33 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Aug 2002 21:52:33 +0200 Subject: Documentation suggestion References: <15725.9796.714651.448286@antilipe.corelatus.se> Message-ID: > The erlang mode already does this, more or less. At least in xemacs, > the Erlang menu has all of the man pages and selecting one shows it in > a buffer. Erm, not on Windows.... I am quite biased to this environment, and sometimes I forget that most of you others actually run Linux or Solaris. regards, Vlad From jamesh@REDACTED Wed Aug 28 23:37:11 2002 From: jamesh@REDACTED (James Hague) Date: Wed, 28 Aug 2002 16:37:11 -0500 Subject: Weird floating point display? Message-ID: >From the R8B-2 shell, under Windows: > 1.0 1.00000 > 0.0 0.00000e+0 Why the "e+0" in the second case? (I tried to cut and paste this from the shell, but cut and paste don't appear to work in R8B-2.) From thomas.lindgren@REDACTED Wed Aug 28 11:58:47 2002 From: thomas.lindgren@REDACTED (Thomas Lindgren) Date: Wed, 28 Aug 2002 11:58:47 +0200 Subject: Changing Code In-Reply-To: Message-ID: Richard Carlsson wrote: > - Is it necessary to be able to exchange any single module? > (E.g., if your application consists of a number of modules, > do you always replace all these modules anyway?) Installing simple patches by loading new modules in a live system has been used at both Bluetail and Cellpoint. (This can also be used to impress customers :-) > - Could code migration be limited to specific functions, or > is it necessary to be able to switch to a new version at all > "remote" calls. (E.g., one could imagine a new declaration > for specifying only certain functions as code update points.) Don't know. > - Do you always use the OTP release handler or similar to > do code updates, or do you do it by hand, or with your own > in-house tools, etc? Do you find it simple as it is today, > or is code update so difficult that you try to avoid it? Bluetail used release handlers IIRC, Cellpoint does not. > - How much of a problem are circular module dependencies in > practice? I believe OTP is full of circular module dependences. (Since Erlang handles this without complaint, most people probably don't, however, consider it a problem :-) > - Is the flexibility of being able to change any module at any > time (even in production code) worth more to you than the > speed of the code? Yes. > - When you make a (remote) call that is expected to switch > to new code whenever it has been loaded, could you guarantee > that the call stack is empty at that point, i.e., you will > not return to the old code, nor to the code that called it? > (If so, the code purging stage would not have to scan the > stacks of processes to find out if they must be killed.) > This pretty much equals saying that code change always starts > a fresh process, but keeps the old Pid. No. Best, Thomas From hakan@REDACTED Wed Aug 28 14:52:33 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 28 Aug 2002 14:52:33 +0200 (MEST) Subject: Megaco simple Media Gateway bleeds memory under load. In-Reply-To: <3D6BA45A.2090405@manderp.freeserve.co.uk> Message-ID: On Tue, 27 Aug 2002, Peter-Henry Mander wrote: Pete> I'm not sure I understand you here. I know how many the maximum number Pete> of concurrent unacknowledged requests is going to be as I have full Pete> control over the MGC, so I expect to need a similar number of Pete> receive_message processes and possibly a similar number of timeout Pete> processes too, which I hope to avoid having collected at all for the Pete> duration of the test. Sorry. What I was getting at, was that it is not obvious that spawning new processes should be avoided by performance reasons. In the Megaco application one process (megaco_tcp/megaco_udp) reads the bytes off a socket and spawns a new process (megaco_messenger) with a binary as argument. The new process decodes the binary and creates lots of temporary data and eventually terminates. If the initial size of the process heap is set large enough (see spawn_opt), no GC is needed at all. Pete> Well, at the moment the congestion handling may be safe, but I would Pete> like to remove all congestion at the MG end if this is possible. It Pete> seems to me that the solution may lie in distributing the MG over two or Pete> more physical nodes, but I'm unclear how I'm going to achieve this. The Pete> Megaco manuals hint at doing exactly this, but I haven't found an Pete> example of how to do it. I will need to use distributed nodes for the Pete> MGC anyway, to push performance into four-figure setup/teardown rates, Pete> so any information or instructions will be very welcome! There are some (limited) documentation about distributed MG's/MGC's in the reference manual for megaco:connect/4. The basic idea is that you invoke megaco:connect/4 as usual on the Erlang node (A) that holds the connection to the MGC. Then you may invoke megaco:connect/4 on another node (B) using the SAME ControlPid. Now you have enabled usage of megaco:call/3 and megaco:cast/3 from the B node (as well as from node A). The encoding work is performed on the originating node (B) while the decoding work is performed on the node holding the connection (A). In order to off-load the A node as much as possible, we have been looking into a more sophisticated solution where the message is partially decoded on the A node. And then based on the extracted transaction id, the message is forwarded as a binary to node B where the complete decoding is performed. The implementation of this is however not complete yet. /H?kan From kent@REDACTED Thu Aug 29 01:34:47 2002 From: kent@REDACTED (Kent Boortz) Date: 29 Aug 2002 01:34:47 +0200 Subject: Weird floating point display? In-Reply-To: References: Message-ID: James Hague writes: > >From the R8B-2 shell, under Windows: > > > 1.0 > 1.00000 > > 0.0 > 0.00000e+0 > > Why the "e+0" in the second case? There is nothing wrong with "0.00000e+0" ;-) We use the normal posix routines on the operating system to do the conversion so different libc libraries will give different results. The conversion from the binary format to text is done in C using sprintf(buf, "%.20e", fp); You could never expect that converting floating point to and from the binary representation to text will give exactly what you may expect but there is room for improvements, kent Ref: Clinger, William D. How to read floating point numbers accurately. In [ACM PLDI, 1990], pp. 92--101. http://www.acm.org/pubs/citations/proceedings/pldi/93542/p92-clinger/ http://citeseer.nj.nec.com/clinger90how.html G. L. Steele Jr. and J. L. White. How to print floating-point numbers accurately. In Proceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation, pages 112--126, White Plains, New York, June 1990. http://www.acm.org/pubs/citations/proceedings/pldi/93542/p112-steele/ From hakan@REDACTED Wed Aug 28 16:43:06 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 28 Aug 2002 16:43:06 +0200 (MEST) Subject: Megaco simple Media Gateway bleeds memory under load. Message-ID: On Tue, 27 Aug 2002, Peter-Henry Mander wrote: Pete> I'm not sure I understand you here. I know how many the maximum number Pete> of concurrent unacknowledged requests is going to be as I have full Pete> control over the MGC, so I expect to need a similar number of Pete> receive_message processes and possibly a similar number of timeout Pete> processes too, which I hope to avoid having collected at all for the Pete> duration of the test. Sorry. What I was getting at, was that it is not obvious that spawning new processes should be avoided by performance reasons. In the Megaco application one process (megaco_tcp/megaco_udp) reads the bytes off a socket and spawns a new process (megaco_messenger) with a binary as argument. The new process decodes the binary and creates lots of temporary data and eventually terminates. If the initial size of the process heap is set large enough (see spawn_opt), no GC is needed at all. Pete> Well, at the moment the congestion handling may be safe, but I would Pete> like to remove all congestion at the MG end if this is possible. It Pete> seems to me that the solution may lie in distributing the MG over two or Pete> more physical nodes, but I'm unclear how I'm going to achieve this. The Pete> Megaco manuals hint at doing exactly this, but I haven't found an Pete> example of how to do it. I will need to use distributed nodes for the Pete> MGC anyway, to push performance into four-figure setup/teardown rates, Pete> so any information or instructions will be very welcome! There are some (limited) documentation about distributed MG's/MGC's in the reference manual for megaco:connect/4. The basic idea is that you invoke megaco:connect/4 as usual on the Erlang node (A) that holds the connection to the MGC. Then you may invoke megaco:connect/4 on another node (B) using the SAME ControlPid. Now you have enabled usage of megaco:call/3 and megaco:cast/3 from the B node (as well as from node A). The encoding work is performed on the originating node (B) while the decoding work is performed on the node holding the connection (A). In order to off-load the A node as much as possible, we have been looking into a more sophisticated solution where the message is partially decoded on the A node. And then based on the extracted transaction id, the message is forwarded as a binary to node B where the complete decoding is performed. The implementation of this is however not complete yet. /H?kan From hakan@REDACTED Wed Aug 28 21:29:30 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 28 Aug 2002 21:29:30 +0200 (CEST) Subject: Megaco simple Media Gateway bleeds memory under load. Message-ID: On Wed, 28 Aug 2002, Peter-Henry Mander wrote: - Pete> I think understand you now, lets see if I got it. With a large enough Pete> heap, a spawned process will not require further chunks from system Pete> memory, and therefore will not cause garbage collection sweeps, but only Pete> while the process doesn't terminate. When the process itself terminates, Pete> garbage collection reclaims the process heap and anything else allocated Pete> from it in one sweep. Am I correct? If I am, I can understand why it Pete> would be more efficient than allocating and freeing small fragments of Pete> system memory, and that it would avoid memory fragmentation. As a dead process has no data alive, no GC sweep is needed at all (unless you use unified heap). Pete> But what if the megaco_messenger processes are spawned at a high rate, Pete> as they appear to be in the MG when receiving almost 1000 Pete> transactions/second? I suspect that memory will get eaten up very Pete> quickly by spawned processes with large heaps. Is it possible that the Pete> garbage collector process is starved (since CPU usage is 99%) due to the Pete> rate at which megaco_messenger processes are being spawned? My idea of Pete> maintaining a pool of megaco_messenger may not be an elegant solution, Pete> and I may be accused of micro-managing memory as would a C programmer! Pete> But I would like to persue it, simply to convince myself, either yes or Pete> no, whether this imperative pardigm may have value in a functional Pete> language. Regardless of the issue of spawning new fresh processes or reusing a pool of old ones, you can still get a more predictable memory consumption by explicitly blocking the socket when the number of currently processed messages exceeds some upper threshold and then unblock it at some lower threshold. Pete> I'll try to keep you updated on this, and the distributed MG Pete> as you describe below, and the Megaco V2 work I mentioned earlier. Pete> Pete> I wonder, since you seem to still be developing the Megaco stack, Pete> whether my feedback is useful to you? Yes, your feedback is useful. Our Megaco application will also support V2 (both text and binary), but currently not know when it will be completed. We need to discuss this internally when Micael returns from his vacation. My own work situation is quite unclear right now, as the Ericsson Computer Science Lab recently has ceased to exist. I hope that I still will have the opportunity to continue working with Erlang, but some dark forces in the new organization want me to work with something completely different (and boring) stuff. Pete> I am extremely interested in the Pete> partial/distributed decoding you mentioned in the last paragraph. Is Pete> there a complementary distributed encoding project in the pipeline? The encoding part is already distributed! There is no automatic load balancing, but you have the opportunity to choose any Erlang node and perform the encoding there. The encoding is performed on the node where the megaco:call/3 or megaco:cast/3 is invoked. /H?kan From etxuwig@REDACTED Thu Aug 29 09:49:53 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 29 Aug 2002 09:49:53 +0200 (MET DST) Subject: Megaco simple Media Gateway bleeds memory under load. In-Reply-To: Message-ID: On Wed, 28 Aug 2002, Hakan Mattsson wrote: >Sorry. What I was getting at, was that it is not obvious that >spawning new processes should be avoided by performance reasons. >In the Megaco application one process (megaco_tcp/megaco_udp) >reads the bytes off a socket and spawns a new process >(megaco_messenger) with a binary as argument. The new process >decodes the binary and creates lots of temporary data and >eventually terminates. If the initial size of the process heap >is set large enough (see spawn_opt), no GC is needed at all. BTW, what "large enough" is can be determined using e.g. dbg and tracing on garbage collections. The trace messages will show what the new heap size is after each GC (and, of course, show whether there is a GC at all). This may vary dependending on the application. Sorry, no examples of how this is done. I leave that up to somebody else. It does pay off to study the tracing support closely, so it's a highly useful exercise. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From thomas.lindgren@REDACTED Thu Aug 29 09:56:58 2002 From: thomas.lindgren@REDACTED (Thomas Lindgren) Date: Thu, 29 Aug 2002 09:56:58 +0200 Subject: Records (was RE: Fun syntax & language feature poll) In-Reply-To: Message-ID: > Are any record changes expected in R9? I've been hearing about records > becoming separate types (not just tuples) and better record support in the > shell for what seems like years now :) The sooner the better :-) What are the current requirements? - create record, #rec{fld1=E1,...} - modify record, R#rec{fld1=E1,...} - access record field, R#rec.fld - index of field, #rec.fld (this one is messy) - record_info - test record type, record(X, rec) - readable, printable (currently, this is ad hoc) (did I forget anything?) I think there are some frequently used operations, e.g., lists:keysearch, mnesia to some extent, that rely on the tuple representation at this time. Other issues: - What is the scope of a record declaration? - Do record declarations exist at runtime? In my optimizer, I used a strict compile-time approach and renamed all records using the MD5-hash of their declarations, so that #rec became #'rec ' which made them unique throughout the program (at least unique up to equivalence; identical declarations got the same name). But this is unsatisfactory for use in the shell. I can see two methods for that: 1. The shell keeps track of what record declarations are active (and permits the user to declare records and including files), and reads and prints records using this information, or 2. When a record type is declared, we allocate an information object about it, which stores the field names, the printname (= declared name), and whatever else is convenient. A heap record then points to this information object. Common operations on records should compile into code that does NOT need to access the record info object, or performance will likely suck. The first one is simpler. The second one seems the more principled approach. (Suitable runtime record info also permits operations such as X#rec.Fld, X#Rec.fld, ... which would come in handy now and then.) Best, Thomas From hakan@REDACTED Wed Aug 28 21:16:18 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 28 Aug 2002 21:16:18 +0200 (MET DST) Subject: Megaco simple Media Gateway bleeds memory under load. In-Reply-To: <3D6CFCCF.3010904@manderp.freeserve.co.uk> Message-ID: On Wed, 28 Aug 2002, Peter-Henry Mander wrote: Pete> I think understand you now, lets see if I got it. With a large enough Pete> heap, a spawned process will not require further chunks from system Pete> memory, and therefore will not cause garbage collection sweeps, but only Pete> while the process doesn't terminate. When the process itself terminates, Pete> garbage collection reclaims the process heap and anything else allocated Pete> from it in one sweep. Am I correct? If I am, I can understand why it Pete> would be more efficient than allocating and freeing small fragments of Pete> system memory, and that it would avoid memory fragmentation. As a dead process has no data alive, no GC sweep is needed at all (unless you use unified heap). Pete> But what if the megaco_messenger processes are spawned at a high rate, Pete> as they appear to be in the MG when receiving almost 1000 Pete> transactions/second? I suspect that memory will get eaten up very Pete> quickly by spawned processes with large heaps. Is it possible that the Pete> garbage collector process is starved (since CPU usage is 99%) due to the Pete> rate at which megaco_messenger processes are being spawned? My idea of Pete> maintaining a pool of megaco_messenger may not be an elegant solution, Pete> and I may be accused of micro-managing memory as would a C programmer! Pete> But I would like to persue it, simply to convince myself, either yes or Pete> no, whether this imperative pardigm may have value in a functional Pete> language. Regardless of the issue of spawning new fresh processes or reusing a pool of old ones, you can still get a more predictable memory consumption by explicitly blocking the socket when the number of currently processed messages exceeds some upper threshold and then unblock it at some lower threshold. Pete> I'll try to keep you updated on this, and the distributed MG Pete> as you describe below, and the Megaco V2 work I mentioned earlier. Pete> Pete> I wonder, since you seem to still be developing the Megaco stack, Pete> whether my feedback is useful to you? Yes, your feedback is useful. Our Megaco application will also support V2 (both text and binary), but currently not know when it will be completed. We need to discuss this internally when Micael returns from his vacation. My own work situation is quite unclear right now, as the Ericsson Computer Science Lab recently has ceased to exist. I hope that I still will have the opportunity to continue working with Erlang, but some dark forces in the new organization want me to work with something completely different (and boring) stuff. Pete> I am extremely interested in the Pete> partial/distributed decoding you mentioned in the last paragraph. Is Pete> there a complementary distributed encoding project in the pipeline? The encoding part is already distributed! There is no automatic load balancing, but you have the opportunity to choose any Erlang node and perform the encoding there. The encoding is performed on the node where the megaco:call/3 or megaco:cast/3 is invoked. /H?kan From mikael.karlsson@REDACTED Thu Aug 29 10:19:40 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 29 Aug 2002 10:19:40 +0200 Subject: Section numbering using xmerl:export Message-ID: <200208291019.40246.mikael.karlsson@creado.com> Hi, I am trying to export a Simple Docbook xml to xhtml using the export function in xmlerl. I wan't to have section numbering in the 3 top levels and after some testing I could use the ParentTagPosition from the [{ParentTag, ParentTagPosition}] argument. (See code below.) The top section gets position 4, next top section pos 6, subsections get pos 5, 7, etc.. . Now, is this just a lucky coincidence or is it something I can expect for any document? Thanks Mikael .. title(Data, Attrs, [{section,C}, {section,B}, {section,A} | _], E) -> ["

", get_chapter(A,B,C)," ", Data, "

"]; title(Data, Attrs, [{section,B}, {section,A} | _], E) -> ["

", get_chapter(A,B), " ", Data, "

"]; title(Data, Attrs, [{section,A} | _], E) -> ["

",get_chapter(A),". ", Data, "

"]; title(Data, Attrs, [{article,_} | _], E) -> ["

", Data, "

"]; title(Data, Attrs, Parents, E)-> ["

", Data, "

"]. get_chapter(A)-> mk_string((A-2) div 2). get_chapter(A,B) -> get_chapter(A) ++ "." ++ get_chapter(B-1). get_chapter(A,B,C) -> get_chapter(A,B) ++ "." ++ get_chapter(C-1). From vlad_dumitrescu@REDACTED Thu Aug 29 12:09:06 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 29 Aug 2002 12:09:06 +0200 Subject: Section numbering using xmerl:export References: <200208291019.40246.mikael.karlsson@creado.com> Message-ID: Hi, I don't know about the xmerl details, but I think it might be risky to rely on a implementation dependent feature... Of course, this depends on your application's use. The safe way would be going through the tree and numbering the nodes along the path. I have written a small routine that will traverse a xml tree and call a fun with every node. I think it might help you too (or others). best regards, Vlad %%% File : xmerl_util.erl %%% Author : %%% Description : %%% Created : 14 Aug 2002 by -module(xmerl_util). -export([traverse/2]). -include("xmerl.hrl"). %% convert an xml doc into another %% %% Fun should return a xmlXXX record, or a list of such records traverse(#xmlElement{content=C}=E, Fun) -> C1 = lists:flatten(traverse(C, Fun)), Fun(E#xmlElement{content=C1}); traverse(List, Fun) when list(List) -> AFun = fun(E) -> traverse(E, Fun) end, lists:map(AFun, List); traverse(E, _Fun) -> E. From Sean.Hinde@REDACTED Thu Aug 29 12:10:02 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 29 Aug 2002 11:10:02 +0100 Subject: Documentation suggestion Message-ID: <04D356A3B172D611981B0008C791C3126BF31E@imp02mbx.t-mobile.co.uk> Hi, > The attached erlang program generates a pair of HTML pages which give > you a search box above the modules index. You type in, say, 'lis' and > it shows you the manpage for the lists module. > > Works for me with Mozilla 1.1 and Netscape 4.7. > > It also generates a shell script, so you can do this from the > unix shell: > > % eman gen_t > > and mozilla will open the manpage for gen_tcp. The latter only works > with mozilla, but it's easy enough to make it work with netscape. No > idea about IE. Well - trying this on IE gave me a chuckle. A search on 'erlang' in the find box caused a pause, and then a popup saying "Something on this page is making IE run slowly. Would you like to continue? (note this may make your computer unstable)". Of course I clicked "NO", not wishing that to happen, at which time the fan came on on my laptop and ie went into total non respond mode. Erlang 1 (more), MS 0 Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From matthias@REDACTED Thu Aug 29 12:38:02 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 29 Aug 2002 12:38:02 +0200 Subject: Documentation suggestion In-Reply-To: <04D356A3B172D611981B0008C791C3126BF31E@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF31E@imp02mbx.t-mobile.co.uk> Message-ID: <15725.63882.670489.232626@antilipe.corelatus.se> mml> The attached erlang program generates a pair of HTML pages which give mml> you a search box above the modules index. You type in, say, 'lis' and mml> it shows you the manpage for the lists module. Sean Hinde writes: > Well - trying this on IE gave me a chuckle. A search on 'erlang' in the find > box caused a pause, and then a popup saying "Something on this page is > making IE run slowly. Would you like to continue? (note this may make your > computer unstable)". Well, that's the most positive spin imaginable on "your crappy program doesn't work" ;-) I should have released it under an assumed name. The code does a linear search through a 1000 entry array. Maybe IE has O(n) array access ;-) Next time I'm near an MS operating system, I'll take a look if eliminating the linear search fixes it, or if it's something else. It could also be that IE can't cope with long lines. Matthias From eleberg@REDACTED Thu Aug 29 13:42:01 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Thu, 29 Aug 2002 13:42:01 +0200 (MET DST) Subject: equivalent of seek'ing in a file? Message-ID: <200208291142.g7TBg1r26637@cbe.ericsson.se> greetings, can i position the 'cursor' when read/writing to a file? it seems (test included below) that after file:open( File, [read, write] ), io:fwrite() will put characters in the beginning of the file. until i have made the first io:get_line(). then characters will start writing at the end of the file. is there some rule/documentation describing this? bengt -------------- next part -------------- #! /usr/bin/env escript -export([main/1]). main( Args ) -> true = code:add_patha( '/home/eleberg/private/erlang/src' ), File = file( Args ), fill_file( File ), display( File ), readwrite( File ), display( File ), fill_file( File ), writeread( File ), display( File ), halt(). fill_file( File ) -> {ok, Io} = file:open( File, [write] ), io:fwrite( Io, "line o1~n", [] ), io:fwrite( Io, "line o2~n", [] ), io:fwrite( Io, "line o3~n", [] ), file:close( Io ). readwrite( File ) -> {ok, Io} = file:open( File, [read, write] ), io:fwrite( "~s", [io:get_line( Io, '' )] ), io:fwrite( Io, "line w1~n", [] ), io:fwrite( "~s", [io:get_line( Io, '' )] ), file:close( Io ). writeread( File ) -> {ok, Io} = file:open( File, [read, write] ), io:fwrite( Io, "line w1~n", [] ), io:fwrite( "~s", [io:get_line( Io, '' )] ), io:fwrite( Io, "line w2~n", [] ), file:close( Io ). display( File ) -> io:fwrite( "~nFile ~p~n", [File] ), {ok, Bin} = file:read_file( File ), io:format( "~s~n", [binary_to_list( Bin )] ). file( [] ) -> "/tmp/afile"; file( [File] ) -> File. From jamesh@REDACTED Thu Aug 29 15:56:51 2002 From: jamesh@REDACTED (James Hague) Date: Thu, 29 Aug 2002 08:56:51 -0500 Subject: Weird floating point display? Message-ID: > > > 1.0 > > 1.00000 > > > 0.0 > > 0.00000e+0 > > > > Why the "e+0" in the second case? > > There is nothing wrong with "0.00000e+0" ;-) Other than being ugly, no :) From Sean.Hinde@REDACTED Thu Aug 29 12:46:07 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 29 Aug 2002 11:46:07 +0100 Subject: Documentation suggestion Message-ID: <04D356A3B172D611981B0008C791C3126BF31F@imp02mbx.t-mobile.co.uk> > mml> The attached erlang program generates a pair of HTML > pages which give > mml> you a search box above the modules index. You type in, > say, 'lis' and > mml> it shows you the manpage for the lists module. > > Sean Hinde writes: > > Well - trying this on IE gave me a chuckle. A search on > 'erlang' in the find > > box caused a pause, and then a popup saying "Something on > this page is > > making IE run slowly. Would you like to continue? (note > this may make your > > computer unstable)". > > Well, that's the most positive spin imaginable on "your crappy program > doesn't work" ;-) I should have released it under an assumed name. > > The code does a linear search through a 1000 entry array. Maybe IE has > O(n) array access ;-) Next time I'm near an MS operating system, I'll > take a look if eliminating the linear search fixes it, or if it's > something else. It could also be that IE can't cope with long lines. Well don't worry on my account. It looks so useful it's prompted me to try installing Mozilla on my crappy end of life corporate laptop (which only has to struggle on until my Powerbook arrives, Er sorry Mr IT, I mean, cough, my portable UNIX workstation and erlang development environment) Thanks for this cool hack, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From mikael.karlsson@REDACTED Thu Aug 29 17:29:07 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 29 Aug 2002 17:29:07 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: <200208291019.40246.mikael.karlsson@creado.com> Message-ID: <200208291729.07558.mikael.karlsson@creado.com> Thanks for the reply and code Vlad, as far as I understand the xmerl:export(Data, Callback) does the similar as your example, but that instead of a fun you provide a Callback module which implement every tag you want to transform as a function: Tag(Data, Attrs, Parents, E) The Parents argument is a list of: [{ParentTag, ParentTagPosition}] Empirically I can use the ParentTagPosition to number my section/ subsection titles "on the fly" in one pass as described earlier. The question is how is the ParentTagPosition to be interpreted? If it is an implementation dependent feature should it be included in the arguments to the callback function at all then? To transform I just scan the xml file and then export it using my callback module. xmerl is really cool I think: test() -> {A,_}=xmerl_scan:file( "/home/mikael/local/src/erlang/erlbook/priv/simpledocbooktest.xml", [{fetch_fun, fun(DTDSpec,S) -> {ok,S} end}]), io:fwrite("~s",[xmerl:export(A,sdocbook2xhtml)]). The only tedious thing is to implement all the Simple DocBook tags (many tags there are...). Not xmerls fault though :-) Thanks Mikael From luke@REDACTED Thu Aug 29 20:19:00 2002 From: luke@REDACTED (Luke Gorrie) Date: 29 Aug 2002 20:19:00 +0200 Subject: Distel 3.0 Message-ID: Ahoy-hoy! A very cool new release is Distel is up, have a squiz at: http://www.bluetail.com/~luke/distel/ This one has a whole bunch of ready-to-go Erlang-related commands in Emacs: dynamic "TAGS", debugger, profiler, "session" scratchpads, process manager, plus a muchly improved programming interface. It's been beta tested around the office and is working great in all major Emacsen (or your money back!) README follows: distel 3.0 -- Distributed Emacs Lisp for Erlang. ------------------------------------------------------------ Distel is a library for Emacs<->Erlang communication, plus a suite of tools built on top of it, such as a debugger front-end. It works by using the Erlang distribution protocol to connect Emacs with regular Erlang nodes, turning it into a very convenient user-interface toolkit. After the INSTALL procedure, you will have an extended Erlang mode any time you edit erlang files. You can see that this is enabled from the mode-line string "Erlang EXT", instead of just "Erlang". To see the available commands, use `describe-mode' (C-h m), which describes all the currently activated modes. Near the bottom of its output you will find this description: Extensions to erlang-mode for communicating with a running Erlang node. These commands generally communicate with an Erlang node. The first time you use one, you will be prompted for the name of the node to use. This name will be cached for future commands. To override the cache, give a prefix argument with C-u before using the command. C-c C-d l - List all Erlang processes ("pman"). M-. - Jump from a function call to its definition. M-, - Jump back from a function definition (multi-level). C-c C-d : - Evaluate an erlang expression from the minibuffer. C-c C-d p - Profile (with fprof) an expression from the minibuffer. C-c C-d i - Toggle debug interpreting of the module. C-c C-d b - Toggle a debugger breakpoint at the current line. C-c C-d m - Popup the debugger's process monitor buffer. C-c C-d s - Create an interactive "session" buffer. C-c C-d c - Create an interactive "session" buffer from current buffer. C-c C-d r - Create an interactive "session" buffer from region. Most commands that pop up new buffers will save your original window configuration, so that you can restore it by pressing 'q'. Use `describe-mode' (C-h m) on any Distel buffer when you want to know what commands are available. To get more information about a particular command, use "C-h k" followed by the command's key sequence. For general information about Emacs' online help, use "C-h ?". If you want to write new commands of your own, the programmer's manual tells you how. You can make a postscript copy with "make postscript", or an Info version with "make info" and "make info_install". For more background about the "Session" commands, have a look in README.ie-session. Hope you enjoy, and please send hacks or feedback to luke@REDACTED! PS: The "dynamic TAGS" with M-. and M-, is the coolest bit to get started with! Compatibility notes: The profiler front end requires >= R8B (to get fprof) The debugger front end requires >= R8B-1 Distel itself is tested with GNU Emacs 20.x and 21.x, and XEmacs 21.x. Snapshots from CVS may sometimes only work with GNU Emacs 21 (or, of course, not work at all :-)) From mikael.karlsson@REDACTED Thu Aug 29 19:14:20 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 29 Aug 2002 19:14:20 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200208291914.20980.mikael.karlsson@creado.com> Actually this seems to work fine in my documents, but maybe I did not understand your point. I actually check the section parents in the "title" element. /Mikael 7> test_xhtml:test(). Parents [{article,1}] Parents [{section,4},{article,1}] Parents [{section,5},{section,4},{article,1}] Parents [{section,7},{section,4},{article,1}] Parents [{section,5},{section,7},{section,4},{article,1}] Parents [{section,7},{section,7},{section,4},{article,1}] Parents [{section,6},{article,1}] Parents [{section,5},{section,6},{article,1}] Parents [{section,7},{section,6},{article,1}] Parents [{section,5},{section,7},{section,6},{article,1}] Input: --------------------------
A Test Document
Section 1 This is para 1.
Section 1.1 This is para 2 with emphasis in it. This is para 3.
Section 1.2 This is para 4.
Section 1.2.1
Section 1.2.2
This is para 5.
Section 2 This is para 6.
Section 2.1
Section 2.2 This is para 7.
Section 2.2.1
This is para 8. This is para 9.
--------------------------------------- Output:

A Test Document

1 Section 1

This is para 1.

1.1 Section 1.1

This is para 2 with emphasis in it.

This is para 3.

1.2 Section 1.2

This is para 4.

1.2.1 Section 1.2.1

1.2.2 Section 1.2.2

This is para 5.

2 Section 2

This is para 6.

2.1 Section 2.1

2.2 Section 2.2

This is para 7.

2.2.1 Section 2.2.1

This is para 8.

This is para 9.

------------------------------ torsdag 29 augusti 2002 18:07 skrev Ulf Wiger: > nOn Thu, 29 Aug 2002, Mikael Karlsson wrote: > >Hi, > > > >I am trying to export a Simple Docbook xml to xhtml using the > >export function in xmlerl. I wan't to have section numbering in > >the 3 top levels and after some testing I could use the > >ParentTagPosition from the [{ParentTag, ParentTagPosition}] > >argument. (See code below.) > > > >The top section gets position 4, next top section pos 6, > >subsections get pos 5, 7, etc.. . > > > >Now, is this just a lucky coincidence or is it something I can > >expect for any document? > > Hmm, sounds risky. The position number enumerates the child > elements in order, but unless you can guarantee that your > chapter elements will never contain a non-chapter sibling, that > particular scheme will not work. > > A typical scheme might be: > >
> ... >
> ... > ... >
> ... >
> > In this case it won't work to look at the position number, > because it will be e.g. > > {section, 1}, [ > {para, 1}, > {section, 2}, [ > {para, 1}, > {section, 2} | ...]}] > ]} > > Maybe this doesn't happen in your Simple DocBook...? > > One idea would be to modify the export concept to do something > similar to xmerl_xpath. I had thought about doing this to make > XSL-type operations possible via the export API. The trick used > by xmerl_xpath is to put the full parent element in the parents > list instead of just the {Tag, Position} indicator. > > This might seem expensive from a memory consumption point of > view, but it is in fact just a pointer to the element behind the > scenes. This would allow the tag function to freely inspect its > parent or its siblings. In your case, you could go via the parent > element and look at the preceding siblings, counting the > occurences of 'section' elements. > > If this appeals to the rest of you, I could prototype such a > modification. I don't know how much of an issue backwards > compatibility is for xmerl...? > > /Uffe From etxuwig@REDACTED Thu Aug 29 18:07:49 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 29 Aug 2002 18:07:49 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200208291019.40246.mikael.karlsson@creado.com> Message-ID: nOn Thu, 29 Aug 2002, Mikael Karlsson wrote: >Hi, > >I am trying to export a Simple Docbook xml to xhtml using the >export function in xmlerl. I wan't to have section numbering in >the 3 top levels and after some testing I could use the >ParentTagPosition from the [{ParentTag, ParentTagPosition}] >argument. (See code below.) > >The top section gets position 4, next top section pos 6, >subsections get pos 5, 7, etc.. . > >Now, is this just a lucky coincidence or is it something I can >expect for any document? Hmm, sounds risky. The position number enumerates the child elements in order, but unless you can guarantee that your chapter elements will never contain a non-chapter sibling, that particular scheme will not work. A typical scheme might be:
...
... ...
...
In this case it won't work to look at the position number, because it will be e.g. {section, 1}, [ {para, 1}, {section, 2}, [ {para, 1}, {section, 2} | ...]}] ]} Maybe this doesn't happen in your Simple DocBook...? One idea would be to modify the export concept to do something similar to xmerl_xpath. I had thought about doing this to make XSL-type operations possible via the export API. The trick used by xmerl_xpath is to put the full parent element in the parents list instead of just the {Tag, Position} indicator. This might seem expensive from a memory consumption point of view, but it is in fact just a pointer to the element behind the scenes. This would allow the tag function to freely inspect its parent or its siblings. In your case, you could go via the parent element and look at the preceding siblings, counting the occurences of 'section' elements. If this appeals to the rest of you, I could prototype such a modification. I don't know how much of an issue backwards compatibility is for xmerl...? /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From mikael.karlsson@REDACTED Thu Aug 29 22:27:36 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 29 Aug 2002 22:27:36 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200208292227.36651.mikael.karlsson@creado.com> Hmm, This sounds interesting, would this also mean that one could perform XSL-type operations like having an arbitrary order of rearranging/filtering the transformed elements, like making a contents table, etc. As it is now it seems that you have to maintain the input XML document order in the export. /Mikael torsdag 29 augusti 2002 18:07 skrev Ulf Wiger: .. > One idea would be to modify the export concept to do something > similar to xmerl_xpath. I had thought about doing this to make > XSL-type operations possible via the export API. The trick used > by xmerl_xpath is to put the full parent element in the parents > list instead of just the {Tag, Position} indicator. > > This might seem expensive from a memory consumption point of > view, but it is in fact just a pointer to the element behind the > scenes. This would allow the tag function to freely inspect its > parent or its siblings. In your case, you could go via the parent > element and look at the preceding siblings, counting the > occurences of 'section' elements. > > If this appeals to the rest of you, I could prototype such a > modification. I don't know how much of an issue backwards > compatibility is for xmerl...? > > /Uffe From etxuwig@REDACTED Fri Aug 30 09:21:11 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 30 Aug 2002 09:21:11 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200208291914.20980.mikael.karlsson@creado.com> Message-ID: On Thu, 29 Aug 2002, Mikael Karlsson wrote: >Actually this seems to work fine in my documents, >but maybe I did not understand your point. >I actually check the section parents in the "title" element. >/Mikael I see. Well, then it should be guaranteed to work, I think. (: If the title had been an attribute in 'section', my objection would have been valid. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From etxuwig@REDACTED Fri Aug 30 09:25:15 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 30 Aug 2002 09:25:15 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200208292227.36651.mikael.karlsson@creado.com> Message-ID: On Thu, 29 Aug 2002, Mikael Karlsson wrote: >Hmm, >This sounds interesting, >would this also mean that one could perform XSL-type operations like >having an arbitrary order of rearranging/filtering the transformed >elements, like making a contents table, etc. As it is now it seems that >you have to maintain the input XML document order in the export. > >/Mikael You can of course do this by hand without too much erlang programming. That was ultimately the reason why I quit trying to implement XSL in xmerl (the fact that it is bloody difficult to implement XSL efficiently was a contributing factor, of course.) A good first step would perhaps be to export the functionality in xmerl_xpath that prepares the XML document for the XPATH search, and perhaps some of the search functions as well. Then you could write your own XSL-like Erlang module with "relative ease". /Uffe >torsdag 29 augusti 2002 18:07 skrev Ulf Wiger: >.. >> One idea would be to modify the export concept to do something >> similar to xmerl_xpath. I had thought about doing this to make >> XSL-type operations possible via the export API. The trick used >> by xmerl_xpath is to put the full parent element in the parents >> list instead of just the {Tag, Position} indicator. >> >> This might seem expensive from a memory consumption point of >> view, but it is in fact just a pointer to the element behind the >> scenes. This would allow the tag function to freely inspect its >> parent or its siblings. In your case, you could go via the parent >> element and look at the preceding siblings, counting the >> occurences of 'section' elements. >> >> If this appeals to the rest of you, I could prototype such a >> modification. I don't know how much of an issue backwards >> compatibility is for xmerl...? >> >> /Uffe > > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From raimo@REDACTED Fri Aug 30 09:50:59 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Fri, 30 Aug 2002 09:50:59 +0200 Subject: equivalent of seek'ing in a file? References: <200208291142.g7TBg1r26637@cbe.ericsson.se> Message-ID: <3D6F23E3.1CB974B5@erix.ericsson.se> So, what is the result of running your escript? Anyway, try file:open(File, [read, append]), it might work as you expected. I should expect that the [read, write] flags will start writing from the beginning of the file, see the erlang man page for the module 'file' function 'open', then will io:get_line/2 read from the position where the write stopped until newline, and then would a subsequent write continue where io:get_line/2 stopped, ... It might be so that the write and read positions are not the same, but I think they are. Check the man pages for the Unix system calls 'read' and 'write'. The 'file' module tries to be Posix (Unix). It might also be so that io:get_line/2 reads ahead and keeps data in a buffer so that file:write/2 writes from the position where io:get_line/2 last read data with file:read/2. In general try to not mix read/write calls from different abstraction levels, in this case 'file' vs 'io'. Try using io:read/2 instead that should know of buffered data in the io server process and compensate for it. This should give a more consistent behaviour (unless there is a bug). / Raimo Niskanen, Erlang/OTP, Ericsson AB Bengt Kleberg wrote: > > greetings, > > can i position the 'cursor' when read/writing to a file? > > it seems (test included below) that after file:open( File, [read, write] ), > io:fwrite() will put characters in the beginning of the file. until i > have made the first io:get_line(). then characters will start writing > at the end of the file. > > is there some rule/documentation describing this? > > bengt > > ------------------------------------------------------------------------ > #! /usr/bin/env escript > > -export([main/1]). > > main( Args ) -> > true = code:add_patha( '/home/eleberg/private/erlang/src' ), > File = file( Args ), > fill_file( File ), > display( File ), > readwrite( File ), > display( File ), > fill_file( File ), > writeread( File ), > display( File ), > halt(). > > fill_file( File ) -> > {ok, Io} = file:open( File, [write] ), > io:fwrite( Io, "line o1~n", [] ), > io:fwrite( Io, "line o2~n", [] ), > io:fwrite( Io, "line o3~n", [] ), > file:close( Io ). > > readwrite( File ) -> > {ok, Io} = file:open( File, [read, write] ), > io:fwrite( "~s", [io:get_line( Io, '' )] ), > io:fwrite( Io, "line w1~n", [] ), > io:fwrite( "~s", [io:get_line( Io, '' )] ), > file:close( Io ). > > writeread( File ) -> > {ok, Io} = file:open( File, [read, write] ), > io:fwrite( Io, "line w1~n", [] ), > io:fwrite( "~s", [io:get_line( Io, '' )] ), > io:fwrite( Io, "line w2~n", [] ), > file:close( Io ). > > > display( File ) -> > io:fwrite( "~nFile ~p~n", [File] ), > {ok, Bin} = file:read_file( File ), > io:format( "~s~n", [binary_to_list( Bin )] ). > > file( [] ) -> > "/tmp/afile"; > file( [File] ) -> > File. From eleberg@REDACTED Fri Aug 30 10:20:14 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Fri, 30 Aug 2002 10:20:14 +0200 (MET DST) Subject: equivalent of seek'ing in a file? Message-ID: <200208300820.g7U8KEr09936@cbe.ericsson.se> > To: erlang-questions@REDACTED > Date: Fri, 30 Aug 2002 09:50:59 +0200 > From: Raimo Niskanen thank you for answering. > So, what is the result of running your escript? > File "/tmp/afile" line o1 line o2 line o3 line o1 line o2 File "/tmp/afile" line o1 line o2 line o3 line w1 line o2 File "/tmp/afile" line w1 line o2 line o3 line w2 > Anyway, try file:open(File, [read, append]), it might work as you > expected. yes it does. ie, all writes are done at the end of the file (as promised in the documentation). > I should expect that the [read, write] flags will start writing from the > beginning of the file, see the erlang man page for the module 'file' > function 'open', then will io:get_line/2 read from the position where > the write stopped until newline, and then would a subsequent write > continue where io:get_line/2 stopped, ... those where my expectations, too. it does not appear to work that way, though. > It might be so that the write and read positions are not the same, but I > think they are. Check the man pages for the Unix system calls 'read' and > 'write'. The 'file' module tries to be Posix (Unix). does the io module have any stated direction of posix compatibility, too? > It might also be so that io:get_line/2 reads ahead and keeps data in a > buffer so that file:write/2 writes from the position where io:get_line/2 > last read data with file:read/2. In general try to not mix read/write > calls from different abstraction levels, in this case 'file' vs 'io'. > Try using io:read/2 instead that should know of buffered data in the io > server process and compensate for it. This should give a more consistent > behaviour (unless there is a bug). i am using the io module for all read/write operations. not the file module. my file contents happens to be line oriented (long exposure to unix). so io:get_line and io:fwrite (the latter with a ~n at the end of the format string) seemed a natural way of doing things. i could even try to live with the lack of cursor positioning (fseek()). but the (pseudo) randomness of read/write operations made me want to find out what the proper, documented, behaviour is. bengt From vlad_dumitrescu@REDACTED Fri Aug 30 10:23:52 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 30 Aug 2002 10:23:52 +0200 Subject: Section numbering using xmerl:export References: <200208291019.40246.mikael.karlsson@creado.com> <200208291729.07558.mikael.karlsson@creado.com> Message-ID: >From: "Mikael Karlsson" > >Thanks for the reply and code Vlad, >as far as I understand the xmerl:export(Data, Callback) does the similar >as your example, but that instead of a fun you provide a Callback >module which implement every tag you want to transform as a function: Hi, I wrote that function just because I thought export wouldn't give me what I needed, but it is possible that I didn't dig deep enough into xmerl... I hope Ulf or Richard can confirm if I'm right or wrong: can xmerl:export be used to return another XML structure too? The examples only return text representing the XML or HTML, so I might have been mislead into thinking that this is all xmerl:export can do... best regards, Vlad From etxuwig@REDACTED Fri Aug 30 10:51:43 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 30 Aug 2002 10:51:43 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: Message-ID: On Fri, 30 Aug 2002, Vlad Dumitrescu wrote: >>From: "Mikael Karlsson" >> >>Thanks for the reply and code Vlad, >>as far as I understand the xmerl:export(Data, Callback) does the similar >>as your example, but that instead of a fun you provide a Callback >>module which implement every tag you want to transform as a function: > >Hi, > >I wrote that function just because I thought export wouldn't >give me what I needed, but it is possible that I didn't dig deep >enough into xmerl... > >I hope Ulf or Richard can confirm if I'm right or wrong: can >xmerl:export be used to return another XML structure too? The >examples only return text representing the XML or HTML, so I >might have been mislead into thinking that this is all >xmerl:export can do... Well, it's not that easy, but what you can do is to use the return value {'#xml-redefine#', NewData} from your callback. NewData can be a new xmerl structure that replaces the old. Xmerl will then call the export callbacks with the new structure instead of the old one. This could of course be used for re-ordering and such, but I would try not to go overboard with it. There is also the {'#xml-alias#', NewTag} that allows for synonyms, e.g. section(Data,Attrs,[{section,A},{section,B},{section,C}|_],E) -> {'#xml-alias#', h4}; section(Data,Attrs,[{section,A},{section,B}|_],E) -> {'#xml-alias#', h3}; section(Data,Attrs,[{section,A}|_],E) -> {'#xml-alias#', h2}; section(Data,Attrs,_,E) -> {'#xml-alias#', h1}. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From mikael.karlsson@REDACTED Fri Aug 30 11:14:31 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 30 Aug 2002 11:14:31 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200208301114.31721.mikael.karlsson@creado.com> Thanks for the replies Ulf, I think I get your point here: Why walk over the bridge to get water (XSLT) when you have Erlang ? :-) At first I thought XSLT was something really good, but reading things like: "XML Matters: Transcending the limits of DOM, SAX, and XSLT ", http://www-106.ibm.com/developerworks/xml/library/x-matters14.html gives me an impression that it could be better using a good functional programming language instead. /Mikael > You can of course do this by hand without too much erlang > programming. That was ultimately the reason why I quit trying to > implement XSL in xmerl (the fact that it is bloody difficult to > implement XSL efficiently was a contributing factor, of course.) > > A good first step would perhaps be to export the functionality in > xmerl_xpath that prepares the XML document for the XPATH search, > and perhaps some of the search functions as well. Then you could > write your own XSL-like Erlang module with "relative ease". > > /Uffe From etxuwig@REDACTED Fri Aug 30 11:18:35 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 30 Aug 2002 11:18:35 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200208301114.31721.mikael.karlsson@creado.com> Message-ID: Yes, given the choice, one would probably use Erlang directly instead of XSLT. It would still be nice to be able to use an existing XSLT framework, if someone else has already done the hard work, but there are fortunately tools to do that already, available to the Erlang programmer. I don't know how well they fit with xmerl, though. Perhaps someone else knows? /Uffe (who has about a thousand things he would rather do than add XSLT support to XMErl) On Fri, 30 Aug 2002, Mikael Karlsson wrote: >Thanks for the replies Ulf, > >I think I get your point here: >Why walk over the bridge to get water (XSLT) when you have >Erlang ? :-) At first I thought XSLT was something really good, >but reading things like: > >"XML Matters: Transcending the limits of DOM, SAX, and XSLT ", >http://www-106.ibm.com/developerworks/xml/library/x-matters14.html > >gives me an impression that it could be better using a good >functional programming language instead. > >/Mikael > >> You can of course do this by hand without too much erlang >> programming. That was ultimately the reason why I quit trying to >> implement XSL in xmerl (the fact that it is bloody difficult to >> implement XSL efficiently was a contributing factor, of course.) >> >> A good first step would perhaps be to export the functionality in >> xmerl_xpath that prepares the XML document for the XPATH search, >> and perhaps some of the search functions as well. Then you could >> write your own XSL-like Erlang module with "relative ease". >> >> /Uffe > > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From vlad_dumitrescu@REDACTED Fri Aug 30 12:44:51 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 30 Aug 2002 12:44:51 +0200 Subject: Section numbering using xmerl:export References: Message-ID: Thanks Ulf, Yes, what you say is about what I'd had figured. The cornerstone is that I sometimes need to replace an element with a mixed content, which I couldn't see how to use xmerl:export for. [I am implementing Zope?s template language, hope it'll be ready for a preview real soon] Maybe my traverse function will make it to the xmerl distribution after all :-) regards, Vlad ----- Original Message ----- From: "Ulf Wiger" To: "Vlad Dumitrescu" Cc: Sent: Friday, August 30, 2002 10:51 AM Subject: Re: Section numbering using xmerl:export > On Fri, 30 Aug 2002, Vlad Dumitrescu wrote: > > >>From: "Mikael Karlsson" > >> > >>Thanks for the reply and code Vlad, > >>as far as I understand the xmerl:export(Data, Callback) does the similar > >>as your example, but that instead of a fun you provide a Callback > >>module which implement every tag you want to transform as a function: > > > >Hi, > > > >I wrote that function just because I thought export wouldn't > >give me what I needed, but it is possible that I didn't dig deep > >enough into xmerl... > > > >I hope Ulf or Richard can confirm if I'm right or wrong: can > >xmerl:export be used to return another XML structure too? The > >examples only return text representing the XML or HTML, so I > >might have been mislead into thinking that this is all > >xmerl:export can do... > > Well, it's not that easy, but what you can do is to use the > return value {'#xml-redefine#', NewData} from your callback. > NewData can be a new xmerl structure that replaces the old. Xmerl > will then call the export callbacks with the new structure > instead of the old one. This could of course be used for > re-ordering and such, but I would try not to go overboard with > it. > > There is also the {'#xml-alias#', NewTag} that allows for > synonyms, e.g. > > section(Data,Attrs,[{section,A},{section,B},{section,C}|_],E) -> > {'#xml-alias#', h4}; > section(Data,Attrs,[{section,A},{section,B}|_],E) -> > {'#xml-alias#', h3}; > section(Data,Attrs,[{section,A}|_],E) -> > {'#xml-alias#', h2}; > section(Data,Attrs,_,E) -> > {'#xml-alias#', h1}. > > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice Networks > > > > From richardc@REDACTED Fri Aug 30 14:27:42 2002 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 30 Aug 2002 14:27:42 +0200 (MET DST) Subject: xmerl:export In-Reply-To: Message-ID: On Fri, 30 Aug 2002, Vlad Dumitrescu wrote: > I wrote that function just because I thought export wouldn't give me > what I needed, but it is possible that I didn't dig deep enough into > xmerl... > > can xmerl:export be used to return another XML structure too? The > examples only return text representing the XML or HTML, so I might > have been mislead into thinking that this is all xmerl:export can > do... As Ulf said, you can do some very simple on-the-fly transformations during export by using #xml-redefine#, but basically, calling export implies that you intend to move your data to a text representation. This should generally mean that you have already done all the transformations you want to do. The xml-redefine stuff is really only there for making the implementation of export formats simpler, to let you say "to handle this thing, just rewrite it to this other thing that we already know how to handle". In any case, yes, the final output will always be text. Rewriting the XML data is preferably done as one or more passes over the xmerl tree before exporting to text form (as opposed to doing it while parsing or exporting). This keeps your code cleaner. In general, trying to cram a complicated transformation into one pass tends to make a big buggy mess of your code. Don't be afraid to use several passes if it helps you clean up the transformation conceptually. When everything appears to be working, you can look at joining passes into one for the sake of speed - but don't do this unless you are pretty sure that you will not need to do any major changes to them later - in that case, just leave them separated for your own sanity. ("Compiler writers do it in multiple passes." :-) /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ From mikael.karlsson@REDACTED Fri Aug 30 19:32:30 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 30 Aug 2002 19:32:30 +0200 Subject: xmerl:export In-Reply-To: References: Message-ID: <200208301932.30492.mikael.karlsson@creado.com> fredag 30 augusti 2002 14:27 skrev Richard Carlsson: > On Fri, 30 Aug 2002, Vlad Dumitrescu wrote: > > I wrote that function just because I thought export wouldn't give me > > what I needed, but it is possible that I didn't dig deep enough into > > xmerl... > > > > can xmerl:export be used to return another XML structure too? The > > examples only return text representing the XML or HTML, so I might > > have been mislead into thinking that this is all xmerl:export can > > do... >... > Rewriting the XML data is preferably done as one or more passes over the > xmerl tree before exporting to text form (as opposed to doing it while > parsing or exporting). This keeps your code cleaner. In general, trying > to cram a complicated transformation into one pass tends to make a big > buggy mess of your code. Don't be afraid to use several passes if it > helps you clean up the transformation conceptually. >... > /Richard Thanks for all the feedback, I understood Vlads point, eventually. (Now I only need to understand how to use his function :-). The reason why I like the idea about one single pass was that I had a vague idea of using xmerl + yaws to export/publish XML documents written in the Simplified DocBook DTD on the fly. So I was i bit biased towards performance. Given all the earlier >1000/s dynamic pages yaws could do, I just thought it could be nice to have a real "heavy duty" engine for XML transform and publishing. I'll give it a second thought though, fast is not always correct... /Mikael From jilani.khaldi@REDACTED Sat Aug 31 10:57:30 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Sat, 31 Aug 2002 10:57:30 +0200 Subject: httpd_example Message-ID: Hi all, I have OTP installed and working fine on my Windows 98 box. When I call http://localhost:8888/cgi-bin/erl/httpd_example/get with the browser I see the page as expected. But when I have moved the file "http_example.beam" from c:\programs\erl\lib\inets-2.6.7\ebin to c:\var\tmp\server_root\cgi-bin I get: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. I have done some changes in some files but I can't get it working. Where and do I have to change to get httpd_example.beam (and other *.beam) to perform from: c:\var\tmp\server_root\cgi-bin? Thank you. -- Jilani Khaldi From jilani.khaldi@REDACTED Sat Aug 31 11:38:20 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Sat, 31 Aug 2002 11:38:20 +0200 Subject: inets vs. yaws Message-ID: Hi all, for medium web applications with some dynamic pages what are the pros and cons of inets and yaws. One important point is the ease of use. Thanx. -- Jilani Khaldi