From toby@REDACTED Thu Mar 1 01:16:16 2007 From: toby@REDACTED (Toby Thain) Date: Wed, 28 Feb 2007 19:16:16 -0500 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <200702282119.l1SLJpu2024774@pluto.hedeland.org> References: <200702282119.l1SLJpu2024774@pluto.hedeland.org> Message-ID: >>>> >>>> a) if "pang" means error, i think "pang" is a pretty misleading >>>> thing >>>> to be responding with :-) and "error" or "failed" or something like >>>> that would be more helpful to newbies. >>> >>> yes, that really sucks. fyi, "pang" is the sound cartoon guns >>> makes in >>> swedish. i guess way back, when the Erlang user base fit in an >>> elevator, someone >>> thought it was funny that ping could return pong (good) or pang >>> (bad). and i >>> guess it is kind of funny, but only if you speak swedish... >> >> It's also a vaguely apposite pun in English -- at least, it wasn't >> completely random to me even though I didn't know the Swedish >> meaning. > > And it's Documented(tm)!:-) Oh, now *that* takes all the Fun(tm) out of it. :) --T > > --Per Hedeland From avindev@REDACTED Thu Mar 1 03:08:29 2007 From: avindev@REDACTED (Arbow) Date: Thu, 1 Mar 2007 10:08:29 +0800 Subject: [erlang-questions] erlang-find-tag bug not solved? Message-ID: Dear Erlang/OTP team: I met the same problem like this: http://www.erlang.org/pipermail/erlang-bugs/2006-May/000180.html , my envionment is: Ubuntu 6.06 Emacs 2.3 Erlang/OTP R11B3 Best regards, Arbow From fritchie@REDACTED Thu Mar 1 04:31:44 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 28 Feb 2007 21:31:44 -0600 Subject: [erlang-questions] hybrid heap question In-Reply-To: Message of "Wed, 28 Feb 2007 21:52:26 +0100." Message-ID: <200703010331.l213ViPa062892@snookles.snookles.com> >>>>> "uw" == Ulf Wiger writes: uw> Does anyone else have some experience with SMP in OTP R11B-3? My brief experience with Mnesia in a 1-CPU-running-100% machine in a write-intensive workload(*) (to be in production use in a few months), the same load on a dual Xeon EM64T box showed both CPUs near 100% usage but very little change in total throughput. My apologies to Dan G. for not following up on his Mnesia patch work (I've been on a business trip for the last 10 days). He'd witnessed a similar pattern, and he suspects (if I recall correctly) lock inefficiencies in the ETS internals. {shrug} If that's the case, I'm a willing guinea pig for testing SMP-friendlier ETS and/or Mnesia patches.(**) -Scott (*) 80% of transactions update at least one record, ouch! (**) Sorry again, Dan! I will be returning home tomorrow and will be able to catch up shortly, I hope. From erlangist@REDACTED Thu Mar 1 08:40:37 2007 From: erlangist@REDACTED (lang er) Date: Thu, 1 Mar 2007 15:40:37 +0800 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <230465c00702270641n3d31ec57kea1184bfccc181c5@mail.gmail.com> References: <230465c00702260705h1d428117y519c123a73fa4cea@mail.gmail.com> <45e300dc.3d10d2d8.5742.4d11SMTPIN_ADDED@mx.google.com> <230465c00702270641n3d31ec57kea1184bfccc181c5@mail.gmail.com> Message-ID: <230465c00702282340r4ca09b33mb4d8068af9fa8af@mail.gmail.com> Hi, Eduardo I add a critical section before and after ei_send,now the code look like this: > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > ei_x_buff xbuf; > ei_x_new_with_version(&xbuf); > ei_x_encode_tuple_header(&xbuf,2); > ei_x_encode_atom(&xbuf,"data"); > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > EnterCriticalSection(&CriticalSection); > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > LeaveCriticalSection(&CriticalSection); > ei_x_free(&xbuf); > now the mormal running time is longer, but Erlang side still got "ERROR REPORT= Got invalid data on distribution channel, offending packet is:" error eventually. I skip first 112 of the error message<<112,131,104,3,97...>>, and use binary_to_term,get term like: > {2,'',<4761.49.0>} I search the maillisting again, and only get one post about this: http://www.erlang.org/pipermail/erlang-questions/2004-October/013383.html It looks like this problem is solved by using mutex http://www.erlang.org/pipermail/erlang-questions/2004-October/013385.html But I still have this problem. Any help is appreciable! BR James 2007/2/27, lang er : > > But in the erl_interface document, it said: > > > > If you are using Erl Interface functions in a threaded application based on POSIX threads or Solaris > > threads, then Erl Interface needs access to some of the synchronization facilities in your threads > > package, and you will need to specify additional compiler flags in order to indicate which of the > > packages you are using. Define REENTRANT and either STHREADS or PTHREADS. The default is to use > > POSIX threads if REENTRANT is specified. > > Note that both single threaded and default versions of the Erl interface and Ei libraries are provided. > > (The single threaded versions are named liberl interface st and libei st). Whether the default > > versions of the libraries have support for threads or not is determined by if the platform in question has > > support for POSIX or Solaris threads. To check this, have a look in the eidefs.mk file in the > > erl interface src directory. > > > I checked the eidefs.mk file, its content is: > > > > > > # Have the ei and erl_interface libs been compiled for threads? > EI_THREADS=true > > # Threads flags > THR_DEFS=-DWIN32_THREADS -DUSE_DECLSPEC_THREAD > > # Threads libs > THR_LIBS= > > # ---------------------------------------------------------------------- > > > Doesn't it means I don't need use any synchronization facilities myself? > > Thanks! > > James > > 2007/2/26, Eduardo Figoli (INS) : > > > > > > > > > > > Have you tried using a critical section whenever calling ei_send? > > > > > > > > Regards, Eduardo > > > > > > > > ________________________________ > > > > De: erlang-questions-bounces@REDACTED [mailto: erlang-questions-bounces@REDACTED] En nombre de lang er > > Enviado el: Lunes, 26 de Febrero de 2007 01:05 p.m. > > Para: erlang-questions@REDACTED > > Asunto: [erlang-questions] ei_send multithreaded problem > > > > > > > > > > > > I'm writing a c node using ei layer. This program is running under Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a fragment of my code: > > > > > > > > -------------------------------------------------------------------- > > > > erlang_pid *pid = (erlang_pid *)pUser; > > ei_x_buff xbuf; > > ei_x_new_with_version(&xbuf); > > ei_x_encode_tuple_header(&xbuf,2); > > ei_x_encode_atom(&xbuf,"data"); > > ei_x_encode_binary(&xbuf, buffer, bufSize); > > ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); > > ei_x_free(&xbuf); > > > > ---------------------------------------------------------------------- > > > > > > > > > > > > It is called inside a C callback function and may be called by many concurrent threads. pUser include a erlang_pid (correspond to a process in Erlang side).When some data come from network, a third party library will invoke this callback function, so ei_send pass these data to a corresponding Erlang process.(This process is an Erlang equivalent to a 3rd library thread. So if I start one process in Erlang side, the 3rd library will use one thread. If I start more than one process in Erlang , the 3rd library will use same number of threads.) > > > > > > > > > > > > Then, If I start one process in Erlang side, everything is OK. But If I start more than one process, the C node program will crash after some random time. If I comment out ei_send line in above code fragment, everything is OK again. > > > > > > > > Do I miss anything to use ei_send in multithreaded environment? > > > > > > > > compiler: ms visual studio 2005 > > > > debug mode use ei_mdd.lib > > > > > > > > > > > > > > > > Thanks, > > > > James > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Thu Mar 1 10:41:53 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 01 Mar 2007 10:41:53 +0100 Subject: [erlang-questions] Troubles with FTP In-Reply-To: References: Message-ID: <45E69FE1.7090008@erix.ericsson.se> erlang-questions-request@REDACTED wrote: > Hi, > > Im trying to use the ftp module in Erlang. When I try to download file using ftp:recv, the Erlang shell gets crashed. I am able to try out the commands like pwd and cd only. > > I can download files from the same server using normal ftp connection from my PC. But when i try it with erlang, the above mentioned problem arises. I dont get any error mesege either. Just the shell crashes. > > Can somebody help me. > > Thanks. > Have you tested it against more than one ftp-server? What ftp server is it that you are having the problem with? Alas the ftp-protocol sometimes leaves room for more than one "correct" behavior. We test it against several ftp-servers but it is not possible to cover all ftp-srvers that are out there. Could you send me the crash you get in the erlang shell. ( You can send it to me privately. ) With the crash report maybe I can help you. Regards Ingela - OTP team From ingela@REDACTED Thu Mar 1 11:29:42 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 01 Mar 2007 11:29:42 +0100 Subject: [erlang-questions] User provided authentication function in, ssh_cli In-Reply-To: References: Message-ID: <45E6AB16.8000402@erix.ericsson.se> We admit the ssh application is very sparsely documented, this will change in the future. You should however be aware that before a function is documented properly it is not considered a part of the API and may be changed without warning. Regards Ingela - OTP team > While working on an ssh based cli, using ssh_cli, I discovered an > undocumented feature. > start the listener with > ssh_cli:listen(UserFun,Port,[{pwdfun,F}]) > where > F(User,Passwd) -> true | {false,Reason} > And F will be called to vaildate the user/password. From ingela@REDACTED Thu Mar 1 13:41:03 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 01 Mar 2007 13:41:03 +0100 Subject: [erlang-questions] Troubles with FTP In-Reply-To: <967777.63791.qm@web43133.mail.sp1.yahoo.com> References: <967777.63791.qm@web43133.mail.sp1.yahoo.com> Message-ID: <45E6C9DF.3010407@erix.ericsson.se> Hi! Well ok this was a bug in inets that was solved in inets-4.5.3. When you changed erlang version you also changed inets-version. You can do for instance do code:which(ftp) in the erlang shell to see what the application version of inets is. Regards Ingela - OTP team Amila Maha Arachchi wrote: > Hi, > > Thanks for the reply. I found the reason (I believe it is the reason). > I am using vsftpd in Redhat9.My erlang version was 5.4.8. But when I > run the code in a version 5.5.2 erlang shell it worked without any > trouble. So, I think the problem was the version. > > Anyway, I am new to Erlang :-) > > You have asked to send the crash messege. But what happens is the > shell gets stuck without giving any messege. It stays like that > forever. So there is no messege to send. > > Thanks. > Amila. > > ----- Original Message ---- > From: Ingela Anderton Andin > To: erlang-questions@REDACTED > Sent: Thursday, March 1, 2007 3:11:53 PM > Subject: Re: [erlang-questions] Troubles with FTP > > erlang-questions-request@REDACTED wrote: > > Hi, > > > > Im trying to use the ftp module in Erlang. When I try to download > file using ftp:recv, the Erlang shell gets crashed. I am able to try > out the commands like pwd and cd only. > > > > I can download files from the same server using normal ftp > connection from my PC. But when i try it with erlang, the above > mentioned problem arises. I dont get any error mesege either. Just the > shell crashes. > > > > Can somebody help me. > > > > Thanks. > > > Have you tested it against more than one ftp-server? What ftp server > is it that you are having the problem with? Alas the ftp-protocol > sometimes leaves room for more than one "correct" behavior. We test it > against several ftp-servers but it is not possible to cover all > ftp-srvers that are out there. Could you send me the crash you get in > the erlang shell. ( You can send it to me privately. ) With the crash > report maybe I can help you. > > Regards Ingela - OTP team > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > ------------------------------------------------------------------------ > No need to miss a message. Get email on-the-go > > with Yahoo! Mail for Mobile. Get started. > From eduardo@REDACTED Thu Mar 1 14:18:09 2007 From: eduardo@REDACTED (Eduardo Figoli (INS)) Date: Thu, 1 Mar 2007 11:18:09 -0200 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <230465c00702282340r4ca09b33mb4d8068af9fa8af@mail.gmail.com> Message-ID: <200703011318.l21DI9eP022235@morgoth.cslab.ericsson.net> Try > EnterCriticalSection(&CriticalSection); > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > ei_x_buff xbuf; > ei_x_new_with_version(&xbuf); > ei_x_encode_tuple_header(&xbuf,2); > ei_x_encode_atom(&xbuf,"data"); > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > ei_x_free(&xbuf); > LeaveCriticalSection(&CriticalSection); Regards Eduardo _____ De: lang er [mailto:erlangist@REDACTED] Enviado el: Jueves, 01 de Marzo de 2007 05:41 a.m. Para: Eduardo Figoli (INS) CC: erlang-questions@REDACTED Asunto: Re: [erlang-questions] ei_send multithreaded problem Hi, Eduardo I add a critical section before and after ei_send,now the code look like this: > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > ei_x_buff xbuf; > ei_x_new_with_version(&xbuf); > ei_x_encode_tuple_header(&xbuf,2); > ei_x_encode_atom(&xbuf,"data"); > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > EnterCriticalSection(&CriticalSection); > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > LeaveCriticalSection(&CriticalSection); > ei_x_free(&xbuf); > now the mormal running time is longer, but Erlang side still got "ERROR REPORT= Got invalid data on distribution channel, offending packet is:" error eventually. I skip first 112 of the error message<<112,131,104,3,97...>>, and use binary_to_term,get term like: {2,'',<4761.49.0>} I search the maillisting again, and only get one post about this: http://www.erlang.org/pipermail/erlang-questions/2004-October/013383.html It looks like this problem is solved by using mutex http://www.erlang.org/pipermail/erlang-questions/2004-October/013385.html But I still have this problem. Any help is appreciable! BR James 2007/2/27, lang er : > > But in the erl_interface document, it said: > > > > If you are using Erl Interface functions in a threaded application based on POSIX threads or Solaris > > threads, then Erl Interface needs access to some of the synchronization facilities in your threads > > package, and you will need to specify additional compiler flags in order to indicate which of the > > packages you are using. Define REENTRANT and either STHREADS or PTHREADS. The default is to use > > POSIX threads if REENTRANT is specified. > > Note that both single threaded and default versions of the Erl interface and Ei libraries are provided. > > (The single threaded versions are named liberl interface st and libei st). Whether the default > > versions of the libraries have support for threads or not is determined by if the platform in question has > > support for POSIX or Solaris threads. To check this, have a look in the eidefs.mk file in the > > erl interface src directory. > > > I checked the eidefs.mk file, its content is: > > > > > > # Have the ei and erl_interface libs been compiled for threads? > EI_THREADS=true > > # Threads flags > THR_DEFS=-DWIN32_THREADS -DUSE_DECLSPEC_THREAD > > # Threads libs > THR_LIBS= > > # ---------------------------------------------------------------------- > > > Doesn't it means I don't need use any synchronization facilities myself? > > Thanks! > > James > > 2007/2/26, Eduardo Figoli (INS) : > > > > > > > > > > > Have you tried using a critical section whenever calling ei_send? > > > > > > > > Regards, Eduardo > > > > > > > > ________________________________ > > > > De: erlang-questions-bounces@REDACTED [mailto: erlang-questions-bounces@REDACTED ] En nombre de lang er > > Enviado el: Lunes, 26 de Febrero de 2007 01:05 p.m. > > Para: erlang-questions@REDACTED > > Asunto: [erlang-questions] ei_send multithreaded problem > > > > > > > > > > > > I'm writing a c node using ei layer. This program is running under Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a fragment of my code: > > > > > > > > -------------------------------------------------------------------- > > > > erlang_pid *pid = (erlang_pid *)pUser; > > ei_x_buff xbuf; > > ei_x_new_with_version(&xbuf); > > ei_x_encode_tuple_header(&xbuf,2); > > ei_x_encode_atom(&xbuf,"data"); > > ei_x_encode_binary(&xbuf, buffer, bufSize); > > ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); > > ei_x_free(&xbuf); > > > > ---------------------------------------------------------------------- > > > > > > > > > > > > It is called inside a C callback function and may be called by many concurrent threads. pUser include a erlang_pid (correspond to a process in Erlang side).When some data come from network, a third party library will invoke this callback function, so ei_send pass these data to a corresponding Erlang process.(This process is an Erlang equivalent to a 3rd library thread. So if I start one process in Erlang side, the 3rd library will use one thread. If I start more than one process in Erlang , the 3rd library will use same number of threads.) > > > > > > > > > > > > Then, If I start one process in Erlang side, everything is OK. But If I start more than one process, the C node program will crash after some random time. If I comment out ei_send line in above code fragment, everything is OK again. > > > > > > > > Do I miss anything to use ei_send in multithreaded environment? > > > > > > > > compiler: ms visual studio 2005 > > > > debug mode use ei_mdd.lib > > > > > > > > > > > > > > > > Thanks, > > > > James > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Thu Mar 1 15:00:11 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 01 Mar 2007 15:00:11 +0100 Subject: [erlang-questions] erlang-find-tag bug not solved? In-Reply-To: References: Message-ID: <45E6DC6B.8080307@erix.ericsson.se> Hi! The first problem is that the function tags-table-format-hooks was renamed to tags-table-format-functions in emacs 21 and x-emacs, so there is a need to add an appropriate cond-clause or so to use the right function for the emacs version. This ought to be a quite easy for us to do, the problem is that there has been a lot of other much higher priority tasks for us to deal with. We will try to get it in there fairly soon. The second problem regarding the syntax highlighting we will have to investigate further. Regards Ingela - OTP team > Dear Erlang/OTP team: > I met the same problem like this: > http://www.erlang.org/pipermail/erlang-bugs/2006-May/000180.html , my > envionment is: > Ubuntu 6.06 > Emacs 2.3 > Erlang/OTP R11B3 From gunilla@REDACTED Thu Mar 1 15:10:32 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Thu, 01 Mar 2007 15:10:32 +0100 Subject: [erlang-questions] [Bug] io:setopts and expand_fun option In-Reply-To: <45CF94E1.8000506@free.fr> References: <45CF94E1.8000506@free.fr> Message-ID: <45E6DED8.6090603@erix.ericsson.se> Ok, I've made a note about this. Thanks for the bug report. Regards, Gunilla, Erlang/OTP team igwan wrote: > Hello, > > I encountered a problem while playing with io:setopts trying to set the > expand_fun option : > > 5> Completion = fun("") -> {yes, "start", ["start", "stop"]}; > 5> (_) -> {no, "", ["start", "stop"]} end. > #Fun > > 6> io:setopts([{expand_fun, Completion}]). > {error,badarg} > > 7> io:setopts([binary]). > ok > > 8> io:setopts([binary, {expand_fun, Completion}]). > ok > > The problem is that setopts doesn't accept the 'expand_fun' option > alone, it has to be provided along with either 'binary' or 'list' options. > This is not stated in the documentation. > The faulty code seems to be located in kernel/group.erl : > > %% setopts > setopts(Opts0,_Drv, Buf) -> > Opts = proplists:substitute_negations([{list,binary}], Opts0), > put(expand_fun, proplists:get_value(expand_fun, Opts, get(expand_fun))), > case proplists:get_value(binary, Opts) of > true -> > put(read_mode,binary), > {ok,ok,Buf}; > false -> > put(read_mode,list), > {ok,ok,Buf}; > _ -> > {error,{error,badarg},Buf} > end. > > expand_fun is put in the process dictionary even if we get a {error, > badarg} in response. I think it is not the intended behaviour. At least, > it doesn't meet my expectation of "least astonishment" :) > > igwan From gunilla@REDACTED Thu Mar 1 15:32:12 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Thu, 01 Mar 2007 15:32:12 +0100 Subject: [erlang-questions] Report browser, remote shell In-Reply-To: <20070215205536.GA4091@frogman.motivity.ca> References: <20070215205536.GA4091@frogman.motivity.ca> Message-ID: <45E6E3EC.60209@erix.ericsson.se> Hi, I'm the main maintainer of SASL and as I was on parental leave in April 2004, unfortunately the rb patch seems to have "fallen between the chairs" as we say in Swedish. (What happens when everyone thinks someone else is taking care of someting). I'll try to find some time to look at your patch and see if it can be included in a future release. Thanks, Gunilla, Erlang/OTP team Vance Shipley wrote: > Geoff, > > I was working on this back in April of 2004. I suggested changes > to support remote (or multiuser) use of rb however no one seemed > interested. You can see my post and patches below. > > -Vance > > http://www.erlang.org/pipermail/erlang-questions/2004-April/012070.html > http://www.erlang.org/pipermail/erlang-patches/2004-April/000099.html > > On Thu, Feb 15, 2007 at 11:43:00AM +1300, Geoff Cant wrote: > } > } Hi everyone, I'm wondering if there's a way to use the report browser > } remotely. From erlangist@REDACTED Thu Mar 1 15:48:28 2007 From: erlangist@REDACTED (lang er) Date: Thu, 1 Mar 2007 22:48:28 +0800 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <45e6d292.06d5474c.238e.ffffe298SMTPIN_ADDED@mx.google.com> References: <230465c00702282340r4ca09b33mb4d8068af9fa8af@mail.gmail.com> <45e6d292.06d5474c.238e.ffffe298SMTPIN_ADDED@mx.google.com> Message-ID: <230465c00703010648h23e90bbfkc916672e569678e1@mail.gmail.com> Hi Eduardo, After the previus modification failed, I also modify code as what you give.This time the normal status last for more time than before, but eventually (about one hours later), I get this error again. The data transfered between Cnode and Erlang process is large(240k/second). I also run this program on a different machine, and use small data (4k/second), it just work fine for more than 24 hours(and I exit it manually). Thanks! BR James 2007/3/1, Eduardo Figoli (INS) : > > Try > > > EnterCriticalSection(&CriticalSection); > > > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > > ei_x_buff xbuf; > > ei_x_new_with_version(&xbuf); > > ei_x_encode_tuple_header(&xbuf,2); > > ei_x_encode_atom(&xbuf,"data"); > > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > > ei_x_free(&xbuf); > > LeaveCriticalSection(&CriticalSection); > > > > > Regards Eduardo > > > ------------------------------ > > *De:* lang er [mailto:erlangist@REDACTED] > *Enviado el:* Jueves, 01 de Marzo de 2007 05:41 a.m. > *Para:* Eduardo Figoli (INS) > *CC:* erlang-questions@REDACTED > *Asunto:* Re: [erlang-questions] ei_send multithreaded problem > > > > Hi, Eduardo > > > I add a critical section before and after ei_send,now the code look like > this: > > > > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > > ei_x_buff xbuf; > > ei_x_new_with_version(&xbuf); > > ei_x_encode_tuple_header(&xbuf,2); > > ei_x_encode_atom(&xbuf,"data"); > > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > > EnterCriticalSection(&CriticalSection); > > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > > LeaveCriticalSection(&CriticalSection); > > ei_x_free(&xbuf); > > > > > now the mormal running time is longer, but Erlang side still got "ERROR > REPORT= Got invalid data on distribution channel, offending packet is:" > error eventually. > > > I skip first 112 of the error message<<112,131,104,3,97...>>, and use > binary_to_term,get term like: > > > > {2,'',<4761.49.0>} > > > > I search the maillisting again, and only get one post about this: > > > > http://www.erlang.org/pipermail/erlang-questions/2004-October/013383.html > > > > It looks like this problem is solved by using mutex > http://www.erlang.org/pipermail/erlang-questions/2004-October/013385.html > > But I still have this problem. > > > > Any help is appreciable! > > > > BR > > > > James > > > > > 2007/2/27, lang er : > > > > But in the erl_interface document, it said: > > > > > > > If you are using Erl Interface functions in a threaded application > based on POSIX threads or Solaris > > > threads, then Erl Interface needs access to some of the > synchronization facilities in your threads > > > package, and you will need to specify additional compiler flags in > order to indicate which of the > > > packages you are using. Define REENTRANT and either STHREADS or > PTHREADS. The default is to use > > > POSIX threads if REENTRANT is specified. > > > Note that both single threaded and default versions of the Erl > interface and Ei libraries are provided. > > > (The single threaded versions are named liberl interface st and libei > st). Whether the default > > > versions of the libraries have support for threads or not is > determined by if the platform in question has > > > support for POSIX or Solaris threads. To check this, have a look in > the eidefs.mk file in the > > > erl interface src directory. > > > > > > I checked the eidefs.mk file, its content is: > > > > > > > > > > > > # Have the ei and erl_interface libs been compiled for threads? > > EI_THREADS=true > > > > # Threads flags > > THR_DEFS=-DWIN32_THREADS -DUSE_DECLSPEC_THREAD > > > > # Threads libs > > THR_LIBS= > > > > # ---------------------------------------------------------------------- > > > > > > Doesn't it means I don't need use any synchronization facilities myself? > > > > > Thanks! > > > > James > > > > 2007/2/26, Eduardo Figoli (INS) : > > > > > > > > > > > > > > > > > Have you tried using a critical section whenever calling ei_send? > > > > > > > > > > > > Regards, Eduardo > > > > > > > > > > > > ________________________________ > > > > > > > De: erlang-questions-bounces@REDACTED [mailto: erlang-questions-bounces@REDACTED > ] En nombre de lang er > > > Enviado el: Lunes, 26 de Febrero de 2007 01:05 p.m. > > > Para: erlang-questions@REDACTED > > > Asunto: [erlang-questions] ei_send multithreaded problem > > > > > > > > > > > > > > > > > > I'm writing a c node using ei layer. This program is running under > Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a > fragment of my code: > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > > erlang_pid *pid = (erlang_pid *)pUser; > > > ei_x_buff xbuf; > > > ei_x_new_with_version(&xbuf); > > > ei_x_encode_tuple_header(&xbuf,2); > > > ei_x_encode_atom(&xbuf,"data"); > > > ei_x_encode_binary(&xbuf, buffer, bufSize); > > > ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); > > > ei_x_free(&xbuf); > > > > > > ---------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > It is called inside a C callback function and may be called by many > concurrent threads. pUser include a erlang_pid (correspond to a process in > Erlang side).When some data come from network, a third party library > will invoke this callback function, so ei_send pass these data to a > corresponding Erlang process.(This process is an Erlang equivalent to a 3rd > library thread. So if I start one process in Erlang side, the 3rd library > will use one thread. If I start more than one process in Erlang , the 3rd > library will use same number of threads.) > > > > > > > > > > > > > > > > > > Then, If I start one process in Erlang side, everything is OK. But If > I start more than one process, the C node program will crash after some > random time. If I comment out ei_send line in above code fragment, > everything is OK again. > > > > > > > > > > > > Do I miss anything to use ei_send in multithreaded environment? > > > > > > > > > > > > compiler: ms visual studio 2005 > > > > > > debug mode use ei_mdd.lib > > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > James > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangist@REDACTED Thu Mar 1 16:13:55 2007 From: erlangist@REDACTED (lang er) Date: Thu, 1 Mar 2007 23:13:55 +0800 Subject: [erlang-questions] ei_send multithreaded problem In-Reply-To: <230465c00703010648h23e90bbfkc916672e569678e1@mail.gmail.com> References: <230465c00702282340r4ca09b33mb4d8068af9fa8af@mail.gmail.com> <45e6d292.06d5474c.238e.ffffe298SMTPIN_ADDED@mx.google.com> <230465c00703010648h23e90bbfkc916672e569678e1@mail.gmail.com> Message-ID: <230465c00703010713t45e79e13k1bebd67f406e8ae@mail.gmail.com> I googled another thread on TrapExit http://forum.trapexit.org/viewtopic.php?p=23802&sid=af4d7236885d03b4cac285a5073ae371 In the last post, Bob, said > Well, after much head scratching I've got it stable. Bad idea to send > messages from inside a callback function, even very small ones like just > {sync} to set off the process. It's still dog slow, it's been running a few > minutes and there are over 5000 queued messages but at least it stays up > long enough to find out why? > I don't know why he got the conclusion that it is a bad idea to send messages from inside a callback function? But I do inspect muy process, there's no unmatched message in queue. BR James 2007/3/1, lang er : > > Hi Eduardo, > > After the previus modification failed, I also modify code as what you > give.This time the normal status last for more time than before, > but eventually (about one hours later), I get this error again. > > The data transfered between Cnode and Erlang process is > large(240k/second). I also run this program on a different machine, and use > small > data (4k/second), it just work fine for more than 24 hours(and I exit it > manually). > > > Thanks! > > BR > James > 2007/3/1, Eduardo Figoli (INS) : > > > > Try > > > > > EnterCriticalSection(&CriticalSection); > > > > > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > > > ei_x_buff xbuf; > > > ei_x_new_with_version(&xbuf); > > > ei_x_encode_tuple_header(&xbuf,2); > > > ei_x_encode_atom(&xbuf,"data"); > > > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > > > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > > > ei_x_free(&xbuf); > > > LeaveCriticalSection(&CriticalSection); > > > > > > > > > > Regards Eduardo > > > > > > ------------------------------ > > > > *De:* lang er [mailto:erlangist@REDACTED] > > *Enviado el:* Jueves, 01 de Marzo de 2007 05:41 a.m. > > *Para:* Eduardo Figoli (INS) > > *CC:* erlang-questions@REDACTED > > *Asunto:* Re: [erlang-questions] ei_send multithreaded problem > > > > > > > > Hi, Eduardo > > > > > > I add a critical section before and after ei_send,now the code look like > > this: > > > > > > > erlang_pid *channel_connection_pid = (erlang_pid *)dwUser; > > > ei_x_buff xbuf; > > > ei_x_new_with_version(&xbuf); > > > ei_x_encode_tuple_header(&xbuf,2); > > > ei_x_encode_atom(&xbuf,"data"); > > > ei_x_encode_binary(&xbuf, pBuffer, dwBufSize); > > > EnterCriticalSection(&CriticalSection); > > > ei_send(acceptedFd, channel_connection_pid, xbuf.buff,xbuf.index); > > > LeaveCriticalSection(&CriticalSection); > > > ei_x_free(&xbuf); > > > > > > > > > now the mormal running time is longer, but Erlang side still got "ERROR > > REPORT= Got invalid data on distribution channel, offending packet is:" > > error eventually. > > > > > > I skip first 112 of the error message<<112,131,104,3,97...>>, and use > > binary_to_term,get term like: > > > > > > > > {2,'',<4761.49.0>} > > > > > > > > I search the maillisting again, and only get one post about this: > > > > > > > > > > http://www.erlang.org/pipermail/erlang-questions/2004-October/013383.html > > > > > > > > It looks like this problem is solved by using mutex > > > > http://www.erlang.org/pipermail/erlang-questions/2004-October/013385.html > > > > But I still have this problem. > > > > > > > > Any help is appreciable! > > > > > > > > BR > > > > > > > > James > > > > > > > > > > 2007/2/27, lang er : > > > > > > But in the erl_interface document, it said: > > > > > > > > > > If you are using Erl Interface functions in a threaded application > > based on POSIX threads or Solaris > > > > threads, then Erl Interface needs access to some of the > > synchronization facilities in your threads > > > > package, and you will need to specify additional compiler flags in > > order to indicate which of the > > > > packages you are using. Define REENTRANT and either STHREADS or > > PTHREADS. The default is to use > > > > POSIX threads if REENTRANT is specified. > > > > Note that both single threaded and default versions of the Erl > > interface and Ei libraries are provided. > > > > (The single threaded versions are named liberl interface st and > > libei st). Whether the default > > > > versions of the libraries have support for threads or not is > > determined by if the platform in question has > > > > support for POSIX or Solaris threads. To check this, have a look in > > the eidefs.mk file in the > > > > erl interface src directory. > > > > > > > > > I checked the eidefs.mk file, its content is: > > > > > > > > > > > > > > > > > > # Have the ei and erl_interface libs been compiled for threads? > > > EI_THREADS=true > > > > > > # Threads flags > > > THR_DEFS=-DWIN32_THREADS -DUSE_DECLSPEC_THREAD > > > > > > # Threads libs > > > THR_LIBS= > > > > > > # > > ---------------------------------------------------------------------- > > > > > > > > > Doesn't it means I don't need use any synchronization facilities > > myself? > > > > > > Thanks! > > > > > > James > > > > > > 2007/2/26, Eduardo Figoli (INS) : > > > > > > > > > > > > > > > > > > > > > > > Have you tried using a critical section whenever calling ei_send? > > > > > > > > > > > > > > > > Regards, Eduardo > > > > > > > > > > > > > > > > ________________________________ > > > > > > > > > > De: erlang-questions-bounces@REDACTED [mailto: erlang-questions-bounces@REDACTED > > ] En nombre de lang er > > > > Enviado el: Lunes, 26 de Febrero de 2007 01:05 p.m. > > > > Para: erlang-questions@REDACTED > > > > Asunto: [erlang-questions] ei_send multithreaded problem > > > > > > > > > > > > > > > > > > > > > > > > I'm writing a c node using ei layer. This program is running under > > Window 2003 enterprise edition sp1, and otp_win32_R11B-3. The following is a > > fragment of my code: > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > > > > erlang_pid *pid = (erlang_pid *)pUser; > > > > ei_x_buff xbuf; > > > > ei_x_new_with_version(&xbuf); > > > > ei_x_encode_tuple_header(&xbuf,2); > > > > ei_x_encode_atom(&xbuf,"data"); > > > > ei_x_encode_binary(&xbuf, buffer, bufSize); > > > > ei_send(acceptedFd, pid, xbuf.buff,xbuf.index); > > > > ei_x_free(&xbuf); > > > > > > > > > > ---------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > It is called inside a C callback function and may be called by many > > concurrent threads. pUser include a erlang_pid (correspond to a process in > > Erlang side).When some data come from network, a third party library > > will invoke this callback function, so ei_send pass these data to a > > corresponding Erlang process.(This process is an Erlang equivalent to a 3rd > > library thread. So if I start one process in Erlang side, the 3rd library > > will use one thread. If I start more than one process in Erlang , the 3rd > > library will use same number of threads.) > > > > > > > > > > > > > > > > > > > > > > > > Then, If I start one process in Erlang side, everything is OK. But > > If I start more than one process, the C node program will crash after some > > random time. If I comment out ei_send line in above code fragment, > > everything is OK again. > > > > > > > > > > > > > > > > Do I miss anything to use ei_send in multithreaded environment? > > > > > > > > > > > > > > > > compiler: ms visual studio 2005 > > > > > > > > debug mode use ei_mdd.lib > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > James > > > > > > > > > > > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gunilla@REDACTED Thu Mar 1 16:35:04 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Thu, 01 Mar 2007 16:35:04 +0100 Subject: [erlang-questions] Supervisor does not restart Gen Server In-Reply-To: <85d11a2e0702200441s70e374aei94e0500991cc7fc0@mail.gmail.com> References: <85d11a2e0702200441s70e374aei94e0500991cc7fc0@mail.gmail.com> Message-ID: <45E6F2A8.1050400@erix.ericsson.se> Hi, This is a really tricky one! My guess is that you start the supervisor from the Erlang shell, right? Since supervisor only has the start_link alternative, you'll get a link between the shell process and the supervisor. Then you call zuzu:do(0), which I would guess calls gen_server:call/2. The gen_server receives the request, does a division by zero and subsequently terminates. The supervisor notices the gen_server has terminated and restarts it. Unfortunately, since the original gen_server process terminated, the call to zuzu:do(0) failed. Which means that the shell process terminates. And the shell process was linked to the supervisor, which means that now also the supervisor terminates. Solution? Calling "catch zuzu:do(0)" should do the trick. Regards, Gunilla, Erlang/OTP team Gurgen Tumanian wrote: > Hello everybody. > > In my application i have a set of gen_servers orginized in a simple one > level supervision tree, with one superviser above all. Now the problem > that i have , is that once one of my gen_servers is crashed, the > supervisor does not restart it, and what is even worse - dies himself. > I have simplified the problem, creating a simple gen server in which a > badarith can be initiated(divide by zero) and a > simple supervisor, which should have restarted it in case of crash by > one_to_one strategy. > > now when starting the supervisor, and then calling the zuzu:do(0) > (causing the badmatch) > i get the crash of the worker gen_serv, and then the supervisor > crashes.Supervior's crash report is > =CRASH REPORT==== 20-Feb-2007::16:35:12 === > crasher: > pid: <0.41.0> > registered_name: [] > error_info: {{badarith,[{zuzu,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]}, > {gen_server,call,[zuzu_serv,{do,0},35000]}} > initial_call: {gen,init_it, > [gen_server, > <0.39.0>, > <0.39.0>, > supervisor, > {self,bubu,[]}, > []]} > ancestors: [<0.39.0>] > messages: [] > links: [] > dictionary: [] > trap_exit: true > status: running > heap_size: 233 > stack_size: 21 > reductions: 227 > neighbours: > > I get the feeling that the supervisor dies as it pasess the restart > limit, but that's a quite surprise for me, as the first start of the > worker proc pases normally. > I will be greatfull for any advice on this issue. > > Regards > Gurgen Tumanyan, Smart Tech From anders.nygren@REDACTED Fri Mar 2 00:44:53 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 1 Mar 2007 17:44:53 -0600 Subject: [erlang-questions] Deleting millions of rows in mnesia Message-ID: Hi I have a mnesia table that collects some data during one month, and then it should be cleared, in order to collect data for the next month. The table could be up to 10 million rows. What is the best way to clear the table? - mnesia:clear_table/1 - delete and recreate the table I suspect that clear_table/1 could give a bad bump in cpu and memory usage. /Anders From bengt.kleberg@REDACTED Fri Mar 2 07:29:01 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 02 Mar 2007 07:29:01 +0100 Subject: [erlang-questions] Deleting millions of rows in mnesia In-Reply-To: References: Message-ID: <45E7C42D.8030300@ericsson.com> On 2007-03-02 00:44, Anders Nygren wrote: > Hi > I have a mnesia table that collects some data during one month, and then > it should be cleared, in order to collect data for the next month. > The table could be up to 10 million rows. > > What is the best way to clear the table? > - mnesia:clear_table/1 > - delete and recreate the table i would be greatful i you filled a table and measured both ways and then email this list with the result. please include erlang version, operating system and hardware. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From ulf@REDACTED Fri Mar 2 08:51:34 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 02 Mar 2007 08:51:34 +0100 Subject: [erlang-questions] Deleting millions of rows in mnesia In-Reply-To: <45E7C42D.8030300@ericsson.com> References: <45E7C42D.8030300@ericsson.com> Message-ID: Den 2007-03-02 07:29:01 skrev Bengt Kleberg : > On 2007-03-02 00:44, Anders Nygren wrote: >> Hi >> I have a mnesia table that collects some data during one month, and then >> it should be cleared, in order to collect data for the next month. >> The table could be up to 10 million rows. >> >> What is the best way to clear the table? >> - mnesia:clear_table/1 >> - delete and recreate the table > > i would be greatful i you filled a table and measured both ways and then > email this list with the result. please include erlang version, > operating system and hardware. I agree. I don't suspect clear_table/1 to be necessarily more expensive than delete_table/create_table. The only thing I paused at when browsing through the code was a call to dets:match_delete(Tab, '_'). I don't know if this is faster than simply deleting the file and creating a new one, but presumably someone has thought about that... (: Semantically, there's a difference in that if you call mnesia:delete_table(Tab), mnesia:create_table(Tab, Opts), there is no possibility of rollback(*), and the table will actually disappear for a while, which may or may not be difficult to handle for other parts of the application. A construct that is more similar to clear_table/1 would be mnesia:activity( transaction, fun() -> mnesia_schema:do_delete_table(Tab), Cs = mnesia_schema:list2cs([{name,Tab}|Opts]), mnesia_schema:do_create_table(Cs) end). (*) The issue of rollback is less important, since clear_table, as it is currently implemented, cannot be combined with any other operation within the same transaction. There is a do_clear_table/1, but it can only be combined with operations that do not address the same table. The main difference that remains, then, is the fact that the table doesn't mysteriously disappear for a while. BR, Ulf W -- Ulf Wiger From chandrashekhar.mullaparthi@REDACTED Fri Mar 2 11:03:23 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 2 Mar 2007 10:03:23 +0000 Subject: [erlang-questions] Deleting millions of rows in mnesia In-Reply-To: References: <45E7C42D.8030300@ericsson.com> Message-ID: On 02/03/07, Ulf Wiger wrote: > Den 2007-03-02 07:29:01 skrev Bengt Kleberg : > > > On 2007-03-02 00:44, Anders Nygren wrote: > >> Hi > >> I have a mnesia table that collects some data during one month, and then > >> it should be cleared, in order to collect data for the next month. > >> The table could be up to 10 million rows. > >> > >> What is the best way to clear the table? > >> - mnesia:clear_table/1 > >> - delete and recreate the table > > > Semantically, there's a difference in that if you > call mnesia:delete_table(Tab), mnesia:create_table(Tab, Opts), > there is no possibility of rollback(*), and the table will > actually disappear for a while, which may or may not be > difficult to handle for other parts of the application. What I would do in such a case is two have two identical tables with different names, say A and B. You have some other config which indicates which is the "active" table. Any process which needs to access this table reads the config to figure out whether it should access A or B. When the time comes for the active table to be purged, change the config to point to the standby table. Then take all the time you need to empty the old table. Chandru From mazen@REDACTED Fri Mar 2 12:09:26 2007 From: mazen@REDACTED (Mazen) Date: Fri, 02 Mar 2007 11:09:26 +0000 Subject: [erlang-questions] Deleting millions of rows in mnesia References: Message-ID: <20070302110926.F34E05A1FC@mail.erlangsystems.com> I would agree that this would be a good solution if the operation of emptying the table would happen frequently. However if you only wish to clear it once every month you would probably make your program less efficient since the total amount of time checking for which table to go to everytime you want to read/write would probably take longer then just mnesia:clear_table/1 (or delete/recreate) once a month :) The real question imho is if the small gain (because I bet its a very small difference) of performing the more efficient operation is a necessary optimization for something that is done once a month. Anyway... My tests showed: mazen@REDACTED:~/Desktop/test> erl Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [kernel-poll:false] Eshell V5.5.3  (abort with ^G) 1> mnesia:create_schema([]). ok 2> mnesia:start(). ok 3> l(test). {module,test} 4> test:create(). {atomic,ok} 5> test:fill(10000000). ok 6> test:clear_table(). Clear time: 6272344 ok 7> test:fill(10000000). ok 8> test:delete_table(). Delete/Create time: 6462585 ok 9> Using this code: -module(test). -author('code@REDACTED'). -copyright('Erlang Training & Consulting Ltd.'). -vsn("$Rev$"). -export([create/0,fill/1,clear_table/0,delete_table/0]). -record(row, {cell1,cell2,cell3,cell4}). create() ->     mnesia:create_table(test, [{record_name, row},                                {attributes, record_info(fields, row)},                                {type, set}]). fill(0) -> ok; fill(N) -> mnesia:dirty_write(test,#row{cell1=now()}), fill(N-1). clear_table() ->     T1 = now(),     mnesia:clear_table(test),     T2 = now(),     io:format("Clear time: ~p ~n",[timer:now_diff(T2,T1)]). delete_table() ->     T1 = now(),     mnesia:delete_table(test),     create(),     T2 = now(),     io:format("Delete/Create time: ~p ~n",[timer:now_diff(T2,T1)]). Enough to convince me anyway that mnesia:clear_table/1 is prefered taking into consideration what Ulf mentioned. What took the longest was the writes (of course). /Mazen Guest wrote: ... What I would do in such a case is two have two identical tables with different names, say A and B. You have some other config which indicates which is the "active" table. Any process which needs to access this table reads the config to figure out whether it should access A or B. When the time comes for the active table to be purged, change the config to point to the standby table. Then take all the time you need to empty the old table. Chandru _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions Post recived from mailinglist (end of quote) _________________________________________________________ Post sent from http://www.trapexit.org From Martin.Logan@REDACTED Fri Mar 2 18:05:33 2007 From: Martin.Logan@REDACTED (Logan, Martin) Date: Fri, 2 Mar 2007 11:05:33 -0600 Subject: [erlang-questions] Is UBF still going, or did it morph/fade? In-Reply-To: <20070222042055.GA732@samizdatdigital.com> References: <20070222042055.GA732@samizdatdigital.com> Message-ID: <26AB42AB6A76E2419D26E66ECF153846EDB674@chiresexc02.resource.corp.lcl> I don't know for sure but I suspect it faded - I have seen or heard nothing about it for quite a few years now. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Jonathan Gold Sent: Wednesday, February 21, 2007 10:21 PM To: erlang-questions@REDACTED Subject: [erlang-questions] Is UBF still going, or did it morph/fade? I'm getting started on a fresh project and, first things first, need to build out some sweet-ass messaging backbone action. I like a lot of things about UBF as I read it in Joe's paper and on his site, but a search through this list shows very little activity or consensus in the last 3-4 years, and not much activity of any sort since 2003. Did work with UBF get subsumed into a differently-acronymed project, or is it just gone entirely? jon _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From fritchie@REDACTED Fri Mar 2 22:46:05 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 02 Mar 2007 15:46:05 -0600 Subject: [erlang-questions] Timeouts: gen_server:call or multi_call, and erlang:monitor Message-ID: <200703022146.l22Lk5W9072412@snookles.snookles.com> Good afternoon, all. I've found something odd regarding timeout handling with gen_server:call and gen_server:multi_call. There are cases where: gen_server:call({some_server, some@REDACTED}, some_term, 1000) ... can take much longer than 1000 milliseconds before timing out. It looks like the problem is erlang:monitor/2. If I suspend the 'some@REDACTED' VM with control-Z, I can see this behavior(*): (t@REDACTED)47> timer:tc(erlang, monitor, [process,{foo_srvr,'s2@REDACTED'}]). {7005921,#Ref<0.0.0.2791>} (That's using R11B-3, with whatever default value is for -kernel net_ticktime (60 seconds?).) Has anyone had a little/big problem with this kind of timeout? The control-Z suspension is quite harsh, but it does a not-too-bad job of simulating an alive-but-very-slow remote node. -Scott (*) In a tiny amount of experimenting, erlang:monitor(process, Pid) when is_pid(Pid) == true shows the same 7 second delay. From dmitriid@REDACTED Sat Mar 3 10:56:52 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Sat, 03 Mar 2007 11:56:52 +0200 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf Message-ID: <45E94664.4090009@gmail.com> http://pragmaticprogrammer.com/titles/jaerlang/index.html Is this it? Is this THE book? Cant' wait! Can't wait! :) Found out about it long way through here: http://groups.google.com/group/columbusrb/browse_thread/thread/79db0d9217278b4e/9f99835bbe36f70c?q=erlang&rnum=3#9f99835bbe36f70c From dmitriid@REDACTED Sat Mar 3 15:01:44 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Sat, 03 Mar 2007 16:01:44 +0200 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> References: <45E94664.4090009@gmail.com> <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> Message-ID: <45E97FC8.2070303@gmail.com> I still haven't gotten around to getting a Mastercard for myself :) But I like what I've seen from the two excerpts on the site. And I'm _definitely_ getting that book! Joe Armstrong wrote: > Yes > > It was supposed to be announced next Tuesday but ... > > You may have noticed that I haven't been posting much here, currently > all hobby > projects are on-hold. > > The book is now in Beta (following the usual Pragmatic Publishing > cycle) - this means > the book is 70% ready - the last four chapters are still to be > written, and I can change > stuff before it's too late. > > So have a good read and tell me if you don't understand anything or > need more > explanations. > > Cheers > > /Joe > > > On 3/3/07, Dmitrii 'Mamut' Dimandt wrote: >> http://pragmaticprogrammer.com/titles/jaerlang/index.html >> >> Is this it? Is this THE book? Cant' wait! Can't wait! >> >> :) >> >> >> Found out about it long way through here: >> http://groups.google.com/group/columbusrb/browse_thread/thread/79db0d9217278b4e/9f99835bbe36f70c?q=erlang&rnum=3#9f99835bbe36f70c >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > From erlang@REDACTED Sat Mar 3 14:58:15 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 3 Mar 2007 14:58:15 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <45E94664.4090009@gmail.com> References: <45E94664.4090009@gmail.com> Message-ID: <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> Yes It was supposed to be announced next Tuesday but ... You may have noticed that I haven't been posting much here, currently all hobby projects are on-hold. The book is now in Beta (following the usual Pragmatic Publishing cycle) - this means the book is 70% ready - the last four chapters are still to be written, and I can change stuff before it's too late. So have a good read and tell me if you don't understand anything or need more explanations. Cheers /Joe On 3/3/07, Dmitrii 'Mamut' Dimandt wrote: > http://pragmaticprogrammer.com/titles/jaerlang/index.html > > Is this it? Is this THE book? Cant' wait! Can't wait! > > :) > > > Found out about it long way through here: > http://groups.google.com/group/columbusrb/browse_thread/thread/79db0d9217278b4e/9f99835bbe36f70c?q=erlang&rnum=3#9f99835bbe36f70c > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Sat Mar 3 16:19:41 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sat, 3 Mar 2007 07:19:41 -0800 (PST) Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <45E94664.4090009@gmail.com> Message-ID: <960696.18944.qm@web38806.mail.mud.yahoo.com> --- Dmitrii 'Mamut' Dimandt wrote: > http://pragmaticprogrammer.com/titles/jaerlang/index.html > > Is this it? Is this THE book? Cant' wait! Can't > wait! Cool. I'll get a copy. It's not like my shelves overflow with Erlang books. Best, Thomas ____________________________________________________________________________________ Want to start your own business? Learn how on Yahoo! Small Business. http://smallbusiness.yahoo.com/r-index From erlang@REDACTED Sat Mar 3 19:42:27 2007 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 3 Mar 2007 19:42:27 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <960696.18944.qm@web38806.mail.mud.yahoo.com> References: <45E94664.4090009@gmail.com> <960696.18944.qm@web38806.mail.mud.yahoo.com> Message-ID: <9b08084c0703031042s52e3b283q66775dedbf81c51@mail.gmail.com> Wonderful - you can read a little about it in http://armstrongonsoftware.blogspot.com/2007/03/hasta-la-vista-baby.html /Joe On 3/3/07, Thomas Lindgren wrote: > > --- Dmitrii 'Mamut' Dimandt > wrote: > > > > http://pragmaticprogrammer.com/titles/jaerlang/index.html > > > > Is this it? Is this THE book? Cant' wait! Can't > > wait! > > Cool. I'll get a copy. It's not like my shelves > overflow with Erlang books. > > Best, > Thomas > > > > > ____________________________________________________________________________________ > Want to start your own business? > Learn how on Yahoo! Small Business. > http://smallbusiness.yahoo.com/r-index > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ugglan@REDACTED Sat Mar 3 20:33:09 2007 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Sat, 3 Mar 2007 20:33:09 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <9b08084c0703031042s52e3b283q66775dedbf81c51@mail.gmail.com> References: <45E94664.4090009@gmail.com> <960696.18944.qm@web38806.mail.mud.yahoo.com> <9b08084c0703031042s52e3b283q66775dedbf81c51@mail.gmail.com> Message-ID: <5c402a550703031133w17093844ib4bea0052eb0d6ac@mail.gmail.com> I bought it as soon as I saw it was available! I've only skimmed through it so far but it looks absolutely excellent. It looks like the book I wish I had when I started out experimenting with Erlang, but even as a now moderately experienced Erlang-programmer it seems to contain an interesting breadth of information that I've missed out on when teaching myself Erlang through the standard documentation and experimenting. It will be a welcome addition to my library when the final paper version is ready! /Tobias On 3/3/07, Joe Armstrong wrote: > > Wonderful - you can read a little about it in > > http://armstrongonsoftware.blogspot.com/2007/03/hasta-la-vista-baby.html > > /Joe > > > > On 3/3/07, Thomas Lindgren wrote: > > > > --- Dmitrii 'Mamut' Dimandt > > wrote: > > > > > > > http://pragmaticprogrammer.com/titles/jaerlang/index.html > > > > > > Is this it? Is this THE book? Cant' wait! Can't > > > wait! > > > > Cool. I'll get a copy. It's not like my shelves > > overflow with Erlang books. > > > > Best, > > Thomas > > > > > > > > > > > ____________________________________________________________________________________ > > Want to start your own business? > > Learn how on Yahoo! Small Business. > > http://smallbusiness.yahoo.com/r-index > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cyberhigh@REDACTED Sat Mar 3 20:39:17 2007 From: cyberhigh@REDACTED (CyBerHigh) Date: Sat, 3 Mar 2007 13:39:17 -0600 Subject: [erlang-questions] [Erlyaws-list] String Support, The most needed feature In-Reply-To: <7fa241f30703031123u2763747cl70ee44f02cdaeeca@mail.gmail.com> References: <20e98f0e0703031020q6ebf4bk4f493799ec8b725d@mail.gmail.com> <7fa241f30703031123u2763747cl70ee44f02cdaeeca@mail.gmail.com> Message-ID: <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> On 3/3/07, Martin Logan wrote: > > What exactly did you find so difficult that it was easier to reinvent > one of the major benefits of Erlang with Python rather than to suffer > through that element of string handling? > > On 3/3/07, CyBerHigh wrote: > > This is my own personal view of erlang. > > > > Erlang is going to be left far behind because it is liking only one > feature, > > true String support. All modern languages have an abstraction layer > over > > strings except for erlang. If you want to have a popular language you > need > > it. I love every feature of erlang and its coding style but I hate the > fact > > that I cannot handle strings very easly and that strings take up huge > > amounts of memory. In fact I was attempting to user erlang for my > project > > but found that handling strings was so much work that it was easier to > use > > other languages like python with stackless then create my own rcp > interface. > > Which is now pretty similar to erlang without all the nice coding > styles of > > erlang. > > > > Is there any movement to create a better string interface? Cause I > would > > love to come back to erlang and use it and get the name out there more > than > > it is currently but untill there is such a thing I just can't find > myself > > using it. > > > > Thank you > > CyberHigh > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Erlyaws-list mailing list > > Erlyaws-list@REDACTED > > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > > > > > Python is very good with string. In fact I enjoy its string syntax more than perl and other string processing languages. I am not actually reinventing anything, stackless offers message passing and microthreads just like erlang. I am moving to a more erlang style of code but doing so is not requiring much work. I just feel there is no reason why I need to actually think of a string as a list of characters, unless I am in c. It is nice that I don't need to have end of string characters but I feel that elangs biggest short coming is the fact that strings are not the easiest thing to handle. Erlang should be able to act like a string processing language, offering easy to use things like regular expressions quick split operations and other nice string tools. Just seems like that would be a big priority to be able to compete with all of these new languages popping up and are started to implement erlang's good things. Python is even started to get a on-the-fly programming model which erlang has. Plus there are tools to be able to do it in just about any popular language now a days. So the list of things that erlang has that others don't is becoming short. Erlang still seems to have it implemented better than other languages, but it missing string handling capability's that other languages do so well that they almost make up for the erlangs slight betterment of implantation. Is there something I am missing about erlangs string capability's, or is there a movement to add better methods to erlang? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sat Mar 3 21:40:56 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 3 Mar 2007 12:40:56 -0800 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <5c402a550703031133w17093844ib4bea0052eb0d6ac@mail.gmail.com> References: <45E94664.4090009@gmail.com> <960696.18944.qm@web38806.mail.mud.yahoo.com> <9b08084c0703031042s52e3b283q66775dedbf81c51@mail.gmail.com> <5c402a550703031133w17093844ib4bea0052eb0d6ac@mail.gmail.com> Message-ID: <6a36e7290703031240q5726284i86a5b49e2351146c@mail.gmail.com> I bought it as soon as I heard about it yesterday as well. It's definitely the best resource I've seen so far, hands down. In fact, before the book, I always pointed people at Joe's thesis... because that's what made Erlang really "click" for me. Unfortunately the parts of the book that I really wanted to read was about 25% of the 30% that's not yet available in the beta. I'm really looking forward to the rest of it, and I'll be recommending the book to *everyone* who wants to learn Erlang. -bob On 3/3/07, Tobias L?fgren wrote: > I bought it as soon as I saw it was available! > > I've only skimmed through it so far but it looks absolutely excellent. It > looks like the book I wish I had when I started out experimenting with > Erlang, but even as a now moderately experienced Erlang-programmer it seems > to contain an interesting breadth of information that I've missed out on > when teaching myself Erlang through the standard documentation and > experimenting. > > It will be a welcome addition to my library when the final paper version is > ready! > > /Tobias > > > > On 3/3/07, Joe Armstrong < erlang@REDACTED> wrote: > > Wonderful - you can read a little about it in > > > > > http://armstrongonsoftware.blogspot.com/2007/03/hasta-la-vista-baby.html > > > > /Joe > > > > > > > > On 3/3/07, Thomas Lindgren wrote: > > > > > > --- Dmitrii 'Mamut' Dimandt > > > wrote: > > > > > > > > > > > http://pragmaticprogrammer.com/titles/jaerlang/index.html > > > > > > > > Is this it? Is this THE book? Cant' wait! Can't > > > > wait! > > > > > > Cool. I'll get a copy. It's not like my shelves > > > overflow with Erlang books. > > > > > > Best, > > > Thomas > > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > > Want to start your own business? > > > Learn how on Yahoo! Small Business. > > > http://smallbusiness.yahoo.com/r-index > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From bob@REDACTED Sat Mar 3 21:46:10 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 3 Mar 2007 12:46:10 -0800 Subject: [erlang-questions] [Erlyaws-list] String Support, The most needed feature In-Reply-To: <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> References: <20e98f0e0703031020q6ebf4bk4f493799ec8b725d@mail.gmail.com> <7fa241f30703031123u2763747cl70ee44f02cdaeeca@mail.gmail.com> <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> Message-ID: <6a36e7290703031246v3190fcecm5b66929f5041d667@mail.gmail.com> On 3/3/07, CyBerHigh wrote: > > > On 3/3/07, Martin Logan wrote: > > What exactly did you find so difficult that it was easier to reinvent > > one of the major benefits of Erlang with Python rather than to suffer > > through that element of string handling? > > > > On 3/3/07, CyBerHigh < cyberhigh@REDACTED> wrote: > > > This is my own personal view of erlang. > > > > > > Erlang is going to be left far behind because it is liking only one > feature, > > > true String support. All modern languages have an abstraction layer > over > > > strings except for erlang. If you want to have a popular language you > need > > > it. I love every feature of erlang and its coding style but I hate the > fact > > > that I cannot handle strings very easly and that strings take up huge > > > amounts of memory. In fact I was attempting to user erlang for my > project > > > but found that handling strings was so much work that it was easier to > use > > > other languages like python with stackless then create my own rcp > interface. > > > Which is now pretty similar to erlang without all the nice coding > styles of > > > erlang. > > > > > > Is there any movement to create a better string interface? Cause I > would > > > love to come back to erlang and use it and get the name out there more > than > > > it is currently but untill there is such a thing I just can't find > myself > > > using it. > > > > > > Thank you > > > CyberHigh > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Erlyaws-list mailing list > > > Erlyaws-list@REDACTED > > > > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > > > > > > > > > > Python is very good with string. In fact I enjoy its string syntax more > than perl and other string processing languages. I am not actually > reinventing anything, stackless offers message passing and microthreads just > like erlang. I am moving to a more erlang style of code but doing so is not > requiring much work. I just feel there is no reason why I need to actually > think of a string as a list of characters, unless I am in c. It is nice > that I don't need to have end of string characters but I feel that elangs > biggest short coming is the fact that strings are not the easiest thing to > handle. Erlang should be able to act like a string processing language, > offering easy to use things like regular expressions quick split operations > and other nice string tools. Just seems like that would be a big priority > to be able to compete with all of these new languages popping up and are > started to implement erlang's good things. Python is even started to get a > on-the-fly programming model which erlang has. Plus there are tools to be > able to do it in just about any popular language now a days. So the list of > things that erlang has that others don't is becoming short. Erlang still > seems to have it implemented better than other languages, but it missing > string handling capability's that other languages do so well that they > almost make up for the erlangs slight betterment of implantation. > > Is there something I am missing about erlangs string capability's, or is > there a movement to add better methods to erlang? Your complaints about Erlang's string handling are really vague. Regular expressions and split operations are available in the stdlib. What are you really missing? As far as memory goes... if you actually have a problem with the overhead of lists-as-strings there's always binaries and iolist. The syntax is a bit uglier and there's not really much stdlib support for that, but I've seen libraries floating around that have a string ops that work on binaries. -bob From orbitz@REDACTED Sat Mar 3 21:54:24 2007 From: orbitz@REDACTED (orbitz@REDACTED) Date: Sat, 3 Mar 2007 15:54:24 -0500 Subject: [erlang-questions] [Erlyaws-list] String Support, The most needed feature In-Reply-To: <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> References: <20e98f0e0703031020q6ebf4bk4f493799ec8b725d@mail.gmail.com> <7fa241f30703031123u2763747cl70ee44f02cdaeeca@mail.gmail.com> <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> Message-ID: <16EBC4BF-0A34-43BD-9873-7F7760BC5EFF@ezabel.com> I'm not sure if Erlang is necessarily lacking anything in the string department, but the problem is probably based more around how to actually deal with strings. In many popular language (not Haskell has the same concept of strings that Erlang does, for the most part), accessing an element of a string is O(1) but in Erlang it is O(n). To me this means that when you do things with strings you are generally going to have to do them in terms of tail ends. What I mean by this is in Python you mind do idx = mystring.find(foo) And you get an idx and go there and work with it. In Erlang this would become mylist = find(mystring, foo), and find would return the remaining list so you can work across the string. This has the most obvious problem of not allowing you to go backwards through the string, so you can't find things prior to some landmark you are working for. That said, I do sometimes think perhaps a container that has O(1) random access time might be nice in Erlang. In Haskell we have Array which works wonderful for those situations. In Erlang the closest we have is a Binary which is limited to bytes as far as I can tell so I wouldn't call it a true container. So the conclusion I'm trying to reach is, Erlang doesn't need a string layer, it needs a new container for these kind of situations. On Mar 3, 2007, at 2:39 PM, CyBerHigh wrote: > > > On 3/3/07, Martin Logan wrote: What > exactly did you find so difficult that it was easier to reinvent > one of the major benefits of Erlang with Python rather than to suffer > through that element of string handling? > > On 3/3/07, CyBerHigh < cyberhigh@REDACTED> wrote: > > This is my own personal view of erlang. > > > > Erlang is going to be left far behind because it is liking only > one feature, > > true String support. All modern languages have an abstraction > layer over > > strings except for erlang. If you want to have a popular > language you need > > it. I love every feature of erlang and its coding style but I > hate the fact > > that I cannot handle strings very easly and that strings take up > huge > > amounts of memory. In fact I was attempting to user erlang for > my project > > but found that handling strings was so much work that it was > easier to use > > other languages like python with stackless then create my own rcp > interface. > > Which is now pretty similar to erlang without all the nice > coding styles of > > erlang. > > > > Is there any movement to create a better string interface? Cause > I would > > love to come back to erlang and use it and get the name out there > more than > > it is currently but untill there is such a thing I just can't > find myself > > using it. > > > > Thank you > > CyberHigh > > > > > ---------------------------------------------------------------------- > --- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Erlyaws-list mailing list > > Erlyaws-list@REDACTED > > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > > > > > > Python is very good with string. In fact I enjoy its string syntax > more than perl and other string processing languages. I am not > actually reinventing anything, stackless offers message passing and > microthreads just like erlang. I am moving to a more erlang style > of code but doing so is not requiring much work. I just feel there > is no reason why I need to actually think of a string as a list of > characters, unless I am in c. It is nice that I don't need to have > end of string characters but I feel that elangs biggest short > coming is the fact that strings are not the easiest thing to > handle. Erlang should be able to act like a string processing > language, offering easy to use things like regular expressions > quick split operations and other nice string tools. Just seems > like that would be a big priority to be able to compete with all of > these new languages popping up and are started to implement > erlang's good things. Python is even started to get a on-the-fly > programming model which erlang has. Plus there are tools to be > able to do it in just about any popular language now a days. So > the list of things that erlang has that others don't is becoming > short. Erlang still seems to have it implemented better than other > languages, but it missing string handling capability's that other > languages do so well that they almost make up for the erlangs > slight betterment of implantation. > > Is there something I am missing about erlangs string capability's, > or is there a movement to add better methods to erlang? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From brian@REDACTED Sat Mar 3 22:03:51 2007 From: brian@REDACTED (Brian Olsen) Date: Sat, 3 Mar 2007 16:03:51 -0500 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <45E94664.4090009@gmail.com> References: <45E94664.4090009@gmail.com> Message-ID: <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> Hello, I suppose I am in the position as everyone else is here: I bought the book right away once I saw this email. I am still on Chapter 1, and even though I know what I am reading already, I really like the very sort of minimal voice when describing the language. I really look forward on the chapters about OTP, in interest to get an even better understanding of it. I think that even though this has already been mentioned on the site's errata page from someone, I think a short introduction to the why's of Erlang would be nice. I mean, if someone is picking up the book, they already know Erlang, but it seems nice anyway. Brian From bob@REDACTED Sat Mar 3 22:18:16 2007 From: bob@REDACTED (Bob Ippolito) Date: Sat, 3 Mar 2007 13:18:16 -0800 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> Message-ID: <6a36e7290703031318l7e747eb4q1463c7b0ec0b84a3@mail.gmail.com> Yeah, some of the history of and justification for Erlang from Joe's thesis would probably make sense in the beginning of the book... to really hammer home why someone would bother with Erlang, and why it turned out looking the way it does. -bob On 3/3/07, Brian Olsen wrote: > Hello, > > I suppose I am in the position as everyone else is here: I bought the > book right away once I saw this email. > > I am still on Chapter 1, and even though I know what I am reading > already, I really like the very sort of minimal voice when describing > the language. I really look forward on the chapters about OTP, in > interest to get an even better understanding of it. > > I think that even though this has already been mentioned on the site's > errata page from someone, I think a short introduction to the why's of > Erlang would be nice. I mean, if someone is picking up the book, they > already know Erlang, but it seems nice anyway. > > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Sat Mar 3 23:07:06 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 03 Mar 2007 23:07:06 +0100 Subject: [erlang-questions] [Erlyaws-list] String Support, The most needed feature In-Reply-To: <16EBC4BF-0A34-43BD-9873-7F7760BC5EFF@ezabel.com> References: <20e98f0e0703031020q6ebf4bk4f493799ec8b725d@mail.gmail.com> <7fa241f30703031123u2763747cl70ee44f02cdaeeca@mail.gmail.com> <20e98f0e0703031139o577ce90cl8c7303c348608296@mail.gmail.com> <16EBC4BF-0A34-43BD-9873-7F7760BC5EFF@ezabel.com> Message-ID: <45E9F18A.8040900@cs.ntua.gr> orbitz@REDACTED wrote: > ... SNIP ... In Erlang the closest we > have is a Binary which is limited to bytes as far as I can tell No, it is not anymore: ----------------------------------------------------------------------- Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.3 (abort with ^G) 1> <> = <<63:7>>. <<63:7>> 2> X. 1 3> Y. 7 ---------------------------------------------------------------------- Coming soon to an Erlang shell near you ;-) Kostis From marc.vanwoerkom@REDACTED Sun Mar 4 11:21:30 2007 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Sun, 04 Mar 2007 11:21:30 +0100 Subject: [erlang-questions] Erlang book Message-ID: <45EA9DAA.6060501@fernuni-hagen.de> I'm impressed by the choice of the publishing company. ZOMG this is good news. http://www.pragmaticprogrammer.com/titles/jaerlang/ Regards, Marc From mickael.remond@REDACTED Sun Mar 4 11:20:59 2007 From: mickael.remond@REDACTED (=?ISO-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Sun, 4 Mar 2007 11:20:59 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> References: <45E94664.4090009@gmail.com> <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> Message-ID: <28CB717E-7DB2-4D17-9F40-C035D3C6A8BF@process-one.net> Hello Joe, Le 3 mars 07 ? 14:58, Joe Armstrong a ?crit : > Yes > > It was supposed to be announced next Tuesday but ... Yes it seems that the news has spread quickly. An interesting blog post is here: http://radar.oreilly.com/archives/2007/03/concurrent_prog_1.html It compares trend on Ruby and Erlang visit on the main websites. Ruby is currently going down and Erlang is rising. I think Pragmatic is onto something again :) By the way, the content which is already there is excellent and the next chapters are very promising. Good job and good push for the Erlang community :) -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rdiaz02@REDACTED Sun Mar 4 11:24:11 2007 From: rdiaz02@REDACTED (Ramon Diaz-Uriarte) Date: Sun, 4 Mar 2007 11:24:11 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> Message-ID: <624934630703040224v58aad1faya6fb958d6562caf5@mail.gmail.com> On 3/3/07, Brian Olsen wrote: > Hello, > > I suppose I am in the position as everyone else is here: I bought the > book right away once I saw this email. > > I am still on Chapter 1, and even though I know what I am reading > already, I really like the very sort of minimal voice when describing > the language. I really look forward on the chapters about OTP, in > interest to get an even better understanding of it. > > I think that even though this has already been mentioned on the site's > errata page from someone, I think a short introduction to the why's of > Erlang would be nice. I mean, if someone is picking up the book, they > already know Erlang, but it seems nice anyway. > As soon as I read about this yesterday, I went ahead and purchased the pdf. I do not know Erlang (in the sense of being in stage 2 or 3 as described in the first pages of the book) but I know about Erlang. It'd be definitely a good idea to have a why and how of Erlang, and even why anyone should consider Erlang in contrast to some other alternatives (Oz, Alice, Scala, etc). In addition, the chapter that deals with interfacing with other programs seems a bit too short. Maybe a longer, and explicitly names something along FFI would be a good idea? Anyway, the book looks fantastic! R. > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz From christophe.romain@REDACTED Sun Mar 4 11:57:33 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Sun, 4 Mar 2007 11:57:33 +0100 Subject: [erlang-questions] better CEAN installer for windows ? Message-ID: <428761CD-FF67-444F-B8E8-65BEEA236ECD@process-one.net> Hello all ! While playing with the the installer I found it was running too slow. So I improved the extraction process. From now, getting erlang shell running from scratch requires ~4Mb download and about 2 seconds to extract. Very quick and easy to get erlang a try ! That's great, but CEAN is used at 60% by windows users. On windows, users have to extract the downloaded zip file and then click on start. Wouldn't it be nice to have a lightweight windows installer ? input is the content of zip file located on the CEAN web site, output would be an exe file I guess. Is there anybody on the list that would like to make that installer ? From thomasl_erlang@REDACTED Sun Mar 4 17:46:47 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Sun, 4 Mar 2007 08:46:47 -0800 (PST) Subject: [erlang-questions] [Erlyaws-list] String Support, The most needed feature In-Reply-To: <16EBC4BF-0A34-43BD-9873-7F7760BC5EFF@ezabel.com> Message-ID: <20070304164647.60523.qmail@web38813.mail.mud.yahoo.com> --- orbitz@REDACTED wrote: > That said, I do sometimes think perhaps a container > that has O(1) > random access time might be nice in Erlang. If binaries are too much of a hassle, then recall that tuples have O(1) access and use less memory than lists (n+1 words rather than 2n). You may have to roll your own algorithms, I'm afraid. (Too bad we don't have any generic 'sequence' types and operations, huh?) To pacify the scripting crowd, one could spend more time on making regexps more convenient and/or more general. Or standardize them, e.g., by using the Ruby syntax or something. In favour of this approach, there might soon be an infusion of fresh users with Joe's new book, so this could be as good a time as any to spruce things up. However, in general I think the serious string-user should read Richard O'Keefe's analysis of the issues made on this list (alas, I didn't bookmark it so someone will have to dig up the reference). In short, a bit of sophistication seems to quickly end up with "strings" that are not arrays of characters and algorithms that are not regexp evaluation. Best, Thomas ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front From g.olgeni@REDACTED Sun Mar 4 19:15:55 2007 From: g.olgeni@REDACTED (Giacomo Olgeni) Date: Sun, 4 Mar 2007 19:15:55 +0100 (CET) Subject: [erlang-questions] Dialyzer on R11B-3: cerl_to_icode error In-Reply-To: <45DC4D08.10605@cs.ntua.gr> References: <45DC480A.4050002@colby.it> <45DC4D08.10605@cs.ntua.gr> Message-ID: <20070304191345.R48777@server.localdomain.net> On Wed, 21 Feb 2007, Kostis Sagonas wrote: > Typically, this is because the translation does not properly handle > the new boolean operators ("andalso" and "orelse"). That was it: I had a couple of orelse operators in the code... I removed them and dialyzer works fine now. Thanks :) -- G. Olgeni (g.olgeni@REDACTED) From marc.vanwoerkom@REDACTED Sun Mar 4 22:11:49 2007 From: marc.vanwoerkom@REDACTED (Marc van Woerkom) Date: Sun, 04 Mar 2007 22:11:49 +0100 Subject: [erlang-questions] Erlang book In-Reply-To: <45EA9DAA.6060501@fernuni-hagen.de> References: <45EA9DAA.6060501@fernuni-hagen.de> Message-ID: <45EB3615.8000202@fernuni-hagen.de> > I'm impressed by the choice of the publishing company. And the possibility to buy the pdf in advance and get the book later is also a good idea. I was able to buy it via a friend. Thanks, Marc From evanlh@REDACTED Mon Mar 5 00:14:56 2007 From: evanlh@REDACTED (Evan Lawrence-Hurt) Date: Sun, 4 Mar 2007 15:14:56 -0800 Subject: [erlang-questions] Google Summer of Code? Message-ID: Hello all, I notice that Google will begin accepting applications for the Summer of Code this month, and I'm curious whether there are/will be any Erlang-related projects participating again this year? How was Process One's experience with ejabberd's sponsorship last year? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dev@REDACTED Mon Mar 5 00:28:35 2007 From: dev@REDACTED (Jonathan Gold) Date: Sun, 4 Mar 2007 15:28:35 -0800 Subject: [erlang-questions] Is there an EUC this year? Message-ID: <20070304232835.GE427@samizdatdigital.com> Just wondering if there is an EUC this year? I started using "the lang," as I like to call it, in the last year, so I'm not sure if I already missed the announcements and, I assume, call for papers. jon From jeffm@REDACTED Mon Mar 5 03:28:39 2007 From: jeffm@REDACTED (jm) Date: Mon, 05 Mar 2007 13:28:39 +1100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> References: <45E94664.4090009@gmail.com> <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> Message-ID: <45EB8057.8050109@ghostgun.com> Joe Armstrong wrote: > Yes > > It was supposed to be announced next Tuesday but ... > > You may have noticed that I haven't been posting much here, currently all hobby > projects are on-hold. > > The book is now in Beta (following the usual Pragmatic Publishing > cycle) - this means > the book is 70% ready - the last four chapters are still to be > written, and I can change > stuff before it's too late. > Hope this means your still able to accept comments: Section 1.7 Floating Point Numbers, P23 Good to see that you mention, When you divide two integers the result is automatically converted to a floating point number. Could you add something about integer operations here as in took me ages to find the "div" operator when I first made the mistake of integer / integer expecting an integer return type. I liked section 5.5 "How Long Does it Take to Create a Process" same may find it hard to believe processes can be spawned so cheaply. After all seeing in believing. I'm hoping that there's plenty of examples, some more advanced as it gets into the OTP chapters, good coverage of debugging and how style can help with this, packaging for distribution and hot-code updating as well. I'm looking forward to reading the Mnesia chapters as that is a module I'm using a lot at the moment which I understand, but am not sure I have the right style of writing for or am getting the most out of. Needless to say this has just jumped to the top of my books to buy list. An open question is: Who's going to write the next must have Erlang book? Now where's that credit card.... Jeff. ps digg it: http://digg.com/programming/Pragmatic_Erlang_book_Erlang_is_their_new_Ruby From dbtleonia@REDACTED Mon Mar 5 05:23:22 2007 From: dbtleonia@REDACTED (David Tucker) Date: Sun, 4 Mar 2007 20:23:22 -0800 Subject: [erlang-questions] erl -name doesn't work In-Reply-To: <77ac51d70702231141k612c470bp62d906d629b0a8e4@mail.gmail.com> References: <77ac51d70702220054m206e1c0ahf458b5c0d11d3cc1@mail.gmail.com> <77ac51d70702221729h3e0c7163lb45a886e8ba8fd97@mail.gmail.com> <17886.36769.593507.553590@antilipe.corelatus.se> <77ac51d70702231141k612c470bp62d906d629b0a8e4@mail.gmail.com> Message-ID: <77ac51d70703042023y49e7319av753e1e11af40addb@mail.gmail.com> Can anyone follow up on this? Thanks. Dave On 2/23/07, David Tucker wrote: > > > > Next question: in the absence of an fqdn for my computer, what should I > > > specify for the Host part? An IP address doesn't seem to work. > > > > Works for me: > > > > ~ >erl -name matthias@REDACTED > > Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] > > [hipe] [kernel-poll:false] > > > > Eshell V5.5.2 (abort with ^G) > > (matthias@REDACTED)1> > > > > Looks like some more digging is needed. Is this a general problem on > > Windows, i.e. do other people have the same problem? (I do not use > > windows, I can't help) > > > Interesting; good to know that an IP address _should_ work. Is there any > flag I can pass to erl to have it print out more verbose debugging > information rather than dying silently? Thanks. > > Dave > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Mar 5 08:05:05 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 05 Mar 2007 08:05:05 +0100 Subject: [erlang-questions] Is there an EUC this year? In-Reply-To: <20070304232835.GE427@samizdatdigital.com> References: <20070304232835.GE427@samizdatdigital.com> Message-ID: Den 2007-03-05 00:28:35 skrev Jonathan Gold : > Just wondering if there is an EUC this year? I started using > "the lang," as I like to call it, in the last year, so I'm > not sure if I already missed the announcements and, I > assume, call for papers. EUC is normally held in October-November. I'm sure there'll be one this year as well. (: http://www.erlang.se/euc/ BR, Ulf W -- Ulf Wiger From gethemant@REDACTED Mon Mar 5 09:03:06 2007 From: gethemant@REDACTED (hemant) Date: Mon, 5 Mar 2007 13:33:06 +0530 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <45EB8057.8050109@ghostgun.com> References: <45E94664.4090009@gmail.com> <9b08084c0703030558t261a6695y409b02fc2e0fa167@mail.gmail.com> <45EB8057.8050109@ghostgun.com> Message-ID: On 3/5/07, jm wrote: > Joe Armstrong wrote: > > Yes > > > > It was supposed to be announced next Tuesday but ... > > > > You may have noticed that I haven't been posting much here, currently all hobby > > projects are on-hold. > > > > The book is now in Beta (following the usual Pragmatic Publishing > > cycle) - this means > > the book is 70% ready - the last four chapters are still to be > > written, and I can change > > stuff before it's too late. > > > > Hope this means your still able to accept comments: > > > Section 1.7 Floating Point Numbers, P23 > Good to see that you mention, > > When you divide two integers the result is automatically converted to a > floating point number. > > Could you add something about integer operations here as in took me ages > to find the "div" operator when I first made the mistake of integer / > integer expecting an integer return type. > > I liked section 5.5 "How Long Does it Take to Create a Process" same may > find it hard to believe processes can be spawned so cheaply. After all > seeing in believing. > > I'm hoping that there's plenty of examples, some more advanced as it > gets into the OTP chapters, good coverage of debugging and how style can > help with this, packaging for distribution and hot-code updating as > well. I'm looking forward to reading the Mnesia chapters as that is a > module I'm using a lot at the moment which I understand, but am not sure > I have the right style of writing for or am getting the most out of. > > Needless to say this has just jumped to the top of my books to buy list. > > An open question is: Who's going to write the next must have Erlang book? > > Now where's that credit card.... > Also, Table 2.1: is_tuple(X) -> X is an Atom looks like error, although I am completely new to Erlang and enjoying it immensely. From mickael.remond@REDACTED Mon Mar 5 10:43:05 2007 From: mickael.remond@REDACTED (=?ISO-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Mon, 5 Mar 2007 10:43:05 +0100 Subject: [erlang-questions] Google Summer of Code? In-Reply-To: References: Message-ID: <348AC63D-F688-41BC-B377-EE3181508917@process-one.net> Hello, Le 5 mars 07 ? 00:14, Evan Lawrence-Hurt a ?crit : > Hello all, > I notice that Google will begin accepting applications for the > Summer of Code this month, and I'm curious whether there are/will > be any Erlang-related projects participating again this year? How > was Process One's experience with ejabberd's sponsorship last year? Experience was nice and we will definitely participate again this year. However, we will work more on developer integration inside our own development team. That's why we are going to publish a list of project to choose from to ensure they can be integrated in the main code base of the main project and as such will help the student to get into the team. We are open to suggestions of projects however :) -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gethemant@REDACTED Mon Mar 5 11:49:00 2007 From: gethemant@REDACTED (hemant) Date: Mon, 5 Mar 2007 16:19:00 +0530 Subject: [erlang-questions] records in erlang and error while creating it Message-ID: this might be a really stupid question, but at shell I am doing this: 2> -record(person, { 2> firstName = "", 2> lastName = "", 2> age}). =ERROR REPORT==== 5-Mar-2007::16:06:35 === Error in process <0.33.0> with exit value: {{badmatch,[]},[{erl_eval,expr,3}]} ** exited: {{badmatch,[]},[{erl_eval,expr,3}]} ** basically I am typing whatever is given there in "Programming Erlang" book, may be I am doing a typo or something. but my question is, how exactly erlang folks read out those error messages? I mean, what exactly is the ERROR REPORT saying here, so that i can find error in my code? -- gnufied ----------- There was only one Road; that it was like a great river: its springs were at every doorstep, and every path was its tributary. http://people.inxsasia.com/~hemant From joelr1@REDACTED Mon Mar 5 12:02:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 5 Mar 2007 11:02:39 +0000 Subject: [erlang-questions] Erlang beats Lisp in the AI scalability battle Message-ID: <6023360C-B8A8-4DE1-A1BE-2E67A5056C36@gmail.com> Since Luke Gorrie was too shy to post it, I thought I would :-) http://programming.reddit.com/info/17yo9/comments Feel free to vote it up! Cheers, Joel -- http://wagerlabs.com/ From kg9020@REDACTED Sun Mar 4 19:40:03 2007 From: kg9020@REDACTED (kgi9020) Date: Sun, 4 Mar 2007 12:40:03 -0600 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: References: Message-ID: <6216F2D7-9986-48BE-8203-23F3898AD470@valornet.com> Another thank you on the book I got it yesterday and going through it think references pdf that are already out there would on the history D?cker, B. (2000). Concurrent functional programming for telecommunications: A case study of technology introduction. pdf, Computer Communication System Laboratory Department of Teleinformatics Royal Institute of Technology Stockholm, SWEDEN, Sweden. Is a very good read On Mar 4, 2007, at 4:21 AM, erlang-questions-request@REDACTED wrote: > Send erlang-questions mailing list submissions to > erlang-questions@REDACTED > > To subscribe or unsubscribe via the World Wide Web, visit > http://www.erlang.org/mailman/listinfo/erlang-questions > or, via email, send a message with subject or body 'help' to > erlang-questions-request@REDACTED > > You can reach the person managing the list at > erlang-questions-owner@REDACTED > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of erlang-questions digest..." > Today's Topics: > > 1. Re: Programming Erlang on Pragmatic Bookshelf (Bob Ippolito) > 2. Re: [Erlyaws-list] String Support, The most needed feature > (Bob Ippolito) > 3. Re: [Erlyaws-list] String Support, The most needed feature > (orbitz@REDACTED) > 4. Re: Programming Erlang on Pragmatic Bookshelf (Brian Olsen) > 5. Re: Programming Erlang on Pragmatic Bookshelf (Bob Ippolito) > 6. Re: [Erlyaws-list] String Support, The most needed feature > (Kostis Sagonas) > 7. Erlang book (Marc van Woerkom) > 8. Re: Programming Erlang on Pragmatic Bookshelf (Micka?l R?mond) > > From: "Bob Ippolito" > Date: March 3, 2007 2:40:56 PM CST > To: "Tobias L?fgren" > Cc: Erlang > Subject: Re: [erlang-questions] Programming Erlang on Pragmatic > Bookshelf > > > I bought it as soon as I heard about it yesterday as well. It's > definitely the best resource I've seen so far, hands down. In fact, > before the book, I always pointed people at Joe's thesis... because > that's what made Erlang really "click" for me. > > Unfortunately the parts of the book that I really wanted to read was > about 25% of the 30% that's not yet available in the beta. I'm really > looking forward to the rest of it, and I'll be recommending the book > to *everyone* who wants to learn Erlang. > > -bob > > On 3/3/07, Tobias L?fgren wrote: >> I bought it as soon as I saw it was available! >> >> I've only skimmed through it so far but it looks absolutely >> excellent. It >> looks like the book I wish I had when I started out experimenting >> with >> Erlang, but even as a now moderately experienced Erlang-programmer >> it seems >> to contain an interesting breadth of information that I've missed >> out on >> when teaching myself Erlang through the standard documentation and >> experimenting. >> >> It will be a welcome addition to my library when the final paper >> version is >> ready! >> >> /Tobias >> >> >> >> On 3/3/07, Joe Armstrong < erlang@REDACTED> wrote: >> > Wonderful - you can read a little about it in >> > >> > >> http://armstrongonsoftware.blogspot.com/2007/03/hasta-la-vista- >> baby.html >> > >> > /Joe >> > >> > >> > >> > On 3/3/07, Thomas Lindgren wrote: >> > > >> > > --- Dmitrii 'Mamut' Dimandt >> > > wrote: >> > > >> > > > >> > > >> http://pragmaticprogrammer.com/titles/jaerlang/index.html >> > > > >> > > > Is this it? Is this THE book? Cant' wait! Can't >> > > > wait! >> > > >> > > Cool. I'll get a copy. It's not like my shelves >> > > overflow with Erlang books. >> > > >> > > Best, >> > > Thomas >> > > >> > > >> > > >> > > >> > > >> _____________________________________________________________________ >> _______________ >> > > Want to start your own business? >> > > Learn how on Yahoo! Small Business. >> > > http://smallbusiness.yahoo.com/r-index >> > > _______________________________________________ >> > > erlang-questions mailing list >> > > erlang-questions@REDACTED >> > > http://www.erlang.org/mailman/listinfo/erlang-questions >> > > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > > > > > > From: "Bob Ippolito" > Date: March 3, 2007 2:46:10 PM CST > To: CyBerHigh > Cc: erlyyaws-list@REDACTED, erlang-questions@REDACTED > Subject: Re: [erlang-questions] [Erlyaws-list] String Support, The > most needed feature > > > On 3/3/07, CyBerHigh wrote: >> >> >> On 3/3/07, Martin Logan wrote: >> > What exactly did you find so difficult that it was easier to >> reinvent >> > one of the major benefits of Erlang with Python rather than to >> suffer >> > through that element of string handling? >> > >> > On 3/3/07, CyBerHigh < cyberhigh@REDACTED> wrote: >> > > This is my own personal view of erlang. >> > > >> > > Erlang is going to be left far behind because it is liking >> only one >> feature, >> > > true String support. All modern languages have an abstraction >> layer >> over >> > > strings except for erlang. If you want to have a popular >> language you >> need >> > > it. I love every feature of erlang and its coding style but I >> hate the >> fact >> > > that I cannot handle strings very easly and that strings take >> up huge >> > > amounts of memory. In fact I was attempting to user erlang >> for my >> project >> > > but found that handling strings was so much work that it was >> easier to >> use >> > > other languages like python with stackless then create my own rcp >> interface. >> > > Which is now pretty similar to erlang without all the nice >> coding >> styles of >> > > erlang. >> > > >> > > Is there any movement to create a better string interface? >> Cause I >> would >> > > love to come back to erlang and use it and get the name out >> there more >> than >> > > it is currently but untill there is such a thing I just can't >> find >> myself >> > > using it. >> > > >> > > Thank you >> > > CyberHigh >> > > >> > > >> --------------------------------------------------------------------- >> ---- >> > > Take Surveys. Earn Cash. Influence the Future of IT >> > > Join SourceForge.net's Techsay panel and you'll get the chance >> to share >> your >> > > opinions on IT & business topics through brief surveys-and >> earn cash >> > > >> http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV >> > > _______________________________________________ >> > > Erlyaws-list mailing list >> > > Erlyaws-list@REDACTED >> > > >> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >> > > >> > > >> > >> >> Python is very good with string. In fact I enjoy its string >> syntax more >> than perl and other string processing languages. I am not actually >> reinventing anything, stackless offers message passing and >> microthreads just >> like erlang. I am moving to a more erlang style of code but doing >> so is not >> requiring much work. I just feel there is no reason why I need to >> actually >> think of a string as a list of characters, unless I am in c. It >> is nice >> that I don't need to have end of string characters but I feel that >> elangs >> biggest short coming is the fact that strings are not the easiest >> thing to >> handle. Erlang should be able to act like a string processing >> language, >> offering easy to use things like regular expressions quick split >> operations >> and other nice string tools. Just seems like that would be a big >> priority >> to be able to compete with all of these new languages popping up >> and are >> started to implement erlang's good things. Python is even started >> to get a >> on-the-fly programming model which erlang has. Plus there are >> tools to be >> able to do it in just about any popular language now a days. So >> the list of >> things that erlang has that others don't is becoming short. >> Erlang still >> seems to have it implemented better than other languages, but it >> missing >> string handling capability's that other languages do so well that >> they >> almost make up for the erlangs slight betterment of implantation. >> >> Is there something I am missing about erlangs string capability's, >> or is >> there a movement to add better methods to erlang? > > Your complaints about Erlang's string handling are really vague. > Regular expressions and split operations are available in the stdlib. > What are you really missing? > > As far as memory goes... if you actually have a problem with the > overhead of lists-as-strings there's always binaries and iolist. The > syntax is a bit uglier and there's not really much stdlib support for > that, but I've seen libraries floating around that have a string ops > that work on binaries. > > -bob > > > > > From: orbitz@REDACTED > Date: March 3, 2007 2:54:24 PM CST > To: CyBerHigh > Cc: erlyyaws-list@REDACTED, erlang-questions@REDACTED > Subject: Re: [erlang-questions] [Erlyaws-list] String Support, The > most needed feature > > > I'm not sure if Erlang is necessarily lacking anything in the > string department, but the problem is probably based more around > how to actually deal with strings. In many popular language (not > Haskell has the same concept of strings that Erlang does, for the > most part), accessing an element of a string is O(1) but in Erlang > it is O(n). To me this means that when you do things with strings > you are generally going to have to do them in terms of tail ends. > What I mean by this is in Python you mind do idx = mystring.find > (foo) And you get an idx and go there and work with it. In Erlang > this would become mylist = find(mystring, foo), and find would > return the remaining list so you can work across the string. > This has the most obvious problem of not allowing you to go > backwards through the string, so you can't find things prior to > some landmark you are working for. > > That said, I do sometimes think perhaps a container that has O(1) > random access time might be nice in Erlang. In Haskell we have > Array which works wonderful for those situations. In Erlang the > closest we have is a Binary which is limited to bytes as far as I > can tell so I wouldn't call it a true container. > > So the conclusion I'm trying to reach is, Erlang doesn't need a > string layer, it needs a new container for these kind of situations. > > > On Mar 3, 2007, at 2:39 PM, CyBerHigh wrote: > >> >> >> On 3/3/07, Martin Logan wrote: What >> exactly did you find so difficult that it was easier to reinvent >> one of the major benefits of Erlang with Python rather than to suffer >> through that element of string handling? >> >> On 3/3/07, CyBerHigh < cyberhigh@REDACTED> wrote: >> > This is my own personal view of erlang. >> > >> > Erlang is going to be left far behind because it is liking only >> one feature, >> > true String support. All modern languages have an abstraction >> layer over >> > strings except for erlang. If you want to have a popular >> language you need >> > it. I love every feature of erlang and its coding style but I >> hate the fact >> > that I cannot handle strings very easly and that strings take up >> huge >> > amounts of memory. In fact I was attempting to user erlang for >> my project >> > but found that handling strings was so much work that it was >> easier to use >> > other languages like python with stackless then create my own >> rcp interface. >> > Which is now pretty similar to erlang without all the nice >> coding styles of >> > erlang. >> > >> > Is there any movement to create a better string interface? >> Cause I would >> > love to come back to erlang and use it and get the name out >> there more than >> > it is currently but untill there is such a thing I just can't >> find myself >> > using it. >> > >> > Thank you >> > CyberHigh >> > >> > >> --------------------------------------------------------------------- >> ---- >> > Take Surveys. Earn Cash. Influence the Future of IT >> > Join SourceForge.net's Techsay panel and you'll get the chance >> to share your >> > opinions on IT & business topics through brief surveys-and earn >> cash >> > http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV >> > _______________________________________________ >> > Erlyaws-list mailing list >> > Erlyaws-list@REDACTED >> > https://lists.sourceforge.net/lists/listinfo/erlyaws-list >> > >> > >> >> Python is very good with string. In fact I enjoy its string >> syntax more than perl and other string processing languages. I am >> not actually reinventing anything, stackless offers message >> passing and microthreads just like erlang. I am moving to a more >> erlang style of code but doing so is not requiring much work. I >> just feel there is no reason why I need to actually think of a >> string as a list of characters, unless I am in c. It is nice that >> I don't need to have end of string characters but I feel that >> elangs biggest short coming is the fact that strings are not the >> easiest thing to handle. Erlang should be able to act like a >> string processing language, offering easy to use things like >> regular expressions quick split operations and other nice string >> tools. Just seems like that would be a big priority to be able to >> compete with all of these new languages popping up and are started >> to implement erlang's good things. Python is even started to get >> a on-the-fly programming model which erlang has. Plus there are >> tools to be able to do it in just about any popular language now a >> days. So the list of things that erlang has that others don't is >> becoming short. Erlang still seems to have it implemented better >> than other languages, but it missing string handling capability's >> that other languages do so well that they almost make up for the >> erlangs slight betterment of implantation. >> >> Is there something I am missing about erlangs string capability's, >> or is there a movement to add better methods to erlang? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > From: "Brian Olsen" > Date: March 3, 2007 3:03:51 PM CST > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Programming Erlang on Pragmatic > Bookshelf > > > Hello, > > I suppose I am in the position as everyone else is here: I bought the > book right away once I saw this email. > > I am still on Chapter 1, and even though I know what I am reading > already, I really like the very sort of minimal voice when describing > the language. I really look forward on the chapters about OTP, in > interest to get an even better understanding of it. > > I think that even though this has already been mentioned on the site's > errata page from someone, I think a short introduction to the why's of > Erlang would be nice. I mean, if someone is picking up the book, they > already know Erlang, but it seems nice anyway. > > Brian > > > > > From: "Bob Ippolito" > Date: March 3, 2007 3:18:16 PM CST > To: "Brian Olsen" > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Programming Erlang on Pragmatic > Bookshelf > > > Yeah, some of the history of and justification for Erlang from Joe's > thesis would probably make sense in the beginning of the book... to > really hammer home why someone would bother with Erlang, and why it > turned out looking the way it does. > > -bob > > On 3/3/07, Brian Olsen wrote: >> Hello, >> >> I suppose I am in the position as everyone else is here: I bought the >> book right away once I saw this email. >> >> I am still on Chapter 1, and even though I know what I am reading >> already, I really like the very sort of minimal voice when describing >> the language. I really look forward on the chapters about OTP, in >> interest to get an even better understanding of it. >> >> I think that even though this has already been mentioned on the >> site's >> errata page from someone, I think a short introduction to the >> why's of >> Erlang would be nice. I mean, if someone is picking up the book, they >> already know Erlang, but it seems nice anyway. >> >> Brian >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > > > From: Kostis Sagonas > Date: March 3, 2007 4:07:06 PM CST > To: orbitz@REDACTED > Cc: erlyyaws-list@REDACTED, erlang-questions@REDACTED > Subject: Re: [erlang-questions] [Erlyaws-list] String Support, The > most needed feature > > > orbitz@REDACTED wrote: >> ... SNIP ... In Erlang the closest we have is a Binary which is >> limited to bytes as far as I can tell > > No, it is not anymore: > > ---------------------------------------------------------------------- > - > Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.5.3 (abort with ^G) > 1> <> = <<63:7>>. > <<63:7>> > 2> X. > 1 > 3> Y. > 7 > ---------------------------------------------------------------------- > > Coming soon to an Erlang shell near you ;-) > > Kostis > > > > > From: Marc van Woerkom > Date: March 4, 2007 4:21:30 AM CST > To: Erlang Questions > Subject: [erlang-questions] Erlang book > > > I'm impressed by the choice of the publishing company. > ZOMG this is good news. > > http://www.pragmaticprogrammer.com/titles/jaerlang/ > > Regards, > Marc > > > > > > From: Micka?l R?mond > Date: March 4, 2007 4:20:59 AM CST > To: Joe Armstrong > Cc: Erlang > Subject: Re: [erlang-questions] Programming Erlang on Pragmatic > Bookshelf > > > Hello Joe, > > Le 3 mars 07 ? 14:58, Joe Armstrong a ?crit : > >> Yes >> >> It was supposed to be announced next Tuesday but ... > > Yes it seems that the news has spread quickly. > An interesting blog post is here: > > http://radar.oreilly.com/archives/2007/03/concurrent_prog_1.html > > It compares trend on Ruby and Erlang visit on the main websites. > Ruby is currently going down and Erlang is rising. > I think Pragmatic is onto something again :) > > By the way, the content which is already there is excellent and the > next chapters are very promising. > Good job and good push for the Erlang community :) > > -- > Micka?l R?mond > http://www.process-one.net/ > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Mar 5 12:52:57 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 05 Mar 2007 12:52:57 +0100 Subject: [erlang-questions] records in erlang and error while creating it In-Reply-To: References: Message-ID: <45EC0499.9020804@ericsson.com> On 2007-03-05 11:49, hemant wrote: > this might be a really stupid question, but at shell I am doing this: > > 2> -record(person, { > 2> firstName = "", > 2> lastName = "", > 2> age}). > > =ERROR REPORT==== 5-Mar-2007::16:06:35 === > Error in process <0.33.0> with exit value: {{badmatch,[]},[{erl_eval,expr,3}]} the record is a preprocessor thing. you can not create records in the shell. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From attila.rajmund.nohl@REDACTED Mon Mar 5 13:01:09 2007 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Mon, 5 Mar 2007 13:01:09 +0100 (CET) Subject: [erlang-questions] records in erlang and error while creating it In-Reply-To: <45EC0499.9020804@ericsson.com> References: <45EC0499.9020804@ericsson.com> Message-ID: On Mon, 5 Mar 2007, Bengt Kleberg wrote: > On 2007-03-05 11:49, hemant wrote: >> this might be a really stupid question, but at shell I am doing this: >> >> 2> -record(person, { >> 2> firstName = "", >> 2> lastName = "", >> 2> age}). >> >> =ERROR REPORT==== 5-Mar-2007::16:06:35 === >> Error in process <0.33.0> with exit value: {{badmatch,[]},[{erl_eval,expr,3}]} > > the record is a preprocessor thing. you can not create records in the shell. There is that rd() function that can do something like this: 1> rd(person, {firstName = "",lastName = "",age}). person 2> P=#person{}. #person{firstName = [],lastName = [],age = undefined} Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From richardc@REDACTED Mon Mar 5 13:10:07 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 05 Mar 2007 13:10:07 +0100 Subject: [erlang-questions] records in erlang and error while creating it In-Reply-To: References: Message-ID: <45EC089F.1000701@it.uu.se> hemant wrote: > this might be a really stupid question, but at shell I am doing this: > > 2> -record(person, { > 2> firstName = "", > 2> lastName = "", > 2> age}). In the shell, you can only write expressions. You cannot write function definitions, such as 'f(X) -> X+1.', and you cannot write declarations (things like '-record(...).', which begin with a '-'). What happened was that the shell thought you tried to write an expression that started with a unary minus, just as if you had written '- f(...)', and it interpreted the part where you said 'firstName = ""' literally and tried to match the atom 'firstName' against the empty string '""'. That's why the error message said 'badmatch'. You're certainly not the first person to make this kind of mistake. To write declarations and function definitions, you need to bring up your text editor and write a module. /Richard From seb-cl-mailist@REDACTED Mon Mar 5 15:05:04 2007 From: seb-cl-mailist@REDACTED (=?ISO-8859-1?Q?S=E9bastien_Saint-Sevin?=) Date: Mon, 05 Mar 2007 15:05:04 +0100 Subject: [erlang-questions] mnesia:dirty_update_counter Message-ID: <45EC2390.3010209@matchix.com> Hi list, It seems I've found a bug regarding mnesia:dirty_update_counter(Tab, Key, Incr). When I use the function for the first time with an Incr of 1 (Key not existing), the table is populated with a value of 0 for the key Key (1 expected) and returns 1 for NewVal (as expected). The doc says : "If Key don't exits, a new record is created with the value Incr if it is larger than 0, otherwise it is set to 0." Is this confirmed or did I missed something ? Cheers, S?bastien. PS : erl-5.5.3 under windows XP From gethemant@REDACTED Mon Mar 5 15:11:58 2007 From: gethemant@REDACTED (hemant) Date: Mon, 5 Mar 2007 19:41:58 +0530 Subject: [erlang-questions] records in erlang and error while creating it In-Reply-To: <45EC089F.1000701@it.uu.se> References: <45EC089F.1000701@it.uu.se> Message-ID: On 3/5/07, Richard Carlsson wrote: > hemant wrote: > > this might be a really stupid question, but at shell I am doing this: > > > > 2> -record(person, { > > 2> firstName = "", > > 2> lastName = "", > > 2> age}). > > In the shell, you can only write expressions. You cannot write > function definitions, such as 'f(X) -> X+1.', and you cannot > write declarations (things like '-record(...).', which begin > with a '-'). > > What happened was that the shell thought you tried to write > an expression that started with a unary minus, just as if > you had written '- f(...)', and it interpreted the part where > you said 'firstName = ""' literally and tried to match the > atom 'firstName' against the empty string '""'. That's why the > error message said 'badmatch'. > > You're certainly not the first person to make this kind of > mistake. To write declarations and function definitions, you > need to bring up your text editor and write a module. Thanks a lot folks. -- gnufied ----------- There was only one Road; that it was like a great river: its springs were at every doorstep, and every path was its tributary. http://people.inxsasia.com/~hemant From james.hague@REDACTED Mon Mar 5 15:34:18 2007 From: james.hague@REDACTED (James Hague) Date: Mon, 5 Mar 2007 08:34:18 -0600 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <45E94664.4090009@gmail.com> References: <45E94664.4090009@gmail.com> Message-ID: I bought the book the book right away, even though Joe said it was targeted at Java programmers, not people who already know Erlang. I figured there would be some tidbits I didn't know, and this turned out to be true. What I'm really wanting, though, are the chapters that are yet to be written :) James From bob@REDACTED Mon Mar 5 16:17:18 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 5 Mar 2007 07:17:18 -0800 Subject: [erlang-questions] mnesia:dirty_update_counter In-Reply-To: <45EC2390.3010209@matchix.com> References: <45EC2390.3010209@matchix.com> Message-ID: <6a36e7290703050717jbc5b486h9d3a7d5f6533c678@mail.gmail.com> It definitely seems like a bug, but I think that's intended behavior for backwards compatibility. Here's what we do, which seems to work: case mnesia:dirty_update_counter(Db, Key, Inc) of X when X == Inc -> F = fun () -> [R] = mnesia:read(Db, Key, write), mnesia:write(R) end, mnesia:transaction(F); _ -> ok end. On 3/5/07, S?bastien Saint-Sevin wrote: > Hi list, > > It seems I've found a bug regarding mnesia:dirty_update_counter(Tab, Key, Incr). > When I use the function for the first time with an Incr of 1 (Key not existing), the table is populated with a value of 0 for the key Key (1 expected) and returns 1 for NewVal (as expected). > The doc says : "If Key don't exits, a new record is created with the value Incr if it is larger than 0, otherwise it is set to 0." > > Is this confirmed or did I missed something ? > > Cheers, > S?bastien. > > PS : erl-5.5.3 under windows XP > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Mon Mar 5 22:07:54 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 5 Mar 2007 22:07:54 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <6a36e7290703031318l7e747eb4q1463c7b0ec0b84a3@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> <6a36e7290703031318l7e747eb4q1463c7b0ec0b84a3@mail.gmail.com> Message-ID: <9b08084c0703051307o349554ecl8e7e6434f0377ed9@mail.gmail.com> On 3/3/07, Bob Ippolito wrote: > Yeah, some of the history of and justification for Erlang from Joe's > thesis would probably make sense in the beginning of the book... to > really hammer home why someone would bother with Erlang, and why it > turned out looking the way it does. > This I'll write last. It's difficult to write the intro until the content is clear /Joe > -bob > > On 3/3/07, Brian Olsen wrote: > > Hello, > > > > I suppose I am in the position as everyone else is here: I bought the > > book right away once I saw this email. > > > > I am still on Chapter 1, and even though I know what I am reading > > already, I really like the very sort of minimal voice when describing > > the language. I really look forward on the chapters about OTP, in > > interest to get an even better understanding of it. > > > > I think that even though this has already been mentioned on the site's > > errata page from someone, I think a short introduction to the why's of > > Erlang would be nice. I mean, if someone is picking up the book, they > > already know Erlang, but it seems nice anyway. > > > > Brian > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Mon Mar 5 22:17:17 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 5 Mar 2007 22:17:17 +0100 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> Message-ID: <9b08084c0703051317j3e52c698q7ae0177e92e84b70@mail.gmail.com> On 3/3/07, Brian Olsen wrote: > Hello, > > I suppose I am in the position as everyone else is here: I bought the > book right away once I saw this email. > > I am still on Chapter 1, and even though I know what I am reading > already, I really like the very sort of minimal voice when describing > the language. I really look forward on the chapters about OTP, in > interest to get an even better understanding of it. > > I think that even though this has already been mentioned on the site's > errata page from someone, The errata page is the best place to add your comments http://books.pragprog.com/titles/jaerlang/errata It's currently growing far faster than I can fix the comments - it actually grows as I'm fixing it :-) It's like a giant brain has decided to proof read the book, reading every page in parallel. I have never ever had so much feedback so quickly - it's awesome. /Joe > I think a short introduction to the why's of > Erlang would be nice. I mean, if someone is picking up the book, they > already know Erlang, but it seems nice anyway. > > Brian > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From brian@REDACTED Mon Mar 5 22:21:26 2007 From: brian@REDACTED (Brian Olsen) Date: Mon, 5 Mar 2007 16:21:26 -0500 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <9b08084c0703051317j3e52c698q7ae0177e92e84b70@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> <9b08084c0703051317j3e52c698q7ae0177e92e84b70@mail.gmail.com> Message-ID: <301fd58b0703051321v59838621pde9d25f192ec5b87@mail.gmail.com> > It's like a giant brain has decided to proof read the book, > reading every page in parallel. > > I have never ever had so much feedback so quickly - it's awesome. Blame a lot of the feedback on me. I'm almost finished reading what I have now. :D Brian From jeffm@REDACTED Mon Mar 5 23:30:38 2007 From: jeffm@REDACTED (jm) Date: Tue, 06 Mar 2007 09:30:38 +1100 Subject: [erlang-questions] erlang in Air Traffic Management ? In-Reply-To: References: Message-ID: <45EC9A0E.10207@ghostgun.com> Dietmar.Schaefer@REDACTED wrote: > Since I know now that Erlang is in use in the railway industrie > > I really would like to know IF ANYONE is actually using erlang in > > > AIR TRAFFIC MANAGEMENT ??? > > > Please drop me a line ! Did anyone see any replies to this? If there where I must have missed it. As a side question and really what I'm curious to know is what requirements, regulations, informal pressure is there that governs the use of certain languages, etc both in the aeronautics industry and other "high reliablity" industries? Jeff. From simonpeterchappell@REDACTED Tue Mar 6 00:38:09 2007 From: simonpeterchappell@REDACTED (Simon Chappell) Date: Mon, 5 Mar 2007 17:38:09 -0600 Subject: [erlang-questions] Programming Erlang on Pragmatic Bookshelf In-Reply-To: <301fd58b0703051321v59838621pde9d25f192ec5b87@mail.gmail.com> References: <45E94664.4090009@gmail.com> <301fd58b0703031303s78345f27m73c129092030b474@mail.gmail.com> <9b08084c0703051317j3e52c698q7ae0177e92e84b70@mail.gmail.com> <301fd58b0703051321v59838621pde9d25f192ec5b87@mail.gmail.com> Message-ID: <8ed733900703051538o1522c436ta5363dd26e816c04@mail.gmail.com> On 3/5/07, Brian Olsen wrote: > > It's like a giant brain has decided to proof read the book, > > reading every page in parallel. > > > > I have never ever had so much feedback so quickly - it's awesome. > > Blame a lot of the feedback on me. I'm almost finished reading what I > have now. :D Goodness, I must be a slacker ... I'm only on page 99! :-) Simon -- simonpeter.org | simonpeter.com | techbook.info From mad.one@REDACTED Tue Mar 6 04:52:17 2007 From: mad.one@REDACTED (Austin Seipp) Date: Mon, 5 Mar 2007 19:52:17 -0800 Subject: [erlang-questions] pool:pspawn and spawning at specific nodes Message-ID: Hi, I've been working on a little toy erlang program to kill some time. It is essentially a simple "Ping, pong" program (as seen in the erlang documentation.) I decided to modify it so that it could do things like scale itself appropriately (I use pool:start to automatically start erlang systmes based on ~/.hosts.erlang) and automatically distribute the 'Ping' and the 'Pong' processes amongst the slave nodes brought up. Here is my code: -module(pingpong). -export([start/0,ping/1,pong/0,output_server/0]). output_server() -> receive {format,{Str,Fmt}} -> io:fwrite(standard_io,"~s ~s~n",[Str,Fmt]), output_server() end. ping(0) -> global:send(pongServer,finished), global:send(outServer,{format,{"ping finished",""}}); ping(N) -> global:send(pongServer,{ping,self()}), receive pong -> global:send(outServer,{format,{"Ping received pong",""}}) end, pingpong:ping(N-1). pong() -> receive finished -> global:send(outServer,{format,{"Pong finished",""}}); {ping,Ping_PID} -> global:send(outServer,{format,{"Pong received ping",""}}), Ping_PID ! pong, pingpong:pong() end. start() -> PongSrv = lists:nth(1,pool:start(ponger)), PingSrv = lists:nth(1,pool:start(pinger)), io:format("nodes registered: ~s and ~s~n",[PongSrv,PingSrv]), %register output server OutSrv_PID = spawn(pingpong,output_server,[]), case global:register_name(outServer,OutSrv_PID) of no -> io:format("could not register output server, exit~n"), pool:stop(), exit(output_srvr_reg_err); yes -> io:format("registered output server~n") end, %register pong server PongSrv_PID = pool:pspawn(pingpong,pong,[]), case global:register_name(pongServer,PongSrv_PID) of no -> io:format("could not register name globally: err~n"), pool:stop(), exit(global_name_reg_err); yes -> io:format("~s: successfully registered global name 'pong'~n",[node()]) end, %register ping client PingSrv_PID = pool:pspawn(pingpong,ping,[1]), case global:register_name(pingServer,PingSrv_PID) of yes -> io:format("~s: successfully registered global name 'ping'~n",[node()]); no -> io:format("couldn't register name globally: err~n"), pool:stop(), exit(global_name_reg_err) end. Here is the output: [austin@REDACTED erlang]$ erl -sname main Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.3 (abort with ^G) (main@REDACTED)1> c(pingpong). {ok,pingpong} (main@REDACTED)2> pingpong:start(). nodes registered: ponger@REDACTED and pinger@REDACTED registered output server main@REDACTED: successfully registered global name 'pong' Pong received ping Ping received pong ping finished Pong finished main@REDACTED: successfully registered global name 'ping' ok (main@REDACTED)3> As you can see, it works fine. However, I wanted to spawn the two seperate Ping and Pong enteties on nodes *at my discretion.* pool:pspawn simply takes the system out of the pool with the lowest load (expected) and starts the new process there. So I sought to see if the regular spawn/4 BIF could spawn it on a node of my choice, here's the start() and the way I changed it: And here's the output now: [austin@REDACTED erlang]$ erl -sname main Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.3 (abort with ^G) (main@REDACTED)1> c(pingpong). {ok,pingpong} (main@REDACTED)2> pingpong:start(). nodes registered: ponger@REDACTED and pinger@REDACTED registered output server main@REDACTED: successfully registered global name 'pong' main@REDACTED: successfully registered global name 'ping' ok (main@REDACTED)3> So my question really is: can you start processes on slave nodes you bring up via pool:start() *explicitly* (that is, you specify on what slave to bring the process up on) rather than letting pspawn decide, or must you let pool:pspawn() care of it, or is there another solution? I wanted to see if I could write a small distributed system that automatically scaled across available systems like this one did, and I figure I could use pool:start(...) to give meaningful names to the Erlang systems I brought up, and bring up a certain part of the whole program on that node explicitly (for example, if you had a database server written in erlang, you may want to start several nodes, say 'filesystem@REDACTED' and another one called 'main@REDACTED' and have the filesystem@REDACTED system take care of the processes that store info into the filesystem, while main@REDACTED would handle incoming connections. pool:pspawn chooses whatever system has the least load; name is irrelivant, so I mean, it's not very logical to have the filesystem processes executing on the main@REDACTED node with the incoming connection code because pool:pspawn decided main@REDACTED had a little less load. Please also note how many computers are actually involved in this is irrelivant, I just want my processes spawning on the slave nodes I specify, and not delegate it to pool:pspawn.) Any recommendations? I suppose this setup would do, but it's not exactly the ideal scenario here. -- - Austin From erlang@REDACTED Tue Mar 6 09:39:10 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 6 Mar 2007 09:39:10 +0100 Subject: [erlang-questions] windows question Message-ID: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> Hi Guys - help needed. A question came up on the errata list for the Erlang book - it was about windows use I'll quote the question below - I'm only an occasional windows user so I don't know the best answer to this. Me - I use mingw and msys (I forget) - and a erl.bat file that aliases erlc but I have no idea if this is the best way to proceed. What is "best practice"???? Thanks /Joe Here are the two posts (from http://books.pragprog.com/titles/jaerlang/errata) #6533: There should be some description on where to put modules such as math4.erl once it is downloaded so that c(math4). works without an error.--Stephen Freitag #6524: > Start your favorite text editor and enter the following > into a file called shop.erl. This to me is almost always the hardest entry point for anyone into a language. Start your text editor where? From the same directory as Cean? If you do that it doesn't compile because the Cean start script immediately moves to the bin directory (at least under windows): > cd erlang/erts*/windows/bin > start werl.exe In order for it to compile under the shell I've got to place the file in Erlang's bin directory. Not exactly the place where you want to be storing your src and beam files.--Chris Baker #end From dmitriid@REDACTED Tue Mar 6 09:48:38 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Tue, 06 Mar 2007 10:48:38 +0200 Subject: [erlang-questions] windows question In-Reply-To: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> References: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> Message-ID: <45ED2AE6.2090801@gmail.com> Hmmm... As far as I remember (I'm on Linux now), I always used the Windows installer from erlang.org. I guess you need to manually add erl to your path variable in order to get access to it from anywhere in the system (i don't think the installer does that). "My Computer -> Properties -> Advanced -> Environment Variables" Once that's done, you can start erl from any directory. The compiled beam file will then be placed in the directory where the source file is. Joe Armstrong wrote: > Hi Guys - help needed. > > A question came up on the errata list for the Erlang book - it was > about windows use > I'll quote the question below - I'm only an occasional windows user > so I don't know the best answer to this. > > Me - I use mingw and msys (I forget) - and a erl.bat file that aliases erlc > but I have no idea if this is the best way to proceed. > > What is "best practice"???? > > Thanks > > /Joe > > Here are the two posts > > (from http://books.pragprog.com/titles/jaerlang/errata) > > > > > > #6533: There should be some description on where to put modules such > as math4.erl once it is downloaded so that c(math4). works without an > error.--Stephen Freitag > > #6524: > Start your favorite text editor and enter the following > >> into a file called shop.erl. >> > > This to me is almost always the hardest entry point for anyone into a > language. Start your text editor where? From the same directory as > Cean? If you do that it doesn't compile because the Cean start script > immediately moves to the bin directory (at least under windows): > > >> cd erlang/erts*/windows/bin >> start werl.exe >> > > In order for it to compile under the shell I've got to place the file > in Erlang's bin directory. Not exactly the place where you want to be > storing your src and beam files.--Chris Baker > > #end > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Mar 6 10:20:01 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 6 Mar 2007 10:20:01 +0100 Subject: [erlang-questions] record_info in module_info Message-ID: <9b08084c0703060120q2158da64jf8c7d589209f77e3@mail.gmail.com> Hi, Suggestion for improvement to system. Compile record tags *into* module_info() Comments - record fields are known at compile time but can be changed later - the values used should be recorded in the module info Benefits: - can check consistency of records *between* different module - can improve ~p to write records correctly - can implement record2list and list2record - can serialize records Problems - none Backward compatibility - 100% Difficulty of implementation: - None :-) Do it /Joe PS can I document this in the book :-) From surindar.shanthi@REDACTED Tue Mar 6 10:20:16 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Tue, 6 Mar 2007 14:50:16 +0530 Subject: [erlang-questions] windows question In-Reply-To: <45ED2AE6.2090801@gmail.com> References: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> <45ED2AE6.2090801@gmail.com> Message-ID: <42ea5fb60703060120y54c8649fwaf93b06bea49185e@mail.gmail.com> In windows, it is better to have a shortcut of erlang in your desktop. You can compile the .erl file in two ways 1. Right click on the shortcut -> Properties -> Give the path of .erl file in the "Start in " text box. Then open the shell and compile the module. 2. Open erlang shell. Then change the current directory using cd("Path of .erl file"). Then compile the module. I hope this answers the queries. On 3/6/07, Dmitrii 'Mamut' Dimandt wrote: > > Hmmm... > > As far as I remember (I'm on Linux now), I always used the Windows > installer from erlang.org. > > I guess you need to manually add erl to your path variable in order to get > access to it from anywhere in the system (i don't think the installer does > that). "My Computer -> Properties -> Advanced -> Environment Variables" > > Once that's done, you can start erl from any directory. The compiled beam > file will then be placed in the directory where the source file is. > > Joe Armstrong wrote: > > Hi Guys - help needed. > > A question came up on the errata list for the Erlang book - it was > about windows use > I'll quote the question below - I'm only an occasional windows user > so I don't know the best answer to this. > > Me - I use mingw and msys (I forget) - and a erl.bat file that aliases erlc > but I have no idea if this is the best way to proceed. > > What is "best practice"???? > > Thanks > > /Joe > > Here are the two posts > > (from http://books.pragprog.com/titles/jaerlang/errata) > > > > > > #6533: There should be some description on where to put modules such > as math4.erl once it is downloaded so that c(math4). works without an > error.--Stephen Freitag > > #6524: > Start your favorite text editor and enter the following > > > into a file called shop.erl. > > > This to me is almost always the hardest entry point for anyone into a > language. Start your text editor where? From the same directory as > Cean? If you do that it doesn't compile because the Cean start script > immediately moves to the bin directory (at least under windows): > > > > cd erlang/erts*/windows/bin > start werl.exe > > In order for it to compile under the shell I've got to place the file > in Erlang's bin directory. Not exactly the place where you want to be > storing your src and beam files.--Chris Baker > > #end > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Tue Mar 6 10:25:44 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 06 Mar 2007 10:25:44 +0100 Subject: [erlang-questions] record_info in module_info In-Reply-To: <9b08084c0703060120q2158da64jf8c7d589209f77e3@mail.gmail.com> References: <9b08084c0703060120q2158da64jf8c7d589209f77e3@mail.gmail.com> Message-ID: It has been suggested before. We might implement it, but definitely not before the book is out. "Joe Armstrong" writes: [...] > Problems > - none Code size. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From seb-cl-mailist@REDACTED Tue Mar 6 10:31:17 2007 From: seb-cl-mailist@REDACTED (=?UTF-8?B?U8OpYmFzdGllbiBTYWludC1TZXZpbg==?=) Date: Tue, 06 Mar 2007 10:31:17 +0100 Subject: [erlang-questions] mnesia:dirty_update_counter In-Reply-To: <6a36e7290703050717jbc5b486h9d3a7d5f6533c678@mail.gmail.com> References: <45EC2390.3010209@matchix.com> <6a36e7290703050717jbc5b486h9d3a7d5f6533c678@mail.gmail.com> Message-ID: <45ED34E5.9010401@matchix.com> > It definitely seems like a bug, but I think that's intended behavior > for backwards compatibility. I'm not sure it was intended in the past, coz the returned value for use by the function caller is 1 while the stored value for future increment is 0, which means the next returned value will still be 1, not being incremented the second time (and so generating overriding updates in mnesia records in my case...) If it was intended, the doc should at least be updated to describe this behaviour. Right now, my own workaround is just to be sure to correctly initialize the counter table with some value (0 is ok) before calling dirty_update_counter for the first time. Cheers, S?bastien. > Here's what we do, which seems to work: > > case mnesia:dirty_update_counter(Db, Key, Inc) of > X when X == Inc -> > F = fun () -> > [R] = mnesia:read(Db, Key, write), > mnesia:write(R) > end, > mnesia:transaction(F); > _ -> > ok > end. > > On 3/5/07, S?bastien Saint-Sevin wrote: >> Hi list, >> >> It seems I've found a bug regarding mnesia:dirty_update_counter(Tab, >> Key, Incr). >> When I use the function for the first time with an Incr of 1 (Key not >> existing), the table is populated with a value of 0 for the key Key (1 >> expected) and returns 1 for NewVal (as expected). >> The doc says : "If Key don't exits, a new record is created with the >> value Incr if it is larger than 0, otherwise it is set to 0." >> >> Is this confirmed or did I missed something ? >> >> Cheers, >> S?bastien. >> >> PS : erl-5.5.3 under windows XP >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> From fred@REDACTED Tue Mar 6 11:40:44 2007 From: fred@REDACTED (=?ISO-8859-1?Q?Lars-=C5ke_Fredlund?=) Date: Tue, 06 Mar 2007 11:40:44 +0100 Subject: [erlang-questions] Sixth ACM SIGPLAN Erlang Workshop -- Call for papers Message-ID: <45ED452C.2050603@babel.ls.fi.upm.es> Dear Erlang friends, the next Erlang workshop will be held in Freiburg, Germany on October 5th. Please see the call for papers below for details. We look forward to receiving many submissions, and to see you all at the workshop! Lars-?ke Fredlund (Programme Chair) Simon Thompson (Workshop Chair) Sixth ACM SIGPLAN Erlang Workshop Freiburg, Germany, October 5, 2007 http://www.erlang.se/workshop/2007/ Satellite event of ACM SIGPLAN International Conference on Functional Programming, October 1-3, 2007 Erlang is a concurrent, distributed functional programming language aimed at systems with requirements on massive concurrency, soft real time response, fault tolerance, and high availability. It has been available as open source for several years creating a community that actively contributes to its already existing rich set of libraries and applications. Originally created for telecom applications, its usage has spread to other domains including e-commerce, banking, and computer telephony. Erlang programs are today among the largest applications written in any functional programming language. These applications offer new opportunities to evaluate functional programming and functional programming methods on a very large scale and suggest new problems for the research community to solve. This workshop will bring together the open source, academic, and industrial programming communities of Erlang. It will enable participants to familiarize themselves with recent developments on new techniques and tools tailored to Erlang, novel applications, draw lessons from users' experiences and identify research problems and common areas relevant to the practice of Erlang and functional programming. Workshop Chair: Simon Thompson University of Kent, UK Programme Chair: Lars-?ke Fredlund Universidad Polit?cnica de Madrid, Spain Programme Committee: Joe Armstrong Ericsson, Stockholm, Sweden Francesco Cesarini Erlang Training & Consulting, London, UK Zolt?n Horv?th E?tv?s Lor?nd University, Budapest, Hungary John Hughes Chalmers University of Technology, Gothenburg, Sweden Rex Page University of Oklahoma, Norman, Oklahoma, USA Micka?l R?mond Process-one, Paris, France Kostis Sagonas Uppsala University, Sweden Erik Stenman Kreditor AB, Stockholm, Sweden Important Dates: Submission deadline: Midnight GMT June 28 Author notification: Midnight GMT July 12 Final submission: Midnight GMT July 26 Submission and publication information: The workshop will have printed proceedings which will be distributed to the participants at the time of the workshop. Subsequently, the papers will be included in the ACM Digital Library. Authors are therefore advised to use the ACM SIGPLAN style file for conference proceedings when preparing their submissions. http://www.acm.org/sigs/sigplan/authorInformation.htm Authors should submit extended abstracts or provisional full papers in PDF, formatted for A4 paper, to Lars-?ke Fredlund fred@REDACTED The length should be restricted to 12 pages in standard ACM format. In previous workshops we have had a mix of papers representing academic research and industrial experiences with Erlang. We particularly welcome papers describing new and novel application of Erlang - if you have any doubts about the suitability of a paper please feel free to contact the Programme Chair for advice. http://www.erlang.se/workshop/2007/ http://www.informatik.uni-bonn.de/~ralf/icfp07.html http://www.erlang.se/workshop From twoggle@REDACTED Tue Mar 6 12:08:56 2007 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 6 Mar 2007 11:08:56 +0000 Subject: [erlang-questions] final year university project with erlang? Message-ID: Hi Folks, I'm currently on a work placement, but in October i'll be starting my final year at university. As part of my course (Computer Science BSc) i'll need to do a project - we can either pick one from those suggested by the department, or we can submit a "student defined" project. The suggestions aren't very inspiring, so I was wondering whether anyone here had any ideas for something I could do involving Erlang? Given my degree level, the project has to be of the "lifecycle" variety, which has following "criteria": BCS/IEE accreditation requires a project that: follows a lifecycle that can be characterised as requirements-design-build-evaluate; describes and evaluates the method(s) used to design, build and evaluate. These projects do not have to be traditional engineering, but must have, describe, and evaluate a recognised method. All lifecycle projects should aim to build or implement something, and to evaluate its quality and reliability etc. AFAIK the project can be run in conjunction with a company, or it could be something that could help the community. My experience so far has been mostly Ruby/Python (in my own time), and Java/Windows programming during my placement. I've only really had a quick play with Erlang, but would rather get to know it a bit better, and I think this could be a good opportunity to do so. Apologies if this is slightly off-topic - please feel free to email me off the list. From seb-cl-mailist@REDACTED Tue Mar 6 12:30:41 2007 From: seb-cl-mailist@REDACTED (=?UTF-8?B?U8OpYmFzdGllbiBTYWludC1TZXZpbg==?=) Date: Tue, 06 Mar 2007 12:30:41 +0100 Subject: [erlang-questions] mnesia:dirty_update_counter In-Reply-To: <45ED39C6.60108@erix.ericsson.se> References: <45EC2390.3010209@matchix.com> <6a36e7290703050717jbc5b486h9d3a7d5f6533c678@mail.gmail.com> <45ED34E5.9010401@matchix.com> <45ED39C6.60108@erix.ericsson.se> Message-ID: <45ED50E1.8010409@matchix.com> Hi Dan, I've isolated the portion of code where the error occurs. Here is a test code. %% file test.erl -module(test). -export([create_db/0]). -record(counter, { key, value}). create_db() -> Nodes = [node()], mnesia:stop(), mnesia:delete_schema(Nodes), mnesia:create_schema(Nodes), mnesia:start(), mnesia:create_table(counter, [{disc_copies, Nodes}, {attributes, record_info(fields, counter)}]), Id1 = mnesia:dirty_update_counter(counter, client, 1), io:format("ID1 : ~w~n", [Id1]), Id2 = mnesia:dirty_update_counter(counter, client, 1), io:format("ID2 : ~w~n", [Id2]), mnesia:stop(). %% end of file Then a session : erl -sname test Eshell V5.5.3 (abort with ^G) (test@REDACTED)1> cd("d:/dev/test"). d:/dev/test ok (test@REDACTED)2> c(test). {ok,test} (test@REDACTED)3> test:create_db(). ID1 : 1 ID2 : 2 =INFO REPORT==== 6-Mar-2007::12:26:06 === application: mnesia exited: stopped type: temporary stopped (test@REDACTED)4> mnesia:start(). ok (test@REDACTED)5> ets:i(counter). <1 > {counter,client,1} EOT (q)uit (p)Digits (k)ill /Regexp -->q quit (test@REDACTED)6> The counter table is finally populated with the (n-1) value of client ID where it sould be (n). Hope this helps to clarify a bit the context. S?bastien. Dan Gudmundsson a ?crit : > > Hi > > This works for me, what are you doing ? > > > 1> mnesia:start(). > ok > 2> mnesia:create_table(a, []). > {atomic,ok} > 3> mnesia:dirty_update_counter(a,1). > ** exited: {aborted,{bad_type,a}} ** > 4> mnesia:dirty_update_counter(a,1,2). > 2 > 5> ets:i(a). > <1 > {a,1,2} > EOT (q)uit (p)Digits (k)ill /Regexp -->q > quit > 6> mnesia:dirty_update_counter(a,2,1). > 1 > 7> ets:i(a). > <1 > {a,2,1} > <2 > {a,1,2} > EOT (q)uit (p)Digits (k)ill /Regexp -->q > quit > > > /Dan > > > S?bastien Saint-Sevin wrote: >>> It definitely seems like a bug, but I think that's intended behavior >>> for backwards compatibility. >> >> I'm not sure it was intended in the past, coz the returned value for >> use by the function caller is 1 while the stored value for future >> increment is 0, which means the next returned value will still be 1, >> not being incremented the second time (and so generating overriding >> updates in mnesia records in my case...) >> >> If it was intended, the doc should at least be updated to describe >> this behaviour. >> >> Right now, my own workaround is just to be sure to correctly >> initialize the counter table with some value (0 is ok) before calling >> dirty_update_counter for the first time. >> >> Cheers, >> >> S?bastien. >> >>> Here's what we do, which seems to work: >>> >>> case mnesia:dirty_update_counter(Db, Key, Inc) of >>> X when X == Inc -> >>> F = fun () -> >>> [R] = mnesia:read(Db, Key, write), >>> mnesia:write(R) >>> end, >>> mnesia:transaction(F); >>> _ -> >>> ok >>> end. >>> >>> On 3/5/07, S?bastien Saint-Sevin wrote: >>>> Hi list, >>>> >>>> It seems I've found a bug regarding mnesia:dirty_update_counter(Tab, >>>> Key, Incr). >>>> When I use the function for the first time with an Incr of 1 (Key >>>> not existing), the table is populated with a value of 0 for the key >>>> Key (1 expected) and returns 1 for NewVal (as expected). >>>> The doc says : "If Key don't exits, a new record is created with the >>>> value Incr if it is larger than 0, otherwise it is set to 0." >>>> >>>> Is this confirmed or did I missed something ? >>>> >>>> Cheers, >>>> S?bastien. >>>> >>>> PS : erl-5.5.3 under windows XP >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://www.erlang.org/mailman/listinfo/erlang-questions >>>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From vladdu55@REDACTED Tue Mar 6 12:57:55 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 6 Mar 2007 12:57:55 +0100 Subject: [erlang-questions] windows question In-Reply-To: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> References: <9b08084c0703060039l77c05561u78176fe953d5b2a8@mail.gmail.com> Message-ID: <95be1d3b0703060357m28414c0fl8bafb4de9bae4332@mail.gmail.com> Hi Joe, On 3/6/07, Joe Armstrong wrote: > A question came up on the errata list for the Erlang book - it was > about windows use > I'll quote the question below - I'm only an occasional windows user > so I don't know the best answer to this. > > Me - I use mingw and msys (I forget) - and a erl.bat file that aliases erlc > but I have no idea if this is the best way to proceed. > > What is "best practice"???? Me, I don't compile Erlang from the command line. I usually used Emacs (of course now it's erlide instead :-) or make:all(load). The windows installer can associate erl files with erlc and adds a right-click menu item saying "Compile". regards, Vlad From thomasl_erlang@REDACTED Tue Mar 6 14:05:34 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 6 Mar 2007 05:05:34 -0800 (PST) Subject: [erlang-questions] record_info in module_info In-Reply-To: <9b08084c0703060120q2158da64jf8c7d589209f77e3@mail.gmail.com> Message-ID: <610459.78490.qm@web38815.mail.mud.yahoo.com> --- Joe Armstrong wrote: > Hi, > > Suggestion for improvement to system. > > Compile record tags *into* module_info() > I can't even decipher what you mean by this. Why not try the shiny new process and write up an EEP? Best, Thomas ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com From serge@REDACTED Tue Mar 6 14:32:57 2007 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 06 Mar 2007 08:32:57 -0500 Subject: [erlang-questions] pool:pspawn and spawning at specific nodes In-Reply-To: References: Message-ID: <45ED6D89.1080906@hq.idt.net> Have you looked at the following family of functions? erlang:spawn(Node, Fun), erlang:spawn(Node, Module, Function, ArgumentList) erlang:spawn_link(Node, Fun), erlang:spawn_link(Node, Module, Function, ArgumentList) If you know the node names and want to have control where processes get spawned this may be the way to go. Some words of caution - it may not be a good idea to use the facilities of the pool module for this type of an applications. First if the nodes are not started in the same subnet, you need to worry about stability of your network connections. When the network is unstable the disconnected pooled nodes started using slave module will be killed, so if you want to spawn processes on specific nodes, you'll need to deal with cases when those nodes are not available. Additionally, in this setup if the master node dies, you automatically loose all the pooled slave nodes. For database applications like the one you described it may not necessarily be a good choice. Perhaps starting N independent nodes, deciding what the connectivity matrix needs to be, and then using pg or pg2 modules to accomplish scaling might be a better alternative in the case you described? The suggested use of a pool module is in cases when you have some computational processes that you want to distribute to independent processors and use the master node to load balance requests. Serge Austin Seipp wrote: > Hi, > > I've been working on a little toy erlang program to kill some time. It > is essentially a simple "Ping, pong" program (as seen in the erlang > documentation.) I decided to modify it so that it could do things like > scale itself appropriately (I use pool:start to automatically start > erlang systmes based on ~/.hosts.erlang) and automatically distribute > the 'Ping' and the 'Pong' processes amongst the slave nodes brought > up. Here is my code: > > -module(pingpong). > -export([start/0,ping/1,pong/0,output_server/0]). > > output_server() -> > receive > {format,{Str,Fmt}} -> > io:fwrite(standard_io,"~s ~s~n",[Str,Fmt]), > output_server() > end. > > ping(0) -> > global:send(pongServer,finished), > global:send(outServer,{format,{"ping finished",""}}); > > ping(N) -> > global:send(pongServer,{ping,self()}), > receive > pong -> > global:send(outServer,{format,{"Ping received pong",""}}) > end, > pingpong:ping(N-1). > > pong() -> > receive > finished -> > global:send(outServer,{format,{"Pong finished",""}}); > {ping,Ping_PID} -> > global:send(outServer,{format,{"Pong received ping",""}}), > Ping_PID ! pong, > pingpong:pong() > end. > > start() -> > PongSrv = lists:nth(1,pool:start(ponger)), > PingSrv = lists:nth(1,pool:start(pinger)), > io:format("nodes registered: ~s and ~s~n",[PongSrv,PingSrv]), > > %register output server > OutSrv_PID = spawn(pingpong,output_server,[]), > case global:register_name(outServer,OutSrv_PID) of > no -> > io:format("could not register output server, exit~n"), > pool:stop(), > exit(output_srvr_reg_err); > yes -> io:format("registered output server~n") > end, > > %register pong server > PongSrv_PID = pool:pspawn(pingpong,pong,[]), > case global:register_name(pongServer,PongSrv_PID) of > no -> > io:format("could not register name globally: err~n"), > pool:stop(), > exit(global_name_reg_err); > yes -> > io:format("~s: successfully registered global name > 'pong'~n",[node()]) > end, > > %register ping client > PingSrv_PID = pool:pspawn(pingpong,ping,[1]), > case global:register_name(pingServer,PingSrv_PID) of > yes -> > io:format("~s: successfully registered global name > 'ping'~n",[node()]); > no -> > io:format("couldn't register name globally: err~n"), > pool:stop(), > exit(global_name_reg_err) > end. > > Here is the output: > > [austin@REDACTED erlang]$ erl -sname main > Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.5.3 (abort with ^G) > (main@REDACTED)1> c(pingpong). > {ok,pingpong} > (main@REDACTED)2> pingpong:start(). > nodes registered: ponger@REDACTED and pinger@REDACTED > registered output server > main@REDACTED: successfully registered global name 'pong' > Pong received ping > Ping received pong > ping finished > Pong finished > main@REDACTED: successfully registered global name 'ping' > ok > (main@REDACTED)3> > > As you can see, it works fine. However, I wanted to spawn the two > seperate Ping and Pong enteties on nodes *at my discretion.* > pool:pspawn simply takes the system out of the pool with the lowest > load (expected) and starts the new process there. So I sought to see > if the regular spawn/4 BIF could spawn it on a node of my choice, > here's the start() and the way I changed it: > > > > And here's the output now: > > [austin@REDACTED erlang]$ erl -sname main > Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.5.3 (abort with ^G) > (main@REDACTED)1> c(pingpong). > {ok,pingpong} > (main@REDACTED)2> pingpong:start(). > nodes registered: ponger@REDACTED and pinger@REDACTED > registered output server > main@REDACTED: successfully registered global name 'pong' > main@REDACTED: successfully registered global name 'ping' > ok > (main@REDACTED)3> > > > So my question really is: can you start processes on slave nodes you > bring up via pool:start() *explicitly* (that is, you specify on what > slave to bring the process up on) rather than letting pspawn decide, > or must you let pool:pspawn() care of it, or is there another > solution? > I wanted to see if I could write a small distributed system that > automatically scaled across available systems like this one did, and I > figure I could use pool:start(...) to give meaningful names to the > Erlang systems I brought up, and bring up a certain part of the whole > program on that node explicitly (for example, if you had a database > server written in erlang, you may want to start several nodes, say > 'filesystem@REDACTED' and another one called 'main@REDACTED' and have the > filesystem@REDACTED system take care of the processes that store info > into the filesystem, while main@REDACTED would handle incoming > connections. pool:pspawn chooses whatever system has the least load; > name is irrelivant, so I mean, it's not very logical to have the > filesystem processes executing on the main@REDACTED node with the > incoming connection code because pool:pspawn decided main@REDACTED had > a little less load. Please also note how many computers are actually > involved in this is irrelivant, I just want my processes spawning on > the slave nodes I specify, and not delegate it to pool:pspawn.) > > > Any recommendations? I suppose this setup would do, but it's not > exactly the ideal scenario here. > -- > - Austin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Tue Mar 6 16:35:41 2007 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 6 Mar 2007 16:35:41 +0100 Subject: [erlang-questions] record_info in module_info In-Reply-To: <610459.78490.qm@web38815.mail.mud.yahoo.com> References: <9b08084c0703060120q2158da64jf8c7d589209f77e3@mail.gmail.com> <610459.78490.qm@web38815.mail.mud.yahoo.com> Message-ID: <9b08084c0703060735l1a5cf40ckc5e72cc860a258f0@mail.gmail.com> On 3/6/07, Thomas Lindgren wrote: > > --- Joe Armstrong wrote: > > > Hi, > > > > Suggestion for improvement to system. > > > > Compile record tags *into* module_info() > > > I meant that if you say -module(glurk). -record(xxx, {a,b,c,...}) -record(yyy, {p,q,r,...}) In a module or include file - then when you compile the file, you'll add information about the record to module_info. So glurk:module_info() might contain tuples like this: {record, xxx, [a,b,c...]}, {record, yyy, [p,q,r]} which are frozen into the beam code > I can't even decipher what you mean by this. Why not > try the shiny new process and write up an EEP? Too busy at the moment, correcting the errata in the U know what :-) /Joe > > Best, > Thomas > > > > > ____________________________________________________________________________________ > Do you Yahoo!? > Everyone is raving about the all-new Yahoo! Mail beta. > http://new.mail.yahoo.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From julien@REDACTED Tue Mar 6 21:10:53 2007 From: julien@REDACTED (Julien Barbot) Date: Tue, 06 Mar 2007 21:10:53 +0100 Subject: [erlang-questions] Init callback return value not checked for port driver Message-ID: <45EDCACD.7010104@barbot.org> Hello, I'm currently working on an erlang port driver and I need some advice on the behaviour of the init callback in the erl_drv_entry structure. The version of erlang used is R11B-3. The documentation says (http://erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/driver_entry.html): "This is called directly after the driver has been loaded by erl_ddll:load_driver/2. (Actually when the driver is added to the driver list.) The driver should return 0, or if the driver can't initialize, -1." If I understand well, the driver is loaded then it is added to the driver list and the init function is called (erts_add_driver_entry() in erts/emulator/beam/io.c). The problem is that the return code of this callback is not checked: erts/emulator/beam/io.c:4498 if (drv->init != NULL) { (*drv->init)(); } What is the good behaviour ?: - The function should never fail, so the documentation is wrong, - The function can fail, so the call of the init function is badly placed. Maybe it could be a better idea to call this function before adding the driver to the driver list ? Here is a simple patch for the R11-B3 that does check the return code before adding the driver to the list if this is what we want. Regards, -- Julien Barbot -------------- next part -------------- A non-text attachment was scrubbed... Name: init_check.patch Type: text/x-patch Size: 1288 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: not available URL: From cd5@REDACTED Tue Mar 6 22:21:15 2007 From: cd5@REDACTED (Christoph Dornheim) Date: Tue, 6 Mar 2007 21:21:15 +0000 (UTC) Subject: [erlang-questions] Question about Erlang's term serialization for message passing Message-ID: Hi, when experimenting with distributed message passing and the external term format transformation with term_to_binary, I wonder if the internal encoding used for passing Erlang terms to local or remote processes is a representation of their in-memory pointer structure (similar to Java's serialization of object graphs) or if it is value-oriented like the external term format. I guess the former is true since otherwise message passing would lead to problems such that data possibly needs more memory space in the receiving process than in the sending one (think of sending [L,L] for L=[1,2,3] from process P1 to P2: if something like term_to_binary is used for encoding the received term needs the same space as [L,[1,2,3]] would have been sent). Is there any documentation about Erlang's data serialization method? Any hints are welcome. Best regards, Christoph From taavi@REDACTED Tue Mar 6 23:03:48 2007 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 7 Mar 2007 00:03:48 +0200 Subject: [erlang-questions] Question about Erlang's term serialization for message passing In-Reply-To: References: Message-ID: <1F7583AA-20F6-4497-9E83-621C4A789234@uninet.ee> On Mar 6, 2007, at 11:21 PM, Christoph Dornheim wrote: > when experimenting with distributed message passing and the > external term format > transformation with term_to_binary, I wonder if the internal > encoding used for > passing Erlang terms to local or remote processes is a > representation of their > in-memory pointer structure (similar to Java's serialization of > object graphs) > or if it is value-oriented like the external term format. > > I guess the former is true since otherwise message passing would > lead to > problems such that data possibly needs more memory space in the > receiving > process than in the sending one (think of sending [L,L] for L= > [1,2,3] from > process P1 to P2: if something like term_to_binary is used for > encoding the > received term needs the same space as [L,[1,2,3]] would have been > sent). Erlang does not have any "hidden in-memory pointer structure" at all. As far as I understand (i am in no way erlang guru) only receiving of values is defined semantically. There are no "object graphs" in erlang. Only values as ints, floats, pids, references, ports, lists etc. Message size optimization probably can be implemented as implementation specific optimization. With hybrid heap it probably is implemented as such. But it is still optimization detail, which should be invisible on language definition level. best regards, taavi From cd5@REDACTED Tue Mar 6 23:56:07 2007 From: cd5@REDACTED (Christoph Dornheim) Date: Tue, 6 Mar 2007 22:56:07 +0000 (UTC) Subject: [erlang-questions] =?utf-8?q?Question_about_Erlang=27s_term_seria?= =?utf-8?q?lization=09for_message_passing?= References: <1F7583AA-20F6-4497-9E83-621C4A789234@uninet.ee> Message-ID: Taavi Talvik uninet.ee> writes: > > Erlang does not have any "hidden in-memory pointer structure" at all. > As far > as I understand (i am in no way erlang guru) only receiving of values is > defined semantically. There are no "object graphs" in erlang. Only > values as > ints, floats, pids, references, ports, lists etc. > > Message size optimization probably can be implemented as implementation > specific optimization. With hybrid heap it probably is implemented as > such. > > But it is still optimization detail, which should be invisible on > language definition level. > > best regards, > taavi > > At the language level, all data are values, but at the implementation level data is built up by pointers to memory locations; so an Erlang term is internally represented by a graph-like pointer structure. E.g. when creating a new list L'=[a|L] from some list L their internal representations share memory since, internally, L' has a pointer to L. See also http://article.gmane.org/gmane.comp.lang.erlang.general/16122/ Regards, Christoph From jeffm@REDACTED Wed Mar 7 00:07:18 2007 From: jeffm@REDACTED (jm) Date: Wed, 07 Mar 2007 10:07:18 +1100 Subject: [erlang-questions] final year university project with erlang? In-Reply-To: References: Message-ID: <45EDF426.1060606@ghostgun.com> Tim Fletcher wrote: > Hi Folks, > > I'm currently on a work placement, but in October i'll be starting my > final year at university. As part of my course (Computer Science BSc) > i'll need to do a project - we can either pick one from those > suggested by the department, or we can submit a "student defined" > project. The suggestions aren't very inspiring, so I was wondering > whether anyone here had any ideas for something I could do involving > Erlang? > Mnesia could do with a good SQL interface. It just needs to support a basic subset of the SQL92 commands. The purpose wouldn't be to turn mnesia into an SQL database nor make erlang use SQL to take to mnesia, but to allow the myriad of other programs out there that only speak SQl and would need major modifications to use mnesia to interface easily to programs written in erlang that use mnesia. This in turn would relieve erlang developers from having to re-invent the wheel in many cases. Really, I think that anything the moves erlang into more industries then the telco and internet related industries would be good. Some crazy ideas to help you get going: * Content Distribution Network (CDN) software - write a file through a web interface with meta-data and have that replicate to a number of servers to be delivered up via HTTP and FTP * Cluster File System - Think NFS with active/active servers and clients. May be a little ambitious. Take a look at lustre.org and gluster.org Depending on you time constraints you may need to scale some of these ideas back to be realistic. I always had a problem picking suitably sized projects myself. :-) Jeff. From bob@REDACTED Wed Mar 7 00:15:30 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 6 Mar 2007 15:15:30 -0800 Subject: [erlang-questions] Question about Erlang's term serialization for message passing In-Reply-To: References: <1F7583AA-20F6-4497-9E83-621C4A789234@uninet.ee> Message-ID: <6a36e7290703061515o3cf4f2a9q508f0691df7ed537@mail.gmail.com> On 3/6/07, Christoph Dornheim wrote: > Taavi Talvik uninet.ee> writes: > > > > > Erlang does not have any "hidden in-memory pointer structure" at all. > > As far > > as I understand (i am in no way erlang guru) only receiving of values is > > defined semantically. There are no "object graphs" in erlang. Only > > values as > > ints, floats, pids, references, ports, lists etc. > > > > Message size optimization probably can be implemented as implementation > > specific optimization. With hybrid heap it probably is implemented as > > such. > > > > But it is still optimization detail, which should be invisible on > > language definition level. > > > > best regards, > > taavi > > > > > > At the language level, all data are values, but at the implementation level data > is built up by pointers to memory locations; so an Erlang term is internally > represented by a graph-like pointer structure. E.g. when creating a new list > L'=[a|L] from some list L their internal representations share memory since, > internally, L' has a pointer to L. > > See also http://article.gmane.org/gmane.comp.lang.erlang.general/16122/ Does it really matter though? It sounds very implementation dependent. If you're trying to reduce identical terms for transfer you're probably going to do pretty well just using term_to_binary/2 with compression. If you're trying to minimize memory consumption you ought to be using data structures that have that property (independent of VM specific optimizations) in the first place. -bob From lcoquelle@REDACTED Wed Mar 7 05:09:51 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 7 Mar 2007 12:09:51 +0800 Subject: [erlang-questions] On using Mnesia to pass data Message-ID: Hi everyone, I would like some advice on "using mnesia or not". The problem I try to solve: A master node run some processes on slave nodes, and gather results of all those processes (master needs to know/admin which process is start on which slave node; the context is a small load-testing tool I am writing mostly to learn Erlang/OTP). Current implementation is fairly simple/direct: Master start the processes on slaves, and wait that the slaves send back results. Looks like using mnesia could give me another implementation to solve the problem: slave write data to mnesia, master read mnesia. Is it a "good idea" to use mnesia only for data transfer? (don't care for now that master will have to store data in some db, it's another issue) Advantage I see to mnesia is that I don't have to manage all cases where slave failed before the end, send half the data only, send all data once or piece by piece... Drawback is maybe efficiency: master and all the slaves will share all the data, where I only need a data transfer from slave->master ... looks like mnesia will do more than what I need: am I in such a case where "when you have a hammer everything looks like a nail"? Any thought? -------------- next part -------------- An HTML attachment was scrubbed... URL: From apnadkarni@REDACTED Wed Mar 7 06:14:26 2007 From: apnadkarni@REDACTED (Ashok P. Nadkarni) Date: Wed, 07 Mar 2007 10:44:26 +0530 Subject: [erlang-questions] Cannot compile file using CEAN distribution Message-ID: <45EE4A32.8070306@users.sourceforge.net> I'm just starting on learning Erlang so apologies in advance if this question has an obvious answer. (BTW, is there a separate mailing list for novices?) Platform is Windows XP. I wrote a simple module x.erl. When I compile it from the werl that comes in the R11B3 distribution using "c(x).", everything works fine. However, when I try to compile the file from the werl that comes with the CEAN distribution, I get the following error: 4> c(x). =ERROR REPORT==== 7-Mar-2007::10:34:06 === Error in process <0.31.0> with exit value: {undef,[{compile,file,[x,[report_erro rs,report_warnings]]},{c,c,2},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_ loop,3}]} ** exited: {undef,[{compile,file,[x,[report_errors,report_warnings]]}, {c,c,2}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** I assume this means the compile module was not found? cean:installed() shows ["cean","crypto","gs","inets","kernel","stdlib"] I tried cean:install(compile) but that shows no such package. I tried cean:install(compiler) but that generates the error "hipe package" not found (or some such). What am I doing wrong with CEAN? I would have thought the CEAN werl and the R11B werl would exhibit the same behaviour. Thanks /Ashok From jeffm@REDACTED Wed Mar 7 06:30:26 2007 From: jeffm@REDACTED (jm) Date: Wed, 07 Mar 2007 16:30:26 +1100 Subject: [erlang-questions] final year university project with erlang? In-Reply-To: <45EDF426.1060606@ghostgun.com> References: <45EDF426.1060606@ghostgun.com> Message-ID: <45EE4DF2.80400@ghostgun.com> jm wrote: > Some crazy ideas to help you get going: Should have added: A decent replacement for amavisd-new/spamassassin that works well with multiple (mail) servers. Take a look at Baysian, of course, but also Conditional Random Fields (CRF), Markov, Boosting, fuzzy OCR, sender IP address reputation, etc. The really good thing about a project like this is that it makes good use of the properties of the erlang language and can be built as a set of plug in modules allowing you to write the core of the application then, time permitting, add extra modules. Jeff. From lcoquelle@REDACTED Wed Mar 7 06:39:42 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 7 Mar 2007 13:39:42 +0800 Subject: [erlang-questions] On using Mnesia to pass data In-Reply-To: <290b3ba10703062104t1452af9as8b89bde157da1be5@mail.gmail.com> References: <290b3ba10703062104t1452af9as8b89bde157da1be5@mail.gmail.com> Message-ID: (re-post some exchange I forgot to copy to the list) Thanks, most of my current knowledge is based on a lot of "2 cents" ... so I always enjoy to got some more! :) I understand that slave can write in the remote table of master. But my point was that there will be some overhead due to mnesia to share all the schema/actions between master and slaves. I don't care about schema/data exchange between master and one slave, but I wonder if mnesia has to make connection between all slaves to know who is writing what, when, where ... On 3/7/07, t ty wrote: > > You do not have to replicate the data. Is possible to have the slave > see the data as a remote table. In this case the data from one slave > isn't propagated to the other slaves. > > Overall I would consider mnesia overkill for your needs. But thats > just my 2 cents. > > Regards > > t > > On 3/6/07, Ludovic Coquelle wrote: > > Hi everyone, > > I would like some advice on "using mnesia or not". > > > > The problem I try to solve: A master node run some processes on slave > nodes, > > and gather results of all those processes (master needs to know/admin > which > > process is start on which slave node; the context is a small > load-testing > > tool I am writing mostly to learn Erlang/OTP). > > > > Current implementation is fairly simple/direct: Master start the > processes > > on slaves, and wait that the slaves send back results. > > > > Looks like using mnesia could give me another implementation to solve > the > > problem: slave write data to mnesia, master read mnesia. > > Is it a "good idea" to use mnesia only for data transfer? (don't care > for > > now that master will have to store data in some db, it's another issue) > > > > Advantage I see to mnesia is that I don't have to manage all cases where > > slave failed before the end, send half the data only, send all data once > or > > piece by piece... > > Drawback is maybe efficiency: master and all the slaves will share all > the > > data, where I only need a data transfer from slave->master ... looks > like > > mnesia will do more than what I need: am I in such a case where "when > you > > have a hammer everything looks like a nail"? > > > > Any thought? > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Mar 7 07:17:19 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 6 Mar 2007 22:17:19 -0800 Subject: [erlang-questions] On using Mnesia to pass data In-Reply-To: References: <290b3ba10703062104t1452af9as8b89bde157da1be5@mail.gmail.com> Message-ID: <6a36e7290703062217m12a144d0hfa138b1479df6137@mail.gmail.com> It may be worth looking at http://www.rabbitmq.com/ ... but that could be more overkill than mnesia. -bob On 3/6/07, Ludovic Coquelle wrote: > (re-post some exchange I forgot to copy to the list) > > Thanks, most of my current knowledge is based on a lot of "2 cents" ... so I > always enjoy to got some more! :) > > I understand that slave can write in the remote table of master. > But my point was that there will be some overhead due to mnesia to share all > the schema/actions between master and slaves. I don't care about schema/data > exchange between master and one slave, but I wonder if mnesia has to make > connection between all slaves to know who is writing what, when, where ... > > On 3/7/07, t ty wrote: > > You do not have to replicate the data. Is possible to have the slave > > see the data as a remote table. In this case the data from one slave > > isn't propagated to the other slaves. > > > > Overall I would consider mnesia overkill for your needs. But thats > > just my 2 cents. > > > > Regards > > > > t > > > > > > On 3/6/07, Ludovic Coquelle wrote: > > > Hi everyone, > > > I would like some advice on "using mnesia or not". > > > > > > The problem I try to solve: A master node run some processes on slave > nodes, > > > and gather results of all those processes (master needs to know/admin > which > > > process is start on which slave node; the context is a small > load-testing > > > tool I am writing mostly to learn Erlang/OTP). > > > > > > Current implementation is fairly simple/direct: Master start the > processes > > > on slaves, and wait that the slaves send back results. > > > > > > Looks like using mnesia could give me another implementation to solve > the > > > problem: slave write data to mnesia, master read mnesia. > > > Is it a "good idea" to use mnesia only for data transfer? (don't care > for > > > now that master will have to store data in some db, it's another issue) > > > > > > Advantage I see to mnesia is that I don't have to manage all cases where > > > slave failed before the end, send half the data only, send all data once > or > > > piece by piece... > > > Drawback is maybe efficiency: master and all the slaves will share all > the > > > data, where I only need a data transfer from slave->master ... looks > like > > > mnesia will do more than what I need: am I in such a case where "when > you > > > have a hammer everything looks like a nail"? > > > > > > Any thought? > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From bjorn@REDACTED Wed Mar 7 07:26:50 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Mar 2007 07:26:50 +0100 Subject: [erlang-questions] Question about Erlang's term serialization for message passing In-Reply-To: References: Message-ID: Christoph Dornheim writes: > Hi, > > when experimenting with distributed message passing and the external term format > transformation with term_to_binary, I wonder if the internal encoding used for > passing Erlang terms to local or remote processes is a representation of their > in-memory pointer structure (similar to Java's serialization of object graphs) > or if it is value-oriented like the external term format. They are value oriented-oriented in both cases. For local message sending, the term in its internal format will simply be copied to the other process. The external term format is used when sending messages to an Erlang process on another node. (But compared to term_to_binary/1, there is an atom cache used, to speed up sending and receiving of atoms.) > I guess the former is true since otherwise message passing would lead to > problems such that data possibly needs more memory space in the receiving > process than in the sending one (think of sending [L,L] for L=[1,2,3] from > process P1 to P2: if something like term_to_binary is used for encoding the > received term needs the same space as [L,[1,2,3]] would have been sent). Such terms will indeed grow when sent to another process. > > Is there any documentation about Erlang's data serialization method? > Any hints are welcome. The external term format is documented in erts/emulator/internal_doc/erl_ext_dist.txt in the source distribution. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sflist@REDACTED Wed Mar 7 07:51:46 2007 From: sflist@REDACTED (Steve Freitas) Date: Tue, 06 Mar 2007 22:51:46 -0800 Subject: [erlang-questions] final year university project with erlang? In-Reply-To: References: Message-ID: <1173250307.24600.23.camel@lothar> On Tue, 2007-03-06 at 11:08 +0000, Tim Fletcher wrote: > Hi Folks, > > I'm currently on a work placement, but in October i'll be starting my > final year at university. As part of my course (Computer Science BSc) > i'll need to do a project - we can either pick one from those > suggested by the department, or we can submit a "student defined" > project. The suggestions aren't very inspiring, so I was wondering > whether anyone here had any ideas for something I could do involving > Erlang? Another idea might be bringing this up to date: http://www.erlang-projects.org/Public/projects/games/nebula-erlang_bindin/view Joe's new book will certainly produce some more people interested in using Erlang to write games, and having a binding to the Nebula Device that's current might be very helpful in that. Steve From bengt.kleberg@REDACTED Wed Mar 7 08:58:12 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 07 Mar 2007 08:58:12 +0100 Subject: [erlang-questions] Cannot compile file using CEAN distribution In-Reply-To: <45EE4A32.8070306@users.sourceforge.net> References: <45EE4A32.8070306@users.sourceforge.net> Message-ID: <45EE7094.3010809@ericsson.com> On 2007-03-07 06:14, Ashok P. Nadkarni wrote: > I'm just starting on learning Erlang so apologies in advance if this > question has an obvious answer. (BTW, is there a separate mailing list > for novices?) there is just erlang-questions for questions. when/if the traffic about cean gets too much there might be a need for a separate list. > Platform is Windows XP. > > I wrote a simple module x.erl. When I compile it from the werl that > comes in the R11B3 distribution using "c(x).", everything works fine. > However, when I try to compile the file from the werl that comes with > the CEAN distribution, I get the following error: ...deleted > > I assume this means the compile module was not found? you are correct. the compiler is not in the base cean install. > I tried > cean:install(compiler) but that generates the error "hipe package" not > found (or some such). > > What am I doing wrong with CEAN? you are doing the right thing. cean:install(compiler) should have installed the compiler for you. i will try to solve the problem (warning i do not have a windows machine) bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From surindar.shanthi@REDACTED Wed Mar 7 10:10:24 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 7 Mar 2007 14:40:24 +0530 Subject: [erlang-questions] Prompting before closing shell Message-ID: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> Dear all, The question might be silly. We have developed a server application in erlang that need to be run throughout the day. We are using Windows Server 2003 as server. If we are closing the erlang shell which is running in the server, it will not give any warning message. Is it possible to give a warning message before closing the erlang shell? Your inputs are welcome. Thanks in advance. -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From christophe.romain@REDACTED Wed Mar 7 10:49:29 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 7 Mar 2007 10:49:29 +0100 Subject: [erlang-questions] Cannot compile file using CEAN distribution In-Reply-To: <45EE4A32.8070306@users.sourceforge.net> References: <45EE4A32.8070306@users.sourceforge.net> Message-ID: <18D8A729-B5F2-499E-B5A1-BFD47DF8B601@process-one.net> Hello This is a known problem on slow connection. hipe is a big package and you just got the "timeout bug" however, you can download it by hand while we are correcting that bug. http://cean.process-one.net/pub/R11B/devel/windows/hipe.tar.gz then extract the content of hipe.tar.gz into [your cean directory]/ erlang/lib you should get a working cean able to compile modules :) regards. From mazen@REDACTED Wed Mar 7 11:14:26 2007 From: mazen@REDACTED (Mazen) Date: Wed, 07 Mar 2007 10:14:26 +0000 Subject: [erlang-questions] Prompting before closing shell References: Message-ID: <20070307101426.672E45A1F4@mail.erlangsystems.com> How are you closing it down exactly? _________________________________________________________ Post sent from http://www.trapexit.org From cd5@REDACTED Wed Mar 7 11:32:44 2007 From: cd5@REDACTED (Christoph Dornheim) Date: Wed, 7 Mar 2007 10:32:44 +0000 (UTC) Subject: [erlang-questions] =?utf-8?q?Question_about_Erlang=27s_term_seria?= =?utf-8?q?lization=09for_message_passing?= References: Message-ID: Bjorn Gustavsson erix.ericsson.se> writes: > > > I guess the former is true since otherwise message passing would lead to > > problems such that data possibly needs more memory space in the receiving > > process than in the sending one (think of sending [L,L] for L=[1,2,3] from > > process P1 to P2: if something like term_to_binary is used for encoding the > > received term needs the same space as [L,[1,2,3]] would have been sent). > > Such terms will indeed grow when sent to another process. Thanks for sharing this information. Is this (the growth of memory space for received data) just a theoretical problem of applications sending that kind of data to remote processes or does it happen sometimes in practice that an application runs out of memory caused by this problem? From apnadkarni@REDACTED Wed Mar 7 12:07:26 2007 From: apnadkarni@REDACTED (Ashok P. Nadkarni) Date: Wed, 07 Mar 2007 16:37:26 +0530 Subject: [erlang-questions] Cannot compile file using CEAN distribution In-Reply-To: <18D8A729-B5F2-499E-B5A1-BFD47DF8B601@process-one.net> References: <45EE4A32.8070306@users.sourceforge.net> <18D8A729-B5F2-499E-B5A1-BFD47DF8B601@process-one.net> Message-ID: <45EE9CEE.5080003@users.sourceforge.net> Thanks, that worked! /Ashok Christophe Romain wrote: > Hello > > This is a known problem on slow connection. > hipe is a big package and you just got the "timeout bug" > > however, you can download it by hand while we are correcting that bug. > http://cean.process-one.net/pub/R11B/devel/windows/hipe.tar.gz > then extract the content of hipe.tar.gz into [your cean > directory]/erlang/lib > > you should get a working cean able to compile modules :) > > regards. > From lcoquelle@REDACTED Wed Mar 7 12:24:03 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 7 Mar 2007 19:24:03 +0800 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> Message-ID: I don't know the answer to your question ... but I would probably do something like: - running the server in a dedicated named shell - open a new shell for the user to communicate with the server shell when needed oh ... maybe I didn't understood your problem ;) On 3/7/07, Surindar Sivanesan wrote: > > Dear all, > The question might be silly. > We have developed a server application in erlang that need to be run > throughout the day. > We are using Windows Server 2003 as server. If we are closing the erlang > shell which is running in the server, it will not give any warning message. > Is it possible to give a warning message before closing the erlang shell? > Your inputs are welcome. > Thanks in advance. > > -- > with regards, > S.Surindar > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From surindar.shanthi@REDACTED Wed Mar 7 12:43:23 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 7 Mar 2007 17:13:23 +0530 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: <20070307101426.672E45A1F4@mail.erlangsystems.com> References: <20070307101426.672E45A1F4@mail.erlangsystems.com> Message-ID: <42ea5fb60703070343y2fa741ceiac0ddeb9e43a6a08@mail.gmail.com> Sometimes there is a chance of closing the shell instead of minimizing it On 3/7/07, Mazen wrote: > > > How are you closing it down exactly? > _________________________________________________________ > Post sent from http://www.trapexit.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Wed Mar 7 12:45:26 2007 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 7 Mar 2007 13:45:26 +0200 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> Message-ID: On Mar 7, 2007, at 1:24 PM, Ludovic Coquelle wrote: > I don't know the answer to your question ... but I would probably > do something like: > - running the server in a dedicated named shell > - open a new shell for the user to communicate with the server > shell when needed > oh ... maybe I didn't understood your problem ;) > > On 3/7/07, Surindar Sivanesan wrote: > Dear all, > The question might be silly. > We have developed a server application in erlang that need to be > run throughout the day. > We are using Windows Server 2003 as server. If we are closing the > erlang shell which is running in the server, it will not give any > warning message. > Is it possible to give a warning message before closing the erlang > shell? > Your inputs are welcome. > Thanks in advance. Does running erlang as service help? http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erlsrv.html best regards, taavi From kenneth.lundin@REDACTED Wed Mar 7 12:48:20 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 7 Mar 2007 12:48:20 +0100 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> Message-ID: Hi, Have you read this: http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erlsrv.html erlsrv is a utility which makes it possible to run an Erlang-node as a Windows service. This enables start of the Erlang-node when the machine is booted up and the Erlang-node will not be terminated because the user that started it is logged out. This may not solve your problem with the shell, but this is the recommended way to run a "non-stop" Erlang application on Windows. /Kenneth On 3/7/07, Surindar Sivanesan wrote: > Dear all, > The question might be silly. > We have developed a server application in erlang that need to be run > throughout the day. > We are using Windows Server 2003 as server. If we are closing the erlang > shell which is running in the server, it will not give any warning message. > Is it possible to give a warning message before closing the erlang shell? > Your inputs are welcome. > Thanks in advance. > > -- > with regards, > S.Surindar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From surindar.shanthi@REDACTED Wed Mar 7 13:11:37 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 7 Mar 2007 17:41:37 +0530 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> Message-ID: <42ea5fb60703070411o5739ec9s248845f14e8aca1c@mail.gmail.com> Hi, Thanks for your suggestion. Our server application need some initial settings to be done after windows is booted. So, we cannot start erlang node as service as far as our application is concerned. On 3/7/07, Kenneth Lundin wrote: > > Hi, > > Have you read this: > http://www.erlang.org/doc/doc-5.5.3/erts-5.5.3/doc/html/erlsrv.html > > erlsrv is a utility which makes it possible to run an Erlang-node as a > Windows service. This enables start of the Erlang-node when the > machine is booted up > and the Erlang-node will not be terminated because the user that > started it is logged out. > > This may not solve your problem with the shell, but this is the > recommended way to > run a "non-stop" Erlang application on Windows. > > /Kenneth > > On 3/7/07, Surindar Sivanesan wrote: > > Dear all, > > The question might be silly. > > We have developed a server application in erlang that need to be run > > throughout the day. > > We are using Windows Server 2003 as server. If we are closing the erlang > > shell which is running in the server, it will not give any warning > message. > > Is it possible to give a warning message before closing the erlang > shell? > > Your inputs are welcome. > > Thanks in advance. > > > > -- > > with regards, > > S.Surindar > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Wed Mar 7 13:20:08 2007 From: matthew@REDACTED (Matthew Sackman) Date: Wed, 7 Mar 2007 12:20:08 +0000 Subject: [erlang-questions] file:sync Message-ID: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> Hi, I've been seeing different performances of disk_log:sync under *nix and win32 and have been tracing through the erlang code base to see where it comes out. So, obviously it ends up in some C code, called via the ports through file:sync. So, for ./erts/emulator/drivers/unix/unix_efile.c int efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ int fd) /* File descriptor for file to sync. */ { #ifdef NO_FSYNC #ifdef VXWORKS return check_error(ioctl(fd, FIOSYNC, 0), errInfo); #else undefined fsync #endif /* VXWORKS */ #else return check_error(fsync(fd), errInfo); #endif /* NO_FSYNC */ } ok - the important line being the last where fsync is actually called which is in glibc unistd.h which is imported. Fine. Then we have for ./erts/emulator/drivers/win32/win_efile.c int efile_fsync(errInfo, fd) Efile_error* errInfo; /* Where to return error codes. */ int fd; /* File descriptor for file to sync. */ { return 1; } This appears to be a slightly troubling implementation and I see no magic redefinition of 1 anywhere. Googling around, everyone seems to map fsync to _commit on win32 and yet _commit appears no where in the erlang source tree. The most telling example I can find is from http://doxygen.postgresql.org/include_2port_2win32_8h-source.html #define fsync(fd) _commit(fd) So have I gone mad, or is this a lacking implementation of file:sync on win32? Cheers, Matthew From ulf.wiger@REDACTED Wed Mar 7 13:36:08 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 7 Mar 2007 13:36:08 +0100 Subject: [erlang-questions] Question about Erlang's term serialization for message passing In-Reply-To: Message-ID: <6616D98C65DD514BA2E1DDC5F92231550131A47F@esealmw115.eemea.ericsson.se> > Christoph Dornheim wrote: > > Is this (the growth of memory space for received data) just a > theoretical problem of applications sending that kind of data > to remote processes or does it happen sometimes in practice > that an application runs out of memory caused by this problem? I ran into severe memory problems once. It's related in this post: http://www.erlang.org/pipermail/erlang-questions/2005-November/018024.ht ml (continued here: http://www.erlang.org/pipermail/erlang-questions/2005-December/018051.ht ml) This was about the flattening of data when passed between two local processes, but the principle is the same. BR, Ulf W From dinesh.titanz@REDACTED Wed Mar 7 15:03:24 2007 From: dinesh.titanz@REDACTED (Dinesh Sunder) Date: Wed, 7 Mar 2007 15:03:24 +0100 (CET) Subject: [erlang-questions] Dinesh has Tagged you! :) Message-ID: <200703071403.l27E3OA1031113@morgoth.cslab.ericsson.net> An HTML attachment was scrubbed... URL: From mats.cronqvist@REDACTED Wed Mar 7 16:04:15 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 07 Mar 2007 16:04:15 +0100 Subject: [erlang-questions] fun in shell Message-ID: <45EED46F.5020209@ericsson.com> running this; F=fun(A,B) -> try A+B catch _:_->dontthinkso end end, lists:zipwith(F,[1,2],[2,3]). in the shell crashes, but works fine in compiled code. is this a well-known problem? or perhaps even a Feature(TM)? mats From Reddy_P@REDACTED Wed Mar 7 16:43:05 2007 From: Reddy_P@REDACTED (Primanathan Reddy [ MTN - Innovation Centre ]) Date: Wed, 7 Mar 2007 17:43:05 +0200 Subject: [erlang-questions] select error when using fragmented tables Message-ID: <5AB5970ECBD20D4D8B6D41A482216B59E8FDDF@MTNMAIL1.mtn.co.za> Hello I'm using mnesia:select/4 in an activity with the mnesia_frag access module. Erlang R11B I get the following error: ** exited: {{badmatch,[{tab_frag2,node@REDACTED,disc_copies}]}, [{mnesia_frag,init_select,6}, {mnesia_tm,non_transaction,5}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** % -------------------- % Original Code % --------------------- init_select(Tid,Opaque,Tab,Pat,Limit,LockKind) -> case ?catch_val({Tab, frag_hash}) of {'EXIT', _} -> mnesia:select(Tid, Opaque, Tab, Pat, Limit,LockKind); FH -> FragNumbers = verify_numbers(FH,Pat), Fun = fun(Num) -> Name = n_to_frag_name(Tab, Num), Node = val({Name, where_to_read}), Storage = mnesia_lib:storage_type_at_node(Node, Name), mnesia:lock(Tid, Opaque, {table, Name}, LockKind), {Name, Node, Storage} end, [{Tab,Node,Type}|NameNodes] = lists:map(Fun, FragNumbers), InitFun = fun(FixedSpec) -> mnesia:dirty_sel_init(Node,Tab,FixedSpec,Limit,Type) end, Res = mnesia:fun_select(Tid,Opaque,Tab,Pat,LockKind,Tab,InitFun,Limit,Node,Typ e), frag_sel_cont(Res, NameNodes, {Pat,LockKind,Limit}) end. After investigating I found that mnesia_frag:init_select/6 is trying to match the result from lists:map( Fun, FragNumbers ) to [{Tab,Node,Type}|NameNodes], where Tab is the name of fragmented table. This will work in all the cases where key is not specified as a part of match specification. However, if the key was specified, instead of Tab, the name of the fragment where key resides is returned instead, which causes the code above to crash. The patch for it is provided below, so I'd like to ask ERLANG/OTP team to include it, or provide equivalent fix for it. % --------- % Patch % --------- init_select(Tid,Opaque,Tab,Pat,Limit,LockKind) -> case ?catch_val({Tab, frag_hash}) of {'EXIT', _} -> mnesia:select(Tid, Opaque, Tab, Pat, Limit,LockKind); FH -> FragNumbers = verify_numbers(FH,Pat), Fun = fun(Num) -> Name = n_to_frag_name(Tab, Num), Node = val({Name, where_to_read}), Storage = mnesia_lib:storage_type_at_node(Node, Name), mnesia:lock(Tid, Opaque, {table, Name}, LockKind), {Name, Node, Storage} end, [{PTab,Node,Type}|NameNodes] = lists:map(Fun, FragNumbers), InitFun = fun(FixedSpec) -> mnesia:dirty_sel_init(Node,PTab,FixedSpec,Limit,Type) end, Res = mnesia:fun_select(Tid,Opaque,PTab,Pat,LockKind,Tab,InitFun,Limit,Node,Ty pe), frag_sel_cont(Res, NameNodes, {Pat,LockKind,Limit}) end. Regards Primanathan Reddy Pharos Consulting (Pty) Ltd. +27832129774 NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/default.aspx?pid=34411 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Wed Mar 7 17:20:23 2007 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 07 Mar 2007 17:20:23 +0100 Subject: [erlang-questions] select error when using fragmented tables In-Reply-To: <5AB5970ECBD20D4D8B6D41A482216B59E8FDDF@MTNMAIL1.mtn.co.za> References: <5AB5970ECBD20D4D8B6D41A482216B59E8FDDF@MTNMAIL1.mtn.co.za> Message-ID: <45EEE647.60801@erix.ericsson.se> Thanks I will take a look at it. /Dan Primanathan Reddy [ MTN - Innovation Centre ] wrote: > Hello > > > > I?m using mnesia:select/4 in an activity with the mnesia_frag access module. > > Erlang R11B > > > > I get the following error: > > > > ** exited: {{badmatch,[{tab_frag2,node@REDACTED,disc_copies}]}, > > [{mnesia_frag,init_select,6}, > > {mnesia_tm,non_transaction,5}, > > {erl_eval,do_apply,5}, > > {shell,exprs,6}, > > {shell,eval_loop,3}]} ** > > > > > > % -------------------- > > % Original Code > > % --------------------- > > init_select(Tid,Opaque,*Tab*,Pat,Limit,LockKind) -> > > case ?catch_val({Tab, frag_hash}) of > > {'EXIT', _} -> > > mnesia:select(Tid, Opaque, Tab, Pat, Limit,LockKind); > > FH -> > > FragNumbers = verify_numbers(FH,Pat), > > Fun = fun(Num) -> > > Name = n_to_frag_name(Tab, Num), > > Node = val({Name, where_to_read}), > > Storage = > mnesia_lib:storage_type_at_node(Node, Name), > > mnesia:lock(Tid, Opaque, {table, > Name}, LockKind), > > {Name, Node, Storage} > > end, > > [{*Tab*,Node,Type}|NameNodes] = *lists:map*(Fun, > FragNumbers), > > InitFun = fun(FixedSpec) -> > mnesia:dirty_sel_init(Node,Tab,FixedSpec,Limit,Type) end, > > Res = > mnesia:fun_select(Tid,Opaque,Tab,Pat,LockKind,Tab,InitFun,Limit,Node,Type), > > frag_sel_cont(Res, NameNodes, {Pat,LockKind,Limit}) > > end. > > > > After investigating I found that mnesia_frag:init_select/6 is trying to > match the result from lists:map( Fun, FragNumbers ) to > [{*Tab*,Node,Type}|NameNodes], where Tab is the name of fragmented > table. This will work in all the cases where key is not specified as a > part of match specification. However, if the key was specified, instead > of Tab, the name of the fragment where key resides is returned instead, > which causes the code above to crash. The patch for it is provided > below, so I?d like to ask ERLANG/OTP team to include it, or provide > equivalent fix for it. > > > > > > > > % --------- > > % Patch > > % --------- > > > > init_select(Tid,Opaque,Tab,Pat,Limit,LockKind) -> > > case ?catch_val({Tab, frag_hash}) of > > {'EXIT', _} -> > > mnesia:select(Tid, Opaque, Tab, Pat, Limit,LockKind); > > FH -> > > FragNumbers = verify_numbers(FH,Pat), > > Fun = fun(Num) -> > > Name = n_to_frag_name(Tab, Num), > > Node = val({Name, where_to_read}), > > Storage = > mnesia_lib:storage_type_at_node(Node, Name), > > mnesia:lock(Tid, Opaque, {table, > Name}, LockKind), > > {Name, Node, Storage} > > end, > > [{*PTab*,Node,Type}|NameNodes] = lists:map(Fun, > FragNumbers), > > InitFun = fun(FixedSpec) -> > mnesia:dirty_sel_init(Node,*PTab*,FixedSpec,Limit,Type) end, > > Res = > mnesia:fun_select(Tid,Opaque,*PTab*,Pat,LockKind,Tab,InitFun,Limit,Node,Type), > > frag_sel_cont(Res, NameNodes, {Pat,LockKind,Limit}) > > end. > > From fritchie@REDACTED Wed Mar 7 19:06:57 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 07 Mar 2007 12:06:57 -0600 Subject: [erlang-questions] On using Mnesia to pass data In-Reply-To: Message of "Wed, 07 Mar 2007 12:09:51 +0800." Message-ID: <200703071806.l27I6v7F021470@snookles.snookles.com> >>>>> "lc" == Ludovic Coquelle writes: lc> Looks like using mnesia could give me another implementation to lc> solve the problem: slave write data to mnesia, master read mnesia. lc> Is it a "good idea" to use mnesia only for data transfer? (don't lc> care for now that master will have to store data in some db, it's lc> another issue) To my reading, this falls squarely in the "overkill" category. If you don't need the data to persist when a slave crashes or if the master crashes, then Mnesia is a huge sledghammer to drive your tack. After all, with Mnesia you need to specify which node(s) in the cluster will be storing your data. Transaction managers will be necessary to coordinate transaction spanning multiple nodes. And if your load generator's data requires more processing by (I'm guessing here) the master for final presentation, the master will have to extract the raw/partially cooked data from Mnesia, perhaps requiring even more cross-node messaging and (perhaps) transaction manager communication. Compared to all of that, this slave-to-client reporting code: MasterStatsPid ! {load_gen_slave_results, OpStatus, OpDetail} ... and a simple stats gathering proc (assuming on the master) is a lot simpler. And remarkably not slow, if performance is worrying you. -Scott P.S. It may be instructive to look at how load generator stats management is performed by Tsung, http://tsung.erlang-projects.org/ From anders@REDACTED Wed Mar 7 23:21:22 2007 From: anders@REDACTED (Anders Ramsell) Date: Wed, 07 Mar 2007 23:21:22 +0100 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: <42ea5fb60703070411o5739ec9s248845f14e8aca1c@mail.gmail.com> References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> <42ea5fb60703070411o5739ec9s248845f14e8aca1c@mail.gmail.com> Message-ID: <45EF3AE2.5060105@theheartofgold.org> Surindar Sivanesan wrote: > Hi, > Thanks for your suggestion. > Our server application need some initial settings to be done > after windows is booted. So, we cannot start erlang node as > service as far as our application is concerned. Yes you can. And, as suggested, you really should. Here's one way of doing it that would preserve your requirements for manual initial settings: 1. Install a service using erlsrv but don't set it to run any code at start-up. 2. Place a werl short-cut on the desktop with access to a user_default module with custom initialize and startup commands. Internally these commands run code in the service node using e.g. the rpc module. 3. Use the "maintenance shell" whenever you need to start, configure, etc. your server. 4. Close "maintenance shell" when you are done. 5. Server keeps running in it's service. With well written and documented user_default commands the person using the "maintenance shell" doesn't even need to know any Erlang. We do something similar in our environment but we do start up the system on boot time. /Anders Ramsell From chris.newcombe@REDACTED Thu Mar 8 00:48:39 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Wed, 7 Mar 2007 15:48:39 -0800 Subject: [erlang-questions] compile module from string, containing macro definitions Message-ID: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> I'm using this code from Ulf Wiger to compile a module from a string: http://www.erlang.org/ml-archive/erlang-questions/200607/msg00080.html It is supposed to support epp-style macros. However, when I test it with code containing a macro definition I get an error. My compilation steps, test output and test code are all below. e.g. This string compiles, loads, and executes correctly: "-module(test_module).\n-export([test/1]).\ntest(P1) -> {test_result, P1}.\n" But adding a single "-define(MY_MACRO, 1).\n" (which compiles fine from a file) "-module(test_module2).\n-export([test/1]).\n-define(MY_MACRO, 1).\ntest(P1) -> {test_result, P1}.\n", ? compile:forms/2 gives this error: {error, [{".", [{none, compile, {crash, lint_module, {function_clause, [{erl_lint, function_state, [{tree, {".",attribute}, ... I've never used syntax_tools/epp_dodger or compile:forms before so any help would be greatly appreciated! Thanks, Chris > c("/home/cnewcom/backups/ram_file_io_server", [{outdir, "/home/cnewcom/backups/"}]). {ok,ram_file_io_server} > c("/home/cnewcom/backups/test_compile_string", [{outdir, "/home/cnewcom/backups/"}]). {ok,test_compile_string} > test_compile_string:test_no_macros(). {test_result,p1} > test_compile_string:test_macros(). =ERROR REPORT==== 7-Mar-2007::15:29:25 === Error in process <0.60.0> with exit value: {{nocatch,{compile_forms_error,{error,[{".",[{none,compile,{crash,lint_module,{function_clause,[{erl_lint,function_state,[{tree,{".",attribute},{attr,{".",3},[],none},{attribute,{".",{atom,3,define}},[{var,{".",3},'MY_MACRO'... ** exited: {{nocatch, {compile_forms_error, {error, [{".", [{none, compile, {crash, lint_module, {function_clause, [{erl_lint, function_state, [{tree, {".",attribute}, {attr,{...},...}, {attribute,...}}, {lint,function,test_module2,[],...}]}, {lists,foldl,3}, {erl_lint,forms,2}, {erl_lint,module,3}, {compile,lint_module,1}, {compile,'-internal_comp/4-anonymous-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,...}]}}}]}], []}}}, [{test_compile_string,compile,3}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** %% Test code -module(test_compile_string). -compile(export_all). test_no_macros() -> ModNameStr = "test_module", Bin = compile(ModNameStr, "-module(" ++ ModNameStr ++ ").\n-export([test/1]).\ntest(P1) -> {test_result, P1}.\n", [return_errors, return_warnings, verbose]), {module, TestModuleNameAtom} = code:load_binary(list_to_atom(ModNameStr), ModNameStr ++ ".erl", Bin), {test_result, p1} = TestModuleNameAtom:test(p1). test_macros() -> ModNameStr = "test_module2", _Bin = compile(ModNameStr, "-module(" ++ ModNameStr ++ ").\n-export([test/1]).\n-define(MY_MACRO, 1).\ntest(P1) -> {test_result, P1}.\n", [return_errors, return_warnings, verbose]). compile(ModuleNameStr, CodeStr, CompileFormsOptions) -> Filename = ModuleNameStr ++ ".erl", {ok, Fd} = open_ram_file(Filename), file:write(Fd, CodeStr), file:position(Fd, 0), case epp_dodger:parse(Fd) of {ok, Tree} -> Forms = revert_tree(Tree), close_ram_file(Fd), ModuleNameAtom = list_to_atom(ModuleNameStr), %% note: 'binary' is forced as an implicit option, whether it is provided or not. case compile:forms(Forms, CompileFormsOptions) of {ok, ModuleNameAtom, Binary} when is_binary(Binary) -> Binary; {ok, ModuleNameAtom, Binary, []} when is_binary(Binary) -> % empty warnings list Binary; {ok, ModuleNameAtom, _, Warnings} -> throw({compile_forms_warnings, Warnings}); Error -> throw({compile_forms_error, Error}) end; Error -> close_ram_file(Fd), throw({?MODULE, epp, Error}) end. open_ram_file(Filename) -> ram_file_io_server:start(self(), Filename, [read,write]). close_ram_file(Fd) -> file:close(Fd). revert_tree(Tree) -> [erl_syntax:revert(T) || T <- Tree]. From surindar.shanthi@REDACTED Thu Mar 8 05:21:54 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Thu, 8 Mar 2007 09:51:54 +0530 Subject: [erlang-questions] Prompting before closing shell In-Reply-To: <45EF3AE2.5060105@theheartofgold.org> References: <42ea5fb60703070110u55b89fbfxe17b2f91e5ac97c2@mail.gmail.com> <42ea5fb60703070411o5739ec9s248845f14e8aca1c@mail.gmail.com> <45EF3AE2.5060105@theheartofgold.org> Message-ID: <42ea5fb60703072021p64a4c28fh9a28201ba92b39d5@mail.gmail.com> Hi, Thanks a lot, for all of your inputs. I will try based on your suggestions. On 3/8/07, Anders Ramsell wrote: > > Surindar Sivanesan wrote: > > Hi, > > Thanks for your suggestion. > > Our server application need some initial settings to be done > > after windows is booted. So, we cannot start erlang node as > > service as far as our application is concerned. > > Yes you can. And, as suggested, you really should. > Here's one way of doing it that would preserve your requirements > for manual initial settings: > > 1. Install a service using erlsrv but don't set it to run any > code at start-up. > 2. Place a werl short-cut on the desktop with access to a > user_default module with custom initialize and startup > commands. Internally these commands run code in the service > node using e.g. the rpc module. > 3. Use the "maintenance shell" whenever you need to start, > configure, etc. your server. > 4. Close "maintenance shell" when you are done. > 5. Server keeps running in it's service. > > With well written and documented user_default commands the person > using the "maintenance shell" doesn't even need to know any > Erlang. > > We do something similar in our environment but we do start up the > system on boot time. > > /Anders Ramsell > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From xpdoka@REDACTED Thu Mar 8 07:54:03 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Thu, 8 Mar 2007 07:54:03 +0100 (CET) Subject: [erlang-questions] erlang in Air Traffic Management ? In-Reply-To: <45EC9A0E.10207@ghostgun.com> References: <45EC9A0E.10207@ghostgun.com> Message-ID: <32550.217.128.75.198.1173336843.squirrel@www.geekisp.com> Hello Jeff, > As a side question and really what I'm curious to know is > what requirements, regulations, informal pressure is there > that governs the use of certain languages, etc both in the > aeronautics industry and other "high reliablity" > industries? When I was in the railway signalling industry a few years ago, we applied Cenelec's EN 50128 standard. It defines 4 safety integrity levels (SIL), of which only 2 are really used, 2 and 4. SIL 4 applies to the critical systems: the ones that directly control signals, points and automatic train control or automatic train protection. SIL 2 applies to things like central control rooms, SCADA etc. The standard doesn't stipulate explicitly which languages can be used, but it does stipulate certain language features that are required or prohibited. The traditional interpretation of the standard is that at SIL4, only Ada can be used, but at SIL2, C/C++ can be (and is) used, although with some restrictions that can be addressed by coding standards. There is no doubt that, as far as the standard is concerned, a good case can be made for Erlang (for SIL2 systems only): it has many features that are recommended by the standard - its only weakness is that it has automatic memory management, but in practice C/C++ systems rarely manage to avoid using dynamic memory (strongly discouraged, if my memory serves me right, by the standard), so obviously a garbage collector is better than doing malloc/free or new/delete manually. But, in principle, one could (and should) write a C/C++ system using only static and automatic memory allocation - which you can't do in Erlang. The real problem is that the industry is very conservative, and there is great informal pressure not to do things any differently from how they've been done in the past. There is even a holy principle, whose name I forget, which is in the standards, and basically means: we guarantee this is as safe as (i.e. not worse than) previously designed systems. Regards, Dominic Williams http://www.dominicwilliams.net ---- From ulf@REDACTED Thu Mar 8 08:22:17 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 08 Mar 2007 08:22:17 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> Message-ID: Den 2007-03-08 00:48:39 skrev Chris Newcombe : > I'm using this code from Ulf Wiger to compile a module from a string: > > http://www.erlang.org/ml-archive/erlang-questions/200607/msg00080.html > > It is supposed to support epp-style macros. > However, when I test it with code containing a macro definition I get an > error. While epp_dodger is able to parse macro definitions (as long as they are syntactically regular), it doesn't expand them. It ought to be possible to insert a macro expansion pass. This is what I do in erlhive. BR, Ulf W -- Ulf Wiger From erlang@REDACTED Thu Mar 8 09:30:18 2007 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 8 Mar 2007 09:30:18 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics Message-ID: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Something to think about ... In the book beta, many people are reporting errors when they type things like -record(a, {b,v,d}). fac(0) -> 1; fac(N) -> N*fac(N-1) into the shell. They don't understand that some things are for the shell, others for modules. I Talked to Dave Thomas (Prag P) - he said "why can't you type everything into the shell" I said bla bla bla .., any explained how it is He said - but it must be easy to implement .... Having slept on it I think he's right. Why not? all we need to do is add an invisible "-module(shell)" to the session, remember all the stuff that's typed in and as new functions come either compile the complete module (so far) or interpret the code. Variable bindings could occur as in parameterized modules. In fact these is no good reason not to allow this in modules as well ... -module(mmm). X = 12 + lists:sqrt(23). foo(A) -> A + X. .... etc.... This would *greatly* increase the power of Erlang and make things nicely symmetric we can pipe modules into the shell and vice versa, no change. We can have a shell session and save it as a module ... /Joe From ulf@REDACTED Thu Mar 8 09:44:47 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 08 Mar 2007 09:44:47 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: Den 2007-03-08 09:30:18 skrev Joe Armstrong : > Something to think about ... > > In the book beta, many people are reporting errors when they type things > like > > -record(a, {b,v,d}). > > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > into the shell. You can already define records in the shell - just not with the record syntax. Eshell V5.5.3 (abort with ^G) 1> rd(person, {name, age}). person 2> Me = #person{name = ulf, age = 40}. #person{name = ulf,age = 40} 3> Me#person.age. 40 4> I think this is reasonably good. You should describe this, and we can prototype extensions that would make it even more convenient. /Ulf W -- Ulf Wiger From VAUCHER@REDACTED Thu Mar 8 09:48:59 2007 From: VAUCHER@REDACTED (VAUCHER Laurent) Date: Thu, 8 Mar 2007 09:48:59 +0100 Subject: [erlang-questions] Changing the shell and module syntax andsemantics Message-ID: <55DDB08CC9CD2941A70E8D626789A2C9046859DC@ec8l7ljvo9h5dde.hosting.exch> Why not even support -module(xxx). to switch current modules ? Just like (in-package :xxx) in Common-Lisp ? Erlang's modules are not exactly the same thing as CL's packages. There is a notion of "(reloadable) compilation unit" that does not exist in CL but the shell could provide us with the right commands. We could just type c(). in the shell to compile/load the current module... I'm no Erlang expert. I'm no CL expert either, so if my comments make no sense, don't bother. Laurent. From cyberlync@REDACTED Thu Mar 8 09:55:06 2007 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 8 Mar 2007 00:55:06 -0800 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: Having a fully functional repl would be very nice. I have wanted to see this happen for a very long time. Just tonight it would have been a nice feature to have. You can get by without it but it would be very convenient. On 3/8/07, Joe Armstrong wrote: > Something to think about ... > > In the book beta, many people are reporting errors when they type things > like > > -record(a, {b,v,d}). > > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > into the shell. > > They don't understand that some things are for the shell, others for modules. > > I Talked to Dave Thomas (Prag P) - he said "why can't you type > everything into the shell" > > I said bla bla bla .., any explained how it is > > He said - but it must be easy to implement .... > > Having slept on it I think he's right. > > Why not? > > all we need to do is add an invisible "-module(shell)" to > the session, remember all the stuff that's typed in and > as new functions come either compile the complete module (so far) > or interpret the code. > > Variable bindings could occur as in parameterized modules. > > In fact these is no good reason not to allow this in modules as well ... > > -module(mmm). > > X = 12 + lists:sqrt(23). > > foo(A) -> > A + X. > > .... etc.... > > This would *greatly* increase the power of Erlang and make things > nicely symmetric > we can pipe modules into the shell and vice versa, no change. We can > have a shell > session and save it as a module ... > > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Thu Mar 8 09:55:46 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 08 Mar 2007 09:55:46 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: <45EFCF92.7010400@ericsson.com> On 2007-03-08 09:30, Joe Armstrong wrote: ...deleted > In fact these is no good reason not to allow this in modules as well ... > > -module(mmm). > > X = 12 + lists:sqrt(23). > > foo(A) -> > A + X. > > .... etc.... > > This would *greatly* increase the power of Erlang and make things > nicely symmetric it would also make this code crash: -module(mmm). X = 12 + lists:sqrt(23). foo(A) -> X = A+1, ... which would be symmetric towards the shell but rather inconvenient in a big module. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From vladdu55@REDACTED Thu Mar 8 09:59:54 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 8 Mar 2007 09:59:54 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: <95be1d3b0703080059y74f2847pfd8d916d8b2de13a@mail.gmail.com> Hi, On 3/8/07, Joe Armstrong wrote: > Something to think about ... > all we need to do is add an invisible "-module(shell)" to > the session, remember all the stuff that's typed in and > as new functions come either compile the complete module (so far) > or interpret the code. > > Variable bindings could occur as in parameterized modules. > > In fact these is no good reason not to allow this in modules as well ... > > -module(mmm). > > X = 12 + lists:sqrt(23). > > foo(A) -> > A + X. Looks like an interesting idea! There are some things that bother me, which would need to be considered carefully. Where is preprocessing done when in shell mode? Since macros need not be full correct Erlang constructs, it's going to be tricky to ensure correctness -- on the other hand, it may be a good opportunity to check if it's possible to restrict macros to be nicely behaved (i.e. is anyone doing nasty things with them?) especially since all source code handling applications assume this is the case anyway. Would declarations become expressions evaluated at compile-time? What would the value be? Function definitions could "return" a fun, but what about attributes? By compiling a module, some arbitrary computation could be started - is it what we'd want? best regards, Vlad From bjorn@REDACTED Thu Mar 8 10:06:23 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Mar 2007 10:06:23 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: Unfortunately, -record(a, {b,v,d}) is a function call in the shell 1> -record(a, {b,v,d}). -42 2> /Bjorn P.S. I've added the following definition to my user_default.erl. record(_, _) -> 42. "Joe Armstrong" writes: > Something to think about ... > > In the book beta, many people are reporting errors when they type things > like > > -record(a, {b,v,d}). > > > fac(0) -> 1; > fac(N) -> N*fac(N-1) > > into the shell. > > They don't understand that some things are for the shell, others for modules. > > I Talked to Dave Thomas (Prag P) - he said "why can't you type > everything into the shell" > > I said bla bla bla .., any explained how it is > > He said - but it must be easy to implement .... > > Having slept on it I think he's right. > > Why not? > > all we need to do is add an invisible "-module(shell)" to > the session, remember all the stuff that's typed in and > as new functions come either compile the complete module (so far) > or interpret the code. > > Variable bindings could occur as in parameterized modules. > > In fact these is no good reason not to allow this in modules as well ... > > -module(mmm). > > X = 12 + lists:sqrt(23). > > foo(A) -> > A + X. > > .... etc.... > > This would *greatly* increase the power of Erlang and make things > nicely symmetric > we can pipe modules into the shell and vice versa, no change. We can > have a shell > session and save it as a module ... > > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From twoggle@REDACTED Thu Mar 8 10:43:10 2007 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 8 Mar 2007 09:43:10 +0000 Subject: [erlang-questions] final year university project with erlang? In-Reply-To: References: Message-ID: Thanks for the comments and great suggestions. Several nice ideas, so I just need to find a supervisor that will accept one of them! Will post an update once it gets finalized (week or so hopefully). From rsaccon@REDACTED Thu Mar 8 10:48:06 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 8 Mar 2007 06:48:06 -0300 Subject: [erlang-questions] image manipulation Message-ID: Does there exist any pixel-based image manipulation library for Erlang which allows me to create shapes such as antialiased circles and save them in .PNG format ? Or has anybody created a Port to an existing C imaging library and might share experience (or code) ? -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Thu Mar 8 11:07:13 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 08 Mar 2007 11:07:13 +0100 Subject: [erlang-questions] image manipulation In-Reply-To: References: Message-ID: Roberto Saccon wrote: > Does there exist any pixel-based image manipulation library for Erlang > which allows me to create shapes such as antialiased circles and save > them in .PNG format ? > > Or has anybody created a Port to an existing C imaging library and might > share experience (or code) ? > > -- > Roberto Saccon > An interface to the gd library. It is extremely old though... http://www.erlang.org/user.html#gif-1.0 --Tobbe From mats.cronqvist@REDACTED Thu Mar 8 11:44:05 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 08 Mar 2007 11:44:05 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> Message-ID: <45EFE8F5.1080104@ericsson.com> Chris Newcombe wrote: > I'm using this code from Ulf Wiger to compile a module from a string: bad mistake... (hi ulf!) > However, when I test it with code containing a macro definition I get an > error. "it hurts when i do this..." :> as it were, i too have needed to compile a string that contains macros. the attached code works without any hacking of OTP. it will compile a string with macros. be aware that the macro handling is very limited (but hopefully easy to extend). e.g. > complainer:string("-module(x).\n-export([go/0]).\n-define(X,\"that sucks\").\ngo()->[erlang,has_macros,?X].\n"). {module,x} > x:go(). [erlang,has_macros,"that sucks"] mats %%---------------------------------------------------------------- %%% File : complainer.erl %%% Author : Mats Cronqvist %%% Created : 10 Jul 2006 %%% Description : takes a string that should be an erlang module. %%% scans, does macro substitution, %%% parses, compiles and loads. %%% will also make popcorn. %%%---------------------------------------------------------------- -module(complainer). -author('Mats Cronqvist'). -export([string/1]). -import(lists,[reverse/1,keyreplace/4]). string(Text) -> Forms = scan_and_parse(Text,1,[],dict:new()), {ok,Mod,Bin} = compile:forms(Forms), code:load_binary(Mod,"generated",Bin). %%%## 'scan_and_parse' %%% %%% basically we call the OTP scanner and parser (erl_scan and %%% erl_parse) line-by-line, but check each scanned line for (or %%% definitions of) macros before parsing. scan_and_parse([],_Line,Forms,_MacroDict) -> reverse(Forms); scan_and_parse(Text,Line,Forms,MacroDict) -> case scanner(Text,Line,MacroDict) of {macro,NLine,Cont,NMacroDict} -> scan_and_parse(Cont,NLine,Forms,NMacroDict); {tokens,NLine,Cont,Toks} -> {ok,Form} = erl_parse:parse_form(Toks), scan_and_parse(Cont,NLine,[Form|Forms],MacroDict) end. scanner(Text,Line,MacroDict) -> {done,{ok,Toks,NLine},Cont} = erl_scan:tokens([],Text,Line), case pre_proc(Toks,MacroDict) of {macro,NMacroDict} -> {macro,NLine,Cont,NMacroDict}; {tokens,NToks} -> {tokens,NLine,Cont,NToks} end. %%%## 'pre-proc' %%% %%% have to implement a subset of the pre-processor, since epp insists %%% on running on a file. %%% only handles 2 cases; %% -define(MACRO,"string"). %% -define(MACRO(VAR1,VARN),{stuff,VAR1,more,stuff,VARN,extra,stuff}). pre_proc([{'-',_},{atom,_,define},{'(',_},{_,_,Name}|DefToks],MacroDict) -> false = dict:is_key(Name,MacroDict), case DefToks of [{',',_}|Macro] -> {macro,dict:store(Name,{[],macro_wo_vars(Macro,[])},MacroDict)}; [{'(',_}|Macro] -> {macro,dict:store(Name,macro_w_vars(Macro,[]),MacroDict)} end; pre_proc(Toks,MacroDict) -> {tokens,subst_macros(Toks,MacroDict,[])}. macro_w_vars([{')',_},{',',_}|Toks],Vars) -> {reverse(Vars),macro_wo_vars(Toks,[])}; macro_w_vars([{var,_,Var}|Toks],Vars) -> macro_w_vars(Toks,[Var|Vars]); macro_w_vars([{',',_},{var,_,Var}|Toks],Vars) -> macro_w_vars(Toks,[Var|Vars]). macro_wo_vars([{')',_},{dot,_}],Val) -> Val; macro_wo_vars([H|T],Val) -> macro_wo_vars(T,[H|Val]). subst_macros([{'?',_},{_,_,Name},{'(',_}|Toks],MacroDict,O) -> {NToks,Vars} = subst_macros_get_vars(Toks,[]), Macro = dict:fetch(Name,MacroDict), subst_macros(NToks,MacroDict,subst_macros_put_vars(Macro,Vars)++O); subst_macros([{'?',_},{_,_,Name}|Toks],MacroDict,O) -> Macro = dict:fetch(Name,MacroDict), subst_macros(Toks,MacroDict,subst_macros_put_vars(Macro,[])++O); subst_macros([H|T],MacroDict,O) -> subst_macros(T,MacroDict,[H|O]); subst_macros([],_MacroDict,O) -> reverse(O). subst_macros_get_vars([{')',_}|Toks],O) -> {Toks,reverse(O)}; subst_macros_get_vars([{',',_},{var,_,Var}|Toks],O) -> subst_macros_get_vars(Toks,[Var|O]); subst_macros_get_vars([{var,_,Var}|Toks],O) -> subst_macros_get_vars(Toks,[Var|O]). subst_macros_put_vars({[],Macro},[]) -> Macro; subst_macros_put_vars({[MVar|MVars],Macro},[Var|Vars]) -> NMacro = keyreplace(MVar,3,Macro,{var,1,Var}), subst_macros_put_vars({MVars,NMacro},Vars). From rsaccon@REDACTED Thu Mar 8 11:51:19 2007 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 8 Mar 2007 07:51:19 -0300 Subject: [erlang-questions] image manipulation In-Reply-To: References: Message-ID: thanks. I took a look at http://www.libgd.org, and that does all I want (and even more ...) On 3/8/07, Torbjorn Tornkvist wrote: > > Roberto Saccon wrote: > > Does there exist any pixel-based image manipulation library for Erlang > > which allows me to create shapes such as antialiased circles and save > > them in .PNG format ? > > > > Or has anybody created a Port to an existing C imaging library and might > > share experience (or code) ? > > > > -- > > Roberto Saccon > > > > An interface to the gd library. > It is extremely old though... > > http://www.erlang.org/user.html#gif-1.0 > > --Tobbe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Roberto Saccon -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Thu Mar 8 12:14:41 2007 From: erlang@REDACTED (Peter Lund) Date: Thu, 08 Mar 2007 12:14:41 +0100 Subject: [erlang-questions] image manipulation In-Reply-To: References: Message-ID: <45EFF021.2070904@lundata.se> The old gif-1.0 I have developed a bit naming it gif-2.0 in order to do more stuff and use the latest version of gd c-code library. It is open source too, so just grab anything you like. Maybe you even can contribute with more functions in the erlang interface using more of the latest and greatest gd library. Check the latest README: http://svn.gna.org/viewcvs/maginot/trunk/gif_drv/README?rev=62&view=markup You need the stuff under: http://svn.gna.org/viewcvs/maginot/trunk/gif_drv/ /Peter Torbjorn Tornkvist skrev: > Roberto Saccon wrote: > >> Does there exist any pixel-based image manipulation library for Erlang >> which allows me to create shapes such as antialiased circles and save >> them in .PNG format ? >> >> Or has anybody created a Port to an existing C imaging library and might >> share experience (or code) ? >> >> -- >> Roberto Saccon >> >> > > An interface to the gd library. > It is extremely old though... > > http://www.erlang.org/user.html#gif-1.0 > > --Tobbe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From thomasl_erlang@REDACTED Thu Mar 8 12:50:06 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 8 Mar 2007 03:50:06 -0800 (PST) Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: <20070308115006.70316.qmail@web38813.mail.mud.yahoo.com> --- Joe Armstrong wrote: > all we need to do is add an invisible > "-module(shell)" to > the session, remember all the stuff that's typed in > and > as new functions come either compile the complete > module (so far) > or interpret the code. I think Prolog can show the way in that case. In Prolog, you can "consult" files to read in predicate definitions, but also consult from a special name, 'user', where you type in definitions directly. Here is an example: I consult from user, type in f/1, exit the consult, then run f(X) (search for solutions binding X). For those not familiar with Prolog, note the uncanny similarity in syntax :-) =========================================== localhost % gprolog GNU Prolog 1.3.0 By Daniel Diaz Copyright (C) 1999-2007 Daniel Diaz | ?- [user]. compiling user for byte code... f(a). f(b). user compiled, 3 lines read - 262 bytes written, 6665 ms yes | ?- f(X). X = a ? ; X = b yes | ?- ============================ (Reading from 'user' was terminated by EOF, control-D, which doesn't show in the above.) Happily, Richard O'Keefe probably knows all there is to know about this topic already. I would suggest a shell command for doing the above, but rather than having an implicit module 'shell', I would generalize it a bit. The command might be named e.g., "def(my_module)" and could work like this: - read forms until EOF - stick "-module(my_module). -compile(export_all)." in front of the forms - compile and load them as my_module It might be nice to be able to extend or revise an existing module too, at least one created with def/1, particularly if there is a compilation error ... Anyway, such a capability would subsume your proposal. Best, Thomas ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news From mats.cronqvist@REDACTED Thu Mar 8 14:55:33 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 08 Mar 2007 14:55:33 +0100 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: <45F015D5.1020008@ericsson.com> Bjorn Gustavsson wrote: > Unfortunately, -record(a, {b,v,d}) is a function call in the shell > > 1> -record(a, {b,v,d}). > -42 > 2> MY shell can do this: 28> {hacker,bjorn,1}. {hacker,bjorn,1} 29> -record(hacker,{name,rank}). 0 30> {hacker,bjorn,1}. #hacker{name = bjorn,rank = 1} mats p.s. had to add some pure evil to user_default.erl -export([record/2]). record(R,Fs) -> [ets:insert(T,{R,rec(R,Fs)})||T<-ets:all(),ets:info(T,name)==shell_records],0. rec(R,Fs)-> {attribute,1,record,{R,[{record_field,1,{atom,1,F}}||F<-tuple_to_list(Fs)]}}. From matthias@REDACTED Thu Mar 8 18:27:50 2007 From: matthias@REDACTED (Matthias Lang) Date: Thu, 8 Mar 2007 18:27:50 +0100 Subject: [erlang-questions] why does the preprocessor sometimes care about -ifdef'd out code? Message-ID: <17904.18326.687443.226615@antilipe.corelatus.se> Hi, A co-worker asked me: Why does this module not compile? -module(mod1). -ifdef(X). f, -endif. tmp >erlc -Wall mod1.erl ./mod1.erl:5: unterminated '-ifdef' Whereas this module does: -module(mod1). -ifdef(X). f. -endif. even though this module doesn't: -module(mod1). f, and this module doesn't either: -module(mod1). f. (I know the erlang preprocessor behaves differently to, say, C, but I can't explain the above.) Matthias From chris.newcombe@REDACTED Thu Mar 8 18:38:51 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Thu, 8 Mar 2007 09:38:51 -0800 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45EFE8F5.1080104@ericsson.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> Message-ID: <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> On 3/8/07, Mats Cronqvist wrote: > the attached code works without any hacking of OTP. it will compile a string > with macros. be aware that the macro handling is very limited (but hopefully > easy to extend). Excellent -- thankyou very much! This works perfectly. BTW, really want to support -include directives too. Do you know if compile:forms supports -include itself, or do I need to modify your scan_and_parse function to handle them? The documentation says that compile:forms takes the same options as compile:file, so I am adding the appropriate search-path options [{i, Directory}, ...], but compile:forms seems to ignore them and I just get unrecognized-record errors. Actually, when using your code I get a scan error, so I guess this means that I need to handle it in the scanner...? 1> <0.151.0>: {1173,374854,738939}: compile_and_execute_code: error:function_clause [{lists, last, [[]]}, {erl_scan, done, 5}, {compile_module_from_string, scanner, 3}, {compile_module_from_string, scan_and_parse, 4}, Many thanks again, Chris From ulf@REDACTED Thu Mar 8 18:42:55 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 08 Mar 2007 18:42:55 +0100 Subject: [erlang-questions] why does the preprocessor sometimes care about -ifdef'd out code? In-Reply-To: <17904.18326.687443.226615@antilipe.corelatus.se> References: <17904.18326.687443.226615@antilipe.corelatus.se> Message-ID: Den 2007-03-08 18:27:50 skrev Matthias Lang : > and this module doesn't either: > -module(mod1). > f. ... but if the macro X had not been defined, then the resulting expanded code would be -module(mod1). BR, Ulf W -- Ulf Wiger From richardc@REDACTED Thu Mar 8 20:02:07 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 08 Mar 2007 20:02:07 +0100 Subject: [erlang-questions] why does the preprocessor sometimes care about -ifdef'd out code? In-Reply-To: <17904.18326.687443.226615@antilipe.corelatus.se> References: <17904.18326.687443.226615@antilipe.corelatus.se> Message-ID: <45F05DAF.1070408@it.uu.se> Matthias Lang wrote: > Hi, > > A co-worker asked me: Why does this module not compile? > > -module(mod1). > -ifdef(X). > f, > -endif. > > tmp >erlc -Wall mod1.erl > ./mod1.erl:5: unterminated '-ifdef' > > Whereas this module does: > > -module(mod1). > -ifdef(X). > f. > -endif. The main difference from the C preprocessor is that the Erlang preprocessor only reads entire "forms" at a time (that is, it uses the normal tokenizer function for reading a form). A "form" is (for scanning purposes) a token sequence ending with a "full stop" token, i.e., a period followed by whitespace (or comment, or end-of-file). Hence, the preprocessor only recognizes "-ifdef(X)." etc. if they occur at the beginning of a form. In the first example above, the third form begins "f, -endif.", so the endif is hidden. In the second example, the "f." is a form in itself, and the "-endif." is detected (and the "f." is then discarded, so the program will compile successfully). This is also why you can't put ifdef/endif sections within a function or any other declaration. They can only occur around complete "forms". This is different from C, where the preprocessor does not care at all about the grammar of the underlying token sequence. If you want to get the same effect, you have to put the ifdef around a macro definition, and then use the macro in the function body. Similarly, the Erlang shell keeps asking for input until you have entered a fullstop token; only then will it attempt to parse the given token sequence. As usual, this is all easy when you know what is happening... /Richard From ok@REDACTED Thu Mar 8 23:05:35 2007 From: ok@REDACTED (ok) Date: Fri, 9 Mar 2007 11:05:35 +1300 Subject: [erlang-questions] Changing the shell and module syntax and semantics In-Reply-To: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> References: <9b08084c0703080030y192f1606k60cef56632da1a@mail.gmail.com> Message-ID: On 8 Mar 2007, at 9:30 pm, Joe Armstrong wrote: > I Talked to Dave Thomas (Prag P) - he said "why can't you type > everything into the shell" > > I said bla bla bla .., any explained how it is > > He said - but it must be easy to implement .... > > Having slept on it I think he's right. > > Why not? Let's see: we have a "module language" which accepts declarations and ONLY declarations, and we have a "shell language" which accepts expressions and ONLY expressions. Sounds right to me. That's exactly the way Haskell interpreters work, and I have to say that in about 6 years of teaching Haskell, this is one "feature" of Haskell that students DON'T have any trouble with. A particular point is that the shell is expected to give a response after EVERY "sentence", but thanks to the preprocessor, there are constructs in the module language that contain many "sentences". > all we need to do is add an invisible "-module(shell)" to > the session, remember all the stuff that's typed in and > as new functions come either compile the complete module (so far) > or interpret the code. It really is not that easy, not at all. The closest analogue would be SML, where the interactive "shell" CAN accept declarations as well as expressions. f% sml Standard ML of New Jersey v110.55 [built: Fri Oct 14 14:48:17 2005] - fun f x = 1 + x; val f = fn : int -> int - f 42; val it = 43 : int - [it,it,it]; val it = [43,43,43] : int list Strictly speaking, in the SML interactive top level, an expression counts as a definition for 'it'. And this brings me to the key point. The SML shell allows you to REdefine identifiers without any fuss. And this is consistent with the rest of the language, which also allows you to redefine identifiers without any fuss, because SML has strict lexical scoping combined with strict declaration-before-use (except as modified by letrec). If in an SML module you write fun f x = x + 1; ... code using f ... fun f x = x - 1; ... more code using f ... what you have done is not to CHANGE the old f, but to HIDE it; the scope of the second definition is nested inside the scope of the first. And the code using f uses the definition it could see, not the new definition. fun f x = x + 1; fun g x = f (x * 2); fun f x = x - 1; fun h x = f (x * 2); g 27 => 55 h 27 => 53 Now the scope of Erlang functions just plain does not work like that. > > In fact these is no good reason not to allow this in modules as > well ... > > -module(mmm). > > X = 12 + lists:sqrt(23). > > foo(A) -> > A + X. > > .... etc.... I like the notation, but I wonder what the semantics is. Erlang *function* declarations do not have to be in any particular order, but Erlang *variable* bindings do. What happens if I have X = foo(12). foo(Y) -> X + Y. in a module? Module *parameters* avoid this problem. These changes would be a nice idea if/when the semantic problems were solved. From vances@REDACTED Thu Mar 8 23:08:59 2007 From: vances@REDACTED (Vance Shipley) Date: Thu, 8 Mar 2007 17:08:59 -0500 Subject: [erlang-questions] erlang in Air Traffic Management ? In-Reply-To: <32550.217.128.75.198.1173336843.squirrel@www.geekisp.com> References: <45EC9A0E.10207@ghostgun.com> <32550.217.128.75.198.1173336843.squirrel@www.geekisp.com> Message-ID: <20070308220859.GA9891@frogman.motivity.ca> On Thu, Mar 08, 2007 at 07:54:03AM +0100, Dominic Williams wrote: } } The real problem is that the industry is very conservative, } and there is great informal pressure not to do things any } differently from how they've been done in the past. There is } even a holy principle, whose name I forget, which is in the } standards, and basically means: we guarantee this is as } safe as (i.e. not worse than) previously designed systems. The Federal Aviation Authority in the US apparently follows no such tenant. I was apalled at what I uncovered when looking into the 2004 air traffic control outage(*). Apparently the "Voice Switching and Control System" linking pilots to controllers on the ground was "upgraded"(+) from a control subsystem using Tandem Himalaya Non-Stop computers to Microsoft Windows 2000. -Vance (*) http://www.cnn.com/2004/TRAVEL/09/14/lax.stoppage/ (+) http://nas-architecture.faa.gov/nas/mechanism/mech_data.cfm?mid=2460 From jeffm@REDACTED Thu Mar 8 23:31:02 2007 From: jeffm@REDACTED (jm) Date: Fri, 09 Mar 2007 09:31:02 +1100 Subject: [erlang-questions] erlang in Air Traffic Management ? In-Reply-To: <20070308220859.GA9891@frogman.motivity.ca> References: <45EC9A0E.10207@ghostgun.com> <32550.217.128.75.198.1173336843.squirrel@www.geekisp.com> <20070308220859.GA9891@frogman.motivity.ca> Message-ID: <45F08EA6.9020201@ghostgun.com> Vance Shipley wrote: > On Thu, Mar 08, 2007 at 07:54:03AM +0100, Dominic Williams wrote: > } > } The real problem is that the industry is very conservative, > } and there is great informal pressure not to do things any > } differently from how they've been done in the past. There is > } even a holy principle, whose name I forget, which is in the > } standards, and basically means: we guarantee this is as > } safe as (i.e. not worse than) previously designed systems. > This is more or less what I expected. I'll have to dig up a copy of EN 50128 sometime and take a quick flip through it. > The Federal Aviation Authority in the US apparently follows no > such tenant. I was apalled at what I uncovered when looking > into the 2004 air traffic control outage(*). Apparently the > "Voice Switching and Control System" linking pilots to controllers > on the ground was "upgraded"(+) from a control subsystem using > Tandem Himalaya Non-Stop computers to Microsoft Windows 2000. > > -Vance > > (*) http://www.cnn.com/2004/TRAVEL/09/14/lax.stoppage/ > (+) http://nas-architecture.faa.gov/nas/mechanism/mech_data.cfm?mid=2460 Words fail me. I just hope CASA ( http://www.casa.gov.au/ ) aren't doing anything this stupid. Jeff. From matthew@REDACTED Thu Mar 8 23:50:53 2007 From: matthew@REDACTED (Matthew Sackman) Date: Thu, 8 Mar 2007 22:50:53 +0000 Subject: [erlang-questions] file:sync In-Reply-To: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> Message-ID: <20070308225053.GK6836@wellquite.org> Hi, Err, I'm slightly surprised there's been no response to this. Surely this has massive implications for the reliability of dets and mnesia, amongst other things like disk_log and general file operations on win32. Or is win32 a second-class citizen for Erlang? On Wed, Mar 07, 2007 at 12:20:08PM +0000, Matthew Sackman wrote: > So, for ./erts/emulator/drivers/unix/unix_efile.c > > int > efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ > int fd) /* File descriptor for file to sync. */ > { > #ifdef NO_FSYNC > #ifdef VXWORKS > return check_error(ioctl(fd, FIOSYNC, 0), errInfo); > #else > undefined fsync > #endif /* VXWORKS */ > #else > return check_error(fsync(fd), errInfo); > #endif /* NO_FSYNC */ > } > > ok - the important line being the last where fsync is actually called > which is in glibc unistd.h which is imported. Fine. > > Then we have for ./erts/emulator/drivers/win32/win_efile.c > > int > efile_fsync(errInfo, fd) > Efile_error* errInfo; /* Where to return error codes. */ > int fd; /* File descriptor for file to sync. */ > { > return 1; > } Matthew -- Matthew Sackman http://www.wellquite.org/ From chris.newcombe@REDACTED Fri Mar 9 00:04:55 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Thu, 8 Mar 2007 15:04:55 -0800 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> Message-ID: <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> The scanner error I reported was only due to a dumb screw-up on my part (passing a binary to scan_and_parse instead of a string, in that particular circumstance). Fixing that gives me the original undefined_record error I mentioned -- even though the same code (as a file) compiles just fine. Does anybody know how to get compile:forms to process -include directives, or if I need to do it myself as a pre-pass? thanks, Chris 1> <0.391.0>: {1173,394833,395445}: compile_and_execute_code: failed throw:{compile_module_from_string, compile_forms, {error, [{".", [{27, erl_lint, {undefined_record, berkeley_db_replication_group_caller_state}}, {29, erl_lint, {unbound_var, 'MLH'}}, {30, erl_lint, {unbound_var, 'Pid'}}]}], []}} From sean.hinde@REDACTED Fri Mar 9 00:07:30 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 8 Mar 2007 23:07:30 +0000 Subject: [erlang-questions] file:sync In-Reply-To: <20070308225053.GK6836@wellquite.org> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> <20070308225053.GK6836@wellquite.org> Message-ID: <08EF2EF1-A0F9-450E-8BFC-299E68CD7911@gmail.com> On 8 Mar 2007, at 22:50, Matthew Sackman wrote: > Hi, > > Err, I'm slightly surprised there's been no response to this. Surely > this has massive implications for the reliability of dets and mnesia, > amongst other things like disk_log and general file operations on > win32. > Or is win32 a second-class citizen for Erlang? I think you have answered your own question. If anyone at all used Erlang on windows in any sort of production environment then this would have been discovered and fixed long ago. As far as I am aware *no-one* is running anything meaningful in erlang under windows. Sean > > On Wed, Mar 07, 2007 at 12:20:08PM +0000, Matthew Sackman wrote: >> So, for ./erts/emulator/drivers/unix/unix_efile.c >> >> int >> efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ >> int fd) /* File descriptor for file to sync. */ >> { >> #ifdef NO_FSYNC >> #ifdef VXWORKS >> return check_error(ioctl(fd, FIOSYNC, 0), errInfo); >> #else >> undefined fsync >> #endif /* VXWORKS */ >> #else >> return check_error(fsync(fd), errInfo); >> #endif /* NO_FSYNC */ >> } >> >> ok - the important line being the last where fsync is actually called >> which is in glibc unistd.h which is imported. Fine. >> >> Then we have for ./erts/emulator/drivers/win32/win_efile.c >> >> int >> efile_fsync(errInfo, fd) >> Efile_error* errInfo; /* Where to return error codes. */ >> int fd; /* File descriptor for file to sync. */ >> { >> return 1; >> } > > Matthew > -- > Matthew Sackman > http://www.wellquite.org/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From chris.newcombe@REDACTED Fri Mar 9 01:11:13 2007 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Thu, 8 Mar 2007 16:11:13 -0800 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> Message-ID: <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> > Does anybody know how to get compile:forms to process -include > directives, or if I need to do it myself as a pre-pass? To answer my own question, a glance at epp.erl shows that include files are handled there. So I guess I'll have to duplicate the support. It's a shame that the preprocessor & compiler are almost-but-not-quite packaged in a way that makes them usable from within applications. In my case, I'm building a web-service, and as an administration/support tool I'm providint a REST API to accept some POSTed code, compile it, load it on all nodes (incase it calls funs on remote nodes), and execute it. Basically I want a scriptable version of a remote-shell. It's clearly a tremendously powerful way to get visibility into, and control over, a live system (with appropriate care over security). Remote-shells are a wonderful tool, but too painful if there are lots of nodes. I'm suprised that this doesn't seem to be a common pattern. Chris From sean.hinde@REDACTED Fri Mar 9 01:33:58 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 9 Mar 2007 00:33:58 +0000 Subject: [erlang-questions] file:sync In-Reply-To: <17904.39997.707391.255540@antilipe.corelatus.se> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> <20070308225053.GK6836@wellquite.org> <08EF2EF1-A0F9-450E-8BFC-299E68CD7911@gmail.com> <17904.39997.707391.255540@antilipe.corelatus.se> Message-ID: > > On 8 Mar 2007, at 22:50, Matthew Sackman wrote: > >> Hi, >> >> Err, I'm slightly surprised there's been no response to this. Surely >> this has massive implications for the reliability of dets and mnesia, >> amongst other things like disk_log and general file operations on >> win32. >> Or is win32 a second-class citizen for Erlang? > > I think you have answered your own question. If anyone at all used > Erlang on windows in any sort of production environment then this > would have been discovered and fixed long ago. > > As far as I am aware *no-one* is running anything meaningful in > erlang under windows. Apart from Wings3d of course. Apologies to the 3d/animation modellers out there - no suggestion of meaningless intended towards you guys ;-) Sean From robert.virding@REDACTED Fri Mar 9 02:17:50 2007 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 09 Mar 2007 02:17:50 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> Message-ID: <45F0B5BE.9040708@telia.com> Chris Newcombe wrote: >> Does anybody know how to get compile:forms to process -include >> directives, or if I need to do it myself as a pre-pass? > > To answer my own question, a glance at epp.erl shows that include > files are handled there. So I guess I'll have to duplicate the > support. > > It's a shame that the preprocessor & compiler are almost-but-not-quite > packaged in a way that makes them usable from within applications. Of course the easiest solution to all this is to modify epp, the preprocessor, to read from a file. I haven't really considered the problem before now as the only times I have looked at generating code on the fly as strings it has been "preprocessed". I suppose it wouldn't be too difficult to do. Robert From ulf@REDACTED Fri Mar 9 08:22:16 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 09 Mar 2007 08:22:16 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45F0B5BE.9040708@telia.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> Message-ID: Den 2007-03-09 02:17:50 skrev Robert Virding : > Of course the easiest solution to all this is to modify epp, the > preprocessor, to read from a file. I haven't really considered the > problem before now as the only times I have looked at generating > code on the fly as strings it has been "preprocessed". My suggestion was to improve the ram_file_server, so that you could take a string representation of code, open it as a ram file, and then use any tool that can operate on a file descriptor (which epp_dodger can, but epp can't). In both cases, the changes would be minor. BR, Ulf W -- Ulf Wiger From mats.cronqvist@REDACTED Fri Mar 9 08:43:38 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 09 Mar 2007 08:43:38 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> Message-ID: <45F1102A.1080909@ericsson.com> Ulf Wiger wrote: > Den 2007-03-09 02:17:50 skrev Robert Virding : > >> Of course the easiest solution to all this is to modify epp, the >> preprocessor, to read from a file. I haven't really considered the >> problem before now as the only times I have looked at generating >> code on the fly as strings it has been "preprocessed". > > My suggestion was to improve the ram_file_server, so that you > could take a string representation of code, open it as a ram > file, and then use any tool that can operate on a file > descriptor (which epp_dodger can, but epp can't). improving the ram_file_server might well be useful, but surely the preprocessor should accept a string as input? actually, i think it should accept a token list too. mats From bengt.kleberg@REDACTED Fri Mar 9 08:47:48 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 09 Mar 2007 08:47:48 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> Message-ID: <45F11124.6090305@ericsson.com> On 2007-03-09 08:22, Ulf Wiger wrote: > My suggestion was to improve the ram_file_server, so that you > could take a string representation of code, open it as a ram > file, and then use any tool that can operate on a file > descriptor (which epp_dodger can, but epp can't). inspired by string ports i have written a string_io module that allows you to {ok, IO} = string_io:open( "a number: 10", [read, write]), "a" = io:get_chars( IO, '', 1), io:fwrite(IO, "-" ), 10 = io:fread( IO, '', "number: ~d" ), string_io:close( IO ). etc. works with epp_dodger. presumably an improved ram_file_server would be better, but i like the concept of string ports. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From mats.cronqvist@REDACTED Fri Mar 9 08:53:05 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 09 Mar 2007 08:53:05 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> Message-ID: <45F11261.60003@ericsson.com> Chris Newcombe wrote: >> Does anybody know how to get compile:forms to process -include >> directives, or if I need to do it myself as a pre-pass? > > To answer my own question, a glance at epp.erl shows that include > files are handled there. So I guess I'll have to duplicate the > support. 'fraid so. btw, i would appreciate if you feed back your improvements. > It's a shame that the preprocessor & compiler are almost-but-not-quite > packaged in a way that makes them usable from within applications. yes, it's a bit sad. the compile:forms/1 function is great, but to get from text to the forms is a pain. > In my case, I'm building a web-service, and as an > administration/support tool I'm providint a REST API to accept some > POSTed code, compile it, load it on all nodes (incase it calls funs on > remote nodes), and execute it. > > Basically I want a scriptable version of a remote-shell. It's > clearly a tremendously powerful way to get visibility into, and > control over, a live system (with appropriate care over security). > Remote-shells are a wonderful tool, but too painful if there are lots > of nodes. > > I'm suprised that this doesn't seem to be a common pattern. perhaps it's because kids these days are too damn lazy to roll their own preprocessors :> mats From luke@REDACTED Fri Mar 9 09:11:27 2007 From: luke@REDACTED (LUKE) Date: Fri, 9 Mar 2007 16:11:27 +0800 Subject: [erlang-questions] Why the double quotation marks is disappear? Message-ID: <002401c76222$89f45610$bd01a8c0@lukeserver> 5> [H|T]="CAT". "CAT" 6> H. 67 7> T. "AT" ============================================== This is very strange. The left double quotation marks is disappear. Why? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Mar 9 09:23:08 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 09 Mar 2007 09:23:08 +0100 Subject: [erlang-questions] Why the double quotation marks is disappear? In-Reply-To: <002401c76222$89f45610$bd01a8c0@lukeserver> References: <002401c76222$89f45610$bd01a8c0@lukeserver> Message-ID: <45F1196C.5070407@ericsson.com> On 2007-03-09 09:11, LUKE wrote: > > 5> [H|T]="CAT". > "CAT" > 6> H. > 67 > > 7> T. > "AT" > ============================================== > This is very strange. The left double quotation marks is disappear. > Why? strings are delimeted with ". a string is a list of characters. H is only one character. One character is not a list. ok? bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From fritchie@REDACTED Fri Mar 9 09:41:55 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 09 Mar 2007 02:41:55 -0600 Subject: [erlang-questions] SNMP v3 change made to TrapExit's SNMP tutorial Message-ID: <200703090841.l298ftP6002719@snookles.snookles.com> Mina-san: I wanted to let the rest of the world know that I've made an edit(*) to TrapExit's nifty SNMP tutorial, http://wiki.trapexit.org/index.php/SNMP_Quick_Start It isn't really a big deal, except that I've spent an absurd amount of time bloodying my forehead on a SNMP v3 brick wall. My major discoveries over the last couple of days have been: 1. The snmp:config/0 function is quite helpful, except for one small detail. The default is to put all agent-related *.conf and manager-related *.conf files in the same directory (the cwd). However, the agent and manager have *very* different files with the *same* name, "usm.conf".(**) While trying to figure out why application:start(snmp) was failing, then digging into the OTP source code, I couldn't figure out if the "usm.conf" file should contain a 6,7-tuple or a 13-tuple. The answer, it turns out, is "It depends on which version of the file". Except that snmp:config/0 overwrites one of them to create the other. 2. Vance Shipley's posting back in April 2005 mentioned the snmp:passwd2localized_key/3 function and that it was undocumented. My poor point-and-click browsing skills couldn't find it in the R11-B3 snmp reference manual. It turns out that the TrapExit SNMP tutorial flipped the 2nd & 3rd arguments to that function. My little edit to the tutorial simply points out that error. I guess this is a long way to suggest: * snmp:config/0 is nice but could be slightly nicer * snmp:passwd2localized_key/3 is still not documented (?) but could use a short blurb in the reference manual * this message may be helpful to another lost soul {shrug} I can finally use NET-SNMP's "snmpwalk" to traverse the OID tree using SNMP v1, v2c, and v3(***), hooray! Now to tackle the hard stuff.... -Scott (*) I have to apologize for not making a complete, fix-all-the-errors edit. I don't have enough time & consciousness this late at night to do all of the cut-and-paste stuff that would be required to fix all of the encrypted passphrase examples, sorry! (**) Which probably cannot be changed without breaking some backward compatibility something-or-other? None of the other SNMP app config files have name conflicts, but is renaming the two "usm.conf" files too impractical? Perhaps read "usm_newname.conf" first and, if not there, fall back to old behavior by trying "usm.conf" second? (***) Which gives me a sliver of confidence that my customer's SNMP tools (which I don't have access to) can also do so. From raimo+erlang-questions@REDACTED Fri Mar 9 09:54:19 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 9 Mar 2007 09:54:19 +0100 Subject: [erlang-questions] : file:sync In-Reply-To: <20070308225053.GK6836@wellquite.org> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> <20070308225053.GK6836@wellquite.org> Message-ID: <20070309085419.GA8567@erix.ericsson.se> Sorry about the noresponse. You are most probably right, and I do not know why _commit() is not used. msdn.microsoft.com claims it has existed since Windows95, and that you only have to include . We will simply have to insert a call to _commit(fd) in win_efile.c. The change will come in a future release. Thank you for finding the bug. On Thu, Mar 08, 2007 at 10:50:53PM +0000, Matthew Sackman wrote: > Hi, > > Err, I'm slightly surprised there's been no response to this. Surely > this has massive implications for the reliability of dets and mnesia, > amongst other things like disk_log and general file operations on win32. > Or is win32 a second-class citizen for Erlang? > > On Wed, Mar 07, 2007 at 12:20:08PM +0000, Matthew Sackman wrote: > > So, for ./erts/emulator/drivers/unix/unix_efile.c > > > > int > > efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ > > int fd) /* File descriptor for file to sync. */ > > { > > #ifdef NO_FSYNC > > #ifdef VXWORKS > > return check_error(ioctl(fd, FIOSYNC, 0), errInfo); > > #else > > undefined fsync > > #endif /* VXWORKS */ > > #else > > return check_error(fsync(fd), errInfo); > > #endif /* NO_FSYNC */ > > } > > > > ok - the important line being the last where fsync is actually called > > which is in glibc unistd.h which is imported. Fine. > > > > Then we have for ./erts/emulator/drivers/win32/win_efile.c > > > > int > > efile_fsync(errInfo, fd) > > Efile_error* errInfo; /* Where to return error codes. */ > > int fd; /* File descriptor for file to sync. */ > > { > > return 1; > > } > > Matthew > -- > Matthew Sackman > http://www.wellquite.org/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From jaiswal.vikash@REDACTED Fri Mar 9 10:42:32 2007 From: jaiswal.vikash@REDACTED (jaiswal.vikash@REDACTED) Date: Fri, 9 Mar 2007 15:12:32 +0530 Subject: [erlang-questions] spawn/4 problem Message-ID: Hi , I've developed an application which uses spawn/4 .But at some instances the pid returned by it is a dummy one i.e. that pid does not exist in reality.(i checked it using pman:start(). ). Due to this , my application is going into a hanged state i.e it is sending some message o the spawned process but not getting any response from it .It is simply waiting for the response . Could anyone please tell me how I can check whether the pid is real one or just a dummy ? Also how can I trap the exit signal sent by spawn/4 ? Also , when I execute this line in the erl prompt it is working fine but when I include it in a file I 'm getting the error . Pid = spawn('abc@REDACTED', my_file, start, []), erlang:is_process_alive(Pid), The above works well in erl prompt but gives the following error when included in the file =ERROR REPORT==== 9-Mar-2007::14:05:19 === Error in process <0.30.0> on node 'abc@REDACTED' with exit value: {badarg,[{erlang,is_process_alive,[<5064.11526.6>]},{erl_eval,do_apply,5 },{shell,eval_loop,2}]} ** exited: {badarg,[{erlang,is_process_alive,[<5064.11526.6>]}, {erl_eval,do_apply,5}, {shell,eval_loop,2}]} ** Thanks in advance . Regards , Vikash The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Fri Mar 9 13:23:34 2007 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 09 Mar 2007 07:23:34 -0500 Subject: [erlang-questions] spawn/4 problem In-Reply-To: References: Message-ID: <45F151C6.6080701@hq.idt.net> You can only use erlang:is_process_alive/1 for Pids on a local node. In your case the Pid is on a different node. If you really need to call that function use rpc: rpc:call(Node, erlang, is_process_alive, [Pid]). Serge jaiswal.vikash@REDACTED wrote: > > Hi , > > I've developed an application which uses spawn/4 .But at some instances > the pid returned by it is a dummy one i.e. that pid does not exist in > reality.(i checked it using pman:start(). ). Due to this , my > application is going into a hanged state i.e it is sending some message > o the spawned process but not getting any response from it .It is simply > waiting for the response . > > Could anyone please tell me how I can check whether the pid is real one > or just a dummy ? > Also how can I trap the exit signal sent by spawn/4 ? > > Also , when I execute this line in the erl prompt it is working fine but > when I include it in a file I 'm getting the error . > Pid = spawn('abc@REDACTED', my_file, start, []), > erlang:is_process_alive(Pid), > The above works well in erl prompt but gives the following error when > included in the file > =ERROR REPORT==== 9-Mar-2007::14:05:19 === > Error in process <0.30.0> on node 'abc@REDACTED' with exit value: > {badarg,[{erlang,is_process_alive,[<5064.11526.6>]},{erl_eval,do_apply,5 > },{shell,eval_loop,2}]} > > ** exited: {badarg,[{erlang,is_process_alive,[<5064.11526.6>]}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > > > Thanks in advance . > > Regards , > Vikash > > > > The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. > > www.wipro.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From tobbe@REDACTED Fri Mar 9 13:54:12 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 09 Mar 2007 13:54:12 +0100 Subject: [erlang-questions] regexp sux! Message-ID: As usual, the regexp module drive me nutts. I simply want to do the equivalent to: # from a bash shell xx="". echo $xx | sed 's/\(.*xml\ version=.*encoding="\)\([a-zA-Z0-9_-]*\).*/\2/' ISO-8859-1 So how do I do this with the regexp module ? Cheers, Tobbe From raimo+erlang-questions@REDACTED Fri Mar 9 15:18:03 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 9 Mar 2007 15:18:03 +0100 Subject: [erlang-questions] : : file:sync In-Reply-To: <20070309091415.GN6836@wellquite.org> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> <20070308225053.GK6836@wellquite.org> <20070309085419.GA8567@erix.ericsson.se> <20070309091415.GN6836@wellquite.org> Message-ID: <20070309141803.GA21403@erix.ericsson.se> After some more digging... We can not use the _commit() function since it operates on the posix compatibility filedescriptors that was not reliable enough. But reading Microsoft's source code for _commit() gives us that it uses FlushFileBuffers() that would work, and exist for valid platforms. The original implementor seem to have failed to find the FlushFileBuffers() function, that is why it is unimplemented. We will try (no promise; busy period) to squeeze it into R11B-4. I have looked through win_efile.c and can only find the functions operating on links that immediately return error, but no more dummy implemented functions. On Fri, Mar 09, 2007 at 09:14:15AM +0000, Matthew Sackman wrote: > Hi, > > On Fri, Mar 09, 2007 at 09:54:19AM +0100, Raimo Niskanen wrote: > > You are most probably right, and I do not know why _commit() is not used. > > msdn.microsoft.com claims it has existed since Windows95, and that > > you only have to include . > > > > We will simply have to insert a call to _commit(fd) in win_efile.c. > > The change will come in a future release. > > Is this likely to be R11B-4 or some later release? The only reason I ask > is that one of our products is being damaged by the fact that it does > not behave properly under win32 in comparison to a competitor's product. > The sooner this can be fixed for us, the better, as I'm sure you can > see. > > I'll have a look myself, but are you aware of other native calls for > win32 that are similarly lacking? The problem with finding an issue like > this is it's now making me wonder what else is missing from the win32 > version. Is there a list or any documentation of these "TODO"-style > platform-native calls? > > > Thank you for finding the bug. > > You're welcome, and thank you very much for looking into this. > > Matthew > -- > Matthew Sackman > http://www.wellquite.org/ -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthew@REDACTED Fri Mar 9 15:27:05 2007 From: matthew@REDACTED (Matthew Sackman) Date: Fri, 9 Mar 2007 14:27:05 +0000 Subject: [erlang-questions] file:sync In-Reply-To: <20070309141803.GA21403@erix.ericsson.se> References: <20070307122008.GA21081@stupid.misconfigured.smtp.servers.think.that.a.fqdn.is.required.wellquite.org> <20070308225053.GK6836@wellquite.org> <20070309085419.GA8567@erix.ericsson.se> <20070309091415.GN6836@wellquite.org> <20070309141803.GA21403@erix.ericsson.se> Message-ID: <20070309142705.GF4915@doc.ic.ac.uk> Hi, On Fri, Mar 09, 2007 at 03:18:03PM +0100, Raimo Niskanen wrote: > We can not use the _commit() function since it operates on the > posix compatibility filedescriptors that was not reliable enough. > > But reading Microsoft's source code for _commit() gives us that it > uses FlushFileBuffers() that would work, and exist for valid platforms. > > The original implementor seem to have failed to find the > FlushFileBuffers() function, that is why it is unimplemented. > > We will try (no promise; busy period) to squeeze it into R11B-4. > > I have looked through win_efile.c and can only find the functions > operating on links that immediately return error, but no more > dummy implemented functions. Many thanks for all your efforts on this. I look forward to seeing the fix. Thanks once again, Matthew From fred@REDACTED Fri Mar 9 15:37:43 2007 From: fred@REDACTED (=?ISO-8859-1?Q?Lars-=C5ke_Fredlund?=) Date: Fri, 09 Mar 2007 15:37:43 +0100 Subject: [erlang-questions] Fun with the distribution mechanism in Erlang Message-ID: <45F17137.7000806@babel.ls.fi.upm.es> Hans Svensson and I were investigating the restarting behaviour of nodes in Erlang; wanting to know for instance whether "are pids created on a node with name "n" comparable to a pid created on a node with the same name after a restart"? (all, of course, for the noble purpose of eventually really understanding the detailed semantics of distributed Erlang :-) Anyway, after experimenting Hans came up with the following program that works a bit unexpectedly (attached as "strangeCommunication.erl"). Three nodes are used (n1,n2,n3); n2 is restarted automatically whenever it halts (by the shell file "restartingErlangshell.sh"). When strangeCommunication:run() is started it performs three times on node n1: - starts a process on n2 - halts node n2 The result is a list of three (dead) process identifiers. We are sure they are dead since we have received exit messages regarding them. We then spawn a new process on n2 which just echo received messages to the sender. The three pids (of dead processes) are communicated to a newly spawned process on node n3, which tries to communicate with any of the dead processes. And rather surprisingly one of the communications succeeds! (test@REDACTED)1> strangeCommunication:start(). Killing and restarting node n2@REDACTED Killing and restarting node n2@REDACTED Killing and restarting node n2@REDACTED Got: {'EXIT',<4981.41.0>,normal} Got: {'EXIT',<4981.41.0>,normal} Got: {'EXIT',<4981.41.0>,normal} Trying to communicate with: <4981.41.0> (<<131,103,100,0,10,110,50,64,106,101,122,97,98,101,108,0,0,0,41,0,0,0,0,3>>) Recieved 6 from <4981.41.0> (!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!) (<<131,103,100,0,10,110,50,64,106,101,122,97,98,101,108,0,0,0,41,0,0,0,0,3>>) Trying to communicate with: <4981.41.0> (<<131,103,100,0,10,110,50,64,106,101,122,97,98,101,108,0,0,0,41,0,0,0,0,1>>) No reply! Trying to communicate with: <4981.41.0> (<<131,103,100,0,10,110,50,64,106,101,122,97,98,101,108,0,0,0,41,0,0,0,0,2>>) No reply! We all know that pids eventually wrap around, but it seems that when nodes are restarted, pids are going be reused much earlier than one would think. Maybe it would be a good idea to permit more restarts than three before reuse? (it seems like three is the magic number being used in the runtime system) Lars-?ke and Hans -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: strangeCommunication.erl URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: restartingErlangshell.sh Type: application/x-shellscript Size: 132 bytes Desc: not available URL: From erlangx@REDACTED Fri Mar 9 16:54:44 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 9 Mar 2007 07:54:44 -0800 Subject: [erlang-questions] regexp sux! In-Reply-To: References: Message-ID: <20070309155444.GZ21303@delora.autosys.us> On Fri, Mar 09, 2007 at 01:54:12PM +0100, Torbjorn Tornkvist wrote: > > As usual, the regexp module drive me nutts. > I simply want to do the equivalent to: > > # from a bash shell > > xx="". > echo $xx | sed 's/\(.*xml\ > version=.*encoding="\)\([a-zA-Z0-9_-]*\).*/\2/' > ISO-8859-1 > > So how do I do this with the regexp module ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ though the above did not work in my bash shell , $ bash --version GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. here is one way to get encoding ver w/regexp, though not fully reliable due to depending on fixed version length and depending on no whitespace between endcoding= and the version. 1> X="". "" 2> {match, Start, Length} = regexp:match(X, "encoding="). {match,21,9} 3> lists:sublist(X, Start+Length, 12). % get past tag "\"ISO-8859-1\"" I'm using R11B-3, Eshell V5.5.3 ~Michael > > Cheers, Tobbe > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,45f1597418341684014417! > > From bengt.kleberg@REDACTED Fri Mar 9 17:10:09 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 09 Mar 2007 17:10:09 +0100 Subject: [erlang-questions] regexp sux! In-Reply-To: <20070309155444.GZ21303@delora.autosys.us> References: <20070309155444.GZ21303@delora.autosys.us> Message-ID: <45F186E1.4080403@ericsson.com> On 2007-03-09 16:54, Michael McDaniel wrote: > here is one way to get encoding ver w/regexp, though not > fully reliable due to depending on fixed version length > and depending on no whitespace between endcoding= and the > version. > > > 1> X="". > "" > > 2> {match, Start, Length} = regexp:match(X, "encoding="). > {match,21,9} perhas you could use Start = string:str(X, "encoding=") instead? that would make no use of regexp at all. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From hans.bolinder@REDACTED Fri Mar 9 17:14:06 2007 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 9 Mar 2007 17:14:06 +0100 Subject: [erlang-questions] fun in shell In-Reply-To: <45EED46F.5020209@ericsson.com> References: <45EED46F.5020209@ericsson.com> Message-ID: <17905.34766.395249.671047@gargle.gargle.HOWL> [Mats Cronqvist :] > running this; > > F=fun(A,B) -> try A+B catch _:_->dontthinkso end end, > lists:zipwith(F,[1,2],[2,3]). > > in the shell crashes, but works fine in compiled code. The implementation of try/catch seems to be buggy. All modules evaluating expressions by means of erl_eval are affected. Examples of such modules are file (eval, script) and qlc (string_to_handle). Thanks for pointing this out. Best regards, Hans Bolinder, Erlang/OTP team From erlangx@REDACTED Fri Mar 9 19:10:31 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 9 Mar 2007 10:10:31 -0800 Subject: [erlang-questions] regexp sux! In-Reply-To: <45F186E1.4080403@ericsson.com> References: <20070309155444.GZ21303@delora.autosys.us> <45F186E1.4080403@ericsson.com> Message-ID: <20070309181031.GA21303@delora.autosys.us> On Fri, Mar 09, 2007 at 05:10:09PM +0100, Bengt Kleberg wrote: > On 2007-03-09 16:54, Michael McDaniel wrote: > > > here is one way to get encoding ver w/regexp, though not > > fully reliable due to depending on fixed version length > > and depending on no whitespace between endcoding= and the > > version. > > > > > > 1> X="". > > "" > > > > 2> {match, Start, Length} = regexp:match(X, "encoding="). > > {match,21,9} > > perhas you could use > Start = string:str(X, "encoding=") > instead? > that would make no use of regexp at all. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ooohhh, I like that - thanks! may be time to refactor some of my code ... ~M > > > bengt > -- > Those were the days... > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,45f1875118347744713486! > > From mats.cronqvist@REDACTED Sat Mar 10 10:44:50 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Sat, 10 Mar 2007 10:44:50 +0100 Subject: [erlang-questions] regexp sux! In-Reply-To: References: Message-ID: <45F27E12.2000102@ericsson.com> Torbjorn Tornkvist wrote: > As usual, the regexp module drive me nutts. > I simply want to do the equivalent to: > > # from a bash shell > > xx="". > echo $xx | sed 's/\(.*xml\ > version=.*encoding="\)\([a-zA-Z0-9_-]*\).*/\2/' > ISO-8859-1 > > So how do I do this with the regexp module ? this will pull out the encoding string; XX="". >{match,B,L}=regexp:match(XX,"encoding=[\"[A-Z0-9-]+"),string:sub_string(XX,B+10,L+B-2). but i guess the question was really about how to get regexp groups/submatches to work. AFAIK, in that respect regexp is completely brain dead. i use the gregexp code by pascal brisset. > gregexp:groups(XX,".*encoding=\"\\([A-Z0-9-]+\\)\".*"). {match,["ISO-8859-1"]} mats From nm@REDACTED Sat Mar 10 10:52:13 2007 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 10 Mar 2007 13:52:13 +0400 Subject: [erlang-questions] regexp sux! In-Reply-To: References: Message-ID: <45F27FCD.10902@web.am> Hi! You could use my regexp module http://zanazan.am/erlang/re.html to match encoding :) /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From tobbe@REDACTED Sat Mar 10 14:00:33 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sat, 10 Mar 2007 14:00:33 +0100 Subject: [erlang-questions] regexp sux! In-Reply-To: <45F27E12.2000102@ericsson.com> References: <45F27E12.2000102@ericsson.com> Message-ID: Mats Cronqvist wrote: > but i guess the question was really about how to get regexp groups/submatches > to work. AFAIK, in that respect regexp is completely brain dead. i use the > gregexp code by pascal brisset. > > > gregexp:groups(XX,".*encoding=\"\\([A-Z0-9-]+\\)\".*"). > {match,["ISO-8859-1"]} > That's more like it ! I haven't tried Gaspar Chilingarov regexp lib but I assume it is very good too. So why do we have this worthless regexp library in OTP? I have never been able to use it in any useful way! I suggest that regexp in OTP is thrown out in favor of one of the other available regexp libraries! (or at least make it depreciated and bring in a useful alternative) Cheers, Tobbe From qrilka@REDACTED Sat Mar 10 14:38:18 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sat, 10 Mar 2007 16:38:18 +0300 Subject: [erlang-questions] CEAN bug Message-ID: <337538cb0703100538r41ecdd17od57e30955361d726@mail.gmail.com> There is still no bug tracking tool for CEAN so I post it here. I've updated to the latest CEAN version but it looks like the problem I had some time ago wasn't solved in CEAN (see http://forum.trapexit.org/viewtopic.php?p=23350&highlight=#23350 ) : installing gs does not install tcl runtime. Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Sat Mar 10 15:47:07 2007 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 10 Mar 2007 09:47:07 -0500 Subject: [erlang-questions] spawn/4 problem In-Reply-To: References: Message-ID: <45F2C4EB.8030400@hq.idt.net> jaiswal.vikash@REDACTED wrote: > Hi Serge, > > Thanks for the suggestion. > Now I'm able to check the return value of "is_process_alive". > It is returning false . > > Now my question is : > Since I'm getting false from is_process_alive , it means that the pid > I'm getting ( due to spawn/4 ) is a dummy pid . No, it means that the pid is not alive (i.e. the function evaluated in the content of the process associated with the Pid exited). > So how can I get the spawn/4 to give me actual pid instead of the dummy > .( If I do init 3 followed by init 4 on my system , the spawn/4 starts > working properly i.e. it does not give dummy but an actual pid ). There's no such a thing as a dummy Pid. Spawn always returns a "real" Pid of a process located on a local/remote node. A Pid either represents a reference to a live process or a reference to a dead process. In the later case you can use the erlang:is_process_alive/1 call to see if it's alive. Serge > Regards , > Vikash > > -----Original Message----- > From: Serge Aleynikov [mailto:serge@REDACTED] > Sent: Friday, March 09, 2007 5:54 PM > To: Vikash Jaiswal (WT01 - IP-Multimedia Carrier & Ent Networks) > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] spawn/4 problem > > You can only use erlang:is_process_alive/1 for Pids on a local node. In > your case the Pid is on a different node. If you really need to call > that function use rpc: > > rpc:call(Node, erlang, is_process_alive, [Pid]). > > Serge > > jaiswal.vikash@REDACTED wrote: >> >> Hi , >> >> I've developed an application which uses spawn/4 .But at some >> instances the pid returned by it is a dummy one i.e. that pid does not > >> exist in reality.(i checked it using pman:start(). ). Due to this , >> my application is going into a hanged state i.e it is sending some >> message o the spawned process but not getting any response from it .It > >> is simply waiting for the response . >> >> Could anyone please tell me how I can check whether the pid is real >> one or just a dummy ? >> Also how can I trap the exit signal sent by spawn/4 ? >> >> Also , when I execute this line in the erl prompt it is working fine >> but when I include it in a file I 'm getting the error . >> Pid = spawn('abc@REDACTED', my_file, start, []), >> erlang:is_process_alive(Pid), The above works well in erl >> prompt but gives the following error when included in the file >> =ERROR REPORT==== 9-Mar-2007::14:05:19 === Error in process >> <0.30.0> on node 'abc@REDACTED' with exit value: >> {badarg,[{erlang,is_process_alive,[<5064.11526.6>]},{erl_eval,do_apply >> ,5 >> },{shell,eval_loop,2}]} >> >> ** exited: {badarg,[{erlang,is_process_alive,[<5064.11526.6>]}, >> {erl_eval,do_apply,5}, >> {shell,eval_loop,2}]} ** >> >> >> Thanks in advance . >> >> Regards , >> Vikash >> >> >> >> The information contained in this electronic message and any > attachments to this message are intended for the exclusive use of the > addressee(s) and may contain proprietary, confidential or privileged > information. If you are not the intended recipient, you should not > disseminate, distribute or copy this e-mail. Please notify the sender > immediately and destroy all copies of this message and any attachments. >> WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. > The company accepts no liability for any damage caused by any virus > transmitted by this email. >> >> www.wipro.com >> >> >> ---------------------------------------------------------------------- >> -- >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > > > > The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. > > www.wipro.com > From ulf@REDACTED Sat Mar 10 16:26:47 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 10 Mar 2007 16:26:47 +0100 (CET) Subject: [erlang-questions] packages woe Message-ID: <44598.81.231.168.176.1173540407.squirrel@webmail.wiger.net> I'm having some trouble with packages (yes, I know, I know...) I had a generated module that looked like this (pretty-printed): -module(m). -import('.lists', [reverse/1]). -export([f/1]). f(L) -> reverse(L). --------------- Compiling it: 28> c(m). ./m.erl:3: bad module name '.lists' ./m.erl:6: function reverse/1 undefined If I remove the single quotes in the import statement, it works, but it works also in this case, which I think is strange: -module(a.b.m). -import(lists,[reverse/1]). -export([f/1]). f(L) -> reverse(L). Looking at erl_lint, it converts the module name in import() to a string, then calls packages:is_valid/1. So... 31> packages:is_valid(".lists"). false 32> packages:is_valid('.lists'). true 33> packages:is_valid('a.b.m'). true 34> packages:is_valid("a.b.m"). true (So '.lists' was ok, according to packages, but since erl_lint converted it to a string first, it suddenly wasn't...) It seems as if module names with a leading "." are handled inconsistently. The functions split/1 and concat/1 add to the confusion: 37> packages:split(.lists). ["lists"] 38> packages:split('.lists'). [[],"lists"] 39> packages:concat(packages:split('.lists')). "lists" Apparently, packages:concat/1 is not a proper inverse to packages:split/1. BR, Ulf W From christophe.romain@REDACTED Sat Mar 10 18:00:29 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Sat, 10 Mar 2007 18:00:29 +0100 Subject: [erlang-questions] CEAN bug In-Reply-To: <337538cb0703100538r41ecdd17od57e30955361d726@mail.gmail.com> References: <337538cb0703100538r41ecdd17od57e30955361d726@mail.gmail.com> Message-ID: <1322B8D7-3040-4DEB-86DC-E6DA366DF7D3@process-one.net> > There is still no bug tracking tool for CEAN so I post it here. such a tool will be required now. i'll do my best to bring it up. > installing gs does not install tcl runtime. yes, this has not been solved yet as it was not the most important thing to fix. it will be corrected for 1.2 coming this month. BR From christophe.romain@REDACTED Sat Mar 10 19:01:40 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Sat, 10 Mar 2007 19:01:40 +0100 Subject: [erlang-questions] CEAN forum (bugs, discussions, ideas...) Message-ID: Hi all erlang-question is not a good place to talk about CEAN specific topic. So here is a forum when you can trace bugs, ask questions, ask for features, and so one. http://www.process-one.net/en/forum/viewforum/7/ From qrilka@REDACTED Sat Mar 10 19:20:15 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Sat, 10 Mar 2007 21:20:15 +0300 Subject: [erlang-questions] CEAN forum (bugs, discussions, ideas...) In-Reply-To: References: Message-ID: <337538cb0703101020h3498191eq1c38afbdff96a811@mail.gmail.com> I think it would quite useful if this link will appear on the CEAN website Best regards, Kirill. On 3/10/07, Christophe Romain wrote: > > Hi all > > erlang-question is not a good place to talk about CEAN specific topic. > So here is a forum when you can trace bugs, ask questions, ask for > features, and so one. > > http://www.process-one.net/en/forum/viewforum/7/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christophe.romain@REDACTED Sun Mar 11 08:36:33 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Sun, 11 Mar 2007 08:36:33 +0100 Subject: [erlang-questions] CEAN forum (bugs, discussions, ideas...) In-Reply-To: <337538cb0703101020h3498191eq1c38afbdff96a811@mail.gmail.com> References: <337538cb0703101020h3498191eq1c38afbdff96a811@mail.gmail.com> Message-ID: <6BAA282E-A4ED-4ED2-8AC6-F73C52287640@process-one.net> the link was added few minutes after my mail, it's the "forum" link in navigation menu. From ulf@REDACTED Sun Mar 11 10:26:17 2007 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 Mar 2007 10:26:17 +0100 Subject: [erlang-questions] packages woe In-Reply-To: <44598.81.231.168.176.1173540407.squirrel@webmail.wiger.net> References: <44598.81.231.168.176.1173540407.squirrel@webmail.wiger.net> Message-ID: Den 2007-03-10 16:26:47 skrev Ulf Wiger : > I'm having some trouble with packages (yes, I know, I know...) > I had a generated module that looked like this (pretty-printed): > -module(m). > -import('.lists', [reverse/1]). > -export([f/1]). Oh, never mind. I'll just have to figure out how to work around this in my code generation. I understand why the functions work like they do. BR, Ulf W -- Ulf Wiger From pacini@REDACTED Sun Mar 11 22:01:27 2007 From: pacini@REDACTED (Filippo Pacini) Date: Sun, 11 Mar 2007 22:01:27 +0100 Subject: [erlang-questions] sgte - erlang template engine Message-ID: <45F46E27.3070106@sgconsulting.it> Hi all, I'm working on an Erlang template language based on String Template www.stringtemplate.org I've created a google project and a google group for discussion. Here are the links: http://code.google.com/p/sgte/ http://groups.google.com/group/sgte-code Any comments and suggestions are welcome. Cheers, filippo From robert.virding@REDACTED Sun Mar 11 23:14:23 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 11 Mar 2007 23:14:23 +0100 Subject: [erlang-questions] regexp sux! In-Reply-To: References: <45F27E12.2000102@ericsson.com> Message-ID: <45F47F3F.20009@telia.com> There is a new version of regexp in the pipe which: - is faster for many operations - supports subexpressions/submatches - has a compiled mode which is always faster, although it does not yet support submatches. I am working on a version which will handle all pathological regexps efficiently (which Perl and many others don't). I have handed it over to the OTP crew but don't know how far they have got with it (it passes all tests so far). Robert Torbjorn Tornkvist wrote: > Mats Cronqvist wrote: > >> but i guess the question was really about how to get regexp groups/submatches >>to work. AFAIK, in that respect regexp is completely brain dead. i use the >>gregexp code by pascal brisset. >> >> > gregexp:groups(XX,".*encoding=\"\\([A-Z0-9-]+\\)\".*"). >>{match,["ISO-8859-1"]} >> > > > That's more like it ! > > I haven't tried Gaspar Chilingarov regexp lib but I assume > it is very good too. So why do we have this worthless > regexp library in OTP? I have never been able to use it > in any useful way! > > I suggest that regexp in OTP is thrown out in favor of > one of the other available regexp libraries! > (or at least make it depreciated and bring in a useful alternative) > > Cheers, Tobbe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bfulg@REDACTED Sun Mar 11 23:38:59 2007 From: bfulg@REDACTED (Brent Fulgham) Date: Sun, 11 Mar 2007 15:38:59 -0700 Subject: [erlang-questions] Support for Maths Message-ID: <67FAEA4E-A490-4C2E-BEA2-82CB81301FB1@pacbell.net> Is anyone aware of ways of using Erlang for: 1. Numerical analysis (e.g., GMP support, bindings to FFTW, etc.) 2. Linear Algebra (things like ATLAS/Veclib support)? Thanks, -Brent From bob@REDACTED Mon Mar 12 00:36:38 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 11 Mar 2007 16:36:38 -0700 Subject: [erlang-questions] OTP Design Principles doc bug (Gen Server Behaviour: 2.5) Message-ID: <6a36e7290703111636s55a59e11i895cb1ddba93d791@mail.gmail.com> I'm pretty sure there is a documentation error in the example code here: http://erlang.org/doc/doc-5.5.3/doc/design_principles/gen_server.html#2.5 When the request is received, the gen_server calls handle_cast(Request, State) which is expected to return a tuple {noreply, State1}. State1 is a new value for the state of the gen_server. handle_call({free, Ch}, Chs) -> Chs2 = free(Ch, Chs), {noreply, Chs2}. I would expect this example to be: handle_cast({free, Ch}, Chs) -> Chs2 = free(Ch, Chs), {noreply, Chs2}. -bob From bob@REDACTED Mon Mar 12 04:06:01 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 11 Mar 2007 20:06:01 -0700 Subject: [erlang-questions] reshd-1.2 compatibility issue with R11B-3 Message-ID: <6a36e7290703112006ub4fb59bma0fb548c08259dd@mail.gmail.com> I've been looking around at examples of doing alternative IO shells with Erlang and I stumbled across reshd, which looked to be an ideal example because it's less complicated than ssh. I haven't been able to find much documentation about group_leader or the group module. reshd-1.2 from http://www.erlang.org/user.html#reshd-1.2 didn't seem to be compatible with R11B-3 though, because something seems to have changed from lists to binaries (probably iolists). I've attached simple patch that appears to work. All it does replace lists:flatten(X) with a function that's equivalent to binary_to_list(iolist_flatten(X)). -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: reshd-1.2-iolist.diff Type: application/octet-stream Size: 1604 bytes Desc: not available URL: From ok@REDACTED Mon Mar 12 06:49:04 2007 From: ok@REDACTED (ok) Date: Mon, 12 Mar 2007 18:49:04 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? Message-ID: I spent last weekend reading the manual for Intel's IXP 1200 series Network processor. A seriously weird but interesting machine. It's said to be "low- cost", but heaven only knows what that means. I have spent the last 45 minutes searching the web for a price, to no avail. These are chips with - an ARM processor (32-bit sort-of-RISC, rather nice, really) - 6 "micro-engines", each of which is a 32-bit RISC-cum- microprogrammable core (as in, memory referencing is straightforward, but the gap between issuing a request and the thing happening is architecturally painfully visible), each having 4 hardware contexts for very fast thread switch, and - oodles of special-purpose stuff to interface to various buses and interfaces. How could you make parallel programming EASY on one of these things? Simple: the same way you would make concurrency easy anywhere, use Erlang. But could you? The microengines have a 2 k-instruction control store each (1 k-instruction in the oldest models; the current IXP2xxx generation have 8 x 8-thread, 4 k- instruction control stores). The current Erlang VM (BEAM) and its emulator are aimed at some mix of portability and speed. Programming something like a network processor in Erlang would require a very compact emulator, which might not be so efficient. Just out of idle curiosity, has anyone looked at the possibility of Erlang on a network processor? If you chucked out bignums and flonums, how small could an Erlang emulator be? From ulf@REDACTED Mon Mar 12 08:30:14 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 12 Mar 2007 08:30:14 +0100 Subject: [erlang-questions] Support for Maths In-Reply-To: <67FAEA4E-A490-4C2E-BEA2-82CB81301FB1@pacbell.net> References: <67FAEA4E-A490-4C2E-BEA2-82CB81301FB1@pacbell.net> Message-ID: Den 2007-03-11 23:38:59 skrev Brent Fulgham : > Is anyone aware of ways of using Erlang for: > > 1. Numerical analysis (e.g., GMP support, bindings to FFTW, etc.) > 2. Linear Algebra (things like ATLAS/Veclib support)? Not me, but I have been following the progress of the Felix programming language (http://felix.sf.net), which is currently undergoing a crisis of sorts, due to lack of programmers working on the core. The line of reasoning leading to felix is something like this: - ocaml seems to be the FPL of choice for this sort of thing - Felix was designed by ocaml fanatics, to be a small, portable, embeddable environment for telecoms. It compiles to C++, and was designed to be linked into existing runtime environments. A serious disadvantage (apart from not having been able to gain momentum) is that it has been forced to lots of compromises in order to be C++ compatible, while the C++ community has shown zero interest. The possibility of having a type-safe, pointer-safe, linked-in driver development environment with all sorts of high-level constructs (in fact, more than Erlang) was intriguing. If you feel that it would be fun to help, now is a good time to jump in. (: BR, Ulf W -- Ulf Wiger From gunilla@REDACTED Mon Mar 12 09:39:06 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Mon, 12 Mar 2007 09:39:06 +0100 Subject: [erlang-questions] OTP Design Principles doc bug (Gen Server Behaviour: 2.5) In-Reply-To: <6a36e7290703111636s55a59e11i895cb1ddba93d791@mail.gmail.com> References: <6a36e7290703111636s55a59e11i895cb1ddba93d791@mail.gmail.com> Message-ID: <45F511AA.1040806@erix.ericsson.se> Yes, it should be handle_cast/2. Thanks for pointing it out, I'll fix it in R11B-4. Thanks, Gunilla, Erlang/OTP team Bob Ippolito wrote: > I'm pretty sure there is a documentation error in the example code here: > http://erlang.org/doc/doc-5.5.3/doc/design_principles/gen_server.html#2.5 > > When the request is received, the gen_server calls > handle_cast(Request, State) which is expected to return a tuple > {noreply, State1}. State1 is a new value for the state of the > gen_server. > > handle_call({free, Ch}, Chs) -> > Chs2 = free(Ch, Chs), > {noreply, Chs2}. > > I would expect this example to be: > > handle_cast({free, Ch}, Chs) -> > Chs2 = free(Ch, Chs), > {noreply, Chs2}. > > -bob From bob@REDACTED Mon Mar 12 10:32:51 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 12 Mar 2007 02:32:51 -0700 Subject: [erlang-questions] [Erlyaws-list] sgte - erlang template engine In-Reply-To: <45F51B78.30407@tail-f.com> References: <45F46E27.3070106@sgconsulting.it> <45F51B78.30407@tail-f.com> Message-ID: <6a36e7290703120232h34e7ae33x980a99f25fe384f0@mail.gmail.com> On 3/12/07, Claes Wikstr?m wrote: > Filippo Pacini wrote: > > Hi all, > > I'm working on an Erlang template language based on String Template > > www.stringtemplate.org > > > > What would be the best way to let yaws handle .eg .st files > Should I allow for external renderers to register their > file suffixes and associate those to a render module. > > Maybe a good idea would be to rip the .yaws support > out from yaws_server.erl, put it in an external module > and then register that external module as the handler for > pages with .yaws suffix ?? and then the same thing for cgi etc ... > > That way it will be easy to plug in any external rendering > engine, for example a string template implementattion It would be great if yaws was split into more components like that. We only use it because it's a working HTTP server protocol implementation. We're serving appmods from it, and nothing else (not even static files). We've also got all of the logging shut off because we have application-specific logs. I would prefer a lighter and easier to understand solution than Yaws, but I couldn't find an alternative HTTP implementation that was half-decent and didn't suffer from the same kind of monolithic bloat that yaws and httpd do. On another note, when I was prototyping something w/ Yaws yesterday I thought it would be nice if there was a return value that could be used to serve a file from disk from an appmod. Right now I just read the whole thing as a binary and return that, but it would be preferable if I could just give the path to yaws and let it serve the file... e.g. {file, ContentType, Path}. Maybe even allow IoDevice in addition to paths to support already open files? -bob From erlang@REDACTED Mon Mar 12 14:11:31 2007 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 12 Mar 2007 14:11:31 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: Message-ID: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> Well before bignums and binaries etc. it was pretty small. For a long time I struggled to keep the executable under 1.4 MB so it would fit on one floppy. Robert made an Erlang (the Vee) that had a reference counting GC and it would run happily in 75KB of memory (excluding the space for the emulator) The JAM was designed with a compact byte code. So if we threw out bignums and floats and designed a very compact object code - (huffman) then it could be very small. A fun student project (hint) /Joe On 3/12/07, ok wrote: > I spent last weekend reading the manual for Intel's IXP 1200 series > Network processor. > A seriously weird but interesting machine. It's said to be "low- > cost", but heaven only knows what > that means. I have spent the last 45 minutes searching the web for a > price, to no avail. > > These are chips with > - an ARM processor (32-bit sort-of-RISC, rather nice, really) > - 6 "micro-engines", each of which is a 32-bit RISC-cum- > microprogrammable core (as in, memory > referencing is straightforward, but the gap between issuing a > request and the thing happening is > architecturally painfully visible), each having 4 hardware > contexts for very fast thread switch, and > - oodles of special-purpose stuff to interface to various buses and > interfaces. > > How could you make parallel programming EASY on one of these things? > Simple: the same way you would make concurrency easy anywhere, use > Erlang. > > But could you? The microengines have a 2 k-instruction control store > each (1 k-instruction in the > oldest models; the current IXP2xxx generation have 8 x 8-thread, 4 k- > instruction control stores). > > The current Erlang VM (BEAM) and its emulator are aimed at some mix > of portability and speed. > Programming something like a network processor in Erlang would > require a very compact emulator, > which might not be so efficient. > > Just out of idle curiosity, has anyone looked at the possibility of > Erlang on a network processor? > If you chucked out bignums and flonums, how small could an Erlang > emulator be? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjorn@REDACTED Mon Mar 12 14:38:07 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 12 Mar 2007 14:38:07 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> References: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> Message-ID: "Joe Armstrong" writes: > So if we threw out bignums and floats and designed a very compact object > code - (huffman) then it could be very small. The Beam code is quite compact before it is loaded. It would be possible to implement an alternate loader that would load the code in more compact way (at the expense of speed). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ulf@REDACTED Mon Mar 12 15:31:00 2007 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 12 Mar 2007 15:31:00 +0100 (CET) Subject: [erlang-questions] module params not visible everywhere Message-ID: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> I ran into the following snag when generating code: -module('erlhive.ulf.epp', [___Env]). -record(epp, {file, ..., macs = .erlhive_call:call_own_module ({'erlhive.ulf.dict', setelement(2,___Env,<<117, 108, 102>>)}, new, 0, [], setelement(2,___Env,<<117, 108, 102>>)), ...}). The compiler didn't accept this. Apparently, ___Env (the module parameter) is not bound at record definition time. I will work around this by generating getenv/1 and setenv/2 functions (with the obvious namespace problems that follow), but I thought I'd mention it. It's not that I set out to specifically use the module params this way, but the code is the result of a regular function call wrapper. BR, Ulf W From richardc@REDACTED Mon Mar 12 16:12:04 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Mar 2007 16:12:04 +0100 Subject: [erlang-questions] module params not visible everywhere In-Reply-To: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> References: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> Message-ID: <45F56DC4.7050304@it.uu.se> Ulf Wiger wrote: > I ran into the following snag when generating code: > > -module('erlhive.ulf.epp', [___Env]). > > -record(epp, {file, > ..., > macs = .erlhive_call:call_own_module > ({'erlhive.ulf.dict', > setelement(2,___Env,<<117, 108, 102>>)}, > new, > 0, > [], > setelement(2,___Env,<<117, 108, 102>>)), > ...}). > > The compiler didn't accept this. Apparently, ___Env (the module parameter) > is not bound at record definition time. Variables in a record definition are not a good idea (currently). Since the expressions that specify field defaults will be inline expanded at the point where you create a new record, they may be subject to name capture. E.g., in the following case: -module(foo, [X, Y]). -record(bar, {a = X, b = Y}). ... f() -> fun (X) -> #bar{} end. the record would probably not contain what you expected (well, perhaps if you are used to programming Emacs Lisp...). This could be solved if the compiler were to generate individual initializer functions for record fields, so that the default for a record field would not be expanded verbatim, but rather as: {bar, __init_bar_1(), __init_bar_2{}} where __init_bar_1() -> X. __init_bar_2() -> Y. This would work by default with parameterized modules, and the normal inlining would remove the calls in most cases anyway (and the inliner avoids the name capture problem). For now, the easiest way to get this right is to write the field initializer functions manually (in any case it's best not to put anything more complicated than a function call in a record field initializer; you'll get code duplication and whatnot). /Richard From thomasl_erlang@REDACTED Mon Mar 12 16:31:40 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 12 Mar 2007 08:31:40 -0700 (PDT) Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> Message-ID: <647189.18086.qm@web38807.mail.mud.yahoo.com> --- Joe Armstrong wrote: > Well before bignums and binaries etc. it was pretty > small. > > For a long time I struggled to keep the executable > under 1.4 MB > so it would fit on one floppy. > > Robert made an Erlang (the Vee) that had a reference > counting GC > and it would run happily in 75KB of memory > (excluding the space for > the emulator) > The JAM was designed with a compact byte code. > > So if we threw out bignums and floats and designed a > very compact object > code - (huffman) then it could be very small. > > A fun student project (hint) A basic Prolog emulator can literally fit in the L1 cache of a modern processor -- it's just a handful of kilobytes of code. But a mature, realistic language implementation also has a lot of other cruft, not just bignums and floats. For example, the largest object files for R10B10 on my computer are (obj.beam): erl_db_util.o: 212 KB beam_load: 204 KB beam_emu: 199 KB erl_bif_wrap: 192 KB bif: 142 KB inet_drv: 136 KB hipe_bif0: 125 KB io: 124 KB erl_alloc: 119 KB erl_db_tree: 116 KB utils: 111 KB big: 107 KB erl_db: 103 KB erl_db_hash: 100 KB erl_pbifs: 98 KB ... Eliminating bignums (big.o) looks pretty far down the list. (PS. The basis of this was dir -l | awk '{print $5, $9 | "sort -n -r"}' ) Best, Thomas ____________________________________________________________________________________ No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail From ulf.wiger@REDACTED Mon Mar 12 16:39:58 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 12 Mar 2007 16:39:58 +0100 Subject: [erlang-questions] module params not visible everywhere In-Reply-To: <45F56DC4.7050304@it.uu.se> Message-ID: <6616D98C65DD514BA2E1DDC5F922315501580019@esealmw115.eemea.ericsson.se> Richard Carlsson wrote: > > Variables in a record definition are not a good idea > (currently). Since the expressions that specify field > defaults will be inline expanded at the point where you > create a new record, they may be subject to name capture. > E.g., in the following case: > > -module(foo, [X, Y]). > -record(bar, {a = X, b = Y}). > ... > f() -> fun (X) -> #bar{} end. Currently, this doesn't even compile. > > the record would probably not contain what you expected > (well, perhaps if you are used to programming Emacs Lisp...). In the case of module parameters, it ought to be safe, since they cannot be redefined. > For now, the easiest way to get this right is to write the > field initializer functions manually (in any case it's best > not to put anything more complicated than a function call in > a record field initializer; you'll get code duplication and whatnot). Unfortunately, this is not so easy in my particular case, since I'm recompiling legacy code (epp, in this particular case) in erlhive. The code is written, and I add special module parameters onto the modules to handle user context. Part of the goal is to rewrite as little of the code as possible. The original record definition _did_ have only a function call to dict:new(). The code generator wraps this, "unfortunately" adding a context based on the module parameter. That has worked beautifully until now. (: For most users, I guess your proposed workaround is perfectly fine. BR, Ulf W From richardc@REDACTED Mon Mar 12 17:09:20 2007 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 12 Mar 2007 17:09:20 +0100 Subject: [erlang-questions] module params not visible everywhere In-Reply-To: <6616D98C65DD514BA2E1DDC5F922315501580019@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F922315501580019@esealmw115.eemea.ericsson.se> Message-ID: <45F57B30.7040507@it.uu.se> Ulf Wiger (TN/EAB) wrote: > Richard Carlsson wrote: >> Variables in a record definition are not a good idea >> (currently). Since the expressions that specify field >> defaults will be inline expanded at the point where you >> create a new record, they may be subject to name capture. >> E.g., in the following case: >> >> -module(foo, [X, Y]). >> -record(bar, {a = X, b = Y}). >> ... >> f() -> fun (X) -> #bar{} end. > > Currently, this doesn't even compile. I think it used to, once, and then someone realized the problem and added a check to prevent the use of free variables. Good to know that it's working. :-) >> the record would probably not contain what you expected >> (well, perhaps if you are used to programming Emacs Lisp...). > > In the case of module parameters, it ought to be safe, > since they cannot be redefined. They can still be shadowed by locally bound variables in fun heads and list comprehension generators, just as if you had written: f(X) -> fun (X) -> #bar{} end. (the transformation for parameterized modules does just that - it adds the module-global variables to each function). >> For now, the easiest way to get this right is to write the >> field initializer functions manually (in any case it's best >> not to put anything more complicated than a function call in >> a record field initializer; you'll get code duplication and whatnot). > > Unfortunately, this is not so easy in my particular case, > since I'm recompiling legacy code (epp, in this particular > case) in erlhive. The code is written, and I add special > module parameters onto the modules to handle user context. > Part of the goal is to rewrite as little of the code as > possible. > > The original record definition _did_ have only a function > call to dict:new(). The code generator wraps this, > "unfortunately" adding a context based on the module > parameter. That has worked beautifully until now. (: > > For most users, I guess your proposed workaround is > perfectly fine. And for you as well: it should be a simple thing to lift all record field initializers to new nullary functions. If you already have a tricky parse transform going, this should be a minor addition to it. /Richard From cmijares@REDACTED Mon Mar 12 15:40:56 2007 From: cmijares@REDACTED (Carlos Mijares) Date: Mon, 12 Mar 2007 08:40:56 -0600 Subject: [erlang-questions] ASN.1 compiler Message-ID: <45F56678.2020006@txm.com.mx> Hello, I'm trying to compile the CAMEL (version 5.9.0) ASN1 description, but the compiler gives: 19> asn1ct:compile("CAP-classes",[ber_bin]). Erlang ASN.1 version "1.4.4.12" compiling "CAP-classes.asn" Compiler Options: [ber_bin,{i,"."},{i,"."}] asn1error:34:'CAP-classes':gsmSSF {'match error in object', {word_or_setting,35,'INITIATES'}, 'found in object', 'ID', 'found in class'} asn1error:39:'CAP-classes':gsmSRF {'match error in object', {word_or_setting,40,'INITIATES'}, 'found in object', 'ID', 'found in class'} {error, {asn1, [{error, {type, 34, 'CAP-classes', gsmSSF, {'match error in object', {word_or_setting,35,'INITIATES'}, 'found in object', 'ID', 'found in class'}}}, {error, {type, 39, 'CAP-classes', gsmSRF, {'match error in object', {word_or_setting,40,'INITIATES'}, 'found in object', 'ID', 'found in class'}}}]}} -- Carlos Mijares Mobile Solutions Architect Telexpertise de M?xico, S.A. de C.V. +52 (844) 438 4813 -------------- next part -------------- A non-text attachment was scrubbed... Name: camel.zip Type: application/x-zip-compressed Size: 99401 bytes Desc: not available URL: From ulf.wiger@REDACTED Mon Mar 12 20:36:05 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 12 Mar 2007 20:36:05 +0100 Subject: [erlang-questions] module params not visible everywhere In-Reply-To: <45F57B30.7040507@it.uu.se> Message-ID: <6616D98C65DD514BA2E1DDC5F922315501580254@esealmw115.eemea.ericsson.se> Richard Carlsson wrote: > > > In the case of module parameters, it ought to be safe, > > since they cannot be redefined. > > They can still be shadowed by locally bound variables in > fun heads and list comprehension generators, just as if > you had written: > > f(X) -> fun (X) -> #bar{} end. Sometimes fingers outrun brain > > For most users, I guess your proposed workaround is > > perfectly fine. > > And for you as well: it should be a simple thing to lift all > record field initializers to new nullary functions. If you > already have a tricky parse transform going, this should be a > minor addition to it. Well, what I ended up doing was to use the annotation feature in syntax_tools, and indicate whether I was in the context of a function (a three-liner), and then fetching the module parameter via a function call if needed outside the scope of a function (another handful lines of code). The only minor thing to fix now is to only generate the extra function if it's actually referred to (to avoid compiler warnings). Being able to add annotations to the abstract forms really simplifies a lot of things. BR, Ulf W From ok@REDACTED Mon Mar 12 23:07:49 2007 From: ok@REDACTED (ok) Date: Tue, 13 Mar 2007 11:07:49 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> Message-ID: <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> On 13 Mar 2007, at 2:38 am, Bjorn Gustavsson wrote: > "Joe Armstrong" writes: > >> So if we threw out bignums and floats and designed a very compact >> object >> code - (huffman) then it could be very small. > > The Beam code is quite compact before it is loaded. It would be > possible > to implement an alternate loader that would load the code in more > compact > way (at the expense of speed). The point was not "how small could compiled Erlang code be", but "how small could the EMULATOR be". On these network processors, there could be up to 8MB to hold the compiled Erlang code, but only 2 k-instructions for the EMULATOR. In particular, a "very compact object code" would make the compiled code smaller (which wouldn't help) at the expense of making the EMULATOR much more complex (which would hurt a lot). In fact, I was thinking that Quintus-style 16-bit threaded code would probably be a good idea, requiring a minimum of decoding. From jeffm@REDACTED Tue Mar 13 00:04:11 2007 From: jeffm@REDACTED (jm) Date: Tue, 13 Mar 2007 10:04:11 +1100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> References: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> Message-ID: <45F5DC6B.4040807@ghostgun.com> ok wrote: > On 13 Mar 2007, at 2:38 am, Bjorn Gustavsson wrote: > >> "Joe Armstrong" writes: >> >>> So if we threw out bignums and floats and designed a very compact >>> object >>> code - (huffman) then it could be very small. >> The Beam code is quite compact before it is loaded. It would be >> possible >> to implement an alternate loader that would load the code in more >> compact >> way (at the expense of speed). > > The point was not "how small could compiled Erlang code be", > but "how small could the EMULATOR be". On these network processors, > there could be up to 8MB to hold the compiled Erlang code, but only > 2 k-instructions for the EMULATOR. > > In particular, a "very compact object code" would make the compiled > code smaller > (which wouldn't help) at the expense of making the EMULATOR much more > complex > (which would hurt a lot). In fact, I was thinking that Quintus-style > 16-bit threaded code > would probably be a good idea, requiring a minimum of decoding. > Are there any on-line references? It could help to see a diagram or two of the architecturea and the data sheet. I get the impression that it's, shall we say, inspired by the cell processor. Jeff. From ok@REDACTED Tue Mar 13 01:34:36 2007 From: ok@REDACTED (ok) Date: Tue, 13 Mar 2007 13:34:36 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <647189.18086.qm@web38807.mail.mud.yahoo.com> References: <647189.18086.qm@web38807.mail.mud.yahoo.com> Message-ID: <7EFFC972-B78E-4591-9F85-792F6E28CA27@cs.otago.ac.nz> On 13 Mar 2007, at 4:31 am, Thomas Lindgren wrote: > A basic Prolog emulator can literally fit in the L1 > cache of a modern processor -- it's just a handful of > kilobytes of code. But a mature, realistic language > implementation also has a lot of other cruft, not just > bignums and floats. > > For example, the largest object files for R10B10 on my > computer are (obj.beam): What they *are* is completely irrelevant to the question. Remember the context: network processors where an ARM core controls 6 (IXP12xx) or 8 (IXP 2xxx) microengines, each microengine having 1 kword or 2 kwords (IXP12xx) or 4kwords (IXP 2xxx) of control store, and all of them sharing access to possibly quite large SRAM and SDRAM memories. This makes the size of the compiled .beam files about as irrelevant as possible (up to a few MB) because that's not the code that has to fit into 2048 40-bit microinstructions. Only the EMULATOR has to do that. Furthermore, the question is not "could we fit full Erlang/OTP on these machines" but "could we fit *enough* of Erlang on these machines to make Erlang a good choice of programming language, rather than the crippled C they actually use". The IXP1200 hardware doesn't support floating point, and while the IXP2400 has a multiplier, I don't think the IXP12xx machines do. Certainly they have no divide. The size of bigum support does matter, because that has to be part of the emulator. The rather vague thinking goes like this: Erlang was designed for making reliable communication and computing systems using distribution and concurrency. These machines are hardware designed for high-performance communication using concurrency, BUT the existing programming models (assembler and crippled C) do not make that easy to do. Some recent PhD theses from Berkeley have done impressive things trying to develop design approaches to make it easier to produce effective concurrent software for these machines (and others like them). They talk about Click a lot. Surely Erlang should be a good match for this problem domain IF it can be squeezed onto the hardware. Of course these machines will only get bigger and faster with time, so it's just a matter of waiting until Erlang *can* run on them. But I remember there was someone (whose name I have forgotten) at Ericsson who was designing what was intended to become an Erlang 'standard cell'. Whatever happened to that work? It's interesting to ask what "Erlang" (or a stripped-down micro-Erlang) could be useful on *now*. From ok@REDACTED Tue Mar 13 01:53:22 2007 From: ok@REDACTED (ok) Date: Tue, 13 Mar 2007 13:53:22 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <45F5DC6B.4040807@ghostgun.com> References: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> <45F5DC6B.4040807@ghostgun.com> Message-ID: On 13 Mar 2007, at 12:04 pm, jm wrote: > Are there any on-line references? It could help to see a diagram or two > of the architecturea and the data sheet. I get the impression that it's, > shall we say, inspired by the cell processor. It is an Intel chip, shipping now, so yes, there are on-line references in abundance. Go to www.intel.com, choose products, network processors, IXP 1200 family, and take it from there. Data sheets, product briefs, hundreds of pages of one kind of manual or another. The one thing I have completely failed to find anywhere is pricing. http://www.intel.com/design/network/ products/npfamily/docs/ ixp1200_docs.htm might be a good place to start. From tty.erlang@REDACTED Tue Mar 13 03:36:18 2007 From: tty.erlang@REDACTED (t ty) Date: Mon, 12 Mar 2007 22:36:18 -0400 Subject: [erlang-questions] Internode connections Message-ID: <290b3ba10703121936j5f87b041y61eb38150259e390@mail.gmail.com> If two nodes are interconnected (net_adm:ping/1 succeeds) and the network connection between both nodes go down, what is the longest time period which can pass before each node says the other is dead. Hints to code to look at would be fine. Reason: I had two interconnected nodes lose connections to each other over the weekend. The servers are the same LAN but different subnet. The servers were running the entire time, however over this weekend we had a Daylight Saving Time change. I suspect one server might had the time change occur before the other and the time to live got all weird. End result, mnesia dropped its peer and I'm left with an inconsistant dbase. Thanks t From igwan@REDACTED Tue Mar 13 06:53:35 2007 From: igwan@REDACTED (igwan) Date: Tue, 13 Mar 2007 06:53:35 +0100 Subject: [erlang-questions] xmerl producing atoms Message-ID: <45F63C5F.3000002@free.fr> Dear list, I'm currently working on a system that parses user-provided XML data using xmerl. What I find is a problem is that xmerl produces new atoms for every element name or namespace URI it parses from the input. This is not a big deal if you work with a limited number of schemas and "internal" users, but when you have to accept input from the internet, your node could be quickly taken down by filling up the atom table. The documentation ("Efficiency Guide" / 7.1 "Memory") says that atoms are not garbage-collected. I came to another post from 2005 describing this issue : http://www.erlang.org/ml-archive/erlang-questions/200502/msg00070.html I have looked at alternative parsers like ErlSom, but it seems to work against a pre-compiled schema and for my application, I have to accept any XML document, without knowing its structure. Plus, I make heavy use of hook_fun in xmerl_scan. My questions : Is there a (possibly-undocumented) option for telling xmerl to produce binaries or strings instead of atoms ? Or are there plans to garbage-collect atoms in the near future ? Thanks in advance, igwan From bertil.karlsson@REDACTED Tue Mar 13 09:20:32 2007 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 13 Mar 2007 09:20:32 +0100 Subject: [erlang-questions] ASN.1 compiler In-Reply-To: <45F56678.2020006@txm.com.mx> References: <45F56678.2020006@txm.com.mx> Message-ID: <45F65ED0.20509@ericsson.com> Hi, The problem you have come across may be a bug or an unsupported feature. I will take a look at this as soon as possible. I cannot promise that I'll make it to the next release. regards /Bertil Karlsson Carlos Mijares wrote: > Hello, > > I'm trying to compile the CAMEL (version 5.9.0) ASN1 description, but > the compiler gives: > > 19> asn1ct:compile("CAP-classes",[ber_bin]). > Erlang ASN.1 version "1.4.4.12" compiling "CAP-classes.asn" > Compiler Options: [ber_bin,{i,"."},{i,"."}] > asn1error:34:'CAP-classes':gsmSSF {'match error in object', > {word_or_setting,35,'INITIATES'}, > 'found in object', > 'ID', > 'found in class'} > asn1error:39:'CAP-classes':gsmSRF {'match error in object', > {word_or_setting,40,'INITIATES'}, > 'found in object', > 'ID', > 'found in class'} > {error, > {asn1, > [{error, > {type, > 34, > 'CAP-classes', > gsmSSF, > {'match error in object', > {word_or_setting,35,'INITIATES'}, > 'found in object', > 'ID', > 'found in class'}}}, > {error, > {type, > 39, > 'CAP-classes', > gsmSRF, > {'match error in object', > {word_or_setting,40,'INITIATES'}, > 'found in object', > 'ID', > 'found in class'}}}]}} > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjorn@REDACTED Tue Mar 13 09:36:31 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Mar 2007 09:36:31 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> References: <9b08084c0703120611k2d7255del49aa02e96b2ede3f@mail.gmail.com> <70BE3062-6A84-4EF0-845A-F03ECED91D0A@cs.otago.ac.nz> Message-ID: ok writes: > On 13 Mar 2007, at 2:38 am, Bjorn Gustavsson wrote: > > > The Beam code is quite compact before it is loaded. It would be > > possible > > to implement an alternate loader that would load the code in more > > compact > > way (at the expense of speed). > > The point was not "how small could compiled Erlang code be", > but "how small could the EMULATOR be". On these network processors, > there could be up to 8MB to hold the compiled Erlang code, but only > 2 k-instructions for the EMULATOR. OK. The Beam loader now does a lot of instruction combining and instruction specialing. An alternate loader wouldn't need to do that, so that the the emulator would have a lot fewer instructions. I have no idea if that would be enough to fit the emulator into the required space. > In particular, a "very compact object code" would make the compiled > code smaller > (which wouldn't help) at the expense of making the EMULATOR much more > complex > (which would hurt a lot). In fact, I was thinking that Quintus-style > 16-bit threaded code > would probably be a good idea, requiring a minimum of decoding. Beam uses 32-bit threaded code; it might be possible to adapt it to use 16-bit threaded code. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kenneth.lundin@REDACTED Tue Mar 13 11:11:12 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 13 Mar 2007 11:11:12 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: Message-ID: Hi, Just like the Cell processor this processor consist of one general purpose processor which can run a normal operating system like Linux, Vxworks, OSE etc. The microkernels around this general purpose processor does not have program-memory and instruction set which fits for running an operating system and applications on top of that AFAIK. The current Erlang emulator is built as an user space application on top of an operating system. How small footprint that implementation or a similar implementation can have is not very interesting in this case I think. If is should be possible to run Erlang on the microkernels we are talking about a completely new Erlang VM with nothing in common with the one we have to day. I even doubt if it is possible in practice to run it in a very limited environment like that. Another approach that is realistic is to run the Erlang VM and an Operating system on the general purpose processor and having some kind of linked in driver which supports execution of special code on the microkernels. I don't think we are talking about Erlang code executing there. So if we are interested in the minimal footprint of todays implementation (or something derived from that) I think it is the memory limitations of the general purpose processor (ARM) that is interesting. /Regards Kenneth On 3/12/07, ok wrote: > I spent last weekend reading the manual for Intel's IXP 1200 series > Network processor. > A seriously weird but interesting machine. It's said to be "low- > cost", but heaven only knows what > that means. I have spent the last 45 minutes searching the web for a > price, to no avail. > > These are chips with > - an ARM processor (32-bit sort-of-RISC, rather nice, really) > - 6 "micro-engines", each of which is a 32-bit RISC-cum- > microprogrammable core (as in, memory > referencing is straightforward, but the gap between issuing a > request and the thing happening is > architecturally painfully visible), each having 4 hardware > contexts for very fast thread switch, and > - oodles of special-purpose stuff to interface to various buses and > interfaces. > > How could you make parallel programming EASY on one of these things? > Simple: the same way you would make concurrency easy anywhere, use > Erlang. > > But could you? The microengines have a 2 k-instruction control store > each (1 k-instruction in the > oldest models; the current IXP2xxx generation have 8 x 8-thread, 4 k- > instruction control stores). > > The current Erlang VM (BEAM) and its emulator are aimed at some mix > of portability and speed. > Programming something like a network processor in Erlang would > require a very compact emulator, > which might not be so efficient. > > Just out of idle curiosity, has anyone looked at the possibility of > Erlang on a network processor? > If you chucked out bignums and flonums, how small could an Erlang > emulator be? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From surindar.shanthi@REDACTED Tue Mar 13 13:31:01 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Tue, 13 Mar 2007 18:01:01 +0530 Subject: [erlang-questions] ODBC problem if query returns multiple tables Message-ID: <42ea5fb60703130531x6dfae4ackae642d34097f22b0@mail.gmail.com> Dear all, I'm using erlang 5.5 I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). When I use that same SP in odbc:sql_query/2, it returns {error,"Column type not supported"}. If I change the SP such that it will return only one table, the SP works fine in odbc:sql_query/2. >From this results, I concluded that, odbc:sql_query/2 does not support query which returns multiple tables. Am I right? Or, Is there any option available to make odbc:sql_query/2 to work if the query returns multiple tables? Please give your inputs. Thanks in advance. -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Tue Mar 13 14:04:37 2007 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 13 Mar 2007 06:04:37 -0700 (PDT) Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: Message-ID: <518773.94247.qm@web38802.mail.mud.yahoo.com> --- Kenneth Lundin wrote: > So if we are interested in the minimal footprint of > todays > implementation (or something derived from that) I > think it is the > memory limitations of the general purpose processor > (ARM) that is > interesting. For the record, I for one wouldn't mind running Erlang on my cellphone ... Best, Thomas ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ From serge@REDACTED Tue Mar 13 14:16:33 2007 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 13 Mar 2007 09:16:33 -0400 Subject: [erlang-questions] Internode connections In-Reply-To: <290b3ba10703121936j5f87b041y61eb38150259e390@mail.gmail.com> References: <290b3ba10703121936j5f87b041y61eb38150259e390@mail.gmail.com> Message-ID: <45F6A431.5080403@hq.idt.net> t ty wrote: > If two nodes are interconnected (net_adm:ping/1 succeeds) and the > network connection between both nodes go down, what is the longest > time period which can pass before each node says the other is dead. > Hints to code to look at would be fine. Somewhere between 45 to 75 seconds. Look into the docs on the net_ticktime net_kernel's option: http://www.erlang.org/doc/doc-5.5.3/lib/kernel-2.11.3/doc/html/kernel_app.html > Reason: I had two interconnected nodes lose connections to each other > over the weekend. The servers are the same LAN but different subnet. > The servers were running the entire time, however over this weekend we > had a Daylight Saving Time change. I suspect one server might had the > time change occur before the other and the time to live got all weird. If you are not starting the emulator with the +c switch, it normally compensates for sudden changes in the system time by gradually adjusting time to catch up with the wall clock. I don't know for sure if net_ticktime is driven by a timer that's based on the internal clock values (i.e. erlang:now/0) rather then the wall clock, but have no reason to believe it wouldn't be. > End result, mnesia dropped its peer and I'm left with an inconsistant > dbase. If you are running a replicated database, you need to design the system that it would monitor network partitioning, and automatically restart the replicated nodes. Please read this thread: http://www.erlang.org/ml-archive/erlang-questions/200304/msg00418.html we also use this technique and it is indeed quite effective. I wish that mnesia had this feature built-in. Regards, Serge > Thanks > > t > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bertil.karlsson@REDACTED Tue Mar 13 14:18:45 2007 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 13 Mar 2007 14:18:45 +0100 Subject: [erlang-questions] xmerl producing atoms In-Reply-To: <45F63C5F.3000002@free.fr> References: <45F63C5F.3000002@free.fr> Message-ID: <45F6A4B5.2050602@ericsson.com> igwan wrote: > My questions : Is there a (possibly-undocumented) option for telling > xmerl to produce binaries or strings instead of atoms ? Or are there > plans to garbage-collect atoms in the near future ? > There is no ongoing work to limit the use of atoms in xmerl. Plans exist to do that for a future release. /Bertil From rasmussen.bryan@REDACTED Tue Mar 13 14:57:12 2007 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Tue, 13 Mar 2007 14:57:12 +0100 Subject: [erlang-questions] xmerl producing atoms In-Reply-To: <45F6A4B5.2050602@ericsson.com> References: <45F63C5F.3000002@free.fr> <45F6A4B5.2050602@ericsson.com> Message-ID: <3bb44c6e0703130657gb14939duf4b01aeb988b9c51@mail.gmail.com> This is interesting for me, I have a framework I've ported to a number of different platforms and I've been hoping to get the time to port to Erlang, it should accept generic xml content and figure out routing to processes dependent on various things in the document. Often I need to switch between a generic handler to a specific handler (when I recognize the XML format I handle it, when not I send further or handle with a generic handler dependent on a bunch of rules) So it sounds like what I should do is to call XML processing code in some other language to tell me what I need to do, in the cases where the code tells me that I can handle with Erlang I switch to erlang otherwise I keep going. This all sounds very dirty. Any suggestions for doing it cleanly and quickly? This isn't actually that important because I am not sure when I would have a chance to port it to erlang since I've been hoping for the time to do so over half a year and no luck yet. Cheers, Bryan Rasmussen On 3/13/07, Bertil Karlsson wrote: > > > igwan wrote: > > My questions : Is there a (possibly-undocumented) option for telling > > xmerl to produce binaries or strings instead of atoms ? Or are there > > plans to garbage-collect atoms in the near future ? > > > There is no ongoing work to limit the use of atoms in xmerl. Plans exist > to do that > for a future release. > > /Bertil > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From kenneth.lundin@REDACTED Tue Mar 13 14:57:50 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 13 Mar 2007 14:57:50 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <518773.94247.qm@web38802.mail.mud.yahoo.com> References: <518773.94247.qm@web38802.mail.mud.yahoo.com> Message-ID: Hi, On 3/13/07, Thomas Lindgren wrote: > > --- Kenneth Lundin wrote: > > > So if we are interested in the minimal footprint of > > todays > > implementation (or something derived from that) I > > think it is the > > memory limitations of the general purpose processor > > (ARM) that is > > interesting. > > For the record, I for one wouldn't mind running Erlang > on my cellphone ... And I don't think it would be any problem to do that with the current implementation. We know that it is possible to run the Erlang VM plus applikations in 32 Mbytes or less and for sure you can find a Cellphone that has memory capacity above that. The missing thing for Erlang is a good binding to the Graphics on a Phone (and elsewhere). Otherwise we would have tried it already. I think Erlang has ideal characteristics for implementing the functions necessary on a Cell phone and Handheld computer. /Kenneth > > Best, > Thomas > > > > > ____________________________________________________________________________________ > TV dinner still cooling? > Check out "Tonight's Picks" on Yahoo! TV. > http://tv.yahoo.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From christophe.romain@REDACTED Tue Mar 13 16:01:30 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Tue, 13 Mar 2007 16:01:30 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: <518773.94247.qm@web38802.mail.mud.yahoo.com> Message-ID: <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> > The missing thing for Erlang is a good binding to the Graphics on a > Phone (and elsewhere). may be it's time to contribute to http://openmoko.com/ writing a binding would be not so complicated (gtk and matchbox2) the GUI is well defined to be easy to add "graphical plugins" i'm running an erlang server application 24/7 on an equivalent hardware platform for one year now. From icfp.publicity@REDACTED Tue Mar 13 17:32:08 2007 From: icfp.publicity@REDACTED (Matthew Fluet (ICFP Publicity Chair)) Date: Tue, 13 Mar 2007 11:32:08 -0500 Subject: [erlang-questions] ICFP07 Final CFP & Note from the Program Chair Message-ID: <53ff55480703130932q7e9f3a3coff06d4e42fd42e59@mail.gmail.com> Call for Papers ICFP 2007: International Conference on Functional Programming Freiburg, Germany, 1-3 October 2007 Important Dates ~~~~~~~~~~~~~~~ Submission: 11:00 6 April 2007, Samoa time (AST) Author response: 11:00 23 May to 11:00 25 May 2007 (AST) Notification: 8 June 2007 Final papers due: 20 July 2007 Note from the ICFP07 Program Chair As the April 6 deadline for ICFP approaches, we thought it might be useful to call potential authors' attention to several significant points in the Call for Papers, the full text of which can be found at http://icfp07.eecs.harvard.edu/cfp.html Experience Reports ~~~~~~~~~~~~~~~~~~ This year ICFP is soliciting a new category of paper: the Experience Report. An Experience Report is a short paper of 2--4 pages. Unlike a normal ICFP paper, it is not intended to add to the body of *knowledge* of the functional-programming community. Rather, each Experience Report will add to a body of published, refereed, citable *evidence* that functional programming really works--or will describe obstacles that prevented it from working. Double-blind review ~~~~~~~~~~~~~~~~~~~ A reviewer's attitude toward a submission may be affected, even unconsciously, by the identity of the author. Our reviewers want to be able to approach each submission without such involuntary reactions as ``Peyton Jones; he writes a good paper'' or ``Who are these people? I have never heard of them.'' We especially want to ensure that work submitted by newcomers to our community gets the same careful consideration and scrutiny as the work of our best-known people. We are therefore requesting that authors make it possible for their submissions to be reviewed without forcing the reviewers to know who the authors are. Once all reviews are written, identities will be revealed at the PC meeting. For authors, this process should be simple: * Omit authors' names from your title page (or list them as ``omitted for submission''), and when you cite your own work, please make it difficult to figure out exactly who you are, even if a reviewer might be able to make a good guess. * If your submission is supported by other material, such as a technical report containing lengthy proofs, please do not cite this material on the web---instead, submit a zip file including both your paper and the technical report. Detailed guidelines can be found at http://icfp07.eecs.harvard.edu/blind.html Firm length limit; no appendices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 12-page limit (for full papers) and 4-page limit (for Experience Reports) are *firm*. Papers exceeding these limits will be rejected summarily by the program chair. If an author wishes to include an appendix which would put the main submission over the limit, the appendix must be submitted as a separate document, in a zip file with the main submission. It is understood that the reviewers' only obligation is to read the main submission; material beyond the 12-page limit may well go unread. Other details ~~~~~~~~~~~~~ We are encouraging author-date citations (Peyton Jones and Wadler 1993) rather than the default numbered citations [27]. LaTeX users can \usepackage{natbib} and \bibliographystyle{plainnat}. The submission deadline is late morning Samoan time, but in many times zones From fritchie@REDACTED Tue Mar 13 20:22:52 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 13 Mar 2007 14:22:52 -0500 Subject: [erlang-questions] ODBC problem if query returns multiple tables In-Reply-To: Message of "Tue, 13 Mar 2007 18:01:01 +0530." <42ea5fb60703130531x6dfae4ackae642d34097f22b0@mail.gmail.com> Message-ID: <200703131922.l2DJMqfu082717@snookles.snookles.com> >>>>> "ss" == Surindar Sivanesan writes: ss> I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). ss> When I use that same SP in odbc:sql_query/2, it returns ss> {error,"Column type not supported"}. It has been a while since I've used the Erlang ODBC driver, but I have a faint memory that the "Column type not supported" can appear because of attempts to use scrollable cursors. Do you still see the error if you use this? {ok, DB} = odbc:connect(DSN_string, [{scrollable_cursors, off}]). -Scott From w.a.de.jong@REDACTED Tue Mar 13 21:07:29 2007 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 13 Mar 2007 21:07:29 +0100 Subject: [erlang-questions] xmerl producing atoms In-Reply-To: <45F63C5F.3000002@free.fr> References: <45F63C5F.3000002@free.fr> Message-ID: <407d9ef80703131307y170e295di5b25d1665776f5ad@mail.gmail.com> Hello igwan, Maybe you can use the sax parser that is part of Erlsom. It wouldn't be difficult to implement a call-back function that produces output similar or the xmerl 'simple-form', or calls a function similar to the 'hook_fun'. The sax parser does not create any atoms. Regards Willem On 3/13/07, igwan wrote: > > Dear list, > > I'm currently working on a system that parses user-provided XML data > using xmerl. What I find is a problem is that xmerl produces new atoms > for every element name or namespace URI it parses from the input. This > is not a big deal if you work with a limited number of schemas and > "internal" users, but when you have to accept input from the internet, > your node could be quickly taken down by filling up the atom table. The > documentation ("Efficiency Guide" / 7.1 "Memory") says that atoms are > not garbage-collected. > > I came to another post from 2005 describing this issue : > http://www.erlang.org/ml-archive/erlang-questions/200502/msg00070.html > > I have looked at alternative parsers like ErlSom, but it seems to work > against a pre-compiled schema and for my application, I have to accept > any XML document, without knowing its structure. Plus, I make heavy use > of hook_fun in xmerl_scan. > > My questions : Is there a (possibly-undocumented) option for telling > xmerl to produce binaries or strings instead of atoms ? Or are there > plans to garbage-collect atoms in the near future ? > > Thanks in advance, > > igwan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igwan@REDACTED Tue Mar 13 21:39:17 2007 From: igwan@REDACTED (igwan) Date: Tue, 13 Mar 2007 21:39:17 +0100 Subject: [erlang-questions] xmerl producing atoms In-Reply-To: <407d9ef80703131307y170e295di5b25d1665776f5ad@mail.gmail.com> References: <45F63C5F.3000002@free.fr> <407d9ef80703131307y170e295di5b25d1665776f5ad@mail.gmail.com> Message-ID: <45F70BF5.6000703@free.fr> Hello Willem, Thanks for the hint. Anyway, I started hacking into xmerl_scan.erl :). I'm for sure breaking other xmerl modules doing so, but for the functions I use in my code, it seems to do the trick (just prototyping for now) igwan Willem de Jong a ?crit : > Hello igwan, > > Maybe you can use the sax parser that is part of Erlsom. It wouldn't > be difficult to implement a call-back function that produces output > similar or the xmerl 'simple-form', or calls a function similar to the > 'hook_fun'. The sax parser does not create any atoms. > > Regards > Willem From xpdoka@REDACTED Tue Mar 13 22:09:11 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Tue, 13 Mar 2007 22:09:11 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45F1102A.1080909@ericsson.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> <45F1102A.1080909@ericsson.com> Message-ID: <45F712F7.2010704@dominicwilliams.net> Mats Cronqvist wrote : > > My suggestion was to improve the ram_file_server, so that you could > > take a string representation of code, open it as a ram file, and > > then use any tool that can operate on a file descriptor (which > > epp_dodger can, but epp can't). > > improving the ram_file_server might well be useful, but surely the > preprocessor should accept a string as input? actually, i think it > should accept a token list too. For what it's worth, I agree with Mats. I am trying to work on a development environment for Erlang, and being able to compile and pre-process a string directly would be very convenient. What we really need is to compile a string to forms (we need the intermediate representation, and we can already compile from forms onwards). The ram_file_server solution would achieve the same thing (if all tools would operate on a file descriptor) but is not as simple. Regards, Dominic Williams http://www.dominicwilliams.net ---- From vladdu55@REDACTED Tue Mar 13 22:30:45 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 13 Mar 2007 21:30:45 +0000 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45F712F7.2010704@dominicwilliams.net> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> <45F1102A.1080909@ericsson.com> <45F712F7.2010704@dominicwilliams.net> Message-ID: <95be1d3b0703131430t7aca1f93u2be721bd77b0cc38@mail.gmail.com> On 3/13/07, Dominic Williams wrote: > > improving the ram_file_server might well be useful, but surely the > > preprocessor should accept a string as input? actually, i think it > > should accept a token list too. > > For what it's worth, I agree with Mats. I am trying to work on a > development environment for Erlang, and being able to compile and > pre-process a string directly would be very convenient. What we really > need is to compile a string to forms (we need the intermediate > representation, and we can already compile from forms onwards). The > ram_file_server solution would achieve the same thing (if all tools > would operate on a file descriptor) but is not as simple. This is just a side thought. For a development environment, you need two ways to handle source code: to "understand" it or to execute it. In the first case, one only needs to parse the code, not compile it. Also, one doesn't want to do macro substitution, but get a parse tree reflecting the actual source (i.e. with macro constructs). For this (and other stuff) I had to hack the scanner and parser for use with Erlide. In the latter case, the use case I see is when debugging, to evaluate some expression. It is however tricky to allow macros -- the context of evaluating the expression has to be defined very precisely, so that the right macro definitions are used. I imagine having set a breakpoint and trying to evaluate an expression containing macros: the values should be those valid at the breakpoint. best regards, Vlad From ok@REDACTED Tue Mar 13 23:32:23 2007 From: ok@REDACTED (ok) Date: Wed, 14 Mar 2007 11:32:23 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: Message-ID: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> On 13 Mar 2007, at 11:11 pm, Kenneth Lundin wrote: > If is should be possible to run Erlang on the microkernels we are > talking about a completely new Erlang VM with nothing in common with > the one we have to day. YES! That is exactly what I explicitly asked about! > I even doubt if it is possible in practice to run it in a very limited > environment like that. Maybe, maybe not. If memory serves me correctly, Xerox Quintus Prolog ran in 4 k-instructions of microcode on the Xerox D-machines (Dandelion, Dandetiger, Daybreak, ...) Erlang *ought* to be easier to emulate than Prolog, as Erlang doesn't have unification, trailing, or choice-points. Emulating on a 32-bit machine *ought* to be easier than emulating on the D-machines (at least the 110 and 1109), where the Smalltalk, Lisp, and Prolog VMs were 32-bit, but the hardware memory interface was 16-bit, so each memory reference involved the "D-machine waltz" ONE fetch page table entry and check it TWO fetch/store one half of word THREE fetch/store other half of word Yes, virtual memory was actually done in the microcode. On a machine like the IXP12xx, you would not bother with virtual memory. So we could expect big savings.. > Another approach that is realistic is to run the Erlang VM and an > Operating system > on the general purpose processor and having some kind of linked in > driver which supports execution of special code on the microkernels. I > don't think we are talking about Erlang code executing there. Running some form of Linux or OS/Kit on a 266Mhz (or slower) StrongArm is not an interesting problem. I don't say it isn't USEFUL, just that it should not be any kind of challenge. (Hullo, Mr 32-bit byte-addressed RISC! Hullo, Mr Unix-like operating system! ./configure; make; make install) YOU may not be talking about executing Erlang code on the micro- engines, but I *AM*. That's the whole *POINT* of thinking about the question: COULD A SUBSET OF ERLANG BE A USEFUL LANGUAGE FOR HANDLING CONCURRENCY ON THE MICRO-ENGINES OF A NETWORK PROCESSOR? Hmm, here's the actual focal sentence of my message: > How could you make parallel programming EASY on one of these things? Your answer appears to be "no, certainly not". But is there any reason *other* than emulator sizewhich would make it so? Is there any reason to believe it *couldn't* be done in 4 k-instructions (IXP 2xxx size)? > So if we are interested in the minimal footprint of todays > implementation (or something derived from that) I can't speak for you, but I am NOT interested in that at all. As long as the emulator is smaller than my processor's I-cache, I'm happy. I see no reason to expect an abstract machine designed for speed to permit a specially compact emulator, so I don't see an emulator derived from BEAM as >obviously< relevant, though it would be nice to be wrong. > I think it is the > memory limitations of the general purpose processor (ARM) that is > interesting. The StrongARM processor has no special limitations. If memory serves (which it may not), it has 128k on-chip I-cache, 128k D-cache, and can accept as much off-chip DDR SDRAM as any other StrongArm could. Remember, the entire point of this thread is NOT "hey, if I had a chip like this, could I run Erlang on it, somehow, anyhow?", but "look, people are trying to do things with chips like these and they have to deal with concurrency and communication in remarkably unpleasant languages; Erlang looks as if it would be useful to these people if only they *could* use it; could they?" So there are three questions of interest. 1. Would it be possible to use Erlang *at all* on these machines? (At least for the IXP2xxx series, I am pretty sure that the answer is "yes", but it is *possible* that the answer might be "yes" for the smaller slower machines as well.) 2. Could Erlang be fast *enough* to be useful on these machines? (For some applications, I suspect that the answer is NO. Why else would the IXP2xxx series have been made so much faster than the IXP12xx series? But for other applications, maybe.) 3. Would Erlang be a *good* language for expressing concurrency and communication of this kind? (I am very confident that the answer is "yes", but the only way to really prove it would be for someone to really try it. And they could only try it if the answer to Q1 were "yes".) 4. If performance isn't good enough, what would it be like to make micro-engines that ran an Erlang instruction set directly? (But this is only an interesting question if Erlang is a good language for the job.) The guy who was trying to design an Erlang "standard cell" obviously thought that Erlang WOULD be a good language for low-level message handling. Was he wrong? From robert.virding@REDACTED Tue Mar 13 23:36:26 2007 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 13 Mar 2007 23:36:26 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> References: <518773.94247.qm@web38802.mail.mud.yahoo.com> <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> Message-ID: <45F7276A.4090909@telia.com> As Kenneth mentioned if you want a really small emulator it would be best to build a completely new one with that as the first priority. I wonder if the most compact wouldn't be to have a small byte code emulator based on a stack machine. No registers and stuff just operations on the top stack. Very regular and minimal. You would probably have to have a serious think about the memory model as well to keep the memory management code small. Trimming BIFs and library functions implemented in C would save some space removing network stuff and the general port mechanism. Maybe even ETS but then would have difficulty running OTP. I suppose it would also depend on what applications you intend running. But it would definitely be fun trying! Robert From ok@REDACTED Wed Mar 14 00:38:10 2007 From: ok@REDACTED (ok) Date: Wed, 14 Mar 2007 12:38:10 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <45F7276A.4090909@telia.com> References: <518773.94247.qm@web38802.mail.mud.yahoo.com> <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> <45F7276A.4090909@telia.com> Message-ID: When someone asks "how small could AN Erlang emulator be", that means something quite different from "how small could THE Erlang emulator be". On 14 Mar 2007, at 11:36 am, Robert Virding wrote: > As Kenneth mentioned if you want a really small emulator it would be > best to build a completely new one with that as the first priority. Yes, exactly. That's why the question used the indefinite article (AN Erlang emulator), not the definite one (THE Erlang emulator that we have now). [Yes, I remember JAM, and I think someone did another as well, plus of course there's EtoS and GERL. is anything but BEAM seeing active use/ development?] > I wonder if the most compact wouldn't be to have a small byte code > emulator based on a stack machine. No registers and stuff just > operations on the top stack. Very regular and minimal. You would > probably have to have a serious think about the memory model as > well to > keep the memory management code small. There is previous work on Scheme implementations for tiny machines. It did seem possible that someone might have actually tried to make a small Erlang VM at some point. As for GC, it seemed to me that the simplest thing might be to have a micro-engine dedicated to GC, and a thread that wants a GC would drop out of the active thread pool into the GC thread pool. Indeed, in a larger system, one might have multiple micro-engines running GCs. The possibility of Erlang processes without shared heaps makes this architecturally pleasant. > Trimming BIFs and library functions implemented in C would save some > space removing network stuff and the general port mechanism. Maybe > even > ETS but then would have difficulty running OTP. If the question were "given a goal of running Erlang/OTP, how could these machines be made to supply that need", running OTP would be an interesting question. Since my question is "given a goal of running concurrent communication stuff on these machines, could Erlang be made to supply that need", OTP is not interesting at all. It would be much more useful to have a library that could use the on-chip hashing support than ETS. Think of an Erlang/IXP "system" as coming in pairs of nodes. Each IXP chip would have an Erlang/OTP node running a normal distribution, plus an IXP node running on the micro-engines. Processes in the IXP node would be able to talk to each other, to the wires, and to the OTP node on the same chip. If an IXP process wanted ETS services it would have a helper process running on the OTP node acting on its behalf. There's no need, therefore, to put *everything* on the micro-engines. The question is whether one can put *enough* to make a pleasant language for doing packet filtering and routing and whatever else people do with these chips. From ok@REDACTED Wed Mar 14 00:59:15 2007 From: ok@REDACTED (ok) Date: Wed, 14 Mar 2007 12:59:15 +1300 Subject: [erlang-questions] Santa likes Erlang better than Haskell In-Reply-To: <45F56DC4.7050304@it.uu.se> References: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> <45F56DC4.7050304@it.uu.se> Message-ID: Yesterday a colleague told me about a draft chapter (for a book called "Beautiful code", editor by Greg Wilson) written by Simon Peyton Jones. The chapter is about Software Transactional Memory in Haskell. You'll find it through http://lambda-the-ultimate.org/node/1964 Software Transactional Memory has already been mentioned before in this mailing list, and the chapter explains the basic ideas clearly enough. As I read, however, I felt a bit worried. STM makes it easy to write CORRECT programs, true enough. (But see below.) But with your transactions being aborted and restarted whenever there is a conflict, it seems to me that it is possible that there might be very large overheads without the programmer having any way of telling that this is happening. Something else bothered me. I've been using Haskell for years, even teaching it, but I found the code in the chapter difficult. I could understand each piece, but it was totally unclear to me how you would design something like this. Key concepts, like the Gate data type, came out of the blue. There are things like lists of promises to return promises to perform actions. Did the problem really demand a solution this complex? The sample application in the chapter is the Santa Claus problem. Santa has 9 reindeer and 10 elves. Whenever the 9 reindeer are ready, Santa goes delivering toys with them. Whenever any 3 elves want a meeting, provided the reindeer are not waiting, Santa has a meeting with them. Haskell solution: 77 SLOC. Erlang solution: 46 SLOC. Haskell techniques: too many to list. Erlang techniques: one process for Santa, one for each elf, one for each reindeer, plus two secretaries (one waits for 9 reindeer and forwards them as a group to Santa, the other waits for 3 elves and forwards them as a group to Santa). Two nested receives in Santa to get the desired priority effect. Haskell hidden cost:transaction abort/restart Erlang hidden cost: well, none, really. Santa's mailbox can have at most 1 reindeer group, 3 elf groups, and 9 good-bye messages; one secretrary's can have at most 9 requests and the other's at most 10; and each reindeer or elf can have at most one proceed message. It makes me really pleased to know Erlang, and rather worried that Simon Peyton Jones thinks his 66% larger and far harder to understand solution is "beautiful". From david.nospam.hopwood@REDACTED Wed Mar 14 01:15:54 2007 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 14 Mar 2007 00:15:54 +0000 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> Message-ID: <45F73EBA.7020202@blueyonder.co.uk> ok wrote: > On 13 Mar 2007, at 11:11 pm, Kenneth Lundin wrote: > > YOU may not be talking about executing Erlang code on the micro-engines, > but I *AM*. That's the whole *POINT* of thinking about the question: > COULD A SUBSET OF ERLANG BE A USEFUL LANGUAGE FOR HANDLING CONCURRENCY ON > THE MICRO-ENGINES OF A NETWORK PROCESSOR? Hmm, here's the actual focal > sentence of my message: > > > How could you make parallel programming EASY on one of these things? > > Your answer appears to be "no, certainly not". But is there any > reason *other* than emulator size which would make it so? Is there any > reason to believe it *couldn't* be done in 4 k-instructions (IXP 2xxx size)? The problem with this question, is that to give an informed answer would require doing a fair amount of the work of trying to implement such a VM. In the context of this discussion, the best answers you're going to get will be guesswork based on people's experience of writing small interpreters for other languages on vaguely similar platforms. Put it this way: if I were asked for a commercial quote to implement a subset of Erlang on this size of platform, I'd have to refuse the work, since there is no way I could guarantee to be able to complete it. In any case, if Erlang is the answer, then what is the question? If I were trying to target any specific application at such a platform, I wouldn't use Erlang. I might use message passing concurrency, but probably in the form of a library designed to work with programs written in the platform's dialect of C, and probably using bounded buffers or synchronous message passing, rather than Erlang's unbounded (up to available memory) asynchronous model. -- David Hopwood From ok@REDACTED Wed Mar 14 03:16:12 2007 From: ok@REDACTED (ok) Date: Wed, 14 Mar 2007 15:16:12 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <45F73EBA.7020202@blueyonder.co.uk> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> Message-ID: <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> On 14 Mar 2007, at 1:15 pm, David Hopwood wrote: > The problem with this question, is that to give an informed answer > would > require doing a fair amount of the work of trying to implement such > a VM. Yes, but there are several people on this mailing list who have tried to write Erlang VMs. I have several times mentioned that there was someone actually at Ericsson (I have visited him in his office) who was trying to develop an Erlang 'standard cell' for ASICs, part of which necessarily involved designing a new VM precisely for a tiny environment. > In the context of this discussion, the best answers you're going to > get will > be guesswork based on people's experience of writing small > interpreters for > other languages on vaguely similar platforms. Surely there is somebody on this mailing list who KNOWS what happened to the Erlang standard cell project and could at least ask the guy who was working on it to comment? Bjarne, are you there? Joe, are you there? Anyone? > In any case, if Erlang is the answer, then what is the question? If I > were trying to target any specific application at such a platform, I > wouldn't use Erlang. And this is the question. Why not? The only reason you mention is Erlang's unbounded mailbox *model*, but as I found when I looked at the Santa Claus problem, for sufficiently small problems (that one was 22 processes but highly regular in structure) it CAN be straightforward in particular cases to see that only bounded mailbox space will be required. If you want to use bounded buffers, you have to do the SAME kind of analysis to find out how big the buffers should be, so there is no gain whatever from avoiding Erlang. Oddly enough, while working on that example I felt the ghost of Concurrent Prolog (or more accurately, Per Brinch Hansen's approach to modelling a concurrent system) hovering over my shoulder. From surindar.shanthi@REDACTED Wed Mar 14 05:44:56 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Wed, 14 Mar 2007 10:14:56 +0530 Subject: [erlang-questions] ODBC problem if query returns multiple tables In-Reply-To: <200703131922.l2DJMqfu082717@snookles.snookles.com> References: <42ea5fb60703130531x6dfae4ackae642d34097f22b0@mail.gmail.com> <200703131922.l2DJMqfu082717@snookles.snookles.com> Message-ID: <42ea5fb60703132144k2fcac16at72a87abcfaff5381@mail.gmail.com> Thanks for the reply. I'm still facing the same problem even though I make the scrollable cursor option off. On 3/14/07, Scott Lystig Fritchie wrote: > > >>>>> "ss" == Surindar Sivanesan writes: > > ss> I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). > ss> When I use that same SP in odbc:sql_query/2, it returns > ss> {error,"Column type not supported"}. > > It has been a while since I've used the Erlang ODBC driver, but I have > a faint memory that the "Column type not supported" can appear because > of attempts to use scrollable cursors. Do you still see the error if > you use this? > > {ok, DB} = odbc:connect(DSN_string, [{scrollable_cursors, off}]). > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Wed Mar 14 10:36:23 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Mar 2007 10:36:23 +0100 Subject: [erlang-questions] Blog: A first concurrency in Erlang Message-ID: <45F7C217.2060105@it.uu.se> Just found this on Reddit: http://matt.blogs.it/entries/00002513.html /Richard From matthias@REDACTED Wed Mar 14 10:55:33 2007 From: matthias@REDACTED (Matthias Lang) Date: Wed, 14 Mar 2007 10:55:33 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> Message-ID: <17911.50837.488174.792585@antilipe.corelatus.se> ok writes: > I have several times mentioned that there was someone > actually at Ericsson (I have visited him in his office) who > was trying to develop an Erlang 'standard cell' for ASICs, > part of which necessarily involved designing a new > VM precisely for a tiny environment. .... > Surely there is somebody on this mailing list who KNOWS what > happened to the Erlang standard cell project and could at least ask > the guy who was working on it to comment? Bjarne, are you there? > Joe, are you there? Anyone? At the risk of guessing wrong, maybe you're thinking of Robert Tj?rnstr?m and his ECOMP thingamibob. Here a recent mailing list post by someone who appears to have looked at ECOMP. I suspect the poster doesn't know more about it than you, though: http://erlang.org/ml-archive/erlang-questions/200507/msg00458.html You can find some slides about ECOMP by asking google "ECOMP Robert Tj?rnstr?m". Matthias From tumanian@REDACTED Wed Mar 14 11:19:42 2007 From: tumanian@REDACTED (Gurgen Tumanian) Date: Wed, 14 Mar 2007 14:19:42 +0400 Subject: [erlang-questions] Code server dead on startup. Message-ID: <85d11a2e0703140319k5137ccffhb35f241a3fe15fe3@mail.gmail.com> Hi all. Erlang Code server gets down on start, when i run the erl shell. The error message that i get is {error_logger,{{2007,3,14},{13,21,32}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{'DOWN',#Ref< 0.0.0.13>,process,<0.15.0 >,normal}},{offender,[{pid,undefined},{name,code_server},{mfa,{code,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2007,3,14},{13,21,33}},crash_report,[[{pid,<0.7.0 >},{registered_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{application_master,init,[< 0.5.0>,<0.6.0 >,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,old_file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,hipe_unified_loader,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[< 0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0 >]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,21},{reductions,1063}],[]]} {error_logger,{{2007,3,14},{13,21,33}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} Thye problem first appeared yesturday, when i got system malfunction because of zero disk space( my application is a kind of web service which dumps lot of logs). After some cleanup on disk and a restart erl had started normally, but it got down today again this morning. I guess it is not connected to disk space any more, as the machine was offline whole day, so didn't do any logging. Can you give me some clue or a piece of advice what to do? Regards Gurgen Tumanyan, SmartTech -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Mar 14 11:33:00 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 Mar 2007 11:33:00 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> Message-ID: <95be1d3b0703140333r288a85aese679863a9415c4db@mail.gmail.com> Hi all, Maybe I am off-track here, but I feel there is some level of confusion here, not everybody is talking about the same thing when saying "erlang". IMHO there are at least three separate things that may be the target: * the "lightweight isolated processes with message passing and monitoring" model (LIP) * any VM that implements the above model * any source level language that can be run on any of the VMs above In my mind, the above are orthogonal (or almost) and it may be important to specify which one is meant in a specific context. Most of the times it doesn't matter much, because there is only one VM (in current use) and only one language, but as it was pointed out before there are other groups that recognize the usefulness of the model and are beginning to have working implementations (see scala actors, for example). Personally, I think it is the model that is the most important part, as I don't really care how it is implemented or what language it is programmed in, as long as it works as advertised. I believe it was the same thing that Richard was aiming at with the question. In this light, what I see as a future path to take is to abstract away the "process managing machinery" from the actual "code running". Then we could have a world filled of "process containers" (the Erlang nodes of today) that would run on large and small CPUs and would run code implemented in pC, pJava, pRuby or even pINTERCAL (where the 'p' prefix is referring to a parallel extension of the respective language supporting the LIP model). Returning to the question at hand, it becomes then - can the LIP part be cleanly separated from the VM proper? (I believe it can) - if yes, how small could a minimal LIP implementation be? Then add the size of a Forth VM :-) best regards, Vlad From rod.gaither@REDACTED Wed Mar 14 12:34:03 2007 From: rod.gaither@REDACTED (Rod Gaither) Date: Wed, 14 Mar 2007 07:34:03 -0400 Subject: [erlang-questions] Santa likes Erlang better than Haskell In-Reply-To: References: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> <45F56DC4.7050304@it.uu.se> Message-ID: Hi, > Yesterday a colleague told me about a draft chapter (for a book called > "Beautiful code", editor by Greg Wilson) written by Simon Peyton Jones. > The chapter is about Software Transactional Memory in Haskell. > > You'll find it through http://lambda-the-ultimate.org/node/1964 > > Haskell solution: 77 SLOC. > Erlang solution: 46 SLOC. For those of us just starting to learn Erlang could you post your code sample or put it up somewhere we can go see it please? Thanks, Rod. -- Rod Gaither Oak Ridge, NC USA From erlang@REDACTED Wed Mar 14 12:51:22 2007 From: erlang@REDACTED (Erlang (INS)) Date: Wed, 14 Mar 2007 09:51:22 -0200 Subject: [erlang-questions] ODBC problem if query returns multiple tables In-Reply-To: <42ea5fb60703132144k2fcac16at72a87abcfaff5381@mail.gmail.com> Message-ID: <200703141251.l2ECpUi9024996@morgoth.cslab.ericsson.net> I have had the same problem sometime ago. Review the record type in each table; the supported ones by ODBC are (the listed in the C Erlang port source code): SQL_CHAR: SQL_VARCHAR: SQL_BINARY: SQL_LONGVARCHAR: SQL_VARBINARY: SQL_LONGVARBINARY: SQL_NUMERIC: SQL_DECIMAL: SQL_TINYINT: SQL_INTEGER: SQL_SMALLINT: SQL_REAL: SQL_FLOAT: SQL_DOUBLE: SQL_TYPE_DATE: SQL_TYPE_TIME: SQL_TYPE_TIMESTAMP: SQL_BIGINT: SQL_BIT: Hope this helps you. Regards, Eduardo _____ De: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] En nombre de Surindar Sivanesan Enviado el: Mi?rcoles, 14 de Marzo de 2007 02:45 a.m. Para: Scott Lystig Fritchie CC: Erlang Asunto: Re: [erlang-questions] ODBC problem if query returns multiple tables Thanks for the reply. I'm still facing the same problem even though I make the scrollable cursor option off. On 3/14/07, Scott Lystig Fritchie wrote: >>>>> "ss" == Surindar Sivanesan < surindar.shanthi@REDACTED > writes: ss> I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). ss> When I use that same SP in odbc:sql_query/2, it returns ss> {error,"Column type not supported"}. It has been a while since I've used the Erlang ODBC driver, but I have a faint memory that the "Column type not supported" can appear because of attempts to use scrollable cursors. Do you still see the error if you use this? {ok, DB} = odbc:connect(DSN_string, [{scrollable_cursors, off}]). -Scott _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Wed Mar 14 14:57:34 2007 From: james.hague@REDACTED (James Hague) Date: Wed, 14 Mar 2007 08:57:34 -0500 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: <518773.94247.qm@web38802.mail.mud.yahoo.com> <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> <45F7276A.4090909@telia.com> Message-ID: >When someone asks "how small could AN Erlang emulator be", >that means something quite different from "how small could THE Erlang >emulator be". There are a lot of possibilities here. One of the largest, most complex modules in the emulator is the one that turns generic BEAM code into a list of threaded superinstructions. Most of this could be moved out to the compiler, but it would lock various optimizations into the BEAM format itself. If you're wanting to reduce the raw size of the emulator, you could remove all support for these superinstructions (a.k.a. combined instructions) at the expense of performance. Another option is to rewrite the core of the emulator in assembly language for each processor (I'd write a custom mini-assembler in Erlang first). The advantage here is that you'd have tight control over register usage and subroutine calling mechanisms and could strip out unecessary fluff. This likely wouldn't reduce code size by that much, however. It would be interesting to try to keep the entire emulator in 16K or 32K so the whole thing fits in the instruction cache. Bjorn already suggested switching to 16-bit threaded code internally, which would cut the size of loaded BEAM files in half (as it stands, they get substantially inflated after loading). If you hand-crafted the emulator, this would be easy. My biggest concern would be memory management. Once you start thinking about small memory systems, ones without memory mapping hardware, then heap fragmentation becomes an issue. On the Playstation 2 projects I've worked on, there was no heap at all, because all 32MB was packed with data and critical buffers. From Martin.Logan@REDACTED Wed Mar 14 21:09:58 2007 From: Martin.Logan@REDACTED (Logan, Martin) Date: Wed, 14 Mar 2007 15:09:58 -0500 Subject: [erlang-questions] Blog: A first concurrency in Erlang In-Reply-To: <45F7C217.2060105@it.uu.se> References: <45F7C217.2060105@it.uu.se> Message-ID: <26AB42AB6A76E2419D26E66ECF153846010DC0D1@chiresexc02.resource.corp.lcl> The flood of new blood to Erlang when this book is officially released is going to be something unlike what we have ever seen before. This is going to make the wings phenomenon look small by comparison. Something is changing for Erlang, I can feel it in the wind... :) Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Richard Carlsson Sent: Wednesday, March 14, 2007 4:36 AM To: erlang-questions@REDACTED Subject: [erlang-questions] Blog: A first concurrency in Erlang Just found this on Reddit: http://matt.blogs.it/entries/00002513.html /Richard _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Wed Mar 14 22:16:53 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 14 Mar 2007 22:16:53 +0100 Subject: [erlang-questions] compile module from string, containing macro definitions In-Reply-To: <45F11124.6090305@ericsson.com> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> <45F11124.6090305@ericsson.com> Message-ID: <45F86645.40204@it.uu.se> Bengt Kleberg wrote: > inspired by string ports i have written a string_io module that allows > you to > > {ok, IO} = string_io:open( "a number: 10", [read, write]), > "a" = io:get_chars( IO, '', 1), > io:fwrite(IO, "-" ), > 10 = io:fread( IO, '', "number: ~d" ), > string_io:close( IO ). I wrote this (attached) module a few years back, and then more or less forgot about it again. It can work as a pipe, or just read from a string. It would be nice if something like it (or your own version) would make its way into the standard library. The code is not terribly well tested but I think it worked. Feel free to reuse the best parts. /Richard -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: iostream.erl URL: From ok@REDACTED Thu Mar 15 00:10:59 2007 From: ok@REDACTED (ok) Date: Thu, 15 Mar 2007 12:10:59 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <17911.50837.488174.792585@antilipe.corelatus.se> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> <17911.50837.488174.792585@antilipe.corelatus.se> Message-ID: <9FCD2E0E-2CF1-4886-8BE8-2AADF2CEF9CE@cs.otago.ac.nz> On 14 Mar 2007, at 10:55 pm, Matthias Lang wrote: > At the risk of guessing wrong, maybe you're thinking of Robert > Tj?rnstr?m and his ECOMP thingamibob. That's it. In 2001 it was "Almost Ready". All a web search can find since then is a trickle of "whatever happened" messages. It is sad that it apparently never came to fruition. If I want a free interesting processor design to look at, I've got to look at SPARC or OpenRISC 1200 instead. What's even sadder is how little information was ever published. I've never even seen an explanation of why work on ECOMP stopped (or even whether it did stop). From ok@REDACTED Thu Mar 15 00:14:40 2007 From: ok@REDACTED (ok) Date: Thu, 15 Mar 2007 12:14:40 +1300 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <95be1d3b0703140333r288a85aese679863a9415c4db@mail.gmail.com> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> <95be1d3b0703140333r288a85aese679863a9415c4db@mail.gmail.com> Message-ID: On 14 Mar 2007, at 11:33 pm, Vlad Dumitrescu wrote: > Personally, I think it is the model that is the most important part, > as I don't really care how it is implemented or what language it is > programmed in, as long as it works as advertised. I believe it was the > same thing that Richard was aiming at with the question. It isn't, but it should have been. Excellent point. > In this light, what I see as a future path to take is to abstract away > the "process managing machinery" from the actual "code running". Then > we could have a world filled of "process containers" (the Erlang nodes > of today) that would run on large and small CPUs and would run code > implemented in pC, pJava, pRuby or even pINTERCAL (where the 'p' > prefix is referring to a parallel extension of the respective language > supporting the LIP model). No, not pIntercal. (I never did manage to get my "Object-Oriented Intercal" paper published anywhere, but writing it taught me more about Intercal than I ever wanted to know.) The only thing worse would be pMalbolge. From andreasmk2@REDACTED Thu Mar 15 00:18:56 2007 From: andreasmk2@REDACTED (Andreas Bakurov) Date: Thu, 15 Mar 2007 01:18:56 +0200 Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes Message-ID: <45F882E0.8030306@gmail.com> I want to setup three erlang nodes on computers that connected via Internet. Secret cookie seems to be a very weak method for this configuration. Apart of "secret cookie" security mechanism is there something more advanced ? -------------- next part -------------- A non-text attachment was scrubbed... Name: andreasmk2.vcf Type: text/x-vcard Size: 121 bytes Desc: not available URL: From ulf@REDACTED Thu Mar 15 00:38:40 2007 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 15 Mar 2007 00:38:40 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <9FCD2E0E-2CF1-4886-8BE8-2AADF2CEF9CE@cs.otago.ac.nz> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> <17911.50837.488174.792585@antilipe.corelatus.se> <9FCD2E0E-2CF1-4886-8BE8-2AADF2CEF9CE@cs.otago.ac.nz> Message-ID: Den 2007-03-15 00:10:59 skrev ok : > > On 14 Mar 2007, at 10:55 pm, Matthias Lang wrote: > > > At the risk of guessing wrong, maybe you're thinking of Robert > > Tj?rnstr?m and his ECOMP thingamibob. > > That's it. In 2001 it was "Almost Ready". All a web search can find > since > then is a trickle of "whatever happened" messages. > > It is sad that it apparently never came to fruition. If I want a > free interesting > processor design to look at, I've got to look at SPARC or OpenRISC > 1200 instead. > What's even sadder is how little information was ever published. > I've never even > seen an explanation of why work on ECOMP stopped (or even whether it > did stop). It was put on ice, partly because Tj?rnstr?m was assigned other duties, and partly because we had difficulty finding a way to fit it into our products. After all, going from an FPGA prototype to an ASIC is a pretty expensive project. Ironically, the architectural changes needed in our products at the time would only have turned out well if ECOMP turned out as good as the prototypes suggested, and we'd have to do a large amount of work on faith. It would be possible to revive ECOMP and/or release it as Open Source, but Ericsson would have to be presented a very good reason to do so. I made a proposal a while ago to MARLOW (www.lowpower.org), suggesting that a low-power Erlang chip might be a good candidate for solving their apparent dilemma - needing an order-of-magnitude improvement in power efficiency in mobile devices, while at the same time managing the increasing complexity in software. In their roadmap, they discuss the problem that known techniques for reducing the power consumption in hardware are difficult to handle in software. Erlang would address the problem of software complexity, while embracing parallelism in hardware, and ECOMP should give an order of magnitude better power efficiency than running Erlang on a general purpose CPU. I thought the proposal was well received, but a firm commitment from Ericsson was asked for. It is possible that that could happen as a result of sufficient interest on the outside. The part of Ericsson that I work with has no interest in mobile devices, so I was basically just pitching the idea over the wall. (: BR, Ulf W -- Ulf Wiger From ok@REDACTED Thu Mar 15 01:01:16 2007 From: ok@REDACTED (ok) Date: Thu, 15 Mar 2007 13:01:16 +1300 Subject: [erlang-questions] Santa likes Erlang better than Haskell In-Reply-To: References: <35968.81.231.168.176.1173709860.squirrel@webmail.wiger.net> <45F56DC4.7050304@it.uu.se> Message-ID: On 15 Mar 2007, at 12:34 am, Rod Gaither wrote: > For those of us just starting to learn Erlang could you post your code > sample or put it up somewhere we can go see it please? http://www.cs.otago.ac.nz/staffpriv/ok/santa/index.htm I was hoping someone would ask (:-). I have tested the code, but it really would not be at all surprising if there were a mistake or two left. From Danesh.D@REDACTED Thu Mar 15 03:17:45 2007 From: Danesh.D@REDACTED (Danesh Daroui) Date: Thu, 15 Mar 2007 03:17:45 +0100 Subject: [erlang-questions] Semaphores Message-ID: <45F8ACC9.8060601@bredband.net> Hi all, I have seen (even posts in this mailing list) that there is a need to have Semaphores in Erlang and since Erlang offers concurrency, Semaphores can be useful in data sharing. I have implemented a method which enhances Erlang to support Semaphores. I am not sure if someone else has done something like this before, but anyway, this is my version. :) I would be glad to have your feedbacks. Cheers, Danesh -------------- next part -------------- A non-text attachment was scrubbed... Name: Erlang_semaphore.tar.gz Type: application/x-compressed Size: 2021 bytes Desc: not available URL: From ok@REDACTED Thu Mar 15 07:10:52 2007 From: ok@REDACTED (ok) Date: Thu, 15 Mar 2007 19:10:52 +1300 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8ACC9.8060601@bredband.net> References: <45F8ACC9.8060601@bredband.net> Message-ID: <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> On 15 Mar 2007, at 3:17 pm, Danesh Daroui wrote: > I have seen (even posts in this mailing list) that there is a need > to have Semaphores > in Erlang This is debatable. Semaphores are a rather dangerous and low level construction, and Erlang is not really supposed to be a dangerous and low level language. > and since Erlang offers concurrency, Semaphores can be useful in > data sharing. But for most purposes, Erlang *doesn't* share data. > I would be glad to have your feedbacks. feedback is a mass noun. Source files should be kept to a maximum width of 80 columns; the RETURN key is there for a reason and should be used often. Source code should be indented using your text editor's indentation features, NOT one tab per tab stop. 8-column indentations (what you get when you use the tab key) are eye-jarring. Just like the RETURN key, the space bar is there on your keyboard for a reason. It should be used between "words"; see the Ada Quality & Style Guidelines for some nearly excellent advice about this. Infix operators like -> are usually best treated as words, punctuation marks are usually best treated like punctuation marks in English. Unlike Smalltalk, which originated the practice because the Smalltalk character set didn't *have* any suitable character like "_", Erlang *does* have "_" and *does* allow it in multi_word_identifiers. (As, for that matter, does modern Smalltalk.) BaStudlyCapsIsNotVeryEasyToRead. Your new function would be better as new(Initial_Count) when is_integer(Initial_Count), Initial_Count >= 0 -> spawn(fun () -> semaphore_loop(Initial_Count) end). There are a number of really basic problems with semaphores. For one thing, unless you speak Dutch, 'p' and 'v' have no intrinsic meaning to you. (If I say that I think 'p' means 'passieren', that just shows you that my ignorance of Dutch is unbounded.) Even 'increment' and 'decrement' would be better names (whichever way around they go), or 'acquire'/'release'. One big problem is that it is too easy to forget to increment the counter again. Smalltalk handles this with 'aSemaphore critical: aBlock'; the Erlang equivalent would be critical(Semaphore, Fun) -> p(Semaphore), Answer = Fun(). v(Semaphore), Answer. BUT with extra stuff in there to catch exceptions, release the semaphore, and re-raise the exceptions. Eeek. Oh heck, I leave you to the abundant literature on semaphores to find out why semaphores have a bad name. There really isn't much point in writing case (SemValue>0) of true -> ~a~ false -> ~b~ end First, the parentheses are worse than useless here. Second, you really need spaces around the > because it is hard to see without them. Third, what's wrong with if Count > 0 -> ~a~ ; Count <= 0 -> ~b~ end making it completely obvious when each case applies? Above all, all you really want to do is this: semaphore_loop(Count) -> receive {acquire,Pid} when Count > 0 -> Pid!granted, semaphore_loop(Count - 1) ; release -> semaphore_loop(Count + 1) ; stop -> ok end. new(Initial_Count) when is_integer(Count), Count >= 0 -> spawn(fun () -> semaphore_loop(Initial_Count) end). acquire(Semaphore) -> Semaphore!{acquire,self()}. release(Semaphore) -> Semaphore!release. stop(Semaphore) -> Semaphore!stop. The next problem is to ensure that a semaphore can only be released by a process which had previously acquired it. Oh yes, lists:append([PID], WaitList) can be written more clearly as [PID] ++ WaitList and more clearly still as [PID | WaitList]. From csanto@REDACTED Thu Mar 15 07:45:21 2007 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 15 Mar 2007 07:45:21 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> Message-ID: <45F8EB81.8080404@diit.unict.it> ok wrote: > This is debatable. > Semaphores are a rather dangerous and low level construction, > and Erlang is not really supposed to be a dangerous and low level > language. Indeed the programming model of Erlang is strongly based on message passing, which can be an *alternative method* to semaphores for programming concurrent systems (see the Tanenbaum's book "Modern Operating Systems"). > But for most purposes, Erlang *doesn't* share data. Maybe someone reminds that, at the last EUC, the talk by Enzo Nicosia on programming robots with Erlang presented the possibility (or necessity) to have a *native support* for sharing simple data among processes. This was due to avoid the latency of message passing between processes that need/share the same information (this latency is dangerous for a real-time system). I would let you know that, in the software that we are writing for our next robot (see http://eurobot.diit.unict.it), we are trying to overcome latency problems without adding any data sharing support: the key point is to improve process dynamics and performances by rewriting a 'clone' of some OTP behaviours (gen_fsm and gen_server). The code of our behaviours is small and fast, it does dot feature *all the same* characteristics of gen_fsm/gen_server but only what we strict need for our robots. And till now it's working good! We will let you know the results ;-) --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From qrilka@REDACTED Thu Mar 15 07:56:00 2007 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 15 Mar 2007 09:56:00 +0300 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8EB81.8080404@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> Message-ID: <337538cb0703142356h2c685b70h16d8c4b138d239b9@mail.gmail.com> On 3/15/07, Corrado Santoro wrote: > > > > > But for most purposes, Erlang *doesn't* share data. > Maybe someone reminds that, at the last EUC, the talk by Enzo Nicosia on > programming robots with Erlang presented the possibility (or necessity) > to have a *native support* for sharing simple data among processes. This > was due to avoid the latency of message passing between processes that > need/share the same information (this latency is dangerous for a > real-time system). > > Doesn't hybrid memory model solve this problem? I thought that was the main goal of it. Best regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ft@REDACTED Thu Mar 15 08:37:52 2007 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 15 Mar 2007 08:37:52 +0100 Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes In-Reply-To: <45F882E0.8030306@gmail.com> References: <45F882E0.8030306@gmail.com> Message-ID: <45F8F7D0.1020806@it.su.se> Andreas Bakurov wrote: > I want to setup three erlang nodes on computers that connected via > Internet. Secret cookie seems to be a very weak method for this > configuration. > Apart of "secret cookie" security mechanism is there something more > advanced ? What sort of security are you looking for, or, asked another way : what's wrong with the shared secret mechanism? /Fredrik From ingela@REDACTED Thu Mar 15 09:21:42 2007 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 15 Mar 2007 09:21:42 +0100 Subject: [erlang-questions] ODBC problem if query returns multiple, tables In-Reply-To: References: Message-ID: <45F90216.2080808@erix.ericsson.se> > Dear all, > I'm using erlang 5.5 > It is more interesting which version of the odbc-application you are running!? You can do code:which(odbc) and the version number should apper in the path. ex: Eshell V5.5.3.1 (abort with ^G) 1> code:which(odbc). "/usr/local/otp/releases/otp_beam_solaris8_r11b_patched/lib/odbc-2.0.7/ebin/odbc.beam" 2> > I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). > When I use that same SP in odbc:sql_query/2, it returns {error,"Column type > not supported"}. > If I change the SP such that it will return only one table, the SP works > fine in odbc:sql_query/2. > >From this results, I concluded that, odbc:sql_query/2 does not support query > which returns multiple tables. > Am I right? Or, Is there any option available to make odbc:sql_query/2 to > work if the query returns multiple tables? > Please give your inputs. > Thanks in advance. > odbc:sql_query/2 supports multiple result sets since odbc version 2.0. Our test cases for this works fine but they may not be exhaustive. I would suggest you make sure you have the latest version 2.0.7 and if you still have a problem try to make a minimal failing case. Preferable by doing plain sql-queries separatred by ; Then send the failing test case to me and if it is a bug I will fix it. Regards Ingela From raimo+erlang-questions@REDACTED Thu Mar 15 09:31:44 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 15 Mar 2007 09:31:44 +0100 Subject: [erlang-questions] : compile module from string, containing macro definitions In-Reply-To: <45F86645.40204@it.uu.se> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> <45F11124.6090305@ericsson.com> <45F86645.40204@it.uu.se> Message-ID: <20070315083144.GA11949@erix.ericsson.se> Have you compared these with the undocumented ram_file. It seems to me at a first glance they do approximately the same job. On Wed, Mar 14, 2007 at 10:16:53PM +0100, Richard Carlsson wrote: > Bengt Kleberg wrote: > > inspired by string ports i have written a string_io module that allows > > you to > > > > {ok, IO} = string_io:open( "a number: 10", [read, write]), > > "a" = io:get_chars( IO, '', 1), > > io:fwrite(IO, "-" ), > > 10 = io:fread( IO, '', "number: ~d" ), > > string_io:close( IO ). > > I wrote this (attached) module a few years back, and then more or less > forgot about it again. It can work as a pipe, or just read from a > string. It would be nice if something like it (or your own version) > would make its way into the standard library. The code is not terribly > well tested but I think it worked. Feel free to reuse the best parts. > > /Richard > %% ===================================================================== > %% I/O streams/pipes in Erlang. > %% > %% Copyright (C) 2002 Richard Carlsson > %% > %% This library is free software; you can redistribute it and/or modify > %% it under the terms of the GNU Lesser General Public License as > %% published by the Free Software Foundation; either version 2 of the > %% License, or (at your option) any later version. > %% > %% This library is distributed in the hope that it will be useful, but > %% WITHOUT ANY WARRANTY; without even the implied warranty of > %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > %% Lesser General Public License for more details. > %% > %% You should have received a copy of the GNU Lesser General Public > %% License along with this library; if not, write to the Free Software > %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > %% USA > %% > %% Author contact: richardc@REDACTED > %% > %% --------------------------------------------------------------------- > > -module(iostream). > > -export([open/0, open/1, open_link/0, open_link/1, string/1, string/2, > close/1]). > > -compile(export_all). > > %% The default timeout is 'infinity', i.e., someone has to be > %% responsible for making the I/O stream process terminate when it is > %% not needed anymore. Typically, the reader does this. > > -define(DEF_TIMEOUT, 'infinity'). > > %% Creates a new I/O stream. Uses default timeout. > > open() -> > open(?DEF_TIMEOUT). > > %% Uses given timeout. T is milliseconds or 'infinity'. > > open(T) -> > {ok, spawn(fun () -> loop({buffer, buf__new()}, T) end)}. > > %% Like open/0, but also links stream process to creator process. > > open_link() -> > open_link(?DEF_TIMEOUT). > > %% Like open/1, but also links stream process to creator process. > > open_link(T) -> > {ok, spawn_link(fun () -> loop({buffer, buf__new()}, T) end)}. > > %% Creates a closed stream containing Chars. Uses default timeout. > > string(Chars) -> > string(Chars, ?DEF_TIMEOUT). > > %% Like string/1, but uses the given timeout. > > string(Chars, T) -> > spawn(fun () -> loop({buffer, buf__close(buf__new(Chars))}, T) end). > > %% Closes the stream. The stream process stays alive until the timeout. > > close(Pid) -> > Pid ! close, > ok. > > %% Terminates the stream process. > > kill(Pid) -> > Pid ! exit, > ok. > > %% ------------------------------------------------------------------ > %% This is the main server loop for the I/O stream process. > %% > %% The server has two states: buffering and transferring. In the > %% buffering state, written characters are simply queued up. If a read > %% request can be satisfied, the server returns to the buffering state > %% afterwards. The transfer state is entered if a read request needs > %% more input. Any writes will be passed directly to the reader, until > %% it is satisfied. Meanwhile, any additional read requests are queued. > %% When the last read request is satisfied, the process returns to the > %% buffering state. > %% > %% If there is no activity for the given 'timeout limit' period, the I/O > %% process terminates. By default the timeout is 'infinity'. > > 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); > exit -> > 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) -> > io:fwrite("Get until. ~p\n", [Buf]), > {Chars, Buf1} = buf__read(Buf), > case catch apply(Mod, Func, [Cont, Chars | Args]) of > {done, Result, Chars1} -> > io:fwrite("Done: ~p, ~p.\n", [Result, Chars1]), > {ok, Result, {buffer, buf__push(Chars1, Buf1)}}; > {more, Cont1} -> > io:fwrite("More: ~p.\n", [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. If there are chars over > %% when we have processed all queued read requests, these are pushed > %% back onto the buffer before returning. > > 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. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From surindar.shanthi@REDACTED Thu Mar 15 09:50:01 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Thu, 15 Mar 2007 14:20:01 +0530 Subject: [erlang-questions] ODBC problem if query returns multiple tables In-Reply-To: <45f7efd5.1e966bf2.0e9f.52c5SMTPIN_ADDED@mx.google.com> References: <42ea5fb60703132144k2fcac16at72a87abcfaff5381@mail.gmail.com> <45f7efd5.1e966bf2.0e9f.52c5SMTPIN_ADDED@mx.google.com> Message-ID: <42ea5fb60703150150y588205a9p8cf571f7ff92a8d5@mail.gmail.com> Thanks a lot for the detailed reply. I will check for the data type and proceed further On 3/14/07, Erlang (INS) wrote: > > I have had the same problem sometime ago. > > Review the record type in each table; the supported ones by ODBC are (the > listed in the C Erlang port source code): > > SQL_CHAR: > > SQL_VARCHAR: > > SQL_BINARY: > > SQL_LONGVARCHAR: > > SQL_VARBINARY: > > SQL_LONGVARBINARY: > > SQL_NUMERIC: > > SQL_DECIMAL: > > SQL_TINYINT: > > SQL_INTEGER: > > SQL_SMALLINT: > > SQL_REAL: > > SQL_FLOAT: > > SQL_DOUBLE: > > SQL_TYPE_DATE: > > SQL_TYPE_TIME: > > SQL_TYPE_TIMESTAMP: > > SQL_BIGINT: > > SQL_BIT: > > > > > > Hope this helps you. > > Regards, Eduardo > > > ------------------------------ > > *De:* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *En nombre de *Surindar Sivanesan > *Enviado el:* Mi?rcoles, 14 de Marzo de 2007 02:45 a.m. > *Para:* Scott Lystig Fritchie > *CC:* Erlang > *Asunto:* Re: [erlang-questions] ODBC problem if query returns multiple > tables > > > > Thanks for the reply. > > I'm still facing the same problem even though I make the scrollable cursor > option off. > > > > On 3/14/07, *Scott Lystig Fritchie* wrote: > > >>>>> "ss" == Surindar Sivanesan < surindar.shanthi@REDACTED> writes: > > ss> I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). > ss> When I use that same SP in odbc:sql_query/2, it returns > ss> {error,"Column type not supported"}. > > It has been a while since I've used the Erlang ODBC driver, but I have > a faint memory that the "Column type not supported" can appear because > of attempts to use scrollable cursors. Do you still see the error if > you use this? > > {ok, DB} = odbc:connect(DSN_string, [{scrollable_cursors, off}]). > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > -- > with regards, > S.Surindar > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From gordonguthrie@REDACTED Thu Mar 15 10:27:54 2007 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Thu, 15 Mar 2007 09:27:54 -0000 (GMT) Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes In-Reply-To: <45F882E0.8030306@gmail.com> References: <45F882E0.8030306@gmail.com> Message-ID: <3263.193.113.57.161.1173950874.squirrel@backawinner.gg> Andreas Happily we can now point you towards a discussion of this in the new Erlang book (well properly when it is published...) Joe discussed just this issue - you can buy a Beta PDF here: http://www.pragmaticprogrammer.com/titles/jaerlang/ Gordon PS Joe - just pop the usual referral fee in a charity box... > I want to setup three erlang nodes on computers that connected via > Internet. Secret cookie seems to be a very weak method for this > configuration. > Apart of "secret cookie" security mechanism is there something more > advanced ? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ulf.wiger@REDACTED Thu Mar 15 10:33:34 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 15 Mar 2007 10:33:34 +0100 Subject: [erlang-questions] : compile module from string, containing macro definitions In-Reply-To: <20070315083144.GA11949@erix.ericsson.se> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550164DEEB@esealmw115.eemea.ericsson.se> I maintain that the easiest way forward is to make a ram_file_io_server, based on file_io_server, and thus make the ram files capable of supporting normal file operations (not just 'raw' mode). It would also require a small change in epp. The only drawback with this suggestion, as I see it, is that OTP needs to do it. (: (Ok, another drawback is that it's not a good solution for parsing a byte stream, and one does need to copy the string into the ram file.) It doesn't preclude string ports or other approaches to doing similar things, but ram files are useful, and could be made even more so. BR, Ulf W Ok, here's a short demo of a ram_file_io_server module and a slightly modified epp.erl. It shows a ram file used as a normal file, and an epp that accepts being handed a file descriptor (it needs a name too). Eshell V5.5.3 (abort with ^G) 1> f(),{ok,Fd} = ram_file_io_server:start(self(),"test.erl",[read,write]). {ok,<0.44.0>} 2> {ok,Bin} = file:read_file("test.erl"). {ok,<<"-module(test).\n-export([f/1]).\n\n-define(X, x).\n\nf(Y) ->\n {?X, Y}.\n">>} 3> file:write(Fd,Bin). ok 4> file:position(Fd,0). {ok,0} 5> {ok,Epp} = epp:use_fd(Fd,"test.erl",[]). {ok,<0.49.0>} 6> epp:parse_erl_form(Epp). {ok,{attribute,1,file,{"test.erl",1}}} 7> epp:parse_erl_form(Epp). {ok,{attribute,1,module,test}} 8> epp:parse_erl_form(Epp). {ok,{attribute,2,export,[{f,1}]}} 9> epp:parse_erl_form(Epp). {ok,{function,6, f, 1, [{clause,6, [{var,6,'Y'}], [], [{tuple,7,[{atom,7,x},{var,7,'Y'}]}]}]}} 10> epp:parse_erl_form(Epp). {eof,8} 11> epp:close(Epp). ok 12> file:close(Fd). ok BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a $> diff ram_file_io_server.erl $OTP_ROOT/lib/kernel-2.10.11/src/file_io_server.erl 18c18 < -module(ram_file_io_server). --- > -module(file_io_server). 27c27 < -define(PRIM_FILE, ram_file). --- > -define(PRIM_FILE, prim_file). $> diff epp.erl $OTP_ROOT/lib/stdlib-1.13.10/src/epp.erl 23d22 < -export([use_fd/3,use_fd/4]). 29d27 < mode, % file or fd 60,68d57 < use_fd(Fd, File, Path) -> < use_fd(Fd, File, Path, []). < < use_fd(Fd, File, Path, Pdm) -> < Self = self(), < Epp = spawn(fun() -> server(Self, fd, Fd, File, Path, Pdm) end), < epp_request(Epp). < < 144,151d132 < case file:open(Name, [read]) of < {ok, File} -> < server(Pid, file, File, Name, Path, Pdm); < {error,E} -> < epp_reply(Pid, {error,E}) < end. < < server(Pid, Mode, Fd, Name, Path, Pdm) -> 153,161c134,147 < put(user_path, Path), < Ms0 = predef_macros(Name), < case user_predef(Pdm, Ms0) of < {ok,Ms1} -> < epp_reply(Pid, {ok,self()}), < St = #epp{file=Fd,mode=Mode,name=Name,macs=Ms1}, < From = wait_request(St), < enter_file_reply(From, Name, 1), < wait_req_scan(St); --- > case file:open(Name, read) of > {ok,File} -> > put(user_path, Path), > Ms0 = predef_macros(Name), > case user_predef(Pdm, Ms0) of > {ok,Ms1} -> > epp_reply(Pid, {ok,self()}), > St = #epp{file=File,name=Name,macs=Ms1}, > From = wait_request(St), > enter_file_reply(From, Name, 1), > wait_req_scan(St); > {error,E} -> > epp_reply(Pid, {error,E}) > end; 166,171d151 < file_close(fd, _) -> < %% let the user close the file (which may not even be a file) < ok; < file_close(file, Fd) -> < file:close(Fd). < 292c272 < file_close(St#epp.mode, St#epp.file), --- > file:close(St#epp.file), The change to epp.erl wasn't as big as the diff suggests. I reorganized the server() function slightly, and diff marked the whole block as changed. Obviously, corresponding changes are needed in file.erl, in order to recognize a 'normal' ram file. BR, Ulf W From r.salazard@REDACTED Thu Mar 15 11:48:40 2007 From: r.salazard@REDACTED (=?ISO-8859-1?Q?Salazard_R=E9my?=) Date: Thu, 15 Mar 2007 11:48:40 +0100 Subject: [erlang-questions] Residual indexes with mnesia Message-ID: <45F92488.1080907@meetic-corp.com> Hi, I have a problem with a mnesia table of type 'bag' with indexed fields. When I'm using mnesia:dirty_delete_object/2, sometimes the indexes are removed and sometimes not :( Here is a testcase module: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -module(test). -export([start/0]). -export([set/0, unset/0]). -record(mytbl, {one, two}). start() -> mnesia:create_schema([node()]), mnesia:start(), mnesia:create_table(mytbl, [{ram_copies, [node()]}, {attributes, record_info(fields, mytbl)}, {type, bag}]), mnesia:add_table_index(mytbl, two). set() -> add({1,1}), add({2,1}), add({2,2}), add({3,1}), add({4,1}), add({2,4}), add({3,2}), add({2,0}), ok. unset() -> del({1,1}), del({2,1}), del({2,2}), del({3,1}), del({4,1}), del({2,4}), del({3,2}), del({2,0}), ok. add({One, Two}) -> mnesia:dirty_write(#mytbl{one = One, two = Two}). del({One, Two}) -> mnesia:dirty_delete_object(mytbl, {mytbl, One, Two}). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% As you can see, there are only two fields and the second is indexed. 1> test:start(). %% two tables are created, 'mytbl' and the mnesia protected table 'mnesia_index' (its ets id is 43). 2> test:set(). %% 'mytbl' contains 8 records: 3> ets:i(mytbl). <1 > {mytbl,4,1} <2 > {mytbl,3,1} <3 > {mytbl,3,2} <4 > {mytbl,2,1} <5 > {mytbl,2,2} <6 > {mytbl,2,4} <7 > {mytbl,2,0} <8 > {mytbl,1,1} EOT (q)uit (p)Digits (k)ill /Regexp --> %% and 'mnesia_index' contains 8 records too: 4> ets:i(43). <1 > {0,2} <2 > {4,2} <3 > {2,2} <4 > {2,3} <5 > {1,1} <6 > {1,2} <7 > {1,3} <8 > {1,4} EOT (q)uit (p)Digits (k)ill /Regexp --> 5> test:unset(). 6> ets:i(mytbl). EOT (q)uit (p)Digits (k)ill /Regexp --> %% now 'mytbl' is empty, but... 7> ets:i(43). <1 > {4,2} <2 > {2,2} <3 > {1,2} <4 > {1,3} EOT (q)uit (p)Digits (k)ill /Regexp --> (notice that the residual indexes correspond to mytbl's records which had no unique first indexe.) Do I make a mistake or is it a bug? Thanks R?my From Danesh.D@REDACTED Thu Mar 15 13:14:25 2007 From: Danesh.D@REDACTED (Danesh Daroui) Date: Thu, 15 Mar 2007 13:14:25 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> Message-ID: <45F938A1.9080505@bredband.net> First thanks for your feedback. :) ok wrote: > On 15 Mar 2007, at 3:17 pm, Danesh Daroui wrote: > >> I have seen (even posts in this mailing list) that there is a need >> to have Semaphores >> in Erlang >> > > This is debatable. > Semaphores are a rather dangerous and low level construction, > and Erlang is not really supposed to be a dangerous and low level > language. > Well, it depends on. Sometimes semaphores can be a simple a good solution if they are used with care. But of course message passing is more advanced and general than semaphores. > >> and since Erlang offers concurrency, Semaphores can be useful in >> data sharing. >> > > But for most purposes, Erlang *doesn't* share data. > Sorry, I explained bad in my previous email. Semaphores can be used *not* only for sharing data but for other tasks, mainly synchronization. In my sample file you can find a sample for barrier synchronization using semaphores. > >> I would be glad to have your feedbacks. >> > > feedback is a mass noun. > Source files should be kept to a maximum width of 80 columns; > the RETURN key is there for a reason and should be used often. > Source code should be indented using your text editor's indentation > features, NOT one tab per tab stop. 8-column indentations (what you > get when you use the tab key) are eye-jarring. > > Just like the RETURN key, the space bar is there on your keyboard for > a reason. It should be used between "words"; see the Ada Quality & > Style > Guidelines for some nearly excellent advice about this. Infix operators > like -> are usually best treated as words, punctuation marks are usually > best treated like punctuation marks in English. > > Unlike Smalltalk, which originated the practice because the Smalltalk > character > set didn't *have* any suitable character like "_", Erlang *does* have > "_" and > *does* allow it in multi_word_identifiers. (As, for that matter, > does modern > Smalltalk.) BaStudlyCapsIsNotVeryEasyToRead. > > It seems that my style in code writing is very irritating. ;) I think you are right because my monitors have a high resolution so characters are shown very small and therefore lines are too long. I have had same problem before, so sorry about that. I also found the link for "Ada Quality & Style". I will read it as soon as I can. Thanks again. > Your new function would be better as > > new(Initial_Count) when is_integer(Initial_Count), Initial_Count > >= 0 -> > spawn(fun () -> semaphore_loop(Initial_Count) end). > > There are a number of really basic problems with semaphores. > > For one thing, unless you speak Dutch, 'p' and 'v' have no intrinsic > meaning > to you. (If I say that I think 'p' means 'passieren', that just > shows you that > my ignorance of Dutch is unbounded.) Even 'increment' and > 'decrement' would be > better names (whichever way around they go), or 'acquire'/'release'. > Frankly, the terms "p" and "v" are very famous, however it can be a little confusing because as you mentioned they are Dutch acronyms but semaphores are known by them now. So I think it is ok to still use them. But I agree, as you said "acquire" and "release" are more clear as Java used. > One big problem is that it is too easy to forget to increment the > counter again. > Smalltalk handles this with 'aSemaphore critical: aBlock'; the Erlang > equivalent > would be > critical(Semaphore, Fun) -> > p(Semaphore), > Answer = Fun(). > v(Semaphore), > Answer. > Yes you are right. Missing a "v" causes deadlock and missing a "p" causes livelock. Better alternative to avoid such problems in Monitor. So, they simply should be used with care. The solution I suggest is that Semaphores should not be used as a main solution to solve problems in concurrency. Better solutions like Message Passing and Monitors should be considered first and then in some places that seems to be easier and more efficient, Semaphores can be used. > BUT with extra stuff in there to catch exceptions, release the > semaphore, and > re-raise the exceptions. Eeek. > > Oh heck, I leave you to the abundant literature on semaphores to find > out why > semaphores have a bad name. > > There really isn't much point in writing > > case (SemValue>0) of > true -> ~a~ > false -> ~b~ > end > > First, the parentheses are worse than useless here. > Second, you really need spaces around the > because it is hard to see > without them. > Third, what's wrong with > > if Count > 0 -> > ~a~ > ; Count <= 0 -> > ~b~ > end > > I will consider that. Actually I used to remove extra spaces, but I think it is just readable to me and not others. :) > making it completely obvious when each case applies? > > Above all, all you really want to do is this: > > semaphore_loop(Count) -> > receive > {acquire,Pid} when Count > 0 -> > Pid!granted, > semaphore_loop(Count - 1) > ; release -> > semaphore_loop(Count + 1) > ; stop -> > ok > end. > > > new(Initial_Count) when is_integer(Count), Count >= 0 -> > spawn(fun () -> semaphore_loop(Initial_Count) end). > > acquire(Semaphore) -> > Semaphore!{acquire,self()}. > > release(Semaphore) -> > Semaphore!release. > > stop(Semaphore) -> > Semaphore!stop. > > The next problem is to ensure that a semaphore can only be released > by a process > which had previously acquired it. > > Oh yes, lists:append([PID], WaitList) > can be written more clearly as > [PID] ++ WaitList > and more clearly still as > [PID | WaitList]. > > > It was a great tip. I was looking for a shortcut to add an element to the list (like Haskell does) but I didn't find. But it is great your wrote. Thanks again. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From chsu79@REDACTED Thu Mar 15 13:42:02 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 15 Mar 2007 13:42:02 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F938A1.9080505@bredband.net> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F938A1.9080505@bredband.net> Message-ID: > > Well, it depends on. Sometimes semaphores can be a simple a good > solution if they are used with care. But of course message passing is > more advanced and general than semaphores. > I find message passing less advanced, I make fewer mistakes when using it. > > Sorry, I explained bad in my previous email. Semaphores can be used > *not* only for sharing data but for other tasks, mainly synchronization. > In my sample file you can find a sample for barrier synchronization > using semaphores. > Do you have any examples of tasks that you solve using your semaphores? From javierparis@REDACTED Thu Mar 15 13:57:45 2007 From: javierparis@REDACTED (Javier =?iso-8859-1?q?Par=EDs?=) Date: Thu, 15 Mar 2007 13:57:45 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8EB81.8080404@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> Message-ID: <200703151357.45870.javierparis@udc.es> El Jueves, 15 de Marzo de 2007 07:45, Corrado Santoro escribi?: > Maybe someone reminds that, at the last EUC, the talk by Enzo Nicosia on > programming robots with Erlang presented the possibility (or necessity) > to have a *native support* for sharing simple data among processes. This > was due to avoid the latency of message passing between processes that > need/share the same information (this latency is dangerous for a > real-time system). I am curious about this. Is the latency of sending a message so high that it affects a robot? It seems to be (from a quick non very reliable test :) more or less in the single digits microseconds. I do not think that using shared memory with semaphores would be much faster (if at all), but of course I have not made any measurements :) Regards. -- Javier Par?s From richardc@REDACTED Thu Mar 15 14:13:45 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 15 Mar 2007 14:13:45 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <200703151357.45870.javierparis@udc.es> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <200703151357.45870.javierparis@udc.es> Message-ID: <45F94689.2030007@it.uu.se> Javier Par?s wrote: > El Jueves, 15 de Marzo de 2007 07:45, Corrado Santoro escribi?: >> Maybe someone reminds that, at the last EUC, the talk by Enzo Nicosia on >> programming robots with Erlang presented the possibility (or necessity) >> to have a *native support* for sharing simple data among processes. This >> was due to avoid the latency of message passing between processes that >> need/share the same information (this latency is dangerous for a >> real-time system). > > I am curious about this. Is the latency of sending a message so high that > it affects a robot? It seems to be (from a quick non very reliable test :) > more or less in the single digits microseconds. > > I do not think that using shared memory with semaphores would be > much faster (if at all), but of course I have not made any measurements :) I believe that their latency problems were due to messages being passed through layers of processes, so that queueing and process scheduling affected the total end-to-end time. (But I could be wrong.) My guess is, anyway, that restructuring the program could have solved the problem. /Richard From Danesh.D@REDACTED Thu Mar 15 14:27:59 2007 From: Danesh.D@REDACTED (Danesh Daroui) Date: Thu, 15 Mar 2007 14:27:59 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F938A1.9080505@bredband.net> Message-ID: <45F949DF.9060406@bredband.net> Christian S wrote: >> >> Well, it depends on. Sometimes semaphores can be a simple a good >> solution if they are used with care. But of course message passing is >> more advanced and general than semaphores. >> > > I find message passing less advanced, I make fewer mistakes when using > it. > >> >> Sorry, I explained bad in my previous email. Semaphores can be used >> *not* only for sharing data but for other tasks, mainly synchronization. >> In my sample file you can find a sample for barrier synchronization >> using semaphores. >> > > Do you have any examples of tasks that you solve using your semaphores? > Sure. Please take a look at my previous post. The semaphore source file is attached. There is also a file which is "semaphore_test.erl". In this file you can find an example about how to use this semaphore module. Also in that file "Barrier Synchronization" problem has been solved using semaphores. "Barrier Synchronization" is used to synchronize some processes where they do not have same speed to reach a point. So faster processes who reach a point (when they are done with a task) should wait for slower processes and when slowest process is done, all will begin from that point again. There are many classic examples like "Dining Philosophers", "Producers and Consumers" etc. which have been solved by semaphores. But, please pay attention that I don't want to defend semaphores against other modern techniques like message passing and so on. There is no doubt that modern techniques are more practical and efficient, but I thought that there might be programmers and tasks that could be done even partly using semaphores, thats all. From Danesh.D@REDACTED Thu Mar 15 14:49:19 2007 From: Danesh.D@REDACTED (Danesh Daroui) Date: Thu, 15 Mar 2007 14:49:19 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8EB81.8080404@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> Message-ID: <45F94EDF.9060707@bredband.net> Corrado Santoro wrote: > ok wrote: > >> This is debatable. >> Semaphores are a rather dangerous and low level construction, >> and Erlang is not really supposed to be a dangerous and low level >> language. >> > Indeed the programming model of Erlang is strongly based on message > passing, which can be an *alternative method* to semaphores for > programming concurrent systems (see the Tanenbaum's book "Modern > Operating Systems"). > > > >> But for most purposes, Erlang *doesn't* share data. >> > Maybe someone reminds that, at the last EUC, the talk by Enzo Nicosia on > programming robots with Erlang presented the possibility (or necessity) > to have a *native support* for sharing simple data among processes. This > was due to avoid the latency of message passing between processes that > need/share the same information (this latency is dangerous for a > real-time system). > > I would let you know that, in the software that we are writing for our > next robot (see http://eurobot.diit.unict.it), we are trying to overcome > latency problems without adding any data sharing support: the key point > is to improve process dynamics and performances by rewriting a 'clone' > of some OTP behaviours (gen_fsm and gen_server). The code of our > behaviours is small and fast, it does dot feature *all the same* > characteristics of gen_fsm/gen_server but only what we strict need for > our robots. And till now it's working good! > > We will let you know the results ;-) > > --Corrado > > Its cool. I am interested to find out more about your solution. It seems that you have solved the problem using State Machines, but if you use a server to pass messages through it, it might be the reason that message passing is not fast enough as you expect. However, you said that the problem is solved, but defining a channel which is accessible by all processes to send their request (asynchronous or synchronous doesn't matter but synchronous needs its own simulation in Erlang) to one or more than one processes which handle requests. Each sender can also have its private channel to get the result. Anyway, I thought sending messages between processes (not in a distributes architecture) is fast enough to avoid such problems. Your task must be very critical. ;) From covracer@REDACTED Thu Mar 15 14:55:27 2007 From: covracer@REDACTED (Christopher Covington) Date: Thu, 15 Mar 2007 14:55:27 +0100 Subject: [erlang-questions] Fwd: Better Security Mechanism for Erlang Nodes In-Reply-To: References: <45F882E0.8030306@gmail.com> <3263.193.113.57.161.1173950874.squirrel@backawinner.gg> Message-ID: I've got no experience with networked Erlang nodes myself but a VPN or SSH tunneling should armor your connections pretty nicely. Chris On 3/15/07, Gordon Guthrie wrote: > Andreas > > Happily we can now point you towards a discussion of this in the new > Erlang book (well properly when it is published...) > > Joe discussed just this issue - you can buy a Beta PDF here: > http://www.pragmaticprogrammer.com/titles/jaerlang/ > > Gordon > > PS Joe - just pop the usual referral fee in a charity box... > > > I want to setup three erlang nodes on computers that connected via > > Internet. Secret cookie seems to be a very weak method for this > > configuration. > > Apart of "secret cookie" security mechanism is there something more > > advanced ? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From csanto@REDACTED Thu Mar 15 14:43:34 2007 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 15 Mar 2007 14:43:34 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F94689.2030007@it.uu.se> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <200703151357.45870.javierparis@udc.es> <45F94689.2030007@it.uu.se> Message-ID: <45F94D86.7080904@diit.unict.it> Richard Carlsson wrote: >>I am curious about this. Is the latency of sending a message so high that >>it affects a robot? It seems to be (from a quick non very reliable test :) >>more or less in the single digits microseconds. >> >>I do not think that using shared memory with semaphores would be >>much faster (if at all), but of course I have not made any measurements :) My first idea was to have some *native constructs* (BIFs) to allow sharing of erlang primitive data types (I'm not talking about "memory buffers"). Something like "put" and "get", but inter-process. So semaphores were internal things of the VM, not visible to Erlang programmers. > I believe that their latency problems were due to messages being passed > through layers of processes, so that queueing and process scheduling > affected the total end-to-end time. (But I could be wrong.) My guess is, > anyway, that restructuring the program could have solved the problem. Indeed this is the point! If you take a look at the code of gen_server or gen_fsm, you can notice that both make strong use of the "gen" and other modules. This is due to the fact that (I suppose) "gen" implements many "general purpose" routines that can be used by gen_fsm/gen_server behaviours. Undoubtedly, this implies a great overhead in the code. This is the reason why we decided to rebuild a "timed-fsm" behaviour, making it very light. We made some tests today: prompt response and good performances! --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From christophe.romain@REDACTED Thu Mar 15 15:25:46 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Thu, 15 Mar 2007 15:25:46 +0100 Subject: [erlang-questions] dependency on inets for string functions Message-ID: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> What can we say about common string functions ? commonly used functions which are implemented in several places: - to_upper: inets builder snmp ubf - to_lower: inets diggo ibrowse megaco www_tools yaws - to_uppercase: ic - to_lowerchar: yaws - encode_base64: inets ibrowse - decode_base64: inets yaws inets.http_util is by far the most used implementation. well, to_upper and to_lower are really string related functions encode_base64 and decode_base64 are MIME related functions modules depending on inets for functions listed above: ibrowse jabberlang orcas pico smtp_client stl tsung xmerl yxa Wouldn't it be nice to move that functions into stdlib.string ? From yan.guiborat@REDACTED Thu Mar 15 15:27:56 2007 From: yan.guiborat@REDACTED (netboz) Date: Thu, 15 Mar 2007 07:27:56 -0700 (PDT) Subject: [erlang-questions] Semaphores In-Reply-To: <45F8ACC9.8060601@bredband.net> References: <45F8ACC9.8060601@bredband.net> Message-ID: <9495619.post@talk.nabble.com> Hi, Christian, If you haven't already read it, there is an article from Joe Armstrong about your problem, may be it is the answer to your query: here is the link: http://armstrongonsoftware.blogspot.com/2006/09/pure-and-simple-transaction-memories.html hope this help. netboz. -- View this message in context: http://www.nabble.com/Semaphores-tf3406027.html#a9495619 Sent from the Erlang Questions mailing list archive at Nabble.com. From csanto@REDACTED Thu Mar 15 15:27:49 2007 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 15 Mar 2007 15:27:49 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F94EDF.9060707@bredband.net> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> Message-ID: <45F957E5.4070403@diit.unict.it> Danesh Daroui wrote: > Its cool. I am interested to find out more about your solution. Maybe at the next EUC ;-) > It seems > that you have solved the problem using State Machines, but if you use a > server to pass messages through it, it might be the reason that message > passing is not fast enough as you expect. However, you said that the > problem is solved, but defining a channel which is accessible by all > processes to send their request (asynchronous or synchronous doesn't > matter but synchronous needs its own simulation in Erlang) to one or > more than one processes which handle requests. Each sender can also have > its private channel to get the result. Anyway, I thought sending > messages between processes (not in a distributes architecture) is fast > enough to avoid such problems. Your task must be very critical. ;) They are not so critical, but an unexpected latency could cause e.g. a wrong navigation. For example, one task is to make the robot rotate of a given angle: we turn on the motors and then we "poll" reading the current orientation. This is made by means a couple of communicating processes (one for interacting with the motor controller and another to perform rotation control): if the latencies are too high, the robot could overcome the target and stop with a wrong orientation. In our current implementation, there are no unexpected latencies. But, we experienced these problems when we used OTP behaviours (gen_fsm, etc.). Please note that the robot is quite fast, so milliseconds are important. In any case, if we have time, we'll make some measurement in order to give some numerical quantities! --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From chsu79@REDACTED Thu Mar 15 16:54:42 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 15 Mar 2007 16:54:42 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F957E5.4070403@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> <45F957E5.4070403@diit.unict.it> Message-ID: Hi, as you have good insight to robot programming. I would like to query you about the language http://en.wikipedia.org/wiki/Esterel that I found interesting. To me it screams 'robot arm control!' since it can express FIR filters so eloquently for various automatic control problems and can compile down to a huge statemachine in c source to run quickly. The programming model is parallell finite state machines that emits signals and react to signals. It is reminiscent of erlang message passing, only different. I was imagining it as a component in robot programming, a high level erlang one that deals with mission, communicating and getting alerts from a lower level one in esterel that does automatic control for positioning limbs as desired. The lower level can run with a high priority to never miss a deadline. It can even run on a separate cpu or micro controller. Is this language (and the others in the same paradigm) discarded as useless eye-candy, or is it one of those gems waiting to be discovered? On 3/15/07, Corrado Santoro wrote: > > Danesh Daroui wrote: > > Its cool. I am interested to find out more about your solution. > Maybe at the next EUC ;-) > > > It seems > > that you have solved the problem using State Machines, but if you use a > > server to pass messages through it, it might be the reason that message > > passing is not fast enough as you expect. However, you said that the > > problem is solved, but defining a channel which is accessible by all > > processes to send their request (asynchronous or synchronous doesn't > > matter but synchronous needs its own simulation in Erlang) to one or > > more than one processes which handle requests. Each sender can also have > > its private channel to get the result. Anyway, I thought sending > > messages between processes (not in a distributes architecture) is fast > > enough to avoid such problems. Your task must be very critical. ;) > They are not so critical, but an unexpected latency could cause e.g. a > wrong navigation. For example, one task is to make the robot rotate of a > given angle: we turn on the motors and then we "poll" reading the > current orientation. This is made by means a couple of communicating > processes (one for interacting with the motor controller and another to > perform rotation control): if the latencies are too high, the robot > could overcome the target and stop with a wrong orientation. > > In our current implementation, there are no unexpected latencies. But, > we experienced these problems when we used OTP behaviours (gen_fsm, > etc.). Please note that the robot is quite fast, so milliseconds are > important. > > In any case, if we have time, we'll make some measurement in order to > give some numerical quantities! > > --Corrado > > -- > ================================================================== > Eng. Corrado Santoro, Ph.D. > University of Catania - ITALY - Engineering Faculty > > Tel: +39 095 7382380 VoIP: sip:7035@REDACTED > > Personal Home Page: http://www.diit.unict.it/users/csanto > NUXI Home Page: http://nuxi.diit.unict.it > ================================================================== > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jerith@REDACTED Thu Mar 15 18:43:28 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Thu, 15 Mar 2007 19:43:28 +0200 Subject: [erlang-questions] Simple chat server in Erlang Message-ID: <45F985C0.7080007@jerith.za.net> Good day all, I'm fairly new to Erlang, and am writing a MUD server to teach myself the language. So far, I have gotten as far as a simple chat server thing which I decided to write up as a tutorial since I couldn't find one pitched at an appropriate level. I would appreciate any comments on my code and/or style. Erlang's the first functional language I've done more than "hello world" in and I'd hate to find myself writing Java in it... http://www.jerith.za.net/writings/erlangsockettut.html Thanks, --J From vances@REDACTED Thu Mar 15 20:02:20 2007 From: vances@REDACTED (Vance Shipley) Date: Thu, 15 Mar 2007 14:02:20 -0500 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> <17911.50837.488174.792585@antilipe.corelatus.se> <9FCD2E0E-2CF1-4886-8BE8-2AADF2CEF9CE@cs.otago.ac.nz> Message-ID: <20070315190220.GB46087@frogman.motivity.ca> I recall that someone made the suggestion on this list that the Crusoe processor, being softwaree definable, could be turned into an Erlang processor. It's just software. :) -Vance From vances@REDACTED Thu Mar 15 20:36:20 2007 From: vances@REDACTED (Vance Shipley) Date: Thu, 15 Mar 2007 14:36:20 -0500 Subject: [erlang-questions] Semaphores In-Reply-To: <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> Message-ID: <20070315193620.GC46087@frogman.motivity.ca> On Thu, Mar 15, 2007 at 07:10:52PM +1300, ok wrote: } Source files should be kept to a maximum width of 80 columns; A number of years ago I would have whole heartedly agreed but no longer. A few years ago I did a project which used ASN.1 and it ended up having really long names which I did not have the luxury of choosing. It became impractical to use 80 column pages. I did all my work in 132 column windows for that project. I now find I really prefer working that way as I have plenty of glass these days. I wouldn't however unecessarily force others into it. } Source code should be indented using your text editor's indentation } features, NOT one tab per tab stop. 8-column indentations (what you } get when you use the tab key) are eye-jarring. That is just wrong. First of all tabs are whatever your tabstops are currently set to. I write all my code using tabs for indentation the beauty of which is that you can easily change the appearance to your personal taste (i.e. in vi: set ts=3). When you find the level of indentation is causing line wrapping just make the tabs a few less characters. My biggest complaint about emacs is it's quirky idea of indentation mixing tabs and spaces. I have never trusted an editor to decide when to indent 'cause we never agree all the time. But again it's a project by project decision. If I submit patches to the OTP group they will be coded with their style (quirky indentation and all). -Vance From toby@REDACTED Thu Mar 15 20:42:01 2007 From: toby@REDACTED (Toby Thain) Date: Thu, 15 Mar 2007 15:42:01 -0400 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: <20070315190220.GB46087@frogman.motivity.ca> References: <3B4DD594-CFFF-451E-941D-DB75C384558E@cs.otago.ac.nz> <45F73EBA.7020202@blueyonder.co.uk> <767F059C-2D40-40CD-88BC-576C64DF2EEF@cs.otago.ac.nz> <17911.50837.488174.792585@antilipe.corelatus.se> <9FCD2E0E-2CF1-4886-8BE8-2AADF2CEF9CE@cs.otago.ac.nz> <20070315190220.GB46087@frogman.motivity.ca> Message-ID: <2C160E5F-C67D-492C-A9E8-BDBC1A72A251@smartgames.ca> On 15-Mar-07, at 3:02 PM, Vance Shipley wrote: > I recall that someone made the suggestion on this list that > the Crusoe processor, being softwaree definable, could be > turned into an Erlang processor. It's just software. :) Or soft CPU on FPGA. --Toby > > -Vance > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From richardc@REDACTED Thu Mar 15 23:08:35 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 15 Mar 2007 23:08:35 +0100 Subject: [erlang-questions] : compile module from string, containing macro definitions In-Reply-To: <20070315083144.GA11949@erix.ericsson.se> References: <781dd98c0703071548l4941b1a7g82fba77ad4b73a2@mail.gmail.com> <45EFE8F5.1080104@ericsson.com> <781dd98c0703080938t678987f0xc2bb3ef6650dc70a@mail.gmail.com> <781dd98c0703081504m2d830953h5a59ea55c2571332@mail.gmail.com> <781dd98c0703081610x2b02273era1aecbd94d14876e@mail.gmail.com> <781dd98c0703081611wb07b9dbl1940f0d33e4cae20@mail.gmail.com> <45F0B5BE.9040708@telia.com> <45F11124.6090305@ericsson.com> <45F86645.40204@it.uu.se> <20070315083144.GA11949@erix.ericsson.se> Message-ID: <45F9C3E3.90402@it.uu.se> Raimo Niskanen wrote: > Have you compared these with the undocumented ram_file. > It seems to me at a first glance they do approximately > the same job. I wasn't aware of the ram_file module (is anyone supposed to be aware of it, and what is it mainly used for?), but to me, it looks at a first glance that they have little in common. My module uses no special driver, and can connect a reader and a writer as a pipe without having to store the entire file, or create a readable stream from a string; however, it does not support seeking. Since ram_file is not documented (not even in the code) it's a bit hard to see what it can and can't do. By the way, why just a ram_file, and not a full ram-disk file system? /Richard From robert.virding@REDACTED Thu Mar 15 23:28:35 2007 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 15 Mar 2007 23:28:35 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8ACC9.8060601@bredband.net> References: <45F8ACC9.8060601@bredband.net> Message-ID: <45F9C893.7020502@telia.com> Just some trivia. In the original Erlang book (not Joe's new one) there was a program example of an implementation of semaphores using message passing. The example was removed because it did not seem very useful to implement a basic feature using a more general one. I don't think you actually need to receive and keep a list of 'P' processes. It should work if you just don't receive them until the process which has the semaphore releases it, does a 'V'. Then receive the next 'P' and wait until it releases the semaphore. By adding processes to the list the way you do it, prepending them, means that they will be processed in the reverse order to which they seize the semaphore. This doesn't seem fair. Robert Danesh Daroui wrote: > Hi all, > > I have seen (even posts in this mailing list) that there is a need to > have Semaphores in Erlang and since Erlang offers concurrency, > Semaphores can be useful in data sharing. I have implemented a method > which enhances Erlang to support Semaphores. I am not sure if someone > else has done something like this before, but anyway, this is my > version. :) > > I would be glad to have your feedbacks. > > Cheers, > > Danesh > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From jeffm@REDACTED Fri Mar 16 03:53:07 2007 From: jeffm@REDACTED (jm) Date: Fri, 16 Mar 2007 13:53:07 +1100 Subject: [erlang-questions] profiling application Message-ID: <45FA0693.7010204@ghostgun.com> Can someone please point me to a tutorial on profiling applications in erlang. I have a small program which takes network usage as flow records, categories them, adds them to the exiting usage, and commits the changed record back into a mnesia database. To test it I fire a flow file at it using flow-cat in combination with flow-send. This process takes about 3 minutes to do without losing records - as determined in a previous test. During this and following it, unix top shows the beam process using the majority (80%+) of the CPU and the process size growing to about 200MB. After about 10 minutes the CPU and memory usage seem relatively unchanged. I have tried to add some optimisations such as summing the usage in memory and the commiting the changes on a periodic basis. Still more improvements should be possible though. So... a couple of questions, 1) How do I determine where the CPU and memory are going, ie where are the bottle necks? 2) Are there any gotchas with mnesia when using large fast data sets? thanks in advance, Jeff. From ok@REDACTED Fri Mar 16 05:25:29 2007 From: ok@REDACTED (ok) Date: Fri, 16 Mar 2007 17:25:29 +1300 Subject: [erlang-questions] Semaphores In-Reply-To: <45F8EB81.8080404@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> Message-ID: On 15 Mar 2007, at 7:45 pm, Corrado Santoro wrote: > Maybe someone reminds that, at the last EUC, the talk by Enzo > Nicosia on > programming robots with Erlang presented the possibility (or > necessity) > to have a *native support* for sharing simple data among processes. > This > was due to avoid the latency of message passing between processes that > need/share the same information (this latency is dangerous for a > real-time system). I didn't see that. Erlang has had shared binaries for a long time, and the hybrid heap provides other kinds of shared data. What Erlang does not have, and cannot have without completely destroying its simplicity of distribution, is shared *mutable* data. From ok@REDACTED Fri Mar 16 06:13:25 2007 From: ok@REDACTED (ok) Date: Fri, 16 Mar 2007 18:13:25 +1300 Subject: [erlang-questions] Semaphores In-Reply-To: <45F938A1.9080505@bredband.net> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F938A1.9080505@bredband.net> Message-ID: <7500E43A-B018-44F6-8449-D51145D7E2CD@cs.otago.ac.nz> On 16 Mar 2007, at 1:14 am, Danesh Daroui wrote: > Frankly, the terms "p" and "v" are very famous, however it can be a > little confusing because as you mentioned they are Dutch acronyms > but semaphores are known by them now. So I think it is ok to still > use them. But I agree, as you said "acquire" and "release" are more > clear as Java used. "p" and "v" are indeed famous. But it is telling that NONE of the programming languages or libraries I have ever used calls or called them that. To quote the Wikipedia "semaphore" entry: In English textbooks, and in the programming language ALGOL 68, the P and V operations are sometimes called, respectively, down and up. In software engineering practice they are called wait and signal, or take and release, or pend and post. For example, the POSIX names are sem_post(2) - unlock a semaphore sem_wait(2) - lock a semaphore, waiting until this can be done sem_trywait(2) - lock a semaphore if possible otherwise fail at once POSIX avoided "signal" for fear of confusion with the signal() function. I have known about "p" and "v" since, oh, 1975? I have *never* been able to remember which is which. >> Oh yes, lists:append([PID], WaitList) >> can be written more clearly as >> [PID] ++ WaitList >> and more clearly still as >> [PID | WaitList]. >> >> >> > It was a great tip. I was looking for a shortcut to add an element > to the list (like Haskell does) but I didn't find. But it is great > your wrote. Thanks again. I'm not quite sure what you mean here. Haskell Erlang [] [] [1,2,3,4,5] [1,2,3,4,5] (x : xs) [X | Xs] xs ++ ys Xs ++ Ys append xs ys lists:append(Xs, Ys) I think you'll find Joe's new book very helpful. From ok@REDACTED Fri Mar 16 06:21:33 2007 From: ok@REDACTED (ok) Date: Fri, 16 Mar 2007 18:21:33 +1300 Subject: [erlang-questions] Semaphores In-Reply-To: <45F949DF.9060406@bredband.net> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F938A1.9080505@bredband.net> <45F949DF.9060406@bredband.net> Message-ID: <837695C5-37DF-4738-BD5A-47E9A78E8C87@cs.otago.ac.nz> On 16 Mar 2007, at 2:27 am, Danesh Daroui wrote: > Also in that file "Barrier Synchronization" problem has been solved > using semaphores. Barriers are very easy to solve with message passing. So are the other examples you mention. The interesting question is not "are there problems that could be solved in Erlang using semaphores", but "are there problems that arise in 'natural' Erlang programming could be solved BETTER using semaphores". I note that a certain other programming language, designed over a period of decades with input from literally thousands of experts for embedded and concurrent programming, while it does have tasks and monitors (which it calls 'protected records') and some other concurrency stuff, does not have and never has had anything resembling a semaphore. I am, of course, referring to Ada 2005 and its predecessors Ada 95, Ada 83, Ada 81, and Ada 79. The big thing that Erlang is interested in is concurrency mechanisms which are reasonable to use across a network as well as within a single UNIX process. From csanto@REDACTED Thu Mar 15 20:18:17 2007 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 15 Mar 2007 20:18:17 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> <45F957E5.4070403@diit.unict.it> Message-ID: <45F99BF9.5090701@diit.unict.it> Hello, Christian S ha scritto: > Hi, as you have good insight to robot programming. I would like to > query you about the language http://en.wikipedia.org/wiki/Esterel > that I found interesting. To me it screams 'robot arm control!' since > it can express FIR filters so eloquently for various automatic control > problems and can compile down to a huge statemachine in c source to > run quickly. This seems very interesting! I save this link to make a deeper analysis in the immediate future. > Is this language (and the others in the same paradigm) discarded as > useless eye-candy, or is it one of those gems waiting to be > discovered? Interesting question.... any comment around? --Corrado From ulf@REDACTED Fri Mar 16 07:12:04 2007 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 16 Mar 2007 07:12:04 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45F99BF9.5090701@diit.unict.it> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> <45F957E5.4070403@diit.unict.it> <45F99BF9.5090701@diit.unict.it> Message-ID: Den 2007-03-15 20:18:17 skrev Corrado Santoro : > Hello, > > Christian S ha scritto: >> Hi, as you have good insight to robot programming. I would like to >> query you about the language http://en.wikipedia.org/wiki/Esterel >> that I found interesting. To me it screams 'robot arm control!' since >> it can express FIR filters so eloquently for various automatic control >> problems and can compile down to a huge statemachine in c source to >> run quickly. > This seems very interesting! I save this link to make a deeper analysis > in the immediate future. > > >> Is this language (and the others in the same paradigm) discarded as >> useless eye-candy, or is it one of those gems waiting to be >> discovered? > Interesting question.... any comment around? When I was in Munich at the FemSYS workshop 2001, I remember that there were several interesting talks about Esterel. I've been sampling it at sparse intervals since, but for the longest time, there didn't seem to be any significant "open" activity around it, but only fairly expensive for designing safety-critical systems. I did notice that the Esterel-language web page http://www-sop.inria.fr/meije/esterel/esterel-eng.html doesn't seem to have been updated since ca 2000. BR, Ulf W -- Ulf Wiger From bengt.kleberg@REDACTED Fri Mar 16 07:30:57 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 Mar 2007 07:30:57 +0100 Subject: [erlang-questions] profiling application In-Reply-To: <45FA0693.7010204@ghostgun.com> References: <45FA0693.7010204@ghostgun.com> Message-ID: <45FA39A1.7070606@ericsson.com> On 2007-03-16 03:53, jm wrote: > Can someone please point me to a tutorial on profiling applications in > erlang. look at the tools section of the manual. http://www.erlang.se/doc/doc-5.5/lib/tools-2.5/doc/html/index.html what you want is fprof. > > 1) How do I determine where the CPU and memory are going, ie where are > the bottle necks? the same section as above also has instrument another helpful module would be in observer http://www.erlang.se/doc/doc-5.5/lib/observer-0.9.7/doc/html/index.html and it is called etop. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From jeffm@REDACTED Fri Mar 16 07:55:42 2007 From: jeffm@REDACTED (jm) Date: Fri, 16 Mar 2007 17:55:42 +1100 Subject: [erlang-questions] profiling application In-Reply-To: <45FA39A1.7070606@ericsson.com> References: <45FA0693.7010204@ghostgun.com> <45FA39A1.7070606@ericsson.com> Message-ID: <45FA3F6E.6030205@ghostgun.com> Bengt Kleberg wrote: > On 2007-03-16 03:53, jm wrote: >> Can someone please point me to a tutorial on profiling applications in >> erlang. > > look at the tools section of the manual. > http://www.erlang.se/doc/doc-5.5/lib/tools-2.5/doc/html/index.html > what you want is fprof. > I looked in the tools section of the manual and was left scratching my head. I even found fprof and dug up an example, but when I followed the example I only got numbers for some functions and didn't see any entries for the ones I know are where most of the functionality resides. It may have something to do with the processes being started through application:start/1 though. >> 1) How do I determine where the CPU and memory are going, ie where are >> the bottle necks? > > the same section as above also has > instrument > > another helpful module would be in observer > http://www.erlang.se/doc/doc-5.5/lib/observer-0.9.7/doc/html/index.html > and it is called etop. Ah, this rings a bell I think I may have seen this mentioned before. I'll take a look at this now. Jeff. From fritchie@REDACTED Fri Mar 16 08:18:23 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 16 Mar 2007 02:18:23 -0500 Subject: [erlang-questions] SNMP app questions: ?StorageType_volatile, Mnesia storage in general Message-ID: <200703160718.l2G7INFN020848@snookles.snookles.com> Hi, I've been playing quite a bit with the OTP SNMP app. It's quite a nifty pice of work. But I'm still (uncomfortably) a blind man patting the elephant, trying to discover its shape. So perhaps my questions are silly, my apologies in advance. 1. I've been using Unbrowse 1.5(*) to test my SNMP v3 agent application. a. Create a group with Unbrowse b. Stop the SNMP agent application c. Start the SNMP agent application ... but after the restart, my new group is gone. If I capture the packet SNMP SET datagram, I see that my client is requesting StorageType... Hm, I don't really grok how to decode these things ... I have an annotated "wireshark" output below (see the "SLF" marks) ... it looks like the Unbrowse client is *not* sending anything for the "vacmAccessStorageType" attribute. But diving into the guts of snmpa_vacm.erl, when the agent restarts, it reads the contents of {db_dir}/snmpa_vacm.db, finds the entry for my new group, but then ignores it because it's a volatile type, ?'StorageType_volatile'. Is this a feature? Perhaps the Unbrowse app is silly/broken for not specifying a value for "vacmAccessStorageType", but this behavior really is confusing. It doesn't appear to be configurable, so I may have to hack code to change it. 2. Why does the SNMP app use local dets storage so frequently (with no config option to use Mnesia? And why does the snmpa_vacm table use ets:tab2file() instead of Mnesia or event dets? It would seem to me advantageous from a high-availability point-of-view to have all that stuff in Mnesia. If Node A fails, how is the SNMP app on node B going to look at all that dets and tab2file stuff over on node A? -Scott (*) Ask Mr. Google about it. It's a Windows SNMP app that claims to manipulate SNMP v3 servers, including adding/modifying/deleting SNMP v3 users, groups, and views. I found it because some search engine told me it might be good for something. {shrug} --- snip --- snip --- snip --- snip --- snip --- snip --- No. Time Source Destination Protocol Info 3 0.109612 10.1.1.253 10.1.1.12 SNMP set-request Frame 3 (239 bytes on wire, 239 bytes captured) Linux cooked capture Internet Protocol, Src: 10.1.1.253 (10.1.1.253), Dst: 10.1.1.12 (10.1.1.12) User Datagram Protocol, Src Port: 4968 (4968), Dst Port: 4000 (4000) Source port: 4968 (4968) Destination port: 4000 (4000) Length: 203 Checksum: 0xf844 [correct] Simple Network Management Protocol msgVersion: snmpv3 (3) msgGlobalData msgAuthoritativeEngineID: 656E67696E656130 0... .... = Engine ID Conformance: RFC1910 (Non-SNMPv3) Engine Enterprise ID: Unknown (1701734249) msgAuthoritativeEngineBoots: 10 msgAuthoritativeEngineTime: 376 msgUserName: foouser msgAuthenticationParameters: 2546C72089B42A036498DCDC msgData: plaintext (0) plaintext contextEngineID: 656E67696E656130 data: set-request (3) set-request request-id: 28497 error-status: noError (0) error-index: 0 variable-bindings: 3 items Item name: 1.3.6.1.6.3.16.1.4.1.5 <-- SLF: vacmAccessReadViewName? name: 1.3.6.1.6.3.16.1.4.1.5.9.98.108.97.114.98.108.97.114.51.0.0.1 (SNMPv2-SMI::snmpModules.16.1.4.1.5.9.98.108.97.114.98.108.97.114.51.0.0.1) valueType: value (0) value: simple (4294967295) simple: string-value (1) Value: STRING: "blar2view" Item name: 1.3.6.1.6.3.16.1.4.1.4 <-- SLF: vacmAccessContextMatch? name: 1.3.6.1.6.3.16.1.4.1.4.9.98.108.97.114.98.108.97.114.51.0.0.1 (SNMPv2-SMI::snmpModules.16.1.4.1.4.9.98.108.97.114.98.108.97.114.51.0.0.1) valueType: value (0) value: simple (4294967295) simple: integer-value (0) Value: INTEGER: 1 Item name: 1.3.6.1.6.3.16.1.4.1.9 <-- SLF: vacmAccessStatus? name: 1.3.6.1.6.3.16.1.4.1.9.9.98.108.97.114.98.108.97.114.51.0.0.1 (SNMPv2-SMI::snmpModules.16.1.4.1.9.9.98.108.97.114.98.108.97.114.51.0.0.1) valueType: value (0) value: simple (4294967295) simple: integer-value (0) Value: INTEGER: 4 From surindar.shanthi@REDACTED Fri Mar 16 08:42:20 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 16 Mar 2007 13:12:20 +0530 Subject: [erlang-questions] ODBC problem if query returns multiple tables In-Reply-To: <42ea5fb60703150150y588205a9p8cf571f7ff92a8d5@mail.gmail.com> References: <42ea5fb60703132144k2fcac16at72a87abcfaff5381@mail.gmail.com> <45f7efd5.1e966bf2.0e9f.52c5SMTPIN_ADDED@mx.google.com> <42ea5fb60703150150y588205a9p8cf571f7ff92a8d5@mail.gmail.com> Message-ID: <42ea5fb60703160042s3697f1edk4e7b8342827d7b68@mail.gmail.com> Dear all, I have confirmed that, the "Column type not supported" problem is not due to returning of multiple tables. Some of the fields returned in the table are not supported by the erlang odbc server. In my case 'nvarchar' type is not supported by the erlang odbc server. My special thanks to Eduardo for his suggestion to sort out the problem. Also my thanks to all forum members for their inputs. On 3/15/07, Surindar Sivanesan wrote: > > Thanks a lot for the detailed reply. > I will check for the data type and proceed further > > > On 3/14/07, Erlang (INS) wrote: > > > > I have had the same problem sometime ago. > > > > Review the record type in each table; the supported ones by ODBC are > > (the listed in the C Erlang port source code): > > > > SQL_CHAR: > > > > SQL_VARCHAR: > > > > SQL_BINARY: > > > > SQL_LONGVARCHAR: > > > > SQL_VARBINARY: > > > > SQL_LONGVARBINARY: > > > > SQL_NUMERIC: > > > > SQL_DECIMAL: > > > > SQL_TINYINT: > > > > SQL_INTEGER: > > > > SQL_SMALLINT: > > > > SQL_REAL: > > > > SQL_FLOAT: > > > > SQL_DOUBLE: > > > > SQL_TYPE_DATE: > > > > SQL_TYPE_TIME: > > > > SQL_TYPE_TIMESTAMP: > > > > SQL_BIGINT: > > > > SQL_BIT: > > > > > > > > > > > > Hope this helps you. > > > > Regards, Eduardo > > > > > > ------------------------------ > > > > *De:* erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] > > *En nombre de *Surindar Sivanesan > > *Enviado el:* Mi?rcoles, 14 de Marzo de 2007 02:45 a.m . > > *Para:* Scott Lystig Fritchie > > *CC:* Erlang > > *Asunto:* Re: [erlang-questions] ODBC problem if query returns multiple > > tables > > > > > > > > Thanks for the reply. > > > > I'm still facing the same problem even though I make the scrollable > > cursor option off. > > > > > > > > On 3/14/07, *Scott Lystig Fritchie* < fritchie@REDACTED> wrote: > > > > >>>>> "ss" == Surindar Sivanesan < surindar.shanthi@REDACTED> writes: > > > > ss> I'm having a Store Procedure (SP) which returns 8 tables (MS Sql). > > ss> When I use that same SP in odbc:sql_query/2, it returns > > ss> {error,"Column type not supported"}. > > > > It has been a while since I've used the Erlang ODBC driver, but I have > > a faint memory that the "Column type not supported" can appear because > > of attempts to use scrollable cursors. Do you still see the error if > > you use this? > > > > {ok, DB} = odbc:connect(DSN_string, [{scrollable_cursors, off}]). > > > > -Scott > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > -- > > with regards, > > S.Surindar > > > > > > -- > with regards, > S.Surindar -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbj@REDACTED Fri Mar 16 08:58:57 2007 From: mbj@REDACTED (Martin Bjorklund) Date: Fri, 16 Mar 2007 08:58:57 +0100 (CET) Subject: [erlang-questions] SNMP app questions: ?StorageType_volatile, Mnesia storage in general In-Reply-To: <200703160718.l2G7INFN020848@snookles.snookles.com> References: <200703160718.l2G7INFN020848@snookles.snookles.com> Message-ID: <20070316.085857.121036238.mbj@tail-f.com> Scott Lystig Fritchie wrote: > Hi, I've been playing quite a bit with the OTP SNMP app. It's quite a > nifty pice of work. But I'm still (uncomfortably) a blind man patting > the elephant, trying to discover its shape. So perhaps my questions > are silly, my apologies in advance. > > 1. I've been using Unbrowse 1.5(*) to test my SNMP v3 agent > application. > > a. Create a group with Unbrowse > b. Stop the SNMP agent application > c. Start the SNMP agent application > > ... but after the restart, my new group is gone. If I capture the > packet SNMP SET datagram, I see that my client is requesting > StorageType... > > Hm, I don't really grok how to decode these things ... I have an > annotated "wireshark" output below (see the "SLF" marks) ... it looks > like the Unbrowse client is *not* sending anything for the > "vacmAccessStorageType" attribute. > > But diving into the guts of snmpa_vacm.erl, when the agent restarts, > it reads the contents of {db_dir}/snmpa_vacm.db, finds the entry for > my new group, but then ignores it because it's a volatile type, > ?'StorageType_volatile'. > > Is this a feature? Perhaps the Unbrowse app is silly/broken for not > specifying a value for "vacmAccessStorageType", but this behavior > really is confusing. It doesn't appear to be configurable, so I may > have to hack code to change it. The agent is supposed to use the DEFVAL in the MIB if the manager doesn't set the value. The DEFVAL in this case is 'nonVolatile', so it should be kept by the agent. Looking at the code in snmp_view_based_acm_mib.erl, it turns out that the function mk_row/1 contains the bug: mk_row(Cols) -> ch_row(Cols, {noinit, "", "", "", ?'StorageType_volatile', noinit}). ^^^^^^^^^^^^^^^^^^^^^^^ should be ?'StorageType_nonVolatile' > 2. Why does the SNMP app use local dets storage so frequently (with no > config option to use Mnesia? And why does the snmpa_vacm table use > ets:tab2file() instead of Mnesia or event dets? The simple answer is that this app was written before Mnesia. It should really be modified so that it is simple(r) to use any other db module, not just mnesia. When I have used it in Real Products, I have always modified the code to fit into whatever db we have had. I haven't done this generic b/c it would require a larger rewrite. /martin From jeffm@REDACTED Fri Mar 16 09:06:29 2007 From: jeffm@REDACTED (jm) Date: Fri, 16 Mar 2007 19:06:29 +1100 Subject: [erlang-questions] profiling application In-Reply-To: <45FA3F6E.6030205@ghostgun.com> References: <45FA0693.7010204@ghostgun.com> <45FA39A1.7070606@ericsson.com> <45FA3F6E.6030205@ghostgun.com> Message-ID: <45FA5005.8080608@ghostgun.com> jm wrote: > Bengt Kleberg wrote: >> On 2007-03-16 03:53, jm wrote: >>> Can someone please point me to a tutorial on profiling applications in >>> erlang. >> look at the tools section of the manual. >> http://www.erlang.se/doc/doc-5.5/lib/tools-2.5/doc/html/index.html >> what you want is fprof. >> > > I looked in the tools section of the manual and was left scratching my > head. I even found fprof and dug up an example, but when I followed the > example I only got numbers for some functions and didn't see any entries > for the ones I know are where most of the functionality resides. It may > have something to do with the processes being started through > application:start/1 though. > >>> 1) How do I determine where the CPU and memory are going, ie where are >>> the bottle necks? >> the same section as above also has >> instrument >> >> another helpful module would be in observer >> http://www.erlang.se/doc/doc-5.5/lib/observer-0.9.7/doc/html/index.html >> and it is called etop. > > Ah, this rings a bell I think I may have seen this mentioned before. > I'll take a look at this now. > Running etop thusly erl -sname etop -s etop -output text -lines 33 -node one@REDACTED on the same machine as the node of interest I keep getting: Erlang top dropped data 1922 Erlang top dropped data 1149 Erlang top dropped data 1147 Erlang top dropped data 966 Erlang top dropped data 1149 Erlang top dropped data 965 Erlang top dropped data 1149 Erlang top dropped data 966 Erlang top dropped data 1148 Thoughts? Jeff. From xpdoka@REDACTED Fri Mar 16 10:21:11 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Fri, 16 Mar 2007 10:21:11 +0100 (CET) Subject: [erlang-questions] profiling application In-Reply-To: <45FA5005.8080608@ghostgun.com> References: <45FA0693.7010204@ghostgun.com> <45FA39A1.7070606@ericsson.com> <45FA3F6E.6030205@ghostgun.com> <45FA5005.8080608@ghostgun.com> Message-ID: <38110.217.128.75.198.1174036871.squirrel@www.geekisp.com> Hi Jeff, > erl -sname etop -s etop -output text -lines 33 -node one@REDACTED Have you tried running the ./priv/bin/etop program (in the observer application of the erlang distribution) ? Regards, Dominic Williams http://www.dominicwilliams.net ---- From dmitriid@REDACTED Fri Mar 16 10:16:29 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Fri, 16 Mar 2007 11:16:29 +0200 Subject: [erlang-questions] Simple chat server in Erlang In-Reply-To: <45F985C0.7080007@jerith.za.net> References: <45F985C0.7080007@jerith.za.net> Message-ID: <45FA606D.5080102@gmail.com> That's one heck of a self-teaching course :)) I liked the tutorial. Hopefully, you'll document your further progress as well :) Jeremy Thurgood wrote: > Good day all, > > I'm fairly new to Erlang, and am writing a MUD server to teach myself > the language. So far, I have gotten as far as a simple chat server > thing which I decided to write up as a tutorial since I couldn't find > one pitched at an appropriate level. > > I would appreciate any comments on my code and/or style. Erlang's the > first functional language I've done more than "hello world" in and I'd > hate to find myself writing Java in it... > > http://www.jerith.za.net/writings/erlangsockettut.html > > Thanks, > --J > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From jerith@REDACTED Fri Mar 16 10:24:51 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Fri, 16 Mar 2007 11:24:51 +0200 Subject: [erlang-questions] Simple chat server in Erlang In-Reply-To: <45FA606D.5080102@gmail.com> References: <45F985C0.7080007@jerith.za.net> <45FA606D.5080102@gmail.com> Message-ID: <45FA6263.5000207@jerith.za.net> Dmitrii 'Mamut' Dimandt wrote: > That's one heck of a self-teaching course :)) > > I liked the tutorial. Hopefully, you'll document your further progress > as well :) I intend to, just as soon as I get some more time to work on it. Thanks for the comment. --J From lemenkov@REDACTED Fri Mar 16 11:55:47 2007 From: lemenkov@REDACTED (Peter Lemenkov) Date: Fri, 16 Mar 2007 13:55:47 +0300 Subject: [erlang-questions] Tail recursion and memory leak Message-ID: Hello All! I write simple example of tail recursion: ================== -module(test). -export([go/0]). go () -> case gen_udp:open(3456) of {ok, Fd} -> select_calls(Fd,0), gen_udp:close(Fd); Error -> io:format("Error creating socket\n", []), exit(Error) end. select_calls(Fd,NumberOfCalls) -> io:format("Call number ~w~n~n",[NumberOfCalls]), send_msg (Fd,"Caller","Called","UserName","SessionID","TagTo","TagFrom","Routeto"), send_msg (Fd,"Called","Caller","UserName","SessionID","TagFrom","TagTo","RouteFrom"), select_calls(Fd,NumberOfCalls+1). send_msg (Fd,Caller,Called,UserName,SessionID,TagTo,TagFrom,Route) -> ok = gen_udp:send(Fd,"127.0.0.1",5060, "Hello All\n\r"). ================== No memory leaks - all worked as I want. However then I try to change function send_msg to something more valuable, for example: ================== Msg = lists:append([ "BYE sip:127.0.0.1:5060 SIP/2.0 \r\n", "Via: SIP/2.0/UDP 127.0.0.1:3456\r\n", "From: <", Caller, ">;tag=", TagFrom, "\r\n", "To: <", Called, ">;tag=", TagTo, "\r\n", "Call-ID: ", SessionID, "\r\n", "User-Agent: My User Agent\r\n", "CSeq: 123 BYE\r\n", "Route: <", Route, ">\r\n", "Content-Length: 0\r\n", "\r\n"]), % io:format("~s~n", [Msg]). ok = gen_udp:send(Fd,"127.0.0.1",5060, [Msg]). ================== I've got a huge memory consumption. Looks like I missed something important about string manipulating but I can't find out what exactly. Can anyone explain me what I'm doing wrong? -- With best regards! From chsu79@REDACTED Fri Mar 16 12:52:28 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 16 Mar 2007 12:52:28 +0100 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: Is your cpu going to 100% as well? The code you describe doesnt have any case where it waits, it will just loop and loop sending packets. Your secondary send_msg seem to cons memory a bit faster than the first one. But they both will likely reach the same memory usage if they run long time enough. You dont need to call lists:append, gen_udp:send will behave as if it calls erlang:iolist_to_binary/1. In fact, we call them iolists because most io functions behaves this way. From adam@REDACTED Fri Mar 16 12:53:56 2007 From: adam@REDACTED (Adam Lindberg) Date: Fri, 16 Mar 2007 12:53:56 +0100 Subject: [erlang-questions] Simple chat server in Erlang In-Reply-To: <45FA6263.5000207@jerith.za.net> References: <45F985C0.7080007@jerith.za.net> <45FA606D.5080102@gmail.com> <45FA6263.5000207@jerith.za.net> Message-ID: <6344005f0703160453v2b7c9191u372dbeb4c661ec9d@mail.gmail.com> Really good one! Bookmarked! Cheers Adam On 3/16/07, Jeremy Thurgood wrote: > Dmitrii 'Mamut' Dimandt wrote: > > That's one heck of a self-teaching course :)) > > > > I liked the tutorial. Hopefully, you'll document your further progress > > as well :) > > I intend to, just as soon as I get some more time to work on it. Thanks > for the comment. > > --J > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lemenkov@REDACTED Fri Mar 16 13:04:54 2007 From: lemenkov@REDACTED (Peter Lemenkov) Date: Fri, 16 Mar 2007 15:04:54 +0300 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: 2007/3/16, Christian S : > You dont need to call lists:append, gen_udp:send will behave as if it > calls erlang:iolist_to_binary/1. In fact, we call them iolists because > most io functions behaves this way. OK, I changed send_message a little: =========================== send_msg (Fd,Caller,Called,UserName,SessionID,TagTo,TagFrom,Route) -> ok = gen_udp:send(Fd,"127.0.0.1",5060, "BYE sip:127.0.0.1:5060 SIP/2.0 \r\n" "Via: SIP/2.0/UDP 127.0.0.1:3456\r\n" "From: <" ++ Caller ++ ">;tag=" ++ TagFrom ++ "\r\n" "To: <" ++ Called ++ ">;tag=" ++ TagTo ++ "\r\n" "Call-ID: " ++ SessionID ++ "\r\n" "User-Agent: MyApp\r\n" "CSeq: 123 BYE\r\n" "Route: <" ++ Route ++ ">\r\n" "Content-Length: 0\r\n" "\r\n"). =========================== Memory is still consumes until the system completely runs out of mem. According to the top utility: 19705 root 15 0 30924 10m 1852 S 3 0.5 0:00.24 beam 19705 root 15 0 29900 9m 1852 S 0 0.5 0:00.24 beam 19705 root 16 0 46928 22m 1856 S 10 1.1 0:00.53 beam 19705 root 18 0 99.7m 61m 1856 S 98 3.0 0:03.48 beam 19705 root 25 0 150m 125m 1856 S 98 6.3 0:06.41 beam 19705 root 25 0 129m 92m 1856 R 94 4.6 0:09.24 beam 19705 root 25 0 118m 91m 1856 R 93 4.5 0:12.04 beam 19705 root 25 0 129m 106m 1856 R 96 5.3 0:14.92 beam 19705 root 25 0 195m 121m 1856 R 91 6.1 0:17.66 beam 19705 root 25 0 207m 136m 1856 R 91 6.8 0:20.41 beam 19705 root 19 0 176m 133m 1856 S 93 6.7 0:23.21 beam 19705 root 25 0 166m 132m 1856 S 95 6.6 0:26.06 beam 19705 root 19 0 166m 138m 1856 R 93 6.9 0:28.85 beam 19705 root 25 0 172m 147m 1856 R 94 7.3 0:31.69 beam 19705 root 25 0 189m 152m 1856 R 94 7.6 0:34.52 beam 19705 root 21 0 180m 155m 1856 R 93 7.7 0:37.33 beam 19705 root 25 0 398m 300m 1856 R 91 14.9 0:40.08 beam 19705 root 25 0 249m 164m 1856 R 95 8.2 0:42.95 beam 19705 root 25 0 257m 163m 1856 R 95 8.1 0:45.81 beam 19705 root 25 0 297m 201m 1856 R 96 10.0 0:48.69 beam 19705 root 25 0 242m 174m 1856 R 93 8.7 0:51.49 beam 19705 root 25 0 248m 175m 1856 R 92 8.7 0:54.27 beam 19705 root 25 0 280m 208m 1856 R 94 10.4 0:57.09 beam 19705 root 25 0 263m 199m 1856 R 94 9.9 0:59.91 beam 19705 root 25 0 242m 191m 1856 R 95 9.5 1:02.76 beam 19705 root 25 0 233m 193m 1856 R 94 9.6 1:05.59 beam 19705 root 25 0 237m 197m 1856 R 94 9.8 1:08.42 beam 19705 root 25 0 246m 208m 1856 R 95 10.4 1:11.27 beam 19705 root 25 0 249m 215m 1856 R 100 10.7 1:14.28 beam 19705 root 25 0 240m 213m 1856 R 99 10.6 1:17.24 beam 19705 root 25 0 463m 402m 1856 R 99 20.0 1:20.22 beam 19705 root 25 0 265m 217m 1856 R 99 10.8 1:23.20 beam 19705 root 25 0 266m 226m 1856 R 100 11.3 1:26.19 beam 19705 root 25 0 266m 235m 1856 R 100 11.7 1:29.18 beam 19705 root 25 0 266m 244m 1856 R 100 12.2 1:32.18 beam 19705 root 25 0 373m 225m 1856 R 99 11.2 1:35.16 beam 19705 root 16 0 372m 233m 1856 R 95 11.6 1:38.02 beam 19705 root 17 0 373m 241m 1856 R 98 12.0 1:40.96 beam 19705 root 21 0 373m 249m 1856 S 98 12.4 1:43.90 beam 19705 root 25 0 373m 236m 1856 R 97 11.8 1:46.81 beam 19705 root 25 0 373m 245m 1856 R 96 12.2 1:49.70 beam 19705 root 25 0 435m 289m 1856 R 97 14.4 1:52.62 beam 19705 root 25 0 349m 247m 1856 R 97 12.3 1:55.55 beam 19705 root 25 0 381m 270m 1856 R 97 13.4 1:58.47 beam 19705 root 25 0 354m 252m 1856 R 97 12.6 2:01.38 beam 19705 root 25 0 354m 260m 1856 R 96 13.0 2:04.26 beam 19705 root 25 0 343m 257m 1856 R 97 12.8 2:07.17 beam ================ and so on. On the other hand, if I try to write simple string (w/o concatenation) everything looks fine. -- With best regards! From tobbe@REDACTED Fri Mar 16 13:32:04 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 16 Mar 2007 13:32:04 +0100 Subject: [erlang-questions] Simple chat server in Erlang In-Reply-To: <45F985C0.7080007@jerith.za.net> References: <45F985C0.7080007@jerith.za.net> Message-ID: Very nice! Especially the rendering of the code examples :-) Is it handwritten or do you have a way of generating those ? Do there exist an up-to-date Erlang->HTML converter nowadays ? Cheers, Tobbe Jeremy Thurgood wrote: > Good day all, > > I'm fairly new to Erlang, and am writing a MUD server to teach myself > the language. So far, I have gotten as far as a simple chat server > thing which I decided to write up as a tutorial since I couldn't find > one pitched at an appropriate level. > > I would appreciate any comments on my code and/or style. Erlang's the > first functional language I've done more than "hello world" in and I'd > hate to find myself writing Java in it... > > http://www.jerith.za.net/writings/erlangsockettut.html > > Thanks, > --J From jerith@REDACTED Fri Mar 16 13:48:18 2007 From: jerith@REDACTED (Jeremy Thurgood) Date: Fri, 16 Mar 2007 14:48:18 +0200 Subject: [erlang-questions] Simple chat server in Erlang In-Reply-To: References: <45F985C0.7080007@jerith.za.net> Message-ID: <45FA9212.5020100@jerith.za.net> Torbjorn Tornkvist wrote: > Very nice! > > Especially the rendering of the code examples :-) > Is it handwritten or do you have a way of generating those ? I cheat and shell out to vim in the Python that runs my site. I'm looking at some native Python syntax highlighting libraries, but none of them do everything I need yet. I'm not quite ready to take the step of rebuilding the backend in Erlang/yaws... --J From chsu79@REDACTED Fri Mar 16 13:50:08 2007 From: chsu79@REDACTED (Christian S) Date: Fri, 16 Mar 2007 13:50:08 +0100 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: Yep, your erlang vm process uses all the cpu, the garbage collector is busy trying to hold the heap under the threshold size. From lemenkov@REDACTED Fri Mar 16 14:04:46 2007 From: lemenkov@REDACTED (Peter Lemenkov) Date: Fri, 16 Mar 2007 16:04:46 +0300 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: 2007/3/16, Christian S : > Yep, your erlang vm process uses all the cpu, the garbage collector is > busy trying to hold the heap under the threshold size. I changed things a little: ========================== select_calls(Fd,NumberOfCalls) -> send_msg (Fd,"Caller","Called","UserName","SessionID","TagTo","TagFrom","Routeto"), send_msg (Fd,"Called","Caller","UserName","SessionID","TagFrom","TagTo","RouteFrom"), timer:sleep(100), select_calls(Fd,NumberOfCalls+1). ========================== I played with sleep-time but nothing changes - memory still leaks (with slower rate of course). All other things are the same - memory leaks then I triy to write a string concatenated from other strings and variables and doesn't leak then I try to write a string concatenated from strings. -- With best regards! From jeffm@REDACTED Sat Mar 17 01:43:31 2007 From: jeffm@REDACTED (jm) Date: Sat, 17 Mar 2007 11:43:31 +1100 Subject: [erlang-questions] profiling application In-Reply-To: <38110.217.128.75.198.1174036871.squirrel@www.geekisp.com> References: <45FA0693.7010204@ghostgun.com> <45FA39A1.7070606@ericsson.com> <45FA3F6E.6030205@ghostgun.com> <45FA5005.8080608@ghostgun.com> <38110.217.128.75.198.1174036871.squirrel@www.geekisp.com> Message-ID: <45FB39B3.6040907@ghostgun.com> Dominic Williams wrote: > Hi Jeff, > >> erl -sname etop -s etop -output text -lines 33 -node one@REDACTED > > Have you tried running the ./priv/bin/etop program (in the observer > application of the erlang distribution) ? > > Regards, > > Dominic Williams > http://www.dominicwilliams.net > ---- > Mmmm, seems to be a script with almost the same as the options as I previously used. Must be some difference in the options though (-hidden?). Here's the output of etop after a few minutes. As you can see the process zu_server has 16233 messages in it queue and the memory usage has blown out. What is the function gen:wait_resp_mon/3? Would I be right in guessing it's the other half of gen:call? If so how do I tell which call it's waiting on? Jeff. Output of etop ======================================================================================== one@REDACTED 23:29:05 Load: cpu 46 Memory: total 110040 binary 535 procs 63 processes 102383 code 2911 runq 3 atom 341 ets 3360 Pid Name or Initial Func Time Reds Memory MsgQ Current Function ---------------------------------------------------------------------------------------- <4249.173.0> zu_server 2246814 11425******** 16233 gen:wait_resp_mon/3 <4249.172.0> zonedb 425912 961486 3984 0 gen_server:loop/6 <4249.46.0> mnesia_locker 189394 8075 2292 0 mnesia_locker:loop/1 <4249.48.0> mnesia_tm 187822 7030 13204 0 mnesia_tm:doit_loop/ From roger.larsson@REDACTED Sat Mar 17 02:29:34 2007 From: roger.larsson@REDACTED (Roger Larsson) Date: Sat, 17 Mar 2007 02:29:34 +0100 Subject: [erlang-questions] Executing Erlang on a FPGA (Re: How small could an Erlang emulator be?) In-Reply-To: <2C160E5F-C67D-492C-A9E8-BDBC1A72A251@smartgames.ca> References: <20070315190220.GB46087@frogman.motivity.ca> <2C160E5F-C67D-492C-A9E8-BDBC1A72A251@smartgames.ca> Message-ID: <200703170229.35140.roger.larsson@norran.net> On Thursday 15 March 2007 20:42, Toby Thain wrote: > On 15-Mar-07, at 3:02 PM, Vance Shipley wrote: > > I recall that someone made the suggestion on this list that > > the Crusoe processor, being softwaree definable, could be > > turned into an Erlang processor. It's just software. :) > > Or soft CPU on FPGA. Yes, I have also thought about that. Would be an interesting project! [Lots of interesting research areas - what "CPU" model to use: JAM, beam, Icode[1], special purpose, extended general purpose[2] - hardware assisted memory allocation + write queue with single assignment optimizations and reference counting? - hardware assisted garbage collection - hardware assisted operating systems see http://www.xilinx.com/publications/magazines/emb_02/xc_pdf/emb02_all.pdf and/or "Programmerbara kretsar" ISBN 91-44-03713-9 Sierra has been sold to Prevas - see http://www.prevas.com/productdevelopment/products/prevassierra.4.7ebfd4a210f9150c2bd80002274.html - hardware assisted serialization (for communicating with the host CPU) - hardware assisted message sending (scatter gather DMA but data itself contains the links) - ... ] Who does this already? /RogerL [1] Icode http://www.erlang.org/ml-archive/erlang-questions/200309/msg00110.html [2] Extended general purpose Generate Sparc executable, add whatever instruction needed. Possible since Sun have released their 64-bit SPARC V9 as GPL http://opensparc-t1.sunsource.net/ "The OpenSPARC T1 processor contains eight SPARC? processor cores, which each have full hardware support for four threads. Each SPARC core has an instruction cache, a data cache, and a fully associative instruction and data translation lookaside buffers (TLB). The eight SPARC cores are connected through a crossbar to an on-chip unified level 2 cache (L2-cache)." Difficult to fit on a FPGA, but there is hope :-) http://www.opencores.org/projects.cgi/web/s1_core/overview (modified T1) "one 64-bit SPARC v9 core (capable of running up to 4 concurrent threads)" no cache, but with wishbone interface... From chandrashekhar.mullaparthi@REDACTED Sat Mar 17 10:20:50 2007 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Sat, 17 Mar 2007 09:20:50 +0000 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: On 16/03/07, Peter Lemenkov wrote: > Hello All! > I write simple example of tail recursion: > > No memory leaks - all worked as I want. > However then I try to change function send_msg to something more > valuable, for example: > > ================== > Msg = lists:append([ "BYE sip:127.0.0.1:5060 SIP/2.0 \r\n", > "Via: SIP/2.0/UDP 127.0.0.1:3456\r\n", > "From: <", Caller, ">;tag=", TagFrom, "\r\n", > "To: <", Called, ">;tag=", TagTo, "\r\n", > "Call-ID: ", SessionID, "\r\n", > "User-Agent: My User Agent\r\n", > "CSeq: 123 BYE\r\n", > "Route: <", Route, ">\r\n", > "Content-Length: 0\r\n", > "\r\n"]), > % io:format("~s~n", [Msg]). > > ok = gen_udp:send(Fd,"127.0.0.1",5060, [Msg]). > > ================== > > I've got a huge memory consumption. > Looks like I missed something important about string manipulating but > I can't find out what exactly. > Is it possible that your destination is responding to you and those messages are stacking up in you r message queue? The way you have opened your UDP socket, the {active, true} option would be set by default on your socket and any UDP packets arriving will be delivered to your process message queue. Repeat the experiment by opening the socket as follows: gen_udp:open(3456, [{active, false}]). regards, Chandru From mobiledreamers@REDACTED Sat Mar 17 23:03:38 2007 From: mobiledreamers@REDACTED (mobiledreamers@REDACTED) Date: Sat, 17 Mar 2007 15:03:38 -0700 Subject: [erlang-questions] Email app for Erlang Message-ID: Ejabberd does jabber/chat eddie - web server for email like qmail/sendmail - ? I m trying to find an email solution or opensource erlang based email tools made by either the bluetail people or Sendmail people thanks Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From mobiledreamers@REDACTED Sat Mar 17 23:25:15 2007 From: mobiledreamers@REDACTED (mobiledreamers@REDACTED) Date: Sat, 17 Mar 2007 15:25:15 -0700 Subject: [erlang-questions] Is there a cache of Bluetail erlang wiki some where on the web? Message-ID: http://bluetail.com/wiki -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Sun Mar 18 02:36:20 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 18 Mar 2007 02:36:20 +0100 Subject: [erlang-questions] How small could an Erlang emulator be? In-Reply-To: References: <518773.94247.qm@web38802.mail.mud.yahoo.com> <1105084E-5AB6-404F-AEC3-33600CFE6D03@process-one.net> <45F7276A.4090909@telia.com> Message-ID: <45FC9794.7040202@telia.com> I have done a number of Erlang implementations but I was not really concerned about the size of the emulator; except of course that writing a large emulator is more time consuming. My main interest then was in looking at different memory models. You can do a lot to influence memeory size by choosing the right memory model. Of course. Size of emulator would be interesting. I still think that a small stack machine using bytecodes would be best. Robert James Hague wrote: >> When someone asks "how small could AN Erlang emulator be", >> that means something quite different from "how small could THE Erlang >> emulator be". > > There are a lot of possibilities here. One of the largest, most > complex modules in the emulator is the one that turns generic BEAM > code into a list of threaded superinstructions. Most of this could be > moved out to the compiler, but it would lock various optimizations > into the BEAM format itself. If you're wanting to reduce the raw size > of the emulator, you could remove all support for these > superinstructions (a.k.a. combined instructions) at the expense of > performance. > > Another option is to rewrite the core of the emulator in assembly > language for each processor (I'd write a custom mini-assembler in > Erlang first). The advantage here is that you'd have tight control > over register usage and subroutine calling mechanisms and could strip > out unecessary fluff. This likely wouldn't reduce code size by that > much, however. It would be interesting to try to keep the entire > emulator in 16K or 32K so the whole thing fits in the instruction > cache. > > Bjorn already suggested switching to 16-bit threaded code internally, > which would cut the size of loaded BEAM files in half (as it stands, > they get substantially inflated after loading). If you hand-crafted > the emulator, this would be easy. > > My biggest concern would be memory management. Once you start > thinking about small memory systems, ones without memory mapping > hardware, then heap fragmentation becomes an issue. On the > Playstation 2 projects I've worked on, there was no heap at all, > because all 32MB was packed with data and critical buffers. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From toby@REDACTED Sun Mar 18 04:01:50 2007 From: toby@REDACTED (Toby Thain) Date: Sun, 18 Mar 2007 00:01:50 -0300 Subject: [erlang-questions] Executing Erlang on a FPGA (Re: How small could an Erlang emulator be?) In-Reply-To: <200703170229.35140.roger.larsson@norran.net> References: <20070315190220.GB46087@frogman.motivity.ca> <2C160E5F-C67D-492C-A9E8-BDBC1A72A251@smartgames.ca> <200703170229.35140.roger.larsson@norran.net> Message-ID: <1A279A18-8B67-4D57-AEAB-64D045012FC3@smartgames.ca> On 16-Mar-07, at 10:29 PM, Roger Larsson wrote: > On Thursday 15 March 2007 20:42, Toby Thain wrote: >> On 15-Mar-07, at 3:02 PM, Vance Shipley wrote: >>> I recall that someone made the suggestion on this list that >>> the Crusoe processor, being softwaree definable, could be >>> turned into an Erlang processor. It's just software. :) >> >> Or soft CPU on FPGA. > > Yes, I have also thought about that. > Would be an interesting project! > > [Lots of interesting research areas > - what "CPU" model to use: > JAM, beam, Icode[1], special purpose, extended general purpose[2] > - hardware assisted memory allocation > + write queue with single assignment optimizations and reference > counting? > - hardware assisted garbage collection > - hardware assisted operating systems > see http://www.xilinx.com/publications/magazines/emb_02/xc_pdf/ > emb02_all.pdf > and/or "Programmerbara kretsar" ISBN 91-44-03713-9 > Sierra has been sold to Prevas - see > http://www.prevas.com/productdevelopment/products/prevassierra. > 4.7ebfd4a210f9150c2bd80002274.html > - hardware assisted serialization (for communicating with the host > CPU) > - hardware assisted message sending (scatter gather DMA but data > itself > contains the links) > - ... > ] > Who does this already? The Transputer had hardware process timeslicing, blocking and message passing... Has anyone considered what kind of fit Erlang would be to its architecture? There is a Transputer-inspired CPU being worked on by John Jakson: http://groups.google.com/group/comp.sys.transputer/browse_thread/ thread/34e00d345d19f817/ http://groups.google.com/group/comp.sys.transputer/msg/ab95a8d60c71f139 He also wrote a nice introduction to the Transputer concept: http://mailgate.dada.net/comp/comp.sys.transputer/msg00330.html --Toby > > > /RogerL ... From stesch@REDACTED Sun Mar 18 17:50:23 2007 From: stesch@REDACTED (Stefan Scholl) Date: Sun, 18 Mar 2007 16:50:23 +0000 (UTC) Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes References: <45F882E0.8030306@gmail.com> <3263.193.113.57.161.1173950874.squirrel@backawinner.gg> Message-ID: <0T3umfgpIo63Nv8%stesch@parsec.no-spoon.de> Gordon Guthrie wrote: > Andreas > Happily we can now point you towards a discussion of this in the new > Erlang book (well properly when it is published...) > > Joe discussed just this issue - you can buy a Beta PDF here: > http://www.pragmaticprogrammer.com/titles/jaerlang/ You need a credit card if you want to buy something from pragmaticprogrammer.com. :-( -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ From james.hague@REDACTED Sun Mar 18 23:46:13 2007 From: james.hague@REDACTED (James Hague) Date: Sun, 18 Mar 2007 17:46:13 -0500 Subject: [erlang-questions] Minimum time for timer:sleep()? Message-ID: Here's some simple code to test timer:sleep/1: test(Milliseconds) -> T1 = now(), timer:sleep(Milliseconds), T2 = now(), io:fwrite("elapsed: ~w\n", [timer:now_diff(T2, T1)]). On the recent model MacBook I tested this on, test(5) prints "elapsed: 10182". In fact, any value less than 10 milliseconds sleeps for ~10 milliseconds. Considering that a message send/receive pair is measured in single-digit MICROseconds on the same machine, this is curious to me. Does anyone have any insight into this behavior? (FWIW, timer:sleep/1 is implemented as a single receive statement.) James From ok@REDACTED Sun Mar 18 23:47:59 2007 From: ok@REDACTED (ok) Date: Mon, 19 Mar 2007 10:47:59 +1200 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: A word of advice. On 16 Mar 2007, at 11:55 pm, Peter Lemenkov wrote: > -module(test). > -export([go/0]). > > go () -> > case gen_udp:open(3456) of > {ok, Fd} -> > select_calls(Fd,0), > gen_udp:close(Fd); > Error -> > io:format("Error creating socket\n", []), > exit(Error) > end. > > select_calls(Fd,NumberOfCalls) -> > io:format("Call number ~w~n~n",[NumberOfCalls]), > send_msg > (Fd,"Caller","Called","UserName","SessionID","TagTo","TagFrom","Routet > o"), > send_msg > (Fd,"Called","Caller","UserName","SessionID","TagFrom","TagTo","RouteF > rom"), > select_calls(Fd,NumberOfCalls+1). > > send_msg (Fd,Caller,Called,UserName,SessionID,TagTo,TagFrom,Route) -> > ok = gen_udp:send(Fd,"127.0.0.1",5060, "Hello All\n\r"). > You would get much better line breaks if you put spaces after function argument commas. Let's see it that way. select_calls(Fd, Number_Of_Calls) -> io:format("Call number ~w~n~n", [Number_Of_Calls]), send_msg(Fd, "Caller", "Called", "UserName", "SessionID", "TagTo", "TagFrom", "Routeto"), % should that be "RouteTo"? send_msg(Fd, "Called", "Caller", "UserName", "SessionID", "TagFrom", "TagTo", "RouteFrom"), select_calls(Fd, Number_Of_Calls + 1). Tail recursion is fine, however I note that select_calls/2 can NEVER STOP, but you have a call to gen_udp:close(Fd) following the initial call to select_calls(Fd, 0), which only makes sense if it DOES eventually stop. Which is it? When if ever is Fd supposed to be closed? From bob@REDACTED Mon Mar 19 00:08:27 2007 From: bob@REDACTED (Bob Ippolito) Date: Sun, 18 Mar 2007 16:08:27 -0700 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: References: Message-ID: <6a36e7290703181608s49eb0d5bv99b76572af305809@mail.gmail.com> On 3/18/07, James Hague wrote: > Here's some simple code to test timer:sleep/1: > > test(Milliseconds) -> > T1 = now(), > timer:sleep(Milliseconds), > T2 = now(), > io:fwrite("elapsed: ~w\n", [timer:now_diff(T2, T1)]). > > On the recent model MacBook I tested this on, test(5) prints "elapsed: > 10182". In fact, any value less than 10 milliseconds sleeps for ~10 > milliseconds. Considering that a message send/receive pair is > measured in single-digit MICROseconds on the same machine, this is > curious to me. Does anyone have any insight into this behavior? > > (FWIW, timer:sleep/1 is implemented as a single receive statement.) I have no idea what the Erlang VM does but I'd guess that this 10 msec granularity comes from the fact that multiplexing syscalls like select/poll or kqueue (at least on OS X) are about that accurate when you use them to sleep. If you wanted something more accurate you'd have to use a whole pthread and nanosleep or polling.. neither of those are terribly easy to pull off. You might get slightly different results depending on if you're using smp or async threads... but I don't know what the internals of the VM look like. -bob From per@REDACTED Mon Mar 19 01:26:40 2007 From: per@REDACTED (Per Hedeland) Date: Mon, 19 Mar 2007 01:26:40 +0100 (CET) Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: <6a36e7290703181608s49eb0d5bv99b76572af305809@mail.gmail.com> Message-ID: <200703190026.l2J0Qeo5098396@pluto.hedeland.org> "Bob Ippolito" wrote: > >On 3/18/07, James Hague wrote: >> Here's some simple code to test timer:sleep/1: >> >> test(Milliseconds) -> >> T1 = now(), >> timer:sleep(Milliseconds), >> T2 = now(), >> io:fwrite("elapsed: ~w\n", [timer:now_diff(T2, T1)]). >> >> On the recent model MacBook I tested this on, test(5) prints "elapsed: >> 10182". In fact, any value less than 10 milliseconds sleeps for ~10 >> milliseconds. Considering that a message send/receive pair is >> measured in single-digit MICROseconds on the same machine, this is >> curious to me. Does anyone have any insight into this behavior? >> >> (FWIW, timer:sleep/1 is implemented as a single receive statement.) > >I have no idea what the Erlang VM does but I'd guess that this 10 msec >granularity comes from the fact that multiplexing syscalls like >select/poll or kqueue (at least on OS X) are about that accurate when >you use them to sleep. Yes, it's nothing Erlang-specific - pretty fundamental actually: Timeouts can only happen on a system clock interrupt, and they obviously happen with the frequency of your system clock, which is traditionally 100 Hz on Unix. You can crank it up on most Unixen if you care about this - I believe some Linux kernel versions used 1000 Hz by default, but they tended to lose clock interrupts then... Actually there used to be some code in the Erlang VM to adjust the value such that e.g. a 'receive ... after 5000 ...' wouldn't give up after 10 microseconds just because that's when the next clock interrupt happened to arrive - i.e. you'd always get at least one clock period. Don't know if it's still there, but something like it should be. >If you wanted something more accurate you'd have to use a whole >pthread and nanosleep or polling.. neither of those are terribly easy >to pull off. You might get slightly different results depending on if >you're using smp or async threads... None of that helps, nanosleep despite its name is still limited by the system clock frequency - it's just that when POSIX decided to specify something that could let you sleep with better granularity than 1 second, they wanted to be future-proof.:-) The only way to get better precision for a delay/timeout than what the system clock provides is by busy-waiting. --Per Hedeland From ok@REDACTED Mon Mar 19 06:28:53 2007 From: ok@REDACTED (ok) Date: Mon, 19 Mar 2007 17:28:53 +1200 Subject: [erlang-questions] Semaphores In-Reply-To: <20070315193620.GC46087@frogman.motivity.ca> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <20070315193620.GC46087@frogman.motivity.ca> Message-ID: <6B90B05F-A720-4CCC-A12E-F79E650C0A7D@cs.otago.ac.nz> I wrote: > } Source files should be kept to a maximum width of 80 columns; On 16 Mar 2007, at 8:36 am, Vance Shipley wrote: > A number of years ago I would have whole heartedly agreed > but no longer. A few years ago I did a project which used > ASN.1 and it ended up having really long names which I did > not have the luxury of choosing. It became impractical to > use 80 column pages. I did all my work in 132 column windows > for that project. I now find I really prefer working that > way as I have plenty of glass these days. I wouldn't however > unecessarily force others into it. The psychology-of-reading results really do seem to be clear this time" narrower columns really ARE easier to read. That doesn't mean 80 columns is right. 80 columns is too wide. It's a tradition that goes back to punched cards, not something which is grounded in human factors. I suspect that anyone who claims to find 132 columns comfortable is suffering from a bit of protective self-deception. I've spent my time reading with a ruler in my hand and have no desire ever to repeat it. While consenting adults may do whatever they please in the privacy of their cubicles, that does not mean that beginners should be encouraged to flout what little we know about readability. The important point is that anyone who DISTRIBUTES a file in wider-than-80-column format *IS* thereby 'unecessarily forc[ing] others to' deal with it. Also, while it may be straightforward to switch your terminal to 132- column mode, or to stretch your window sideways, you cannot stretch your printer to handle such stuff without substantially reducing the character size. I like to print listings off and take them home to look at. I do not enjoy reading with a microscope. So the point remains: If you want OTHER people to read your stuff, have the elementary courtesy to keep the lines 80 characters or narrower, and if you can keep them 72 characters or narrower, so much the better. > > } Source code should be indented using your text editor's indentation > } features, NOT one tab per tab stop. 8-column indentations (what > you > } get when you use the tab key) are eye-jarring. > > That is just wrong. First of all tabs are whatever your tabstops > are currently set to. 'That is just wrong' is forcefully put, but quite untrue, and the second sentence gives the very reason that it is untrue. YOUR tabstops are whatever YOU have set them to. The tabstops I see are for the most part whatever I have been given and are almost certainly *NOT* the tabstops you see. Some of the editors I use can set tabstops; some can't. Some of the commands I use for printing files can set tabstops; some can't. The ones that do don't use the same options (-e, -T, others). NONE of these programs have ANY idea what YOUR tabstops are, and the default is the standard tab=8. > I write all my code using tabs for indentation > the beauty of which is that you can easily change the appearance to > your personal taste (i.e. in vi: set ts=3). The ugliness of this is that YOU see what you want, but NOBODY ELSE can tell that you ever did 'set ts=3'. If you embedded the command in the source code, it is quite certain that other people reading the code will do so using a different editor that doesn't know how to read those embedded commands. I don't care what keys you press to make indentation happen (the TAB key in Emacs doesn't normally insert a literal tab; Vi uses > and < for changing indentation; Xcode uses Cmd-] and Cmd-[; &c). You could do it by clicking your teeth like castanets for all I care. But if you want other people to be able to look at your code and see what you see, any tabstops had better be 8 columns apart, and it is best of all if there are no tab characters in the file at all. There used to be a compression benefit from using tabs instead of spaces, but with 720GB discs the price they are, I care a lot less about that than I used to. But we do agree that Emacs is pathetic at choosing where to indent. From valentin@REDACTED Mon Mar 19 07:47:08 2007 From: valentin@REDACTED (Valentin Micic) Date: Mon, 19 Mar 2007 08:47:08 +0200 Subject: [erlang-questions] On TABSTOPS Re: Semaphores References: <45F8ACC9.8060601@bredband.net><0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz><20070315193620.GC46087@frogman.motivity.ca> <6B90B05F-A720-4CCC-A12E-F79E650C0A7D@cs.otago.ac.nz> Message-ID: <002301c769f2$70c48d40$6401a8c0@moneymaker2> This discussion has nothing to do with Semaphores anymore and has degenerated into a "protective self-deception" -- the least one can do is to change a message subjectso so we do not deceive others as well. On the subject of tabstops: I'm using an editor that replaces TAB's with configurable number of blank characters (spaces), thus insuring that anyone can see my code the way I see it. Not as efficient regarding file's memory utilization, but, hey, we're not in 70's. V. ----- Original Message ----- From: "ok" To: "Erlang/OTP discussions" Sent: Monday, March 19, 2007 7:28 AM Subject: Re: [erlang-questions] Semaphores >I wrote: >> } Source files should be kept to a maximum width of 80 columns; > > On 16 Mar 2007, at 8:36 am, Vance Shipley wrote: >> A number of years ago I would have whole heartedly agreed >> but no longer. A few years ago I did a project which used >> ASN.1 and it ended up having really long names which I did >> not have the luxury of choosing. It became impractical to >> use 80 column pages. I did all my work in 132 column windows >> for that project. I now find I really prefer working that >> way as I have plenty of glass these days. I wouldn't however >> unecessarily force others into it. > > The psychology-of-reading results really do seem to be clear this time" > narrower columns really ARE easier to read. That doesn't mean 80 > columns > is right. 80 columns is too wide. It's a tradition that goes back to > punched cards, not something which is grounded in human factors. > > I suspect that anyone who claims to find 132 columns comfortable is > suffering from a bit of protective self-deception. I've spent my time > reading with a ruler in my hand and have no desire ever to repeat it. > > While consenting adults may do whatever they please in the privacy of > their cubicles, that does not mean that beginners should be encouraged > to flout what little we know about readability. > > The important point is that anyone who DISTRIBUTES a file in > wider-than-80-column format *IS* thereby 'unecessarily forc[ing] others > to' deal with it. > > Also, while it may be straightforward to switch your terminal to 132- > column mode, or to stretch your window sideways, you cannot stretch your > printer to handle such stuff without substantially reducing the > character > size. I like to print listings off and take them home to look at. > I do not enjoy reading with a microscope. > > So the point remains: > If you want OTHER people to read your stuff, have the elementary > courtesy to keep the lines 80 characters or narrower, and if you > can keep them 72 characters or narrower, so much the better. > >> >> } Source code should be indented using your text editor's indentation >> } features, NOT one tab per tab stop. 8-column indentations (what >> you >> } get when you use the tab key) are eye-jarring. >> >> That is just wrong. First of all tabs are whatever your tabstops >> are currently set to. > > 'That is just wrong' is forcefully put, but quite untrue, > and the second sentence gives the very reason that it is untrue. > YOUR tabstops are whatever YOU have set them to. > The tabstops I see are for the most part whatever I have been given > and are almost certainly *NOT* the tabstops you see. > Some of the editors I use can set tabstops; some can't. > Some of the commands I use for printing files can set tabstops; > some can't. The ones that do don't use the same options (-e, -T, > others). NONE of these programs have ANY idea what YOUR tabstops > are, and the default is the standard tab=8. > >> I write all my code using tabs for indentation >> the beauty of which is that you can easily change the appearance to >> your personal taste (i.e. in vi: set ts=3). > > The ugliness of this is that YOU see what you want, but NOBODY ELSE > can tell that you ever did 'set ts=3'. If you embedded the command in > the source code, it is quite certain that other people reading the > code will do so using a different editor that doesn't know how to read > those embedded commands. > > I don't care what keys you press to make indentation happen (the TAB key > in Emacs doesn't normally insert a literal tab; Vi uses > and < for > changing indentation; Xcode uses Cmd-] and Cmd-[; &c). You could do it > by clicking your teeth like castanets for all I care. But if you want > other people to be able to look at your code and see what you see, any > tabstops had better be 8 columns apart, and it is best of all if there > are no tab characters in the file at all. > > There used to be a compression benefit from using tabs instead of > spaces, > but with 720GB discs the price they are, I care a lot less about that > than I used to. > > But we do agree that Emacs is pathetic at choosing where to indent. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From samuelrivas@REDACTED Mon Mar 19 08:54:58 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 19 Mar 2007 08:54:58 +0100 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: <20070319075458.GA12006@lambdastream.com> Peter Lemenkov wrote: > 2007/3/16, Christian S : > > > You dont need to call lists:append, gen_udp:send will behave as if it > > calls erlang:iolist_to_binary/1. In fact, we call them iolists because > > most io functions behaves this way. > > OK, I changed send_message a little: > > =========================== > send_msg (Fd,Caller,Called,UserName,SessionID,TagTo,TagFrom,Route) -> > ok = gen_udp:send(Fd,"127.0.0.1",5060, > "BYE sip:127.0.0.1:5060 SIP/2.0 \r\n" > "Via: SIP/2.0/UDP 127.0.0.1:3456\r\n" > "From: <" ++ Caller ++ ">;tag=" ++ TagFrom ++ "\r\n" > "To: <" ++ Called ++ ">;tag=" ++ TagTo ++ "\r\n" > "Call-ID: " ++ SessionID ++ "\r\n" > "User-Agent: MyApp\r\n" > "CSeq: 123 BYE\r\n" > "Route: <" ++ Route ++ ">\r\n" > "Content-Length: 0\r\n" > "\r\n"). Just for the record, you are still appending lists (++ an infix version of lists:append). It is more efficient to create a deep list (io list) and let the port flatten it: gen_udp:send(Fd, "127.0.0.1", 5060, ["BYE sip:127.0.0.1:5060 SIP/2.0 \r\n", "Via: SIP/2.0/UDP 127.0.0.1:3456\r\n", "From: <", Caller, ">;tag=", TagFrom, "\r\n", "To: <", Called, ">;tag=", TagTo, "\r\n", "Call-ID: ", SessionID, "\r\n", "etc, etc"]). Anyway, it must have nothing to do with your huge memory consumption, two versions worked as expected in my system. i.e. 100% of the CPU, but not extra memory usage. Regards -- Samuel From amila_maha@REDACTED Mon Mar 19 09:58:33 2007 From: amila_maha@REDACTED (Amila Maha Arachchi) Date: Mon, 19 Mar 2007 01:58:33 -0700 (PDT) Subject: [erlang-questions] Google summer of codes Message-ID: <513427.38469.qm@web43132.mail.sp1.yahoo.com> Hi, Are there any erlang related projects available in "Google summer of Codes 2007". If not, does anybody have an idea for such a project? Regards, Amila. ____________________________________________________________________________________ Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From siddharthpareek@REDACTED Mon Mar 19 10:18:01 2007 From: siddharthpareek@REDACTED (Siddharth Pareek) Date: Mon, 19 Mar 2007 14:48:01 +0530 Subject: [erlang-questions] Cannot Connect to peer node - Jinterface Message-ID: <008801c76a07$81c53990$2301a8c0@calance.com> Hi all , i have a OtpSelf node which connects to OtpPeer node like this: otpself.connect(otppeer) ...in this manner in many parts of my Jinterface program...At time it gives the cannot connect to peer node and at times it works smoothly without any exception.. Is there any way by which the exception can be overcomed and the connection is established when ever i try to connect to the remote node. Please do let me know the solution for it as soon as possible. Also if you require any other details or the problem is not clear then please do let me know. Thanks and Regards, Siddharth Pareek -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas@REDACTED Mon Mar 19 10:32:09 2007 From: nicolas@REDACTED (Nicolas Niclausse) Date: Mon, 19 Mar 2007 10:32:09 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> <45F957E5.4070403@diit.unict.it> <45F99BF9.5090701@diit.unict.it> Message-ID: <45FE5899.4070606@niclux.org> Ulf Wiger ecrivait le 16.03.2007 07:12: > I did notice that the Esterel-language web page > > http://www-sop.inria.fr/meije/esterel/esterel-eng.html > > doesn't seem to have been updated since ca 2000. This page seems really outdated, the good one is : http://www-sop.inria.fr/esterel-org/ nothing new though, and only binaries are available ... -- Nicolas From erlang@REDACTED Mon Mar 19 10:35:22 2007 From: erlang@REDACTED (Peter Lund) Date: Mon, 19 Mar 2007 10:35:22 +0100 Subject: [erlang-questions] Email app for Erlang In-Reply-To: References: Message-ID: <45FE595A.1030605@lundata.se> Are you looking for a SMTP client or server? There is a SMTP client written by Mike Bradford all in erlang that I am using very successfully. http://erlang.org/user.html#smtp_client-1.1 mobiledreamers@REDACTED skrev: > Ejabberd does jabber/chat > eddie - web server > for email like qmail/sendmail - ? > I m trying to find an email solution or opensource erlang based email > tools made by either the bluetail people or Sendmail people > > thanks > Mark > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From stesch@REDACTED Mon Mar 19 10:38:26 2007 From: stesch@REDACTED (Stefan Scholl) Date: Mon, 19 Mar 2007 09:38:26 +0000 (UTC) Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes References: <45F882E0.8030306@gmail.com> <3263.193.113.57.161.1173950874.squirrel@backawinner.gg> <0T3umfgpIo63Nv8%stesch@parsec.no-spoon.de> Message-ID: <0T3uoa9vI8nfNv8%stesch@parsec.no-spoon.de> Stefan Scholl wrote: > You need a credit card if you want to buy something from > pragmaticprogrammer.com. > > :-( By the way: I wasn't begging for a copy of the book. Please don't send me the PDF. I delete it on arrival. I'll order the book as soon as it shows up on amazon.de (Credit cards seem to be a cultural thing. Almost nobody in the US is without one. As in Europe/Germany we don't really feel the need for one.) -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ From chsu79@REDACTED Mon Mar 19 11:59:48 2007 From: chsu79@REDACTED (Christian S) Date: Mon, 19 Mar 2007 11:59:48 +0100 Subject: [erlang-questions] Semaphores In-Reply-To: <45FE5899.4070606@niclux.org> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <45F8EB81.8080404@diit.unict.it> <45F94EDF.9060707@bredband.net> <45F957E5.4070403@diit.unict.it> <45F99BF9.5090701@diit.unict.it> <45FE5899.4070606@niclux.org> Message-ID: I found this project: http://ecl.sourceforge.net/aboutecl.htm On 3/19/07, Nicolas Niclausse wrote: > This page seems really outdated, the good one is : > > http://www-sop.inria.fr/esterel-org/ > > nothing new though, and only binaries are available ... From david.nospam.hopwood@REDACTED Mon Mar 19 18:42:46 2007 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Mon, 19 Mar 2007 17:42:46 +0000 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: <200703190026.l2J0Qeo5098396@pluto.hedeland.org> References: <200703190026.l2J0Qeo5098396@pluto.hedeland.org> Message-ID: <45FECB96.3020404@blueyonder.co.uk> Per Hedeland wrote: > "Bob Ippolito" wrote: > [...] >>I have no idea what the Erlang VM does but I'd guess that this 10 msec >>granularity comes from the fact that multiplexing syscalls like >>select/poll or kqueue (at least on OS X) are about that accurate when >>you use them to sleep. > > Yes, it's nothing Erlang-specific - pretty fundamental actually: > Timeouts can only happen on a system clock interrupt, and they obviously > happen with the frequency of your system clock, which is traditionally > 100 Hz on Unix. Not obviously; there is no reason other than implementation simplicity why interrupts need to be periodic. It would be perfectly feasible to set the timer to interrupt precisely on the next timeout requested by any application, as some real-time operating systems do. There is even an actively maintained Linux kernel patch to do that: but whether this would work from Erlang depends on which API the Erlang emulator is using for timeouts, and in any case the OP was using a Mac (so probably not Linux). Note that even with a high-res timer API on a real-time OS, the latency of timeout callbacks is unavoidably increased when multiple applications request a timeout at about the same time. > None of that helps, nanosleep despite its name is still limited by the > system clock frequency - it's just that when POSIX decided to specify > something that could let you sleep with better granularity than 1 > second, they wanted to be future-proof.:-) Or to allow the above technique for precise timeouts. -- David Hopwood From david.nospam.hopwood@REDACTED Mon Mar 19 19:08:38 2007 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Mon, 19 Mar 2007 18:08:38 +0000 Subject: [erlang-questions] Off-topic: source code width and tab stops In-Reply-To: <6B90B05F-A720-4CCC-A12E-F79E650C0A7D@cs.otago.ac.nz> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <20070315193620.GC46087@frogman.motivity.ca> <6B90B05F-A720-4CCC-A12E-F79E650C0A7D@cs.otago.ac.nz> Message-ID: <45FED1A6.7080003@blueyonder.co.uk> ok wrote: > On 16 Mar 2007, at 8:36 am, Vance Shipley wrote: >> ok wrote: > >>> Source files should be kept to a maximum width of 80 columns; > >>A number of years ago I would have whole heartedly agreed >>but no longer. A few years ago I did a project which used >>ASN.1 and it ended up having really long names which I did >>not have the luxury of choosing. It became impractical to >>use 80 column pages. I did all my work in 132 column windows >>for that project. I now find I really prefer working that >>way as I have plenty of glass these days. I wouldn't however >>unecessarily force others into it. > > The psychology-of-reading results really do seem to be clear this time - > narrower columns really ARE easier to read. Narrow columns of natural-language text are easier to read. For programming languages, statements or expressions that have to be split over more than one line are more difficult to read. The extent of the difficulty, and the frequency of long lines, is programming language-dependent. Unlike natural-language texts, *most* lines are short regardless of the window width. For C and Java, I find that a window width of less than 100 columns is impractical. I haven't written enough in Erlang to come to a firm conclusion in that case. [...] > I don't care what keys you press to make indentation happen (the TAB key > in Emacs doesn't normally insert a literal tab; Vi uses > and < for > changing indentation; Xcode uses Cmd-] and Cmd-[; &c). You could do it > by clicking your teeth like castanets for all I care. But if you want > other people to be able to look at your code and see what you see, any > tabstops had better be 8 columns apart, and it is best of all if there > are no tab characters in the file at all. Agreed. -- David Hopwood From kenneth.lundin@REDACTED Mon Mar 19 19:23:23 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 19 Mar 2007 19:23:23 +0100 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> Message-ID: Hi, On 3/15/07, Christophe Romain wrote: > What can we say about common string functions ? > > commonly used functions which are implemented in several places: > - to_upper: inets builder snmp ubf > - to_lower: inets diggo ibrowse megaco www_tools yaws > - to_uppercase: ic > - to_lowerchar: yaws > - encode_base64: inets ibrowse > - decode_base64: inets yaws > > inets.http_util is by far the most used implementation. > well, to_upper and to_lower are really string related functions > encode_base64 and decode_base64 are MIME related functions > > modules depending on inets for functions listed above: > ibrowse jabberlang orcas pico smtp_client stl tsung xmerl yxa > > Wouldn't it be nice to move that functions into stdlib.string ? In the next release OTP R11B-4 the following is added to stdlib: - module string will have to_upper and to_lower added - A new module base64 with several encode and decode functions. inets:http_util will later be changed to use the functions in stdlib. /Kenneth (OTP team at Ericsson) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From toby@REDACTED Mon Mar 19 19:29:57 2007 From: toby@REDACTED (Toby Thain) Date: Mon, 19 Mar 2007 15:29:57 -0300 Subject: [erlang-questions] Off-topic: source code width and tab stops In-Reply-To: <45FED1A6.7080003@blueyonder.co.uk> References: <45F8ACC9.8060601@bredband.net> <0EC52404-76CD-4FDD-A39D-81D7A4E938BF@cs.otago.ac.nz> <20070315193620.GC46087@frogman.motivity.ca> <6B90B05F-A720-4CCC-A12E-F79E650C0A7D@cs.otago.ac.nz> <45FED1A6.7080003@blueyonder.co.uk> Message-ID: On 19-Mar-07, at 3:08 PM, David Hopwood wrote: > ok wrote: >> On 16 Mar 2007, at 8:36 am, Vance Shipley wrote: >>> ok wrote: >> >>>> Source files should be kept to a maximum width of 80 columns; >> >>> A number of years ago I would have whole heartedly agreed >>> but no longer. A few years ago I did a project which used >>> ASN.1 and it ended up having really long names which I did >>> not have the luxury of choosing. It became impractical to >>> use 80 column pages. I did all my work in 132 column windows >>> for that project. I now find I really prefer working that >>> way as I have plenty of glass these days. I wouldn't however >>> unecessarily force others into it. >> >> The psychology-of-reading results really do seem to be clear this >> time - >> narrower columns really ARE easier to read. > > Narrow columns of natural-language text are easier to read. For > programming languages, statements or expressions that have to be > split over more than one line are more difficult to read. As a typographer I was going to make a similar clarification. Agreed. > The extent > of the difficulty, and the frequency of long lines, is programming > language-dependent. Unlike natural-language texts, *most* lines are > short regardless of the window width. > > For C and Java, I find that a window width of less than 100 columns > is impractical. I haven't written enough in Erlang to come to a firm > conclusion in that case. To me, it seems to mix very short and very long lines, more than say, C. --Toby > > [...] >> I don't care what keys you press to make indentation happen (the >> TAB key >> in Emacs doesn't normally insert a literal tab; Vi uses > and < for >> changing indentation; Xcode uses Cmd-] and Cmd-[; &c). You could >> do it >> by clicking your teeth like castanets for all I care. But if you >> want >> other people to be able to look at your code and see what you see, >> any >> tabstops had better be 8 columns apart, and it is best of all if >> there >> are no tab characters in the file at all. > > Agreed. > > -- > David Hopwood > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Mon Mar 19 19:38:39 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 Mar 2007 11:38:39 -0700 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> Message-ID: <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> On 3/19/07, Kenneth Lundin wrote: > Hi, > > On 3/15/07, Christophe Romain wrote: > > What can we say about common string functions ? > > > > commonly used functions which are implemented in several places: > > - to_upper: inets builder snmp ubf > > - to_lower: inets diggo ibrowse megaco www_tools yaws > > - to_uppercase: ic > > - to_lowerchar: yaws > > - encode_base64: inets ibrowse > > - decode_base64: inets yaws > > > > inets.http_util is by far the most used implementation. > > well, to_upper and to_lower are really string related functions > > encode_base64 and decode_base64 are MIME related functions > > > > modules depending on inets for functions listed above: > > ibrowse jabberlang orcas pico smtp_client stl tsung xmerl yxa > > > > Wouldn't it be nice to move that functions into stdlib.string ? > > In the next release OTP R11B-4 the following is added to stdlib: > - module string will have to_upper and to_lower added > - A new module base64 with several encode and decode functions. > > inets:http_util will later be changed to use the functions in stdlib. We should have a party! This is great :) How about UTF8 encoding and decoding too? That would pretty much remove all of the "calling into really strange places for functionality that should be standard" from my projects. What's the status of bit-level binaries and general comprehensions? Is that coming in R11B-4 too? That would REALLY be awesome. -bob From erlangx@REDACTED Mon Mar 19 19:46:31 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Mon, 19 Mar 2007 11:46:31 -0700 Subject: [erlang-questions] Better Security Mechanism for Erlang Nodes In-Reply-To: <0T3uoa9vI8nfNv8%stesch@parsec.no-spoon.de> References: <45F882E0.8030306@gmail.com> <3263.193.113.57.161.1173950874.squirrel@backawinner.gg> <0T3umfgpIo63Nv8%stesch@parsec.no-spoon.de> <0T3uoa9vI8nfNv8%stesch@parsec.no-spoon.de> Message-ID: <20070319184627.GA29973@delora.autosys.us> On Mon, Mar 19, 2007 at 09:38:26AM +0000, Stefan Scholl wrote: > Stefan Scholl wrote: > > You need a credit card if you want to buy something from > > pragmaticprogrammer.com. > > > > :-( > > By the way: I wasn't begging for a copy of the book. Please don't > send me the PDF. I delete it on arrival. I'll order the book as > soon as it shows up on amazon.de ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ perhaps this will be useful (both go to same howto on trapexit) ... short URL: http://tinyurl.com/38lpdz long URL : http://wiki.trapexit.org/index.php/Distributed_erlang_using_ssl_through_firewalls ~Michael > > > (Credit cards seem to be a cultural thing. Almost nobody in the > US is without one. As in Europe/Germany we don't really feel the > need for one.) > > > -- > Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,45fe5a8518349391584543! > > From kostis@REDACTED Mon Mar 19 20:06:38 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 19 Mar 2007 20:06:38 +0100 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> Message-ID: <45FEDF3E.1090906@cs.ntua.gr> Bob Ippolito wrote: > On 3/19/07, Kenneth Lundin wrote: >> Hi, >> >> On 3/15/07, Christophe Romain wrote: >>> What can we say about common string functions ? >>> >>> commonly used functions which are implemented in several places: >>> - to_upper: inets builder snmp ubf >>> - to_lower: inets diggo ibrowse megaco www_tools yaws >>> - to_uppercase: ic >>> - to_lowerchar: yaws >>> - encode_base64: inets ibrowse >>> - decode_base64: inets yaws >>> >>> inets.http_util is by far the most used implementation. >>> well, to_upper and to_lower are really string related functions >>> encode_base64 and decode_base64 are MIME related functions >>> >>> modules depending on inets for functions listed above: >>> ibrowse jabberlang orcas pico smtp_client stl tsung xmerl yxa >>> >>> Wouldn't it be nice to move that functions into stdlib.string ? >> In the next release OTP R11B-4 the following is added to stdlib: >> - module string will have to_upper and to_lower added >> - A new module base64 with several encode and decode functions. >> >> inets:http_util will later be changed to use the functions in stdlib. > > We should have a party! This is great :) > > How about UTF8 encoding and decoding too? That would pretty much > remove all of the "calling into really strange places for > functionality that should be standard" from my projects. > > What's the status of bit-level binaries and general comprehensions? Is > that coming in R11B-4 too? That would REALLY be awesome. Their status is that these are present in R11B-3 already ! We have not publicized this very much because the Erlang shell in R11B-3 does not have support for bit streams -- but in .erl files everything works. The shell support is already in place and will be released as part of R11B-4. Enjoy! Kostis From pjdtech2000@REDACTED Mon Mar 19 21:30:24 2007 From: pjdtech2000@REDACTED (PJ Durai) Date: Mon, 19 Mar 2007 20:30:24 +0000 (UTC) Subject: [erlang-questions] Email app for Erlang References: <45FE595A.1030605@lundata.se> Message-ID: Peter Lund lundata.se> writes: > > Are you looking for a SMTP client or server? There is a SMTP client > written by Mike Bradford all in erlang that I am using very successfully. > > http://erlang.org/user.html#smtp_client-1.1 > > mobiledreamers gmail.com skrev: > > Ejabberd does jabber/chat > > eddie - web server > > for email like qmail/sendmail - ? He wants the former I think. A mail server (MTA ?) like SendMail or PostFix. It would be a killer app in Erlang IMHO. I have never seen one that is freely available. From vladdu55@REDACTED Mon Mar 19 21:49:25 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 Mar 2007 20:49:25 +0000 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: <45FEDF3E.1090906@cs.ntua.gr> References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> <45FEDF3E.1090906@cs.ntua.gr> Message-ID: <95be1d3b0703191349v27380cebje96a7920e27cbefc@mail.gmail.com> > > What's the status of bit-level binaries and general comprehensions? Is > > that coming in R11B-4 too? That would REALLY be awesome. > > Their status is that these are present in R11B-3 already ! Hi, Maybe it would be useful to know that in order to be able to use those, the module has to be compiled with -compile([binary_comprehension, bitlevel_binaries]). I didn't know :-) regards, Vlad From kenneth.lundin@REDACTED Mon Mar 19 22:42:33 2007 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 19 Mar 2007 22:42:33 +0100 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: <95be1d3b0703191349v27380cebje96a7920e27cbefc@mail.gmail.com> References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> <45FEDF3E.1090906@cs.ntua.gr> <95be1d3b0703191349v27380cebje96a7920e27cbefc@mail.gmail.com> Message-ID: On 3/19/07, Vlad Dumitrescu wrote: > > > What's the status of bit-level binaries and general comprehensions? Is > > > that coming in R11B-4 too? That would REALLY be awesome. > > > > Their status is that these are present in R11B-3 already ! > > Hi, > > Maybe it would be useful to know that in order to be able to use > those, the module has to be compiled with > -compile([binary_comprehension, bitlevel_binaries]). > > I didn't know :-) The complete support for binary comprehensions and bitlevel binaries will not be released in R11B-4. With complete I mean e.g. as default in the compiler and more. There are still some compatibility issues that we have to think of very carefully before we turn the support for bitlevel binaries on as default. /Kenneth (OTP Team at Ericsson) > > regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From james.hague@REDACTED Mon Mar 19 23:01:40 2007 From: james.hague@REDACTED (James Hague) Date: Mon, 19 Mar 2007 17:01:40 -0500 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: References: Message-ID: Thanks everyone for the replies, though I still haven't worked out a solution I'm happy with. Here's the details of what I'm trying to do: I have an Erlang program that communicates with an external graphics "driver" program. This way I can put pretty pictures on the screen but without having to micromanage everything from Erlang itself. What I was attempting to do was to get updates running more or less at 60 Hz (16 microseconds per frame). My first idea was to track execution time per frame, then sleep the rest of the 16 millisecond slice. This didn't work because sleep waits a minimum of 10 milliseconds, regardless of the value passed in. My second idea was to spawn a process at the start of a frame, wait 16 milliseconds in that process, then send a message to the original process, This works, except the 16 millisecond time can vary quite a bit: from 16.8 ms to 22+ ms in my tests. Any approaches to more precise timing would be appreciated! James From bob@REDACTED Mon Mar 19 23:13:06 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 Mar 2007 15:13:06 -0700 Subject: [erlang-questions] dependency on inets for string functions In-Reply-To: References: <7EF404C0-D5C3-46AD-8882-506CA697984D@process-one.net> <6a36e7290703191138u1db1946fh73d145edf6e0da7f@mail.gmail.com> <45FEDF3E.1090906@cs.ntua.gr> <95be1d3b0703191349v27380cebje96a7920e27cbefc@mail.gmail.com> Message-ID: <6a36e7290703191513ge6123aai7741a56704462ced@mail.gmail.com> On 3/19/07, Kenneth Lundin wrote: > On 3/19/07, Vlad Dumitrescu wrote: > > > > What's the status of bit-level binaries and general comprehensions? Is > > > > that coming in R11B-4 too? That would REALLY be awesome. > > > > > > Their status is that these are present in R11B-3 already ! > > > > Hi, > > > > Maybe it would be useful to know that in order to be able to use > > those, the module has to be compiled with > > -compile([binary_comprehension, bitlevel_binaries]). > > > > I didn't know :-) > > The complete support for binary comprehensions and bitlevel binaries will > not be released in R11B-4. > With complete I mean e.g. as default in the compiler and more. > There are still some compatibility issues that we have to think of > very carefully > before we turn the support for bitlevel binaries on as default. Are there any known caveats to using the current R11B-3 implementation, or is it just a matter of the shell not yet supporting them? Would it be possible to support both old and new binary syntax in the same source file? Is it possible to use preprocessor macros to use one function instead of another? Are there predefined macros that state what the compiler's capabilities are? I ask because it would be convenient to keep compatibility with R11B-2 for a little while longer, but I'd like to migrate to using bit level binaries for clarity and performance reasons over the next release cycle or two. -bob From bob@REDACTED Mon Mar 19 23:35:06 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 Mar 2007 15:35:06 -0700 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: References: Message-ID: <6a36e7290703191535m2391a3b6u9cca4c2d3e12d774@mail.gmail.com> On 3/19/07, James Hague wrote: > Thanks everyone for the replies, though I still haven't worked out a > solution I'm happy with. Here's the details of what I'm trying to do: > > I have an Erlang program that communicates with an external graphics > "driver" program. This way I can put pretty pictures on the screen > but without having to micromanage everything from Erlang itself. What > I was attempting to do was to get updates running more or less at 60 > Hz (16 microseconds per frame). > > My first idea was to track execution time per frame, then sleep the > rest of the 16 millisecond slice. This didn't work because sleep > waits a minimum of 10 milliseconds, regardless of the value passed in. > > My second idea was to spawn a process at the start of a frame, wait 16 > milliseconds in that process, then send a message to the original > process, This works, except the 16 millisecond time can vary quite a > bit: from 16.8 ms to 22+ ms in my tests. > > Any approaches to more precise timing would be appreciated! You could write a function that sleeps as much as it can by way of timer:sleep, and then busywaits the rest? How about something like this: -module(busywait). -export([add_microsec/2, microsleep/1, test/0]). -define(JITTER, 5). add_microsec(Micro, {Mega0, Sec0, Micro0}) -> Micro1 = Micro0 + Micro, Sec1 = Sec0 + (Micro1 div 1000000), Mega1 = Mega0 + (Sec1 div 1000000), {Mega1, (Sec1 rem 1000000), (Micro1 rem 1000000)}. busywait_until(Target, Loops) -> case now() of Now when Now >= Target -> {Now, Loops}; _ -> erlang:yield(), busywait_until(Target, 1 + Loops) end. microsleep(MicroSec) -> Target = add_microsec(MicroSec, now()), AdjMsec = MicroSec - ?JITTER, case AdjMsec > 10000 of true -> timer:sleep(AdjMsec div 1000); false -> ok end, {Finish, Loops} = busywait_until(Target, 1), {timer:now_diff(Finish, Target), Loops}. test() -> {Accuracy, Loops} = microsleep(16 * 1000), io:format("Jitter: ~p ms Iterations: ~p~n", [Accuracy, Loops]). From bob@REDACTED Mon Mar 19 23:37:43 2007 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 Mar 2007 15:37:43 -0700 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: <6a36e7290703191535m2391a3b6u9cca4c2d3e12d774@mail.gmail.com> References: <6a36e7290703191535m2391a3b6u9cca4c2d3e12d774@mail.gmail.com> Message-ID: <6a36e7290703191537p13775c26q308c4a2721ccf1c7@mail.gmail.com> On 3/19/07, Bob Ippolito wrote: > On 3/19/07, James Hague wrote: > > Thanks everyone for the replies, though I still haven't worked out a > > solution I'm happy with. Here's the details of what I'm trying to do: > > > > I have an Erlang program that communicates with an external graphics > > "driver" program. This way I can put pretty pictures on the screen > > but without having to micromanage everything from Erlang itself. What > > I was attempting to do was to get updates running more or less at 60 > > Hz (16 microseconds per frame). > > > > My first idea was to track execution time per frame, then sleep the > > rest of the 16 millisecond slice. This didn't work because sleep > > waits a minimum of 10 milliseconds, regardless of the value passed in. > > > > My second idea was to spawn a process at the start of a frame, wait 16 > > milliseconds in that process, then send a message to the original > > process, This works, except the 16 millisecond time can vary quite a > > bit: from 16.8 ms to 22+ ms in my tests. > > > > Any approaches to more precise timing would be appreciated! > > You could write a function that sleeps as much as it can by way of > timer:sleep, and then busywaits the rest? > > How about something like this: > > -module(busywait). > > -export([add_microsec/2, microsleep/1, test/0]). > > -define(JITTER, 5). > > add_microsec(Micro, {Mega0, Sec0, Micro0}) -> > Micro1 = Micro0 + Micro, > Sec1 = Sec0 + (Micro1 div 1000000), > Mega1 = Mega0 + (Sec1 div 1000000), > {Mega1, (Sec1 rem 1000000), (Micro1 rem 1000000)}. > > busywait_until(Target, Loops) -> > case now() of > Now when Now >= Target -> > {Now, Loops}; > _ -> > erlang:yield(), > busywait_until(Target, 1 + Loops) > end. > > microsleep(MicroSec) -> > Target = add_microsec(MicroSec, now()), > AdjMsec = MicroSec - ?JITTER, > case AdjMsec > 10000 of > true -> > timer:sleep(AdjMsec div 1000); > false -> > ok > end, > {Finish, Loops} = busywait_until(Target, 1), > {timer:now_diff(Finish, Target), Loops}. > > test() -> > {Accuracy, Loops} = microsleep(16 * 1000), > io:format("Jitter: ~p ms Iterations: ~p~n", [Accuracy, Loops]). > Of course that should be: io:format("Jitter: ~p us Iterations: ~p~n", [Accuracy, Loops]). Or: io:format("Jitter: ~p ms Iterations: ~p~n", [0.001 * Accuracy, Loops]). -bob From casper2000a@REDACTED Tue Mar 20 08:13:49 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Tue, 20 Mar 2007 12:43:49 +0530 Subject: [erlang-questions] Erlang Port Drivers and Multiple Queues In-Reply-To: <6a36e7290703191537p13775c26q308c4a2721ccf1c7@mail.gmail.com> Message-ID: <20070320071406.02AF519DCEE8@mail.wavenet.lk> Hi, In an Erlang Port Driver, the event received from the Driver to Erlang, is it possible to queue in multiple queues? Does is always have to come to the Port Owner process? I have an Erlang Port Driver, which waits on a Wait Object (POLLIN | POLLPRI). This port receives about 2000 event per second. I see those are getting queued to the Port Owner Process (a gen_server); however the it seems to be processing very slow. The owner process just receives the messages and queues to other processes to process. Therefore theoretically, it shouldn't be this slow. Can port driver blocks or affect the execution speed of Owner Process? How can I over come this problem? Thanks in advance, - Eranga From samuelrivas@REDACTED Tue Mar 20 08:32:22 2007 From: samuelrivas@REDACTED (Samuel Rivas) Date: Tue, 20 Mar 2007 08:32:22 +0100 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: References: Message-ID: <20070320073222.GA31112@lambdastream.com> James Hague wrote: > Thanks everyone for the replies, though I still haven't worked out a > solution I'm happy with. Here's the details of what I'm trying to do: > > I have an Erlang program that communicates with an external graphics > "driver" program. This way I can put pretty pictures on the screen > but without having to micromanage everything from Erlang itself. What > I was attempting to do was to get updates running more or less at 60 > Hz (16 microseconds per frame). > > My first idea was to track execution time per frame, then sleep the > rest of the 16 millisecond slice. This didn't work because sleep > waits a minimum of 10 milliseconds, regardless of the value passed in. > > My second idea was to spawn a process at the start of a frame, wait 16 > milliseconds in that process, then send a message to the original > process, This works, except the 16 millisecond time can vary quite a > bit: from 16.8 ms to 22+ ms in my tests. Since sleeps are inaccurate, you may have to work out how much to sleep before doing it. Also, you must keep a reference to the "origin" to avoid drifting because of uneven waits. Regards. -- Samuel -------------- next part -------------- -module(sleep). -export([tic/1]). tic(Ms) -> tic(Ms, now(), 0). tic(Ms, Then, N) -> Now = now(), sleep_until(N*Ms, Then, Now), io:format("~p~n", [Now]), tic(Ms, Then, N + 1). sleep_until(Ms, Then, Now) -> case timer:now_diff(Now, Then) of N when N < Ms * 1000 -> timer:sleep(Ms - N div 1000); _ -> true end. From mickael.remond@REDACTED Tue Mar 20 09:23:27 2007 From: mickael.remond@REDACTED (=?ISO-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Tue, 20 Mar 2007 09:23:27 +0100 Subject: [erlang-questions] Google summer of codes In-Reply-To: <513427.38469.qm@web43132.mail.sp1.yahoo.com> References: <513427.38469.qm@web43132.mail.sp1.yahoo.com> Message-ID: <60BF0CCE-400D-4F6E-882E-BB9AF7FE2F13@process-one.net> Hello, Le 19 mars 07 ? 09:58, Amila Maha Arachchi a ?crit : > Hi, > > Are there any erlang related projects available in "Google summer > of Codes 2007". If not, does anybody have an idea for such a project? We are mentoring project for the Google summer of code. We are mentoring project in Erlang, around the theme of instant messaging and ejabberd. We have several ideas to improve ejabberd or develop new modules or extension. We can discuss that with those who are interested. Please drop me a mail. -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From pradeep@REDACTED Tue Mar 20 11:44:14 2007 From: pradeep@REDACTED (Pradeep Gunawardana) Date: Tue, 20 Mar 2007 16:14:14 +0530 Subject: [erlang-questions] Cannot Connect to peer node - Jinterface (Siddharth Pareek) In-Reply-To: References: Message-ID: <45FFBAFE.8070406@wavenet.lk> Hi Siddharth Check whether you are trying to connect multiple times using same otppeer . if yes , change the otppeer for unique each time . you can not connect same otppeer multiple times without closing previous connections. you can create deferent class for connect to remote node and handle the all exceptions inside it, here is the little example . public class Conn{ static long baseTime = 1; OtpConnection connection; protected String hidClient; public Conn()throws Exception { hidClient= "_" + baseTime; baseTime = baseTime + 1; } public OtpConnection databaseConn(String peer, String cookie) { try { OtpSelf self = new OtpSelf(hidClient, cookie.trim()); OtpPeer other = new OtpPeer(peer.trim()); return connection = self.connect(other); } catch (Exception exp) { myLogger.error("connection error " + exp.toString()); return null; } } ... ... Regards Pradeep From erlang@REDACTED Tue Mar 20 16:12:00 2007 From: erlang@REDACTED (Peter Lund) Date: Tue, 20 Mar 2007 16:12:00 +0100 Subject: [erlang-questions] Email app for Erlang In-Reply-To: References: <45FE595A.1030605@lundata.se> Message-ID: <45FFF9C0.8060301@lundata.se> PJ Durai skrev: > Peter Lund lundata.se> writes: >> Are you looking for a SMTP client or server? There is a SMTP client >> written by Mike Bradford all in erlang that I am using very successfully. >> >> http://erlang.org/user.html#smtp_client-1.1 >> >> mobiledreamers gmail.com skrev: >>> Ejabberd does jabber/chat >>> eddie - web server >>> for email like qmail/sendmail - ? > > He wants the former I think. A mail server (MTA ?) like SendMail or PostFix. > It would be a killer app in Erlang IMHO. > I have never seen one that is freely available. I do belive you are correct there. I have not either seen any erlang SMTP server implementation published on this list for anyone to use. This is still a to-do item for someone in the erlang community to do. :) /Peter From mobiledreamers@REDACTED Tue Mar 20 21:36:15 2007 From: mobiledreamers@REDACTED (mobiledreamers@REDACTED) Date: Tue, 20 Mar 2007 13:36:15 -0700 Subject: [erlang-questions] Email app for Erlang In-Reply-To: <45FFF9C0.8060301@lundata.se> References: <45FE595A.1030605@lundata.se> <45FFF9C0.8060301@lundata.se> Message-ID: bummer! was hoping to use this instead of python twisted or stackless :( thanks pj durai and peter mark On 3/20/07, Peter Lund wrote: > > PJ Durai skrev: > > Peter Lund lundata.se> writes: > >> Are you looking for a SMTP client or server? There is a SMTP client > >> written by Mike Bradford all in erlang that I am using very > successfully. > >> > >> http://erlang.org/user.html#smtp_client-1.1 > >> > >> mobiledreamers gmail.com skrev: > >>> Ejabberd does jabber/chat > >>> eddie - web server > >>> for email like qmail/sendmail - ? > > > > He wants the former I think. A mail server (MTA ?) like SendMail or > PostFix. > > It would be a killer app in Erlang IMHO. > > I have never seen one that is freely available. > I do belive you are correct there. I have not either seen any erlang > SMTP server implementation published on this list for anyone to use. > This is still a to-do item for someone in the erlang community to do. :) > > /Peter > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Tue Mar 20 23:19:29 2007 From: bob@REDACTED (Bob Ippolito) Date: Tue, 20 Mar 2007 15:19:29 -0700 Subject: [erlang-questions] Email app for Erlang In-Reply-To: References: <45FE595A.1030605@lundata.se> <45FFF9C0.8060301@lundata.se> Message-ID: <6a36e7290703201519p3562be10m34dadba5d8d31c87@mail.gmail.com> Stackless wouldn't really help you much. There's just as many open source SMTP servers written for stackless as there are for Erlang (zero). Twisted does have something that is supposedly pretty complete, but I do not know anyone who has used it other than http://divmod.com/ (they pretty much wrote it all). If you're not up for writing your own implementation, Twisted is probably a pretty good choice. Stackless is not really. -bob On 3/20/07, mobiledreamers@REDACTED wrote: > bummer! was hoping to use this instead of python twisted or stackless :( > thanks pj durai and peter > > mark > > > On 3/20/07, Peter Lund < erlang@REDACTED> wrote: > > PJ Durai skrev: > > > Peter Lund lundata.se> writes: > > >> Are you looking for a SMTP client or server? There is a SMTP client > > >> written by Mike Bradford all in erlang that I am using very > successfully. > > >> > > >> http://erlang.org/user.html#smtp_client-1.1 > > >> > > >> mobiledreamers gmail.com skrev: > > >>> Ejabberd does jabber/chat > > >>> eddie - web server > > >>> for email like qmail/sendmail - ? > > > > > > He wants the former I think. A mail server (MTA ?) like SendMail or > PostFix. > > > It would be a killer app in Erlang IMHO. > > > I have never seen one that is freely available. > > I do belive you are correct there. I have not either seen any erlang > > SMTP server implementation published on this list for anyone to use. > > This is still a to-do item for someone in the erlang community to do. :) > > > > /Peter > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > From jeffm@REDACTED Wed Mar 21 07:24:45 2007 From: jeffm@REDACTED (jm) Date: Wed, 21 Mar 2007 17:24:45 +1100 Subject: [erlang-questions] profiling application In-Reply-To: <45FB39B3.6040907@ghostgun.com> References: <45FA0693.7010204@ghostgun.com> <45FA39A1.7070606@ericsson.com> <45FA3F6E.6030205@ghostgun.com> <45FA5005.8080608@ghostgun.com> <38110.217.128.75.198.1174036871.squirrel@www.geekisp.com> <45FB39B3.6040907@ghostgun.com> Message-ID: <4600CFAD.6020409@ghostgun.com> jm wrote: > Mmmm, seems to be a script with almost the same as the options as I > previously used. Must be some difference in the options though > (-hidden?). Here's the output of etop after a few minutes. As you can > see the process zu_server has 16233 messages in it queue and the memory > usage has blown out. What is the function gen:wait_resp_mon/3? Would I > be right in guessing it's the other half of gen:call? If so how do I > tell which call it's waiting on? For those keeping score: I moved the code to another server of similar specs, but without anything else running on it. The results were encouraging. The CPU utilisation never got above 1% (one percent) and even in a 30-40 minute test with traffic twice that of the original recorded rate the memory utilisation never got above 143MB. When I added another module back in, not included in the original tests, written without the batch commit the old problems started to reappear, so this is now targeted for a rewrite. Jeff. From Norbert.Klamann@REDACTED Wed Mar 21 10:03:59 2007 From: Norbert.Klamann@REDACTED (norbertk) Date: Wed, 21 Mar 2007 09:03:59 +0000 Subject: [erlang-questions] Q: How to wget cean-installer.bin References: Message-ID: <20070321090359.504A55A1FC@mail.erlangsystems.com> Hello all, I try to wget the cean_installer.bin. Maybe I am dense, but I don't see a real URL for downloading over at http://cean.process-one.net/download/. I want to play with Erlang on a virtual ubuntu box without a connection to a physical box, so i cannot download with the Button on that page and copy it over. -- All the best Norbert Klamann <Erlang newbie> _________________________________________________________ Post sent from http://www.trapexit.org From bob@REDACTED Wed Mar 21 10:25:57 2007 From: bob@REDACTED (Bob Ippolito) Date: Wed, 21 Mar 2007 02:25:57 -0700 Subject: [erlang-questions] Q: How to wget cean-installer.bin In-Reply-To: <20070321090359.504A55A1FC@mail.erlangsystems.com> References: <20070321090359.504A55A1FC@mail.erlangsystems.com> Message-ID: <6a36e7290703210225v386268ddw2cf3c664f774fe1b@mail.gmail.com> On 3/21/07, norbertk wrote: > > Hello all, > I try to wget the cean_installer.bin. Maybe I am dense, but I don't see a real URL for downloading over at http://cean.process-one.net/download/. > > I want to play with Erlang on a virtual ubuntu box without a connection to a physical box, so i cannot download with the Button on that page and copy it over. Looks like directory listings are on: http://cean.process-one.net/R11B/devel/linux-x86/ -bob From Norbert.Klamann@REDACTED Wed Mar 21 11:51:23 2007 From: Norbert.Klamann@REDACTED (norbertk) Date: Wed, 21 Mar 2007 10:51:23 +0000 Subject: [erlang-questions] Q: How to wget cean-installer.bin References: Message-ID: <20070321105123.521045A1F7@mail.erlangsystems.com> ... maybe it should be mentioned on the site. -- All the best Norbert Klamann <Erlang newbie> _________________________________________________________ Post sent from http://www.trapexit.org From Norbert.Klamann@REDACTED Wed Mar 21 12:38:23 2007 From: Norbert.Klamann@REDACTED (norbertk) Date: Wed, 21 Mar 2007 11:38:23 +0000 Subject: [erlang-questions] CEAN and Proxy References: Message-ID: <20070321113823.B1EE75A1FC@mail.erlangsystems.com> Hello all, I managed to download the CEAN with wget and try to use it behind a proxy. I wanted to see the available packages with > cean:available(). and got the following error which I do not understand: <---------------------- =ERROR REPORT==== 21-Mar-2007::11:55:10 === ** Generic server <0.34.0> terminating ** Last message in was {{send_req,["http://cean.process-one.net/R11B/devel/linux-x86.lst", [], get, [], [{proxy_host,"proxy..xxx.yy.de"}, {proxy_port,"80"}], 60000]}, {<0.30.0>,#Ref<0.0.0.37>}} ** When Server state == {state,"proxy.xxx.yy.de", "80", false, undefined, [], false, undefined, {[],[]}, undefined, idle, undefined, [], 0, [], undefined, undefined, undefined, false, undefined, undefined, [], false, undefined, undefined} ** Reason for termination == ** {function_clause,[{inet_tcp,getserv,["80"]}, {gen_tcp,connect1,4}, {gen_tcp,connect,4}, {ibrowse_http_client,handle_info,2}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]} <---------------------- At first I forgot to set the HTTP_PROXY variable in the start.sh-Script, but now this is corrected and the value is shown above - whenever masked by me) . I double-checked its value against the one that I used to download the 'cean_installer.bin' itself and it seems to be the same. Thanks for listening ! -- All the best Norbert Klamann <Erlang newbie> _________________________________________________________ Post sent from http://www.trapexit.org From bengt.kleberg@REDACTED Wed Mar 21 12:56:49 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Mar 2007 12:56:49 +0100 Subject: [erlang-questions] CEAN and Proxy In-Reply-To: <20070321113823.B1EE75A1FC@mail.erlangsystems.com> References: <20070321113823.B1EE75A1FC@mail.erlangsystems.com> Message-ID: <46011D81.8060106@ericsson.com> On 2007-03-21 12:38, norbertk wrote: > Hello all, > I managed to download the CEAN with wget and try to use it behind a proxy. > > I wanted to see the available packages with >> cean:available(). > > and got the following error which I do not understand: > <---------------------- > =ERROR REPORT==== 21-Mar-2007::11:55:10 === > ** Generic server <0.34.0> terminating > ** Last message in was {{send_req,["http://cean.process-one.net/R11B/devel/linux-x86.lst", > [], > get, > [], > [{proxy_host,"proxy..xxx.yy.de"}, > {proxy_port,"80"}], > 60000]}, > {<0.30.0>,#Ref<0.0.0.37>}} ...deleted > ** Reason for termination == > ** {function_clause,[{inet_tcp,getserv,["80"]}, > {gen_tcp,connect1,4}, > {gen_tcp,connect,4}, > {ibrowse_http_client,handle_info,2}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]} > > <---------------------- > > At first I forgot to set the HTTP_PROXY variable in the start.sh-Script, but now this is corrected and the value is shown above - whenever masked by me) . I double-checked its value against the one that I used to download the 'cean_installer.bin' itself and it seems to be the same. that is a know proxy bug. see http://www.process-one.net/en/forum/viewthread/26/ post #3 for an example. i have fixed the bug and can offer a cean beam file to everybody interested. bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From ulf.wiger@REDACTED Wed Mar 21 13:36:38 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Wed, 21 Mar 2007 13:36:38 +0100 Subject: [erlang-questions] who owns an open file Message-ID: <6616D98C65DD514BA2E1DDC5F922315501716498@esealmw115.eemea.ericsson.se> I had reason to debug a system that ran out of file descriptors. It was easy enough to verify that the list of ports kept growing, and to extract the new ports in each poll iteration. More difficult - surprisingly - to figure out who owned the open files. erlang:port_info(P) will give the pid of the controlling process. In this case, it's a file_io_server. It will be linked to the process which spawned it - this is always file_server. But file_server has no info of who ordered the opening of the file. The file_io_server does, but keeps it in a state variable, and doesn't respond to e.g. sys:get_status(Pid). Finally, I wrote the following hacks in the shell: 1> Owner = fun(P) -> {backtrace,Bin} = process_info(P,backtrace), Str = binary_to_list(Bin), {match,Start,Len} = regexp:match(Str,"#Port<.*>,.*}},"), [PidS|_] = string:tokens(string:sub_string(Str,Start+Len),"<>"), list_to_pid("<"++PidS++">") end. #Fun 2> {ok,Fd} = file:open("foo.txt",[write]) . {ok,<0.80.0>} 3> Owner(Fd). <0.70.0> 4> self(). <0.70.0> 5> Filename = ets:lookup_element(file_io_servers,Fd,2). "foo.txt" There should be a better way. BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Wed Mar 21 14:07:56 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 21 Mar 2007 14:07:56 +0100 Subject: [erlang-questions] Good one-liners? Message-ID: Hi, I keep seeing these perl programmers in teeshirts with one-liners printed on them. It made me think about what erlang one-liners I would want on a teeshirt. I mean, something in erlang that gives you the same fuzzy feeling as math people get over eulers identity: e^{j*pi} + 1 = 0 Or something world domination-ish: [enlight(P) || P <- Programmers, false == knows_erlang(P)] PS Why not have a parallel list-comprehension syntax? What pmap is to map. From james.hague@REDACTED Wed Mar 21 14:30:28 2007 From: james.hague@REDACTED (James Hague) Date: Wed, 21 Mar 2007 08:30:28 -0500 Subject: [erlang-questions] Minimum time for timer:sleep()? In-Reply-To: <20070320073222.GA31112@lambdastream.com> References: <20070320073222.GA31112@lambdastream.com> Message-ID: I ended up using something along the lines of Bob's solution, sleeping for 10 millisecond chunks and then busy-waiting the rest. I've gotta admit that busy-waiting on such a fast machine feels completely wrong to me--but it does give almost microsecond-perfect timing. I spawn the wait loop into its own process, to minimize the garbage collection times caused by flooding memory with tuples from now/1 and timer:now_diff/2. When I got around to trying this under Windows, I found sleep is even worse than under OS X. The minimum sleep time is 16,000 microseconds (compared to 10,000) and the drift is all over the place: sleep(100) takes 110,000 microseconds, sleep(20) takes 31,000 microseconds. So now I'm busy-waiting all the time; no calls to sleep. I'm getting a much better appreciation for what it takes to push Erlang in a slightly harder real-time direction. I'll post the results of further experiments when I have time to work through them. James From peter@REDACTED Wed Mar 21 15:39:28 2007 From: peter@REDACTED (Peter Mechlenborg) Date: Wed, 21 Mar 2007 15:39:28 +0100 Subject: [erlang-questions] Module mock-up's Message-ID: <460143A0.5030805@mu.dk> Hi, When writing tests I often find that I want to test the module that I working on, in isolation from the rest of the system. In the past I have sometimes created mock-up processes, for the parts of my system that interacts with the module I'm testing. This works well for some cases, but normally processes are encapsulated by a module, and what I really want to do is to create a mock-up of the module instead of the process. I haven't found anything with Google, and before I start trying to implementing a module-mock-up library, I would like to know if anyone have done anything similar, creating mock-up modules? I would also like to know if I'm missing something simple - how do you guys normally test Erlang code that depends on other modules, without creating a complete integration test?. In other words I guess my question is, how to do unit tests at the level of modules en Erlang? Sincerely your, -- Peter Mechlenborg From pacini@REDACTED Wed Mar 21 16:37:49 2007 From: pacini@REDACTED (Filippo Pacini) Date: Wed, 21 Mar 2007 16:37:49 +0100 Subject: [erlang-questions] Module mock-up's In-Reply-To: <460143A0.5030805@mu.dk> References: <460143A0.5030805@mu.dk> Message-ID: <4601514D.8090602@sgconsulting.it> Hi, I'm not sure this is what you need, but did you look at eunit? Google for eunit erlang. For my tests I use a small module I developed when I was learning erlang. It's enough for most of my needs, though I should really learn the test_server and yatsy :-) If you want to take a look download sgte: http://code.google.com/p/sgte/ It's the file sgeunit.erl in the test/src directory. In the file you find some test to test itself. cheers, filippo Peter Mechlenborg wrote: > Hi, > > When writing tests I often find that I want to test the module that I > working on, in isolation from the rest of the system. > In the past I have sometimes created mock-up processes, for the parts of > my system that interacts with the module I'm testing. This works well > for some cases, but normally processes are encapsulated by a module, and > what I really want to do is to create a mock-up of the module instead of > the process. > > I haven't found anything with Google, and before I start trying to > implementing a module-mock-up library, I would like to know if anyone > have done anything similar, creating mock-up modules? > > I would also like to know if I'm missing something simple - how do you > guys normally test Erlang code that depends on other modules, without > creating a complete integration test?. In other words I guess my > question is, how to do unit tests at the level of modules en Erlang? > > Sincerely your, > > -- Peter Mechlenborg From christophe.romain@REDACTED Wed Mar 21 17:24:33 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 21 Mar 2007 17:24:33 +0100 Subject: [erlang-questions] CEAN and Proxy In-Reply-To: <20070321113823.B1EE75A1FC@mail.erlangsystems.com> References: <20070321113823.B1EE75A1FC@mail.erlangsystems.com> Message-ID: <7FE4785E-2249-4161-B141-76F68363A092@process-one.net> Several patches are actually into the pipe, including bengt's patch and windows related issues. they all will be uploaded to the site in few days. regards. From christophe.romain@REDACTED Wed Mar 21 17:26:41 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 21 Mar 2007 17:26:41 +0100 Subject: [erlang-questions] Q: How to wget cean-installer.bin In-Reply-To: <20070321090359.504A55A1FC@mail.erlangsystems.com> References: <20070321090359.504A55A1FC@mail.erlangsystems.com> Message-ID: Hello, complete url is: http://cean.process-one.net/pub/R11B/devel/linux-x86/cean-installer.bin or http://cean.process-one.net/pub/R11B/devel/linux-x86/cean_base.tar.gz you can change devel to prod if you want stripped beam and so sources. From lenartlad@REDACTED Wed Mar 21 19:32:35 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 21 Mar 2007 19:32:35 +0100 Subject: [erlang-questions] Module mock-up's In-Reply-To: <460143A0.5030805@mu.dk> References: <460143A0.5030805@mu.dk> Message-ID: <46017A43.2090007@volny.cz> Peter Mechlenborg wrote: > Hi, > > When writing tests I often find that I want to test the module that I > working on, in isolation from the rest of the system. > In the past I have sometimes created mock-up processes, for the parts of > my system that interacts with the module I'm testing. This works well > for some cases, but normally processes are encapsulated by a module, and > what I really want to do is to create a mock-up of the module instead of > the process. > > I haven't found anything with Google, and before I start trying to > implementing a module-mock-up library, I would like to know if anyone > have done anything similar, creating mock-up modules? > > I would also like to know if I'm missing something simple - how do you > guys normally test Erlang code that depends on other modules, without > creating a complete integration test?. In other words I guess my > question is, how to do unit tests at the level of modules en Erlang? Hello. First, I'd like to appologize for a rather long answer, I just don't know when to stop... :-) I will start by answering your question about "mock-up" modules, though I am affraid that I will disappoint you a little bit. We implemented a simple 'sniffer' module. This is a process (not even a 'gen' thing) that stores all incoming messages in a list and responds to two messages: 'stop' and 'get_message'. The second returns the oldest buffered message to the caller process (and removes it from the buffer). The caller in our case is the 'shell_eval' process running the tests. The example usage is like: test_function(Pid, Sniffer) -> %% No message arrives to the sniffer in 10 milliseconds. ?assert({error, timeout}, sniffer:wait(Sniffer, 10)), some:action(Pid), %% This effectively means that some:action(Pid) sends %% a message 'message' to the sniffer within 10 milliseconds. ?assert({ok, message}, sniffer:wait(Sniffer, 10)), ok. Function sniffer:wait/2 returns one of: * {ok, Message} * {error, timeout} We implemented sniffer in such a way that it "understands" a gen_XXX messages (cast, call, event, ...) and returns us only "our" part of them. As you can see we actually didn't implement your mock-up module to be replaced for the real one, we just check that the tested process sends the "right" messages in proper order so later when it is connected to the real process, all works as expected. Though odd it might seem, it actually works for us pretty well. And to answer your first question... I started to learn Erlang (not a long time ago) by writing my own testing framework with colleagues of mine. We wrote it in TD (test-driven) style just as Kent Beck did in his famous "Test-Driven Development By Example". We literally went step by step through the book. The only difference was the language. This petty project has grown over past few months and we happily use it ever since in our daily Erlang work. Because we were all used to OO idiom, we wanted it to be as similar as possible to the style we were already familiar with. An example testing module now looks like: ---------------------------------------------------------------- %%% Module name is not important but as a convention we append "_tests". -module(some_tests). -export([setup_test/1, teardown_test/1, test_f/1]). -export([setup__other__test/1, teardown__other__test/1, test__other__f/1]). -export([test__no_setup__f/1]). %%% This attribute annotates a test module. %%% By this we can easily filter which tests to run: %%% * run all tests: eunit:run() %%% * run only "some" tests: eunit:run(some). -test_categories([all, some]). %% Called before each test function with signature test_XXX/1 %% (test_f/1 in this example). setup_test(_) -> "test_config". %% Called after each test function with signature test_XXX/1. %% The test framework guarantees that the teardown is called %% even if there is an error in a test. teardown_test("test_config") -> %% clean up ok. %% A test. test_f("test_config) -> ?assert(true, true). %% Called before each test function with signature test__other__XXX/1. setup__other__test(_) -> "other_test_config". %% Called after each test function with signature test__other__XXX/1. teardown__other__test("other_test_config") -> %% clean up ok. %% A test. test__other__f("other_test_config") -> ?fail. %% A test without a setup or teardown function is also possible. test__no_setup__f(_) -> Fun = fun () -> throw("ex") end, ?should_raise(Fun, throw, "ex"), ok. ---------------------------------------------------------------- We invoke tests from the erlang shell: eunit:report(complete, eunit:run()). Function eunit:report/2 only pretty prints the results. I hope this inspires you to write YOUR BEST eunit... :-) Ladislav Lenart From agl@REDACTED Wed Mar 21 20:24:27 2007 From: agl@REDACTED (Adam Langley) Date: Wed, 21 Mar 2007 12:24:27 -0700 Subject: [erlang-questions] ThinkingParallel interview Message-ID: <396556a20703211224y31560313secca4bfec78a3b3@mail.gmail.com> http://www.thinkingparallel.com/2007/03/20/ten-questions-with-joe-armstrong-about-parallel-programming-and-erlang/ In one of your answers, you name a few features that you would consider for a second-system implementation of Erlang. Some of the points are clear (I'm thinking of the distributed/capability ideas, much of which have been fleshed out by others[1]). But would you mind elaborating on what you had in mind when you spoke of first-class protocols and a contracts system for them. Are you thinking of a type-system for protocols? If so, how do you see it working? Thanks [1] http://www.erights.org/ -- Adam Langley agl@REDACTED http://www.imperialviolet.org 650-283-9641 From Bob.Cowdery@REDACTED Wed Mar 21 20:35:26 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Wed, 21 Mar 2007 19:35:26 -0000 Subject: [erlang-questions] gen-fsm problem Message-ID: <3A76756EED583B43A4AD704E29CCD0797411E7@mail.aprsmartlogik.com> Hi all, Could some kind person tell me how to figure out what's wrong here. It's my first gen-fsm module. Just stand-alone not part of a supervisor tree. As far as I can tell the state machine is initialised and it's in the right initial state and the event and state data matches the function-clause. The idle function is not entered. Thanks Bob =ERROR REPORT==== 21-Mar-2007::19:23:33 === ** State machine 'erlink-sm' terminating ** Last event in was {"INIT_ENVIRONMENT", {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}}} ** When State == idle ** Data == [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}] ** Reason for termination = ** {function_clause,[{sm_sdr1000,idle, [{"INIT_ENVIRONMENT", {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}}}, [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}]] }, {gen_fsm,handle_msg,7}, {proc_lib,init_p,5}]} From serge@REDACTED Wed Mar 21 20:47:39 2007 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 21 Mar 2007 15:47:39 -0400 Subject: [erlang-questions] gen-fsm problem In-Reply-To: <3A76756EED583B43A4AD704E29CCD0797411E7@mail.aprsmartlogik.com> References: <3A76756EED583B43A4AD704E29CCD0797411E7@mail.aprsmartlogik.com> Message-ID: <46018BDB.8080701@hq.idt.net> There's no matching function clause found when evaluating sm_sdr1000:idle({"INIT_ENVIRONMENT", {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}}}, State). You might've forgotten to include an idle function accepting this parameter: {"INIT_ENVIRONMENT", _}. Serge Bob Cowdery wrote: > Hi all, > > Could some kind person tell me how to figure out what's wrong here. It's my first gen-fsm module. Just stand-alone not part of a supervisor tree. As far as I can tell the state machine is initialised and it's in the right initial state and the event and state data matches the function-clause. The idle function is not entered. > > Thanks > Bob > > > =ERROR REPORT==== 21-Mar-2007::19:23:33 === > ** State machine 'erlink-sm' terminating > ** Last event in was {"INIT_ENVIRONMENT", > {{0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}}} > ** When State == idle > ** Data == [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}] > ** Reason for termination = > ** {function_clause,[{sm_sdr1000,idle, > [{"INIT_ENVIRONMENT", > {{0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}}}, > [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}]] > }, > {gen_fsm,handle_msg,7}, > {proc_lib,init_p,5}]} > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From Bob.Cowdery@REDACTED Wed Mar 21 22:05:32 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Wed, 21 Mar 2007 21:05:32 -0000 Subject: [erlang-questions] gen-fsm problem Message-ID: <3A76756EED583B43A4AD704E29CCD0797411E8@mail.aprsmartlogik.com> Serge Thanks, after playing with the pattern to see what it was actually getting I spotted my deliberate mistake of wrapping the State in []. Too long playing with Jython which is at the other end of this link! Bob There's no matching function clause found when evaluating sm_sdr1000:idle({"INIT_ENVIRONMENT", {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}}}, State). You might've forgotten to include an idle function accepting this parameter: {"INIT_ENVIRONMENT", _}. Serge Bob Cowdery wrote: > Hi all, > > Could some kind person tell me how to figure out what's wrong here. It's my first gen-fsm module. Just stand-alone not part of a supervisor tree. As far as I can tell the state machine is initialised and it's in the right initial state and the event and state data matches the function-clause. The idle function is not entered. > > Thanks > Bob > > > =ERROR REPORT==== 21-Mar-2007::19:23:33 === > ** State machine 'erlink-sm' terminating > ** Last event in was {"INIT_ENVIRONMENT", > {{0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}}} > ** When State == idle > ** Data == [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}] > ** Reason for termination = > ** {function_clause,[{sm_sdr1000,idle, > [{"INIT_ENVIRONMENT", > {{0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}, > {0,0}}}, > [{<4683.45.0>,ui,st,dsp,hw,"D:\\srs\\state"}]] > }, > {gen_fsm,handle_msg,7}, > {proc_lib,init_p,5}]} > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From mle+erlang@REDACTED Thu Mar 22 01:32:51 2007 From: mle+erlang@REDACTED (Erik de Castro Lopo) Date: Thu, 22 Mar 2007 11:32:51 +1100 Subject: [erlang-questions] Pleac anyone? Message-ID: <20070322113251.e1a0afe1.mle+erlang@mega-nerd.com> Hi all, I'm about to start learning Erlang. When I learned Ocaml a couple of years ago, the Pleac project on sourceforge: http://pleac.sourceforge.net/ was really, *REALLY* useful. Pleac contains all sections of the Perl Cookbook translated into other languages, a sort of computer language Rosetta stone. Unfortunately, the Erlang entry is rather sparse: http://pleac.sourceforge.net/pleac_erlang/index.html As I learn Erlang, I'll probably add some stuff, but it would be really cool if other learners like myself (or experienced hands) also contributed. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ Muslim protestors called for the implementation of Sharia Law in Britain. -- http://www.timesonline.co.uk/article/0,,2-2218601,00.html From michal@REDACTED Thu Mar 22 03:41:45 2007 From: michal@REDACTED (Michal Slaski) Date: Thu, 22 Mar 2007 03:41:45 +0100 Subject: [erlang-questions] Pleac anyone? In-Reply-To: <20070322113251.e1a0afe1.mle+erlang@mega-nerd.com> References: <20070322113251.e1a0afe1.mle+erlang@mega-nerd.com> Message-ID: <84d062da0703211941p7accb2b9w57f4d7834f7b593e@mail.gmail.com> Hi Erik, If you like to use cookbooks while learning a language check the Erlang cookbook on TrapExit http://wiki.trapexit.org/index.php/Category:CookBook which was ported from the original cookbook on http://schemecookbook.org/Erlang/WebHome Cheers, Michal -- Michal Slaski http://www.erlang-consulting.com From beepblip@REDACTED Thu Mar 22 05:46:47 2007 From: beepblip@REDACTED (beepblip@REDACTED) Date: Wed, 21 Mar 2007 21:46:47 -0700 Subject: [erlang-questions] Idioms for logging to a file Message-ID: <7cb7cf500703212146k5b18901fr171e6e93896a950f@mail.gmail.com> hi, any idioms for logging. I want to log application events in a similar way that Apache does (this isn't a web server though). What is the best practice in Erlang? -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Thu Mar 22 09:10:44 2007 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 22 Mar 2007 09:10:44 +0100 Subject: [erlang-questions] Module mock-up's In-Reply-To: <46017A43.2090007@volny.cz> References: <460143A0.5030805@mu.dk> <46017A43.2090007@volny.cz> Message-ID: <46023A04.9050500@it.uu.se> Ladislav Lenart wrote: > We invoke tests from the erlang shell: > eunit:report(complete, eunit:run()). > Function eunit:report/2 only pretty prints the results. Your examples seem a bit odd. Are you using the ancient version of eunit? You can get the newer, completely rewritten version here: http://svn.process-one.net/contribs/trunk/eunit (It should be better documented and be published properly, I know. I'll try to fix that.) /Richard From tobbe@REDACTED Thu Mar 22 09:16:51 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 22 Mar 2007 09:16:51 +0100 Subject: [erlang-questions] Idioms for logging to a file In-Reply-To: <7cb7cf500703212146k5b18901fr171e6e93896a950f@mail.gmail.com> References: <7cb7cf500703212146k5b18901fr171e6e93896a950f@mail.gmail.com> Message-ID: beepblip@REDACTED wrote: > > hi, any idioms for logging. I want to log application events in a > similar way that Apache does (this isn't a web server though). What is > the best practice in Erlang? > One alternative may be yfront/src/wraplog.erl as found in jungerl. Cheers, Tobbe From chsu79@REDACTED Thu Mar 22 09:21:55 2007 From: chsu79@REDACTED (Christian S) Date: Thu, 22 Mar 2007 09:21:55 +0100 Subject: [erlang-questions] ThinkingParallel interview In-Reply-To: <396556a20703211224y31560313secca4bfec78a3b3@mail.gmail.com> References: <396556a20703211224y31560313secca4bfec78a3b3@mail.gmail.com> Message-ID: Have you seen this work? : http://www.sics.se/~joe/ubf/site/home.html On 3/21/07, Adam Langley wrote: > But would you mind elaborating on what you had in mind when you spoke > of first-class protocols and a contracts system for them. Are you > thinking of a type-system for protocols? If so, how do you see it > working? From mats.cronqvist@REDACTED Thu Mar 22 09:24:10 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 22 Mar 2007 09:24:10 +0100 Subject: [erlang-questions] Idioms for logging to a file In-Reply-To: References: <7cb7cf500703212146k5b18901fr171e6e93896a950f@mail.gmail.com> Message-ID: <46023D2A.9090806@ericsson.com> Torbjorn Tornkvist wrote: > beepblip@REDACTED wrote: >> >> hi, any idioms for logging. I want to log application events in a >> similar way that Apache does (this isn't a web server though). What is >> the best practice in Erlang? >> > > One alternative may be yfront/src/wraplog.erl as found in jungerl. > or perhaps error_logger in the kernel application. mats From lenartlad@REDACTED Thu Mar 22 09:35:20 2007 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 22 Mar 2007 09:35:20 +0100 Subject: [erlang-questions] Module mock-up's In-Reply-To: <46023A04.9050500@it.uu.se> References: <460143A0.5030805@mu.dk> <46017A43.2090007@volny.cz> <46023A04.9050500@it.uu.se> Message-ID: <46023FC8.7060102@volny.cz> Richard Carlsson wrote: > Ladislav Lenart wrote: >> We invoke tests from the erlang shell: >> eunit:report(complete, eunit:run()). >> Function eunit:report/2 only pretty prints the results. > > Your examples seem a bit odd. Are you using the ancient version > of eunit? You can get the newer, completely rewritten version here: > > http://svn.process-one.net/contribs/trunk/eunit > > (It should be better documented and be published properly, I know. > I'll try to fix that.) Nope, we are using our own testing framework which has accidentally the same name as "the official" one. Sorry for the mess, I thought it was clear from the mail... Ladislav Lenart From mats.cronqvist@REDACTED Thu Mar 22 09:50:27 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 22 Mar 2007 09:50:27 +0100 Subject: [erlang-questions] who owns an open file In-Reply-To: <6616D98C65DD514BA2E1DDC5F922315501716498@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F922315501716498@esealmw115.eemea.ericsson.se> Message-ID: <46024353.7080502@ericsson.com> Ulf Wiger (TN/EAB) wrote: > I had reason to debug a system that ran out of file descriptors. It was > easy enough to verify that the list of ports kept growing, and to > extract the new ports in each poll iteration. More difficult - > surprisingly - to figure out who owned the open files. > > erlang:port_info(P) will give the pid of the controlling process. In > this case, it's a file_io_server. It will be linked to the process which > spawned it - this is always file_server. But file_server has no info of > who ordered the opening of the file. The file_io_server does, but keeps > it in a state variable, and doesn't respond to e.g. sys:get_status(Pid). > > Finally, I wrote the following hacks in the shell: > > 1> Owner = fun(P) -> {backtrace,Bin} = process_info(P,backtrace), Str = > binary_to_list(Bin), {match,Start,Len} = > regexp:match(Str,"#Port<.*>,.*}},"), [PidS|_] = > string:tokens(string:sub_string(Str,Start+Len),"<>"), > list_to_pid("<"++PidS++">") end. > > #Fun > 2> {ok,Fd} = file:open("foo.txt",[write]) . > {ok,<0.80.0>} > 3> Owner(Fd). > <0.70.0> > 4> self(). > <0.70.0> > 5> Filename = ets:lookup_element(file_io_servers,Fd,2). > "foo.txt" > > > There should be a better way. > trying to outdo me in the Horrible One-Liner Competition? Hah! [{process_info(Pid,monitors),ets:lookup(file_io_servers,Pid)}||[{name,"efile"},{links,[Pid]}|_]<-[erlang:port_info(P) || P <- erlang:ports()]]. mats From ulf.wiger@REDACTED Thu Mar 22 10:00:41 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 22 Mar 2007 10:00:41 +0100 Subject: [erlang-questions] who owns an open file In-Reply-To: <46024353.7080502@ericsson.com> Message-ID: <6616D98C65DD514BA2E1DDC5F922315501744F45@esealmw115.eemea.ericsson.se> Mats Cronqvist: > > trying to outdo me in the Horrible One-Liner Competition? Hah! > > > [{process_info(Pid,monitors),ets:lookup(file_io_servers,Pid)}| > |[{name,"efile"},{links,[Pid]}|_]<-[erlang:port_info(P) > || P <- erlang:ports()]]. I pronounce that my solution was more horrible than yours. (: (I'd actually missed process_info(P,monitors). I just assumed that it didn't exist. I obviously haven't read TFM closely enough.) BR, Ulf W From tobbe@REDACTED Thu Mar 22 10:12:00 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 22 Mar 2007 10:12:00 +0100 Subject: [erlang-questions] who owns an open file In-Reply-To: <46024353.7080502@ericsson.com> References: <6616D98C65DD514BA2E1DDC5F922315501716498@esealmw115.eemea.ericsson.se> <46024353.7080502@ericsson.com> Message-ID: Mats Cronqvist wrote: > Ulf Wiger (TN/EAB) wrote: >> I had reason to debug a system that ran out of file descriptors. It was >> easy enough to verify that the list of ports kept growing, and to >> extract the new ports in each poll iteration. More difficult - >> surprisingly - to figure out who owned the open files. >> >> erlang:port_info(P) will give the pid of the controlling process. In >> this case, it's a file_io_server. It will be linked to the process which >> spawned it - this is always file_server. But file_server has no info of >> who ordered the opening of the file. The file_io_server does, but keeps >> it in a state variable, and doesn't respond to e.g. sys:get_status(Pid). >> >> Finally, I wrote the following hacks in the shell: >> >> 1> Owner = fun(P) -> {backtrace,Bin} = process_info(P,backtrace), Str = >> binary_to_list(Bin), {match,Start,Len} = >> regexp:match(Str,"#Port<.*>,.*}},"), [PidS|_] = >> string:tokens(string:sub_string(Str,Start+Len),"<>"), >> list_to_pid("<"++PidS++">") end. >> >> #Fun >> 2> {ok,Fd} = file:open("foo.txt",[write]) . >> {ok,<0.80.0>} >> 3> Owner(Fd). >> <0.70.0> >> 4> self(). >> <0.70.0> >> 5> Filename = ets:lookup_element(file_io_servers,Fd,2). >> "foo.txt" >> >> >> There should be a better way. >> > > trying to outdo me in the Horrible One-Liner Competition? Hah! > > > [{process_info(Pid,monitors),ets:lookup(file_io_servers,Pid)}||[{name,"efile"},{links,[Pid]}|_]<-[erlang:port_info(P) > || P <- erlang:ports()]]. > > mats Beautiful! :-) There is also, from the shell: C-c o (shown to me by Magnus.F) --Tobbe From mats.cronqvist@REDACTED Thu Mar 22 10:22:27 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 22 Mar 2007 10:22:27 +0100 Subject: [erlang-questions] who owns an open file In-Reply-To: <6616D98C65DD514BA2E1DDC5F922315501744F45@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F922315501744F45@esealmw115.eemea.ericsson.se> Message-ID: <46024AD3.4090001@ericsson.com> Ulf Wiger (TN/EAB) wrote: > Mats Cronqvist: >> trying to outdo me in the Horrible One-Liner Competition? Hah! >> >> >> [{process_info(Pid,monitors),ets:lookup(file_io_servers,Pid)}| >> |[{name,"efile"},{links,[Pid]}|_]<-[erlang:port_info(P) >> || P <- erlang:ports()]]. > > I pronounce that my solution was more horrible than yours. (: true enough... bested again... perhaps this could be turned into file:list_open_files/0? mats From dmitriid@REDACTED Thu Mar 22 13:18:59 2007 From: dmitriid@REDACTED (Dmitrii 'Mamut' Dimandt) Date: Thu, 22 Mar 2007 14:18:59 +0200 Subject: [erlang-questions] ThinkingParallel interview In-Reply-To: References: <396556a20703211224y31560313secca4bfec78a3b3@mail.gmail.com> Message-ID: <46027433.9090205@gmail.com> Hm. I'm running into this from time to time. And this time I am really interested in this. However ubf seems to be no longer supported/developed. I doesn't even compile as it has syntax errors in, for example, contract_lex.erl file I wonder if anyone (or may be Joe Armstrong himself ;) ) could continue work on UBF... Christian S wrote: > Have you seen this work? : > http://www.sics.se/~joe/ubf/site/home.html > > On 3/21/07, Adam Langley wrote: > >> But would you mind elaborating on what you had in mind when you spoke >> of first-class protocols and a contracts system for them. Are you >> thinking of a type-system for protocols? If so, how do you see it >> working? >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From surindar.shanthi@REDACTED Thu Mar 22 15:47:39 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Thu, 22 Mar 2007 20:17:39 +0530 Subject: [erlang-questions] prim_inet:send/2 Message-ID: <42ea5fb60703220747n7aea7988y71a7a4b0340ca896@mail.gmail.com> Dear all, We have developed a server using erlang in Windows server 2003. As many as 200 client would be simultaneously connected to this server through TCP/IP connection. When I view the process manager table in the server, an internal process called prim_inet:send/2 is always having around 400 messages in queue. Why this process is always having messages in queue? Whether it will affect the performance of the system in any way? If so, is there any way to sort out the problem? Please give your inputs...! -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From surindar.shanthi@REDACTED Thu Mar 22 16:12:58 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Thu, 22 Mar 2007 20:42:58 +0530 Subject: [erlang-questions] Error while writing to a file Message-ID: <42ea5fb60703220812o26faff95gc39ea9c3d78fddda@mail.gmail.com> Dear all, I have an application in Erlang which has as many as 200 processes running simultaneously. All the 200 process will access a process (Module name -file_writer) which write log to a file. Sometimes, the following error is occured. =ERROR REPORT==== 22-Mar-2007::15:45:16 === ** Generic server file_writer terminating ** Last message in was {'$gen_cast',{write_log, "22/3/2007", "15:45:16", "Empty", "Process_63", "Process 63 log off"}} ** When Server state == [<0.45.0>,<0.44.0>] ** Reason for termination == ** {badarg,[{io,put_chars,[<0.45.0>,"22/3/2007"]}, {io,o_request,2}, {file_writer,handle_cast,2}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]} Please help me in sorting out this problem. -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From beepblip@REDACTED Thu Mar 22 22:51:41 2007 From: beepblip@REDACTED (beepblip@REDACTED) Date: Thu, 22 Mar 2007 14:51:41 -0700 Subject: [erlang-questions] Idioms for logging to a file In-Reply-To: <46023D2A.9090806@ericsson.com> References: <7cb7cf500703212146k5b18901fr171e6e93896a950f@mail.gmail.com> <46023D2A.9090806@ericsson.com> Message-ID: <7cb7cf500703221451j7ba55c1t262f4a706b0fd6ed@mail.gmail.com> I now have enough to go on. Big thanks to: Mats, RCB, & Tobbe -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Fri Mar 23 03:36:53 2007 From: jay@REDACTED (Jay Nelson) Date: Thu, 22 Mar 2007 18:36:53 -0800 Subject: [erlang-questions] Thinking Parallel interview Message-ID: <46033D45.8010205@duomark.com> Dmitrii wrote: >I wonder if anyone ... could continue work on UBF... No promises or previews, but I plan to be using it for my own projects. Will start on something in about a month that may prove useful to others. jay From samuel.hornus@REDACTED Fri Mar 23 07:35:56 2007 From: samuel.hornus@REDACTED (Samuel Hornus) Date: Fri, 23 Mar 2007 15:35:56 +0900 Subject: [erlang-questions] knowing if messages are available with 'ei' Message-ID: Hello, Please pardon my ignorance as I'm new to Erlang. I am implementing a C-node that send and receive messages to erlang processes. I'm using the 'ei' library. I'd like to know if there is a way to check wether a message has arrived or not ? Currently I do this with : int got = ei_xreceive_msg_tmo(gFD, &emsg, &eibuf, 1); This has many problems : 1/ it does eat at least 1precious millisecond (probably much more). 2/ if the mailbox is empty, it returns an error due to timeout, which can be confused with "real" errors. So, is there a nicer solution ? or a way to avoid checking for new messages ? The reason is that the C-node implements graphical representation every, say, 30 milliseconds. Before re-drawing, I wantto check if new messages modifying the state of the elements to be drawn have arrived or not... witout wasting 1 millisecond timeout. Also, is there a way to do that in Erlang (maybe with 'after 0' statement in a receive expression, but I'm not sure). Thanks you very much, -- Samuel From raimo+erlang-questions@REDACTED Fri Mar 23 09:15:36 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 23 Mar 2007 09:15:36 +0100 Subject: [erlang-questions] prim_inet:send/2 In-Reply-To: <42ea5fb60703220747n7aea7988y71a7a4b0340ca896@mail.gmail.com> References: <42ea5fb60703220747n7aea7988y71a7a4b0340ca896@mail.gmail.com> Message-ID: <20070323081536.GA16058@erix.ericsson.se> It does not seem likely you have "a process called prim_inet:send/2". It is also not likely it was spawned as prim_inet:send/2. The most likely option is that you have a process stuck in prim_inet:send/2 where it has given a command to the inet driver and is waiting for the response. So, is this process the only one sending replies to your clients? And why does it get so many messages from other Erlang processes, and is there no flow control on those messages. The normal way to design a server handling many clients is to have one listening process and when accepting connections branch them off to separate processes for each TPC connection. Then the clients can be handled in parallel within the server. Try such a design and see if it helps. On Thu, Mar 22, 2007 at 08:17:39PM +0530, Surindar Sivanesan wrote: > Dear all, > We have developed a server using erlang in Windows server 2003. As many as > 200 client would be simultaneously connected to this server through TCP/IP > connection. When I view the process manager table in the server, an > internal process called prim_inet:send/2 is always having around 400 > messages in queue. Why this process is always having messages in queue? > Whether it will affect the performance of the system in any way? If so, is > there any way to sort out the problem? > Please give your inputs...! > -- > with regards, > S.Surindar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Fri Mar 23 11:32:34 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 23 Mar 2007 11:32:34 +0100 Subject: [erlang-questions] knowing if messages are available with 'ei' In-Reply-To: References: Message-ID: <4603ACC2.3020302@ericsson.com> Samuel Hornus wrote: > Hello, > Please pardon my ignorance as I'm new to Erlang. > I am implementing a C-node that send and receive messages to erlang > processes. I'm using the 'ei' library. > I'd like to know if there is a way to check wether a message has > arrived or not ? > [...] > So, is there a nicer solution ? or a way to avoid checking for new messages ? you can call select() on the fd you get from ei_connect(). that's what i (or rather, glib) do in gtknode. > Also, is there a way to do that in Erlang (maybe with 'after 0' statement in a > receive expression, but I'm not sure). 1> process_info(self(),message_queue_len). {message_queue_len,0} mats p.s. is your application described anywhere? sounds interesting. From surindar.shanthi@REDACTED Fri Mar 23 11:59:14 2007 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 23 Mar 2007 16:29:14 +0530 Subject: [erlang-questions] prim_inet:send/2 In-Reply-To: <20070323081536.GA16058@erix.ericsson.se> References: <42ea5fb60703220747n7aea7988y71a7a4b0340ca896@mail.gmail.com> <20070323081536.GA16058@erix.ericsson.se> Message-ID: <42ea5fb60703230359j6eb0a870ve9d012214d6e5494@mail.gmail.com> On 3/23/07, Raimo Niskanen wrote: > > It does not seem likely you have "a process called prim_inet:send/2". > > It is also not likely it was spawned as prim_inet:send/2. > > The most likely option is that you have a process stuck in > prim_inet:send/2 where it has given a command to the inet driver > and is waiting for the response. >> You are exactly right. I think the exact function is gstk_port_handler:idle/1 [Surindar] So, is this process the only one sending replies to your clients? > And why does it get so many messages from other Erlang processes, > and is there no flow control on those messages. > > The normal way to design a server handling many clients is to > have one listening process and when accepting connections > branch them off to separate processes for each TPC connection. > Then the clients can be handled in parallel within the server. > > Try such a design and see if it helps. >>In our case too every client will communicate to the server through seperate TCP/IP communication.[Surindar] On Thu, Mar 22, 2007 at 08:17:39PM +0530, Surindar Sivanesan wrote: > > Dear all, > > We have developed a server using erlang in Windows server 2003. As many > as > > 200 client would be simultaneously connected to this server through > TCP/IP > > connection. When I view the process manager table in the server, an > > internal process called prim_inet:send/2 is always having around 400 > > messages in queue. Why this process is always having messages in queue? > > Whether it will affect the performance of the system in any way? If so, > is > > there any way to sort out the problem? > > Please give your inputs...! > > -- > > with regards, > > S.Surindar > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From waldemar.rachwal@REDACTED Fri Mar 23 12:27:08 2007 From: waldemar.rachwal@REDACTED (Waldemar Rachwal) Date: Fri, 23 Mar 2007 12:27:08 +0100 Subject: [erlang-questions] CEAN and Proxy Message-ID: Christophe, I'd be nice to expose CEAN SVN repository for read-only access (it isn't, right?). Community would have opportunity to peek at sources, send patches, and eventually test long before a next relase is published. Of course, nobody can promise, but making sources open during development may only encourage people for contribution. Regards, WR. On 3/21/07, Christophe Romain wrote: > Several patches are actually into the pipe, including bengt's patch and > windows related issues. > they all will be uploaded to the site in few days. From fig@REDACTED Fri Mar 23 19:05:57 2007 From: fig@REDACTED (Michael FIG) Date: Fri, 23 Mar 2007 12:05:57 -0600 Subject: [erlang-questions] Embedded systems Message-ID: <46041705.60408@marketelsystems.com> Hi, all... I'd like to use Erlang's release handling for several of my applications, but am a little confused about a few basic points. 1) Is it possible to run several different releases on the same computer? I have a client program and a server program, and I want to be able to install them on different machines, or the same machine. 2) How can I install an embedded system on the same machine as a development Erlang system (under Windows)? I suspect this is only possible by changing the Erlang executables to look at a different place in the registry (instead of HKLM\SOFTWARE\Ericsson\Erlang\*) to find one another. 3) I'm updating the target_system.erl script to work for Windows, too. What belongs in the "bin/" directory of the release tarball as opposed to the "erts-VERSION/bin" directory? Thanks for any help you can offer, -- Michael FIG , PMP MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From chadrwilson@REDACTED Sat Mar 24 03:44:17 2007 From: chadrwilson@REDACTED (Chad Wilson) Date: Fri, 23 Mar 2007 22:44:17 -0400 Subject: [erlang-questions] Which Book? Message-ID: Greetings. I have just begun my journey with Erlang. Of the various books available on Erlang, which one(s) worked for as a beginner? -w From jeffm@REDACTED Sat Mar 24 04:07:06 2007 From: jeffm@REDACTED (jm) Date: Sat, 24 Mar 2007 14:07:06 +1100 Subject: [erlang-questions] Which Book? In-Reply-To: References: Message-ID: <460495DA.3060500@ghostgun.com> Chad Wilson wrote: > Greetings. > > I have just begun my journey with Erlang. Of the various books > available on Erlang, which one(s) worked for as a beginner? > I'll try and beat everyone else on the list and say try http://pragmaticprogrammer.com/titles/jaerlang/index.html Which is written by one of the authors who wrote the older "Concurrent Programming in Erlang" which still has part 1 available publicly as a pdf at http://www.erlang.org/doc.html ( 3rd and 4th link down). This latter book or at least part one thereof is what I relied on in learning Erlang. I also read many of the papers floating around to get a grasp of the philosophy in writing in Erlang. Jeff. From avindev@REDACTED Sat Mar 24 04:56:13 2007 From: avindev@REDACTED (Arbow) Date: Sat, 24 Mar 2007 11:56:13 +0800 Subject: [erlang-questions] Met problem when using distel at emacs Message-ID: Hi: I followed this article: http://bob.pythonmac.org/archives/2007/03/16/distel-and-erlang-mode-for-emacs-on-mac-os-x/, installed the newest distel from svn. When I press (C-c C-z) start an erlang console at emacs, and press (C-c C-d l), message console print following messages: "DeepBlue / -27924 servname not supported for ai_socktype" Could anyone help me, thanks:) Arbow From avindev@REDACTED Sat Mar 24 05:07:44 2007 From: avindev@REDACTED (Arbow) Date: Sat, 24 Mar 2007 12:07:44 +0800 Subject: [erlang-questions] Met problem when using distel at emacs In-Reply-To: References: Message-ID: Anyway, I am using emacs 2.3 (svn), Ubuntu linux 6.06 Best regards, Arbow From juneaftn@REDACTED Sat Mar 24 11:04:49 2007 From: juneaftn@REDACTED (June Kim) Date: Sat, 24 Mar 2007 19:04:49 +0900 Subject: [erlang-questions] JCL on windows Message-ID: <6f80c1520703240304va492baej2d1b79d7b84f1fd@mail.gmail.com> Hello. Is there anyway I can bring up the JCL mode(where the prompt is "User switch command") from the command line(erl.exe) on windows machine? ^G would simply start a new Eshell. Thanks in advance, June From juneaftn@REDACTED Sat Mar 24 11:09:02 2007 From: juneaftn@REDACTED (June Kim) Date: Sat, 24 Mar 2007 19:09:02 +0900 Subject: [erlang-questions] JCL on windows In-Reply-To: <6f80c1520703240304va492baej2d1b79d7b84f1fd@mail.gmail.com> References: <6f80c1520703240304va492baej2d1b79d7b84f1fd@mail.gmail.com> Message-ID: <6f80c1520703240309kf785207ld0a566b2f737c5b@mail.gmail.com> I forgot to add one more thing. I'm using GNU Emacs for erlang mode. It seems like there is the same problem with the erlang shell in emacs. What do you do when you're stuck in an infinite loop in the erlang shell in emacs? 2007/3/24, June Kim : > Hello. > > Is there anyway I can bring up the JCL mode(where the prompt is "User > switch command") from the command line(erl.exe) on windows machine? > > ^G would simply start a new Eshell. > > Thanks in advance, > > June > From fritchie@REDACTED Sun Mar 25 06:36:05 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sat, 24 Mar 2007 23:36:05 -0500 Subject: [erlang-questions] SNMP decryption with SHA auth and DES privacy Message-ID: <200703250436.l2P4a5mr085443@snookles.snookles.com> Hi, all. I hope very, very few of you are working on crypto things this weekend. :-) I've stumbled upon a problem that appears to be very similar to one reported in November 2005 by Magnus Fr?berg(*). However, my problem appears to be with SHA authentication and DES privacy on a Linux box with Erlang/OTP release R11B-3. I have two entries in usm.conf that are nearly identical (see below). * MD5 auth + DES privacy for "superuser" works just fine. * MD5 auth + no privacy for "superuser-sha" works just fine. * SHA auth + DES privacy for "superuser-sha" gives this very repeatable error: "snmpget: Decryption error" I'm quite puzzled. It looks like Magnus's fix is not-quite-verbatim applied to R11B-3. I guess I can try experimenting a bit on Sunday, after a bit of sleep to clear my eyes. I've included a {net_if, debug} trace of all three operations. -Scott (*) http://www.erlang.org/ml-archive/erlang-questions/200511/msg00317.html --- snip --- snip --- snip --- snip --- snip --- snip --- %% To reproduce: snmpget -v 3 -u superuser -a MD5 -A authphrase -e 656e67696e656130 \ -l authPriv -x DES -X privphrase localhost:55161 sysDescr.0 echo "" sleep 5 snmpget -v 3 -u superuser-sha -a SHA -A shaphrase -e 656e67696e656130 \ -l authNoPriv -x DES -X privphrase localhost:55161 sysDescr.0 echo "" sleep 5 snmpget -v 3 -u superuser-sha -a SHA -A shaphrase -e 656e67696e656130 \ -l authPriv -x DES -X privphrase localhost:55161 sysDescr.0 %% Output: SNMPv2-MIB::sysDescr.0 = STRING: You found the description. SNMPv2-MIB::sysDescr.0 = STRING: You found the description. snmpget: Decryption error --- snip --- snip --- snip --- snip --- snip --- snip --- %% usm.conf entries %% authphrase, privphrase {"enginea0", "superuser", "superuser", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmDESPrivProtocol, "", "", "", [201,30,3,40,187,111,176,54,115,130,133,102,206,102,95,204], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. %% shaphrase, privphrase {"enginea0", "superuser-sha", "superuser-sha", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmDESPrivProtocol, "", "", "", [112,106,201,117,200,192,230,137,68,190,22,79,233,209,95,141,121,43,89,119], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. --- snip --- snip --- snip --- snip --- snip --- snip --- *** [2007:03:25 04:16:26 4137] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:26 4154] SNMP A-NET-IF MPD LOG *** v3, msgID: 302068428, msgFlags: [7], msgSecModel: 3 *** [2007:03:25 04:16:26 4154] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 302068428 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,51,4,8,101,110,103,105,110,101,97,48,2,1,0,2,1,0,4,9,115,117,112,101,114,117,115,101,114,4,12,208,90,139,40,212,188,229,5,174,170,107,38,4,8,0,0,0,1,158,43,145,217] *** [2007:03:25 04:16:26 4165] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser" *** [2007:03:25 04:16:26 4176] SNMP A-NET-IF A-USM INFO *** NOT in time window: SecName: "superuser" SnmpEngineBoots: 1 MsgAuthEngineBoots: 0 SnmpEngineTime: 5 MsgAuthEngineTime: 0 *** [2007:03:25 04:16:26 4189] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsNotInTimeWindows ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,2,0],'Counter32',1,undefined}, "superuser", [{securityLevel,1}]} *** [2007:03:25 04:16:26 4198] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsNotInTimeWindows} *** [2007:03:25 04:16:26 4208] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:26 4208] SNMP A-NET-IF MPD LOG *** v3, msgID: 302068429, msgFlags: [7], msgSecModel: 3 *** [2007:03:25 04:16:26 4208] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 302068429 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,51,4,8,101,110,103,105,110,101,97,48,2,1,1,2,1,5,4,9,115,117,112,101,114,117,115,101,114,4,12,204,112,230,199,103,68,61,31,49,251,137,150,4,8,0,0,0,1,158,43,145,218] *** [2007:03:25 04:16:26 4209] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser" *** [2007:03:25 04:16:26 4222] SNMP A-NET-IF MPD LOG *** contextEngineID: "enginea0", context: "" *** [2007:03:25 04:16:26 4235] SNMP A-NET-IF MPD DEBUG *** PDU type: 'get-request' *** [2007:03:25 04:16:26 4244] SNMP A-NET-IF LOG *** got pdu {pdu,'get-request',838136151,noError,0,[{varbind,[1,3,6,1,2,1,1,1,0],'NULL','NULL',1}]} *** [2007:03:25 04:16:26 4274] SNMP A-NET-IF LOG *** reply pdu: {pdu,'get-response',838136151,noError,0,[{varbind,[1,3,6,1,2,1,1,1,0],'OCTET STRING',[71,101,109,105,110,105,32,77,111,98,105,108,101,32,84,101,99,104,110,111,108,111,103,105,101,115,32,77,77,83,71,32,83,78,77,80,32,65,103,101,110,116],1}]} *** [2007:03:25 04:16:26 4282] SNMP A-NET-IF INFO *** time in agent: 73850 mysec (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> *** [2007:03:25 04:16:31 4451] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:31 4452] SNMP A-NET-IF MPD LOG *** v3, msgID: 1751779636, msgFlags: [5], msgSecModel: 3 *** [2007:03:25 04:16:31 4452] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 1751779636 msgMaxSize = 65507 msgFlags = [5] msgSecurityModel = 3 msgSecurityParameters = [48,47,4,8,101,110,103,105,110,101,97,48,2,1,0,2,1,0,4,13,115,117,112,101,114,117,115,101,114,45,115,104,97,4,12,18,222,3,95,162,234,24,13,151,130,210,188,4,0] *** [2007:03:25 04:16:31 4452] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser-sha" *** [2007:03:25 04:16:31 4460] SNMP A-NET-IF A-USM INFO *** NOT in time window: SecName: "superuser-sha" SnmpEngineBoots: 1 MsgAuthEngineBoots: 0 SnmpEngineTime: 10 MsgAuthEngineTime: 0 *** [2007:03:25 04:16:31 4461] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsNotInTimeWindows ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,2,0],'Counter32',2,undefined}, "superuser-sha", [{securityLevel,1}]} *** [2007:03:25 04:16:31 4468] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsNotInTimeWindows} *** [2007:03:25 04:16:31 4473] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:31 4473] SNMP A-NET-IF MPD LOG *** v3, msgID: 1751779637, msgFlags: [5], msgSecModel: 3 *** [2007:03:25 04:16:31 4474] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 1751779637 msgMaxSize = 65507 msgFlags = [5] msgSecurityModel = 3 msgSecurityParameters = [48,47,4,8,101,110,103,105,110,101,97,48,2,1,1,2,1,10,4,13,115,117,112,101,114,117,115,101,114,45,115,104,97,4,12,214,42,129,241,26,215,5,67,103,122,118,14,4,0] *** [2007:03:25 04:16:31 4474] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser-sha" *** [2007:03:25 04:16:31 4482] SNMP A-NET-IF MPD LOG *** contextEngineID: "enginea0", context: "" *** [2007:03:25 04:16:31 4484] SNMP A-NET-IF MPD DEBUG *** PDU type: 'get-request' *** [2007:03:25 04:16:31 4489] SNMP A-NET-IF LOG *** got pdu {pdu,'get-request',1825175770,noError,0,[{varbind,[1,3,6,1,2,1,1,1,0],'NULL','NULL',1}]} *** [2007:03:25 04:16:31 4497] SNMP A-NET-IF LOG *** reply pdu: {pdu,'get-response',1825175770,noError,0,[{varbind,[1,3,6,1,2,1,1,1,0],'OCTET STRING',[71,101,109,105,110,105,32,77,111,98,105,108,101,32,84,101,99,104,110,111,108,111,103,105,101,115,32,77,77,83,71,32,83,78,77,80,32,65,103,101,110,116],1}]} *** [2007:03:25 04:16:31 4514] SNMP A-NET-IF INFO *** time in agent: 40380 mysec (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> (gmt_snmpa_dev@REDACTED)1> *** [2007:03:25 04:16:36 4689] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:36 4689] SNMP A-NET-IF MPD LOG *** v3, msgID: 113381616, msgFlags: [7], msgSecModel: 3 *** [2007:03:25 04:16:36 4690] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 113381616 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,55,4,8,101,110,103,105,110,101,97,48,2,1,0,2,1,0,4,13,115,117,112,101,114,117,115,101,114,45,115,104,97,4,12,249,209,249,228,174,228,167,11,152,157,102,91,4,8,0,0,0,1,110,71,1,213] *** [2007:03:25 04:16:36 4690] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser-sha" *** [2007:03:25 04:16:36 4698] SNMP A-NET-IF A-USM INFO *** NOT in time window: SecName: "superuser-sha" SnmpEngineBoots: 1 MsgAuthEngineBoots: 0 SnmpEngineTime: 15 MsgAuthEngineTime: 0 *** [2007:03:25 04:16:36 4699] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsNotInTimeWindows ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,2,0],'Counter32',3,undefined}, "superuser-sha", [{securityLevel,1}]} *** [2007:03:25 04:16:36 4707] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsNotInTimeWindows} *** [2007:03:25 04:16:36 4711] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33978 *** [2007:03:25 04:16:36 4712] SNMP A-NET-IF MPD LOG *** v3, msgID: 113381617, msgFlags: [7], msgSecModel: 3 *** [2007:03:25 04:16:36 4712] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 113381617 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,55,4,8,101,110,103,105,110,101,97,48,2,1,1,2,1,15,4,13,115,117,112,101,114,117,115,101,114,45,115,104,97,4,12,107,221,81,164,31,13,51,255,54,251,27,6,4,8,0,0,0,1,110,71,1,214] *** [2007:03:25 04:16:36 4712] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "superuser-sha" *** [2007:03:25 04:16:36 4720] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsDecryptionErrors ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,6,0],'Counter32',1,undefined}, "superuser-sha", []} *** [2007:03:25 04:16:36 4727] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsDecryptionErrors} (gmt_snmpa_dev@REDACTED)1> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution From fredrik.hoback@REDACTED Sun Mar 25 14:27:37 2007 From: fredrik.hoback@REDACTED (Fredrik Hoback) Date: Sun, 25 Mar 2007 14:27:37 +0200 Subject: [erlang-questions] Registered processes: Message-ID: Hi, I'm new to erlang but I have some questions regarding process registration. I have these 2 modules that I want to send messages between with Pid ! Msg for example. As I start my first module a gen_server (alpha) from the shell which spawns away with spawn(?MODULE,start,[]). It sits around waiting for incoming messages. Then also from the same shell I start my other module (beta) which begins with register(?MODULE, self()). Now when the gen_server receives a message that I want to forward to my second module (beta). But I don't get any message, it seems that it gets lost on the way. Is there a problem that the beta module does a registration after the fact that alpha has already started, because I use "beta ! Msg" to send the message from alpha to beta. --------------------------------- Regard's Fredrik Hoback --------------------------------- From sean.hinde@REDACTED Sun Mar 25 15:27:51 2007 From: sean.hinde@REDACTED (Sean Hinde) Date: Sun, 25 Mar 2007 14:27:51 +0100 Subject: [erlang-questions] Registered processes: In-Reply-To: References: Message-ID: <9E6F88D9-AA48-4EDD-A2BD-0934CE0C990D@gmail.com> On 25 Mar 2007, at 13:27, Fredrik Hoback wrote: > Hi, I'm new to erlang but I have some questions regarding process > registration. > I have these 2 modules that I want to send messages between with Pid ! > Msg for example. As I start my first module a gen_server (alpha) from > the shell which spawns away with spawn(?MODULE,start,[]). It sits > around waiting for incoming messages. Then also from the same shell I > start my other module (beta) which begins with register(?MODULE, > self()). Now when the gen_server receives a message that I want to > forward to my second module (beta). But I don't get any message, it > seems that it gets lost on the way. Is there a problem that the beta > module does a registration after the fact that alpha has already > started, because I use "beta ! Msg" to send the message from alpha to > beta. One thing to check is that the processes are still running. Using spawn to start the process doesn't give any indication that a process has died. A nice way to debug this is first to make sure sasl is running - application:sart(sasl). Then if you start the gen_servers using the gen_server:start.. API you will see if the server has died. And, to answer your specific question, it does not matter when a process is registered. Once it is registered all other processes in the same node get access to the name mapping. Sean From ok@REDACTED Mon Mar 26 00:34:20 2007 From: ok@REDACTED (ok) Date: Mon, 26 Mar 2007 10:34:20 +1200 Subject: [erlang-questions] Miller's oversight In-Reply-To: <4603ACC2.3020302@ericsson.com> References: <4603ACC2.3020302@ericsson.com> Message-ID: <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> I've just started reading Mark Miller's thesis, "Robust Composition: Towards a Unified Approach to Access Control and Concurrency Control", or "all about E". On page 170, writing about Erlang, he wrote: Unfortunately, a process has only one processId, so the common convention is (sic.) for making a request and receiving a reply is for the client to include its own processId in the message as a reply port. This gives the provider the authority, not only to reply to the client, but to invoke the client. [He means that the receiver can not only send the expected reply message to the originator, but can send any number of messages of any form, at any time.] It is not clear how to repair this convention within the overall Erlang framework. My immediate reaction to this was "OK, how can we fix it?" What would it be like to introduce a "single-use" Pid, an atomic value which wraps a Pid so that you can send a message to it once but afterwards it is useless? My second reaction was "There is no problem: Miller has overlooked the fact that the process the receiver replies to need not be the originator." reply() -> S = self(), spawn(fun () -> receive M -> S!M end end). reply(T) -> S = self(), spawn(fun () -> receive M -> S!M after T -> failed end end). Instead of Untrusted!{request,self(),Data} do Untrusted!{request,reply(),Data} and all is well. There's no point in putting this in a library, because in specific cases you want tailored versions of the reply function that only accept the kind of response you want to receive. What Miller basically overlooked is just how cheap process creation is in Erlang. As Erlang programmers we should not make the same mistake: we often think of processes as long-lived, and so they may be, but we shouldn't be afraid to make processes that live for only a single message. From markm@REDACTED Mon Mar 26 02:35:08 2007 From: markm@REDACTED (Mark S. Miller) Date: Sun, 25 Mar 2007 17:35:08 -0700 Subject: [erlang-questions] Miller's oversight In-Reply-To: <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> References: <4603ACC2.3020302@ericsson.com> <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> Message-ID: <4607153C.7060600@cs.jhu.edu> ok wrote: > My second reaction was "There is no problem: Miller has overlooked > the fact that the process > the receiver replies to need not be the originator." > [...] > What Miller basically overlooked is just how cheap process creation > is in Erlang. As Erlang > programmers we should not make the same mistake: we often think of > processes as long-lived, > and so they may be, but we shouldn't be afraid to make processes that > live for only a single > message. I agree. At I wrote: > On practicality, perhaps I am underestimating how lightweight Erlang processes > are. If they are lightweight enough, then this approach would work. To whit: > > When Erlang process X wishes to make a request and receive a response from > process Y, X would make a new use-once process X2 which knows X's pid. X would > then include X2's pid in the message to Y. When Y responds to X2, X2 would > then wrap Y's response with a tag and send this response to X. > > Either these tags can themselves be unforgeable, or X's clients would also > need to go through a tagging intermediate process so that a client couldn't > send a message that X would mistake for Y's tagged response. I think it works > for X2 to tag the message with X2's (presumed unforgeable) pid, since anyone > who has that pid can respond on behalf of Y anyway. > > With enough care, X could reuse X2 for successive requests to Y. But if X > wants to make requests of Z, it would need a separate X3 for that purpose. > Otherwise, it enables Y to issues Z's response, and vice versa. > > The above scheme would meet the hard requirements. But how practical would it be? That's the good news. The bad news is that Erlang processIds are forgeable, making the above technique irrelevant. See . -- Text by me above is hereby placed in the public domain Cheers, --MarkM From ok@REDACTED Mon Mar 26 03:38:41 2007 From: ok@REDACTED (ok) Date: Mon, 26 Mar 2007 13:38:41 +1200 Subject: [erlang-questions] Miller's oversight In-Reply-To: <4607153C.7060600@cs.jhu.edu> References: <4603ACC2.3020302@ericsson.com> <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> <4607153C.7060600@cs.jhu.edu> Message-ID: <63FC6476-16A7-4FC7-ADAE-FE7835D32DF3@cs.otago.ac.nz> On 26 Mar 2007, at 12:35 pm, Mark S. Miller wrote: > That's the good news. The bad news is that Erlang processIds are > forgeable, making the above technique irrelevant. See erlang.org/ml-archive/erlang-questions/200606/msg00206.html>. This is sadly true. However, I think it is useful to distinguish between Erlang the language and the full Erlang/OTP system. If you took the language described in the old Erlang book and just removed list_to_pid/1 you would have something that was recognisably Erlang and in which process IDs were NOT forgeable. Virtually all Erlang techniques would survive unchanged, and the vast majority of Erlang code would be unaffected. As a start towards this, (a) extend the list of BIFs flagged as "Warning: this BIF is intended for debugging only". process_info/1 is so marked but process_info/2 is not; surely *normal* Erlang processes have no business looking inside others. process_flag/3 is even worse. To prevent forgery, yes, processes/0 should be so marked as well. (b) add a compiler flag requesting warnings about calls to any of those BIFs. Better still, make that the default, and require a special flag NOT to warn. It isn't enough to just use Erlang's existing cross-reference facilities; the normal Erlang programmer shouldn't even remember the names of these BIFs so would find it hard to check for them. (c) Long term, create a new 'unsafe' module and move all such unsafe BIFs to it. (Burroughs did something very like this in their NEWP language.) Providing reflection facilities in a language for the sake of debugging (or for any other reason) usually seems to result in a language whose encapsulation is more apparent than real. It is for this reason that in Quintus Prolog it is possible (if you work at it) to call any predicate in any module. It is for this reason that Smalltalk, whose encapsulation of instance variables appears to be total does in fact let any object change any instance variable in any other object (using #instanceVariableAt:put:). From markm@REDACTED Mon Mar 26 05:39:14 2007 From: markm@REDACTED (Mark S. Miller) Date: Sun, 25 Mar 2007 20:39:14 -0700 Subject: [erlang-questions] Miller's oversight In-Reply-To: <63FC6476-16A7-4FC7-ADAE-FE7835D32DF3@cs.otago.ac.nz> References: <4603ACC2.3020302@ericsson.com> <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> <4607153C.7060600@cs.jhu.edu> <63FC6476-16A7-4FC7-ADAE-FE7835D32DF3@cs.otago.ac.nz> Message-ID: <46074062.4090806@cs.jhu.edu> ok wrote: > This is sadly true. However, I think it is useful to distinguish > between Erlang the language > and the full Erlang/OTP system. If you took the language described > in the old Erlang book and > just removed list_to_pid/1 you would have something that was > recognisably Erlang and in which > process IDs were NOT forgeable. Virtually all Erlang techniques > would survive unchanged, and > the vast majority of Erlang code would be unaffected. Good. Is there also an easy way to keep normal Erlang code working, but to have it use the safe call-though-intermediate-tagging-process pattern everywhere it currently uses the unsafe pid-reusing RPC pattern? In order for distributed Erlang to provide distributed cryptographic capability security between mutually suspicious machines, you'll need to change the network representation of a pid as well -- to provide unguessability and unspoofability, as explained in Chapter 7 of my thesis. Currently, does the distributed Erlang protocol use crypto? How does it manage keys? > As a start towards this, > (a) [...] (b) [...] > (c) Long term, create a new 'unsafe' module and move all such unsafe > BIFs to it. > (Burroughs did something very like this in their NEWP language.) We now have three good papers documenting the issues in deriving an object-capability language from an existing memory-safe almost-capability language: "The Oz-E Project: Design Guidelines for a Secure Multiparadigm Programming Language" by Fred Spiessens and Peter Van Roy at . The Joe-E project, by Adrian Mettler and David Wagner, at . "How Emily Tamed the Caml" by Marc Stiegler and myself at . Experience with all three supports your approach. > Providing reflection facilities in a language for the sake of > debugging (or for any other > reason) usually seems to result in a language whose encapsulation is > more apparent than > real. It is for this reason that in Quintus Prolog it is possible > (if you work at it) to > call any predicate in any module. It is for this reason that > Smalltalk, whose encapsulation > of instance variables appears to be total does in fact let any object > change any instance > variable in any other object (using #instanceVariableAt:put:). Flat Concurrent Prolog provided virtual meta-interpretive debugging in a way that met the needs of security and debugging simultaneously. At I speculate on how one might adapt these ideas to Smalltalk and similar languages. I call the approach "refraction". Would something like this work for Erlang? -- Text by me above is hereby placed in the public domain Cheers, --MarkM From vladdu55@REDACTED Mon Mar 26 09:00:41 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 26 Mar 2007 09:00:41 +0200 Subject: [erlang-questions] Miller's oversight In-Reply-To: <46074062.4090806@cs.jhu.edu> References: <4603ACC2.3020302@ericsson.com> <313B3600-B963-4FF2-B59B-25DA2B956CA9@cs.otago.ac.nz> <4607153C.7060600@cs.jhu.edu> <63FC6476-16A7-4FC7-ADAE-FE7835D32DF3@cs.otago.ac.nz> <46074062.4090806@cs.jhu.edu> Message-ID: <95be1d3b0703260000v41388d8fg30380a76968411f8@mail.gmail.com> Hi, > Re: Erlang process id forgeability Just a related idea: another approach (that is in use here and there) would be that when a process sends it's pid to a peer, it would also send an unique reference. The reference is unforgeable [*] and will serve as identification. If this mechanism is used throughout the system, I believe it would work - but I am known to have been wrong before :-) [*] Regarding unforgeability (also by removing list_to_pid/1): even binary_to_term and term_to_binary should be disabled and also C/Java clients that have access to the internal representation and could send a remote message with faked data. best regards, Vlad From christophe.romain@REDACTED Mon Mar 26 10:06:20 2007 From: christophe.romain@REDACTED (Christophe Romain) Date: Mon, 26 Mar 2007 10:06:20 +0200 Subject: [erlang-questions] CEAN Contributions (was: CEAN and Proxy) In-Reply-To: References: Message-ID: Hello, Before releasing anything I had to make things stable and functional enough. The key thing with CEAN is quality and stability. From the first CEAN release, If you use the developer distribution, you have sources of all packages, including cean (that is the start script which must work on all supported platforms and cean.erl). For contribution, best is first to validate the dependencies, then to check package metadata (described into .pub files for each package), finally to add new packages. This week CEAN 1.3 will be released with many improvements, new packages and bug corrections. From CEAN 1.3, all packages will include there .pub file. All .pub files will also be downloadable from the contribution web page. Best Regards. From puzza007@REDACTED Mon Mar 26 18:18:00 2007 From: puzza007@REDACTED (Paul Oliver) Date: Mon, 26 Mar 2007 17:18:00 +0100 Subject: [erlang-questions] Met problem when using distel at emacs In-Reply-To: References: Message-ID: I've had the same problem. It seems that when Distel contacts epmd, the port it gets back is out by 65536. I had a go at fixing it. My change was: (defun epmd-recv-port-resp (event data) (ecase event ((data) (assert (= (length arg) 2)) (let ((resp (+ (ash (elt arg 0) 8) (logand (elt arg 1) 255)))) (fsm-terminate (if (< resp 0) (+ resp 65536) resp)))) ((closed) (fsm-fail)))) This got the correct port. Unfortunately this only got me to the next problem and I've not had time to revisit it. I'm using the CEAN version of Distel and emacs-snapshot-gtk on Ubuntu Feisty. Cheers, Paul. On 3/24/07, Arbow wrote: > > Anyway, I am using emacs 2.3 (svn), Ubuntu linux 6.06 > > Best regards, > Arbow > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- http://puzza.dyndns.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik.hoback@REDACTED Mon Mar 26 20:05:04 2007 From: fredrik.hoback@REDACTED (Fredrik Hoback) Date: Mon, 26 Mar 2007 20:05:04 +0200 Subject: [erlang-questions] Communicating processes Message-ID: <0E92D352-7FCB-4FDB-A153-4434EBA6204D@gmail.com> Hi, I'm having some trouble with inter-process communication. First of all I have a process which receives a message it looks something like this: %%%%%%%%%%%%%%%%%%%%%%%% receive_msg() -> receive {Msg} -> io:format("Recieved Message"); _-> io:format("Nothing to report") end. %%%%%%%%%%%%%%%%%%%%%%%% Note: this process is spawned and registered as proxy. To continue: I have another module which I start from within the shell it looks similar to this: %%%%%%%%%%%%%%%%%%%%%%%% send_message()-> Msg = "Hello World", % My message send(Msg), % here I send my message somewhere unknown and the reply is sent to the process proxy above %Here I want to receive the message that is received in proxy %%%%%%%%%%%%%%%%%%%%%%%% So how to I accomplish this? Is there any other way then using " ! "? What I would like to do is to call the process proxy from within send_message and the return answer should be Msg, is this possible? And how should it look? ------------------------------------ Fredrik Hoback fredrik.hoback@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From taavi@REDACTED Mon Mar 26 20:51:23 2007 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 26 Mar 2007 21:51:23 +0300 Subject: [erlang-questions] Communicating processes In-Reply-To: <0E92D352-7FCB-4FDB-A153-4434EBA6204D@gmail.com> References: <0E92D352-7FCB-4FDB-A153-4434EBA6204D@gmail.com> Message-ID: On Mar 26, 2007, at 9:05 PM, Fredrik Hoback wrote: > Hi, I'm having some trouble with inter-process communication. First > of all I have a process which receives a message it looks something > like this: There is difference between {Msg} and Msg. First is tuple with one element. 1> M="hello". "hello" 2> {M}=M. =ERROR REPORT==== 26-Mar-2007::21:33:19 === Error in process <0.30.0> with exit value: {{badmatch,"hello"}, [{erl_eval,expr,3}]} ** exited: {{badmatch,"hello"},[{erl_eval,expr,3}]} ** 2) probably function send can look like send(Msg) -> proxy ! Msg. 3) If you want to get answer, you should tell receiver where to return answer. send(Msg) -> proxy ! {self(), MSG}. receive_msg() -> receive {Pid_To_Answer, Msg} -> % proxy is registered process % http://www.erlang.org/doc/doc-5.5.3/lib/kernel-2.11.3/ doc/html/erlang.html#register/2 Pid_To_Answer ! io_lib:format("got message ~p", [Msg]) Msg -> io:format("Got really strange message without pid() for sending answer : ~p~n", [Msg]) end. best regards, taavi From ngreco@REDACTED Mon Mar 26 21:52:10 2007 From: ngreco@REDACTED (Nahuel Greco) Date: Mon, 26 Mar 2007 16:52:10 -0300 Subject: [erlang-questions] Question about driver_select() and fd's out-of-band / exceptional events. In-Reply-To: <47d93090703261236j34f278b7ia89dea030cf893d8@mail.gmail.com> References: <47d93090703261236j34f278b7ia89dea030cf893d8@mail.gmail.com> Message-ID: <47d93090703261252n362ab132idf1b268e8b75aae1@mail.gmail.com> Hi, from what I saw in the erl_driver/driver_entry manpages and erl_driver.h file, you can use driver_select(...) from a linked-in driver to pass a couple of file descriptors to the Erlang VM, and then when these file descriptors have data to be read (DO_READ) or can be written to (DO_WRITE), driver's ready_input() or ready_output() will be called by the VM. So, the driver is indirectly passing arguments to a select() call somewhere in the Erlang VM. The problem is that I can't find how a driver can give a file descriptor to the VM for _out of band_ information (the fourth argument to the select() call, "exceptfds") with the purpose of be awaken as with ready_input or ready_output when oob data becomes available on a fd. Is this possible? I don't see any related field in driver_entry. -- Saludos, Nahuel Greco. From fipar@REDACTED Tue Mar 27 03:17:50 2007 From: fipar@REDACTED (Fernando Ipar) Date: Mon, 26 Mar 2007 22:17:50 -0300 Subject: [erlang-questions] spawn problem Message-ID: <460870BE.7070004@seriema-systems.com> Hello all, I'm writing a little module to make use of erlang's lightweight processes and load test external programs/servers. Here's a very simple first version: ---- code ---- test(_, 0) -> true; test(Command, Threads) when number(Threads) -> spawn('os', 'cmd', [Command]), test(Command, Threads - 1). start() -> Command = list_to_atom(os:getenv("Command")), Threads = list_to_integer(os:getenv("Threads")), test(Command,Threads). --- end code ---- I know this is a very rudimentary first version and I would have to take more things into account, like the period of time over which the processes are created (ala Jakarta James) and all, but this is just a pet project to learn the basics of erlang by doing something I find more useful than Fibonacci :) My problem is that if I call this with more than 508 'Threads' (bear with me on the variable name selection..) I get this error: Error in process <0.1046.0> with exit value: {emfile,[{erlang,open_port,[{spawn,"sh -s unix:cmd 2>&1"},[stream]]},{os,start_port,0},{os,unix_cmd1,2}]} I get as many error messages as times I exceed the number 508. I've looked around and it seems 'emfile' means too many open files, which is strange, given the output of ulimit -a: [fipar@REDACTED testing]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited max nice (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7663 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 max rt priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 7663 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited file locks (-x) unlimited I've looked around sysctl -a and it seems everything's fine too. While this project in particular is not important, I'll appreciate any help with this problem, since I'd like to know how many processes I can create in erlang, and what tweaking needs to be done to the OS (if any). On another note, I'm working on a rewrite of my HA project for MySQL in erlang, also as a learning experience. This is still green, but if anyone wants to let me know what you think about the code, you can browse the svn repository here: https://svn.sourceforge.net/svnroot/mysql-ha/trunk/mysql-ha-erl/ The script tabs.sh lets you replace \t (I use vim for programming) for any given amount of whitespace. Thanks in advance for any help. Regards, Fernando. From ok@REDACTED Tue Mar 27 04:17:05 2007 From: ok@REDACTED (ok) Date: Tue, 27 Mar 2007 14:17:05 +1200 Subject: [erlang-questions] spawn problem In-Reply-To: <460870BE.7070004@seriema-systems.com> References: <460870BE.7070004@seriema-systems.com> Message-ID: <15684BE4-99FE-45B3-AA80-A7BD1C8F5FAC@cs.otago.ac.nz> On 27 Mar 2007, at 1:17 pm, Fernando Ipar wrote > test(_, 0) -> > true; > test(Command, Threads) when number(Threads) -> > spawn('os', 'cmd', [Command]), > test(Command, Threads - 1). You do not need quotation marks around atoms like os and cmd. > > start() -> > Command = list_to_atom(os:getenv("Command")), > Threads = list_to_integer(os:getenv("Threads")), > test(Command,Threads). You do not need to convert Command to an atom; the documentation for os: says cmd(Command) -> string() Types: Command = string() | atom() Mind you, sending an atom in a message to a process is cheaper than sending a string, but since atoms are not garbage collected, there's an advantage to using strings in a long-running process. > My problem is that if I call this with more than 508 'Threads' (bear > with me on the variable name selection..) I get ... emfile ... > open files (-n) 1024 508 is suspiciously close to 512, which is half of 1024. Doesn't it look to you as though os:cmd/1 is opening TWO files? Looking in lib/kernel/src/os.erl, cmd/1 -> unix_cmd/1 -> spawns unix_cmd/1 -> creates a port using start_port/0 -> open_port({spawn,"sh -s unix:cmd 2>&1"}, [stream]) The command is then sent to the STANDARD INPUT of that new process and the STANDARD OUTPUT of the process read and returned to the original caller. It would be a little clearer if the documentation for erlang:open_port/2 said explicitly that open_port({spawn,...},[...]) used up two file descriptors, but this text: use_stdio This is only valid for {spawn, Command}. It allows the standard input and output (file descriptors 0 and 1) of the spawned (UNIX) process for communication with Erlang. does give you a strong hint. Why does os:cmd/1 send the command to the shell's standard input, sh -s unix:cmd <"your command string" , rather than sh -c "your command string" While this project in particular is not important, I'll appreciate any > help with this problem, since I'd like to know how many processes I > can > create in erlang, and what tweaking needs to be > done to the OS (if any). Well, now you know the answer. If sysconf(_SC_OPEN_MAX) is N, the answer is "a little bit less than N/2", and apparently it's (N-8)/2. You can create any number of processes; the limit is on the number that can be active at the same time. The limit is determined by sysconf (_SC_CHILD_MAX) -- 25813 on my machine -- and sysconf(_SC_OPEN_MAX)/2 minus a bit -- my machine limits the number of open files to 256, so I can only have a little over 100 os:cmd/1 processes active at the same time. Since there is no guaranteed way for an Erlang program to determine whether there will be enough file descriptors left or not, a reasonable extension might be to add a {timeout,T} option to to erlang:open_port/2 to wait up to T milliseconds for sufficient file descriptors to become available again. Until something like that is done, the simplest thing is to keep the number of OS processes you create low, and the next simplest is to write your own wrapper which catches emfile, waits for some time, and retries, giving up after some number of retries. From fritchie@REDACTED Tue Mar 27 08:18:47 2007 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 27 Mar 2007 01:18:47 -0500 Subject: [erlang-questions] SNMP decryption with SHA auth and DES privacy In-Reply-To: Message of "Sat, 24 Mar 2007 23:36:05 CDT." <200703250436.l2P4a5mr085443@snookles.snookles.com> Message-ID: <200703270618.l2R6Ilct048946@snookles.snookles.com> Following up to my own posting with a bit more info, I've discovered the following things, using 4 users configured in the 4 combinations of auth + privacy methods. 0. All 4 privacy keys are configured identically: the phrase "privphrase". 1. I have no problem with MD5 auth + DES privacy. 2. I have no problem with MD5 auth + AES privacy.(*) 3. I have problems with authPriv, using SHA auth + either privacy method. 4. If I send the wrong passphrase for either MD5 or SHA auth user, I immediately get an authentication error. 5. If I send the correct passphrase for a SHA auth user + authPriv, I immediately get a "snmpget: Decryption error" error. 6. The SNMP-USER-BASED-SM-MIB::usmStatsDecryptionErrors.0 counter is incremented each time I attempt a These facts suggest to me that I have configured the SHA authentication key correctly. Is it possible that I'm wrong? I've included my snippet from "agent/usm.conf" as well as a trace log of the net_if doodad. -Scott (*) I discovered that the net-snmp package version 5.1 does not support AES encryption. (Version 5.1 is what's installed on a CentOS/Red Hat Enterprise Linux 4.x machine.) Net-snmp version 5.4 supports both DES and AES encryption. --- snip --- snip --- snip --- snip --- snip --- snip --- snip --- {"enginea0", "test0.w-all", "test0.w-all", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmDESPrivProtocol, "", "", "", [201,30,3,40,187,111,176,54,115,130,133,102,206,102,95,204], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. {"enginea0", "test0.w-all-sha", "test0.w-all-sha", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmDESPrivProtocol, "", "", "", [112,106,201,117,200,192,230,137,68,190,22,79,233,209,95,141,121,43,89,119], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. {"enginea0", "test0.w-all-md5aes", "test0.w-all-md5aes", zeroDotZero, usmHMACMD5AuthProtocol, "", "", usmAesCfb128Protocol, "", "", "", [201,30,3,40,187,111,176,54,115,130,133,102,206,102,95,204], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. {"enginea0", "test0.w-all-shaaes", "test0.w-all-shaaes", zeroDotZero, usmHMACSHAAuthProtocol, "", "", usmAesCfb128Protocol, "", "", "", [112,106,201,117,200,192,230,137,68,190,22,79,233,209,95,141,121,43,89,119], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129] }. --- snip --- snip --- snip --- snip --- snip --- snip --- snip --- (gmt_snmpa_dev@REDACTED)5> *** [2007:03:27 06:10:15 4934] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33999 *** [2007:03:27 06:10:15 4934] SNMP A-NET-IF MPD LOG *** v3, msgID: 488947328, msgFlags: [7], msgSecModel: 3 *** [2007:03:27 06:10:15 4934] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 488947328 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,60,4,8,101,110,103,105,110,101,97,48,2,1,0,2,1,0,4,18,116,101,115,116,48,46,119,45,97,108,108,45,115,104,97,97,101,115,4,12,52,96,113,137,13,135,131,237,174,30,185,171,4,8,109,235,47,18,194,123,209,147] *** [2007:03:27 06:10:15 4935] SNMP A-NET-IF MPD TRACE *** SecModule = snmpa_usm SecLevel = 3 IsReportable = true *** [2007:03:27 06:10:15 4935] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> check security parms: 3.2.1 *** [2007:03:27 06:10:15 4935] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "test0.w-all-shaaes" *** [2007:03:27 06:10:15 4935] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> check engine id: 3.2.3 *** [2007:03:27 06:10:15 4944] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> retrieve usm user: 3.2.4 *** [2007:03:27 06:10:15 4948] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> securityName: "test0.w-all-shaaes" *** [2007:03:27 06:10:15 4948] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> authenticate incoming: 3.2.5 - 3.2.7 {"enginea0", "test0.w-all-shaaes", "test0.w-all-shaaes", [0,0], [1,3,6,1,6,3,10,1,1,3], [], [], [1,3,6,1,6,3,10,1,2,4], [], [], [], 3, 1, [112, 106, 201, 117, 200, 192, 230, 137, 68, 190, 22, 79, 233, 209, 95, 141, 121, 43, 89, 119], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129]} *** [2007:03:27 06:10:15 4949] SNMP A-NET-IF A-USM TRACE *** authenticate_incoming -> 3.2.6 *** [2007:03:27 06:10:15 4949] SNMP A-NET-IF A-USM TRACE *** is_auth -> retrieve EngineBoots and EngineTime: 3.2.7 *** [2007:03:27 06:10:15 4959] SNMP A-NET-IF A-USM TRACE *** is_auth -> SnmpEngineID: "enginea0" *** [2007:03:27 06:10:15 4959] SNMP A-NET-IF A-USM TRACE *** is_auth -> we are authoritative: 3.2.7a *** [2007:03:27 06:10:15 4964] SNMP A-NET-IF A-USM TRACE *** is_auth -> SnmpEngineBoots: 1 *** [2007:03:27 06:10:15 4964] SNMP A-NET-IF A-USM INFO *** NOT in time window: SecName: "test0.w-all-shaaes" SnmpEngineBoots: 1 MsgAuthEngineBoots: 0 SnmpEngineTime: 382 MsgAuthEngineTime: 0 *** [2007:03:27 06:10:15 4964] SNMP A-NET-IF MPD TRACE *** message processing result: {error,usmStatsNotInTimeWindows, {{varbind,[1,3,6,1,6,3,15,1,1,2,0],'Counter32',12,undefined}, "test0.w-all-shaaes", [{securityLevel,1}]}} *** [2007:03:27 06:10:15 4965] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsNotInTimeWindows ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,2,0],'Counter32',12,undefined}, "test0.w-all-shaaes", [{securityLevel,1}]} *** [2007:03:27 06:10:15 4965] SNMP A-NET-IF MPD TRACE *** Report ReqId: 0 *** [2007:03:27 06:10:15 4972] SNMP A-NET-IF MPD TRACE *** generate_response_msg -> SecEngineID: "enginea0" *** [2007:03:27 06:10:15 4972] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> entry [3.1.1] *** [2007:03:27 06:10:15 4976] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.4] *** [2007:03:27 06:10:15 4977] SNMP A-NET-IF A-USM TRACE *** encrypt -> 3.1.4b *** [2007:03:27 06:10:15 4992] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> SnmpEngineID: "enginea0" [3.1.6] *** [2007:03:27 06:10:15 4996] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.5 - 3.1.7] *** [2007:03:27 06:10:15 4996] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.8] *** [2007:03:27 06:10:15 4997] SNMP A-NET-IF A-USM TRACE *** authenticate_outgoing -> encode message only *** [2007:03:27 06:10:15 4997] SNMP A-NET-IF LOG TRACE *** log -> entry with Log: "snmpa_log" Addr: {127,0,0,1} Port: 33999 *** [2007:03:27 06:10:15 4997] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsNotInTimeWindows} *** [2007:03:27 06:10:16 415] SNMP A-NET-IF TRACE *** activate once *** [2007:03:27 06:10:16 426] SNMP A-NET-IF LOG *** got paket from {127,0,0,1}:33999 *** [2007:03:27 06:10:16 426] SNMP A-NET-IF MPD LOG *** v3, msgID: 488947329, msgFlags: [7], msgSecModel: 3 *** [2007:03:27 06:10:16 426] SNMP A-NET-IF MPD DEBUG *** version 3 message header: msgID = 488947329 msgMaxSize = 65507 msgFlags = [7] msgSecurityModel = 3 msgSecurityParameters = [48,61,4,8,101,110,103,105,110,101,97,48,2,1,1,2,2,1,126,4,18,116,101,115,116,48,46,119,45,97,108,108,45,115,104,97,97,101,115,4,12,186,201,129,36,5,21,215,85,218,222,122,37,4,8,109,235,47,18,194,123,209,148] *** [2007:03:27 06:10:16 427] SNMP A-NET-IF MPD TRACE *** SecModule = snmpa_usm SecLevel = 3 IsReportable = true *** [2007:03:27 06:10:16 427] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> check security parms: 3.2.1 *** [2007:03:27 06:10:16 427] SNMP A-NET-IF A-USM LOG *** authEngineID: "enginea0", userName: "test0.w-all-shaaes" *** [2007:03:27 06:10:16 427] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> check engine id: 3.2.3 *** [2007:03:27 06:10:16 447] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> retrieve usm user: 3.2.4 *** [2007:03:27 06:10:16 452] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> securityName: "test0.w-all-shaaes" *** [2007:03:27 06:10:16 452] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> authenticate incoming: 3.2.5 - 3.2.7 {"enginea0", "test0.w-all-shaaes", "test0.w-all-shaaes", [0,0], [1,3,6,1,6,3,10,1,1,3], [], [], [1,3,6,1,6,3,10,1,2,4], [], [], [], 3, 1, [112, 106, 201, 117, 200, 192, 230, 137, 68, 190, 22, 79, 233, 209, 95, 141, 121, 43, 89, 119], [177,119,145,118,201,81,4,153,176,177,63,200,186,208,118,129]} *** [2007:03:27 06:10:16 453] SNMP A-NET-IF A-USM TRACE *** authenticate_incoming -> 3.2.6 *** [2007:03:27 06:10:16 466] SNMP A-NET-IF A-USM TRACE *** is_auth -> retrieve EngineBoots and EngineTime: 3.2.7 *** [2007:03:27 06:10:16 478] SNMP A-NET-IF A-USM TRACE *** is_auth -> SnmpEngineID: "enginea0" *** [2007:03:27 06:10:16 479] SNMP A-NET-IF A-USM TRACE *** is_auth -> we are authoritative: 3.2.7a *** [2007:03:27 06:10:16 491] SNMP A-NET-IF A-USM TRACE *** is_auth -> SnmpEngineBoots: 1 *** [2007:03:27 06:10:16 491] SNMP A-NET-IF A-USM TRACE *** process_incoming_msg -> decrypt scoped data: 3.2.8 *** [2007:03:27 06:10:16 492] SNMP A-NET-IF MPD TRACE *** message processing result: {error,usmStatsDecryptionErrors, {{varbind,[1,3,6,1,6,3,15,1,1,6,0],'Counter32',7,undefined}, "test0.w-all-shaaes", []}} *** [2007:03:27 06:10:16 492] SNMP A-NET-IF MPD DEBUG *** security module result when reportable [7.2.6-a]: Reason: usmStatsDecryptionErrors ErrorInfo: {{varbind,[1,3,6,1,6,3,15,1,1,6,0],'Counter32',7,undefined}, "test0.w-all-shaaes", []} *** [2007:03:27 06:10:16 493] SNMP A-NET-IF MPD TRACE *** Report ReqId: 0 *** [2007:03:27 06:10:16 4115] SNMP A-NET-IF MPD TRACE *** generate_response_msg -> SecEngineID: "enginea0" *** [2007:03:27 06:10:16 4116] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> entry [3.1.1] *** [2007:03:27 06:10:16 4118] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.4] *** [2007:03:27 06:10:16 4118] SNMP A-NET-IF A-USM TRACE *** encrypt -> 3.1.4b *** [2007:03:27 06:10:16 4118] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> SnmpEngineID: "enginea0" [3.1.6] *** [2007:03:27 06:10:16 4119] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.5 - 3.1.7] *** [2007:03:27 06:10:16 4119] SNMP A-NET-IF A-USM TRACE *** generate_outgoing_msg -> [3.1.8] *** [2007:03:27 06:10:16 4119] SNMP A-NET-IF A-USM TRACE *** authenticate_outgoing -> encode message only *** [2007:03:27 06:10:16 4119] SNMP A-NET-IF LOG TRACE *** log -> entry with Log: "snmpa_log" Addr: {127,0,0,1} Port: 33999 *** [2007:03:27 06:10:16 4120] SNMP A-NET-IF LOG *** sending report for reason: {securityError,usmStatsDecryptionErrors} *** [2007:03:27 06:10:16 4120] SNMP A-NET-IF TRACE *** activate once From matthias@REDACTED Tue Mar 27 09:10:04 2007 From: matthias@REDACTED (Matthias Lang) Date: Tue, 27 Mar 2007 09:10:04 +0200 Subject: [erlang-questions] spawn problem In-Reply-To: <460870BE.7070004@seriema-systems.com> References: <460870BE.7070004@seriema-systems.com> Message-ID: <17928.49996.175799.738199@antilipe.corelatus.se> Fernando Ipar writes: > Hello all, > > I'm writing a little module to make use of erlang's lightweight > processes and load test external programs/servers. > > Here's a very simple first version: > > ---- code ---- > test(_, 0) -> > true; > > > test(Command, Threads) when number(Threads) -> > spawn('os', 'cmd', [Command]), > test(Command, Threads - 1). > > > start() -> > Command = list_to_atom(os:getenv("Command")), > Threads = list_to_integer(os:getenv("Threads")), > test(Command,Threads). > > --- end code ---- In addition to what's already been said, the above doesn't really make use of erlang's lightweight processes. Each time you call os:cmd, you're starting a (heavyweight) operating system process. It may be that this is what you intended. Matthias From fipar@REDACTED Tue Mar 27 15:42:13 2007 From: fipar@REDACTED (Fernando Ipar) Date: Tue, 27 Mar 2007 10:42:13 -0300 Subject: [erlang-questions] spawn problem In-Reply-To: <15684BE4-99FE-45B3-AA80-A7BD1C8F5FAC@cs.otago.ac.nz> References: <460870BE.7070004@seriema-systems.com> <15684BE4-99FE-45B3-AA80-A7BD1C8F5FAC@cs.otago.ac.nz> Message-ID: <46091F35.6060408@seriema-systems.com> That was it! I increased the number of open files with ulimit and it worked. I don't know how I didn't realize it needed two fds open for each process :) Thanks for the help, Fernando. ok wrote: > > 508 is suspiciously close to 512, which is half of 1024. > Doesn't it look to you as though os:cmd/1 is opening TWO files? > > Looking in lib/kernel/src/os.erl, > > cmd/1 -> unix_cmd/1 -> spawns unix_cmd/1 -> creates a port using > start_port/0 > -> open_port({spawn,"sh -s unix:cmd 2>&1"}, [stream]) > The command is then sent to the STANDARD INPUT of that new process > and the STANDARD OUTPUT of the process read and returned to the > original caller. > > It would be a little clearer if the documentation for > erlang:open_port/2 said explicitly > that open_port({spawn,...},[...]) used up two file descriptors, but > this text: > use_stdio > This is only valid for {spawn, Command}. > It allows the standard input and output (file descriptors 0 and 1) > of the spawned (UNIX) process for communication with Erlang. > does give you a strong hint. > > Why does os:cmd/1 send the command to the shell's standard input, > sh -s unix:cmd <"your command string" , > rather than > sh -c "your command string" > Not being the author, I can't say for sure, but there is an upper > bound on the size of a > command in the second case which does not apply in the first (if the > Command is passed as > a string, because atoms have their own limits). > > From fipar@REDACTED Tue Mar 27 15:45:28 2007 From: fipar@REDACTED (Fernando Ipar) Date: Tue, 27 Mar 2007 10:45:28 -0300 Subject: [erlang-questions] spawn problem In-Reply-To: <17928.49996.175799.738199@antilipe.corelatus.se> References: <460870BE.7070004@seriema-systems.com> <17928.49996.175799.738199@antilipe.corelatus.se> Message-ID: <46091FF8.7000904@seriema-systems.com> You're right. I should have said that it makes use of erlang's easy way to create processes, or that I just wanted to write something quick in erlang as a proof of concept and to have fun, but these are certainly not lightweight :) Regards, Fernando. Matthias Lang wrote: > In addition to what's already been said, the above doesn't really make > use of erlang's lightweight processes. Each time you call os:cmd, > you're starting a (heavyweight) operating system process. > > It may be that this is what you intended. > > Matthias > > > -- Fernando Ipar - Director Seriema Systems ------------------------- Coquimbo 2236 - 102 400 6717 # 23 www.seriema-systems.com From fipar@REDACTED Tue Mar 27 16:03:47 2007 From: fipar@REDACTED (Fernando Ipar) Date: Tue, 27 Mar 2007 11:03:47 -0300 Subject: [erlang-questions] spawn problem In-Reply-To: <290b3ba10703261847u6013ae8ck9b15c0c545aeb088@mail.gmail.com> References: <460870BE.7070004@seriema-systems.com> <290b3ba10703261847u6013ae8ck9b15c0c545aeb088@mail.gmail.com> Message-ID: <46092443.7080102@seriema-systems.com> I'll take a look at it. My fault is that I usually look for open source in sourceforge, and there aren't many erlang projects there except for jungerl, openmonet and maybe a few others. Thanks, Fernando. t ty wrote: > if you are interested in load testing an external program then have a > look into tsung (http://www.process-one.net/en/tsung/). Its open > source and written in Erlang. > > The number of open files error looks too similar to your 'open file' > limit of 1024. I'm guessing here, but a shell spawn would take up 2 > open file descriptors (stdin & stdout). 504 * 2 isn't 1024 but the > Erlang itself might have some open ones. Trying upping that limit to > test. > > t > From csanto@REDACTED Tue Mar 27 17:16:39 2007 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 27 Mar 2007 17:16:39 +0200 Subject: [erlang-questions] OT: Eurobot: Call-for-sponsorship Message-ID: <46093557.7050302@diit.unict.it> Dear Erlangers, first of all, my apologies for the off-topic. As some of you already know, some students of mine and myself are building an autonomous robot to participate to the 2007 edition of the Eurobot competition (see http://www.eurobot.org/eng ). The web site of our team is at http://eurobot.diit.unict.it The software of our robot is completely written in Erlang, so, I'm writing to ask if anyone could be interested in supporting our project. Our main problem is that we need some funds to contribute to pay the travel and the stay for 11 people in La Ferte'-Bernard, France, the place in which this edition of Eurobot will be held. Currently, our main sponsors are: - Erlang Training & Consuling (thanks Francesco!); - Siatel, a sicilian automation company; - the University of Catania. However, this support is not enough to buy the materials for our robot and to pay the travel. So, any further help is really appreaciated: anyone interested could contact me privatelly for major details (we can provide some multimedia material showing the current state of our project). All the best, --Corrado -- ================================================================== Eng. Corrado Santoro, Ph.D. University of Catania - ITALY - Engineering Faculty Tel: +39 095 7382380 VoIP: sip:7035@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.diit.unict.it ================================================================== From xpdoka@REDACTED Tue Mar 27 21:42:56 2007 From: xpdoka@REDACTED (Dominic Williams) Date: Tue, 27 Mar 2007 21:42:56 +0200 Subject: [erlang-questions] Good one-liners? In-Reply-To: References: Message-ID: <460973C0.9050907@dominicwilliams.net> > Hi, I keep seeing these perl programmers in teeshirts with one-liners printed on them. It made me think about what erlang one-liners I would want on a teeshirt. I would go for something like: world ! hello with whichever atoms suit your taste ! (I like list comprehensions, but they're hardly Erlang's most distinctive feature). Have fun, Dominic Williams http://www.dominicwilliams.net ---- From jocke@REDACTED Wed Mar 28 01:53:38 2007 From: jocke@REDACTED (Joakim G.) Date: Wed, 28 Mar 2007 01:53:38 +0200 Subject: [erlang-questions] Good one-liners? In-Reply-To: <460973C0.9050907@dominicwilliams.net> References: <460973C0.9050907@dominicwilliams.net> Message-ID: <4609AE82.8030007@tail-f.com> Christian S wrote: >> Hi, I keep seeing these perl programmers in teeshirts with one-liners printed on them. It made me think about what erlang one-liners I would want on a teeshirt. From the top of my head. A four-liner parallel map perhaps: pmap(F, L) -> Parent = self(), [receive {Pid, Result} -> Result end || Pid <- [spawn(fun() -> Parent ! {self(), F(X)} end) || X <- L]]. as a single-line: pmap(F, L) -> Parent = self(), [receive {Pid, Result} -> Result end || Pid <- [spawn(fun() -> Parent ! {self(), F(X)} end) || X <- L]]. It all depends on your t-shirt size I suppose. :-) Cheers /Jocke From jeffm@REDACTED Wed Mar 28 03:39:15 2007 From: jeffm@REDACTED (jm) Date: Wed, 28 Mar 2007 11:39:15 +1000 Subject: [erlang-questions] gen_event and global event handlers Message-ID: <4609C743.2000702@ghostgun.com> And the any notes floating around on the specifics of global event managers? I have an event mananager and a set of handler that work fine as locally, but when I attempt to make a couple of simple changes for it to work across two machines/nodes thing start to go awry. To begin with execute the following all on the same node with EVENTMGR to equal some atom, gen_event:start_link({global, ?EVENTMGR}). gen_event:which_handlers({global,?EVENTMGR}). returns []. Then in calling event handler module executes start_link(Options) -> gen_event:add_handler({global, ?EVENTMGR}, ?MODULE, Options). called with Options = []. Yet calling this function results in ** exited: noproc ** and gen_event:which_handlers({global,?EVENTMGR}). now also returns ** exited: noproc ** Any hints as to what may be going wrong? Jeff. From dcaoyuan@REDACTED Wed Mar 28 12:34:51 2007 From: dcaoyuan@REDACTED (Caoyuan Deng) Date: Wed, 28 Mar 2007 18:34:51 +0800 Subject: [erlang-questions] Erlang Editor for NetBeans - ErlyBird 0.10.1 released Message-ID: Erlang Editor for NetBeans - ErlyBird 0.10.1 released I'm pleased to announce ErlyBird 0.10.1, an Erlang Editor Module for NetBeans has been released. Current features: * Syntax checking; * Syntax highlighting; * Functions navigator; * Code-folding; * Indentation; * Built-in function completion. You can download ErlyBird from http://sourceforge.net/projects/erlybird ErlyBird needs NetBeans IDE 6.0 M7+, which can be downloaded via: http://www.netbeans.info/downloads/dev.php page select Q-Build in 'Build Type'. After NetBeans IDE installed, go to Tools->Update Center, fetch the "Generic Language Module" from Category "Languages Support" To install ErlyBird module, unzip the binary package first, then: 1. From menu: Tools -> Update Center 2. In the "Select Location of Modules" pane, click "Install Manually Downloaded Modules(.nbm Files)", then "Next" 3. Click [Add...] button, go to the path to select the unzip .nbm file. 4. Following the instructions to install updated modules. 5. Restart NetBeans. It may not be stable yet, feedback and bug reports are welcome. From chsu79@REDACTED Wed Mar 28 13:37:10 2007 From: chsu79@REDACTED (Christian S) Date: Wed, 28 Mar 2007 13:37:10 +0200 Subject: [erlang-questions] re javascript concurrency Message-ID: Someone already mentioned the "Threads in JavaScript?" link I think, see http://lambda-the-ultimate.org/node/2065 if you missed it. I think this API implemented by Opera 8 and newer is interesting: http://virtuelvis.com/archives/2005/12/cross-document-messaging Now if they only realized what a bit of pattern matching and processes would do to this programming style. From jay@REDACTED Wed Mar 28 14:49:06 2007 From: jay@REDACTED (Jay Edwards) Date: Wed, 28 Mar 2007 12:49:06 +0000 Subject: [erlang-questions] Erlang Editor for NetBeans - ErlyBird 0.10.1 References: <460a64422270b_442a92c6434237@web3-prod.tmail> Message-ID: <460a64422270b_442a92c6434237@web3-prod.tmail> On Wed Mar 28 10:34:51 UTC 2007, Caoyuan Deng wrote: > Erlang Editor for NetBeans - ErlyBird 0.10.1 released > > I'm pleased to announce ErlyBird 0.10.1, an Erlang Editor Module for > NetBeans has been released. Excellent! Thanks. From Bob.Cowdery@REDACTED Wed Mar 28 15:41:59 2007 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Wed, 28 Mar 2007 14:41:59 +0100 Subject: [erlang-questions] Problem with jInterface nodes Message-ID: <3A76756EED583B43A4AD704E29CCD0797411E9@mail.aprsmartlogik.com> Hi all, Does anyone know how to get stdout from a java node using jInterface to print to the erlang window. C Nodes I start through Erlang using 'open_port({spawn, CmdLine},[])',still maintain their connection but doing the same with java, output is lost. I can add a redirection at the end of the command line and print to a file but that's not ideal. Also I cannot seem to redirect stderr using >& as it simply does not start the node, without raising any errors. Thanks Bob From mle+erlang@REDACTED Wed Mar 28 15:45:31 2007 From: mle+erlang@REDACTED (Erik de Castro Lopo) Date: Wed, 28 Mar 2007 23:45:31 +1000 Subject: [erlang-questions] Escript Message-ID: <20070328234531.359557d0.mle+erlang@mega-nerd.com> Hi all, I found references to a program named Escript. I downloaded it (version 3.0) and found that it didn't work. Searching some more I found mention of a version 4.0 but can't find a single working link to it. Anybody know where this is hidden? Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "I'll just say that having programmed in Lisp the shortcomings of Java are glaringly obvious." -- Erann Gat From bjorn@REDACTED Wed Mar 28 15:51:15 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 28 Mar 2007 15:51:15 +0200 Subject: [erlang-questions] Erlang/OTP R11B-4 has been released Message-ID: Bug fix release : otp_src_R11B-4 Build date : 2007-03-28 This is bug fix release 4 for the R11B release. You can download the full source distribution from http://www.erlang.org/download/otp_src_R11B-4.tar.gz http://www.erlang.org/download/otp_src_R11B-4.readme Note: To unpack the TAR archive you need a GNU TAR compatible program. For instance, on MacOS X before 10.3 you must use the 'gnutar' command; you can't use the 'tar' command or StuffIt to unpack the sources. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R11B-4.exe On-line documentation can be found at http://www.erlang.org/doc.html. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R11B-4.tar.gz http://www.erlang.org/download/otp_doc_man_R11B-4.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team --- HIGHLIGHTS ------------------------------------------------------------ OTP-6505 There is a new escript program that can be used for writing scripts in Erlang. Erlang scripts don't need to be compiled and any arguments can be passed to them without risk that they are interpreted by the Erlang system. OTP-6546 Dialyzer (in the modes where either source or BEAM code which contains debug_info is analyzed) spits out line information for all discrepancies. This has been a major change, worth of increasing the version number. We warn users that *considerably* more discrepancies are identified by this version of Dialyzer compared with previous ones and applications. If, for some reason, warnings generated by previous versions of Dialyzer are preferable, the command line option --old_style can be employed. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Wed Mar 28 15:52:59 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 28 Mar 2007 15:52:59 +0200 Subject: [erlang-questions] Escript In-Reply-To: <20070328234531.359557d0.mle+erlang@mega-nerd.com> References: <20070328234531.359557d0.mle+erlang@mega-nerd.com> Message-ID: escript is included in R11B-4. /Bjorn Erik de Castro Lopo writes: > Hi all, > > I found references to a program named Escript. I downloaded it (version > 3.0) and found that it didn't work. > > Searching some more I found mention of a version 4.0 but can't find a > single working link to it. Anybody know where this is hidden? > > Cheers, > Erik > -- > +-----------------------------------------------------------+ > Erik de Castro Lopo > +-----------------------------------------------------------+ > "I'll just say that having programmed in Lisp the shortcomings > of Java are glaringly obvious." -- Erann Gat > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From richardc@REDACTED Wed Mar 28 16:31:06 2007 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 28 Mar 2007 16:31:06 +0200 Subject: [erlang-questions] Good one-liners? In-Reply-To: <460973C0.9050907@dominicwilliams.net> References: <460973C0.9050907@dominicwilliams.net> Message-ID: <460A7C2A.1000803@it.uu.se> Dominic Williams wrote: >> Hi, I keep seeing these perl programmers in teeshirts with >> one-liners printed on them. It made me think about what erlang >> one-liners I would want on a teeshirt. > > I would go for something like: > > world ! hello > > with whichever atoms suit your taste ! A small counter process, perhaps: p(C) -> receive Q -> p(Q!C+1) end. or maybe an RPC: receive {Q, F} -> Q ! F() end or something more slogan-like: receive stop -> ok end /Richard From juneaftn@REDACTED Wed Mar 28 17:45:20 2007 From: juneaftn@REDACTED (June Kim) Date: Thu, 29 Mar 2007 00:45:20 +0900 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? Message-ID: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> "fun" expressions can be used to declare a function. Can it make a recursive call inside? That is, Can I somehow declare the following with callself, which is an imaginary functionality that calls the anonymous function itself? fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. From VAUCHER@REDACTED Wed Mar 28 18:03:10 2007 From: VAUCHER@REDACTED (VAUCHER Laurent) Date: Wed, 28 Mar 2007 18:03:10 +0200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? Message-ID: <55DDB08CC9CD2941A70E8D626789A2C904AA3C11@ec8l7ljvo9h5dde.hosting.exch> http://en.wikipedia.org/wiki/Anonymous_recursion ? -----Message d'origine----- De : erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de June Kim Envoy? : 28 March 2007 17:45 ? : erlang-questions@REDACTED Objet : [erlang-questions] anyway to make recursion inside anonymous funs? "fun" expressions can be used to declare a function. Can it make a recursive call inside? That is, Can I somehow declare the following with callself, which is an imaginary functionality that calls the anonymous function itself? fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From okossuth@REDACTED Wed Mar 28 17:15:49 2007 From: okossuth@REDACTED (Oskar Kossuth) Date: Wed, 28 Mar 2007 15:15:49 +0000 (UTC) Subject: [erlang-questions] Errors compiling erlang on AIX 5.3 Message-ID: I'm having problem compiling erlang on AIX 5.3. Im using GNU gcc and Make and AIX include headers. I got the following error: make[3]: Entering directory `/home/okossuth/otp_src_R11B-4/lib/parsetools/src' erlc -W +debug_info -I/home/okossuth/otp_src_R11B-4/lib/stdlib/include -o../ebin yecc.erl exec(): 0509-036 Cannot load program /home/okossuth/otp_src_R11B-4/bin/powerpc-ibm-aix5.3.0.0/beam because of the following errors: 0509-151 The program does not have an entry point or the o_snentry field in the auxiliary header is invalid. 0509-194 Examine file headers with the 'dump -ohv' command. make[3]: *** [../ebin/yecc.beam] Error 255 make[3]: Leaving directory `/home/okossuth/otp_src_R11B-4/lib/parsetools/src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/okossuth/otp_src_R11B-4/lib/parsetools' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/okossuth/otp_src_R11B-4/lib' make: *** [secondary_bootstrap_build] Error 2 I think its a problem with libraries.. Any ideas how to solve this?? Thanks. From luna@REDACTED Wed Mar 28 18:37:29 2007 From: luna@REDACTED (Daniel Luna) Date: Wed, 28 Mar 2007 18:37:29 +0200 (CEST) Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> Message-ID: On Thu, 29 Mar 2007, June Kim wrote: > "fun" expressions can be used to declare a function. Can it make a > recursive call inside? > > That is, > > Can I somehow declare the following with callself, which is an > imaginary functionality that calls the anonymous function itself? > > fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. Fun = fun(F, X) -> receive {P,V} -> P!(X+V), F(F, X+V) end end, Fun(Fun, X0), So you just need to define the function that you want to call and then add the function as an argument to itself. The joys of dynamic typing (or infinite types). Just a warning though. Self recursive anonymous functions don't handle hot code updates. /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From vladdu55@REDACTED Wed Mar 28 22:49:12 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Mar 2007 20:49:12 +0000 Subject: [erlang-questions] Erlang/OTP R11B-4 has been released In-Reply-To: References: Message-ID: <95be1d3b0703281349x15c6b075s8b168bec4e11bb8e@mail.gmail.com> Hi, On 28 Mar 2007 15:51:15 +0200, Bjorn Gustavsson wrote: > This is bug fix release 4 for the R11B release. Cool! Thanks! * The online documentation isn't updated yet. * What's the story with typer? I suppose it's still unsupported, since it's not documented. I can get it print annotations with --show, but it doesn't create any annotation file otherwise (on Windows) best regards, Vlad From mle+erlang@REDACTED Wed Mar 28 22:49:32 2007 From: mle+erlang@REDACTED (Erik de Castro Lopo) Date: Thu, 29 Mar 2007 06:49:32 +1000 Subject: [erlang-questions] Escript In-Reply-To: References: <20070328234531.359557d0.mle+erlang@mega-nerd.com> Message-ID: <20070329064932.c2b2d969.mle+erlang@mega-nerd.com> Bjorn Gustavsson wrote: > escript is included in R11B-4. Hmm, I'm running the R11B-2 package shipped with the Ubuntu Feisty Linux distribution. Is there any way I can get hold of escript without compiling erlang from source? Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "... a discussion of C++'s strengths and flaws always sounds like an argument about whether one should face north or east when one is sacrificing one's goat to the rain god." -- Thant Tessman From kostis@REDACTED Wed Mar 28 22:37:06 2007 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 28 Mar 2007 22:37:06 +0200 Subject: [erlang-questions] TypEr [WAS: Re: Erlang/OTP R11B-4 has been released] In-Reply-To: <95be1d3b0703281349x15c6b075s8b168bec4e11bb8e@mail.gmail.com> References: <95be1d3b0703281349x15c6b075s8b168bec4e11bb8e@mail.gmail.com> Message-ID: <460AD1F2.60307@cs.ntua.gr> Vlad Dumitrescu wrote: > Hi, > > * What's the story with typer? I suppose it's still unsupported, since > it's not documented. I can get it print annotations with --show, but > it doesn't create any annotation file otherwise (on Windows) As far as I know, on Unix machines, typer works OK when used with the --show or --show-exported options. At this point, I would not recommend any other way of using typer. Not because the other ways do not work, but more because the type domain (i.e. the type annotations typer generates) is a moving target as we refine the type analysis. So, if I were a user, I would be reluctant to add to my files type annotations which might change in the next release. It's also on our TODO list (albeit near its bottom) to see if there are any incompatibilities between the types that typer generates and edoc understands. On this point, we welcome user feedback & experiences. We've not tested typer on Windows; we do not have access to such an environment. However, if there are any problems on that platform (*), they should be relatively easy to fix once reported to us by a user who is also willing to help. Kostis (*) Of course, I mean of the related to typer kind... I am sure there are others. From yerl@REDACTED Thu Mar 29 00:03:45 2007 From: yerl@REDACTED (Yerl) Date: Thu, 29 Mar 2007 00:03:45 +0200 Subject: [erlang-questions] Escript In-Reply-To: <20070329064932.c2b2d969.mle+erlang@mega-nerd.com> References: <20070328234531.359557d0.mle+erlang@mega-nerd.com> <20070329064932.c2b2d969.mle+erlang@mega-nerd.com> Message-ID: <460AE641.8030009@club-internet.fr> Hi Erik! Look here: http://yhafri.club.fr/crux/index.htm http://yhafri.club.fr/crux/escript/escript-4.1.tgz http://yhafri.club.fr/crux/escript/Pkgfile cheers Youn?s Erik de Castro Lopo a ?crit : > Bjorn Gustavsson wrote: > > >> escript is included in R11B-4. >> > > Hmm, I'm running the R11B-2 package shipped with the Ubuntu Feisty > Linux distribution. > > Is there any way I can get hold of escript without compiling erlang > from source? > > Cheers, > Erik > From ok@REDACTED Thu Mar 29 02:30:55 2007 From: ok@REDACTED (ok) Date: Thu, 29 Mar 2007 12:30:55 +1200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> Message-ID: <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> On 29 Mar 2007, at 3:45 am, June Kim wrote: > "fun" expressions can be used to declare a function. > Can [a fun] make a recursive call inside? Let's take factorial 0 = 1 factorial n = n * factorial (n-1) as an example. We'd have to have F = fun (0) -> 1; (N) -> N * F(N-1) end This doesn't work, because the compiler reckons the second occurrence of F is unbound. So the body of F will have to use some other variable, call it G. But we can't provide the value of G until after the value to be bound to F is created, so G will have to be a parameter. G = fun (_, 0) -> ; (G, N) -> N * G(G, N-1) end, F = fun (N) -> G(G, N) end We *do* have to give G a name (because F uses G twice); we *don't* have to give F a name. In general, F = fun (...) -> ... F(...) ... end turns into G = fun (G,...) -> ... G(G,...) ... end, F = fun (...) -> G(G,...) end A group of mutually recursive functions can be handled by adding an argument for each. > Can I somehow declare the following with callself, which is an > imaginary functionality that calls the anonymous function itself? > > fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. This example becomes ( G = fun (G, X) -> receive {P,V} -> P!(X+V), G(G, X+V) end end, fun (X) -> G(G, X) end ) From erlang@REDACTED Thu Mar 29 08:10:12 2007 From: erlang@REDACTED (Peter Lund) Date: Thu, 29 Mar 2007 08:10:12 +0200 Subject: [erlang-questions] Communicating processes In-Reply-To: <0E92D352-7FCB-4FDB-A153-4434EBA6204D@gmail.com> References: <0E92D352-7FCB-4FDB-A153-4434EBA6204D@gmail.com> Message-ID: <460B5844.9030702@lundata.se> Fredrik Hoback skrev: > Hi, I'm having some trouble with inter-process communication. First of > all I have a process which receives a message it looks something like > this: > > %%%%%%%%%%%%%%%%%%%%%%%% > receive_msg() -> > receive > {Msg} -> > io:format("Recieved Message"); > _-> > io:format("Nothing to report") > end. > %%%%%%%%%%%%%%%%%%%%%%%% > Note: this process is spawned and registered as proxy. > > To continue: I have another module which I start from within the shell > it looks similar to this: > > %%%%%%%%%%%%%%%%%%%%%%%% > send_message()-> > Msg = "Hello World", % My message > send(Msg), % here I send my message somewhere unknown and the reply is > sent to the process proxy above > %Here I want to receive the message that is received in proxy > %%%%%%%%%%%%%%%%%%%%%%%% > > So how to I accomplish this? Is there any other way then using " ! "? > What I would like to do is to call the process proxy from within > send_message and the return answer should be Msg, is this possible? > And how should it look? I am not sure what you are looking for, but anyhow if you would like to implement a function "call" to retrieve something from another process: %% process A ... NameOfB = call(BPid, what_is_your_name) ... call(Pid, Msg) -> Ref = make_ref(), Pid ! {call_request, Ref, self(), Msg}, receive {call_response, Ref, Resp} -> Resp after 5000 -> timeout end. %% process B loop() -> receive {call_request, Ref, From, what_is_your_name} -> From ! {call_response, Ref, "Barbados"} end, loop(). The make_ref() returns a unique refernce assuring the caller that it is the response to the correct request. Observer that the call here is allowed to timeout after 5000 millisecs. From vladdu55@REDACTED Thu Mar 29 09:13:05 2007 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 29 Mar 2007 09:13:05 +0200 Subject: [erlang-questions] TypEr [WAS: Re: Erlang/OTP R11B-4 has been released] In-Reply-To: <460AD1F2.60307@cs.ntua.gr> References: <95be1d3b0703281349x15c6b075s8b168bec4e11bb8e@mail.gmail.com> <460AD1F2.60307@cs.ntua.gr> Message-ID: <95be1d3b0703290013w539c071dn10cd2c70633f6d6b@mail.gmail.com> Hi, On 3/28/07, Kostis Sagonas wrote: > As far as I know, on Unix machines, typer works OK when used with the > --show or --show-exported options. Works on Windows too. I see that here at work it works > At this point, I would not recommend any other way of using typer. Not > because the other ways do not work, but more because the type domain > (i.e. the type annotations typer generates) is a moving target as we > refine the type analysis. So, if I were a user, I would be reluctant to > add to my files type annotations which might change in the next release. Ah, the output is the annotated source code. Somehow I thought it would have been just the annotations. BTW, it would be useful to do the same addition as with dialyzer: make it callable from inside Erlang and returning the type information as a data structure. Of course, this would also place at the bottom of the todo list. best regards, Vlad From raimo+erlang-questions@REDACTED Thu Mar 29 09:27:15 2007 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 29 Mar 2007 09:27:15 +0200 Subject: [erlang-questions] : anyway to make recursion inside anonymous funs? In-Reply-To: <55DDB08CC9CD2941A70E8D626789A2C904AA3C11@ec8l7ljvo9h5dde.hosting.exch> References: <55DDB08CC9CD2941A70E8D626789A2C904AA3C11@ec8l7ljvo9h5dde.hosting.exch> Message-ID: <20070329072715.GA8708@erix.ericsson.se> The standard trick in Erlang is: F = fun(This, X) -> receive {P,V} -> P!{X+V}, This(This, X+V) end end, F(F, 17). On Wed, Mar 28, 2007 at 06:03:10PM +0200, VAUCHER Laurent wrote: > http://en.wikipedia.org/wiki/Anonymous_recursion ? > > > -----Message d'origine----- > De : erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] De la part de June Kim > Envoy? : 28 March 2007 17:45 > ? : erlang-questions@REDACTED > Objet : [erlang-questions] anyway to make recursion inside anonymous funs? > > "fun" expressions can be used to declare a function. Can it make a recursive call inside? > > That is, > > Can I somehow declare the following with callself, which is an imaginary functionality that calls the anonymous function itself? > > fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From waldemar.rachwal@REDACTED Thu Mar 29 10:56:51 2007 From: waldemar.rachwal@REDACTED (Waldemar Rachwal) Date: Thu, 29 Mar 2007 10:56:51 +0200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> Message-ID: See Joe's thesis: http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf In chap. 3.3.12 "Higher order functions", on page 57 there is a factorial example implemented with funs. WR. On 3/28/07, June Kim wrote: > "fun" expressions can be used to declare a function. Can it make a > recursive call inside? > > That is, > > Can I somehow declare the following with callself, which is an > imaginary functionality that calls the anonymous function itself? > From huss01@REDACTED Thu Mar 29 11:09:34 2007 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Thu, 29 Mar 2007 11:09:34 +0200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> Message-ID: On 3/29/07, ok wrote: > > On 29 Mar 2007, at 3:45 am, June Kim wrote: > > > "fun" expressions can be used to declare a function. > > Can [a fun] make a recursive call inside? > > Let's take > factorial 0 = 1 > factorial n = n * factorial (n-1) > as an example. > > > G = fun (_, 0) -> ; (G, N) -> N * G(G, N-1) end, > F = fun (N) -> G(G, N) end > > We *do* have to give G a name (because F uses G twice); > we *don't* have to give F a name. > Well, obviously we don't *have to* give G a name, or lambda-calculus would have severe problems. Not doing so, however, requires you to write out the fun previously known as G twice: F = fun (N) -> fun (_, 0) -> 1; (G, N) -> N * G(G, N-1) end (fun (_, 0) -> 1; (G, N) -> N * G(G, N-1) end, N) end. > > Can I somehow declare the following with callself, which is an > > imaginary functionality that calls the anonymous function itself? > > > > fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. > > This example becomes > ( G = fun (G, X) -> receive {P,V} -> P!(X+V), G(G, X+V) end end, > fun (X) -> G(G, X) end > ) > Without G: fun (X) -> fun (F) -> receive {P,V} -> P!(X+V), F(F) end end (fun (F) -> receive {P,V} -> P!(X+V), F(F) end end) end. /H?kan From dg@REDACTED Thu Mar 29 11:42:06 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Thu, 29 Mar 2007 13:42:06 +0400 Subject: [erlang-questions] Restarting processes Message-ID: <460B89EE.4070202@ot-e.biz> In my application I have a demultiplexing process and few worker processes. The workers subscribe to events, the demultiplexor gets requests from the network, and distributes them to the workers, which handle them as appropiate. The demultiplexor monitors (erlang:monitor) the workers, so when a worker terminates without unsubscribing, the demultiplexor cleans the subscription data. Now, what if the demultiplexor itself die? Ok, demultiplexor's supervisor will restart it. But what about the workers? I don't want to terminate and restart them, because workers carry quite a few state and I don't want that state to be lost. So, I need my workers to resubscribe to restarted demux. How can I handle it nicely? I can have workers to monitor the demux. It solves a part of the problem: the workers would be notified if old demux die and try to resubscribe to new demux getting it's pid via whereis(demux_registered_name). But what if a worker get {'DOWN', ...} message and tries to resubscribe, but the demux isn't restarted yet or haven't finished the init stage? Cleary a race contidition. I can introduce a small delay after the {'DOWN, ...} message and attempted resubscription, but this approach seems to be a bit ugly. What I want to do is to have a some way for demux to announce "Hey, I've just restarted and forgot all my subscribers. Now I'm operational again. Whoever interested may resubscribe". Supervisors seem to be a natural choice to relay that king of messages, since they are always there. But it appears that OTP supervisors cannot do that. How do you handle this kind of problems in your applications? -- dg From rdiaz02@REDACTED Thu Mar 29 12:00:12 2007 From: rdiaz02@REDACTED (Ramon Diaz-Uriarte) Date: Thu, 29 Mar 2007 12:00:12 +0200 Subject: [erlang-questions] Erlang and Ada Message-ID: <624934630703290300v7e489ee2tad98c065e523f861@mail.gmail.com> Dear All, I was looking for a comparison of Erlang with Ada and could find very little (I searched comp.lang.ada, the erlang list, and lambda the ultimate, and did a variety of goodle searches). I understand that the two languages have different origins and have been mainly applied in different areas (telecom --Erlang-- vs. aviation and military --Ada). But it seems both are unique among "major languages" in the support they provide for concurrent and distributed programming using message passing. Why, then, so few comparisons among the two? In case it is relevant for anyone, I found the following masters thesis (?) "Comparison of the Concurrency Concepts of Ada, CHILL, Erlang, and Java" by Frank Ecke (http://www1.informatik.uni-jena.de/Themen/pap-talk/studarb-pb-fe.htm) interesting in that regard (there is another one by P. Br?mel, but being in German is inaccessible to me). If I understand correctly from the docs of each of the languages, etc, the main differences between the two (besides the difference in dynamic and functional (Erlang) vs. statics and imperative (Ada)) are: - Erlang uses asynchronous message passing, whereas Ada uses synchronous message passing. However, as F. Ecke shows above, it is possible to "trick" both languages into doing synchronous (Erlang) and asynchronous (Ada) without much trouble. - The concurrency and distributed computing aspects of Erlang emphasize fault tolerance. - Whether you use multiple Erlang processes within a machine or over several machines (e.g., a cluster) is generally transparent (i.e., code to cover these situations and things in between does not require rewriting). (Sure, there are many other differences from syntax to interpreter to libraries, etc). Am I missing something obvious? Best, R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz From ulf.wiger@REDACTED Thu Mar 29 12:14:40 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 29 Mar 2007 12:14:40 +0200 Subject: [erlang-questions] Restarting processes In-Reply-To: <460B89EE.4070202@ot-e.biz> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> I made an extended process registry a while ago, called proc: http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/proc/ Here's the edoc manual: http://jungerl.cvs.sourceforge.net/*checkout*/jungerl/jungerl/lib/proc/d oc/proc.html?revision=1.1 It allows processes to register under several different names, and the names don't have to be atoms. It also allows processes to register "properties", which do not have to be unique. Properties can be used for a very simple publish- subscribe pattern that would work in your case. The subscriber publishes a property, and the publisher folds over a given property and e.g. sends a message to each process. Example: demux.erl subscribe() -> proc:add_property(property()). notify(Event) -> proc:fold_properties( fun({_Prop, Pid}, _Acc) -> Pid ! {self(), ?MODULE, Event} end, [], property()). property() -> {?MODULE, subscriber}. As the subscriber property is registered with the subscriber process, and not kept by the publisher, it remains even if the publisher is restarted. An added bonus with the pattern is that properties become sort of a public registry of characteristics and dependencies of properties - a process index, which can be extremely helpful during debugging. We've been using this solution in our products for a while, and it has led to a radical simplification of the code. It turned out that this was a pervasive pattern in our applications, e.g. releasing all calls associated with a given signaling channel; identifying all processes involved in a given call setup; etc. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Daniel Ginsburg > Sent: den 29 mars 2007 11:42 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Restarting processes > > In my application I have a demultiplexing process and few > worker processes. The workers subscribe to events, the > demultiplexor gets requests from the network, and distributes > them to the workers, which handle them as appropiate. > > The demultiplexor monitors (erlang:monitor) the workers, so > when a worker terminates without unsubscribing, the > demultiplexor cleans the subscription data. > > Now, what if the demultiplexor itself die? Ok, > demultiplexor's supervisor will restart it. But what about > the workers? I don't want to terminate and restart them, > because workers carry quite a few state and I don't want that > state to be lost. So, I need my workers to resubscribe to > restarted demux. How can I handle it nicely? > > I can have workers to monitor the demux. It solves a part of the > problem: the workers would be notified if old demux die and > try to resubscribe to new demux getting it's pid via > whereis(demux_registered_name). But what if a worker get > {'DOWN', ...} message and tries to resubscribe, but the demux > isn't restarted yet or haven't finished the init stage? > Cleary a race contidition. I can introduce a small delay > after the {'DOWN, ...} message and attempted resubscription, > but this approach seems to be a bit ugly. > > What I want to do is to have a some way for demux to announce > "Hey, I've just restarted and forgot all my subscribers. Now > I'm operational again. > Whoever interested may resubscribe". Supervisors seem to be a > natural choice to relay that king of messages, since they are > always there. But it appears that OTP supervisors cannot do > that. How do you handle this kind of problems in your applications? > > -- > dg > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Thu Mar 29 12:16:33 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 29 Mar 2007 12:16:33 +0200 Subject: [erlang-questions] Restarting processes In-Reply-To: <460B89EE.4070202@ot-e.biz> References: <460B89EE.4070202@ot-e.biz> Message-ID: <460B9201.8040801@ericsson.com> Daniel Ginsburg wrote: > In my application I have a demultiplexing process and few worker > processes. The workers subscribe to events, the demultiplexor gets > requests from the network, and distributes them to the workers, which > handle them as appropiate. > > The demultiplexor monitors (erlang:monitor) the workers, so when a > worker terminates without unsubscribing, the demultiplexor cleans the > subscription data. > > Now, what if the demultiplexor itself die? Ok, demultiplexor's > supervisor will restart it. But what about the workers? I don't want to > terminate and restart them, because workers carry quite a few state and > I don't want that state to be lost. So, I need my workers to resubscribe > to restarted demux. How can I handle it nicely? > > I can have workers to monitor the demux. It solves a part of the > problem: the workers would be notified if old demux die and try to > resubscribe to new demux getting it's pid via > whereis(demux_registered_name). But what if a worker get {'DOWN', ...} > message and tries to resubscribe, but the demux isn't restarted yet or > haven't finished the init stage? Cleary a race contidition. I can > introduce a small delay after the {'DOWN, ...} message and attempted > resubscription, but this approach seems to be a bit ugly. > > What I want to do is to have a some way for demux to announce "Hey, I've > just restarted and forgot all my subscribers. Now I'm operational again. > Whoever interested may resubscribe". Supervisors seem to be a natural > choice to relay that king of messages, since they are always there. But > it appears that OTP supervisors cannot do that. How do you handle this > kind of problems in your applications? > i can see two easy ways to do this. in either case the workers should monitor the demux. * the workers poll on the demux registered name. * the demux has an ets table with all worker pids, and notify them at startup. mats From lcoquelle@REDACTED Thu Mar 29 12:23:55 2007 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Thu, 29 Mar 2007 18:23:55 +0800 Subject: [erlang-questions] Restarting processes In-Reply-To: <460B89EE.4070202@ot-e.biz> References: <460B89EE.4070202@ot-e.biz> Message-ID: Not sure to well understand everything as I have few experience with Erlang, but I was thinking: if the workers are started with start_link kind of function, shouldn't they get a message when/if the demultiplexer dies? that way they know they have to re-subscribe but don't know the new demultiplexer .... maybe they could subscribe to an orphan server that the new demultiplexer can use when it start? does this make sense? On 3/29/07, Daniel Ginsburg wrote: > > In my application I have a demultiplexing process and few worker > processes. The workers subscribe to events, the demultiplexor gets > requests from the network, and distributes them to the workers, which > handle them as appropiate. > > The demultiplexor monitors (erlang:monitor) the workers, so when a > worker terminates without unsubscribing, the demultiplexor cleans the > subscription data. > > Now, what if the demultiplexor itself die? Ok, demultiplexor's > supervisor will restart it. But what about the workers? I don't want to > terminate and restart them, because workers carry quite a few state and > I don't want that state to be lost. So, I need my workers to resubscribe > to restarted demux. How can I handle it nicely? > > I can have workers to monitor the demux. It solves a part of the > problem: the workers would be notified if old demux die and try to > resubscribe to new demux getting it's pid via > whereis(demux_registered_name). But what if a worker get {'DOWN', ...} > message and tries to resubscribe, but the demux isn't restarted yet or > haven't finished the init stage? Cleary a race contidition. I can > introduce a small delay after the {'DOWN, ...} message and attempted > resubscription, but this approach seems to be a bit ugly. > > What I want to do is to have a some way for demux to announce "Hey, I've > just restarted and forgot all my subscribers. Now I'm operational again. > Whoever interested may resubscribe". Supervisors seem to be a natural > choice to relay that king of messages, since they are always there. But > it appears that OTP supervisors cannot do that. How do you handle this > kind of problems in your applications? > > -- > dg > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From forsyth@REDACTED Thu Mar 29 12:29:27 2007 From: forsyth@REDACTED (Charles Forsyth) Date: Thu, 29 Mar 2007 11:29:27 +0100 Subject: [erlang-questions] Erlang and Ada Message-ID: <69a517e79492578765b9f939cd25918d@terzarima.net> >- Erlang uses asynchronous message passing, whereas Ada uses >synchronous message passing. However, as F. Ecke shows above, it is Ada doesn't really use message passing. the rendezvous is more like a procedure call into another process, although that description too is misleading. it's really a different construction. From ulf.wiger@REDACTED Thu Mar 29 12:47:44 2007 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Thu, 29 Mar 2007 12:47:44 +0200 Subject: [erlang-questions] Erlang and Ada In-Reply-To: <624934630703290300v7e489ee2tad98c065e523f861@mail.gmail.com> Message-ID: <6616D98C65DD514BA2E1DDC5F92231550186DB13@esealmw115.eemea.ericsson.se> One missing detail in your list is that Erlang lacks global variables, while Ada has them. Erlang thus consistently employs "share-nothing concurrency", while this is optional in Ada. This is one of the fundamental reasons why you have distribution transparency fairly routinely in Erlang, while it is by no means given in e.g. Ada. In the very early history of Erlang, a study called SPOTS (SPC* for POTS**) was done. It involved writing a phone switch control system in several different languages. The project was sketched by Mike Williams back in 1981, and carried out, as I understand it, 1982-1984. It involved experiments using e.g. CHILL, Ada, Concurrent Euclid, CCS, LPL, Frames, CLU and OPS4 - i.e. imperative declarative, object- oriented and rule-based programming environments. A report was presented at: "Experiments with Programming Languages and Techniques for Telecommunications Applications" (Bjarne D?cker, Nabiel Elshiewy, Per Hedeland, Carl Wilhelm Welin and Mike Williams) Software Engineering for Telecommunication Switching Systems, April 14-18, 1996, Eindhoven I'm sure it's difficult to come by, in electronic form or otherwise. Back in those days, it was by no means easy to circumvent the synchonous nature of Ada's rendezvous, but I think I recall that Ada got pretty favourable reviews overall. I've often heard the comment that it wouldn't have been half bad if industry had chosen to standardize on Ada... Back in 1996, I also heard of a project sponsored by the Swedish Defense Industry, leading to a Master's Thesis: "Process-based Simulation of Interactive Agents in a Dynamic Terrain." Samuel Tronje. UU/CSD, 1995. It was a troop simulation program, which was supposed to have been written in Ada, but was never finished. A few students wrote it in Erlang in a few weeks. I've read the report once, but don't recall whether it contains any comparisons between Erlang and Ada. I also recall hearing that much attention at the demo was paid to the graphical user interface, so the reasons why the Ada project didn't succeed may well have very little to do with language- specific matters***. * SPC = Stored Program Controller ** POTS = Plain Ordinary Telephone System *** I recall a similar project where a contractor was to build a prototype system for tracking vehicles as overlays on digital maps. They couldn't handle a live feed, but did have cute animated helicopters, and were embarrassed that the helicopter flew upside- down when going in the other direction. The organization that ordered the work escorted them to the airport and told them never to come back. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Ramon Diaz-Uriarte > Sent: den 29 mars 2007 12:00 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Erlang and Ada > > Dear All, > > I was looking for a comparison of Erlang with Ada and could > find very little (I searched comp.lang.ada, the erlang list, > and lambda the ultimate, and did a variety of goodle > searches). I understand that the two languages have different > origins and have been mainly applied in different areas > (telecom --Erlang-- vs. aviation and military --Ada). > But it seems both are unique among "major languages" in the > support they provide for concurrent and distributed > programming using message passing. Why, then, so few > comparisons among the two? > > In case it is relevant for anyone, I found the following > masters thesis (?) > > "Comparison of the Concurrency Concepts of Ada, CHILL, > Erlang, and Java" by Frank Ecke > (http://www1.informatik.uni-jena.de/Themen/pap-talk/studarb-pb-fe.htm) > interesting in that regard (there is another one by P. > Br?mel, but being in German is inaccessible to me). > > > If I understand correctly from the docs of each of the > languages, etc, the main differences between the two (besides > the difference in dynamic and functional (Erlang) vs. statics > and imperative (Ada)) are: > > - Erlang uses asynchronous message passing, whereas Ada uses > synchronous message passing. However, as F. Ecke shows above, > it is possible to "trick" both languages into doing > synchronous (Erlang) and asynchronous (Ada) without much trouble. > > - The concurrency and distributed computing aspects of Erlang > emphasize fault tolerance. > > - Whether you use multiple Erlang processes within a machine > or over several machines (e.g., a cluster) is generally > transparent (i.e., code to cover these situations and things > in between does not require rewriting). > > (Sure, there are many other differences from syntax to > interpreter to libraries, etc). > > > Am I missing something obvious? > > > > Best, > > R. > > -- > Ramon Diaz-Uriarte > Statistical Computing Team > Structural Biology and Biocomputing Programme Spanish > National Cancer Centre (CNIO) http://ligarto.org/rdiaz > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From lemenkov@REDACTED Thu Mar 29 14:42:27 2007 From: lemenkov@REDACTED (Peter Lemenkov) Date: Thu, 29 Mar 2007 16:42:27 +0400 Subject: [erlang-questions] Tail recursion and memory leak In-Reply-To: References: Message-ID: > Is it possible that your destination is responding to you and those > messages are stacking up in you r message queue? The way you have > opened your UDP socket, the {active, true} option would be set by > default on your socket and any UDP packets arriving will be delivered > to your process message queue. > > Repeat the experiment by opening the socket as follows: > > gen_udp:open(3456, [{active, false}]). Thanks, Chandru! It solves the problem! -- With best regards! From philar@REDACTED Thu Mar 29 18:11:04 2007 From: philar@REDACTED (Philip Robinson) Date: Fri, 30 Mar 2007 02:11:04 +1000 Subject: [erlang-questions] Restarting processes In-Reply-To: Message-ID: >I don't want that state to be lost. So, I need my workers to resubscribe >to restarted demux. How can I handle it nicely? If I try to monitor a dead process I get another 'DOWN' message. Have you tried something like this? loop() -> receive {'DOWN', _Ref, process, MonitoredProcess, _Reason} -> erlang:monitor(process, MonitoredProcess), loop(); ... Cheers, Philip _________________________________________________________________ Advertisement: Chat with 1000s of Sexy Singles right now http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D25447&_t=754951090&_r=chat&_m=EXT From nils.muellner@REDACTED Thu Mar 29 19:06:24 2007 From: nils.muellner@REDACTED (=?ISO-8859-15?Q?Nils_M=FCllner?=) Date: Thu, 29 Mar 2007 19:06:24 +0200 Subject: [erlang-questions] random:uniform \chi^2 test Message-ID: <460BF210.5020605@heh.uni-oldenburg.de> Hi, has someone ever tested the reliability of the random-number generator with a chi square test? Kind regards, Nils From dg@REDACTED Thu Mar 29 19:12:28 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Thu, 29 Mar 2007 21:12:28 +0400 Subject: [erlang-questions] Restarting processes In-Reply-To: <460B9201.8040801@ericsson.com> References: <460B89EE.4070202@ot-e.biz> <460B9201.8040801@ericsson.com> Message-ID: <460BF37C.7040003@ot-e.biz> Mats Cronqvist ?????: > i can see two easy ways to do this. > in either case the workers should monitor the demux. > * the workers poll on the demux registered name. You mean, calling whereis(demux_name) is a cycle? Well, if other approaches won't work, I think I'll do just that. > * the demux has an ets table with all worker pids, and notify them at > startup. I might be confused about how ets works, but if demux has an ets table and terminates, the table will vanish along with it's owner, won't it? -- dg From dg@REDACTED Thu Mar 29 19:12:23 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Thu, 29 Mar 2007 21:12:23 +0400 Subject: [erlang-questions] Restarting processes In-Reply-To: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> Message-ID: <460BF377.40809@ot-e.biz> This sounds good. I think I'll give it a try. I just hope that process registry won't die ;) I think I'll need to measure performance of lookups in (or folding through) the registry (if you have any data, please share). Anyway, even if the lookup is not very fast, I'll be able to repopulate demux lookup tables from the registry in case demux has to restart. Ulf Wiger (TN/EAB) ?????: > I made an extended process registry a while ago, > called proc: > > http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/proc/ > > Here's the edoc manual: > http://jungerl.cvs.sourceforge.net/*checkout*/jungerl/jungerl/lib/proc/d > oc/proc.html?revision=1.1 > > It allows processes to register under several different > names, and the names don't have to be atoms. It also > allows processes to register "properties", which do > not have to be unique. > > > Properties can be used for a very simple publish- > subscribe pattern that would work in your case. > > The subscriber publishes a property, and the publisher > folds over a given property and e.g. sends a message to > each process. > > Example: > > demux.erl > > subscribe() -> > proc:add_property(property()). > > notify(Event) -> > proc:fold_properties( > fun({_Prop, Pid}, _Acc) -> > Pid ! {self(), ?MODULE, Event} > end, [], property()). > > property() -> {?MODULE, subscriber}. > > As the subscriber property is registered with the > subscriber process, and not kept by the publisher, > it remains even if the publisher is restarted. > > An added bonus with the pattern is that properties > become sort of a public registry of characteristics > and dependencies of properties - a process index, > which can be extremely helpful during debugging. > > We've been using this solution in our products for > a while, and it has led to a radical simplification > of the code. It turned out that this was a pervasive > pattern in our applications, e.g. releasing all > calls associated with a given signaling channel; > identifying all processes involved in a given > call setup; etc. > > BR, > Ulf W > > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED >> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of >> Daniel Ginsburg >> Sent: den 29 mars 2007 11:42 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Restarting processes >> >> In my application I have a demultiplexing process and few >> worker processes. The workers subscribe to events, the >> demultiplexor gets requests from the network, and distributes >> them to the workers, which handle them as appropiate. >> >> The demultiplexor monitors (erlang:monitor) the workers, so >> when a worker terminates without unsubscribing, the >> demultiplexor cleans the subscription data. >> >> Now, what if the demultiplexor itself die? Ok, >> demultiplexor's supervisor will restart it. But what about >> the workers? I don't want to terminate and restart them, >> because workers carry quite a few state and I don't want that >> state to be lost. So, I need my workers to resubscribe to >> restarted demux. How can I handle it nicely? >> >> I can have workers to monitor the demux. It solves a part of the >> problem: the workers would be notified if old demux die and >> try to resubscribe to new demux getting it's pid via >> whereis(demux_registered_name). But what if a worker get >> {'DOWN', ...} message and tries to resubscribe, but the demux >> isn't restarted yet or haven't finished the init stage? >> Cleary a race contidition. I can introduce a small delay >> after the {'DOWN, ...} message and attempted resubscription, >> but this approach seems to be a bit ugly. >> >> What I want to do is to have a some way for demux to announce >> "Hey, I've just restarted and forgot all my subscribers. Now >> I'm operational again. >> Whoever interested may resubscribe". Supervisors seem to be a >> natural choice to relay that king of messages, since they are >> always there. But it appears that OTP supervisors cannot do >> that. How do you handle this kind of problems in your applications? >> >> -- >> dg >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> -- dg From dg@REDACTED Thu Mar 29 19:55:21 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Thu, 29 Mar 2007 21:55:21 +0400 Subject: [erlang-questions] Restarting processes In-Reply-To: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> References: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> Message-ID: <460BFD89.1090305@ot-e.biz> I have glanced through the code and noticed that you use a very simple and impossible to fail separate process "proc_tabs", which acts as ets tables holder. So even if proc server itself will die and restart, its state will be retained. Clever! Ulf Wiger (TN/EAB) ?????: > I made an extended process registry a while ago, > called proc: > > http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/proc/ > > Here's the edoc manual: > http://jungerl.cvs.sourceforge.net/*checkout*/jungerl/jungerl/lib/proc/d > oc/proc.html?revision=1.1 > > It allows processes to register under several different > names, and the names don't have to be atoms. It also > allows processes to register "properties", which do > not have to be unique. > > -- dg From christopher.faulet@REDACTED Thu Mar 29 23:21:48 2007 From: christopher.faulet@REDACTED (Christopher Faulet) Date: Thu, 29 Mar 2007 23:21:48 +0200 Subject: [erlang-questions] Residual indexes with mnesia In-Reply-To: <45F92488.1080907@meetic-corp.com> References: <45F92488.1080907@meetic-corp.com> Message-ID: <460C2DEC.1030902@capflam.org> Salazard R?my a ?crit : > I have a problem with a mnesia table of type 'bag' with indexed fields. > > When I'm using mnesia:dirty_delete_object/2, sometimes the indexes are > removed and sometimes not :( [...] > > Do I make a mistake or is it a bug? Hi, IMHO, this is a bug and a leak. Firstly, I will explain shortly the format of indexes tables. I hope there are no mistakes in my explanation. For mnesia table, built with the record #mytbl{one, two, three}, the element identified by 'one' is the implicit key. We can add extra indexes on this table (For example, we can add an index on the element identified by 'two'). When we do that, a table per index is created. It will contain fields with the following syntax: {index, key} We are going to use the following example to illustrate our purpose: We insert {mytbl, key_1, index_1, data1} (1) {mytbl, key_1, index_2, data2} (2) {mytbl, key_1, index_2, data3} (3) {mytbl, key_2, index_1, data4} (4) in the mnesia table named 'mytbl', defined from the record #mytbl{one, two, three} and with an index on second element. The associated indexes table will be: {index_1, key_1} -> associated with record (1) {index_2, key_1} -> associated with records (2) and (3) {index_1, key_2} -> associated with record (4) Now, when we remove a record, we must remove these associated indexes too. But, with a table of type 'bag', we can have multiple records with the same pair {index, key} (in our example, {index_2, key_1} is shared by records (2) and (3)). So, to remove an index, we must be sure that there is no other records that use the same pair {index, key}. In our example, if we remove the record (1) or (4), we also implicitly remove the associated index, i.e, respectively, {index_1, key_1} or {index_1, key_2}. But, if we remove the record (2), the record (3) still uses the pair {index_2, key_1}. So this index must not be removed immediately. It will be removed only with the record (3). From this point, we can try to explain the suspected bug. In the file mnesia_index.erl which deals with indexes, we can find the following code: [...] 1 |del_object_bag(Tab, Key, Obj, Pos, Ixt, undefined) -> 2 | Old = mnesia_lib:db_get(Tab, Key), 3 | del_object_bag(Tab, Key, Obj, Pos, Ixt, Old); 4 |%% If Tab type is bag we need remove index identifier if Tab 5 |%% contains less than 2 elements. 6 |del_object_bag(_Tab, Key, Obj, Pos, Ixt, Old) when length(Old) < 2 -> 7 | del_ixes(Ixt, [Obj], Pos, Key); 8 |del_object_bag(_Tab, _Key, _Obj, _Pos, _Ixt, _Old) -> ok. [...] Currently, to remove an index, a request is performed in the mnesia table with the record key (line 2). If there are more than one result (guard on line 6), we suppose that there is another record(s) that shares the same index and we do not remove it (line 8). Else, we try to remove it (line 7). Come back on our example to understand what it happens. If we remove the record (4), the associated index (identified by {index_1, key_2}) is removed, because there is no other records with the same key. all is ok. Nevertheless, if we remove the record (1), the associated index (identified by {index_1, key_1}) is not removed, because there is other records with the same key (records (2) and (3)). Once the record (1) removed, there is no more opportunity to remove the pair {index_1, key_1}. IMHO, there is a bug here. We must refine the selection. We must only keep records with the same key *AND* the same index. the line 2 returns all records with the key of the one we want to remove. But, it seems likely there are records with different indexes. To fix this bug, we can replace the line 2 by these two lines: IxKey = element(Pos, Obj), Old = [X || X <- mnesia_lib:db_get(Tab, Key), element(Pos, X) =:= IxKey], It slows down the deletion of indexes and, maybe, it exists faster solutions (perhaps with some mnesia internal facilities). But this hack works. I made a patch that seems to work with the releases from R10B9 to R11B4. Regards, -- Christopher Faulet http://www.capflam.org -------------- next part -------------- A non-text attachment was scrubbed... Name: mnesia_index.patch Type: text/x-patch Size: 582 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From robert.virding@REDACTED Thu Mar 29 23:53:33 2007 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 29 Mar 2007 23:53:33 +0200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> Message-ID: <460C355D.3070509@telia.com> Well, that is all well and good but if we really want to do it properly (:-)) we should of course use the Y-combinator: Y = fun (F) -> G = fun (X) -> F(fun(Y) -> (X(X))(Y) end) end, G(G) end. Yes I know it is ugly with the G but I couldn't be bothered to write it out twice. Then you get: R = fun (F) -> fun (X) -> receive {P,V} -> P!(X+V), F(X) end end end. and the call: (Y(R))(X). Much nicer! Unfortunately you need a separate Y-combinator for each arity your recursing function has. Unless of course you always put them in a tuple and so always have one argument. Robert H?kan Huss wrote: > On 3/29/07, ok wrote: >> On 29 Mar 2007, at 3:45 am, June Kim wrote: >> >>> "fun" expressions can be used to declare a function. >>> Can [a fun] make a recursive call inside? >> Let's take >> factorial 0 = 1 >> factorial n = n * factorial (n-1) >> as an example. >> >> >> G = fun (_, 0) -> ; (G, N) -> N * G(G, N-1) end, >> F = fun (N) -> G(G, N) end >> >> We *do* have to give G a name (because F uses G twice); >> we *don't* have to give F a name. >> > Well, obviously we don't *have to* give G a name, or lambda-calculus > would have severe problems. Not doing so, however, requires you to > write out the fun previously known as G twice: > F = fun (N) -> > fun (_, 0) -> 1; > (G, N) -> N * G(G, N-1) > end > (fun (_, 0) -> 1; > (G, N) -> N * G(G, N-1) > end, > N) > end. > >>> Can I somehow declare the following with callself, which is an >>> imaginary functionality that calls the anonymous function itself? >>> >>> fun(X) -> receive {P,V} -> P!(X+V), callself(X+V) end end. >> This example becomes >> ( G = fun (G, X) -> receive {P,V} -> P!(X+V), G(G, X+V) end end, >> fun (X) -> G(G, X) end >> ) >> > Without G: > fun (X) -> > fun (F) -> > receive {P,V} -> P!(X+V), F(F) end > end (fun (F) -> > receive {P,V} -> P!(X+V), F(F) end > end) > end. > > /H?kan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From serge@REDACTED Fri Mar 30 00:01:26 2007 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 29 Mar 2007 18:01:26 -0400 Subject: [erlang-questions] term_to_binary encoding of floats in R11B-4 Message-ID: <460C3736.2090505@hq.idt.net> I noticed in kernel's release notes of R11B-4 the following statement: "A {minor_version,Version} option is now recognized by term_to_binary/2. {minor_version,1} will cause floats to be encoded in an exact and more space-efficient way compared to the previous encoding." I didn't find any mentioning of this in erl_interface/ei. Was the ei's implementation changed to support floats encoded in this more space-efficient way as well? Serge -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From rdiaz02@REDACTED Fri Mar 30 00:11:19 2007 From: rdiaz02@REDACTED (Ramon Diaz-Uriarte) Date: Fri, 30 Mar 2007 00:11:19 +0200 Subject: [erlang-questions] Erlang and Ada In-Reply-To: <3783b2ce2f74f0f16fbf6b5de761d02b@terzarima.net> References: <3783b2ce2f74f0f16fbf6b5de761d02b@terzarima.net> Message-ID: <624934630703291511l212c15b9me507f0c7e4c7ad5f@mail.gmail.com> On 3/29/07, Charles Forsyth wrote: > >- Erlang uses asynchronous message passing, whereas Ada uses > >synchronous message passing. However, as F. Ecke shows above, it is > > Ada doesn't really use message passing. the rendezvous is more like > a procedure call into another process, although that description too is > misleading. it's really a different construction. > Thanks for the clarification. R. -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz From rdiaz02@REDACTED Fri Mar 30 00:19:03 2007 From: rdiaz02@REDACTED (Ramon Diaz-Uriarte) Date: Fri, 30 Mar 2007 00:19:03 +0200 Subject: [erlang-questions] Erlang and Ada In-Reply-To: <6616D98C65DD514BA2E1DDC5F92231550186DB13@esealmw115.eemea.ericsson.se> References: <624934630703290300v7e489ee2tad98c065e523f861@mail.gmail.com> <6616D98C65DD514BA2E1DDC5F92231550186DB13@esealmw115.eemea.ericsson.se> Message-ID: <624934630703291519u2f351c75l6619362ff806c27c@mail.gmail.com> On 3/29/07, Ulf Wiger (TN/EAB) wrote: > > > One missing detail in your list is that Erlang > lacks global variables, while Ada has them. > Erlang thus consistently employs "share-nothing > concurrency", while this is optional in Ada. This > is one of the fundamental reasons why you have > distribution transparency fairly routinely in > Erlang, while it is by no means given in e.g. > Ada. Ooops!! Yes, you are right. > > In the very early history of Erlang, a study called > SPOTS (SPC* for POTS**) was done. It involved writing > a phone switch control system in several different > languages. The project was sketched by Mike Williams > back in 1981, and carried out, as I understand it, > 1982-1984. It involved experiments using e.g. > CHILL, Ada, Concurrent Euclid, CCS, LPL, Frames, > CLU and OPS4 - i.e. imperative declarative, object- > oriented and rule-based programming environments. > > A report was presented at: > > "Experiments with Programming Languages and Techniques > for Telecommunications Applications" > (Bjarne D?cker, Nabiel Elshiewy, Per Hedeland, > Carl Wilhelm Welin and Mike Williams) > Software Engineering for Telecommunication > Switching Systems, April 14-18, 1996, Eindhoven > > I'm sure it's difficult to come by, in electronic > form or otherwise. > I only found links to patents. > Back in those days, it was by no means easy to > circumvent the synchonous nature of Ada's > rendezvous, but I think I recall that Ada got > pretty favourable reviews overall. I've often > heard the comment that it wouldn't have been > half bad if industry had chosen to standardize > on Ada... > > However, Ericsson decided to "invent" Erlang. > Back in 1996, I also heard of a project sponsored by > the Swedish Defense Industry, leading to a Master's > Thesis: > > "Process-based Simulation of Interactive Agents in a Dynamic Terrain." > Samuel Tronje. > UU/CSD, 1995. > > It was a troop simulation program, which was supposed to > have been written in Ada, but was never finished. A few > students wrote it in Erlang in a few weeks. I've read the > report once, but don't recall whether it contains any > comparisons between Erlang and Ada. I also recall hearing > that much attention at the demo was paid to the graphical > user interface, so the reasons why the Ada project didn't > succeed may well have very little to do with language- > specific matters***. > > * SPC = Stored Program Controller > ** POTS = Plain Ordinary Telephone System > *** I recall a similar project where a contractor was to > build a prototype system for tracking vehicles as > overlays on digital maps. They couldn't handle a > live feed, but did have cute animated helicopters, > and were embarrassed that the helicopter flew upside- > down when going in the other direction. The organization > that ordered the work escorted them to the airport and > told them never to come back. > This is an interesting story :-). Thanks for your comments. R. > BR, > Ulf W > > > -----Original Message----- > > From: erlang-questions-bounces@REDACTED > > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > > Ramon Diaz-Uriarte > > Sent: den 29 mars 2007 12:00 > > To: erlang-questions@REDACTED > > Subject: [erlang-questions] Erlang and Ada > > > > Dear All, > > > > I was looking for a comparison of Erlang with Ada and could > > find very little (I searched comp.lang.ada, the erlang list, > > and lambda the ultimate, and did a variety of goodle > > searches). I understand that the two languages have different > > origins and have been mainly applied in different areas > > (telecom --Erlang-- vs. aviation and military --Ada). > > But it seems both are unique among "major languages" in the > > support they provide for concurrent and distributed > > programming using message passing. Why, then, so few > > comparisons among the two? > > > > In case it is relevant for anyone, I found the following > > masters thesis (?) > > > > "Comparison of the Concurrency Concepts of Ada, CHILL, > > Erlang, and Java" by Frank Ecke > > (http://www1.informatik.uni-jena.de/Themen/pap-talk/studarb-pb-fe.htm) > > interesting in that regard (there is another one by P. > > Br?mel, but being in German is inaccessible to me). > > > > > > If I understand correctly from the docs of each of the > > languages, etc, the main differences between the two (besides > > the difference in dynamic and functional (Erlang) vs. statics > > and imperative (Ada)) are: > > > > - Erlang uses asynchronous message passing, whereas Ada uses > > synchronous message passing. However, as F. Ecke shows above, > > it is possible to "trick" both languages into doing > > synchronous (Erlang) and asynchronous (Ada) without much trouble. > > > > - The concurrency and distributed computing aspects of Erlang > > emphasize fault tolerance. > > > > - Whether you use multiple Erlang processes within a machine > > or over several machines (e.g., a cluster) is generally > > transparent (i.e., code to cover these situations and things > > in between does not require rewriting). > > > > (Sure, there are many other differences from syntax to > > interpreter to libraries, etc). > > > > > > Am I missing something obvious? > > > > > > > > Best, > > > > R. > > > > -- > > Ramon Diaz-Uriarte > > Statistical Computing Team > > Structural Biology and Biocomputing Programme Spanish > > National Cancer Centre (CNIO) http://ligarto.org/rdiaz > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz From ok@REDACTED Fri Mar 30 03:08:00 2007 From: ok@REDACTED (ok) Date: Fri, 30 Mar 2007 13:08:00 +1200 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> Message-ID: <440F765B-4E7B-4EAB-8E74-FBF77FD6CB7D@cs.otago.ac.nz> On 29 Mar 2007, at 9:09 pm, H?kan Huss wrote: > Well, obviously we don't *have to* give G a name, or lambda-calculus > would have severe problems. Not doing so, however, requires you to > write out the fun previously known as G twice: > F = fun (N) -> > fun (_, 0) -> 1; > (G, N) -> N * G(G, N-1) %%<<<<<<< > end > (fun (_, 0) -> 1; > (G, N) -> N * G(G, N-1) %%<<<<<<< > end, > N) > end. But in this example he HAS given G a name, in the lines I have flagged with %%<<<<<<<. Even that, of course, can be eliminated by using combinators, but if we were going to use combinators we might as well use Y and be done with it. From ok@REDACTED Fri Mar 30 03:44:18 2007 From: ok@REDACTED (ok) Date: Fri, 30 Mar 2007 13:44:18 +1200 Subject: [erlang-questions] Erlang and Ada In-Reply-To: <624934630703290300v7e489ee2tad98c065e523f861@mail.gmail.com> References: <624934630703290300v7e489ee2tad98c065e523f861@mail.gmail.com> Message-ID: On 29 Mar 2007, at 10:00 pm, Ramon Diaz-Uriarte wrote: > I was looking for a comparison of Erlang with Ada and could find very > little (I searched comp.lang.ada, the erlang list, and lambda the > ultimate, and did a variety of goodle searches). I understand that the > two languages have different origins and have been mainly applied in > different areas (telecom --Erlang-- vs. aviation and military --Ada). > But it seems both are unique among "major languages" in the support > they provide for concurrent and distributed programming using message > passing. Why, then, so few comparisons among the two? I have copies of the Ada 81, Ada 83, Ada 95, and Ada 2005 standards. I haven't finished reading the last of these, as I only got it recently. However, I can certainly assure you that there is nothing in any of the previous Ada standards concerning distribution. Ada was designed to be a clean general-purpose programming language with a special emphasis on embedded systems, which is one reason why the Ada standards do not require garbage collection. The SPARK Ada subset, that is, the subset supported by the SPARK verifier, doesn't even include dynamic allocation, although that is certainly part of the full language. Nor does Ada use message passing. It uses the *rendezvous*, which is a bit like message passing except that it is synchronous and unbuffered. If one Ada task wants another task to do something, it has to wait until the other task is ready to receive the request. The 'select' statement of Ada is very similar indeed to Erlang's 'receive', but the one is unbuffered synchronous and the other buffered asynchronous. The different backgrounds lead to another important difference. Erlang is designed for systems where you expect to upgrade the software while it is running without taking the system down; this is the famous "hot loading", and amongst other things it presupposes a network over which the changes can be distributed. Ada was designed for conventional applications and for embedded systems, where you are expected to follow a development process that gets the program "right the first time". There is no notion in the Ada language of any kind of dynamic loading. (Which is not to say that Ada can't use dynamic linking on those operating systems that have it, only that it's not part of the standard language or libraries in the same way that it's not part of the standard C language or libraries.) Interestingly, both Ada 95 and Erlang/OTP allow a kind of dotted module name, and from my point of view they both got the dotted names inside out, but Ada 95 "child packages" really have some point to them. (For example an Ada package can have *private* children that other packages cannot see. Neither Java nor Erlang can manage that. Also, Ada children can be allowed to see inside their parents, which again neither Java nor its slavish imitator in this respect, Erlang, allows.) Arguably the single most important difference between Ada and Erlang is that Ada is an imperative language relying on destructive updates to variables and arrays, while Erlang is mostly functional. One of the things that makes Ada a nice language for concurrency is that it doesn't SHARE mutable data between tasks. The nearest it comes is something called a 'protected record', which is essentially a 'monitor' (or a Java object all of whose methods are synchronised and with no exported fields). Nevertheless it is only really at home on shared *memory* machines. Ada doesn't have any form of pattern matching other than a 'case' statement which is similar to (but MUCH cleaner and far easier to get right) the C/C++/Java 'switch' statement. It _could_ have something fancier; Mesa did. From bjorn@REDACTED Fri Mar 30 07:45:19 2007 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 30 Mar 2007 07:45:19 +0200 Subject: [erlang-questions] term_to_binary encoding of floats in R11B-4 In-Reply-To: <460C3736.2090505@hq.idt.net> References: <460C3736.2090505@hq.idt.net> Message-ID: Serge Aleynikov writes: > I didn't find any mentioning of this in erl_interface/ei. Was the ei's > implementation changed to support floats encoded in this more > space-efficient way as well? Not yet. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Fri Mar 30 09:27:33 2007 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 30 Mar 2007 09:27:33 +0200 Subject: [erlang-questions] Restarting processes In-Reply-To: <460BF37C.7040003@ot-e.biz> References: <460B89EE.4070202@ot-e.biz> <460B9201.8040801@ericsson.com> <460BF37C.7040003@ot-e.biz> Message-ID: <460CBBE5.2060003@ericsson.com> Daniel Ginsburg wrote: > Mats Cronqvist ?????: > >> i can see two easy ways to do this. >> in either case the workers should monitor the demux. >> * the workers poll on the demux registered name. > > You mean, calling whereis(demux_name) is a cycle? Well, if other > approaches won't work, I think I'll do just that. i'm not sure what you mean by "cycle". but something like (pseudo-code) assert_demux() -> case whereis(demux_name) of undefined -> receive after 1000 -> assert_demux() end; Pid -> Pid end. >> * the demux has an ets table with all worker pids, and notify them at >> startup. > > I might be confused about how ets works, but if demux has an ets table > and terminates, the table will vanish along with it's owner, won't it? yes, the demux supervisor should own the table. btw, ulf's "proc" thing is a, quite clever, generalization of this. unless you use it, you'll probably end up reinventing it. mats From gunilla@REDACTED Fri Mar 30 09:36:39 2007 From: gunilla@REDACTED (Gunilla Arendt) Date: Fri, 30 Mar 2007 09:36:39 +0200 Subject: [erlang-questions] gen_event and global event handlers In-Reply-To: <4609C743.2000702@ghostgun.com> References: <4609C743.2000702@ghostgun.com> Message-ID: <460CBE07.50501@erix.ericsson.se> The only difference between a "global" event manager and a "local" event manager is that your process in one case is registered globally, and in the other case is registered locally. So, if the event manager works fine locally, it should work fine globally. The exit reason noproc means "no such process". That is, your event manager has terminated somewhere between the calls to gen_event:which_handlers/1 and gen_event:add_handler/3. Since you use gen_event:start_link/1 to start your event manager, and assuming you start it from the shell, my first guess is that you have accidently killed your shell process. Since it is linked to the event manager, this process will terminate as well. Starting the SASL application will install an event handler in error_logger that gives more information about gen_* process terminations. Use % erl -boot start_sasl or 1> application:start(sasl). Good luck, / Gunilla jm wrote: > And the any notes floating around on the specifics of global event > managers? I have an event mananager and a set of handler that work fine > as locally, but when I attempt to make a couple of simple changes for it > to work across two machines/nodes thing start to go awry. > > To begin with execute the following all on the same node with EVENTMGR > to equal some atom, > > gen_event:start_link({global, ?EVENTMGR}). > > gen_event:which_handlers({global,?EVENTMGR}). > > returns []. Then in calling event handler module executes > > start_link(Options) -> > gen_event:add_handler({global, ?EVENTMGR}, ?MODULE, Options). > > > called with Options = []. Yet calling this function results in > > ** exited: noproc ** > > and > > gen_event:which_handlers({global,?EVENTMGR}). > > now also returns > > ** exited: noproc ** > > Any hints as to what may be going wrong? > > Jeff. From ayrnieu@REDACTED Fri Mar 30 11:49:32 2007 From: ayrnieu@REDACTED (Julian Fondren) Date: Fri, 30 Mar 2007 18:49:32 +0900 Subject: [erlang-questions] anyway to make recursion inside anonymous funs? In-Reply-To: <440F765B-4E7B-4EAB-8E74-FBF77FD6CB7D@cs.otago.ac.nz> References: <6f80c1520703280845t6f034c3k258b93ffb06216a8@mail.gmail.com> <91D42182-C5A1-443F-92C5-E7430FC49659@cs.otago.ac.nz> <440F765B-4E7B-4EAB-8E74-FBF77FD6CB7D@cs.otago.ac.nz> Message-ID: For quick (and probably necessarily short-lived) hacks at EShell, it suffices to use the process dictionary: 1> Fact = case fun (0) -> 1; (N) when N > 0 -> N*(get(factorial))(N-1) end of F -> put(factorial, F), F end. #Fun 2> Fact(5) 120 Cheers, Julian From dg@REDACTED Fri Mar 30 13:00:18 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Fri, 30 Mar 2007 15:00:18 +0400 Subject: [erlang-questions] Restarting processes In-Reply-To: <8209f740703291204h33b4315dg1dbfe61f2adf35e4@mail.gmail.com> References: <6616D98C65DD514BA2E1DDC5F92231550186DA7D@esealmw115.eemea.ericsson.se> <460BF377.40809@ot-e.biz> <8209f740703291204h33b4315dg1dbfe61f2adf35e4@mail.gmail.com> Message-ID: <460CEDC2.9040308@ot-e.biz> Thanks for the detailed explaination! Ulf Wiger ?????: > > > 2007/3/29, Daniel Ginsburg >: > > This sounds good. I think I'll give it a try. I just hope that process > registry won't die ;) > > > > Actually, the way it's written, the registry process may die, and > will recover completely when restarted. There's another process > which keeps the ets tables of the registry. It may not die, but > on the other hand, there's no reason why it should, since it > doesn't do anything. In the event that it would be killed, its > supervisor is rigged so that it also terminates. If the proc > application has been started as 'permanent', the erlang node > will terminate. This is a common way to handle processes that > mustn't die. > > (I just noticed that you had seen this already.) > > > I think I'll need to measure performance of lookups in (or folding > through) the registry (if you have any data, please share). Anyway, > even > if the lookup is not very fast, I'll be able to repopulate demux lookup > tables from the registry in case demux has to restart. > > > Performance is not as good as with the built-in registry, but a > registration > will take somewhere around 30-60 microseconds, depending on what > machine you're using. The fold operation is cheap - essentially an > ets:select > on an ordered_set ets table. This means that if the beginning of the select > pattern is bound (which will be the case when you fold over a known > property), > the search time will be proportional to the number of such properties in > the registry, almost independently of how many other properties there are. > > In our in-house version, we've made some optimizations - mainly an > add_properties/1 function, where several properties are registrered > using only one gen_server call. The cost of registering e.g. 10 properties > at once is only marginally higher than the cost of registering one property. > > A colleague of mine made the further optimization of saving a set of > properties as bits in a counter. Then, adding a property was reduced to > an update_counter() operation. To make full use of this, we also added > a fold_counters() function. > > I don't have time to port these additions to the jungerl version, but they > are fairly trivial to add, should someone else feel like doing so. > > BR, > Ulf W > -- dg From dg@REDACTED Fri Mar 30 13:00:51 2007 From: dg@REDACTED (Daniel Ginsburg) Date: Fri, 30 Mar 2007 15:00:51 +0400 Subject: [erlang-questions] Restarting processes In-Reply-To: <460CBBE5.2060003@ericsson.com> References: <460B89EE.4070202@ot-e.biz> <460B9201.8040801@ericsson.com> <460BF37C.7040003@ot-e.biz> <460CBBE5.2060003@ericsson.com> Message-ID: <460CEDE3.9040407@ot-e.biz> Mats Cronqvist ?????: > Daniel Ginsburg wrote: >> Mats Cronqvist ?????: >> >>> i can see two easy ways to do this. >>> in either case the workers should monitor the demux. >>> * the workers poll on the demux registered name. >> >> You mean, calling whereis(demux_name) is a cycle? Well, if other >> approaches won't work, I think I'll do just that. > > i'm not sure what you mean by "cycle". but something like (pseudo-code) > > assert_demux() -> > case whereis(demux_name) of > undefined -> receive after 1000 -> assert_demux() end; > Pid -> Pid > end. > Yes, that's what I meant. >>> * the demux has an ets table with all worker pids, and notify them at >>> startup. >> >> I might be confused about how ets works, but if demux has an ets table >> and terminates, the table will vanish along with it's owner, won't it? > > yes, the demux supervisor should own the table. > You mean create ets table in supervisor's init and pass it as argument to started process in childspec? Neat. I haven't thought about that and always created my ets tables in my gen_servers' init callback. > btw, ulf's "proc" thing is a, quite clever, generalization of this. > unless you use it, you'll probably end up reinventing it. > Yeah, I'm playing with proc right now and I quite like it. I think I'll use it. -- dg From bengt.kleberg@REDACTED Fri Mar 30 15:29:47 2007 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 30 Mar 2007 15:29:47 +0200 Subject: [erlang-questions] Escript In-Reply-To: References: <20070328234531.359557d0.mle+erlang@mega-nerd.com> Message-ID: <460D10CB.2010608@ericsson.com> On 2007-03-28 15:52, Bjorn Gustavsson wrote: > escript is included in R11B-4. it it possible to get the name of the script when using escript? i notice that the escript that is included in R11B-4 does not have the script itself as the first argument (like a $0 is a shell script). ex: #! /tmp/erlang/bin/escript main( Arg ) -> io:fwrite( "~w~n", [Arg] ). i made a patch for joe's escript-4.1 that made the script name available, but escript.erl in R11B-4 does not look like it was made from escript-4.1 bengt -- Those were the days... EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From ayrnieu@REDACTED Fri Mar 30 18:24:26 2007 From: ayrnieu@REDACTED (Julian Fondren) Date: Sat, 31 Mar 2007 01:24:26 +0900 Subject: [erlang-questions] Escript In-Reply-To: <460D10CB.2010608@ericsson.com> References: <20070328234531.359557d0.mle+erlang@mega-nerd.com> <460D10CB.2010608@ericsson.com> Message-ID: On 3/30/07, Bengt Kleberg wrote: > it it possible to get the name of the script when using escript? escript throws it away: start([_|X]) -> X0 = map(fun(I) -> binary_to_list(I) end, X), [_,File|Args] = X0, ___, if ___; true -> case Mode of interpret -> interpret(File, Parse, Args); compile -> compile(Parse, Args) end end. interpret(File, Parse, Args) -> ___, Call = {call,999,{atom,999,main},[ArgsA]}, ___. Cheers, Julian From robert.virding@REDACTED Sat Mar 31 12:27:51 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 31 Mar 2007 12:27:51 +0200 Subject: [erlang-questions] random:uniform \chi^2 test In-Reply-To: <460BF210.5020605@heh.uni-oldenburg.de> References: <460BF210.5020605@heh.uni-oldenburg.de> Message-ID: <460E37A7.30105@telia.com> No, not to my knowledge. The algoritm used is supposed to be quite good, but it is not suitable for cryptography. Robert Nils M?llner wrote: > Hi, > > has someone ever tested the reliability of the random-number generator > with a chi square test? > > Kind regards, > Nils > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From igwan@REDACTED Sat Mar 31 12:59:34 2007 From: igwan@REDACTED (igwan) Date: Sat, 31 Mar 2007 12:59:34 +0200 Subject: [erlang-questions] random:uniform \chi^2 test In-Reply-To: <460E37A7.30105@telia.com> References: <460BF210.5020605@heh.uni-oldenburg.de> <460E37A7.30105@telia.com> Message-ID: <460E3F16.9080605@free.fr> There are also the functions in crypto (rand_bytes/1 and rand_uniform/2) which supposedly make use of openssl. Maybe they are more suitable ? igwan Robert Virding a ?crit : > No, not to my knowledge. The algoritm used is supposed to be quite good, > but it is not suitable for cryptography. > > Robert > > Nils M?llner wrote: > >> Hi, >> >> has someone ever tested the reliability of the random-number generator >> with a chi square test? >> >> Kind regards, >> Nils >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From als@REDACTED Sat Mar 31 16:43:11 2007 From: als@REDACTED (Anthony Shipman) Date: Sun, 1 Apr 2007 01:43:11 +1100 Subject: [erlang-questions] benefits of binary format strings? Message-ID: <200704010043.11752.als@iinet.net.au> The new R11B-4 has this change: OTP-6517 The Format argument of the functions io:fwrite/2,3 and io_lib:fwrite/2 is now allowed to be a binary. Are there performance benefits from writing io:format(<<"hello world~n">>, []) compared with a bare string? -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From raould@REDACTED Sat Mar 31 21:33:12 2007 From: raould@REDACTED (Raoul Duke) Date: Sat, 31 Mar 2007 12:33:12 -0700 Subject: [erlang-questions] Fwd: newbie distel / general node help In-Reply-To: <91a2ba3e0702281120v2ef41732mf72a3dcb706da81d@mail.gmail.com> References: <91a2ba3e0702252130n328966d5kbd00585c590537dd@mail.gmail.com> <91a2ba3e0702261542r5bd2c4fdr78c3677c830eddaf@mail.gmail.com> <45E3EC92.7060005@ericsson.com> <91a2ba3e0702271033l4807454cv8fab8593c5f6dc37@mail.gmail.com> <91a2ba3e0702271637n1e9c14d8na152a329f7e9cefe@mail.gmail.com> <45E52F02.9090804@ericsson.com> <91a2ba3e0702281120v2ef41732mf72a3dcb706da81d@mail.gmail.com> Message-ID: <91a2ba3e0703311233r66ddfe4ek7a8fe68c3122d190@mail.gmail.com> P.S.: After some experimenting on my Windows XP PC (although with a newer version of erlang), I found there using "erl -sname foo@REDACTED" and "net_adm:ping('bar@REDACTED')." would work. Using "@localhost" didn't fix the issue on CentOS/OpenVZ. When I called "erl_epmd:names()." on the XP machine it would list the two nodes (even if I'd started without "@localhost" for sname, but in that case ping didn't work). However trying "erl_epmd:names(). " on my CentOS/OpenVZ machine just froze for a long time and then eventually gave "{error,address}". For whatever it might be worth to any other folks :-} On 2/28/07, Raoul Duke wrote: > > yes, unfortunately. > > if you have two nodes, on the same machine, with the same cookie, running the > > same version of the distribution protocol, if should work. > > > how about if you start the nodes like this; > > erl -sname bla@REDACTED > > erl -sname foo@REDACTED > > using "localhost" or "mail" (the name of the machine) only gave pangs. > > thanks for your time on this, i will chalk it up to my OpenVZ setup > being pathalogical. > From diginux@REDACTED Sat Mar 31 23:08:05 2007 From: diginux@REDACTED (Jordan Wilberding) Date: Sat, 31 Mar 2007 16:08:05 -0500 Subject: [erlang-questions] How to identify symlinks with Erlang Message-ID: <460ECDB5.4060207@diginux.net> Hello, I was wondering if there is a way to identify if a directory is a symlink to another directory in Erlang? The problem I am having is that when you install the wine, it creates symlinks like ~/.wine/dosdevices/z: -> / This means when you try to use filelib:fold_files("~/.",..) it goes endlessly, since it keeps recursing back into the symlink. Anyone have any ideas? Thanks! Jordan Wilberding