From vlad_dumitrescu@REDACTED Mon Jul 1 07:57:08 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 07:57:08 +0200 Subject: extra console/shell Message-ID: Hi folks, I wonder if there is (or if you think too there should be) a general way to connect to an erlang node via additional consoles, creating several unrelated shells. If my memory serves me right, on Solaris there is a to_erl utility, but I think it only allows connecting to the active shell, not create a new one. Is this something that others have missed? Is it reasonable to implement (in terms of effort)? Thanks. Best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From vlad_dumitrescu@REDACTED Mon Jul 1 08:36:28 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 08:36:28 +0200 Subject: ESDL Message-ID: Hi again, I think using ESDL & OpenGL from Erlang works very nice - (if in doubt, just look at Wings :-). However there is a problem related to SDL only using one native window: you can't have several windows (i.e. applications) with own windows when using the linked-in driver... One possible solution is to create the option of creating a new ESDL port to a new instance of sdl_wrapper, every time. Instead of having a registered 'sdl_server' process, the pid would then be sent as argument to all calls. This is rather a handful of work, but I am willing to do it, if you think it is the way. Are there any other apps than Wings using ESDL? If not (or none to be used at the same time with another), it might continue using the linked-in driver, so as not to break the code... Does anyone see another solution for this? If there is a simpler one, I would only be happy! :-) best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From vlad_dumitrescu@REDACTED Mon Jul 1 08:42:55 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 08:42:55 +0200 Subject: double-linked list Message-ID: yet another question for today... I want to implement a double-linked list, which I can easily traverse in both directions. I wonder if there are any smart solutions you know of... One way is to maintain two lists, in reversed order from each other, and do the hard work when inserting and deleting. Another way is to implement the classic double-linked list structure and algorithms, because the objects in my list are processes and they can store the 'next' and 'previous' pointers in their state. Yet another would be to use an ETS table for storage of the list data. Does anyone have thoughts about which one (or any other) is recommended? Maybe there are different data structures that can fullfill the requirements... Thanks. Best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From Bruce@REDACTED Mon Jul 1 09:39:39 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 1 Jul 2002 19:39:39 +1200 Subject: extra console/shell References: Message-ID: <062a01c220d2$74d01490$dc21970a@norris> (forgot to post to the list) Hi Vlad, > I wonder if there is (or if you think too there should be) a general way to > connect to an erlang node via additional consoles, creating several > unrelated shells. Do you mean something like reshd? Someone posted it a while ago, so it should be in the archives. Its a telnet shell interface. Wait a mo... http://www.erlang.org/ml-archive/erlang-questions/200105/msg00019.html by Tomas Abrahamsson. I've used it a bit, and found it very useful for embedded systems. /Bruce From vlad_dumitrescu@REDACTED Mon Jul 1 09:46:40 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 09:46:40 +0200 Subject: extra console/shell Message-ID: >From: "Bruce Fitzsimons" >Hi Vlad, >Do you mean something like reshd? Someone posted it a while ago, so it >should be in the archives. Its a telnet shell interface. > >Wait a mo... >http://www.erlang.org/ml-archive/erlang-questions/200105/msg00019.html >by Tomas Abrahamsson. > >I've used it a bit, and found it very useful for embedded systems. Yes, I think that would be perfect! Thanks for the tip! regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From daniel.neri@REDACTED Mon Jul 1 11:27:33 2002 From: daniel.neri@REDACTED (Daniel =?iso-8859-1?q?N=E9ri?=) Date: 01 Jul 2002 09:27:33 +0000 Subject: extra console/shell In-Reply-To: <062a01c220d2$74d01490$dc21970a@norris> References: <062a01c220d2$74d01490$dc21970a@norris> Message-ID: "Bruce Fitzsimons" writes: > Do you mean something like reshd? Someone posted it a while ago, so it > should be in the archives. Its a telnet shell interface. I just noticed that recent snapshots of P9 include a new application called rshell... Regards, --Daniel -- Daniel N?ri phone: +46 (0)8 44 99 755 Sigicom AB, Stockholm, Sweden fax: +46 (0)8 44 99 769 From per@REDACTED Mon Jul 1 11:58:04 2002 From: per@REDACTED (Per Hedeland) Date: Mon, 1 Jul 2002 11:58:04 +0200 (CEST) Subject: extra console/shell In-Reply-To: Message-ID: <200207010958.g619w4R42441@tordmule.bluetail.com> "Vlad Dumitrescu" wrote: > >I wonder if there is (or if you think too there should be) a general way to >connect to an erlang node via additional consoles, creating several >unrelated shells. Besides what has already been mentioned, there is of course the "remote shell" built into the "job control" - requires that the node is running distributed though, and that you can run Erlang on the system you want to connect from. E.g. if you want another shell on the node 'foo@REDACTED', just connect to it from another node (here 'bar@REDACTED'): Eshell V5.0.1.1.b4 (abort with ^G) (bar@REDACTED)1> ^G User switch command --> r 'foo@REDACTED' --> c Eshell V5.0.1.1.b4 (abort with ^G) (foo@REDACTED)1> You can create any number of shells that way AFAIK (plus of course you can create additional "local" shells the same way), but the interface for switching between them is perhaps a tad awkward for those that aren't used to traditional Unix "job control"...:-) - unless you fire up one node for each shell, then you can of course switch between them whichever way you like. Note also that this remote shell is actually authenticated (via the erlang cookies) - having something that "drops right into an erlang shell" listening on a TCP port in a production system is not such a hot idea if you care about security:-), but it should be fine for development. >If my memory serves me right, on Solaris there is a to_erl utility, but I >think it only allows connecting to the active shell, not create a new one. Yes, and it's a hack (I wrote the original version:-) that has no real business being included with Solaris, I think. I did it for the VxWorks port, where it made some sense, since on such systems you typically don't have window systems or job control, and frequently only a single serial port through which you may need to access both the VxWorks shell and the Erlang shell. So you give the serial port to the VxWorks shell, and fire up Erlang behind a pseudo-tty ('start_erl' did this IIRC) - and then you can run to_erl from the VxWorks shell to talk to that pseudo-tty, returning to the VxWorks shell when to_erl finishes (on ^D). --Per Hedeland per@REDACTED From Sean.Hinde@REDACTED Mon Jul 1 12:30:00 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 1 Jul 2002 11:30:00 +0100 Subject: extra console/shell Message-ID: <04D356A3B172D611981B0008C791C3126BF123@imp02mbx.t-mobile.co.uk> > >If my memory serves me right, on Solaris there is a to_erl > utility, but I > >think it only allows connecting to the active shell, not > create a new one. > > Yes, and it's a hack (I wrote the original version:-) that has no real > business being included with Solaris, I think. Hey, don't knock your creation - to_erl has been a key enabler for us. Just showing our ops guys (who use AXE-10 as well) that you could simply connect to a running system and manage it via a shell was something they instantly loved! Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From jb@REDACTED Mon Jul 1 13:56:18 2002 From: jb@REDACTED (Johan Bevemyr) Date: Mon, 01 Jul 2002 13:56:18 +0200 (CEST) Subject: getting to yaws In-Reply-To: <20020630192908.E8624@bluetail.com> References: <04D356A3B172D611981B0008C791C312404864@imp02mbx.t-mobile.co.uk> <200206301027.g5UARZ840929@tordmule.bluetail.com> <20020630192908.E8624@bluetail.com> Message-ID: <20020701.135618.74743951.jb@bevemyr.com> > > but his machine is up - so I guess > > yaws must have crashed, > > It's worse than that, I was so stressed when packing for holidays, so > I must have simply - not started - or even stopped - yaws before > leaving. No, it is even worse :-). There was a bug in the htmlize code which cause the emulator to crash when the string to htmlize was to big. I think the binary code created to much garbage, or something. I rewrote it to use lists instead which made it much faster and working. What was even worse than that was that one of the examples, which trigged this behaviour, contained a bit of a security hole (now fixed as well), so perhaps it was a good thing that yaws.hyber.org crashed :-) /Johan From vlad_dumitrescu@REDACTED Mon Jul 1 14:37:38 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 14:37:38 +0200 Subject: double-linked lists Message-ID: Hi, I think you answered to the wrong mail :-) >I suppose you need the following operations: > >- create an empty list >- put an item at the front >- put an item at the end >- traverse from the front (using an iterator, or a higher order > function?) >- traverse from the end. > >When would you be doing deletions? Well, I am not sure how things will look like, if there will be an external manager traversing the list or if the listed processes will just take care of themselves. What will happen is that the processes might start sending messages either forward or backward in the list. On second thought, a list will not be enough, but more like a "double-linked tree" where one has a 'root' at either end and in the middle there are several branches to traverse... Hmmm, this needs more thought! :-) regards, Vlad _________________________________________________________________ Skicka snabbmeddelanden till dina v?nner online med MSN Messenger: http://messenger.msn.se From vlad_dumitrescu@REDACTED Mon Jul 1 14:46:43 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 14:46:43 +0200 Subject: extra console/shell Message-ID: >From: Per Hedeland >Besides what has already been mentioned, there is of course the "remote >shell" built into the "job control" - requires that the node is running >distributed though, and that you can run Erlang on the system you want to >connect from. Yes, this I was aware of, but it isn't what I need. The extra overhead of another node is too large. >Note also that this remote shell is actually authenticated (via the >erlang cookies) - having something that "drops right into an erlang >shell" listening on a TCP port in a production system is not such a hot >idea if you care about security:-), but it should be fine for >development. True, this is something to think about! Thanks!! Regards, Vlad _________________________________________________________________ Skicka snabbmeddelanden till dina v?nner online med MSN Messenger: http://messenger.msn.se From vlad_dumitrescu@REDACTED Mon Jul 1 14:48:45 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 14:48:45 +0200 Subject: extra console/shell Message-ID: >Wait a mo... >http://www.erlang.org/ml-archive/erlang-questions/200105/msg00019.html >by Tomas Abrahamsson. I think it is a very useful application - maybe it should be published among the other user contributions! regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From dgud@REDACTED Mon Jul 1 15:11:16 2002 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 1 Jul 2002 15:11:16 +0200 Subject: ESDL In-Reply-To: References: Message-ID: <15648.21748.492684.114898@gargle.gargle.HOWL> You should be able to make that work if you use ports (?SDL_INIT_NOERLDRIVER) instead of drivers (and some hacking), since SDL only handles one window per process I don't think it will work with the driver. Now Bjorn/Wings want me remove the port portion of SDL, because it's to slow, nobody uses it and it would increase wings performance with 1% :-) by inlining code. /Dan Vlad Dumitrescu writes: > Hi again, > > I think using ESDL & OpenGL from Erlang works very nice - (if in doubt, just > look at Wings :-). However there is a problem related to SDL only using one > native window: you can't have several windows (i.e. applications) with own > windows when using the linked-in driver... > > One possible solution is to create the option of creating a new ESDL port to > a new instance of sdl_wrapper, every time. Instead of having a registered > 'sdl_server' process, the pid would then be sent as argument to all calls. > This is rather a handful of work, but I am willing to do it, if you think it > is the way. > > Are there any other apps than Wings using ESDL? If not (or none to be used > at the same time with another), it might continue using the linked-in > driver, so as not to break the code... > > Does anyone see another solution for this? If there is a simpler one, I > would only be happy! :-) > > best regards, > Vlad > From vlad_dumitrescu@REDACTED Mon Jul 1 15:44:07 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jul 2002 15:44:07 +0200 Subject: ESDL Message-ID: >From: "Dan Gudmundsson" >You should be able to make that work if you use ports >(?SDL_INIT_NOERLDRIVER) instead of drivers (and some hacking), >since SDL only handles one window per process I don't think >it will work with the driver. Yes, the problem is that there is only one registered server name - if several ports, then a way to identtify which one is addressed needs to be added. >Now Bjorn/Wings want me remove the port portion of SDL, because it's >to slow, nobody uses it and it would increase wings performance with 1% >:-) by inlining code. Hmm, though! :-) A solution might be splitting sdl.erl in two modules, one using the driver, one using ports. This way, every one could get what they need, without trouble (except for you, Dan, since there will be more code to maintain! :-) Btw, does anyone have experience on how ports compare in speed with using a TCP connection instead? thanks. Regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From kent@REDACTED Mon Jul 1 16:24:10 2002 From: kent@REDACTED (Kent Boortz) Date: 01 Jul 2002 16:24:10 +0200 Subject: extra console/shell In-Reply-To: References: <062a01c220d2$74d01490$dc21970a@norris> Message-ID: daniel.neri@REDACTED (Daniel N?ri) writes: > I just noticed that recent snapshots of P9 include a new application > called rshell... Rshell currently support the telnet protocol. It is not complete and contains lots of bugs but you can connect from Solaris telnet directly to the Erlang node even if the node is not distributed and get a "newshell", i.e. command line editing in an Erlang shell, kent From kent@REDACTED Mon Jul 1 16:42:00 2002 From: kent@REDACTED (Kent Boortz) Date: 01 Jul 2002 16:42:00 +0200 Subject: extra console/shell In-Reply-To: <200207010958.g619w4R42441@tordmule.bluetail.com> References: <200207010958.g619w4R42441@tordmule.bluetail.com> Message-ID: Per Hedeland writes: > >If my memory serves me right, on Solaris there is a to_erl utility, but I > >think it only allows connecting to the active shell, not create a new one. > > Yes, and it's a hack (I wrote the original version:-) that has no real > business being included with Solaris, I think. A hack?! No one told me, to_erl is now ported to Linux and FreeBSD... ;-) kent From per@REDACTED Mon Jul 1 22:47:54 2002 From: per@REDACTED (Per Hedeland) Date: Mon, 1 Jul 2002 22:47:54 +0200 (CEST) Subject: extra console/shell In-Reply-To: Message-ID: <200207012047.g61Klsb43231@tordmule.bluetail.com> Kent Boortz wrote: > >Per Hedeland writes: >> >If my memory serves me right, on Solaris there is a to_erl utility, but I >> >think it only allows connecting to the active shell, not create a new one. >> >> Yes, and it's a hack (I wrote the original version:-) that has no real >> business being included with Solaris, I think. > >A hack?! No one told me, to_erl is now ported to Linux and FreeBSD... ;-) Well, the Unix version of to_erl & Co is actually quite a different beast than the twenty lines I wrote for VxWorks, so I should neither take credit for it nor claim that it's a hack:-) - my point was just that I think it solves a non-problem on Unix, but if people like it / want it, fine by me...:-) --Per Hedeland per@REDACTED From klacke@REDACTED Mon Jul 1 23:23:17 2002 From: klacke@REDACTED (Klacke) Date: Mon, 1 Jul 2002 23:23:17 +0200 Subject: getting to yaws In-Reply-To: <20020701.135618.74743951.jb@bevemyr.com>; from jb@bevemyr.com on Mon, Jul 01, 2002 at 01:56:18PM +0200 References: <04D356A3B172D611981B0008C791C312404864@imp02mbx.t-mobile.co.uk> <200206301027.g5UARZ840929@tordmule.bluetail.com> <20020630192908.E8624@bluetail.com> <20020701.135618.74743951.jb@bevemyr.com> Message-ID: <20020701232317.C10624@bluetail.com> On Mon, Jul 01, 2002 at 01:56:18PM +0200, Johan Bevemyr wrote: > > > > but his machine is up - so I guess > > > yaws must have crashed, > > > > It's worse than that, I was so stressed when packing for holidays, so > > I must have simply - not started - or even stopped - yaws before > > leaving. > > No, it is even worse :-). There was a bug in the htmlize code > which cause the emulator to crash when the string to htmlize > was to big. I think the binary code created to much garbage, or > something. I rewrote it to use lists instead which made it much > faster and working. > > What was even worse than that was that one of the examples, which > trigged this behaviour, contained a bit of a security hole (now > fixed as well), so perhaps it was a good thing that yaws.hyber.org > crashed :-) > > /Johan Ouch, ouch ouch Ok new release 0.52 ... now containing johans security bugfixes, -heart support by tobbe and a wiki web. http://yaws.hyber.org (hopefully up this time) /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From spearce@REDACTED Tue Jul 2 01:14:58 2002 From: spearce@REDACTED (Shawn Pearce) Date: Mon, 1 Jul 2002 19:14:58 -0400 Subject: ets weirdness when using -run In-Reply-To: <15633.30616.798214.841532@antilipe.corelatus.se> References: <20020618162413.1f480b16.cpressey@catseye.mb.ca> <3D1044CE.6C433CB6@erix.ericsson.se> <20020619195950.1c0e466c.cpressey@catseye.mb.ca> <20020619223848.B3699@spearce.org> <15633.30616.798214.841532@antilipe.corelatus.se> Message-ID: <20020701191458.B835@spearce.org> That's what I get for writing off a chunk of code right before I shutdown my computer for a 12 day vacation in the "flordia sunshine" (rain).... Yes, Matthias corrected me with what I'm almost sure I meant to say... I'll try not to fire off something right before vacation next time. :-) Matthias Lang scrawled: > Shawn Pearce writes: > > > wait_forever() -> > > receive > > stop -> > > done > > end, > > wait_forever(). > > > > This way you can request that the process terminate by sending it > > a 'stop' message: > > > > ProcessPid ! stop > > The final recursive call to wait_forever() defeats the stop > mechanism. Maybe you meant > > wait_forever() -> > receive > stop -> > done; > X -> > io:fwrite("~p: unexpected: ~p\n",[self(), X]), > wait_forever() > end. > > Matt -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From luke@REDACTED Tue Jul 2 11:57:03 2002 From: luke@REDACTED (Luke Gorrie) Date: 02 Jul 2002 11:57:03 +0200 Subject: File system software??? In-Reply-To: References: Message-ID: Joe Armstrong writes: > Luke (Gorrie) has none something like this - you can mount a filesystem > which is implemented as an Erlang server (somehow) - details luke ... That was a user-space (erlang) NFS server, that you then become root and mount. The code is on erlang.org's contributions. It doesn't actually implement a general read/write filesystem as-is though, it's mostly intended for plug-in "magic" file systems along the lines of /proc. Cheers, Luke From martinjlogan@REDACTED Wed Jul 3 01:57:41 2002 From: martinjlogan@REDACTED (martin logan) Date: Tue, 02 Jul 2002 18:57:41 -0500 Subject: Mnesia: Tables on the fly. Message-ID: Hello All, I seem to be facing a small problem having to do with mnesia. I have the following code: % definitions of all the tables we are going to create MappingTabDef = [{type, set}, {ram_copies, [node()]}, {attributes, record_info(fields, mapping)}], % More tables here. % create the tables mnesia:create_table(mapping, MappingTabDef), % Create more tables here I would like to replace that with somthing like the following: Tables = [{mapping, ram_copies}|T], Fun = fun({Table, StoreType}) -> create_table([{type, set}, {StoreType, [node()]}, {attributes, record_info(fields, Table)}] end, lists:foreach(Fun, Tables), When I statically define everything as illustrated in the first example things work perfectly. Unfortunatly the second bit of code blows up every time. Does anyone understand why? Thanks, Martin _________________________________________________________________ Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com From cpressey@REDACTED Wed Jul 3 08:47:27 2002 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 3 Jul 2002 01:47:27 -0500 Subject: Mnesia: Tables on the fly. In-Reply-To: References: Message-ID: <20020703014727.6f115fee.cpressey@catseye.mb.ca> On Tue, 02 Jul 2002 18:57:41 -0500 "martin logan" wrote: > Hello All, I seem to be facing a small problem having to do with mnesia. > I have the following code: > > % definitions of all the tables we are going to create > MappingTabDef = [{type, set}, {ram_copies, [node()]}, {attributes, > record_info(fields, mapping)}], > % More tables here. > > % create the tables > mnesia:create_table(mapping, MappingTabDef), > % Create more tables here > > > I would like to replace that with somthing like the following: > Tables = [{mapping, ram_copies}|T], > > Fun = fun({Table, StoreType}) -> create_table([{type, set}, > {StoreType, [node()]}, {attributes, record_info(fields, Table)}] end, > > lists:foreach(Fun, Tables), > > When I statically define everything as illustrated in the first example > things work perfectly. Unfortunatly the second bit of code blows up > every time. Does anyone understand why? record_info only works at compile-time. (The record name must be a literal constant). -Chris From vlad_dumitrescu@REDACTED Wed Jul 3 10:42:07 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 03 Jul 2002 10:42:07 +0200 Subject: design question Message-ID: Hi all, I have a design decision to make and I feel it would be beneficial with some more and qualified opinions. The data structure is an ordered set of entities (=regions), with rather heavy cross-referencing between them. Each is related to an owner process and messages will go between the regions (conceptually). The first idea was to implement the regions as own processes, because the design is clearer and seems to be easier to see what's going on. On the other hand, it would be somewhat more difficult to debug and there are quite a lot (hundreds) of these regions alive (although not more than a few active at a time). The other solution is to implement a manager process that will handle the message passing on behalf of the regions. The handling of the data woud be more complicated, though. It isn't easy to switch between the paradigms, so I thought I'd try to choose before starting. I don't have experience with systems with that many long-lived processes running, so I am not sure how the system would behave with some 100's of regions and some tenths of owners... I look forward to hearing *your* opinion! Thanks!? Best regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From joe@REDACTED Wed Jul 3 15:39:46 2002 From: joe@REDACTED (Joe Armstrong) Date: Wed, 3 Jul 2002 15:39:46 +0200 (CEST) Subject: broadcast Message-ID: I have several machines on a LAN How do I set up a low-level broadcast system. I can find the broadcast address with {ok, [{broadaddr, Ip}]} = inet:ifget("eth0", [broadaddr]), But then what? How do I send to the broadcast address and what port do I use? This didn't work: {ok, S} = gen_udp:open(5010), gen_udp:send(S, Ip, 6000, Str) open works but send fails with {error, eacess} I'd thought that this would send a broadcast message to port 6000 and that all machines on the LAN that listen to broadcasts would see this message. The listener I guess is something like {ok, S} = gen_udp:open(6000), loop(S). loop(Socket) -> receive {udp, Socket, Host, Port} -> ... loop(Socket) end. And here I imagined that Port would be 5010 and Host the machine sending the packet. Is this how to do set up a listener and do a broadcast? Or have I totally misunderstood. Any ideas what is going wrong here???? Thanks /Joe From joe@REDACTED Wed Jul 3 16:21:34 2002 From: joe@REDACTED (Joe Armstrong) Date: Wed, 3 Jul 2002 16:21:34 +0200 (CEST) Subject: broadcast (solved) In-Reply-To: Message-ID: On Wed, 3 Jul 2002, Joe Armstrong wrote: > > I have several machines on a LAN > > How do I set up a low-level broadcast system. > > I can find the broadcast address with > > {ok, [{broadaddr, Ip}]} = inet:ifget("eth0", [broadaddr]), > > But then what? > > How do I send to the broadcast address and what port do I use? > > This didn't work: > > {ok, S} = gen_udp:open(5010), > gen_udp:send(S, Ip, 6000, Str) > ... cut ... > Any ideas what is going wrong here???? > It should have been {ok, S} = gen_udp:open(5010, [{broadcast, true}]), You nitwit RTFM /Joe > Thanks > > /Joe > > > > From jhouchin@REDACTED Wed Jul 3 18:38:07 2002 From: jhouchin@REDACTED (Jimmie Houchin) Date: Wed, 03 Jul 2002 11:38:07 -0500 Subject: getting to yaws References: <04D356A3B172D611981B0008C791C312404864@imp02mbx.t-mobile.co.uk> <200206301027.g5UARZ840929@tordmule.bluetail.com> <20020630192908.E8624@bluetail.com> <20020701.135618.74743951.jb@bevemyr.com> <20020701232317.C10624@bluetail.com> Message-ID: <3D23286F.9070605@texoma.net> Hello, I recently downloaded yaws-5.1 and tested it and ran a few (ab) benchmarks and did similarly to Apache, AOLServer, thttpd, etc. Very impressive. I'll post results and questions later. They are on a different machine at home. It gives me great encouragement and incentive to learn Erlang to use for my website. I was afraid I was going to have to write Apache modules for good performance. Ha! :) This makes me very happy. Thanks. I am busy going thru the Erlang materials to get up to speed. After recieving the below message I downloaded yaws-5.2. Several times actually and now on different machines and OSes (Debian Linux and WinME). All gzip utilities tell me that it isn't a gzipped archive. I had know problems with the previous version. Anyone else had such experiences? Thanks for any help. Jimmie Houchin Klacke wrote: [snip] > Ok new release 0.52 ... now containing johans security bugfixes, > -heart support by tobbe and a wiki web. > > http://yaws.hyber.org (hopefully up this time) > > /klacke From Chandrashekhar.Mullaparthi@REDACTED Wed Jul 3 18:42:21 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 3 Jul 2002 17:42:21 +0100 Subject: getting to yaws Message-ID: <04D356A3B172D611981B0008C791C31240488E@imp02mbx.t-mobile.co.uk> Download it from sourceforge.net - project name is erlyaws. cheers, Chandru -----Original Message----- From: Jimmie Houchin [mailto:jhouchin@REDACTED] Sent: 03 July 2002 17:38 To: Klacke Cc: erlang-questions@REDACTED Subject: Re: getting to yaws After recieving the below message I downloaded yaws-5.2. Several times actually and now on different machines and OSes (Debian Linux and WinME). All gzip utilities tell me that it isn't a gzipped archive. I had know problems with the previous version. Anyone else had such experiences? NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From jhouchin@REDACTED Wed Jul 3 19:01:00 2002 From: jhouchin@REDACTED (Jimmie Houchin) Date: Wed, 03 Jul 2002 12:01:00 -0500 Subject: getting to yaws References: <04D356A3B172D611981B0008C791C31240488E@imp02mbx.t-mobile.co.uk> Message-ID: <3D232DCC.3020605@texoma.net> Thanks. I had forgotten about the project at sourceforge. Jimmie Houchin Chandrashekhar Mullaparthi wrote: > Download it from sourceforge.net - project name is erlyaws. > > cheers, > Chandru > > -----Original Message----- > From: Jimmie Houchin [mailto:jhouchin@REDACTED] > Sent: 03 July 2002 17:38 > To: Klacke > Cc: erlang-questions@REDACTED > Subject: Re: getting to yaws > > > After recieving the below message I downloaded yaws-5.2. Several times > actually and now on different machines and OSes (Debian Linux and > WinME). All gzip utilities tell me that it isn't a gzipped archive. I > had know problems with the previous version. > > Anyone else had such experiences? From fredrik.linder@REDACTED Wed Jul 3 23:56:43 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 3 Jul 2002 23:56:43 +0200 Subject: design question References: Message-ID: <002601c222dc$85152460$d7b7f2d5@frelin> Hi Vlad I would go for the many processes variant, a few hundred processes is not much in erlang terms. If it makes the design clearer then what's the problem? Though I am interested, what do you intend to benefit from a message passing manager that you do not get for free with the message passing build in into erlang? You could possibly write a server wrapper to gen_server or something to hide the message passing between regions. Unless each region has its own implementation I wouldn't worry about the debugging. You would probaly soon very clearly see what is going on in your system using a combination of erlang trace and disklog (that's what we're currently using.). Btw erlang trace is great! Best Regards /Fredrik ----- Original Message ----- From: "Vlad Dumitrescu" To: Sent: Wednesday, July 03, 2002 10:42 AM Subject: design question > Hi all, > > I have a design decision to make and I feel it would be beneficial with some > more and qualified opinions. > > The data structure is an ordered set of entities (=regions), with rather > heavy cross-referencing between them. Each is related to an owner process > and messages will go between the regions (conceptually). > > The first idea was to implement the regions as own processes, because the > design is clearer and seems to be easier to see what's going on. On the > other hand, it would be somewhat more difficult to debug and there are quite > a lot (hundreds) of these regions alive (although not more than a few active > at a time). > > The other solution is to implement a manager process that will handle the > message passing on behalf of the regions. The handling of the data woud be > more complicated, though. > > It isn't easy to switch between the paradigms, so I thought I'd try to > choose before starting. I don't have experience with systems with that many > long-lived processes running, so I am not sure how the system would behave > with some 100's of regions and some tenths of owners... > > I look forward to hearing *your* opinion! Thanks!? > Best regards, > Vlad > > _________________________________________________________________ > Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla > kopior: http://photos.msn.se > > From vlad_dumitrescu@REDACTED Thu Jul 4 08:58:09 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 04 Jul 2002 08:58:09 +0200 Subject: design question Message-ID: >From: "Fredrik Linder" Hi, >I would go for the many processes variant, a few hundred processes is not >much in erlang terms. If it makes the design clearer then what's the >problem? Well, I was worried that the scheduler is not as good as it seems to be :-) I ran some tests with many processes and chain message passing and it seems that it works fine (code available on request). I was probably mislead by test I made with previous releases. Btw, there might be more than a "few hundred" processes in the worst case. But since most of them do nothing than sit in a receive and then resending the message they got, it seems not to be a problem. >Though I am interested, what do you intend to benefit from a message >passing >manager that you do not get for free with the message passing build in into >erlang? Well, there could be some benefits by using a global server - like for example global prioritization, but I don't t hink they are important enough if the 'many processes' approach works. >Btw erlang trace is great! I agree! :-) Thanks for the input! Regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From cpressey@REDACTED Thu Jul 4 09:19:45 2002 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 4 Jul 2002 02:19:45 -0500 Subject: ANN: crone - cron in Erlang (sort of) Message-ID: <20020704021945.696fc960.cpressey@catseye.mb.ca> Hi all. Realizing I'd soon need something like it, and surprised to not find anything existing quite like it, I wrote this little application in Erlang. crone is a task scheduler, something like cron, but also a bit different. As a testament to the ease of programming in Erlang, this program took only one day to write, once the idea had gelled. For each task you wish to schedule, crone creates a process. Each process calculates the time until the task will next be run, calls timer:sleep/1 for that duration, runs the task, and repeats. There is no configuration file, instead, crone is started with a list of tasks to schedule, e.g.: crone:start([ {{daily, {every, {5 min}, {between, {8, am}, {5, pm}}}}, {funky_db, dump_to_file, [my_db, "report.txt"]}}, {{daily, [{1, pm}, {4, 30, am}]}, {funky_db, rotate_log, ["foo.log"]}}, {{weekly, sun, {5, am}}, {os, cmd, ["backup important-files"]}}, {{monthly, 1, {2, am}}, {funky_db, monthly_maintenance, []}} ]). It raises the question: just how large can the argument to timer:sleep/1 be? Scheduling a task on a monthly basis means sleeping for potentially hundreds of hours (that is, billions of milliseconds.) How much inaccuracy should be expected to creep in over such a long wait? Anyway, if I get some positive feedback on this, I'll submit it to User Contributions... :) -Chris -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: crone.erl URL: From joe@REDACTED Thu Jul 4 10:31:06 2002 From: joe@REDACTED (Joe Armstrong) Date: Thu, 4 Jul 2002 10:31:06 +0200 (CEST) Subject: getting to yaws In-Reply-To: <3D23286F.9070605@texoma.net> Message-ID: On Wed, 3 Jul 2002, Jimmie Houchin wrote: > Hello, > > I recently downloaded yaws-5.1 and tested it and ran a few (ab) > benchmarks and did similarly to Apache, AOLServer, thttpd, etc. > Very impressive. I'll post results and questions later. They are on a > different machine at home. If you are doing benchmarks then the following question is very interesting. How well does yaws work in the presence of overload, and how well does yews work in the presences of massing simulatenous access. I want to measure the following: 1) raw page rate (one user multiple connects) 2) Set up (say) 20,000 sockets and dribble data into them - make the HTTP requests very slowly ( 1 byte/sec). Then set up one fast client (as in 1) and measure the page rate Do 2) varying the number of slow sockets Plot the page rate/# slow sockets connections Compare with Apache. I think the results might be surprising :-) 3) Measure the throughput as you massivly overload the system. (say the page rate is 1000 pages/sec) Subject the system to 10000 requests/sec. The desirable behaviour is that 10% of the traffic is accepted 90% is rejected. Consider only the accepted requests. How many accepted requests/sec do we get as a function of the the input load. Measure this rate as a function of the overload. For the AXD301 Uffe reports astoundingly good results here - if we can reproduce this in a web server I think there is a good chance that we will be be very much better than Apache etc. This measure tells how well your system behaves during a denayal of service attack. I am very interested in the measurements 1) - 3) above. All measurements should be normalised to a 1 GHz machine. I will be doing these measurements myself so it will be interesting to compare results. /Joe > > It gives me great encouragement and incentive to learn Erlang to use for > my website. I was afraid I was going to have to write Apache modules for > good performance. Ha! :) > This makes me very happy. Thanks. > > I am busy going thru the Erlang materials to get up to speed. > > After recieving the below message I downloaded yaws-5.2. Several times > actually and now on different machines and OSes (Debian Linux and > WinME). All gzip utilities tell me that it isn't a gzipped archive. I > had know problems with the previous version. > > Anyone else had such experiences? > > Thanks for any help. > > Jimmie Houchin > > > > Klacke wrote: > [snip] > > Ok new release 0.52 ... now containing johans security bugfixes, > > -heart support by tobbe and a wiki web. > > > > http://yaws.hyber.org (hopefully up this time) > > > > /klacke > > From gerd@REDACTED Thu Jul 4 11:25:52 2002 From: gerd@REDACTED (Gerd Flaig) Date: Thu, 04 Jul 2002 11:25:52 +0200 Subject: File system software??? In-Reply-To: (Joe Armstrong's message of "Fri, 28 Jun 2002 17:21:54 +0200 (CEST)") References: Message-ID: Joe Armstrong writes: > In Windows/linux applications are made of multitudes of files - now > there mighthave to be lots of small files in an application but there > is no good reason why the user should known this - all files > (including any new files created by the application should be neatly > hidden away *inside* a container - also you should not be able to see > inside the container. the container does exist already. It's called a directory. I don't see why you would want to make it complicated to look inside the container - users will always find ways to break stuff. The only part that is missing would be the ability to execute directories. This could easily be accomplished in most modern shells by a few lines of configuration. $ tar xvzf app.tar.gz app/ app/run app/data/ app/data/a app/data/b app/data/c $ ./app [ translated to ./app/run ] [ app running happily forever after ] Obviously, the application should not be dependent on the location of the directory in the filesystem. You could still use all standard utilities to manipulate stuff which is a major win. Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From gerd@REDACTED Thu Jul 4 11:35:00 2002 From: gerd@REDACTED (Gerd Flaig) Date: Thu, 04 Jul 2002 11:35:00 +0200 Subject: ANN: crone - cron in Erlang (sort of) In-Reply-To: <20020704021945.696fc960.cpressey@catseye.mb.ca> (Chris Pressey's message of "Thu, 4 Jul 2002 02:19:45 -0500") References: <20020704021945.696fc960.cpressey@catseye.mb.ca> Message-ID: Chris Pressey writes: > For each task you wish to schedule, crone creates a process. Each process > calculates the time until the task will next be run, calls timer:sleep/1 > for that duration, runs the task, and repeats. perhaps it would be better to organize the tasks to be run in a priority queue with the next time to run as key. That way, you only need one process that calculates the time to wait until the next task should be executed, then spawn the process to execute that task. Saves lots of processes. Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From francesco@REDACTED Thu Jul 4 11:56:43 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 04 Jul 2002 10:56:43 +0100 Subject: double-linked list References: Message-ID: <3D241BDB.1070805@erlang-consulting.com> Hi Vlad, Vlad Dumitrescu wrote: > I want to implement a double-linked list, which I can easily traverse > in both directions. I wonder if there are any smart solutions you know > of... Why don't you use ets tables with an ordered set, and the calls prev/2 and next/2? Sounds like the easiest solution to me. Francesco From Sean.Hinde@REDACTED Thu Jul 4 14:53:10 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 4 Jul 2002 13:53:10 +0100 Subject: ANN: crone - cron in Erlang (sort of) Message-ID: <04D356A3B172D611981B0008C791C3126BF150@imp02mbx.t-mobile.co.uk> Well, here's one I wrote earlier. The API is unfinished (stuck somewhat between two methods) but it does seem to work well enough. This one sends a tick to itself every minute and does any jobs which are scheduled at that time. There are some (slightly incorrect) docs in the code You can also have a job run at startup which returns a state which is passed through future invocations. Someone might find it useful.. cron.conf is in the priv dir Sean > -----Original Message----- > From: Gerd Flaig [mailto:gerd@REDACTED] > Sent: 04 July 2002 10:35 > To: Chris Pressey > Cc: erlang-questions@REDACTED > Subject: Re: ANN: crone - cron in Erlang (sort of) > > > Chris Pressey writes: > > > For each task you wish to schedule, crone creates a > process. Each process > > calculates the time until the task will next be run, calls > timer:sleep/1 > > for that duration, runs the task, and repeats. > > perhaps it would be better to organize the tasks to be run in a > priority queue with the next time to run as key. That way, you only > need one process that calculates the time to wait until the next task > should be executed, then spawn the process to execute that task. Saves > lots of processes. > > Goodbyte, Gerd. > -- > Gerd Flaig Technik gerd@REDACTED > Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe > Physics is like sex: sure, it may give some practical results, > but that's not why we do it. -- Richard Feynman > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. -------------- next part -------------- A non-text attachment was scrubbed... Name: cron-1.0.tgz Type: application/octet-stream Size: 3515 bytes Desc: not available URL: From hal@REDACTED Thu Jul 4 19:53:25 2002 From: hal@REDACTED (Hal Snyder) Date: Thu, 04 Jul 2002 12:53:25 -0500 Subject: getting to yaws, devpoll In-Reply-To: (Joe Armstrong's message of "Thu, 4 Jul 2002 10:31:06 +0200 (CEST)") References: Message-ID: <87y9crnzvu.fsf@ghidra.vail> Joe Armstrong writes: > If you are doing [yaws] benchmarks then the following question is > very interesting. ... > 3) Measure the throughput as you massivly overload the system. > > (say the page rate is 1000 pages/sec) > > Subject the system to 10000 requests/sec. I wonder, wouldn't this situation be helped by kernel polling? Per Bergqvist was working on a patch, but - I don't see devpoll stuff in a recent snapshot (otp_src_P9_2002-06-30). http://www.erlang.org/ml-archive/erlang-questions/200203/msg00038.html From cpressey@REDACTED Thu Jul 4 20:02:04 2002 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 4 Jul 2002 13:02:04 -0500 Subject: ANN: crone - cron in Erlang (sort of) In-Reply-To: <04D356A3B172D611981B0008C791C3126BF150@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF150@imp02mbx.t-mobile.co.uk> Message-ID: <20020704130204.4e851e68.cpressey@catseye.mb.ca> On Thu, 4 Jul 2002 13:53:10 +0100 Sean Hinde wrote: > Well, here's one I wrote earlier. > > The API is unfinished (stuck somewhat between two methods) but it does > seem to work well enough. > > This one sends a tick to itself every minute and does any jobs which are > scheduled at that time. There are some (slightly incorrect) docs in the > code > > You can also have a job run at startup which returns a state which is > passed through future invocations. > > Someone might find it useful.. cron.conf is in the priv dir > > Sean Heh... I suppose I could have asked on the list as part of my searching. But, I also wanted to see what a scheduler would be like written in 'the Erlang style'. This applies to Vlad's design question as well - I've found that having one process per real-world concurrent task is generally preferable to being conservative about the number of processes. Erlang can handle a really phenomenal number of processes, by design. Also, it usually results in code that's easier to understand and maintain. -Chris From igouy@REDACTED Thu Jul 4 04:09:06 2002 From: igouy@REDACTED (isaac gouy) Date: Wed, 3 Jul 2002 19:09:06 -0700 (PDT) Subject: yaws Message-ID: <20020704020906.69696.qmail@web20502.mail.yahoo.com> - Here are ancient benchmarks for "small & fast & simple HTTP servers". (I chose to use mathopd because I thought the author could actually understand 3,500 lines of code.) http://www.acme.com/software/thttpd/benchmarks.html - From what I read (*note no real experience*) webserver performance isn't the performance hog. Processing page templates and DB requests is the problem. http://philip.greenspun.com/internet-application-workbook/scaling __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com From heinz.eriksson@REDACTED Thu Jul 4 15:56:29 2002 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Thu, 04 Jul 2002 15:56:29 +0200 Subject: lists:zip / zip_with / unzip etc Message-ID: <3D24540D.BD1BB816@era.ericsson.se> I can't find any functions which does the same as zip (Haskell, Python) or unzip/zipWith (Haskell). Is this zip ok or is there som good function available which I have missed? ziph([H1|L1],[H2|L2], Z) -> ziph(L1,L2,[{H1,H2}|Z]); ziph([],L2, Z) -> Z; ziph(L1,[], Z) -> Z. zip(A,B) -> lists:reverse(ziph(A,B,[])). For example mean_list(A,B) -> [(U+L)/2.0 || {U,L} <- zip(A,B)]. 2> mean_list([2.0,3.0], [1.0,2.0]). [1.50000,2.50000] 3> /hz From etxuwig@REDACTED Fri Jul 5 00:34:12 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 5 Jul 2002 00:34:12 +0200 (MET DST) Subject: ANN: crone - cron in Erlang (sort of) In-Reply-To: <20020704021945.696fc960.cpressey@catseye.mb.ca> Message-ID: On Thu, 4 Jul 2002, Chris Pressey wrote: >It raises the question: just how large can the argument to >timer:sleep/1 be? Scheduling a task on a monthly basis means >sleeping for potentially hundreds of hours (that is, billions of >milliseconds.) How much inaccuracy should be expected to creep >in over such a long wait? The argument to timer:sleep/1 can be a 32 bit integer, I think. It's the same as T in receive after T -> ok end. A function that allows for longer sleeps than that can be found below. If you're worried about the precision (I don't think it's a big problem, but have not tried to figure out exactly what it is), you can reduce ?MAX_MSG_WAIT_TIME significantly without any measureable performance penalty. /Uffe -define(MAX_MSG_WAIT_TIME, 4294967295). % Max int. for % unsigned 32 bit sleep(Time) -> do_sleep(Time, system_time()). do_sleep(Time, Start) -> DiffTime = system_time() - Start, case Time - DiffTime of X when X > ?MAX_MSG_WAIT_TIME -> sleep(?MAX_MSG_WAIT_TIME), do_sleep(Time, Start); X when X > 0 -> receive after X -> ok end; X -> ok end. %%% %%% return the system time in %%% milli-seconds. %%% system_time() -> {M,S,U} = erlang:now(), 1000000000 * M + 1000 * S + (U div 1000). -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From thomas@REDACTED Fri Jul 5 08:34:23 2002 From: thomas@REDACTED (Thomas Arts) Date: Fri, 05 Jul 2002 08:34:23 +0200 Subject: lists:zip / zip_with / unzip etc References: <3D24540D.BD1BB816@era.ericsson.se> Message-ID: <3D253DEF.E7BAD43@cslab.ericsson.se> Hi Heinz The zip function is indeed missing in the lists module, like the uniq function (removing duplicates from a list). > ziph([H1|L1],[H2|L2], Z) -> > ziph(L1,L2,[{H1,H2}|Z]); > ziph([],L2, Z) -> > Z; > ziph(L1,[], Z) -> > Z. > > zip(A,B) -> > lists:reverse(ziph(A,B,[])). This solution for zip has complexity 2N (2 times the length of the list). It is easy to make a solution that only traverses the list once. It is a matter of taste whether you accept lists of unequal length. I would like the program to crash (in the Erlang style) if you offer it two lists of unequal length. /Thomas From bjarne@REDACTED Fri Jul 5 10:01:46 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Fri, 05 Jul 2002 10:01:46 +0200 Subject: Erlang workshop and user conference Message-ID: <3D25526A.5937EF21@erix.ericsson.se> Hello Please note two exciting Erlang happenings later this year. On October 7 the ACM SIGPLAN Erlang Workshop will occur as a satellite event of PLI2002. It will take place at the CMU in Pittsburgh, PA, USA. The program has just been posted on the net http://www.erlang.se/workshop/2002/ The annual Erlang User Conference is planned for November 19 in Stockholm and the call-for-papers can also be found on the net http://www.erlang.se/euc/02/ Please make a note in your diary of there events ! Have a nice summer Bjarne From per@REDACTED Fri Jul 5 11:09:53 2002 From: per@REDACTED (Per Bergqvist) Date: Fri, 05 Jul 2002 10:09:53 +0100 Subject: getting to yaws, devpoll In-Reply-To: <87y9crnzvu.fsf@ghidra.vail> Message-ID: <200207050809.g6589r020752@raven.levonline.com> > Joe Armstrong writes: > > > If you are doing [yaws] benchmarks then the following question is > > very interesting. > > ... > > > 3) Measure the throughput as you massivly overload the system. > > > > (say the page rate is 1000 pages/sec) > > > > Subject the system to 10000 requests/sec. > > I wonder, wouldn't this situation be helped by kernel polling? > Most certainly. To clearify why kernel polling suites erlang extremely well one just have to look on the way the scheduler works. On a system with load it will sit in a loop where it executes a number of reductions and then goes away to check for i/o with zero timeout. If you run a unix that supports poll and have, say 15000, active TCP/IP connections you will have to copy 12*15000 bytes from user space to kernel space. The kernel then have to do a driver poll for each and every of those file descriptors. Note that this will occur even if there is no actual i/o taking over the connections, like many http 1.1 sessions. It is not uncommon to see 70-80% kernel load already at 2000-3000 connections. With kernel polling it is a totally different story. Instead of having each connections fd in the pollset the sockets fds are bound in kernel state. Only a single fd is included in the pollset reducing the user-kernel space copying but more important it is not necessary for the kernel to execute the driver poll for each fd since it keeps state. The system load now depends on actual traffic and not established connections which makes erlang + kernel an ideal platform for massive multiuser internet services. > Per Bergqvist was working on a patch, but - I don't see devpoll > stuff in a recent snapshot (otp_src_P9_2002-06-30). > I haven't updated the patch for P9. Will probably happen during the summer. There is still some weird behaviour with FreeBSD kqueue support but the Solaris and Linux+/dev/kpoll variants are flawless. /dev/kpoll is a derivate work from Davide Libenskis devpoll driver. It mimics the semantics of poll better than devpoll. It is still unreleased to a wider audience. It should really have been released a few months ago but nobody seemed interested in the kernel poll support. Let me know if your interested and I'll fix it. > http://www.erlang.org/ml-archive/erlang-questions/200203/msg00038.html > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From matthias@REDACTED Fri Jul 5 11:03:11 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 5 Jul 2002 11:03:11 +0200 Subject: is the ifdef macro supposed to work in the middle of a function? Message-ID: <15653.24783.699857.458463@beladrome.corelatus.se> Hi, Feature or bug? ---------------------------------------------------------------------- -module(macro). %% The following works -ifdef(BLO). b(1) -> ok. -endif. %% But this does not work: macro.erl:14: unterminated '-ifdef' -ifdef(BLA). a(1) -> ok; -endif. a(2) -> ok. ---------------------------------------------------------------------- Using R8B-1. Matthias From heinz.eriksson@REDACTED Fri Jul 5 11:36:36 2002 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Fri, 05 Jul 2002 11:36:36 +0200 Subject: lists:zip / zip_with / unzip etc References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> Message-ID: <3D2568A4.46927B6@era.ericsson.se> Thomas Arts wrote: > > Hi Heinz > > The zip function is indeed missing in the lists module, > like the uniq function (removing duplicates from a list). > > > ziph([H1|L1],[H2|L2], Z) -> > > ziph(L1,L2,[{H1,H2}|Z]); > > ziph([],L2, Z) -> > > Z; > > ziph(L1,[], Z) -> > > Z. > > > > zip(A,B) -> > > lists:reverse(ziph(A,B,[])). > > This solution for zip has complexity 2N (2 times the length > of the list). It is easy to make a solution that only > traverses the list once. > It is a matter of taste whether you accept lists of > unequal length. I would like the program to crash (in the > Erlang style) if you offer it two lists of unequal length. I think so too, but what is expected of a zip ... in Haskell zip type: zip :: [a] -> [b] -> [(a,b)] description: applied to two lists, returns a list of pairs which are formed by tupling together corresponding elements of the given lists. If the two lists are of different length, the length of the resulting list is that of the shortest. and Python zip(seq1, ...) This function returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences. ... The returned list is truncated in length to the length of the shortest argument sequence. Would this be ok to you then: ziph([H1|L1],[H2|L2], Z) -> [{H1,H2}|ziph(L1,L2,Z)]; ziph([],[], Z) -> Z. zip(A,B) -> ziph(A,B,[]). ? Is that tail recursive? Or how shall it be done. Pair of lists -> List of pairs -> List of mean values of pairs [(U+L)/2.0 || {U,L} <- zip(A,B)] It would be nice with an even richer 'lists' module. There have been other useful functions discussed before. But is there a _direct_ way to make a the generators of a list comprehension "operate in parallel"? [(U + L) / 2.0 || U <- A (??) L <- B] ^^ I know about generators for two (or more) lists working "nestedly" as in the Cartesian product example. (first version of this post seemed to disappear, sorry if it reincarnates). /hz From Chandrashekhar.Mullaparthi@REDACTED Fri Jul 5 16:12:03 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 5 Jul 2002 15:12:03 +0100 Subject: emfile Message-ID: <04D356A3B172D611981B0008C791C3124048A4@imp02mbx.t-mobile.co.uk> Hello everyone, One of my nodes is going down regularly because it is running out of file descriptors oever a period of time (about 20 hours). I've had the same node running for the past six months with no outage at all using R7B but now I've added orber and upgraded to R8B. The client is a WebLogic app server which creates CORBA objects in my node. Each object seems to result in the opening of 2 TCP connections. What is happening here? MY file descriptor limit is set to 512 and I have about 50 mnesia tables in total. Has anyone else seen this kind of behaviour. One thing I do is try limit the number of objects created. I do this by killing old objects (erlang gen_servers) when a new create request is created which exceed the max number of allowed objects. Is this what might be causing the problem - is there a more graceful way of deleting an object? regards Chandru NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From nick@REDACTED Fri Jul 5 16:46:36 2002 From: nick@REDACTED (Niclas Eklund) Date: Fri, 5 Jul 2002 16:46:36 +0200 (MEST) Subject: emfile In-Reply-To: <04D356A3B172D611981B0008C791C3124048A4@imp02mbx.t-mobile.co.uk> Message-ID: Hello! The proper way to destroy an Orber object is to use corba:dispose/1. Sounds like that client-side ORB never terminates the connection. When Orber acts as a client-side ORB you should set the iiop_connection_timeout option (acts like a GC and terminates all "out-going" connections which haven't been used for T seconds). I also recomend that you set iiop_timeout and iiop_setup_connection_timeout (see chapter 5.2 in the User's Guide). The number of Orber objects you've started isn't the problem since Orber uses one proxy per client-ORB; use orb.destroy(); (Java) to stop it. Now you might wonder why 2 TCP connections are used. Well, that's because the Client-ORB requests it, which is common. If you're using the latest version of Orber you can easily check the amount of "out-going" connections Orber holds (one per host/port) by invoking: orber:iiop_connections(). or orber:info(). Have a nice weekend /Nick P.S. If you use Orber to access Mnesia, then it might be a very good idea to use pseudo-objects. D.S. > Hello everyone, > > One of my nodes is going down regularly because it is running out of file > descriptors oever a period of time (about 20 hours). I've had the same node > running for the past six months with no outage at all using R7B but now I've > added orber and upgraded to R8B. > > The client is a WebLogic app server which creates CORBA objects in my node. > Each object seems to result in the opening of 2 TCP connections. What is > happening here? MY file descriptor limit is set to 512 and I have about 50 > mnesia tables in total. Has anyone else seen this kind of behaviour. > > One thing I do is try limit the number of objects created. I do this by > killing old objects (erlang gen_servers) when a new create request is > created which exceed the max number of allowed objects. Is this what might > be causing the problem - is there a more graceful way of deleting an object? > > regards > Chandru > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have received > this email in error please notify the sender immediately and delete this > email from your system without copying or disseminating it or placing any > reliance upon its contents. We cannot accept liability for any breaches of > confidence arising through use of email. Any opinions expressed in this > email (including attachments) are those of the author and do not necessarily > reflect our opinions. We will not accept responsibility for any commitments > made by our employees outside the scope of our business. We do not warrant > the accuracy or completeness of such information. From pascal.brisset@REDACTED Fri Jul 5 16:36:35 2002 From: pascal.brisset@REDACTED (Pascal Brisset) Date: Fri, 5 Jul 2002 16:36:35 +0200 Subject: emfile In-Reply-To: <04D356A3B172D611981B0008C791C3124048A4@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3124048A4@imp02mbx.t-mobile.co.uk> Message-ID: <15653.44787.541789.428310@pcg.localdomain> Chandrashekhar Mullaparthi writes: > One of my nodes is going down regularly because it is running out of file > descriptors oever a period of time (about 20 hours). Are you using os_mon on Linux ? There used to be a leak which caused emfile problems after 17 hours, depending on the number of descriptors and the value of {os_mon,memory_check_interval}. -- Pascal Brisset From hal@REDACTED Fri Jul 5 18:36:31 2002 From: hal@REDACTED (Hal Snyder) Date: Fri, 05 Jul 2002 11:36:31 -0500 Subject: getting to yaws, devpoll In-Reply-To: <200207050809.g6589r020752@raven.levonline.com> (Per Bergqvist's message of "Fri, 05 Jul 2002 10:09:53 +0100") References: <200207050809.g6589r020752@raven.levonline.com> Message-ID: <87vg7up1ww.fsf@ghidra.vail> Per Bergqvist writes: > I haven't updated the [devpoll] patch for P9. Will probably happen > during the summer. There is still some weird behaviour with FreeBSD > kqueue support but the Solaris and Linux+/dev/kpoll variants are > flawless. > /dev/kpoll is a derivate work from Davide Libenskis devpoll driver. > It mimics the semantics of poll better than devpoll. It is still > unreleased to a wider audience. It should really have been released > a few months ago but nobody seemed interested in the kernel poll > support. > Let me know if your interested and I'll fix it. Definitely interested! We use the BSDs a fair amount - let me know if we can help with kqueue issues. From vances@REDACTED Fri Jul 5 23:10:39 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 5 Jul 2002 17:10:39 -0400 Subject: extra console/shell In-Reply-To: <200207010958.g619w4R42441@tordmule.bluetail.com> References: <200207010958.g619w4R42441@tordmule.bluetail.com> Message-ID: <20020705211039.GG77220@frogman.motivity.ca> Per, I use to_erl (on Solaris, Linux & FreeBSD) quite frequently. The advantage of to_erl is that the system doesn't need to be running distributed. -Vance On Mon, Jul 01, 2002 at 11:58:04AM +0200, Per Hedeland wrote: > > >If my memory serves me right, on Solaris there is a to_erl utility, but I > >think it only allows connecting to the active shell, not create a new one. > > Yes, and it's a hack (I wrote the original version:-) that has no real > business being included with Solaris, I think. I did it for the VxWorks > port, where it made some sense, since on such systems you typically don't > have window systems or job control, and frequently only a single serial > port through which you may need to access both the VxWorks shell and the > Erlang shell. > > So you give the serial port to the VxWorks shell, and fire up Erlang > behind a pseudo-tty ('start_erl' did this IIRC) - and then you can run > to_erl from the VxWorks shell to talk to that pseudo-tty, returning to > the VxWorks shell when to_erl finishes (on ^D). > > --Per Hedeland > per@REDACTED From spearce@REDACTED Sat Jul 6 07:30:07 2002 From: spearce@REDACTED (Shawn Pearce) Date: Sat, 6 Jul 2002 01:30:07 -0400 Subject: Erts doesn't support 64 bit files? Message-ID: <20020706013007.A12818@spearce.org> So apparently OTP R8B-1 doesn't support 64 bit files... $ erl Erlang (BEAM) emulator version 5.1.1 [source] [hipe] [threads:0] Eshell V5.1.1 (abort with ^G) 1> {ok, F} = file:open("test2.dat", [raw, binary, write]). {ok,{file_descriptor,prim_file,{#Port<0.26>,5}}} 2> file:position(F, (1 bsl 31)-1). {ok,2147483647} 3> file:write(F, "ab"). File size limit exceeded $ Causes the entire system to crash. This is on x86 Debian Potato, using the 2.4.18 kernel. It appears as though the crash may actually be caused by the 32 bit write system call being used by the efile driver, and not by erts. Kind of hard to guard against a crash caused by the C library. :-( This is interesting, because a user might be able to bring down an Erlang node unknowningly. A bug in a process may create an invalid file position and bring the entire node down, rather than just causing a single process to crash. I'd settle for the node not crashing when a process writes over the 2 GB barrier, but since I'm working on digital video inside of Erlang I'd like true 64 bit file support. I would really like to be able to keep the 4 or 8 GB video streams in a single file whenever possible, especially since the streams are stored on an XFS disk, which has a 14 TB maximum file size. So I'm politely submitting two feature requests: erts shouldn't crash in the above case, and I'd really like to see larger file support. I doubt there is much that could be done to protect erts from the 2 GB barrier crash, not without using a 64 bit file interface. In the mean time, I'm may write a new device driver that can handle the 64 bit files on XFS, as well as to support XFS's Direct IO, to bypass the kernel buffer cache. Or just write a poor man's version which splices the data across multiple 2GB files, and debug carefully. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From mikpe@REDACTED Sat Jul 6 16:04:42 2002 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 6 Jul 2002 16:04:42 +0200 (MET DST) Subject: Erts doesn't support 64 bit files? Message-ID: <200207061404.QAA15644@harpo.it.uu.se> On Sat, 6 Jul 2002 01:30:07 -0400, Shawn Pearce wrote: >So apparently OTP R8B-1 doesn't support 64 bit files... > > $ erl > Erlang (BEAM) emulator version 5.1.1 [source] [hipe] [threads:0] > > Eshell V5.1.1 (abort with ^G) > 1> {ok, F} = file:open("test2.dat", [raw, binary, write]). > {ok,{file_descriptor,prim_file,{#Port<0.26>,5}}} > 2> file:position(F, (1 bsl 31)-1). > {ok,2147483647} > 3> file:write(F, "ab"). > File size limit exceeded > $ > >Causes the entire system to crash. This is on x86 Debian Potato, >using the 2.4.18 kernel. It appears as though the crash >may actually be caused by the 32 bit write system call being >used by the efile driver, and not by erts. Kind of hard to >guard against a crash caused by the C library. :-( >... >In the mean time, I'm may write a new device driver that can >handle the 64 bit files on XFS, as well as to support XFS's Direct IO, >to bypass the kernel buffer cache. Or just write a poor man's version >which splices the data across multiple 2GB files, and debug carefully. The bug is in erts. If you don't open(2) a file with O_LARGEFILE in the flags, the kernel sends SIGXFSZ to you if your write(*) would cause the file size to exceed $2^{31}-1$ bytes. This shows up as a core dump in glibc's write() procedure, but that's not glibc's fault. The application should #define _LARGEFILE64_SOURCE before its #includes, as an indication of it being ready to handle 64-bit off64_t etc. (*) I haven't checked but a write to an mmap():ed page could also grow a file and might have similar behaviour as write(). /Mikael From L.A.Timochouk@REDACTED Sat Jul 6 18:00:14 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Sat, 6 Jul 2002 17:00:14 +0100 (BST) Subject: getting to yaws, devpoll In-Reply-To: <200207050809.g6589r020752@raven.levonline.com> Message-ID: Is the devpoll patch supposed to work with R8B-1 (and forthcoming R8B-2)? So far, it was done against R8B-0... -- Sincerely, Leonid Timochouk University of Kent at Canterbury From per@REDACTED Sun Jul 7 15:55:03 2002 From: per@REDACTED (Per Bergqvist) Date: Sun, 07 Jul 2002 14:55:03 +0100 Subject: getting to yaws, devpoll In-Reply-To: Message-ID: <200207071255.g67Ct3518764@sork.levonline.com> > Is the devpoll patch supposed to work with R8B-1 (and forthcoming R8B-2)? > So far, it was done against R8B-0... Correct, I'll release a R8B-1 patch next week when I get home. Since this is a experimental due to the limited usage I don't think it will be included R8B-2. If you do use it please give me feedback. /Per > > -- Sincerely, > Leonid Timochouk > University of Kent at Canterbury > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From thomas@REDACTED Mon Jul 8 09:12:48 2002 From: thomas@REDACTED (Thomas Arts) Date: Mon, 08 Jul 2002 09:12:48 +0200 Subject: lists:zip / zip_with / unzip etc References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> <3D2568A4.46927B6@era.ericsson.se> Message-ID: <3D293B70.81606D13@cslab.ericsson.se> Heinz Eriksson wrote: > Would this be ok to you then: > > ziph([H1|L1],[H2|L2], Z) -> > [{H1,H2}|ziph(L1,L2,Z)]; > ziph([],[], Z) -> > Z. > > zip(A,B) -> > ziph(A,B,[]). > > ? > Is that tail recursive? > Or how shall it be done. No, this makes no sense. You don't use the last argument! It is not tail recursive if you just add a last argument, you need to really use it. ziph([H1|L1],[H2|L2], Z) -> ziph(L1,L2,[{H1,H2}|Z]); ziph([],[], Z) -> Z. zip(A,B) -> ziph(A,B,[]). and this solution accepts only lists of equal length, which is perfectly fine with me. See tail recursion as "not using the callstack". In your version of ziph you push the value {H1,H2} on the stack, call ziph recusively and when the answer returns, you add the value on the stack on top of it. In the tail-recursive example above, you construct the value and call the ziph function with empty callstack, but growing argument. Problem is, of course, that your new list is reversed. This need not be a problem, but is not very nice. ziph([H1|L1],[H2|L2], Z) -> ziph(L1,L2,Z++[{H1,H2}]); ziph([],[], Z) -> Z. would give you the right order, but this version has a higher complexity. Appending to the end of the list becomes more expesive every time you increase the length of the list. Thus the number of "list traversels" is 1+2+...+N, instead of the N times you need in the non tail recursive case. Note that it is even faster to build a reversed list and use the reverse function afterward (viz. 2*N) instead of doing the above. Unless the lists are expected to be really, really long, I would advocate for the simple solution: zip([],[]) -> []; zip([H1|T1],[H2|T2]) -> [{H1,H2}|zip(T1,T2)]. In case your lists are expected to be really long, think about another data structure, like balanced trees. /Thomas From fredrik.linder@REDACTED Sun Jul 7 16:46:21 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Sun, 7 Jul 2002 16:46:21 +0200 Subject: Recursion References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> <3D2568A4.46927B6@era.ericsson.se> Message-ID: <002501c225c5$120b2320$a8b7f2d5@frelin> [Clip from: "lists:zip / zip_with / unzip etc"] > > Would this be ok to you then: > > ziph([H1|L1],[H2|L2], Z) -> > [{H1,H2}|ziph(L1,L2,Z)]; > ziph([],[], Z) -> > Z. > > zip(A,B) -> > ziph(A,B,[]). > > ? > Is that tail recursive? No, it is not tail-recursive, sorry. One can see that 'cause there is something to do after the recursive call, i.e the creation of a cons cell. This is tail-recursive however: zip(L1, L2) -> zip(L1, L2, []). zip([H1 | T1], [H2 | T2], Acc) -> zip(T1, T2, [{H1, H2} | Acc]); % Nothing to be done after the recursive call zip([], [], Acc) -> lists:reverse(Acc). % This is necesary if you want to keep the order of your list elements. This is non-tail-recursive: zip([H1 | T1], [H2 | T2]) -> [{H1, H2} | zip(T1, T2)]; zip([], []) -> []. Btw, in this case there is no need to name the helper function differently than the function it helps (different number of arguments). They do the same thing, except setting the default accumulator value, so then it is good practice to give them the same name. /Fredrik From thierry.mallard@REDACTED Tue Jul 9 14:47:59 2002 From: thierry.mallard@REDACTED (Thierry Mallard) Date: Tue, 9 Jul 2002 14:47:59 +0200 Subject: Erlang RPM for Mandrake 8.2 - asking for test Message-ID: <20020709124759.GC4519@calvin.local.vawis.net> Greetings, As I didn't find any Mandrake RPM for Erlang, I've tried to build one. (this is my first RPM, so there may be errors in it..) Here's the URL : http://www.vawis.net/mdk/erlang-8.1-0mdk.i586.rpm It has been done for Mandrake 8.2, x86 plateform. RPM installation should add an Erlang entry in the window manager's menu to get an Erlang shell.. The trailing -0mdk indicates that it's a beta version. Don't use this on production sites ! Feedback is most welcome, to get a final release. :-) Have fun ! -- Thierry Mallard http://vawis.net From heinz.eriksson@REDACTED Tue Jul 9 17:02:24 2002 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Tue, 09 Jul 2002 17:02:24 +0200 Subject: Recursion References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> <3D2568A4.46927B6@era.ericsson.se> <002501c225c5$120b2320$a8b7f2d5@frelin> Message-ID: <3D2AFB00.30BA62E8@era.ericsson.se> Fredrik Linder wrote: > > [Clip from: "lists:zip / zip_with / unzip etc"] > > > > Would this be ok to you then: > > > > ziph([H1|L1],[H2|L2], Z) -> > > [{H1,H2}|ziph(L1,L2,Z)]; > > ziph([],[], Z) -> > > Z. > > > > zip(A,B) -> > > ziph(A,B,[]). > > > > ? > > Is that tail recursive? > > No, it is not tail-recursive, sorry. One can see that 'cause there is > something to do after the recursive call, i.e the creation of a cons cell. Ok, thank you, then everything fits my previous 'understanding'. Thomas wrote. >No, this makes no sense. You don't use the last argument! Yes I do, the messed up non-tail recursive variant with the dragged along empty list argument is actually used when recursion terminates:-) > > This is tail-recursive however: > > zip(L1, L2) -> > zip(L1, L2, []). > > zip([H1 | T1], [H2 | T2], Acc) -> > zip(T1, T2, [{H1, H2} | Acc]); % Nothing to be done after the recursive > call > zip([], [], Acc) -> > lists:reverse(Acc). % This is necesary if you want to keep the order of > your list elements. That was close my initial attempt (except for the helper function naming) to which Thomas commented that: >This solution for zip has complexity 2N (2 times the length >of the list). It is easy to make a solution that only >traverses the list once. Does this imply something more than a space / time compromise for the function evaluation characteristics? (Except elegance of the implementation). Also: You order the clauses differently (than Thomas) for the non-tail recursive version. Which is to preferable? My guess was that placing the zip([],[])->[] last was best. /hz From svg@REDACTED Tue Jul 9 17:49:04 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 09 Jul 2002 21:49:04 +0600 (YEKST) Subject: lists:zip / zip_with / unzip etc In-Reply-To: <3D24540D.BD1BB816@era.ericsson.se> References: <3D24540D.BD1BB816@era.ericsson.se> Message-ID: <20020709.214904.18299636.svg@surnet.ru> From: Heinz Eriksson Subject: lists:zip / zip_with / unzip etc Date: Thu, 04 Jul 2002 15:56:29 +0200 Message-ID: <3D24540D.BD1BB816@REDACTED> heinz.eriksson> heinz.eriksson> ziph([H1|L1],[H2|L2], Z) -> heinz.eriksson> ziph(L1,L2,[{H1,H2}|Z]); heinz.eriksson> ziph([],L2, Z) -> heinz.eriksson> Z; heinz.eriksson> ziph(L1,[], Z) -> heinz.eriksson> Z. heinz.eriksson> heinz.eriksson> zip(A,B) -> heinz.eriksson> lists:reverse(ziph(A,B,[])). Slightly generalized version: noname@REDACTED> listn:zipn([[1,2,3], [4,5,6], [7,8,9]]) -> [{1,4,7},{2,5,8},{3,6,9}] Code: zipn(Ls) -> [list_to_tuple(L) || L <- listn(Ls)]. listn(Ls) -> [lists:reverse(L) || L <- foldn(fun (A, Acc) -> [A|Acc] end, [], Ls)]. foldn(_, _, []) -> []; foldn(Fun, Acc0, Ls) -> foldn(Fun, Acc0, Ls, []). foldn(_, _, [[]|_], Ret) -> lists:reverse(Ret); foldn(Fun, Acc0, Ls, Ret) -> foldn(Fun, Acc0, [tl(L) || L <- Ls], [lists:foldl(Fun, Acc0, [hd(L) || L <- Ls])|Ret] ). Best Regards, Vladimir Sekissov From twanvds@REDACTED Wed Jul 10 01:24:03 2002 From: twanvds@REDACTED (Twan van der Schoot) Date: Wed, 10 Jul 2002 01:24:03 +0200 Subject: Consistent problems with gs, toolbar, pman under WinNT Message-ID: <01C227B0.7B233EF0.twanvds@xs4all.nl> Dear all, after some trepidation I dare to rise an issue which has been mentioned in the release notes of R8B-0 and RB8-1 about, and I quote from the Readme-file: "4.1 Some graphical tools have problems on Windows. Pman may not start at the first attempt. Some other tools may give some error messages." I'm sorry to say that the situation is graver than suggested by this note. Repeated attempts to start, e.g. the toolbar do indeed finally succeed, taking a very long time to start. But, alas, actually using any of the "graphical" tools invariable lead to a crash and an erlang dump! What's more, the node on which gs has been started crashes and is left in an appearantly unrecoverable state, ouch. I encountered this problem from RB8-0 on and I quickely reverted back to the R7B version which does not suffer from this problem. But today I tried it again by installing and running R8B-1, to no avail. The reason I now dare to raise the issue is that other people seem tp complain about the same problem, but on WinNT systems much much faster (1.8GHz systems) than my own system (a dual 133MHz processor system). A number of symptoms of the problem indicates IMHO (a) synchronisation problem(s): 1. Repeately attempting to start the gs-system (e.g. by toolbar:start() ) does start the gs-system and the toolbar; 2. Actually using "successfully" started gs-based applications eventually do crash because the gs-kernel has died; 3. The same problem occurs on fast as well on slow systems; 4. The tcl/tk process starts nevertheless quite quickly, but shows the first window very late. Alas, I'm not an expert on process creation and the plumbing of pipes in WinNT and I've no background information on the required level of compatibility with pipes on a SunOS or UNIX-like platform. But the inspection of the windows specific C-code suggests that no specific measures have been taken to synchronise the creation of the various processes and pipes (As far as I can see the Erlang driver seems to work via the stdout and stdin pipes of the tcl/tk process instance) and the first use of these system resources. No mutexs, no Win32 Events are used. It looks like that the makers of the drivers c.a. (in 1996!) made some implicit assumption on the sequence of events, which now, somehow has changed. On the other hand, I can completely be wrong :( Nevertheless, I don't know what the priority of the MS WinNT/W2000 version of Erlang is in the Open Source strategy of Ericsson, but is structurally lags behind the "real" UNIX versions. Normally it is not that big a problem, but I think that the debugger and the pman applications are essential tools and can hardly be missed. From spearce@REDACTED Wed Jul 10 07:09:57 2002 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 10 Jul 2002 01:09:57 -0400 Subject: Untimely garbage collection Message-ID: <20020710010957.A32879@spearce.org> I'm having a little trouble abusing Erts. :-) What I've setup is an in-process C driver on Linux which allocates a pool of ErlDrvBinary objects when the port is opened from Erts. As this driver receives data from the bt848 frame grabber card (its a video capture driver), it places the video data into the available binaries and then sends the binaries to Erts with driver_output_term. Within Erts, a pair of gen_server processes open two ports: one to the bt848 video driver, and another to an X11 XVideo display driver. The messages sent by the bt848 with binaries attached is accepted by the one gen_server and is directly forwarded to the other. When the second gen_server gets the binaries, it sends them to the port using Port ! {self(), {command, List}}, where List is the List of ErlDrvBinary objects given to Erts by the bt848 driver. So we have a traffic flow like this: bt848 ---> gen_server 1 --> gen_server 2 --> XVideo Initial testing showed that allocating ErlDrvBinary objects for each video frame was far too costly in CPU time. The allocator is just too slow. So my initial design was to have the bt848 driver use a circular queue and just overwrite binaries as it wraps around. This causes a nice little side effect of binaries being modified within Erlang when they should be read only. So I decided to use the ErlDrvBinary refc field. If refc is 1, the bt848 driver owns the binary and is free to modify the contents. Erlang doesn't have a reference, so its not a problem. If refc is > 1, then at least one or more processes within Erlang still hold a reference to this binary and it cannot be updated. The bt848 driver uses its own micro GC routine which just scans the queue for any binary objects with refc == 1. This scheme worked well, provided the gen_server's used something like: handle_info({_, read, List}, State) -> % work with binaries stored in List force_gc({noreply, State}). force_gc(Ret) -> garbage_collect(), Ret. This seemed kind of risky, but appeared to work well. Erts was making the tail call into force_gc, which allowed it to remove List from the process stack. Since the only references to the binaries were held in List, and its now popped off the stack, the binaries should be unreachable and have their refc decremented when the garbage collection occurs. Additionally, the gen_server's use a memory heap of only 377 words, which should GC quickly. Suddenly this has stopped working. My C drivers are seizing when they run out of binaries, and all of the binaries have a refc of 3: one for the driver that "owns" the binary, and one for each gen_server process. The XVideo driver only holds the binary for a short period of time and is definately increasing and decreasing refc properly. refc >From the perspective of my application, it would be ok for my Erlang servers to notify the C drivers when they are done with the binary so it can rewrite it, regardless of the refc. It just causes a lot more coordination code to be written and more messages to be passed per set of frames being moved. It also breaks the Erlang single assignment / everything is read only model, making it harder for other modules to integrate well. Does anyone who knows more about the Erlang GC and Erlang driver development have better suggestions than what I currently have? I'm starting to get a little frustrated debugging this "lack of GC" sorta-deadlock I'm in... -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From spearce@REDACTED Wed Jul 10 07:16:46 2002 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 10 Jul 2002 01:16:46 -0400 Subject: Untimely garbage collection In-Reply-To: <20020710010957.A32879@spearce.org> References: <20020710010957.A32879@spearce.org> Message-ID: <20020710011646.B32879@spearce.org> Shawn Pearce scrawled: > I'm having a little trouble abusing Erts. :-) ... > Does anyone who knows more about the Erlang GC and > Erlang driver development have better suggestions > than what I currently have? RTFM: spawn_opt(Module, Function, ArgumentList, Options): {fullsweep_after, Number} Here are a few cases when it could be useful to change fullsweep_after. Firstly, if you want binaries that are no longer used to be thrown away as soon as possible. (Set Number to zero.) I'll try this and see if that makes things better. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From spearce@REDACTED Wed Jul 10 07:49:43 2002 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 10 Jul 2002 01:49:43 -0400 Subject: Untimely garbage collection In-Reply-To: <20020710011646.B32879@spearce.org> References: <20020710010957.A32879@spearce.org> <20020710011646.B32879@spearce.org> Message-ID: <20020710014943.C32879@spearce.org> This had no effect on my program at all. With fullsweep_after set to 0 and 1 it still runs out of buffers and locks up. It definately looks like the erlang binaries are not being garbage collected from within erts. Shawn Pearce scrawled: > Shawn Pearce scrawled: > > I'm having a little trouble abusing Erts. :-) > > ... > > > Does anyone who knows more about the Erlang GC and > > Erlang driver development have better suggestions > > than what I currently have? > > RTFM: > > spawn_opt(Module, Function, ArgumentList, Options): > > {fullsweep_after, Number} > Here are a few cases when it could be useful to change fullsweep_after. > Firstly, if you want binaries that are no longer used to be thrown away > as soon as possible. (Set Number to zero.) > > I'll try this and see if that makes things better. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From kent@REDACTED Wed Jul 10 10:00:55 2002 From: kent@REDACTED (Kent Boortz) Date: 10 Jul 2002 10:00:55 +0200 Subject: Consistent problems with gs, toolbar, pman under WinNT In-Reply-To: <01C227B0.7B233EF0.twanvds@xs4all.nl> References: <01C227B0.7B233EF0.twanvds@xs4all.nl> Message-ID: Twan van der Schoot writes: > Nevertheless, I don't know what the priority of the MS WinNT/W2000 version > of Erlang is in the Open Source strategy of Ericsson, but is structurally > lags behind the "real" UNIX versions. Normally it is not that big a > problem, but I think that the debugger and the pman applications are > essential tools and can hardly be missed. We are committed to make GS work on Windows NT and Windows 2000, and we have taken some time to look into this problem but haven't found what caused GS to start having problems in R8B, kent From per@REDACTED Wed Jul 10 18:33:44 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 10 Jul 2002 17:33:44 +0100 Subject: HP-UX 11 =?iso-8859-1?q?=3F?= In-Reply-To: <599CB390ADA8D3118101009027CCB33E75196D@clavius.europe.logica.com> Message-ID: <200207101533.g6AFXiN01858@lejon.levonline.com> Is anyone running OTP R8B1 under HP-UX 11 ? /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From heinz.eriksson@REDACTED Thu Jul 11 08:45:00 2002 From: heinz.eriksson@REDACTED (Heinz Eriksson) Date: Thu, 11 Jul 2002 08:45:00 +0200 Subject: Parallel list comprehensions (was: lists:zip / zip_with / unzip etc) References: <3D24540D.BD1BB816@era.ericsson.se> <20020709.214904.18299636.svg@surnet.ru> Message-ID: <3D2D296C.E2E7923E@era.ericsson.se> Vladimir Sekissov wrote: > > From: Heinz Eriksson > Subject: lists:zip / zip_with / unzip etc > Date: Thu, 04 Jul 2002 15:56:29 +0200 > Message-ID: <3D24540D.BD1BB816@REDACTED> > > heinz.eriksson> > heinz.eriksson> ziph([H1|L1],[H2|L2], Z) -> > heinz.eriksson> ziph(L1,L2,[{H1,H2}|Z]); > heinz.eriksson> ziph([],L2, Z) -> > heinz.eriksson> Z; > heinz.eriksson> ziph(L1,[], Z) -> > heinz.eriksson> Z. > heinz.eriksson> > heinz.eriksson> zip(A,B) -> > heinz.eriksson> lists:reverse(ziph(A,B,[])). > > Slightly generalized version: > > noname@REDACTED> listn:zipn([[1,2,3], [4,5,6], [7,8,9]]) -> > [{1,4,7},{2,5,8},{3,6,9}] > > Code: > > zipn(Ls) -> > [list_to_tuple(L) || L <- listn(Ls)]. > > listn(Ls) -> > [lists:reverse(L) > || L <- foldn(fun (A, Acc) -> [A|Acc] end, [], Ls)]. > > foldn(_, _, []) -> > []; > foldn(Fun, Acc0, Ls) -> > foldn(Fun, Acc0, Ls, []). > > foldn(_, _, [[]|_], Ret) -> > lists:reverse(Ret); > foldn(Fun, Acc0, Ls, Ret) -> > foldn(Fun, Acc0, > [tl(L) || L <- Ls], > [lists:foldl(Fun, Acc0, [hd(L) || L <- Ls])|Ret] > ). > > Best Regards, > Vladimir Sekissov Thank you, but what would you think of 'parallel list comprehensions'? such as is evidently in (one) Haskell: http://www.haskell.org/ghc/docs/latest/set/parallel-list-comprehensions.html There would have to be either a convention to 'comprehend' to the shortest list length or crash on different length lists. (Just as with zip/zip_with/zipn). /hz From Bruce@REDACTED Fri Jul 12 01:32:56 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Fri, 12 Jul 2002 11:32:56 +1200 Subject: HP-UX 11 ? References: <200207101533.g6AFXiN01858@lejon.levonline.com> Message-ID: <013401c22933$49d93dc0$5f00a8c0@slant> People, > Is anyone running OTP R8B1 under HP-UX 11 ? In response to this I have been attempting to build otp under HPUX11 (with Pers help), and I have run across the following problems: 1. finite() is not defined under hpux11 (isfinite() macro is) but this is not detected automatically...I haven't searched to see why yet. Putting #define USE_ISINF_ISNAN into otp_src_R8B-1/erts/hppa2.0w-hp-hpux11.00/config.h allows it to build. 2. After this is fixed it builds the C code okay, but the built code gives the error > erlc -W -bbeam +debug_info -I../include -I../../kernel/include > -o../ebin > beam_lib.erl > beam/beam_load.c(1357): Error loading module otp_ring0: op > i_func_info u a a > u: > no specific operation found > Failed loading preloaded module otp_ring0 > gmake[3]: *** [../ebin/beam_lib.beam] IOT trap (core dumped) This is on a PA-RISC 2.0 64 bit cpu, but running in 32bit mode on HPUX 11.0. It is running as big-endian (a la SPARC), and this is correctly identified. Using gcc-3.0.4 and the hpux standard ld. I'm happy to post configure output/files and do more investigation on request. The error is a mystery to me; it appears as though the opcodes inside a beam file cannot be interpreted. HPUX is a weird unix flavour, but given that it builds the c code I naively expected the erlang stuff to work. /Bruce From cy_tang@REDACTED Fri Jul 12 03:46:38 2002 From: cy_tang@REDACTED (cy) Date: Fri, 12 Jul 2002 09:46:38 +0800 Subject: about Megaco implementation Message-ID: <3D2E34FE.5070908@telesoft.com.hk> I have got a project on implementing a Megaco - MGC/MG for load generation In using the megaco protocol stack with megaco_session for C interface, I got the following problem in implementing the start of MG: It always return a {error, {bad_option,host}} for MegacoSessionUdp_open() from the megaco_session. Am I composing the "ipOptions" wrongly or I still missed something? By the way, is it possible to include a simple_MG in the megaco_session for example. Best regards, CY Tang Advanced Telesoft Ltd. (852)-2634-0246 Output from megaco_session : Eshell V5.1.1 (abort with ^G) (megaco_session@REDACTED)1> MSTI: init -> start transport MSTI: init -> transport started: <0.87.0> MSUI: init -> start transport MSUI: init -> transport started: <0.92.0> MSUI: open -> entry with RequestRef: 1 ReplyTo: <51.99.0> ReceiveHandle: {'Megaco_ReceiveHandle',{'MegacoMessage_MIdUnion','MIdChoice_deviceName',[109,121,95,109,103]},[109,101,103,97,99,111,95,112,114,101,116,116,121,95,116,101,120,116,95,101,110,99,111,100,101,114],[],[109,101,103,97,99,111,95,117,100,112]} Options: [{'MegacoSessionIp_IpOption','Ip_host',[114,104,108,105,110,117,120,49]},{'MegacoSessionIp_IpOption','Ip_port',2944}] MSUI: open -> error: Error: {error,{bad_option,host}} =ERROR REPORT==== 12-Jul-2002::09:15:37 === 'Megaco_SessionFactory_impl'(<0.85.0>): SessionUser node died - mg@REDACTED Source code from mg Megaco_SessionUser_startUserResponse__rs* Megaco_SessionUser_startUserResponse__cb(Megaco_SessionUser oe_obj, CORBA_long *ref, Megaco_Status *status, CORBA_Environment *oe_env) { V( ("received startUserResponse\n") ); ASSERT_OK(status); Megaco_ReceiveHandle rh; MegacoSessionIp_IpOption port[2]; MegacoSessionIp_IpOptions ipOptions; V( ("setup restart\n") ); rh.localMid = mid; // Setup text port for UDP port[0]._d = MegacoSessionIp_Ip_host; port[0]._u.host = "rhlinux1"; port[1]._d = MegacoSessionIp_Ip_port; port[1]._u.port = 2944; ipOptions._buffer = port; ipOptions._length = 2; ipOptions._maximum = 2; prepare_udp(&dummy); /* prepare receive handle for udp text */ rh.encodingMod = (CORBA_char*)"megaco_pretty_text_encoder"; rh.encodingConfig = (CORBA_char*)""; rh.sendMod = (CORBA_char*)"megaco_udp"; V( ("open UDP text (port 2944) connection\n") ); MegacoSessionUdp_open(NULL, *ref, &session_user_pid, &rh, &ipOptions, send_env); ASSERT_SEND(); } From micael.karlberg@REDACTED Fri Jul 12 11:13:50 2002 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Fri, 12 Jul 2002 08:13:50 -0100 Subject: about Megaco implementation References: <3D2E34FE.5070908@telesoft.com.hk> Message-ID: <3D2E9DCE.5090106@ericsson.com> cy wrote: > I have got a project on implementing a Megaco - MGC/MG for load generation > In using the megaco protocol stack with megaco_session for C interface, > I got the following problem in implementing the start of MG: > It always return a {error, {bad_option,host}} for > MegacoSessionUdp_open() from the megaco_session. > Am I composing the "ipOptions" wrongly or I still missed something? You should not supply the host address (as part of IpOptions) in the call to open. Also, the portnumber should propably be zero (0). > > By the way, is it possible to include a simple_MG in the megaco_session > for example. We had originally planned to do so, but we ran out of time. It's still on my todo-list. Regards, /BMK > > Best regards, > CY Tang > Advanced Telesoft Ltd. > (852)-2634-0246 > > > Output from megaco_session : > > Eshell V5.1.1 (abort with ^G) > (megaco_session@REDACTED)1> MSTI: init -> start transport > MSTI: init -> transport started: <0.87.0> > MSUI: init -> start transport > MSUI: init -> transport started: <0.92.0> > MSUI: open -> entry with > RequestRef: 1 > ReplyTo: <51.99.0> > ReceiveHandle: > {'Megaco_ReceiveHandle',{'MegacoMessage_MIdUnion','MIdChoice_deviceName',[109,121,95,109,103]},[109,101,103,97,99,111,95,112,114,101,116,116,121,95,116,101,120,116,95,101,110,99,111,100,101,114],[],[109,101,103,97,99,111,95,117,100,112]} > > Options: > [{'MegacoSessionIp_IpOption','Ip_host',[114,104,108,105,110,117,120,49]},{'MegacoSessionIp_IpOption','Ip_port',2944}] > > MSUI: open -> error: > Error: {error,{bad_option,host}} > > =ERROR REPORT==== 12-Jul-2002::09:15:37 === > 'Megaco_SessionFactory_impl'(<0.85.0>): SessionUser node died - mg@REDACTED > > > > > Source code from mg > > Megaco_SessionUser_startUserResponse__rs* > Megaco_SessionUser_startUserResponse__cb(Megaco_SessionUser oe_obj, > CORBA_long *ref, > Megaco_Status *status, > CORBA_Environment *oe_env) { > > V( ("received startUserResponse\n") ); > ASSERT_OK(status); > > Megaco_ReceiveHandle rh; > MegacoSessionIp_IpOption port[2]; > MegacoSessionIp_IpOptions ipOptions; > > V( ("setup restart\n") ); > > rh.localMid = mid; > > // Setup text port for UDP > port[0]._d = MegacoSessionIp_Ip_host; > port[0]._u.host = "rhlinux1"; > port[1]._d = MegacoSessionIp_Ip_port; > port[1]._u.port = 2944; > > ipOptions._buffer = port; > ipOptions._length = 2; > ipOptions._maximum = 2; > > prepare_udp(&dummy); > > /* prepare receive handle for udp text */ > rh.encodingMod = (CORBA_char*)"megaco_pretty_text_encoder"; > rh.encodingConfig = (CORBA_char*)""; > rh.sendMod = (CORBA_char*)"megaco_udp"; > > V( ("open UDP text (port 2944) connection\n") ); > MegacoSessionUdp_open(NULL, > *ref, > &session_user_pid, > &rh, > &ipOptions, > send_env); > ASSERT_SEND(); > } > From cy_tang@REDACTED Fri Jul 12 10:04:17 2002 From: cy_tang@REDACTED (cy) Date: Fri, 12 Jul 2002 16:04:17 +0800 Subject: about Megaco implementation References: <3D2E34FE.5070908@telesoft.com.hk> <3D2E9DCE.5090106@ericsson.com> Message-ID: <3D2E8D81.1050606@telesoft.com.hk> Thanks for your reply. I removed the host address from IpOptions. It opened successfully. Then, I tried to connect the MGC on the other node. But it need a sendHandle. There is a function megaco_udp:create_send_handle/3 in Erlang, but there isn't one in the C interface from megaco_session. If I just put the sendHandle returned from openResponse, it will give me the debug trace attached. From the Erlang example in Megaco for simple mg, sendHandle is composed of (Handle, MgcHost, MgcPort) using megaco_udp:create_send_handle/3, where Handle is returned by megaco_udp:open. How should I do the same composition in C using megaco_session? Best regards, CY Tang Advanced Telesoft Ltd. (852) 2634-0246 Micael Karlberg wrote: > cy wrote: > >> I have got a project on implementing a Megaco - MGC/MG for load >> generation >> In using the megaco protocol stack with megaco_session for C interface, >> I got the following problem in implementing the start of MG: >> It always return a {error, {bad_option,host}} for >> MegacoSessionUdp_open() from the megaco_session. >> Am I composing the "ipOptions" wrongly or I still missed something? > > > You should not supply the host address (as part of IpOptions) > in the call to open. Also, the portnumber should propably be > zero (0). > >> >> By the way, is it possible to include a simple_MG in the >> megaco_session for example. > > > We had originally planned to do so, but we ran out of time. > It's still on my todo-list. > > Regards, > /BMK > >> >> Best regards, >> CY Tang >> Advanced Telesoft Ltd. >> (852)-2634-0246 >> >> >> Output from megaco_session : >> >> Eshell V5.1.1 (abort with ^G) >> (megaco_session@REDACTED)1> MSTI: init -> start transport >> MSTI: init -> transport started: <0.87.0> >> MSUI: init -> start transport >> MSUI: init -> transport started: <0.92.0> >> MSUI: open -> entry with >> RequestRef: 1 >> ReplyTo: <51.99.0> >> ReceiveHandle: >> {'Megaco_ReceiveHandle',{'MegacoMessage_MIdUnion','MIdChoice_deviceName',[109,121,95,109,103]},[109,101,103,97,99,111,95,112,114,101,116,116,121,95,116,101,120,116,95,101,110,99,111,100,101,114],[],[109,101,103,97,99,111,95,117,100,112]} >> >> Options: >> [{'MegacoSessionIp_IpOption','Ip_host',[114,104,108,105,110,117,120,49]},{'MegacoSessionIp_IpOption','Ip_port',2944}] >> >> MSUI: open -> error: >> Error: {error,{bad_option,host}} >> >> =ERROR REPORT==== 12-Jul-2002::09:15:37 === >> 'Megaco_SessionFactory_impl'(<0.85.0>): SessionUser node died - >> mg@REDACTED >> >> >> >> >> Source code from mg >> >> Megaco_SessionUser_startUserResponse__rs* >> Megaco_SessionUser_startUserResponse__cb(Megaco_SessionUser oe_obj, >> CORBA_long *ref, >> Megaco_Status *status, >> CORBA_Environment *oe_env) { >> >> V( ("received startUserResponse\n") ); >> ASSERT_OK(status); >> >> Megaco_ReceiveHandle rh; >> MegacoSessionIp_IpOption port[2]; >> MegacoSessionIp_IpOptions ipOptions; >> >> V( ("setup restart\n") ); >> >> rh.localMid = mid; >> >> // Setup text port for UDP >> port[0]._d = MegacoSessionIp_Ip_host; >> port[0]._u.host = "rhlinux1"; >> port[1]._d = MegacoSessionIp_Ip_port; >> port[1]._u.port = 2944; >> >> ipOptions._buffer = port; >> ipOptions._length = 2; >> ipOptions._maximum = 2; >> >> prepare_udp(&dummy); >> >> /* prepare receive handle for udp text */ >> rh.encodingMod = (CORBA_char*)"megaco_pretty_text_encoder"; >> rh.encodingConfig = (CORBA_char*)""; >> rh.sendMod = (CORBA_char*)"megaco_udp"; >> >> V( ("open UDP text (port 2944) connection\n") ); >> MegacoSessionUdp_open(NULL, >> *ref, >> &session_user_pid, >> &rh, >> &ipOptions, >> send_env); >> ASSERT_SEND(); >> } > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: source_log2.txt URL: From thierry@REDACTED Fri Jul 12 10:31:48 2002 From: thierry@REDACTED (Thierry Mallard) Date: Fri, 12 Jul 2002 10:31:48 +0200 Subject: Erlang RPM for Mandrake 8.2 -testing- Message-ID: <20020712083148.GA799@calvin.local.vawis.net> Greetings, I've posted the same mail a few days ago, but I didn't received it and don't see it on the list archive, so I guess I dreamed it or whatever ;-) Anyway, as I didn't find Erlang R8B1 RPMs for Mandrake 8.2, I've tried to build one. It's my first RPM, so things may be wrong.. If anyone has the opportunity to have a look at it, and send some feedback, please do so ;-) Here's the URL : http://www.vawis.net/mdk/erlang-8.1-0mdk.i586.rpm The trailing -0mdk indicates it's an alpha version : don't use it on production sites, yet. With best regards, -- Thierry Mallard http://vawis.net From raimo@REDACTED Fri Jul 12 13:47:18 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Fri, 12 Jul 2002 13:47:18 +0200 Subject: is the ifdef macro supposed to work in the middle of a function? References: <15653.24783.699857.458463@beladrome.corelatus.se> Message-ID: <3D2EC1C6.AD0B8DF1@erix.ericsson.se> Perhaps more feature than bug, rather more "defined behaviour". The preprocessor parses "complete forms", and the "a(1) -> ok;" is not a complete form since it does not end with a full stop (i.e "."). So the '-ifdef' stuff can only be used to encapsulate a complete function definition. Not at all as flexible as the 'C' preprocessor, alas. / Raimo Niskanen, Erlang/OTP, Ericsson AB. Matthias Lang wrote: > > Hi, > > Feature or bug? > > ---------------------------------------------------------------------- > -module(macro). > > %% The following works > -ifdef(BLO). > b(1) -> ok. > -endif. > > %% But this does not work: macro.erl:14: unterminated '-ifdef' > -ifdef(BLA). > a(1) -> ok; > -endif. > a(2) -> ok. > ---------------------------------------------------------------------- > > Using R8B-1. > > Matthias From mikpe@REDACTED Fri Jul 12 15:33:08 2002 From: mikpe@REDACTED (Mikael Pettersson) Date: Fri, 12 Jul 2002 15:33:08 +0200 Subject: HP-UX 11 ? In-Reply-To: <013401c22933$49d93dc0$5f00a8c0@slant> References: <200207101533.g6AFXiN01858@lejon.levonline.com> <013401c22933$49d93dc0$5f00a8c0@slant> Message-ID: <15662.55956.438308.397933@kim.it.uu.se> Bruce Fitzsimons writes: > > Is anyone running OTP R8B1 under HP-UX 11 ? > > beam/beam_load.c(1357): Error loading module otp_ring0: op > > i_func_info u a a > > u: > > no specific operation found > > Failed loading preloaded module otp_ring0 > > gmake[3]: *** [../ebin/beam_lib.beam] IOT trap (core dumped) > > This is on a PA-RISC 2.0 64 bit cpu, but running in 32bit mode on HPUX 11.0. > It is running as big-endian (a la SPARC), and this is correctly identified. > Using gcc-3.0.4 and the hpux standard ld. I'm happy to post configure > output/files and do more investigation on request. Try adding a #define NO_JUMP_TABLE near the start of erts/emulator/beam/beam_load.h. My recollection of HP-(s)UX is that gcc computed gotos have serious problems, and maybe only work if gcc is configured to use GNU as and ld. (Function pointers also suck on HP-(s)UX due to their segmented memory model.) /Mikael From Bruce@REDACTED Sat Jul 13 08:45:45 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sat, 13 Jul 2002 18:45:45 +1200 Subject: HP-UX 11 ? References: <200207101533.g6AFXiN01858@lejon.levonline.com><013401c22933$49d93dc0$5f00a8c0@slant> <15662.55956.438308.397933@kim.it.uu.se> Message-ID: <00ec01c22a38$eaacbf00$4021970a@norris> Hi Mikael, > Try adding a #define NO_JUMP_TABLE near the start of erts/emulator/beam/beam_load.h. > My recollection of HP-(s)UX is that gcc computed gotos have serious problems, > and maybe only work if gcc is configured to use GNU as and ld. > > (Function pointers also suck on HP-(s)UX due to their segmented memory model.) I can see you have many fine memories of HP-SUX :-) I am not enamoured with it either. Adding the define didn't help, I'm going to do what Per suggested (offlist) and print the loaded bytes to compare against a good system. I might spray around a few more debug statements as well. If I get really keen I might even gdb it, but I'm not sure what the code should be doing if it was working. Would the erl_crash.dump be useful for anything? I've never used one... /Bruce From per@REDACTED Sat Jul 13 10:36:15 2002 From: per@REDACTED (Per Bergqvist) Date: Sat, 13 Jul 2002 09:36:15 +0100 Subject: Kernel poll (WAS: Re: getting to yaws, devpoll) In-Reply-To: <200207050809.g6589r020752@raven.levonline.com> Message-ID: <200207130736.g6D7aFH24631@hyena.levonline.com> Hi, Kernel poll support patches for OTP R8B-1 may now be downloaded from http://www.synap.se/open_source.html. I would really like to see Linux users using the /dev/kpoll. We have been running it for about 4 months now a it appears to be rock-solid. Never the less, the audience has been very limited (i.e. me and Tony). Please post me feedback. /Per ======================================================== Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From per@REDACTED Sat Jul 13 16:56:03 2002 From: per@REDACTED (Per Bergqvist) Date: Sat, 13 Jul 2002 15:56:03 +0100 Subject: Kernel poll Message-ID: <200207131356.g6DDu4m01581@hunden.levonline.com> Hi, this is certainly not my day. First my ISP mess up incoming email and takes the weekend off ... Then I release a broken patch. In the /dev/kpoll patch released this morning there are a few files missing. This have now been corrected and the patch was updated 13:04 CET. I have seen quite a few downloads but I cannot see the time in the stats provided by my ISP. Please download the patch again if the kernel build fails. Sorry for causing this mess (can't really blame my ISP for this ...:-) Per P.S. If you need to get in contact with me use chrisper@REDACTED algonet always works, (powered by erlang ...) D.S. ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From fritchie@REDACTED Sat Jul 13 21:54:20 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sat, 13 Jul 2002 14:54:20 -0500 Subject: Untimely garbage collection In-Reply-To: Message of "Wed, 10 Jul 2002 01:09:57 EDT." <20020710010957.A32879@spearce.org> Message-ID: <200207131954.g6DJsKB48440@snookles.snookles.com> In preparing for the upcoming ACM PLI Erlang workshop, I'm suddenly *very* interested in the issues Shawn raises. I'll split my comments & questions into two messages ... two short messages are harder to ignore (intentionally or accidentally) than a single long message. :-) >>>>> "sp" == Shawn Pearce writes: sp> When the second gen_server gets the binaries, it sends them to the sp> port using Port ! {self(), {command, List}}, where List is the sp> List of ErlDrvBinary objects given to Erts by the bt848 driver. The docs & erts code seem to imply that erlang:port_command/2 is the preferred way of doing that. {shrug} Would I be correct to guess that your XVideo driver defines the 'outputv' method and that its 'outputv' handler accesses the pointers inside of the ErlIOVec directly (to avoid unnecessary data copies)? sp> Initial testing showed that allocating ErlDrvBinary objects for sp> each video frame was far too costly in CPU time. The allocator is sp> just too slow. Really? You really be moving a *lot* of data through those drivers. Or, if after allocating a ErlDrvBinary, you don't have enough time to copy the frame into the new ErlDrvBinary without dropping some data? Perhaps this strategy would be useful? Have the bt848 driver allocate a single (or a small number of) ErlDrvBinary large enough to hold several frames worth of data. The driver can choose the offset in a ErlDrvBinary to deposit the next frame's data. Hrm ... it isn't obvious if this would lower your overhead or not. sp> From the perspective of my application, it would be ok sp> for my Erlang servers to notify the C drivers when they are done sp> with the binary so it can rewrite it, regardless of the refc. I had a brainstorm I had yesterday on this topic. Consider this example from the SWIG (http://www.swig.org/) documentation: # Copy a file def filecopy(source,target): f1 = fopen(source, "r") f2 = fopen(target, "w") buffer = malloc(8192) nbytes = fread(buffer,8192,1,f1) while (nbytes > 0): fwrite(buffer,8192,1,f2) nbytes = fread(buffer,8192,1,f1) free(buffer) An Erlang driver cannot implement malloc and fread in this manner because of its assumption of multiple assignment. But, what if the local Erlang process knew that certain binaries were multiple-assignment-capable? Then it could safely work like filecopy above *if* it were written carefully. This might be viable if two things were added: 1. If the owner process of such a binary were to send it to another process, the ErlDrvBinary data would be _copied_ so that the multiple-assignment-ignorant receiver could blissfully assume single-assignment semantics? 2. The driver implemented a copy method so that the owner process could make a single-assignment "snapshot" of the multiple-assignment binary for long-term keeping. Is this a good idea? {shrug} -Scott From fritchie@REDACTED Sat Jul 13 22:00:46 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sat, 13 Jul 2002 15:00:46 -0500 Subject: Aggressive GC? Was Re: Untimely garbage collection In-Reply-To: Message of "Wed, 10 Jul 2002 01:09:57 EDT." <20020710010957.A32879@spearce.org> Message-ID: <200207132000.g6DK0kB48466@snookles.snookles.com> While hacking drivers, I've come across a GC question, similar to Shawn's, that I cannot answer. Consider this code snippet: iolist2binary(B) when binary(B) -> {B, size(B)}; iolist2binary(L) when List(L) -> B = list_to_binary(L), {B, size(B)}. foofoo(Port, IOList) when port(Port) -> {IOListBinary, IOListBinaryLen} = iolist2binary(IOList), C = [ <>, IOListBinary], erlang:port_command(Port, C), %% Vulnerability window begins here? get_port_reply(Port). get_port_reply(Port) -> receive {Port, ok} -> ok; [...] Assume: 1. The driver caches the pointer to IOListBinary's data buffer. This permits the driver to avoid making a copy of that data buffer: it can access the binary's data buffer directly. 2. The driver is implemented asynchonously, using a separate Pthread. Thus the VM can do other work while the driver's Pthread takes an arbitrary amount of time to do whatever it does. My question: Is it possible for the VM's GC to decrement IOListBinary's refcount in the time between execution of the port_command() and the receive? If the VM's GC were extremely aggressive(*), then if a GC happened at "Vulnerability window begins here?", then: a. IOListBinary's refcount could go to zero: if the original IOList were a deep byte list, then foofoo() is the only thing that knows about IOListBinary, so its refcount would drop to zero. b. Disaster! The driver's cached pointer to IOListBinary's data buffer is invalid. The driver is executing independently of the VM's Pthread, so there's no guarantee that the driver will use the pointer before the pointer becomes invalid. -Scott (*) If the GC system can figure out that a binding has not yet gone out of scope yet *but* that binding will never be used again, then ... I'm in trouble. From mickael.remond@REDACTED Sun Jul 14 12:19:00 2002 From: mickael.remond@REDACTED (mickael.remond@REDACTED) Date: Sun, 14 Jul 2002 12:19:00 +0200 Subject: Yaws API discussion Message-ID: <20020714101918.444051691@relay-1v.club-internet.fr> Hello, I feel that there is a need to improve an aspect of yaws api. The ssi function can be used to include some external html template. My need is to be able to add some dynamic generated values (for example the title in the html header portion) I am thinking on the best way to do that. The most evident thing is to pass a dictionnary of substitution that needs to be performed in the included file. I think it might not be interesting to implement nested evaluation of included files. What do you think ? Any clever idea ? -- Micka?l R?mond http://www.erlang-fr.org/ From spearce@REDACTED Sun Jul 14 15:57:36 2002 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jul 2002 09:57:36 -0400 Subject: Untimely garbage collection In-Reply-To: <200207131954.g6DJsKB48440@snookles.snookles.com> References: <20020710010957.A32879@spearce.org> <200207131954.g6DJsKB48440@snookles.snookles.com> Message-ID: <20020714095736.B41543@spearce.org> >>>>> "slf" == Scott Lystig Fritchie scrawled: slf> >>>>> "sp" == Shawn Pearce writes: slf> sp> When the second gen_server gets the binaries, it sends them to the slf> sp> port using Port ! {self(), {command, List}}, where List is the slf> sp> List of ErlDrvBinary objects given to Erts by the bt848 driver. slf> slf> The docs & erts code seem to imply that erlang:port_command/2 is the slf> preferred way of doing that. {shrug} Learn something new every day. Thanks, I'll update my code. slf> Would I be correct to guess that your XVideo driver defines the slf> 'outputv' method and that its 'outputv' handler accesses the pointers slf> inside of the ErlIOVec directly (to avoid unnecessary data copies)? Yes. Because the binaries are much larger than the 4*ERL_ONHEAP_BIN_LIMIT (which in R8B-1 is 256 bytes), Erts won't combine them into a single binary. Instead I get the group of them as an ErlIoVec, which I then just take the binaries out of. However, my code is "poor" in that the data stored within the binary must start at the first byte of the ErlDrvBinary. In reality, the ErlIoVec may point to a byte within the binary, not at the start. This can occur if the binary actually came from another driver, but the driver used an offset to skip some leading number of bytes, or if Erts "splits" the binary into two subbinaries without copying the data. I guess that would be a 'bug' that I should address at some point. Right now the only binaries I am dealing with are controlled by other drivers I've also written. slf> sp> Initial testing showed that allocating ErlDrvBinary objects for slf> sp> each video frame was far too costly in CPU time. The allocator is slf> sp> just too slow. slf> slf> Really? You really be moving a *lot* of data through those drivers. slf> Or, if after allocating a ErlDrvBinary, you don't have enough time to slf> copy the frame into the new ErlDrvBinary without dropping some data? slf> slf> Perhaps this strategy would be useful? Have the bt848 driver allocate slf> a single (or a small number of) ErlDrvBinary large enough to hold slf> several frames worth of data. The driver can choose the offset in a slf> ErlDrvBinary to deposit the next frame's data. Hrm ... it isn't slf> obvious if this would lower your overhead or not. Eh. Its digital video. Frames of digital video are not exactly what I'd call small. Plus I have digital audio too, but those are quite small compared to the digital video frames. It was "initial" testing, my test consisted of a very small Erlang driver and module, was run several times in a couple of hours, and that was that. I may very well have done something in that test that wasn't close enough to real life, giving me bad results. Part of the problem with allocating a frame (or even a group of frames) every time I need them, rather than reusing ErlDrvBinarys is that i could potentially explode my memory heap quite dramatically. If a video compressor gets behind, I'll still be capturing video frames at "wire speed". I'll never get any back pressure from the compressor to slow down the capture engine, forcing the capture engine to just skip capturing frames. I could setup my own counters and stuff and have the video compressor send a message to the capture driver when the video compressor starts to see that its queue is getting long I guess... It just seemed so much more convienent to let the driver "own" an ErlDrvBinary, and when that binary's refc == 1, reuse it. With a fixed number of binaries, its possible for the driver to feel the backpressure very quickly, as the video compressor won't be "releasing" binaries by setting their refc to 1. slf> sp> From the perspective of my application, it would be ok slf> sp> for my Erlang servers to notify the C drivers when they are done slf> sp> with the binary so it can rewrite it, regardless of the refc. slf> slf> I had a brainstorm I had yesterday on this topic. Consider this slf> example from the SWIG (http://www.swig.org/) documentation: slf> slf> # Copy a file slf> def filecopy(source,target): slf> f1 = fopen(source, "r") slf> f2 = fopen(target, "w") slf> buffer = malloc(8192) slf> nbytes = fread(buffer,8192,1,f1) slf> while (nbytes > 0): slf> fwrite(buffer,8192,1,f2) slf> nbytes = fread(buffer,8192,1,f1) slf> free(buffer) slf> slf> An Erlang driver cannot implement malloc and fread in this manner slf> because of its assumption of multiple assignment. slf> slf> But, what if the local Erlang process knew that certain binaries were slf> multiple-assignment-capable? Then it could safely work like filecopy slf> above *if* it were written carefully. This might be viable if two slf> things were added: slf> slf> 1. If the owner process of such a binary were to send it slf> to another process, the ErlDrvBinary data would be _copied_ so slf> that the multiple-assignment-ignorant receiver could slf> blissfully assume single-assignment semantics? slf> slf> 2. The driver implemented a copy method so that the owner slf> process could make a single-assignment "snapshot" of the slf> multiple-assignment binary for long-term keeping. slf> slf> Is this a good idea? {shrug} I don't like this idea that much. What I was thinking about instead was a way for a driver to "register" interest in an ErlDrvBinary's refc mutation. For example: void my_watcher(ErlDrvData ref0, ErlDrvBinary theBinary) { fprintf(stderr, "%p now has %i users\r\n", theBinary, theBinary->refc); } ErlDrvBinary* b = driver_alloc_binary(8192); driver_watch_binary(ref0, b, my_watcher); Then when Erts decrements refc during GC in a process we can see that because Erts called the my_watcher function with the driver's own data object and the binary in question. Then the Erlang code could do: % Copy a file filecopy(source,target) -> {ok, F1} = file:open(source, [read, raw, binary]), {ok, F2} = file:open(target, [write, raw, binary]), filecopy2(F1, F2). filecopy2(F1, F2) -> erlang:garbage_collect(), filecopy2(F1, F2, file:read(F1, 8192)). filecopy2(F1, F2, {ok, Buffer}) -> file:write(F2, Buffer), filecopy2(F1, F2); filecopy2(F1, F2, eof) -> file:close(F1), file:close(F2), ok; filecopy2(F1, F2, {error, Info}) -> file:close(F1), file:close(F2), exit({error, Info}). Initally, the F1 driver would check during the call to file:read to see if a buffer has been allocated of that size. If it has not, it would allocate it, if it has, it would reuse that buffer, so long as refc == 1. The erlang:garbage_collect() call would be to force the process to release its reference to the binary so that the driver's my_watcher would be called, allowing the driver to see the refc decrease and put that binary back into its list of usable buffers. This is admittedly a stupid example, as the driver could have just checked for refc == 1 during file:read. This works today in R8B-1, and I use that to some extent. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From spearce@REDACTED Sun Jul 14 15:34:44 2002 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jul 2002 09:34:44 -0400 Subject: Aggressive GC? Was Re: Untimely garbage collection In-Reply-To: <200207132000.g6DK0kB48466@snookles.snookles.com> References: <20020710010957.A32879@spearce.org> <200207132000.g6DK0kB48466@snookles.snookles.com> Message-ID: <20020714093444.A41543@spearce.org> My understanding of this (and the way I'm using it in my drivers) is this: When port_command/2 returns, the driver's outputv method (or just output) has been called and returned already. This can be seen also when just using Port ! {self, {command, List}}, the driver's outputv function is called while the message is being sent. The send operation doesn't proceed to the next operation in your Erlang code until the driver has completed its outputv work. Since the driver wants to hold the binary for some period of time, it must increment the refc of any ErlDrvBinary which it wants to keep, before it returns from the outputv function. This sets the refc to be one higher than the number of Erlang processes still using the binary. When the Erlang GC kicks in at your vunerability window, it decrements the refc of the binary, but discovers that the refc is still > 0, so it leaves the binary alone. The driver calls driver_free_binary at some point in the future, which decrements refc and determines that refc == 0, so it deallocates the binary. Therefore, the situation you are describing cannot occur. Of course, since the driver is a pthread, you do have to be very careful about the interaction with Erts. If you are using the async driver interface provided by Erts, you cannot make emulator calls like driver_free_binary or driver_output_term from within the background pthread. They can only be made from the main Erts thread that your erl_drv_entry functions are invoked on. In my bt848 driver case, I spawn my own pthread when the port is setup. This pthread uses a mutex and a pipe to communicate with the Erts thread, and all Erts interactions occur on the only when Erts calls my driver's erl_drv_entry functions. In the outputv method of my driver, I increment refc, store them in a memory space shared with the pthread, and signal the pthread to wake up. When the pthread is done with the binary, it signals Erts over the pipe, and my ready_input driver method decrements the refc (and deallocates the binary if necessary). Synchronization between the Erts thread and my background pthread is done through a pthread mutex, which is locked and unlocked in the outputv/read_input functions. outputv: ev->binv[1]->refc++; // I want to keep this binary! pthread_mutex_lock(&ref->lock); // Sync with my pthread ref->the_binary = ev->binv[1]; pthread_cond_signal(&ref->cond); // Wakup pthread pthread_mutex_unlock(&ref->lock); // Unsync ready_input: read(ref->pipe_in, &_junk, 1); pthread_mutex_lock(&ref->lock); driver_free_binary(ref->the_binary); ref->the_binary = NULL; pthread_mutex_unlock(&ref->lock); bgthread_worker: pthread_mutex_lock(&ref->lock); for(;;) { while(!ref->the_binary) pthread_cond_wait(&ref->cond, &ref->lock); // Work with the_binary ... // Signal Erts we are done. write(ref->pipe_out, &ref, 1); } pthread_mutex_unlock(&ref->lock); The actual code is a little bit more complex, but this is the very simple version of it. Erts basically does the right thing, the question is, does your driver? ;-) Plus, I don't think the GC would necessarily occur at a function call. I think you'd need to trip it by allocating memory or calling erlang:garbage_collect() explicitly. Scott Lystig Fritchie scrawled: > While hacking drivers, I've come across a GC question, similar to > Shawn's, that I cannot answer. > > Consider this code snippet: > > iolist2binary(B) when binary(B) -> > {B, size(B)}; > iolist2binary(L) when List(L) -> > B = list_to_binary(L), > {B, size(B)}. > > foofoo(Port, IOList) when port(Port) -> > {IOListBinary, IOListBinaryLen} = iolist2binary(IOList), > C = [ <>, IOListBinary], > erlang:port_command(Port, C), > %% Vulnerability window begins here? > get_port_reply(Port). > > get_port_reply(Port) -> > receive > {Port, ok} -> ok; > [...] > > Assume: > > 1. The driver caches the pointer to IOListBinary's data > buffer. This permits the driver to avoid making a copy of > that data buffer: it can access the binary's data buffer > directly. > > 2. The driver is implemented asynchonously, using a separate > Pthread. Thus the VM can do other work while the driver's > Pthread takes an arbitrary amount of time to do whatever it > does. > > My question: Is it possible for the VM's GC to decrement > IOListBinary's refcount in the time between execution of the > port_command() and the receive? If the VM's GC were extremely > aggressive(*), then if a GC happened at "Vulnerability window begins > here?", then: > > a. IOListBinary's refcount could go to zero: if the original > IOList were a deep byte list, then foofoo() is the only thing > that knows about IOListBinary, so its refcount would drop to > zero. > > b. Disaster! The driver's cached pointer to IOListBinary's > data buffer is invalid. The driver is executing independently > of the VM's Pthread, so there's no guarantee that the driver > will use the pointer before the pointer becomes invalid. > > -Scott > > (*) If the GC system can figure out that a binding has not yet gone > out of scope yet *but* that binding will never be used again, then > ... I'm in trouble. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From bjorn@REDACTED Sun Jul 14 17:32:38 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Jul 2002 17:32:38 +0200 Subject: Aggressive GC? Was Re: Untimely garbage collection In-Reply-To: Scott Lystig Fritchie's message of "Sat, 13 Jul 2002 15:00:46 -0500" References: <200207132000.g6DK0kB48466@snookles.snookles.com> Message-ID: Answer to the part about the GC: Scott Lystig Fritchie writes: > While hacking drivers, I've come across a GC question, similar to > Shawn's, that I cannot answer. > > Consider this code snippet: > > iolist2binary(B) when binary(B) -> > {B, size(B)}; > iolist2binary(L) when List(L) -> > B = list_to_binary(L), > {B, size(B)}. > > foofoo(Port, IOList) when port(Port) -> > {IOListBinary, IOListBinaryLen} = iolist2binary(IOList), > C = [ <>, IOListBinary], > erlang:port_command(Port, C), > %% Vulnerability window begins here? Yes. If your driver haven't incremented the reference counter, you are in trouble. The compiler knows that the variables C and IOListBinary will not be used anymore; therefore, at this point no reference to them will be kept, and the next garbage collection the reference counts for the binaries will be decremented. > get_port_reply(Port). > > get_port_reply(Port) -> > receive > {Port, ok} -> ok; > [...] > /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From Sean.Hinde@REDACTED Sun Jul 14 22:56:26 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Sun, 14 Jul 2002 21:56:26 +0100 Subject: Untimely garbage collection Message-ID: <04D356A3B172D611981B0008C791C3126BF198@imp02mbx.t-mobile.co.uk> > Suddenly this has stopped working. My C drivers are > seizing when they run out of binaries, and all of the > binaries have a refc of 3: one for the driver that > "owns" the binary, and one for each gen_server process. I had this problem once when developing my (now abandoned - mnesia got even better :) ) SQL driver. The solution turned out to be sipmly that I was testing from the shell which also retained the binaries in it's result history! Otherwise binaries got GC'd very quickly and I could rely on the refc no problem. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Sean.Hinde@REDACTED Sun Jul 14 23:01:15 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Sun, 14 Jul 2002 22:01:15 +0100 Subject: Yaws API discussion Message-ID: <04D356A3B172D611981B0008C791C3126BF199@imp02mbx.t-mobile.co.uk> Hi, > The ssi function can be used to include some external html > template. My need is to be able to add some dynamic generated > values (for example the title in the html header portion) Perhaps some combination of yaws and esp is needed. I attach my somewhat hacked version of esp which stores parsed pages in mnesia and allows both a dictionary to be passed in and mixed erlang/html. There is some documentation on how to use it. Ideally I agree this concept would be fully implemented into yaws in some way.. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. -------------- next part -------------- A non-text attachment was scrubbed... Name: esp.erl Type: application/octet-stream Size: 8807 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From apeake@REDACTED Mon Jul 15 00:04:13 2002 From: apeake@REDACTED (Alex Peake) Date: Sun, 14 Jul 2002 15:04:13 -0700 Subject: Beginner help with distributed Erlang Message-ID: I am just starting to try distributed Erlang. I am in the Windows 2000 world. I have two machines in a domain (FEY). On machine 1 (the server) called predator I start Erlang: erl -name predator I get: (predator@REDACTED)1> So far so good (I think). On machine 2 (the client) called functional I start Erlang: werl -name functional I get: (functional@REDACTED)1> OK so far (I think). I try: net_adm:names(predator). and get: {ok,[{"predator",4888}]} which I think is OK (4888 is what I get over on predator for net_adm:names(). Now when I try from functional: net_adm:ping('predator@REDACTED'). I get pang, and I see on the predator screen: ** Connection attempt from disallowed node 'functional@REDACTED' I tried the sample banking example from the book (chapter 6) and of course receive similar responses. I tried (on the server): net_kernel:allow('functional@REDACTED'). and get: ok However, I still get the same: ** Connection attempt from disallowed node 'functional@REDACTED' Can someone help me please? What am I missing? Alex From thomas@REDACTED Mon Jul 15 01:16:40 2002 From: thomas@REDACTED (Thomas Lange) Date: Mon, 15 Jul 2002 01:16:40 +0200 Subject: Beginner help with distributed Erlang References: Message-ID: <3D320658.A33000AA@corelatus.com> You have to set a cookie for each node to be able to use the erlang distibution. -setcookie My_cookie Of course, the cookie should be the same on both nodes ;-) /Thomas Alex Peake wrote: > > I am just starting to try distributed Erlang. > > I am in the Windows 2000 world. I have two machines in a domain (FEY). > > On machine 1 (the server) called predator I start Erlang: > erl -name predator > I get: > (predator@REDACTED)1> > > So far so good (I think). > > On machine 2 (the client) called functional I start Erlang: > werl -name functional > I get: > (functional@REDACTED)1> > > OK so far (I think). > > I try: > net_adm:names(predator). > and get: > {ok,[{"predator",4888}]} > > which I think is OK (4888 is what I get over on predator for net_adm:names(). > > Now when I try from functional: > net_adm:ping('predator@REDACTED'). > I get pang, and I see on the predator screen: > ** Connection attempt from disallowed node 'functional@REDACTED' > > I tried the sample banking example from the book (chapter 6) and of course receive similar > responses. > > I tried (on the server): > net_kernel:allow('functional@REDACTED'). > and get: > ok > > However, I still get the same: > ** Connection attempt from disallowed node 'functional@REDACTED' > > Can someone help me please? What am I missing? > > Alex From spearce@REDACTED Mon Jul 15 02:00:34 2002 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jul 2002 20:00:34 -0400 Subject: Untimely garbage collection In-Reply-To: <04D356A3B172D611981B0008C791C3126BF198@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF198@imp02mbx.t-mobile.co.uk> Message-ID: <20020714200034.A66572@spearce.org> I know this isn't my problem. If I got the 30+ binaries, each over 128K apiece back in my shell, it'd choke. I'd dreged through most of the processes in my Erlang node, it doesn't look like they are stuck in anybody's message queue either. I had figured my strategy would work well, as it had been at one point about two weeks ago. I also checked most of the Erts source code, and in R8B-1 the binary should get collected and its refc updated immediately during a call to erlang:garbage_collect(). I recently concluded about two days ago that I may not have all of the cases worked out on interaction between my background pthread and Erts. I think I am going to revisit them and see what might be missing. As an intersting side note, the refc's are messed up unless I use fprintf(stderr, "test!\r\n") in my driver. That causes the refc's to be correct. Cute. Clearly something is wrong. And I think Sean Hinde is right, what I am trying to do should just work, providing my thread communication is correct. Sean Hinde scrawled: > > Suddenly this has stopped working. My C drivers are > > seizing when they run out of binaries, and all of the > > binaries have a refc of 3: one for the driver that > > "owns" the binary, and one for each gen_server process. > > I had this problem once when developing my (now abandoned - mnesia got even > better :) ) SQL driver. The solution turned out to be sipmly that I was > testing from the shell which also retained the binaries in it's result > history! > > Otherwise binaries got GC'd very quickly and I could rely on the refc no > problem. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From fritchie@REDACTED Mon Jul 15 05:01:32 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 14 Jul 2002 22:01:32 -0500 Subject: Aggressive GC? Was Re: Untimely garbage collection In-Reply-To: Message of "14 Jul 2002 17:32:38 +0200." Message-ID: <200207150301.g6F31WB54761@snookles.snookles.com> >>>>> "bg" == Bjorn Gustavsson writes: bg> Yes. If your driver haven't incremented the reference counter, you bg> are in trouble. bg> The compiler knows that the variables C and IOListBinary will not bg> be used anymore; therefore, at this point no reference to them bg> will be kept, and the next garbage collection the reference counts bg> for the binaries will be decremented. Those darn smart compilers! They are so, umm, smart! {sigh} It's good to know that my current driver implementation is broken. I don't wanna fix it, but I guess there's a price to pay for 100% correct behavior. It's so sad when 99.99% correctness isn't good enough. Referring back to one of Shawn's messages ... I hadn't ever paid attention to the "binv" member of the ErlIOVec structure. Now I'm quite interested! The serialization scheme needed to get data into the driver is very annoying -- I was under the impression that the ErlIOVec completely hid the serialized data from me. It's nice to know I'm wrong. I had discovered a problem with non-binary data in an I/O list: write_port() allocates a buffer, "cbin" of "csize", for all non-binary data. write_port() frees that buffer immediately after calling the driver's "outputv" method. My thinking was: it's unsafe for an asynchronous driver to try to access the non-binary data stored in "cbin", so I'd force the Erlang code calling the driver to create binaries for any non-binary data. ... However, upon another examination, write_port() is using driver_alloc_binary(), *not* sys_alloc_from() or safe_alloc_from(). Driver binaries have a reference count! If my driver increments the refc of that thing, then I don't have to make the Erlang-side code so contorted when given non-binary data. Yay! -Scott From per@REDACTED Mon Jul 15 09:35:25 2002 From: per@REDACTED (Per Bergqvist) Date: Mon, 15 Jul 2002 08:35:25 +0100 Subject: Untimely garbage collection In-Reply-To: <20020714200034.A66572@spearce.org> Message-ID: <200207150635.g6F6ZQQ16468@sork.levonline.com> Your strategy should be working, I use more or less the same in several drivers and it is the most efficient scheme I have figured out so far. 1) the driver have two logical threads a) the vm itself and b) a worker thread. 2) in the outputv thread a) make a copy of ErlIOVec,SysIOVec AND the ErlDrvBinary vector in ErlIOVec. NOTE that it is simply the array of pointers to the real ErlDrvBinaries. Store this in the drivers context. 3) For each element in the ErlDrvBinaries update refc. 4) signal is some way (i.e. use pipes) to thread b) to do the actual processing and return from outputv. The vm may now do the gc as it likes since the refc's are correct. 5) when thread b) is done with the chunk it signal over the pipe to thread a). 6) When ready_input is called in thread a) decrement the refc's for all elements in the ErlDrvBinaries vector. Deallocate the ErlDrvBinary vector, ErlIOVec and SysIOVec. For a simple implementation use the the set_busy_port in step 2) and 6). The more ambitious approach is to allow multiple outstanding outputv requests. /Per > I know this isn't my problem. If I got the 30+ binaries, each > over 128K apiece back in my shell, it'd choke. > > I'd dreged through most of the processes in my Erlang node, it > doesn't look like they are stuck in anybody's message queue > either. > > I had figured my strategy would work well, as it had been > at one point about two weeks ago. I also checked most of > the Erts source code, and in R8B-1 the binary should > get collected and its refc updated immediately during > a call to erlang:garbage_collect(). > > I recently concluded about two days ago that I may not > have all of the cases worked out on interaction between > my background pthread and Erts. I think I am going to > revisit them and see what might be missing. > > As an intersting side note, the refc's are messed up > unless I use fprintf(stderr, "test!\r\n") in my > driver. That causes the refc's to be correct. Cute. > Clearly something is wrong. > > And I think Sean Hinde is right, what I am trying to > do should just work, providing my thread communication is > correct. > > Sean Hinde scrawled: > > > Suddenly this has stopped working. My C drivers are > > > seizing when they run out of binaries, and all of the > > > binaries have a refc of 3: one for the driver that > > > "owns" the binary, and one for each gen_server process. > > > > I had this problem once when developing my (now abandoned - mnesia got even > > better :) ) SQL driver. The solution turned out to be sipmly that I was > > testing from the shell which also retained the binaries in it's result > > history! > > > > Otherwise binaries got GC'd very quickly and I could rely on the refc no > > problem. > > -- > Shawn. > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From johan.blom@REDACTED Mon Jul 15 09:52:42 2002 From: johan.blom@REDACTED (Johan Blom) Date: 15 Jul 2002 09:52:42 +0200 Subject: inet driver problem Message-ID: <1026719562.1244.21.camel@knocker> Hi, found a bug in the OTP-R8B-1 version of inet_drv.c when concurrently sending and receiving from the same socket in passive mode. Sometimes a gen_tcp:recv/3 could be just hanging infinitely while sending on the same socket. This should now be fixed with the following patch. Johan Blom Mobile Arts -------------- next part -------------- --- inet_drv.c-orig Fri Jul 12 11:50:40 2002 +++ inet_drv.c Fri Jul 12 11:53:08 2002 @@ -5779,6 +5779,8 @@ } else { tcp_clear_output(desc); + tcp_clear_input(desc); + tcp_close_check(desc); inet_close(INETP(desc)); inet_reply_error_am(INETP(desc), am_closed); } From sgelkins@REDACTED Mon Jul 15 17:26:25 2002 From: sgelkins@REDACTED (Steve Elkins) Date: 15 Jul 2002 11:26:25 -0400 Subject: Building R8B-1 on OpenBSD 3.1 Message-ID: <87ptxp3tcu.fsf@d8tv0m01.rdu.bellsouth.net> Hi, R8B-0 builds without incident. Just got around to building R8B-1 and ran into this... gcc -c -o ../priv/obj/i386-unknown-openbsd3.1/memsup.o -g -O2 \ -I/home/sge/build/otp_src_R8B-1/erts/i386-unknown-openbsd3.1 \ -DHAVE_CONFIG_H memsup.c memsup.c:102: vm/vm_param.h: No such file or directory gmake[4]: *** [../priv/obj/i386-unknown-openbsd3.1/memsup.o] Error 1 gmake[4]: Leaving directory `/home/sge/build/otp_src_R8B-1/lib/os_mon/c_src' ...which must've happened because BSD4_4 was defined. Changed line 102 of the file from... #include ...to... #include ...and it compiled, but I'm sure the PTB have better ways of addressing such issues. Just thought I ought to report the hack. And what does the change do anyway? How can I find out if compiling it produces something that runs? Thanks, Steve From cyberlync@REDACTED Mon Jul 15 19:14:23 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 15 Jul 2002 10:14:23 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <20020714101918.444051691@relay-1v.club-internet.fr> Message-ID: <20020715171423.75481.qmail@web40207.mail.yahoo.com> Mickael, Per your request I am going to make a few suggestions. I would, however, warn readers that I will be swimming in what some consider a holy war area. I do not intend any kind of little war here, I am just providing suggestions based on my experience and knowlege. I believe that the problem you are having stems from a core problem with the paradigm yaws has adopted. Yaws, like PHP and JSP Scriptlets, is founded upon the idea that actual logic should be embedded in the html page. This is a bad thing(TM). It limits scalability of the application by quite a bit. I am not refering to scalability in terms of speed or performance, but to scalablity in terms of application size, reliablity/maintenance, and extensablility. I am rambling here so forgive me. Back in the early '80s users of smalltalk realized that the ui design paradigms of the time were lacking for large projects. To address the issue they came up with a paradigm called MVC (Model, View, Controller). This basically stated that your model (data, logic) should be seperated from your controller (flow control logic) and all of that should be seperated from your view code. It eventually was expoused that the view code should be extreamly limited. In that it only allows you to manipulate data provided from your model layer. This was a really good idea for UIs, and when the WEB came about it proved to be a really good idea for webapplications as well. To use some hisorical examples, the inventors of JSP realized this same issue after they released the first JSP specification. In that original specification JSPs allowed only scriptlets (which is java code imbedded in the html and delimited by <% %> tags). This approach was obviously not MVC like in any way. In fact, it cuased quite allot of headaches for developers then (and even in somecases now). Thier next release included the idea of 'TagLibs' which are custom tags that use data from provided from some backend process (via session and request variables). Now the use of scriptlets are frowned upon almost universally and are actaully not allowed to be used in most big projects. This still wasn't really a complete MVC solution as the coder had to code allot of the controller and logic framework himself, but it did provide a foundation. Projects like Struts have made good use of this foundation and provide full blown MVC frameworks now. Using these frameworks has made web application programming much much easier. Well to get back to your problem. If your Model/Controller layer only provided data to your view and your view simply made use of that data all you would need to do is include the header and it could make use of all the data that was globally available in the page. In JSPs that is simply an <@include 'page location'> directive. The included page then simply makes use of the data already provided. I realize that the yaws api is based to quite a large extent on PHP, but PHP is a very poor choice for large, extensable applications. Don,t get me wrong PHP is a great thing for quick and dirty applications. Basically for those applications that only span a few pages or that are only designed to live a short time. Anything beyond that and PHP starts to fall down. I would suggest that you take a look at some of the Java page rendering technology. They have allot of experience in this type of thing by now. Probably start out with the taglib stuff and then take a look at Struts (available at jakarta.apache.org/struts). Perhaps also take a look at webmacro (www.webmacro.org) and velocity (jakarta.apache.org/velocity). I personally like the idea of taglibs and compiled pages (I think they are much faster), but the template engines and thier restricted data manipulation langauges are nice as well. I guess I went kind of long, sorry. I also hope I did not get anyone too angry. Thanks, Eric --- mickael.remond@REDACTED wrote: > Hello, > > I feel that there is a need to improve an aspect of > yaws api. > > The ssi function can be used to include some > external html template. My need is to be able to add > some dynamic generated values (for example the title > in the html header portion) > > I am thinking on the best way to do that. The most > evident thing is to pass a dictionnary of > substitution that needs to be performed in the > included file. > > I think it might not be interesting to implement > nested evaluation of included files. > > What do you think ? > Any clever idea ? > > -- > Micka?l R?mond > http://www.erlang-fr.org/ > __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From apeake@REDACTED Mon Jul 15 19:51:59 2002 From: apeake@REDACTED (Alex Peake) Date: Mon, 15 Jul 2002 10:51:59 -0700 Subject: Yaws API discussion In-Reply-To: <20020715171423.75481.qmail@web40207.mail.yahoo.com> Message-ID: Let me state a counter-point. Microsoft, in its release of ASP.NET also took this approach of separating the UI from the data. However, they have just released a product called WebMatrix, which goes back to the "old" way - my guess is that too many people are comfortable with the "mixed" approach and so Microsoft responded. >From my own point of view, I have built large dynamic web sites with this mixed approach, and have had no problems evolving the solution at all. Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Eric Merritt > Sent: Monday, July 15, 2002 10:14 AM > To: mickael.remond@REDACTED; erlang-questions@REDACTED > Subject: Re: Yaws API discussion > > > Mickael, > > Per your request I am going to make a few > suggestions. I would, however, warn readers that I > will be swimming in what some consider a holy war > area. I do not intend any kind of little war here, I > am just providing suggestions based on my experience > and knowlege. > > I believe that the problem you are having stems from a > core problem with the paradigm yaws has adopted. Yaws, > like PHP and JSP Scriptlets, is founded upon the idea > that actual logic should be embedded in the html page. > This is a bad thing(TM). It limits scalability of the > application by quite a bit. I am not refering to > scalability in terms of speed or performance, but to > scalablity in terms of application size, > reliablity/maintenance, and extensablility. > > I am rambling here so forgive me. Back in the early > '80s users of smalltalk realized that the ui design > paradigms of the time were lacking for large projects. > To address the issue they came up with a paradigm > called MVC (Model, View, Controller). This basically > stated that your model (data, logic) should be > seperated from your controller (flow control logic) > and all of that should be seperated from your view > code. It eventually was expoused that the view code > should be extreamly limited. In that it only allows > you to manipulate data provided from your model layer. > > > This was a really good idea for UIs, and when the WEB > came about it proved to be a really good idea for > webapplications as well. > > To use some hisorical examples, the inventors of JSP > realized this same issue after they released the first > JSP specification. In that original specification JSPs > allowed only scriptlets (which is java code imbedded > in the html and delimited by <% %> tags). This > approach was obviously not MVC like in any way. In > fact, it cuased quite allot of headaches for > developers then (and even in somecases now). Thier > next release included the idea of 'TagLibs' which are > custom tags that use data from provided from some > backend process (via session and request variables). > Now the use of scriptlets are frowned upon almost > universally and are actaully not allowed to be used in > most big projects. This still wasn't really a complete > MVC solution as the coder had to code allot of the > controller and logic framework himself, but it did > provide a foundation. Projects like Struts have made > good use of this foundation and provide full blown MVC > frameworks now. Using these frameworks has made web > application programming much much easier. > > > Well to get back to your problem. If your > Model/Controller layer only provided data to your view > and your view simply made use of that data all you > would need to do is include the header and it could > make use of all the data that was globally available > in the page. In JSPs that is simply an <@include 'page > location'> directive. The included page then simply > makes use of the data already provided. > > I realize that the yaws api is based to quite a large > extent on PHP, but PHP is a very poor choice for > large, extensable applications. Don,t get me wrong PHP > is a great thing for quick and dirty applications. > Basically for those applications that only span a few > pages or that are only designed to live a short time. > Anything beyond that and PHP starts to fall down. > > I would suggest that you take a look at some of the > Java page rendering technology. They have allot of > experience in this type of thing by now. Probably > start out with the taglib stuff and then take a look > at Struts (available at jakarta.apache.org/struts). > Perhaps also take a look at webmacro > (www.webmacro.org) and velocity > (jakarta.apache.org/velocity). I personally like the > idea of taglibs and compiled pages (I think they are > much faster), but the template engines and thier > restricted data manipulation langauges are nice as > well. > > I guess I went kind of long, sorry. I also hope I did > not get anyone too angry. > > Thanks, > Eric > > --- mickael.remond@REDACTED wrote: > > Hello, > > > > I feel that there is a need to improve an aspect of > > yaws api. > > > > The ssi function can be used to include some > > external html template. My need is to be able to add > > some dynamic generated values (for example the title > > in the html header portion) > > > > I am thinking on the best way to do that. The most > > evident thing is to pass a dictionnary of > > substitution that needs to be performed in the > > included file. > > > > I think it might not be interesting to implement > > nested evaluation of included files. > > > > What do you think ? > > Any clever idea ? > > > > -- > > Mickakl Rimond > > http://www.erlang-fr.org/ > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Autos - Get free new car price quotes > http://autos.yahoo.com > From cyberlync@REDACTED Mon Jul 15 21:02:06 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 15 Jul 2002 12:02:06 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: Message-ID: <20020715190206.59615.qmail@web40205.mail.yahoo.com> Alex, I am glad that you had success. I would guess (not having looked at the code I could very well be wrong here) that you may have used parts of MVC even if you didn't use a framework or werent thinking about it conciously. I have seen this happen quite allot with other types of patterns. Programmers reinvent patterns (like singletons in OO) all the time without ever knowing it. Even if you didnt go this route I think that a decent coder can make either approach work. I would make the argument that using MVC makes it much easier and increases your chance of success especially for mediocre programmers or those without allot of experience. In my opinion, really good coder could probably write a dynamic, extensably app in brainf**k but I would want to do it myself. For that matter I wouldnt want to be the one to maintain it after he leaves. As for Microsofts solution IBM tried to do the samething with a project call Net.Data that failed pretty miserably. My other argument is that Microsoft (like many companies) tends to target the lowest common denominator with its products. In this instance, I woulds say that the lowest common denominator here are those mediocre programmers mentioned above. Doing things right and according to a set pattern makes things much more difficult in the begining, but over time it pays off. Many programmers either just want to get it done quick, or dont think about the long term, hence the preference for the embedded solutions like PHP/ASP. This may be the reason Microsoft decided to go back to the 'old' solution. In any case, I congradulate you on your success and thank you for your opposing viewpoint. Thanks, Eric Ps. please excuse my terrible spelling, yahoo still hasn't gotten the spellcheck feature to work in mozilla. --- Alex Peake wrote: > Let me state a counter-point. > > Microsoft, in its release of ASP.NET also took this > approach of separating the UI from the data. > However, they have just released a product called > WebMatrix, which goes back to the "old" way - my > guess is that too many people are comfortable with > the "mixed" approach and so Microsoft responded. > > From my own point of view, I have built large > dynamic web sites with this mixed approach, and have > had no problems evolving the solution at all. > > Alex > > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED]On > Behalf Of Eric Merritt > > Sent: Monday, July 15, 2002 10:14 AM > > To: mickael.remond@REDACTED; > erlang-questions@REDACTED > > Subject: Re: Yaws API discussion > > > > > > Mickael, > > > > Per your request I am going to make a few > > suggestions. I would, however, warn readers that I > > will be swimming in what some consider a holy war > > area. I do not intend any kind of little war here, > I > > am just providing suggestions based on my > experience > > and knowlege. > > > > I believe that the problem you are having stems > from a > > core problem with the paradigm yaws has adopted. > Yaws, > > like PHP and JSP Scriptlets, is founded upon the > idea > > that actual logic should be embedded in the html > page. > > This is a bad thing(TM). It limits scalability of > the > > application by quite a bit. I am not refering to > > scalability in terms of speed or performance, but > to > > scalablity in terms of application size, > > reliablity/maintenance, and extensablility. > > > > I am rambling here so forgive me. Back in the > early > > '80s users of smalltalk realized that the ui > design > > paradigms of the time were lacking for large > projects. > > To address the issue they came up with a paradigm > > called MVC (Model, View, Controller). This > basically > > stated that your model (data, logic) should be > > seperated from your controller (flow control > logic) > > and all of that should be seperated from your view > > code. It eventually was expoused that the view > code > > should be extreamly limited. In that it only > allows > > you to manipulate data provided from your model > layer. > > > > > > This was a really good idea for UIs, and when the > WEB > > came about it proved to be a really good idea for > > webapplications as well. > > > > To use some hisorical examples, the inventors of > JSP > > realized this same issue after they released the > first > > JSP specification. In that original specification > JSPs > > allowed only scriptlets (which is java code > imbedded > > in the html and delimited by <% %> tags). This > > approach was obviously not MVC like in any way. In > > fact, it cuased quite allot of headaches for > > developers then (and even in somecases now). Thier > > next release included the idea of 'TagLibs' which > are > > custom tags that use data from provided from some > > backend process (via session and request > variables). > > Now the use of scriptlets are frowned upon almost > > universally and are actaully not allowed to be > used in > > most big projects. This still wasn't really a > complete > > MVC solution as the coder had to code allot of the > > controller and logic framework himself, but it did > > provide a foundation. Projects like Struts have > made > > good use of this foundation and provide full blown > MVC > > frameworks now. Using these frameworks has made > web > > application programming much much easier. > > > > > > Well to get back to your problem. If your > > Model/Controller layer only provided data to your > view > > and your view simply made use of that data all you > > would need to do is include the header and it > could > > make use of all the data that was globally > available > > in the page. In JSPs that is simply an <@include > 'page > > location'> directive. The included page then > simply > > makes use of the data already provided. > > > > I realize that the yaws api is based to quite a > large > > extent on PHP, but PHP is a very poor choice for > > large, extensable applications. Don,t get me wrong > PHP > > is a great thing for quick and dirty applications. > > Basically for those applications that only span a > few > > pages or that are only designed to live a short > time. > > Anything beyond that and PHP starts to fall down. > > > > I would suggest that you take a look at some of > the > > Java page rendering technology. They have allot of > > experience in this type of thing by now. Probably > > start out with the taglib stuff and then take a > look > > at Struts (available at > jakarta.apache.org/struts). > > Perhaps also take a look at webmacro > > (www.webmacro.org) and velocity > > (jakarta.apache.org/velocity). I personally like > the > > idea of taglibs and compiled pages (I think they > are > > much faster), but the template engines and thier > > restricted data manipulation langauges are nice as > > well. > > > > I guess I went kind of long, sorry. I also hope I > did > > not get anyone too angry. > > > > Thanks, > > Eric > > > > --- mickael.remond@REDACTED wrote: > > > Hello, > > > > > > I feel that there is a need to improve an aspect > of > > > yaws api. > > > > > > The ssi function can be used to include some > > > external html template. My need is to be able to > add > > > some dynamic generated values (for example the > title > > > in the html header portion) > > > > > > I am thinking on the best way to do that. The > most > > > evident thing is to pass a dictionnary of > > > substitution that needs to be performed in the > > > included file. > > > > > > I think it might not be interesting to implement > > > nested evaluation of included files. > > > > > > What do you think ? > > > Any clever idea ? > > > > > > -- > > > Mickakl Rimond > > > http://www.erlang-fr.org/ > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Autos - Get free new car price quotes > > http://autos.yahoo.com > > > > === message truncated === __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From Sean.Hinde@REDACTED Mon Jul 15 23:20:50 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 15 Jul 2002 22:20:50 +0100 Subject: Yaws API discussion Message-ID: <04D356A3B172D611981B0008C791C3126BF1A2@imp02mbx.t-mobile.co.uk> Hi, > I would suggest that you take a look at some of the > Java page rendering technology. They have allot of > experience in this type of thing by now. Probably > start out with the taglib stuff and then take a look > at Struts (available at jakarta.apache.org/struts). > Perhaps also take a look at webmacro > (www.webmacro.org) and velocity > (jakarta.apache.org/velocity). I personally like the > idea of taglibs and compiled pages (I think they are > much faster), but the template engines and thier > restricted data manipulation langauges are nice as > well. Interesting links, and I do agree that separating presentation from dynamic content is important (web design agencies don't do Erlang!) This might be something of a plug for my last post.. but Joe's esp can be used (and is by us) as a nice simple (erlang native) alternative to the velocity templates. We write pretty much all the presentation html as standalone html files which are parameterised with variables from a dictionary (shown as ${var} in the html). It is also possible to pass in lists of variables and iterate over them with a lists:map - very much like the #foreach stuff in Velocity Templates (though with slightly more syntax ..). This allows the nice generation of tables etc used in the VTL examples. With a little more work I think this esp stuff could be quite a nice basis for what you describe Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From dne@REDACTED Mon Jul 15 23:26:52 2002 From: dne@REDACTED (Daniel =?iso-8859-1?q?N=E9ri?=) Date: Mon, 15 Jul 2002 23:26:52 +0200 Subject: Building R8B-1 on OpenBSD 3.1 In-Reply-To: <87ptxp3tcu.fsf@d8tv0m01.rdu.bellsouth.net> (Steve Elkins's message of "15 Jul 2002 11:26:25 -0400") References: <87ptxp3tcu.fsf@d8tv0m01.rdu.bellsouth.net> Message-ID: <87it3g1y3n.fsf@nowhere.mayonnaise.net> Steve Elkins writes: > ..and it compiled, but I'm sure the PTB have better ways of > addressing such issues. Just thought I ought to report the hack. Aah! I'm the one to blame for these lines. The problem seems to be that the machine I did the port of os_mon to OpenBSD on has lots of obsolete left-over stuff on it. It was originally running OpenBSD 2.4, and somewhere along the lines of upgrades, the virtual memory implementation in OpenBSD changed from plain VM to a new one called UVM. Thus, this code works for me, who's too lazy to install from scratch at every new OS release, but it doesn't work for everyone else. > And what does the change do anyway? I suppose it includes the correct include file, instead of an old one that shouldn't exist anymore. ;-) >How can I find out if compiling it produces something that runs? Something like: application:start(sasl). application:start(os_mon). memsup:get_system_memory_data(). Regards, --Daniel -- Daniel Neri dne@REDACTED From dne@REDACTED Mon Jul 15 23:34:20 2002 From: dne@REDACTED (Daniel =?iso-8859-1?q?N=E9ri?=) Date: Mon, 15 Jul 2002 23:34:20 +0200 Subject: inet driver problem In-Reply-To: <1026719562.1244.21.camel@knocker> (Johan Blom's message of "15 Jul 2002 09:52:42 +0200") References: <1026719562.1244.21.camel@knocker> Message-ID: <87ele41xr7.fsf@nowhere.mayonnaise.net> Johan Blom writes: > Sometimes a gen_tcp:recv/3 could be just hanging infinitely while > sending on the same socket. Ah! Might this explain the problems I've been having with hanging connections when using the HTTP client from your own sowap/inets package? Regards, --Daniel -- Daniel Neri dne@REDACTED From sgelkins@REDACTED Tue Jul 16 01:49:39 2002 From: sgelkins@REDACTED (Steve Elkins) Date: 15 Jul 2002 19:49:39 -0400 Subject: Building R8B-1 on OpenBSD 3.1 References: <87ptxp3tcu.fsf@d8tv0m01.rdu.bellsouth.net> <87it3g1y3n.fsf@nowhere.mayonnaise.net> Message-ID: <8765zg4kmk.fsf@d8tv0m01.rdu.bellsouth.net> dne@REDACTED (Daniel N?ri) writes: > Steve Elkins writes: > > And what does the change do anyway? > > I suppose it includes the correct include file, instead of an old one > that shouldn't exist anymore. ;-) ;-) But what's the difference between R8B-0 and R8B-1? > >How can I find out if compiling it produces something that runs? > > Something like: > > application:start(sasl). > application:start(os_mon). > memsup:get_system_memory_data(). sge:33$ erl ... 3> memsup:get_system_memory_data(). [{system_total_memory,258584576}, {free_memory,114364416}, {total_memory,258584576}] 4> Looks ok to me. Thanks, Steve From cpressey@REDACTED Tue Jul 16 18:40:33 2002 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 16 Jul 2002 11:40:33 -0500 Subject: Yaws API discussion In-Reply-To: <20020715171423.75481.qmail@web40207.mail.yahoo.com> References: <20020714101918.444051691@relay-1v.club-internet.fr> <20020715171423.75481.qmail@web40207.mail.yahoo.com> Message-ID: <20020716114033.4f8dcb3c.cpressey@catseye.mb.ca> On Mon, 15 Jul 2002 10:14:23 -0700 (PDT) Eric Merritt wrote: > Mickael, > > Per your request I am going to make a few > suggestions. I would, however, warn readers that I > will be swimming in what some consider a holy war > area. I do not intend any kind of little war here, I > am just providing suggestions based on my experience > and knowlege. > > I believe that the problem you are having stems from a > core problem with the paradigm yaws has adopted. Yaws, > like PHP and JSP Scriptlets, is founded upon the idea > that actual logic should be embedded in the html page. > This is a bad thing(TM). It limits scalability of the > application by quite a bit. I am not refering to > scalability in terms of speed or performance, but to > scalablity in terms of application size, > reliablity/maintenance, and extensablility. My two cents: I agree that it is a Bad Thing, for the reason that interleaving different languages in the same source code file results a polyglot that is harder to understand and consequently harder to maintain. In order to write a good 'active page' you need to write good HTML and good code, and few people specialize in both. Even more unpopular opinion follows: I don't see the big deal with yaws besides performance (which, as has been mentioned, it gets by "cheating" like mad.) On sourceforge it is described as "small and beautiful" but I find it to be neither, at least in comparison to pico. No offense meant to Klacke, but it's only as well designed as any project called "yet another foo" would be expected to be. I feel it is trying to do too much. So, I'm writing my own web server. Mainly I'm doing so because of the usual Erlang-hacker excuse, that nothing available out there provides quite the right balance of features that I'm looking for (of course this is just to hide the fact that it's more fun to roll your own :) For the sake of elegant design I have consciously decided not to support documents consisting of interleaved Erlang and HTML in my project. Instead, templates have fields which are filled out from values in a dictionary. While I do not suppose it will be able to compete with yaws in terms of sheer performance, that can always be added later, once driver-side http-header parsing is a documented feature... -Chris From cyberlync@REDACTED Tue Jul 16 19:09:14 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 10:09:14 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <20020716114033.4f8dcb3c.cpressey@catseye.mb.ca> Message-ID: <20020716170914.33714.qmail@web40206.mail.yahoo.com> See inline -> --- Chris Pressey wrote: > My two cents: > > I agree that it is a Bad Thing, for the reason > that interleaving > different languages in the same source code file > results a polyglot that > is harder to understand and consequently harder to > maintain. In order to > write a good 'active page' you need to write good > HTML and good code, and > few people specialize in both. I agree with you here. Most people dont realize this, or they dont agree with the supposition (I attribute this to lack of experience in the domain). > Even more unpopular opinion follows: > > I don't see the big deal with yaws besides > performance (which, as has been > mentioned, it gets by "cheating" like mad.) On > sourceforge it is > described as "small and beautiful" but I find it to > be neither, at least > in comparison to pico. No offense meant to Klacke, > but it's only as well > designed as any project called "yet another foo" > would be expected to be. > I feel it is trying to do too much. Well in defense of klacke, he achieved his design goals. Which is more then I can say for many projects. The resultof his efforts is exaclty what he wanted. > So, I'm writing my own web server. Mainly I'm doing > so because of the > usual Erlang-hacker excuse, that nothing available > out there provides > quite the right balance of features that I'm looking > for (of course this > is just to hide the fact that it's more fun to roll > your own :) Not a bad idea. > For the sake of elegant design I have consciously > decided not to support > documents consisting of interleaved Erlang and HTML > in my project. > Instead, templates have fields which are filled out > from values in a > dictionary. As far as I am concerned this is the right choice. But dont forget that you need to support lists as well. Also are you going to go with the specialed template language approach or the tag approach? If you go with the tag approach I would suggest that you use something other then <> as tag delimiters. Awhile back I wrote a custom template engine for a client and made use of [] for tag delimiters. It made the parser much easier to write and the tags tended to stand out pretty well against the html. > While I do not suppose it will be able to compete > with yaws in terms of > sheer performance, that can always be added later, > once driver-side > http-header parsing is a documented feature... Why not? go ahead and lift the code from yaws, thats what open source is about. In this case, the documentation is yaws itself. Also, if you compile your templates to erlang you should get pretty close to the performance of yaws. > -Chris __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From mickael.remond@REDACTED Tue Jul 16 19:32:10 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 16 Jul 2002 19:32:10 +0200 Subject: Yaws API discussion Message-ID: <1026840730.3d34589a203a1@webmail.spamcop.net> Eric Merritt : > Mickael, > > > I believe that the problem you are having stems from a > core problem with the paradigm yaws has adopted. Yaws, > like PHP and JSP Scriptlets, is founded upon the idea > that actual logic should be embedded in the html page. > This is a bad thing(TM). It limits scalability of the > application by quite a bit. I am not refering to > scalability in terms of speed or performance, but to > scalablity in terms of application size, > reliablity/maintenance, and extensablility. [snip] I think that you are mixing two kind of problem here. The MVC model you are talking about is dealing with framework/approach to organize your application. The template problem is about choosing a elegant formalize to describe the way to generate the dynamic final HTML code that the user will receive on their browser when they connect on the site. MVC is often seen as a good approach to organise application logic. On the other side I consider that there is no widely accepted answer to the templating aspects. There are many different approach that are a trade-off between flexibility and efficiency. By the way an original approach of templating system can be found in Zope (http://www.zope.org/Documentation/ZopeBook/ZPT.stx). I am still not convinced yet that this approach is good but at least people are exploring new way of producing HTML. My point is that the Erlang community tends to find simple clever and straightforward answer to many common problem and that I wondering what would resort in such a debate. Maybe the dictionary aproach is the best (I am also still not sure yet because I tend to think that the templating issue is very sensitive, non trivial and most of the time a matter of taste). My only purpose is to collaboratively explore the web templating question and try to constructively propose interesting things. -- Micka?l R?mond From willem@REDACTED Tue Jul 16 20:04:43 2002 From: willem@REDACTED (Willem Broekema) Date: Tue, 16 Jul 2002 20:04:43 +0200 Subject: Yaws API discussion References: <20020714101918.444051691@relay-1v.club-internet.fr> <20020715171423.75481.qmail@web40207.mail.yahoo.com> <20020716114033.4f8dcb3c.cpressey@catseye.mb.ca> Message-ID: <3D34603B.9040807@pastelhorn.com> Chris Pressey wrote: > I agree that it is a Bad Thing, for the reason that interleaving > different languages in the same source code file results a polyglot that > is harder to understand and consequently harder to maintain. In order to > write a good 'active page' you need to write good HTML and good code, and > few people specialize in both. For an example of a web page template language that does not prevent you from editing the page with a (WYSIWYG) HTML editor (so logic and presentation can be done apart from each other): take a look at Zope Page Templates. There, variables, loops, including other page snippets etc are all done by setting special attributes in the regular HTML tag. This allows the template page to be valid (X)HTML. There can be dummy contents that will replace at request time with the appropriate value. Here's a simple example (the whole tag will get replaced by the title): Title goes here... Iteration over a list (with one row dummy contents, so template can be previewed unparsed, to see how it will look after parsing): Bill 23 It's probably a problem that Zope is Object Oriented: person/name means "the name attribute of the object named person". Erlang records are a poor substitute for this, especially because 'person/name' may also refer to the 'name' *method* of the person object. Nevertheless, I like using attributes as template commands seems better than using special Chris Pressey : > Even more unpopular opinion follows: > > I don't see the big deal with yaws besides performance Because I think that there is a need in a application server that is simple to use and code with and performant and I feel that it can be achieved by an Erlang development. All solutions that I know of are complicated and clumsy. For the rest, I tend to think that Open Source is about improving the tool that fit best your need at a given moment of time. What worries me is energy dispersion. Here is the list of Erlang HTTP server that I know of: - Inets 2 - Inets 3 - Pico - Yaws - possibly your incoming HTTP Server, Chris So the main question is why develop another one ? Really ? You can choose one of those servers as a basis of improvement. And writing another HTTP server, does not allow place for other cool improvement in the feature of those servers (like cool templating system, MVC approach modules, etc) It would be cool to see an important Open Source Erlang project emerge as a collaborative work of many Erlang developpers, but this would probably not happen if we always rewrite everything when we need a piece of code (Even if this is easy in Erlang). -- Micka?l R?mond From cyberlync@REDACTED Tue Jul 16 20:31:35 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 11:31:35 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <1026840730.3d34589a203a1@webmail.spamcop.net> Message-ID: <20020716183135.81585.qmail@web40202.mail.yahoo.com> > I think that you are mixing two kind of problem > here. The MVC model you are > talking about is dealing with framework/approach to > organize your application. > The template problem is about choosing a elegant > formalize to describe the way > to generate the dynamic final HTML code that the > user will receive on their > browser when they connect on the site. > > MVC is often seen as a good approach to organise > application logic. > On the other side I consider that there is no widely > accepted answer to the > templating aspects. There are many different > approach that are a trade-off > between flexibility and efficiency. > By the way an original approach of templating system > can be found in Zope You are right, there is no generally accepted approach. However I lump yaws, PHP, ASP, JSP scriptlets together becuase they allow *any* code to be imbedded in the html page. This allows the programmer to very easily violate the MVC architecture. If you want to look at an embedded scriptlet type architecture for java take a look a the tea templating system. It only allows a very limited subset of java to be embedded into the page. I personally don't like this approach but it does illustrate that MVC can be used with an embedded langauge if the language is design/restricted right. Perhaps you are right in that I should not have lumped templating and MVC into the same problem, but in my mind these two ideas are firmly linked. A good templating engine helps a programmer stick to MVC, not to mention making the code more readable and extensable. > (http://www.zope.org/Documentation/ZopeBook/ZPT.stx). > I am still not convinced > yet that this approach is good but at least people > are exploring new way of > producing HTML. I have not actually spent very much time with zope, but I will give it a look and see what its about. > My point is that the Erlang community tends to find > simple clever and > straightforward answer to many common problem and > that I wondering what would > resort in such a debate. > Maybe the dictionary aproach is the best (I am also > still not sure yet because I > tend to think that the templating issue is very > sensitive, non trivial and most > of the time a matter of taste). I think here you are right as well. You will probably get flamed from someone no matter what solution you come up with. However if you come up with a good, straitforward, logical templating solution I think allot of people would use if even if they didnt like the syntax/semantics all that much. > My only purpose is to collaboratively explore the > web templating question and > try to constructively propose interesting things. That is laudable and I hope I have been/will be able to contribute some to the discussion. If I get up on my soapbox to much just throw something at me and I will get the message :) Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From cyberlync@REDACTED Tue Jul 16 20:37:36 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 11:37:36 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <1026842627.3d346003f11b9@webmail.spamcop.net> Message-ID: <20020716183736.15370.qmail@web40205.mail.yahoo.com> > > Because I think that there is a need in a > application server that is simple to > use and code with and performant and I feel that it > can be achieved by an Erlang > development. All solutions that I know of are > complicated and clumsy. > > For the rest, I tend to think that Open Source is > about improving the tool that > fit best your need at a given moment of time. > What worries me is energy dispersion. Here is the > list of Erlang HTTP server > that I know of: > - Inets 2 > - Inets 3 > - Pico > - Yaws > - possibly your incoming HTTP Server, Chris Man I didnt realize there were so many. Hmm. > So the main question is why develop another one ? > Really ? You can choose one of > those servers as a basis of improvement. And writing > another HTTP server, does > not allow place for other cool improvement in the > feature of those servers (like > cool templating system, MVC approach modules, etc) I would tend to agree with you here as well mickael. I would actually like to use yaws and if the perfomance is actually as good as perviously claimed its orders of magnitude faster then most other web application systems out there. The thing that has prevented me from using it to date is the lack of a templating engine, and perhaps an mvc framework. With those two pieces in place it would be a nice server to code for. > It would be cool to see an important Open Source > Erlang project emerge as a > collaborative work of many Erlang developpers, but > this would probably not > happen if we always rewrite everything when we need > a piece of code (Even if > this is easy in Erlang). This is true. I have seen this happen with a few other open source projects. I guess if everyone spends time reinventing the wheel no one will get around to inventing the car, if you know what I mean. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From jhouchin@REDACTED Tue Jul 16 21:43:48 2002 From: jhouchin@REDACTED (Jimmie Houchin) Date: Tue, 16 Jul 2002 14:43:48 -0500 Subject: Yaws API discussion References: <20020714101918.444051691@relay-1v.club-internet.fr> <20020715171423.75481.qmail@web40207.mail.yahoo.com> <20020716114033.4f8dcb3c.cpressey@catseye.mb.ca> Message-ID: <3D347774.3020501@texoma.net> What is the target developer for any of these said web app servers? Is the target a webshop which has seperate HTML designers and web programming developers? Or are they designed for the person/people who can do (is doing) it all? If peaceful coexistance between HTML people and programmers is a requirement, then Zope is an excellent example, for that is a primary goal of Zope. However if that is not a requirement then Quixote (yet another Python web app server) provides an interesting perspective. http://www.amk.ca/python/writing/mx-architecture/ http://www.mems-exchange.org/software/quixote/ Being Python based and its users proficient Python programmers they prefer to stay as close to and within Python as much as possible for their web app development. Even their templating language PTL's (Python Template Language) goal is to be very Pythonic in flavor. Whether or not their design goals are shared here, it is an interesting read to see other perspectives. The authors of this web app server are very familiar with Zope and chose this direction for their own development. Take a look. Jimmie Houchin From cyberlync@REDACTED Tue Jul 16 22:08:13 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 13:08:13 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <3D347774.3020501@texoma.net> Message-ID: <20020716200813.13753.qmail@web40204.mail.yahoo.com> See inline --> --- Jimmie Houchin wrote: > What is the target developer for any of these said > web app servers? > > Is the target a webshop which has seperate HTML > designers and web > programming developers? Or are they designed for the > person/people who > can do (is doing) it all? I would have to disagree with this logic a bit. Shops change, either growing or getting smaller. Today you could have one guy that does it all. Next your or five years from now you could have a dedicated team of 15 html guys and five coders. I would have to say you split it into the easiest solution for both. Coders generally wont have a problems with a simple template language/tag set so go that route. If things change down the road you still have it covered. > If peaceful coexistance between HTML people and > programmers is a > requirement, then Zope is an excellent example, for > that is a primary > goal of Zope. The only issue I really have with zope is I dont like how it mixes html and view logic. Feel free to disagree with me, but this would seem to make it harder to distinguise between markup and view logic especially on a large/complex page. I also dont really like the idea of extending the existing html standard. I realize that once it gets out to the browser you end up with plain html but it still doesnt sit well with me. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From cyberlync@REDACTED Wed Jul 17 00:30:03 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 15:30:03 -0700 (PDT) Subject: Yaws API discussion In-Reply-To: <1026842627.3d346003f11b9@webmail.spamcop.net> Message-ID: <20020716223003.63669.qmail@web40203.mail.yahoo.com> Mickaels ideas below are a great idea. A question arises though, Is the owner (klacke) willing to allow this? It seems that at the moment yaws is very much a single owner/maintainer project. After spending a little time looking over yaws.hyber.org it seems that there is no way to submit code, get cvs images, no mailing list, etc. It may very well be that the owner is not interested in expanding the project. Does anyone have any idea on this? Thanks, Eric > For the rest, I tend to think that Open Source is > about improving the tool that > fit best your need at a given moment of time. > What worries me is energy dispersion. Here is the > list of Erlang HTTP server > that I know of: > - Inets 2 > - Inets 3 > - Pico > - Yaws > - possibly your incoming HTTP Server, Chris > > So the main question is why develop another one ? > Really ? You can choose one of > those servers as a basis of improvement. And writing > another HTTP server, does > not allow place for other cool improvement in the > feature of those servers (like > cool templating system, MVC approach modules, etc) > > It would be cool to see an important Open Source > Erlang project emerge as a > collaborative work of many Erlang developpers, but > this would probably not > happen if we always rewrite everything when we need > a piece of code (Even if > this is easy in Erlang). __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From Bruce@REDACTED Wed Jul 17 00:42:00 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Wed, 17 Jul 2002 10:42:00 +1200 Subject: Yaws API discussion References: <20020716223003.63669.qmail@web40203.mail.yahoo.com> Message-ID: <004901c22d19$ffab1670$5f00a8c0@slant> Eric said: > Mickaels ideas below are a great idea. A question > arises though, Is the owner (klacke) willing to allow > this? I'm sure Klacke would be weighing in here with his own view and contributions, but he's on holiday (still AFAIK). So don't misinterpret the lack of immediate responses :-) Its an interesting discussion (MVC vs everything else) and I'm still forming an opinion (having used inets, pico and now yaws). /Bruce From cpressey@REDACTED Wed Jul 17 01:26:55 2002 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 16 Jul 2002 18:26:55 -0500 Subject: Yaws API discussion In-Reply-To: <20020716170914.33714.qmail@web40206.mail.yahoo.com> References: <20020716114033.4f8dcb3c.cpressey@catseye.mb.ca> <20020716170914.33714.qmail@web40206.mail.yahoo.com> Message-ID: <20020716182655.160256a8.cpressey@catseye.mb.ca> On Tue, 16 Jul 2002 10:09:14 -0700 (PDT) Eric Merritt wrote: > Well in defense of klacke, he achieved his design > goals. Which is more then I can say for many projects. > The resultof his efforts is exaclty what he wanted. According to motivation.yaws, he wanted something less ad-hoc than PHP, and yaws is that. (But I want something even less ad-hoc than yaws :) > [snip] > As far as I am concerned this is the right choice. > But dont forget that you need to support lists as > well. Also are you going to go with the specialed > template language approach or the tag approach? If you > go with the tag approach I would suggest that you use > something other then <> as tag delimiters. Awhile back > I wrote a custom template engine for a client and made > use of [] for tag delimiters. It made the parser much > easier to write and the tags tended to stand out > pretty well against the html. Currently I'm using tags formatted like ${This}, because it evolved from some (now quite old) Perl CGI code. They stand out quite well. Iterating over lists is currently done in the Erlang handlers (in .beam files) and the whole table is exported as a single tag. This is less than ideal since it hard-codes things like cell alignment. It's also not very scaleable, but who wants to see an HTML table with a million cells in it anyway? Better to break it up into many smaller pages. I'm intrigued by Zope's "format by example" approach, and if I'm going to improve on the templating I might go in that direction... -Chris From Bruce@REDACTED Wed Jul 17 01:39:39 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Wed, 17 Jul 2002 11:39:39 +1200 Subject: Yaws API discussion References: <20020716223003.63669.qmail@web40203.mail.yahoo.com> Message-ID: <006101c22d22$0d60a250$5f00a8c0@slant> Eric said: > It seems that at the moment yaws is very much a single > owner/maintainer project. After spending a little time > looking over yaws.hyber.org it seems that there is no > way to submit code, get cvs images, no mailing list, > etc. Oh and http://sourceforge.net/projects/erlyaws/ -- not referenced from yaws.hyber.org yet. /Bruce From cpressey@REDACTED Wed Jul 17 02:19:53 2002 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 16 Jul 2002 19:19:53 -0500 Subject: Yaws API discussion In-Reply-To: <1026842627.3d346003f11b9@webmail.spamcop.net> References: <1026842627.3d346003f11b9@webmail.spamcop.net> Message-ID: <20020716191953.2f0f0098.cpressey@catseye.mb.ca> On Tue, 16 Jul 2002 20:03:47 +0200 Mickael Remond wrote: > Chris Pressey : > > > Even more unpopular opinion follows: > > > > I don't see the big deal with yaws besides performance > > Because I think that there is a need in a application server that is > simple to use and code with and performant and I feel that it can be > achieved by an Erlang development. All solutions that I know of are > complicated and clumsy. Fair enough. I think out(A) -> yaws_api:ssi(A#arg.docroot, ["/HEAD", "/TOPTAB"]). is at least a *little* bit clumsy though. :) > For the rest, I tend to think that Open Source is about improving the > tool that fit best your need at a given moment of time. I think the success of Open Source has been more to do with widespread peer-review. More eyeballs on the code means more bugs are caught. > What worries me is energy dispersion. Here is the list of Erlang HTTP > server that I know of: > - Inets 2 > - Inets 3 > - Pico > - Yaws > - possibly your incoming HTTP Server, Chris > > So the main question is why develop another one ? Really ? You can > choose one of those servers as a basis of improvement. And writing > another HTTP server, does not allow place for other cool improvement in > the feature of those servers (like cool templating system, MVC approach > modules, etc) But one person's idea of a cool improvement is another person's cruft. Why should I force my ideas on Klacke's project when it's clear that we have different priorities? Maybe he doesn't want an integrated cookieless user system based on a database of IP addresses with timeouts, whereas I do. Maybe I could just take yaws and make my "improvements" to it, but then I'd have Chris' Hacked Version of Yaws, which wouldn't be any better than something original of mine. In fact it would probably be worse in the long run, as I can barely follow his code as it rapidly progresses. > It would be cool to see an important Open Source Erlang project emerge > as a collaborative work of many Erlang developpers, but this would > probably not happen if we always rewrite everything when we need a piece > of code (Even if this is easy in Erlang). I think that's a bit of a pipe dream... in my experience, Open Source projects are generally written and maintained by a small team of developers, or even a single person; everyone else mainly just sends in bug reports and suggestions. Collaborative design tends to result in a 'too many cooks spoil the broth' situation in the pursuit of a 'one size fits all' solution. Basically, if I were going to worry about duplication of effort, I'd worry more about how every Erlang programmer writes their own to_upper/1 et al helper functions because they aren't found in stdlib :) -Chris From cyberlync@REDACTED Wed Jul 17 05:11:23 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 16 Jul 2002 20:11:23 -0700 (PDT) Subject: gen_server, gen_tcp question Message-ID: <20020717031123.43672.qmail@web40202.mail.yahoo.com> Guys, As some of you may know I am fairly new to erlang. I have been poking around a bit getting my feet wet, messing with yaws, mnesia, etc. Well I am finally getting around to coding a fairly heft application as a learning exercise and I have hit a stumbling block. I am just begining to write the tcp comm part of the application, I would love to follow the otp practices and make use of gen_server. There even seems to be some arcane way for gen_tcp and gen_server to work together for a module. I can't, for the life of me, figure it out. The documentation is pretty sparse in this area as well. If I missed some documentation somewhere could one of you point it out or if I missed something obvious just let me know my error. Otherwise a little example would be great. I have spent a significant amount of time searching the archives, the net, etc. Also I have attempted to look at the inets and yaws source to figure this out. The only problem there is that both the inets source and the yaws source is largly undocumented. So I tend to just get a headache accompanied by very little understanding. So if one of you could point me in the right direction that would be great. Otherwise I may have just revealed the true magnitude of my ingnorance :) Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From mickael.remond@REDACTED Wed Jul 17 08:20:36 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 Jul 2002 08:20:36 +0200 Subject: Yaws API discussion Message-ID: <1026886836.3d350cb43b883@webmail.spamcop.net> Eric Merritt : > Mickaels ideas below are a great idea. A question > arises though, Is the owner (klacke) willing to allow > this? > > It seems that at the moment yaws is very much a single > owner/maintainer project. After spending a little time > looking over yaws.hyber.org it seems that there is no > way to submit code, get cvs images, no mailing list, > etc. As Bruce said, the project is hosted on Sourceforge and thus benefits from the whole sourceforge infrastructure, in particular mailing list, bug tracking, CVS (anonymous and read/write access). This project is still open: There are already 7 registered developper in the sourceforge site. -- Micka?l R?mond From mickael.remond@REDACTED Wed Jul 17 08:40:57 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 Jul 2002 08:40:57 +0200 Subject: Yaws API discussion Message-ID: <1026888057.3d35117964690@webmail.spamcop.net> Chris Pressey : > I think the success of Open Source has been more to do with widespread > peer-review. More eyeballs on the code means more bugs are caught. This is another aspect about Open Source that surely cannot be leveraged if there is one Open Source by user/developper. It implies that users and developpers make the effort to collaboratively think on how to improve the software and care about this improvment. > But one person's idea of a cool improvement is another person's cruft. > Why should I force my ideas on Klacke's project when it's clear that we > have different priorities? Maybe he doesn't want an integrated cookieless > user system based on a database of IP addresses with timeouts, whereas I > do. Maybe I could just take yaws and make my "improvements" to it, but > then I'd have Chris' Hacked Version of Yaws, which wouldn't be any better > than something original of mine. In fact it would probably be worse in > the long run, as I can barely follow his code as it rapidly progresses. In fact developping an HTTP server is fairly easy. It is also fairly easy to start a project. In fact the first reaction when looking at a project is often the following: people find often difficult to extend the code to make it comptible with their own need. So it is easy to conclude that the code may be poorly design and that rewriting the same thing from scratch will improve it. And it often and up with a code impleting nearly the same set of functions and that is difficult to extend and not very generic. Actually, many open source project are launched and concentrate on easy parts. And then the author get to the point that this is more difficult to progress, to make it more generic and to cover more users needs because it is the easiest part has been developped and the next effort, extension and so on are the more difficult part. If everyone think this way, the difficult part will never be tackle. I think this is the real challenge here. And that is why collaboratively thinking of the project evolution is necessary. Oh sure, you need to discuss and find a compromise but when reached this compromise might lead to better code, more generic, and so on. When we developped the SOAP server we decided to implement our own http lib. This was a mistake and today I would build this project on an existing http server. For your specific need about user session, I think you should have a look at Inets. The design is modular and makes it possible to add such functionnalities on top of a full-feature and tested http server. > I think that's a bit of a pipe dream... in my experience, Open Source > projects are generally written and maintained by a small team of > developers, or even a single person; everyone else mainly just sends in > bug reports and suggestions. Collaborative design tends to result in a > 'too many cooks spoil the broth' situation in the pursuit of a 'one size > fits all' solution. It might, but this risks should be taken to provide better tools. -- Micka?l R?mond From mickael.remond@REDACTED Wed Jul 17 08:53:00 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 Jul 2002 08:53:00 +0200 Subject: No subject Message-ID: <1026888780.3d35144cb7f02@webmail.spamcop.net> Hi, I really think that an Erlang application server efficient and easy to use might become an Erlang killer app. But I am sure that this application design can only succeed if this become an effort of the overall imaginative Erlang community. This two topics (MVC) and templating engine are good piece of the puzzle. My problem with Zope ZPT approach is that it is very process intensive. By adding attribute to HTML tag, I think you will lose server performance. But I might be proved wrong. I think we should think of a way to map this templating system to Erlang code. Anyone interested ? Maybe we can use the wiki to think about that... http://www.bluetail.com/wiki/showPage?node=TemplateEngine -- Micka?l R?mond From fredrik.linder@REDACTED Wed Jul 17 00:44:35 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 17 Jul 2002 00:44:35 +0200 Subject: Possible bug using funs Message-ID: <005201c22d1a$5ee28ba0$f2b7f2d5@frelin> Hi, I get the following error when writing a fun: The only differense (as I can see) is the order of the two clauses in the funs; T2 has the empty list test as its first clause while T1 has the empty list test as its last clause: 17> T2=fun([],[],Acc,Cont)->lists:reverse(Acc); ([H1|T1],[H2|T2],Acc,Cont)->io:format("~w~n",[Acc]),Cont(T1,T2,[{H1,H2}|Acc] ,Cont) end. #Fun 18> T2([1,2],[1,2],[],T2). [] [{1,1}] [{1,1},{2,2}] 19> T1=fun([H1|T1],[H2|T2],Acc,Cont)->io:format("~w~n",[Acc]),Cont(T1,T2,[{H1,H2 }|Acc],Cont); ([],[],Acc,Cont)->lists:reverse(Acc) end. #Fun 20> T1([1,2],[1,2],[],T1). [] [{1,1}] ** exited: {{illegal_pattern,{cons,1,{var,1,'H1'},{var,1,'T1'}}}, [{erl_eval,expr,3}]} ** 21> I'm using: Erlang 5.1/OTP R8B /Fredrik From johan.blom@REDACTED Wed Jul 17 09:36:23 2002 From: johan.blom@REDACTED (Johan Blom) Date: 17 Jul 2002 09:36:23 +0200 Subject: inet driver problem In-Reply-To: <87ele41xr7.fsf@nowhere.mayonnaise.net> References: <1026719562.1244.21.camel@knocker> <87ele41xr7.fsf@nowhere.mayonnaise.net> Message-ID: <1026891383.1244.111.camel@knocker> On Mon, 2002-07-15 at 23:34, Daniel N?ri wrote: > Johan Blom writes: > > > Sometimes a gen_tcp:recv/3 could be just hanging infinitely while > > sending on the same socket. > > Ah! Might this explain the problems I've been having with hanging > connections when using the HTTP client from your own sowap/inets > package? Might indeed be related, yes! BR Johan Blom Mobile Arts From kent@REDACTED Wed Jul 17 09:46:42 2002 From: kent@REDACTED (Kent Boortz) Date: 17 Jul 2002 09:46:42 +0200 Subject: gen_server, gen_tcp question In-Reply-To: <20020717031123.43672.qmail@web40202.mail.yahoo.com> References: <20020717031123.43672.qmail@web40202.mail.yahoo.com> Message-ID: Eric Merritt writes: > As some of you may know I am fairly new to erlang. I > have been poking around a bit getting my feet wet, > messing with yaws, mnesia, etc. Well I am finally > getting around to coding a fairly heft application as > a learning exercise and I have hit a stumbling block. > I am just begining to write the tcp comm part of the > application, I would love to follow the otp practices > and make use of gen_server. There even seems to be > some arcane way for gen_tcp and gen_server to work > together for a module. I can't, for the life of me, > figure it out. The documentation is pretty sparse in > this area as well. If you talk about creating an application that listen to a port and accept an connection then I think they don't fit together as well as they should do. Some OTP applications bypass the gen_server module and use the sys module to use gen_tcp and still fit into the supervision model of Erlang/OTP. You can look at the source of ssl or the P9 rshell application for an example of this. There is an ascii drawing in "$ERL_TOP/lib/rshell/src/rshell.erl" that show the supervisor structure. One problem is that we can't sit and wait for a connection in the blocking call gen_tcp:accept() because the application may get a code change system message. One way around this is to give a timeout of one second to gen_tcp:accept() to leave the call and pick up system messages if any and redo the accept call. A second problem that gen_tcp solves in an unusual way (a bit ugly in my opinion) is that after an accept of a connection in active mode messages with TCP data may be received to the message queue of the process calling gen_tcp:accept() before it has started a process to handle the specific connection. There is a function gen_tcp:controlling_process() that redirect these messages to a new process and, from what I have been told, actually move the TCP messages from the message queue of the first process to the new controlling process, kent init(Parent, Options) -> process_flag(trap_exit, true), Deb = sys:debug_options(?DBG_OPTS ++ Options), Port = get_port(Options), AcceptTimeout = case application:get_env(rshell, accept_timeout) of {ok, AcceptT} -> AcceptT; undefined -> 1000 % XXX: Create a macro!!! end, Opts = [ {nodelay, true}, {packet,raw}, {reuseaddr,true} ], % We crash if we can't open the socket to listen {ok, ListenSocket} = gen_tcp:listen(Port, Opts), loop(Parent, Deb, ListenSocket, AcceptTimeout). loop(Parent, Deb, ListenSocket, AcceptTimeout) -> receive {system, From, Request} -> State = {ListenSocket, AcceptTimeout}, sys:handle_system_msg(Request, From, Parent, ?MODULE, Deb, State); What -> NewDeb = sys:handle_debug(Deb, {?MODULE, write_debug}, rshell_listener, {in, What}), loop(Parent, NewDeb, ListenSocket, AcceptTimeout) case gen_tcp:accept(ListenSocket, AcceptTimeout) of {ok, Sock} -> case supervisor:start_child(rshell_connection_sup, [Sock]) of {ok,Pid} when pid(Pid) -> gen_tcp:controlling_process(Sock, Pid), loop(Parent, Deb, ListenSocket, AcceptTimeout); Other -> NewDeb = sys:handle_debug(Deb, {?MODULE, write_debug}, rshell_listener, {start_child_result, Other}), gen_tcp:close(Sock), loop(Parent, NewDeb, ListenSocket, AcceptTimeout) end; {error, timeout} -> %% This is what we want to enable system events loop(Parent, Deb, ListenSocket, AcceptTimeout); Other -> NewDeb = sys:handle_debug(Deb, {?MODULE, write_debug}, rshell_listener, {accept_result,Other}), loop(Parent, NewDeb, ListenSocket, AcceptTimeout) end end. From fredrik.linder@REDACTED Wed Jul 17 01:36:53 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 17 Jul 2002 01:36:53 +0200 Subject: Recursion References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> <3D2568A4.46927B6@era.ericsson.se> <002501c225c5$120b2320$a8b7f2d5@frelin> <3D2AFB00.30BA62E8@era.ericsson.se> Message-ID: <005701c22d21$aa6f8080$f2b7f2d5@frelin> Sorry for my later reply, but I had a week vacation. :) > > This is tail-recursive however: > > > > zip(L1, L2) -> > > zip(L1, L2, []). > > > > zip([H1 | T1], [H2 | T2], Acc) -> > > zip(T1, T2, [{H1, H2} | Acc]); % Nothing to be done after the recursive > > call > > zip([], [], Acc) -> > > lists:reverse(Acc). % This is necesary if you want to keep the order of > > your list elements. > > That was close my initial attempt (except for the > helper function naming) to which Thomas commented that: > > >This solution for zip has complexity 2N (2 times the length > >of the list). It is easy to make a solution that only > >traverses the list once. > > Does this imply something more than a space / time compromise > for the function evaluation characteristics? (Except elegance > of the implementation). With my limited knowledge of the implementation of Erlang, I guess not, except from the fact that lists always is created bottom-up (using cons-cells), and hence forcing order-sensitive tail-recursive functions to traverse lists at least twice. With a simple test repeated 7 times, each time traversing 10000 lists with 1000 elements I got that the tail-recursive function actually was 4% faster than the non-tail-recursive. (See attachment) > Also: > You order the clauses differently (than Thomas) for the non-tail > recursive version. Which is to preferable? My guess was that placing > the zip([],[])->[] last was best. I think so too ;-) Maybe it no longer matters due to hopefully better implementation of Erlang, but earlier I think it did. So placing the clauses executed only once last could be a good micro-optimization. /Fredrik -------------- next part -------------- A non-text attachment was scrubbed... Name: test.erl Type: application/octet-stream Size: 589 bytes Desc: not available URL: From bjorn@REDACTED Wed Jul 17 10:14:10 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Jul 2002 10:14:10 +0200 Subject: Recursion In-Reply-To: "Fredrik Linder"'s message of "Wed, 17 Jul 2002 01:36:53 +0200" References: <3D24540D.BD1BB816@era.ericsson.se> <3D253DEF.E7BAD43@cslab.ericsson.se> <3D2568A4.46927B6@era.ericsson.se> <002501c225c5$120b2320$a8b7f2d5@frelin> <3D2AFB00.30BA62E8@era.ericsson.se> <005701c22d21$aa6f8080$f2b7f2d5@frelin> Message-ID: "Fredrik Linder" writes: > > > Also: > > You order the clauses differently (than Thomas) for the non-tail > > recursive version. Which is to preferable? My guess was that placing > > the zip([],[])->[] last was best. > > I think so too ;-) Maybe it no longer matters due to hopefully better > implementation of Erlang, but earlier I think it did. So placing the clauses > executed only once last could be a good micro-optimization. The order no longer makes any difference. The compiler reorders the clauses anyway. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From francesco@REDACTED Wed Jul 17 10:22:21 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 17 Jul 2002 09:22:21 +0100 Subject: gen_server, gen_tcp question References: <20020717031123.43672.qmail@web40202.mail.yahoo.com> Message-ID: <3D35293D.2000501@erlang-consulting.com> Hi Eric, welcome to the world of Erlang. I assume the problem you have stumbled across is the usage of gen_tcp in passive modes, making your gen_server hang until receive the request. (The same applies to receiving data). You will be hanging, and thus unable to handle code upgrades or other requests sent to the server. You could use the timeout, but that will generate an unnecessary overhead. Your solution is to spawn a process (Not following any behaviors), which hangs in the call gen_tcp:accept/1 waiting for a connection request. Make sure this process is linked to your gen_server. When you receive a request, make your gen_server the controlling process and receive your packages in active mode using the handle_info call. Should you want to implement code upgrades, make sure you set the timeout to a very low value. This will kill your listener process. Just make sure you respawn it after the upgrade. Hope the above helps. Good documentation on OTP design principles is at http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html . Mickael Remond & I wrote a paper on the "non" usage of OTP outside Ericsson you might find interesting. You can read about at http://www.erlang-consulting.com/euc2001/index.htm Good Luck, Francesco -- http://www.erlang-consulting.com Eric Merritt wrote: >Guys, > > As some of you may know I am fairly new to erlang. I >have been poking around a bit getting my feet wet, >messing with yaws, mnesia, etc. Well I am finally >getting around to coding a fairly heft application as >a learning exercise and I have hit a stumbling block. >I am just begining to write the tcp comm part of the >application, I would love to follow the otp practices >and make use of gen_server. There even seems to be >some arcane way for gen_tcp and gen_server to work >together for a module. I can't, for the life of me, >figure it out. The documentation is pretty sparse in >this area as well. > > > If I missed some documentation somewhere could one of >you point it out or if I missed something obvious just >let me know my error. Otherwise a little example would >be great. > >I have spent a significant amount of time searching >the archives, the net, etc. Also I have attempted to >look at the inets and yaws source to figure this out. >The only problem there is that both the inets source >and the yaws source is largly undocumented. So I tend >to just get a headache accompanied by very little >understanding. > >So if one of you could point me in the right direction >that would be great. Otherwise I may have just >revealed the true magnitude of my ingnorance :) > >Thanks, >Eric > >__________________________________________________ >Do You Yahoo!? >Yahoo! Autos - Get free new car price quotes >http://autos.yahoo.com > > From johan.blom@REDACTED Wed Jul 17 10:27:06 2002 From: johan.blom@REDACTED (Johan Blom) Date: 17 Jul 2002 10:27:06 +0200 Subject: Yaws API discussion In-Reply-To: <1026842627.3d346003f11b9@webmail.spamcop.net> References: <1026842627.3d346003f11b9@webmail.spamcop.net> Message-ID: <1026894426.1246.162.camel@knocker> Hi, On Tue, 2002-07-16 at 20:03, Mickael Remond wrote: > Chris Pressey : > > > Even more unpopular opinion follows: > > > > I don't see the big deal with yaws besides performance > > Because I think that there is a need in a application server that is simple to > use and code with and performant and I feel that it can be achieved by an Erlang > development. All solutions that I know of are complicated and clumsy. > > For the rest, I tend to think that Open Source is about improving the tool that > fit best your need at a given moment of time. > What worries me is energy dispersion. Here is the list of Erlang HTTP server > that I know of: > - Inets 2 > - Inets 3 > - Pico > - Yaws > - possibly your incoming HTTP Server, Chris Just to clarify a bit on the different inets versions floating around. To my knowledge there are currently three tracks on this - The inets 2.6.x serie as part of OTP-R8-y (HTTP 1.0) - The inets 3.0 version in OTP-P9 (adds HTTP 1.1 support) - And what I started on sowap.soureforge.net The latter one beeing based on the latest inets-3.0 version at the time I started. If everything goes well the idea is that the sowap.sourceforge.net version will be the one part of OTP-R9 when that is released. So, my own humble opinion would be to have a closer look at the latest inets version and help out with that. One of the main design goals with inets is to have a fast "core" with only the most basic HTTP functionality and then allow for extensions, provided by the module design. Thus I assume e.g. a "yaws" extension should be quite easy to implement. BR Johan Blom Mobile Arts From mickael.remond@REDACTED Wed Jul 17 11:27:57 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 Jul 2002 11:27:57 +0200 Subject: Yaws API discussion Message-ID: <1026898077.3d35389d4f21c@webmail.spamcop.net> Johan Blom : > So, my own humble opinion would be to have a closer look at the latest > inets version and help out with that. One of the main design goals with > inets is to have a fast "core" with only the most basic HTTP > functionality and then allow for extensions, provided by the module > design. Thus I assume e.g. a "yaws" extension should be quite easy to > implement. Why not. From what I remember from previous test with Inets 2.6 is that the performance was not as impressive as Yaws. But maybe we should work on Inet 3 to make it as fast with the same level of functionnality. Do you think it is something possible ? We could then implement various templating approach as module (Yaws, ZPT, ...) If I remember right it was possible to considerably improve Inets performance by removing the log feature. This was very strange. Do you know if this is still the case ? -- Micka?l R?mond From johan.blom@REDACTED Wed Jul 17 11:45:09 2002 From: johan.blom@REDACTED (Johan Blom) Date: 17 Jul 2002 11:45:09 +0200 Subject: Yaws API discussion In-Reply-To: <1026898077.3d35389d4f21c@webmail.spamcop.net> References: <1026898077.3d35389d4f21c@webmail.spamcop.net> Message-ID: <1026899109.1247.193.camel@knocker> On Wed, 2002-07-17 at 11:27, Mickael Remond wrote: > Johan Blom : > > > So, my own humble opinion would be to have a closer look at the latest > > inets version and help out with that. One of the main design goals with > > inets is to have a fast "core" with only the most basic HTTP > > functionality and then allow for extensions, provided by the module > > design. Thus I assume e.g. a "yaws" extension should be quite easy to > > implement. > > Why not. From what I remember from previous test with Inets 2.6 is that the > performance was not as impressive as Yaws. But maybe we should work on Inet 3 to > make it as fast with the same level of functionnality. > Do you think it is something possible ? Indeed. I see no reason why inets needs to be slower than e.g. yaws. In fact inet_drv based HTTP parsing is already there. Next on my list is a general overhaul of the EWSAPI interface and some internal rearrangements. > We could then implement various templating approach as module (Yaws, ZPT, ...) Yes, I believe so. > > If I remember right it was possible to considerably improve Inets performance by > removing the log feature. > This was very strange. > Do you know if this is still the case ? Don't know, we are not using it... BR Johan Blom Mobile Arts From cyberlync@REDACTED Wed Jul 17 15:59:14 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 17 Jul 2002 06:59:14 -0700 (PDT) Subject: gen_server, gen_tcp question In-Reply-To: Message-ID: <20020717135914.58547.qmail@web40203.mail.yahoo.com> Kent, Thanks allot this actually clears things up quite a bit. I do have one question though, the rshell app you mention does not seem to be in my erlang distro (R8-1). Do you have any idea where I could get it from? or do I need to recompile erlang with some options set? Thanks, Eric --- Kent Boortz wrote: > > Eric Merritt writes: > > As some of you may know I am fairly new to > erlang. I > > have been poking around a bit getting my feet wet, > > messing with yaws, mnesia, etc. Well I am finally > > getting around to coding a fairly heft application > as > > a learning exercise and I have hit a stumbling > block. > > I am just begining to write the tcp comm part of > the > > application, I would love to follow the otp > practices > > and make use of gen_server. There even seems to be > > some arcane way for gen_tcp and gen_server to work > > together for a module. I can't, for the life of > me, > > figure it out. The documentation is pretty sparse > in > > this area as well. > > If you talk about creating an application that > listen to a port and > accept an connection then I think they don't fit > together as well as > they should do. Some OTP applications bypass the > gen_server module and > use the sys module to use gen_tcp and still fit into > the supervision > model of Erlang/OTP. You can look at the source of > ssl or the P9 > rshell application for an example of this. There is > an ascii drawing > in "$ERL_TOP/lib/rshell/src/rshell.erl" that show > the supervisor > structure. > > One problem is that we can't sit and wait for a > connection in the > blocking call gen_tcp:accept() because the > application may get a code > change system message. One way around this is to > give a timeout of one > second to gen_tcp:accept() to leave the call and > pick up system > messages if any and redo the accept call. > > A second problem that gen_tcp solves in an unusual > way (a bit ugly in > my opinion) is that after an accept of a connection > in active mode > messages with TCP data may be received to the > message queue of the > process calling gen_tcp:accept() before it has > started a process to > handle the specific connection. There is a function > gen_tcp:controlling_process() that redirect these > messages to a new > process and, from what I have been told, actually > move the TCP > messages from the message queue of the first process > to the new > controlling process, > > kent > > > init(Parent, Options) -> > process_flag(trap_exit, true), > > Deb = sys:debug_options(?DBG_OPTS ++ Options), > Port = get_port(Options), > AcceptTimeout = > case application:get_env(rshell, > accept_timeout) of > {ok, AcceptT} -> > AcceptT; > undefined -> > 1000 % > XXX: Create a macro!!! > end, > > Opts = > [ > {nodelay, true}, > {packet,raw}, > {reuseaddr,true} > ], > > % We crash if we can't open the socket to listen > {ok, ListenSocket} = gen_tcp:listen(Port, Opts), > > loop(Parent, Deb, ListenSocket, AcceptTimeout). > > > loop(Parent, Deb, ListenSocket, AcceptTimeout) -> > receive > {system, From, Request} -> > State = {ListenSocket, AcceptTimeout}, > sys:handle_system_msg(Request, From, > Parent, ?MODULE, Deb, State); > What -> > NewDeb = sys:handle_debug(Deb, {?MODULE, > write_debug}, rshell_listener, > {in, What}), > loop(Parent, NewDeb, ListenSocket, > AcceptTimeout) > case gen_tcp:accept(ListenSocket, > AcceptTimeout) of > {ok, Sock} -> > case > supervisor:start_child(rshell_connection_sup, > > [Sock]) of > {ok,Pid} when pid(Pid) -> > > gen_tcp:controlling_process(Sock, Pid), > loop(Parent, Deb, > ListenSocket, AcceptTimeout); > Other -> > NewDeb = > sys:handle_debug(Deb, > > {?MODULE, write_debug}, > > rshell_listener, > > {start_child_result, > > Other}), > gen_tcp:close(Sock), > loop(Parent, NewDeb, > ListenSocket, AcceptTimeout) > end; > {error, timeout} -> > %% This is what we want to > enable system events > loop(Parent, Deb, ListenSocket, > AcceptTimeout); > Other -> > NewDeb = sys:handle_debug(Deb, > > {?MODULE, write_debug}, > > rshell_listener, > > {accept_result,Other}), > loop(Parent, NewDeb, > ListenSocket, AcceptTimeout) > end > end. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From kent@REDACTED Wed Jul 17 16:33:54 2002 From: kent@REDACTED (Kent Boortz) Date: 17 Jul 2002 16:33:54 +0200 Subject: gen_server, gen_tcp question In-Reply-To: <20020717135914.58547.qmail@web40203.mail.yahoo.com> References: <20020717135914.58547.qmail@web40203.mail.yahoo.com> Message-ID: Eric Merritt writes: > Thanks allot this actually clears things up quite a > bit. I do have one question though, the rshell app you > mention does not seem to be in my erlang distro > (R8-1). Do you have any idea where I could get it > from? or do I need to recompile erlang with some > options set? The application is under construction but can be found in the P9 snapshots http://www.erlang.org/download/snapshots/ But I now have been informed that there are better ways to handle this but unfortunately not in detail. There may be some comments about this in the "OTP Application Upgrade FAQ" found at http://www.erlang.org/doc/misc/ kent From cyberlync@REDACTED Wed Jul 17 16:50:13 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 17 Jul 2002 07:50:13 -0700 (PDT) Subject: gen_server, gen_tcp question In-Reply-To: Message-ID: <20020717145013.27303.qmail@web40206.mail.yahoo.com> Kent, Thanks, I eventually found it lol. Btw, this is one of the most readable pieces of erlang code that I have yet seen. Its also very well documented. I am extreamly impressed overall, not what it does so much but in how well its coded. If nothing else it sets a goal for me to shoot for in my own code. Thanks, Eric --- Kent Boortz wrote: > > Eric Merritt writes: > > Thanks allot this actually clears things up quite > a > > bit. I do have one question though, the rshell app > you > > mention does not seem to be in my erlang distro > > (R8-1). Do you have any idea where I could get it > > from? or do I need to recompile erlang with some > > options set? > > The application is under construction but can be > found in the P9 > snapshots > > http://www.erlang.org/download/snapshots/ > > But I now have been informed that there are better > ways to handle this > but unfortunately not in detail. There may be some > comments about this > in the "OTP Application Upgrade FAQ" found at > > http://www.erlang.org/doc/misc/ > > kent __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From richardc@REDACTED Wed Jul 17 17:09:44 2002 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 17 Jul 2002 17:09:44 +0200 (MET DST) Subject: Possible bug using funs In-Reply-To: <005201c22d1a$5ee28ba0$f2b7f2d5@frelin> Message-ID: On Wed, 17 Jul 2002, Fredrik Linder wrote: > Hi, I get the following error when writing a fun: > > 19> > T1=fun([H1|T1],[H2|T2],Acc,Cont)->io:format("~w~n",[Acc]),Cont(T1,T2,[{H1,H2 > }|Acc],Cont); ([],[],Acc,Cont)->lists:reverse(Acc) end. > #Fun > 20> T1([1,2],[1,2],[],T1). > [] > [{1,1}] > ** exited: {{illegal_pattern,{cons,1,{var,1,'H1'},{var,1,'T1'}}}, > [{erl_eval,expr,3}]} ** There was a bug in erl_eval; I've reported it to OTP. Meanwhile, here is a patch. (If the pattern was a cons, but the value was not, it resulted in an illegal pattern error, instead of simply a match failure.) Index: lib/stdlib/src/erl_eval.erl =================================================================== 631a632,633 > match1({cons,_,H,T}, List, Bs0) -> > throw(nomatch); /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From micael.karlberg@REDACTED Wed Jul 17 17:23:06 2002 From: micael.karlberg@REDACTED (Micael Karlberg) Date: 17 Jul 2002 15:23:06 GMT Subject: gen_server, gen_tcp question References: <20020717031123.43672.qmail@web40202.mail.yahoo.com>, <3D35293D.2000501@erlang-consulting.com> Message-ID: In article <3D35293D.2000501@REDACTED>, Francesco Cesarini wrote: > Hi Eric, > welcome to the world of Erlang. > > I assume the problem you have stumbled across is the usage of gen_tcp in > passive modes, making your gen_server hang until receive the request. > (The same applies to receiving data). You will be hanging, and thus > unable to handle code upgrades or other requests sent to the server. You > could use the timeout, but that will generate an unnecessary overhead. > > Your solution is to spawn a process (Not following any behaviors), which > hangs in the call gen_tcp:accept/1 waiting for a connection request. > Make sure this process is linked to your gen_server. When you receive a > request, make your gen_server the controlling process and receive your > packages in active mode using the handle_info call. There is a couple of examples of this in OTP, such as the megaco application (and inets-3.0). The Megaco application TCP transport has a very simple process that does exactly this, except that it is handled by a supervisor. The listen socket itself is created and owned by an other process. > > Should you want to implement code upgrades, make sure you set the > timeout to a very low value. This will kill your listener process. Just > make sure you respawn it after the upgrade. The process that hangs in accept is so simple that it should very rarely need to be upgraded. If it does need to be upgraded, just kill it and it will be restarted by the supervisor, with the new code. > > Hope the above helps. Good documentation on OTP design principles is at > http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html . > > Mickael Remond & I wrote a paper on the "non" usage of OTP outside > Ericsson you might find interesting. You can read about at > http://www.erlang-consulting.com/euc2001/index.htm > > Good Luck, > Francesco > -- > http://www.erlang-consulting.com > > /BMK > > Eric Merritt wrote: > >>Guys, >> >> As some of you may know I am fairly new to erlang. I >>have been poking around a bit getting my feet wet, >>messing with yaws, mnesia, etc. Well I am finally >>getting around to coding a fairly heft application as >>a learning exercise and I have hit a stumbling block. >>I am just begining to write the tcp comm part of the >>application, I would love to follow the otp practices >>and make use of gen_server. There even seems to be >>some arcane way for gen_tcp and gen_server to work >>together for a module. I can't, for the life of me, >>figure it out. The documentation is pretty sparse in >>this area as well. >> >> >> If I missed some documentation somewhere could one of >>you point it out or if I missed something obvious just >>let me know my error. Otherwise a little example would >>be great. >> >>I have spent a significant amount of time searching >>the archives, the net, etc. Also I have attempted to >>look at the inets and yaws source to figure this out. >>The only problem there is that both the inets source >>and the yaws source is largly undocumented. So I tend >>to just get a headache accompanied by very little >>understanding. >> >>So if one of you could point me in the right direction >>that would be great. Otherwise I may have just >>revealed the true magnitude of my ingnorance :) >> >>Thanks, >>Eric >> >>__________________________________________________ >>Do You Yahoo!? >>Yahoo! Autos - Get free new car price quotes >>http://autos.yahoo.com >> >> > > -- Micael Karlberg Mail: micael.karlberg@REDACTED Ericsson AB, ?lvsj? Sweden EAB/UHK/KD From mickael.remond@REDACTED Wed Jul 17 18:19:22 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 Jul 2002 18:19:22 +0200 Subject: Erlang RPM for Mandrake 8.2 -testing- Message-ID: <1026922762.3d35990a956d8@webmail.spamcop.net> Thierry Mallard : > Anyway, as I didn't find Erlang R8B1 RPMs for Mandrake 8.2, I've tried > to build one. It's my first RPM, so things may be wrong.. > > If anyone has the opportunity to have a look at it, and send some > feedback, please do so ;-) This seems to work for me. I need to do some more test. It would be great to have this RPM added into the Linux Mandrake distribution. The Mandrake Club now allow volonteer to submit third parties RPM for integration in the distribution. If you agree, I can, as a mandrake club member, submit your RPM on your behalf. -- Micka?l R?mond From cyberlync@REDACTED Wed Jul 17 20:31:52 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 17 Jul 2002 11:31:52 -0700 (PDT) Subject: gen_server, gen_tcp question In-Reply-To: Message-ID: <20020717183152.86300.qmail@web40205.mail.yahoo.com> Here is the text from the relevent faq entry --> Q.11 : One process in my application is typically hanging in a call to gen_tcp:accept/1 waiting for a connection request. How do I perform code change for that process? A: Let the implementation be such that another process holds the listen socket and is linked to the process hanging in gen_tcp:accept/1. Specify an update code upgrade instruction with a very short timeout, which will cause the process to be killed almost immediately by the release handler, before the new version of the call-back module for the process is loaded. Then let the other process restart the process calling gen_tcp:accept/1. (I am still not thinking in erlang yet so forgive me if I miss something obvious). In the server portion after creating the listen socket you would spawn a process whose only job would be to accept any incoming connections? This is fairly strait forward. I assume that you would not want this process to spawn the worker thread to handle the connection, considering it should be as simple as possible? What should it do with an excepted socket then? Message it back to the server and let the server handle it? I hope I am not displaying to much ignorance here. Thanks, Eric --- Kent Boortz wrote: > > Eric Merritt writes: > > Thanks allot this actually clears things up quite > a > > bit. I do have one question though, the rshell app > you > > mention does not seem to be in my erlang distro > > (R8-1). Do you have any idea where I could get it > > from? or do I need to recompile erlang with some > > options set? > > The application is under construction but can be > found in the P9 > snapshots > > http://www.erlang.org/download/snapshots/ > > But I now have been informed that there are better > ways to handle this > but unfortunately not in detail. There may be some > comments about this > in the "OTP Application Upgrade FAQ" found at > > http://www.erlang.org/doc/misc/ > > kent __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From francesco@REDACTED Wed Jul 17 21:17:10 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 17 Jul 2002 20:17:10 +0100 Subject: gen_server, gen_tcp question References: <20020717183152.86300.qmail@web40205.mail.yahoo.com> Message-ID: <3D35C2B6.5020306@erlang-consulting.com> > > >In the server portion after creating the listen socket >you would spawn a process whose only job would be to >accept any incoming connections? > Yes. Once a connection has been accepted, you pass control of that socket to a server. (And as Kent said, make sure you handle possible incoming packets which might be sent to this process before control has been passed). >I assume that you would not want this process >to spawn the worker thread to handle the connection, >considering it should be as simple as possible? > More than spawning another process, you would could instead spawn a new OTP behavior. It all depends on the nature of your application. > What >should it do with an excepted socket then? Message it >back to the server and let the server handle it? > If you want to allow your server to handle many connections, then the answer is yes. Otherwise, if you want one server per connection, than you are better off spawning a new behavior. Regards, Francesco -- http://www.erlang-consulting.com From cyberlync@REDACTED Wed Jul 17 21:26:03 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 17 Jul 2002 12:26:03 -0700 (PDT) Subject: gen_server, gen_tcp question In-Reply-To: <3D35C2B6.5020306@erlang-consulting.com> Message-ID: <20020717192603.95087.qmail@web40205.mail.yahoo.com> > Yes. Once a connection has been accepted, you pass > control of that > socket to a server. (And as Kent said, make sure you > handle possible > incoming packets which might be sent to this process > before control has > been passed). Yes this is a given, my question would be should the spawn functionality be in the process that accepts the connection or somewhere else? Basically how simple should the accept process be kept? > More than spawning another process, you would could > instead spawn a new > OTP behavior. It all depends on the nature of your > application. ..[snip].. > If you want to allow your server to handle many > connections, then the > answer is yes. Otherwise, if you want one server per > connection, than > you are better off spawning a new behavior. I assume that by new behaviour, you intend to spawn a supervised process that implements the gen_server behaviour. This would make sense. Mr. Cesarini, Kent, and everyone else, thanks for all your help. You have been very generous with a newbie. Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From thierry.mallard@REDACTED Wed Jul 17 21:50:10 2002 From: thierry.mallard@REDACTED (Thierry Mallard) Date: Wed, 17 Jul 2002 21:50:10 +0200 Subject: Erlang RPM for Mandrake 8.2 -testing- In-Reply-To: <1026922762.3d35990a956d8@webmail.spamcop.net> References: <1026922762.3d35990a956d8@webmail.spamcop.net> Message-ID: <20020717195010.GA12222@calvin.local.vawis.net> On Wed, Jul 17, 2002 at 06:19:22PM +0200, Mickael Remond wrote: > Thierry Mallard : > [ Erlang Mandrake 8.2 RPM ] > It would be great to have this RPM added into the Linux Mandrake distribution. > The Mandrake Club now allow volonteer to submit third parties RPM for > integration in the distribution. If you agree, I can, as a mandrake club member, > submit your RPM on your behalf. No need to do so, I'm in the club too ;-) I'm also in touch with a Mandrake developer to polish the thing and hopefully propose it for the next release.. Thanks for the feedback ! -- Thierry Mallard http://vawis.net From cpressey@REDACTED Thu Jul 18 09:57:35 2002 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 18 Jul 2002 02:57:35 -0500 Subject: Yaws API discussion In-Reply-To: <1026888057.3d35117964690@webmail.spamcop.net> References: <1026888057.3d35117964690@webmail.spamcop.net> Message-ID: <20020718025735.63d45b02.cpressey@catseye.mb.ca> On Wed, 17 Jul 2002 08:40:57 +0200 Mickael Remond wrote: > Chris Pressey : > > > I think the success of Open Source has been more to do with widespread > > peer-review. More eyeballs on the code means more bugs are caught. > > This is another aspect about Open Source that surely cannot be leveraged > if there is one Open Source by user/developper. It implies that users > and developpers make the effort to collaboratively think on how to > improve the software and care about this improvment. Sorry, I don't see your logic here. A bug is a bug - it doesn't take a group of people to determine that a program does not do what it claims to do. It takes just one person trying something no one else thought of. (Unless the design goals are less than clearly specified - in which case, the group will have to decide if the behaviour is a bug or a feature. But even then, it is still the core developers who will make that judgement.) > > But one person's idea of a cool improvement is another person's cruft. > > Why should I force my ideas on Klacke's project when it's clear that > > we have different priorities? Maybe he doesn't want an integrated > > cookieless user system based on a database of IP addresses with > > timeouts, whereas I do. Maybe I could just take yaws and make my > > "improvements" to it, but then I'd have Chris' Hacked Version of Yaws, > > which wouldn't be any better than something original of mine. In fact > > it would probably be worse in the long run, as I can barely follow his > > code as it rapidly progresses. > > In fact developping an HTTP server is fairly easy. It is also fairly > easy to start a project. > In fact the first reaction when looking at a project is often the > following: people find often difficult to extend the code to make it > comptible with their own need. So it is easy to conclude that the code > may be poorly design and that rewriting the same thing from scratch will > improve it. This is *exactly* Klacke's rationale for yaws over php, btw. > And it often and up with a code impleting nearly the same > set of functions and that is difficult to extend and not very generic. If it is a hack job, as so many projects are, yes it will be difficult to extend. But people who look at an existing piece of code and conclude that it is poorly designed and that they could design something better usually try to make something that is *less* of a hack job. Sometimes they succeed. The alternative is to try to patch the existing design, which may very well break it and/or create some redundant (deprecated) functionality. The result is often ugly, complex, and even harder to understand and maintain. Take Daniel J Bernstein's qmail as an example of the potential success of a non-collaborative project. It is elegant, reliable, generalized and extensible. It was written by one person and isn't even technically Open Source software by OSI's definition, but I'd use it over sendmail anyday. I dread to think what the result would have been had he tried to adapt sendmail to achieve his design goals! > Actually, many open source project are launched and concentrate on easy > parts. And then the author get to the point that this is more difficult > to progress, to make it more generic and to cover more users needs > because it is the easiest part has been developped and the next effort, > extension and so on are the more difficult part. > > If everyone think this way, the difficult part will never be tackle. But luckily not *everyone* works that way. Some do, some don't. I tend to think the most difficult part should be tackled before a single line of code gets written. Unfortunately not many Open Source developers posess much foresight, and would rather take the expedient approach of debugging a project into existence. > I think this is the real challenge here. And that is why collaboratively > thinking of the project evolution is necessary. While feedback is always good, I think what this challenge warrants is a well-thought-out, realistic plan *before* starting out. > Oh sure, you need to discuss and find a compromise but when reached this > compromise might lead to better code, more generic, and so on. > > When we developped the SOAP server we decided to implement our own http > lib. This was a mistake and today I would build this project on an > existing http server. > > For your specific need about user session, I think you should have a > look at Inets. The design is modular and makes it possible to add such > functionnalities on top of a full-feature and tested http server. But (for example) I want users to be able to upload files with a multpart/form-data form and to choke off the transfer with a 413 error if the file size exceeds the user's quota. How can this be done in Inets or yaws without resorting to a grody hack? In fact (unless I am mistaken; I am not an expert at Inets or yaws code) it seems that neither of these webservers store an uploaded file from a multipart form in a temporary file as it is being recieved. If a user uploads a file many megabytes in size, it seems to me that storing it on the heap could cause some severe problems with virtual memory swapping &c. (This is guesswork though; I have yet to actually try this with them.) > > I think that's a bit of a pipe dream... in my experience, Open Source > > projects are generally written and maintained by a small team of > > developers, or even a single person; everyone else mainly just sends > > in bug reports and suggestions. Collaborative design tends to result > > in a'too many cooks spoil the broth' situation in the pursuit of a > > 'one size fits all' solution. > > It might, but this risks should be taken to provide better tools. Why is taking this risk preferable to taking the risk of starting over? Forgive me, but you haven't shown why collaborative thinking is necessary, you've just asserted that it is. You've shown that it's difficult to turn a hack job into an elegant, general solution, and I agree. But it doesn't automatically follow from that that a group effort makes it any easier to turn a hack job into an elegant solution, or that an individual effort to independently create a new elegant solution is wasteful. -Chris From igouy@REDACTED Thu Jul 18 23:52:38 2002 From: igouy@REDACTED (isaac gouy) Date: Thu, 18 Jul 2002 14:52:38 -0700 (PDT) Subject: Erlang killer app? Message-ID: <20020718215238.22169.qmail@web20506.mail.yahoo.com> Please excuse my ignorance of most things Erlang, and my outsiders perspective. >an Erlang application server efficient and easy >to use might become an Erlang killer app I had the impression that there already was an "Erlang killer app" - building telcomm systems and apps? I also got a vague impression that within Ericsson there's ongoing debate about whether Erlang should be used on this project or that project...? As an outsider, I'd like to know that Erlang is still used on new projects within the domain it was designed for. "Eddie" seems to play to Erlangs strengths wonderfully. That was nearly 2 years ago. But at least it played to Erlangs strengths. Is string manipulation/web page templating something that really plays to Erlangs strengths? Or would it be more obvious to use Tcl/Perl/Python/... for that (with something like IDX-spyerl?). I don't know. I *believe* there's value in improving how Erlang plays with other technologies, rather than trying to do everything in Erlang. Yes, Erlang Server Pages let the Erlang community create dynamic web pages, but they won't bring outsiders to Erlang. Smalltalk Server Pages never brought others to Smalltalk :-( best wishes, Isaac http://www.mozart-oz.org/ seems to build on the Erlang heritage. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From hakanm@REDACTED Fri Jul 19 00:12:23 2002 From: hakanm@REDACTED (Hakan Millroth) Date: Thu, 18 Jul 2002 15:12:23 -0700 Subject: Erlang killer app? References: <20020718215238.22169.qmail@web20506.mail.yahoo.com> Message-ID: <3D373D47.30408@nortelnetworks.com> > As an outsider, I'd like to know that Erlang is still > used on new projects within the domain it was designed > for. It is used in several products from Nortel Networks, with thousands of deployed systems. Hakan Millroth Nortel Networks Santa Clara, CA, USA From thantos@REDACTED Fri Jul 19 01:21:35 2002 From: thantos@REDACTED (Alexander Williams) Date: Thu, 18 Jul 2002 19:21:35 -0400 Subject: Erlang killer app? In-Reply-To: <20020718215238.22169.qmail@web20506.mail.yahoo.com> References: <20020718215238.22169.qmail@web20506.mail.yahoo.com> Message-ID: <20020718232135.GA13202@telocity.com> On Thu, Jul 18, 2002 at 02:52:38PM -0700, isaac gouy wrote: > Is string manipulation/web page templating something Personally, I wish Erlang had somewhat stronger support for string manipulation -- since currently I use Python for my quick-hack bits, and I'd really love to use Erlang for the bits instead. (Replicating the Python "os", "os.path", and "string" modules would be an excellent first stop, there; and yes, I'm aware that Erlang isn't really intended to be a stand-alone script system.) If you count the number of times I use string.split in a typical hack, I fear the counter will spin wildly. :) -- Alexander Williams (thantos@REDACTED) | http://www.chancel.org | ============================================================================ "Have you no love for imagination?" asked the Lady Vijaya. | "I have no love for anything that does not exist," answered Lord Kurian. | "The things not found in this world resent me for living in it. They would | kill me, I think, and savor the deed, were not their fangs and claws and | blades as illusory as they." | --from The Divine Hunt, by Michael Kay | From martin@REDACTED Fri Jul 19 04:08:37 2002 From: martin@REDACTED (Martin L.W. Hall, Ph.D.) Date: Thu, 18 Jul 2002 19:08:37 -0700 Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <20020718215238.22169.qmail@web20506.mail.yahoo.com> Message-ID: <5.1.0.14.2.20020718190611.02b57160@localhost> I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 and/or Mandrake 8.2. I am not having much luck on either one. Can someone give me suggestions, pointers, binaries or something? Thanks, ----Martin---- From cyberlync@REDACTED Fri Jul 19 05:23:33 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 18 Jul 2002 20:23:33 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: <20020718215238.22169.qmail@web20506.mail.yahoo.com> Message-ID: <20020719032333.54138.qmail@web40210.mail.yahoo.com> Isaac, Just creating erlang server pages wont do it. You would have to create and easy, efficient, system for web application construction. Zope is probably pretty close but its not thier yet, JSP/Servlets/Struts(coccoon?) is close as well, but still has a ways to go. It would almost have to be a two level system. Something that would do most of the work for quick scripts (and poor programmers) and not hinder an experienced programmer (in fact it should help significantly) get the job done. In this case, I think erlang would beat the python and java solutions in speed and flexability (depending on who coded it and how it is coded). It would take quite allot of expertise in many areas to do it right, (that probably exists here on the list) but it wouldnt be a simple undertaking. In one way you are right, ESP (thats kind of a cool acronym lol) alone would not do it, but a technology that elegently fills a current need and makes programmers more productive would have a very good chance of doing it. --- isaac gouy wrote: > Please excuse my ignorance of most things Erlang, > and > my outsiders perspective. > > >an Erlang application server efficient and easy > >to use might become an Erlang killer app > I had the impression that there already was an > "Erlang > killer app" - building telcomm systems and apps? > > I also got a vague impression that within Ericsson > there's ongoing debate about whether Erlang should > be > used on this project or that project...? > > As an outsider, I'd like to know that Erlang is > still > used on new projects within the domain it was > designed > for. > > > "Eddie" seems to play to Erlangs strengths > wonderfully. That was nearly 2 years ago. But at > least > it played to Erlangs strengths. > > Is string manipulation/web page templating something > that really plays to Erlangs strengths? Or would it > be > more obvious to use Tcl/Perl/Python/... for that > (with > something like IDX-spyerl?). I don't know. > > I *believe* there's value in improving how Erlang > plays with other technologies, rather than trying to > do everything in Erlang. Yes, Erlang Server Pages > let > the Erlang community create dynamic web pages, but > they won't bring outsiders to Erlang. Smalltalk > Server > Pages never brought others to Smalltalk :-( > > best wishes, Isaac > > http://www.mozart-oz.org/ seems to build on the > Erlang > heritage. > > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Autos - Get free new car price quotes > http://autos.yahoo.com __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From cyberlync@REDACTED Fri Jul 19 05:25:17 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 18 Jul 2002 20:25:17 -0700 (PDT) Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: <20020719032517.89636.qmail@web40208.mail.yahoo.com> Martin, It might help if you provided the error message. Thanks, Eric --- "Martin L.W. Hall, Ph.D." wrote: > > I am new to the list. I am trying to get Erlang to > compile on FreeBSD 4.5 > and/or Mandrake 8.2. I am not having much luck on > either one. Can someone > give me suggestions, pointers, binaries or > something? > > Thanks, > ----Martin---- > __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From vladimir.sekissov@REDACTED Fri Jul 19 01:58:00 2002 From: vladimir.sekissov@REDACTED (Vladimir Sekissov) Date: Fri, 19 Jul 2002 05:58:00 +0600 (YEKST) Subject: gen_server, gen_tcp question In-Reply-To: <20020717192603.95087.qmail@web40205.mail.yahoo.com> References: <3D35C2B6.5020306@erlang-consulting.com> <20020717192603.95087.qmail@web40205.mail.yahoo.com> Message-ID: <20020719.055800.98878580.vladimir.sekissov@saburovo.com> Good day, In the attachments is the library where I tried to gather practices I learned from design of pico, inet, wiki and other packages. Short description: tac_listen.erl - base server module; tac_connect.erl - base client module; tac_socket_mdr.erl - common mediator between transport, packet and protocol layers; tac_tcp_socket.erl - TCP transport tac_udp_socket.erl - UDP transport For specific application you need to code packet module and protocol module. Interface is explained in comments in tac_socket_mdr.erl Examples from real application. Server: ... start_listener(ConfigDB) -> Port = tac_util:lookup(ConfigDB, port), SKey = tac_util:lookup(ConfigDB, skey), MaxConn = tac_util:lookup(ConfigDB, max_connections), TrMod = tac_tcp_socket, PctFun = tac_packet:make_packer(SKey), PrtFun = tacacs_fsm:make_fsm(server, self(), []), Args = [{transp_opts, [{packet, 0}, {reuseaddr,true}]}, {max, MaxConn}], tac_listen:start_link(Port, TrMod, PctFun, PrtFun, Args). Client: ... SockPid = spawn_link(tac_connect, start, [Host, Port, TrMod, PctFun, PrtFun, TrArgs]), SockPid ! {data, Self, Data}, Ret = receive {return, _, Result} -> Result; {'EXIT', SockPid, Reson} -> {error, Reson} end, May be this code help you. I would be glad to get your advises also. Best Regards, Vladimir Sekissov cyberlync> > Yes. Once a connection has been accepted, you pass cyberlync> > control of that cyberlync> > socket to a server. (And as Kent said, make sure you cyberlync> > handle possible cyberlync> > incoming packets which might be sent to this process cyberlync> > before control has cyberlync> > been passed). cyberlync> Yes this is a given, my question would be should the cyberlync> spawn functionality be in the process that accepts the cyberlync> connection or somewhere else? Basically how simple cyberlync> should the accept process be kept? cyberlync> cyberlync> > More than spawning another process, you would could cyberlync> > instead spawn a new cyberlync> > OTP behavior. It all depends on the nature of your cyberlync> > application. cyberlync> ..[snip].. cyberlync> > If you want to allow your server to handle many cyberlync> > connections, then the cyberlync> > answer is yes. Otherwise, if you want one server per cyberlync> > connection, than cyberlync> > you are better off spawning a new behavior. cyberlync> cyberlync> I assume that by new behaviour, you intend to spawn a cyberlync> supervised process that implements the gen_server cyberlync> behaviour. This would make sense. cyberlync> cyberlync> Mr. Cesarini, Kent, and everyone else, thanks for all cyberlync> your help. You have been very generous with a newbie. cyberlync> cyberlync> Thanks, cyberlync> Eric cyberlync> cyberlync> __________________________________________________ cyberlync> Do You Yahoo!? cyberlync> Yahoo! Autos - Get free new car price quotes cyberlync> http://autos.yahoo.com -------------- next part -------------- %%%---------------------------------------------------------------------- %%% File : tac_socket_mdr.erl %%% Author : %%% Purpose : Socket mediator between transport and protocol levels %%% Created : 1 Jul 2002 by %%%---------------------------------------------------------------------- %% %% $Id$ %% %% $Log$ %% %%** %% %% .* tac_socket_mdr %% %%* -module(tac_socket_mdr). -author('svg@REDACTED'). -export([server/6, client/4]). -include("dbg.hrl"). %%% Transport module interface %% %% listen(Port, Max, TrOpts) -> {ok, ListenPid} | Error %% accept(ListenPid) -> {ok, Socket} | Error %% recv(init, Socket, Timeout) -> {ok, InitState} | Error %% recv(next, Socket, State) -> {ok, Bin, NextState} | Error %% recv(cancel, Socket, State) -> ok | Error %% send(Socket, Bin) -> ok | Error %% close(Socket) -> ok | Error %% sockname(Socket) -> {ok, {IP, Port}} | Error %% peername(Socket) -> {ok, {IP, Port}} | Error %% Error {error, Error} %% %%% %%% Packet function interface %% PacketFun(Binary, AccBinary) -> Next %% initial call to receive next packet %% Binary currently received block %% AccBinary rest from previous block %% Next {more, ContFun, ContState} - get next block and continue with ContFun %% ContFun(Binary, ContState) %% {done, Packet, RestBin} - packet recieved %% Packet - curried to protocol function %% RestBin == AccBinary for next PacketFun call %% PacketFun(pack, Packet) -> Result %% pack packet %% Result {packet, Data} %% Data - curried to transport module for sending %%% Protocol function interface %% ProtoFun(start, {Socket, TrMod}) -> Next %% TrMod - transport module, we can get local/remote peer from Socket here %% ProtoFun(Event, State) -> Next %% Event start - initial state %% {recv, Packet} - Packet received %% sended - packet sended %% continue, - previous protocol function requested continuation with %% this function %% Next {continue, Packet, CntFun, CntState, Timeout} - %% send Packet and receive next %% {continue, CntPrtFun, CntState} - switch to ContPrtFun %% {recv, CntPrtFun, CntState} - receive packet %% {send, Packet, CntPrtFun, CntState} - send packet and continue %% {done, Packet} - send packet and exit normally %% done - normal exit %% {error, Error} - abnormal exit with {badproto,Error} %% %% start_socket(Parent, LrPid, TrMod, PctFun, PrtFun, AclFun) -> Result %% Result nothing | exit(Reson) %% Reson normal %% | {deny, {RemPeer, LocalPeer}} %% | {badproto,Error} %% | {bad_proto_fun, Error} %% | {badpacket, Error} %% | {bad_packet_fun, Error} %% | {badsock, Error} %% Error term %% Parent socket manager %% LrPid listener pid %% TrMod transport module %% PctFun packet fun %% PrtFun protocol fun %% AclFun ACL fun server(Parent, LrPid, TrMod, PctFun, PrtFun, AclFun) -> case catch TrMod:accept(LrPid) of {error, closed} -> exit(normal); {error, Error} -> exit(Error); {'EXIT', Error} -> exit(Error); {ok, Socket} -> ask_acl(Socket, TrMod, AclFun), tac_listen:new_connect(Parent, self()), socket_loop(Socket, TrMod, PctFun, PrtFun) end. client(Socket, TrMod, PctFun, PrtFun) -> socket_loop(Socket, TrMod, PctFun, PrtFun). ask_acl(Socket, TrMod, AclFun) -> {ok, LocalPeer} = TrMod:sockname(Socket), {ok, RemPeer} = TrMod:peername(Socket), case AclFun(RemPeer, LocalPeer) of permit -> ok; _ -> exit({deny, {RemPeer, LocalPeer}}) end. socket_loop(Socket, TrMod, PctFun, PrtFun) -> socket_loop(Socket, TrMod, PctFun, PrtFun, start, {Socket, TrMod}, <<>>). socket_loop(Socket, TrMod, PctFun, PrtFun, PrtData, PrtState, AccBin) -> ?dbg("next ~w with state ~w", [PrtData, PrtState]), case catch PrtFun(PrtData, PrtState) of {continue, Packet, CntPrtFun, CntState, RecvTimeout} -> send_packet(Socket, TrMod, PctFun, Packet), {Data, RestBin} = recv_packet(Socket, TrMod, PctFun, AccBin, RecvTimeout), socket_loop(Socket, TrMod, PctFun, CntPrtFun, {recv, Data}, CntState, RestBin); {continue, CntPrtFun, CntState} -> socket_loop(Socket, TrMod, PctFun, CntPrtFun, continue, CntState, AccBin); {recv, CntPrtFun, CntState, RecvTimeout} -> {Data, RestBin} = recv_packet(Socket, TrMod, PctFun, AccBin, RecvTimeout), socket_loop(Socket, TrMod, PctFun, CntPrtFun, {recv, Data}, CntState, RestBin); {send, Packet, CntPrtFun, CntState} -> send_packet(Socket, TrMod, PctFun, Packet), socket_loop(Socket, TrMod, PctFun, CntPrtFun, sended, CntState, AccBin); {done, Packet} -> send_packet(Socket, TrMod, PctFun, Packet), TrMod:close(Socket); done -> TrMod:close(Socket); {error, Error} -> TrMod:close(Socket), exit({badproto,Error}); Other -> TrMod:close(Socket), exit({bad_proto_fun, Other}) end. recv_packet(Socket, TrMod, PctFun, AccBin, Timeout) -> TrState = TrMod:recv(init, Socket, Timeout), recv_packet_loop(Socket, TrMod, PctFun, AccBin, TrState). recv_packet_loop(Socket, TrMod, PctFun, PctState, TrState) -> case TrMod:recv(next, Socket, TrState) of {ok, Bin, NxtState} -> case catch PctFun(Bin, PctState) of {more, CntFun, CntState} -> recv_packet_loop(Socket, TrMod, CntFun, CntState, NxtState); {done, Data, RestBin} when binary(RestBin) -> TrMod:recv(cancel, Socket, TrState), {Data, RestBin}; {error, Reson} -> TrMod:close(Socket), exit({badpacket, Reson}); {'EXIT', Reson} -> TrMod:close(Socket), ?dbg("error ~w", [Reson]), exit({packet_parse, Reson}); Other -> TrMod:close(Socket), exit({bad_packet_fun, Other}) end; {error, Reson} -> exit({badsock, Reson}) end. send_packet(Socket, TrMod, PctFun, Packet) -> case catch PctFun(pack, Packet) of {packet, Bin} -> case TrMod:send(Socket, Bin) of ok -> ok; {error, Reson} -> exit({badsock, Reson}) end; {error, Reson} -> TrMod:close(Socket), exit({badpacket, Reson}); {'EXIT', Reson} -> TrMod:close(Socket), ?dbg("error ~w", [Reson]), exit({packet_pack, Reson}); Other -> TrMod:close(Socket), exit({bad_packet_fun, Other}) end. -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : tac_tcp_socket.erl %%% Author : %%% Description : %%% %%% Created : 14 Jun 2002 by %%%------------------------------------------------------------------- %% %% $Id$ %% %% $Log$ %% %%** %% %% .* tac_udp_socket %% %%* -module(tac_udp_socket). -export([listen/3, connect/3, connect/4, info/2, accept/1, close/1]). -export([send/2, recv/3, sockname/1, peername/1]). -include("dbg.hrl"). -define(COMMON_TIMEOUT, 5000). -record(state,{master, % listen process acceptor=false, % current acceptor active=[], % active connections socket, % socket inq = queue:new(), % input queue inq_size = 0, % input queue size inq_max}). % input queue max size -record(tac_udp_socket, {listen_pid, peer}). listen(Port, Max, Opts) -> DefOpts = [binary, {active, true}], Params = DefOpts ++ Opts, case gen_udp:open(Port, Params) of {ok, Socket} -> Self = self(), LrPid = spawn_link(fun () -> start_listener(Self, Socket, Max) end), gen_udp:controlling_process(Socket, LrPid), LrPid ! {start, Self}, {ok, LrPid}; Error -> Error end. %% Start listener on any port, register ourselves as acceptor %% and send dummy package to listener to emulate connection %% so we can use the same interface as client %% connect/4 is only for compatibility with common interface %% connection timeout is never used connect(Addr, Port, Opts) -> connect(Addr, Port, Opts, none). connect(Addr, Port, Opts, _Timeout) -> {ok, LrPid} = listen(0, 1, Opts), {ok, IP} = inet:getaddr(Addr, inet), LrPid ! {udp, false, IP, Port, connect}, {ok, Socket} = accept(LrPid), receive {recv, LrPid, connect} -> {ok, Socket} end. accept(LrPid) -> LrPid ! {accept, self()}, receive {connected, LrPid, Socket} -> {ok, Socket}; {error, LrPid, Reson} -> {error, Reson} end. close(Pid) when pid(Pid) -> exit(Pid, normal); close(S=#tac_udp_socket{listen_pid=LrPid, peer=Peer}) -> LrPid ! {close, self(), Peer}, receive {closed, LrPid} -> ok; {error, LrPid, Reson} -> {error, Reson} end. send(S=#tac_udp_socket{listen_pid=LrPid, peer=Peer}, Bin) -> LrPid ! {send, self(), Peer, Bin}, receive Ret={sended, LrPid} -> ok; {error, LrPid, Reson} -> {error, Reson} end. recv(init, _S, Timeout) when integer(Timeout); Timeout == infinity -> recv(init, _S, {0, Timeout}); recv(init, _S, RS={Size, Timeout}) when integer(Size), Size >= 0 -> RS; recv(next, S, State) -> do_recv(S, State, <<>>); recv(cancel, _S, _State) -> ok. info(S=#tac_udp_socket{listen_pid=LrPid}, Query) -> info(LrPid, Query); info(LrPid, Query) when pid(LrPid) -> LrPid ! {info, self(), Query}, receive {info, LrPid, Answer} -> {ok, Answer} after ?COMMON_TIMEOUT -> {error, timeout} end. start_listener(Serv, Socket, Max) -> receive {start, Serv} -> process_flag(trap_exit, true), listener_loop(#state{socket=Socket, master=Serv, inq_max=Max}) end. listener_loop(S=#state{master=Mr, acceptor=Current, active=Active, socket=Sock}) -> Self = self(), receive {sockname, From} -> From ! {sockname, Self, inet:sockname(Sock)}, listener_loop(S); {accept, Pid} -> set_acceptor(Pid, S); {close, From, Peer} -> close_socket(From, Peer, S); {send, From, Peer, Data} -> send_to_socket(From, Peer, Data, S); {recv, From, Peer} -> recv_from_socket(From, Peer, S); {info, From, state} -> From ! {info, Self, S}, listener_loop(S); {'EXIT', Mr, Reson} -> exit(Reson); {'EXIT', Self, Reson} -> exit(Reson); {'EXIT', Current, Reson} -> listener_loop(S#state{acceptor=false}); {'EXIT', Pid, Reson} -> listener_loop(S#state{active=active_delete(Pid, Active)}); {udp, _S, IP, Port, Data} -> dispatch_packet({IP, Port}, Data, S); Other -> {ok, Peer} = inet:sockname(Sock), error_logger:format("~w:~p Unexpected message: ~p~n", [?MODULE, Peer, Other]), listener_loop(S) end. set_acceptor(Pid, S=#state{socket=Sock, acceptor=false}) -> % inet:setopts(Sock, [{active, once}]), link(Pid), new_connection(S#state{acceptor=Pid}); set_acceptor(Pid, S=#state{acceptor=Current}) when pid(Current) -> Pid ! {error, self(), already_exist}, listener_loop(S). dispatch_packet(Peer, Data, S=#state{active=Active}) -> case active_lookup(Peer, Active) of undefined -> new_connection(Peer, Data, S); {Pid, _} -> Pid ! {recv, self(), Data}, listener_loop(S) end. new_connection(S=#state{acceptor=Pid, inq=Q, inq_size=QSz}) when pid(Pid) -> case queue:out(Q) of {empty, NQ} -> %input queue is empty listener_loop(S); {{value, {Peer, Data}}, NQ} -> new_connection(Peer, Data, S#state{inq=NQ, inq_size=QSz - 1}) end. new_connection(Peer, Data, S=#state{acceptor=false, inq=Q, inq_size=QSz, inq_max=Max}) -> if QSz >= Max -> listener_loop(S); % no active acceptors, queue is full - discard true -> % put in queue listener_loop(S#state{inq=queue:in({Peer, Data}, Q), inq_size=QSz+1}) end; new_connection(Peer, Data, S=#state{master=Mr, acceptor=Current, active=Active}) -> NewSocket = #tac_udp_socket{listen_pid=self(), peer=Peer}, Current ! {connected, self(), NewSocket}, Current ! {recv, self(), Data}, listener_loop(S#state{acceptor=false, active=active_add({Current, Peer}, Active)}). send_to_socket(Pid, Peer={IP, Port}, Data, S=#state{socket=Sock}) -> case gen_udp:send(Sock, IP, Port, Data) of ok -> Pid ! {sended, self()}; {error, Reson} -> Pid ! {error, self(), Reson} end, listener_loop(S). recv_from_socket(From, Peer, S=#state{socket=Sock}) -> % inet:setopts(Sock, [{active, once}]), listener_loop(S). close_socket(Pid, Peer, S=#state{active=Active}) -> NewActive = active_delete({Pid, Peer}, Active), if length(NewActive) == length(Active) -> Pid ! {error, self(), not_exist}; true -> Pid ! {closed, self()} end, listener_loop(S#state{active=NewActive}). sockname(S=#tac_udp_socket{listen_pid=LrPid, peer=Peer}) -> LrPid ! {sockname, self()}, receive {sockname, LrPid, Ret} -> Ret; {error, LrPid, Reson} -> {error, Reson} end. peername(S=#tac_udp_socket{peer=Peer}) -> {ok, Peer}. do_recv(S=#tac_udp_socket{listen_pid=LrPid, peer=Peer}, State = {Size, Timeout}, AccBin) -> receive {recv, LrPid, RecvBin} -> Bin = erlang:concat_binary([AccBin, RecvBin]), BinSize = size(Bin), if (Size == 0) or (BinSize == Size) -> {ok, Bin, State}; BinSize < Size -> do_recv(S, State, Bin); true -> {RetBin, _} = erlang:split_binary(Bin, Size), {ok, RetBin, State} end; {error, LrPid, Reson} -> {error, Reson} after Timeout -> {error, timeout} end. active_add(New, Active) -> [New|Active]. active_delete(Pid, Active) when pid(Pid) -> [Conn || Conn <- Active, element(1, Conn) =/= Pid]; active_delete(Conn, Active) -> lists:delete(Conn, Active). active_lookup(Pid, Active) when pid(Pid) -> case lists:keysearch(Pid, 1, Active) of {value, V} -> V; _ -> undefined end; active_lookup(Peer={_IP, _Port}, Active) -> case lists:keysearch(Peer, 2, Active) of {value, V} -> V; _ -> undefined end. %%start_timer(infinity, _) -> %% infinity; %%start_timer(Timeout, Msg) -> %% erlang:start_timer(Timeout, self(), Msg). %% %%cancel_timer(infinity) -> %% ok; %%cancel_timer(Ref) -> %% erlang:cancel_timer(Ref), %% receive %% {timeout, Ref, _} -> %% ok %% after 0 -> %% ok %% end. -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : tac_tcp_socket.erl %%% Author : %%% Description : %%% %%% Created : 14 Jun 2002 by %%%------------------------------------------------------------------- %% %% $Id$ %% %% $Log$ %% %%** %% %% .* tac_tcp_socket %% %%* -module(tac_tcp_socket). -export([listen/3, connect/3, connect/4, accept/1, close/1]). -export([send/2, recv/3, sockname/1, peername/1]). -include("dbg.hrl"). -record(state, {socket, master}). listen(Port, Max, Opts) -> DefOpts = [binary, {active, false}], BackLog = if is_integer(Max) -> [{backlog, Max}]; true -> [] end, Params = BackLog ++ DefOpts ++ Opts, case gen_tcp:listen(Port, Params) of {ok, Socket} -> Self = self(), LrPid = spawn_link(fun () -> start_listener(Self, Socket) end), gen_tcp:controlling_process(Socket, LrPid), LrPid ! {start, Self}, {ok, LrPid}; Error -> Error end. connect(Addr, Port, Opts) -> connect(Addr, Port, Opts, infinity). connect(Addr, Port, Opts, Timeout) -> {ok, IP} = inet:getaddr(Addr, inet), gen_tcp:connect(IP, Port, [binary, {packet, 0}, {active, false}|Opts], Timeout). accept(LrPid) when pid(LrPid) -> gen_tcp:accept(get_socket(LrPid)). close(Pid) when pid(Pid) -> exit(Pid, normal); close(S) -> gen_tcp:close(S). send(S, Bin) -> case gen_tcp:send(S, Bin) of ok -> ok; Error -> close(S), Error end. sockname(Pid) when pid(Pid)-> sockname(get_socket(Pid)); sockname(S) -> inet:sockname(S). peername(S) -> inet:peername(S). get_socket(LrPid) -> LrPid ! {get_socket, self()}, receive {socket, LrPid, Socket} -> Socket end. recv(init, _S, Timeout) when integer(Timeout); Timeout == infinity -> recv(init, _S, {0, Timeout}); recv(init, _S, RS={Size, Timeout}) when integer(Size); Size >= 0 -> RS; recv(next, S, {Size, Timeout}) -> do_recv(S, Size, Timeout); recv(cancel, _S, _RS) -> ok. %% Internal funs do_recv(S, Size, Timeout) -> NxtState = {Size, Timeout}, case gen_tcp:recv(S, Size, Timeout) of {ok, Data} -> {ok, Data, NxtState}; Error={error, timeout} -> Error; Error={error, Reson} -> gen_tcp:close(S), Error; Other -> gen_tcp:close(S), {error, Other} end. start_listener(Serv, Socket) -> receive {start, Serv} -> process_flag(trap_exit, true), listener_loop(#state{socket=Socket, master=Serv}) end. listener_loop(S=#state{master=Mr, socket=Sock}) -> Self = self(), receive {get_socket, Pid} -> Pid ! {socket, Self, Sock}, listener_loop(S); {'EXIT', Self, Reson} -> close(Sock), exit(Reson); {'EXIT', Mr, Reson} -> close(Sock), exit(Reson); Other -> {ok, Peer} = inet:sockname(Sock), error_logger:format("~w:~p Unexpected message: ~p~n", [?MODULE, Peer, Other]), listener_loop(S) end. %%recv(init, S, Timeout) when integer(Timeout); %% Timeout == none -> %% Ref = start_timer(Timeout, recv_timeout), %% Ref; %%recv(next, S, Ref) -> %% do_recv(S, Ref); %%recv(cancel, S, Ref) -> %% cancel_timer(Ref). %% %%do_recv(S, Ref) -> %% inet:setopts(S, [{active, once}]), %% receive %% {tcp, _P, Bin} -> %% {ok, Bin, Ref}; %% {timeout, Ref, recv_timeout} -> %% close(S), %% {error, timeout}; %% {tcp_closed, P} -> %% close(P), %% cancel_timer(Ref), %% {error, closed}; %% {tcp_error, P, Reson} -> %% close(P), %% cancel_timer(Ref), %% {error, Reson} %% end. %% %%start_timer(none, _) -> %% none; %%start_timer(Timeout, Msg) -> %% erlang:start_timer(Timeout, self(), Msg). %% %%cancel_timer(none) -> %% ok; %%cancel_timer(Ref) -> %% erlang:cancel_timer(Ref), %% receive %% {timeout, Ref, _} -> %% ok %% after 0 -> %% ok %% end. -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : tac_connect.erl %%% Author : %%% Description : TCP/IP/UDP client %%% %%% Created : 12 Jun 2002 by %%%------------------------------------------------------------------- %% %% $Id$ %% %% $Log$ %% %%** %% %% .* tac_connect %% %%* -module(tac_connect). -export([start/6]). -include("dbg.hrl"). start(Addr, Port, TrMod, PctFun, PrtFun, Args) -> [Timeout, TrOpts] = [getopt:value(Key, Opts) || Key <- [timeout, transp_opts], Opts <- [check_opts(Args)]], case TrMod:connect(Addr, Port, TrOpts, Timeout) of {ok, Socket} -> tac_socket_mdr:client(Socket, TrMod, PctFun, PrtFun); {error, Error} -> exit(Error); {'EXIT', Error} -> exit(Error) end. check_opts(Args) -> ChkTimeout = fun (N) when integer(N), N > 0 -> {ok, N}; (N=infinity) -> {ok, N} end, Opts = getopt:options(Args, [ {timeout, infinity, ChkTimeout}, {transp_opts, [], list} ], defined_strict), Opts. -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : tac_listen.erl %%% Author : %%% Description : TCP/IP/UDP server, accepts connections and spawns protocol %%% and transport modules %%% %%% Created : 12 Jun 2002 by %%%------------------------------------------------------------------- %% %% $Id$ %% %% $Log$ %% %%** %% %% .* tac_listen %% %%* -module(tac_listen). -behaviour(gen_server). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports -export([start_link/5, start_link/6, stop/1, info/2]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). %% Internal exports -export([new_connect/2]). -include("dbg.hrl"). -record(state, {listen_pid, % Listener pid acceptor, %Current acceptor active=[], %Active connections max_conn=infinity, %Max connections number transp_mod, %Transport module packet_fun, %Packet fun proto_fun, %Protocol fun acl_fun=fun allow_all/2 % ACL function to permit/deny connection }). -ifndef(DEBUG). -define(DEBUG, 1). -endif. -ifdef(DEBUG). -define(DEBUG_TAC_LISTEN, [debug]). -else. -define(DEBUG_TAC_LISTEN, []). -endif. %DEBUG -ifndef(TAC_LISTEN_TIMEOUT). -define(TAC_LISTEN_TIMEOUT, 30000). -endif. -define(MAX_CONNECTIONS, 256). -define(SERVER(P), list_to_atom(lists:flatten(io_lib:format(?MODULE_STRING "_~w",[P])))). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: start_link/0 %% Description: Starts the server %%-------------------------------------------------------------------- start_link(Port, TrMod, PctFun, PrtFun, Args) -> start_link(?SERVER(Port), Port, TrMod, PctFun, PrtFun, Args). start_link(Name, Port, TrMod, PctFun, PrtFun, Args) -> gen_server:start_link({local, Name}, ?MODULE, {Port, TrMod, PctFun, PrtFun, Args}, ?DEBUG_TAC_LISTEN). stop(Port) when integer(Port) -> stop(?SERVER(Port)); stop(Name) -> destroy(whereis(Name)). info(Port, Query) when integer(Port) -> info(?SERVER(Port), Query); info(Server, Query) -> gen_server:call(Server, {info, Query}). %%==================================================================== %% Server functions %%==================================================================== %%-------------------------------------------------------------------- %% Function: init/1 %% Description: Initiates the server %% Returns: {ok, State} | %% {ok, State, Timeout} | %% ignore | %% {stop, Reason} %%-------------------------------------------------------------------- init({Port, TrMod, PctFun, PrtFun, Args}) -> [Max, AclFun, TrOpts] = [getopt:value(Key, Opts) || Key <- [max, acl_fun, transp_opts], Opts <- [check_opts(Args)]], process_flag(trap_exit, true), case TrMod:listen(Port, Max, TrOpts) of {ok, LrPid} -> Pid = start_accept(LrPid, TrMod, PctFun, PrtFun, AclFun), ?dbg("started at port ~w",[Port]), {ok, #state{listen_pid = LrPid, acceptor = Pid, transp_mod = TrMod, proto_fun = PrtFun, packet_fun = PctFun, acl_fun = AclFun, max_conn = Max }}; {error, Reason} -> {stop, Reason}; Other -> {stop, Other} end. %%-------------------------------------------------------------------- %% Function: handle_call/3 %% Description: Handling call messages %% Returns: {reply, Reply, State} | %% {reply, Reply, State, Timeout} | %% {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, Reply, State} | (terminate/2 is called) %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_call({info, state}, From, S=#state{listen_pid=LrPid, acceptor=Acceptor, active=Active, max_conn=Max, transp_mod=TrMod }) -> Reply = [{listen_pid, LrPid}, {acceptor, Acceptor}, {transp_mod, TrMod}, {active, length(Active)}, {max_conn, Max} ], {reply, Reply, S}; handle_call({info, active_pids}, From, S=#state{active=A}) -> {reply, A, S}; handle_call(stop, From, State) -> {stop, normal, ok, State}; handle_call(Request, From, State) -> Reply = {bad_request, Request}, {reply, Reply, State}. %%-------------------------------------------------------------------- %% Function: handle_cast/2 %% Description: Handling cast messages %% Returns: {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_cast({connected, Current}, S=#state{acceptor=Current, active=As, max_conn=Max, transp_mod=TrMod, listen_pid=LrPid, packet_fun=PcF, proto_fun=PrF, acl_fun=AcF}) -> AsLen = length(As), ?dbg("new connection ~p, connections ~w", [Current, AsLen]), New = another_accept(LrPid, TrMod, PcF, PrF, AcF, AsLen, Max, false), {noreply, S#state{acceptor=New, active=[Current|As]}}; handle_cast(_, State) -> {noreply, State}. %%-------------------------------------------------------------------- %% Function: handle_info/2 %% Description: Handling all non call/cast messages %% Returns: {noreply, State} | %% {noreply, State, Timeout} | %% {stop, Reason, State} (terminate/2 is called) %%-------------------------------------------------------------------- handle_info({'EXIT', LrPid, Reson}, S=#state{listen_pid=LrPid}) -> ?dbg("listener ~p exited, reson ~p", [LrPid, Reson]), {stop, Reson, S#state{listen_pid=none}}; handle_info({'EXIT', Current, Reson}, S=#state{listen_pid=LrPid, acceptor=Current, active=As, max_conn=Max, transp_mod=TM, proto_fun=PrF, packet_fun=PcF, acl_fun=AcF}) -> AsLen = length(As), ?dbg("acceptor ~p exited, reson ~p, connections ~w", [Current, Reson,AsLen]), New = another_accept(LrPid, TM, PcF, PrF, AcF, AsLen, Max, false), {noreply, S#state{acceptor=New}}; handle_info({'EXIT', Pid, Reson}, S=#state{listen_pid=LrPid, acceptor=A, active=As, max_conn=Max, transp_mod=TM, proto_fun=PrF, packet_fun=PcF, acl_fun=AcF}) -> AsLen = length(As), As1 = lists:delete(Pid, As), AsLen1 = length(As1), if AsLen == AsLen1 -> {noreply, S}; true -> ?dbg("session ~p exited, reson ~p, connections ~w", [Pid, Reson, AsLen1]), New = another_accept(LrPid, TM, PcF, PrF, AcF, AsLen1, Max, A), {noreply, S#state{acceptor=New, active=As1}} end; handle_info(Info, S=#state{listen_pid=LrPid, transp_mod=TM}) -> Port = case TM:sockname(LrPid) of {ok, {_, P}} -> P; _Error -> unknown end, error_logger:format("~w Unexpected info: ~p~n", [process_info(self(),registered_name) , Info]), {noreply, S}; handle_info(Info, S) -> {noreply, S}. %%-------------------------------------------------------------------- %% Function: terminate/2 %% Description: Shutdown the server %% Returns: any (ignored by gen_server) %%-------------------------------------------------------------------- terminate(Reason, S=#state{listen_pid=LrPid, transp_mod=TrMod, acceptor=Current, active=Active}) -> case LrPid of _ when pid(LrPid) -> TrMod:close(LrPid); _ -> ok end, Children = case Current of _ when pid(Current) -> [Current|Active]; _ -> Active end, lists:foreach(fun (P) -> exit(P, stop) end, Children), ?dbg("Terminating", []), ok. %%-------------------------------------------------------------------- %% Func: code_change/3 %% Purpose: Convert process state when code is changed %% Returns: {ok, NewState} %%-------------------------------------------------------------------- code_change(OldVsn, State, Extra) -> {ok, State}. %%-------------------------------------------------------------------- %%% Internal functions %%-------------------------------------------------------------------- destroy(Server) when pid(Server) -> gen_server:call(Server, stop, ?TAC_LISTEN_TIMEOUT); destroy(Other) -> {error, Other}. start_accept(LrPid, TrMod, PctFun, PrtFun, AclFun) -> Self = self(), spawn_link(tac_socket_mdr, server, [Self, LrPid, TrMod, PctFun, PrtFun, AclFun]). %% return new acceptor another_accept(LrPid, TrMod, PctFun, PrtFun, AclFun, Active, Max, false) -> if Active < Max -> % lower than limit start_accept(LrPid, TrMod, PctFun, PrtFun, AclFun); true -> ?dbg("blocking accept, active ~w, max ~w", [Active, Max]), false end; another_accept(_LrPid, _TM, _PcF, _PrF, _AF, _As, _Max, Acceptor) -> Acceptor. new_connect(Server, New) -> gen_server:cast(Server, {connected, New}). check_opts(Args) -> ChkMax = fun (N) when integer(N), N > 0 -> {ok, N}; (N=infinity) -> {ok, N} end, Opts = getopt:options(Args, [ {acl_fun, fun allow_all/2, function}, {max, ?MAX_CONNECTIONS, ChkMax}, {transp_opts, [], list} ], defined_strict), Opts. allow_all(RemotePeer, LocalPeer) -> permit. From sam@REDACTED Fri Jul 19 09:47:16 2002 From: sam@REDACTED (Samuel Tardieu) Date: Fri, 19 Jul 2002 09:47:16 +0200 Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <5.1.0.14.2.20020718190611.02b57160@localhost> References: <20020718215238.22169.qmail@web20506.mail.yahoo.com> <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: <2002-07-19-09-47-16+trackit+sam@inf.enst.fr> On 18/07, Martin L.W. Hall, Ph.D. wrote: | I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 | and/or Mandrake 8.2. I am not having much luck on either one. Can someone | give me suggestions, pointers, binaries or something? Erlang is part of the FreeBSD "ports collection". You may try either "pkg_add -r erlang" or untar the ports collection and run: cd /usr/ports/lang/erlang && make install That should do the job. Sam From olgeni@REDACTED Fri Jul 19 12:08:40 2002 From: olgeni@REDACTED (Jimmy Olgeni) Date: Fri, 19 Jul 2002 12:08:40 +0200 (CEST) Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: <20020719120657.B2332-100000@dev1.localdomain.net> On Thu, 18 Jul 2002, Martin L.W. Hall, Ph.D. wrote: > I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 > and/or Mandrake 8.2. I am not having much luck on either one. Can someone > give me suggestions, pointers, binaries or something? Simple way (freebsd): # cd /usr/ports/lang/erlang # make install And lang/erlang-doc has the PDF docs :) Be sure to have an up-to-date ports collection because I recently fixed a file ownership bug (I forgot to chown some files...) -- jimmy From thierry.mallard@REDACTED Fri Jul 19 16:12:32 2002 From: thierry.mallard@REDACTED (Thierry Mallard) Date: Fri, 19 Jul 2002 16:12:32 +0200 Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <5.1.0.14.2.20020718190611.02b57160@localhost> References: <20020718215238.22169.qmail@web20506.mail.yahoo.com> <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: <20020719141232.GA7011@calvin.local.vawis.net> On Thu, Jul 18, 2002 at 07:08:37PM -0700, Martin L.W. Hall, Ph.D. wrote: > > I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 > and/or Mandrake 8.2. If you use Mandrake 8.2 somewhere, could you try the RPM i've tried to build ? http://www.vawis.net/mdk/erlang-8.1-0mdk.i586.rpm (The .src.rpm will follow this week-end) The more feedback it will get, the better :-) With kind regards, -- Thierry Mallard http://vawis.net From jgomsi@REDACTED Fri Jul 19 16:54:37 2002 From: jgomsi@REDACTED (=?iso-8859-1?Q?Javier_G=F3mez_Sierras?=) Date: Fri, 19 Jul 2002 16:54:37 +0200 (CEST) Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: > I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 > and/or Mandrake 8.2. I am not having much luck on either one. Can someone > give me suggestions, pointers, binaries or something? I compiled Erlang for Mandrake 8.1 and these are some of the packages you need (apart from make and gcc): XFree86-devel libtermcap2-devel j2re-1.3 j2sdk-1.3 It may be different for Mandrake 8.2. I have not tested it on MDK 8.2 because I now use Debian ;-) Javier G?mez Sierras jgomsi@REDACTED From klacke@REDACTED Fri Jul 19 17:08:08 2002 From: klacke@REDACTED (Klacke) Date: Fri, 19 Jul 2002 17:08:08 +0200 Subject: Yaws API discussion In-Reply-To: <20020716223003.63669.qmail@web40203.mail.yahoo.com>; from cyberlync@yahoo.com on Tue, Jul 16, 2002 at 03:30:03PM -0700 References: <1026842627.3d346003f11b9@webmail.spamcop.net> <20020716223003.63669.qmail@web40203.mail.yahoo.com> Message-ID: <20020719170808.A4379@bluetail.com> Folks, I've been away on holidays, ... and I'll try to give some input to the above diskussion. It started with complaints/ideas about the actual yaws api. I partly agree. I've been hacking a webmail app during the holiday, and yaws is indeed ideal for this, but the api maybe isn't yet quite right. I did a drastic api change abouth a month ago when tobbe started to use yaws for his ticket tracker. The only way to find out is to write real apps in yaws. On Tue, Jul 16, 2002 at 03:30:03PM -0700, Eric Merritt wrote: > Mickaels ideas below are a great idea. A question > arises though, Is the owner (klacke) willing to allow > this? > > It seems that at the moment yaws is very much a single > owner/maintainer project. After spending a little time > looking over yaws.hyber.org it seems that there is no > way to submit code, get cvs images, no mailing list, > etc. code submit can be by patches to me, or by asking me (or tobbe) to become a yaws sourceforge developer. What's a cvs image :-), snapshots are available from sourceforge in the normal anonymous ways mailing list ... yes I've been thinking about that, remember, the yaws project is yet just a couple of months old. > > It may very well be that the owner is not interested > in expanding the project. I am. Cheers /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From martin@REDACTED Fri Jul 19 17:08:49 2002 From: martin@REDACTED (Martin L.W. Hall, Ph.D.) Date: Fri, 19 Jul 2002 08:08:49 -0700 Subject: Erland on FreeBSD or Mandrake? In-Reply-To: <20020719120657.B2332-100000@dev1.localdomain.net> References: <5.1.0.14.2.20020718190611.02b57160@localhost> Message-ID: <5.1.0.14.2.20020719074214.02c7de70@localhost> Here is the error message that I get, though it seems that different (but similarly configured machines) give different errors: # make install ===> Configuring for erlang-7.3.0 >> Error: cannot find javac in JAVABINDIR. >> Please configure JAVABINDIR, or use the WITHOUT_JAVA option *** Error code 1 Stop in /usr/ports/lang/erlang. *** Error code 1 Stop in /usr/ports/lang/erlang. *** Error code 1 Stop in /usr/ports/lang/erlang. *** Error code 1 Stop in /usr/ports/lang/erlang. *** Error code 1 Stop in /usr/ports/lang/erlang.At 12:08 PM 7/19/2002 +0200, Jimmy Olgeni wrote: >On Thu, 18 Jul 2002, Martin L.W. Hall, Ph.D. wrote: > > > I am new to the list. I am trying to get Erlang to compile on FreeBSD 4.5 > > and/or Mandrake 8.2. I am not having much luck on either one. Can someone > > give me suggestions, pointers, binaries or something? > >Simple way (freebsd): > ># cd /usr/ports/lang/erlang ># make install > >And lang/erlang-doc has the PDF docs :) > >Be sure to have an up-to-date ports collection because I recently fixed a >file ownership bug (I forgot to chown some files...) > >-- >jimmy From willem@REDACTED Fri Jul 19 17:49:30 2002 From: willem@REDACTED (Willem Broekema) Date: Fri, 19 Jul 2002 17:49:30 +0200 Subject: inet:getopts/2 Message-ID: <3D38350A.8030008@pastelhorn.com> Hi -- Is there a reason not to include a description of the function getopts/2 in the documentation of the 'inet' module? Shouldn't it be used? - Willem From dne@REDACTED Fri Jul 19 18:59:53 2002 From: dne@REDACTED (Daniel Neri) Date: Fri, 19 Jul 2002 18:59:53 +0200 Subject: Building R8B-1 on OpenBSD 3.1 In-Reply-To: <8765zg4kmk.fsf@d8tv0m01.rdu.bellsouth.net> Message-ID: <200207191704.g6JH4fW09296@hades.cslab.ericsson.net> > ;-) But what's the difference between R8B-0 and R8B-1? R8B-1 includes some changes I contributed to make the os_mon application work at all on OpenBSD. R8B-0 doesn't, so while it might build OK, os_mon will not work there. > 3> memsup:get_system_memory_data(). > [{system_total_memory,258584576}, > {free_memory,114364416}, > {total_memory,258584576}] > 4> > > Looks ok to me. Yep. Regards, --Daniel From igouy@REDACTED Fri Jul 19 20:22:40 2002 From: igouy@REDACTED (isaac gouy) Date: Fri, 19 Jul 2002 11:22:40 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: <20020719032333.54138.qmail@web40210.mail.yahoo.com> Message-ID: <20020719182240.39094.qmail@web20513.mail.yahoo.com> > Just creating erlang server pages wont do it. You > would have to create and easy, efficient, system for > web application construction. I'm trying to get some sense of what the Erlang community wants to achieve next. Building yet another CMS might be fun. I'm sure it can be done in Erlang. But how much does it lever Erlangs strengths, and what kind of organisations would use it instead of their current CMS? I could more easily understand using Erlang to build highly reliable, secure, transacted, messaging systems: like www.kenemea.com Maybe I'm just being unimaginative. Being able to develop Wings3D in Erlang is fabulous! I wonder what business areas outside of telcomm share similar performance requirements - stock exchange, B2B marketplace, others? Where are Erlangs/OTPs strengths applicable outside of telcomm? best wishes, Isaac __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From cyberlync@REDACTED Fri Jul 19 21:06:42 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 19 Jul 2002 12:06:42 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: <20020719182240.39094.qmail@web20513.mail.yahoo.com> Message-ID: <20020719190642.82870.qmail@web40207.mail.yahoo.com> You are right, the only problem is that the project has to be fun for the programmers (this is a hobby after all). Targeting vertical markets like this, especially those that have limited access by joe programmer, is probably not going to be allot of fun to do. Even the idea of a messeging system for corporate use is not so simple as it may seem. We actaully wrote some requirements for a similar system here awhile ago. We never got the time to write it but the design looked like it would work pretty well. In the corporate senarios you would probably need standard IM, virtual perminant and dynamic conference rooms, auto loggin etc. Not to mention the need to support admins, monitors who could pop into and monitor any session, etc. I almost wouldn't be comfortable writing something like that, though I do understand why corporations feel they need it. I guess my point is that coming up with something that would be of interest to corporations and hackers/programmers would be very difficult. Btw, the url provided does not seem to be available. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From igouy@REDACTED Fri Jul 19 21:46:55 2002 From: igouy@REDACTED (isaac gouy) Date: Fri, 19 Jul 2002 12:46:55 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: <20020719190642.82870.qmail@web40207.mail.yahoo.com> Message-ID: <20020719194655.35721.qmail@web20503.mail.yahoo.com> > You are right, the only problem is that the project > has to be fun for the programmers (this is a hobby > after all). People seem to have all kinds of ideas about what is fun ;-) JBoss? OpenNMS? Maybe the issue is really one of domain knowledge -Erlang experts have domain expertise within Telcomm, not in other domains where the technology might be applied? > Btw, the url provided does not seem to be available. Oooops typo! http://www.kenamea.com/ __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From etxuwig@REDACTED Sat Jul 20 00:21:18 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sat, 20 Jul 2002 00:21:18 +0200 (MET DST) Subject: Erlang killer app? In-Reply-To: <20020719194655.35721.qmail@web20503.mail.yahoo.com> Message-ID: On Fri, 19 Jul 2002, isaac gouy wrote: >Maybe the issue is really one of domain knowledge -Erlang >experts have domain expertise within Telcomm, not in other >domains where the technology might be applied? I don't think it's quite that simple. Personally, I spent a few years designing systems for emergency response, trooper dispatch, etc. Many of the things we worked with were database and groupware oriented. I picked up Erlang during that time, and considered it ideal for the flexible and robust messaging backbones we wanted to build. I'm convinced that Erlang could be used to design some killer groupware. I joined Ericsson because I wanted to work with Erlang, but knew fairly little about Telecom at the time. My fellow Erlang programmers at work have all sorts of backgrounds. I think you'd find a fairly wide variety of domain experience on this list. It would perhaps be interesting to conduct a poll...? /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From anders.p.nygren@REDACTED Sat Jul 20 00:43:18 2002 From: anders.p.nygren@REDACTED (Anders Nygren) Date: Sat, 20 Jul 2002 00:43:18 +0200 Subject: Building R8B-1 on SuSE 8.0 Message-ID: <200207200043.18641.anders.p.nygren@telia.com> I am trying to build R8B-1 on SuSE 8.0, and I get the following errors. Does anyone have any hints on what I am missing? /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: In function `move_right': /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:634: undefined reference to `tputs' /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: In function `move_up': /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:642: undefined reference to `tputs' /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: In function `move_down': /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:650: undefined reference to `tputs' collect2: ld returned 1 exit status make[2]: *** [/usr/local/src/erlang/otp_src_R8B-1/bin/i686-pc-linux-gnu/beam.instr] Error 1 make[1]: *** [instr] Error 2 make: *** [emulator.instr] Error 2 /Anders Nygren From cyberlync@REDACTED Sat Jul 20 00:54:29 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 19 Jul 2002 15:54:29 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: Message-ID: <20020719225429.61182.qmail@web40204.mail.yahoo.com> > I don't think it's quite that simple. > > Personally, I spent a few years designing systems > for emergency > response, trooper dispatch, etc. Many of the things > we worked > with were database and groupware oriented. I picked > up Erlang > during that time, and considered it ideal for the > flexible and > robust messaging backbones we wanted to build. > > I'm convinced that Erlang could be used to design > some killer > groupware. Now groupware, thats an interesting thought. I used to work with Lotus Notes, about the best general groupware app anywere, and its not that great. 5,000,000+ lines of code and it tends to be a buggy mess half the time (though far better then the alternatives). A good group where app would probably be a 'Killer App' and catch the eye of quite a few good size corporations. Not to mention what it could do for the open source world in general. Unfortunatly this is no simple application no matter how you look at it. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From kent@REDACTED Sat Jul 20 01:05:38 2002 From: kent@REDACTED (Kent Boortz) Date: 20 Jul 2002 01:05:38 +0200 Subject: Building R8B-1 on SuSE 8.0 In-Reply-To: <200207200043.18641.anders.p.nygren@telia.com> References: <200207200043.18641.anders.p.nygren@telia.com> Message-ID: Anders Nygren writes: > I am trying to build R8B-1 on SuSE 8.0, and I get the following errors. > Does anyone have any hints on what I am missing? > > /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: > In function `move_right': > /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:634: > undefined reference to `tputs' > /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: > In function `move_up': > /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:642: > undefined reference to `tputs' > /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu/ttsl_drv.o: > In function `move_down': > /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c:650: > undefined reference to `tputs' > collect2: ld returned 1 exit status > make[2]: *** > [/usr/local/src/erlang/otp_src_R8B-1/bin/i686-pc-linux-gnu/beam.instr] Error > 1 > make[1]: *** [instr] Error 2 > make: *** [emulator.instr] Error 2 I think the problem goes away if you install the developer RPM for ncurses, kent From apeake@REDACTED Sat Jul 20 01:21:04 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 19 Jul 2002 16:21:04 -0700 Subject: Erlang killer app? In-Reply-To: Message-ID: Well, since you ask for a poll -- I work on eCommerce systems. These involve geographically distributed warehouses around the US. We set up items (SKUs), receive Advance Shipment Notifications (ASNs), receive material, put away in the warehouse. We then receive orders from our web site or SOAP (Web Services) or ftp, and dispatch the orders to the appropriate warehouse. Orders in the warehouse are then picked, packed and shipped (UPS, FedEx and most others). We invoice. Our system is unusual in that we do this for about 100 clients, and every client has different rules. The web site is a common set of code, but looks like a different web site for each client. Our current technology is RDBMS in each warehouse and at the web site (SQL Server). Microsoft IIS, ASP and VB COM+ on the web site for application programming. MS Message Queues to distribute to the warehouses. We have a monster web-based reporting system for our clients - built around Actuate. The warehouse application is old and the whole system about to be re-written - hence my interest in Erlang. Alex -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Ulf Wiger Sent: Friday, July 19, 2002 3:21 PM To: erlang-questions@REDACTED Subject: Re: Erlang killer app? On Fri, 19 Jul 2002, isaac gouy wrote: >Maybe the issue is really one of domain knowledge -Erlang >experts have domain expertise within Telcomm, not in other >domains where the technology might be applied? I don't think it's quite that simple. Personally, I spent a few years designing systems for emergency response, trooper dispatch, etc. Many of the things we worked with were database and groupware oriented. I picked up Erlang during that time, and considered it ideal for the flexible and robust messaging backbones we wanted to build. I'm convinced that Erlang could be used to design some killer groupware. I joined Ericsson because I wanted to work with Erlang, but knew fairly little about Telecom at the time. My fellow Erlang programmers at work have all sorts of backgrounds. I think you'd find a fairly wide variety of domain experience on this list. It would perhaps be interesting to conduct a poll...? /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From apeake@REDACTED Sat Jul 20 01:23:26 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 19 Jul 2002 16:23:26 -0700 Subject: Erlang killer app? In-Reply-To: <20020719225429.61182.qmail@web40204.mail.yahoo.com> Message-ID: Tools to build distributed commerce apps would be good. Erlang offers huge productivity gains over Java, VB, C# etc. Alex -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Eric Merritt Sent: Friday, July 19, 2002 3:54 PM To: Ulf Wiger; erlang-questions@REDACTED Subject: Re: Erlang killer app? > I don't think it's quite that simple. > > Personally, I spent a few years designing systems > for emergency > response, trooper dispatch, etc. Many of the things > we worked > with were database and groupware oriented. I picked > up Erlang > during that time, and considered it ideal for the > flexible and > robust messaging backbones we wanted to build. > > I'm convinced that Erlang could be used to design > some killer > groupware. Now groupware, thats an interesting thought. I used to work with Lotus Notes, about the best general groupware app anywere, and its not that great. 5,000,000+ lines of code and it tends to be a buggy mess half the time (though far better then the alternatives). A good group where app would probably be a 'Killer App' and catch the eye of quite a few good size corporations. Not to mention what it could do for the open source world in general. Unfortunatly this is no simple application no matter how you look at it. __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From cyberlync@REDACTED Sat Jul 20 01:45:25 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 19 Jul 2002 16:45:25 -0700 (PDT) Subject: Erlang killer app? In-Reply-To: Message-ID: <20020719234525.88101.qmail@web40205.mail.yahoo.com> Depending on the flexablility you need this can be either pretty simple or damn hard. I do agree with you, however, that using erlang would make it allot easier. I guess in this situation you would want to come up with a generalized pluggable framework and build from there. Add extension point for custom logic at key points, probably some type of templating system for the web aspects (lol going back to the original thread lol). I am not really sure how you would do this as an open source project but it would be an interesting project to do. On a side note I decided to use asn for some comm work an erlang app I am working on. Between the natural ease of erlang, and the spec writing ease of asn it was almost simple. I havnt had this much fun coding a project in a long time. Ok back, Are you suggesting something like this be done in the community? If so do you have any ideas on how to go about it? generating specs etc. --- Alex Peake wrote: > Well, since you ask for a poll -- > > I work on eCommerce systems. > > These involve geographically distributed warehouses > around the US. We set up items (SKUs), receive > Advance Shipment Notifications (ASNs), receive > material, put away in the warehouse. We then receive > orders from our web site or SOAP (Web Services) or > ftp, and dispatch the orders to the appropriate > warehouse. Orders in the warehouse are then picked, > packed and shipped (UPS, FedEx and most others). > We invoice. > > Our system is unusual in that we do this for about > 100 clients, and every client has different > rules. The web site is a common set of code, but > looks like a different web site for each client. > > Our current technology is RDBMS in each warehouse > and at the web site (SQL Server). Microsoft IIS, > ASP and VB COM+ on the web site for application > programming. MS Message Queues to distribute to the > warehouses. > > We have a monster web-based reporting system for our > clients - built around Actuate. > > The warehouse application is old and the whole > system about to be re-written - hence my interest in > Erlang. > > Alex > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf > Of Ulf Wiger > Sent: Friday, July 19, 2002 3:21 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang killer app? > > > On Fri, 19 Jul 2002, isaac gouy wrote: > > >Maybe the issue is really one of domain knowledge > -Erlang > >experts have domain expertise within Telcomm, not > in other > >domains where the technology might be applied? > > I don't think it's quite that simple. > > Personally, I spent a few years designing systems > for emergency > response, trooper dispatch, etc. Many of the things > we worked > with were database and groupware oriented. I picked > up Erlang > during that time, and considered it ideal for the > flexible and > robust messaging backbones we wanted to build. > > I'm convinced that Erlang could be used to design > some killer > groupware. > > I joined Ericsson because I wanted to work with > Erlang, but knew > fairly little about Telecom at the time. My fellow > Erlang > programmers at work have all sorts of backgrounds. > > I think you'd find a fairly wide variety of domain > experience on > this list. It would perhaps be interesting to > conduct a poll...? > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class > Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice > Networks > > > __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com From martinjlogan@REDACTED Sat Jul 20 01:49:36 2002 From: martinjlogan@REDACTED (martin logan) Date: Fri, 19 Jul 2002 18:49:36 -0500 Subject: Link question. Message-ID: Hello all, I have found an interesting problem with link that I could not find an explanation for in the docs. I wanted to ask if link is defined this way for a reason? Here is the scenario. All procs on one node: case catch link(DeadLocalPid) of true -> true; {'EXIT', Reason} -> false end. yeilds: false The pid referanced of is on a remote node. case catch link(DeadRemotePid) of true -> true; {'EXIT', Reason} -> false end. yeilds: true So the situation in english; If I have a pid that dies befor I link to it and it was local I get {'EXIT' Reason}. If the pid was remote I get true. Can anyone explain why this is the case? Thanks, Martin _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx From vances@REDACTED Sat Jul 20 01:42:40 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 19 Jul 2002 19:42:40 -0400 Subject: Erlang killer app? In-Reply-To: References: <20020719194655.35721.qmail@web20503.mail.yahoo.com> Message-ID: <20020719234240.GA26800@frogman.motivity.ca> I've always felt in the minority around here as I am focused on telecom. The vast majority of posts here are to do with language issues and not with OTP. The behaviour we use the most is gen_fsm. I'm sure the most widely used is gen_server. -Vance On Sat, Jul 20, 2002 at 12:21:18AM +0200, Ulf Wiger wrote: > > I think you'd find a fairly wide variety of domain experience on > this list. It would perhaps be interesting to conduct a poll...? > > /Uffe From lennart.ohman@REDACTED Sat Jul 20 08:39:25 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Sat, 20 Jul 2002 08:39:25 +0200 Subject: Link question. References: Message-ID: <3D39059D.CA50B9E2@st.se> Hi Martin, I guess you have tried that in the shell!? I have run into that during a training class or two while trying to show linking to students. The general idea is that link/1 must always succeed since you can not tell the difference between a process that does not exist at the linking moment and a process that dies a second later. I had to write a program and run it in a process spawned from the shell to demonstrate it. From my "teacher-toolsbox": -module(link_test). -compile(export_all). f(P) -> process_flag(trap_exit,true), case catch link(P) of true -> io:format("true~n",[]), wait_for_exit(P); {'EXIT',Reason} -> io:format("Got~w~n",[Reason]) end. wait_for_exit(P) -> receive Any -> io:format("Got 2: ~w~n",[Any]) end. /Lennart martin logan wrote: > > Hello all, > I have found an interesting problem with link that I could not find an > explanation for in the docs. I wanted to ask if link is defined this way for > a reason? Here is the scenario. > > All procs on one node: > > case catch link(DeadLocalPid) of > true -> true; > {'EXIT', Reason} -> false > end. > > yeilds: false > > The pid referanced of is on a remote node. > > case catch link(DeadRemotePid) of > true -> true; > {'EXIT', Reason} -> false > end. > > yeilds: true > > So the situation in english; If I have a pid that dies befor I link to it > and it was local I get {'EXIT' Reason}. If the pid was remote I get true. > Can anyone explain why this is the case? > > Thanks, > Martin > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From cpressey@REDACTED Sat Jul 20 09:39:06 2002 From: cpressey@REDACTED (Chris Pressey) Date: Sat, 20 Jul 2002 02:39:06 -0500 Subject: Question about ports & eof Message-ID: <20020720023906.2ea08493.cpressey@catseye.mb.ca> Is there any way to send an eof to a port without closing it? I want to call a program and give it some data on standard input. The problem is that it won't give me back any data on standard output until it gets an eof. Basically something like... -module(test). -export([start/0]). start() -> P = open_port({spawn, "tar -c -f - -I -"}, [stream, use_stdio, eof]), port_command(P, "foo\nbar\nbaz\n"), port_command(P, eof), % if only it were this simple loop(P). loop(P) -> receive {P, {data, Data}} -> io:fwrite("~p~n", [Data]), loop(P); {P, eof} -> port_close(P) end. I guess I might have to resort to a tmpfile here... -Chris From anders.p.nygren@REDACTED Sat Jul 20 10:08:40 2002 From: anders.p.nygren@REDACTED (Anders Nygren) Date: Sat, 20 Jul 2002 10:08:40 +0200 Subject: Building R8B-1 on SuSE 8.0 In-Reply-To: References: <200207200043.18641.anders.p.nygren@telia.com> Message-ID: <200207201008.40674.anders.p.nygren@telia.com> On Saturday 20 July 2002 01:05, Kent Boortz wrote: > Anders Nygren writes: > > I am trying to build R8B-1 on SuSE 8.0, and I get the following errors. > > Does anyone have any hints on what I am missing? > > > > /usr/local/src/erlang/otp_src_R8B-1/erts/obj.instr.beam/i686-pc-linux-gnu > >/ttsl_drv.o: In function `move_right': > > /usr/local/src/erlang/otp_src_R8B-1/erts/emulator/drivers/unix/ttsl_drv.c > >:634: undefined reference to `tputs' snip > > I think the problem goes away if you install the developer RPM for ncurses, > > kent Thanks for the suggestion, unfortunately it does not solve my problem. ncurses-devel-5.2 is already installed, is there something missing in this list of installed files? I don't know if this is of any importance but ./configure gives ... checking for tgetent in -ltermlib... (cached) no checking for tgetent in -lcurses... (cached) no checking for tgetent in -lncurses... (cached) no checking for tgetent in -ltermcap... (cached) no ... /Anders rpm -q -l ncurses-devel /usr/bin/captoinfo /usr/bin/infocmp /usr/bin/infotocap /usr/bin/tack /usr/bin/tic /usr/include/curses.h /usr/include/cursesapp.h /usr/include/cursesf.h /usr/include/cursesm.h /usr/include/cursesp.h /usr/include/cursesw.h /usr/include/cursslk.h /usr/include/eti.h /usr/include/etip.h /usr/include/form.h /usr/include/menu.h /usr/include/ncurses.h /usr/include/ncurses_dll.h /usr/include/panel.h /usr/include/term.h /usr/include/termcap.h /usr/include/unctrl.h /usr/lib/libform.a /usr/lib/libform.so /usr/lib/libmenu.a /usr/lib/libmenu.so /usr/lib/libncurses++.a /usr/lib/libncurses.a /usr/lib/libncurses.so /usr/lib/libpanel.a /usr/lib/libpanel.so ..... From thierry@REDACTED Sat Jul 20 14:56:40 2002 From: thierry@REDACTED (Thierry Mallard) Date: Sat, 20 Jul 2002 14:56:40 +0200 Subject: Building R8B-1 on SuSE 8.0 In-Reply-To: <200207201008.40674.anders.p.nygren@telia.com> References: <200207200043.18641.anders.p.nygren@telia.com> <200207201008.40674.anders.p.nygren@telia.com> Message-ID: <20020720125640.GA21247@calvin.local.vawis.net> On Sat, Jul 20, 2002 at 10:08:40AM +0200, Anders Nygren wrote: > [ Compiling Erlang on SuSE 8.0 ] > I don't know if this is of any importance but ./configure gives > ... > checking for tgetent in -ltermlib... (cached) no > checking for tgetent in -lcurses... (cached) no > checking for tgetent in -lncurses... (cached) no > checking for tgetent in -ltermcap... (cached) no if you installed the ncurses RPM _after_ the first ./configure attempt, you may try to remove the config.cache file, which may prevent ./configure to really check for ncurses again. Another lead would be to publish the config.log, if the previous suggestion doesn't work. With kind regards, -- Thierry Mallard http://vawis.net From anders.p.nygren@REDACTED Sat Jul 20 19:35:54 2002 From: anders.p.nygren@REDACTED (Anders Nygren) Date: Sat, 20 Jul 2002 19:35:54 +0200 Subject: Building R8B-1 on SuSE 8.0 In-Reply-To: <20020720125640.GA21247@calvin.local.vawis.net> References: <200207200043.18641.anders.p.nygren@telia.com> <200207201008.40674.anders.p.nygren@telia.com> <20020720125640.GA21247@calvin.local.vawis.net> Message-ID: <200207201935.54983.anders.p.nygren@telia.com> On Saturday 20 July 2002 14:56, Thierry Mallard wrote: > On Sat, Jul 20, 2002 at 10:08:40AM +0200, Anders Nygren wrote: > > [ Compiling Erlang on SuSE 8.0 ] > > I don't know if this is of any importance but ./configure gives > > ... > > checking for tgetent in -ltermlib... (cached) no > > checking for tgetent in -lcurses... (cached) no > > checking for tgetent in -lncurses... (cached) no > > checking for tgetent in -ltermcap... (cached) no > > if you installed the ncurses RPM _after_ the first ./configure attempt, > you may try to remove the config.cache file, which may prevent > ./configure to really check for ncurses again. > > Another lead would be to publish the config.log, if the previous > suggestion doesn't work. > > With kind regards, Thank You Thierry, deleting configure.cache solved my problem. /Anders From igouy@REDACTED Sat Jul 20 21:47:14 2002 From: igouy@REDACTED (isaac gouy) Date: Sat, 20 Jul 2002 12:47:14 -0700 (PDT) Subject: Erlang killer app?, Message-ID: <20020720194714.60496.qmail@web20503.mail.yahoo.com> Ulf Wiger wrote: >ideal for the flexible and robust messaging >backbones we wanted to build Alex Peake wrote: >warehouse application is old and the whole system >about to be re-written Ulf, given the Erlang community has a depth of experience outside of telecomm, perhaps the advantages of Erlang aren't well known outside of the telecomm community? They aren't well known by people building systems which require similar qualities? Alex, which bits do you imagine would really use Erlangs strengths, which bits would need to be implemented in something else? How did you hear about Erlang? >Erlang offers huge productivity gains Hmm. I had a big surprise going from Smalltalk to Java. We knew that Smalltalk was x10 more productive than C++ but thought Smalltalk would only be x2 better than Java. It's amazing how much static typing and an excess of syntax slow you down ;-) So-many Smalltalk systems have been re-written in Java, at great cost and reduction of functionality. IMHO mostly it doesn't matter that Smalltalk is hugely more productive, or that Erlang is hugely more productive. It matters that they have name recognition as the best solution for a particular class of problems. (And that's why I've been asking about the core strengths of Erlang/OTP, and how they can be applied outside of Telecomm) best wishes, Isaac __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From cpressey@REDACTED Sat Jul 20 22:44:27 2002 From: cpressey@REDACTED (Chris Pressey) Date: Sat, 20 Jul 2002 15:44:27 -0500 Subject: Erlang killer app? In-Reply-To: References: Message-ID: <20020720154427.24ba81a9.cpressey@catseye.mb.ca> On Fri, 19 Jul 2002 16:21:04 -0700 "Alex Peake" wrote: > Well, since you ask for a poll -- > > I work on eCommerce systems. I can chip in a bit here, since I've always thought of myself as far outside of telecomm. My main interest is in language design. At my day job I work in the retail/wholesale building materials industry (custom programmer - not much more than a glorified DB admin.) Distributed systems aren't critical to my job, but I feel they can really help to get information from one person to another in an event-driven fashion. My big Erlang project at work is a program which interfaces with the legacy point-of-sale system to track the status of orders and display this information to users in real-time. I don't really believe in killer apps... the next big thing is a myth. I'd rather make a living than make a killing :) But an enterprise resource planning / accounting / point-of-sale application written in Erlang could be a very remarkable thing. Partly because of the inherent distribution of the problem, partly because Mnesia is such a well designed database system (in terms of flexibility - being able to store arbitrary structures and lambda functions in database record fields, for example. The data does not have to be entirely normalized, and I think this is wonderful - coming up with the 'right' schema in most database engines is a pain, I find.) I think many people who are interested in distributed programming are aware of Erlang - but they actually shun it - and I have no idea why. Perhaps it's because functional languages are "supposed" to have strong typing. Perhaps it's because distributed systems are "supposed" to be for efficiency in massively parallel supercomputing problems. I'm not sure. But to me, Erlang is so nice, even if it didn't have distribution or even message passing, I'd still use it for general-purpose programming, scripting and so forth. Of all the high-level languages I've used, Erlang reminds me the most of Lego, and Lego was my favourite toy as a child. (In comparison, Haskell and Java remind me of bricks and mortar, and Perl and Python remind me of papier-mache' :) Outside of my job, I've always been interested in the potential of Erlang for online games (like MUDs.) Does this count as groupware? Not the serious, productive kind of course :) -Chris From francesco@REDACTED Sat Jul 20 23:09:12 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Sat, 20 Jul 2002 22:09:12 +0100 Subject: Erlang killer app?, References: <20020720194714.60496.qmail@web20503.mail.yahoo.com> Message-ID: <3D39D178.8000907@erlang-consulting.com> To give my two pennies to the discussion. Telecom systems' characteristics include: * Distribution * Fault Tolerance * Massive Concurrency * Soft Real Time * Non Stop (For Upgrades / Patch Installation / Crashes) Those are the characteristics Erlang has inherited, and thus, it is suitable to solve most problems in domains exhibiting those characteristics. When bluetail released its first product, Erlang certainly did not have name recognition for the domain of problems it was solving. They were first out using it in a suitable domain, and cashed in on it. Many other start ups are now doing the same, but in other areas. In my 9 years of working with Erlang, I have seen it used with great success in simulations, computer telephony integration, products for ISPs, games, 3d modellers, distributed database applications, all without any recognition in those area, as it was a language only used for embedded telecom control systems. What these non telecom application developers were able to do, however, was use the 5 - 10 fold increase in productivity to improve their time to market and at the same time easily integrating characteristics such as code upgrade and salability during runtime, high availability which were previously unheard of or hard to solve in those domains. One of the great strengths of the language is the ability to quickly put together a working prototype. If you are looking at using Erlang in a new domain (e-commerce systems sound exciting) but are unsure, test your ideas. Design errors, limitations, and flaws should show up at an early stage of the development when it is still possible to stop and reverse the baby elephant... If your hunch is right, you will have a working prototype to show and convince higher management. This strategy has been used time after time when Erlang was competing against hundreds of documents describing how the problem could be solved using other hyped technology. Regards, Francesco -- http://www.erlang-consulting.com isaac gouy wrote: >Ulf Wiger wrote: > >>ideal for the flexible and robust messaging >>backbones we wanted to build >> > >Alex Peake wrote: > >>warehouse application is old and the whole system >>about to be re-written >> > >Ulf, given the Erlang community has a depth of >experience outside of telecomm, perhaps the advantages >of Erlang aren't well known outside of the telecomm >community? They aren't well known by people building >systems which require similar qualities? > >Alex, which bits do you imagine would really use >Erlangs strengths, which bits would need to be >implemented in something else? How did you hear about >Erlang? > >>Erlang offers huge productivity gains >> >Hmm. I had a big surprise going from Smalltalk to >Java. We knew that Smalltalk was x10 more productive >than C++ but thought Smalltalk would only be x2 better >than Java. It's amazing how much static typing and an >excess of syntax slow you down ;-) > >So-many Smalltalk systems have been re-written in >Java, at great cost and reduction of functionality. > >IMHO mostly it doesn't matter that Smalltalk is hugely >more productive, or that Erlang is hugely more >productive. It matters that they have name recognition >as the best solution for a particular class of >problems. > >(And that's why I've been asking about the core >strengths of Erlang/OTP, and how they can be applied >outside of Telecomm) > >best wishes, Isaac > > >__________________________________________________ >Do You Yahoo!? >Yahoo! Health - Feel better, live better >http://health.yahoo.com > > From bparsia@REDACTED Sat Jul 20 23:32:43 2002 From: bparsia@REDACTED (Bijan Parsia) Date: Sat, 20 Jul 2002 17:32:43 -0400 (EDT) Subject: MacOS X Build Message-ID: I see from google that someone got Erlang to build on MacOS X but I can't seem to find a binary anywhere around. Any pointers? Cheers, Bijan Parsia. From thierry@REDACTED Sun Jul 21 00:27:59 2002 From: thierry@REDACTED (Thierry Mallard) Date: Sun, 21 Jul 2002 00:27:59 +0200 Subject: Online games in Erlang (was "Erlang killer app?") In-Reply-To: <20020720154427.24ba81a9.cpressey@catseye.mb.ca> References: <20020720154427.24ba81a9.cpressey@catseye.mb.ca> Message-ID: <20020720222759.GA26825@calvin.local.vawis.net> On Sat, Jul 20, 2002 at 03:44:27PM -0500, Chris Pressey wrote: > [ talking about an Erlang killer app ] > [...] > Outside of my job, I've always been interested in the potential of Erlang > for online games (like MUDs.) Does this count as groupware? Not the > serious, productive kind of course :) I've tried to implement some server side application for an open source MMORPG, named WorldForge[1]. My main goals were : 1/ to practise Erlang 2/ to see if Erlang would be a good langage to achieve a MMORPG server, for the development point of view 3/ same thing, but for the application point of view (speed, for instance) Although I never tried to quantify those points, the results I could feel were the following : - I was almost alone in this quest.. the WorldForge team was working on a C++ implementation of STAGE (the WorldForge server), and was never really interested in the Erlang version. Mostly because they don't know this language, of course.. - Coding the Erlang implementation of STAGE (cunningly called ErlyStage) was fast indeed. In about 3 months, Mickael and I were about the same point as they (the C++ team, 3 people) were after a year of development. - ErlyStage featured some new things that are very difficult to implement in C++ : the classical hot-upgrade and application distributions. - The difficults parts : keep a persistant world in memory.. I'm really not sure that Mnesia can do that. And worst of all, I think : the server should do more and more operations on those "entities" (any object of the world). But, to be honest, I'm not an expert Erlang programer, so maybe those "gotchas" aren't really ones.. Looking at that experience after a year has passed, I would say that I feel like Erlang forms "brains for cells" (for sales ? ;-) ). It's very good at putting together other technologies (an external database, via ODBC, a 3D engine or middleware -see Wings3D-, etc). But I definitly think that we can't (and _shouldn't_) try to do everything in Erlang. The "brains", that Erlang provides, help all those parts works together, with the features Francesco mentionned in his post : hot-swapping, fault-tolerance, and so on.. Ok, enought blabbering (is that english?) for tonight :-) With kind regards, -- Thierry Mallard http://vawis.net From apeake@REDACTED Sun Jul 21 01:31:39 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 20 Jul 2002 16:31:39 -0700 Subject: Erlang killer app?, In-Reply-To: <20020720194714.60496.qmail@web20503.mail.yahoo.com> Message-ID: Isaac wrote: > Alex, which bits do you imagine would really use > Erlangs strengths, which bits would need to be > implemented in something else? How did you hear about > Erlang? > > I have been on a search for "a better way" to write software for several years. I discovered the "functional" style about two years ago and started with Common Lisp, then Scheme and wrote some interesting stuff in (PLT) Scheme and (Franz) Common Lisp realizing significant productivity gains. I also looked into Haskell (and Clean) and SML (and Miranda) and CAML. Of all of these only Franz Common Lisp has a broad enough set of capabilities for my world (see previous message on this thread), but it is outrageously expensive! ($6000 per seat for development and $20,000 per server for deployment of the app!) PLT Scheme comes close, but "academic, as time permits" support is not a good bet for the commercial systems I write. "Libraries" for the ML languages are sparse (as relates to my world). Though interestingly things are starting to happen with .NET (which opens up huge libraries). There are now an early versions of SML.NET and also CAML.Net (called F#). I found Erlang just a few months ago as I continued to search. It is "fairly" complete for what I want and commercial enough (but I am still very much novice in Erlang). I like the Erlang language (functional, pattern matching, ...) and the natural distributed nature of it. I have re-written my Lisp/Scheme pattern generators in Erlang and they are more elegant now. Erlang can connect to RDBMSs (only ODBC, but I can live with that) and that is essential in my work. A Web Server (yaws?) as distributed application server is important building scalable applications as well as for Web Services (SOAP/XML), and of course as web server for browser based UI. I have not discovered the level of support for generating HTML, dealing with XML (and SOAP) yet. >From what I have seen so far, the UI creation part is sadly lacking in Erlang. I just mentioned HTML for browsers, and for "thick" clients (for a more interesting and productive UI) it appears that tcl/tk is the answer. My first experiments there had the first window take 12 seconds to open (using an example from the docs)! And I cannot see how to work with "interesting" UI widgets - grids like ComponentOne and Infragistics. It would be fine if interop were "easy" with (perhaps) .NET? (or Java?) for the UI part. Web Services might solve that -- I write the UI in C# or Java -- that would be good? I am not sure if it is going to be difficult in Erlang (without (.NET, Java) interop), but I need "Message Queuing" (the reliable, transactional delivery of arbitrary messages over a network, with alternate routing in case of failure). MQ does exist in COM and that is supported by Erlang (I read). I ramble, sorry. Alex From igouy@REDACTED Sun Jul 21 02:33:46 2002 From: igouy@REDACTED (isaac gouy) Date: Sat, 20 Jul 2002 17:33:46 -0700 (PDT) Subject: Erlang killer app?, In-Reply-To: Message-ID: <20020721003346.82184.qmail@web20503.mail.yahoo.com> Thank you all for educating me on the things you've been doing with Erlang. (And for putting up with the messed up subject line!) I have a humble and unoriginal suggestion. Maybe there are projects that you've done which you could write articles about and educate some more people about through the computer "comics"? ("Comics"? - everything from Java Report to InfoWeek) Java Report! Maybe there's an article about interfacing Java UI with a complex Erlang/OTP system? Python Journal! ditto Linux world / Unix world? Maybe they'd be interested in the yaws/unix clever stuff discussed in Per Bergqvist's and Klacke's postings? Of course, the humble suggestion is more Erlang/OTP advocacy! My apologies to those of you who must have worked very hard, as strong advocates for Erlang during the last 10 years. I can just about imagine what it's taken to get Erlang/OTP to where it is today. I asked the OpenNMS guys why they chose to develop in Java. They didn't have much experience of Java when they started but from their C++ perspective "It seemed the right tool for the job of writing something easily portable with a rapid development time." "> Has anyone on the OpenNMS team heard of Erlang? Heard of, yes. Looked at, not really... > Was it ever considered as an implementation choice? I doubt it" I don't know enough about Erlang/OTP to be sure - but I would guess that (apart from the UI) Erlang/OTP would have been ideal for what these guys are doing. But they didn't know that... thanks again, Isaac __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From thierry@REDACTED Sun Jul 21 09:05:34 2002 From: thierry@REDACTED (Thierry Mallard) Date: Sun, 21 Jul 2002 09:05:34 +0200 Subject: Erlang killer app?, In-Reply-To: <20020721003346.82184.qmail@web20503.mail.yahoo.com> References: <20020721003346.82184.qmail@web20503.mail.yahoo.com> Message-ID: <20020721070534.GA9367@calvin.local.vawis.net> On Sat, Jul 20, 2002 at 05:33:46PM -0700, isaac gouy wrote: > [ Choosing a language ] > I asked the OpenNMS guys why they chose to develop in > Java. They didn't have much experience of Java when > they started but from their C++ perspective "It seemed > the right tool for the job of writing something easily > portable with a rapid development time." > "> Has anyone on the OpenNMS team heard of Erlang? > Heard of, yes. Looked at, not really... > > Was it ever considered as an implementation choice? > I doubt it" In my humble opinion, this is a common pattern : often, specially when it's a "hobby project", the developers thinks first "ok, I like this language and I want to code with it. Now, what can I do... ? " and not : "Ok, there's problem here that needs to be solved. What would be the betters tools (language among others) to solve it ? " For example -and only an example- I wondered recently why Zope was written in Python. The answer Jim Fulton gave in an interview was " I was a convert to Python by that time. ;) " Best regards, -- Thierry Mallard http://vawis.net From hakan.stenholm@REDACTED Sun Jul 21 01:40:51 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 21 Jul 2002 01:40:51 +0200 Subject: MacOS X Build Message-ID: <202EC56D-9C3A-11D6-870D-003065B5F8B4@mbox304.swipnet.se> I don't know anything about a binary version, but it's not very hard to download the source code and follow the instructions in the "README" file to compile it. I'm still using the R8B-0 version, which might have required some extra patch (should be available in the mailing list archive). From hakan.stenholm@REDACTED Sun Jul 21 01:40:51 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 21 Jul 2002 01:40:51 +0200 Subject: MacOS X Build Message-ID: <202EC56D-9C3A-11D6-870D-003065B5F8B4@mbox304.swipnet.se> I don't know anything about a binary version, but it's not very hard to download the source code and follow the instructions in the "README" file to compile it. I'm still using the R8B-0 version, which might have required some extra patch (should be available in the mailing list archive). From kent@REDACTED Mon Jul 22 00:02:19 2002 From: kent@REDACTED (Kent Boortz) Date: 22 Jul 2002 00:02:19 +0200 Subject: Plan and preparation for R8B-2 In-Reply-To: <200206232221.g5NMLbY27274@sork.levonline.com> References: <200206232221.g5NMLbY27274@sork.levonline.com> Message-ID: This is a request for portability patches to be included before the R8B-2 release. We would like it to build on as many platforms as possible without the need to download any separate patches. There will be some other changes before R8B-2 as well. Note this is *not* R8B-2, it is a snapshot for portability verification http://www.erlang.org/otp_src_R8B_2002-07-21.tar.gz The following patches from this list are part of this snapshot (there may be others that was included earlier) corrections in "inet_drv.c" from Johan Blom fix for erl_interface sort order in erl_compare_ext and bignum decoding from Per Bergqvist fix for problem with erl_connect from Per Bergqvist build corrections with gcc 3.1 under RH7.2 from Per Bergqvist emacs mode problems with emacs 21 from Gerd Flaig (and possibly others) hipe corrections from Mikael Pettersson At the moment I can't access clearcase to check but I think the following patches are also included mod_auth.patch and patch-no-crypto patches from Matthias Lang changes in mod_cgi from Guillaume Bongenaar We would like to add the kernel poll support patch from Per Bergqvist as a configure option, something like "--enable-kernel-poll", but unfortunately the patch changes old non kernel poll code as well and we don't have time to verify those changes. I'm sure those changes are correct but we can't risk introducing new bugs for our commercial customers. Thank you all for your help improving Erlang/OTP, kent From tab@REDACTED Mon Jul 22 00:15:16 2002 From: tab@REDACTED (Tomas Abrahamsson) Date: Mon, 22 Jul 2002 00:15:16 +0200 (MEST) Subject: extra console/shell In-Reply-To: (vlad_dumitrescu@hotmail.com) References: Message-ID: <200207212215.AAA03032@proton.lysator.liu.se> >> Wait a mo... >> http://www.erlang.org/ml-archive/erlang-questions/200105/msg00019.html >> by Tomas Abrahamsson. > > I think it is a very useful application - maybe it should be published among > the other user contributions! It is now published as a user contribution, reshd-1.2. The version on the user contribution web contains some bugfixes. I also submitted another package I had lying around: py_interface. This is like JInterface but for Python. It acts as a hidden node, it is written entirely in Python, it is can to send/receive messages and it can do rpc:call. It translates Erlang types into Python types, and vice versa, as far as possible. /Tomas From jilani.khaldi@REDACTED Mon Jul 22 01:10:00 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Mon, 22 Jul 2002 01:10:00 +0200 Subject: Installing Erlang on FreeBSD Message-ID: Hi All, could somebody tell me, please, how to install Erlang on FreeBSD from source code (dependencies...)? I can't find any FreeBSD pkg. Thank you. -- Jilani Khaldi http://space.tin.it/scuola/jkhaldi From kent@REDACTED Mon Jul 22 01:16:08 2002 From: kent@REDACTED (Kent Boortz) Date: 22 Jul 2002 01:16:08 +0200 Subject: Installing Erlang on FreeBSD In-Reply-To: References: Message-ID: > could somebody tell me, please, how to install Erlang on FreeBSD > from source code (dependencies...)? I can't find any FreeBSD pkg. There is a port, as root do % cd /usr/ports/lang/erlang % make % make install There is a separate port for documentation, kent From apeake@REDACTED Mon Jul 22 05:49:58 2002 From: apeake@REDACTED (Alex Peake) Date: Sun, 21 Jul 2002 20:49:58 -0700 Subject: Erlang as Killer Programming Tool Message-ID: This article, actually about a proposed new Lisp, is very intriguing as you think about a possible future for Erlang. http://www.paulgraham.com/popular.html Note that, consistent with the views expressed in many papers by respected programming visionaries, the future lies in server-based programming. I believe that Erlang is well suited to this. Is the community (or Ericsson) interested in moving Erlang more mainstream? It appears that it has less distance to travel than Lisp! Alex From spearce@REDACTED Mon Jul 22 00:40:06 2002 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 21 Jul 2002 18:40:06 -0400 Subject: Erlang killer app?, In-Reply-To: <20020721070534.GA9367@calvin.local.vawis.net> References: <20020721003346.82184.qmail@web20503.mail.yahoo.com> <20020721070534.GA9367@calvin.local.vawis.net> Message-ID: <20020721184006.D72689@spearce.org> Isn't this kind of what this thread is about currently? ``I like Erlang, so what can we make in it?'' I agree however, that its very, very common for developers to pick up langauges such as Java, but shun something such as Erlang, just because of the sheer hype, marketing, and influence of coworkers. Then they come with an idea and create a software package in it, even if that means lots of work because of the wrong language selection. I myself shuned using Ruby for a project that others who know it have said it would have been good at. Instead I have a 65,000+ line C++ monster I'd prefer not to touch. I also know I was tempted to port it to Erlang, just because I knew the language and thought it would be `cool'. I've also used Tcl and Java for a project that I think would be much better suited to Erlang, except: 1) I don't know the state of SAE on Windows. Tcl can be built to a stand alone Windows .exe, perfect for my application. No DLLs are required. 2) Erlang doesn't have XSLT and FOP->PDF available. (But JInterface would work well enough here with only minimal Java code that I could use the Java based processors.) 3) Programming web interfaces in Erlang still isn't a strong suite of mine, despite that I do it in nearly every other language. Perhaps its because I still think yaws,inets,etc are weaker than the other offerings... not that I really like Java servlets and JSP that much. 4) My coworkers don't know Erlang and don't want to bother with the "chore" of learning a language other than the One-True-Language-Called-Java(tm). Its just too much of an inconvience for them. Too much effort, too much thinking and studying required. Conversely, I chose C/Erlang for my video application, only because its very similiar to what the telecomm guys do with Erlang. Much of the "routing" and "control" is done in Erlang, with the device specific bindings and speed critical sections in C. Erlang made perfect sense to use, as it had an integrated database, code reloading, distributed messaging, which were all critical as I am attempting to create a multiple computer solution. I think Erlang's biggest strength is really the points mentioned earlier in this thread about fault tolerance, distribution, etc, but also how well it coordinates and integrates with other systems. Just how "easy" is it to hook Java to C or C++? What about making Java act as an NFS server to communicate with Unix clients? Erlang people do this all of the time, because its so easy. And because its so easy, we try not to reinvent the wheel (when possible), unlike our Java, Perl and Python friends. I think its because: Erlang is concurrent, and with message passing so central to its design, that it is very trival to declare some unknown black box as 'another concurrent process, handling messages'. This fits perfectly into the environment, and the environment fits perfectly to it. Thierry Mallard scrawled: > On Sat, Jul 20, 2002 at 05:33:46PM -0700, isaac gouy wrote: > > [ Choosing a language ] > > I asked the OpenNMS guys why they chose to develop in > > Java. They didn't have much experience of Java when > > they started but from their C++ perspective "It seemed > > the right tool for the job of writing something easily > > portable with a rapid development time." > > "> Has anyone on the OpenNMS team heard of Erlang? > > Heard of, yes. Looked at, not really... > > > Was it ever considered as an implementation choice? > > I doubt it" > > In my humble opinion, this is a common pattern : often, specially when > it's a "hobby project", the developers thinks first "ok, I like > this language and I want to code with it. Now, what can I do... ? " > and not : "Ok, there's problem here that needs to be solved. What would > be the betters tools (language among others) to solve it ? " > > For example -and only an example- I wondered recently why Zope was > written in Python. The answer Jim Fulton gave in an interview was > " I was a convert to Python by that time. ;) " -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From mike@REDACTED Mon Jul 22 08:43:13 2002 From: mike@REDACTED (Michael Williams) Date: 22 Jul 2002 06:43:13 GMT Subject: Erlang killer app? References: <20020719194655.35721.qmail@web20503.mail.yahoo.com>, Message-ID: In article , etxuwig@REDACTED (Ulf Wiger) writes: |> I'm convinced that Erlang could be used to design some killer |> groupware. Lotus Notes is very popular - and expensive. I am sure that similar groupware written in Erlang could be a great hit. And Erlang would be very suitable, lots of concurrency and distribution in a network of machines which come and go. /mike From sam@REDACTED Mon Jul 22 10:54:04 2002 From: sam@REDACTED (Samuel Tardieu) Date: Mon, 22 Jul 2002 10:54:04 +0200 Subject: Plan and preparation for R8B-2 In-Reply-To: References: <200206232221.g5NMLbY27274@sork.levonline.com> Message-ID: <2002-07-22-10-54-04+trackit+sam@inf.enst.fr> On 22/07, Kent Boortz wrote: | Note this is *not* R8B-2, it is a snapshot for portability verification | | http://www.erlang.org/otp_src_R8B_2002-07-21.tar.gz The compilation went flawlessly on SparcLinux (Debian GNU/Linux 3.0 on UltraSparc). Sam -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available URL: From laura@REDACTED Mon Jul 22 11:42:55 2002 From: laura@REDACTED (Laura Castro) Date: Mon, 22 Jul 2002 11:42:55 +0200 (CEST) Subject: Problems with Erlang and ODBC Message-ID: Hello all: I'm trying to get Erlang (OTP R7B-4) and PostgreSQL 7.1.3 working together, using unixODBC 2.2.2 driver. I downloaded postgresql source code, configured and installed it at ~/postgresql-7.1.3, and also downloaded unixODBC source code, configured and installed it at ~/unixODBC-2.2.2. Both of them seems to work all right (I can create SQL-tables from psql prompt, then "select" them via unixODBC, and vice versa). Next I downloaded OTP R7B-4 source code, and again configured and installed it at ~/otp_R7B-4 this way: ./configure --prefix=~/otp_R7B-4 --enable-odbc make make install Those processes doesn't seem to get any errors. To get erlang odbc module available, I tried to follow all the steps I found at: http://www.erlang.org/doc/r8b/lib/odbc-0.9.1/doc/html/part_frame.html but although I modified ODBCROOT, ODBCLDFLAGS, ODBCLIBS and ODBCINCLUDE, then type "make" again in the lib/odbc/src directory and got no errors on the process, when I try: > basic:start(). or > utility:start(). (which are two examples on previously mentioned documentation I modified properly to set my DSN, UID and PWD) I get: ** exited: {undef,[{odbc,start_link,[{local,odbc1},[],[]]}, {basic,start,0}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** Of course, postgresql postmaster is running. Searching for a similar problem in erlang mailing-list archives I found the following: http://www.erlang.org/ml-archive/erlang-questions/200012/msg00148.html I thought that should be fixed (since it references OTP R7B-1), but it isn't. The mentioned "Makefile" contains exactly that if-structure. What surprised me the most was that that mail hadn't got any answer, as it had been ignored. I don't really know what to do. I tried another release (R8B-0), but it was worse, because I didn't even get a Makefile in which I should modified the environment variables after first compilation. Any ideas? Thank you very much in advance. Laura Castro From Sean.Hinde@REDACTED Mon Jul 22 11:52:26 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 22 Jul 2002 10:52:26 +0100 Subject: MacOS X Build Message-ID: <04D356A3B172D611981B0008C791C3126BF1C0@imp02mbx.t-mobile.co.uk> Hi, R8B-1 builds out of the box (after following the instrucions in the README). The main catch is that you MUST use the gnutar command (no other tar will do) but of course that note is in the README which you can't read until it is untarred! I have thought some about how to make a binary build for OS X. I haven't quite come up with a way to resolve the perpetual OS X conflict between: a) Just making an installer .pkg from a built system and leaving the user to start up Terminal and type erl b) Trying to make a nice OS X native application which can be dragged onto the desktop, makes a nice shell window when double clicked, and carries all the baggage around with it. I started work on a Cocoa Erlang shell application somewhat along the lines of a cross between the windows version and "Winfiol", but I ran into the problem that the Windows Shell seems to have lots of extra support built into the erlang runtime itself.. and just using stdin/out became problematic (I found myself having to write a full blown vt emulator). Also, having a nice Erlang.app structure means that other apps can't find include files etc (well, erl_driver.h!). But, I'm struggling to see the point of just making a .pkg file of /usr/local/erlang when it is so easy to do ./configure etc. What's your thought Bijian? You have wider experience of the general computing world than I. Regards, Sean > -----Original Message----- > From: Bijan Parsia [mailto:bparsia@REDACTED] > Sent: 20 July 2002 22:33 > To: erlang-questions@REDACTED > Subject: MacOS X Build > > > I see from google that someone got Erlang to build on MacOS X > but I can't > seem to find a binary anywhere around. Any pointers? > > Cheers, > Bijan Parsia. > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Sean.Hinde@REDACTED Mon Jul 22 11:50:49 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 22 Jul 2002 10:50:49 +0100 Subject: MacOS X Build Message-ID: <04D356A3B172D611981B0008C791C3126BF1C1@imp02mbx.t-mobile.co.uk> > What's your thought Bijian? You have wider experience of the > general computing world than I. Sorry, misread your name spelling! Rgds, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From ingela@REDACTED Mon Jul 22 13:01:52 2002 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 22 Jul 2002 13:01:52 +0200 (MEST) Subject: Problems with Erlang and ODBC References: Message-ID: <200207221101.NAA16293@gildor.du.uab.ericsson.se> Well, you could wait for the new and better version of odbc that will be part of R9. A beta version of it will be released with the open source release R8B-2. Laura Castro wrote: > > Hello all: > > I'm trying to get Erlang (OTP R7B-4) and PostgreSQL 7.1.3 working > together, using unixODBC 2.2.2 driver. I downloaded postgresql source > code, configured and installed it at ~/postgresql-7.1.3, and also > downloaded unixODBC source code, configured and installed it at > ~/unixODBC-2.2.2. Both of them seems to work all right (I can create > SQL-tables from psql prompt, then "select" them via unixODBC, and > vice versa). > > Next I downloaded OTP R7B-4 source code, and again configured and > installed it at ~/otp_R7B-4 this way: > > ./configure --prefix=~/otp_R7B-4 --enable-odbc > make > make install > > Those processes doesn't seem to get any errors. > > To get erlang odbc module available, I tried to follow all the steps I > found at: > > http://www.erlang.org/doc/r8b/lib/odbc-0.9.1/doc/html/part_frame.html > > but although I modified ODBCROOT, ODBCLDFLAGS, ODBCLIBS and ODBCINCLUDE, > then type "make" again in the lib/odbc/src directory and got no errors > on the process, when I try: > > > basic:start(). or > utility:start(). > > (which are two examples on previously mentioned documentation I > modified properly to set my DSN, UID and PWD) I get: > > ** exited: {undef,[{odbc,start_link,[{local,odbc1},[],[]]}, > {basic,start,0}, > {erl_eval,expr,3}, > {erl_eval,exprs,4}, > {shell,eval_loop,2}]} ** > > Of course, postgresql postmaster is running. > > Searching for a similar problem in erlang mailing-list archives I found > the following: > > http://www.erlang.org/ml-archive/erlang-questions/200012/msg00148.html > > I thought that should be fixed (since it references OTP R7B-1), but it > isn't. The mentioned "Makefile" contains exactly that if-structure. What > surprised me the most was that that mail hadn't got any answer, as it had > been ignored. > > I don't really know what to do. I tried another release (R8B-0), but it > was worse, because I didn't even get a Makefile in which I should modified > the environment variables after first compilation. Any ideas? > > Thank you very much in advance. > > Laura Castro -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team From bjowi@REDACTED Mon Jul 22 16:47:59 2002 From: bjowi@REDACTED (=?iso-8859-1?q?Bj=F6rn?= Wingman) Date: Mon, 22 Jul 2002 16:47:59 +0200 Subject: idl compilation problems Message-ID: If I have two idl-files, test1.idl and test2.idl, like these: test1.idl: #ifndef TEST1 #define TEST1 module A { struct Vec { double x; double y; double z; }; }; #endif test2.idl: #ifndef TEST2 #define TEST2 #include "test1.idl" module A { struct Pos { double x; double y; double z; }; }; #endif ...and I compile then with ic:gen(), the generated .hrl file (A.hrl) will only contain either the Vec or the Pos struct (as a record), depending on in which order I compiled the files. Even if I compile only test2.idl (which includes test1.idl), only Pos appears in A.hrl. I have fiddled around with preprocessor options, and using cpp instead of the built-in preprocessor. How do I solve this? I'm using this ic: 1> m(ic). Module ic compiled: Date: March 21 2002, Time: 16.12 Compiler options: [v3, debug_info, {parse_transform,sys_pre_attributes}, {attribute,insert,vsn,"ic_4.1.1"}, {outdir,"/home/bjowi/otp_src_R8B-0/lib/ic/src/../ebin"}, {cwd,'/home/bjowi/otp_src_R8B-0/lib/ic/src'}] Object file: /usr/local/lib/erlang/lib/ic-4.1.2/ebin/ic.beam /Bj?rn Wingman From bjowi@REDACTED Mon Jul 22 17:15:11 2002 From: bjowi@REDACTED (=?iso-8859-1?q?Bj=F6rn?= Wingman) Date: Mon, 22 Jul 2002 17:15:11 +0200 Subject: idl compilation problems In-Reply-To: (bjowi@ida.liu.se's message of "Mon, 22 Jul 2002 16:47:59 +0200") References: Message-ID: > If I have two idl-files, test1.idl and test2.idl, like these: Hang on, those weren't perhaps the best examples. If test2.idl instead looks like this: module A { module B { struct Pos { double x; /**< x-coordinate */ double y; /**< y-coordinate */ double z; /**< z-coordinate */ }; }; }; ...compiling test1 before test2 yields an empty A.hrl. /Bj?rn Wingman From Niclas.Eklund@REDACTED Mon Jul 22 17:24:33 2002 From: Niclas.Eklund@REDACTED (Niclas Eklund) Date: Mon, 22 Jul 2002 17:24:33 +0200 (MEST) Subject: idl compilation problems In-Reply-To: Message-ID: Hello! This is a known "problem". Initially it wasn't possible to divide module-definitions into several IDL-files. What you should do is to put typedef, struct, union and exception definitions in one of the IDL-files or create a 'DataType'-module. - "Why can't IC open an existing file and add new definitions?" The generated files may, for example, be created in different directories or old files, which should have been removed, exists. To continue to be compatible with older versions it was not possible to change this. If we have: module A { module B { struct Pos { double x; /**< x-coordinate */ double y; /**< y-coordinate */ double z; /**< z-coordinate */ }; }; }; ...compiling test1 before test2 yields an empty A.hrl. In this case we could skip generating the hrl-file when compiling test1.idl. But, since the hrl-file may be included in a module or added to a Makefile, even though it's empty, changing this could cause problems. /Niclas > If I have two idl-files, test1.idl and test2.idl, like these: > > test1.idl: > > #ifndef TEST1 > #define TEST1 > > module A { > struct Vec { > double x; > double y; > double z; > }; > }; > > #endif > > test2.idl: > > #ifndef TEST2 > #define TEST2 > > #include "test1.idl" > > module A { > struct Pos { > double x; > double y; > double z; > }; > }; > > #endif > > > ...and I compile then with ic:gen(), the generated .hrl file (A.hrl) > will only contain either the Vec or the Pos struct (as a record), > depending on in which order I compiled the files. Even if I compile > only test2.idl (which includes test1.idl), only Pos appears in A.hrl. > > I have fiddled around with preprocessor options, and using cpp instead > of the built-in preprocessor. How do I solve this? > > I'm using this ic: > > 1> m(ic). > Module ic compiled: Date: March 21 2002, Time: 16.12 > Compiler options: [v3, > debug_info, > {parse_transform,sys_pre_attributes}, > {attribute,insert,vsn,"ic_4.1.1"}, > {outdir,"/home/bjowi/otp_src_R8B-0/lib/ic/src/../ebin"}, > {cwd,'/home/bjowi/otp_src_R8B-0/lib/ic/src'}] > Object file: /usr/local/lib/erlang/lib/ic-4.1.2/ebin/ic.beam > > > /Bj?rn Wingman From per@REDACTED Mon Jul 22 19:42:38 2002 From: per@REDACTED (Per Bergqvist) Date: Mon, 22 Jul 2002 18:42:38 +0100 Subject: Plan and preparation for R8B-2 In-Reply-To: Message-ID: <200207221642.g6MGgcG23872@lejon.levonline.com> Hi, attached are three patch files. 1) a number of patches to avoid warnings. I think I have posted most of them earlier but here they are again. 2) kernel poll for the snap shot with --enable-kernel-poll as requested. 3) a patch against R8B-1 to build properly under HP'sUX-11. BR Per > > This is a request for portability patches to be included before the > R8B-2 release. We would like it to build on as many platforms as > possible without the need to download any separate patches. > There will be some other changes before R8B-2 as well. > > Note this is *not* R8B-2, it is a snapshot for portability verification > > http://www.erlang.org/otp_src_R8B_2002-07-21.tar.gz > > The following patches from this list are part of this snapshot > (there may be others that was included earlier) > > corrections in "inet_drv.c" from Johan Blom > > fix for erl_interface sort order in erl_compare_ext and bignum decoding > from Per Bergqvist > > fix for problem with erl_connect from Per Bergqvist > > build corrections with gcc 3.1 under RH7.2 from Per Bergqvist > > emacs mode problems with emacs 21 from Gerd Flaig (and possibly others) > > hipe corrections from Mikael Pettersson > > At the moment I can't access clearcase to check but I think the > following patches are also included > > mod_auth.patch and patch-no-crypto patches from Matthias Lang > > changes in mod_cgi from Guillaume Bongenaar > > We would like to add the kernel poll support patch from Per Bergqvist > as a configure option, something like "--enable-kernel-poll", but > unfortunately the patch changes old non kernel poll code as well and > we don't have time to verify those changes. I'm sure those changes are > correct but we can't risk introducing new bugs for our commercial > customers. > > Thank you all for your help improving Erlang/OTP, > > kent > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R8B_2002_07_21.patch Type: application/octet-stream Size: 8733 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: kernel_poll_R8B_2002-07-21.patch Type: application/octet-stream Size: 27528 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: R8B-1.patch14 Type: application/octet-stream Size: 1353 bytes Desc: not available URL: From joe@REDACTED Mon Jul 22 20:00:38 2002 From: joe@REDACTED (Joe Armstrong) Date: Mon, 22 Jul 2002 20:00:38 +0200 (CEST) Subject: Erlang killer app?, In-Reply-To: <20020721184006.D72689@spearce.org> Message-ID: On Sun, 21 Jul 2002, Shawn Pearce wrote: > Isn't this kind of what this thread is about currently? > ``I like Erlang, so what can we make in it?'' > > I agree however, that its very, very common for developers > to pick up langauges such as Java, but shun something such > as Erlang, just because of the sheer hype, marketing, and > influence of coworkers. Then they come with an idea and > create a software package in it, even if that means > lots of work because of the wrong language selection. > > I myself shuned using Ruby for a project that others who > know it have said it would have been good at. Instead > I have a 65,000+ line C++ monster I'd prefer not to touch. > I also know I was tempted to port it to Erlang, just because > I knew the language and thought it would be `cool'. > > I've also used Tcl and Java for a project that I think > would be much better suited to Erlang, except: > > 1) I don't know the state of SAE on Windows. Tcl > can be built to a stand alone Windows .exe, > perfect for my application. No DLLs are required. > This is in the (near) pipeline :-) You *will* need one DLL (erlang.dll) thereafter you will be able to pack all application code into a single .exe file (or use shared libraries). You'll also be able to make windows .exe files inside Linux and build linux executables from windows. > 2) Erlang doesn't have XSLT and FOP->PDF available. > (But JInterface would work well enough here with > only minimal Java code that I could use the > Java based processors.) > ?? - I don't understand - do you meant you'd like an implementation of XSLT in Erlang???? Also, are their any good (free) FOP->PDF convertors? > 3) Programming web interfaces in Erlang still isn't > a strong suite of mine, despite that I do it > in nearly every other language. Perhaps its > because I still think yaws,inets,etc are weaker > than the other offerings... not that I really > like Java servlets and JSP that much. I disagee - Erlang programs are a lot shorter than the equivalent Java stuff so the embedded code is much shorter and easier to write and maintain. I think I mentioned erarier that we were going to benchmark an yaws against Apache under condition of medium to high overload. We have some *very*?preliminary figures. At low load yaws and Apache have very similar performance. At 100% overload yaws is about 4 - 7 times faster than Apache. At 1000% overload yaws is about 4 times better than Apache. In other words if your web site has nasty peaks when suddenly everybody wants to access it Apache almost falls over, yews ticks along nicely. Even at 1000% overload yaws was servicing all requests (albeit slowly) but Apache was rejecting 40% of all traffic. Also bear in mind Klackes figures - yaws was generating 2,000 dynamic pages/sec - a high performance PHP will manage a few hundred. So we have: 1) shorter code 2) better performance under heavy overload 3) very fast dynamic page generation That's why you will like it :-) > > 4) My coworkers don't know Erlang and don't want to > bother with the "chore" of learning a language > other than the One-True-Language-Called-Java(tm). > Its just too much of an inconvience for them. Too > much effort, too much thinking and studying required. > If you can learn Java you can learn anything - Java is ridicolously complicated. If you're going argue that "lazyness rules" then take the easy way out and program in Erlang - believe me much less thinking is involved programming in Erlang than programming in Java. > Conversely, I chose C/Erlang for my video application, > only because its very similiar to what the telecomm guys > do with Erlang. Much of the "routing" and "control" is > done in Erlang, with the device specific bindings and > speed critical sections in C. Erlang made perfect sense > to use, as it had an integrated database, code reloading, > distributed messaging, which were all critical as I am > attempting to create a multiple computer solution. > > I think Erlang's biggest strength is really the points > mentioned earlier in this thread about fault tolerance, > distribution, etc, but also how well it coordinates > and integrates with other systems. > > Just how "easy" is it to hook Java to C or C++? What > about making Java act as an NFS server to communicate > with Unix clients? > > Erlang people do this all of the time, because its so > easy. And because its so easy, we try not to reinvent > the wheel (when possible), unlike our Java, Perl and > Python friends. > > I think its because: > > Erlang is concurrent, and with message passing > so central to its design, that it is very trival > to declare some unknown black box as 'another > concurrent process, handling messages'. This > fits perfectly into the environment, and the > environment fits perfectly to it. > > > Thierry Mallard scrawled: > > On Sat, Jul 20, 2002 at 05:33:46PM -0700, isaac gouy wrote: > > > [ Choosing a language ] > > > I asked the OpenNMS guys why they chose to develop in > > > Java. They didn't have much experience of Java when > > > they started but from their C++ perspective "It seemed > > > the right tool for the job of writing something easily > > > portable with a rapid development time." > > > "> Has anyone on the OpenNMS team heard of Erlang? > > > Heard of, yes. Looked at, not really... > > > > Was it ever considered as an implementation choice? > > > I doubt it" > > > > In my humble opinion, this is a common pattern : often, specially when > > it's a "hobby project", the developers thinks first "ok, I like > > this language and I want to code with it. Now, what can I do... ? " > > and not : "Ok, there's problem here that needs to be solved. What would > > be the betters tools (language among others) to solve it ? " > > > > For example -and only an example- I wondered recently why Zope was > > written in Python. The answer Jim Fulton gave in an interview was > > " I was a convert to Python by that time. ;) " > > -- > Shawn. > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' > From fritchie@REDACTED Tue Jul 23 03:58:49 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 22 Jul 2002 20:58:49 -0500 Subject: driver_output_term() and unsigned long (32 bit) values Message-ID: <200207230158.g6N1wna50896@snookles.snookles.com> Am I correct in assuming that, if I *really* needed a driver to get the most-significant bit of a 32 bit unsigned long sent to Erlang via driver_output_term(), I'm out of luck? I suppose I could do something like: 1. Modify BEAM to support unsigned integers. 2. Send the unsigned int back as a binary and then unpack it as an ":32/unsigned-integer" 3. Send the unsigned int back as a signed int, then have Erlang pack it into a binary and then unpack it as a ":32/unsigned-integer". 4. Send back a {1, N} tuple and then have Erlang convert via "(1 bsl 31) bor N" or equivalent arithmetic. 5. Not use driver_output_term(). 6. Um, I think I'd better stop now. This is getting too ugly. Is there a better, non-ugly solution I'm missing? -Scott From igouy@REDACTED Tue Jul 23 04:30:05 2002 From: igouy@REDACTED (isaac gouy) Date: Mon, 22 Jul 2002 19:30:05 -0700 (PDT) Subject: Erlang killer app?, Message-ID: <20020723023005.13497.qmail@web20510.mail.yahoo.com> >benchmark yaws against Apache The hardware vendors seem to use SPECweb99 and SPECweb99_SSL for their bragging. In their tests they use Zeus, IIS5, TUX, Red Hat Content Accelerator. ( http://www.spec.org/osg/web99/docs/faq.html ) It doesn't seem that Apache 1.3 was popular because it was fast but because it was fast enough. (Particularly if you offloaded static html and gifs to mathopd.) Better to benchmark against Zeus? The Zeus website has some pdfs on benchmarking: http://www.zeus.com/library/technical/ Some 2 year old IIS benchmarks are given down at the bottom of this page: http://www.networkcomputing.com/1104/1104f12.html >Java is ridiculously complicated Sun seem to have complicated things so much that the next step is... a code generator! http://research.sun.com/features/ace/ best wishes Isaac __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From igouy@REDACTED Tue Jul 23 04:40:11 2002 From: igouy@REDACTED (isaac gouy) Date: Mon, 22 Jul 2002 19:40:11 -0700 (PDT) Subject: Linux Journal - Favorite Programming Language Message-ID: <20020723024011.52174.qmail@web20508.mail.yahoo.com> http://www.linuxjournal.com/rc2002/ I'm happy because I get to vote for Smalltalk ;-) But at the moment y'all will have to vote in "Other"! Maybe that would get Erlang onto their form? __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From spearce@REDACTED Tue Jul 23 04:49:23 2002 From: spearce@REDACTED (Shawn Pearce) Date: Mon, 22 Jul 2002 22:49:23 -0400 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: <200207230158.g6N1wna50896@snookles.snookles.com> References: <200207230158.g6N1wna50896@snookles.snookles.com> Message-ID: <20020722224923.B100935@spearce.org> I'm getting around this with #2 right now. Its not a big deal, as its a group of unsigned ints already stored in a C struct. Format of the struct is part of the "contract" between my port server in Erlang and my C code. Its ugly, but its working just fine. Of course, ugly is 68 lines of extremely commented Erlang code. ;-) The more interesting thing missing from driver_output_term is a way to send a floating point number. Just figure that one out. :-) Currently I'm constructing an integer which is the actual value times the number of decimal places I need (100 to make 12.45 1245), and dividing it in Erlang after converting it to a float with float/1. Its a good thing I don't need to represent a large number of decimal places, or large values. Looking at the extensions since 4.4 docs however, I see that it may be possible to use << F:64/float >> to pass my floating point information up to Erlang. However, what floating point representation is this in? Docs don't seem to say. The other way to do this would be to use erl_interface to convert the floats into the external format, send that as a binary with driver_output_term() and let Erlang convert it back with binary_to_term/1. I noticed that for endianness << >> supports big and little, but doesn't support "host". This would be really nice, as there is otherwise no way to just have Erlang read my C struct from the driver. Instead, the driver must convert everything back and forth using ntohl() and Erlang does the same conversion. I can see though how this option could easily get you into trouble when you distribute an application. IMHO, driver_output_term is simple enough to get most of what is needed, the rest can be trivially hacked with a little bit of glue code in Erlang. Since the port itself should be hidden through either a module or a server process, its not to bad programmatically either. But these little conversions can add up in both speed and accuracy fast... Scott Lystig Fritchie scrawled: > Am I correct in assuming that, if I *really* needed a driver to get > the most-significant bit of a 32 bit unsigned long sent to Erlang via > driver_output_term(), I'm out of luck? > > I suppose I could do something like: > > 1. Modify BEAM to support unsigned integers. > 2. Send the unsigned int back as a binary and then unpack it as an > ":32/unsigned-integer" > 3. Send the unsigned int back as a signed int, then have Erlang pack > it into a binary and then unpack it as a ":32/unsigned-integer". > 4. Send back a {1, N} tuple and then have Erlang convert via "(1 bsl > 31) bor N" or equivalent arithmetic. > 5. Not use driver_output_term(). > 6. Um, I think I'd better stop now. This is getting too ugly. > > Is there a better, non-ugly solution I'm missing? -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From spearce@REDACTED Tue Jul 23 05:21:40 2002 From: spearce@REDACTED (Shawn Pearce) Date: Mon, 22 Jul 2002 23:21:40 -0400 Subject: Erlang killer app?, In-Reply-To: References: <20020721184006.D72689@spearce.org> Message-ID: <20020722232140.C100935@spearce.org> Joe Armstrong scrawled: > On Sun, 21 Jul 2002, Shawn Pearce wrote: > > 1) I don't know the state of SAE on Windows. Tcl > > can be built to a stand alone Windows .exe, > > perfect for my application. No DLLs are required. > > > > This is in the (near) pipeline :-) You *will* need one DLL > (erlang.dll) thereafter you will be able to pack all application code > into a single .exe file (or use shared libraries). You'll also be able to make > windows .exe files inside Linux and build linux executables from windows. Good to hear! Lets see if I can talk my boss into it. * checks * Nope. I think SAE is a good thing. ;-) Even if I can't use it at work. > > 2) Erlang doesn't have XSLT and FOP->PDF available. > > (But JInterface would work well enough here with > > only minimal Java code that I could use the > > Java based processors.) > > > > ?? - I don't understand - do you meant you'd like an implementation of > XSLT in Erlang???? Also, are their any good (free) FOP->PDF convertors? No, I don't think an implementation of XSLT is the issue. I was simply stating that since it doesn't have one, I'd have to use another one externally. But JInterface is pretty solid at communiating back and forth, making it relatively trivial. An Erlang based XSLT would be cool, but I think its one of those things that right now nobody really has a big desire for, so its not worth expending resources into. Would I find use for an Erlang based XSLT if we had one? Maybe. Do I have that many uses for the existing Java based ones? Nope. C++? Nope. The Apache Jakarta Project has a tool available called FOP to translate XSL:FO (which is what I meant to say) to PDF. Does a pretty slick job too. Some XSL:FO features are not yet supported. but version 0.23 is pretty stable. I've got an internal tool at work based entirely around XSLT->XSLT->XSL:FO->PDF. So even if we had XSLT in Erlang, I'd still be doing the last pass in Java. > > 3) Programming web interfaces in Erlang still isn't > > a strong suite of mine, despite that I do it > > in nearly every other language. Perhaps its > > because I still think yaws,inets,etc are weaker > > than the other offerings... not that I really > > like Java servlets and JSP that much. > > I disagee - Erlang programs are a lot shorter than the equivalent Java > stuff so the embedded code is much shorter and easier to write and maintain. Excellent point. I didn't think of it that way. I was thinking about the fact that I'm not a big fan of embedding code within the HTML. Haven't been since we were using the latest and greatest Pentium 90 to serve up web pages in Perl and used Berkely db as our database. > I think I mentioned erarier that we were going to benchmark an > yaws against Apache under condition of medium to high overload. > > We have some *very*?preliminary figures. > > At low load yaws and Apache have very similar performance. > > At 100% overload yaws is about 4 - 7 times faster than Apache. > > At 1000% overload yaws is about 4 times better than Apache. > > In other words if your web site has nasty peaks when suddenly everybody > wants to access it Apache almost falls over, yews ticks along nicely. > Even at 1000% overload yaws was servicing all requests (albeit slowly) > but Apache was rejecting 40% of all traffic. > > Also bear in mind Klackes figures - yaws was generating 2,000 > dynamic pages/sec - a high performance PHP will manage a few hundred. > > So we have: > > 1) shorter code > 2) better performance under heavy overload > 3) very fast dynamic page generation > > That's why you will like it :-) And that's why I'm wondering how much better the Apache Servlet container might run when stuck behind a yaws like server rather than the real Apache HTTPd. We build Java servlet applications at work, and our customers deploy in Apache Tomcat. We've got a major telcom equipment vendor who is having lots of trouble with the front end Apache web server we're using when its under high load (about 100 concurrent connections, 26 views/sec). Apache itself is falling apart, but the Tomcat's seem fine. I'm quite tempted to write a plugin for yaws (or just plain hack yaws) to create a proof of concept of this. Problem is, my boss won't approve my expending time/resources on anything isoteric like Tcl, Erlang, etc. (He just pulled the plug today on a Tcl/Tk GUI we were building, opting instead for it to be done in Java/JSP, for no reason other than that its JSP.) *sigh* > > 4) My coworkers don't know Erlang and don't want to > > bother with the "chore" of learning a language > > other than the One-True-Language-Called-Java(tm). > > Its just too much of an inconvience for them. Too > > much effort, too much thinking and studying required. > > If you can learn Java you can learn anything - Java is ridicolously > complicated. If you're going argue that "lazyness rules" then take the > easy way out and program in Erlang - believe me much less thinking is > involved programming in Erlang than programming in Java. This I have to agree whole heartedly with. Unfortunately, I work for an organization that only jumps on the bandwagon that Sun and Microsoft are on. Any other isn't a valid bandwagon, and there are no other technologies available for use. Since Tcl isn't a big Sun technology, at least not like Java, coworkers refuse to expend any effort into learning it to any extent. Consequently, we can't do rapid GUI development in Tcl/Tk for internal projects. I'm having a hard enough time getting coworkers to learn shell scripting, let alone a new-to-them language like Erlang. Now a slightly off topic question: Has anyone had success at getting Erlang (or any other isoteric-to-them language/environment) into an environment like I'm describing? -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From apeake@REDACTED Tue Jul 23 06:26:50 2002 From: apeake@REDACTED (Alex Peake) Date: Mon, 22 Jul 2002 21:26:50 -0700 Subject: Erlang killer app?, In-Reply-To: <20020722232140.C100935@spearce.org> Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Shawn Pearce > Sent: Monday, July 22, 2002 8:22 PM > To: erlang-questions@REDACTED > Subject: Re: Erlang killer app?, > > [...snip...] > Now a slightly off topic question: Has anyone had success at getting > Erlang (or any other isoteric-to-them language/environment) into an > environment like I'm describing? > I am using Erlang in just such an environment, but surreptitiously -- I use to to generate Active Server Pages, VB COM objects and JavaScript. I have also used it to generate VB forms. I am now working on generating C#, ASPX versions. Alex From mickael.remond@REDACTED Tue Jul 23 07:17:24 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 23 Jul 2002 07:17:24 +0200 Subject: Erlang killer app?, Message-ID: <1027401444.3d3ce6e4b1870@webmail.spamcop.net> Shawn Pearce : > No, I don't think an implementation of XSLT is the issue. I was simply > stating that since it doesn't have one, I'd have to use another one > externally. Do not forget that there is a Sablotron binding for Erlang. And that a mod_xsl extension for Inets web server has been developped. > And that's why I'm wondering how much better the Apache Servlet container > might run when stuck behind a yaws like server rather than the real Apache > HTTPd. We build Java servlet applications at work, and our customers > deploy > in Apache Tomcat. We've got a major telcom equipment vendor who is having > lots of trouble with the front end Apache web server we're using when its > under high load (about 100 concurrent connections, 26 views/sec). Apache > itself is falling apart, but the Tomcat's seem fine. It is an interesting question: How much Erlang can help in making Java apps more reliable ? I have no answer for that, but I would really like to know. Please let us know if you go further in this direction. -- Micka?l R?mond From mickael.remond@REDACTED Tue Jul 23 07:39:37 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 23 Jul 2002 07:39:37 +0200 Subject: Erlang killer app?, Message-ID: <1027402777.3d3cec199e610@webmail.spamcop.net> Joe Armstrong : > In other words if your web site has nasty peaks when suddenly everybody > wants to access it Apache almost falls over, yews ticks along nicely. > Even at 1000% overload yaws was servicing all requests (albeit slowly) > but Apache was rejecting 40% of all traffic. > > Also bear in mind Klackes figures - yaws was generating 2,000 > dynamic pages/sec - a high performance PHP will manage a few hundred. I think Yaws performance are impressive, particularly when you realize it has nearly the same figure when serving dynamic pages and static pages. I mentionned Inets earlier. I made preliminary benchmarks during the week-end (Inets-3.0JB). Inets seems 4 to 5 times slower than Yaws under light charge. An intersting question here regarding Apache: Which version did you use ? Apache V2 is marketed as more scalable than Apache 1.3 because some multithreaded stuff has been added. It seems that it does not always use the system process 'fork' to handle several requests. > So we have: > > 1) shorter code > 2) better performance under heavy overload > 3) very fast dynamic page generation > > That's why you will like it :-) I think we also need: - A page templating system. I made preliminary tests of an Erlang Page templating system based on ZPT (Zope) and I think it fits well to Erlang. It seems to be a good choice. - A way to described the logic of the web application itself. An MVC approach might be a good choicefor this task. I still need to think about the way to do it. In Erlang terms, we need a web application behaviour (like OTP behaviours). - A way to be able to have several independant Web Application running independantly. J2EE approach is good on this side. You can add a directory with a config file describing the behaviour of your application and the service it needs. This way we could for exemple run a new Erlang node to provide a mnesia database to application that need serialisation mechanism. We would have here a good application server that can become a killer app here. Then, the last requirement would be a way to take advantage of Erlang feature: A must have is to be able to update a given web application without restarting the server (page templates and Erlang modules). Having the same functionnality for the http/Application server itself would be nice. Some one mentionned Paul Graham text. A described the importance of dynamic server environments for ASP application hosting and development. I think for monthes that the market is looking for a good plat-form to develop robust, reliable, efficient application servers that can be the basis of critical applications running 24/7. Then Sun proposed the J2EE application server technology. People are disappointed because this technology does not fullfill its promise. I think we can do it with an Erlang approach. And it will be a great relief if we can find a simpler alternative to J2EE technologie, because this is really a nightmare to developp with J2EE application server (Too complicated, too heavy, several minutes to deploy new apps: that's horrible to use it in developpement phase, etc). -- Micka?l R?mond http://www.erlang-fr.org/ From mickael.remond@REDACTED Tue Jul 23 07:41:42 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 23 Jul 2002 07:41:42 +0200 Subject: Erlang killer app?, Message-ID: <1027402902.3d3cec96e62ab@webmail.spamcop.net> Joe Armstrong : > I think I mentioned erarier that we were going to benchmark an > yaws against Apache under condition of medium to high overload. > Maybe we should use Bluetail wikie to work together on this stuff ? Is it still regularly backed up ? -- Micka?l R?mond From per@REDACTED Tue Jul 23 09:40:23 2002 From: per@REDACTED (Per Bergqvist) Date: Tue, 23 Jul 2002 08:40:23 +0100 Subject: =?iso-8859-1?q?driver=5Foutput=5Fterm()?= and unsigned long (32 bit) values In-Reply-To: <200207230158.g6N1wna50896@snookles.snookles.com> Message-ID: <200207230640.g6N6eNj16123@hyena.levonline.com> Send it as a bignum. Haven't really checked if this is supported via driver_output_term. (If not it should be fixed...) I do it via driver_output_binary and binary_to_term. /Per > Am I correct in assuming that, if I *really* needed a driver to get > the most-significant bit of a 32 bit unsigned long sent to Erlang via > driver_output_term(), I'm out of luck? > > I suppose I could do something like: > > 1. Modify BEAM to support unsigned integers. > 2. Send the unsigned int back as a binary and then unpack it as an > ":32/unsigned-integer" > 3. Send the unsigned int back as a signed int, then have Erlang pack > it into a binary and then unpack it as a ":32/unsigned-integer". > 4. Send back a {1, N} tuple and then have Erlang convert via "(1 bsl > 31) bor N" or equivalent arithmetic. > 5. Not use driver_output_term(). > 6. Um, I think I'd better stop now. This is getting too ugly. > > Is there a better, non-ugly solution I'm missing? > > -Scott > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From Sean.Hinde@REDACTED Tue Jul 23 11:23:10 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 23 Jul 2002 10:23:10 +0100 Subject: Erlang killer app?, Message-ID: <04D356A3B172D611981B0008C791C3126BF1CD@imp02mbx.t-mobile.co.uk> > I think we also need: > - A page templating system. I made preliminary tests of an Erlang Page > templating system based on ZPT (Zope) and I think it fits > well to Erlang. It > seems to be a good choice. I agree. This is one of the main things holding us back from deploying in directly customer facing environments (Along with the absense of a finished performant web server itself) > Some one mentionned Paul Graham text. A described the > importance of dynamic > server environments for ASP application hosting and development. > I think for monthes that the market is looking for a good > plat-form to develop > robust, reliable, efficient application servers that can be > the basis of > critical applications running 24/7. > Then Sun proposed the J2EE application server technology. People are > disappointed because this technology does not fullfill its promise. It truly does not. It is painful, it takes large teams month to create small apps which are painfully slow. Some vendors are even trying to move J2EE into the domain of core GSM Network Intelligent Network applications - the heartland of telecoms 24x7 land - it really is a joke. Currently there is even a problem with new Sun servers that they will not run the Sun JVM for more than a day without causing a SIGSEGV. It has taken Sun weeks to recognise the problem and there is still no fix.. Having said that there is no way we'd wean even the internal folks off their J2EE - even having demonstrated that 1 guy in a month can replace the work of 10 contractors for a year. Madness Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Sean.Hinde@REDACTED Tue Jul 23 13:01:59 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 23 Jul 2002 12:01:59 +0100 Subject: Erlang killer app?, Message-ID: <04D356A3B172D611981B0008C791C3126BF1D1@imp02mbx.t-mobile.co.uk> > > Having said that there is no way we'd wean even the > internal folks off their > > J2EE - even having demonstrated that 1 guy in a month can > replace the work > > of 10 contractors for a year. > > Seen that - and also s/J2EE/.NET/g or whatever fancy technology > appears on fancy colourful brochures this month. > > Sorry to quote someone who is on the list, but as Joe wrote last > year: 'you will never displace an existing technology if it > works. Wait > for the failures'. The 'night stalker programmer' approach > seems to work > well in my humble experience. Just be there when hell breaks > loose with a > solution in hand, and make sure it works. Indeed, there is little point even starting on the 1 month project if the 1 year one is actually succeeding ;-) It is not very pleasant to watch.. but it can have surprising results Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From enano@REDACTED Tue Jul 23 12:53:24 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Tue, 23 Jul 2002 12:53:24 +0200 (CEST) Subject: Erlang killer app?, In-Reply-To: <04D356A3B172D611981B0008C791C3126BF1CD@imp02mbx.t-mobile.co.uk> Message-ID: On Tue, 23 Jul 2002, Sean Hinde wrote: > Having said that there is no way we'd wean even the internal folks off their > J2EE - even having demonstrated that 1 guy in a month can replace the work > of 10 contractors for a year. Seen that - and also s/J2EE/.NET/g or whatever fancy technology appears on fancy colourful brochures this month. Sorry to quote someone who is on the list, but as Joe wrote last year: 'you will never displace an existing technology if it works. Wait for the failures'. The 'night stalker programmer' approach seems to work well in my humble experience. Just be there when hell breaks loose with a solution in hand, and make sure it works. Regards, Miguel From etxuwig@REDACTED Tue Jul 23 00:01:57 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 23 Jul 2002 00:01:57 +0200 (MET DST) Subject: Erlang killer app? In-Reply-To: Message-ID: On 22 Jul 2002, Michael Williams wrote: >In article , > etxuwig@REDACTED (Ulf Wiger) writes: >|> I'm convinced that Erlang could be used to design some killer >|> groupware. > >Lotus Notes is very popular - and expensive. I am sure that >similar groupware written in Erlang could be a great hit. And >Erlang would be very suitable, lots of concurrency and >distribution in a network of machines which come and go. /mike Personally, I've thought that the product to benchmark against would be FirstClass, which is a BBS system designed as a robust and fast client-server architecture. When I played with it, back in 1995-96, a Mac 950 could support 100 concurrent users, and a sufficiently powerful Windows NT box could serve 1000. It zipped along just fine over a 2400 bps modem line, with concurrent file downloads with resume functionality, message history tracking, on-line chat, database interfaces, multi-server forwarding, lots of security options, ... ...and it was a breeze to configure and never went down. What's more, it didn't cost more than your average PC mail package (much less for modem users.) I don't know how far it's progressed since then, or if there are better systems in the Open Source world. I thought Lotus Notes was terrible by comparison: expensive, slow, and hard to maintain. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From mike@REDACTED Tue Jul 23 13:43:27 2002 From: mike@REDACTED (Michael Williams) Date: 23 Jul 2002 11:43:27 GMT Subject: Erlang killer app? References: , Message-ID: In article , etxuwig@REDACTED (Ulf Wiger) writes: |> I don't know how far it's progressed since then, or if there are |> better systems in the Open Source world. I thought Lotus Notes |> was terrible by comparison: expensive, slow, and hard to |> maintain. Nevertheless, Lotus Notes is widely used despite the fact that it is expensive "payware". There should be a niche for a cheapware/freeware alternative written in Erlang! /mike From rprice@REDACTED Tue Jul 23 23:42:27 2002 From: rprice@REDACTED (Roger Price) Date: Tue, 23 Jul 2002 23:42:27 +0200 (CEST) Subject: Is HiPE faster than the Beam emulator? Message-ID: I wrote an simulator in Erlang for a machine which does many things at the same time. Using the Beam emulator in otp_src_R7B-4 running on SuSE Linux 7.1 it performed just over 10000 actions per second. I then downloaded otp_src_R8B-1.tar.gz, unpacked, configured with --enable-hipe , make, make install. I then erased all my .beam files and recompiled my main program using c(main,[native]) in the new Eshell V5.1.1. The other programs are compiled by main using compile:c(ErlFile, CompileOpts) where CompileOpts = [native, verbose, report_errors, report_warnings, warn_unused_vars, {outdir,BeamDir}]. To my surprise, the machine still runs at just over 10000 actions per sec. I had hoped that HiPE would be faster than the BEAM emulator. Neither the HiPE 1.0.2 user's manual nor the Technical reference 0.99.0 make any claim for improved speed. Should HiPE be faster than the BEAM emulator? Best Regards, Roger From kostis@REDACTED Wed Jul 24 00:11:17 2002 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Jul 2002 00:11:17 +0200 (MET DST) Subject: Is HiPE faster than the Beam emulator? In-Reply-To: Mail from 'Roger Price ' dated: Tue, 23 Jul 2002 23:42:27 +0200 (CEST) Message-ID: <200207232211.AAA16023@harpo.it.uu.se> Roger Price asked: > Should HiPE be faster than the BEAM emulator? Short answer due to the use of "should": Yes ;-) Unfortunately, the version of HiPE distributed with the R8 emulator is not always. Also, I suspect that your machine is an x86, right? The x86 port of HiPE was at a preliminary stage last October. Since then, we have been working on HiPE and the newer versions are much better. The upcoming R9 release will contain these and the x86 port of HiPE is now complete. Still, we will make no claims for guaranteed performance improvements, although I will be surprised if you do not notice some in applications where all the frequently executed code is compiled to native code. Mode-switches (i.e. BEAM <-> HiPE switches) still have an overhead though. Best, Kostis From shrogers@REDACTED Wed Jul 24 03:38:06 2002 From: shrogers@REDACTED (Steven H. Rogers, Ph.D.) Date: Tue, 23 Jul 2002 20:38:06 -0500 Subject: Erlang killer app?, References: <20020721184006.D72689@spearce.org> <20020722232140.C100935@spearce.org> Message-ID: <3D3E04FE.8010302@ionet.net> Shawn Pearce wrote: > > I'm having a hard enough time getting coworkers to learn shell scripting, > let alone a new-to-them language like Erlang. > > Now a slightly off topic question: Has anyone had success at getting > Erlang (or any other isoteric-to-them language/environment) into an > environment like I'm describing? > Well, I've had some success. I introduced Java to my C shop when it was still considered esoteric. I silenced a complaint about using a non-standard language by countering that if I'd really wanted to be non standard, I'd be using Objective-C. Java still isn't widely used in my group, though it now is in the rest of the company. I proposed Python as the scripting language for a piece of test equipment and it was accepted over Perl, Tcl, and a home grown version of Tiny C. I intended it to be used by mostly "non-programmer" engineers to write test scripts, but the systems programmers liked it enough to use it for much of their work, with C extensions for hardware interfacing. So, in my experience, you can be successful if you present a good case. Now, I have a distributed control application that seems nearly ideal for Erlang, but I don't whether I should try to introduce "Yet Another Programming Language". We're spread pretty thin and no matter how good an "esoteric language" may be for a particular application, there is extra overhead involved with using it. Regards, Steve -- "A language that doesn't affect the way you think about programming is not worth knowing." - Alan Perlis From cyberlync@REDACTED Wed Jul 24 06:07:48 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 23 Jul 2002 21:07:48 -0700 (PDT) Subject: make_script info In-Reply-To: <3D3E04FE.8010302@ionet.net> Message-ID: <20020724040748.26842.qmail@web40203.mail.yahoo.com> Guys, I am am probably missing something here so I hope you guys can point out my stupidity. I am trying to use the systools:make_script function to make a boot file for my app. This is the first time I have done this so I am kinda moving slow. In any case, my application is laid out according to the otp docs, ie. ./ebin appname.app appname.rel ./docs ./include someincludes.hrl ./src somesources.erl My problem is that when I go to use make script I always get the error "File not found: appname.app", this is getting frustrating becuase the appname.app file is right there. The command I use for the make_script function is erl -pa $(EBIN) \ -s systools make_script appname \ -s erlang halt -noshell __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From chris.williams@REDACTED Wed Jul 24 09:16:52 2002 From: chris.williams@REDACTED (Chris Williams) Date: Wed, 24 Jul 2002 09:16:52 +0200 (MET DST) Subject: make_script info In-Reply-To: <20020724040748.26842.qmail@web40203.mail.yahoo.com> Message-ID: If I remember correctly systools:make_script expects the "appname.app" should be in "./src" as default. You could always call the function with 2 arguments systools:make_script(appname,[{path,["/ebin"]}]). and it will find "appname.app" or you could use the script /bin/erlc i.e. erlc -o . -I /ebin appname.rel //Chris On Tue, 23 Jul 2002, Eric Merritt wrote: > Guys, > > I am am probably missing something here so I hope you > guys can point out my stupidity. I am trying to use > the systools:make_script function to make a boot file > for my app. This is the first time I have done this so > I am kinda moving slow. In any case, my application is > laid out according to the otp docs, ie. > > ./ebin > appname.app > appname.rel > ./docs > ./include > someincludes.hrl > ./src > somesources.erl > > My problem is that when I go to use make script I > always get the error "File not found: appname.app", > this is getting frustrating becuase the appname.app > file is right there. The command I use for the > make_script function is > > erl -pa $(EBIN) \ > -s systools make_script appname \ > -s erlang halt -noshell > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > From per@REDACTED Wed Jul 24 10:48:39 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 24 Jul 2002 09:48:39 +0100 Subject: Is HiPE faster than the Beam =?iso-8859-1?q?emulator=3F?= In-Reply-To: <200207232211.AAA16023@harpo.it.uu.se> Message-ID: <200207240748.g6O7mdX16644@raven.levonline.com> Hi Kostis, Can you use unified heap with HiPE nowadays ? /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From fritchie@REDACTED Wed Jul 24 09:50:35 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 24 Jul 2002 02:50:35 -0500 Subject: Erlang killer app?, In-Reply-To: Message of "Tue, 23 Jul 2002 20:38:06 CDT." <3D3E04FE.8010302@ionet.net> Message-ID: <200207240750.g6O7oZa74046@snookles.snookles.com> >>>>> "sp" = Shawn Pearce (?) wrote: >> Now a slightly off topic question: Has anyone had success at >> getting Erlang (or any other isoteric-to-them language/environment) >> into an environment like I'm describing? I suppose I could've chimed in sooner about this. If you haven't seen it, I presented a paper about just such an experience at the 6th Erlang/OTP User Conference. See "Sendmail Meets Erlang: Experiences Using Erlang for Email Applications" at http://www.erlang.se/euc/00/. -Scott From jilani.khaldi@REDACTED Wed Jul 24 11:51:30 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Wed, 24 Jul 2002 11:51:30 +0200 Subject: How to run httpd as daemon? Message-ID: As subject. Thanks. Jilani Khaldi http://space.tin.it/scuola/jkhaldi From kostis@REDACTED Wed Jul 24 12:35:49 2002 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 24 Jul 2002 12:35:49 +0200 (MET DST) Subject: HiPE and Unified Heap (was: Re: Is HiPE faster than the Beam emulator) In-Reply-To: Mail from 'Per Bergqvist ' dated: Wed, 24 Jul 2002 09:48:39 +0100 Message-ID: <200207241035.MAA17797@harpo.it.uu.se> > Can you use unified heap with HiPE nowadays ? Since the snapshots of about March 2002 or so, yes. Also in the upcoming R9. Kostis. PS. I think it is now called --enable-shared-heap From matthias@REDACTED Wed Jul 24 14:15:38 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 24 Jul 2002 14:15:38 +0200 Subject: How to run httpd as daemon? In-Reply-To: References: Message-ID: <15678.39530.34732.729887@antilipe.corelatus.se> If you search for "Erlang daemon" on google, the first page that google finds is a step-by-step description of how to run erlang programs as daemons: http://www.bluetail.com/wiki/showOldPage?node=ErlangDaemons&index=1 Alternatively, the 'erl' manpage describes how to use the '-detached' flag to start the system as a daemon: http://www.erlang.org/doc/r8b/erts-5.1.1/doc/html/erl.html The FAQ also gives an example of how to run things from the command line, though the author was too lazy or clueless to include an example using -detached: http://www.erlang.org/faq/x304.html#AEN329 It says that you need to create (and compile!) a program something like: -module(hello). -export([hello_world/0]). hello_world() -> httpd:start_link("my_http_config_file.conf"), receive nothing -> ok end. and then run it using a command line something like: erl -detached -s hello hello_world Matthias From cyberlync@REDACTED Wed Jul 24 15:29:45 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 24 Jul 2002 06:29:45 -0700 (PDT) Subject: make_script info In-Reply-To: Message-ID: <20020724132945.35101.qmail@web40204.mail.yahoo.com> --- Chris Williams wrote: > If I remember correctly systools:make_script expects > the "appname.app" > should be in "./src" as default. You could always > call the function > with 2 arguments Just out or curiosity, if that is the case why does the documentation suggest that it should go into the ebin directory? >systools:make_script(appname,[{path,["/ebin"]}]). > and it will find "appname.app" or you could use the > script > /bin/erlc i.e. erlc -o . -I /ebin > appname.rel Thanks a million Chris, I will give this a shot. __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From francesco@REDACTED Wed Jul 24 16:01:56 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 24 Jul 2002 15:01:56 +0100 Subject: make_script info References: <20020724132945.35101.qmail@web40204.mail.yahoo.com> Message-ID: <3D3EB354.5090402@erlang-consulting.com> > > >Just out or curiosity, if that is the case why does >the documentation suggest that it should go into the >ebin directory? > The app file is supposed to be in the ebin directory, as the search paths in the code server (retrievable through code:get_path()) are used to locate it. Chis must have done a typo, as in his paths example, he has in fact written ebin.. Some projects have in the past put their app files in their src directories, but it creates problems with the sys tools, you have to add the src directories in your search paths, and are all in all limited in your actions... If you want to tread in gray areas, there are much more fun things you can do. Cheers, Francesco -- http://www.erlang-consulting.com From francesco@REDACTED Wed Jul 24 16:11:42 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 24 Jul 2002 15:11:42 +0100 Subject: Erlang killer app?, References: <20020721184006.D72689@spearce.org> <20020722232140.C100935@spearce.org> <3D3E04FE.8010302@ionet.net> Message-ID: <3D3EB59E.6070904@erlang-consulting.com> A strategy I have seen work very well when introducing Erlang in new environments is to put together a working prototype.. And often, this can be achieved in little time providing something which usually impresses. When others (including management and pointy haired bosses) see the results versus what others have achieved using hyped stuff (Or if nothing of it works, truckloads of documents :-), they have opted for Erlang. >> Now a slightly off topic question: Has anyone had success at getting >> Erlang (or any other isoteric-to-them language/environment) into an >> environment like I'm describing? > Teaching it to people who question why they should be learning something new? All the time... (As recently as three weeks ago..) But through experience, if people have enough of a computer science background, they very quickly realize the potential. Students who have maybe taken an occasional programming course in college and have maybe only come in contact with one or two languages and are the ones who are hard to convince, as they feel safe with what they know and fear new stuff.. Regards, Francesco -- http://www.erlang-consulting.com From luke@REDACTED Wed Jul 24 16:42:17 2002 From: luke@REDACTED (Luke Gorrie) Date: 24 Jul 2002 16:42:17 +0200 Subject: mnesia usage optimisation Message-ID: Hi all, I'm trying to optimise some code that uses Mnesia, I'd really appreciate some advice :-) It's for a program that uses Mnesia to store the edges of a directed graph, the basic record being {From, To}. The table gets large, and gets a lot of writes per transaction (e.g. a 50,000 element table might be (re)built in one transaction). There are also a lot of edges with the same 'From' value (each value is a small list or tuple). I'm using Mnesia 3.10.2 on R7. The following operations are needed, and they have to be fast: insert an element delete all elements with a particular From field lookup all elements with a particular To field This module runs as part of a transaction, and it would be more convenient to make it run fast in Mnesia than to use some other data structure. In the first approach, I use -record({myrec, {from, to}}) for my schema (names changed to avoid distraction). The table is a ram-only bag, and I have an extra index on 'to'. The implementation is simple enough. Insert is a mnesia:write(), delete by 'from' is a mnesia:delete(), and lookup by 'to' is a mnesia:index_read(). The trouble is that the writes get slow when I have a lot of records with the same 'from' value (the table key). It looks like it takes linear time, and is way too slow (~10ms for a single write with ~5000 other records with the same key). The other operations are fine. So I need to make it faster. Anyone have a good idea? (The story continues..) My next approach was to swap the order of the record fields, so that 'to' is the table key. This is because there tend not to be so many duplicate 'to' values, so I can live with linear time on duplicates (for now at least..) With this approach, insert is a mnesia:write(), lookup by 'to' field is a mnesia:read(), and delete by 'from' _would be_ a mnesia:index_delete() - but that function doesn't exist. So for delete I use: foreach({mnesia,delete_object}, mnesia:index_read(myrec, From, #myrec.from)) .. which is very much too slow for deletions, although the insert does become fast. And that's where I'm up to now. Anyone with a solution will be awarded a beer at EUC :-) Cheers, Luke From cyberlync@REDACTED Wed Jul 24 16:49:28 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 24 Jul 2002 07:49:28 -0700 (PDT) Subject: make_script info In-Reply-To: <3D3EB354.5090402@erlang-consulting.com> Message-ID: <20020724144928.48629.qmail@web40204.mail.yahoo.com> Francesco, > The app file is supposed to be in the ebin > directory, as the search > paths in the code server (retrievable through > code:get_path()) are used > to locate it. > > Chis must have done a typo, as in his paths example, > he has in fact > written ebin.. Some projects have in the past put > their app files in > their src directories, but it creates problems with > the sys tools, you > have to add the src directories in your search > paths, and are all in all > limited in your actions... If you want to tread in > gray areas, there > are much more fun things you can do. > Now I am a bit confused. If the *.app file is supposed to be in the ebin directory then why doesn't systools:make_script("appname") find it when I run it? Even if it is in the ebin should I provide a path (perhaps that is what I am not doing). My original problem was that the make_script function couldn't find the *.app file in ebin (though thats where its at). I kept getting a file not found error which was a bit frustrating. Thanks for your input, Eric __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From Sean.Hinde@REDACTED Wed Jul 24 18:45:33 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 24 Jul 2002 17:45:33 +0100 Subject: make_script info Message-ID: <04D356A3B172D611981B0008C791C3126BF1E2@imp02mbx.t-mobile.co.uk> > Now I am a bit confused. If the *.app file is supposed > to be in the ebin directory then why doesn't > systools:make_script("appname") find it when I run it? > Even if it is in the ebin should I provide a path > (perhaps that is what I am not doing). My original > problem was that the make_script function couldn't > find the *.app file in ebin (though thats where its > at). I kept getting a file not found error which was a > bit frustrating. Yep, .app not found is the irritating symptom of not having the ebin in your path erl -pa "...path" or, in your .erlang file in your home directory put: code:add_pathz("/path/to/ebin"). Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From hal@REDACTED Wed Jul 24 20:25:19 2002 From: hal@REDACTED (Hal Snyder) Date: Wed, 24 Jul 2002 13:25:19 -0500 Subject: Erlang killer app?, In-Reply-To: <3D3EB59E.6070904@erlang-consulting.com> (Francesco Cesarini's message of "Wed, 24 Jul 2002 15:11:42 +0100") References: <20020721184006.D72689@spearce.org> <20020722232140.C100935@spearce.org> <3D3E04FE.8010302@ionet.net> <3D3EB59E.6070904@erlang-consulting.com> Message-ID: <87adohhtkg.fsf@ghidra.vail> Francesco Cesarini writes: > A strategy I have seen work very well when introducing Erlang in new > environments is to put together a working prototype.. And often, > this can be achieved in little time providing something which > usually impresses. When others (including management and pointy > haired bosses) see the results versus what others have achieved > using hyped stuff (Or if nothing of it works, truckloads of > documents :-), they have opted for Erlang. What Francesco said. It happened here. We did one pilot project in Erlang a couple years ago. We were learning Erlang as we went. The pilot went so well that there has been a succession of projects of larger and more ambitious scope. It is a joy working with OTP. From etxuwig@REDACTED Wed Jul 24 23:06:36 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 24 Jul 2002 23:06:36 +0200 (MET DST) Subject: mnesia usage optimisation In-Reply-To: Message-ID: On 24 Jul 2002, Luke Gorrie wrote: >I'm using Mnesia 3.10.2 on R7. > >The following operations are needed, and they have to be fast: > > insert an element > delete all elements with a particular From field > lookup all elements with a particular To field You could perhaps try using two ordered sets: -record(myrec, {key, value}). In one table, key is {From, To}, and in the other, it's {To, From}. You have to have at least a non-key field, and worst case, you'd have to make up a dummy field, e.g. 0. >This module runs as part of a transaction, and it would be more >convenient to make it run fast in Mnesia than to use some other >data structure. A problem with this, of course, is that the data will be duplicated during the transaction. But that's more a general trait of transaction semantics than a specific mnesia problem. You have to have a rollback image if you want transaction properties. You will get two updates each time you insert or delete an element, but they will be fast. Finding all elements with a particular From field: mnesia:match_object( FromTable, #myrec{key = {From, '_'}, _='_'}). Finding all elements with a particular To field: mnesia:match_object( ToTable, #myrec{key = {To, '_'}, _='_'}). Both operations will be equally efficient, and having performed the match on one table, deleting the same objects in the other table is just a matter of reversing the key and deleting each object in O(logN) time. Naturally, you trade some memory for predictable performance, since you duplicate the data. If each object has significant payload, you can store that in only one of the tables, and dummy payload in the other. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From piotr.daruk@REDACTED Thu Jul 25 10:29:19 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 10:29:19 +0200 Subject: Erlang echo server with eLite? Message-ID: <001401c233b5$5ec410c0$a00fe30a@panasonic.com.pl> Halo! Despite the fact I'm working for Panasonic Poland, I'm also a student of Warsaw University of Computer Science Dept. I'm now to write a program using functional language. I have chosen Erlang and decided to write an echo server. Yet, I would like to compile that to executable files either server and client. I'm using Linux Mandreak 8.1 and eLite 2.0 that contains a compiler. The problem is that the error occurs when I'm trying to do "Srv ! {self(), Msg}". I mean it compiles but doesn't work! I have already got know that there is difference when I'm writing for eLite. For example I must do erlang:halt(). insted of halt(). What should I do? Also, dose "Srv ! {self(), Msg}" messaging work as pipe in Linux? Can I communicate to another process from other terminal on the same machine? I'm waiting for any help! Thanx!!!!! Best regards. Piotr Daruk -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik.linder@REDACTED Thu Jul 25 11:53:22 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Thu, 25 Jul 2002 11:53:22 +0200 Subject: Erlang echo server with eLite? In-Reply-To: <001401c233b5$5ec410c0$a00fe30a@panasonic.com.pl> Message-ID: Hi Piotr Perhaps there are others who can help you better than I, but here goes nothing. Using the !-operator one can communicate between erlang processes on differnet erlang nodes, which can be located on different hosts. So, I guess that's a yes to your question. However, in order to do so must all involved erlang nodes have the same cookie (at the time of the message sending) and must also have networking turned on (see doc for erl: http://www.erlang.se/doc/doc-5.1/erts-5.1/doc/html/erl.html, -name or -sname option to erl). What kind of error are you having with "Srv ! {self(), Msg}" ? This statement adds the erlang term "{self(), Msg}" to the mailbox of the Srv process, which can be read by having the Srv process execute a receive-statement (which reads one message from the mailbox). Best Regards /Fredrik -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Piotr Daruk Sent: den 25 juli 2002 10:29 To: erlang-questions@REDACTED Subject: Erlang echo server with eLite? Halo! Despite the fact I'm working for Panasonic Poland, I'm also a student of Warsaw University of Computer Science Dept. I'm now to write a program using functional language. I have chosen Erlang and decided to write an echo server. Yet, I would like to compile that to executable files either server and client. I'm using Linux Mandreak 8.1 and eLite 2.0 that contains a compiler. The problem is that the error occurs when I'm trying to do "Srv ! {self(), Msg}". I mean it compiles but doesn't work! I have already got know that there is difference when I'm writing for eLite. For example I must do erlang:halt(). insted of halt(). What should I do? Also, dose "Srv ! {self(), Msg}" messaging work as pipe in Linux? Can I communicate to another process from other terminal on the same machine? I'm waiting for any help! Thanx!!!!! Best regards. Piotr Daruk -------------- next part -------------- An HTML attachment was scrubbed... URL: From piotr.daruk@REDACTED Thu Jul 25 12:52:36 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 12:52:36 +0200 Subject: Erlang echo server with eLite? References: Message-ID: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> Hi Fredrik! First of all thanx for such quick answer! Please note that I don't want to use erlang environment to run my programmes. I want to compile them and move to another Linux machine. That is why I'm using "aLike 2.0" compiler. Both programmes can be compiled without any problem. Than I start ./echo and ./client. The client can send only Integers. But when the client tries to send a message that is: echosrv ! {ClientPid, N} error occurs: {badarg,[{client,main,1}]}. So I comment this line (%%%) and as it is expected every thing works correctly. It means the client tries to receive message (see attach) which is the next thing it does. That is why I assume that echosrv ! {ClientPid, N} is wrong order. I wrote before about little differences between progs. run on erlang environment and progs. intended to be compiled and run on Linux. Best regards. Piotr Daruk / PPS BS Technical Support Team tel +48 22 338 12 13, fax +48 22 338 11 00 komertel +48 39123173 komertel fax +48 39122215 www.panasonic.com.pl ----- Original Message ----- From: Fredrik Linder To: Piotr Daruk ; erlang-questions@REDACTED Sent: Thursday, July 25, 2002 11:53 AM Subject: RE: Erlang echo server with eLite? Hi Piotr Perhaps there are others who can help you better than I, but here goes nothing. Using the !-operator one can communicate between erlang processes on differnet erlang nodes, which can be located on different hosts. So, I guess that's a yes to your question. However, in order to do so must all involved erlang nodes have the same cookie (at the time of the message sending) and must also have networking turned on (see doc for erl: http://www.erlang.se/doc/doc-5.1/erts-5.1/doc/html/erl.html, -name or -sname option to erl). What kind of error are you having with "Srv ! {self(), Msg}" ? This statement adds the erlang term "{self(), Msg}" to the mailbox of the Srv process, which can be read by having the Srv process execute a receive-statement (which reads one message from the mailbox). Best Regards /Fredrik -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Piotr Daruk Sent: den 25 juli 2002 10:29 To: erlang-questions@REDACTED Subject: Erlang echo server with eLite? Halo! Despite the fact I'm working for Panasonic Poland, I'm also a student of Warsaw University of Computer Science Dept. I'm now to write a program using functional language. I have chosen Erlang and decided to write an echo server. Yet, I would like to compile that to executable files either server and client. I'm using Linux Mandreak 8.1 and eLite 2.0 that contains a compiler. The problem is that the error occurs when I'm trying to do "Srv ! {self(), Msg}". I mean it compiles but doesn't work! I have already got know that there is difference when I'm writing for eLite. For example I must do erlang:halt(). insted of halt(). What should I do? Also, dose "Srv ! {self(), Msg}" messaging work as pipe in Linux? Can I communicate to another process from other terminal on the same machine? I'm waiting for any help! Thanx!!!!! Best regards. Piotr Daruk -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 264 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: echo.erl Type: application/octet-stream Size: 219 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: client.erl Type: application/octet-stream Size: 460 bytes Desc: not available URL: From fredrik.linder@REDACTED Thu Jul 25 14:12:31 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Thu, 25 Jul 2002 14:12:31 +0200 Subject: Erlang echo server with eLite? In-Reply-To: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> Message-ID: Yes, there seems to be an error in eLink and unfortunately I cannot help you with that, sorry. There went nothing. :-) /Fredrik -----Original Message----- From: Piotr Daruk [mailto:piotr.daruk@REDACTED] Sent: den 25 juli 2002 12:53 To: Fredrik Linder; erlang-questions@REDACTED Subject: Re: Erlang echo server with eLite? Hi Fredrik! First of all thanx for such quick answer! Please note that I don't want to use erlang environment to run my programmes. I want to compile them and move to another Linux machine. That is why I'm using "aLike 2.0" compiler. Both programmes can be compiled without any problem. Than I start ./echo and ./client. The client can send only Integers. But when the client tries to send a message that is: echosrv ! {ClientPid, N} error occurs: {badarg,[{client,main,1}]}. So I comment this line (%%%) and as it is expected every thing works correctly. It means the client tries to receive message (see attach) which is the next thing it does. That is why I assume that echosrv ! {ClientPid, N} is wrong order. I wrote before about little differences between progs. run on erlang environment and progs. intended to be compiled and run on Linux. Best regards. Piotr Daruk / PPS BS Technical Support Team tel +48 22 338 12 13, fax +48 22 338 11 00 komertel +48 39123173 komertel fax +48 39122215 www.panasonic.com.pl ----- Original Message ----- From: Fredrik Linder To: Piotr Daruk ; erlang-questions@REDACTED Sent: Thursday, July 25, 2002 11:53 AM Subject: RE: Erlang echo server with eLite? Hi Piotr Perhaps there are others who can help you better than I, but here goes nothing. Using the !-operator one can communicate between erlang processes on differnet erlang nodes, which can be located on different hosts. So, I guess that's a yes to your question. However, in order to do so must all involved erlang nodes have the same cookie (at the time of the message sending) and must also have networking turned on (see doc for erl: http://www.erlang.se/doc/doc-5.1/erts-5.1/doc/html/erl.html, -name or -sname option to erl). What kind of error are you having with "Srv ! {self(), Msg}" ? This statement adds the erlang term "{self(), Msg}" to the mailbox of the Srv process, which can be read by having the Srv process execute a receive-statement (which reads one message from the mailbox). Best Regards /Fredrik -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Piotr Daruk Sent: den 25 juli 2002 10:29 To: erlang-questions@REDACTED Subject: Erlang echo server with eLite? Halo! Despite the fact I'm working for Panasonic Poland, I'm also a student of Warsaw University of Computer Science Dept. I'm now to write a program using functional language. I have chosen Erlang and decided to write an echo server. Yet, I would like to compile that to executable files either server and client. I'm using Linux Mandreak 8.1 and eLite 2.0 that contains a compiler. The problem is that the error occurs when I'm trying to do "Srv ! {self(), Msg}". I mean it compiles but doesn't work! I have already got know that there is difference when I'm writing for eLite. For example I must do erlang:halt(). insted of halt(). What should I do? Also, dose "Srv ! {self(), Msg}" messaging work as pipe in Linux? Can I communicate to another process from other terminal on the same machine? I'm waiting for any help! Thanx!!!!! Best regards. Piotr Daruk -------------- next part -------------- An HTML attachment was scrubbed... URL: From olgeni@REDACTED Thu Jul 25 14:13:12 2002 From: olgeni@REDACTED (Jimmy Olgeni) Date: Thu, 25 Jul 2002 14:13:12 +0200 (CEST) Subject: R8B-2 snapshot Message-ID: <20020725141139.T5474-100000@dev1.localdomain.net> Hi! I was wondering where I can find a snapshot of R8B-2, to check if everything's ok with the FreeBSD port... clues are welcome :o) -- jimmy From piotr.daruk@REDACTED Thu Jul 25 14:05:59 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 14:05:59 +0200 Subject: Erlang echo server with eLite? References: Message-ID: <006101c233d3$a3b10a80$a00fe30a@panasonic.com.pl> Thanx, any way!!! Piotr ;-) ----- Original Message ----- From: Fredrik Linder To: Piotr Daruk ; erlang-questions@REDACTED Sent: Thursday, July 25, 2002 2:12 PM Subject: RE: Erlang echo server with eLite? Yes, there seems to be an error in eLink and unfortunately I cannot help you with that, sorry. There went nothing. :-) /Fredrik -----Original Message----- From: Piotr Daruk [mailto:piotr.daruk@REDACTED] Sent: den 25 juli 2002 12:53 To: Fredrik Linder; erlang-questions@REDACTED Subject: Re: Erlang echo server with eLite? Hi Fredrik! First of all thanx for such quick answer! Please note that I don't want to use erlang environment to run my programmes. I want to compile them and move to another Linux machine. That is why I'm using "aLike 2.0" compiler. Both programmes can be compiled without any problem. Than I start ./echo and ./client. The client can send only Integers. But when the client tries to send a message that is: echosrv ! {ClientPid, N} error occurs: {badarg,[{client,main,1}]}. So I comment this line (%%%) and as it is expected every thing works correctly. It means the client tries to receive message (see attach) which is the next thing it does. That is why I assume that echosrv ! {ClientPid, N} is wrong order. I wrote before about little differences between progs. run on erlang environment and progs. intended to be compiled and run on Linux. Best regards. Piotr Daruk / PPS BS Technical Support Team tel +48 22 338 12 13, fax +48 22 338 11 00 komertel +48 39123173 komertel fax +48 39122215 www.panasonic.com.pl ----- Original Message ----- From: Fredrik Linder To: Piotr Daruk ; erlang-questions@REDACTED Sent: Thursday, July 25, 2002 11:53 AM Subject: RE: Erlang echo server with eLite? Hi Piotr Perhaps there are others who can help you better than I, but here goes nothing. Using the !-operator one can communicate between erlang processes on differnet erlang nodes, which can be located on different hosts. So, I guess that's a yes to your question. However, in order to do so must all involved erlang nodes have the same cookie (at the time of the message sending) and must also have networking turned on (see doc for erl: http://www.erlang.se/doc/doc-5.1/erts-5.1/doc/html/erl.html, -name or -sname option to erl). What kind of error are you having with "Srv ! {self(), Msg}" ? This statement adds the erlang term "{self(), Msg}" to the mailbox of the Srv process, which can be read by having the Srv process execute a receive-statement (which reads one message from the mailbox). Best Regards /Fredrik -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Piotr Daruk Sent: den 25 juli 2002 10:29 To: erlang-questions@REDACTED Subject: Erlang echo server with eLite? Halo! Despite the fact I'm working for Panasonic Poland, I'm also a student of Warsaw University of Computer Science Dept. I'm now to write a program using functional language. I have chosen Erlang and decided to write an echo server. Yet, I would like to compile that to executable files either server and client. I'm using Linux Mandreak 8.1 and eLite 2.0 that contains a compiler. The problem is that the error occurs when I'm trying to do "Srv ! {self(), Msg}". I mean it compiles but doesn't work! I have already got know that there is difference when I'm writing for eLite. For example I must do erlang:halt(). insted of halt(). What should I do? Also, dose "Srv ! {self(), Msg}" messaging work as pipe in Linux? Can I communicate to another process from other terminal on the same machine? I'm waiting for any help! Thanx!!!!! Best regards. Piotr Daruk -------------- next part -------------- An HTML attachment was scrubbed... URL: From Niclas.Eklund@REDACTED Thu Jul 25 14:17:42 2002 From: Niclas.Eklund@REDACTED (Niclas Eklund) Date: Thu, 25 Jul 2002 14:17:42 +0200 (MEST) Subject: R8B-2 snapshot In-Reply-To: <20020725141139.T5474-100000@dev1.localdomain.net> Message-ID: See: http://www.erlang.org/ml-archive/erlang-questions/200207/msg00178.html /Nick > > Hi! > > I was wondering where I can find a snapshot of R8B-2, to check if > everything's ok with the FreeBSD port... clues are welcome :o) > > -- > jimmy > From luke@REDACTED Thu Jul 25 14:26:00 2002 From: luke@REDACTED (Luke Gorrie) Date: 25 Jul 2002 14:26:00 +0200 Subject: Erlang echo server with eLite? In-Reply-To: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> Message-ID: "Piotr Daruk" writes: > Hi Fredrik! > > First of all thanx for such quick answer! Please note that I don't > want to use erlang environment to run my programmes. I want to compile > them and move to another Linux machine. That is why I'm using "aLike > 2.0" compiler. Both programmes can be compiled without any > problem. Than I start ./echo and ./client. I'm assuming the client and server run as separate programs (separate unix processes). > The client can send only Integers. But when the client tries to send > a message that is: echosrv ! {ClientPid, N} error occurs: > {badarg,[{client,main,1}]}. The expression "echosrv ! {ClientPid, N}" will try to send a message to the registered process 'echosrv' in the current node (i.e. unix process). If your echosrv is actually registered in another process, then it will crash (with 'badarg') because the current node has no echosrv process. To send the message to a remote node, you should do: "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" Which will use distribution (over a TCP socket) to send the message to the other process. I don't know if distribution is easy to use with eLite - Joe? P.S., the latest version of eLite (aka Stand Alone Erlang) at http://www.sics.se/~joe/sae.html is 3.1. Cheers, Luke From piotr.daruk@REDACTED Thu Jul 25 14:36:00 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 14:36:00 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> Message-ID: <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> Thanx!! Sorry for not being specific!!! Yet, you have assumed correctly! Now I understand the Erlang messaging mechanism. I will try that as soon as possible. Best regards. Piotr ----- Original Message ----- From: "Luke Gorrie" To: "Piotr Daruk" Cc: "Fredrik Linder" ; Sent: Thursday, July 25, 2002 2:26 PM Subject: Re: Erlang echo server with eLite? > "Piotr Daruk" writes: > > > Hi Fredrik! > > > > First of all thanx for such quick answer! Please note that I don't > > want to use erlang environment to run my programmes. I want to compile > > them and move to another Linux machine. That is why I'm using "aLike > > 2.0" compiler. Both programmes can be compiled without any > > problem. Than I start ./echo and ./client. > > I'm assuming the client and server run as separate programs (separate > unix processes). > > > The client can send only Integers. But when the client tries to send > > a message that is: echosrv ! {ClientPid, N} error occurs: > > {badarg,[{client,main,1}]}. > > The expression "echosrv ! {ClientPid, N}" will try to send a message > to the registered process 'echosrv' in the current node (i.e. unix > process). If your echosrv is actually registered in another process, > then it will crash (with 'badarg') because the current node has no > echosrv process. > > To send the message to a remote node, you should do: > "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" > > Which will use distribution (over a TCP socket) to send the message > to the other process. > > I don't know if distribution is easy to use with eLite - Joe? > > P.S., the latest version of eLite (aka Stand Alone Erlang) at > http://www.sics.se/~joe/sae.html is 3.1. > > Cheers, > Luke > From piotr.daruk@REDACTED Thu Jul 25 15:13:10 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 15:13:10 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> Message-ID: <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> Sorry! For such questions, but I'm a freshman to use an Erlang. How should I set cookies to make this work? Cheers; Piotr ----- Original Message ----- From: "Francesco Cesarini" To: "Piotr Daruk" Sent: Thursday, July 25, 2002 3:12 PM Subject: Re: Erlang echo server with eLite? > Don't forget to set the cookies else it will not work. > > Francesco > -- > http://www.erlang-consulting.com > > Piotr Daruk wrote: > > >Thanx!! > >Sorry for not being specific!!! Yet, you have assumed correctly! Now I > >understand the Erlang messaging mechanism. I will try that as soon as > >possible. > > > >Best regards. > >Piotr > >----- Original Message ----- > >From: "Luke Gorrie" > >To: "Piotr Daruk" > >Cc: "Fredrik Linder" ; > > > >Sent: Thursday, July 25, 2002 2:26 PM > >Subject: Re: Erlang echo server with eLite? > > > > > >>"Piotr Daruk" writes: > >> > >>>Hi Fredrik! > >>> > >>> First of all thanx for such quick answer! Please note that I don't > >>>want to use erlang environment to run my programmes. I want to compile > >>>them and move to another Linux machine. That is why I'm using "aLike > >>>2.0" compiler. Both programmes can be compiled without any > >>>problem. Than I start ./echo and ./client. > >>> > >>I'm assuming the client and server run as separate programs (separate > >>unix processes). > >> > >>>The client can send only Integers. But when the client tries to send > >>>a message that is: echosrv ! {ClientPid, N} error occurs: > >>>{badarg,[{client,main,1}]}. > >>> > >>The expression "echosrv ! {ClientPid, N}" will try to send a message > >>to the registered process 'echosrv' in the current node (i.e. unix > >>process). If your echosrv is actually registered in another process, > >>then it will crash (with 'badarg') because the current node has no > >>echosrv process. > >> > >>To send the message to a remote node, you should do: > >> "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" > >> > >>Which will use distribution (over a TCP socket) to send the message > >>to the other process. > >> > >>I don't know if distribution is easy to use with eLite - Joe? > >> > >>P.S., the latest version of eLite (aka Stand Alone Erlang) at > >>http://www.sics.se/~joe/sae.html is 3.1. > >> > >>Cheers, > >>Luke > >> > > > > > > From francesco@REDACTED Thu Jul 25 15:57:45 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 25 Jul 2002 14:57:45 +0100 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> Message-ID: <3D4003D9.7050808@erlang-consulting.com> You have an example in the FAQ, http://www.erlang.org/faq/x778.html#AEN844 The Erlang book (Chapter 10) describes it as well. Francesco -- http://www.erlang-consulting.com Piotr Daruk wrote: >Sorry! For such questions, but I'm a freshman to use an Erlang. How should I >set cookies to make this work? > >Cheers; >Piotr > >----- Original Message ----- >From: "Francesco Cesarini" >To: "Piotr Daruk" >Sent: Thursday, July 25, 2002 3:12 PM >Subject: Re: Erlang echo server with eLite? > > >>Don't forget to set the cookies else it will not work. >> >>Francesco >>-- >>http://www.erlang-consulting.com >> >>Piotr Daruk wrote: >> >>>Thanx!! >>>Sorry for not being specific!!! Yet, you have assumed correctly! Now I >>>understand the Erlang messaging mechanism. I will try that as soon as >>>possible. >>> >>>Best regards. >>>Piotr >>>----- Original Message ----- >>>From: "Luke Gorrie" >>>To: "Piotr Daruk" >>>Cc: "Fredrik Linder" ; >>> >>>Sent: Thursday, July 25, 2002 2:26 PM >>>Subject: Re: Erlang echo server with eLite? >>> >>> >>>>"Piotr Daruk" writes: >>>> >>>>>Hi Fredrik! >>>>> >>>>> First of all thanx for such quick answer! Please note that I don't >>>>>want to use erlang environment to run my programmes. I want to compile >>>>>them and move to another Linux machine. That is why I'm using "aLike >>>>>2.0" compiler. Both programmes can be compiled without any >>>>>problem. Than I start ./echo and ./client. >>>>> >>>>I'm assuming the client and server run as separate programs (separate >>>>unix processes). >>>> >>>>>The client can send only Integers. But when the client tries to send >>>>>a message that is: echosrv ! {ClientPid, N} error occurs: >>>>>{badarg,[{client,main,1}]}. >>>>> >>>>The expression "echosrv ! {ClientPid, N}" will try to send a message >>>>to the registered process 'echosrv' in the current node (i.e. unix >>>>process). If your echosrv is actually registered in another process, >>>>then it will crash (with 'badarg') because the current node has no >>>>echosrv process. >>>> >>>>To send the message to a remote node, you should do: >>>> "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" >>>> >>>>Which will use distribution (over a TCP socket) to send the message >>>>to the other process. >>>> >>>>I don't know if distribution is easy to use with eLite - Joe? >>>> >>>>P.S., the latest version of eLite (aka Stand Alone Erlang) at >>>>http://www.sics.se/~joe/sae.html is 3.1. >>>> >>>>Cheers, >>>>Luke >>>> >>> >> > > From lennart.ohman@REDACTED Thu Jul 25 15:56:11 2002 From: lennart.ohman@REDACTED (Administrator Computer Gripen) Date: Thu, 25 Jul 2002 15:56:11 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> Message-ID: <3D40037B.611CB5AC@st.se> Try: >erl -name mynode -setcookie biscuit in your shell when starting the node or erlang:set_cookie(node(),biscuit) if you like to set or change the cookie after start. You can check your cookie with erlang:get_cookie(). Good luck! /Lennart Piotr Daruk wrote: > Sorry! For such questions, but I'm a freshman to use an Erlang. How should I > set cookies to make this work? > > Cheers; > Piotr > From piotr.daruk@REDACTED Thu Jul 25 15:51:50 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 15:51:50 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> <3D4003D9.7050808@erlang-consulting.com> Message-ID: <011001c233e2$6d5e0960$a00fe30a@panasonic.com.pl> Thanx!! I will read it all and try to make the echo srv work! Cheers! Piotr ----- Original Message ----- From: "Francesco Cesarini" To: "Piotr Daruk" Cc: Sent: Thursday, July 25, 2002 3:57 PM Subject: Re: Erlang echo server with eLite? > You have an example in the FAQ, > http://www.erlang.org/faq/x778.html#AEN844 The Erlang book (Chapter 10) > describes it as well. > > Francesco > -- > http://www.erlang-consulting.com > > Piotr Daruk wrote: > > >Sorry! For such questions, but I'm a freshman to use an Erlang. How should I > >set cookies to make this work? > > > >Cheers; > >Piotr > > > >----- Original Message ----- > >From: "Francesco Cesarini" > >To: "Piotr Daruk" > >Sent: Thursday, July 25, 2002 3:12 PM > >Subject: Re: Erlang echo server with eLite? > > > > > >>Don't forget to set the cookies else it will not work. > >> > >>Francesco > >>-- > >>http://www.erlang-consulting.com > >> > >>Piotr Daruk wrote: > >> > >>>Thanx!! > >>>Sorry for not being specific!!! Yet, you have assumed correctly! Now I > >>>understand the Erlang messaging mechanism. I will try that as soon as > >>>possible. > >>> > >>>Best regards. > >>>Piotr > >>>----- Original Message ----- > >>>From: "Luke Gorrie" > >>>To: "Piotr Daruk" > >>>Cc: "Fredrik Linder" ; > >>> > >>>Sent: Thursday, July 25, 2002 2:26 PM > >>>Subject: Re: Erlang echo server with eLite? > >>> > >>> > >>>>"Piotr Daruk" writes: > >>>> > >>>>>Hi Fredrik! > >>>>> > >>>>> First of all thanx for such quick answer! Please note that I don't > >>>>>want to use erlang environment to run my programmes. I want to compile > >>>>>them and move to another Linux machine. That is why I'm using "aLike > >>>>>2.0" compiler. Both programmes can be compiled without any > >>>>>problem. Than I start ./echo and ./client. > >>>>> > >>>>I'm assuming the client and server run as separate programs (separate > >>>>unix processes). > >>>> > >>>>>The client can send only Integers. But when the client tries to send > >>>>>a message that is: echosrv ! {ClientPid, N} error occurs: > >>>>>{badarg,[{client,main,1}]}. > >>>>> > >>>>The expression "echosrv ! {ClientPid, N}" will try to send a message > >>>>to the registered process 'echosrv' in the current node (i.e. unix > >>>>process). If your echosrv is actually registered in another process, > >>>>then it will crash (with 'badarg') because the current node has no > >>>>echosrv process. > >>>> > >>>>To send the message to a remote node, you should do: > >>>> "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" > >>>> > >>>>Which will use distribution (over a TCP socket) to send the message > >>>>to the other process. > >>>> > >>>>I don't know if distribution is easy to use with eLite - Joe? > >>>> > >>>>P.S., the latest version of eLite (aka Stand Alone Erlang) at > >>>>http://www.sics.se/~joe/sae.html is 3.1. > >>>> > >>>>Cheers, > >>>>Luke > >>>> > >>> > >> > > > > > > From piotr.daruk@REDACTED Thu Jul 25 16:02:31 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Thu, 25 Jul 2002 16:02:31 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> <3D4003D9.7050808@erlang-consulting.com> Message-ID: <012401c233e3$eb4a40e0$a00fe30a@panasonic.com.pl> One more thing! I got an Erlang book that has only 9 chapters (see attachment.)!? How can I get the one of this that has at least 10 chapters? Cheers; Piotr ----- Original Message ----- From: "Francesco Cesarini" To: "Piotr Daruk" Cc: Sent: Thursday, July 25, 2002 3:57 PM Subject: Re: Erlang echo server with eLite? > You have an example in the FAQ, > http://www.erlang.org/faq/x778.html#AEN844 The Erlang book (Chapter 10) > describes it as well. > > Francesco > -- > http://www.erlang-consulting.com > > Piotr Daruk wrote: > > >Sorry! For such questions, but I'm a freshman to use an Erlang. How should I > >set cookies to make this work? > > > >Cheers; > >Piotr > > > >----- Original Message ----- > >From: "Francesco Cesarini" > >To: "Piotr Daruk" > >Sent: Thursday, July 25, 2002 3:12 PM > >Subject: Re: Erlang echo server with eLite? > > > > > >>Don't forget to set the cookies else it will not work. > >> > >>Francesco > >>-- > >>http://www.erlang-consulting.com > >> > >>Piotr Daruk wrote: > >> > >>>Thanx!! > >>>Sorry for not being specific!!! Yet, you have assumed correctly! Now I > >>>understand the Erlang messaging mechanism. I will try that as soon as > >>>possible. > >>> > >>>Best regards. > >>>Piotr > >>>----- Original Message ----- > >>>From: "Luke Gorrie" > >>>To: "Piotr Daruk" > >>>Cc: "Fredrik Linder" ; > >>> > >>>Sent: Thursday, July 25, 2002 2:26 PM > >>>Subject: Re: Erlang echo server with eLite? > >>> > >>> > >>>>"Piotr Daruk" writes: > >>>> > >>>>>Hi Fredrik! > >>>>> > >>>>> First of all thanx for such quick answer! Please note that I don't > >>>>>want to use erlang environment to run my programmes. I want to compile > >>>>>them and move to another Linux machine. That is why I'm using "aLike > >>>>>2.0" compiler. Both programmes can be compiled without any > >>>>>problem. Than I start ./echo and ./client. > >>>>> > >>>>I'm assuming the client and server run as separate programs (separate > >>>>unix processes). > >>>> > >>>>>The client can send only Integers. But when the client tries to send > >>>>>a message that is: echosrv ! {ClientPid, N} error occurs: > >>>>>{badarg,[{client,main,1}]}. > >>>>> > >>>>The expression "echosrv ! {ClientPid, N}" will try to send a message > >>>>to the registered process 'echosrv' in the current node (i.e. unix > >>>>process). If your echosrv is actually registered in another process, > >>>>then it will crash (with 'badarg') because the current node has no > >>>>echosrv process. > >>>> > >>>>To send the message to a remote node, you should do: > >>>> "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" > >>>> > >>>>Which will use distribution (over a TCP socket) to send the message > >>>>to the other process. > >>>> > >>>>I don't know if distribution is easy to use with eLite - Joe? > >>>> > >>>>P.S., the latest version of eLite (aka Stand Alone Erlang) at > >>>>http://www.sics.se/~joe/sae.html is 3.1. > >>>> > >>>>Cheers, > >>>>Luke > >>>> > >>> > >> > > > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_book.jpg Type: image/jpeg Size: 19120 bytes Desc: not available URL: From lennart.ohman@REDACTED Thu Jul 25 17:05:07 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Thu, 25 Jul 2002 17:05:07 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> <3D4003D9.7050808@erlang-consulting.com> <012401c233e3$eb4a40e0$a00fe30a@panasonic.com.pl> Message-ID: <3D4013A3.82D630D4@st.se> I guess you downloaded the first free part of "Concurrent Programming in Erlang". The hardcopy book contains 17 chapters. You have to buy it from Prentice Hall. /Lennart Piotr Daruk wrote: > One more thing! > > I got an Erlang book that has only 9 chapters (see attachment.)!? How > can I get the one of this that has at least 10 chapters? > > Cheers; > Piotr > From luke@REDACTED Thu Jul 25 19:59:05 2002 From: luke@REDACTED (Luke Gorrie) Date: 25 Jul 2002 19:59:05 +0200 Subject: mnesia usage optimisation In-Reply-To: References: Message-ID: Ulf Wiger writes: > You could perhaps try using two ordered sets: Nearly works :-) In the start of the transaction, all operations are very fast, even if the table is already big. But as a large transaction proceeds, the 'match' operations get slower. It looks like it goes O(N)ish on the number of table updates. My access pattern is basically a chain of read-write-read-write.. I'm guessing it's less efficient to match on the data structure for pre-committed values? Any other ideas? I'm probably overdoing my Mnesia usage really :-) Cheers, Luke From Sean.Hinde@REDACTED Thu Jul 25 22:16:42 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 25 Jul 2002 21:16:42 +0100 Subject: mnesia usage optimisation Message-ID: <04D356A3B172D611981B0008C791C3126BF1EE@imp02mbx.t-mobile.co.uk> Luke, I think the problem is that indexes are built using a linear search mechanism when you have many items with the same value. You could get around this by creating a new table wherever you wish to store more than 1 destination node against a single source node - store the name of the new table against your source node instead of the actual destinations, and store all the destinations in the new table. You would need to do this for both directions much like Ulf's suggestion. It should be possible within a couple of reads to get whatever data you want.. I'd have a go at making it but I have a 2 hour drive ahead of me and it's already 9-15pm (excuses, I know!) You would run out of mnesia/ets tables eventually.. Sean > -----Original Message----- > From: Luke Gorrie [mailto:luke@REDACTED] > Sent: 25 July 2002 18:59 > To: Ulf Wiger > Cc: erlang-questions@REDACTED > Subject: Re: mnesia usage optimisation > > > Ulf Wiger writes: > > > You could perhaps try using two ordered sets: > > Nearly works :-) > > In the start of the transaction, all operations are very fast, even if > the table is already big. But as a large transaction proceeds, the > 'match' operations get slower. It looks like it goes O(N)ish on the > number of table updates. My access pattern is basically a chain of > read-write-read-write.. > > I'm guessing it's less efficient to match on the data structure for > pre-committed values? > > Any other ideas? > > I'm probably overdoing my Mnesia usage really :-) > > Cheers, > Luke > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Chandrashekhar.Mullaparthi@REDACTED Thu Jul 25 23:36:25 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 25 Jul 2002 22:36:25 +0100 Subject: mnesia usage optimisation Message-ID: <04D356A3B172D611981B0008C791C312404952@imp02mbx.t-mobile.co.uk> But given that Luke's code runs as part of a transaction, he can't create a table from within a transaction. If you can get away from being in a transaction, you can probably use the mnesia:ets function... Chandru -----Original Message----- From: Sean Hinde [mailto:Sean.Hinde@REDACTED] Sent: 25 July 2002 21:17 To: 'Luke Gorrie' Cc: erlang-questions@REDACTED Subject: RE: mnesia usage optimisation Luke, I think the problem is that indexes are built using a linear search mechanism when you have many items with the same value. You could get around this by creating a new table wherever you wish to store more than 1 destination node against a single source node - store the name of the new table against your source node instead of the actual destinations, and store all the destinations in the new table. NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Fri Jul 26 00:32:21 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 26 Jul 2002 00:32:21 +0200 (MET DST) Subject: mnesia usage optimisation In-Reply-To: Message-ID: Hmmm, you're of course right. This is a general problem when wielding transactions with 50,000 updates in them, given the way mnesia handles the transaction store. (: Looking at mnesia_tm.erl, it sets up the transaction store as a bag table, which of course destroys the good match times in large transactions. I have not attempted to grasp the complexity of it all (hacking mnesia is not something one should do after midnight), but one could perhaps modify mnesia:write_to_store/4 slightly (and lots of other functions, I'm sure) to use multiple transaction stores: one with ordered_set semantics, and one with bag semantics... and see what that does for performance in your case. Since the objects in the transaction store have an object identifier of {Table, Key}, you should get similar good performance on matches in the transaction store as on the original table. /Uffe On 25 Jul 2002, Luke Gorrie wrote: >Ulf Wiger writes: > >> You could perhaps try using two ordered sets: > >Nearly works :-) > >In the start of the transaction, all operations are very fast, even if >the table is already big. But as a large transaction proceeds, the >'match' operations get slower. It looks like it goes O(N)ish on the >number of table updates. My access pattern is basically a chain of >read-write-read-write.. > >I'm guessing it's less efficient to match on the data structure for >pre-committed values? > >Any other ideas? > >I'm probably overdoing my Mnesia usage really :-) > >Cheers, >Luke > > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From luke@REDACTED Fri Jul 26 01:02:36 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Jul 2002 01:02:36 +0200 Subject: mnesia usage optimisation In-Reply-To: References: Message-ID: Ulf Wiger writes: > Hmmm, you're of course right. This is a general problem when > wielding transactions with 50,000 updates in them, given the way > mnesia handles the transaction store. (: For my 5th rewrite of the module this week :-) I switched back to an older design, with one mnesia record per vertex, which contains 'to' and 'from' sets of edges in gb_sets structures. The problem with this was that large sets (containing lists of some thousands of atoms) were slow (>10ms) to read/write to mnesia, and I was doing it each time I added an edge. I don't know where all that time goes, but I'm guessing it's copying between heaps and garbage collecting (unified heap! unified heap!) - though that doesn't seem quite right. To solve that problem, I put a cache in the process dictionary to avoid reading/writing a record on each of the thousands of updates. It now runs, as they say, faster than shit. Maybe I'll think of a cleaner way on the bus, otherwise at least I strongly retain my "bluetail #1 process dictionary abuser" status :-) (And just in the nick of time, before you tempt me to hack Mnesia.. I've tried that before with disastrous results :-) Cheers, Luke From fritchie@REDACTED Fri Jul 26 07:27:37 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 26 Jul 2002 00:27:37 -0500 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: Message of "Tue, 23 Jul 2002 08:40:23 BST." <200207230640.g6N6eNj16123@hyena.levonline.com> Message-ID: <200207260527.g6Q5Rba82793@snookles.snookles.com> >>>>> "pb" == Per Bergqvist writes: pb> Send it as a bignum. Haven't really checked if this is supported pb> via driver_output_term. (If not it should be fixed...) If I'm reading the source correctly, a driver can't send an unsigned 32-bit value back to Erlang. It cannot send an arbitrary bignum, either. Is the former (or both) possible to include in R9 at this late date? For what it's worth, it doesn't appear possible to have the driver create a reference and send that back to Erlang, either. -Scott From piotr.daruk@REDACTED Fri Jul 26 08:28:02 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 08:28:02 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> <3D4003D9.7050808@erlang-consulting.com> <012401c233e3$eb4a40e0$a00fe30a@panasonic.com.pl> <3D4013A3.82D630D4@st.se> Message-ID: <000b01c2346d$985b6000$a00fe30a@panasonic.com.pl> Yeah! You right! I will try to buy the hardcopy now! Chears, Piotr ----- Original Message ----- From: "Lennart ?hman" To: "Piotr Daruk" Cc: Sent: Thursday, July 25, 2002 5:05 PM Subject: Re: Erlang echo server with eLite? > I guess you downloaded the first free part of "Concurrent Programming > in Erlang". The hardcopy book contains 17 chapters. You have to buy it > from Prentice Hall. > > /Lennart > > Piotr Daruk wrote: > > > One more thing! > > > > I got an Erlang book that has only 9 chapters (see attachment.)!? How > > can I get the one of this that has at least 10 chapters? > > > > Cheers; > > Piotr > > > From piotr.daruk@REDACTED Fri Jul 26 09:13:03 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 09:13:03 +0200 Subject: Erlang echo server with eLite? References: <000a01c233c9$6344ede0$a00fe30a@panasonic.com.pl> <008e01c233d7$d52d5ba0$a00fe30a@panasonic.com.pl> <3D3FF953.7010801@erlang-consulting.com> <00d301c233dd$05fc3940$a00fe30a@panasonic.com.pl> <3D4003D9.7050808@erlang-consulting.com> Message-ID: <00a501c23473$e228c000$a00fe30a@panasonic.com.pl> -Halo! I have tried setting cookies erlang:set_cookie(echo_node, nocookie) for echo server and erlang:set_cookie(client_node, nocookie) for client. After that I was able to send messages to registered server {echosrv, echo_node@REDACTED} ! {self(), Msg}. It has worked but only under erlang environment. Yet, when I have compiled my programmes with eLite 2.0 and started ./echo and ./client I could see an error msg: {undef, [{auth, set_cookie, 2}]} what is wrong? What should I do to make it work as I want, not on erlang environment, but just on Linux console? Cheers, Piotr ---- Original Message ----- From: "Francesco Cesarini" To: "Piotr Daruk" Cc: Sent: Thursday, July 25, 2002 3:57 PM Subject: Re: Erlang echo server with eLite? > You have an example in the FAQ, > http://www.erlang.org/faq/x778.html#AEN844 The Erlang book (Chapter 10) > describes it as well. > > Francesco > -- > http://www.erlang-consulting.com > > Piotr Daruk wrote: > > >Sorry! For such questions, but I'm a freshman to use an Erlang. How should I > >set cookies to make this work? > > > >Cheers; > >Piotr > > > >----- Original Message ----- > >From: "Francesco Cesarini" > >To: "Piotr Daruk" > >Sent: Thursday, July 25, 2002 3:12 PM > >Subject: Re: Erlang echo server with eLite? > > > > > >>Don't forget to set the cookies else it will not work. > >> > >>Francesco > >>-- > >>http://www.erlang-consulting.com > >> > >>Piotr Daruk wrote: > >> > >>>Thanx!! > >>>Sorry for not being specific!!! Yet, you have assumed correctly! Now I > >>>understand the Erlang messaging mechanism. I will try that as soon as > >>>possible. > >>> > >>>Best regards. > >>>Piotr > >>>----- Original Message ----- > >>>From: "Luke Gorrie" > >>>To: "Piotr Daruk" > >>>Cc: "Fredrik Linder" ; > >>> > >>>Sent: Thursday, July 25, 2002 2:26 PM > >>>Subject: Re: Erlang echo server with eLite? > >>> > >>> > >>>>"Piotr Daruk" writes: > >>>> > >>>>>Hi Fredrik! > >>>>> > >>>>> First of all thanx for such quick answer! Please note that I don't > >>>>>want to use erlang environment to run my programmes. I want to compile > >>>>>them and move to another Linux machine. That is why I'm using "aLike > >>>>>2.0" compiler. Both programmes can be compiled without any > >>>>>problem. Than I start ./echo and ./client. > >>>>> > >>>>I'm assuming the client and server run as separate programs (separate > >>>>unix processes). > >>>> > >>>>>The client can send only Integers. But when the client tries to send > >>>>>a message that is: echosrv ! {ClientPid, N} error occurs: > >>>>>{badarg,[{client,main,1}]}. > >>>>> > >>>>The expression "echosrv ! {ClientPid, N}" will try to send a message > >>>>to the registered process 'echosrv' in the current node (i.e. unix > >>>>process). If your echosrv is actually registered in another process, > >>>>then it will crash (with 'badarg') because the current node has no > >>>>echosrv process. > >>>> > >>>>To send the message to a remote node, you should do: > >>>> "{echosrv, othernodename@REDACTED} ! {ClientPid, N}" > >>>> > >>>>Which will use distribution (over a TCP socket) to send the message > >>>>to the other process. > >>>> > >>>>I don't know if distribution is easy to use with eLite - Joe? > >>>> > >>>>P.S., the latest version of eLite (aka Stand Alone Erlang) at > >>>>http://www.sics.se/~joe/sae.html is 3.1. > >>>> > >>>>Cheers, > >>>>Luke > >>>> > >>> > >> > > > > > > From lennart.ohman@REDACTED Fri Jul 26 10:16:27 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Fri, 26 Jul 2002 10:16:27 +0200 Subject: Erlang echo server with eLite Message-ID: <3D41055B.651B268F@st.se> Reposting this to the list since it got lost somewhere... Hi again! without knowing anything about stand alone Erlang, the error msg you got, undef, means that the function set_cookie in the module auth taking 2 arguments does not exist. Either there is no such function in the auth module or the auth module is not loaded. /Lennart Piotr Daruk wrote: > > -Halo! > > I have tried setting cookies erlang:set_cookie(echo_node, nocookie) for > echo server and erlang:set_cookie(client_node, nocookie) for client. After > that I was able to send messages to registered server {echosrv, > echo_node@REDACTED} ! {self(), Msg}. It has worked but only under erlang > environment. Yet, when I have compiled my programmes with eLite 2.0 and > started ./echo and ./client I could see an error msg: > {undef, [{auth, set_cookie, 2}]} what is wrong? What should I do to make it > work as I want, not on erlang environment, but just on Linux console? > > Cheers, > Piotr ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From per@REDACTED Fri Jul 26 12:07:52 2002 From: per@REDACTED (Per Bergqvist) Date: Fri, 26 Jul 2002 11:07:52 +0100 Subject: =?iso-8859-1?q?driver=5Foutput=5Fterm()?= and unsigned long (32 bit) values In-Reply-To: <200207260527.g6Q5Rba82793@snookles.snookles.com> Message-ID: <200207260907.g6Q97qV15702@vargen.levonline.com> > If I'm reading the source correctly, a driver can't send an unsigned > 32-bit value back to Erlang. It cannot send an arbitrary bignum, > either. Is the former (or both) possible to include in R9 at this > late date? Correct, there is no interface to create an arbitrary bignum but for an arbitrary ulong the ei_encode_ulong function does the work for you. It will encode a small big if the ulong is larger than ERL_MAX. What kind of interface would you like to see for encoding arbitrary bignums ? (string -> bignum) ? > > For what it's worth, it doesn't appear possible to have the driver > create a reference and send that back to Erlang, either. > IMHO, I think it is a bad idea to allow a driver to create a reference since references should be unique and it will be hard to guarantee uniqueness if there are several allocators ... /Per From sureshsaragadam@REDACTED Fri Jul 26 11:25:58 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Fri, 26 Jul 2002 10:25:58 +0100 (BST) Subject: How to comm Between to erlang Modules . Message-ID: <20020726092558.54180.qmail@web8105.in.yahoo.com> Hai , I am recently started working with erlang, How do i communicate between two erlang modules, please let me know if possible with example prg, thanking u. suresh ________________________________________________________________________ Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com From piotr.daruk@REDACTED Fri Jul 26 11:12:41 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 11:12:41 +0200 Subject: Erlang echo server with eLite? Message-ID: <003101c23484$998edf80$a00fe30a@panasonic.com.pl> I have attached my new code. Yes! I also thought, that there is no set_cookie function. Yet, look at erlang.erl that is linked during compilation to echo prog. and client prog. there is a definition of this function. Please note that echo server and client works correctly when I'm running it on Erlang enviroment. On one Linux console I start: erl -sname echo_node then I start echo (echo_node@REDACTED) 1>echo:main([]). {server_awaits} true (echo_node@REDACTED) 2> On another linux console I start: erl -sname client_node then I run client and I got: (client_node@REDACTED) 1>client:main(["6","6"]). 6 [linux]$ So it works?! But after compilation when I am trying to run ./echo and ./client on the shell I got the error {undef, [{auth,set_cookie,2}]}. I was thinking and I got know that maybe erl runs some processes (like inet_kernel or something) and if I want to run my programmes on a shell, maybe I should start such process by my self on each program? What do you think? Cheers, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 285 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: echo.erl Type: application/octet-stream Size: 332 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang.beam Type: application/octet-stream Size: 5946 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang.erl Type: application/octet-stream Size: 5942 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: client.erl Type: application/octet-stream Size: 531 bytes Desc: not available URL: From lennart.ohman@REDACTED Fri Jul 26 11:44:47 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Fri, 26 Jul 2002 11:44:47 +0200 Subject: How to comm Between to erlang Modules . References: <20020726092558.54180.qmail@web8105.in.yahoo.com> Message-ID: <3D411A0F.FF6CA14@st.se> Hi Suresh, forgive me for marking words :-) In Erlang modules are independent fragments of code, processes are "living" entities able to communicate with each other (running modules telling them to do so). My best advice is that you download the first free chapters of "Concurrent Programming in Erlang". Chapter 5 deals with process communication. The book contains plenty of program examples. http://www.erlang.org/doc.html Good luck, Lennart Suresh S wrote: > > Hai , > > I am recently started working with erlang, > How do i communicate between two erlang modules, > please let me know if possible with example prg, > > thanking u. > > suresh > > ________________________________________________________________________ > Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! > visit http://in.autos.yahoo.com -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From ingela@REDACTED Fri Jul 26 12:38:21 2002 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 26 Jul 2002 12:38:21 +0200 (MEST) Subject: How to comm Between to erlang Modules . References: <20020726092558.54180.qmail@web8105.in.yahoo.com> Message-ID: <200207261038.MAA20805@gildor.du.uab.ericsson.se> Well probably this is just a unhappy choice of word from your side (as Lennart pointed out), but this seems to be a common misconception. So I would like to press on the fact that you do not communicate between two Erlang modules, however you may communicate between two Erlang processes. I think the distinction between the two is very significant. It is true that a single module may contain all the code that a process runs but this is not always the case, and even when this is the case there is a big difference. You may start many process instances that are implemented by the same module. Lets say the process code is defined by the module test and has a state variable that tells you how many messages the process has received. Consider the following: 1> ProcessA = test:start(). 2> ProcessB = test:start(). 3> ProcessA ! {self(), hello}. 4> ProcessB ! {self(), hello}. 5> ProcessB ! {self(), hello_again}. Now ProcessA says that the state variable has the value 1 but ProcessB say it has the value 2. This is as it should be. Now if a process and a module where the same thing this would have been very odd, but fortunatly they are not. Hope I made my point. Good luck with your programming :) sureshsaragadam@REDACTED wrote: > Hai , > > I am recently started working with erlang, > How do i communicate between two erlang modules, > please let me know if possible with example prg, > > thanking u. > > suresh > > > > ________________________________________________________________________ > Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! > visit http://in.autos.yahoo.com -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team From piotr.daruk@REDACTED Fri Jul 26 13:51:00 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 13:51:00 +0200 Subject: Erlang echo server with eLite? Message-ID: <004f01c2349a$b61da800$a00fe30a@panasonic.com.pl> > What about auth module? Don't you think it should be linked as well? >set_cookie/2 at erlang module references auth:set_cookie/2... But I don't have one!? I tried to find auth module, if there is one, and I didn't find it? What to do?! Cheers, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: From piotr.daruk@REDACTED Fri Jul 26 14:16:21 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 14:16:21 +0200 Subject: Erlang echo server with eLite? Message-ID: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> Hello! I have succeeded to find auth module so I have linked it to the compilation. Obviously it helps, thanx Laura!! Yet, I got new error: {distribution_not_started,{auth,set_cookie,2}]} Dose anybody now what is this? What should I start? Cheers, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke@REDACTED Fri Jul 26 14:33:55 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Jul 2002 14:33:55 +0200 Subject: Erlang echo server with eLite? In-Reply-To: <003101c23484$998edf80$a00fe30a@panasonic.com.pl> References: <003101c23484$998edf80$a00fe30a@panasonic.com.pl> Message-ID: "Piotr Daruk" writes: > So it works?! But after compilation when I am trying to run ./echo and > ./client on the shell I got the error {undef, [{auth,set_cookie,2}]}. I was > thinking and I got know that maybe erl runs some processes (like inet_kernel > or something) and if I want to run my programmes on a shell, maybe I should > start such process by my self on each program? > > What do you think? I think that only Joe Armstrong knows the one true answer, but since he seems to be away I'll have another crack :-) The thing is that "distributed erlang" is partly implemented in erlang, and Stand Alone Erlang chops out most of the standard erlang modules (to make things small). So it looks like distribution isn't "linked in" to your stand alone program. However, the latest SAE at http://www.sics.se/~joe/sae.html puts back various bits of the standard libraries with its ".lib" files, so you can probably get distribution (via 'kernel.lib' I'm guessing). If you upgrade to version 3.1, it may "just work" because it can load the necessary libraries on-demand from a .lib file. That's my best guess! Cheers, Luke From luke@REDACTED Fri Jul 26 15:44:20 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Jul 2002 15:44:20 +0200 Subject: Erlang echo server with eLite? In-Reply-To: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> References: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> Message-ID: "Piotr Daruk" writes: > Hello! > > I have succeeded to find auth module so I have linked it to the compilation. Obviously it helps, thanx Laura!! > Yet, I got new error: > {distribution_not_started,{auth,set_cookie,2}]} I think you will need a lot more than just the 'auth' module to do distribution, so again upgrading SAE to have the .lib files is probably a good idea. Since SAE doesn't seem to have a command line option for starting distribution, I've attached a module that does it "the direct way", which I snarfed out of some guru-written code. I think this is "not recommended", but it works :-) To start distribution with node name 'foo', you would do: my_dist:start_distribution(foo). Cheers, Luke -------------- next part -------------- A non-text attachment was scrubbed... Name: my_dist.erl Type: application/octet-stream Size: 971 bytes Desc: not available URL: From piotr.daruk@REDACTED Fri Jul 26 15:45:09 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Fri, 26 Jul 2002 15:45:09 +0200 Subject: Erlang echo server with eLite? References: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> Message-ID: <003001c234aa$a8b95c80$a00fe30a@panasonic.com.pl> Thanx, I will try that! Also I will try to include kernel.lib To do so I should write "-include(kernel.lib).", right? Cheers, Piotr ----- Original Message ----- From: "Luke Gorrie" To: "Piotr Daruk" Cc: "Laura Castro" ; Sent: Friday, July 26, 2002 3:44 PM Subject: Re: Erlang echo server with eLite? > "Piotr Daruk" writes: > > > Hello! > > > > I have succeeded to find auth module so I have linked it to the compilation. Obviously it helps, thanx Laura!! > > Yet, I got new error: > > {distribution_not_started,{auth,set_cookie,2}]} > > I think you will need a lot more than just the 'auth' module to do > distribution, so again upgrading SAE to have the .lib files is > probably a good idea. > > Since SAE doesn't seem to have a command line option for starting > distribution, I've attached a module that does it "the direct way", > which I snarfed out of some guru-written code. I think this is "not > recommended", but it works :-) > > To start distribution with node name 'foo', you would do: > > my_dist:start_distribution(foo). > > Cheers, > Luke > > From cyberlync@REDACTED Fri Jul 26 17:18:43 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 26 Jul 2002 08:18:43 -0700 (PDT) Subject: Crypto Module In-Reply-To: <003001c234aa$a8b95c80$a00fe30a@panasonic.com.pl> Message-ID: <20020726151843.50165.qmail@web40202.mail.yahoo.com> Hello All, I have another question. I need an md5 checksum in one of the apps I am doing in erlang. The crypto module contains such functionality, but I get the feeling from previous postings that the crypto module is a bit of a joke. If this is the case, why? and what alternatives are there? Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From luke@REDACTED Fri Jul 26 17:45:47 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Jul 2002 17:45:47 +0200 Subject: Crypto Module In-Reply-To: <20020726151843.50165.qmail@web40202.mail.yahoo.com> References: <20020726151843.50165.qmail@web40202.mail.yahoo.com> Message-ID: Eric Merritt writes: > Hello All, > > I have another question. I need an md5 checksum in > one of the apps I am doing in erlang. The crypto > module contains such functionality, but I get the > feeling from previous postings that the crypto module > is a bit of a joke. If this is the case, why? and what > alternatives are there? MD5 is a built-in function, erlang:md5/1 (plus other functions for incrementally digesting chunks of data). Cheers, Luke From cyberlync@REDACTED Fri Jul 26 17:58:58 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 26 Jul 2002 08:58:58 -0700 (PDT) Subject: Crypto Module In-Reply-To: Message-ID: <20020726155858.56518.qmail@web40202.mail.yahoo.com> Luke, Oops, I guess I should have looked more closly at the docs. Thanks for setting me strait. Thanks, Eric --- Luke Gorrie wrote: > Eric Merritt writes: > > > Hello All, > > > > I have another question. I need an md5 checksum > in > > one of the apps I am doing in erlang. The crypto > > module contains such functionality, but I get the > > feeling from previous postings that the crypto > module > > is a bit of a joke. If this is the case, why? and > what > > alternatives are there? > > MD5 is a built-in function, erlang:md5/1 (plus other > functions for > incrementally digesting chunks of data). > > Cheers, > Luke > __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From spearce@REDACTED Fri Jul 26 17:18:46 2002 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 26 Jul 2002 11:18:46 -0400 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: <200207260907.g6Q97qV15702@vargen.levonline.com> References: <200207260527.g6Q5Rba82793@snookles.snookles.com> <200207260907.g6Q97qV15702@vargen.levonline.com> Message-ID: <20020726111845.A114109@spearce.org> Per Bergqvist scrawled: > > For what it's worth, it doesn't appear possible to have the driver > > create a reference and send that back to Erlang, either. > > > IMHO, I think it is a bad idea to allow a driver to create a reference > since references should be unique and it will be hard to guarantee > uniqueness if there are several allocators ... Why not a function: ErlDrvTerm driver_mkref() which will always use the internal reference allocator? Or is it not possible to use the existing allocator underlying erlang:mkref/0 while a driver is executing? It would be very convient for drivers to be able to use references, esp. as the references could be stored in a small hash table linking to driver specific objects, for example a widget in a GUI library. Of course, driver authors could still try to send illegal reference values by attempting to create their own references without the driver_mkref() function. But today driver authors could also try to make an ErlDrvBinary on their own without driver_alloc_binary(), and the results would be just as bad. I had really considered making a bunch of ErlDrvBinary objects in a mmap region at one point, until I noticed in the Erts source that the ErlDrvBinary is not the entire binary structure - there is data stored before it by the emulator. I would have had pretty ugly results had I tried to use my own binary. Therefore I'm arguing that its acceptable if there are ugly results because a driver author used a value for a reference which did not come from driver_mkref(). -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From per@REDACTED Fri Jul 26 18:52:08 2002 From: per@REDACTED (Per Bergqvist) Date: Fri, 26 Jul 2002 17:52:08 +0100 Subject: =?iso-8859-1?q?driver=5Foutput=5Fterm()?= and unsigned long (32 bit) values In-Reply-To: <20020726111845.A114109@spearce.org> Message-ID: <200207261552.g6QFq8i05860@raven.levonline.com> I rest my case, it would make sense to have a driver_mkref. On the topic of extending the driver interface: Today there is only one timer available for a driver. Driver authors that have need for more timers have to implement timer wheels on their own or multiplex the timer in other ways. This is not always an ideal situation (like in inet_drv where the driver tries to keep track of both read and write timeouts). I would like to expose the timer wheel of the vm to the drivers to avoid re-inventing the wheel (:-). My proposal is to : Add a callback function ext_timeout(ErlDrvData, int) to the driver entry. Add functions: driver_alloc_ext_timers(ErlDrvData, int), driver_free_ext_timers(ErlDrvData), driver_set_ext_timer(ErlDrvData, int, ulong) driver_cancel_ext_timer(ErlDrvData, int, ulong) driver_read_ext_timer(ErlDrvData, int, ulong) Comments ? /Per > Per Bergqvist scrawled: > > > For what it's worth, it doesn't appear possible to have the driver > > > create a reference and send that back to Erlang, either. > > > > > IMHO, I think it is a bad idea to allow a driver to create a reference > > since references should be unique and it will be hard to guarantee > > uniqueness if there are several allocators ... > > Why not a function: > > ErlDrvTerm driver_mkref() > > which will always use the internal reference allocator? Or is it > not possible to use the existing allocator underlying erlang:mkref/0 > while a driver is executing? > > It would be very convient for drivers to be able to use references, > esp. as the references could be stored in a small hash table linking > to driver specific objects, for example a widget in a GUI library. > > Of course, driver authors could still try to send illegal reference > values by attempting to create their own references without the > driver_mkref() function. But today driver authors could also try to > make an ErlDrvBinary on their own without driver_alloc_binary(), and > the results would be just as bad. > > I had really considered making a bunch of ErlDrvBinary objects in a > mmap region at one point, until I noticed in the Erts source that the > ErlDrvBinary is not the entire binary structure - there is data stored > before it by the emulator. I would have had pretty ugly results had > I tried to use my own binary. > > Therefore I'm arguing that its acceptable if there are ugly results > because a driver author used a value for a reference which did not > come from driver_mkref(). > > -- > Shawn. > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From lennart.ohman@REDACTED Fri Jul 26 21:27:11 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Fri, 26 Jul 2002 21:27:11 +0200 Subject: Erlang echo server with eLite? References: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> Message-ID: <3D41A28F.8FBDF4C7@st.se> You seem to ha gotten valuable help from Luke. Otherwise I believe distribution_not_started means that your system is missing the net_kernel process which must run if you are running a distributed system. /Lennart Piotr Daruk wrote: > > Hello! > > I have succeeded to find auth module so I have linked it to the > compilation. Obviously it helps, thanx Laura!! > Yet, I got new error: > {distribution_not_started,{auth,set_cookie,2}]} > > Dose anybody now what is this? What should I start? > > Cheers, > Piotr -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From spearce@REDACTED Fri Jul 26 22:48:46 2002 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 26 Jul 2002 16:48:46 -0400 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: <04D356A3B172D611981B0008C791C3126BF1F3@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF1F3@imp02mbx.t-mobile.co.uk> Message-ID: <20020726164846.B114460@spearce.org> Sean Hinde scrawled: > > Why not a function: > > > > ErlDrvTerm driver_mkref() > > > > which will always use the internal reference allocator? Or is it > > not possible to use the existing allocator underlying erlang:mkref/0 > > while a driver is executing? > > It might be a problem if this was called by a driver thread - depending on > the algorithm it might need some mutex protection. Calling something like > this from one of the main driver callbacks in the main thread shouldn't be a > problem though. It was my understanding from the documentation that none of the functions made available by Erts could be used in a driver async thread or any other type of thread created by the driver. I wouldn't expect this function to be any different. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From spearce@REDACTED Fri Jul 26 22:57:17 2002 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 26 Jul 2002 16:57:17 -0400 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: <200207261552.g6QFq8i05860@raven.levonline.com> References: <20020726111845.A114109@spearce.org> <200207261552.g6QFq8i05860@raven.levonline.com> Message-ID: <20020726165717.C114460@spearce.org> Per Bergqvist scrawled: > I would like to expose the timer wheel of the vm to the drivers > to avoid re-inventing the wheel (:-). This is a good idea. ;-) > My proposal is to : > Add a callback function ext_timeout(ErlDrvData, int) to the driver > entry. > Add functions: > driver_alloc_ext_timers(ErlDrvData, int), > driver_free_ext_timers(ErlDrvData), > driver_set_ext_timer(ErlDrvData, int, ulong) > driver_cancel_ext_timer(ErlDrvData, int, ulong) > driver_read_ext_timer(ErlDrvData, int, ulong) This interface would work well I think. I'm kicking around the idea of having a ErlTimer type (like an ErlDrvBinary) that can be alloc'd and managed through some functions, rather than working with a set of timers at once. I'm not sure of what the impact would be to driver API/code clarity either way, nor what the impact would be to the internal timer code of the VM. One thing I do like about Erlang drivers is they are so easy to write. The API is very short, to the point, and definately does not make it awkward to do driver development. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From fritchie@REDACTED Sat Jul 27 01:10:15 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 26 Jul 2002 18:10:15 -0500 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: Message of "Fri, 26 Jul 2002 11:18:46 EDT." <20020726111845.A114109@spearce.org> Message-ID: <200207262310.g6QNAFa84501@snookles.snookles.com> >>>>> "sp" == Shawn Pearce writes: sp> I had really considered making a bunch of ErlDrvBinary objects in sp> a mmap region at one point, until I noticed in the Erts source sp> that the ErlDrvBinary is not the entire binary structure - there sp> is data stored before it by the emulator. I would have had pretty sp> ugly results had I tried to use my own binary. If it's any help, here are some snippets from my Erlang Driver Tool Kit. I cooked up some quickie replacements for malloc(), realloc(), and free() as well as a function (could be a macro, I suppose) to automagically turn one of those pointers into a pointer to an ErlDrvBinary. -Scott /* ------------- From erl_driver_tk.h */ /* Wrapper functions for driver_{alloc,realloc,free}_binary */ /* ** Use these as as you would use malloc(), realloc(), and free(), ** respectively. */ void *edtk_driver_alloc_wrapper(size_t); void *edtk_driver_realloc_wrapper(void *, size_t); void edtk_driver_free_wrapper(void *); /* Helper func */ ErlDrvBinary *edtk_alloced_ptr2ErlDrvBinary(void *); /* ------------- From erl_driver_tk.c */ void * edtk_driver_alloc_wrapper(size_t size) { ErlDrvBinary *eb; if ((eb = driver_alloc_binary(size)) != NULL) { return eb->orig_bytes; } else { return NULL; } } void * edtk_driver_realloc_wrapper(void *p, size_t size) { ErlDrvBinary *eb, *neweb; if ((eb = edtk_alloced_ptr2ErlDrvBinary(p)) != NULL) { if ((neweb = driver_realloc_binary(eb, size)) != NULL) { return neweb->orig_bytes; } else { return NULL; } } else { return NULL; } } void edtk_driver_free_wrapper(void *p) { ErlDrvBinary *eb; if ((eb = edtk_alloced_ptr2ErlDrvBinary(p)) != NULL) { driver_free_binary(eb); } } /* QQQ Make this a macro, use scratch static ErlDrvBinary? */ ErlDrvBinary * edtk_alloced_ptr2ErlDrvBinary(void *p) { ErlDrvBinary stackeb; int offset = stackeb.orig_bytes - (char *) &stackeb; if (p != NULL) { return (ErlDrvBinary *) ((char *) p - offset); } else { return NULL; } } /* ------------- From example driver code... */ /* ** Callers almost always call with the beginning offset = 0. */ static int reply_ok_binary(descriptor_t *desc, char *ptr, int beg_offset, int length) { ErlDrvTermData msg[15]; /* too big */ int i = 0; int res; /* ** Up until now, the driver has been dealing with 'ptr' ** as if it had received it from malloc() or realloc(). */ i = LOAD_PORT(msg, i, driver_mk_port(desc->port)); i = LOAD_ATOM(msg, i, am_ok); i = LOAD_BINARY(msg, i, edtk_alloced_ptr2ErlDrvBinary(ptr), beg_offset, length); i = LOAD_TUPLE(msg, i, 3); res = driver_output_term(desc->port, msg, i); return res; } From raimo@REDACTED Sat Jul 27 01:25:38 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Sat, 27 Jul 2002 01:25:38 +0200 Subject: driver_output_term() and unsigned long (32 bit) values References: <200207230158.g6N1wna50896@snookles.snookles.com> Message-ID: <3D41DA72.4E9C5CC@erix.ericsson.se> Scott Lystig Fritchie wrote: > > Am I correct in assuming that, if I *really* needed a driver to get > the most-significant bit of a 32 bit unsigned long sent to Erlang via > driver_output_term(), I'm out of luck? > > I suppose I could do something like: > > 1. Modify BEAM to support unsigned integers. > 2. Send the unsigned int back as a binary and then unpack it as an > ":32/unsigned-integer" > 3. Send the unsigned int back as a signed int, then have Erlang pack > it into a binary and then unpack it as a ":32/unsigned-integer". 3b. Send the unsigned int back as a signed int, then if the returned value is negative: add (1 bsl 32), otherwise it is correct. This assumes a 32 bit 2-complement machine. A portability freak would first find the wordsize in some way (for the day a 64-bit Erlang port comes), but I do not think non 2-complement machines even exist nor ever will. / Raimo Niskanen, Erlang/OTP, Ericsson AB > 4. Send back a {1, N} tuple and then have Erlang convert via "(1 bsl > 31) bor N" or equivalent arithmetic. > 5. Not use driver_output_term(). > 6. Um, I think I'd better stop now. This is getting too ugly. > > Is there a better, non-ugly solution I'm missing? > > -Scott From davidg@REDACTED Sat Jul 27 02:48:59 2002 From: davidg@REDACTED (David Gould) Date: Fri, 26 Jul 2002 17:48:59 -0700 Subject: driver_output_term() and unsigned long (32 bit) values In-Reply-To: <3D41DA72.4E9C5CC@erix.ericsson.se>; from raimo@erix.ericsson.se on Sat, Jul 27, 2002 at 01:25:38AM +0200 References: <200207230158.g6N1wna50896@snookles.snookles.com> <3D41DA72.4E9C5CC@erix.ericsson.se> Message-ID: <20020726174859.A27148@lenny.dnai.com> On Sat, Jul 27, 2002 at 01:25:38AM +0200, Raimo Niskanen wrote: > Scott Lystig Fritchie wrote: > > > > Am I correct in assuming that, if I *really* needed a driver to get > > the most-significant bit of a 32 bit unsigned long sent to Erlang via > > driver_output_term(), I'm out of luck? > > > > I suppose I could do something like: > > > > 1. Modify BEAM to support unsigned integers. > > 2. Send the unsigned int back as a binary and then unpack it as an > > ":32/unsigned-integer" > > 3. Send the unsigned int back as a signed int, then have Erlang pack > > it into a binary and then unpack it as a ":32/unsigned-integer". > > 3b. Send the unsigned int back as a signed int, then if the returned > value is negative: add (1 bsl 32), otherwise it is correct. > > This assumes a 32 bit 2-complement machine. A portability freak would > first find the wordsize in some way (for the day a 64-bit Erlang port > comes), but I do not think non 2-complement machines even exist nor ever > will. Univac 1100 series. Ones complement, 36 bit words, either 9 bit ascii or 6 bit "Fieldata" character set depending on whether in "quarterword mode" or "thirdword mode". There may even be some still in use. If you think x86 is ugly and baroque, you have not worked on a Univac! For some more amusement and edification see: http://www.fourmilab.ch/documents/univac/ I had the pleasure of working on an 1108 for a year so, a long time ago, (never mind exactly how long!). -dg -- David Gould davidg@REDACTED If simplicity worked, the world would be overrun with insects. From Sean.Hinde@REDACTED Fri Jul 26 21:39:42 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 26 Jul 2002 20:39:42 +0100 Subject: driver_output_term() and unsigned long (32 bit) values Message-ID: <04D356A3B172D611981B0008C791C3126BF1F3@imp02mbx.t-mobile.co.uk> > > IMHO, I think it is a bad idea to allow a driver to create > a reference > > since references should be unique and it will be hard to > guarantee > > uniqueness if there are several allocators ... > > > Why not a function: > > ErlDrvTerm driver_mkref() > > which will always use the internal reference allocator? Or is it > not possible to use the existing allocator underlying erlang:mkref/0 > while a driver is executing? It might be a problem if this was called by a driver thread - depending on the algorithm it might need some mutex protection. Calling something like this from one of the main driver callbacks in the main thread shouldn't be a problem though. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From jabba@REDACTED Sat Jul 27 14:32:44 2002 From: jabba@REDACTED (Jani Launonen) Date: Sat, 27 Jul 2002 15:32:44 +0300 (EEST) Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? In-Reply-To: <04D356A3B172D611981B0008C791C3126BF1F3@imp02mbx.t-mobile.co.uk> Message-ID: Hello, in his master's thesis ( http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf ), Pekka Hedqvist studied how to implement Erlang emulator suitable for multiprocessors mapping Erlang processes to OS threads. While very interesting idea and worthy implementing (from my point of view, at least), I haven't seen lately anything suggesting that such implementation would take place in near future. Although clusters are quite hot topic nowadays (blades and such), I think SMP-machines hardly are going to be fewer in near future - even for U1 form factor rack machines are provided with dual processors. Multiple core CPUs are going to be the norm, so running two Erlang emulators inside one physical chip seems to be bad idea as they would have to communicate through TCP/IP stack or pipe instead of sharing data (messages) through local (L1/L2 cache) memory without communicating through OS. So if anybody has information, if there are any efforts put towards implementing such multithreaded emulator, please share some information about status. -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of EE Assistant Researcher . . .Apricot Project "Computing is a field which has one of the shortest collective memories of any engineering or scientific discipline." - Marty Fouts, comp.distributed From pekka@REDACTED Sun Jul 28 00:03:02 2002 From: pekka@REDACTED (pekka@REDACTED) Date: Sun, 28 Jul 2002 00:03:02 +0200 Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? In-Reply-To: Message-ID: <000001c235b9$67c809a0$24434bd4@SILLTRUT> The implementation Tony and I did some years back that I wrote my report about was promising, it worked and performed well in some tests and not so well in others. A fresh start would be welcome, I would take some different design descisions in a new implementation that probably would work better and actually make it easier to implement MT Erlang, but still require a fair amount of work. Another aproach that tempted me (and others) lately thought about would be to "cheat". It would not have the potential to be as good as a "full" MT Erlang but probably a better than just running several several plain Erlang nodes on a MP machine. Basically shortcut the distribution mechanism, detect Erlang nodes running on the same physical machine and then bypass the normal socket based distribution by establishing a shared memory communication area between the two Erlang nodes on the same machine. Far easier to implement and you avoid the overhead of socket, TCP and external format conversions. The full process contex switch overhead is still there and one also would need to handle "node" scheduling of Erlang processes for full benefit etc, etc. But thats the same problems as today with distributed Erlang. A real MT Erlang is still desirable and it can be done very nicely and efficient in my oppinion. MP machines is, as mentioned, a comodity nowdays and now when hyperthreading is introduced in the Intel P4Xeon CPUs even more more interesting benefits for an MT Erlang is opened. /pekka >-----Original Message----- >From: owner-erlang-questions@REDACTED >[mailto:owner-erlang-questions@REDACTED] On Behalf Of Jani Launonen >Sent: Saturday, July 27, 2002 2:33 PM >To: erlang-questions@REDACTED >Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? > > >Hello, > >in his master's thesis ( >http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf ), >Pekka Hedqvist studied how to implement Erlang emulator >suitable for multiprocessors mapping Erlang processes to OS >threads. While very interesting idea and worthy implementing >(from my point of view, at least), I haven't seen lately >anything suggesting that such implementation would take place >in near future. Although clusters are quite hot topic nowadays >(blades and such), I think SMP-machines hardly are going to be >fewer in near future - even for U1 form factor rack machines >are provided with dual processors. Multiple core CPUs are >going to be the norm, so running two Erlang emulators inside >one physical chip seems to be bad idea as they would have to >communicate through TCP/IP stack or pipe instead of sharing data >(messages) through local (L1/L2 cache) memory without >communicating through OS. > >So if anybody has information, if there are any efforts put >towards implementing such multithreaded emulator, please share >some information about status. > >-+-+-+- >Jani Launonen >Student. . . . . . . . . .University of Oulu, Dept. of EE >Assistant Researcher . . .Apricot Project > >"Computing is a field which has one of the shortest collective >memories of any engineering or scientific discipline." - Marty >Fouts, comp.distributed > > From cpressey@REDACTED Sun Jul 28 04:06:20 2002 From: cpressey@REDACTED (Chris Pressey) Date: Sat, 27 Jul 2002 21:06:20 -0500 Subject: "permission denied" on world-readable app file? this seems very odd Message-ID: <20020727210620.5e8f6c42.cpressey@catseye.mb.ca> %erl Erlang (BEAM) emulator version 5.1.1 [source] Eshell V5.1.1 (abort with ^G) 1> mnesia:start(). {error,{"permission denied","mnesia.app"}} 2> lists:member("/usr/local/lib/erlang/lib/mnesia-4.0.2/ebin",code:get_path( )). true 3> file:consult("/usr/local/lib/erlang/lib/mnesia-4.0.2/ebin/mnesia.app"). {ok,[{application,mnesia, [{description,"MNESIA CXC 138 12"}, {vsn,"4.0.2"}, {modules,[mnesia, mnesia_backup, mnesia_bup, mnesia_checkpoint, mnesia_checkpoint_sup, ... Have I overlooked something obvious? -Chris From tv@REDACTED Sun Jul 28 19:41:06 2002 From: tv@REDACTED (Thomas Verner) Date: Sun, 28 Jul 2002 19:41:06 +0200 Subject: ODBC or gen_server problems ?! Message-ID: Hi !! After a few years away from Erlang, I am finally back, but I have problems on two things :-( We should use ODBC to obtain customer data from a Database, ODBC compiled well, I guess, got an odbcserver.exe now, BUT it will not start correctly ?! ( Please see errors below ) Secondly long node names fails ( the erlang node fails ), that is no problem for the first installations, but when we conquer the world, it should work. What to do ? We are running Windows (2000) btw. Yes I know, but Customer demands :-) Can anyone help me out? /v -- CUT -- Erlang (BEAM) emulator version 5.1.1 [threads:0] Eshell V5.1.1 (abort with ^G) (test01@REDACTED)1> odbc:start_link([],[]). ** exited: {noproc,{gen_server,call, [odbc_sup, {start_child,[[{client,<0.29.0>}],[]]}, infinity]}} ** (test01@REDACTED)2> -- CUT -- Best Regards / Med venlig Hilsen Thomas Verner BluePosition Lyngbyhus Parallelvej 10 2800 Kgs. Lyngby Phone +45 70 20 65 25 Direct +45 20 48 34 51 http://www.blueposition.com mailto:tv@REDACTED From vlad_dumitrescu@REDACTED Sun Jul 28 21:18:30 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sun, 28 Jul 2002 21:18:30 +0200 Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? Message-ID: Hi, >Another aproach that tempted me (and others) lately thought about would >be to "cheat". It would not have the potential to be as good as a "full" >MT Erlang but probably a better than just running several several plain >Erlang nodes on a MP machine. >Basically shortcut the distribution mechanism, detect Erlang nodes >running on the same physical machine and then bypass the normal socket >based distribution by establishing a shared memory communication area >between the two Erlang nodes on the same machine. I wonder if this really would be a 'cheat': it is probably simpler (I think) to just implement a driver that will enable distribution via shared memory instead of TCP... The only big question mark would be then if it is possible to have two simultaneously active distribution bearers. If it isn't now, I think it should be - the future might require it... best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From laura@REDACTED Mon Jul 29 09:46:53 2002 From: laura@REDACTED (Laura Castro) Date: Mon, 29 Jul 2002 09:46:53 +0200 (CEST) Subject: ODBC or gen_server problems ?! In-Reply-To: Message-ID: I think you should try to do something like: application:start(odbc) before doing odbc:start_link([], []). Laura Castro On Sun, 28 Jul 2002, Thomas Verner wrote: > Hi !! > > After a few years away from Erlang, I am finally back, but I have > problems on two things :-( > > We should use ODBC to obtain customer data from a Database, ODBC > compiled well, I guess, got an odbcserver.exe now, BUT it will not start > correctly ?! ( Please see errors below ) > > Secondly long node names fails ( the erlang node fails ), that is no > problem for the first installations, but when we conquer the world, it > should work. What to do ? > > We are running Windows (2000) btw. Yes I know, but Customer demands :-) > > Can anyone help me out? > > /v > > -- CUT -- > > Erlang (BEAM) emulator version 5.1.1 [threads:0] > > Eshell V5.1.1 (abort with ^G) > (test01@REDACTED)1> odbc:start_link([],[]). > ** exited: {noproc,{gen_server,call, > [odbc_sup, > {start_child,[[{client,<0.29.0>}],[]]}, > infinity]}} ** > (test01@REDACTED)2> > -- CUT -- > > Best Regards / Med venlig Hilsen > > Thomas Verner > > BluePosition > Lyngbyhus > Parallelvej 10 > 2800 Kgs. Lyngby > Phone +45 70 20 65 25 > Direct +45 20 48 34 51 > http://www.blueposition.com > mailto:tv@REDACTED > > From sureshsaragadam@REDACTED Mon Jul 29 10:52:30 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Mon, 29 Jul 2002 09:52:30 +0100 (BST) Subject: Postgres-ODBC-Erlang In-Reply-To: <200207261038.MAA20805@gildor.du.uab.ericsson.se> Message-ID: <20020729085230.38028.qmail@web8102.in.yahoo.com> Hai Ingela, Thank u, It is fine, i got it, So communication is done between pid's, I think ur problem might had solved, i.e from Erlang - PostgreSQL According to that mail i seen u have to config ODBCConfig where u have to set DSN name for the database u r working with then u can work with both example prg utility.erl basic.erl all the best suresh ________________________________________________________________________ Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com From piotr.daruk@REDACTED Mon Jul 29 08:48:30 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Mon, 29 Jul 2002 08:48:30 +0200 Subject: Erlang echo server with eLite? References: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> <3D41A28F.8FBDF4C7@st.se> Message-ID: <005801c236cb$f60b6c80$a00fe30a@panasonic.com.pl> Hello! Since I'm extremely stubborn, I've been trying to make my programmes work, under the Linux shell, continuously. I have found all modules I've needed to link. Also I've managed to start Erlang distribution using command erl_distributin:start([echo_node,shortnames]). on my programmes. Now it works just fine when you start Erlang run-time environment typing just "erl" on the shell, the programmes echo and client will start erlang nodes by them self. Would you please find the attached file and try it (Please remember to change the hostnames on the programmes and to recompile it)? hostName() -> 'echo_node@REDACTED'. "darukhost" must be changed to your hostname. On the one terminal start erl: erl then start echo 1>echo:start(0). On the other terminal start erl: erl then run client 1>klient:main(["5","5"]). It should work just fine. So, I figured out that it should work on a shell, yet it doesn't work. It is strange but when I start my program either ./echo or ./client 5 it stops on erl_distributin:start(). command. I've been reading and I found that I must start "epmd" daemon, which is the Erlang port mapper. Yet, after starting it, my programmes still do not work. Do you have any suggestions? Cheers, Piotr P.S. Sorry, I am being so annoying! ----- Original Message ----- From: "Lennart ?hman" To: "Piotr Daruk" Cc: Sent: Friday, July 26, 2002 9:27 PM Subject: Re: Erlang echo server with eLite? > You seem to ha gotten valuable help from Luke. Otherwise I believe > distribution_not_started means that your system is missing the > net_kernel process which must run if you are running a distributed > system. > > /Lennart > > Piotr Daruk wrote: > > > > Hello! > > > > I have succeeded to find auth module so I have linked it to the > > compilation. Obviously it helps, thanx Laura!! > > Yet, I got new error: > > {distribution_not_started,{auth,set_cookie,2}]} > > > > Dose anybody now what is this? What should I start? > > > > Cheers, > > Piotr > > -- > ------------------------------------------------------------- > Lennart Ohman phone : +46-8-587 623 27 > Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 > Sehlstedtsgatan 6 fax : +46-8-667 8230 > SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: echo.tar.gz Type: application/octet-stream Size: 79488 bytes Desc: not available URL: From vlad_dumitrescu@REDACTED Mon Jul 29 21:52:31 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 29 Jul 2002 21:52:31 +0200 Subject: Fun syntax Message-ID: Hi, I am a little confused about the syntax for functional objects when the referred function is remote. The way to define a fun is then Fun = {lists, reverse} I find this a little inconsequent. Why not Fun = fun lists:reverse/1 ? What I find even strange is that it works to write something like {lists, reverse}([1,2,3]). Wouldn't it be cleaner with an unified syntax for funs? The tuple notation looks like remains from the old, while it working side by side with the normal Module:Function notation feels almost like a bug... Is it? best regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From vlad_dumitrescu@REDACTED Mon Jul 29 22:41:52 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 29 Jul 2002 22:41:52 +0200 Subject: Erlang killer app?, Message-ID: Hi all, I will add my two and a half pesetas worth of, erm... wisdom, to what has already been said :-) In my humble opinion, a wider developer base wold be beneficial because there would be new and fresh ideas streaming in. In order to reach this wider audience, one or several "killer apps" might help. I think it might be helpful to list some things that I think would serve the purpose (either per se, or as a base for future development). - servers for more protocols than HTTP: FTP, SMTP, IMAP, etc. Also WebDAV, Web Services. Even better, a "gen_xxx" framework for writing such servers. Ease of use should be balanced with efficiency. - clients for the above. - Windows users can't compile the sources at the moment - no unified heap, no possibilities for hacking the runtime. Hopefully it will be gcc based, not VC. - better support under Emacs, integrating syntax_tools, igor, distel. Even better, Ermacs! (and it wouldn't hurt if Ermacs would work for Windows too) - the already mentioned massive multiplayer games - with truly alive entities, distribution, etc - a better graphical UI kit. Maybe with alive widgets!? Maybe even a GUI builder (a la Delphi/Kylix)? Just some ideas, please feel free to add more. Last night I thought there were more of them :-) About the last one, I might be able to show something at the user conference, but there are many question marks about my available spare time, so don't hold your breath. Best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From cyberlync@REDACTED Mon Jul 29 22:58:54 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 29 Jul 2002 13:58:54 -0700 (PDT) Subject: Erlang killer app?, In-Reply-To: Message-ID: <20020729205854.81278.qmail@web40210.mail.yahoo.com> > - better support under Emacs, integrating > syntax_tools, igor, distel. > Even better, Ermacs! (and it wouldn't hurt if Ermacs > would work for Windows > too) > I am about 3/4s of the way through writing an Erlang support plugin for Eclipse. I am porting an existing plugin from another langauge so the initial release will just include what was already available in the initial plugin. Basically, an Erlang perspective, an outliner, syntax-highlighting, an embedded shell, and a compilation process. I expect to release a beta by the end of the week. I would love to do a debugger but I don't think I have a good enough understanding of the guts of the Erlang vm to do that. Also there are probably a bunch of other things that would be nice. What I am hoping happens is that after the release I get some suggestions for enhancements. __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com From piotr.daruk@REDACTED Tue Jul 30 09:34:31 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Tue, 30 Jul 2002 09:34:31 +0200 Subject: Erlang echo server with eLite? References: <001701c2349e$41063c40$a00fe30a@panasonic.com.pl> <3D41A28F.8FBDF4C7@st.se> Message-ID: <003601c2379b$8df1fc60$a00fe30a@panasonic.com.pl> Hello! Since my lecturer of Functional Programming might not have an Erlang runtime, I'm desperate to make it working on Linux shell as I've got to show Him that my project works. Yesterday I have modified my echo server and now it starts the epmd daemon by it self. On this moment starting erlang runtime by erl will do. After that, on the one Linux console echo must be started (echo:start(0).), on the other console start erl and then run client (client:main(["5","5","square"]). I think it should work. Yet, on Linux shell it stops. The ./echo proces stops on "os:cmd(Epmd ++ " -daemon")," command and ./client 5 square stops on "erl_distributin:start(),". Please find the attachment and try it. Sorry, I'm being so annoying, yet it is very important for my. Thank you all very much!! Cheers, Piotr ----- Original Message ----- From: "Lennart ?hman" To: "Piotr Daruk" Cc: Sent: Friday, July 26, 2002 9:27 PM Subject: Re: Erlang echo server with eLite? > You seem to ha gotten valuable help from Luke. Otherwise I believe > distribution_not_started means that your system is missing the > net_kernel process which must run if you are running a distributed > system. > > /Lennart > > Piotr Daruk wrote: > > > > Hello! > > > > I have succeeded to find auth module so I have linked it to the > > compilation. Obviously it helps, thanx Laura!! > > Yet, I got new error: > > {distribution_not_started,{auth,set_cookie,2}]} > > > > Dose anybody now what is this? What should I start? > > > > Cheers, > > Piotr > > -- > ------------------------------------------------------------- > Lennart Ohman phone : +46-8-587 623 27 > Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 > Sehlstedtsgatan 6 fax : +46-8-667 8230 > SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: echo.tar.gz Type: application/octet-stream Size: 75876 bytes Desc: not available URL: From piotr.daruk@REDACTED Tue Jul 30 10:07:03 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Tue, 30 Jul 2002 10:07:03 +0200 Subject: Erlang echo server with eLite? Message-ID: <00ba01c237a0$189afa20$a00fe30a@panasonic.com.pl> Hello! Since my lecturer of Functional Programming might not have an Erlang runtime, I'm desperate to make it working on Linux shell as I've got to show Him that my project works. Yesterday I have modified my echo server and now it starts the epmd daemon by it self. On this moment starting erlang runtime by erl will do. After that, on the one Linux console echo must be started (echo:start(0).), on the other console start erl and then run client (client:main(["5","5","square"]). I think it should work. Yet, on Linux shell it stops. The ./echo proces stops on "os:cmd(Epmd ++ " -daemon")," command and ./client 5 square stops on "erl_distributin:start(),". Please find the attachment and try it. Sorry, I'm being so annoying, yet it is very important for my. Thank you all very much!! Cheers, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: echo.tar.gz Type: application/octet-stream Size: 75876 bytes Desc: not available URL: From matthias@REDACTED Tue Jul 30 10:46:29 2002 From: matthias@REDACTED (Matthias Lang) Date: Tue, 30 Jul 2002 10:46:29 +0200 Subject: Fun syntax In-Reply-To: References: Message-ID: <15686.21093.922559.874994@antilipe.corelatus.se> Vlad Dumitrescu writes: > I am a little confused about the syntax for functional objects when the > referred function is remote. The way to define a fun is then > Fun = {lists, reverse} > I find this a little inconsequent. Why not > Fun = fun lists:reverse/1 ? Are you mixing up several weakly-related issues? The tuple syntax for funs is deprecated and has (almost?) nothing to do with 'local' or 'remote'. You can use the same fun syntax to send funs between local and remote processes. Example: -------------------a.erl-------- -module(a). -export([make_fun/0]). make_fun() -> fun(X) -> lists:reverse(X) end. -------------------one node--------- (a@REDACTED)3> F = a:make_fun(). #Fun (a@REDACTED)4> pid(230,53,0) ! F. #Fun -------------------another node--------- (b@REDACTED)1> self(). <230.53.0> (b@REDACTED)2> F = receive X -> X end. #Fun (b@REDACTED)3> F([1,2,3]). [3,2,1] The only coupling between "remote" and "local" I can think of in relation to funs is that the code for the fun must be available on the node it is executed on, i.e. if 'b@REDACTED' doesn't have access to 'a.beam', you get ** exited: {undef,[{#Fun,[[1,2,3]]}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** In the example, the problem CAN be avoided by sending a "tuple-fun", but you're up the proverbial shit creek without a paddle if the fun() you wanted to send was something more complex, for instance: fun(X) -> lists:duplicate(lists:reverse(X)) end So: 1. You shouldn't be using the tuple syntax 2. It is possible to abuse the tuple syntax to work around some fundamental design decisions in Erlang, but the result is ugly and non-general, and mucking around with the syntax won't fix that. BTW, take a look at what happens if you send a fun() you define in the shell around. It sends the code for the fun in the message. ;-) Matthias From happi@REDACTED Tue Jul 30 11:20:53 2002 From: happi@REDACTED (Erik.Stenman) Date: Tue, 30 Jul 2002 11:20:53 +0200 Subject: Fun syntax References: Message-ID: <025c01c237aa$67e39010$980cee82@it.uu.se> Vlad Dumitrescu wrote: > Hi, > > I am a little confused about the syntax for functional objects when the > referred function is remote. The way to define a fun is then > Fun = {lists, reverse} No, it is not. Don't tell anyone that this works ;) The way to do it is: Fun = fun(L) -> lists:reverse(L) end. > I find this a little inconsequent. Why not > Fun = fun lists:reverse/1 ? I think the reason is that the entity lists:reverse/1 does not exist at compile time, the address of the function can only be found at load time or at the time of the call. If you create a fun like: Fun = reverse/1, then Fun is just an alias for the local function reverse/1 which can be found during compilation. One could argue that fun lists:reverse/1 could be syntactic sugar for fun(L) -> lists:reverse(L) end, but this might lead one to belive that this fun only depend on the module lists but in fact it would also depend on the current module (there would be alocal fun calling lists:reverse/1). > What I find even strange is that it works to write something like > {lists, reverse}([1,2,3]). > Wouldn't it be cleaner with an unified syntax for funs? The tuple notation > looks like remains from the old, while it working side by side with the > normal Module:Function notation feels almost like a bug... Is it? Yes, this is terrible and ugly in so many ways... and it is going to go away. The reason this still exists is because of the interaction with code updates. In some generic servers you want to store dynamic callback functions. If you send a closure (fun) to these servers and then update the module that contained that closure the server will (probably) crash when trying to call the callback. But if you send it a tuple it will do a dynamic apply and the callback will work regardles of code updates (provided of course that the new module still implements the callback function in the same way.) e.g. s(MF) -> receive {call,Arg} -> MF(Arg), s(MF); _ -> s(MF) end. But this can be expressed just as well with apply: s(MF={M,F}) -> receive {call,Arg} -> apply(M,F,[Arg]), s(MF); _ -> s(MF) end. /Erik -------------------------------------- Eric Conspiracy Secret Laboratories I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. From happi@REDACTED Tue Jul 30 11:43:23 2002 From: happi@REDACTED (Erik.Stenman) Date: Tue, 30 Jul 2002 11:43:23 +0200 Subject: Fun syntax & language feature poll References: <15686.21093.922559.874994@antilipe.corelatus.se> Message-ID: <026801c237ad$8c5a8e50$980cee82@it.uu.se> Matthias Lang wrote: > > I am a little confused about the syntax for functional objects when the > > referred function is remote. The way to define a fun is then > > Fun = {lists, reverse} ... > Are you mixing up several weakly-related issues? The tuple syntax for > funs is deprecated and has (almost?) nothing to do with 'local' or > 'remote'. You can use the same fun syntax to send funs between local > and remote processes. I think you misunderstood Vlad, I am sure he meant local or remote call as in calls within the same module (local) or calls to another module (remote) which has nothing to do with local or remote processes. Unfortunately these two types of calls also distinguishes which version of module is to be called. Speaking of which, why not remove this feature of Erlang (that a remote call calls the latest version of loaded code) and instead introduce a special update call like: enter_latest foo(...) ? Except in the shell who uses this feature? If you want to write an application that really supports upgrades you have think this through and design with it in mind from the beginning anyway. Removing this feature would do wonders to the possibilities of optimization... Comments, flames, arguments are welcome. /Erik -------------------------------------- N. Erik M. Stenman Eric Conspiracy Secret Laboratories -------------------------------------- I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. From lennart.ohman@REDACTED Tue Jul 30 13:06:08 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Tue, 30 Jul 2002 13:06:08 +0200 Subject: Fun syntax & language feature poll References: <15686.21093.922559.874994@antilipe.corelatus.se> <026801c237ad$8c5a8e50$980cee82@it.uu.se> Message-ID: <3D467320.AB1B254C@st.se> Apart from being against all new things :-) In my opinion it should be better with functionality where you can keep to a certain version of a module in the function call (making it possible to extend to having more than two versions) and only program with that feature where it is necessary. /Lennart > Speaking of which, why not remove this feature of Erlang (that a remote call > calls the latest version of loaded code) and instead introduce a special update > call like: > enter_latest foo(...) ? > > Except in the shell who uses this feature? > If you want to write an application that really supports upgrades you have think this > through and design with it in mind from the beginning anyway. > > Removing this feature would do wonders to the possibilities of optimization... > > Comments, flames, arguments are welcome. > > /Erik > -------------------------------------- > N. Erik M. Stenman > Eric Conspiracy Secret Laboratories > -------------------------------------- > I'm Happi, you should be happy. > Praeterea censeo "0xCA" scribere Erlang posse. ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From luke@REDACTED Tue Jul 30 15:58:20 2002 From: luke@REDACTED (Luke Gorrie) Date: 30 Jul 2002 15:58:20 +0200 Subject: Erlang killer app?, In-Reply-To: References: Message-ID: "Vlad Dumitrescu" writes: > - better support under Emacs, integrating syntax_tools, igor, > distel. Even better, Ermacs! (and it wouldn't hurt if Ermacs > would work for Windows too) Emacsification is happening :-). The CVS version of Distel (http://sf.net/projects/distel) is getting fancy now, it includes a debugger front-end (so you can single-step code inside a buffer), and a dynamic TAGS-like feature for jumping from a function call to the function definition, and more. Here's the current `describe-mode' documentation for the erlang-extended-mode: Erlang-Extended minor mode (indicator EXT): Extensions to erlang-mode for communicating with a running Erlang node. C-c C-d l - List all Erlang processes ("pman"). C-c C-d . - Jump to the definition of a function call (dynamic TAGS). C-c C-d : - Evaluate an erlang expression from the minibuffer. C-c C-d p - Profile (with fprof) an expression from the minibuffer. C-c C-d i - Toggle debug interpreting of the module. C-c C-d b - Toggle a debugger breakpoint at the current line. C-c C-d m - Popup the debugger's process monitor buffer. I have a debugger screen-shot at http://www.bluetail.com/~luke/misc/distel-dbg.png for the curious. After some polishing and beta-testing I'll be able to make a release with really nice "out of the box" features. As it stands, the CVS version works great with Emacs 21 and R8, albeit with minor installation hiccups on some machines. Testers welcome :-) syntax_tools/igor integration is a great next idea. It should be very easy to make "refactoring" commands, e.g. "refactor region as sub-function": take a region of a function, send it to Richard Carlsson's magic to get a list of free variables, generate a new function with those variables as parameters and the region as the body, rewrite original bit as a call to the new function. As for Ermacs (outright clone of Emacs in Erlang), I reckon integration with the real Emacs is the better approach, which is why I switched to Distel. I really learned a new apprciation for Emacs in trying to replace it :-) Cheers, Luke From piotr.daruk@REDACTED Tue Jul 30 16:35:41 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Tue, 30 Jul 2002 16:35:41 +0200 Subject: Erlang echo server with eLite? Message-ID: <005801c237d6$6119b940$a00fe30a@panasonic.com.pl> Hello! I'm still looking for a BAG in my programmes. Did anyone find something? Cheers, Piotr My previous e-mail: > Since my lecturer of Functional Programming might not have an Erlang >runtime, I'm desperate to make it working on Linux shell as I've got to >show >Him that my project works. Yesterday I have modified my echo server >and now >it starts the epmd daemon by it self. On this moment starting erlang runtime >by erl will do. After that, on the one Linux console echo must be started >(echo:start(0).), on the other console start erl and then run client >(client:main(["5","5","square"]). I think it should work. Yet, on Linux >shell it stops. The ./echo proces stops on "os:cmd(Epmd ++ " -daemon")," >command and ./client 5 square stops on "erl_distributin:start(),". > > Please find the attachment (to my previous e-mail!) and try it. Sorry, I'm >being so annoying, yet it is very important for my. > > Thank you all very much!! Cheers, Piotr -------------- next part -------------- An HTML attachment was scrubbed... URL: From jabba@REDACTED Tue Jul 30 18:22:12 2002 From: jabba@REDACTED (Jani Launonen) Date: Tue, 30 Jul 2002 19:22:12 +0300 (EEST) Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? Message-ID: <200207301622.g6UGMCf25064@ee.oulu.fi> Thank you Pekka for the update! [cut] >Basically shortcut the distribution mechanism, detect Erlang nodes >running on the same physical machine and then bypass the normal socket >based distribution by establishing a shared memory communication area >between the two Erlang nodes on the same machine. Far easier to >implement and you avoid the overhead of socket, TCP and external format >conversions. The full process contex switch overhead is still there and >one also would need to handle "node" scheduling of Erlang processes for >full benefit etc, etc. But thats the same problems as today with >distributed Erlang. How much that would enhance performance? The pipe-communication is supposed to provide 10% improvement over TCP/IP (as http://erlang.stacken.kth.se/user.html#unixdom-0.1 describes. Perhaps there are newer and faster version somewhere?) so could one expect whole lot of more throughput? >A real MT Erlang is still desirable and it can be done very nicely and >efficient in my oppinion. MP machines is, as mentioned, a comodity >nowdays and now when hyperthreading is introduced in the Intel P4Xeon >CPUs even more more interesting benefits for an MT Erlang is opened. Letting the operating system do the balancing in one physical machine would be very nice because that would leave out the own balancing code - which in turn would give some performance advantage in larger SMP systems. I sure hope, that MT Erlang would become under active development (or at least some evaluation) in near future, to ensure that Erlang continue to be interesting language for problems suitable for SMP-machines. -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of EE Assistant Researcher . . .Apricot Project "Computing is a field which has one of the shortest collective memories of any engineering or scientific discipline." - Marty Fouts, comp.distributed From vlad_dumitrescu@REDACTED Tue Jul 30 21:48:50 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 30 Jul 2002 21:48:50 +0200 Subject: Fun syntax Message-ID: Hi, you are right, Erik: by "remote" I meant "from another module". > > I am a little confused about the syntax for functional objects when the > > referred function is remote. The way to define a fun is then > > Fun = {lists, reverse} > >No, it is not. Don't tell anyone that this works ;) Well, it's stated in the docs about the Fun syntax: We can also refer to a function defined in a different module with the following syntax: F = {Module, FunctionName} In this case, the function must be exported from the module in question. >I think the reason is that the entity lists:reverse/1 does not exist at >compile time, the address of the function can only be found at load time or >at the time of the call. I was thinking that internally 'lists:reverse' could be represented just as '{lists, reverse}' - the new syntax could only be clearer and more consistent. > > What I find even strange is that it works to write something like > > {lists, reverse}([1,2,3]). >Yes, this is terrible and ugly in so many ways... and it is going to go >away. Good! >In some generic servers you want to store dynamic callback functions. Yes, but as you say, that's why apply is here for. best regards, Vlad _________________________________________________________________ Med MSN Foto kan du enkelt dela med dig av dina fotografier och best?lla kopior: http://photos.msn.se From vlad_dumitrescu@REDACTED Tue Jul 30 21:53:43 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 30 Jul 2002 21:53:43 +0200 Subject: Erlang killer app?, Message-ID: Hi, >From: Luke Gorrie >"Vlad Dumitrescu" writes: > > > - better support under Emacs, integrating syntax_tools, igor, > > distel. Even better, Ermacs! (and it wouldn't hurt if Ermacs > > would work for Windows too) > >Emacsification is happening :-). I know now, I got your announcement just after sending my question. I think it is a great job!! >As for Ermacs (outright clone of Emacs in Erlang), I reckon >integration with the real Emacs is the better approach, which is why I >switched to Distel. I really learned a new apprciation for Emacs in >trying to replace it :-) You dug into this alot more than I did, so you must know better! best regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From vlad_dumitrescu@REDACTED Tue Jul 30 21:58:57 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 30 Jul 2002 21:58:57 +0200 Subject: Erlang killer app?, Message-ID: Hi again, to add a few more things to make the list more complete (nothing new and I think work is in progress): - better string handling, maybe as binaries, or as a separate type. Multibyte and Unicode support would also help any Internet application that wants to be international. - the hyerarchical module system might help reduce the namespace clutter regards, Vlad _________________________________________________________________ P? MSN hittar du det roliga, intressanta och anv?ndbara p? internet: http://www.msn.se From spearce@REDACTED Wed Jul 31 06:10:57 2002 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 31 Jul 2002 00:10:57 -0400 Subject: New proposal: driver objects (in same track as driver_mkref) Message-ID: <20020731001057.A141604@spearce.org> So i was just thinking about this whole driver_mkref() discussion we had a few days ago... Yes, it would be nice to be able to send a reference back to Erlang. But it would also be nice to be able to send back a pointer which is not mutable by Erlang. There was some discussion about how it could be dangerous for a driver to return a reference, as that reference might not be unique, unless the driver used the same allocation scheme as Erts. But what about the dangers of drivers returning pointers (and other driver private information) to Erlang as integers or binaries? These terms are easy to "manipulate" in Erlang, allowing an Erlang application to potentially send a bad value to the driver. So the driver author must code somewhat defensively. This is really out on a limb, but what about being able to do something such as: Window w = XCreateWindow(...); ErlDrvObject obj1 = driver_mkobject(port, w); ErlDrvObject obj2 = driver_packobject(port, &w, sizeof(w)); ErlDrvTerm[] term = {ERL_DRV_OBJECT, obj}; driver_output_term(... term ...); .... Window w2 = (Window)driver_getobject(obj); ... Window w3; driver_unpackobject(obj, &w3, sizeof(w3)); Objects are terms in Erlang, perhaps printed as "#Object<#Port<0.15>.805243a0>>". It should not be possible to create object terms in Erlang, as they cannot be mucked with for the sake of driver safety. Objects can hold any size of data needed by the driver, but would in general hold pointer sized data. In the concept above, I show a pair of functions for pointer sized data, and a second pair for variable sized data. When all references to an object from within Erts are gone, the driver should get a callback to notify it that all of the references are gone and the object (should most likely) be freed. This might be able to be handled much like ErlDrvBinaries are handled today, only objects are attached to a specific port. When the port is closed, all driver objects existing must be freed. Perhaps mini-references can be embedded in the object to act as sequence guards to ensure that any left over object terms in Erlang are useless once that port has been closed. I guess my brain got on this track because its somewhat similiar to ports and process ids. They are difficult to create for the sole reason that sane Erlang applications should not attempt to create them, unless they are using open_port or spawn. Granted, pid_to_list exists for the sake of debugging, etc., but its very "difficult" to create a pid or a port term, compared to creating and/or accidentially modifying an int, binary or tuple, which would be common driver reference types today. After writing this suggestion, I'm wondering if its even worth wasting the network bytes to transfer it to the mailing list, let alone actually implementing. Might as well throw it out there for discussion though. -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From fritchie@REDACTED Wed Jul 31 07:04:47 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 31 Jul 2002 00:04:47 -0500 Subject: "A Parallel and Multithreaded ERLANG Implementation" - status? In-Reply-To: Message of "Tue, 30 Jul 2002 19:22:12 +0300." <200207301622.g6UGMCf25064@ee.oulu.fi> Message-ID: <200207310504.g6V54la56606@snookles.snookles.com> >>>>> "jl" == Jani Launonen writes: jl> How much that would enhance performance? The pipe-communication is jl> supposed to provide 10% improvement over TCP/IP (as jl> http://erlang.stacken.kth.se/user.html#unixdom-0.1 jl> describes. Perhaps there are newer and faster version somewhere?) jl> so could one expect whole lot of more throughput? I'm the wild-eyed hacker responsible for that driver.... The 10% figure was for communication on a uniprocessor SPARC box (Ultra 10, perhaps?) running Solaris 2.6. One end of the UNIX domain socket was an Erlang application, and the other was a C application. Sun RPC was being used on over the socket. That was a while ago, alas. So, that 10% number is subject to a lot of variables. The speed differences between TCP sockets across the loopback and UNIX sockets varies pretty widely from OS to OS. At work a few months ago I cooked up some RPC latency and bandwidth figures for an x86 box running Linux 2.2.14. I don't have the figures in front of me, but IIRC the differences were more than 10%, both in terms of bandwidth and latency. -Scott From fritchie@REDACTED Wed Jul 31 07:40:32 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 31 Jul 2002 00:40:32 -0500 Subject: New proposal: driver objects (in same track as driver_mkref) In-Reply-To: Message of "Wed, 31 Jul 2002 00:10:57 EDT." <20020731001057.A141604@spearce.org> Message-ID: <200207310540.g6V5eWa56689@snookles.snookles.com> >>>>> "sp" == Shawn Pearce writes: sp> After writing this suggestion, I'm wondering if its even worth sp> wasting the network bytes to transfer it to the mailing list, let sp> alone actually implementing. Might as well throw it out there for sp> discussion though. You're right. That's a pretty far-out idea. :-) But the discussion is worthwhile, particularly since I have something relevant to add. sp> But what about the dangers of drivers returning pointers (and sp> other driver private information) to Erlang as integers or sp> binaries? These terms are easy to "manipulate" in Erlang, sp> allowing an Erlang application to potentially send a bad value to sp> the driver. So the driver author must code somewhat defensively. I've come up with a solution that requires no change to the VM and does most of what I think you're proposing. I'll yank an example out of the Erlang Workshop paper I've been working on. (THANK GOD I DON'T HAVE TO HAVE THAT PAPER FINISHED THIS WEEK!!! Alright, I think I have that out of my system now.) The "Erlang Driver Toolkit" code generator I've been working on automatically generates all or almost all of the code a person needs to create a driver for an existing C library. I quote an example from the SWIG (http://www.swig.org/) documentation, then show how it can be done using an EDTK-generated driver. Assume that pli2002_drv provides a straightforward interface to malloc(3), fopen(3), fread(3), and fwrite(3). Ignore the fact that fwrite doesn't take the same number of arguments as fread: that's intentional, explained in the paper, so nevermind. -module(pli2002_test). -define(DRV, pli2002_drv). -define(BUFSIZ, 8192). -export([file_copy/1, file_copy/2]). %% command line "-s" usage file_copy([Src, Dst]) when atom(Src), atom(Dst) -> file_copy(atom_to_list(Src), atom_to_list(Dst)). file_copy(Src, Dst) -> {ok, Port} = ?DRV:start(), {ok, SrcF} = ?DRV:fopen(Port, Src, "r"), {ok, DstF} = ?DRV:fopen(Port, Dst, "w"), {ok, Buf} = ?DRV:malloc(Port, ?BUFSIZ), RFun = fun () -> ?DRV:fread(Port, Buf, 1, ?BUFSIZ, SrcF) end, WFun = fun (N) -> ?DRV:fwrite(Port, Buf, N, DstF) end, Val = file_copy2(RFun, WFun), %% Shutdown will automatically close %% files and free the buffer. ?DRV:shutdown(Port), Val. file_copy2(RFun, WFun) -> file_copy2(RFun, WFun, RFun()). file_copy2(RFun, WFun, {ok, N}) -> WFun(N), file_copy2(RFun, WFun); file_copy2(RFun, WFun, {error, 0}) -> ok; % End of file file_copy2(RFun, WFun, Error) -> Error. In the section where I talk about the hassles/joys of single-assignment, I point to how this function written in Python is OK but problematic for Erlang. The return of pli2002_drv:malloc/2 is not a pointer cast as an integer (though you can tell EDTK to do that for you) or hidden inside a binary (though I'm tempted by that). Instead it's what I've called a "value map" tuple. It looks like {valmap_ptr, 5}. The "5" is an index into a private value map table maintained by the driver. The index is what gets passed into the driver: here's free/2: free(Port, Ptr ) when port(Port) -> % TODO: Add additional constraints here {valmap_ptr, PtrIndex} = Ptr, B = <>, erlang:port_command(Port, B), get_port_reply(Port). The pattern matching extracts the index value, but it has the side benefit of causing an error if the caller passed in something else.(*) It's not foolproof, as I also discuss (I think?), but it works pretty well. Anyway, the driver can hide whatever it wants behind these value map thingies. I have example drivers that use store malloc'ed pointers as well as file descriptors and Berkeley DB database and environment "handles". The driver's "stop" method calls the user's deallocation/close/cleanup function for each entry in each value map whenever the port is closed: 'cause port_close/1 was called or because the owner process died/was killed. As the comment in file_copy/2 says, closing the port will close both "FILE *" thingies (and their file descriptors and free any additional buffers they were hiding) as well as free the malloc'ed memory. IMHO it's pretty slick. It makes it almost impossible for a driver to leak resources, unless the owner process allocates stuff and then lives forever. But then you've got bigger problems. If that's the sort of sanity mechanism you're proposing, I agree, it's very useful. -Scott (*) I borrowed this bit of type checking from SWIG, which encodes its pointers as something like (fuzzy memory) "_0x01234f30_FILE_": it includes both the pointer address and the pointer type. From piotr.daruk@REDACTED Wed Jul 31 08:16:58 2002 From: piotr.daruk@REDACTED (Piotr Daruk) Date: Wed, 31 Jul 2002 08:16:58 +0200 Subject: Erlang echo server with eLite? References: <04D356A3B172D611981B0008C791C3126BF20C@imp02mbx.t-mobile.co.uk> Message-ID: <002901c23859$e02103a0$a00fe30a@panasonic.com.pl> Hello! Yeah I know. But I'm trying to run my programmes on Linux shell not on Erlang runtime. I managed to start epmd daemon remotely using os:cmd command and it works on Erlang runtime. Yet, when I'm running my programmes on Linux shell (after compiling it useing eLite) it stops. The ./echo one stops on the command "os:cmd()", the ./client one stops on the command "erl_distribution:start()". Do you have any idea what is wrong? Cheers, Piotr ----- Original Message ----- From: "Sean Hinde" To: "'Piotr Daruk'" Sent: Tuesday, July 30, 2002 5:19 PM Subject: RE: Erlang echo server with eLite? > Just start 2 erlang shells with > > erl -sname name1 -setcookie cookie_cream > > and > > erl -sname name2 -setcookie cookie_cream > > The at the erlang shell for name2 do: > > net_adm:ping(name1@REDACTED). > > This starts up epmd automatically and establishes the connection. your ping > should be trivial after that > > Sean > > -----Original Message----- > From: Piotr Daruk [mailto:piotr.daruk@REDACTED] > Sent: 30 July 2002 15:36 > To: erlang-questions@REDACTED > Subject: Erlang echo server with eLite? > > > Hello! > > I'm still looking for a BAG in my programmes. Did anyone find something? > > Cheers, > Piotr > > My previous e-mail: > > > > Since my lecturer of Functional Programming might not have an Erlang > >runtime, I'm desperate to make it working on Linux shell as I've got to > >show > >Him that my project works. Yesterday I have modified my echo server >and > now > >it starts the epmd daemon by it self. On this moment starting erlang > runtime > >by erl will do. After that, on the one Linux console echo must be started > >(echo:start(0).), on the other console start erl and then run client > >(client:main(["5","5","square"]). I think it should work. Yet, on Linux > >shell it stops. The ./echo proces stops on "os:cmd(Epmd ++ " -daemon")," > >command and ./client 5 square stops on "erl_distributin:start(),". > > > > Please find the attachment (to my previous e-mail!) and try it. Sorry, > I'm >being so annoying, yet it is very important for my. > > > > Thank you all very much!! > > Cheers, > Piotr > > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have received > this email in error please notify the sender immediately and delete this > email from your system without copying or disseminating it or placing any > reliance upon its contents. We cannot accept liability for any breaches of > confidence arising through use of email. Any opinions expressed in this > email (including attachments) are those of the author and do not necessarily > reflect our opinions. We will not accept responsibility for any commitments > made by our employees outside the scope of our business. We do not warrant > the accuracy or completeness of such information. > From luke@REDACTED Wed Jul 31 15:44:35 2002 From: luke@REDACTED (Luke Gorrie) Date: 31 Jul 2002 15:44:35 +0200 Subject: Erlang killer app?, In-Reply-To: References: Message-ID: "Vlad Dumitrescu" writes: > >As for Ermacs (outright clone of Emacs in Erlang), I reckon > >integration with the real Emacs is the better approach, which is why I > >switched to Distel. I really learned a new apprciation for Emacs in > >trying to replace it :-) > > You dug into this alot more than I did, so you must know better! Just think about rewriting the 750,000 lines of Emacs Lisp code that comes with GNU Emacs :-) Cheers, Luke From vlad_dumitrescu@REDACTED Wed Jul 31 17:09:43 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 31 Jul 2002 17:09:43 +0200 Subject: Erlang killer app?, Message-ID: Hi, >Just think about rewriting the 750,000 lines of Emacs Lisp code that >comes with GNU Emacs :-) :-) Well, I don't think that it really would be necessary to rewrite all Lisp code. Just the basics and some more Erlang related. Wouldn't really need to be an Emacs clone, just provide editing capabilities and a scripted extension mechanism... If it should prove itself as a "killer app", developers would stream in as pilgrims to the promised land to port all of Emacs! ;-) All in all, even if it isn't practical, it would still be cool! regards, Vlad _________________________________________________________________ MSN Hotmail ?r v?rldens popul?raste e-posttj?nst. Skaffa dig ett eget konto du ocks?: http://www.hotmail.com From kent@REDACTED Wed Jul 31 22:06:22 2002 From: kent@REDACTED (Kent Boortz) Date: 31 Jul 2002 22:06:22 +0200 Subject: Plan and preparation for R8B-2 In-Reply-To: References: <200206232221.g5NMLbY27274@sork.levonline.com> Message-ID: Sorry that the R8B-2 is taking such a long time. Now it close to what is to be released. There are some version number changes and some minor Windows build issues left. A new snapshot can be found at http://www.erlang.org/otp_src_R8B_2002-07-31.tar.gz Some of the changes since the last snapshot are Updated applications, ic-4.1.3, orber-3.2.13 and cosNotification-1.0.6 Corrected to the fun handling in the erlang shell HPUX build configure changes Kernel poll support (--enable-kernel-poll configure flag) kent