From hfventer@REDACTED Mon Dec 2 08:58:04 2002 From: hfventer@REDACTED (hfventer) Date: Mon, 2 Dec 2002 09:58:04 +0200 Subject: Distributed Applications Message-ID: <000101c299d8$9d910db0$0100a8c0@home1> Hi every one. I have been searching for some answers on distributed applications, but have not yet gotten it to work. Here is what I want to do: I have a simple TCP/IP server that creates a separate process for each connection to the socket. This process then receives commands from the user. These commands are passed on to a central server (possably running on another node) and returns the response to the user. The central server has its own internal stat and recieves commands from other processes. Nothing realy fancy. What I have achieved thusfar is to get my two nodes (windows XP and Linux) to connect. I can start everything on node 2 from node 1 (with a spawn command) I have two applications at the moment. The TCP/IP server and the command server. They both have the application behavior. I created a boot script on both nodes to start these two applications. [{kernel,"2.8.0"}, {stdlib,"1.11.0"}, {sasl, "1.9.4"}, {erlyhack_app,"0.01.02"}, {erlyhack_map_app,"0.01.01"}] In my kernel.app file I added the following to both nodes. {distributed, [ {erlyhack_map_app, [n2@REDACTED, n1@REDACTED]} ]}, {start_dist_ac, true}, {sync_nodes_optional, [n2@REDACTED, n1@REDACTED]}, {sync_nodes_timeout, 10000} When I start the nodes up what I get is that all the applications start on the node in question (erlyhack_app and erlyhack_map_app start on n1 and then on n2 and continue running there) No takeover of erlyhack_map_app to n2 happens. Clearly I am missing something :) Anyone know what I am doing wrong? I have been searching for complete examples of distributed applications but have not found any. Are there any available for me to look at and learn? Thanks -]-[einrich PS This might be a duplicate message. If it is, my appologies. From ingela@REDACTED Mon Dec 2 09:07:07 2002 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 2 Dec 2002 09:07:07 +0100 Subject: odbc help ( PATCH ) References: <20021113155724.G49569-100000@dev1.localdomain.net> <20021129.044717.74754876.svg@surnet.ru> <15847.36793.533404.150512@gargle.gargle.HOWL> <20021129.215242.41635409.svg@surnet.ru> Message-ID: <15851.5291.42564.414123@gargle.gargle.HOWL> > > As I mentioned native PostgresSQL ODBC is version 2.5 so it is > compliant only with ODBC 2 specification. If erlang ODBC can work well > with ODBC 2 drivers why it mustn't. My simple patch doesn't affect any > standard application functionality or behavior so it could be the user's > choice to use it with reduced to ODBC 2 abilities or not. Well that does put it in another light. If you look at the documentation you will see that Erlang ODBC is designed using odbc 3.0 specification and does not claim to work with 2.x drivers. If your workaround will make it work for 2.x drivers, it is, as you say, up to the user if they will like to apply the patch. After all Erlang is open source. I just think you should be aware of what you are doing. I do agree that probably your patch is pretty harmless but in principal it is the wrong thing to do. Are there not any 3.0 compliant drivers for PostgressSQL? -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team Cellular/Mobile: +46 70 636 78 68 From Bruce@REDACTED Mon Dec 2 09:41:10 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 2 Dec 2002 21:41:10 +1300 Subject: Buglet in gen_server? Message-ID: <074001c299de$90bfbef0$dc21970a@norris> Hi, I've been using the emacs skeletons forever, and these do things such as: gen_server:start_link({local, app}, app, [], []). This syntax isn't documented in R9B, and is possibly deprecated, but the interesting thing is that gen_server:call, and gen_server:start_link both work, while gen_server:cast doesn't (and fails silently, the dangerous little monster). Is the ServerRef -> {local, app} syntax valid? deprecated? invalid? Thanks, Bruce From Bruce@REDACTED Mon Dec 2 10:46:27 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 2 Dec 2002 22:46:27 +1300 Subject: Buglet in gen_server? References: <074001c299de$90bfbef0$dc21970a@norris> Message-ID: <075201c299e7$b0175750$dc21970a@norris> Oops. Brain-spasm. {local, app} is valid for gen_server:start_link but not subsequent calls. I should know this, I have numerous examples where I've managed to do this successfully. Promise. Sorry for wasting bandwidth :-) /Bruce ----- Original Message ----- From: "Bruce Fitzsimons" To: Sent: Monday, December 02, 2002 9:41 PM Subject: Buglet in gen_server? > Hi, > > I've been using the emacs skeletons forever, and these do things such as: > > gen_server:start_link({local, app}, app, [], []). > > This syntax isn't documented in R9B, and is possibly deprecated, but the > interesting thing is that gen_server:call, and gen_server:start_link both > work, while gen_server:cast doesn't (and fails silently, the dangerous > little monster). > > Is the ServerRef -> {local, app} syntax valid? deprecated? invalid? > > Thanks, > Bruce > > > > From Chandrashekhar.Mullaparthi@REDACTED Mon Dec 2 10:55:14 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 2 Dec 2002 09:55:14 -0000 Subject: Buglet in gen_server? Message-ID: <04D356A3B172D611981B0008C791C312404EAC@IMP02MBX> This syntax is documented. Checkout http://www.erlang.org/doc/r9b/lib/stdlib-1.11.0/doc/html/index.html Extract from the doc. ======== If ServerName={local,Name} the gen_server is registered locally as Name using register/2. If ServerName= {global,Name} the gen_server is registered globally as Name using global:register_name/2. If no name is provided, the gen_server is not registered ======== Not providing a name is useful when you want to have a supervised child using the simple_one_for_one restart strategy. cheers, Chandru -----Original Message----- From: Bruce Fitzsimons [mailto:Bruce@REDACTED] Sent: 02 December 2002 08:41 To: erlang-questions@REDACTED Subject: Buglet in gen_server? Hi, I've been using the emacs skeletons forever, and these do things such as: gen_server:start_link({local, app}, app, [], []). This syntax isn't documented in R9B, and is possibly deprecated, but the interesting thing is that gen_server:call, and gen_server:start_link both work, while gen_server:cast doesn't (and fails silently, the dangerous little monster). Is the ServerRef -> {local, app} syntax valid? deprecated? invalid? Thanks, Bruce 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 svg@REDACTED Mon Dec 2 11:06:09 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Mon, 02 Dec 2002 15:06:09 +0500 (YEKT) Subject: Distributed Applications In-Reply-To: <000101c299d8$9d910db0$0100a8c0@home1> References: <000101c299d8$9d910db0$0100a8c0@home1> Message-ID: <20021202.150609.71083873.svg@surnet.ru> Good day, For receiving takeover|failover application must be configured with start_phases parameter. erlyhack_map_app.app: {application, erlyhack_map_app, [{description, "some desc"}, {vsn, "1.0.0"}, {start_phases, [{init, []}, {go, []}]}, ... ] }. And then in application module erlyhack_map_app.erl: start(_, StartArgs) -> ... start_phase(init, {takeover, FromNode}, Args) -> %% Here apllication is yet working on second node so we %% can talk with application processes to get states and %% get agreement about global names my_callback_module:perform_takeover(FromNode), ... ok; start_phase(init, _, _) -> % Type = normal | {failover, FromNode} ok; start_phase(go, _, GoArgs) -> ok. Best Regards, Vladimir Sekissov hfventer> I have been searching for some answers on distributed applications, but hfventer> have not yet gotten it to work. hfventer> hfventer> Here is what I want to do: hfventer> I have a simple TCP/IP server that creates a separate process for each hfventer> connection to the socket. This process then receives commands from the hfventer> user. These commands are passed on to a central server (possably hfventer> running on another node) and returns the response to the user. The hfventer> central server has its own internal stat and recieves commands from hfventer> other processes. hfventer> hfventer> Nothing realy fancy. hfventer> What I have achieved thusfar is to get my two nodes (windows XP and hfventer> Linux) to connect. I can start everything on node 2 from node 1 (with a hfventer> spawn command) hfventer> hfventer> I have two applications at the moment. The TCP/IP server and the hfventer> command server. They both have the application behavior. I created a hfventer> boot script on both nodes to start these two applications. hfventer> hfventer> [{kernel,"2.8.0"}, hfventer> {stdlib,"1.11.0"}, hfventer> {sasl, "1.9.4"}, hfventer> {erlyhack_app,"0.01.02"}, hfventer> {erlyhack_map_app,"0.01.01"}] hfventer> hfventer> In my kernel.app file I added the following to both nodes. hfventer> hfventer> {distributed, [ {erlyhack_map_app, [n2@REDACTED, n1@REDACTED]} ]}, hfventer> {start_dist_ac, true}, hfventer> {sync_nodes_optional, [n2@REDACTED, n1@REDACTED]}, hfventer> {sync_nodes_timeout, 10000} hfventer> hfventer> When I start the nodes up what I get is that all the applications start hfventer> on the node in question (erlyhack_app and erlyhack_map_app start on n1 hfventer> and then on n2 and continue running there) No takeover of hfventer> erlyhack_map_app to n2 happens. Clearly I am missing something :) hfventer> hfventer> Anyone know what I am doing wrong? hfventer> hfventer> I have been searching for complete examples of distributed applications hfventer> but have not found any. Are there any available for me to look at and hfventer> learn? hfventer> hfventer> Thanks hfventer> hfventer> -]-[einrich hfventer> PS This might be a duplicate message. If it is, my appologies. From hfventer@REDACTED Mon Dec 2 14:32:47 2002 From: hfventer@REDACTED (hfventer) Date: Mon, 2 Dec 2002 15:32:47 +0200 Subject: Distributed Applications In-Reply-To: <20021202.150609.71083873.svg@surnet.ru> Message-ID: <000001c29a07$4e053d50$0100a8c0@home1> >For receiving takeover|failover application must be configured with start_phases >parameter. Thank you for the help, but I stil have no joy with this. I can see that the nodes each run through the start phases. Node 1 and node 2 both start the distributed application locally with no takeover. It seems that after I start the erlang node up, it does not know of the other node yet. If I use net_kernel:connect(n1@REDACTED) no actions are taken to move the application to the appropriate node. Now I am wondering what exactly is needed in the bootscript and kernel.app to make sure that two nodes talk to each other at startup so that a distrubuted application gets distributed. Do I need to use node_sync_mandatory to force the nodes to wait for each other? Or do I need to start more apps up than kernel and stdlib to get distributed behavior? Thanks -]-[einrich From etxuwig@REDACTED Mon Dec 2 14:49:23 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 2 Dec 2002 14:49:23 +0100 (MET) Subject: Distributed Applications In-Reply-To: <000001c29a07$4e053d50$0100a8c0@home1> Message-ID: On Mon, 2 Dec 2002, hfventer wrote: >>For receiving takeover|failover application must be configured with >start_phases >>parameter. > >Thank you for the help, but I stil have no joy with this. >I can see that the nodes each run through the start phases. >Node 1 and node 2 both start the distributed application >locally with no takeover. It seems that after I start the >erlang node up, it does not know of the other node yet. >If I use net_kernel:connect(n1@REDACTED) no actions are taken >to move the application to the appropriate node. Just to make sure: when you call nodes() in either of the nodes, can you actually see the name of the other node in the list? That is, on n1@REDACTED, nodes() should yield [n2@REDACTED], and on n2@REDACTED, it should be [n1@REDACTED]. If you get [], then the nodes are not able to talk to each other. Then it would be time to look at cookies, for example. Do they have the same cookie (e.g. via erl -sname n1 -setcookie mycookie)? BTW, normally, you wouldn't use net_kernel:connect(Node). The most common method is net_adm:ping(Node). There's nothing wrong with using net_kernel:connect/1, though. It works perfectly (does it actually return 'true' when you try it?) >Do I need to use node_sync_mandatory to force the nodes to >wait for each other? No, the only difference between sync_nodes_mandatory and sync_nodes_optional is that with ..._mandatory, the nodes will wait forever for each other, and with ..._optional, they will wait for the specified time, and then continue in "single mode". >Or do I need to start more apps up >than kernel and stdlib to get distributed behavior? No, that should not be necessary. Running sasl is a good idea for better error reporting, but you seem to be running that already. It doesn't affect the distribution problem, though. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From hfventer@REDACTED Mon Dec 2 15:05:48 2002 From: hfventer@REDACTED (hfventer) Date: Mon, 2 Dec 2002 16:05:48 +0200 Subject: Distributed Applications In-Reply-To: Message-ID: <000001c29a0b$eb51ce80$0100a8c0@home1> >Just to make sure: when you call nodes() in either of the nodes, can you actually see >the name of the other node in the list? Not initialy no. They do connect normally once I use connect tho. This works and I can start up processes on the remote nodes just fine. Both the nodes have the same cookie in the erlang.cookie file. Do I understand the expected behavior correctly: Start node n1 with a boot script that starts (among other things) my distributed app (erlyhack_map_app). Since the second (preferred) node is not yet up, it starts up locally. Start node n2 with the exact same boot script. This attempts to start the distributed app by first notifying the first node to shut the app down. If this is correct, then it must be the node communication that is not set up correctly during bootup of the nodes. Is there a way to force the communication to be set up between nodes after boot that will still cause takeover of distributed apps? >The most common method is net_adm:ping(Node) Ah, thanks :) >No, the only difference between sync_nodes_mandatory and sync_nodes_optional is that >with ..._mandatory, the nodes will wait forever for each other, and with ..._optional, >they will wait for the specified time, and then continue in "single mode". Once in "single mode" the node will not exhibit any distributed behavior? Is there a way to check if a node will cooperate in distributed applications or not? Thanks for the info. Much appreciated. -]-[einrich From etxuwig@REDACTED Mon Dec 2 18:30:27 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 2 Dec 2002 18:30:27 +0100 (MET) Subject: Distributed Applications In-Reply-To: <000101c299d8$9d910db0$0100a8c0@home1> Message-ID: I decided to make my own example and see if I could make it work on my workstation. It worked, but I was once again reminded how much work it is to build a system from scratch. Good grief! Someone really needs to design a tool that takes care of beginners. I've included my toy example, where I've written my own erlyhack_app and erlyhack_map_app (I'm not going to ask where those names came from). The tar file is called dist_ac.tgz just to create some confusion. (: It unpacks into dist_ac/ releases/ 1.0/ hack.boot hack.rel hack.script sys.config lib/ erlyhack_app-0.01.02/ src/ app1.erl server1.erl super1.erl ebin/ erlyhack_app.app ... *.beam erlyhack_map_app-0.01.01/ src/ app2.erl server2.erl super2.erl ebin/ erlyhack_map_app.app ... *.beam I cd:ed into dist_ac/releases/1.0, started an erlang shell and typed Path = ["/home/..../dist_ac/lib/*/ebin"]. systools:make_script("hack", [local, {path, Path}]). Then systools went on and did its thing, creating hack.script and hack.boot files. (A small note: In the sys.config file, you will find the kernel environment variables that you need to set. Instead of hacking the .app file, one writes a .config and identifies it from the command line using -config Filename. You must change the node names in sys.config to be able to run the example.) I then put myself right under dist_ac and started two xterms, and in them I wrote the following commands: erl -sname n1 -boot releases/1.0/hack -config \ releases/1.0/sys erl -sname n2 -boot releases/1.0/hack -config \ releases/1.0/sys Starting n1 first, I got the following output: ... =PROGRESS REPORT==== 2-Dec-2002::18:12:29 === application: sasl started_at: n1@REDACTED server1 starting. =PROGRESS REPORT==== 2-Dec-2002::18:12:29 === supervisor: {local,super1} started: [{pid,<0.53.0>}, {name,server}, {mfa,{server1,start_link,[]}}, {restart_type,permanent}, {shutdown,10000}, {child_type,worker}] =PROGRESS REPORT==== 2-Dec-2002::18:12:29 === application: erlyhack_app started_at: n1@REDACTED server2 starting. =PROGRESS REPORT==== 2-Dec-2002::18:12:29 === supervisor: {local,super2} started: [{pid,<0.58.0>}, {name,server}, {mfa,{server2,start_link,[]}}, {restart_type,permanent}, {shutdown,10000}, {child_type,worker}] =PROGRESS REPORT==== 2-Dec-2002::18:12:29 === application: erlyhack_map_app started_at: n1@REDACTED ******** Then starting n2, I got the following output: =PROGRESS REPORT==== 2-Dec-2002::18:12:36 === application: sasl started_at: n2@REDACTED server1 starting. =PROGRESS REPORT==== 2-Dec-2002::18:12:36 === supervisor: {local,super1} started: [{pid,<0.54.0>}, {name,server}, {mfa,{server1,start_link,[]}}, {restart_type,permanent}, {shutdown,10000}, {child_type,worker}] =PROGRESS REPORT==== 2-Dec-2002::18:12:36 === application: erlyhack_app started_at: n2@REDACTED server2 starting. =PROGRESS REPORT==== 2-Dec-2002::18:12:36 === supervisor: {local,super2} started: [{pid,<0.59.0>}, {name,server}, {mfa,{server2,start_link,[]}}, {restart_type,permanent}, {shutdown,10000}, {child_type,worker}] =PROGRESS REPORT==== 2-Dec-2002::18:12:36 === application: erlyhack_map_app started_at: n2@REDACTED **** and at the same time in n1: =INFO REPORT==== 2-Dec-2002::18:12:36 === application: erlyhack_map_app exited: stopped type: permanent Perhaps you can compare my files with yours and find out what you've done wrong? /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks -------------- next part -------------- A non-text attachment was scrubbed... Name: dist_ac.tgz Type: application/octet-stream Size: 7230 bytes Desc: dist_ac.tgz URL: From hfventer@REDACTED Mon Dec 2 19:34:21 2002 From: hfventer@REDACTED (hfventer) Date: Mon, 2 Dec 2002 20:34:21 +0200 Subject: Distributed Applications In-Reply-To: Message-ID: <000001c29a31$7096ef10$0100a8c0@home1> Thank you for the example code... Things seem a lot less dark now :) I have successfully run the first node on my windows XP box and the second on on my Linux box (twinkle in the eye considering the possabilities) >Perhaps you can compare my files with yours and find out >what you've done wrong? Not sure what the culprit is yet, but off the bat I can spot two major differences. First off my directory structure is different... Actually nonexistant. I had everything in one directory. I know this not "how its done" but I thought that it would not make a difference. Secondly my apps do not have supervisors. This is something that I thougth I would put in later, since I will eventually need the robustness they they promise. I thought to avoid the extra complexity initialy. Not sure which one of these will be the culprit. Will have to toy around with it a bit to form a better understanding. Going to spend the rest of the night reorginising my code base to look more like your example. Its amazing home instuctive a few lines of working code can be :) -]-[einrich From jim@REDACTED Mon Dec 2 21:04:27 2002 From: jim@REDACTED (Jim Larson) Date: Mon, 02 Dec 2002 12:04:27 -0800 Subject: inter-process inlining In-Reply-To: Your message of "Sat, 30 Nov 2002 00:38:08 +0100." Message-ID: <200212022004.gB2K4Rsb015211@krumkake.jetcafe.org> In message you write: > >Just a thought that came to me while driving home. > >The EUC talk "On reducing interprocess overhead >communication in concurrent programs" mentioned the idea of >inlining, where a client process could (in some cases) >directly fetch the server's state and perform the operation >needed without context switching. > >Perhaps it's mentioned somewhere in the paper, but what >happens if there is a bug in the server code, and it >crashes? The paper doesn't appear to mention it. Along the same lines, some runtime mechanism would have to watch for hot-loading of the server's code modules and dynamically "recompile" the client's inlined code. The paper doesn't mention this explicitly, but it does propose an auxiliary process that looks for optimization opportunities in the running system - this could be extended to handle module replacement as well. >Would the normal error indication be simulated even with >inlining, or would there be an entirely different error? You certainly *could* simulate the usual error behavior with inlining - you just have to be careful that the costs of this fidelity don't eliminate the benefits of inlining. Since, presumably, the errors are rare and not performance-critical, a clever implementor could make the non-error case faster at the expense of needing more work to generate the correct error message. Jim Larson jim@REDACTED From Marc.Vanwoerkom@REDACTED Tue Dec 3 05:32:23 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Tue, 3 Dec 2002 05:32:23 +0100 (MET) Subject: [freebsd] new erlang related packages In-Reply-To: <20021116013227.M20684-100000@olgeni.olgeni> (message from Jimmy Olgeni on Sat, 16 Nov 2002 01:35:55 +0100 (CET)) Message-ID: <200212030432.gB34WNf25133@bonsai.fernuni-hagen.de> > I'd try with "erl -sname somename" and using "somename@REDACTED" as > the node name, if you have "remotehost" in your /etc/hosts file. Also > "erl -name somename" and "somename@REDACTED" (numeric address) should > work (but I tried with 127.0.0.1 so it may not actually work...) Sorry, I can't try it out before end of the week. I use a rather fresh -CURRENT by the way. The strange bit here is, that I had no problem with the prior R8B release, only with the R9B one. So I doubt a bit that it is just my network configuration, because that stayed the same. More soon.. Regards, Marc From sureshsaragadam@REDACTED Tue Dec 3 08:53:29 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 3 Dec 2002 07:53:29 +0000 (GMT) Subject: need more info about release handler Message-ID: <20021203075329.48339.qmail@web8201.mail.in.yahoo.com> hi, i need to build a release for an application in erlang, my application in erlang is making use of many other API's and protocols, the release should be unpacked in differnet file location not in OTP, i need to learn more about release handling with examples i am going through SASL doc's where he is talking on release handler, can i get more stuff related to this topic more practical plase help me out with examples if possible thanking u suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From klacke@REDACTED Tue Dec 3 11:10:36 2002 From: klacke@REDACTED (Klacke) Date: Tue, 3 Dec 2002 11:10:36 +0100 Subject: Distributed Applications In-Reply-To: ; from etxuwig@etxb.ericsson.se on Mon, Dec 02, 2002 at 06:30:27PM +0100 References: <000101c299d8$9d910db0$0100a8c0@home1> Message-ID: <20021203111036.B30331@bluetail.com> On Mon, Dec 02, 2002 at 06:30:27PM +0100, Ulf Wiger wrote: > > I decided to make my own example and see if I could make it > work on my workstation. Something like this should exists in the getting started section at www.erlang.org together with Ulf's tar file. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From sureshsaragadam@REDACTED Tue Dec 3 11:21:51 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 3 Dec 2002 10:21:51 +0000 (GMT) Subject: How to build a release for an erlang application Message-ID: <20021203102152.72986.qmail@web8201.mail.in.yahoo.com> hi, I have to build a release for an application in erlang and work on versioning. where can i get good examples what is the best approach now i am seeing sasl docs please help me suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From etxuwig@REDACTED Tue Dec 3 18:17:21 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 3 Dec 2002 18:17:21 +0100 (MET) Subject: need more info about release handler In-Reply-To: <20021203075329.48339.qmail@web8201.mail.in.yahoo.com> Message-ID: On Tue, 3 Dec 2002, Suresh S wrote: >hi, > >i need to build a release for an application in erlang, my >application in erlang is making use of many other API's and >protocols, the release should be unpacked in differnet file >location not in OTP, i need to learn more about release >handling with examples > >i am going through SASL doc's where he is talking on >release handler, > >can i get more stuff related to this topic >more practical > >plase help me out with examples if possible >thanking u > >suresh s My example from 2 Dec, http://www.erlang.org/ml-archive/erlang-questions/200212/msg00009.html might be a starting point. If you want to make the code relocatable, you need to replace the 'local' option in systools:make_script() with { Path = ["/home/..../dist_ac/lib/*/ebin"]. Var = {"MYAPP", "/home/.../dist_ac"}. systools:make_script("hack", [{variables,[Var]}, {path, Path}]). and then, when starting the nodes erl -sname n1 -boot releases/1.0/hack -config \ releases/1.0/sys -boot_var MYAPP /home/.../dist_ac You may then start by running the command systools:make_tar("hack",[{variables,...},{path,...}]). i.e. the same options as for make_script. This will create a tarfile, including everything you need. This tarfile can be unpacked somewhere else with gtar. A more thorough tutorial of this should of course be written. Hopefully, this will get you started. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From svenolof@REDACTED Tue Dec 3 18:23:28 2002 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Tue, 3 Dec 2002 18:23:28 +0100 Subject: inter-process inlining In-Reply-To: <200212022004.gB2K4Rsb015211@krumkake.jetcafe.org> References: <200212022004.gB2K4Rsb015211@krumkake.jetcafe.org> Message-ID: <15852.59536.482701.445528@harpo.it.uu.se> Jim Larson writes: > In message you write: > > > >Just a thought that came to me while driving home. > > > >The EUC talk "On reducing interprocess overhead > >communication in concurrent programs" mentioned the idea of > >inlining, where a client process could (in some cases) > >directly fetch the server's state and perform the operation > >needed without context switching. > > > >Perhaps it's mentioned somewhere in the paper, but what > >happens if there is a bug in the server code, and it > >crashes? > > The paper doesn't appear to mention it. > > Along the same lines, some runtime mechanism would have to watch > for hot-loading of the server's code modules and dynamically > "recompile" the client's inlined code. The paper doesn't mention > this explicitly, but it does propose an auxiliary process that looks > for optimization opportunities in the running system - this could > be extended to handle module replacement as well. > > >Would the normal error indication be simulated even with > >inlining, or would there be an entirely different error? > > You certainly *could* simulate the usual error behavior with inlining > - you just have to be careful that the costs of this fidelity don't > eliminate the benefits of inlining. > > Since, presumably, the errors are rare and not performance-critical, > a clever implementor could make the non-error case faster at the > expense of needing more work to generate the correct error message. The two authors of the paper are unlikely to reply anytime soon due to various personal reasons. I co-authored a paper with Happi which discussed some similar ideas (Workshop on dynamic and adaptive compilation 2000), so perhaps I can help out. First, regarding hot-loading. Before executing any in-lined code the client checks that a) the server's mailbox is empty, and b) that the server is suspended at the right program point. Testing for b is done by checking the program counter. If the server's code has been replaced the program counter will be different, the test will fail and the inlined code will not be executed. About exceptions. (I assume that crash = throw an exception. Are there any other types of crashes that should be considered?) This question is trickier. As far as I know, Happi has not addressed this issue directly. There are two issues that need to be handled. First, the exceptions must somehow be caught, as they cannot be allowed to affect the client process. Second, the exception must be reproduced on the server, either immediately or when the server is scheduled. Note that extracted code (that is, server code executed by the client) must satisfy a number of properties, for example, it must not suspend, and it must terminate. Second, code executed by the client must be modified to allow external execution. In particular, special versions of all bifs are needed. Given that we have full control over which code is inlined and that all this code is rewritten for external execution (using special bifs etc) it should be possible to catch all exceptions. Since we want optimized code to behave 'as if' the optimization hadn't happend, we want the server code to throw the exception it would have thrown originally. If the inlined code does not contain any side-effects, the solution is simple: pretend that the optimization never happend and that the inlined code was never executed. Just leave the server in its current state, insert the message in the mailbox and let the client continue its execution. When the server is scheduled, it will (eventually) throw the exception. If the in-lined code contains side-effects things get slightly more complicated. The simplest solution is to avoid this problem by only inlining code that does not have side-effects (this is probably a very reasonable restriction). If we inline code with side effects, and code following a side-effect throws an exception, one way of reproducing the exception is to put the server in a state corresponding to a point in the program after the side-effect and before the instruction causing the exception. Hope this helps, Sven-Olof From etxuwig@REDACTED Tue Dec 3 18:44:33 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 3 Dec 2002 18:44:33 +0100 (MET) Subject: inter-process inlining In-Reply-To: <15852.59536.482701.445528@harpo.it.uu.se> Message-ID: On Tue, 3 Dec 2002, Sven-Olof Nystr|m wrote: >About exceptions. (I assume that crash = throw an >exception. Are there any other types of crashes that should >be considered?) No... I think. Handling exceptions is probably enough. >This question is trickier. As far as I know, Happi has not >addressed this issue directly. There are two issues that >need to be handled. First, the exceptions must somehow be >caught, as they cannot be allowed to affect the client >process. Second, the exception must be reproduced on the >server, either immediately or when the server is scheduled. If the exception is reproduced later, it must still be so that the server actually acts on that very message (and perhaps this isn't appropriate if other messages have come in to the server during the scheduling delay, since a selective receive might have resulted in a different prioritization of messages then -- unlikely, but...) >Since we want optimized code to behave 'as if' the >optimization hadn't happend, we want the server code to >throw the exception it would have thrown originally. If the >inlined code does not contain any side-effects, the >solution is simple: pretend that the optimization never >happend and that the inlined code was never executed. Just >leave the server in its current state, insert the message >in the mailbox and let the client continue its execution. >When the server is scheduled, it will (eventually) throw >the exception. The most appropriate would perhaps be to schedule the server immediately (see above). Doing it this way would also ensure that the stack chain on the server reflects the situation appropriately. >If the in-lined code contains side-effects things get >slightly more complicated. The simplest solution is to >avoid this problem by only inlining code that does not have >side-effects (this is probably a very reasonable >restriction). Yes, it seems reasonable. >If we inline code with side effects, and code following a >side-effect throws an exception, one way of reproducing the >exception is to put the server in a state corresponding to >a point in the program after the side-effect and before the >instruction causing the exception. Hmm... /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From cyberlync@REDACTED Wed Dec 4 01:56:43 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 3 Dec 2002 16:56:43 -0800 (PST) Subject: appname.app not found Message-ID: <20021204005643.47147.qmail@web40803.mail.yahoo.com> Hello All, Once again I am getting frustrated as all get out here. I use the following (per early conversations) bat file to attempt to compile a *.rel file. C:\erl5.2\bin\erlc -I /ebin -o . appname.rel No matter what I do it always comes back 'file now found: appname.app'. I can use the systools:make_script command from the shell and get the same result wehter I supply a path argument or not. I hope one of you have an idea as to what this might be. Thanks, Eric __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From sureshsaragadam@REDACTED Wed Dec 4 06:57:51 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Wed, 4 Dec 2002 05:57:51 +0000 (GMT) Subject: need more info about release handler In-Reply-To: Message-ID: <20021204055751.23954.qmail@web8206.mail.in.yahoo.com> http://www.erlang.org/ml-archive/erlang-questions/200212/msg00009.html > > might be a starting point. > > If you want to make the code relocatable, you need > to > replace the 'local' option in systools:make_script() > with { > > > Path = ["/home/..../dist_ac/lib/*/ebin"]. > Var = {"MYAPP", "/home/.../dist_ac"}. > systools:make_script("hack", [{variables,[Var]}, > {path, Path}]). > > and then, when starting the nodes > > erl -sname n1 -boot releases/1.0/hack -config \ > releases/1.0/sys -boot_var MYAPP /home/.../dist_ac > > > You may then start by running the command > > systools:make_tar("hack",[{variables,...},{path,...}]). > > i.e. the same options as for make_script. This will > create a > tarfile, including everything you need. This tarfile > can be > unpacked somewhere else with gtar. > > A more thorough tutorial of this should of course be > written. Hopefully, this will get you started. > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class > Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice > Networks > hi Ulf Wiger, u have done a good job, which helps many beginers, more over this suits my reqirement exactly, this ref example should work in my system , regards suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From enewhuis@REDACTED Wed Dec 4 15:16:10 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 4 Dec 2002 08:16:10 -0600 Subject: Practical Binary Pattern Matching Message-ID: <000f01c29b9f$b1d5a830$55c3cf0a@XENO> I am attempting to parse a byte stream with variable-length records that consist of attribute-value pairs and my code looks like this: parseElements (Body) -> case Body of <> -> case Rest of <> -> out (Attribute, valueOf (Attribute, Raw)); <> -> out (Attribute, valueOf (Attribute, Raw)), parseElements (Rest) end; <> -> case Rest of <> -> out (Attribute, valueOf (Attribute, Raw)); <> -> out (Attribute, valueOf (Attribute, Raw)), parseElements (Rest) end end. I've have nested binary pattern matching and I suspect that leads to inefficiencies due to the fact that I must pattern-match more than once for each record. Is there an easier way to do this? Like this? <> -> ... Where Rest can match <<>> and Length can be used with Raw:Length before it is bound? Or maybe there is some other simplification I have overlooked. Or maybe this is fast enough for my application? I don't know yet. Sincerely, Eric Newhuis From bjarne@REDACTED Wed Dec 4 15:33:35 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Wed, 04 Dec 2002 15:33:35 +0100 Subject: Pictures from Pittsburgh References: <15843.13417.805424.738870@antilipe.corelatus.se> Message-ID: <3DEE123F.A2FAC426@erix.ericsson.se> Hello For those interested. There are now pictures from the ACM SIGPLAN Erlang Workshop in Pittsburgh on October 7 available on the net at http://www.erlang.se/workshop/2002/photo/ They can also be reached from the workshop home page at http://www.erlang.se/workshop/2002/ Best regards Bjarne From pascal.brisset-ml@REDACTED Wed Dec 4 16:20:29 2002 From: pascal.brisset-ml@REDACTED (Pascal Brisset) Date: Wed, 4 Dec 2002 16:20:29 +0100 Subject: Practical Binary Pattern Matching In-Reply-To: <000f01c29b9f$b1d5a830$55c3cf0a@XENO> References: <000f01c29b9f$b1d5a830$55c3cf0a@XENO> Message-ID: <3DEE017F0001672A@mel-rta10.wanadoo.fr> (added by postmaster@wanadoo.fr) Eric Newhuis writes: > < Raw:Length/binary, Rest/binary>> -> ... For some reason this is supported in the Erlang shell but not in compiled modules. Here is a quick hack which removes this limitation. We are using it to compile an application with lots of <> patterns. Hopefully this functionality will be added properly in a future release. -- Pascal Brisset [pascal.brisset@REDACTED] -- -- Cellicium | 157 r des Blains | F-92220 Bagneux -- diff -aur otp_src_P9-20020302-SNAPSHOT.orig/lib/compiler/src/v3_kernel.erl otp_src_P9-20020302-SNAPSHOT/lib/compiler/src/v3_kernel.erl --- otp_src_P9-20020302-SNAPSHOT.orig/lib/compiler/src/v3_kernel.erl Mon Nov 12 15:02:43 2001 +++ otp_src_P9-20020302-SNAPSHOT/lib/compiler/src/v3_kernel.erl Mon Mar 4 12:55:12 2002 @@ -1046,26 +1046,45 @@ %% aliases as well. match_clause([U|Us], T, Cs0, Def, St0) -> - {Match,Vs,St1} = get_match(get_con(Cs0), St0), + %% FIXME: Not really sure how to get the substitution from Cs0. + BinSub = case Cs0 of + [#iclause{sub=BinSub_} | _] -> BinSub_; + _ -> [] + end, + {Match,Vs,St1} = get_match(BinSub, get_con(Cs0), St0), {Cs1,St2} = new_clauses(Cs0, U, St1), {B,St3} = match(Vs ++ Us, Cs1, Def, St2), {#k_val_clause{val=Match,body=B},St3}. get_con([C|Cs]) -> arg_arg(clause_arg(C)). %Get the constructor -get_match(#k_cons{}, St0) -> +get_match(BinSub, #k_cons{}, St0) -> {[H,T],St1} = new_vars(2, St0), {#k_cons{hd=H,tl=T},[H,T],St1}; -get_match(M=#k_binary{}, St0) -> +get_match(BinSub, M=#k_binary{}, St0) -> {[V]=Mes,St1} = new_vars(1, St0), {#k_binary{segs=V},Mes,St1}; -get_match(#k_bin_seg{}=Seg, St0) -> +get_match(BinSub, #k_bin_seg{}=Seg, St0) -> {[S,N]=Mes,St1} = new_vars(2, St0), - {Seg#k_bin_seg{seg=S,next=N},Mes,St1}; -get_match(#k_tuple{es=Es}, St0) -> + %% Substitute the size if it is a var from a previous bin segment. + case Seg#k_bin_seg.size of + #k_var{name=SizeName}=Size -> + case lists:keysearch(SizeName, 1, BinSub) of + {value,{_,SizeName1}} -> + io:format("** Using the result of a previous pattern " + "in size=~p (experimental)~n", [SizeName]), + Size1 = Size#k_var{name=SizeName1}, + {Seg#k_bin_seg{size=Size1,seg=S,next=N},Mes,St1}; + _ -> + {Seg#k_bin_seg{seg=S,next=N},Mes,St1} + end; + _ -> + {Seg#k_bin_seg{seg=S,next=N},Mes,St1} + end; +get_match(BinSub, #k_tuple{es=Es}, St0) -> {Mes,St1} = new_vars(length(Es), St0), {#k_tuple{es=Mes},Mes,St1}; -get_match(M, St) -> +get_match(BinSub, M, St) -> {M,[],St}. new_clauses(Cs0, U, St) -> diff -aur otp_src_P9-20020302-SNAPSHOT.orig/lib/stdlib/src/erl_lint.erl otp_src_P9-20020302-SNAPSHOT/lib/stdlib/src/erl_lint.erl --- otp_src_P9-20020302-SNAPSHOT.orig/lib/stdlib/src/erl_lint.erl Thu Dec 20 13:28:41 2001 +++ otp_src_P9-20020302-SNAPSHOT/lib/stdlib/src/erl_lint.erl Mon Mar 4 09:52:08 2002 @@ -1549,7 +1549,10 @@ {[{V,{bound,binsize}}], add_warning(Line, {exported_var,V,From}, St)}; error -> - {[{V,{bound,used}}],add_error(Line, {unbound_var,V}, St)} + io:format("** Ignoring unbound variable ~p at line ~p in order" + " to allow extended bin patterns." + " Please fix erl_lint.~n", [V,Line]), + {[{V,{bound,used}}],St} end. %% expr_var(Variable, LineNo, VarTable, State) -> From eduardo@REDACTED Thu Dec 5 12:51:13 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Thu, 5 Dec 2002 12:51:13 +0100 Subject: Ultraedit & Erlang Message-ID: <005501c29c54$9f1c67a0$0200a8c0@design> Thank you for your responses. I'm using Windows OS and Ultraedit Editor to develop in Erlang. Ultraedit has a Wordfile.txt file where keywords for a lot of languages can be declared. Has anyone used Ultraedit editor tool or a better tool ? Which language is the most similar to Erlang syntax ? Lisp ? Thanks again Eduardo Figoli INswitch Solutions. -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Wed Dec 4 19:05:11 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 04 Dec 2002 23:05:11 +0500 (YEKT) Subject: Ultraedit & Erlang In-Reply-To: <005501c29c54$9f1c67a0$0200a8c0@design> References: <005501c29c54$9f1c67a0$0200a8c0@design> Message-ID: <20021204.230511.78708250.svg@surnet.ru> Good day, eduardo> Which language is the most similar to Erlang syntax ? Lisp ? Erlang syntax is mostly similar to Prolog. eduardo> Has anyone used Ultraedit editor tool or a better tool ? Erlang mode for Emacs provides an extensive support for Erlang coding. Look at `lib/tools-2.1/emacs/erlang.el' file in your distribution. The very interesting and useful package for Erlang-node<->Emacs interaction is Distel of Luke Gorrie - http://www.bluetail.com/~luke/distel/ Best Regards, Vladimir Sekissov eduardo> eduardo> Thank you for your responses. eduardo> eduardo> I'm using Windows OS and Ultraedit Editor to develop in Erlang. eduardo> Ultraedit has a Wordfile.txt file where keywords for a lot of languages can be declared. eduardo> Has anyone used Ultraedit editor tool or a better tool ? eduardo> Which language is the most similar to Erlang syntax ? Lisp ? eduardo> eduardo> eduardo> Thanks again eduardo> Eduardo Figoli eduardo> INswitch Solutions. eduardo> eduardo> eduardo> From cyberlync@REDACTED Wed Dec 4 20:09:23 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 4 Dec 2002 11:09:23 -0800 (PST) Subject: appname.app not found In-Reply-To: <20021204005643.47147.qmail@web40803.mail.yahoo.com> Message-ID: <20021204190923.29617.qmail@web40806.mail.yahoo.com> Ok guys, I have done a bit more tinkering and come to a few more concise results. I know that the path is correct, I can call modules from the shell that are in the same directory as the *.app file. What other choices are there? Are there any other reasons this error would be given. Possible other cuases? Any help would be appreciated. Thanks, Eric --- Eric Merritt wrote: > Hello All, > > Once again I am getting frustrated as all get out > here. I use the following (per early conversations) > bat file to attempt to compile a *.rel file. > > C:\erl5.2\bin\erlc -I /ebin -o . appname.rel > > No matter what I do it always comes back 'file now > found: appname.app'. I can use the > systools:make_script command from the shell and get > the same result wehter I supply a path argument or > not. I hope one of you have an idea as to what this > might be. > > Thanks, > Eric > > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > http://mailplus.yahoo.com __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From eduardo@REDACTED Thu Dec 5 18:05:03 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Thu, 5 Dec 2002 18:05:03 +0100 Subject: Node name and host name Message-ID: <000e01c29c80$74f119e0$1e00a8c0@design> I have started erl -sname ef in hostname machine and I've got the prompt 1> . Then, on another machine hostname2 I've executed monitor_node('ef@REDACTED', true). function but it fails. Does anyone know what is wrong ? What I want to do is to use a node remotely. Thanks in advance. Eduardo Figoli -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Thu Dec 5 18:40:26 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Thu, 5 Dec 2002 18:40:26 +0100 Subject: Node Message-ID: <001b01c29c85$6611c820$1e00a8c0@design> I get the monitor_node function work. I have executed succesfully a function remotely but I have received an error on the machine where the function it is loaded: ** Connection attempt from disallowed node bar@REDACTED ** What does this message mean ? Thank you again Eduardo Figoli INswitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Thu Dec 5 01:11:10 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 05 Dec 2002 05:11:10 +0500 (YEKT) Subject: Node name and host name In-Reply-To: <000e01c29c80$74f119e0$1e00a8c0@design> References: <000e01c29c80$74f119e0$1e00a8c0@design> Message-ID: <20021205.051110.112626875.svg@surnet.ru> Good day, Do your nodes use the same cookie? If they do then may be hosts don't know each other by short name. You can add short name for its IP to your local /etc/hosts(on unix) or create file `.hosts.erlang' in your home directory and then call `net_adm:world()' before to make nodes known. Look at detailed explanation in `net_adm' documentation. Best Regards, Vladimir Sekissov eduardo> I have started erl -sname ef in hostname machine and eduardo> I've got the prompt 1> . eduardo> Then, on another machine hostname2 I've executed monitor_node('ef@REDACTED', true). function but it fails. eduardo> eduardo> Does anyone know what is wrong ? eduardo> What I want to do is to use a node remotely. eduardo> eduardo> eduardo> Thanks in advance. eduardo> Eduardo Figoli eduardo> eduardo> From DANIESC.SCHUTTE@REDACTED Thu Dec 5 07:42:17 2002 From: DANIESC.SCHUTTE@REDACTED (DANIESC SCHUTTE) Date: Thu, 05 Dec 2002 08:42:17 +0200 Subject: UltraEdit & Erlang Message-ID: Morning all, Firstly - I wish to express my gratitude to all the people who frequently help with all the questions. We use UltraEdit (and we have got the UltraEdit wordfile for it if you want it) and the Open From FTP, FTP Save As functions :) makes it A BRILLIANT TOOL for our previouslyunix deprived individuals who are shying away from Emacs and Vi editors but still need erlang apps on Solaris/Unix/Linux. Regards Danie Schutte Danie Schutte Phone: +27 - 11 - 203 - 1613 Mobile: 084-468-3138 e-Mail: Daniesc@REDACTED ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy and copies. ##################################################################################### -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: TEXT.htm URL: From Chandrashekhar.Mullaparthi@REDACTED Thu Dec 5 12:04:04 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 5 Dec 2002 11:04:04 -0000 Subject: appname.app not found Message-ID: <04D356A3B172D611981B0008C791C312404EE4@imp02mbx.t-mobile.co.uk> Eric, You application directory name should be appname-vsn - do you have it setup like this? Can you post your rel file and a directory listing? cheers Chandru -----Original Message----- From: Eric Merritt [mailto:cyberlync@REDACTED] Sent: 04 December 2002 19:09 To: erlang-questions@REDACTED Subject: Re: appname.app not found Ok guys, I have done a bit more tinkering and come to a few more concise results. I know that the path is correct, I can call modules from the shell that are in the same directory as the *.app file. What other choices are there? Are there any other reasons this error would be given. Possible other cuases? Any help would be appreciated. Thanks, Eric --- Eric Merritt wrote: > Hello All, > > Once again I am getting frustrated as all get out > here. I use the following (per early conversations) > bat file to attempt to compile a *.rel file. > > C:\erl5.2\bin\erlc -I /ebin -o . appname.rel > > No matter what I do it always comes back 'file now > found: appname.app'. I can use the > systools:make_script command from the shell and get > the same result wehter I supply a path argument or > not. I hope one of you have an idea as to what this > might be. > > Thanks, > Eric 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 Dec 5 12:10:30 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 5 Dec 2002 11:10:30 -0000 Subject: Node Message-ID: <04D356A3B172D611981B0008C791C312404EE5@imp02mbx.t-mobile.co.uk> This means the nodes which are trying to communicate dont have the same cookie. You can check the cookie using erlang:get_cookie(). in the erlang shell. If you are using erlang R9B, you can set the cookie in the shell using erlang:set_cookie(node(), your_cookie). hth Chandru -----Original Message----- From: Eduardo Figoli [mailto:eduardo@REDACTED] Sent: 05 December 2002 17:40 To: erlang-questions@REDACTED Subject: Node I get the monitor_node function work. I have executed succesfully a function remotely but I have received an error on the machine where the function it is loaded: ** Connection attempt from disallowed node bar@REDACTED ** What does this message mean ? Thank you again Eduardo Figoli INswitch Solutions 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 svenolof@REDACTED Thu Dec 5 16:58:27 2002 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Thu, 5 Dec 2002 16:58:27 +0100 Subject: inter-process inlining In-Reply-To: References: <15852.59536.482701.445528@harpo.it.uu.se> Message-ID: <15855.30627.512391.997256@harpo.it.uu.se> Ulf Wiger writes: (Exceptions) > >This question is trickier. As far as I know, Happi has not > >addressed this issue directly. There are two issues that > >need to be handled. First, the exceptions must somehow be > >caught, as they cannot be allowed to affect the client > >process. Second, the exception must be reproduced on the > >server, either immediately or when the server is scheduled. > > If the exception is reproduced later, it must still be so > that the server actually acts on that very message (and > perhaps this isn't appropriate if other messages have come > in to the server during the scheduling delay, since a > selective receive might have resulted in a different > prioritization of messages then -- unlikely, but...) > > >Since we want optimized code to behave 'as if' the > >optimization hadn't happened, we want the server code to > >throw the exception it would have thrown originally. If the > >inlined code does not contain any side-effects, the > >solution is simple: pretend that the optimization never > >happened and that the inlined code was never executed. Just > >leave the server in its current state, insert the message > >in the mailbox and let the client continue its execution. > >When the server is scheduled, it will (eventually) throw > >the exception. > > The most appropriate would perhaps be to schedule the server > immediately (see above). Doing it this way would also ensure > that the stack chain on the server reflects the situation > appropriately. I don't think that's necessary. Consider the scenario: The client wants to send a message to the server. Due to profiling and optimization the client instead starts running inlined code from the server. Now, the server code throws an exception. Since exceptions should be rare, we do not want to invest much effort into handling this situation. Instead, the client discards any intermediate results it may have computed while running server code, inserts the message into the server's mailbox, and continues running its own code. As far as I can see the situation is indistinguishable from what we would have in unoptimized code: a) The client is running some code following the send. b) The server is suspended on a receive. c) The server's mailbox contains a message from the client. d) Since scheduling is under software control, none of the other processes have been scheduled during the interval. As far as I can see, this guarantees that the state is 'as if' the optimization had never happened. It could happen that some other process later sneaks in a message that prevents the server from seeing the client's message (due to matching receive), causing history to enter an entirely different path... But note that the two behaviors (the server seeing a message that causes an exception, or another message being read first) are possible in an unoptimized Erlang implementation, depending on scheduling strategy, so the optimization hasn't really changed anything. > >If the in-lined code contains side-effects things get > >slightly more complicated. The simplest solution is to > >avoid this problem by only inlining code that does not have > >side-effects (this is probably a very reasonable > >restriction). > > Yes, it seems reasonable. Yes, it's probably a good idea to restrict the optimization to side-effect free code. I'm sure it's possible to handle the general case, but it may not be worth the trouble. > >If we inline code with side effects, and code following a > >side-effect throws an exception, one way of reproducing the > >exception is to put the server in a state corresponding to > >a point in the program after the side-effect and before the > >instruction causing the exception. > > Hmm... Sven-Olof Nystr?m From etxuwig@REDACTED Thu Dec 5 17:04:36 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 5 Dec 2002 17:04:36 +0100 (MET) Subject: inter-process inlining In-Reply-To: <15855.30627.512391.997256@harpo.it.uu.se> Message-ID: On Thu, 5 Dec 2002, Sven-Olof Nystr|m wrote: >Ulf Wiger writes: > > The most appropriate would perhaps be to schedule the server > > immediately (see above). Doing it this way would also ensure > > that the stack chain on the server reflects the situation > > appropriately. > >I don't think that's necessary. Consider the scenario: The >client wants to send a message to the server. Due to >profiling and optimization the client instead starts >running inlined code from the server. Now, the server code >throws an exception. Since exceptions should be rare, we do >not want to invest much effort into handling this >situation. Instead, the client discards any intermediate >results it may have computed while running server code, >inserts the message into the server's mailbox, and >continues running its own code. As far as I can see the >situation is indistinguishable from what we would have in >unoptimized code: True, apart from the fact (which may be of mere philosophical value) that the exception that occured during evaluation of the inlined code (which probably is a real error that we'd like to fix) may not appear at all when the operation is "re-scheduled". Essentially, we may have a timing bug that gets a second chance of slipping through our fingers. I'm not sure I'd like that issue to stand in the way of a perfectly good optimization. ;) /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From thomasl_4711@REDACTED Thu Dec 5 17:20:16 2002 From: thomasl_4711@REDACTED (Thomas Lindgren) Date: Thu, 5 Dec 2002 08:20:16 -0800 (PST) Subject: interprocess inlining Message-ID: <20021205162016.3627.qmail@web14913.mail.yahoo.com> > [exceptions in another process] There is another book keeping issue as well: primitives such as self(), process dictionary, etc. must be changed while you are executing the code of the other process. Likewise with the set of links, monitors, and possibly other things. (Alternatively, you can restrict yourself to not inlining such code.) Second: it seems that the restriction that A may not suspend while executing code from B is fairly draconian: you can't, in principle, make a procedure call inside the inlined code (p.5, top) since that increments the reduction counter in ordinary BEAM. Or am I missing something? Third: another interesting issue, if we want to handle more complex scenarios, is how to handle chained sends: - A sends to B - B sends to C - C sends to D (perhaps C or D are really A; perhaps we suspend in code belonging to C; etc.) The paper[*] doesn't mention this issue, though it seems technically to be permitted. (It should be said I haven't read it closely.) -- Thomas [*] The same idea also seems to appear in the following paper, which Sven-Olof mentions; at least the difference is not obvious at a cursory read. Yet the EUC'02 paper doesn't cite the earlier paper? Perhaps someone can clarify? E. Johansson, S.-O. Nystr?m. Profile-guided optimization across process boundaries . In ACM SIGPLAN Workshop on Dynamic and Adaptive Compilation (Dynamo'00). Jan 18, 2000. __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From spearce@REDACTED Thu Dec 5 18:02:08 2002 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 5 Dec 2002 12:02:08 -0500 Subject: interprocess inlining In-Reply-To: <20021205162016.3627.qmail@web14913.mail.yahoo.com> References: <20021205162016.3627.qmail@web14913.mail.yahoo.com> Message-ID: <20021205170208.GA32600@spearce.org> Thomas Lindgren wrote: > Third: another interesting issue, if we want to handle > more complex scenarios, is how to handle chained > sends: > > - A sends to B > - B sends to C > - C sends to D This is the more interesting case to me. Sometimes a server is built to just proxy messages to another process, after perhaps a very mild reformatting. If the last meaningful op that a server does is a message send, and it doesn't do any function calls except the tail recursion to go back to receive, it might be nice to inline this just to improve latency. server(State) -> receive {request, Payload} -> Pid = State#mystate.target, Pid ! {dowork, Payload, self()}, server(State) end. -- Shawn. From etxuwig@REDACTED Thu Dec 5 18:11:21 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 5 Dec 2002 18:11:21 +0100 (MET) Subject: interprocess inlining In-Reply-To: <20021205170208.GA32600@spearce.org> Message-ID: On Thu, 5 Dec 2002, Shawn Pearce wrote: >Thomas Lindgren wrote: >> Third: another interesting issue, if we want to handle >> more complex scenarios, is how to handle chained >> sends: >> >> - A sends to B >> - B sends to C >> - C sends to D > >This is the more interesting case to me. Sometimes a >server is built to just proxy messages to another >process, after perhaps a very mild reformatting. > >If the last meaningful op that a server does is >a message send, and it doesn't do any function calls >except the tail recursion to go back to receive, >it might be nice to inline this just to improve >latency. > >server(State) -> > receive > {request, Payload} -> > Pid = State#mystate.target, > Pid ! {dowork, Payload, self()}, > server(State) > end. Indeed. It could be one of the steps towards really using lots of simple processes rather than a few complicated ones. I believe it could make for much more readable code in the end. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From etxuwig@REDACTED Thu Dec 5 18:18:46 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 5 Dec 2002 18:18:46 +0100 (MET) Subject: Tutorial package: how to build an OTP system Message-ID: I have made a slightly more ambitious tutorial of how to build a system from scratch. It's fairly similar to my previous example, but I tried to make it a little more interesting(*). I wrote a small HTML file (index.html) that covers the different steps. Perhaps someone could put this up on a public web site (e.g. erlang.org), if you find it useful? The "interesting" part is a distributed application that uses start phases and the global name server, and implements smooth takeover of state. It's actually quite tricky to do this right, and you're all welcome to try and punch holes into my example, if you find that it actually isn't safe. It's not a whole lot of code (some 30 lines), but there are several opportunities to go wrong. Anyone with more time is also welcome to make the HTML file more visually appealing. (: Anyone with a lot more time might follow up with a tutorial that shows how a live upgrade would be done. (: (: Another follow-up tutorial would be to make the system into an embedded system. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks -------------- next part -------------- A non-text attachment was scrubbed... Name: release_tutorial.tgz Type: application/octet-stream Size: 17375 bytes Desc: release_tutorial.tgz URL: From Sean.Hinde@REDACTED Thu Dec 5 18:20:32 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 5 Dec 2002 17:20:32 -0000 Subject: interprocess inlining Message-ID: <04D356A3B172D611981B0008C791C3126BF5DD@imp02mbx.t-mobile.co.uk> > Indeed. It could be one of the steps towards really using > lots of simple processes rather than a few complicated ones. > I believe it could make for much more readable code in the > end. I sense the introduction of Java style hunting through dozens of source code files just to find the 3 lines of code which do the actual work ;) 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 spearce@REDACTED Thu Dec 5 18:20:41 2002 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 5 Dec 2002 12:20:41 -0500 Subject: interprocess inlining In-Reply-To: References: <20021205170208.GA32600@spearce.org> Message-ID: <20021205172041.GB32600@spearce.org> Ulf Wiger wrote: > Indeed. It could be one of the steps towards really using > lots of simple processes rather than a few complicated ones. > I believe it could make for much more readable code in the > end. Unfortunately, when I do program Erlang, this is how I program in it. :-) Message passing probably dominates most of my runtime cost. Worse though is I'm stuck in Java at work 99.99999% of the time. :-( -- Shawn. From spearce@REDACTED Thu Dec 5 18:24:22 2002 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 5 Dec 2002 12:24:22 -0500 Subject: interprocess inlining In-Reply-To: <04D356A3B172D611981B0008C791C3126BF5DD@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF5DD@imp02mbx.t-mobile.co.uk> Message-ID: <20021205172422.GC32600@spearce.org> Sean Hinde wrote: > > Indeed. It could be one of the steps towards really using > > lots of simple processes rather than a few complicated ones. > > I believe it could make for much more readable code in the > > end. > > I sense the introduction of Java style hunting through dozens of source code > files just to find the 3 lines of code which do the actual work ;) Doesn't that improve job security though? ;-) Its the object oriented style of programming. And it drives me nuts too. But I often have these little proxy servers because I need/want to keep state about what is going on as data passes through the module, but don't want to resort to the process dictionary or a seperate state server which must also receive the message to update the state. Indeed we could already program in the java style right now by creating lots of simple little modules calling each other. Sort of like creating a module to handle all sends to a process, rather than just doing Server ! {command, go, data} when necessary. :) -- Shawn. From erlang@REDACTED Fri Dec 6 16:16:26 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Fri, 6 Dec 2002 16:16:26 +0100 Subject: Design phase in Erlang Message-ID: <00a001c29d3a$72e6af60$1e00a8c0@design> Erlang Devs, I have a procces in machine M1 which receives requests to run a state machine which I called "service". N clients send a request to machine M1 to execute the service. >From the Erlang point of view, is it a good design to have a process for each client request (N processes) ? Viewing it from another way, the service has the same code (logic) for each client but different instances for each client (the states). Though, could be better to have those states for every client saved in some kind of structure and use the same code for every client by messages and recursion usage ( only 1 process) ? N times reentrant code vs N processes. It'd be harder to implement but I don't know how Erlang manages the N processes (N same execution routines) in memory when a huge number of processes are running. I'd greatly appreciate some feedback about this. Thanks, Eduardo Figoli INswitch solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Thu Dec 5 21:07:58 2002 From: vances@REDACTED (Vance Shipley) Date: Thu, 5 Dec 2002 15:07:58 -0500 Subject: Maximum number of processes Message-ID: <20021205200758.GJ5821@frogman.motivity.ca> Looking at Kenneth Lundin's slides from his presentation on the R9 Release at the recent EUC I came across the following statement: "The maximum number of Erlang processes within one Erlang node is increased to 2^18 -1 = 262143, previously the limit was 32768. To enable the higher limit the +P flag must be used when Erlang is started." I can't find any mention of this in the release notes for R9B-0. I do see that the +P flag is documented though: +P Number Sets the maximum number of concurrent processes for this system. By default this value is 32768. The Number must be in the range [16, 262144]. This is very good news indeed. I do wonder why it wasn't mentioned though. -Vance From svg@REDACTED Thu Dec 5 21:34:46 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 06 Dec 2002 01:34:46 +0500 (YEKT) Subject: Design phase in Erlang In-Reply-To: <00a001c29d3a$72e6af60$1e00a8c0@design> References: <00a001c29d3a$72e6af60$1e00a8c0@design> Message-ID: <20021206.013446.74724634.svg@surnet.ru> Good day, The following documents could give you the picture of Erlang process creation and message passing cost in comparison with other languages: http://www.sics.se/~joe/ericsson/du98024.html http://www.sics.se/~joe/talks/ll2_2002.pdf Best Regards, Vladimir Sekissov erlang> I have a procces in machine M1 which receives requests to run a state machine which I called "service". erlang> N clients send a request to machine M1 to execute the service. erlang> erlang> >From the Erlang point of view, is it a good design to have a process for each client request (N processes) ? erlang> erlang> Viewing it from another way, the service has the same code (logic) for each client but different instances for each client (the states). erlang> Though, could be better to have those states for every client saved in some kind of structure and use the same code for every client by messages and recursion usage ( only 1 process) ? N times reentrant code vs N processes. erlang> It'd be harder to implement but I don't know how Erlang manages the N processes (N same execution routines) in memory when a huge number of processes are running. erlang> erlang> I'd greatly appreciate some feedback about this. erlang> erlang> Thanks, erlang> Eduardo Figoli erlang> INswitch solutions erlang> erlang> erlang> erlang> From martin@REDACTED Fri Dec 6 00:15:19 2002 From: martin@REDACTED (martin j logan) Date: 05 Dec 2002 17:15:19 -0600 Subject: Design phase in Erlang In-Reply-To: <00a001c29d3a$72e6af60$1e00a8c0@design> References: <00a001c29d3a$72e6af60$1e00a8c0@design> Message-ID: <1039130125.6149.35.camel@berimbau> Eduardo, I think that one of the things that takes the longest to come to grips with when learning erlang is that a process is EXTREMELY lightweight. It takes only a scant few microseconds to spawn one. This fact and a few others, efficient messaging and no shared data, make it possible to really program with concurrency in mind. You should thus endeavor to model your problems in erlang with processes as the primary abstraction. The rule set forth by one of the "erlang guru's", I'm not sure who, is one process per truly concurrent activity in your system. By adhering this paradigm it is possible to elegantly reflect a problem with your code. As always "make it work, make it beautiful, make it fast(if you really have to)". So my advice in a nut-shell use a process per client request because that seems to be the correct granularity for modeling your problem. This will make your code infinitely more readable and maintainable than a "preemptively fast" single process approach. After doing so if you don't get the performance that you need, go ahead and re-factor the code. Cheers, Martin On Fri, 2002-12-06 at 09:16, Inswitch Solutions - Erlang Evaluation wrote: > Erlang Devs, > > I have a procces in machine M1 which receives requests to run a state machine which I called "service". > N clients send a request to machine M1 to execute the service. > > From the Erlang point of view, is it a good design to have a process for each client request (N processes) ? > > Viewing it from another way, the service has the same code (logic) for each client but different instances for each client (the states). > Though, could be better to have those states for every client saved in some kind of structure and use the same code for every client by messages and recursion usage ( only 1 process) ? N times reentrant code vs N processes. > It'd be harder to implement but I don't know how Erlang manages the N processes (N same execution routines) in memory when a huge number of processes are running. > > I'd greatly appreciate some feedback about this. > > Thanks, > Eduardo Figoli > INswitch solutions > > > From cpressey@REDACTED Fri Dec 6 04:07:03 2002 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 5 Dec 2002 21:07:03 -0600 Subject: appname.app not found In-Reply-To: <20021204190923.29617.qmail@web40806.mail.yahoo.com> References: <20021204005643.47147.qmail@web40803.mail.yahoo.com> <20021204190923.29617.qmail@web40806.mail.yahoo.com> Message-ID: <20021205210703.26477a07.cpressey@catseye.mb.ca> On Wed, 4 Dec 2002 11:09:23 -0800 (PST) Eric Merritt wrote: > Ok guys, > > I have done a bit more tinkering and come to a few > more concise results. I know that the path is correct, > I can call modules from the shell that are in the same > directory as the *.app file. > > What other choices are there? Are there any other > reasons this error would be given. Possible other > cuases? Any help would be appreciated. Is it possible you have a directory in the path with a space in it's filename? IIRC erlc has had problems with this under Windows. Especially since it's installed under "Program Files" by default. I used to have major problems with it (couldn't get it to display any warnings, or errors, even) until I installed R9 as E:\erl5.2 . Now it seems to work much more sanely... -Chris From DANIESC.SCHUTTE@REDACTED Fri Dec 6 08:31:18 2002 From: DANIESC.SCHUTTE@REDACTED (DANIESC SCHUTTE) Date: Fri, 06 Dec 2002 09:31:18 +0200 Subject: A tricky "Can I create a virtual IP grabbing Erlang Solution Or Is There an Easier Way Message-ID: Morning all, this morning I'm asking, a hopefully trivial question, about making a system more robust, and the more I see from Erlang, the more I am impressed. I have the following scenario, I have EXTERNAL clients, connecting to a specific IP and Port and an Erlang Server managing the connections and requests. Unfortuanately the External clients are stupid and can NOT change the IP they connect to when that box fails. Is there a way of creating a "virtual ip address" to which external clients can connect, but which is handled and failed over between / among erlang nodes as there are multiple nodes available for processing? Or is the only solution a server cluster with hardware failover? Regards Danie Schutte Danie Schutte Phone: +27 - 11 - 203 - 1613 Mobile: 084-468-3138 e-Mail: Daniesc@REDACTED ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy and copies. ##################################################################################### -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: TEXT.htm URL: From cpressey@REDACTED Fri Dec 6 04:01:00 2002 From: cpressey@REDACTED (Chris Pressey) Date: Thu, 5 Dec 2002 21:01:00 -0600 Subject: random thoughts on language design etc. In-Reply-To: References: Message-ID: <20021205210100.3ee76856.cpressey@catseye.mb.ca> n Fri, 22 Nov 2002 09:29:55 -0600 James Hague wrote: > >I think it would be great to loosen the > >restrictions a bit and be able to > >use arbitrary boolean functions in guards. > > I think this changes the language in such a dramatic way that there's > not much point in discussing it :) >From an implementation standpoint, it could be a pain, granted. But I think it has a minimal impact on the *language* - the resulting language would be a proper superset of Erlang, since guards are semantically equivalent to boolean functions. Consider: case module:something(Whatever) of {A, B} when ets:lookup(mytable, B) == [{B, something}] -> 50; {C, D, E} when funky:test1(E) > funky:test2(D) -> 100; _ -> 0 end. Is the equivalent of: case module:something(Whatever) of {A, B} -> case ets:lookup(mytable, B) == [{B, something}] of true -> 50; false -> 0 end; {C, D, E} -> case funky:test1(E) > funky:test2(D) of true -> 100; false -> 0 end; _ -> 0 end Admittedly, a rather hairy parse transform, but I dare suggest it's within the bounds of doable. The benefits would be great from a readability / maintenance standpoint IMHO, which (also IMHO) is probably the single most important metric for judging what makes code, *good* code - assuming you don't have critical performance limits to adhere to via hand optimization. One might make the argument that Erlang is a language exclusively for soft real-time applications, and thus should shun all improvements except those that directly correspond to performance and expediency, but the fact that the compiler (hardly a real-time application) is written in Erlang would seem to be a precedent that contradicts that notion :) > My feeling is that all other Erlang changes should be put on hold until > something is done to improve records. Wow, is it ugly to have use > -include directives, especially without any guarantees that different > modules are compiled with the same record definitions. It's like C > externs all over again. I know abstract syntax patterns didn't work > out, but surely there's_something_ that would make a good alternative? > I remember seeing mention of a simple, dynamic record system for Erlang > somewhere, but I haven't been able to locate it. I can't think of anything simpler or more dynamic than the 'dict' module. Include files can be avoided if record definitions are internal to a module which provides accessor functions - although that may be too OO-flavoured for many Erlangers. Using -include_lib and recompiling copiously should be a pretty good guarantee that all modules are using the same record definitions. But yes, records are ugly ugly ugly, and part of that stems from Erlang's rather cavalier attitude towards data types, which can be both good and bad. One of the worse effects is that no type can really be opaque - it will be generally be implemented as a tuple or a list, and case clauses can catch either of those accidentally (especially a list.) Witness, for example, the disclaimers placed on the parse tree compatible data type in the syntaxtools contrib. That appears to be the best that can be done until there is some sort of way to define truly distinct types in Erlang. -Chris From klacke@REDACTED Fri Dec 6 10:23:54 2002 From: klacke@REDACTED (Klacke) Date: Fri, 6 Dec 2002 10:23:54 +0100 Subject: A tricky "Can I create a virtual IP grabbing Erlang Solution Or Is There an Easier Way In-Reply-To: ; from DANIESC.SCHUTTE@tebabank.com on Fri, Dec 06, 2002 at 09:31:18AM +0200 References: Message-ID: <20021206102354.A20181@bluetail.com> On Fri, Dec 06, 2002 at 09:31:18AM +0200, DANIESC SCHUTTE wrote: > Morning all, > > this morning I'm asking, a hopefully trivial question, about making a system more robust, and the more I see from Erlang, the more I am impressed. > > I have the following scenario, I have EXTERNAL clients, connecting to a specific IP and Port and an Erlang Server managing the connections and requests. Unfortuanately the External clients are stupid and can NOT change the IP they connect to when that box fails. > > Is there a way of creating a "virtual ip address" to which external clients can connect, but which is handled and failed over between / among erlang nodes as there are multiple nodes available for processing? > > Or is the only solution a server cluster with hardware failover? This is the sort of software that we have written at Alteon for years now. There are no libraries in the erlang distro to do this. You have to write it yourself. One way to do it is: 1. Decide which node should have the IP. 2. Bring up virtual interface on that machine. (This is even doable on win32, I did that a couple of years ago) 3. Start to listen for incoming tcp conns. 4. All nodes monitor each other. If they see that a node goes down, they must migrate the virt IPs that were previously on that node to themselves. 5. Once they have decided which node has which IP, the surviving nodes bring up virt interfaces and do gratiotous (uhhh is that hard to spell or what) ARP on the IPs thereby moving the IP address from one dead machine to themselves. This was done in the eddie project initially and I think you can find at least some useable erlang code in that project that you can snitch. Search google for eddie. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From klacke@REDACTED Fri Dec 6 10:26:43 2002 From: klacke@REDACTED (Klacke) Date: Fri, 6 Dec 2002 10:26:43 +0100 Subject: Design phase in Erlang In-Reply-To: <00a001c29d3a$72e6af60$1e00a8c0@design>; from erlang@inswitch.us on Fri, Dec 06, 2002 at 04:16:26PM +0100 References: <00a001c29d3a$72e6af60$1e00a8c0@design> Message-ID: <20021206102643.B20181@bluetail.com> On Fri, Dec 06, 2002 at 04:16:26PM +0100, Inswitch Solutions - Erlang Evaluation wrote: > Erlang Devs, > > I have a procces in machine M1 which receives requests to run a state machine which I called "service". > N clients send a request to machine M1 to execute the service. > > >From the Erlang point of view, is it a good design to have a process for each client request (N processes) ? > > Viewing it from another way, the service has the same code (logic) for each client but different instances for each client (the states). > Though, could be better to have those states for every client saved in some kind of structure and use the same code for every client by messages and recursion usage ( only 1 process) ? N times reentrant code vs N processes. > It'd be harder to implement but I don't know how Erlang manages the N processes (N same execution routines) in memory when a huge number of processes are running. > > I'd greatly appreciate some feedback about this. > One process (or more) per client is the way to go. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From DANIESC.SCHUTTE@REDACTED Fri Dec 6 10:26:23 2002 From: DANIESC.SCHUTTE@REDACTED (DANIESC SCHUTTE) Date: Fri, 06 Dec 2002 11:26:23 +0200 Subject: A tricky "Can I create a virtual IP grabbing Erlang Solution Or Is There an Easier Way Message-ID: Morning again, Thank you very much for pointing me in the right direction. I just want to comment on the BRILLIANT and QUICK responses to all questions. I appreciate it. Regards Daniel Danie Schutte Phone: +27 - 11 - 203 - 1613 Mobile: 084-468-3138 e-Mail: Daniesc@REDACTED >>> Klacke 12/06/02 11:23AM >>> On Fri, Dec 06, 2002 at 09:31:18AM +0200, DANIESC SCHUTTE wrote: > Morning all, > > this morning I'm asking, a hopefully trivial question, about making a system more robust, and the more I see from Erlang, the more I am impressed. > > I have the following scenario, I have EXTERNAL clients, connecting to a specific IP and Port and an Erlang Server managing the connections and requests. Unfortuanately the External clients are stupid and can NOT change the IP they connect to when that box fails. > > Is there a way of creating a "virtual ip address" to which external clients can connect, but which is handled and failed over between / among erlang nodes as there are multiple nodes available for processing? > > Or is the only solution a server cluster with hardware failover? This is the sort of software that we have written at Alteon for years now. There are no libraries in the erlang distro to do this. You have to write it yourself. One way to do it is: 1. Decide which node should have the IP. 2. Bring up virtual interface on that machine. (This is even doable on win32, I did that a couple of years ago) 3. Start to listen for incoming tcp conns. 4. All nodes monitor each other. If they see that a node goes down, they must migrate the virt IPs that were previously on that node to themselves. 5. Once they have decided which node has which IP, the surviving nodes bring up virt interfaces and do gratiotous (uhhh is that hard to spell or what) ARP on the IPs thereby moving the IP address from one dead machine to themselves. This was done in the eddie project initially and I think you can find at least some useable erlang code in that project that you can snitch. Search google for eddie. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy and copies. ##################################################################################### -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sean.Hinde@REDACTED Fri Dec 6 13:42:04 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 6 Dec 2002 12:42:04 -0000 Subject: xmerl order of callbacks Message-ID: <04D356A3B172D611981B0008C791C3126BF5E3@imp02mbx.t-mobile.co.uk> Hi, I'm battling with xmerl (0.18) and wonder if anyone knows whether the module callbacks for encoding each tag are supposed to be called in the order they appear in the input xml data? This for some changes to sowap for encoding multiple code pages in WBXML. I need to keep the current code page in state and output a change page instruction if the next tag is in a different page - if the elements appear in random order (as appears to be the case) then I have fallen at the FINAL hurdle... Thanks, 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 svenolof@REDACTED Fri Dec 6 14:49:48 2002 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Fri, 6 Dec 2002 14:49:48 +0100 Subject: interprocess inlining In-Reply-To: <20021205162016.3627.qmail@web14913.mail.yahoo.com> References: <20021205162016.3627.qmail@web14913.mail.yahoo.com> Message-ID: <15856.43772.287688.938481@harpo.it.uu.se> Thomas Lindgren writes: > > [exceptions in another process] > There is another book keeping issue as well: > primitives such as self(), process dictionary, etc. > must be changed while you are executing the code of > the other process. Likewise with the set of links, > monitors, and possibly other things. (Alternatively, > you can restrict yourself to not inlining such code.) Yes. Most primitives need to be rewritten to allow external execution. (This is pointed out in the paper.) > Second: it seems that the restriction that A may not > suspend while executing code from B is fairly > draconian: you can't, in principle, make a procedure > call inside the inlined code (p.5, top) since that > increments the reduction counter in ordinary BEAM. Or > am I missing something? No. Besides the problem with reduction counters, there is also the problem that any code executed externally (by another process) must be adapted for external execution. If inlined code contains a procedure call, then the call should be to a version of the procedure adapted for external execution. To execute a call externally also requires the client (A) to allocate a stack frame on the server's (B's) stack. This is certainly doable, but adds to the complexity of the optimization. > Third: another interesting issue, if we want to handle > more complex scenarios, is how to handle chained > sends: > > - A sends to B > - B sends to C > - C sends to D > > (perhaps C or D are really A; perhaps we suspend in > code belonging to C; etc.) The situation when B sends a message back to A is discussed in the paper (a rather interesting special case, I think). The case when B sends a message to a third process is not really that hard. The send is just another primitive. To run the send externally, we need a version adapted for external execution. This assumes that everything goes well. The case when B's code contains a send followed by some code that throws an exception is left as an exercise for the reader. Sven-Olof Nystr?m From cyberlync@REDACTED Fri Dec 6 18:05:06 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 6 Dec 2002 09:05:06 -0800 (PST) Subject: appname.app not found In-Reply-To: <20021205210703.26477a07.cpressey@catseye.mb.ca> Message-ID: <20021206170506.72049.qmail@web40806.mail.yahoo.com> No I am afraid not. I did finally solve the problem. I took Ulf's latest tutorial and modified it to for my app. It doesn't look like anything has changed, but it does work now so something did change. I wish I knew what the diffrence was, but I am content with it working now. --- Chris Pressey wrote: > On Wed, 4 Dec 2002 11:09:23 -0800 (PST) > Eric Merritt wrote: > > > Ok guys, > > > > I have done a bit more tinkering and come to a > few > > more concise results. I know that the path is > correct, > > I can call modules from the shell that are in the > same > > directory as the *.app file. > > > > What other choices are there? Are there any other > > reasons this error would be given. Possible other > > cuases? Any help would be appreciated. > > Is it possible you have a directory in the path with > a space in it's > filename? IIRC erlc has had problems with this > under Windows. Especially > since it's installed under "Program Files" by > default. I used to have > major problems with it (couldn't get it to display > any warnings, or > errors, even) until I installed R9 as E:\erl5.2 . > Now it seems to work > much more sanely... > > -Chris __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From cyberlync@REDACTED Fri Dec 6 18:31:08 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 6 Dec 2002 09:31:08 -0800 (PST) Subject: Impressions of Mozart-Oz Message-ID: <20021206173108.58424.qmail@web40808.mail.yahoo.com> Hello All, I have been spending a bit of time playing with the mozart-oz (www.mozart-oz.org) system. I was curious as to what the impressions of some of you Erlang Gurus are. This is just an exercise in curiosity. Thanks, Eric __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From vances@REDACTED Fri Dec 6 19:08:09 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 6 Dec 2002 13:08:09 -0500 Subject: Design phase in Erlang In-Reply-To: <20021206.013446.74724634.svg@surnet.ru> References: <00a001c29d3a$72e6af60$1e00a8c0@design> <20021206.013446.74724634.svg@surnet.ru> Message-ID: <20021206180809.GC8295@frogman.motivity.ca> } http://www.sics.se/~joe/ericsson/du98024.html Just for fun I tried out this test on an UltraSparc 5 running Solaris 8 and R9B-0. I found that it started paging at about 70K processes with 256MB of memory so I upgraded it to 512MB and found I could go to 180K processes before it paged. $ erl +P 262144 +A 32 Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:32] 21> zog:start(180000). <0.23949.6> Setup : 5.17900 s (28.7724 us per spawn) (179999 spawns) Run : 6.12400 s (5.67038 us per msg) (1079999 msgs) This is pretty is impressive! What I found interesting are the results of running the same tests using the shared heap emulator: Non-shared Heap Shared Heap (in micro secs) (in micro secs) ----------------- ----------------- Processes Spawn Message Spawn Message --------- ------- -------- ------ -------- 10 2.3 2.1 100 2.7 20.2 2.5 1000 29.0 2.8 29.0 2.8 10000 32.7 5.2 26.6 6.2 20000 31.0 5.2 27.2 10.4 30000 29.9 5.2 28.3 10.4 40000 29.4 5.3 29.3 26.8 50000 28.9 5.4 28.8 38.8 60000 28.6 5.4 38.0 10.4 70000 29.3 5.4 36.6 38.9 80000 29.3 5.3 35.7 26.9 90000 29.3 5.5 38.0 9.8 100000 29.0 5.6 33.5 134.6 110000 29.0 5.6 33.4 134.6 120000 29.1 5.6 33.3 89.6 130000 28.1 5.4 41.7 27.0 140000 28.6 5.8 40.8 188.2 150000 28.5 5.5 40.0 39.0 160000 28.5 5.8 39.3 188.2 170000 28.7 5.3 38.7 * 13.7 180000 28.8 5.7 42.3 * 121.4 190000 43.3 * 86.7 579.4 * 328.1 200000 42.7 * 233.1 [*] paging From erlang@REDACTED Sat Dec 7 16:15:53 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 7 Dec 2002 16:15:53 +0100 Subject: Design phase in Erlang References: <00a001c29d3a$72e6af60$1e00a8c0@design> <20021206.013446.74724634.svg@surnet.ru> <20021206180809.GC8295@frogman.motivity.ca> Message-ID: <007f01c29e03$89cd9f80$1e00a8c0@design> Really interesting numbers. Thank you. Eduardo Figoli INswitch Solutions ----- Original Message ----- From: "Vance Shipley" To: Sent: Friday, December 06, 2002 7:08 PM Subject: Re: Design phase in Erlang > } http://www.sics.se/~joe/ericsson/du98024.html > > Just for fun I tried out this test on an UltraSparc 5 running > Solaris 8 and R9B-0. I found that it started paging at about > 70K processes with 256MB of memory so I upgraded it to 512MB > and found I could go to 180K processes before it paged. > > $ erl +P 262144 +A 32 > Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:32] > > 21> zog:start(180000). > <0.23949.6> > Setup : 5.17900 s (28.7724 us per spawn) (179999 spawns) > Run : 6.12400 s (5.67038 us per msg) (1079999 msgs) > > This is pretty is impressive! What I found interesting are the > results of running the same tests using the shared heap emulator: > > Non-shared Heap Shared Heap > (in micro secs) (in micro secs) > ----------------- ----------------- > Processes Spawn Message Spawn Message > --------- ------- -------- ------ -------- > 10 2.3 2.1 > 100 2.7 20.2 2.5 > 1000 29.0 2.8 29.0 2.8 > 10000 32.7 5.2 26.6 6.2 > 20000 31.0 5.2 27.2 10.4 > 30000 29.9 5.2 28.3 10.4 > 40000 29.4 5.3 29.3 26.8 > 50000 28.9 5.4 28.8 38.8 > 60000 28.6 5.4 38.0 10.4 > 70000 29.3 5.4 36.6 38.9 > 80000 29.3 5.3 35.7 26.9 > 90000 29.3 5.5 38.0 9.8 > 100000 29.0 5.6 33.5 134.6 > 110000 29.0 5.6 33.4 134.6 > 120000 29.1 5.6 33.3 89.6 > 130000 28.1 5.4 41.7 27.0 > 140000 28.6 5.8 40.8 188.2 > 150000 28.5 5.5 40.0 39.0 > 160000 28.5 5.8 39.3 188.2 > 170000 28.7 5.3 38.7 * 13.7 > 180000 28.8 5.7 42.3 * 121.4 > 190000 43.3 * 86.7 579.4 * 328.1 > 200000 42.7 * 233.1 > > [*] paging From feeley@REDACTED Fri Dec 6 21:03:05 2002 From: feeley@REDACTED (Marc Feeley) Date: Fri, 6 Dec 2002 15:03:05 -0500 Subject: Design phase in Erlang In-Reply-To: <20021206180809.GC8295@frogman.motivity.ca> (message from Vance Shipley on Fri, 6 Dec 2002 13:08:09 -0500) References: <00a001c29d3a$72e6af60$1e00a8c0@design> <20021206.013446.74724634.svg@surnet.ru> <20021206180809.GC8295@frogman.motivity.ca> Message-ID: <200212062003.gB6K35911484@dino00.iro.umontreal.ca> > } http://www.sics.se/~joe/ericsson/du98024.html > > Just for fun I tried out this test on an UltraSparc 5 running > Solaris 8 and R9B-0. I found that it started paging at about > 70K processes with 256MB of memory so I upgraded it to 512MB > and found I could go to 180K processes before it paged. I ran a similar benchmark in Scheme (compiled using Gambit-C and run on a 2.4GHz Pentium 4 with 1GBytes of RAM running Linux). The Scheme code is attached below. I ran it with values of N (number of processes) from 10 to 900 thousand. Here is a table indicating the process creation time and the time to send/receive one message in microseconds): process message creation send/receive N time (us) time (us) ______ _____ _____ 10 2.36 1000 2.73 10000 2.53 2.75 100000 2.69 2.71 200000 2.65 2.74 300000 2.61 2.73 400000 2.60 2.70 500000 2.62 2.74 600000 2.68 2.68 700000 6.91 2.54 800000 6.24 3.01 900000 6.14 2.78 The message passing time stayed at roughly 2.7 microseconds (like Erlang/OTP with non-shared heap the time does not vary much with N). However process creation time was around 2.5 microseconds when N < 700000, but above that it jumped to 6 microseconds because the heap was close to its limit (I gave the system a 1GByte heap so that a very high number of processes could be created). My conclusion is that Gambit-C scales very well in the sense that there is very little variation with N (just like Erlang/OTP with non-shared heap). The use of a unified heap allows message passing to be done in constant time (i.e. no copying necessary). Moreover Gambit-C can handle a very high number of processes if there is enough memory (roughly 1 KByte per process). It would appear from your experiment with the UltraSparc that Erlang/OTP is using about 2.7 KBytes per process (i.e. 512 MBytes/190000). In relative terms (since the processors aren't the same) the process creation time seems a bit better in Gambit-C, and the message passing time is a bit worse. Marc ------------------------------------------------------------------------------- ; file: "ring.scm" (declare (standard-bindings)) (define (joes-challenge n m) (define (create-processes) (declare (fixnum) (not safe)) (define (iota n) (iota-aux n '())) (define (iota-aux n lst) (if (= n 0) lst (iota-aux (- n 1) (cons n lst)))) (let* ((1-to-n (iota n)) (channels (list->vector (map (lambda (i) (open-vector)) 1-to-n))) (processes (map (lambda (i) (let ((input (vector-ref channels (modulo (- i 1) n))) (output (vector-ref channels (modulo i n)))) (make-thread (lambda () (let loop ((j m)) (if (> j 0) (let ((message (read input))) (write message output) (force-output output) (loop (- j 1))))))))) 1-to-n))) (write 'go (vector-ref channels 1)) (force-output (vector-ref channels 1)) processes)) (let* ((point1 (cpu-time)) (processes (create-processes)) (point2 (cpu-time))) (for-each thread-start! processes) (thread-join! (car processes)) (let ((point3 (cpu-time))) (display n) (display " ") (display (/ (- point2 point1) n)) (display " ") (display (/ (- point3 point2) (* n m))) (newline)))) (define (main) (define (usage) (display "usage: ring \n")) (let ((args (cdr (command-line)))) (if (null? args) (usage) (let ((n (string->number (car args)))) (if (not (and (integer? n) (exact? n) (>= n 2) (<= n 1000000))) (usage) (let ((m (quotient 1000000 n))) (joes-challenge n m))))))) (main) ------------------------------------------------------------------------------- From bparoli@REDACTED Fri Dec 6 18:50:40 2002 From: bparoli@REDACTED (Paroli, Bernardo) Date: Fri, 6 Dec 2002 14:50:40 -0300 Subject: Convert C types to Erlang types Message-ID: I'm make a server socket in Erlang and I send message from C client. The C client send the next message: typedef struct { int first; char second; } Message; char buf[1024]; Message*p; p = (Message*) buf; p->first = 1567; p->second = 's'; send(s, buf, sizeof(Message), 0); In the Erlang server I'm receive the next binary message: <<31,6,0,0,115,255,255,255>> I need convernt this structure to the corresponding C structure. Exist in Erlang something function to make this conversion? -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_4711@REDACTED Fri Dec 6 18:13:50 2002 From: thomasl_4711@REDACTED (Thomas Lindgren) Date: Fri, 6 Dec 2002 09:13:50 -0800 (PST) Subject: interprocess inlining In-Reply-To: <15856.43772.287688.938481@harpo.it.uu.se> Message-ID: <20021206171350.75045.qmail@web14913.mail.yahoo.com> --- Sven-Olof Nystr|m wrote: > Thomas Lindgren writes: > > > [exceptions in another process] > > [rewrite primitives that refer to process state] > > Yes. Most primitives need to be rewritten to allow > external execution. (This is pointed out in the > paper.) OK, I missed that. Sorry. > > Second: it seems that the restriction that A may > not > > suspend while executing code from B is fairly > > draconian: you can't, in principle, make a > procedure > > call inside the inlined code (p.5, top) since > that > > increments the reduction counter in ordinary > BEAM. Or > > am I missing something? > > No. Besides the problem with reduction counters, > there is also the > problem that any code executed externally (by > another process) must be > adapted for external execution. If inlined code > contains a procedure > call, then the call should be to a version of the > procedure adapted > for external execution. To execute a call externally > also requires the > client (A) to allocate a stack frame on the server's > (B's) stack. This > is certainly doable, but adds to the complexity of > the optimization. The first part sounds okay; duplicating code is what inlining is about. Switching stacks sounds hairier, as you say. And that's ignoring suspension, of course. > > Third: another interesting issue, if we want to > handle > > more complex scenarios, is how to handle chained > > sends: > > > > - A sends to B > > - B sends to C > > - C sends to D > > > > (perhaps C or D are really A; perhaps we suspend > in > > code belonging to C; etc.) > > The situation when B sends a message back to A is > discussed in the > paper (a rather interesting special case, I think). > The case when B > sends a message to a third process is not really > that hard. The send > is just another primitive. To run the send > externally, we need a > version adapted for external execution. I assume we are talking about inlining the subsequent sends as well here? In that case, I think there's a bit more to it. In practice, one would have to handle possible suspension inside B, for example. Also, checking what sends are really "return sends" and to where. (A sends to B, which sends to C, which replies to A, say.) Perhaps there are more issues to consider. (It should be said it's always possible to limit what is handled; but we must then ask which are the common cases.) > This assumes that everything goes well. > The case when B's code contains a send > followed by some > code that throws an exception is left as an exercise > for the reader. Alas, this mail, at least, is too short to hold the solution :-) Best, Thomas __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From carlos@REDACTED Fri Dec 6 18:13:15 2002 From: carlos@REDACTED (Carlos Silva) Date: Fri, 6 Dec 2002 14:13:15 -0300 Subject: Mnesia question Message-ID: <005401c29d4a$c43b5a40$1400a8c0@tdapi> Hello I've just arrived to the "Erlang world" and I've been trying to introduce myself in Mnesia DBMS. I found a tool to give the user graphical access to the mnesia and ets tables, called "trex-2.6.tgz - Leif Lorentzen, ", under the "User Contributions" page. But I have some troubles in using it. The message that I receive from my erlang shell is the following. 4> trex:start(). <0.124.0> *** Could not start trex_sh! Reason: {badrpc,{'EXIT',{undef,[{trex_sh,start,[]}, {rpc,call,4},{trex,start1,2}]}}} I'm not ready to understand it yet and I will apreciate any help you could give me about this (the answer or to whom I could contact to answer my questions). May I copy the files in another directory? Run something else before trex? etc. Thank you very much, Carlos.- -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Sat Dec 7 21:06:40 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Sat, 7 Dec 2002 21:06:40 +0100 Subject: Binary to integer Message-ID: <002e01c29e2c$28e98f20$1e00a8c0@design> Does someone know how to convert a binary 4 bytes expression to integer ? Thanks, Eduardo Figoli INswitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Sat Dec 7 10:06:44 2002 From: matthias@REDACTED (Matthias Lang) Date: Sat, 7 Dec 2002 10:06:44 +0100 Subject: Convert C types to Erlang types In-Reply-To: References: Message-ID: <15857.47652.959365.9822@antilipe.corelatus.se> Paroli, Bernardo writes: > I'm make a server socket in Erlang and I send message from C > client. The C client send the next message: > > typedef struct > { > int first; > char second; > } Message; > > char buf[1024]; > Message*p; > p = (Message*) buf; > > p->first = 1567; > p->second = 's'; > > send(s, buf, sizeof(Message), 0); > > In the Erlang server I'm receive the next binary message: > <<31,6,0,0,115,255,255,255>> > > I need convernt this structure to the corresponding C structure. > Exist in Erlang something function to make this conversion? In general, you can't do that because the C standard alloweds more than one way of laying out a structure, i.e. the binary message for the same structure with the same data will vary from compiler to compiler and machine to machine. One quick and dirty way to do it is to make a few educated guesses and manually decode the data. In your example, the guesses are: 1. You have a little-endian machine 2. Your compiler pads to 32 bit boundaries 5> <> = <<31,6,0,0,115,255,255,255>>. <<31,6,0,0,115,255,255,255>>. 6> {First, Second}. {1567,115} This is not a very good way to do things. A better way is to define a protocol between your C code and your Erlang code. The choices are many, reading the "interoperability guide" is a good place to start: http://www.erlang.org/doc/r9b/doc/tutorial/part_frame.html Matthias From matthias@REDACTED Sat Dec 7 10:10:39 2002 From: matthias@REDACTED (Matthias Lang) Date: Sat, 7 Dec 2002 10:10:39 +0100 Subject: Binary to integer In-Reply-To: <002e01c29e2c$28e98f20$1e00a8c0@design> References: <002e01c29e2c$28e98f20$1e00a8c0@design> Message-ID: <15857.47887.274557.529235@antilipe.corelatus.se> Eduardo Figoli writes: > Does someone know how to convert a binary 4 bytes expression to integer ? 7> <> = <<1,2,3,4>>. <<1,2,3,4>> 8> I. 16909060 The "bit syntax" I used above has many options for word widths and endianness. It's described in "Languages Extensions since 4.4": http://www.erlang.org/doc/r9b/doc/extensions/bit_syntax.html#6 I also recommend the entire "Language Extensions" part of the manual: http://www.erlang.org/doc/r9b/doc/extensions/part_frame.html Matthias From d98peter@REDACTED Fri Dec 6 18:14:05 2002 From: d98peter@REDACTED (Peter Strand) Date: Fri, 6 Dec 2002 18:14:05 +0100 Subject: ei_rpc vs. erl_rpc Message-ID: <20021206181404.B78458@zarquon.ran> Hi, I'm playing around a bit with erl_interface and have some trouble with the ei_rpc function, it failes with -1 and erl_errno == EIO when used as follows: ei_cnode ec; int fd, n; ei_x_buff x, x2; ei_init(); ei_connect_init(&ec, "test", "cookie", 2); fd = ei_connect(&ec, "foo@REDACTED"); ei_x_new(&x); ei_x_new(&x2); ei_x_format(&x, "[]"); ei_rpc(&ec, fd, "net_adm", "localhost", x.buff, x.index, &x2); Am I doing anything wrong here? If I strace the server it seems to close the connection right after rpc-request is received.. However, this works just fine: int fd; ETERM *args; erl_init(0,0); erl_connect_init(1, "cookie", 2); fd = erl_connect("foo@REDACTED"); args = erl_format("[]"); erl_rpc(fd, "net_adm", "localhost", args); /Peter From kent@REDACTED Sat Dec 7 15:12:09 2002 From: kent@REDACTED (Kent Boortz) Date: 07 Dec 2002 15:12:09 +0100 Subject: ei_rpc vs. erl_rpc In-Reply-To: <20021206181404.B78458@zarquon.ran> References: <20021206181404.B78458@zarquon.ran> Message-ID: > I'm playing around a bit with erl_interface and have some > trouble with the ei_rpc function, it failes with -1 and > erl_errno == EIO when used as follows: You may find more information if you have access set "ERL_DEBUG_DIST" to 3 in your environment. kent From Marc.Vanwoerkom@REDACTED Mon Dec 9 07:30:09 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Mon, 9 Dec 2002 07:30:09 +0100 (MET) Subject: Erlang jobs? Message-ID: <200212090630.gB96U9S18571@bonsai.fernuni-hagen.de> Does anyone know open positions for full time Erlang development in Germany (or maybe the Netherlands)? I'm presently looking for a new job (usually I earn my living doing C++/Java Developement or Unix Administration) and fed the Job search engines occasionally with "Erlang", but found nothing so far. Regards, Marc From Chandrashekhar.Mullaparthi@REDACTED Mon Dec 9 09:52:18 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 9 Dec 2002 08:52:18 -0000 Subject: Mnesia question Message-ID: <04D356A3B172D611981B0008C791C312404F18@imp02mbx.t-mobile.co.uk> The error message basically is that the module trex_sh is not loaded. Check that the module is loaded. Here is an example checking that the kernel module is loaded. 1> m(kernel). Module kernel compiled: Date: April 12 2002, Time: 05.57 Compiler options: [v3, debug_info, {i,"/clearcase/otp/erts/lib/kernel/src/../include"}, {outdir,"/clearcase/otp/erts/lib/kernel/src/../ebin"}, {cwd,'/clearcase/otp/erts/lib/kernel/src'}] Object file: D:\PROGRA~1\ERL51~1.1/lib/kernel-2.7.2/ebin/kernel.beam Exports: config_change/3 init/1 module_info/0 module_info/1 start/2 stop/1 ok 2> cheers Chandru -----Original Message----- From: Carlos Silva [mailto:carlos@REDACTED] Sent: 06 December 2002 17:13 To: erlang-questions@REDACTED Subject: Mnesia question Hello I've just arrived to the "Erlang world" and I've been trying to introduce myself in Mnesia DBMS. I found a tool to give the user graphical access to the mnesia and ets tables, called "trex-2.6.tgz - Leif Lorentzen, ", under the "User Contributions" page. But I have some troubles in using it. The message that I receive from my erlang shell is the following. 4> trex:start(). <0.124.0> *** Could not start trex_sh! Reason: {badrpc,{'EXIT',{undef,[{trex_sh,start,[]}, {rpc,call,4},{trex,start1,2}]}}} I'm not ready to understand it yet and I will apreciate any help you could give me about this (the answer or to whom I could contact to answer my questions). May I copy the files in another directory? Run something else before trex? etc. Thank you very much, Carlos.- 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 klacke@REDACTED Mon Dec 9 10:19:02 2002 From: klacke@REDACTED (Klacke) Date: Mon, 9 Dec 2002 10:19:02 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: <20021206173108.58424.qmail@web40808.mail.yahoo.com>; from cyberlync@yahoo.com on Fri, Dec 06, 2002 at 09:31:08AM -0800 References: <20021206173108.58424.qmail@web40808.mail.yahoo.com> Message-ID: <20021209101902.A31220@bluetail.com> On Fri, Dec 06, 2002 at 09:31:08AM -0800, Eric Merritt wrote: > Hello All, > > I have been spending a bit of time playing with the > mozart-oz (www.mozart-oz.org) system. I was curious as > to what the impressions of some of you Erlang Gurus > are. This is just an exercise in curiosity. > I played around with it a couple of years ago. I think they have changed the language considerably since then ... actually, I think they took some of the ideas from Erlang. In particular they toook the idea of explicit concurrency. The LP world had the idea of implicit concurrency whereby each goal, in a series of goals was evaluated as a process. Syncronization between theses goals/processes was/is done by logical variables. I personally think that that model of concurrency sucks. Anyway, oz has explicit concurrency and logical variables. So message passing is done (correct me if i'm wrong) by sending a uninstantiated logical variable, the sender can wait until someone instantiates a sent variable. (possibly on another machine) I prefer messages the way we have them in erlang. On the other hand, imagine Erlang _with_ logical variables, it makes for some pretty interesting/complicated programs. I think, that logical variables is programming concept that is too hard to be used in large (many not so very talented programmers) projects. The code becomes hard to read/understand and it's to easy to write unnecessary complicated code. My 2 ?re. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 LocalWords: uninstnasiated From eleberg@REDACTED Mon Dec 9 10:28:30 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Mon, 9 Dec 2002 10:28:30 +0100 (MET) Subject: Convert C types to Erlang types Message-ID: <200212090928.gB99SUr24671@cbe.ericsson.se> > Paroli, Bernardo writes: > > I'm make a server socket in Erlang and I send message from C > > client. The C client send the next message: > > > > typedef struct > > { > > int first; > > char second; > > } Message; > > > > char buf[1024]; > > Message*p; > > p = (Message*) buf; > > > > p->first = 1567; > > p->second = 's'; > > > > send(s, buf, sizeof(Message), 0); > > > > In the Erlang server I'm receive the next binary message: > > <<31,6,0,0,115,255,255,255>> > > > > I need convernt this structure to the corresponding C structure. > > Exist in Erlang something function to make this conversion? a practice suggested by the plan9 developpers is to always use ascii for this kind of transfer. send the numbers as text. parse the text to numbers on the erlang side. see http://plan9.bell-labs.com/sys/doc/index.html for all plan9 documentation. example quoute: ''To avoid byte order problems, data is communicated between programs as text whenever practical.'' bengt From etxuwig@REDACTED Mon Dec 9 10:52:51 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 9 Dec 2002 10:52:51 +0100 (MET) Subject: Mnesia question In-Reply-To: <005401c29d4a$c43b5a40$1400a8c0@tdapi> Message-ID: I'm not absolutely sure, but I would guess that trex is badly (though unofficially) deprecated. To my knowledge, it is no longer used by those who wrote it in the first place. (If this is true, it should probably be removed from the contribs directory...? Could someone who feels closer to trex verify?) The OTP table visualizer does many of the things trex does. Perhaps you should go with that first? /Uffe On Fri, 6 Dec 2002, Carlos Silva wrote: >Hello I've just arrived to the "Erlang world" and I've been >trying to introduce myself in Mnesia DBMS. > I found a tool to give the user graphical access to the >mnesia and ets tables, called "trex-2.6.tgz - Leif >Lorentzen, ", under the "User Contributions" page. > >But I have some troubles in using it. The message that I >receive from my erlang shell is the following. > >4> trex:start(). ><0.124.0> >*** Could not start trex_sh! Reason: {badrpc,{'EXIT',{undef,[{trex_sh,start,[]}, >{rpc,call,4},{trex,start1,2}]}}} > >I'm not ready to understand it yet and I will apreciate any >help you could give me about this (the answer or to whom I >could contact to answer my questions). May I copy the files >in another directory? Run something else before trex? etc. > >Thank you very much, Carlos.- > > > > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From bjarne@REDACTED Mon Dec 9 13:01:45 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Mon, 09 Dec 2002 13:01:45 +0100 Subject: Photos from EUC'2002 References: <200212090630.gB96U9S18571@bonsai.fernuni-hagen.de> Message-ID: <3DF48629.7F36903@erix.ericsson.se> Hello There are now some photos available from EUC'2002 at http://www.erlang.se/euc/02/photo/ They are also reachable from the EUC'2002 homepage at http://www.erlang.se/euc/02/ Because of the lighting in the auditorium (dark plus bright screen) only about half of the photos turned out reasonably well. However, it might give people who were unable to attend the EUC'2002 some idea of what it was like. Merry Xmas Bjarne From goran.bage@REDACTED Mon Dec 9 13:41:53 2002 From: goran.bage@REDACTED (Goran Bage) Date: Mon, 09 Dec 2002 13:41:53 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: <20021209101902.A31220@bluetail.com> References: <20021206173108.58424.qmail@web40808.mail.yahoo.com> <20021209101902.A31220@bluetail.com> Message-ID: <3DF48F91.10809@mobilearts.se> Klacke wrote: > On Fri, Dec 06, 2002 at 09:31:08AM -0800, Eric Merritt wrote: > ... > > I prefer messages the way we have them in erlang. On the > other hand, imagine Erlang _with_ logical variables, it makes > for some pretty interesting/complicated programs. As I remember it Erlang was developed out of logic programming (as the syntax still shows) and logic variable communication was seriously considered. Maybe Robert or Joe could comment on the trade offs made. > > I think, that logical variables is programming concept that > is too hard to be used in large (many not so very talented > programmers) projects. The code becomes hard to read/understand > and it's to easy to write unnecessary complicated code. Maybe, but in some cases it is neat to be able to successively instantiate data structures. I remember missing it a lot building list functions, where I need to reverse the list or do several runs over the list in Erlang. But as you say the resulting code is often simpler without this feature. -- -- Goran ------------------------- May the Snow be with you ---- Goran Bage, MobilArts, www.mobilearts.se Tegnerlunden 3, SE-111 61 Stockholm, Sweden email:goran.bage@REDACTED, phone: +46 733 358405 From svenolof@REDACTED Mon Dec 9 14:35:29 2002 From: svenolof@REDACTED (Sven-Olof Nystr|m) Date: Mon, 9 Dec 2002 14:35:29 +0100 Subject: interprocess inlining In-Reply-To: <20021206171350.75045.qmail@web14913.mail.yahoo.com> References: <15856.43772.287688.938481@harpo.it.uu.se> <20021206171350.75045.qmail@web14913.mail.yahoo.com> Message-ID: <15860.39969.815039.166088@harpo.it.uu.se> Thomas Lindgren writes: > > > Third: another interesting issue, if we want to handle more > > > complex scenarios, is how to handle chained sends: > > > > > > - A sends to B > > > - B sends to C > > > - C sends to D > > > > > > (perhaps C or D are really A; perhaps we suspend in code > > > belonging to C; etc.) > > > > The situation when B sends a message back to A is discussed in > > the paper (a rather interesting special case, I think). The case > > when B sends a message to a third process is not really that > > hard. The send is just another primitive. To run the send > > externally, we need a version adapted for external execution. > > I assume we are talking about inlining the subsequent sends as well > here? In that case, I think there's a bit more to it. wasn't. Yes, doing process inlining with a third process can certainly complicate things a bit. In principle, cascading process inling should be like inlining any other operation. It is certainly easy to come up with scenarios when we would run into difficulties, though. > In practice, one would have to handle possible suspension inside B, > for example. Also, checking what sends are really "return sends" > and to where. (A sends to B, which sends to C, which replies to A, > say.) Perhaps there are more issues to consider. > > (It should be said it's always possible to limit what is handled; > but we must then ask which are the common cases.) Agreed. Sven-Olof From cyberlync@REDACTED Mon Dec 9 15:32:17 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 9 Dec 2002 06:32:17 -0800 (PST) Subject: Impressions of Mozart-Oz In-Reply-To: <20021209101902.A31220@bluetail.com> Message-ID: <20021209143217.88721.qmail@web40809.mail.yahoo.com> [snip] > I prefer messages the way we have them in erlang. On > the > other hand, imagine Erlang _with_ logical variables, > it makes > for some pretty interesting/complicated programs. This is kinda the conclusion I came to after a few days of reasearch. I was interested in it becuase at first read, the descriptions made it sound like Erlang with Constraint/Logic Programming features. But you are right its concurrency model sucks for real world situations at least if you want to use concurrency/processes as your primary coding concept. On a side note, I really don't like the syntax of Oz. The declaration of variables in the local .. end. and define constructs seam a little redundant in a single assignment langauge. Thanks, Eric __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From erlang@REDACTED Mon Dec 9 15:34:31 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 09 Dec 2002 14:34:31 +0000 Subject: Impressions of Mozart-Oz References: <20021206173108.58424.qmail@web40808.mail.yahoo.com> Message-ID: <3DF4A9F7.8020202@manderp.freeserve.co.uk> Hi Eric, I hesitated to answer this, I'm no Erlang guru, so consume the following with salt to taste. But I would like to add my ? 1/50th because I've heard plenty of A vs. B arguments over programming languages, and as an end user I wish to express why I'd rather use Erlang over Lisp, or Prolog, or even C++ (now there's a surprise!). And I'm curious too :-) There is one major thing missing from the Mozart project that initially attracted me to Erlang: Applications. I found Erlang because I was looking for an application including the Megaco stack. Erlang happened to be part of the learning curve, and solved a real-world engineering problem for me, so I learnt Erlang and now prefer to use it where I can because it helps me more than other languages I know to solve problems. It would seem to me that Mozart suffers the same problem as almost all Functional/Logic programming languages, in that it originates and will probably remain in academic circles. The applications it offers to solve are too abstract to be of interest to me. What makes Erlang so powerful in my eyes is that here I have a set of tools designed to tackle the programming problems I face in professional software engineering, because it is designed and built to solve the type of engineering problems I encounter every day. Libraries are what I need to solve problems and in my opinion are an integral part of a language. I don't have the time available to reinvent the wheel, and thankfully the CS labs at Ericsson supplied some very fine wheels, thank you guys. (I spent two years writing wheels/libraries for a proprietry language similar to Smalltalk and I experienced the implications of not making them perfectly rounded!) Erlang is also fast, efficient, simple, explicit, and expresses flow control, message passing and concurrency elegantly. It may also be possible to prove that code is mathematically correct, but I haven't found that to be a major selling point for me (I'm not a mathematician!) Erlang seems to have got the fundamentals right, and also shares the same aims as the huge majority of bread-and-butter programmers who simply want to get a job done! So why isn't it the defacto standard? The answer is probably hype and marketing. We mostly use C++ and Java despite the crap code we end up writing and, worse, maintaining! There hasn't been a Functional/Logic programming trend like the OO fad that swept the scene (Not a trendy concept? Maybe before my time? It is old after all...), and Ericsson, despite the courageous erlang.org Open Source effort, hasn't invested the kind of effort of the same scale that propelled C++ and Java into prominence. It's no fault of theirs, they're sadly not going to make money out of Erlang. The remarkable thing is that Erlang is growing in popularity simply due to its technical superiority. This is a freakish rareity! Pete. Eric Merritt wrote: >Hello All, > > I have been spending a bit of time playing with the >mozart-oz (www.mozart-oz.org) system. I was curious as >to what the impressions of some of you Erlang Gurus >are. This is just an exercise in curiosity. > >Thanks, >Eric > >__________________________________________________ >Do you Yahoo!? >Yahoo! Mail Plus - Powerful. Affordable. Sign up now. >http://mailplus.yahoo.com > > > > From bparsia@REDACTED Mon Dec 9 16:04:35 2002 From: bparsia@REDACTED (Bijan Parsia) Date: Mon, 9 Dec 2002 10:04:35 -0500 (EST) Subject: Impressions of Mozart-Oz In-Reply-To: <3DF4A9F7.8020202@manderp.freeserve.co.uk> Message-ID: On Mon, 9 Dec 2002, Peter-Henry Mander wrote: [snip] > It would seem to me that Mozart suffers the same problem as almost all > Functional/Logic programming languages, in that it originates and will > probably remain in academic circles. Just like to note that Prolog long ago moved into industry, has several commerical vendors whose sole business is selling their implementation (well, and consulting, training, etc.). OTOH, XSLT is a fairly pure functional programming language. There are probably more XSLT programmers than all the rest of the functional programming language programmers, including Erlang. [snip] This isn't to say that Erlang doesn't rule. It does. :) I do agree with the overall points that Erlang has a very good balance of very useful simplicity and functionality (in the language itself) and a great set of applications. To these I add that it has enough real experience out there to have developed a useful set of "design patterns" and methodologies that fit in well with the language/library features (all this is clearly the result of iterative design with a fine feedback loop). The applications generally exhibit the design patterns in a lucid way, which makes it easy to get into the swing of things. Cheers, Bijan Parsia. From erlang@REDACTED Mon Dec 9 18:14:41 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 09 Dec 2002 17:14:41 +0000 Subject: Impressions of Mozart-Oz References: Message-ID: <3DF4CF81.6020200@manderp.freeserve.co.uk> Hi Bijan, Agreed, Prolog is an industrial language, but I faced a steep learning curve when I first encountered it. Not until I conceived the algorithms as diagrams of logic gates, as in electronic schematics, that I understood the implicit concurrency of Prolog. Powerful? Certainly. Easy to use/debug? I'm not so sure, but I didn't use it that much to fully understand how it works. And add to the picture green/red cuts that seem to break the "logic" of Prolog. Your point about the widespread use of XSLT is true, but it doesn't extend its reach into general purpose programming (yet). And Lord is it ugly! That may seem trivial, but I go cross-eyed reading xslt, which kills my productivity, needless to say! As far as practical and accessible languages go, Erlang scores high, better than most. Pete. Bijan Parsia wrote: >On Mon, 9 Dec 2002, Peter-Henry Mander wrote: > >[snip] > > >>It would seem to me that Mozart suffers the same problem as almost all >>Functional/Logic programming languages, in that it originates and will >>probably remain in academic circles. >> >> > >Just like to note that Prolog long ago moved into industry, has several >commerical vendors whose sole business is selling their implementation >(well, and consulting, training, etc.). OTOH, XSLT is a fairly pure >functional programming language. There are probably more XSLT programmers >than all the rest of the functional programming language programmers, >including Erlang. >[snip] > >This isn't to say that Erlang doesn't rule. It does. :) > >I do agree with the overall points that Erlang has a very good balance of >very useful simplicity and functionality (in the language itself) and a >great set of applications. To these I add that it has enough real >experience out there to have developed a useful set of "design patterns" >and methodologies that fit in well with the language/library features (all >this is clearly the result of iterative design with a fine feedback loop). >The applications generally exhibit the design patterns in a lucid way, >which makes it easy to get into the swing of things. > >Cheers, >Bijan Parsia. > > > > > From jesperw@REDACTED Mon Dec 9 18:24:53 2002 From: jesperw@REDACTED (Jesper Wilhelmsson) Date: Mon, 9 Dec 2002 18:24:53 +0100 (MET) Subject: Design phase in Erlang In-Reply-To: <20021206180809.GC8295@frogman.motivity.ca> Message-ID: On Fri, 6 Dec 2002, Vance Shipley wrote: > $ erl +P 262144 +A 32 > Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:32] > > 21> zog:start(180000). > <0.23949.6> > Setup : 5.17900 s (28.7724 us per spawn) (179999 spawns) > Run : 6.12400 s (5.67038 us per msg) (1079999 msgs) I tried this in my shared heap system: $ erl +P 262144 +A 32 Erlang (BEAM) emulator version 2002.10.12 [source] [shared heap] Eshell V2002.10.12 (abort with ^G) 1> zog:start(180000). <0.30.0> Setup : 0.923000 s (5.12781 us per spawn) (179999 spawns) Run : 5.42400 s (5.02223 us per msg) (1079999 msgs) I don't get quite the same numbers as you im my table (below). From the looks of it, it seems we are using different programs. But I assure you, I copied zog from the link you gave and ran it unmodified. (I used a x86 for this, don't know if that makes any difference) private shared processes spawn mess spawn mess 10 0.0 1.5 0.0 0.9 100 20.2 1.5 0.0 0.9 1000 19.0 1.7 3.0 1.0 10000 34.6 1.8 3.6 1.3 20000 49.7 1.8 3.7 1.5 30000 64.8 1.9 3.7 1.5 40000 79.9 1.9 3.8 2.2 50000 94.9 1.8 3.7 2.7 60000 109.8 1.8 3.8 1.5 70000 125.2 1.9 4.9 2.7 80000 140.1 1.8 4.7 2.3 90000 155.8 1.9 4.6 5.2 100000 170.3 1.9 4.5 7.6 110000 185.7 1.9 4.5 8.1 120000 201.2 2.0 4.4 5.1 130000 215.7 1.9 5.6 2.2 140000 230.9 1.9 5.5 10.8 150000 246.3 1.9 5.4 2.8 160000 261.5 1.9 5.3 10.9 170000 277.1 1.8 5.2 1.5 180000 292.2 1.9 5.1 5.0 190000 307.3 1.9 6.4 15.5 200000 323.6 1.9 6.3 35.0 The program hardly sends any data, so the benefit of a shared heap is not obvious here, only the (much) higher garbage collection latency. Although this is interesting, an even more interesting table is: private heap shared heap Pr Words sent allocated used allocated used 10 1.753 78.012 56.584 139.104 9.497 100 1.933 98.982 56.584 139.104 9.497 1K 3.733 308.538 58.263 139.104 9.628 10K 21.733 2.405.682 76.215 139.104 27.628 20K 41.733 4.735.538 96.270 139.104 47.628 30K 61.733 7.065.538 116.292 139.104 67.628 40K 81.733 9.395.682 136.216 139.104 87.628 50K 101.733 11.725.682 156.216 139.104 107.628 60K 121.733 14.055.538 176.272 139.104 127.628 70K 141.733 16.385.538 196.302 139.104 128.784 80K 161.733 18.715.682 216.216 139.104 128.784 90K 181.733 21.045.682 236.257 139.104 128.784 100K 201.733 23.375.538 256.304 139.104 128.784 110K 221.733 25.705.682 276.184 139.104 128.784 120K 241.733 28.035.682 296.248 139.104 128.784 130K 261.733 30.365.682 316.303 139.104 128.785 140K 281.733 32.695.538 336.304 139.104 128.785 150K 301.733 35.025.682 356.185 139.104 128.785 160K 321.733 37.355.682 376.248 139.104 128.785 170K 341.733 39.685.682 396.303 139.104 128.785 180K 361.733 42.015.538 416.314 139.104 128.785 190K 381.733 44.345.682 436.191 139.104 128.841 200K 401.733 46.675.682 456.248 139.104 128.841 As you can see, the shared heap system was started with ~140K-word heap (word = 4 bytes), and stayed there for the entire run. "Heap" is in this case erlang process heap. Static system structures (ets-tables, atom-tables etc) and PCBs are not included. __ ___( |_______________________ _______________________________________________ | | ,---. ,--.,--.,--. ( ( | || _ || o ) o ) p ) ) ) "Beware of bugs in the above code; | || (_) || r'| r'| -?--.( ( I have only proved it correct, not tried it." o,--' | `---' |_| |_| `-----' ) ) -- Donald Knuth _`----'______________________( (_______________________________________________ Jesper Wilhelmsson, jesperw@REDACTED +46 (0)18 471 1046 Computing Science Department, Uppsala University, Sweden +46 (0)733 207 207 ------------------------------------------------------------------------------- > } http://www.sics.se/~joe/ericsson/du98024.html > > Just for fun I tried out this test on an UltraSparc 5 running > Solaris 8 and R9B-0. I found that it started paging at about > 70K processes with 256MB of memory so I upgraded it to 512MB > and found I could go to 180K processes before it paged. > > > This is pretty is impressive! What I found interesting are the > results of running the same tests using the shared heap emulator: > > Non-shared Heap Shared Heap > (in micro secs) (in micro secs) > ----------------- ----------------- > Processes Spawn Message Spawn Message > --------- ------- -------- ------ -------- > 10 2.3 2.1 > 100 2.7 20.2 2.5 > 1000 29.0 2.8 29.0 2.8 > 10000 32.7 5.2 26.6 6.2 > 20000 31.0 5.2 27.2 10.4 > 30000 29.9 5.2 28.3 10.4 > 40000 29.4 5.3 29.3 26.8 > 50000 28.9 5.4 28.8 38.8 > 60000 28.6 5.4 38.0 10.4 > 70000 29.3 5.4 36.6 38.9 > 80000 29.3 5.3 35.7 26.9 > 90000 29.3 5.5 38.0 9.8 > 100000 29.0 5.6 33.5 134.6 > 110000 29.0 5.6 33.4 134.6 > 120000 29.1 5.6 33.3 89.6 > 130000 28.1 5.4 41.7 27.0 > 140000 28.6 5.8 40.8 188.2 > 150000 28.5 5.5 40.0 39.0 > 160000 28.5 5.8 39.3 188.2 > 170000 28.7 5.3 38.7 * 13.7 > 180000 28.8 5.7 42.3 * 121.4 > 190000 43.3 * 86.7 579.4 * 328.1 > 200000 42.7 * 233.1 > > [*] paging > From etxuwig@REDACTED Mon Dec 9 18:30:37 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 9 Dec 2002 18:30:37 +0100 (MET) Subject: Design phase in Erlang In-Reply-To: <20021206180809.GC8295@frogman.motivity.ca> Message-ID: On Fri, 6 Dec 2002, Vance Shipley wrote: >} http://www.sics.se/~joe/ericsson/du98024.html > >Just for fun I tried out this test on an UltraSparc 5 >running Solaris 8 and R9B-0. I found that it started >paging at about 70K processes with 256MB of memory so I >upgraded it to 512MB and found I could go to 180K processes >before it paged. > >$ erl +P 262144 +A 32 >Erlang (BEAM) emulator version 5.2 [64-bit] [source] [threads:32] I couldn't resist running a similar test on my workstation. I eventually dared going all the way to 260,000 processes, and found that the cost of spawning and sending messages remained constant all the way -- on my machine (a 440 MHz UltraSPARC), about 16 us/spawn, and 3-4 us/send. The Erlang VM grew up to about 320 MB. This is very satisfying. (= (= (= /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From mikael.karlsson@REDACTED Tue Dec 10 09:33:18 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 10 Dec 2002 09:33:18 +0100 Subject: UBF is much better than SOAP? Message-ID: <200212100933.18954.mikael.karlsson@creado.com> Hi, I had a look into Joe Armstrongs paper about Universal Binary Format (UBF): "Getting Erlang to talk to the outside world" - http://www.sics.se/~joe/talks/pittsburgh_2002_ubf.pdf and at the UBF home page: http://www.sics.se/~joe/ubf/site/home.html which states that : >> UBF(B) is a programming langauge for describing types in UBF(A) and protocols between clients and servers. UBF(B) is roughly equivalent to to Verified XML, XML-schemas, SOAP and WDSL. << Should not the "roughly equivalent to" statement be replaced with "much more than" since UBF(B) also takes care of the dynamic part (protocol description)? I do not know much about XML-Schemas and SOAP but doesn't that only give you the possibility to define the messages, in a very verbose way? It is like defining the all Signals between two systems but without sequence diagrams. This would not work for a day in the telecom world, but it seems that you can build large .internet infrastructures this way. Or am I missing something? /Mikael From klacke@REDACTED Tue Dec 10 10:08:14 2002 From: klacke@REDACTED (Klacke) Date: Tue, 10 Dec 2002 10:08:14 +0100 Subject: patches Message-ID: <20021210100814.A8977@bluetail.com> Folks, This mail is actually more to the OTP group than to the erlang-questions list. I'm bit disturbed by the way patches are sent in to this group and subsequently picked up by the otp group. It would be nice to get some feedback somehow which patches are picked up by the otp team, which are dropped and which are modified and later accepted. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From kent@REDACTED Tue Dec 10 11:29:55 2002 From: kent@REDACTED (Kent Boortz) Date: 10 Dec 2002 11:29:55 +0100 Subject: patches In-Reply-To: <20021210100814.A8977@bluetail.com> References: <20021210100814.A8977@bluetail.com> Message-ID: Klacke writes: > This mail is actually more to the OTP group than to the erlang-questions > list. I'm bit disturbed by the way patches are sent in to this group > and subsequently picked up by the otp group. > > It would be nice to get some feedback somehow which patches > are picked up by the otp team, which are dropped and which are > modified and later accepted. 0. I agree that silently just merging some and dropping others without notifying the author is not the way to handle contributions. When I had the main responsibility for the integration I know I wrote several authors about their patches but we could do better. We will discuss how we could improve the response on patches. Some background 1. We don't merge patches the same day they are sent to this list because we are busy doing other things. We go over this list before each OpenSource release to catch up on the patches. 2. Build patches are always merged into the release, i.e. make file and configure patches for improved portability. 3. Smaller patches that we can determine with visual inspection that it will not break anything else are always merged into the new OpenSource release. 4. Experimental new features are mostly accepted if they are separated from the existing code and enabled with a configure flag. 5. Larger patches or patches to critical parts of the system may take longer or never get into the source. We can't merge lots of new code into existing code without spending time understanding and verifying the new code. This take time. 6. We have to focus on quality and this sometimes get in the way of adding new features. It has also happened that we accidently lost patches, sorry about that. 7. It has been discussed before, we could of course branch of the OpenSource version from the commercial version and have less quality demands on the OpenSource version (the correction patches of course improves the quality as soon as we have had time to merge and verify them). This is not the direction we want to go, instead we want the commercial and the OpenSource version to be as close as possible. Mainly to reduce the amount of work needed for us to maintain the OpenSource version but also because we think the kind of OpenSource community we have prefer quality before features. I assure you that the lack of immediate response is no indication that we don't care. We are very thankful for the patches send to us and try to get them into a the new OpenSource release as soon as possible, kent From eduardo@REDACTED Wed Dec 11 14:50:38 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Wed, 11 Dec 2002 14:50:38 +0100 Subject: Erl-interface Message-ID: <003901c2a11c$4ad58a60$1e00a8c0@design> Does anyone know where can I download a simple program using erl-interface ? Thanks, Eduardo Figoli INswitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakanm@REDACTED Tue Dec 10 19:13:00 2002 From: hakanm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Millroth?=) Date: Tue, 10 Dec 2002 19:13:00 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: <20021209101902.A31220@bluetail.com> Message-ID: <0430BE87-0C6B-11D7-85B9-0003939B65EA@nortelnetworks.com> I taught Prolog / Logic Programming at the University for 7 years and my experience is that 90% of the students have big problems with: 1. Using logic variables (unification) efficiently. 2. Restricting non-determinism (backtracking) to places where you want it. The remaining 10% typically gets hooked for life :-) Prolog is a hard language for hard problems (as Alain Colmerauer, the father of Prolog, once said). It is a power tool that's hard to beat for the type of problems it was intended for - concurrency is not one of those problems though. Writing a compiler or natural language system is. Here is a useful metric for evaluating languages: The difference in code quality between someone who is really good at using the language and the average Joe [no offense, Joe :-)]. In Prolog, that gap is enormous, partly because bad Prolog programs are really bad (and this is mostly due to uncontrolled and unwanted non-determinism). In Erlang, the gap is much smaller - not-so-good people can actually write decent Erlang code. This is exactly what made me interested in Erlang in the first place: Compared to most "exotic power languages" (Prolog, Haskell, Oz, etc, etc) it is/was (*) so restricted and simple - and yet surprisingly efficient at handling the types of problems it was designed for. The proof was the 4-day Erlang course Ericsson once used for teaching people Erlang - at the end of the 4th day, people with very little programming experience could do some amazingly advanced things. (*) This was back in the old days, before stuff like list comprehensions, funs, etc, were added to the language. A good thing for skilled people but a bad thing for the average guy (because he won't understand it). Regarding Mozart-Oz: Implicit communication using logical variables in concurrent programs definitively gets too hard to use for non-wizards. -- Hakan Hakan Millroth Nortel Networks From etxuwig@REDACTED Tue Dec 10 20:52:39 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 10 Dec 2002 20:52:39 +0100 (MET) Subject: Impressions of Mozart-Oz In-Reply-To: <0430BE87-0C6B-11D7-85B9-0003939B65EA@nortelnetworks.com> Message-ID: On Tue, 10 Dec 2002, H?kan Millroth wrote: >(*) This was back in the old days, before stuff like list >comprehensions, funs, etc, were added to the language. A >good thing for skilled people but a bad thing for the >average guy (because he won't understand it). Actually, I've seen average programmers use lots of funs and list comprehensions. They will probably tune out if you start talking about lambdas, but they have no problem understanding the semantics of a mnesia:transaction/1 (well... they use it, at least.) And list comprehensions seem quite easy as soon as you learn to spell out the shorthand -- "the list of X where X is taken from the list L and X>17". The same goes for lists:map, foldl, etc. ...or are our average programmers not as average as I've thought? (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From DANIESC.SCHUTTE@REDACTED Wed Dec 11 08:09:52 2002 From: DANIESC.SCHUTTE@REDACTED (DANIESC SCHUTTE) Date: Wed, 11 Dec 2002 09:09:52 +0200 Subject: Dynamic Node Additions Message-ID: Good morning to all the fountains of information, from which I greedily gulp. Our current systems looks as follows: ( 2 x Solaris 8 x86 Application Servers, 1 x Sparc Solaris 8 DB) as this is a realtime system we were wondering about the way additional application server nodes can be added to share the processing load once certain critical levels are reached, and how the upgrading procedure would be done. Is there a suggested way of doing this elegantly? (We were looking at downing 1 node, loading the relevant boot scripts etc and then bringing it up again, then downing node 2 doing the same, the caveat however is that every application must be run on at least two nodes, and both those nodes must not go down simultaneously). Thank you Daniel Schutte Danie Schutte Phone: +27 - 11 - 203 - 1613 Mobile: 084-468-3138 e-Mail: Daniesc@REDACTED ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy and copies. ##################################################################################### From per@REDACTED Wed Dec 11 10:00:33 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 11 Dec 2002 10:00:33 +0100 Subject: Dynamic Node Additions In-Reply-To: Message-ID: <200212110900.gBB90YC28250@raven.levonline.com> Hi, ... [snip] ... > > (We were looking at downing 1 node, loading the relevant boot scripts etc and then bringing it up again, then downing node 2 doing the same, the caveat however is that every application must be run on at least two nodes, and both those nodes must not go down simultaneously). > (If all nodes providing a service are down there is not much to do, is it ?). Is this a SASL distributed applications ? I experienced severe problems with the distributed application at a customer site earlier this spring. My analysis was that the distributed application controller and it's underlying protocol is broken. It is really easy to get the distributed application controller into deadlock states when two nodes start at the same time (e.g. reboot after a power failure on two identical hosts). Another bizarro side effect is that dist_ac always stops the active running instance of the application in a distributed cluster of nodes and starts it on the last started node. My personal view is: use non distributed applications and roll your own interlocking and failover mechanism. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From etxuwig@REDACTED Wed Dec 11 11:26:45 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 11 Dec 2002 11:26:45 +0100 (MET) Subject: Dynamic Node Additions In-Reply-To: <200212110900.gBB90YC28250@raven.levonline.com> Message-ID: On Wed, 11 Dec 2002, Per Bergqvist wrote: >My personal view is: use non distributed applications and >roll your own interlocking and failover mechanism. Whoa! Heavy advice. I would suggest that you can get pretty far with dist_ac, though. I'm not at all sure that people in general will be more successful rolling their own than using dist_ac as it is. Having said that, we (AXD 301) don't use it. We have rolled our own distributed application controller (based on a prototype by Martin Bj?rklund). It is not for the faint of heart, but ours works well and is extremely well tested. I will look into making it available. The agreement with OTP was that it will eventually become part of OTP, but I will not promise that whatever I may publish will be compatible with whatever they may include in OTP in the future. (: Daniesc, what you can do to get started is to use dist_ac, and replicate state data in mnesia. This way, your application can get started quickly on the other node. Things to consider when you upgrade one node at a time like that: - The mnesia schema cannot be upgraded one node at a time. You could work around this by using one "registry" table (using only key+value attributes) for starters. This doesn't "solve" the problem, but gives you a chance to address it manually during your upgrade. - Make sure that you handle all interaction across node boundaries with extra care. If a procotol between processes on different erlang nodes changes, you will have a harder time (it can be handled, but complicates things). Adding a version field in messages going between nodes could help you a little down the road. I'm sure you will eventually also learn to perform smooth upgrades synchronized across multiple nodes. OTP supports this, but a good tutorial is needed... /Uffe On Wed, 11 Dec 2002, Per Bergqvist wrote: >Hi, > >... [snip] ... > >> >> (We were looking at downing 1 node, loading the relevant boot >scripts etc and then bringing it up again, then downing node 2 doing >the same, the caveat however is that every application must be run on >at least two nodes, and both those nodes must not go down >simultaneously). >> > >(If all nodes providing a service are down there is not much to do, is >it ?). > >Is this a SASL distributed applications ? >I experienced severe problems with the distributed application at a >customer site earlier this spring. >My analysis was that the distributed application controller and it's >underlying protocol is broken. >It is really easy to get the distributed application controller into >deadlock states when two nodes start at the same time (e.g. reboot >after a power failure on two identical hosts). > >Another bizarro side effect is that dist_ac always stops the active >running instance of the application in a distributed cluster of nodes >and starts it on the last started node. > >My personal view is: use non distributed applications and roll your >own interlocking and failover mechanism. > >/Per > >========================================================= >Per Bergqvist >Synapse Systems AB >Phone: +46 709 686 685 >Email: per@REDACTED > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From Marc.Vanwoerkom@REDACTED Wed Dec 11 12:16:12 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Wed, 11 Dec 2002 12:16:12 +0100 (MET) Subject: Mobile Erlang? Message-ID: <200212111116.gBBBGCF24126@bonsai.fernuni-hagen.de> Looking at all those latest cell phones, that come with Java engines, and the wealth of Bluetooth stuff.. Is Erlang used in that domain? Regards, Marc From per@REDACTED Wed Dec 11 12:33:58 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 11 Dec 2002 12:33:58 +0100 Subject: Dynamic Node Additions In-Reply-To: Message-ID: <200212111133.gBBBXwe25198@raven.levonline.com> > > Having said that, we (AXD 301) don't use it. We have rolled > our own distributed application controller (based on a > prototype by Martin Bj?rklund). It is not for the faint of > heart, but ours works well and is extremely well tested. > And this is probably why the standard dist ac is still broken ... Is anybody using it in commercial products ??? > I will look into making it available. The agreement with OTP > was that it will eventually become part of OTP, but I will > not promise that whatever I may publish will be compatible > with whatever they may include in OTP in the future. (: > Good. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From Chandrashekhar.Mullaparthi@REDACTED Wed Dec 11 12:46:35 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 11 Dec 2002 11:46:35 -0000 Subject: Dynamic Node Additions Message-ID: <04D356A3B172D611981B0008C791C312404F53@imp02mbx.t-mobile.co.uk> We use it a lot - but I have to say that it works alright in a simple case where one is a primary node and the other is a standby. Throw in a few more nodes with different applications supposed to failover to different nodes and it hasn't really worked well in production. And when there is a problem in live, there isn't much time to study what is happening. Just have to get it working quickly. So we resort to restarting the nodes. cheers Chandru -----Original Message----- From: Per Bergqvist [mailto:per@REDACTED] Sent: 11 December 2002 11:34 To: Ulf Wiger Cc: Per Bergqvist; DANIESC SCHUTTE; erlang-questions@REDACTED Subject: Re: Dynamic Node Additions > > Having said that, we (AXD 301) don't use it. We have rolled > our own distributed application controller (based on a > prototype by Martin Bj?rklund). It is not for the faint of > heart, but ours works well and is extremely well tested. > And this is probably why the standard dist ac is still broken ... Is anybody using it in commercial products ??? > I will look into making it available. The agreement with OTP > was that it will eventually become part of OTP, but I will > not promise that whatever I may publish will be compatible > with whatever they may include in OTP in the future. (: > Good. /Per 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 d98peter@REDACTED Wed Dec 11 13:12:57 2002 From: d98peter@REDACTED (Peter Strand) Date: Wed, 11 Dec 2002 13:12:57 +0100 Subject: ei_rpc vs. erl_rpc In-Reply-To: <20021206181404.B78458@zarquon.ran>; from d98peter@dtek.chalmers.se on Fri, Dec 06, 2002 at 06:14:05PM +0100 References: <20021206181404.B78458@zarquon.ran> Message-ID: <20021211131256.A22789@zarquon.ran> On Fri, Dec 06, 2002 at 06:14:05PM +0100, Peter Strand wrote: > I'm playing around a bit with erl_interface and have some > trouble with the ei_rpc function, it failes with -1 and > erl_errno == EIO when used as follows: > ei_x_new(&x); ei_x_new(&x2); > ei_x_format(&x, "[]"); > ei_rpc(&ec, fd, "net_adm", "localhost", x.buff, x.index, &x2); > Am I doing anything wrong here? Yes I was, the ei_rpc functions shouldn't have a version encoded in the argument. The documentation seems a bit weak in this area, the example for ei_rpc both encodes and decodes the version byte, and it doesn't mention that ei_rpc does more decoding than ei_rpc_from, which can be a bit surprising, at least it was for me before I looked at the source ;) Oh well, it works great now. /Peter From Sean.Hinde@REDACTED Wed Dec 11 16:40:22 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 11 Dec 2002 15:40:22 -0000 Subject: Mobile Erlang? Message-ID: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> > Looking at all those latest cell phones, that come with Java engines, > and the wealth of Bluetooth stuff.. > Is Erlang used in that domain? Not currently, though Chandru and I were musing on what it would take to compile Erlang for Symbian the other day - it would be pretty darned cool :) 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 Marc.Vanwoerkom@REDACTED Wed Dec 11 16:51:10 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Wed, 11 Dec 2002 16:51:10 +0100 (MET) Subject: Mobile Erlang? In-Reply-To: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> (message from Sean Hinde on Wed, 11 Dec 2002 15:40:22 -0000) Message-ID: <200212111551.gBBFpAu15424@bonsai.fernuni-hagen.de> > Not currently, though Chandru and I were musing on what it would take to > compile Erlang for Symbian the other day - it would be pretty darned cool :) What is a typical set of resources (CPU speed, memory) that these cell phones offer? Is there something like a common denominator? And how would that compare to a minimum Erlang system, I read about 2 MB in the FAQ 8.8 entry.. Sorry, to bother you - I really have to do my homework first and read somewhat through the mobile phone vendor specs. Regards, Marc From taavi@REDACTED Wed Dec 11 16:59:25 2002 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 11 Dec 2002 17:59:25 +0200 (EET) Subject: Mobile Erlang? In-Reply-To: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> Message-ID: <20021211175627.W35404-100000@valu.uninet.ee> On Wed, 11 Dec 2002, Sean Hinde wrote: > > Looking at all those latest cell phones, that come with Java engines, > > and the wealth of Bluetooth stuff.. > > Is Erlang used in that domain? > > Not currently, though Chandru and I were musing on what it would take to > compile Erlang for Symbian the other day - it would be pretty darned cool :) For Windows CE (Compaq IPAQ) this will be probably easier. At least their development kit seems litle bit more usable. best regards, taavi From John-Olof.Bauner@REDACTED Wed Dec 11 17:08:21 2002 From: John-Olof.Bauner@REDACTED (John-Olof Bauner) Date: Wed, 11 Dec 2002 17:08:21 +0100 Subject: Mobile Erlang? References: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> Message-ID: <3DF762F5.2000204@era.ericsson.se> Sean Hinde wrote: >>Looking at all those latest cell phones, that come with Java engines, >>and the wealth of Bluetooth stuff.. >>Is Erlang used in that domain? >> My boss tinkered with the idea 10 years ago, but then the thought was more to update the code in the phone remote, which I still think is a valid idea considering the need to update the code in the phone with new releases. John-Olof From mickael.remond@REDACTED Wed Dec 11 17:39:28 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 11 Dec 2002 17:39:28 +0100 Subject: Mobile Erlang? In-Reply-To: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> Message-ID: <1039624768.3df76a40f2f08@webmail.spamcop.net> Sean Hinde : > > Looking at all those latest cell phones, that come with Java engines, > > and the wealth of Bluetooth stuff.. > > Is Erlang used in that domain? > > Not currently, though Chandru and I were musing on what it would take to > compile Erlang for Symbian the other day - it would be pretty darned cool :) I have heard people that manage to put Erlang on Arm based Linux PDA (IPAQ with Linux system). I have also heard of some try to compile Erlang for PalmOS 3. It seems to require many change, but would allow to have Erlang on a Treo cell phone. Does someone know if PalmOS 5 (running on Arm) will ease the port of Erlang to the Palm platform ? The new palm integrate a bluetooth chip and having Erlang running on it would be sexy. I have know idea of the required changes and how hard it is... -- Micka?l R?mond From r.raschke@REDACTED Wed Dec 11 18:13:08 2002 From: r.raschke@REDACTED (Robert Raschke) Date: Wed, 11 Dec 2002 17:13:08 +0000 Subject: Erl-interface In-Reply-To: ("Eduardo Figoli" Wed, 11 Dec 2002 14:50:38 +0100) <003901c2a11c$4ad58a60$1e00a8c0@design> References: <003901c2a11c$4ad58a60$1e00a8c0@design> Message-ID: <24383.1039626788@blueyonder.co.uk> Hi, here is some of my work in progress trying to wrap up a larger library (reduced to math.h's sin() and pow() for demonstration purposes :-) that I would like to access from Erlang. Part of what I want to achieve is to have the library accessible from anywhere in a Erlang network of nodes. So, I wrote some support code to enable me to start the library as a node itself. Both starting it on its own as a node registering with epmd and starting it with a connection to an already existing node is supported. I currently only deal with simple messages, once I've read up on linking and such, I might want to extend things to deal with that as well. Ages ago I tried playing with IG, but never really got off the ground because the data structures I am dealing with are very complex. I have to write my own translation routines anyway, so just writing the whole thing from scratch, bypassing any automatic code generation, was the way forward for me. (I did try to understand Corba at some point, but my brain wasn't big enough, so I gave up.) I have tried this running in a variety of configurations under Windows NT and Solaris (the C node on either and the Erlang node on either), and everything looks very transparent. I hope this may prove to be interesting to people. And, of course, feedback will be gratefully received. Oh, compiling I do roughly like this: NT: cl -c -I%ERL_HOME%/erl_interface-3.3.2/include -D_WINDOWS simple.c link /NODEFAULTLIB:libc.lib /NODEFAULTLIB:msvcrtd.lib /SUBSYSTEM:console /LIBPATH:c:/progra~1/micros~3/vc98/lib simple.obj /LIBPATH:%ERL_HOME%/erl_interface-3.3.2/lib liberl_interface.lib libei.lib WSock32.lib Solaris: cc -c -I$ERL_HOME/erl_interface-3.3.2/include simple.c cc -o simple simple.o -L$ERL_HOME/erl_interface-3.3.2/lib -lerl_interface -lei -lsocket -lnsl -lresolv And running as a standalone node (randomly chosen port no) (epmd needs to be up for this): ; simple nodeid -server 9898 Or connecting to existing node: ; simple nodeid -client othernode@REDACTED The Erlang side I start like this: ; erl -name othernode -setcookie secretcookie Obviously, you'll need to adapt the Erlang code to reflect your node and machine names. Next on my list is to make the Erlang side be a gen_server proper. Robby -------------- next part -------------- -module(simple). -export([sin/1, pow/2]). sin(X) when number(X) -> call_simple(e_sin, {X}). pow(X, Y) when number(X), number(Y)-> call_simple(e_pow, {X, Y}). call_simple(Fn, Params) -> {any, 'nodeid@REDACTED'} ! {call, self(), Fn, Params}, receive {nodeid, ok, Result} -> {ok, Result}; {nodeid, error, Reason, Details} -> {error, Reason, Details} end. -------------- next part -------------- #include #include #include #if defined(_WINDOWS) # include #else # include # include # include # include # include #endif #ifndef MAXHOSTNAMELEN # define MAXHOSTNAMELEN 256 /* Sensible value */ #endif #include "erl_interface.h" #include "ei.h" #define BUFSIZE 1000 static void usage(void) { fprintf(stderr, "simple {-client |-server }\n"); exit(1); } /* wrapped functions */ #include static void e_sin(ETERM *from, ETERM *params); static void e_pow(ETERM *from, ETERM *params); static struct { const char *name; void (*function)(ETERM *from, ETERM *params); } function_list[] = { { "e_sin", e_sin }, { "e_pow", e_pow }, }; #define N_FUNCS (sizeof function_list / sizeof function_list[0]) /* some support functions */ #if defined(_WINDOWS) static int initWinsock(); #endif static int my_listen(unsigned short port); static void main_message_loop(); static void handle_regular_message(ETERM *msg); /* GLOBAL STATE! */ static char *nodeid; /* used in error messages */ static int fd; /* socket to Erlang node */ int main(int argc, char **argv) { unsigned short port = 0; char *node = NULL; char *fullnodeid; /* @ */ char hostname[MAXHOSTNAMELEN]; /* name of machine we're running on */ struct hostent *host; /* host info on machine */ struct in_addr *addr; /* 32-bit IP number of host */ int listen_socket; ErlConnect conn; /* Connection data */ if (argc != 4) usage(); nodeid = (char *) malloc(strlen(argv[1]) + 1); strcpy(nodeid, argv[1]); if (strncmp(argv[2], "-client", 7) == 0) node = argv[3]; else if (strncmp(argv[2], "-server", 7) == 0) port = (unsigned short) atoi(argv[3]); else usage(); #if defined(_WINDOWS) if (! initWinsock()) return -1; #endif erl_init(NULL, 0); if (gethostname(hostname, MAXHOSTNAMELEN) != 0) erl_err_sys("Error: cannot determine host name"); if ((host = gethostbyname(hostname)) == NULL) erl_err_sys("Error: cannot retrieve host information"); /* The name in the hostent structure is guaranteed to be the fully qualified name. */ if (strlen(host->h_name) >= MAXHOSTNAMELEN) erl_err_quit("Error: cannot deal with overlong fully qualified host name."); sprintf(hostname, "%s", host->h_name); if ((fullnodeid = (char *) malloc(strlen(nodeid) + 1 + strlen(hostname) + 1)) == NULL) erl_err_quit("Error: out of memory."); sprintf(fullnodeid, "%s@%s", nodeid, hostname); addr = (struct in_addr *) host->h_addr; if (! erl_connect_xinit(hostname, nodeid, fullnodeid, addr, "secretcookie", 0)) erl_err_sys("Error: initialisation failed"); if (port != 0) { if ((listen_socket = my_listen(port)) <= 0) erl_err_sys("Error: cannot open socket"); if (erl_publish(port) == -1) erl_err_sys("Error: cannot register with local name server"); if ((fd = erl_accept(listen_socket, &conn)) == ERL_ERROR) erl_err_sys("Error: cannot accept connection"); erl_err_msg("Connected to %s .", conn.nodename); } else if (node != NULL) { if ((fd = erl_connect(node)) < 0) erl_err_sys("Error: cannot connect to node"); erl_err_msg("Connected to %s .", node); } else { erl_err_quit("Error: bad connection information."); } main_message_loop(); erl_err_msg("Disconnecting."); if (erl_close_connection(fd) != 0) erl_err_sys("Error: failed to close Erlang connection"); #if defined(_WINDOWS) closesocket(listen_socket); #else close(listen_socket); #endif return 0; } #if defined(_WINDOWS) static int initWinsock() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2, 0); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { /* Tell the user that we couldn't find a usable WinSock DLL. */ return 0; } /* Confirm that the WinSock DLL supports 2.0. Note that if the DLL supports versions greater than 2.0 in addition to 2.0, it will still return 2.0 in wVersion since that is the version we requested. */ if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) { /* Tell the user that we couldn't find a usable WinSock DLL. */ WSACleanup(); return 0; } /* The WinSock DLL is acceptable. Proceed. */ return 1; } #endif static int my_listen(unsigned short port) { int listen_socket; struct sockaddr_in addr; int on = 1; if ((listen_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) return -1; setsockopt(listen_socket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); memset((void *) &addr, 0, (size_t) sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(listen_socket, (struct sockaddr *) &addr, sizeof(addr)) != 0) return -1; if (listen(listen_socket, 5) != 0) return -1; return listen_socket; } static void main_message_loop() { int got; /* Result of receive */ unsigned char buf[BUFSIZE]; /* Buffer for incoming message */ ErlMessage emsg; /* Incoming message */ while (1) { got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); if (got == ERL_TICK) { /* ignore */ } else if (got == ERL_ERROR) { break; /* leave the loop */ } else { switch (emsg.type) { case ERL_REG_SEND: handle_regular_message(emsg.msg); erl_free_term(emsg.from); erl_free_term(emsg.msg); break; case ERL_SEND: erl_err_msg("Ignoring SEND message type."); erl_free_term(emsg.to); erl_free_term(emsg.msg); break; case ERL_LINK: erl_err_msg("Ignoring LINK message type."); erl_free_term(emsg.from); erl_free_term(emsg.to); break; case ERL_UNLINK: erl_err_msg("Ignoring UNLINK message type."); erl_free_term(emsg.from); erl_free_term(emsg.to); break; case ERL_EXIT: erl_err_msg("Ignoring EXIT message type."); erl_free_term(emsg.from); erl_free_term(emsg.to); erl_free_term(emsg.msg); break; default: erl_err_msg("Ignoring unknown message type."); break; } } } } static void handle_regular_message(ETERM *msg) { ETERM *call_pattern; ETERM *from, *params; ETERM *fn, *res; int i; call_pattern = erl_format("{call, Pid, Fn, Params}"); if (! erl_match(call_pattern, msg)) { erl_err_msg("Ignoring malformed message (not {call, Pid, Fn, Params})."); } else { from = erl_var_content(call_pattern, "Pid"); fn = erl_var_content(call_pattern, "Fn"); params = erl_var_content(call_pattern, "Params"); if (! ERL_IS_PID(from)) { erl_err_msg("Ignoring malformed message (no return PID)."); } else { if (! (ERL_IS_ATOM(fn) && ERL_IS_TUPLE(params))) { res = erl_format("{~a, error, unrecognized_message, ~w}", nodeid, msg); erl_send(fd, from, res); erl_free_term(res); } else { /* There is potential for optimising this to not use a string lookup, but use array indices instead. That would mean amending the caller (Erlang) to pass through function id's as numbers rather than strings. The numbers being indices into the above array. */ for (i = 0; i < N_FUNCS; i++) { if (strcmp(ERL_ATOM_PTR(fn), function_list[i].name) == 0) { (*(function_list[i].function))(from, params); break; /* leave loop */ } } if (i == N_FUNCS) { res = erl_format("{~a, error, unrecognized_function, ~w}", nodeid, fn); erl_send(fd, from, res); erl_free_term(res); } } } erl_free_term(from); erl_free_term(params); erl_free_term(fn); } erl_free_term(call_pattern); } static void send_badarg_error(ETERM *from, char *fn_name, ETERM *params) { ETERM *res; res = erl_format("{~a, error, badarg, [~a, ~w]}", nodeid, fn_name, params); erl_send(fd, from, res); erl_free_term(res); } static void e_sin(ETERM *from, ETERM *params) { ETERM *arg_term; ETERM *res_term; double arg; double res; if (ERL_TUPLE_SIZE(params) != 1) { send_badarg_error(from, "e_sin", params); return; } arg_term = erl_element(1, params); if (ERL_IS_FLOAT(arg_term)) arg = ERL_FLOAT_VALUE(arg_term); else if (ERL_IS_INTEGER(arg_term)) arg = ERL_INT_VALUE(arg_term); else if (ERL_IS_UNSIGNED_INTEGER(arg_term)) arg = ERL_INT_UVALUE(arg_term); else { send_badarg_error(from, "e_sin", params); return; } erl_free_term(arg_term); res = sin(arg); /* Need to check errno here and do the right thing! */ res_term = erl_format("{~a, ok, ~f}", nodeid, res); erl_send(fd, from, res_term); erl_free_term(res_term); } static void e_pow(ETERM *from, ETERM *params) { ETERM *x_term; ETERM *y_term; ETERM *res_term; double x; double y; double res; if (ERL_TUPLE_SIZE(params) != 2) { send_badarg_error(from, "e_pow", params); return; } x_term = erl_element(1, params); y_term = erl_element(2, params); if (ERL_IS_FLOAT(x_term)) x = ERL_FLOAT_VALUE(x_term); else if (ERL_IS_INTEGER(x_term)) x = (double) ERL_INT_VALUE(x_term); else if (ERL_IS_UNSIGNED_INTEGER(x_term)) x = (double) ERL_INT_UVALUE(x_term); else { send_badarg_error(from, "e_pow", params); return; } if (ERL_IS_FLOAT(y_term)) y = ERL_FLOAT_VALUE(y_term); else if (ERL_IS_INTEGER(y_term)) y = (double) ERL_INT_VALUE(y_term); else if (ERL_IS_UNSIGNED_INTEGER(y_term)) y = (double) ERL_INT_UVALUE(y_term); else { send_badarg_error(from, "e_pow", params); return; } erl_free_term(x_term); erl_free_term(y_term); res = pow(x, y); /* Need to check errno here and do the right thing! */ res_term = erl_format("{~a, ok, ~f}", nodeid, res); erl_send(fd, from, res_term); erl_free_term(res_term); } From kent@REDACTED Wed Dec 11 19:12:13 2002 From: kent@REDACTED (Kent Boortz) Date: 11 Dec 2002 19:12:13 +0100 Subject: ei_rpc vs. erl_rpc In-Reply-To: <20021211131256.A22789@zarquon.ran> References: <20021206181404.B78458@zarquon.ran> <20021211131256.A22789@zarquon.ran> Message-ID: Peter Strand writes: > On Fri, Dec 06, 2002 at 06:14:05PM +0100, Peter Strand wrote: > > I'm playing around a bit with erl_interface and have some > > trouble with the ei_rpc function, it failes with -1 and > > erl_errno == EIO when used as follows: > > ei_x_new(&x); ei_x_new(&x2); > > ei_x_format(&x, "[]"); > > ei_rpc(&ec, fd, "net_adm", "localhost", x.buff, x.index, &x2); > > Am I doing anything wrong here? > > Yes I was, the ei_rpc functions shouldn't have a version encoded > in the argument. > > The documentation seems a bit weak in this area, the example for > ei_rpc both encodes and decodes the version byte, and it doesn't mention > that ei_rpc does more decoding than ei_rpc_from, which can be a bit > surprising, at least it was for me before I looked at the source ;) Thank you for pointing out the errors in the ei_rpc*() documentation, I have updated it. I'm reorganizing, updating and correcting the erl_interface/ei source at the moment and try to catch documentation mistakes at the same time. Haven't tried the old or the updated example but the old one I'm quite sure didn't work at all and not only because the version header was added, kent int ei_rpc(ei_cnode *ec, int fd, char *mod, char *fun, const char *argbuf, int argbuflen, ei_x_buff *x) int ei_rpc_to(ei_cnode *ec, int fd, char *mod, char *fun, const char *argbuf, int argbuflen) int ei_rpc_from(ei_cnode *ec, int fd, int timeout, erlang_msg *msg, ei_x_buff *x) Remote Procedure Call from C to Erlang

These functions support calling Erlang functions on remote nodes. ei_rpc_to() sends an rpc request to a remote node and ei_rpc_from() receives the results of such a call. ei_rpc() combines the functionality of these two functions by sending an rpc request and waiting for the results. See also rpc:call/4.

ec is the C-node structure previously initiated by a call to ei_connect_init() or ei_connect_xinit()

fd is an open descriptor to an Erlang connection.

timeout is the maximum time (in ms) to wait for results. Specify ERL_NO_TIMEOUT to wait forever. ei_rpc() will wait infinitely for the answer, i.e. the call will never time out.

mod is the name of the module containing the function to be run on the remote node.

fun is the name of the function to run.

argbuf is a pointer to a buffer with an encoded Erlang list, without a version magic number, containing the arguments to be passed to the function.

argbuflen is the length of the buffer containing the encoded Erlang list.

msg structure of type erlang_msg and contains information on the message received. See ei_receive_msg() for a description of the erlang_msg format.

x points to the dynamic buffer that receives the result. For ei_rpc_from() this will return a 2-tuple {rex,Reply}, for ei_rpc() this will be the result without the tuple.

ei_rpc() returns the number of bytes in the result on success and -1 on failure. ei_rpc_from() returns number of bytes or one of ERL_TICK, ERL_TIMEOUT and ERL_ERROR otherwise. When failing, all three functions set erl_errno to one of: EIO I/O error. ETIMEDOUT Timeout expired. EAGAIN Temporary error: Try again.

Example, check to see if an erlang process is alive: int index = 0, is_alive; ei_x_buff args, result; ei_x_new(&result); ei_x_new(&args); ei_x_encode_list_header(&args, 1); ei_x_encode_pid(&args, &check_pid); ei_x_encode_empty_list(&args); if (ei_rpc(&ec, fd, "erlang", "is_process_alive", args.buff, args.index, &result) < 0) error(); if (ei_decode_version(result.buff, &index) < 0 || ei_decode_bool(result.buff, &index, &is_alive) < 0) error(); From kent@REDACTED Wed Dec 11 19:25:07 2002 From: kent@REDACTED (Kent Boortz) Date: 11 Dec 2002 19:25:07 +0100 Subject: Erl-interface In-Reply-To: <24383.1039626788@blueyonder.co.uk> References: <003901c2a11c$4ad58a60$1e00a8c0@design> <24383.1039626788@blueyonder.co.uk> Message-ID: Robert Raschke writes: > I hope this may prove to be interesting to people. And, of course, > feedback will be gratefully received. For new project we recommend to use the more low level library 'ei' (liberl_interface.a uses 'ei'). It gives more control over memory allocation etc, kent From martin@REDACTED Wed Dec 11 19:25:38 2002 From: martin@REDACTED (martin j logan) Date: 11 Dec 2002 12:25:38 -0600 Subject: Dynamic Node Additions In-Reply-To: References: Message-ID: <1039631139.6148.87.camel@berimbau> Hello, I am not sure how the real time constraints on your system would mesh with this solution. The way that we have chosen to design applications when possible is so that they are dynamically scalable. Knowledge of other producers/consumers is discovered at run time with out configuration. The way the system works is that first a new node must find a single node that is already in the node cluster that it is to join. This is accomplished with DNS SRV records. Once it is a member of the appropriate cluster it relies on the "resource_discovery" application included in all Vail dynamic discovery apps .rel files. The way that this dynamic discovery works is it contains at start up a list of the generic resource names that the node provides the network coupled with the tokens, usually pid() or {atom(), node()}, to access those resources. It also contains the generic names of the remote resources that the node itself needs to function. The cluster is then given this information, cluster being nodes(), via an async message. The nodes that require any of the resources the new node possesses cache the appropriate tokens the new node provided. The nodes that contain resources the new node needed to function respond to that new node with the tokens for the resources were requested. This is similar for mnesia in the basic case. When a node comes up it comes up with a blank schema and finds the nodes that are already running with the correct schema via resource discovery. The new node then does a change_config, with one of the nodes that were discovered, and then adds table copies. In this manner it becomes one of the replicating members of that resource pool. Example: Say there are two clients and one server clients would include in their resource discovery lists something like this. % the list of resources the client has [{client, self()}] %The list of resources that the client wants to be aware of [server] A server would have something like this. % the list of resources the server has, in this case its token is a % {registered name, node()} [{server, {app_server, some_app@REDACTED}}] %The list of resources that the server wants to be aware of [] So when you bring up a new client the server would see that the new node wants to be aware of servers and hand off its token to that client. If a new server were to be brought up then the client would see that it has been messaged by a server and cache that servers token. So at this point the client would know about all servers in the cluster and be able to use them as an application programmer sees fit. When it is discovered that a server is no longer there the app programmer deletes it from the cache of servers. Perhaps this is too simple a solution for your application. It seems to work in many of the cases that we have here and allows for minimal configuration, minimal deployment headache, and maximal scalability. Cheers, Martin On Wed, 2002-12-11 at 01:09, DANIESC SCHUTTE wrote: > Good morning to all the fountains of information, from which I greedily gulp. > > Our current systems looks as follows: > > ( 2 x Solaris 8 x86 Application Servers, 1 x Sparc Solaris 8 DB) > > as this is a realtime system we were wondering about the way additional application server nodes can be added to share the processing load once certain critical levels are reached, and how the upgrading procedure would be done. > > Is there a suggested way of doing this elegantly? > > (We were looking at downing 1 node, loading the relevant boot scripts etc and then bringing it up again, then downing node 2 doing the same, the caveat however is that every application must be run on at least two nodes, and both those nodes must not go down simultaneously). > > Thank you > Daniel Schutte > > Danie Schutte > Phone: +27 - 11 - 203 - 1613 > Mobile: 084-468-3138 > e-Mail: Daniesc@REDACTED > > ##################################################################################### > The information contained in this message and or attachments is intended > only for the person or entity to which it is addressed and may contain > confidential and/or privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance upon, > this information by persons or entities other than the intended recipient > is prohibited. If you received this in error, please contact the sender and > delete the material from any system and destroy and copies. > ##################################################################################### From enano@REDACTED Wed Dec 11 19:29:14 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Wed, 11 Dec 2002 19:29:14 +0100 (CET) Subject: Mobile Erlang? In-Reply-To: <20021211175627.W35404-100000@valu.uninet.ee> References: <20021211175627.W35404-100000@valu.uninet.ee> Message-ID: On Wed, 11 Dec 2002, Taavi Talvik wrote: > For Windows CE (Compaq IPAQ) this will be probably easier. At least their > development kit seems litle bit more usable. Given the memory requirements for a useable CE setup, at least erlang would be less resource starved than on most other embedded environments };) From eduardo@REDACTED Thu Dec 12 16:50:01 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Thu, 12 Dec 2002 16:50:01 +0100 Subject: Erl-interface Message-ID: <009601c2a1f6$2292fbc0$1e00a8c0@design> I don't understand very well how ports in C/C++ can be use in an asynchronous way. The port needs the caller PID (Process ID) to answer for a request after a certain amount of time has passed and other requests to the port where made (async). How can the port know the PID to answer to ? Should I pass the PID to my port (C program) ? Again, thanks to everybody, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Dec 11 23:06:36 2002 From: vances@REDACTED (Vance Shipley) Date: Wed, 11 Dec 2002 17:06:36 -0500 Subject: Mobile Erlang? In-Reply-To: <200212111551.gBBFpAu15424@bonsai.fernuni-hagen.de> References: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> <200212111551.gBBFpAu15424@bonsai.fernuni-hagen.de> Message-ID: <20021211220636.GC48863@frogman.motivity.ca> Can we port the Erlang emulator to Java? Qualcomm's BREW? :) -Vance From Marc.Vanwoerkom@REDACTED Thu Dec 12 00:15:37 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 12 Dec 2002 00:15:37 +0100 (MET) Subject: [freebsd] new erlang related packages In-Reply-To: <20021116012910.R20684-100000@olgeni.olgeni> (message from Jimmy Olgeni on Sat, 16 Nov 2002 01:32:12 +0100 (CET)) Message-ID: <200212112315.gBBNFb814047@bonsai.fernuni-hagen.de> > > The error message comes after a short pause. > > Any idea? > > No clue here, looks fine on -stable. Which tcl/wish package are you > using? Hi Jimmy, I finally understood what was going on: Your port has no dependency on tcl/tk. When I had the R8B release, which worked fine with graphics mode, I probably had some tcl/tk version installed. Before I built R9B, which had the mentioned problem, I updated my system from a several months old FreeBSD 5.0-CURRRENT to the latest known to build -CURRENT. To avoid version problems, I nuked X11 as well and all depending apps, rebuilding everything I needed afterwards. Obviously there was no tcl/tk package among those rebuilt ports. Suggestion: As Erlang runs fine without GUI, I would change the port to handle both cases well. Your present port seems to decide this depending on the definition of the WITHOUT_X11 variable. So you must insist on having some tcl/tk version installed, in case that variable is undefined. I would also have a look on how other tcl/tk depending ports handle the various tcl/tk versions, R9B seems to want 8.3 and above (there was a message on this list regarding the version needed). What kind of frustrates me is that I did not infer that simple problem reason from the error messages.. :) The graphical toolbar comes up now. What not works is the ball demo, albeit I can ping/pong two nodes successfully.. hm. Regards, Marc From Marc.Vanwoerkom@REDACTED Thu Dec 12 00:26:03 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 12 Dec 2002 00:26:03 +0100 (MET) Subject: Mobile Erlang? In-Reply-To: <20021211220636.GC48863@frogman.motivity.ca> (message from Vance Shipley on Wed, 11 Dec 2002 17:06:36 -0500) Message-ID: <200212112326.gBBNQ3J14899@bonsai.fernuni-hagen.de> > Can we port the Erlang emulator to Java? What Erlang emulator do you mean? > Qualcomm's BREW? :) Another VM. ;) What I just read about minimum requirements on http://www.forum.nokia.com/main/1,35452,1_0_37,00.html --------------------------------------------------------------------------- Q11. What are the minimum hardware requirements in the MIDP environment? Display: Screen size: 96 x 54 Display depth: 1-bit Pixel shape: 1:1 Input: One or more of the following: "one-handed keyboard", "two- handed keyboard"(QWERTY), touch screen Memory: 128 kB of non-volatile memory for MIDP components 8 kB of non-volatile memory for application-created persistent data 32 kB volatile memory for Java runtime Networking: Two-way, wireless, with limited bandwidth --------------------------------------------------------------------------- Is not too exciting. - 30kb maximum on midlet size (ok, that's byte code and quite compact). - no bluetooth - just http for communications - no standard infrared port access - no pixel access to display I hope that information is outdated. Regards, Marc From kent@REDACTED Thu Dec 12 00:33:55 2002 From: kent@REDACTED (Kent Boortz) Date: 12 Dec 2002 00:33:55 +0100 Subject: Erl-interface In-Reply-To: <009601c2a1f6$2292fbc0$1e00a8c0@design> References: <009601c2a1f6$2292fbc0$1e00a8c0@design> Message-ID: "Eduardo Figoli" writes: > I don't understand very well how ports in C/C++ can be use in an > asynchronous way. > The port needs the caller PID (Process ID) to answer for a request after a > certain amount of time has passed and other requests to the port where made > (async). > How can the port know the PID to answer to ? > Should I pass the PID to my port (C program) ? You mean that you have an external C/C++ program? This sound as a general asynchronous request/reply problem, you have to identify who you are to send the answer to somehow. You could pass the pid to the port program or use the port owner as a proxy where you let it save the mapping between a request identifier (an integer) and the pid of the process that are to get the answer. If the "clients" waiting for the answers can die and you want to pass on a cancellation to the port program you can "monitor" or "link" to the client processes. This way the proxy get a message when they terminate and can send on the information to the port program. All messages from the port are sent to the port owner so you need to use it to pass on the messages from the port program to the client anyway. I may misunderstand what you want to do, kent From luther@REDACTED Thu Dec 12 01:11:04 2002 From: luther@REDACTED (Luther Huffman) Date: Wed, 11 Dec 2002 19:11:04 -0500 Subject: elink and OS X Message-ID: <344FE2AE-0D66-11D7-AF62-00039366D058@widgeon.org> I've built R9B-0 on OS X 10.2.2 with no problems. Erl runs with no difficulties. Compiling with ecc seems to present no problems either (as far as I can tell). My elink, however, seems to be ill-formed. Using elink gives me: luther% ecc factorial.erl luther% elink factorial.beam Cannot parse arguments:["factorial.beam"] Usage: elink -t [windows | unix] [-d | -s] -o out[.exe] -S mod -m m1.beam m2.beam m2.beam ... Any ideas? Does this work for others? Regards, Luther From fritchie@REDACTED Thu Dec 12 04:54:48 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 11 Dec 2002 21:54:48 -0600 Subject: Erl-interface In-Reply-To: Message of "Wed, 11 Dec 2002 17:13:08 GMT." <24383.1039626788@blueyonder.co.uk> Message-ID: <200212120354.gBC3smF85400@snookles.snookles.com> >>>>> "rr" == Robert Raschke writes: rr> here is some of my work in progress trying to wrap up a larger rr> library (reduced to math.h's sin() and pow() for demonstration rr> purposes :-) that I would like to access from Erlang. If you haven't looked at it, you might want to look at the Erlang Driver Toolkit, EDTK. I wrote a paper about it for the Erlang workshop at the ACM PLI 2002 conference this year in Pittsburgh. The paper and the source code is available at http://www.snookles.com/erlang/edtk/. I have a large amount of extra documentation I'm nearly finished with -- I can get you a copy ahead of the "1.0" release if you're curious. -Scott From Pantov_O@REDACTED Thu Dec 12 08:22:24 2002 From: Pantov_O@REDACTED (Ognian Pantov [ MTN - Sandhurst ]) Date: Thu, 12 Dec 2002 09:22:24 +0200 Subject: How to increase the size of atom_tab? Message-ID: <6D9893466466AB4587F7C60C43F7B9F901978BFE@SDHMAIL.mtn.co.za> Hi, The size of atom_tab is fixed to 1048576. I need to increase the size of atom_tab table. How can I do this? Thank you Ognian From jay@REDACTED Thu Dec 12 06:41:54 2002 From: jay@REDACTED (Jay Nelson) Date: Wed, 11 Dec 2002 21:41:54 -0800 Subject: Symbian Message-ID: <4.2.2.20021211214043.00d104a0@duomark.com> > Not currently, though Chandru and I were musing on what it would take to > compile Erlang for Symbian the other day - it would be pretty darned cool > :)Sean I would _love_ to have Erlang running on my Psion 7!!! From erlang@REDACTED Thu Dec 12 09:53:05 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 12 Dec 2002 08:53:05 +0000 Subject: Mobile Erlang? References: <04D356A3B172D611981B0008C791C3126BF607@imp02mbx.t-mobile.co.uk> Message-ID: <3DF84E71.9020404@manderp.freeserve.co.uk> Hi Sean, Did you reach any conclusions? I would imagine that the port and cross compilation is not trivial, considering the idiosyncratic manner Symbiants write C++ programs. Pete. Sean Hinde wrote: >>Looking at all those latest cell phones, that come with Java engines, >>and the wealth of Bluetooth stuff.. >>Is Erlang used in that domain? >> >> > >Not currently, though Chandru and I were musing on what it would take to >compile Erlang for Symbian the other day - it would be pretty darned cool :) > >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 mike@REDACTED Thu Dec 12 10:28:43 2002 From: mike@REDACTED (Mike Williams) Date: 12 Dec 2002 09:28:43 GMT Subject: Impressions of Mozart-Oz References: <20021209101902.A31220@bluetail.com>, <20021209143217.88721.qmail@web40809.mail.yahoo.com> Message-ID: |> There hasn't been a Functional/Logic |> programming trend like the OO fad that swept the scene (Not a trendy |> concept? Maybe before my time? It is old after all...), Language fads to remember are: Assembly --> FORTRAN Stuctured programming ---> Pascal, Algol Pascal, Algol ---> C (a step backwards, but driven by Unix) Pascal ---> Ada (there was a heck of a lot of hype around Ada at one time) Proper concurrency in UNIX (Select, sockets, IP - far too heavyweight, was was very influential on programming style if not really a language fad, "select" in Unix comes from Ada's "select" (I think)) C ---> C++, OO (Objective C etc never stood a chance) C++ ---> Java (well I suppose it can be seen as a *slight* improvment) Java/C++ ---> UML (Another step backwards) |> and Ericsson, |> despite the courageous erlang.org Open Source effort, hasn't invested |> the kind of effort of the same scale that propelled C++ and Java into |> prominence. It's no fault of theirs, they're sadly not going to make |> money out of Erlang. We (Ericsson) had the crazy idea we could make money by selling Erlang and set up a limitted company "Erlang Systems AB" to market and sell Erlang. I was CEO of this company for a couple of years. With the benefit of hindsight If we had made Erlang open source then, about two years before the Java "fad" we might have seen the spread of Erlang earlier. On the other hand Erlang was not so stable then and didn't have so many applications. |> The remarkable thing is that Erlang is growing in popularity simply due |> to its technical superiority. This is a freakish rareity! Not so freakish, for example things like TCL/TK and Perl are speading without any marketting effort. The initial spread of Linux also had no marketting behind it. We will know that Erlang has made it into the mainstream if large companies (like the ones nowadays pushing Linux) start pushing Erlang. /Mike W PS. Hindsight again, Joe pointed out to me another thing we did wrong. We pushed Erlang as a Declarative / Functional language. If we had played down these aspects and pushed it as a "concurrency oriented" language we might From vlad_dumitrescu@REDACTED Thu Dec 12 11:32:16 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 12 Dec 2002 11:32:16 +0100 Subject: New apps to R8B Message-ID: Hello! I wonder if it is possible to move some of the new applications in R9 back to R8 - am interested in ET and Observer. Will they run? Is anything else needed from the other apps? I can't try it right now, but have to decide whether to plan for it. Thanks for the help. best regards, Vlad From hakan@REDACTED Thu Dec 12 11:47:11 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 12 Dec 2002 11:47:11 +0100 (MET) Subject: New apps to R8B In-Reply-To: Message-ID: On Thu, 12 Dec 2002, Vlad Dumitrescu wrote: Vlad> I wonder if it is possible to move some of the new applications in R9 back Vlad> to R8 - am interested in ET and Observer. Vlad> Vlad> Will they run? Vlad> Is anything else needed from the other apps? In R8, ET was a part of the Megaco application. You can either use that old version of ET as it is, or pick both ET and Megaco from R9. /H?kan From etxuwig@REDACTED Thu Dec 12 12:08:18 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 12 Dec 2002 12:08:18 +0100 (MET) Subject: undefined erlang snot? Message-ID: I tried running a program compiled for OTP R7B in OTP R9B, and got the following crash: ** exited: {undef,[{erlang,snot,[true]}, {sysFs,find,3}, {recomp,process_app_dir,2}, {recomp,process_apps,2}, {recomp,build,3}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** ** Terminating erlang (nonode@REDACTED) ** The line of code causing this must be: Thorough = not(lists:member(lazy, Opts)), I don't quite recall if running OTP R7B applications in OTP R9B is _guaranteed_ to work, but it does seem to work most of the time. Is the above problem an OTP bug then? /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From matthias@REDACTED Thu Dec 12 12:36:56 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 12 Dec 2002 12:36:56 +0100 Subject: undefined erlang snot? In-Reply-To: References: Message-ID: <15864.29912.815674.662086@antilipe.corelatus.se> Ulf Wiger writes: > I tried running a program compiled for OTP R7B in OTP R9B, > and got the following crash: [...] > I don't quite recall if running OTP R7B applications in OTP > R9B is _guaranteed_ to work, but it does seem to work most > of the time. Is the above problem an OTP bug then? Last time I wondered about this, the semi-official answer seemed to be that, yes, R7 apps should work on R9 without recompiling. See: http://www.erlang.org/ml-archive/erlang-questions/200205/msg00082.html I can't reproduce your problem. If I compile this module: -module(t). -export([go/0]). go() -> Opts = [1,2,3], Thorough = not(lists:member(lazy, Opts)). with R7B-4 and then run it in R9B, it works (returns true). Matthias From LHL@REDACTED Thu Dec 12 14:15:41 2002 From: LHL@REDACTED (Lars H. Larsen, ICCC) Date: Thu, 12 Dec 2002 14:15:41 +0100 Subject: Port I/O in WIN2000 & XP Message-ID: Hello Erlang world Any ideas for implementing asynchronous I/O on Port programs in R9 for Windows 2000... The only thing that seems to work is polling to handle 0 , I can't get any (windows) overlapped I/O to work and that really kills me !! I know this works and will loop for ever: void ErlangRead() { int Cnt; BYTE Len = 0; BYTE * pb; while (1) { Cnt = read (0, &Len, 1); if (!Cnt) { return; } Cnt = read(0, pb, Len); } } regards Software developer Lars H. Larsen ICCC A/S M?l?vhovedgade 88 2760 M?l?v Denmark http://www.iccc.dk mailto:lhl@REDACTED tel:+45 44860400 GSM +45 51901320 From vlad_dumitrescu@REDACTED Thu Dec 12 18:02:27 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 12 Dec 2002 18:02:27 +0100 Subject: GS user/kernel namespaces References: Message-ID: Hi, > Did we ever answer your question? No, not before this :-) > The even/odd thing was probably just the easiest way to implement > this, Okay, thank you very much! regards, Vlad From enewhuis@REDACTED Fri Dec 13 05:06:31 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Thu, 12 Dec 2002 22:06:31 -0600 Subject: Message Routing Paradigms Message-ID: <000b01c2a25d$0524a0e0$4a00a8c0@XENO> To whomever knows, Are there any good information sources regarding Erlang message routing paradigms? I am interested in decoupling publishers and subscribers, possible space-based load-balancing (like Java Spaces or IBM T-spaces), content-based subject routing, and it must handle on order of 10K messages per second per 1GHz CPU. Sincerely, Eric Newhuis -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Fri Dec 13 09:59:58 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 13 Dec 2002 09:59:58 +0100 Subject: undefined erlang snot? In-Reply-To: Ulf Wiger's message of "Thu, 12 Dec 2002 12:08:18 +0100 (MET)" References: Message-ID: I think that your code was compiled with OTP R5B, not R7B. Boolean operators used to be implemented in Erlang in the erlang module up to and including R5B. /Bjorn Ulf Wiger writes: > I tried running a program compiled for OTP R7B in OTP R9B, > and got the following crash: > > ** exited: {undef,[{erlang,snot,[true]}, > {sysFs,find,3}, > {recomp,process_app_dir,2}, > {recomp,process_apps,2}, > {recomp,build,3}, > {erl_eval,expr,3}, > {erl_eval,exprs,4}, > {shell,eval_loop,2}]} ** > ** Terminating erlang (nonode@REDACTED) ** > > The line of code causing this must be: > > Thorough = not(lists:member(lazy, Opts)), > > > I don't quite recall if running OTP R7B applications in OTP > R9B is _guaranteed_ to work, but it does seem to work most > of the time. Is the above problem an OTP bug then? > > /Uffe > -- -- 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 Fri Dec 13 11:31:05 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 13 Dec 2002 10:31:05 -0000 Subject: Message Routing Paradigms Message-ID: <04D356A3B172D611981B0008C791C3126BF62F@imp02mbx.t-mobile.co.uk> Eric, I'm not sure there is really a need for a paradigm - it is the basis of Erlang. To get 10k per second you are probably not wanting to do a lot of processing on each message - but a simple round robin load balancer based on differently tagged messages is probably no more than a single gen_server with a little logic I'm not familiar with these different mechanisms but my guess is that they are only needed because they don't have Erlang :-) Sean -----Original Message----- From: Eric Newhuis [mailto:enewhuis@REDACTED] Sent: 13 December 2002 04:07 To: erlang-questions@REDACTED Subject: Message Routing Paradigms To whomever knows, Are there any good information sources regarding Erlang message routing paradigms? I am interested in decoupling publishers and subscribers, possible space-based load-balancing (like Java Spaces or IBM T-spaces), content-based subject routing, and it must handle on order of 10K messages per second per 1GHz CPU. Sincerely, Eric Newhuis 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 Dec 13 13:20:57 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 13 Dec 2002 13:20:57 +0100 (MET) Subject: undefined erlang snot? In-Reply-To: Message-ID: On 13 Dec 2002, Bjorn Gustavsson wrote: >I think that your code was compiled with OTP R5B, not R7B. This may well be the case (wasn't supposed to be, but I did have R5B equivalents of the modules as well. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From enewhuis@REDACTED Fri Dec 13 15:15:07 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Fri, 13 Dec 2002 08:15:07 -0600 Subject: Message Routing Paradigms In-Reply-To: <04D356A3B172D611981B0008C791C3126BF62F@imp02mbx.t-mobile.co.uk> Message-ID: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> I am aware of Erlang's messaging capabilities and yet there is still a general need for higher level protocols like the one's I mentioned. Even the CosEvent module demonstrates acceptance of the decoupled publish/subscribe paradigm. Do you or anyone else have any idea of messaging "middleware" developed with Erlang for Erlang that addresses message routing like the CosEvent module, but without the overhead of CORBA? Sincerely, Eric -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Sean Hinde Sent: Friday, December 13, 2002 4:31 AM To: 'Eric Newhuis'; erlang-questions@REDACTED Subject: RE: Message Routing Paradigms Eric, I'm not sure there is really a need for a paradigm - it is the basis of Erlang. To get 10k per second you are probably not wanting to do a lot of processing on each message - but a simple round robin load balancer based on differently tagged messages is probably no more than a single gen_server with a little logic I'm not familiar with these different mechanisms but my guess is that they are only needed because they don't have Erlang :-) Sean -----Original Message----- From: Eric Newhuis [mailto:enewhuis@REDACTED] Sent: 13 December 2002 04:07 To: erlang-questions@REDACTED Subject: Message Routing Paradigms To whomever knows, Are there any good information sources regarding Erlang message routing paradigms? I am interested in decoupling publishers and subscribers, possible space-based load-balancing (like Java Spaces or IBM T-spaces), content-based subject routing, and it must handle on order of 10K messages per second per 1GHz CPU. Sincerely, Eric Newhuis 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 Fri Dec 13 15:39:13 2002 From: jabba@REDACTED (Jani Launonen) Date: Fri, 13 Dec 2002 16:39:13 +0200 (EET) Subject: Message Routing Paradigms In-Reply-To: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> Message-ID: >I am aware of Erlang's messaging capabilities and yet there is still a >general need for higher level protocols like the one's I mentioned. > >Even the CosEvent module demonstrates acceptance of the decoupled >publish/subscribe paradigm. You might want to check out CosNotification instead of CosEvent. It gives the same functionality plus a whole lot more. >Do you or anyone else have any idea of messaging "middleware" developed >with Erlang for Erlang that addresses message routing like the CosEvent >module, but without the overhead of CORBA? If your Orbers are configured to be on the same Orber domain (http://erlang.stacken.kth.se/doc/r9b/lib/orber-3.3/doc/html/ch_install.html) they use the Erlang's distribution protocol to communicate with each other bypassing IIOP's overhead. They (in side one Orber domain) can communicate with other ORB's and other Orber domains with IIOP, of course. Cheers, Jani >Sincerely, >Eric > > > >-----Original Message----- >From: owner-erlang-questions@REDACTED >[mailto:owner-erlang-questions@REDACTED] On Behalf Of Sean Hinde >Sent: Friday, December 13, 2002 4:31 AM >To: 'Eric Newhuis'; erlang-questions@REDACTED >Subject: RE: Message Routing Paradigms > > >Eric, > >I'm not sure there is really a need for a paradigm - it is the basis of >Erlang. > >To get 10k per second you are probably not wanting to do a lot of >processing on each message - but a simple round robin load balancer >based on differently tagged messages is probably no more than a single >gen_server with a little logic > >I'm not familiar with these different mechanisms but my guess is that >they are only needed because they don't have Erlang :-) > >Sean > >-----Original Message----- >From: Eric Newhuis [mailto:enewhuis@REDACTED] >Sent: 13 December 2002 04:07 >To: erlang-questions@REDACTED >Subject: Message Routing Paradigms > > >To whomever knows, > >Are there any good information sources regarding Erlang message routing >paradigms? > >I am interested in decoupling publishers and subscribers, possible >space-based load-balancing (like Java Spaces or IBM T-spaces), >content-based subject routing, and it must handle on order of 10K >messages per second per 1GHz CPU. > > >Sincerely, >Eric Newhuis > > > > > > >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. > -+-+-+- 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 jabba@REDACTED Fri Dec 13 15:47:33 2002 From: jabba@REDACTED (Jani Launonen) Date: Fri, 13 Dec 2002 16:47:33 +0200 (EET) Subject: Message Routing Paradigms In-Reply-To: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> Message-ID: Sorry, Orber domain's idea is presented in http://erlang.stacken.kth.se/doc/r9b/lib/orber-3.3/doc/html/ch_orber_kernel.html Two things concerning CosEvent & CosNotification: as CosNotification have to support FIFO-ordering, it cannot use such optimisations as CosEvent which can use more asynchronous way to handle event as ordering is not specified. On the other hand, one can filter messages with CosNotification (consumers can subscribe to certain kind of events) and not with CosEvent (all events are received by all consumers). Cheers, -+-+-+- 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 ingela@REDACTED Fri Dec 13 16:30:13 2002 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 13 Dec 2002 16:30:13 +0100 Subject: Erlang mode in Emacs Message-ID: <15865.64773.886666.293988@gargle.gargle.HOWL> Hello everyone! I have been doing some corrections to the erlang-mode. This updated version will not be officially released until the next Erlang/OTP release. But as it is so hard to test emacs-modes with automatic test-suits I have put it into the contribution area so that you may test it right away. This way I get it properly tested and you get the benefit of my fixes already today :) http://www.erlang.org/download/contrib/ If you find an bugs old or new, please send me a mail. -- /m.v.h Ingela Ericsson AB - OTP team From vances@REDACTED Fri Dec 13 17:08:03 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 13 Dec 2002 11:08:03 -0500 Subject: Message Routing Paradigms In-Reply-To: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> References: <04D356A3B172D611981B0008C791C3126BF62F@imp02mbx.t-mobile.co.uk> <000601c2a2b2$0a3c0820$56c3cf0a@XENO> Message-ID: <20021213160803.GG51743@frogman.motivity.ca> Eric, There is the EVA application within OTP. I'm sure it's not what you are looking for but is an example of "middleware" for messaging in an Erlang/OTP system. The gen_event behaviour is a lower level building block. The language itself provides transparent distribution, named processes, handling of mailboxes and other difficult aspects of message passing. To go further brings you pretty close to the actual application context. We do this sort of thing all the time. A marshalling process is created (from a gen_server) which is the destination for all messages in a certain application context and that marshalling process makes the decision as to which of the (probably gen_fsm) processes the message should be routed to. The added functionality is that these destination processes don't need to exist at the time the first message is sent but can instead be spawned by the marshall. Also we can prequalify the messages and discard/nack them at that point. -Vance On Fri, Dec 13, 2002 at 08:15:07AM -0600, Eric Newhuis wrote: } } Do you or anyone else have any idea of messaging "middleware" developed } with Erlang for Erlang that addresses message routing like the CosEvent } module, but without the overhead of CORBA? } } Sincerely, } Eric From peter@REDACTED Fri Dec 13 18:00:53 2002 From: peter@REDACTED (Peter Lund) Date: Fri, 13 Dec 2002 18:00:53 +0100 Subject: Message Routing Paradigms In-Reply-To: <20021213160803.GG51743@frogman.motivity.ca> Message-ID: EVA (Event and Alarms) are for messages that are meant for the human operator to receive. Not to be confused with system internal machine to machine communication... > Eric, > > There is the EVA application within OTP. I'm sure it's not what you > are looking for but is an example of "middleware" for messaging in an > Erlang/OTP system. The gen_event behaviour is a lower level building > block. From vances@REDACTED Fri Dec 13 18:08:12 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 13 Dec 2002 12:08:12 -0500 Subject: Message Routing Paradigms In-Reply-To: References: <20021213160803.GG51743@frogman.motivity.ca> Message-ID: <20021213170812.GM51743@frogman.motivity.ca> Peter, I beg to differ. They are for my own handlers to receive. Whether I show to an operator is up to me. -Vance On Fri, Dec 13, 2002 at 06:00:53PM +0100, Peter Lund wrote: } EVA (Event and Alarms) are for messages that are meant for the } human operator to receive. Not to be confused with system internal } machine to machine communication... From fritchie@REDACTED Fri Dec 13 18:49:31 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 13 Dec 2002 11:49:31 -0600 Subject: Message Routing Paradigms In-Reply-To: Message of "Thu, 12 Dec 2002 22:06:31 CST." <000b01c2a25d$0524a0e0$4a00a8c0@XENO> Message-ID: <200212131749.gBDHnVF89633@snookles.snookles.com> >>>>> "en" == Eric Newhuis writes: en> I am interested in decoupling publishers and subscribers, possible en> space-based load-balancing (like Java Spaces or IBM T-spaces), Hrm. From the 90 seconds I've spent finding out what JavaSpaces are, and encountering a reference to LINDA tuple-spaces, my comment about "I've created a driver for the Spread messaging toolkit (http://www.spread.org/)" probably doesn't apply. I'm mentioning it just in case it does. {shrug} -Scott From peter@REDACTED Fri Dec 13 19:15:44 2002 From: peter@REDACTED (Peter Lund) Date: Fri, 13 Dec 2002 19:15:44 +0100 Subject: Message Routing Paradigms In-Reply-To: <20021213170812.GM51743@frogman.motivity.ca> Message-ID: You are welcome to differ, but when I was part of the AXD301 Operation and Maintenance team ages ago (1998), the focus of EVA was quite much on the human operator, even if so called "OaM expert systems" also were thought of. I am aware of that this was well before EVA was integrated into the OTP middle- ware and it may have switched focus slightly in this process. Best regards, Peter Lund > -----Ursprungligt meddelande----- > Fran: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]For Vance Shipley > Skickat: den 13 december 2002 18:08 > Till: Peter Lund > Kopia: erlang-questions@REDACTED > Amne: Re: Message Routing Paradigms > > > Peter, > > I beg to differ. They are for my own handlers to receive. Whether I > show to an operator is up to me. > > -Vance > > On Fri, Dec 13, 2002 at 06:00:53PM +0100, Peter Lund wrote: > } EVA (Event and Alarms) are for messages that are meant for the > } human operator to receive. Not to be confused with system internal > } machine to machine communication... From luke@REDACTED Fri Dec 13 18:29:49 2002 From: luke@REDACTED (Luke Gorrie) Date: 13 Dec 2002 18:29:49 +0100 Subject: Message Routing Paradigms In-Reply-To: <000b01c2a25d$0524a0e0$4a00a8c0@XENO> References: <000b01c2a25d$0524a0e0$4a00a8c0@XENO> Message-ID: "Eric Newhuis" writes: > To whomever knows, > > Are there any good information sources regarding Erlang message routing > paradigms? This seems like a nice opportunity to plug the book "Communicating Sequential Processes" by C.A.R. Hoare. That's the best description I've seen of what I think is meant when people say "Erlang programming the way it's supposed to be", even though the model is not exactly the same. What especially shines through is the use of selective-receive as a way to synchronize things. I think most Erlang programmers would really enjoy it! There are currently a bunch of second hand copies available via www.bookfinder.com, starting at US$45. Availability seems to vary a lot - I picked up a very cheap copy there a ways back, but at other times I've seen the cheapest copy being ~$150. Cheers, Luke From luke@REDACTED Fri Dec 13 17:23:29 2002 From: luke@REDACTED (Luke Gorrie) Date: 13 Dec 2002 17:23:29 +0100 Subject: Message Routing Paradigms In-Reply-To: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> References: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> Message-ID: G'day Eric, > I am aware of Erlang's messaging capabilities and yet there is still a > general need for higher level protocols like the one's I mentioned. > > Even the CosEvent module demonstrates acceptance of the decoupled > publish/subscribe paradigm. > > Do you or anyone else have any idea of messaging "middleware" developed > with Erlang for Erlang that addresses message routing like the CosEvent > module, but without the overhead of CORBA? For basic decoupled publish/subscribe in straight erlang (plus some nice features, like synchronous/blocking notification), there is the gen_event behaviour. You can find details under the 'stdlib' part of the manual: http://www.erlang.org/doc/r9b/lib/stdlib-1.11.0/doc/html/index.html In general though I think that Erlang leans on its lovely native support for concurrent/distributed programming to let you roll your own solution to the problem at hand, as oppossed to CORBA's focus on generalized frameworks. But, Erlang does have generalized frameworks for some things in the form of behaviours too (am I trying to have have my cake and eat it too? :-)) Could you post some more details about your problem? You will probably get some nice code in reply - it is rather fun to write this sort of thing in Erlang, and usually there's a very nice and simple way. As to 10,000 messages per second on 1ghz, that'd be 100 microseconds per message. Some message passing benchmarks were recently posted here under the "Design phase in Erlang" thread. I just ran Joe's benchmark (http://www.sics.se/~joe/ericsson/du98024.html) on my 800mhz Athlon and it says that sending small messages (an integer in this case) takes about 2 microseconds and constant time (doesn't depend on number of processes). That also includes the time to context-switch between processes for each message, and there is a lot of that since the processes (10,000 of them) were arranged in a chain and running in lock-step. In that case message passing should require about 2% of your time and leave you 98us/message to do what you gotta do. Not that this is conclusive or anything - you may want to send several messages per event (e.g. for flow control), if your messages are large you may want to switch to unified heap, etc etc. But it seems like a promising first approximation (unless I've missed something embarrassing :-)) Cheers, Luke From luke@REDACTED Fri Dec 13 17:46:01 2002 From: luke@REDACTED (Luke Gorrie) Date: 13 Dec 2002 17:46:01 +0100 Subject: Message Routing Paradigms In-Reply-To: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> References: <000601c2a2b2$0a3c0820$56c3cf0a@XENO> Message-ID: (Apologies if this is a repost, I had a crash while sending..) G'day Eric, > I am aware of Erlang's messaging capabilities and yet there is still a > general need for higher level protocols like the one's I mentioned. > > Even the CosEvent module demonstrates acceptance of the decoupled > publish/subscribe paradigm. > > Do you or anyone else have any idea of messaging "middleware" developed > with Erlang for Erlang that addresses message routing like the CosEvent > module, but without the overhead of CORBA? For basic decoupled publish/subscribe in straight erlang (plus some nice features, like synchronous/blocking notification), there is the gen_event behaviour. You can find details under the 'stdlib' part of the manual: http://www.erlang.org/doc/r9b/lib/stdlib-1.11.0/doc/html/index.html In general though I think that Erlang leans on its lovely native support for concurrent/distributed programming to let you roll your own solution to the problem at hand, as oppossed to CORBA's focus on generalized frameworks. But, Erlang does have generalized frameworks for some things in the form of behaviours too (am I trying to have have my cake and eat it too? :-)) Could you post some more details about your problem? You will probably get some nice code in reply - it is rather fun to write this sort of thing in Erlang, and usually there's a very nice and simple way. As to 10,000 messages per second on 1ghz, that'd be 100 microseconds per message. Some message passing benchmarks were recently posted here under the "Design phase in Erlang" thread. I just ran Joe's benchmark (http://www.sics.se/~joe/ericsson/du98024.html) on my 800mhz Athlon and it says that sending small messages (an integer in this case) takes about 2 microseconds and constant time (doesn't depend on number of processes). That also includes the time to context-switch between processes for each message, and there is a lot of that since the processes (10,000 of them) were arranged in a chain and running in lock-step. In that case communication and synchronization should require about 2% of your time and leave you 98us/message to do what you gotta do. Not that this is conclusive or anything - you may want to send several messages per event (e.g. for flow control), if your messages are large you may want to switch to unified heap, etc etc. But it seems like a promising first approximation (unless I've missed something embarrassing :-)) Cheers, Luke From etxuwig@REDACTED Fri Dec 13 20:15:00 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 13 Dec 2002 20:15:00 +0100 (MET) Subject: time for a truly threaded Erlang? Message-ID: http://kt.zork.net/kernel-traffic/kt20021007_187.html#3 "Native POSIX Thread Library 0.1 Achieves 100,000 Concurrent Threads" (on Linux) Apparently, they've been able to start and stop 100,000 POSIX threads within 2 secs on a Dual P4 with 1 GB RAM. Let's make sure the Erlang BIFs are all reentrant before this package reaches 1.0. (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From L.A.Timochouk@REDACTED Fri Dec 13 22:33:01 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Fri, 13 Dec 2002 21:33:01 +0000 (GMT) Subject: time for a truly threaded Erlang? In-Reply-To: Message-ID: But is there any need for a truly threaded Erlang? The native Linux threads (in the current version) are pretty heavy-weight, and not much different from full-fledged processes (indeed, the "fork" syscall in Linux is just a specialisation of "clone" which is used to create kernel threads). The cited posting mentions some improvements in "clone", but the relatively high cost of thread creation (compared to Erlang processes) would probably still be an issue. Multiple kernel threads can be useful only on multi-processor machines, so they can be scheduled to different CPUs. But even in that case you don't need 100,000 threads -- the reasonable number of them is bounded by the number of CPUs available. Erlang processes are so light-weight and efficient that it makes much more sense to use them, rather than kernel threads, as units of concurrency... Leonid Timochouk Computing Laboratory University of Kent at Canterbury From kent@REDACTED Fri Dec 13 23:19:08 2002 From: kent@REDACTED (Kent Boortz) Date: 13 Dec 2002 23:19:08 +0100 Subject: Port I/O in WIN2000 & XP In-Reply-To: References: Message-ID: "Lars H. Larsen, ICCC" writes: > Any ideas for implementing asynchronous I/O on Port programs in R9 > for Windows 2000... > > The only thing that seems to work is polling to handle 0 , I can't > get any (windows) overlapped I/O to work and that really kills me !! Not really an answer to your question but for the R9 GS Erlang application and Windows we let the port program (wish) open a localhost socket to Erlang. The port pipe not really used for anything. I don't know if a pipe is faster than sockets on Windows 2000 but because we support older windows versions where pipes didn't work that well this seem to be a more safe solution in our case, kent From jamesh@REDACTED Sat Dec 14 00:18:46 2002 From: jamesh@REDACTED (James Hague) Date: Fri, 13 Dec 2002 17:18:46 -0600 Subject: Impressions of Mozart-Oz Message-ID: >PS. Hindsight again, Joe pointed out to me >another thing we did wrong. We pushed Erlang >as a Declarative / Functional language. If we >had played down these aspects and pushed it as >a "concurrency oriented" language [...] And though I hate to say it, if Erlang had a few more imperative features then I expect there'd be less resistance to it. For example, it can be pretty tough to explain to someone why they can't have a global updateable array, especially when that's a basic feature in just about every other language out there. Or that you can only have global variables in general through the process dictionary, a feature the Erlang book strongly warns against using. It's difficult to find *any* program in Python, Perl, Scheme, Lisp, Ruby, etc., that doesn't use globals for infrequently updated variables. James From vances@REDACTED Sat Dec 14 01:43:06 2002 From: vances@REDACTED (Vance Shipley) Date: Fri, 13 Dec 2002 19:43:06 -0500 Subject: Impressions of Mozart-Oz In-Reply-To: References: Message-ID: <20021214004306.GF54010@frogman.motivity.ca> James, It's part of learning Erlang though isn't it? We don't really want global variables any more than we want multiple assignment variables. It's just a mindset that you must learn to get out of. What is needed is good tutorial text to demonstrate why we don't have them and how to avoid needing them. The following is a poor attempt: Q: Where are the global variables? A: There are none. To accomplish what you want pass the data in arguments to function calls. When using the standard behaviours use the State argument to store all data which must be persistent. Don't use the process dictionary. To keep persistant data which must be accessed by more than one process use a server to provide access and updates to the data. Use ETS to maintain system wide counters and tables. -Vance On Fri, Dec 13, 2002 at 05:18:46PM -0600, James Hague wrote: } } And though I hate to say it, if Erlang had a few more imperative features } then I expect there'd be less resistance to it. For example, it can be } pretty tough to explain to someone why they can't have a global updateable } array, especially when that's a basic feature in just about every other } language out there. Or that you can only have global variables in general } through the process dictionary, a feature the Erlang book strongly warns } against using. It's difficult to find *any* program in Python, Perl, } Scheme, Lisp, Ruby, etc., that doesn't use globals for infrequently updated } variables. } } James From rpettit@REDACTED Sat Dec 14 02:19:30 2002 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 13 Dec 2002 19:19:30 -0600 (CST) Subject: Impressions of Mozart-Oz Message-ID: <20021214011930.2DF89E789@hydra.vail> > And though I hate to say it, if Erlang had a few more imperative features > then I expect there'd be less resistance to it. For example, it can be > pretty tough to explain to someone why they can't have a global updateable > array, especially when that's a basic feature in just about every other I don't know a single professional programmer that can't get by without global variables. Furthermore, if a programmer feels he/she _cannot_ get their work done without globals they (IMHO) either need to: 1) graduate from college and begin working in the industry, or 2) find another career. Erlang may need work in some areas, but the lack of globals and the inclusion of things like single-assignment variables are _features_, not bugs. I would hate to see these features added so that Erlang can turn into every other language out there. The person that refuses to pick it up because it lacks global variables and the like may never "get it"... -Rick From enewhuis@REDACTED Sat Dec 14 03:46:21 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Fri, 13 Dec 2002 20:46:21 -0600 Subject: Message Routing Paradigms In-Reply-To: Message-ID: <001401c2a31a$fcd63890$4c00a8c0@XENO> Luke et al, First of all a big thanks to you Luke, Peter, Scott, Vance, Jani, and Sean (in no particular order) for responding with all this great information. If Erlang-the-language is not enough to sell me on OTP then Erlang-the-community certainly is. This is great feedback; I really appreciate the help. My *first* problem is to deal with routing messages from server to server so I can keep a lot of data coherent across many nodes on a network. I estimate order ~ 500,000 records split among about 10 data tables for starters. About 10,000 records are updated every second on a single node. Multiple nodes can feed other nodes so that, in total, there may be 50,000 updates per second in one server farm. Satellite servers that are *mostly* subscribers are also fed information from this farm and supplemented with data that is "more local". I have no control over the structure of supplemental records stored in the satellite servers. And so it is feasible that some of them may grow larger than my main farm. Also, over time, about once a month we are defining new tables and record formats and so we want the message format to be flexible and not depend on a brittle database schema. I desire minimal recompilation of services already in production. In short, all of the above just states that I have a rather large distributed database that is too big to fit in one place and does not need to fit in one place. Subscribers are dynamic. They come and go as they see fit. And they can subscribe to changes in individual records or record sets or simple event messages not associated with tables. And subscribers change their subscriptions often, about 1/s. Most subscribers have 100s of subscriptions. The subscribable record sets are defined with a simple pattern matching language that matches variable-length lists of Erlang values or wildcards. So, for example, a subscriber could choose to subscribe to either [a,b,c,d], ['_',b,c,d], [a,b,'_',d], or a multitude of other possibilities. My current thinking leads me to believe that more complex pattern-matching based on queries like ['$1', '<', 200] will be too slow to handle the expected transaction rate. But I'd be happy to find out that I'm wrong. Thus far my current approach has been to implement a Trie structure in the Message Router that maps patterns to lists of subscriber PIDs. I traverse the trie on every published message to find all patterns that match the message, forwarding the message to all of the subscribers. This was my first *real* data structure in Erlang and I was shocked to discover that it only took me an hour to write a rather complex insertion function in Erlang. It would be wonderful to discover that such a thing already exists, such a thing as either the simple wildcard match or the more advanced pattern matching grammar that Erlang supports (as described in the erts module documentation). Also, FIFO must be maintained from a single publisher so that all subscribers of messages that originate from a single publisher receive them in the same order they were published. Thanks everyone for reading this far. This is a lot to digest. Sincerely, Eric From james@REDACTED Sat Dec 14 05:09:15 2002 From: james@REDACTED (James Hague) Date: Fri, 13 Dec 2002 22:09:15 -0600 Subject: Impressions of Mozart-Oz Message-ID: <3DFA5A8B.3582.46B880@localhost> >Erlang may need work in some areas, but the lack of >globals and the inclusion of things like single >assignment variables are _features_, not bugs. Right, I agree. I'm just playing devil's advocate. I can understand why the 100% no globals style can be difficult to convince people of. It's not a matter of being able to somehow get by without them, it's a matter of it being more cumbersome in many cases. Erlang already lets you register processes and give ETS tables globally defined names. There's a reason for that. It's past the point of diminishing returns to have to pass the handle of a global table all over the place. That feature is there because it's convenient. And actually we already have updatable global variables in the guise of ETS tables. It's just harder to explain to someone than the simple variable reference used in Python or Perl. (Again, I'm not bashing Erlang here.) James From peter@REDACTED Sat Dec 14 11:20:11 2002 From: peter@REDACTED (Peter Lund) Date: Sat, 14 Dec 2002 11:20:11 +0100 Subject: SV: Message Routing Paradigms In-Reply-To: Message-ID: My memory seems to fool me. It was 1996-1997 when I was working with AXD301 erlang design and GUI and OaM issues. Sorry! /Peter I wrote: > You are welcome to differ, but when I was part of the AXD301 > Operation and Maintenance team ages ago (1998), the focus of > EVA was quite much on the human operator, even if so called > "OaM expert systems" also were thought of. I am aware of that > this was well before EVA was integrated into the OTP middle- > ware and it may have switched focus slightly in this process. From enewhuis@REDACTED Sun Dec 15 01:19:51 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Sat, 14 Dec 2002 18:19:51 -0600 Subject: Message Routing Paradigms In-Reply-To: <003801c2a3b0$868aa540$5a9c143e@station-r> Message-ID: <000001c2a3cf$b0603cd0$8c00a8c0@XENO> Wiger, Thank you; yes I saw those. I think my problem is different, however. Rather than having a table of values that I want to match with a single search pattern, I have a table of search patterns that I want to match with a single value. In other words: Given [a,b,c], ['_',b,c], and [x,y,z] as patterns I want to find out if the value [a,b,c] matches anything. I have a database of patterns. I do not have a database of values. I have 1000s of patterns where one is added and dropped once a second and I have 10,000 values per second. So the map structure changes once a second and I search through it 10,000 times per second. Sincerely, Eric -----Original Message----- From: Wiger Ulf [mailto:ulf.wiger@REDACTED] Sent: Saturday, December 14, 2002 2:37 PM To: Eric Newhuis Cc: erlang-questions@REDACTED Subject: Re: Message Routing Paradigms On Dec 14, Eric Newhuis wrote: >The subscribable record sets are defined with a simple pattern matching >language that matches variable-length lists of Erlang values or >wildcards. So, for example, a subscriber could choose to subscribe to >either [a,b,c,d], ['_',b,c,d], [a,b,'_',d], or a multitude of other >possibilities. > >My current thinking leads me to believe that more complex >pattern-matching based on queries like ['$1', '<', 200] will be too >slow to handle the expected transaction rate. But I'd be happy to find >out that I'm wrong. [...] >It would be wonderful to discover that such a thing already exists, >such a thing as either the simple wildcard match or the more advanced >pattern matching grammar that Erlang supports (as described in the erts >module documentation). Eric, You may want to check out the ets:select() function. It allows you to perform quite advanced pattern matching on ets tables, using basically the same pattern matching language as for trace filters. In OTP R9B, there is also the possibility to write match filters using more traditional erlang syntax (it is then transformed into the match syntax described in the erts manual.) If ordering is important, ordered_set tables can be used. If your match pattern avoids wild cards in the first part of the key, when matching on an ordered_set table, the bound part of the key will be used to narrow the search. (I was going to provide a good example from the man page, but can't access the documentation right now. Look at the man page for ms_transform.) /Uffe From jabba@REDACTED Sun Dec 15 01:42:24 2002 From: jabba@REDACTED (Jani Launonen) Date: Sun, 15 Dec 2002 02:42:24 +0200 (EET) Subject: time for a truly threaded Erlang? In-Reply-To: Message-ID: >But is there any need for a truly threaded Erlang? The native Linux >threads (in the current version) are pretty heavy-weight, and not much >different from full-fledged processes (indeed, the "fork" syscall in Linux >is just a specialisation of "clone" which is used to create kernel >threads). The cited posting mentions some improvements in "clone", but >the relatively high cost of thread creation (compared to Erlang processes) >would probably still be an issue. > >Multiple kernel threads can be useful only on multi-processor machines, so >they can be scheduled to different CPUs. But even in that case you don't >need 100,000 threads -- the reasonable number of them is bounded by the >number of CPUs available. Erlang processes are so light-weight and >efficient that it makes much more sense to use them, rather than kernel >threads, as units of concurrency... I think, Ulf was promoting the kind of Erlang VM that Peter Hedqvist studied (http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf) and made his thesis about. An Erlang VM that can take full advantage of SMP machines without deploying an EVM per CPU would be very beneficial. There would be no need to make own load balancing as OS would schedule threads anyways. So when one needs some serious throughput (as Eric Newhuis seems to need), it would be very useful to scale to several CPUs with only one EVM running, without the need to balance load across several nodes by static or dynamic load balancing. One could, of course, start several EVMs and have one EVM run the NotificationChannel process, other some subset of ConsumerAdmins and so on, but the load balancing would propably not be as good as what OS could do. So wouldn't it be more effcient to have one EVM running several threads (running Erlang processes) on one SMP machine, where processes / threads does get scheduled by OS and message sending could be optimised by shared heap than doing distribution through TCP/IP stack or pipe and load balancing on top of that. Every message from one EVM to another have to across the (heavy) process boundary, which isn't nice for little and frequent messages (I haven't really measured, but it's just my gut feeling). >Leonid Timochouk >Computing Laboratory >University of Kent at Canterbury With respect, -+-+-+- 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 jabba@REDACTED Sun Dec 15 02:19:43 2002 From: jabba@REDACTED (Jani Launonen) Date: Sun, 15 Dec 2002 03:19:43 +0200 (EET) Subject: Message Routing Paradigms In-Reply-To: <000001c2a3cf$b0603cd0$8c00a8c0@XENO> Message-ID: >Wiger, > >Thank you; yes I saw those. I think my problem is different, however. > >Rather than having a table of values that I want to match with a single >search pattern, I have a table of search patterns that I want to match >with a single value. > >In other words: > >Given [a,b,c], ['_',b,c], and [x,y,z] as patterns I want to find out if >the value [a,b,c] matches anything. I have a database of patterns. I >do not have a database of values. > >I have 1000s of patterns where one is added and dropped once a second >and I have 10,000 values per second. So the map structure changes once >a second and I search through it 10,000 times per second. This is exactly what CosNotification is all about. Delivering events to subscribers according to filtering rules. It does support the FIFO-ordering and as a bonus is CORBA-thing and so easily integrated into heterogenous environment. Unfortunately, the CosNotification is quite complicated and has several processes utilised before any single event gets through it. Every supplier is connected to a proxy object which the event is delivered. The proxy is an erlang process. The proxy then forwards it to it's consumer administrator object (an erlang process), which does filtering or QoS mappings (if required - usually not) and delivers it to the channel object (an erlang process). As there are several suppliers, so there are several proxy objects. Any single consumer adminstrator object can handle several proxy objects, if they (proxies) aren't requiring anything special handling. If there are proxies, whose events should be filtered or mapped, one should make suitable administrator with filter or mapping-filter object attached to it. Naturally the channel object has one or more supplier administrators attached to it. On the down stream, there are several consumer administrators consuming events from a channel. Usually there are several consumer administrators with different kind of filters, that does some coarse grained level of filtering, attached to a channel. And every consumer administrator object has several proxy objects (that usually make more fine grained filtering on the objects that gets through consumer administratos filters) attached to it. Finally, these proxy objects forwards events to consumers separately or in batches (which increases bandwidth utilisation). So there's several processes and lots of message copying involved in the path from supplier to consumer. Shared heap might help with copying, but with single processor, things might get CPU bound anyways as the filtering language is quite expressive. Perhaps making use of several nodes (in one SMP machine, or in cluster of single CPU machines) one could assign one node to run proxies, supplier administrators and the channel while other machines would have one consumer administrator and several proxies each. Event batching should help the network performance in clustering solution. And it does help reduce context switching (between Erlang processes) anyways. So this is what CosNotification might do for you, but I'm not quite sure, it fits in the whole picture. This figure propably explains CosNotification so much more clearly than my babling, that it is worth to check: http://www.prismtechnologies.com/English/Products/CORBA/CORBA_services/notification/corba_notification.html Cheers. >Sincerely, >Eric [cut] -+-+-+- 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 ulf.wiger@REDACTED Sat Dec 14 21:36:45 2002 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Sat, 14 Dec 2002 21:36:45 +0100 Subject: Message Routing Paradigms Message-ID: <003801c2a3b0$868aa540$5a9c143e@station-r> On Dec 14, Eric Newhuis wrote: >The subscribable record sets are defined with a simple pattern matching >language that matches variable-length lists of Erlang values or >wildcards. So, for example, a subscriber could choose to subscribe to >either [a,b,c,d], ['_',b,c,d], [a,b,'_',d], or a multitude of other >possibilities. > >My current thinking leads me to believe that more complex >pattern-matching based on queries like ['$1', '<', 200] will be too slow >to handle the expected transaction rate. But I'd be happy to find out >that I'm wrong. [...] >It would be wonderful to discover that such a thing already exists, such >a thing as either the simple wildcard match or the more advanced pattern >matching grammar that Erlang supports (as described in the erts module >documentation). Eric, You may want to check out the ets:select() function. It allows you to perform quite advanced pattern matching on ets tables, using basically the same pattern matching language as for trace filters. In OTP R9B, there is also the possibility to write match filters using more traditional erlang syntax (it is then transformed into the match syntax described in the erts manual.) If ordering is important, ordered_set tables can be used. If your match pattern avoids wild cards in the first part of the key, when matching on an ordered_set table, the bound part of the key will be used to narrow the search. (I was going to provide a good example from the man page, but can't access the documentation right now. Look at the man page for ms_transform.) /Uffe From valentin@REDACTED Sun Dec 15 14:13:51 2002 From: valentin@REDACTED (Valentin) Date: Sun, 15 Dec 2002 15:13:51 +0200 Subject: RENAMING MNESIA TABES Message-ID: <002f01c2a43b$e0cea520$8eb01fc4@moneymaker> Any idea how to rename a mnesia table? Consider the following scenario: 1) process P1 writes to table T1 2) table T1 is renamed to T2 3) process P1 fails to write while T1 is not available (new messages (data) are accumulated in P1's queue while P1 retries to write to T1) 4) a new T1 is created 5) process P1 writes to T1 I am worried that something like this is not possible, as it would complicate transactions, etc. Hope that I'm wrong, as it would make my life so much simpler. I've been looking at fragmentation, but that doesn't seem to be a simple solution for (I hope) a simple problem. Valentin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From etxuwig@REDACTED Sun Dec 15 15:46:34 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sun, 15 Dec 2002 15:46:34 +0100 (MET) Subject: time for a truly threaded Erlang? In-Reply-To: Message-ID: On Fri, 13 Dec 2002, Leonid Timochouk wrote: >But is there any need for a truly threaded Erlang? The >native Linux threads (in the current version) are pretty >heavy-weight, and not much different from full-fledged >processes (indeed, the "fork" syscall in Linux is just a >specialisation of "clone" which is used to create kernel >threads). The cited posting mentions some improvements in >"clone", but the relatively high cost of thread creation >(compared to Erlang processes) would probably still be an >issue. It was the mention of starting and stopping 100,000 threads within 2 seconds on 2-CPU machine that caught my attention. Assuming a perfectly even load split between the CPUs (which is probably not the case), this would mean 40us to start and stop one thread, and that's not so terribly different from Erlang's performance. Granted, you must do a bit more than just create a POSIX thread -- a global process table needs to be kept, and the Erlang process metadata must be initialized. Still... In the old Multi-Pro Erlang (Pekka Hedqvist's thesis), one suggestion was to run scheduler groups within threads, so that you could still use the very lightweight Erlang thread scheduling. AFAIR, the main problem was making the VM support (efficiently) thread-safe, though. I think it's interesting to be able to combine multi-CPU support with many thousand processes. One use that comes to mind would be to separate communication and control (where there could be thousands of control threads), or control and Operation and Maintenance, while still running on the same processor board. Essentially, coarse-grained load sharing without many of the hassles of distributed computing (loosely coupled computers on a slow communication medium.) /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From etxuwig@REDACTED Sun Dec 15 16:27:01 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sun, 15 Dec 2002 16:27:01 +0100 (MET) Subject: Message Routing Paradigms In-Reply-To: <000001c2a3cf$b0603cd0$8c00a8c0@XENO> Message-ID: On Sat, 14 Dec 2002, Eric Newhuis wrote: >Wiger, > >Thank you; yes I saw those. I think my problem is >different, however. > >Rather than having a table of values that I want to match >with a single search pattern, I have a table of search >patterns that I want to match with a single value. > >In other words: > >Given [a,b,c], ['_',b,c], and [x,y,z] as patterns I want to >find out if the value [a,b,c] matches anything. I have a >database of patterns. I do not have a database of values. Yes. My first thought was that you could try to turn it around and basically do reversed pattern matching: based on the value, define a match filter that extracts matching patterns. After sending the mail, I thought about it some more and decided that it's probably unwieldy. The next wild idea is to simply create an abstract for out of your patterns and compile it. Given Erlang's support for dynamic module loading, you _can_ compile a module on the fly without breaking already running code; processes that have started in the old code will finish there, and new calls will be diverted to the new code. The VM is quite good at pattern matching, and the BEAM code is very compact. This would also allow you to design arbitrarily complex patterns. ;) I once wrote a small module to test the concept. It relies on a key-value table in mnesia, and exports a function set_value(Key, Value). This function writes the Key-Value tuple to the table, then matches out all Key-Value combinations from same table and compiles a module sysGlobals.erl, such that sysGlobals:Key() -> Value. A small test (1-2 values in the table), indicates that it takes ca 9 msec to update the table and recompile/reload. I'm sure there are a hundred ways to improve the concept. I think the basic idea is one that should be developed one of these days. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks -------------- next part -------------- -module(keyval). -export([compile/0, set_value/2]). -export([bootstrap/0]). -define(MOD_NAME, sysGlobals). -define(TAB_NAME, ?MOD_NAME). -record(sysGlobals, {key, value}). -include_lib("stdlib/include/ms_transform.hrl"). compile() -> Keys = keys(), Forms = [{attribute, 1, module, ?MOD_NAME}, {attribute, 2, compile, export_all}| compile_keys(Keys, 3, [])], do_compile(Forms). set_value(Key, Value) when atom(Key) -> mnesia:dirty_write(#sysGlobals{key = Key, value = Value}), compile(). bootstrap() -> %% test function mnesia:create_schema([node()]), mnesia:start(), {atomic, ok} = mnesia:create_table(?TAB_NAME, [{disc_copies,[node()]}]). keys() -> MS = ets:fun2ms(fun(#sysGlobals{key = K, value = V}) -> {K, V} end), ets:select(?TAB_NAME, MS). compile_keys([{K,V}|T], N, Acc) when atom(K) -> Acc1 = [{function, N, K, 0, [{clause,N,[],[],[form(V, N)]}]}| Acc], compile_keys(T, N+1, Acc1); compile_keys([], N, Acc) -> lists:reverse([{eof, N}|Acc]). form(X, N) when integer(X) -> {integer, N, X}; form(X, N) when atom(X) -> {atom, N, X}; form(X, N) when list(X) -> form_list(X,N); form(X, N) when tuple(X) -> {tuple, N, [form(E, N) || E <- tuple_to_list(X)]}. form_list([X], N) -> {cons, N, form(X, N), {nil, N}}; form_list([X|T], N) -> {cons, N, form(X, N), form_list(T, N)}; form_list([], N) -> {nil, N}. do_compile(Forms) -> Src = [erl_pp:form(F) || F <- Forms], Dir = filename:join(["", "tmp"]), FileName = filename:join([Dir, ?MOD_NAME]), ok = file:write_file(FileName ++ ".erl", list_to_binary(Src)), {ok, _ModName, Binary} = compile:file(FileName, [binary]), code:load_binary(?MOD_NAME, FileName ++ ".beam", Binary). From etxuwig@REDACTED Sun Dec 15 20:31:27 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sun, 15 Dec 2002 20:31:27 +0100 (MET) Subject: Message Routing Paradigms In-Reply-To: Message-ID: On Sun, 15 Dec 2002, Ulf Wiger wrote: >The next wild idea is to simply create an abstract for out >of your patterns and compile it. This should of course be "abstract form". Given the size of your problem, it may not work. I'm assuming that you won't have 10,000 unique patterns, but rather quite fewer patterns than that and multiple subscribers to some common patterns. The megaco_text_parser module is the largest one I know of, and it contains 22,000 lines of code -- essentially only two large functions. The compiler can handle this, and so can the VM, but recompiling it once per second is a totally different matter, of course... (: If it works at all, you'd probably do the recompile on another node, and then call rpc:call(FilteringNode, code, load_binary, [ModuleName, FileName, FilterModule]). Like I said, a wild idea. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From rprice@REDACTED Sun Dec 15 22:07:01 2002 From: rprice@REDACTED (Roger Price) Date: Sun, 15 Dec 2002 22:07:01 +0100 (CET) Subject: Impressions of Mozart-Oz In-Reply-To: <20021214004306.GF54010@frogman.motivity.ca> Message-ID: On Fri, 13 Dec 2002, Vance Shipley wrote: > Q: Where are the global variables? > A: There are none.... Don't use the process dictionary. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ What's wrong with the process dictionary? Is it a matter of performance, or programming style, or something else? Best Regards, Roger From luke@REDACTED Sun Dec 15 22:39:39 2002 From: luke@REDACTED (Luke Gorrie) Date: 15 Dec 2002 22:39:39 +0100 Subject: Erlang mode in Emacs In-Reply-To: <15865.64773.886666.293988@gargle.gargle.HOWL> References: <15865.64773.886666.293988@gargle.gargle.HOWL> Message-ID: Ingela Anderton writes: > Hello everyone! > > I have been doing some corrections to the erlang-mode. This updated > version will not be officially released until the next Erlang/OTP > release. But as it is so hard to test emacs-modes with automatic > test-suits I have put it into the contribution area so that you may > test it right away. This way I get it properly tested and you get the > benefit of my fixes already today :) Nice! Working well thus far. I have a command for aligning the arrows in function heads that I've been meaning to send in for years - maybe something we can add to the mode and assign a key? Here's the command w/ description: (defun erlang-align-arrows (start end) "Align arrows (\"->\") in function clauses from START to END. When called interactively, aligns arrows inside the region. Example: sum(L) -> sum(L, 0). sum([H|T], Sum) -> sum(T, Sum + H); sum([], Sum) -> Sum. becomes: sum(L) -> sum(L, 0). sum([H|T], Sum) -> sum(T, Sum + H); sum([], Sum) -> Sum." (interactive "r") (save-excursion (let (;; regexp matching a function head (without newlines..) (re (concat "^" erlang-atom-regexp ".*\\(\\)->")) ;; part of regexp matching directly before the arrow (arrow-match-pos (1+ erlang-atom-regexp-matches)) ;; accumulator for positions where arrows are found, ordered ;; by buffer position (from greatest to smallest) (arrow-positions '()) ;; accumulator for longest distance from start of line to arrow (most-indent 0) ;; marker to track the end of the region we're aligning (end-marker (progn (goto-char end) (point-marker)))) ;; Pass 1: Find the arrow positions, adjust the whitespace ;; before each arrow to one space, and find the greatest ;; indentation level. (goto-char start) (while (re-search-forward re end-marker t) (goto-char (match-beginning arrow-match-pos)) (just-one-space) ; adjust whitespace (setq arrow-positions (cons (point) arrow-positions)) (setq most-indent (max most-indent (- (point) (line-beginning-position))))) (set-marker end-marker nil) ; free the marker ;; Pass 2: Insert extra padding so that all arrow indentation is ;; equal. This is done last-to-first by buffer position, so that ;; inserting spaces before one arrow doesn't change the ;; positions of the next ones. (mapcar (lambda (arrow-pos) (goto-char arrow-pos) (let* ((indent (- arrow-pos (line-beginning-position))) (pad (- most-indent indent))) (when (> pad 0) (insert (make-string pad ? ))))) arrow-positions)))) From etxuwig@REDACTED Sun Dec 15 23:11:02 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sun, 15 Dec 2002 23:11:02 +0100 (MET) Subject: Impressions of Mozart-Oz In-Reply-To: Message-ID: On Sun, 15 Dec 2002, Roger Price wrote: >On Fri, 13 Dec 2002, Vance Shipley wrote: > >> Q: Where are the global variables? >> A: There are none.... Don't use the process dictionary. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >What's wrong with the process dictionary? Is it a matter of >performance, or programming style, or something else? Programming style. It introduces a form of get-put programming that breaks referential transparency. Of course, so do message passing and ets as well. The warning about the process dictionary pre-dates ets, but holds every bit as much for ets -- more so for public ets tables, as they essentially allow all processes to share data, similarly to global variables. Referential transparency is perhaps the one feature that functional programming afficionados like to hail as The Great Advantage of Functional Programming. But since Erlang has been officially re-labeled a COPL (Concurrency-oriented Programming Language) by Joe Armstrong, it is a perfectly reasonable question. (: Referential transparency means that you can trust that a function will always return the same value if called with the same function arguments. A function that relies on the contents of the process dictionary, the message queue, or ets/mnesia tables is not referentially transparent. Another way of putting it would be that you cannot simply read the code of a function and figure out exactly what it does. If you think ets is really neat, you may conclude that the process dictionary has been unfairly accused. In some respects, the process dictionary is actually handier than ets (no copying, its contents are included in crash reports, etc.) And -- well -- mnesia uses it, and so does proc_lib. However, all sources of side-effects are potentially dangerous, and will made the code harder to understand if not used with discipline. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From etxuwig@REDACTED Sun Dec 15 23:13:27 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Sun, 15 Dec 2002 23:13:27 +0100 (MET) Subject: Erlang mode in Emacs In-Reply-To: Message-ID: On 15 Dec 2002, Luke Gorrie wrote: >I have a command for aligning the arrows in function heads >that I've been meaning to send in for years - maybe >something we can add to the mode and assign a key? > >Here's the command w/ description: > >(defun erlang-align-arrows (start end) > "Align arrows (\"->\") in function clauses from START to END. >When called interactively, aligns arrows inside the region. > >Example: > >sum(L) -> sum(L, 0). >sum([H|T], Sum) -> sum(T, Sum + H); >sum([], Sum) -> Sum. > >becomes: > >sum(L) -> sum(L, 0). >sum([H|T], Sum) -> sum(T, Sum + H); >sum([], Sum) -> Sum." Wonderful, Luke! What's kept you? (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From luke@REDACTED Sun Dec 15 23:23:25 2002 From: luke@REDACTED (Luke Gorrie) Date: 15 Dec 2002 23:23:25 +0100 Subject: Erlang mode in Emacs In-Reply-To: References: Message-ID: Ulf Wiger writes: > >Here's the command w/ description: > > > >(defun erlang-align-arrows (start end) > > "Align arrows (\"->\") in function clauses from START to END. > >When called interactively, aligns arrows inside the region. > > > >Example: > > > >sum(L) -> sum(L, 0). > >sum([H|T], Sum) -> sum(T, Sum + H); > >sum([], Sum) -> Sum. > > > >becomes: > > > >sum(L) -> sum(L, 0). > >sum([H|T], Sum) -> sum(T, Sum + H); > >sum([], Sum) -> Sum." > > Wonderful, Luke! What's kept you? (: Well, to be honest, that is a rewrite of the original command, which was quite grotesquely implemented and had a bug that I couldn't account for :-) -Luke From luke@REDACTED Mon Dec 16 04:42:27 2002 From: luke@REDACTED (Luke Gorrie) Date: 16 Dec 2002 04:42:27 +0100 Subject: Distel 3.2 Message-ID: Ahoyhoy, There's a new release of Distel up at http://distel.sourceforge.net/ What _didn't_ make it into this one was a user guide and a windows port - they're coming, but for now you still need a little sense of adventure ;-) Here's what did make it, from the NEWS file: Version 3.2: Completion of module and function names. So list:keyso completes to lists:keysort, etc. Bound to M-TAB and (since some window managers take that) M-?. Also has popups for ambiguous completions and all that good stuff. (Thanks Mikael Karlsson for suggesting this often enough that it finally sunk in :-)) Major debugger extensions by Martin Bj?rklund: - Visual breakpoints: lines with breakpoints set are now highlighted in red. If the buffer is modified, the breakpoints turn purple to indicate that they may be out of sync with the line numbers in the Erlang node. Once editing is finished at the code is reloaded, the breakpoints can be resynchronized with C-c C-d s. Note that using "l(module)" in the shell seems to go behind the debugger's back, so to reload an interpreted module you should use either C-c C-d L in Emacs, or i(...) in the shell. - Save (C-c C-d S) and Restore (C-c C-d R) of debugger state (set of interpreted modules and breakpoints.) This can be used to temprarily save your debug settings while restarting a node, etc. The settings are stored inside Emacs. Group for Customization (M-x customize), so customizable variables can be configured interactively. It's in Programming->Tools->Distel. More faithful tags-compliance (i.e. prompting for which tag to follow after M-.) optionally available, via the (Customizable) `distel-tags-compliant' variable (Martin Bj?rklund.) Distel commands now appear in the Erlang pull-down menu (Martin Bj?rklund) Improved "Interactive Session" support. Now C-j evaluates the previous expression and inserts the result in-line, and C-M-x evaluates a function definition and prints the result as a message. The binding for creating/showing a session is now C-c C-d e. Improved process-manager support, with many small UI enhancements: 'u' updates the list, 'k' kills a process, fewer buffers are created, better errors when inspecting dead processes, ... (thanks Martin Bj?rklund and Mats Cronqvist) EXIT signals are now generated for remote processes when the link goes down. This solves some long-standing problems like the debug monitor hanging if you restart the node you were debugging on. Option to explicitly set a cookie in the variable `derl-cookie' (Mats Cronqvist) Now you can connect several Emacsen to the same Erlang node, because Distel now uses a unique distel_@ node name for each Emacs. From Bruce@REDACTED Mon Dec 16 09:18:14 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 16 Dec 2002 21:18:14 +1300 Subject: Q: Supervision and Magically Reincarnated Processes Message-ID: <00e201c2a4db$ae02d710$4021970a@norris> Hi peoples, A quick OTP question, I'm using supervisors in my Aplio (Internet Phone) server program and I've carefully inserted a bug somewhere that makes one of the processes crash. But I don't get any output about why it has crashed in the error_logger or shell (when I run it that way). The process that dies is a gen_server (behaviour) and it doesn't execute its terminate(Reason, State) so I guess its just 'EXIT'ing somewhere. My question is: how can I trap this (preferably sans debugger)? The supervisor restarts it happily, and works so fast and well that I wasn't even aware it was dying until I started running it in the shell this week. /Bruce From Chandrashekhar.Mullaparthi@REDACTED Mon Dec 16 09:28:54 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 16 Dec 2002 08:28:54 -0000 Subject: RENAMING MNESIA TABES Message-ID: <04D356A3B172D611981B0008C791C312404F7B@imp02mbx.t-mobile.co.uk> There isn't a way to rename a table. You'll have to create a new table, copy the contents and delete the old table. But why do you want to do such a thing? What is the problem you're tackling? Chandru -----Original Message----- From: Valentin [mailto:valentin@REDACTED] Sent: 15 December 2002 13:14 To: erlang-questions@REDACTED Subject: RENAMING MNESIA TABES Any idea how to rename a mnesia table? Consider the following scenario: 1) process P1 writes to table T1 2) table T1 is renamed to T2 3) process P1 fails to write while T1 is not available (new messages (data) are accumulated in P1's queue while P1 retries to write to T1) 4) a new T1 is created 5) process P1 writes to T1 I am worried that something like this is not possible, as it would complicate transactions, etc. Hope that I'm wrong, as it would make my life so much simpler. I've been looking at fragmentation, but that doesn't seem to be a simple solution for (I hope) a simple problem. Valentin. NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From matthias@REDACTED Mon Dec 16 09:38:20 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 16 Dec 2002 09:38:20 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: References: <20021214004306.GF54010@frogman.motivity.ca> Message-ID: <15869.37116.190542.326910@antilipe.corelatus.se> Roger Price writes: > On Fri, 13 Dec 2002, Vance Shipley wrote: > > > Q: Where are the global variables? > > A: There are none.... Don't use the process dictionary. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > What's wrong with the process dictionary? Is it a matter of performance, > or programming style, or something else? Programming style. If the answer was: For beginners: Be patient. Complete the course and spend a few days writing programs without global variables until you're completely comfortable doing that. You don't need global variables, honest. For others: There are various ways to to achieve similar effects to having global variables: 1. For storing constants, you can use a function, e.g. max_line_length() -> 80. you may wish to enable inlining if you do the above. 2. Using a registered process to store state. 3. Using ETS tables. 4. Using the process dictionary. This is widely considered to be bad style. Would you expect the average beginner to think "oh, ok, that sounds like sensible advice", or would would it be "patronising academic wankers with functional weirdo crap, the process dictionary is just what I need"? Matthias From Chandrashekhar.Mullaparthi@REDACTED Mon Dec 16 09:38:15 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 16 Dec 2002 08:38:15 -0000 Subject: Supervision and Magically Reincarnated Processes Message-ID: <04D356A3B172D611981B0008C791C312404F7E@imp02mbx.t-mobile.co.uk> Do you have sasl running? If so you should get crash reports you can look at using rb. If you want to find out the reason without changing anything, us the sys:trace function on your supervisor, you should see the EXIT message from the supervised child... Chandru -----Original Message----- From: Bruce Fitzsimons [mailto:Bruce@REDACTED] Sent: 16 December 2002 08:18 To: erlang-questions@REDACTED Subject: Q: Supervision and Magically Reincarnated Processes Hi peoples, A quick OTP question, I'm using supervisors in my Aplio (Internet Phone) server program and I've carefully inserted a bug somewhere that makes one of the processes crash. But I don't get any output about why it has crashed in the error_logger or shell (when I run it that way). The process that dies is a gen_server (behaviour) and it doesn't execute its terminate(Reason, State) so I guess its just 'EXIT'ing somewhere. My question is: how can I trap this (preferably sans debugger)? The supervisor restarts it happily, and works so fast and well that I wasn't even aware it was dying until I started running it in the shell this week. /Bruce 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 Bruce@REDACTED Mon Dec 16 10:13:28 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 16 Dec 2002 22:13:28 +1300 Subject: Supervision and Magically Reincarnated Processes References: <04D356A3B172D611981B0008C791C312404F7E@imp02mbx.t-mobile.co.uk> Message-ID: <013801c2a4e3$65ced360$4021970a@norris> Thanks a lot Chandru, thats exactly what I needed (sys:trace). Now I just need to wait for it to crash :-( /Bruce ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "'Bruce Fitzsimons'" ; Sent: Monday, December 16, 2002 9:38 PM Subject: RE: Supervision and Magically Reincarnated Processes > Do you have sasl running? If so you should get crash reports you can look at > using rb. If you want to find out the reason without changing anything, us > the sys:trace function on your supervisor, you should see the EXIT message > from the supervised child... > > Chandru > > -----Original Message----- > From: Bruce Fitzsimons [mailto:Bruce@REDACTED] > Sent: 16 December 2002 08:18 > To: erlang-questions@REDACTED > Subject: Q: Supervision and Magically Reincarnated Processes > > > Hi peoples, > > A quick OTP question, I'm using supervisors in my Aplio (Internet Phone) > server program and I've carefully inserted a bug somewhere that makes one of > the processes crash. But I don't get any output about why it has crashed in > the error_logger or shell (when I run it that way). > > The process that dies is a gen_server (behaviour) and it doesn't execute its > terminate(Reason, State) so I guess its just 'EXIT'ing somewhere. > > My question is: how can I trap this (preferably sans debugger)? > > The supervisor restarts it happily, and works so fast and well that I wasn't > even aware it was dying until I started running it in the shell this week. > > /Bruce > > > > > 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 Mon Dec 16 10:28:19 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 16 Dec 2002 10:28:19 +0100 (MET) Subject: Q: Supervision and Magically Reincarnated Processes In-Reply-To: <00e201c2a4db$ae02d710$4021970a@norris> Message-ID: On Mon, 16 Dec 2002, Bruce Fitzsimons wrote: >The process that dies is a gen_server (behaviour) and it >doesn't execute its terminate(Reason, State) so I guess its >just 'EXIT'ing somewhere. One comment: if the process doesn't trap exits and is linked to some process that dies, the terminate/2 function will not be executed. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From valentin@REDACTED Mon Dec 16 11:51:54 2002 From: valentin@REDACTED (Valentin) Date: Mon, 16 Dec 2002 12:51:54 +0200 Subject: RENAMING MNESIA TABES References: <04D356A3B172D611981B0008C791C312404F7B@imp02mbx.t-mobile.co.uk> Message-ID: <001e01c2a4f1$3dc305e0$83b01fc4@moneymaker> We have a requirement to export some historical/log data from MNESIA into ORACLE. The data in MNESIA table is short-lived, that is, once the data has been exported, the MNESIA table is recreated (we find it much faster to recreate a table than to use mnesia:clear_table/1). At the time, the easiest way to achieve this was to run a single process that will receive log messages and store them into MNESIA table. Once a day, say, at midnight, the same process would export data into CSV file, whilst any message "posted" during this time will remain in the queue and will be inserted once the export was completed... Some external process uploads such a CSV file into the ORACLE. This process has worked just fine so far, however, as it usually happens, we have underestimated the traffic volumes, and I am not sure if the process will cope with the load -- the export facility that I wrote is quite a slow one. I've been looking for a simple work-around, i.e. if the table can be renamed, I would have all the time in the world to do the export, etc. Well, it's a back to the drawing board for me, I guess :-( V. ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "'Valentin'" ; Sent: Monday, December 16, 2002 10:28 AM Subject: RE: RENAMING MNESIA TABES > There isn't a way to rename a table. You'll have to create a new table, copy > the contents and delete the old table. But why do you want to do such a > thing? What is the problem you're tackling? > > Chandru > > -----Original Message----- > From: Valentin [mailto:valentin@REDACTED] > Sent: 15 December 2002 13:14 > To: erlang-questions@REDACTED > Subject: RENAMING MNESIA TABES > > > Any idea how to rename a mnesia table? Consider the following scenario: > > 1) process P1 writes to table T1 > 2) table T1 is renamed to T2 > 3) process P1 fails to write while T1 is not available (new messages (data) > are accumulated in P1's queue while P1 retries to write to T1) > 4) a new T1 is created > 5) process P1 writes to T1 > > I am worried that something like this is not possible, as it would > complicate transactions, etc. Hope that I'm wrong, as it would make my life > so much simpler. > I've been looking at fragmentation, but that doesn't seem to be a simple > solution for (I hope) a simple problem. > > Valentin. > > > > 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 Mon Dec 16 11:58:29 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 16 Dec 2002 11:58:29 +0100 (MET) Subject: RENAMING MNESIA TABES In-Reply-To: <001e01c2a4f1$3dc305e0$83b01fc4@moneymaker> Message-ID: On Mon, 16 Dec 2002, Valentin wrote: >This process has worked just fine so far, however, as it >usually happens, we have underestimated the traffic >volumes, and I am not sure if the process will cope with >the load -- the export facility that I wrote is quite a >slow one. I've been looking for a simple work-around, i.e. >if the table can be renamed, I would have all the time in >the world to do the export, etc. You could perhaps steal an idea from the telephony realm, where one usually keeps a NOP and an OP table for B-number analysis. Basically, you keep two tables, and perform a lookup on a record (in some other table) to determine which of the two is active. When you are ready to export data from one of the tables, you update the "switch" record to point to another table, and so on. It's also very similar to how a wrap log works. Another way to go might be to use ets instead of mnesia. The ets:rename/2 function does allow you to rename an ets table. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From Sean.Hinde@REDACTED Mon Dec 16 11:58:27 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 16 Dec 2002 10:58:27 -0000 Subject: RENAMING MNESIA TABES Message-ID: <04D356A3B172D611981B0008C791C3126BF63C@imp02mbx.t-mobile.co.uk> > We have a requirement to export some historical/log data from > MNESIA into > ORACLE. The data in MNESIA table is short-lived, that is, > once the data has > been exported, the MNESIA table is recreated (we find it much > faster to > recreate a table than to use mnesia:clear_table/1). Someone once posted a benchmark of nmesia:clear_table/1 using the unified heap architecture - the time for I think 100k rows dropped from 10's of seconds to sub 1 second. It was something to do with memory locality. Might be worth a try. 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 Chandrashekhar.Mullaparthi@REDACTED Mon Dec 16 12:02:58 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 16 Dec 2002 11:02:58 -0000 Subject: RENAMING MNESIA TABES Message-ID: <04D356A3B172D611981B0008C791C312404F81@imp02mbx.t-mobile.co.uk> Take a backup of the database and then do your export by traversing the backup. The backup process is quite efficient and quick. The functions of interest to you would be mnesia:backup and mnesia:traverse_backup - check the user guide for mnesia as well - there is an example of traversing a mnesia backup file. You can traverse the backup in a different mnesia node as well. Tip: when writing to your CSV file, dont write one line at a time. Write a bunch of lines at a time. This will considerably speed up your export process. cheers Chandru -----Original Message----- From: Valentin [mailto:valentin@REDACTED] Sent: 16 December 2002 10:52 To: Chandrashekhar Mullaparthi; erlang-questions@REDACTED Subject: Re: RENAMING MNESIA TABES We have a requirement to export some historical/log data from MNESIA into ORACLE. The data in MNESIA table is short-lived, that is, once the data has been exported, the MNESIA table is recreated (we find it much faster to recreate a table than to use mnesia:clear_table/1). At the time, the easiest way to achieve this was to run a single process that will receive log messages and store them into MNESIA table. Once a day, say, at midnight, the same process would export data into CSV file, whilst any message "posted" during this time will remain in the queue and will be inserted once the export was completed... Some external process uploads such a CSV file into the ORACLE. This process has worked just fine so far, however, as it usually happens, we have underestimated the traffic volumes, and I am not sure if the process will cope with the load -- the export facility that I wrote is quite a slow one. I've been looking for a simple work-around, i.e. if the table can be renamed, I would have all the time in the world to do the export, etc. Well, it's a back to the drawing board for me, I guess :-( V. ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "'Valentin'" ; Sent: Monday, December 16, 2002 10:28 AM Subject: RE: RENAMING MNESIA TABES > There isn't a way to rename a table. You'll have to create a new table, copy > the contents and delete the old table. But why do you want to do such a > thing? What is the problem you're tackling? > > Chandru > > -----Original Message----- > From: Valentin [mailto:valentin@REDACTED] > Sent: 15 December 2002 13:14 > To: erlang-questions@REDACTED > Subject: RENAMING MNESIA TABES > > > Any idea how to rename a mnesia table? Consider the following scenario: > > 1) process P1 writes to table T1 > 2) table T1 is renamed to T2 > 3) process P1 fails to write while T1 is not available (new messages (data) > are accumulated in P1's queue while P1 retries to write to T1) > 4) a new T1 is created > 5) process P1 writes to T1 > > I am worried that something like this is not possible, as it would > complicate transactions, etc. Hope that I'm wrong, as it would make my life > so much simpler. > I've been looking at fragmentation, but that doesn't seem to be a simple > solution for (I hope) a simple problem. > > Valentin. 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 valentin@REDACTED Mon Dec 16 12:23:23 2002 From: valentin@REDACTED (Valentin) Date: Mon, 16 Dec 2002 13:23:23 +0200 Subject: RENAMING MNESIA TABES References: <04D356A3B172D611981B0008C791C312404F81@imp02mbx.t-mobile.co.uk> Message-ID: <003d01c2a4f5$8c869c10$83b01fc4@moneymaker> Thanks Chandru (and Sean) for your advices. Highly appreciated. Doing and traversing the backup might just do the trick!!! V. ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "'Valentin'" ; "Chandrashekhar Mullaparthi" ; Sent: Monday, December 16, 2002 1:02 PM Subject: RE: RENAMING MNESIA TABES > Take a backup of the database and then do your export by traversing the > backup. The backup process is quite efficient and quick. The functions of > interest to you would be mnesia:backup and mnesia:traverse_backup - check > the user guide for mnesia as well - there is an example of traversing a > mnesia backup file. You can traverse the backup in a different mnesia node > as well. > > Tip: when writing to your CSV file, dont write one line at a time. Write a > bunch of lines at a time. This will considerably speed up your export > process. > > cheers > Chandru > > -----Original Message----- > From: Valentin [mailto:valentin@REDACTED] > Sent: 16 December 2002 10:52 > To: Chandrashekhar Mullaparthi; erlang-questions@REDACTED > Subject: Re: RENAMING MNESIA TABES > > > We have a requirement to export some historical/log data from MNESIA into > ORACLE. The data in MNESIA table is short-lived, that is, once the data has > been exported, the MNESIA table is recreated (we find it much faster to > recreate a table than to use mnesia:clear_table/1). > > At the time, the easiest way to achieve this was to run a single process > that will receive log messages and store them into MNESIA table. Once a day, > say, at midnight, the same process would export data into CSV file, whilst > any message "posted" during this time will remain in the queue and will be > inserted once the export was completed... Some external process uploads such > a CSV file into the ORACLE. > > This process has worked just fine so far, however, as it usually happens, we > have underestimated the traffic volumes, and I am not sure if the process > will cope with the load -- the export facility that I wrote is quite a slow > one. I've been looking for a simple work-around, i.e. if the table can be > renamed, I would have all the time in the world to do the export, etc. > > Well, it's a back to the drawing board for me, I guess :-( > > V. > > > ----- Original Message ----- > From: "Chandrashekhar Mullaparthi" > > To: "'Valentin'" ; > Sent: Monday, December 16, 2002 10:28 AM > Subject: RE: RENAMING MNESIA TABES > > > > There isn't a way to rename a table. You'll have to create a new table, > copy > > the contents and delete the old table. But why do you want to do such a > > thing? What is the problem you're tackling? > > > > Chandru > > > > -----Original Message----- > > From: Valentin [mailto:valentin@REDACTED] > > Sent: 15 December 2002 13:14 > > To: erlang-questions@REDACTED > > Subject: RENAMING MNESIA TABES > > > > > > Any idea how to rename a mnesia table? Consider the following scenario: > > > > 1) process P1 writes to table T1 > > 2) table T1 is renamed to T2 > > 3) process P1 fails to write while T1 is not available (new messages > (data) > > are accumulated in P1's queue while P1 retries to write to T1) > > 4) a new T1 is created > > 5) process P1 writes to T1 > > > > I am worried that something like this is not possible, as it would > > complicate transactions, etc. Hope that I'm wrong, as it would make my > life > > so much simpler. > > I've been looking at fragmentation, but that doesn't seem to be a simple > > solution for (I hope) a simple problem. > > > > Valentin. > > > > 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 valentin@REDACTED Mon Dec 16 12:36:59 2002 From: valentin@REDACTED (Valentin) Date: Mon, 16 Dec 2002 13:36:59 +0200 Subject: RENAMING MNESIA TABES References: Message-ID: <004401c2a4f7$72806650$83b01fc4@moneymaker> Thanks Ulf, using more than one table and a "switch" row is quite a good idea for this application -- I've been thinking along similar lines, and will implement this approach in the next release. V. ----- Original Message ----- From: "Ulf Wiger" To: "Valentin" Cc: Sent: Monday, December 16, 2002 12:58 PM Subject: Re: RENAMING MNESIA TABES > On Mon, 16 Dec 2002, Valentin wrote: > > >This process has worked just fine so far, however, as it > >usually happens, we have underestimated the traffic > >volumes, and I am not sure if the process will cope with > >the load -- the export facility that I wrote is quite a > >slow one. I've been looking for a simple work-around, i.e. > >if the table can be renamed, I would have all the time in > >the world to do the export, etc. > > You could perhaps steal an idea from the telephony realm, > where one usually keeps a NOP and an OP table for B-number > analysis. Basically, you keep two tables, and perform a > lookup on a record (in some other table) to determine which > of the two is active. > > When you are ready to export data from one of the tables, > you update the "switch" record to point to another table, > and so on. It's also very similar to how a wrap log works. > > Another way to go might be to use ets instead of mnesia. The > ets:rename/2 function does allow you to rename an ets table. > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice Networks > From hakanm@REDACTED Mon Dec 16 12:39:47 2002 From: hakanm@REDACTED (Hakan Millroth) Date: Mon, 16 Dec 2002 12:39:47 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: <15869.37116.190542.326910@antilipe.corelatus.se> Message-ID: <1486A8CC-10EB-11D7-A423-0003939B65EA@nortelnetworks.com> >> What's wrong with the process dictionary? Is it a matter of >> performance, >> or programming style, or something else? > > Programming style. Performance also: Optimizing compilers that rely on any kind of non-trivial dataflow analysis are (much) less effective for programs with side effects. -- Hakan Hakan Millroth Nortel Networks From hakan@REDACTED Mon Dec 16 13:04:57 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Mon, 16 Dec 2002 13:04:57 +0100 (MET) Subject: RENAMING MNESIA TABES In-Reply-To: <04D356A3B172D611981B0008C791C312404F81@imp02mbx.t-mobile.co.uk> Message-ID: On Mon, 16 Dec 2002, Chandrashekhar Mullaparthi wrote: Chandru> Take a backup of the database and then do your export by traversing the Chandru> backup. The backup process is quite efficient and quick. The functions of Chandru> interest to you would be mnesia:backup and mnesia:traverse_backup - check Chandru> the user guide for mnesia as well - there is an example of traversing a Chandru> mnesia backup file. You can traverse the backup in a different mnesia node Chandru> as well. Chandru> Chandru> Tip: when writing to your CSV file, dont write one line at a time. Write a Chandru> bunch of lines at a time. This will considerably speed up your export Chandru> process. If you want you can plug-in your own backup module in order to directly create your CSV file without going via Mnesia's default backup format. See the 'mnesia_backup' appendix for more info. /H?kan From luke@REDACTED Mon Dec 16 16:21:19 2002 From: luke@REDACTED (Luke Gorrie) Date: 16 Dec 2002 16:21:19 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: <15869.37116.190542.326910@antilipe.corelatus.se> References: <20021214004306.GF54010@frogman.motivity.ca> <15869.37116.190542.326910@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > Roger Price writes: > > On Fri, 13 Dec 2002, Vance Shipley wrote: > > > > > Q: Where are the global variables? > > > A: There are none.... Don't use the process dictionary. > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > What's wrong with the process dictionary? Is it a matter of performance, > > or programming style, or something else? > > Programming style. > > If the answer was: > > For beginners: Be patient. Complete the course and spend > a few days writing programs without global variables > until you're completely comfortable doing that. You don't > need global variables, honest. Allow me to give my 2 cents from some Dark Side experiments :-) In Distel we have mutable process-global variables (global scope, separate value in each process), and I find them very handy. We use them for all the things that would go into a process-specific #state record in Erlang. They're especially nice for debugging, since the buffer/process correspondence means you can just switch into a process's buffer and use `describe-variable' to poke around its internal state. It's also more convenient than passing a state record around everywhere and returning updated copies, since you can just refer to everything as a regular global variable (and we have assignment.) On the other hand, it's probably true that passing the whole state record around and updating it in the furthest corners of your process is a sign of poor design. I dare say the win for referential transparency is when you restrict large parts of the system to only seeing/updating small parts of the overall state. If every function signature is "f(State0, ...) -> {State1, ...}" then we're in the same boat as having globals, but with more typing (as in keyboard). An interesting question then is whether well-written processes tend to have a lot of functions like that anyway? I certainly see a lot of them in daily life, but maybe that's just my own code :-) On a less-dark-side note, one Distel feature that I'd like to see in Erlang is a piece of process info giving a one-sentence description, which the process sets for itself and others can read. That way as well as e.g. "current function: {yaws_server,loop,3}" in process lists and crash reports, you could see e.g. "Yaws worker serving HTTP/1.1 request #3 for foo.bar.com:31459". Maybe just a proc_lib hack? Also, on another random note - (nearly) everywhere I use the process dictionary, I really want dynamic scope, like "call this function with these dictionary entries, then throw them away." I don't know if this is true for other people too. Overall, I'm pretty interested in more formal process state and states (in the state machine sense) in processes, in the name of runtime debugging information. I don't know if it would actually be a Good Thing and have no bright plans, though :-) Cheers, Luke From jamesh@REDACTED Mon Dec 16 17:01:29 2002 From: jamesh@REDACTED (James Hague) Date: Mon, 16 Dec 2002 10:01:29 -0600 Subject: Impressions of Mozart-Oz Message-ID: Luke Gorrie wrote: >On the other hand, it's probably true that passing the whole >state record around and updating it in the furthest corners of >your process is a sign of poor design. I agree. There's a point where having a globally accessible state becomes less intrusive than threading that state throughout your program in a purely functional way. There was a long thread about this in comp.lang.functional some time back, which coincidentally was started by Peter Van Roy, the driving force behind Mozart/Oz (he was attempting to demonstrate why Mozart is multi-paradigm). Taking away all forms of globals rapidly gives state updates for many large programs a puzzle-like feel. You get this a lot in Haskell. There's too much mental effort for something fundamentally easy. Wandering a bit, I'd be curious to know about the history of the undocumented "vector" module, a C implementation of functional arrays. Sometimes not having fast array updates hurts, and this sounds like a good solution. But it has been in stealth mode for a couple of releases now. James From martin@REDACTED Mon Dec 16 19:07:52 2002 From: martin@REDACTED (martin j logan) Date: 16 Dec 2002 12:07:52 -0600 Subject: [Fwd: Re: Impressions of Mozart-Oz] Message-ID: <1040062072.6149.341.camel@berimbau> -------------- next part -------------- An embedded message was scrubbed... From: martin j logan Subject: Re: Impressions of Mozart-Oz Date: 16 Dec 2002 11:53:42 -0600 Size: 1054 URL: From vances@REDACTED Mon Dec 16 21:16:11 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 16 Dec 2002 15:16:11 -0500 Subject: Impressions of Mozart-Oz In-Reply-To: References: <20021214004306.GF54010@frogman.motivity.ca> Message-ID: <20021216201611.GI54010@frogman.motivity.ca> Roger, The process dictionary is just not necessary. You can achieve the same access to data by passing it around between functions in the module(s) which implement the process. If you are using the process dictionary you are probably not thinking about the problem the way that Erlang encourages you to. ETS can be used to have data available across processes. While this may break the same sort of rules of style as previously discussed there are many real life situations where it is necessary. One simple example from the telecom domain is the "Call Reference Number" (CRN) in ISUP & ISDN. We may have hundreds of gen_fsm processes handling call state and for the most part they operate independantly. Each new call however must use a globally unique CRN and they should really increment sequentially. ETS provides a handy way to do this with update_counter/3. Now it can be argued that the more proper way of doing this is to have a gen_server process which assigns these values and is accessed by sending and receiving messages. This process keeps the CRN value as State data which it passes to each function. Personally I just use ETS, it's much easier. -Vance On Sun, Dec 15, 2002 at 10:07:01PM +0100, Roger Price wrote: } } What's wrong with the process dictionary? Is it a matter of performance, } or programming style, or something else? From vances@REDACTED Mon Dec 16 21:39:01 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 16 Dec 2002 15:39:01 -0500 Subject: Q: Supervision and Magically Reincarnated Processes In-Reply-To: <00e201c2a4db$ae02d710$4021970a@norris> References: <00e201c2a4db$ae02d710$4021970a@norris> Message-ID: <20021216203901.GJ54010@frogman.motivity.ca> Bruce, You need to do the following in your init/1 function: process_flag(trap_exit, true) Normally the {'EXIT', Pid, Reason} message is handled for you but after setting this you will receive it in your handle_info/2 call back. You can do cleanup/reporting and return {stop,Reason,NewState}. Now terminate/2 will be called. Afterwards the supervisor will start it up again. -Vance On Mon, Dec 16, 2002 at 09:18:14PM +1300, Bruce Fitzsimons wrote: } } The process that dies is a gen_server (behaviour) and it doesn't execute its } terminate(Reason, State) so I guess its just 'EXIT'ing somewhere. } } My question is: how can I trap this (preferably sans debugger)? From erlang@REDACTED Tue Dec 17 20:40:27 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 17 Dec 2002 20:40:27 +0100 Subject: Process alive ? References: <00e201c2a4db$ae02d710$4021970a@norris> <20021216203901.GJ54010@frogman.motivity.ca> Message-ID: <005701c2a604$2a661b90$1e00a8c0@design> Does anyone know how can I check if a process running in a node is alive ? Thanks, Bernardo Paroli INSwitch Solutions From vances@REDACTED Tue Dec 17 00:56:53 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 16 Dec 2002 18:56:53 -0500 Subject: Process alive ? In-Reply-To: <005701c2a604$2a661b90$1e00a8c0@design> References: <00e201c2a4db$ae02d710$4021970a@norris> <20021216203901.GJ54010@frogman.motivity.ca> <005701c2a604$2a661b90$1e00a8c0@design> Message-ID: <20021216235653.GE62075@frogman.motivity.ca> You can use erlang:process_info/1. 1> Pid = self(). <0.25.0> 2> process_info(Pid). [{current_function,{erl_eval,expr,3}}, {initial_call,{shell,evaluator,3}}, {status,running}, {message_queue_len,0}, {messages,[]}, {links,[<0.22.0>]}, {dictionary,[]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.21.0>}, {heap_size,233}, {stack_size,13}, {reductions,89}, {garbage_collection,[{fullsweep_after,65535}]}] 3> banf = bang. ** exited: {{badmatch,bang},[{erl_eval,expr,3}]} ** 4> self(). <0.34.0> 5> process_info(Pid). undefined On Tue, Dec 17, 2002 at 08:40:27PM +0100, Inswitch Solutions - Erlang Evaluation wrote: } } Does anyone know how can I check if a process running in a node is alive ? } } Thanks, } Bernardo Paroli } INSwitch Solutions } } } From svg@REDACTED Tue Dec 17 01:19:14 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 17 Dec 2002 05:19:14 +0500 (YEKT) Subject: Process alive ? In-Reply-To: <005701c2a604$2a661b90$1e00a8c0@design> References: <00e201c2a4db$ae02d710$4021970a@norris> <20021216203901.GJ54010@frogman.motivity.ca> <005701c2a604$2a661b90$1e00a8c0@design> Message-ID: <20021217.051914.71085826.svg@surnet.ru> Good day, You can use is_process_alive(Pid) or rpc:call(Node, erlang, is_process_alive, [Pid]) if it is on another node. Best Regards, Vladimir Sekissov erlang> erlang> Does anyone know how can I check if a process running in a node is alive ? erlang> erlang> Thanks, erlang> Bernardo Paroli erlang> INSwitch Solutions erlang> erlang> From svg@REDACTED Tue Dec 17 01:35:16 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 17 Dec 2002 05:35:16 +0500 (YEKT) Subject: Gen processes and exit/2 from shell Message-ID: <20021217.053516.104027560.svg@surnet.ru> Good day, Could somebody explain me why gen_* processes don't trap exit(GenProcessPid, Reson) if it executed from erlang shell when ordinary processes do? 33> T = spawn_link(fun () -> process_flag(trap_exit, true), receive Msg -> io:format("msg: ~w~n", [Msg]) end end). <0.97.0> 34> exit(T, myreson). msg: {'EXIT',<0.73.0>,myreson} But 35> {ok, P} = gen_serv_with_trap_exit:start_link(). {ok, <0.99.0>} 36> exit(P, myreson). =ERROR REPORT==== 17-Dec-2002::04:19:17 === ** Generic server test_exit terminating ** Last message in was {'EXIT',<0.73.0>,myreson} ** When Server state == {state} ... Best Regards, Vladimir Sekissov From etxuwig@REDACTED Tue Dec 17 10:49:22 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 17 Dec 2002 10:49:22 +0100 (MET) Subject: Process alive ? In-Reply-To: <20021217.051914.71085826.svg@surnet.ru> Message-ID: On Tue, 17 Dec 2002, Vladimir Sekissov wrote: >Good day, > >You can use > >is_process_alive(Pid) > >or > >rpc:call(Node, erlang, is_process_alive, [Pid]) > >if it is on another node. Or, if you don't have a Pid, whereis(LogicalName) assuming that the process has registered a logical name using register(LogicalName, self()). whereis/1 returns a pid or 'undefined'. If you're checking from a remote node: rpc:call(Node, erlang, whereis, [LogicalName]). You can also use erlang:monitor(process, PidOrName). If the process is not alive, you will receive a 'DOWN' message. This is what gen:call() does. It works also in a distributed setting. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From luke@REDACTED Tue Dec 17 11:19:52 2002 From: luke@REDACTED (Luke Gorrie) Date: 17 Dec 2002 11:19:52 +0100 Subject: Gen processes and exit/2 from shell In-Reply-To: <20021217.053516.104027560.svg@surnet.ru> References: <20021217.053516.104027560.svg@surnet.ru> Message-ID: Vladimir Sekissov writes: > Good day, > > Could somebody explain me why gen_* processes don't trap > > exit(GenProcessPid, Reson) > > if it executed from erlang shell when ordinary processes do? It is a special case in gen_server:loop/6 that if your parent process (the one that spawned you) dies then you have to terminate, even if you're trapping exits. I guess the intention is to use a reliable parent like a supervisor, and not outlive it. When you use exit/2 from the shell it will get an {'EXIT', ShellPid, Rsn} signal - so if ShellPid == Parent (who spawned the server) then you would hit the special case. -Luke From bjorn@REDACTED Tue Dec 17 11:38:02 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 Dec 2002 11:38:02 +0100 Subject: Impressions of Mozart-Oz In-Reply-To: James Hague's message of "Mon, 16 Dec 2002 10:01:29 -0600" References: Message-ID: James Hague writes: > Wandering a bit, I'd be curious to know about the history of the > undocumented "vector" module, a C implementation of functional arrays. > Sometimes not having fast array updates hurts, and this sounds like a good > solution. But it has been in stealth mode for a couple of releases now. The current implementation of vectors is not as fast as it could be, as it forces a fullsweep (major) garbage collection as soon as an vector update has created pointers from the old generation heap to the new generation heap. For some uses, vectors will still out-perform other data structures. We hope to make the vectors faster in a future release by implementing a proper write barrier in the garbage collector. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From etxuwig@REDACTED Tue Dec 17 11:43:47 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 17 Dec 2002 11:43:47 +0100 (MET) Subject: Gen processes and exit/2 from shell In-Reply-To: Message-ID: On 17 Dec 2002, Luke Gorrie wrote: >It is a special case in gen_server:loop/6 that if your >parent process (the one that spawned you) dies then you >have to terminate, even if you're trapping exits. I guess >the intention is to use a reliable parent like a >supervisor, and not outlive it. > >When you use exit/2 from the shell it will get an {'EXIT', >ShellPid, Rsn} signal - so if ShellPid == Parent (who >spawned the server) then you would hit the special case. > >-Luke This is a really annoying feature when testing a server from the shell. What I usually do when playing around in the shell is: - {ok,Pid} = Server:start_link(...). - unlink(Pid). ...and then get on with the testing. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From enewhuis@REDACTED Tue Dec 17 14:16:59 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Tue, 17 Dec 2002 07:16:59 -0600 Subject: Job Offer Posting Ok? Message-ID: <000401c2a5ce$94d37fd0$56c3cf0a@XENO> To whom it may concern, Is it acceptable use of this mailing list to post job offers? Sincerely, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From eleberg@REDACTED Tue Dec 17 14:27:21 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Tue, 17 Dec 2002 14:27:21 +0100 (MET) Subject: Job Offer Posting Ok? Message-ID: <200212171327.gBHDRLD17974@cbe.ericsson.se> > From: "Eric Newhuis" > Is it acceptable use of this mailing list to post job offers? definitly not. send all job offers to me, personally, instead :-) seriously speaking, i think it would be a very good idea to have job offers here. bengt From hakan@REDACTED Tue Dec 17 14:33:16 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 17 Dec 2002 14:33:16 +0100 (MET) Subject: Gen processes and exit/2 from shell In-Reply-To: Message-ID: On Tue, 17 Dec 2002, Ulf Wiger wrote: Uffe> On 17 Dec 2002, Luke Gorrie wrote: Uffe> Uffe> >It is a special case in gen_server:loop/6 that if your Uffe> >parent process (the one that spawned you) dies then you Uffe> >have to terminate, even if you're trapping exits. I guess Uffe> >the intention is to use a reliable parent like a Uffe> >supervisor, and not outlive it. Uffe> > Uffe> >When you use exit/2 from the shell it will get an {'EXIT', Uffe> >ShellPid, Rsn} signal - so if ShellPid == Parent (who Uffe> >spawned the server) then you would hit the special case. Uffe> > Uffe> >-Luke Uffe> Uffe> This is a really annoying feature when testing a server from Uffe> the shell. What I usually do when playing around in the Uffe> shell is: Uffe> Uffe> - {ok,Pid} = Server:start_link(...). Uffe> - unlink(Pid). Uffe> Uffe> ...and then get on with the testing. Uffe> Uffe> /Uffe That is one useful approach. Another is to create the processes, ets-tables or whatever from one (resource owning) shell and then create another (working) shell where you do the actual work. This has helped me many times when I am doing my annoying typos in the shell. (Starting a new shell is done with 'control-g' followed by 's' and 'c') /H?kan --- H?kan Mattsson Ericsson High Availability Software, DBMS Internals http://www.ericsson.com/cslab/~hakan/ From enewhuis@REDACTED Tue Dec 17 14:54:30 2002 From: enewhuis@REDACTED (Eric Newhuis) Date: Tue, 17 Dec 2002 07:54:30 -0600 Subject: Job Offer Posting In-Reply-To: <200212171327.gBHDRLD17974@cbe.ericsson.se> Message-ID: <003101c2a5d3$d259faf0$56c3cf0a@XENO> Ok. Well then if that is a good thing then I have a job opening near Chicago, Illinois, USA, Planet Earth. I am still working on the perfect job description and here is what I have so far: Platform Team, Software Engineer for soft real-time telecommunications with C, C++, and Erlang in large distributed database system. Candidate must demonstrate proficiency in a functional language, either Erlang or something similar. Ideal candidate also has commercial C experience, can use version control, enjoys writing unit tests, wants to work with people, and is very flexible and can adapt to other's styles. Send resume and salary requirements to Kristine O'Neal, FutureSource, +1 630 792 2001 (USA). Mention Platform Team Software Engineer position. -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Bengt Kleberg Sent: Tuesday, December 17, 2002 7:27 AM To: erlang-questions@REDACTED Subject: Re: Job Offer Posting Ok? > From: "Eric Newhuis" > Is it acceptable use of this mailing list to post job offers? definitly not. send all job offers to me, personally, instead :-) seriously speaking, i think it would be a very good idea to have job offers here. bengt From luke@REDACTED Tue Dec 17 16:22:09 2002 From: luke@REDACTED (Luke Gorrie) Date: 17 Dec 2002 16:22:09 +0100 Subject: Erlang mode in Emacs In-Reply-To: References: <15865.64773.886666.293988@gargle.gargle.HOWL> Message-ID: Luke Gorrie writes: > I have a command for aligning the arrows in function heads that I've > been meaning to send in for years - maybe something we can add to the > mode and assign a key? Here's an updated version, which works like the old one except that if you give a prefix argument (by pressing C-u before the command), it will indent all arrows in the region, not just the ones in function heads. Fix courtesy of Matthias Lang, and meant for expressions like this: parse([open, {name, Name}|T]) -> case Name of "bye" -> {ok, #cmd_tuple{command = bye}}; "delete" -> delete(T); "install" -> install(T); "new" -> new(T); "nop" -> {ok, #cmd_tuple{command = nop}}; "query" -> qry(T); "reset" -> reset(T); "set" -> set(T); "takeover" -> takeover(T); "update" -> update(T); "zero" -> zero(T) end. Also, the `line-beginning-position' function doesn't exist in XEmacs, so here is a workaround to make the erlang-align-arrows work there: (unless (fboundp 'line-beginning-position) (defalias 'line-beginning-position 'point-at-bol)) (We can't just use point-at-bol all the time, because Emacs20 lacks that - it seems that some Emacs has to work around.) Okay, so here's the updated command (two functions now): (defun erlang-align-arrows (start end) "Align arrows (\"->\") in function clauses from START to END. When called interactively, aligns arrows after function clauses inside the region. With a prefix argument, aligns all arrows, not just those in function clauses. Example: sum(L) -> sum(L, 0). sum([H|T], Sum) -> sum(T, Sum + H); sum([], Sum) -> Sum. becomes: sum(L) -> sum(L, 0). sum([H|T], Sum) -> sum(T, Sum + H); sum([], Sum) -> Sum." (interactive "r") (save-excursion (let (;; regexp for matching arrows. without a prefix argument, ;; the regexp matches function heads. With a prefix, it ;; matches any arrow. (re (if current-prefix-arg "^.*\\(\\)->" (concat "^" erlang-atom-regexp ".*\\(\\)->"))) ;; part of regexp matching directly before the arrow (arrow-match-pos (if current-prefix-arg 1 (1+ erlang-atom-regexp-matches))) ;; accumulator for positions where arrows are found, ordered ;; by buffer position (from greatest to smallest) (arrow-positions '()) ;; accumulator for longest distance from start of line to arrow (most-indent 0) ;; marker to track the end of the region we're aligning (end-marker (progn (goto-char end) (point-marker)))) ;; Pass 1: Find the arrow positions, adjust the whitespace ;; before each arrow to one space, and find the greatest ;; indentation level. (goto-char start) (while (re-search-forward re end-marker t) (goto-char (match-beginning arrow-match-pos)) (just-one-space) ; adjust whitespace (setq arrow-positions (cons (point) arrow-positions)) (setq most-indent (max most-indent (erlang-column-number)))) (set-marker end-marker nil) ; free the marker ;; Pass 2: Insert extra padding so that all arrow indentation is ;; equal. This is done last-to-first by buffer position, so that ;; inserting spaces before one arrow doesn't change the ;; positions of the next ones. (mapcar (lambda (arrow-pos) (goto-char arrow-pos) (let* ((pad (- most-indent (erlang-column-number)))) (when (> pad 0) (insert (make-string pad ? ))))) arrow-positions)))) (defun erlang-column-number () "Return the column number of the current position in the buffer. Tab characters are counted by their visual width." (string-width (buffer-substring (line-beginning-position) (point)))) From eduardo@REDACTED Wed Dec 18 13:14:43 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Wed, 18 Dec 2002 13:14:43 +0100 Subject: TCP Broadcast Message-ID: <005301c2a68f$0cfd0d80$1e00a8c0@design> How can I do a TCP broadcast with clients connected to my server ? If I use controlling_proccess(...,PID) I can't send messages to PID from outside. Thanks again, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Wed Dec 18 15:17:32 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Wed, 18 Dec 2002 15:17:32 +0100 Subject: Mapping processes Message-ID: <006901c2a6a0$3577b150$1e00a8c0@design> I'm thinking how to map processes with request Id so to manage callbacks when using ports. What do you think about using register(reqId, PID) and whereis(reqId) to retrieve the PID so to send the response, in an async. way, to the calling process. Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Tue Dec 17 20:50:31 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 18 Dec 2002 00:50:31 +0500 (YEKT) Subject: Mapping processes In-Reply-To: <006901c2a6a0$3577b150$1e00a8c0@design> References: <006901c2a6a0$3577b150$1e00a8c0@design> Message-ID: <20021218.005031.78705334.svg@surnet.ru> Good day, eduardo> What do you think about using register(reqId, PID) and eduardo> whereis(reqId) to eduardo> retrieve the PID so to send the response, in an async. way, eduardo> to the calling process. I think you could easily exceed the atoms table limit on long living system. Using simple dictionary of {callerPid, reqId} and trapping exit messages from callers to delete records from dictionary would be better solution. May be like this or as gen_server: create_dict() -> spawn_link(fun dict_srv/0). remove_dict(DPid) -> DPid ! {self(), stop}, receive {DPid, stopped} -> ok end. dict_add(DPid, Pid, Reg) -> DPid ! {self(), add, {Pid, Reg}}. dict_get(DPid, Reg) -> DPid ! {self(), get, Reg}, receive {DPid, {value, {Pid, _}}} -> Pid; {DPid, false} -> undefined end. dict_srv() -> process_flag(trap_exit, true), dict_loop([]). dict_loop(Dict) -> receive {_From, add, V={Pid, Reg}} -> link(Pid), dict_loop([V|Dict]); {From, get, Reg} -> From ! {self(), lists:keysearch(Reg, 2, Dict)}, dict_loop(Dict); {'EXIT', Pid, Reson} -> case lists:keymember(Pid, 1, Dict) of true -> dict_loop(lists:keydelete(Pid, 1, Dict)); false -> exit(Reson) end; {From, stop} -> From ! {self(), stopped}, ok end. Best Regards, Vladimir Sekissov eduardo> eduardo> I'm thinking how to map processes with request Id so to manage eduardo> callbacks when using ports. eduardo> What do you think about using register(reqId, PID) and whereis(reqId) to eduardo> retrieve the PID so to send the response, in an async. way, to the calling process. eduardo> eduardo> eduardo> eduardo> Thanks, eduardo> Eduardo Figoli eduardo> INSwitch Solutions eduardo> eduardo> eduardo> eduardo> From erlang@REDACTED Tue Dec 17 01:44:36 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Mon, 16 Dec 2002 21:44:36 -0300 Subject: Process alive ? References: <00e201c2a4db$ae02d710$4021970a@norris> <20021216203901.GJ54010@frogman.motivity.ca> <005701c2a604$2a661b90$1e00a8c0@design> <20021216235653.GE62075@frogman.motivity.ca> Message-ID: <000001c2a612$4b70c8e0$1400a8c0@tdapi> Ok, but I don't know the Pid of the process. For example I have a process running in a node e1@REDACTED and another process running in a node e2@REDACTED, from node e1 I need send a message to application running in e2 node, in node e1 I write the next code {application, e2@REDACTED} ! {self(), "Message to send"}, receive {ok, Reply} -> ..... end But if the application it's not running in the e2 node I don't receive any error. ----- Original Message ----- From: "Vance Shipley" To: "Inswitch Solutions - Erlang Evaluation" Cc: Sent: Monday, December 16, 2002 8:56 PM Subject: Re: Process alive ? > > You can use erlang:process_info/1. > > 1> Pid = self(). > <0.25.0> > 2> process_info(Pid). > [{current_function,{erl_eval,expr,3}}, > {initial_call,{shell,evaluator,3}}, > {status,running}, > {message_queue_len,0}, > {messages,[]}, > {links,[<0.22.0>]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.21.0>}, > {heap_size,233}, > {stack_size,13}, > {reductions,89}, > {garbage_collection,[{fullsweep_after,65535}]}] > 3> banf = bang. > ** exited: {{badmatch,bang},[{erl_eval,expr,3}]} ** > 4> self(). > <0.34.0> > 5> process_info(Pid). > undefined > > On Tue, Dec 17, 2002 at 08:40:27PM +0100, Inswitch Solutions - Erlang Evaluation wrote: > } > } Does anyone know how can I check if a process running in a node is alive ? > } > } Thanks, > } Bernardo Paroli > } INSwitch Solutions > } > } > } > From erlang@REDACTED Tue Dec 17 23:01:18 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 17 Dec 2002 19:01:18 -0300 Subject: Fw: Process alive ? Message-ID: <002101c2a617$d46eb940$1400a8c0@tdapi> Please ignore this email. I already had the full answered from the list guys. Thanks! Bernardo Paroli INSwitch Solutions ----- Original Message ----- From: "Inswitch Solutions - Erlang Evaluation" To: Sent: Monday, December 16, 2002 9:44 PM Subject: Re: Process alive ? > Ok, but I don't know the Pid of the process. For example I have a process > running in a node e1@REDACTED and another process running in a node > e2@REDACTED, from node e1 I need send a message to application running in e2 > node, in node e1 I write the next code > {application, e2@REDACTED} ! {self(), "Message to send"}, > receive > {ok, Reply} -> > ..... > end > > But if the application it's not running in the e2 node I don't receive any > error. > > > ----- Original Message ----- > From: "Vance Shipley" > To: "Inswitch Solutions - Erlang Evaluation" > Cc: > Sent: Monday, December 16, 2002 8:56 PM > Subject: Re: Process alive ? > > > > > > You can use erlang:process_info/1. > > > > 1> Pid = self(). > > <0.25.0> > > 2> process_info(Pid). > > [{current_function,{erl_eval,expr,3}}, > > {initial_call,{shell,evaluator,3}}, > > {status,running}, > > {message_queue_len,0}, > > {messages,[]}, > > {links,[<0.22.0>]}, > > {dictionary,[]}, > > {trap_exit,false}, > > {error_handler,error_handler}, > > {priority,normal}, > > {group_leader,<0.21.0>}, > > {heap_size,233}, > > {stack_size,13}, > > {reductions,89}, > > {garbage_collection,[{fullsweep_after,65535}]}] > > 3> banf = bang. > > ** exited: {{badmatch,bang},[{erl_eval,expr,3}]} ** > > 4> self(). > > <0.34.0> > > 5> process_info(Pid). > > undefined > > > > On Tue, Dec 17, 2002 at 08:40:27PM +0100, Inswitch Solutions - Erlang > Evaluation wrote: > > } > > } Does anyone know how can I check if a process running in a node is > alive ? > > } > > } Thanks, > > } Bernardo Paroli > > } INSwitch Solutions > > } > > } > > } > > > From martin@REDACTED Tue Dec 17 23:26:28 2002 From: martin@REDACTED (martin j logan) Date: 17 Dec 2002 16:26:28 -0600 Subject: Mapping processes In-Reply-To: <20021218.005031.78705334.svg@surnet.ru> References: <006901c2a6a0$3577b150$1e00a8c0@design> <20021218.005031.78705334.svg@surnet.ru> Message-ID: <1040163994.6149.403.camel@berimbau> Eduardo, When I first started using erlang I also had this idea. I went so far as to implement it. I spent about an hour trying to figure out what clever construct I had come up with in order to fool the garbage collector so completely and cause such a nasty "memory leak". The thing is that the first argument to register must be an atom so you must convert reqID to an atom. I found out after a bit of research that atoms are not garbage collected, they are stored in a table for the life of the system. So in the interest of helping a fellow erlanger avoid such folly as I engaged in let me say that you should not ever dynamically create atoms in any situation that is not garaunteed to be finite. I typically use an ets table, loop data/dict, or some such to store mappings. This is coupled with some facility to remove the processes when they die. In this manner you can nicely achieve the same functionality. Cheers, Martin On Tue, 2002-12-17 at 13:50, Vladimir Sekissov wrote: > Good day, > > eduardo> What do you think about using register(reqId, PID) and > eduardo> whereis(reqId) to > eduardo> retrieve the PID so to send the response, in an async. way, > eduardo> to the calling process. > > I think you could easily exceed the atoms table limit on long living > system. Using simple dictionary of {callerPid, reqId} and trapping > exit messages from callers to delete records from dictionary would be > better solution. May be like this or as gen_server: > > create_dict() -> > spawn_link(fun dict_srv/0). > > remove_dict(DPid) -> > DPid ! {self(), stop}, > receive > {DPid, stopped} -> > ok > end. > > dict_add(DPid, Pid, Reg) -> > DPid ! {self(), add, {Pid, Reg}}. > > dict_get(DPid, Reg) -> > DPid ! {self(), get, Reg}, > receive > {DPid, {value, {Pid, _}}} -> > Pid; > {DPid, false} -> > undefined > end. > > dict_srv() -> > process_flag(trap_exit, true), > dict_loop([]). > > dict_loop(Dict) -> > receive > {_From, add, V={Pid, Reg}} -> > link(Pid), > dict_loop([V|Dict]); > {From, get, Reg} -> > From ! {self(), lists:keysearch(Reg, 2, Dict)}, > dict_loop(Dict); > {'EXIT', Pid, Reson} -> > case lists:keymember(Pid, 1, Dict) of > true -> > dict_loop(lists:keydelete(Pid, 1, Dict)); > false -> > exit(Reson) > end; > {From, stop} -> > From ! {self(), stopped}, > ok > end. > > Best Regards, > Vladimir Sekissov > > eduardo> > eduardo> I'm thinking how to map processes with request Id so to manage > eduardo> callbacks when using ports. > eduardo> What do you think about using register(reqId, PID) and whereis(reqId) to > eduardo> retrieve the PID so to send the response, in an async. way, to the calling process. > eduardo> > eduardo> > eduardo> > eduardo> Thanks, > eduardo> Eduardo Figoli > eduardo> INSwitch Solutions > eduardo> > eduardo> > eduardo> > eduardo> From martin@REDACTED Tue Dec 17 23:35:20 2002 From: martin@REDACTED (martin j logan) Date: 17 Dec 2002 16:35:20 -0600 Subject: Process alive ? In-Reply-To: <005701c2a604$2a661b90$1e00a8c0@design> References: <00e201c2a4db$ae02d710$4021970a@norris> <20021216203901.GJ54010@frogman.motivity.ca> <005701c2a604$2a661b90$1e00a8c0@design> Message-ID: <1040164521.6149.413.camel@berimbau> If the process is registered then you can do a whereis/1 if it is not then you must have some way of identifying it i.e pid(). If you have its pid() then you can interact with it in any number of ways. The cleanest is is_process_alive(Pid) the Pid argument must refer to a process of the same node as the call. Things of this sort can usually be found in the kernel module "erlang". Cheers, Martin On Tue, 2002-12-17 at 13:40, Inswitch Solutions - Erlang Evaluation wrote: > > Does anyone know how can I check if a process running in a node is alive ? > > Thanks, > Bernardo Paroli > INSwitch Solutions > > > From erlang@REDACTED Tue Dec 17 23:53:22 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 17 Dec 2002 19:53:22 -0300 Subject: Mnesia Web Interface for O&M and Customer Care Message-ID: <001601c2a61f$1dbc4570$1100a8c0@notebook> Hello, We are implementing a Mnesia database, for mobile prepaid accounts. Now, we need to implement both O&M and customer's care graphical modules. And we would prefer them to be web based interfaces. The web interface would be used to retrieve and update prepaid accounts data from the Mnesia accounts database. How would you recommend us to make the web to mnesia interface? Is there anything already implemented, that would help, as inets? Regards, daniel Daniel Fernandez INswitch Solutions T. 5989-9667353 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bruce@REDACTED Wed Dec 18 06:16:19 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Wed, 18 Dec 2002 18:16:19 +1300 Subject: Mnesia Web Interface for O&M and Customer Care References: <001601c2a61f$1dbc4570$1100a8c0@notebook> Message-ID: <00dc01c2a654$993f95a0$4021970a@norris> Hi Daniel, I'd highly recommend yaws (http://yaws.hyber.org), also at sourceforge.net. It is possible to use inets, or pico, but I've found yaws to be far faster (in terms of development time) and more flexible. Its in quite active development at the moment, and so some of the interfaces have been a little unstable, but I think thats been mostly ironed out now. /Bruce ----- Original Message ----- From: Inswitch Solutions - Erlang Evaluation To: erlang-questions@REDACTED Sent: Wednesday, December 18, 2002 11:53 AM Subject: Mnesia Web Interface for O&M and Customer Care Hello, We are implementing a Mnesia database, for mobile prepaid accounts. Now, we need to implement both O&M and customer's care graphical modules. And we would prefer them to be web based interfaces. The web interface would be used to retrieve and update prepaid accounts data from the Mnesia accounts database. How would you recommend us to make the web to mnesia interface? Is there anything already implemented, that would help, as inets? Regards, daniel Daniel Fernandez INswitch Solutions T. 5989-9667353 From eduardo@REDACTED Wed Dec 18 18:28:10 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Wed, 18 Dec 2002 18:28:10 +0100 Subject: user and server unbound variables Message-ID: <007901c2a6ba$d70e9460$1e00a8c0@design> Good morning, What does spawn_link(user, server, [self()]) mean ? I get this line from the code attached (telnet to erlang console). I don't know from where do user and server variables come from. Thanks, Eduardo Figoli -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: getty.erl Type: application/octet-stream Size: 2309 bytes Desc: not available URL: From luke@REDACTED Wed Dec 18 12:56:04 2002 From: luke@REDACTED (Luke Gorrie) Date: 18 Dec 2002 12:56:04 +0100 Subject: Mapping processes In-Reply-To: <006901c2a6a0$3577b150$1e00a8c0@design> References: <006901c2a6a0$3577b150$1e00a8c0@design> Message-ID: "Eduardo Figoli" writes: > I'm thinking how to map processes with request Id so to manage > callbacks when using ports. > What do you think about using register(reqId, PID) and > whereis(reqId) to retrieve the PID so to send the response, in an > async. way, to the calling process. Maybe you can use the PID as/in the request ID itself? -Luke From Sean.Hinde@REDACTED Wed Dec 18 13:22:17 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 18 Dec 2002 12:22:17 -0000 Subject: Mnesia Web Interface for O&M and Customer Care Message-ID: <04D356A3B172D611981B0008C791C3126BF656@imp02mbx.t-mobile.co.uk> Hi, Inets works fine for the sort of O&M activity you are talking about. We use a modified version of Joe's Erlang Server Pages (esp.erl attached) which stores the page templates in mnesia itself. The idea is to have an erlang callback using the mod_erl inets mechanism which can pass data into the esp page to make a dynamic page. a trivial example for http://localhost:8080/cgi-bin/erl/test/page would be: -module(test). -export([page/2]). page(_,_) -> Dynamic_content = "Sean", esp:expand("test_page.esp", [{"my_data", Dynamic_content}]). test_page.esp could look something like: Name: ${my_data} This is what we do for all our config pages including customer provisioning for a full blown VPN IN service. Sean -----Original Message----- From: Inswitch Solutions - Erlang Evaluation [mailto:erlang@REDACTED] Sent: 17 December 2002 22:53 To: erlang-questions@REDACTED Subject: Mnesia Web Interface for O&M and Customer Care Hello, We are implementing a Mnesia database, for mobile prepaid accounts. Now, we need to implement both O&M and customer's care graphical modules. And we would prefer them to be web based interfaces. The web interface would be used to retrieve and update prepaid accounts data from the Mnesia accounts database. How would you recommend us to make the web to mnesia interface? Is there anything already implemented, that would help, as inets? Regards, daniel Daniel Fernandez INswitch Solutions T. 5989-9667353 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: 9130 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sean.Hinde@REDACTED Wed Dec 18 14:05:23 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 18 Dec 2002 13:05:23 -0000 Subject: user and server unbound variables Message-ID: <04D356A3B172D611981B0008C791C3126BF65A@imp02mbx.t-mobile.co.uk> user and server are atoms (or fixed labels) not variable names - Variable names start with a Capital letter in Erlang. The line of code says that you wish to create a new erlang process which will execute the function server(Pid) in the module user when it has started. Pid here will be set to the value of self() which is the process ID of the process it is executed in (in this case the process calling the spawn_link function). I guess this means that the new process needs to be able to send replies to the original process. The first part of the Erlang Book pdf covers this stuff very nicely: www.erlang.org/download/erlang-book-part1.pdf Sean -----Original Message----- From: Eduardo Figoli [mailto:eduardo@REDACTED] Sent: 18 December 2002 17:28 To: erlang-questions@REDACTED Subject: user and server unbound variables Good morning, What does spawn_link(user, server, [self()]) mean ? I get this line from the code attached (telnet to erlang console). I don't know from where do user and server variables come from. Thanks, Eduardo Figoli 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 joe@REDACTED Wed Dec 18 14:13:22 2002 From: joe@REDACTED (Joe Armstrong) Date: Wed, 18 Dec 2002 14:13:22 +0100 (CET) Subject: user and server unbound variables In-Reply-To: <007901c2a6ba$d70e9460$1e00a8c0@design> Message-ID: On Wed, 18 Dec 2002, Eduardo Figoli wrote: > > Good morning, > > What does spawn_link(user, server, [self()]) mean ? > I get this line from the code attached (telnet to erlang console). > I don't know from where do user and server variables come from. > > Thanks, > Eduardo Figoli > user and server are not variables they are atoms (because they start with small letters) - so this means spawn the process user:server(self()) and create a link to the spawned process. What does this do? > erl -man user ... Should tell you the answer - but this is an undocumented function :-) You could read the code to find out: 1> code:which(user). "/usr/local/lib/erlang/lib/kernel-2.8.0/ebin/user.beam" 2> The code is in the ../src directory relative to the object code $ less /usr/local/lib/erlang/lib/kernel-2.8.0/src/user.erl ... What is appears is make all termoinal io operations go to the calling process. /Joe From bjarne@REDACTED Wed Dec 18 15:12:23 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Wed, 18 Dec 2002 15:12:23 +0100 Subject: New HiPE partners are invited References: <0430BE87-0C6B-11D7-85B9-0003939B65EA@nortelnetworks.com> Message-ID: <3E008247.27C29C4D@erix.ericsson.se> Hello High Performance Erlang, HiPE, is a research project run at Uppsala university which also produces results which are directly included in the Erlang/OTP releases. HiPE is part of the ASTEC competence centre. In competence centres industry and research work together. This means that Swedish state agency VINNOVA sponsors project on par with industry sponsoring. This can take the form of work effort or money contribution. In the HiPE case Ericsson both contributes work and money. The work effort consists of 30% of a manyear. For 2002 the cash constribution was 600 KSEK, however, for 2003 it will be reduced to 220 KSEK. Further HiPE partners are welcome both as cash input and as work effort. Please contact me or somebody at ASTEC or HiPE. Best regards Bjarne Links http://www.astec.uu.se/ http://www.csd.uu.se/projects/hipe/ http://www.erlang.org/ From erlang@REDACTED Wed Dec 18 17:48:35 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Wed, 18 Dec 2002 13:48:35 -0300 Subject: Mnesia Web Interface for O&M and Customer Care In-Reply-To: <04D356A3B172D611981B0008C791C3126BF656@imp02mbx.t-mobile.co.uk> Message-ID: <000201c2a6b5$52917130$1100a8c0@notebook> Hello Sean, Many Thanks! If I understand the idea, (please correct me if I am wrong in the process description) erl pages are saved within Mnesia. When inets receives an URL request, which is an ?.esp? page, it calls ?esp.erl? which retrieves it from Mnesia. One question: how do we configure inets to call ?esp.erl? when receiving an URL request which is an ?erl? page, and where does ?esp.erl? go (I suppose within ?/cgi-bin/erl/? for example)? Then, the retrieved erl page is converted into html, (by ?esp.erl??) and shown to the web client who made the request. Now, if the returned page, has a form which has a database lookup option, when the client will submit the form, and a second request for a new URL, with certain parameters submitted (about the data to be lookup into Mnesia, like an account number, for example). This time, ?esp.erl? will retrieve a new page, and with the additional data entered it should make the database lookup, and dynamically create an html page with the response data, from Mnesia. Question: where does the logic that makes the mnesia database lookup and data retrieval go? Within the ?.esp? page, or within the ?esp.erl? ? Regards, daniel INswitch Solutions T. 5989-9667353 -----Mensaje original----- De: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] En nombre de Sean Hinde Enviado el: mi?rcoles, 18 de diciembre de 2002 9:22 Para: 'Inswitch Solutions - Erlang Evaluation'; erlang-questions@REDACTED Asunto: RE: Mnesia Web Interface for O&M and Customer Care Hi, Inets works fine for the sort of O&M activity you are talking about. We use a modified version of Joe's Erlang Server Pages (esp.erl attached) which stores the page templates in mnesia itself. The idea is to have an erlang callback using the mod_erl inets mechanism which can pass data into the esp page to make a dynamic page. a trivial example for http://localhost:8080/cgi-bin/erl/test/page would be: -module(test). -export([page/2]). page(_,_) -> Dynamic_content = "Sean", esp:expand("test_page.esp", [{"my_data", Dynamic_content}]). test_page.esp could look something like: Name: ${my_data} This is what we do for all our config pages including customer provisioning for a full blown VPN IN service. Sean -----Original Message----- From: Inswitch Solutions - Erlang Evaluation [mailto:erlang@REDACTED] Sent: 17 December 2002 22:53 To: erlang-questions@REDACTED Subject: Mnesia Web Interface for O&M and Customer Care Hello, We are implementing a Mnesia database, for mobile prepaid accounts. Now, we need to implement both O&M and customer's care graphical modules. And we would prefer them to be web based interfaces. The web interface would be used to retrieve and update prepaid accounts data from the Mnesia accounts database. How would you recommend us to make the web to mnesia interface? Is there anything already implemented, that would help, as inets? Regards, daniel Daniel Fernandez INswitch Solutions T. 5989-9667353 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 Wed Dec 18 18:01:32 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 18 Dec 2002 17:01:32 -0000 Subject: Mnesia Web Interface for O&M and Customer Care Message-ID: <04D356A3B172D611981B0008C791C3126BF666@imp02mbx.t-mobile.co.uk> > Hello Sean, > > Many Thanks! > > If I understand the idea, (please correct me if I am wrong in the > process description) erl pages are saved within Mnesia. When inets > receives an URL request, which is an ".esp" page, it calls "esp.erl" > which retrieves it from Mnesia. One question: how do we > configure inets > to call "esp.erl" when receiving an URL request which is an > "erl" page, > and where does "esp.erl" go (I suppose within "/cgi-bin/erl/" for > example)? Almost. The .esp pages are stored in mnesia with esp:store("page.esp"). The /cgi-bin/erl is in the configuration file to inets. It tells inets that if it gets a request for a URL like /cgi-bin/erl/mod/func then it should just call mod:func(Env, Data) to get the page to serve. This function returns the result of esp:expand(page.esp,[]) whcih is the html code. > Question: where does the logic that makes the mnesia database > lookup and data retrieval go? Within the ".esp" page, or within the > "esp.erl" ? in the callback for mod:func/2 which receives the content of the POST. See http://www.erlang.org/doc/r9b/lib/inets-3.0/doc/html/mod_esi.html for more details Sean > -----Mensaje original----- > De: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] En nombre de Sean Hinde > Enviado el: mi?rcoles, 18 de diciembre de 2002 9:22 > Para: 'Inswitch Solutions - Erlang Evaluation'; > erlang-questions@REDACTED > Asunto: RE: Mnesia Web Interface for O&M and Customer Care > > Hi, > > Inets works fine for the sort of O&M activity you are talking > about. We > use > a modified version of Joe's Erlang Server Pages (esp.erl > attached) which > stores the page templates in mnesia itself. > > The idea is to have an erlang callback using the mod_erl > inets mechanism > which can pass data into the esp page to make a dynamic page. > > a trivial example for http://localhost:8080/cgi-bin/erl/test/page > would be: > > -module(test). > -export([page/2]). > > page(_,_) -> > Dynamic_content = "Sean", > esp:expand("test_page.esp", [{"my_data", Dynamic_content}]). > > test_page.esp could look something like: > > > > Name: ${my_data} > > > > This is what we do for all our config pages including customer > provisioning > for a full blown VPN IN service. > > Sean > > -----Original Message----- > From: Inswitch Solutions - Erlang Evaluation > [mailto:erlang@REDACTED] > Sent: 17 December 2002 22:53 > To: erlang-questions@REDACTED > Subject: Mnesia Web Interface for O&M and Customer Care > > > > Hello, > > > > We are implementing a Mnesia database, for mobile prepaid > accounts. Now, > we > need to implement both O&M and customer's care graphical > modules. And we > would prefer them to be web based interfaces. The web > interface would be > used to retrieve and update prepaid accounts data from the Mnesia > accounts > database. How would you recommend us to make the web to mnesia > interface? Is > there anything already implemented, that would help, as inets? > > > > Regards, > > > > daniel > > > > Daniel Fernandez > > > > > > INswitch Solutions > > T. 5989-9667353 > > > > > > > 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. > > > > 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 Dec 18 18:37:46 2002 From: luke@REDACTED (Luke Gorrie) Date: 18 Dec 2002 18:37:46 +0100 Subject: Erlang mode in Emacs In-Reply-To: <15865.64773.886666.293988@gargle.gargle.HOWL> References: <15865.64773.886666.293988@gargle.gargle.HOWL> Message-ID: Ingela Anderton writes: > Hello everyone! > > I have been doing some corrections to the erlang-mode. This updated > version will not be officially released until the next Erlang/OTP > release. But as it is so hard to test emacs-modes with automatic > test-suits I have put it into the contribution area so that you may > test it right away. This way I get it properly tested and you get the > benefit of my fixes already today :) > > http://www.erlang.org/download/contrib/ > > If you find an bugs old or new, please send me a mail. Just remembered a couple of font-lock bugs, and it looks like there have been fixes already. Grep'ing for "bad emacs" in our source tree gave 12 hits, and they all seem to be solved, which is really great. Looks like the fixes were that $" and $' are not seen as starting strings anymore, probably because $ and ^ were changed to "character quote" syntax class? I think this also solves a problem of matching ( with $). There is however another problem coming from those syntax classes: "foo$" "foo^" In both cases the closing " is escaped (in font-lock) so everything that follows gets classed as a string, i.e. Emacs reads it the same as "foo\". I don't know how to fix it properly, but the workarounds aren't too bad: "foo\$" "foo\^" Cheers, Luke From valentin@REDACTED Wed Dec 18 20:47:45 2002 From: valentin@REDACTED (Valentin) Date: Wed, 18 Dec 2002 21:47:45 +0200 Subject: Fw: Was Mapping processes Now: ATOMS and atom_tab index Message-ID: <003c01c2a6ce$587aecc0$ccea1ec4@moneymaker> We have discovered (the hard way) that number of atoms in ERTS is limited to 1024*1024, which limits the number of atoms to 1,048,576. The question was posted recently asking how to increase this limit, but judging from the lack of response, I guess, there isn't one. We have found the code where this table was allocated, but I do not think that the recompilation with changed value will do any good, as it might have side effects. When the space in the atom_tab index is reached, erlang crashes with the bang. And quite a sizable dump. It might be a good idea to mention this limitation somewhere in the manual (hopefully in ei_x_encode_atom(...) description as well). Eduardo, as well as Martin before him, had a good idea (that is, if you ask me). It seems odd that one has to use ets, or similar mechanism to register a short-lived processes, if such a mechanism already exist, but cannot be used because it requires an atom, as an argument. On the other hand, I've noticed that global:register_name/2 supports string as registration name argument as well. I wonder, would it be wise to use this in a context that Eduardo was describing, by using global:register_name/2 and global:whereis_name/1. What would be the catch (other than specific syntax that has to be used in order to send a message?) Any performance penalty? Valentin. > > ----- Original Message ----- > From: "martin j logan" > To: > Cc: > Sent: Wednesday, December 18, 2002 12:26 AM > Subject: Re: Mapping processes > > > > Eduardo, > > When I first started using erlang I also had this idea. I went so > > far as to implement it. I spent about an hour trying to figure out what > > clever construct I had come up with in order to fool the garbage > > collector so completely and cause such a nasty "memory leak". The thing > > is that the first argument to register must be an atom so you must > > convert reqID to an atom. I found out after a bit of research that atoms > > are not garbage collected, they are stored in a table for the life of > > the system. So in the interest of helping a fellow erlanger avoid such > > folly as I engaged in let me say that you should not ever dynamically > > create atoms in any situation that is not garaunteed to be finite. I > > typically use an ets table, loop data/dict, or some such to store > > mappings. This is coupled with some facility to remove the processes > > when they die. In this manner you can nicely achieve the same > > functionality. > > > > Cheers, > > Martin > > > > On Tue, 2002-12-17 at 13:50, Vladimir Sekissov wrote: > > > Good day, > > > > > > eduardo> What do you think about using register(reqId, PID) and > > > eduardo> whereis(reqId) to > > > eduardo> retrieve the PID so to send the response, in an async. way, > > > eduardo> to the calling process. > > > > > > I think you could easily exceed the atoms table limit on long living > > > system. Using simple dictionary of {callerPid, reqId} and trapping > > > exit messages from callers to delete records from dictionary would be > > > better solution. May be like this or as gen_server: > > > > > > create_dict() -> > > > spawn_link(fun dict_srv/0). > > > > > > remove_dict(DPid) -> > > > DPid ! {self(), stop}, > > > receive > > > {DPid, stopped} -> > > > ok > > > end. > > > > > > dict_add(DPid, Pid, Reg) -> > > > DPid ! {self(), add, {Pid, Reg}}. > > > > > > dict_get(DPid, Reg) -> > > > DPid ! {self(), get, Reg}, > > > receive > > > {DPid, {value, {Pid, _}}} -> > > > Pid; > > > {DPid, false} -> > > > undefined > > > end. > > > > > > dict_srv() -> > > > process_flag(trap_exit, true), > > > dict_loop([]). > > > > > > dict_loop(Dict) -> > > > receive > > > {_From, add, V={Pid, Reg}} -> > > > link(Pid), > > > dict_loop([V|Dict]); > > > {From, get, Reg} -> > > > From ! {self(), lists:keysearch(Reg, 2, Dict)}, > > > dict_loop(Dict); > > > {'EXIT', Pid, Reson} -> > > > case lists:keymember(Pid, 1, Dict) of > > > true -> > > > dict_loop(lists:keydelete(Pid, 1, Dict)); > > > false -> > > > exit(Reson) > > > end; > > > {From, stop} -> > > > From ! {self(), stopped}, > > > ok > > > end. > > > > > > Best Regards, > > > Vladimir Sekissov > > > > > > eduardo> > > > eduardo> I'm thinking how to map processes with request Id so to manage > > > eduardo> callbacks when using ports. > > > eduardo> What do you think about using register(reqId, PID) and > whereis(reqId) to > > > eduardo> retrieve the PID so to send the response, in an async. way, to > the calling process. > > > eduardo> > > > eduardo> > > > eduardo> > > > eduardo> Thanks, > > > eduardo> Eduardo Figoli > > > eduardo> INSwitch Solutions > > > eduardo> > > > eduardo> > > > eduardo> > > > eduardo> > > > > > From vances@REDACTED Wed Dec 18 21:14:38 2002 From: vances@REDACTED (Vance Shipley) Date: Wed, 18 Dec 2002 15:14:38 -0500 Subject: problem with include_lib directive Message-ID: <20021218201438.GA858@frogman.motivity.ca> I found a problem with R9B-0 when I try to use the include_lib directive. It works when I compile from the shell but not from the unix command line: -module(t). -include_lib("eva/include/eva.hrl"). -export([start/0]). start() -> ok. $ erlc t.erl ./t.erl:3: can't find include lib "eva/include/eva.hrl" $ erl Erlang (BEAM) emulator version 5.2 [source] [hipe] [threads:0] Eshell V5.2 (abort with ^G) 1> c(t). {ok,t} -Vance From Chandrashekhar.Mullaparthi@REDACTED Thu Dec 19 02:50:48 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 19 Dec 2002 01:50:48 -0000 Subject: Was Mapping processes Now: ATOMS and atom_tab index Message-ID: <04D356A3B172D611981B0008C791C312404FB0@imp02mbx.t-mobile.co.uk> Using global will create problems if you have more than one erlang node in a mesh, all doing pretty much the same thing. And every call to global:register_name, global:re_register_name, global:unregister_name makes a synchronous call to every node in the mesh. The PID of a process is unique within the node - I usually associate a name to a process only when it is going to live a long time or when it should be seen across a network of nodes. Why do you need this for such short-lived processes? As Luke said in the previous thread, the PID can be used as or as part of the request-id? The limitation is documented. See http://www.erlang.org/doc/r9b/doc/efficiency_guide/advanced.html#7.2 Chandru -----Original Message----- From: Valentin [mailto:valentin@REDACTED] Sent: 18 December 2002 19:48 To: erlang-questions@REDACTED Subject: Fw: Was Mapping processes Now: ATOMS and atom_tab index We have discovered (the hard way) that number of atoms in ERTS is limited to 1024*1024, which limits the number of atoms to 1,048,576. The question was posted recently asking how to increase this limit, but judging from the lack of response, I guess, there isn't one. We have found the code where this table was allocated, but I do not think that the recompilation with changed value will do any good, as it might have side effects. When the space in the atom_tab index is reached, erlang crashes with the bang. And quite a sizable dump. It might be a good idea to mention this limitation somewhere in the manual (hopefully in ei_x_encode_atom(...) description as well). Eduardo, as well as Martin before him, had a good idea (that is, if you ask me). It seems odd that one has to use ets, or similar mechanism to register a short-lived processes, if such a mechanism already exist, but cannot be used because it requires an atom, as an argument. On the other hand, I've noticed that global:register_name/2 supports string as registration name argument as well. I wonder, would it be wise to use this in a context that Eduardo was describing, by using global:register_name/2 and global:whereis_name/1. What would be the catch (other than specific syntax that has to be used in order to send a message?) Any performance penalty? Valentin. > > ----- Original Message ----- > From: "martin j logan" > To: > Cc: > Sent: Wednesday, December 18, 2002 12:26 AM > Subject: Re: Mapping processes > > > > Eduardo, > > When I first started using erlang I also had this idea. I went so > > far as to implement it. I spent about an hour trying to figure out what > > clever construct I had come up with in order to fool the garbage > > collector so completely and cause such a nasty "memory leak". The thing > > is that the first argument to register must be an atom so you must > > convert reqID to an atom. I found out after a bit of research that atoms > > are not garbage collected, they are stored in a table for the life of > > the system. So in the interest of helping a fellow erlanger avoid such > > folly as I engaged in let me say that you should not ever dynamically > > create atoms in any situation that is not garaunteed to be finite. I > > typically use an ets table, loop data/dict, or some such to store > > mappings. This is coupled with some facility to remove the processes > > when they die. In this manner you can nicely achieve the same > > functionality. > > > > Cheers, > > Martin > > > > On Tue, 2002-12-17 at 13:50, Vladimir Sekissov wrote: > > > Good day, > > > > > > eduardo> What do you think about using register(reqId, PID) and > > > eduardo> whereis(reqId) to > > > eduardo> retrieve the PID so to send the response, in an async. way, > > > eduardo> to the calling process. > > > > > > I think you could easily exceed the atoms table limit on long living > > > system. Using simple dictionary of {callerPid, reqId} and trapping > > > exit messages from callers to delete records from dictionary would be > > > better solution. May be like this or as gen_server: > > > > > > create_dict() -> > > > spawn_link(fun dict_srv/0). > > > > > > remove_dict(DPid) -> > > > DPid ! {self(), stop}, > > > receive > > > {DPid, stopped} -> > > > ok > > > end. > > > > > > dict_add(DPid, Pid, Reg) -> > > > DPid ! {self(), add, {Pid, Reg}}. > > > > > > dict_get(DPid, Reg) -> > > > DPid ! {self(), get, Reg}, > > > receive > > > {DPid, {value, {Pid, _}}} -> > > > Pid; > > > {DPid, false} -> > > > undefined > > > end. > > > > > > dict_srv() -> > > > process_flag(trap_exit, true), > > > dict_loop([]). > > > > > > dict_loop(Dict) -> > > > receive > > > {_From, add, V={Pid, Reg}} -> > > > link(Pid), > > > dict_loop([V|Dict]); > > > {From, get, Reg} -> > > > From ! {self(), lists:keysearch(Reg, 2, Dict)}, > > > dict_loop(Dict); > > > {'EXIT', Pid, Reson} -> > > > case lists:keymember(Pid, 1, Dict) of > > > true -> > > > dict_loop(lists:keydelete(Pid, 1, Dict)); > > > false -> > > > exit(Reson) > > > end; > > > {From, stop} -> > > > From ! {self(), stopped}, > > > ok > > > end. > > > > > > Best Regards, > > > Vladimir Sekissov > > > > > > eduardo> > > > eduardo> I'm thinking how to map processes with request Id so to manage > > > eduardo> callbacks when using ports. > > > eduardo> What do you think about using register(reqId, PID) and > whereis(reqId) to > > > eduardo> retrieve the PID so to send the response, in an async. way, to > the calling process. > > > eduardo> > > > eduardo> > > > eduardo> > > > eduardo> Thanks, > > > eduardo> Eduardo Figoli > > > eduardo> INSwitch Solutions > > > eduardo> > > > eduardo> > > > eduardo> > > > eduardo> > > > > > 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 kent@REDACTED Thu Dec 19 07:26:46 2002 From: kent@REDACTED (Kent Boortz) Date: 19 Dec 2002 07:26:46 +0100 Subject: Fw: Was Mapping processes Now: ATOMS and atom_tab index In-Reply-To: <003c01c2a6ce$587aecc0$ccea1ec4@moneymaker> References: <003c01c2a6ce$587aecc0$ccea1ec4@moneymaker> Message-ID: "Valentin" writes: > We have discovered (the hard way) that number of atoms in ERTS is limited > to > 1024*1024, which limits the number of atoms to 1,048,576. The question was > posted recently asking how to increase this limit, but judging from the > lack > of response, I guess, there isn't one. We have found the code where this > table was allocated, but I do not think that the recompilation with changed > value will do any good, as it might have side effects. > > When the space in the atom_tab index is reached, erlang crashes with the > bang. And quite a sizable dump. > It might be a good idea to mention this limitation somewhere in the manual > (hopefully in ei_x_encode_atom(...) description as well). It is in the manual. I entered "limits" in the search field at www.erlang.org, got 10 pages and found the information at http://www.erlang.org/doc/r9b/doc/efficiency_guide/advanced.html But I knew what I was looking for, the page is not that easy to find from the index page of the documentation. There is also a note that registered processes is only for long lived processes at http://www.erlang.se/doc/programming_rules.shtml#HDR17 I will add a note or a reference about limitations in the erl_interface manual, kent From hfventer@REDACTED Thu Dec 19 10:08:59 2002 From: hfventer@REDACTED (hfventer) Date: Thu, 19 Dec 2002 11:08:59 +0200 Subject: Gen_server and multiple processes Message-ID: <000001c2a73e$45c785f0$0100a8c0@home1> Hello all I would like to know if the gen_server behavior creates a separate process for each message that is sent to it, or must this kind of thing still be written into your own code? In other words, if several calls to the function foo() is made, will there be several processes each running handle_call spawned, or will there be several queued calls to handle_call? It seems that playing to Erlangs strengths in this situation makes the most sense :) Would spawning a process to handle foo and returning immediately might be the correct way to do this type of thing? (if gen_server does not do it already). -]-[einrich From matthias@REDACTED Thu Dec 19 10:44:43 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 19 Dec 2002 10:44:43 +0100 Subject: Gen_server and multiple processes In-Reply-To: <000001c2a73e$45c785f0$0100a8c0@home1> References: <000001c2a73e$45c785f0$0100a8c0@home1> Message-ID: <15873.38155.42970.278251@antilipe.corelatus.se> hfventer writes: > I would like to know if the gen_server behavior creates a separate > process for each message that is sent to it, or must this kind of thing > still be written into your own code? gen_server does not create a new process for each call. Half the point of having a a gen_server is that requests to it are taken one at a time. You can verify this yourself by inserting something like io:fwrite("my_gen_server:handle_call running in pid ~p\n", [self()]) into your handle_call code. Matthias From francesco@REDACTED Thu Dec 19 11:02:55 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 19 Dec 2002 10:02:55 +0000 Subject: Gen_server and multiple processes References: <000001c2a73e$45c785f0$0100a8c0@home1> Message-ID: <3E01994F.8070907@erlang-consulting.com> > > >I would like to know if the gen_server behavior creates a separate >process for each message > Each generic server is a process, and calls and casts to it are just sent as messages. If you want a process to handle every incoming message, you will have to create dynamic children (1 server for every message). >In other words, if several calls to the function foo() is made, will >there be several processes each running handle_call spawned, or will >there be several queued calls to handle_call? > The messages will be queued. >It seems that playing to Erlangs strengths in this situation makes the >most sense :) Would spawning a process to handle foo and returning >immediately might be the correct way to do this type of thing? (if >gen_server does not do it already). > Not really. It depends on how heavy the operations are (How long will the wait for the other messages in the queue are), how many incoming messages you will expect (eg. will the server be a bottle neck), and if you expect a reply or not (Should the calls be synchronous or asynchronous), will the change of state in your server affect the various calls, and if the order in which the requests are handled will affect other requests. Maybe if you describe your problem in more detail, we can lead you in the right direction. Generalizing, and knowing little about your problem, my first attempt would be to solve the problem with one gen server and see if it works. If the load on it is too heavy, the step to a server per request is not that big. Francesco -- http://www.erlang-consulting.com From Sean.Hinde@REDACTED Thu Dec 19 13:00:50 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 19 Dec 2002 12:00:50 -0000 Subject: Gen_server and multiple processes Message-ID: <04D356A3B172D611981B0008C791C3126BF672@imp02mbx.t-mobile.co.uk> > I would like to know if the gen_server behavior creates a separate > process for each message that is sent to it, or must this > kind of thing > still be written into your own code? > In other words, if several calls to the function foo() is made, will > there be several processes each running handle_call spawned, or will > there be several queued calls to handle_call? > It seems that playing to Erlangs strengths in this situation makes the > most sense :) Would spawning a process to handle foo and returning > immediately might be the correct way to do this type of thing? (if > gen_server does not do it already). As Mattias says gen_server doesn't do this, but it does provide the mechnism to not return an immediate reply if you wish to spawn a new thread for the call, and an additional mechanism to actually send the reply sometime later. You just need to return {no_reply, State} from the initial handle_call/3, and later call gen_server:reply(Client, Reply) with the result of the long calculation done in your thread. 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 martin@REDACTED Thu Dec 19 19:06:42 2002 From: martin@REDACTED (martin j logan) Date: 19 Dec 2002 12:06:42 -0600 Subject: Gen_server and multiple processes In-Reply-To: <000001c2a73e$45c785f0$0100a8c0@home1> References: <000001c2a73e$45c785f0$0100a8c0@home1> Message-ID: <1040321203.5644.629.camel@berimbau> Einrich, The way that is typically advocated for dealing with concurrency is one process for each truly concurrent activity in the system. It is the task of the programmer to determine exactly what that means i.e the proper granularity for modeling. Many things can be concurrent but are they salient in terms of the overall architecture, could you easily give each of these processes a name on a data flow diagram without an explanation? Are they truly, logically concurrent? If not chances are they really have no overwhelming need to be executed in a non-sequential manner. Of course there are exceptions to this rule but on the whole it stands. Some of the general things I ask myself are: - Is there a simple and logical linguistic formulation of my reasoning, can I explain it easily? These things are separate processes/entities because... - Would I include this process in a Data Flow Diagram? Would it get a name that is not an explanation? - If I implement this operation sequentially will I place a significant bottle neck in my system? - Does the concurrent implementation of this operation simplify the overall architecture of my system? Does it make it more elegant? Getting a feel for thinking in terms of concurrency took me some time. A good scenario to re-examine in these terms is the implementation of a TCP server vs. a UDP server. It is easy to explain why a TCP server should have a concurrent process per TCP stream. It simplifies the overall architecture and avoids a potential bottle neck. There is a clean logical separation between the truly concurrent elements, streams, in this case. There exists no such easy explanation, salient logical separation, or architectural simplification when talking about the UDP server. Typically one would not implement a concurrent process for each UDP connection i.e each packet. Further more implementing it sequentially does not introduce a bottle neck into the system and would probably make your overall architecture cleaner. I hope that this helps - I would also like to hear if others agree or have another way of looking at modeling concurrent systems. Cheers, Martin On Thu, 2002-12-19 at 03:08, hfventer wrote: > Hello all > > I would like to know if the gen_server behavior creates a separate > process for each message that is sent to it, or must this kind of thing > still be written into your own code? > In other words, if several calls to the function foo() is made, will > there be several processes each running handle_call spawned, or will > there be several queued calls to handle_call? > It seems that playing to Erlangs strengths in this situation makes the > most sense :) Would spawning a process to handle foo and returning > immediately might be the correct way to do this type of thing? (if > gen_server does not do it already). > > -]-[einrich > From valentin@REDACTED Thu Dec 19 19:12:23 2002 From: valentin@REDACTED (Valentin) Date: Thu, 19 Dec 2002 20:12:23 +0200 Subject: Was Mapping processes Now: ATOMS and atom_tab index References: <04D356A3B172D611981B0008C791C312404FB0@imp02mbx.t-mobile.co.uk> Message-ID: <001901c2a78a$2e848f40$84ed1ec4@moneymaker> I agree that PID can be used to uniquely identify processes, and that works very well if the application completely lives in ERLANG and/or one part lives in ERLANG (i.e. server) and another in some other environment (i.e. CNode). However, if one wants to use ERLANG as a middleware product (for example, to do the similar thing as VITRIA or TIBCO for a fraction of the cost), it has to figure out the best way to establish a short-lived connections between processes that live outside ERLANG (i.e. using ERLANG as a value-added broker -- implement common functions like authorization, usage recording, statistics, etc). As a common integration point, ERLANG really has to offer much more than any other platform I've seen so far. Valentin. ----- Original Message ----- From: "Chandrashekhar Mullaparthi" To: "'Valentin'" ; Sent: Thursday, December 19, 2002 3:50 AM Subject: RE: Was Mapping processes Now: ATOMS and atom_tab index > Using global will create problems if you have more than one erlang node in a > mesh, all doing pretty much the same thing. And every call to > global:register_name, global:re_register_name, global:unregister_name makes > a synchronous call to every node in the mesh. > > The PID of a process is unique within the node - I usually associate a name > to a process only when it is going to live a long time or when it should be > seen across a network of nodes. Why do you need this for such short-lived > processes? As Luke said in the previous thread, the PID can be used as or as > part of the request-id? > > The limitation is documented. See > http://www.erlang.org/doc/r9b/doc/efficiency_guide/advanced.html#7.2 > > Chandru > > -----Original Message----- > From: Valentin [mailto:valentin@REDACTED] > Sent: 18 December 2002 19:48 > To: erlang-questions@REDACTED > Subject: Fw: Was Mapping processes Now: ATOMS and atom_tab index > > > > We have discovered (the hard way) that number of atoms in ERTS is limited > to > 1024*1024, which limits the number of atoms to 1,048,576. The question was > posted recently asking how to increase this limit, but judging from the > lack > of response, I guess, there isn't one. We have found the code where this > table was allocated, but I do not think that the recompilation with changed > value will do any good, as it might have side effects. > > When the space in the atom_tab index is reached, erlang crashes with the > bang. And quite a sizable dump. > It might be a good idea to mention this limitation somewhere in the manual > (hopefully in ei_x_encode_atom(...) description as well). > > Eduardo, as well as Martin before him, had a good idea (that is, if you ask > me). It seems odd that one has to use ets, or similar mechanism to register > a short-lived processes, if such a mechanism already exist, but cannot be > used because it requires an atom, as an argument. > > On the other hand, I've noticed that global:register_name/2 supports string > as registration name argument as well. I wonder, would it be wise to use > this in a context that Eduardo was describing, by using > global:register_name/2 and global:whereis_name/1. > > What would be the catch (other than specific syntax that has to be used in > order to send a message?) Any performance penalty? > > Valentin. > > > > > ----- Original Message ----- > > From: "martin j logan" > > To: > > Cc: > > Sent: Wednesday, December 18, 2002 12:26 AM > > Subject: Re: Mapping processes > > > > > > > Eduardo, > > > When I first started using erlang I also had this idea. I went so > > > far as to implement it. I spent about an hour trying to figure out what > > > clever construct I had come up with in order to fool the garbage > > > collector so completely and cause such a nasty "memory leak". The thing > > > is that the first argument to register must be an atom so you must > > > convert reqID to an atom. I found out after a bit of research that atoms > > > are not garbage collected, they are stored in a table for the life of > > > the system. So in the interest of helping a fellow erlanger avoid such > > > folly as I engaged in let me say that you should not ever dynamically > > > create atoms in any situation that is not garaunteed to be finite. I > > > typically use an ets table, loop data/dict, or some such to store > > > mappings. This is coupled with some facility to remove the processes > > > when they die. In this manner you can nicely achieve the same > > > functionality. > > > > > > Cheers, > > > Martin > > > > > > On Tue, 2002-12-17 at 13:50, Vladimir Sekissov wrote: > > > > Good day, > > > > > > > > eduardo> What do you think about using register(reqId, PID) and > > > > eduardo> whereis(reqId) to > > > > eduardo> retrieve the PID so to send the response, in an async. way, > > > > eduardo> to the calling process. > > > > > > > > I think you could easily exceed the atoms table limit on long living > > > > system. Using simple dictionary of {callerPid, reqId} and trapping > > > > exit messages from callers to delete records from dictionary would be > > > > better solution. May be like this or as gen_server: > > > > > > > > create_dict() -> > > > > spawn_link(fun dict_srv/0). > > > > > > > > remove_dict(DPid) -> > > > > DPid ! {self(), stop}, > > > > receive > > > > {DPid, stopped} -> > > > > ok > > > > end. > > > > > > > > dict_add(DPid, Pid, Reg) -> > > > > DPid ! {self(), add, {Pid, Reg}}. > > > > > > > > dict_get(DPid, Reg) -> > > > > DPid ! {self(), get, Reg}, > > > > receive > > > > {DPid, {value, {Pid, _}}} -> > > > > Pid; > > > > {DPid, false} -> > > > > undefined > > > > end. > > > > > > > > dict_srv() -> > > > > process_flag(trap_exit, true), > > > > dict_loop([]). > > > > > > > > dict_loop(Dict) -> > > > > receive > > > > {_From, add, V={Pid, Reg}} -> > > > > link(Pid), > > > > dict_loop([V|Dict]); > > > > {From, get, Reg} -> > > > > From ! {self(), lists:keysearch(Reg, 2, Dict)}, > > > > dict_loop(Dict); > > > > {'EXIT', Pid, Reson} -> > > > > case lists:keymember(Pid, 1, Dict) of > > > > true -> > > > > dict_loop(lists:keydelete(Pid, 1, Dict)); > > > > false -> > > > > exit(Reson) > > > > end; > > > > {From, stop} -> > > > > From ! {self(), stopped}, > > > > ok > > > > end. > > > > > > > > Best Regards, > > > > Vladimir Sekissov > > > > > > > > eduardo> > > > > eduardo> I'm thinking how to map processes with request Id so to > manage > > > > eduardo> callbacks when using ports. > > > > eduardo> What do you think about using register(reqId, PID) and > > whereis(reqId) to > > > > eduardo> retrieve the PID so to send the response, in an async. way, > to > > the calling process. > > > > eduardo> > > > > eduardo> > > > > eduardo> > > > > eduardo> Thanks, > > > > eduardo> Eduardo Figoli > > > > eduardo> INSwitch Solutions > > > > eduardo> > > > > eduardo> > > > > eduardo> > > > > eduardo> > > > > > > > > > > > > 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 Thu Dec 19 20:40:29 2002 From: luke@REDACTED (Luke Gorrie) Date: 19 Dec 2002 20:40:29 +0100 Subject: Was Mapping processes Now: ATOMS and atom_tab index In-Reply-To: <001901c2a78a$2e848f40$84ed1ec4@moneymaker> References: <04D356A3B172D611981B0008C791C312404FB0@imp02mbx.t-mobile.co.uk> <001901c2a78a$2e848f40$84ed1ec4@moneymaker> Message-ID: "Valentin" writes: > I agree that PID can be used to uniquely identify processes, and that works > very well if the application completely lives in ERLANG and/or one part > lives in ERLANG (i.e. server) and another in some other environment (i.e. > CNode). But what makes it break down in the other environments? Note that you can turn a PID into a binary and back again: 1> Bin = term_to_binary(self()). <<131,103,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0,27,0,0,0,0,0>> 2> binary_to_term(Bin). <0.27.0> You can also turn it into a string and back again: 3> httpd_util:encode_base64(binary_to_list(term_to_binary(self()))). "g2dkAA1ub25vZGVAbm9ob3N0AAAAGwAAAAAA" 4> binary_to_term(list_to_binary(httpd_util:decode_base64("g2dkAA1ub25vZGVAbm9ob3N0AAAAGwAAAAAA"))). <0.27.0> Keep in mind that this is forgeable - but so is a string naming a registered process. -Luke From hfventer@REDACTED Fri Dec 20 08:23:08 2002 From: hfventer@REDACTED (hfventer) Date: Fri, 20 Dec 2002 09:23:08 +0200 Subject: Gen_server and multiple processes In-Reply-To: <1040321203.5644.629.camel@berimbau> Message-ID: <000001c2a7f8$b9fae1f0$0100a8c0@home1> Thanks for all the advice so far The system we have at the moment looks like this: We have several connections (TCP, but from different subsystem so they don't all speak the same protocol) The message is sent to the appropriate translator to translate if from its native format to our internal representation of the data. This representation is then sent off to be processed. Once processing is finished a response is returned on the same communication medium that it came in on. With the curent gen_server implelentation (that works fine btw) there is a huge bottleneck, because the next message does not even start processing before the previous one hasn't completely finished its round trip. Obviously this limmits the thoroughput. Our gen_server is essentially stateless. It recieves a message to do something with and sends a response. If I understand most of the advice correctly a better way of doing things would be something like the following: Once a message is received it spawns a separate message_hanlder thread. This thread sends the message to the appropriate translator. The translator spawns a worker thread to do the actual translation and immediately sends back a no_reply. Once the translation is done, the correct response is sent back to the original worker thread. This should free up the connection server to handle as many connections as the node has memory for and allow the translator to do its job as fast as it has processors to do it with. Would the list of spawned processes (workers or message_handlers) constitute the state of the gen_server now, or would that stil be supperfluous? (maybe for orderly shutdown purposes the list needs to be kept? Would this be generaly good design or is there an easier way?) This design patters is something that repeats several times in our system. Is it possible to easily create our own behavior to make life easier for some of the newer programmers on the project? Thanks to every one for your sage advice. Heinrich From francesco@REDACTED Fri Dec 20 09:04:48 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 20 Dec 2002 08:04:48 +0000 Subject: Gen_server and multiple processes References: <000001c2a7f8$b9fae1f0$0100a8c0@home1> Message-ID: <3E02CF20.7050206@erlang-consulting.com> Comments below, but from what I understand, you should spawn one process for each incoming message. You then use this process to translate, process, and send the reply back to the client. From what I understand, you have implemented your translator as a process. Can you strip out the code and just have a module that can be called? Translating is not a truly concurrent activity, as you might have many messages from the same source to translate at the same time. Handling the message is a concurrent activity, however. hfventer wrote: > >Our gen_server is essentially stateless. It recieves a message to do >something with and sends a response. > This will allow you to spawn a process for every incoming message. >Once a message is received it spawns a separate message_hanlder thread. > Yes. You have a message server that receives all messages and spawns a new server (Let us call it a message handler) every time one is received. This server sends back a noreply to the caller, and passes the From variable from the handle_call(Msg, From, State) callback. The caller will be suspended waiting for a result. >This thread sends the message to the appropriate translator. The >translator spawns a worker thread to do the actual translation and >immediately sends back a no_reply. > No. Implement your translator as a function which is called by the message handler. There is no need for extra message passing or processes. If the translator has a state or data, use a public ets table. > Once the translation is done, the >correct response is sent back to the original worker thread. > Yes, using gen_server:reply(From, Msg), the From coming from your original request. This is also done from your message handler. >Would the list of spawned processes (workers or message_handlers) >constitute the state of the gen_server now, or would that still be >supperfluous? (maybe for orderly shutdown purposes the list needs to be >kept? Would this be generaly good design or is there an easier way?) > It would be superfluous, as the supervisor would handle the shutting down. If you have a system restart, I would assume that all the TCP connections would go down, so there is no need in saving them. Take a look at the slide show from my presentation at EUC, looking at the before and after slides of the architecture. THe jabber server had the same bottleneck as you describe, as every socket pair was one process, but the rest wasn't. You can see it at http://www.erlang-consulting.com/euc2001/. Best of luck, Francesco -- http://www.erlang-consulting.com From hfventer@REDACTED Fri Dec 20 09:43:13 2002 From: hfventer@REDACTED (hfventer) Date: Fri, 20 Dec 2002 10:43:13 +0200 Subject: Gen_server and multiple processes In-Reply-To: <3E02CF20.7050206@erlang-consulting.com> Message-ID: <000001c2a803$ef189890$0100a8c0@home1> >>Once a message is received it spawns a separate message_hanlder thread. >Yes. You have a message server that receives all messages and spawns a >new server (Let us call it a message handler) Just to check, you mean to actually spawn a new OTP gen_server? Is this not slow since it has quite a bit of overhead. The idea we had was to have one gen_server that spawns its own worker threads in the handle_call. >No. Implement your translator as a function which is called by the >message handler. There is no need for extra message passing or >processes. The idea we had was that by putting the translators (there is more than one flavor of translator) into OTP servers we would more easily be able to distribute them over the number of processors we have. Possably doing some load balancing on the way. This seemed to be the easiest way to get that going quickly. (thinks about this for a bit) This same thing could be achieved by spawing the message handler on the different nodes in the first place? -Heinrich From francesco@REDACTED Fri Dec 20 10:04:40 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 20 Dec 2002 09:04:40 +0000 Subject: Gen_server and multiple processes References: <000001c2a803$ef189890$0100a8c0@home1> Message-ID: <3E02DD28.8070203@erlang-consulting.com> >>Yes. You have a message server that receives all messages and spawns a >>new server (Let us call it a message handler) >> >Just to check, you mean to actually spawn a new OTP gen_server? Is this >not slow since it has quite a bit of overhead. >The idea we had was to have one gen_server that spawns its own worker >threads in the handle_call. > I would first try with a dynamic child in a gen_server. Yes, you do have overheads, but at the same time, you have supervision, control, and uniformity. I think the overhead should be neglectable. If it is still slow, then go ahead and start using special processes. They are however rare, and the extra performance has to my knowledge only been needed in very few cases. >>No. Implement your translator as a function which is called by the >>message handler. There is no need for extra message passing or >>processes. >> >The idea we had was that by putting the translators (there is more than >one flavor of translator) into OTP servers we would more easily be able >to distribute them over the number of processors we have. >doing some load balancing on the way. This seemed to be the easiest way >to get that going quickly. > Have a different module for every different translator, and use pattern matching to pick the right one. Then, the only thing you have to distribute among the processors is the message handler. That is easily achieved with a round robin scheduler. Francesco -- http://www.erlang-consulting.com From mickael.remond@REDACTED Fri Dec 20 10:13:27 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 20 Dec 2002 10:13:27 +0100 Subject: Gen_server and multiple processes In-Reply-To: <000001c2a73e$45c785f0$0100a8c0@home1>; from hfventer@mweb.co.za on Thu, Dec 19, 2002 at 11:08:59AM +0200 References: <000001c2a73e$45c785f0$0100a8c0@home1> Message-ID: <20021220100509.A14346@TH01.TGV.NET> * hfventer [2002-12-19 11:08:59 +0200]: > Hello all > > I would like to know if the gen_server behavior creates a separate > process for each message that is sent to it, or must this kind of thing > still be written into your own code? [...] > It seems that playing to Erlangs strengths in this situation makes the > most sense :) Would spawning a process to handle foo and returning > immediately might be the correct way to do this type of thing? (if > gen_server does not do it already). One thing to remember is that gen_server has a state. One of the goal of the gen_server is to protect/serialize access to this state. So you are always sure that you will not have concurrency problem on the state on a gen_server. I have remarked that people that discover gen_server tend to overuse it. One of the question to ask is: Do we need a gen_server in our case. Sometimes a simple spawn can do the trick and the gen_server is not really needed. You should think twice about using a gen_server especially when your gen_server uses an empty state. I hope this helps. -- Micka?l R?mond From Sean.Hinde@REDACTED Fri Dec 20 10:31:13 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 20 Dec 2002 09:31:13 -0000 Subject: Gen_server and multiple processes Message-ID: <04D356A3B172D611981B0008C791C3126BF683@imp02mbx.t-mobile.co.uk> > >>Yes. You have a message server that receives all messages > and spawns a > >>new server (Let us call it a message handler) > >> > >Just to check, you mean to actually spawn a new OTP > gen_server? Is this > >not slow since it has quite a bit of overhead. > >The idea we had was to have one gen_server that spawns its own worker > >threads in the handle_call. > > > I would first try with a dynamic child in a gen_server. Yes, > you do have > overheads, but at the same time, you have supervision, control, and > uniformity. > Or if you really don't think you need a full blown gen_server in each case, you could create your short lived processes using proc_lib:spawn_link(). This provides nice crash reports if the worker crashes but is otherwise a bit less overhead than using dynamic children/gen_servers. For example our usual tcp server pattern has a new gen_server created for each new socket conection but each new call creates a proc_lib:spawn_link(). I tend to keep an ets table holding the worker pids as the gen_server state, and like to hold at least the transactionid/header information from the incoming packet with the Pid so that if the worker crashes I can retrieve this and return an appropriate error response to the client. 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 svg@REDACTED Fri Dec 20 12:17:24 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 20 Dec 2002 16:17:24 +0500 (YEKT) Subject: Gen_server and multiple processes In-Reply-To: <000001c2a7f8$b9fae1f0$0100a8c0@home1> References: <1040321203.5644.629.camel@berimbau> <000001c2a7f8$b9fae1f0$0100a8c0@home1> Message-ID: <20021220.161724.48530885.svg@surnet.ru> Good day, It seems I have what you need. It is the module `connection_pool' I wrote some time ago. It consists from pool supervisor(ordinary supervisor), pool manager and pool of servers. Client can request server for operation and return server to pool after (explicitly or implicitly on client exit). Varying supervisor and manager parameters you can achieve the management policy you want. Some features: - prestarting minimal number of servers; - pool size limit; - shared servers - all clients are spreaded between servers; - exclusive servers - one client per server, servers are selected in round-robin manner. Let me know and I'll send you code if you want. Best Regards, Vladimir Sekissov hfventer> Thanks for all the advice so far hfventer> hfventer> The system we have at the moment looks like this: hfventer> We have several connections (TCP, but from different subsystem so they hfventer> don't all speak the same protocol) The message is sent to the hfventer> appropriate translator to translate if from its native format to our hfventer> internal representation of the data. This representation is then sent hfventer> off to be processed. Once processing is finished a response is returned hfventer> on the same communication medium that it came in on. hfventer> With the curent gen_server implelentation (that works fine btw) there is hfventer> a huge bottleneck, because the next message does not even start hfventer> processing before the previous one hasn't completely finished its round hfventer> trip. Obviously this limmits the thoroughput. hfventer> hfventer> Our gen_server is essentially stateless. It recieves a message to do hfventer> something with and sends a response. If I understand most of the advice hfventer> correctly a better way of doing things would be something like the hfventer> following: hfventer> Once a message is received it spawns a separate message_hanlder thread. hfventer> This thread sends the message to the appropriate translator. The hfventer> translator spawns a worker thread to do the actual translation and hfventer> immediately sends back a no_reply. Once the translation is done, the hfventer> correct response is sent back to the original worker thread. This hfventer> should free up the connection server to handle as many connections as hfventer> the node has memory for and allow the translator to do its job as fast hfventer> as it has processors to do it with. hfventer> Would the list of spawned processes (workers or message_handlers) hfventer> constitute the state of the gen_server now, or would that stil be hfventer> supperfluous? (maybe for orderly shutdown purposes the list needs to be hfventer> kept? Would this be generaly good design or is there an easier way?) hfventer> hfventer> This design patters is something that repeats several times in our hfventer> system. Is it possible to easily create our own behavior to make life hfventer> easier for some of the newer programmers on the project? hfventer> hfventer> Thanks to every one for your sage advice. hfventer> hfventer> Heinrich From ingela@REDACTED Fri Dec 20 12:41:39 2002 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 20 Dec 2002 12:41:39 +0100 (MET) Subject: Erlang mode in Emacs In-Reply-To: Message-ID: On 18 Dec 2002, Luke Gorrie wrote: > Just remembered a couple of font-lock bugs, and it looks like there > have been fixes already. Grep'ing for "bad emacs" in our source tree > gave 12 hits, and they all seem to be solved, which is really great. > > Looks like the fixes were that $" and $' are not seen as starting > strings anymore, probably because $ and ^ were changed to "character > quote" syntax class? I think this also solves a problem of matching ( > with $). Well that has been fixed, but that was fixed before I took responsibility for the emacs mode so this correction ought to be part of an official release. It should be part of R8B according to or internal information. It was a open source contribution. But until now there has been a lack of somebody that has felt responsible for the erlang mode for some while, so maybe this was not communicated. /Ingela Ericsson AB - OTP Team From erlang@REDACTED Sat Dec 21 09:48:56 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 21 Dec 2002 09:48:56 +0100 Subject: Binary to ASCII Message-ID: <001401c2a8cd$ccf1b5b0$1e00a8c0@design> I'd like to convert a set of bytes to ASCII characters (string). Please, could someone tell me how to do this in Erlang ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chandrashekhar.Mullaparthi@REDACTED Fri Dec 20 14:05:24 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 20 Dec 2002 13:05:24 -0000 Subject: Binary to ASCII Message-ID: <04D356A3B172D611981B0008C791C312404FC8@imp02mbx.t-mobile.co.uk> 12> List = "abcd". "abcd" 13> 13> 13> 13> Bin = list_to_binary(List). <<97,98,99,100>> 14> 14> binary_to_list(Bin). "abcd" 15> -----Original Message----- From: Inswitch Solutions - Erlang Evaluation [mailto:erlang@REDACTED] Sent: 21 December 2002 08:49 To: erlang-questions@REDACTED Subject: Binary to ASCII I'd like to convert a set of bytes to ASCII characters (string). Please, could someone tell me how to do this in Erlang ? Thanks, Eduardo Figoli INSwitch Solutions 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 Louis.van.der.Stam@REDACTED Fri Dec 20 14:12:42 2002 From: Louis.van.der.Stam@REDACTED (Louis van der Stam) Date: Fri, 20 Dec 2002 14:12:42 +0100 Subject: Having nodes talk to each other. Message-ID: <2F12028DC08DD611A9BB00306E360ADD1BEBE7@nl-nie-mail04.att.cmg.nl> Hello, I have seen messages here concerning the problem I'm having, from the responses I have read, I conclude my problem is different or is it ..... I'm having difficulty getting two Erlang nodes on the same machine communicate with each other. net_adm:ping('n1@REDACTED'). fails from n2 and vise versa. I'm starting the two erlang nodes with '> erl -sname n1' and '> erl -sname n2' respectively. Before starting I had edited the .erlang.cookie file in my HOME directory to contain mycookie without quotes. In my experience this in enough to get two nodes communicating. The installation where this fails is a Tru64 running R9 (it compiled without problems). Both nodes create a listen port in the TCP stack, but I never see a connection being established. Am I overlooking some simple configuration item or ....? Is there a switch, ... that instructs erl to write some debuging/traceing information concerning connections and/or connection attempts and failure causes? Regards, Louis van der Stam From erlang@REDACTED Sat Dec 21 10:11:35 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 21 Dec 2002 10:11:35 +0100 Subject: Concurrency in Functions and Messages Message-ID: <001d01c2a8d0$f6fdd750$1e00a8c0@design> When a process is in receive state (receive -> ....), I understand that concurrency is managed by a queue in Erlang when other processes send messages to it. I don't know how Erlang manages functions calls concurrency when more than one process is calling the same function. For example io:format(.....) called by two processes at the same time. Does anyone know something about this ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chandrashekhar.Mullaparthi@REDACTED Fri Dec 20 14:20:54 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 20 Dec 2002 13:20:54 -0000 Subject: Concurrency in Functions and Messages Message-ID: <04D356A3B172D611981B0008C791C312404FC9@imp02mbx.t-mobile.co.uk> Eduardo, the called function is run in the context of the calling process. A module is just a container for some code and it exports some functions. If you are familiar with C, calling io:format is the same as calling printf. cheers Chandru -----Original Message----- From: Inswitch Solutions - Erlang Evaluation [mailto:erlang@REDACTED] Sent: 21 December 2002 09:12 To: erlang-questions@REDACTED Subject: Concurrency in Functions and Messages When a process is in receive state (receive -> ....), I understand that concurrency is managed by a queue in Erlang when other processes send messages to it. I don't know how Erlang manages functions calls concurrency when more than one process is calling the same function. For example io:format(.....) called by two processes at the same time. Does anyone know something about this ? Thanks, Eduardo Figoli INSwitch Solutions 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 Fri Dec 20 14:29:21 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 20 Dec 2002 13:29:21 -0000 Subject: Having nodes talk to each other. Message-ID: <04D356A3B172D611981B0008C791C312404FCA@imp02mbx.t-mobile.co.uk> Check the cookie the nodes are actually using to be really sure. (abcd@REDACTED)2> erlang:get_cookie(). 'KJRLCCCBTWIDUUUIHMWT' (abcd@REDACTED)3> Make sure they are both the same. You can run epmd in debug mode. Shutdown your erlang nodes, kill epmd, and start it up again using epmd -debug Then start your erlang shells and see what is happening. cheers Chandru -----Original Message----- From: Louis van der Stam [mailto:Louis.van.der.Stam@REDACTED] Sent: 20 December 2002 13:13 To: erlang-questions@REDACTED Subject: Having nodes talk to each other. Hello, I have seen messages here concerning the problem I'm having, from the responses I have read, I conclude my problem is different or is it ..... I'm having difficulty getting two Erlang nodes on the same machine communicate with each other. net_adm:ping('n1@REDACTED'). fails from n2 and vise versa. I'm starting the two erlang nodes with '> erl -sname n1' and '> erl -sname n2' respectively. Before starting I had edited the .erlang.cookie file in my HOME directory to contain mycookie without quotes. In my experience this in enough to get two nodes communicating. The installation where this fails is a Tru64 running R9 (it compiled without problems). Both nodes create a listen port in the TCP stack, but I never see a connection being established. Am I overlooking some simple configuration item or ....? Is there a switch, ... that instructs erl to write some debuging/traceing information concerning connections and/or connection attempts and failure causes? Regards, Louis van der Stam NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From mickael.remond@REDACTED Fri Dec 20 14:49:23 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 20 Dec 2002 14:49:23 +0100 Subject: Having nodes talk to each other. In-Reply-To: <2F12028DC08DD611A9BB00306E360ADD1BEBE7@nl-nie-mail04.att.cmg.nl>; from Louis.van.der.Stam@cmg.com on Fri, Dec 20, 2002 at 02:12:42PM +0100 References: <2F12028DC08DD611A9BB00306E360ADD1BEBE7@nl-nie-mail04.att.cmg.nl> Message-ID: <20021220144923.A19091@TH01.TGV.NET> * Louis van der Stam [2002-12-20 14:12:42 +0100]: > Hello, > > I have seen messages here concerning the problem I'm having, from the > responses I have read, I conclude my problem is different or is it ..... > > I'm having difficulty getting two Erlang nodes on the same machine > communicate with each other. net_adm:ping('n1@REDACTED'). fails from n2 and vise > versa. I'm starting the two erlang nodes with '> erl -sname n1' and '> erl > -sname n2' respectively. Before starting I had edited the .erlang.cookie > file in my HOME directory to contain mycookie without quotes. In my > experience this in enough to get two nodes communicating. I sometimes add problem, especially when my machine had no network connection (dns related problem). You could try to launch the options: erl -name n1@REDACTED and then use this explicit node reference to try to access it. > Is there a switch, ... that instructs erl to write some debuging/traceing > information concerning connections and/or connection attempts and failure > causes? You can kill the epmd deamon and restart it explicitly in debug mode. /usr/local/lib/erlang/bin/epmd -debug The you will see a trace of what is happening from the network deamon point of view. -- Micka?l R?mond From Louis.van.der.Stam@REDACTED Fri Dec 20 15:10:26 2002 From: Louis.van.der.Stam@REDACTED (Louis van der Stam) Date: Fri, 20 Dec 2002 15:10:26 +0100 Subject: Having nodes talk to each other. Message-ID: <2F12028DC08DD611A9BB00306E360ADD1BEBE9@nl-nie-mail04.att.cmg.nl> Hello Chandrashekhar, I ran epmd -debug and on the Tru64 I do not see the "got PORT2_REQ" when I execute the net_adm:ping('n2@REDACTED'). from the n1 shell. Any further ideas? Thanx so far, Louis -----Original Message----- From: Chandrashekhar Mullaparthi [mailto:Chandrashekhar.Mullaparthi@REDACTED] Sent: 20 December 2002 14:29 To: 'Louis van der Stam'; erlang-questions@REDACTED Subject: RE: Having nodes talk to each other. Check the cookie the nodes are actually using to be really sure. (abcd@REDACTED)2> erlang:get_cookie(). 'KJRLCCCBTWIDUUUIHMWT' (abcd@REDACTED)3> Make sure they are both the same. You can run epmd in debug mode. Shutdown your erlang nodes, kill epmd, and start it up again using epmd -debug Then start your erlang shells and see what is happening. cheers Chandru -----Original Message----- From: Louis van der Stam [mailto:Louis.van.der.Stam@REDACTED] Sent: 20 December 2002 13:13 To: erlang-questions@REDACTED Subject: Having nodes talk to each other. Hello, I have seen messages here concerning the problem I'm having, from the responses I have read, I conclude my problem is different or is it ..... I'm having difficulty getting two Erlang nodes on the same machine communicate with each other. net_adm:ping('n1@REDACTED'). fails from n2 and vise versa. I'm starting the two erlang nodes with '> erl -sname n1' and '> erl -sname n2' respectively. Before starting I had edited the .erlang.cookie file in my HOME directory to contain mycookie without quotes. In my experience this in enough to get two nodes communicating. The installation where this fails is a Tru64 running R9 (it compiled without problems). Both nodes create a listen port in the TCP stack, but I never see a connection being established. Am I overlooking some simple configuration item or ....? Is there a switch, ... that instructs erl to write some debuging/traceing information concerning connections and/or connection attempts and failure causes? Regards, Louis van der Stam 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 Dec 20 17:17:31 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 20 Dec 2002 17:17:31 +0100 (MET) Subject: Gen_server and multiple processes In-Reply-To: <000001c2a803$ef189890$0100a8c0@home1> Message-ID: On Fri, 20 Dec 2002, hfventer wrote: >Just to check, you mean to actually spawn a new OTP >gen_server? Is this not slow since it has quite a bit of >overhead. The idea we had was to have one gen_server that >spawns its own worker threads in the handle_call. I have submitted a contribution to erlang.org called mdisp. (when it actually appears depends a bit on how the contributions moderator works through the Holidays.) It's based on a concept from the AXD301. The idea is that you have a permanent process that creates request threads. The threads themselves are not gen_servers, but one could easily make a gen_server-compatible "mdisp behaviour", such that the thread can be programmed like a gen_server. Just to show what the programming model would look like, I've added an example behaviour. The callback module implementing the behaviour needs to implement three functions: init(Key, State), awake(Key, State), terminate(Reason,Key,State). Typically, a "port process" will receive messages from the outside, do some partial decode, and then call mdisp:new(MDisp, MDispBehaviour, Key, State) Subsequent messages can be send to the new instance using mdisp:send(MDisp, Key, Msg). The threads can stay up until they're done, or go to sleep during periods of inactivity (the sleep() function is highly optimized and "thread safe"). I can submit the whole package (5K) if someone is really eager to try it out. -module(mdisp_cb). -behaviour(mdisp). -export([init/2, awake/2, terminate/3]). %% internal exports -export([f1/2, f2/2]). -define(write(Fmt, Args), ok=io:format(Fmt, Args)). init(Key, State = {Fun, S}) -> ?write("init(~p, ~p)~n", [Key, State]), ?MODULE:Fun(Key, S). awake(Key, State = {Fun, S}) -> ?write("awake(~p, ~p)~n", [Key, State]), ?MODULE:Fun(Key, S). terminate(Reason, Key, State) -> exit({Reason, {Key, State}}). f1(Key, S) -> ?write("f1(~p)~n", [S]), receive Msg -> ?write("f1 ==> ~p~n", [Msg]), f2(Key, S+1) after 5000 -> ?write("f1 going to sleep (~p)~n", [S]), mdisp:sleep(mdisp, Key, {f1, S}) end. f2(Key, S) -> ?write("f2(~p)~n", [S]), receive this -> ?write("f2 ==> ~p~n", [this]), f1(Key, S+1) after 5000 -> ?write("f2 going to sleep (~p)~n", [S]), mdisp:sleep(mdisp, Key, {f2, S}) end. -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From joe@REDACTED Fri Dec 20 20:16:59 2002 From: joe@REDACTED (Joe Armstrong) Date: Fri, 20 Dec 2002 20:16:59 +0100 (CET) Subject: Concurrency in Functions and Messages In-Reply-To: <001d01c2a8d0$f6fdd750$1e00a8c0@design> Message-ID: On Sat, 21 Dec 2002, Inswitch Solutions - Erlang Evaluation wrote: > > When a process is in receive state (receive -> ....), I understand that concurrency is managed by a queue in Erlang when other processes send messages to it. > > I don't know how Erlang manages functions calls concurrency when > more than one process is calling the same function. > For example io:format(.....) called by two processes at the same time. > > Does anyone know something about this ? Yes - each process is *entirely independent* so you can think of this as if each process calls it's own copy of io:format (only it's not a copy since they share code) - each process has it's own stack and heap, and things never get mixed up. Per (Brand) pointed out to me that there was an unfortunately terminology problem here. Most people think that processes are big and heavy things, whereas threads are lightweight things. In Erlang our processes (i.e. Erlang processes) are *incredibly* light weight i.e. much smaller and cheaper to create than threads - and just like OS processes they are independent. Unlike threads you do not have to worry about two two "threads of control" bumping into each other by calling the same function at the same time - so there are no "synchronized methods" or locks of mutexes or critical regions or all these other silly things that make concurrent programming difficult :-) All synchronization and transfer of data between processes is done by explicate message passing which makes life much easier. /Joe From erlang@REDACTED Sat Dec 21 17:17:54 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 21 Dec 2002 17:17:54 +0100 Subject: Displaying messages in a remote node IO Message-ID: <010601c2a90c$883c9a90$1e00a8c0@design> Thank you for all your responses. I have started the code below in Node 1. I'd like to send a message from Node 2 to Node 1 and display it in Node 1 I don't figure out what should I modify in this code to do this. %%%%%%%%%%%%%%%% -module(logger). -export([start/0, stop/0]). start() -> spawn(fun() -> init() end). stop() -> logger ! {stop, self()}. init() -> register(logger, self()), process_flag(trap_exit, true), loop(). loop() -> receive {call, Caller, Msg} -> {self(), sender, Msg}, io:format('Logger closed ~w ~n', Msg) loop(); {stop, Caller} -> io:format('Logger closed ~n'), exit(normal) end. %%%%%%%%%%%% Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Fri Dec 20 22:22:17 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Sat, 21 Dec 2002 02:22:17 +0500 (YEKT) Subject: Displaying messages in a remote node IO In-Reply-To: <010601c2a90c$883c9a90$1e00a8c0@design> References: <010601c2a90c$883c9a90$1e00a8c0@design> Message-ID: <20021221.022217.08323272.svg@surnet.ru> Good day, As in Unix all IO is sent to group leader process. There is a trick I've got from: http://www.erlang.org/ml-archive/erlang-questions/200205/msg00004.html If we on Node2: RP = rpc:call(Node1,erlang,list_to_pid,["<0.0.0>"]), erlang:group_leader(RP,self()), io:format("Hello World !\n"). and all output from your process will be redirected to Node1. Best Regards, Vladimir Sekissov erlang> erlang> Thank you for all your responses. erlang> erlang> I have started the code below in Node 1. erlang> I'd like to send a message from Node 2 to Node 1 and display it in Node 1 erlang> I don't figure out what should I modify in this code to do this. erlang> erlang> %%%%%%%%%%%%%%%% erlang> erlang> -module(logger). erlang> -export([start/0, stop/0]). erlang> erlang> erlang> start() -> erlang> spawn(fun() -> init() end). erlang> erlang> stop() -> erlang> logger ! {stop, self()}. erlang> erlang> init() -> erlang> register(logger, self()), erlang> process_flag(trap_exit, true), erlang> loop(). erlang> erlang> loop() -> erlang> receive erlang> {call, Caller, Msg} -> erlang> {self(), sender, Msg}, erlang> io:format('Logger closed ~w ~n', Msg) erlang> loop(); erlang> {stop, Caller} -> erlang> io:format('Logger closed ~n'), erlang> exit(normal) erlang> end. erlang> erlang> %%%%%%%%%%%% erlang> erlang> Thanks, erlang> Eduardo Figoli erlang> INSwitch Solutions erlang> erlang> erlang> erlang> From eduardo@REDACTED Sat Dec 21 14:45:34 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Sat, 21 Dec 2002 14:45:34 +0100 Subject: Displaying messages in a remote node IO Message-ID: <00ee01c2a8f7$3d1b1a10$1e00a8c0@design> I have started the code below in Node 1. I'd like to send a message from Node 2 to Node 1 and display it in Node 1 I don't figure it out what should I modify in this code to do this. %%%%%%%%%%%%%%%% -module(logger). -export([start/0, stop/0]). start() -> spawn(fun() -> init() end). stop() -> logger ! {stop, self()}. init() -> register(logger, self()), process_flag(trap_exit, true), loop(). loop() -> receive {call, Caller, Msg} -> {self(), sender, Msg}, io:format('Logger closed ~w ~n', Msg) loop(); {stop, Caller} -> io:format('Logger closed ~n'), exit(normal) end. %%%%%%%%%%%% Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Sat Dec 21 09:20:37 2002 From: per@REDACTED (Per Bergqvist) Date: Sat, 21 Dec 2002 09:20:37 +0100 Subject: Displaying messages in a remote node IO In-Reply-To: <20021221.022217.08323272.svg@surnet.ru> Message-ID: <200212210820.gBL8KcP15246@hunden.levonline.com> You may also use io:format/3 to selectively output to different destinations. RP = rpc:call(Node1,erlang,list_to_pid,["<0.0.0>"]), io:format(RP,"Hello World !\n",[]). A side note on use of io:format for remote logging: Using io:format directly for logging is not an ideal solution. io:format may cause the calling process to hang if the output file handling process disappears. It is better to have your own protocol for distributing log events to a logger server on the remote node that does the actual io. /Per > Good day, > > As in Unix all IO is sent to group leader process. > > There is a trick I've got from: > > http://www.erlang.org/ml-archive/erlang-questions/200205/msg00004.html > > If we on Node2: > > RP = rpc:call(Node1,erlang,list_to_pid,["<0.0.0>"]), > erlang:group_leader(RP,self()), > io:format("Hello World !\n"). > > and all output from your process will be redirected to Node1. > > Best Regards, > Vladimir Sekissov > > erlang> > erlang> Thank you for all your responses. > erlang> > erlang> I have started the code below in Node 1. > erlang> I'd like to send a message from Node 2 to Node 1 and display it in Node 1 > erlang> I don't figure out what should I modify in this code to do this. > erlang> > erlang> %%%%%%%%%%%%%%%% > erlang> > erlang> -module(logger). > erlang> -export([start/0, stop/0]). > erlang> > erlang> > erlang> start() -> > erlang> spawn(fun() -> init() end). > erlang> > erlang> stop() -> > erlang> logger ! {stop, self()}. > erlang> > erlang> init() -> > erlang> register(logger, self()), > erlang> process_flag(trap_exit, true), > erlang> loop(). > erlang> > erlang> loop() -> > erlang> receive > erlang> {call, Caller, Msg} -> > erlang> {self(), sender, Msg}, > erlang> io:format('Logger closed ~w ~n', Msg) > erlang> loop(); > erlang> {stop, Caller} -> > erlang> io:format('Logger closed ~n'), > erlang> exit(normal) > erlang> end. > erlang> > erlang> %%%%%%%%%%%% > erlang> > erlang> Thanks, > erlang> Eduardo Figoli > erlang> INSwitch Solutions > erlang> > erlang> > erlang> > erlang> > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From Sean.Hinde@REDACTED Sun Dec 22 01:04:59 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Sun, 22 Dec 2002 00:04:59 -0000 Subject: Displaying messages in a remote node IO Message-ID: <04D356A3B172D611981B0008C791C3126BF692@imp02mbx.t-mobile.co.uk> > It is better to have your own protocol for distributing log events to > a logger server on the remote node that does the actual io. Indeed. Or if you don't need to store the messages remotely just use the functions in the error_logger module. I suggest you reserve io:format for debugging - apart from anything else it can be quite distracting typing commands into the shell of a live system with errors flying through at a rate of knots! More generally I suspect you will find that time spent digging through and really digesting the documentation for SASL and the Design Principles will be invaluable when you come to structure and build your real system. I did this at the beginning, and whilst it is initially daunting you should find that there really is an incredibly powerful structure hiding away in there which will pretty much give you your whole system framework for free. 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 sureshsaragadam@REDACTED Tue Dec 24 06:55:05 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 24 Dec 2002 05:55:05 +0000 (GMT) Subject: No subject Message-ID: <20021224055505.78581.qmail@web8205.mail.in.yahoo.com> Hi Ulf Wiger, After Going Through ur work "OTP Release Handling Tutorial" i tried to work on packaging of my application, while making script it is giving the error for very first erlang term in the .app file, what may be the problem . Eshell V5.0.1.1 (abort with ^G) 1> Dir = "/home/suresh/InRoam-1.0/RoamApp". "/home/suresh/InRoam-1.0/RoamApp" 2> Path = [Dir ++ "/lib/*/ebin"]. ["/home/suresh/InRoam-1.0/RoamApp/lib/*/ebin"] 3> Var = {"RoamApp", Dir}. {"RoamApp","/home/suresh/InRoam-1.0/RoamApp"} 4> systools:make_script("start_roamapp",[{path,Path},{variables,[Var]}]). roamapp: Parse error in file: "/home/suresh/InRoam-1.0/RoamApp/lib/roamapp-1.0.1/ebin/roamapp.app". Line: 1 Error: "bad term"; error 5> This is my app file ------------------- {application, roamapp, [{description, "Application for Call Processing of a Roamer"}, {vsn, "1.0.1"}, {modules, [ authentication.erl, inroam_trigger.erl, timefun.erl, importdata.erl, roamapp.erl]}, {registered,[ transceiver, keepaliveagent, keepalivemanager, supervise_process, Table_name, manager, agent, recTrigMsg, trap_msg]}, {applications, [kernel,stdlib]}, {mod, {roamapp,[]}}]}. Thanking u suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From hal@REDACTED Tue Dec 24 07:51:19 2002 From: hal@REDACTED (Hal Snyder) Date: Tue, 24 Dec 2002 00:51:19 -0600 Subject: fd leak in error_logger_file_h? Message-ID: <87y96fq594.fsf@ghidra.vail> Is it just us, or is there a leak in stdlib/error_logger_file_h.erl? The question arose when we noticed mysterious loss of space in /var on a system where we use the above module inside a log file rotation mechanism. There's a call to file:open in init/2, but for terminate/2, there's only terminate(_Reason, _State) -> []. shouldn't it be something like terminate(_Reason, State) -> case State of {Fd, File, Prev} -> close(Fd); _ -> true end, []. ? From sureshsaragadam@REDACTED Tue Dec 24 09:27:59 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 24 Dec 2002 08:27:59 +0000 (GMT) Subject: how to retrive registered processes of user application running on a node Message-ID: <20021224082759.23389.qmail@web8202.mail.in.yahoo.com> Hi, i hava an application , which has got many registered processes , is there any chance to know all the registered processes of my application running on a node there is no .app file for my application usually registered(). will return all the registered processes on a node where as i nedd is registered processes of my application Thanking u suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From martin@REDACTED Tue Dec 24 15:58:30 2002 From: martin@REDACTED (martin j logan) Date: 24 Dec 2002 08:58:30 -0600 Subject: how to retrive registered processes of user application running on a node In-Reply-To: <20021224082759.23389.qmail@web8202.mail.in.yahoo.com> References: <20021224082759.23389.qmail@web8202.mail.in.yahoo.com> Message-ID: <1040741911.6148.669.camel@berimbau> Suresh, There is the function regs() that can be run on the shell that will give you the info that you need. The actual function that regs() is calling can be traced through the stdlib module shell_default. There is the function erlang:registered() which will return a list of all registered names on a node. Typically basic utility functions of this nature can be found in the kernel module erlang. As an aside, you may want to look at the postings this past week on registering many processes. Make sure that it is the right fit for you. In my experience there is usually little need to do so. Cheers, Martin On Tue, 2002-12-24 at 02:27, Suresh S wrote: > Hi, > i hava an application , which has got many registered > processes , > is there any chance to know all the registered > processes of my application running on a node > > there is no .app file for my application > > usually registered(). > will return all the registered processes on a node > where as i nedd is registered processes of my > application > > Thanking u > > suresh s > > ________________________________________________________________________ > Missed your favourite TV serial last night? Try the new, Yahoo! TV. > visit http://in.tv.yahoo.com From vances@REDACTED Tue Dec 24 19:47:18 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 24 Dec 2002 13:47:18 -0500 Subject: how to retrive registered processes of user application running on a node In-Reply-To: <20021224082759.23389.qmail@web8202.mail.in.yahoo.com> References: <20021224082759.23389.qmail@web8202.mail.in.yahoo.com> Message-ID: <20021224184718.GC13040@frogman.motivity.ca> On Tue, Dec 24, 2002 at 08:27:59AM +0000, Suresh S wrote: } } is there any chance to know all the registered } processes of my application running on a node } } there is no .app file for my application Suresh, If you don't gave a .app file then you don't have an application. :) If you do then application:get_key/[1|2] will report on what you defined in your .app file: 1> application:get_key(kernel, registered). {ok,[application_controller, erl_reply, auth, boot_server, code_server, disk_log_server, disk_log_sup, erl_prim_loader, error_logger, file_server, file_server_2, fixtable_server, global_group, global_name_server, heart, init, kernel_config, kernel_sup, net_kernel, net_sup, rex, user, os_server, ddll_server, erl_epmd, inet_db, pg2]} This doesn't necessarily tell you the whole story though. In some of our applications we have many dynamic registered processes for which we cannot predict when we write the .app file. As I have said the above only reports on what is in the application specification. I have always thought that we should be able to put patterns or prefixes in the specification so that we could define these sorts of things (e.g. chan_fsm_[0-9][0-9]). -Vance From ulf.wiger@REDACTED Wed Dec 25 00:53:12 2002 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Wed, 25 Dec 2002 00:53:12 +0100 Subject: No subject References: <20021224055505.78581.qmail@web8205.mail.in.yahoo.com> Message-ID: <001301c2aba7$9e7a52a0$f67a40d5@telia.com> Hi Suresh, The parser most likely stumbles on the 'modules' list in your app file. The modules are given as authentication.erl, which is not a valid atom. You should remove the ".erl" part from the module names. You can check your .app file from an erlang shell by calling file:consult("roamapp.app"). /Uffe ----- Original Message ----- From: "Suresh S" To: Cc: "Ulf Wiger" Sent: den 24 december 2002 06:55 > Hi Ulf Wiger, > After Going Through ur work "OTP Release Handling > Tutorial" i tried to work on packaging of my > application, > > while making script it is giving the error for very > first erlang term in the .app file, > > what may be the problem . > > Eshell V5.0.1.1 (abort with ^G) > 1> Dir = "/home/suresh/InRoam-1.0/RoamApp". > "/home/suresh/InRoam-1.0/RoamApp" > 2> Path = [Dir ++ "/lib/*/ebin"]. > ["/home/suresh/InRoam-1.0/RoamApp/lib/*/ebin"] > 3> Var = {"RoamApp", Dir}. > {"RoamApp","/home/suresh/InRoam-1.0/RoamApp"} > 4> > systools:make_script("start_roamapp",[{path,Path},{variables,[Var]}]). > roamapp: Parse error in file: > "/home/suresh/InRoam-1.0/RoamApp/lib/roamapp-1.0.1/ebin/roamapp.app". > Line: 1 Error: "bad term"; > > error > 5> > > This is my app file > ------------------- > > {application, roamapp, > [{description, "Application for Call Processing of a > Roamer"}, > {vsn, "1.0.1"}, > {modules, [ authentication.erl, > inroam_trigger.erl, > timefun.erl, > importdata.erl, > roamapp.erl]}, > {registered,[ transceiver, > keepaliveagent, > keepalivemanager, > supervise_process, > Table_name, > manager, > agent, > recTrigMsg, > trap_msg]}, > {applications, [kernel,stdlib]}, > {mod, {roamapp,[]}}]}. > > Thanking u > > suresh s > > > > ________________________________________________________________________ > Missed your favourite TV serial last night? Try the new, Yahoo! TV. > visit http://in.tv.yahoo.com From sureshsaragadam@REDACTED Thu Dec 26 05:41:04 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Thu, 26 Dec 2002 04:41:04 +0000 (GMT) Subject: parse error in using make_script In-Reply-To: <001301c2aba7$9e7a52a0$f67a40d5@telia.com> Message-ID: <20021226044104.12829.qmail@web8207.mail.in.yahoo.com> Hi Ulff, this point which i neglected seams to be simple issue, but very important point i mistakenly did Even after going through OTP Relaese Handling Tutorial thanking u suresh --- Wiger Ulf wrote: > > Hi Suresh, > > The parser most likely stumbles on the 'modules' > list in your app file. The > modules are given as authentication.erl, which is > not a valid atom. You > should remove the ".erl" part from the module names. > You can check your .app > file from an erlang shell by calling > file:consult("roamapp.app"). > > /Uffe > > ----- Original Message ----- > From: "Suresh S" > To: > Cc: "Ulf Wiger" > Sent: den 24 december 2002 06:55 > > > > Hi Ulf Wiger, > > After Going Through ur work "OTP Release Handling > > Tutorial" i tried to work on packaging of my > > application, > > > > while making script it is giving the error for > very > > first erlang term in the .app file, > > > > what may be the problem . > > > > Eshell V5.0.1.1 (abort with ^G) > > 1> Dir = "/home/suresh/InRoam-1.0/RoamApp". > > "/home/suresh/InRoam-1.0/RoamApp" > > 2> Path = [Dir ++ "/lib/*/ebin"]. > > ["/home/suresh/InRoam-1.0/RoamApp/lib/*/ebin"] > > 3> Var = {"RoamApp", Dir}. > > {"RoamApp","/home/suresh/InRoam-1.0/RoamApp"} > > 4> > > > systools:make_script("start_roamapp",[{path,Path},{variables,[Var]}]). > > roamapp: Parse error in file: > > > "/home/suresh/InRoam-1.0/RoamApp/lib/roamapp-1.0.1/ebin/roamapp.app". > > Line: 1 Error: "bad term"; > > > > error > > 5> > > > > This is my app file > > ------------------- > > > > {application, roamapp, > > [{description, "Application for Call Processing > of a > > Roamer"}, > > {vsn, "1.0.1"}, > > {modules, [ authentication.erl, > > inroam_trigger.erl, > > timefun.erl, > > importdata.erl, > > roamapp.erl]}, > > {registered,[ transceiver, > > keepaliveagent, > > keepalivemanager, > > supervise_process, > > Table_name, > > manager, > > agent, > > recTrigMsg, > > trap_msg]}, > > {applications, [kernel,stdlib]}, > > {mod, {roamapp,[]}}]}. > > > > Thanking u > > > > suresh s > > > > > > > > > ________________________________________________________________________ > > Missed your favourite TV serial last night? Try > the new, Yahoo! TV. > > visit http://in.tv.yahoo.com > ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From sureshsaragadam@REDACTED Thu Dec 26 06:42:31 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Thu, 26 Dec 2002 05:42:31 +0000 (GMT) Subject: how to retrive registered processes of user application running on a node In-Reply-To: <20021224184718.GC13040@frogman.motivity.ca> Message-ID: <20021226054231.75062.qmail@web8203.mail.in.yahoo.com> Hi Vance Shipley , Once app file is defined we can know the registered proesses running May not possible for registered processes loaded dynamically of an application, I hava small clarification here, is there any chance to know the all the registered processes running on a node for a particular module This is all just because i need to keep track of all the processes running mainly registered processes of my applcation or any particular module , specificly is there any chance to know the status of the processes for particular module or aplication runnung Thanking u suresh s ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From sureshsaragadam@REDACTED Thu Dec 26 07:26:52 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Thu, 26 Dec 2002 06:26:52 +0000 (GMT) Subject: Mr martin Re: how to retrive registered processes of user application running on a node In-Reply-To: <1040741911.6148.669.camel@berimbau> Message-ID: <20021226062652.42013.qmail@web8201.mail.in.yahoo.com> Hi martin, My requirement goes like this , I need to keep track of all the processes may be registered processes of my application or a particular module in my application Is there is any utility suits my requirement Thanking u regards suresh s --- martin j logan wrote: > Suresh, > There is the function regs() that can be run on the > shell that will give > you the info that you need. The actual function that > regs() is calling > can be traced through the stdlib module > shell_default. > There is the function erlang:registered() which will > return a list of > all registered names on a node. Typically basic > utility functions of > this nature can be found in the kernel module > erlang. > > As an aside, you may want to look at the postings > this past week on > registering many processes. Make sure that it is the > right fit for you. > In my experience there is usually little need to do > so. > > Cheers, > Martin > > On Tue, 2002-12-24 at 02:27, Suresh S wrote: > > Hi, > > i hava an application , which has got many > registered > > processes , > > is there any chance to know all the registered > > processes of my application running on a node > > > > there is no .app file for my application > > > > usually registered(). > > will return all the registered processes on a > node > > where as i nedd is registered processes of my > > > application > > > > Thanking u > > > > suresh s > > > > > ________________________________________________________________________ > > Missed your favourite TV serial last night? Try > the new, Yahoo! TV. > > visit http://in.tv.yahoo.com > > ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From eleberg@REDACTED Fri Dec 27 08:42:02 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Fri, 27 Dec 2002 08:42:02 +0100 (MET) Subject: Concurrency in Functions and Messages Message-ID: <200212270742.gBR7g2D09979@cbe.ericsson.se> > X-Authentication-Warning: r2d2.sics.se: joe owned process doing -bs > Date: Fri, 20 Dec 2002 20:16:59 +0100 (CET) > From: Joe Armstrong > Most people think that processes are big and heavy things, whereas threads > are lightweight things. unless people know about plan9 and rfork(). see http://plan9.bell-labs.com/magic/man2html/2/fork bengt From hal@REDACTED Fri Dec 27 09:54:10 2002 From: hal@REDACTED (Hal Snyder) Date: Fri, 27 Dec 2002 02:54:10 -0600 Subject: fd leak in error_logger_file_h? In-Reply-To: <87y96fq594.fsf@ghidra.vail> (Hal Snyder's message of "Tue, 24 Dec 2002 00:51:19 -0600") References: <87y96fq594.fsf@ghidra.vail> Message-ID: <87isxfdeq5.fsf@ghidra.vail> > shouldn't it be something like > > terminate(_Reason, State) -> > case State of > {Fd, File, Prev} -> > close(Fd); > _ -> > true > end, > []. Sorry. Here's a patch against R9 that compiles: --- lib/stdlib/src/error_logger_file_h.erl.orig Wed Oct 2 16:15:17 2002 +++ lib/stdlib/src/error_logger_file_h.erl Thu Dec 26 16:58:26 2002 @@ -86,7 +86,13 @@ handle_call(_Query, State) -> {ok, {error, bad_query}, State}. -terminate(_Reason, _State) -> +terminate(_Reason, State) -> + case State of + {Fd, File, Prev} -> + file:close(Fd); + _ -> + true + end, []. code_change(_OldVsn, State, _Extra) -> From erlang@REDACTED Sat Dec 28 11:18:25 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 28 Dec 2002 11:18:25 +0100 Subject: Fw: ASN.1 examples? Message-ID: <004901c2ae5a$7612abe0$1e00a8c0@design> Does anyone know where to look for examples of ASN.1 ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Sat Dec 28 11:03:03 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Sat, 28 Dec 2002 11:03:03 +0100 Subject: ASN.1 examples? Message-ID: <001f01c2ae58$523ed600$1e00a8c0@design> Does anyone know where to look for examples of ASN.1 ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Dec 28 20:02:40 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 28 Dec 2002 20:02:40 +0100 Subject: ASN.1 compiler for C/C++ Message-ID: <007d01c2aea3$b268cc70$1e00a8c0@design> Where can I get an ASN.1 compiler for C/C++ and Windows OS ? Thanks, Eduardo Figoli -------------- next part -------------- An HTML attachment was scrubbed... URL: From sureshsaragadam@REDACTED Sat Dec 28 16:04:26 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Sat, 28 Dec 2002 15:04:26 +0000 (GMT) Subject: release handler and behaviour In-Reply-To: <001301c2aba7$9e7a52a0$f67a40d5@telia.com> Message-ID: <20021228150426.8473.qmail@web8203.mail.in.yahoo.com> Hi Uffe Wiger, I have not used any behaviour in my application, i am getting confused to make user of behaviour and all the stuff related to call_back Where do i get more info on behaviours and is supervisor module is necessery for a release ? i really want to include this module in my application, because i want to make a fault taularent applicatin very first statement of my .app file is throughing a parse error Thanking u with regards s suresh > Hi Suresh, > > The parser most likely stumbles on the 'modules' > list in your app file. The > modules are given as authentication.erl, which is > not a valid atom. You > should remove the ".erl" part from the module names. > You can check your .app > file from an erlang shell by calling > file:consult("roamapp.app"). > > /Uffe > > ----- Original Message ----- > From: "Suresh S" > To: > Cc: "Ulf Wiger" > Sent: den 24 december 2002 06:55 > > > > Hi Ulf Wiger, > > After Going Through ur work "OTP Release Handling > > Tutorial" i tried to work on packaging of my > > application, > > > > while making script it is giving the error for > very > > first erlang term in the .app file, > > > > what may be the problem . > > > > Eshell V5.0.1.1 (abort with ^G) > > 1> Dir = "/home/suresh/InRoam-1.0/RoamApp". > > "/home/suresh/InRoam-1.0/RoamApp" > > 2> Path = [Dir ++ "/lib/*/ebin"]. > > ["/home/suresh/InRoam-1.0/RoamApp/lib/*/ebin"] > > 3> Var = {"RoamApp", Dir}. > > {"RoamApp","/home/suresh/InRoam-1.0/RoamApp"} > > 4> > > > systools:make_script("start_roamapp",[{path,Path},{variables,[Var]}]). > > roamapp: Parse error in file: > > > "/home/suresh/InRoam-1.0/RoamApp/lib/roamapp-1.0.1/ebin/roamapp.app". > > Line: 1 Error: "bad term"; > > > > error > > 5> > > > > This is my app file > > ------------------- > > > > {application, roamapp, > > [{description, "Application for Call Processing > of a > > Roamer"}, > > {vsn, "1.0.1"}, > > {modules, [ authentication, > > inroam_trigger, > > timefun, > > importdata, > > roamapp]}, > > {registered,[ transceiver, > > keepaliveagent, > > keepalivemanager, > > supervise_process, > > Table_name, > > manager, > > agent, > > recTrigMsg, > > trap_msg]}, > > {applications, [kernel,stdlib]}, > > {mod, {roamapp,[]}}]}. > > > > Thanking u > > > > suresh s > > > > > > > > > ________________________________________________________________________ > > Missed your favourite TV serial last night? Try > the new, Yahoo! TV. > > visit http://in.tv.yahoo.com > ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From erlang@REDACTED Sat Dec 28 17:23:14 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Sat, 28 Dec 2002 13:23:14 -0300 Subject: binary to string Message-ID: <000e01c2ae8d$6cb6db60$1400a8c0@tdapi> I'm need convert binary to string, but I don't want use list_to_atom(binary_to_list(Bin)) because the atom it's not garbage collector. It is possible to do this? Thanks, Bernardo Paroli. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kent@REDACTED Sat Dec 28 19:13:50 2002 From: kent@REDACTED (Kent Boortz) Date: 28 Dec 2002 19:13:50 +0100 Subject: binary to string In-Reply-To: <000e01c2ae8d$6cb6db60$1400a8c0@tdapi> References: <000e01c2ae8d$6cb6db60$1400a8c0@tdapi> Message-ID: "Inswitch Solutions - Erlang Evaluation" writes: > I'm need convert binary to string, but I don't want use > list_to_atom(binary_to_list(Bin)) because the atom it's not garbage > collector. It is possible to do this? In Erlang strings are lists of integers so converting a binary to a string (given that the binary is something that you can view as a string) is just binary_to_list(Bin) Strings are not an efficient data type in Erlang but for most applications they work ok. These are all the same "string" only written differently "foo" [102,111,111] [$f, $o, $o] [$f, $o, $o | [] ] [$f, $o | [$o | [] ]] [$f | [$o | [$o | [] ]]] and takes 24 bytes on the heap on a 32 bit machine, kent From ulf.wiger@REDACTED Sat Dec 28 21:05:43 2002 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Sat, 28 Dec 2002 21:05:43 +0100 Subject: release handler and behaviour References: <20021228150426.8473.qmail@web8203.mail.in.yahoo.com> Message-ID: <003901c2aeac$80ff0600$f67a40d5@telia.com> The part of the OTP documentation that describes behaviours is: http://www.erlang.org/doc/r9b/doc/design_principles/des_princ.html#1.1 If you want to make a fault tolerant application, the supervisor behaviour is an essential component. The above document also talks about building supervision trees. The reference manual for the 'supervisor' module (part of stdlib) is also important. One of the most common behaviours is gen_server, the generic client-server behaviour. Here's a slightly simplified version of gen_server. Perhaps it will clarify how the callbacks are used. It lacks a few of the gen_server features (see erl -man gen_server), but behaves essentially like gen_server does. The most notable omission is the support for code change. -module(simple_server). -export([start_link/3, call/2, call/3, cast/2]). start_link({local, Name}, Module, Argument) -> Parent = self(), proc_lib:start_link(fun() -> init(Name, Module, Argument, Parent) end). call(Server, Request) -> call(Server, Request, 5000). call(Server, Request, Timeout) -> Ref = erlang:monitor(process, Server), Server ! {'$gen_call', {self(), Ref}, Request), receive {Ref, Reply} -> erlang:demonitor(Ref), Reply; {'DOWN', process, Ref, Reason} -> exit(timeout) % If memory serves me - too lazy to check after Timeout -> exit(timeout) end. cast(Server, Msg) -> Server ! {'$gen_cast', Msg}, ok. init(Name, Module, Argument, Parent) -> register(Name, self()), case catch Module:init(Argument) of {'EXIT', Reason} -> terminate(Module, Reason, []); {ok, State} -> main_loop(Module, Parent, State); Other -> terminate(Module, {bad_return, Other}, []) end. main_loop(Module, Parent, State) -> receive {'EXIT', Parent, Reason} -> % Note: the *Parent* exited terminate(Module, Reason, State); {'$gen_call', {Pid, Ref}=From, Request} -> case catch Module:handle_call(Request, From, State) of {'EXIT', Reason} -> terminate(Module, Reason, State); {reply, Reply, NewState} -> Pid ! {Ref, Reply}, main_loop(Module, Parent, NewState); {noreply, NewState} -> main_loop(Module, Parent, NewState); {stop, Reason, NewState} -> terminate(Module, Reason, NewState}; {stop, Reply, Reason, NewState} -> Pid ! {Ref, Reply}, terminate(Module, Reason, NewState) end; {'$gen_cast', Msg} -> case catch Module:handle_cast(Msg, State) of {'EXIT', Reason} -> terminate(Module, Reason, State); {noreply, NewState} -> main_loop(Module, Parent, NewState); {stop, Reason, NewState} -> terminate(Module, Reason, NewState) end; Msg -> case catch Module:handle_info(Msg, State) of {'EXIT', Reason} -> terminate(Module, Reason, State); {noreply, NewState} -> main_loop(Module, Parent, NewState); {stop, Reason, NewState} -> terminate(Module, Reason, NewState) end end. terminate(Module, Reason, State) -> catch Module:terminate(Reason, State), exit(Reason). ----- Original Message ----- From: "Suresh S" To: "Wiger Ulf" Cc: Sent: den 28 december 2002 16:04 Subject: release handler and behaviour > Hi Uffe Wiger, > > I have not used any behaviour in my application, > i am getting confused to make user of behaviour > and all the stuff related to call_back > > Where do i get more info on behaviours and is > supervisor module is necessery for a release ? > i really want to include this module in my > application, > because i want to make a fault taularent applicatin > > very first statement of my .app file is throughing a > parse error > > Thanking u > > with regards > s suresh > > > > Hi Suresh, > > > > The parser most likely stumbles on the 'modules' > > list in your app file. The > > modules are given as authentication.erl, which is > > not a valid atom. You > > should remove the ".erl" part from the module names. > > You can check your .app > > file from an erlang shell by calling > > file:consult("roamapp.app"). > > > > /Uffe > > > > ----- Original Message ----- > > From: "Suresh S" > > To: > > Cc: "Ulf Wiger" > > Sent: den 24 december 2002 06:55 > > > > > > > Hi Ulf Wiger, > > > After Going Through ur work "OTP Release Handling > > > Tutorial" i tried to work on packaging of my > > > application, > > > > > > while making script it is giving the error for > > very > > > first erlang term in the .app file, > > > > > > what may be the problem . > > > > > > Eshell V5.0.1.1 (abort with ^G) > > > 1> Dir = "/home/suresh/InRoam-1.0/RoamApp". > > > "/home/suresh/InRoam-1.0/RoamApp" > > > 2> Path = [Dir ++ "/lib/*/ebin"]. > > > ["/home/suresh/InRoam-1.0/RoamApp/lib/*/ebin"] > > > 3> Var = {"RoamApp", Dir}. > > > {"RoamApp","/home/suresh/InRoam-1.0/RoamApp"} > > > 4> > > > > > > systools:make_script("start_roamapp",[{path,Path},{variables,[Var]}]). > > > roamapp: Parse error in file: > > > > > > "/home/suresh/InRoam-1.0/RoamApp/lib/roamapp-1.0.1/ebin/roamapp.app". > > > Line: 1 Error: "bad term"; > > > > > > error > > > 5> > > > > > > This is my app file > > > ------------------- > > > > > > {application, roamapp, > > > [{description, "Application for Call Processing > > of a > > > Roamer"}, > > > {vsn, "1.0.1"}, > > > {modules, [ authentication, > > > inroam_trigger, > > > timefun, > > > importdata, > > > > roamapp]}, > > > {registered,[ transceiver, > > > keepaliveagent, > > > keepalivemanager, > > > supervise_process, > > > Table_name, > > > manager, > > > agent, > > > recTrigMsg, > > > trap_msg]}, > > > {applications, [kernel,stdlib]}, > > > {mod, {roamapp,[]}}]}. > > > > > > Thanking u > > > > > > suresh s > > > > > > > > > > > > > > > ________________________________________________________________________ > > > Missed your favourite TV serial last night? Try > > the new, Yahoo! TV. > > > visit http://in.tv.yahoo.com > > > > ________________________________________________________________________ > Missed your favourite TV serial last night? Try the new, Yahoo! TV. > visit http://in.tv.yahoo.com From eduardo@REDACTED Sat Dec 28 20:01:28 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Sat, 28 Dec 2002 20:01:28 +0100 Subject: ASN.1 compiler Message-ID: <006901c2aea3$89fb1130$1e00a8c0@design> Where can I get an ASN.1 compiler for Windows ? Thanks, Eduardo Figoli -------------- next part -------------- An HTML attachment was scrubbed... URL: From sureshsaragadam@REDACTED Mon Dec 30 12:13:23 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Mon, 30 Dec 2002 11:13:23 +0000 (GMT) Subject: mod key and its role in resourse file In-Reply-To: <003901c2aeac$80ff0600$f67a40d5@telia.com> Message-ID: <20021230111323.56939.qmail@web8205.mail.in.yahoo.com> Hi Ulf I have some other OTP Based applications like mnesian, eva,.. inculded in my applications Acoording to Design Principles of OTP it says Included Applications --------------------- if you want several applications to include an application, it has to be designed as a library application without a start function (the mod key in the .app file). So i should not have mod key in my resourse file(.app file) Then how do i specify start function of my application with out using mod key Starting Applications --------------------- A primary application can be started in one or two steps. The first step is mandatory and the purpose of it is to start the main supervisor of the application and possible permanent children. The second step is optional and its purpose is to synchronize processes within an application. Thanking u sir regards suresh s --- Wiger Ulf wrote: > The part of the OTP documentation that describes > behaviours is: > > http://www.erlang.org/doc/r9b/doc/design_principles/des_princ.html#1.1 > > If you want to make a fault tolerant application, > the supervisor behaviour > is an essential component. The above document also > talks about building > supervision trees. The reference manual for the > 'supervisor' module (part of > stdlib) is also important. > > One of the most common behaviours is gen_server, the > generic client-server > behaviour. > Here's a slightly simplified version of gen_server. > Perhaps it will clarify > how the callbacks are used. It lacks a few of the > gen_server features (see > erl -man gen_server), but behaves essentially like > gen_server does. ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From erlang@REDACTED Mon Dec 30 14:14:41 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Mon, 30 Dec 2002 10:14:41 -0300 Subject: FSM example Message-ID: <001201c2b005$6a76c990$1400a8c0@tdapi> Can anyone share a gen_fsm example that uses timers? Thanks, Bernardo Paroli -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Dec 31 10:29:44 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 10:29:44 +0100 Subject: Legal binary syntax? Message-ID: <003f01c2b0af$27f6b440$1e00a8c0@design> Is this a legal binary syntax: <> = Bytes, where Bytes is a binary. I received "Len unbound" error message. If assignment is left to right why does this happen ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.dudley@REDACTED Mon Dec 30 16:35:43 2002 From: daniel.dudley@REDACTED (Daniel Dudley) Date: Mon, 30 Dec 2002 16:35:43 +0100 Subject: Word origins (mnensia and mnemosyne) Message-ID: <001b01c2b019$1dcf96d0$86d0b33e@dld2000> I'm curious about the origins of the words mnensia and mnemosyne. A search in web dictionaries gives no answers, so I assume the words are concocted by the creators of the mnensia and mnemosyne applications -- but on what basis? Daniel From hakan.stenholm@REDACTED Mon Dec 30 17:57:34 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 30 Dec 2002 17:57:34 +0100 Subject: Word origins (mnensia and mnemosyne) In-Reply-To: <001b01c2b019$1dcf96d0$86d0b33e@dld2000> Message-ID: On m?ndag, dec 30, 2002, at 16:35 Europe/Stockholm, Daniel Dudley wrote: > I'm curious about the origins of the words mnensia and > mnemosyne. A search in web dictionaries gives no answers, > so I assume the words are concocted by the creators of the > mnensia and mnemosyne applications -- but on what basis? > > Daniel It'll make more sense if you add a "a" at the beginning, amnesia and amnemosyne (greece - loss of memory for a specific span of time). From erlang@REDACTED Tue Dec 31 13:55:07 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 13:55:07 +0100 Subject: Fw: Messages between processes Message-ID: <006101c2b0cb$d8fd6510$1e00a8c0@design> When sending messages with parameters, between processes, should be better to send them (the params) in binary form ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Mon Dec 30 18:00:21 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Mon, 30 Dec 2002 22:00:21 +0500 (YEKT) Subject: Legal binary syntax? In-Reply-To: <003f01c2b0af$27f6b440$1e00a8c0@design> References: <003f01c2b0af$27f6b440$1e00a8c0@design> Message-ID: <20021230.220021.74732731.svg@surnet.ru> Good day, The two occurrences of Len are not allowed. You must rewrite code your code as: <> = Bytes, <> = Rest, ... Best Regards, Vladimir Sekissov erlang> Is this a legal binary syntax: erlang> erlang> <> = Bytes, erlang> where Bytes is a binary. erlang> erlang> I received "Len unbound" error message. erlang> If assignment is left to right why does this happen ? erlang> erlang> erlang> Thanks, erlang> Eduardo Figoli erlang> INSwitch Solutions erlang> erlang> From klacke@REDACTED Mon Dec 30 18:36:23 2002 From: klacke@REDACTED (Klacke) Date: Mon, 30 Dec 2002 18:36:23 +0100 Subject: Word origins (mnensia and mnemosyne) In-Reply-To: <001b01c2b019$1dcf96d0$86d0b33e@dld2000>; from daniel.dudley@chello.no on Mon, Dec 30, 2002 at 04:35:43PM +0100 References: <001b01c2b019$1dcf96d0$86d0b33e@dld2000> Message-ID: <20021230183623.A24257@bluetail.com> On Mon, Dec 30, 2002 at 04:35:43PM +0100, Daniel Dudley wrote: > I'm curious about the origins of the words mnensia and > mnemosyne. A search in web dictionaries gives no answers, > so I assume the words are concocted by the creators of the > mnensia and mnemosyne applications -- but on what basis? > I initially nicked the db to Amnesia. In those days, Mnesia was a ram only db. The idea was that when the power is shut down, the db forgets everything, amnesia. Once the OTP kit was getting ready for prime time, a couple of serious suits came into my little research cubicle, closed the door and said - Klacke, we must do something about this non-proffesional-sounding name of the OTP database. I dropped the A. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From klacke@REDACTED Mon Dec 30 18:41:08 2002 From: klacke@REDACTED (Klacke) Date: Mon, 30 Dec 2002 18:41:08 +0100 Subject: Fw: Messages between processes In-Reply-To: <006101c2b0cb$d8fd6510$1e00a8c0@design>; from erlang@inswitch.us on Tue, Dec 31, 2002 at 01:55:07PM +0100 References: <006101c2b0cb$d8fd6510$1e00a8c0@design> Message-ID: <20021230184108.B24257@bluetail.com> On Tue, Dec 31, 2002 at 01:55:07PM +0100, Inswitch Solutions - Erlang Evaluation wrote: > > When sending messages with parameters, between processes, should > be better to send them (the params) in binary form ? > No, The only possible exception where it would be (possibly) faster would be long strings of characters and use list_to_binary/1. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From erlang@REDACTED Tue Dec 31 16:42:10 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 16:42:10 +0100 Subject: Fw: Messages between processes References: <006101c2b0cb$d8fd6510$1e00a8c0@design> <20021230184108.B24257@bluetail.com> Message-ID: <007901c2b0e3$2f9cdfb0$1e00a8c0@design> So sending messages using binary types between different Nodes (different machines) does not have better performance ? Thank you, Eduardo Figoli INSwitch Solutions ----- Original Message ----- From: "Klacke" To: "Inswitch Solutions - Erlang Evaluation" Cc: Sent: Monday, December 30, 2002 6:41 PM Subject: Re: Fw: Messages between processes > On Tue, Dec 31, 2002 at 01:55:07PM +0100, Inswitch Solutions - Erlang Evaluation wrote: > > > > When sending messages with parameters, between processes, should > > be better to send them (the params) in binary form ? > > > > No, > > The only possible exception where it would be (possibly) faster > would be long strings of characters and use list_to_binary/1. > > > /klacke > > -- > Claes Wikstrom -- Caps lock is nowhere and > Alteon WebSystems -- everything is under control > http://www.bluetail.com/~klacke > cellphone: +46 70 2097763 From ulf.wiger@REDACTED Mon Dec 30 21:48:22 2002 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Mon, 30 Dec 2002 21:48:22 +0100 Subject: Fw: Messages between processes References: <006101c2b0cb$d8fd6510$1e00a8c0@design> <20021230184108.B24257@bluetail.com> <007901c2b0e3$2f9cdfb0$1e00a8c0@design> Message-ID: <002101c2b044$cb165ba0$f67a40d5@telia.com> The time saved when sending messages between different nodes would be insignificant, since you would only save a few microseconds at most on the message encode/decode -- this is nothing compared to the total cost of distributed messaging. The only time it really makes sense to pass around messages as binaries is if they originated as binaries. This would be typical for some protocol applications, where a message arrives from the network in some well-specified binary form. A first recipient could do a partial decode of the message in order to determine where it should go next, and then pass the original message along. This would be more efficient than decoding the entire message first, and then sending a (perhaps big) erlang term -- partly because some messages can be discarded early, or off-loaded to another processor early, and partly because passing binary payload in a local message is very cheap. The downside is that it complicates the application somewhat. As a general rule, converting data to binary format in order to shave a little time off the message passing is a sub-optimization. Very much so with Shared Heap Erlang, since all local messages (not just binary messages) are passed by pointer reference. /Uffe ----- Original Message ----- From: "Inswitch Solutions - Erlang Evaluation" To: Sent: den 31 december 2002 16:42 Subject: Re: Fw: Messages between processes > > So sending messages using binary types between different Nodes (different > machines) does not have better performance ? > > Thank you, > Eduardo Figoli > INSwitch Solutions > > > ----- Original Message ----- > From: "Klacke" > To: "Inswitch Solutions - Erlang Evaluation" > Cc: > Sent: Monday, December 30, 2002 6:41 PM > Subject: Re: Fw: Messages between processes > > > > On Tue, Dec 31, 2002 at 01:55:07PM +0100, Inswitch Solutions - Erlang > Evaluation wrote: > > > > > > When sending messages with parameters, between processes, should > > > be better to send them (the params) in binary form ? > > > > > > > No, > > > > The only possible exception where it would be (possibly) faster > > would be long strings of characters and use list_to_binary/1. > > > > > > /klacke > > > > -- > > Claes Wikstrom -- Caps lock is nowhere and > > Alteon WebSystems -- everything is under control > > http://www.bluetail.com/~klacke > > cellphone: +46 70 2097763 > From erlang@REDACTED Tue Dec 31 20:18:09 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 20:18:09 +0100 Subject: Fw: Acknowledge messages Message-ID: <00dd01c2b101$5b928d90$1e00a8c0@design> Is it necessary to acknowledge every message I sent to a process ? If it's the case is there a better choice to do this than by hand (send message and receive ack) ? I wish you a Happy New Year and thanks to all of you, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Dec 31 20:17:44 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 20:17:44 +0100 Subject: Acknowledge messages Message-ID: <00ce01c2b101$4e28de20$1e00a8c0@design> Is it necessary to acknowledge every message I sent to a process ? If it's the case is there a better choice to do this than by hand (send message and receive ack) ? I wish you a Happy New Year and thanks to all of you, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.dudley@REDACTED Tue Dec 31 01:00:39 2002 From: daniel.dudley@REDACTED (Daniel Dudley) Date: Tue, 31 Dec 2002 01:00:39 +0100 Subject: Word origins (mnensia and mnemosyne) References: <001b01c2b019$1dcf96d0$86d0b33e@dld2000> <3E107358.7020609@home.se> Message-ID: <005101c2b05f$a7c76700$86d0b33e@dld2000> Sorry about the typo. I thought as much when a wildcard search revealed "amnesia". However, I didn't dare believe that someone could be that clever (and witty)! :-) Thankfully, Claes has owned up to that bravado while Haakon has revealed the similarity regarding "mnemosyne". Cheers to you all, Daniel ----- Original Message ----- From: "Torbjorn Tornkvist" To: "Daniel Dudley" Cc: Sent: Monday, December 30, 2002 5:24 PM Subject: Re: Word origins (mnensia and mnemosyne) > Daniel Dudley wrote: > > >I'm curious about the origins of the words mnensia and > >mnemosyne. A search in web dictionaries gives no answers, > >so I assume the words are concocted by the creators of the > >mnensia and mnemosyne applications -- but on what basis? > > > >Daniel > > > > > You probably mean 'Mnesia' ? > > Anyway, the Mnesia DB was initially named "Amnesia" , but > some manager at Ericsson though that wasn't a funny joke so > the 'A' was dropped from the name. > > Apparently, Mnesia is still a valid greek word meaning > 'memory' or something like that. > Mnemosyne was taken from the Greek mythology if I remember > correctly. > > Cheers /Tobbe From sureshsaragadam@REDACTED Tue Dec 31 09:59:11 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 31 Dec 2002 08:59:11 +0000 (GMT) Subject: how to include OTP defiened applications in resourse file In-Reply-To: <000b01c2b043$47dda280$f67a40d5@telia.com> Message-ID: <20021231085911.88525.qmail@web8202.mail.in.yahoo.com> Hi Ulf, nice of u for ur mail which well describes mod attribute in a resourse file. According to your mail( can be seen below) the mod is not necessery and we need to make use of attribute 'included_applications' in resourse file if an application inculdes sub-applications Here in my applicaiton i make use OTP defined applications say SASL , EVA , MNESIA ... So In this case do i need to use mod key attribute or include_applicaiton attribute , now my resourse file applicatoin attribute is defined this way {applications, [kernel,stdlib]} do i have to difene for SASL, EVA , MNESIA like {applications, [kernel,stdlib,sasl,eva,mnesia]} Thanking u suresh s --- Wiger Ulf wrote: > Hi Suresh, > > The passage about the 'mod' key refers to so-called > "included applications". > > It is possible to create a hierarchy of > applications, where several > different applications are combined into one complex > application. This can > be very useful if you need to create a large > "run-time complex", but still > want to break things up into manageable units. Also, > if you have several > programmer teams each working on a certain part, it > is convenient to allow > them to package their own code as an application, > and then build larger > applications out of several smaller ones. > > The way to create a hierarchy of applications is to > specify sub-applications > in the 'included_applications' attribute of another > application. This will > be recognized by the release handler and the > application controller. > > When starting the application, the OTP application > controller only cares > about the topmost application, and uses the 'mod' > key in it to identify the > start function. It is then up to that start function > to create any processes > needed by the sub-applications. > > To be precise, the sub-applications are allowed to > have a 'mod' key as well; > it is just ignored by the application controller. > > In AXD 301, for example, the ATM signaling > application is a fairly large > complex of smaller applications (each ATM signaling > protocol is an > application; generic call control is another; > resource handling, admission > control, routing, etc. are also applications. They > all make up one large > (hierarchical) application, where the startup and > recovery procedures are > tightly integrated using "start phases" (another > feature of the application > controller). > > In AXD 301, all applications have the same 'mod' key > ({sysApp, > {sysAppCB,[]}}), where sysApp:start(Type, ...) (an > AXD 301-specific > function) takes care of starting the topmost > application as well as all > included applications. It is not terribly difficult > to write such a > function, and it can use application:get_key(App, > included_applications) and > application:get_key(App, mod) to extract the > information needed to start > included applications automatically. > > Regards, > Ulf Wiger > > ----- Original Message ----- > From: "Suresh S" > To: "Wiger Ulf" > Cc: > Sent: den 30 december 2002 12:13 > Subject: mod key and its role in resourse file > > > > Hi Ulf > > > > I have some other OTP Based applications like > mnesian, > > eva,.. inculded in my applications > > > > Acoording to Design Principles of OTP it says > > > > Included Applications > > --------------------- > > if you want several applications to include an > > application, it has to be designed as a library > > application without a start function (the mod key > in > > the .app file). > > > > So i should not have mod key in my resourse > file(.app > > file) > > Then how do i specify start function of my > application > > > > with out using mod key > > > > Starting Applications > > --------------------- > > A primary application can be started in one or two > > steps. The first step is mandatory and the purpose > of > > it is to start the main supervisor of the > application > > and possible permanent children. The second step > is > > optional and its purpose is to synchronize > processes > > within an application. > > > > Thanking u sir > > > > regards > > suresh s > > --- Wiger Ulf wrote: > The > part > > of the OTP documentation that describes > > > behaviours is: > > > > > > > > > http://www.erlang.org/doc/r9b/doc/design_principles/des_princ.html#1.1 > > > > > > If you want to make a fault tolerant > application, > > > the supervisor behaviour > > > is an essential component. The above document > also > > > talks about building > > > supervision trees. The reference manual for the > > > 'supervisor' module (part of > > > stdlib) is also important. > > > > > > One of the most common behaviours is gen_server, > the > > > generic client-server > > > behaviour. > > > Here's a slightly simplified version of > gen_server. > > > Perhaps it will clarify > > > how the callbacks are used. It lacks a few of > the > > > gen_server features (see > > > erl -man gen_server), but behaves essentially > like > > > gen_server does. > > > > > > > ________________________________________________________________________ > > Missed your favourite TV serial last night? Try > the new, Yahoo! TV. > > visit http://in.tv.yahoo.com > ________________________________________________________________________ Missed your favourite TV serial last night? Try the new, Yahoo! TV. visit http://in.tv.yahoo.com From Jozsef.Berces@REDACTED Mon Dec 30 14:36:41 2002 From: Jozsef.Berces@REDACTED (Jozsef Berces (QCZ)) Date: Mon, 30 Dec 2002 14:36:41 +0100 Subject: asn1: swapped fields Message-ID: <9CC6CC2973F2D211B3580008C70DB2D205708975@eatvint903.dsa.ericsson.se> Hi, I have compiled RANAP with asn1ct and the decoder erlang code produces swapped fields for ProtocolIE-FieldPair: firstValue and secondCriticality are swapped in the resulting record. Here I am posting a simplified example. If you try to compile the attached file RAB-SetupOrModifyList.asn with option per, then for the sequence ProtocolIE-FieldPair {RANAP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { id RANAP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), firstCriticality RANAP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), firstValue RANAP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), secondCriticality RANAP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), secondValue RANAP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) } the erlang code will be 'dec_RAB-SetupOrModifyList_SEQOF_ProtocolIE-FieldPair'(Bytes,Telltype) -> %% attribute number 1 with type id {Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]), %% attribute number 2 with type firstCriticality {Term2,Bytes2} = ?RT_PER:decode_enumerated(Bytes1,[{'ValueRange',{0,2}}],{reject,ignore,notify}), %% attribute number 3 with type FirstValue {Tmpterm1, Bytes3} = ?RT_PER:decode_open_type(Bytes2, []), %% attribute number 4 with type secondCriticality {Term3,Bytes4} = ?RT_PER:decode_enumerated(Bytes3,[{'ValueRange',{0,2}}],{reject,ignore,notify}), %% attribute number 5 with type SecondValue {Tmpterm2, Bytes5} = ?RT_PER:decode_open_type(Bytes4, []), DecObjidTerm1 = 'getdec_RAB-SetupOrModifyItem-IEs'(id, Term1), {Term4, _} = case DecObjidTerm1('FirstValue', Tmpterm1, telltype,[]) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm3 -> Tmpterm3 end, {Term5, _} = case DecObjidTerm1('SecondValue', Tmpterm2, telltype,[]) of {'EXIT', Reason2} -> exit({'Type not compatible with table constraint',Reason2}); Tmpterm4 -> Tmpterm4 end, {{'ProtocolIE-FieldPair',Term1,Term2,Term3,Term4,Term5},Bytes5}. It can be seen that attribute number 3 is assigned to Term4 and attribute number 4 goes to Term3. It seems that the problem is to have the 'getdec_RAB-SetupOrModifyItem-IEs'(id, Term1) call too late, so Term4 will receive attribute number 3. I attached the results for different options: per, per_bin, and ber. per and per_bin are the same but ber is even worse (however, RANAP uses PER encoding)! Could someone post a fix? Until then we have to modify the erang code manually. Thanks in advance, Jozsef -------------- next part -------------- A non-text attachment was scrubbed... Name: RAB-SetupOrModifyList.asn Type: application/octet-stream Size: 2396 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RAB-SetupOrModifyList.ber.erl Type: application/octet-stream Size: 15019 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RAB-SetupOrModifyList.per.erl Type: application/octet-stream Size: 10378 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RAB-SetupOrModifyList.per_bin.erl Type: application/octet-stream Size: 10409 bytes Desc: not available URL: From tnt@REDACTED Mon Dec 30 17:24:56 2002 From: tnt@REDACTED (Torbjorn Tornkvist) Date: Mon, 30 Dec 2002 17:24:56 +0100 Subject: Word origins (mnensia and mnemosyne) References: <001b01c2b019$1dcf96d0$86d0b33e@dld2000> Message-ID: <3E107358.7020609@home.se> Daniel Dudley wrote: >I'm curious about the origins of the words mnensia and >mnemosyne. A search in web dictionaries gives no answers, >so I assume the words are concocted by the creators of the >mnensia and mnemosyne applications -- but on what basis? > >Daniel > > You probably mean 'Mnesia' ? Anyway, the Mnesia DB was initially named "Amnesia" , but some manager at Ericsson though that wasn't a funny joke so the 'A' was dropped from the name. Apparently, Mnesia is still a valid greek word meaning 'memory' or something like that. Mnemosyne was taken from the Greek mythology if I remember correctly. Cheers /Tobbe From eduardo@REDACTED Tue Dec 31 13:54:49 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Tue, 31 Dec 2002 13:54:49 +0100 Subject: Messages between processes Message-ID: <005601c2b0cb$cebf5310$1e00a8c0@design> When sending messages with parameters, between processes, should be better to send them (the params) in binary form ? Thanks, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From eduardo@REDACTED Tue Dec 31 20:17:34 2002 From: eduardo@REDACTED (Eduardo Figoli) Date: Tue, 31 Dec 2002 20:17:34 +0100 Subject: Acknowledge messages Message-ID: <00c401c2b101$47cd8490$1e00a8c0@design> Is it necessary to acknowledge every message I sent to a process ? If it's the case is there a better choice to do this than by hand (send message and receive ack) ? I wish you a Happy New Year and thanks to all of you, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickael.remond@REDACTED Tue Dec 31 11:10:32 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 31 Dec 2002 11:10:32 +0100 Subject: Acknowledge messages In-Reply-To: <00c401c2b101$47cd8490$1e00a8c0@design>; from eduardo@inswitch.us on Tue, Dec 31, 2002 at 08:17:34PM +0100 References: <00c401c2b101$47cd8490$1e00a8c0@design> Message-ID: <20021231111032.C28202@TH01.TGV.NET> * Eduardo Figoli [2002-12-31 20:17:34 +0100]: I assume you should have a very straight deadline to repost this message a 31 december ;-) So, here is a first answer. > Is it necessary to acknowledge every message I sent to a process ? It really depend on your protocol. So the answer is no, this is not necessary :-) Basically this difference is a choice between a synchronous operation (where you wait for the reply) and asynchronous operation when the process that send the message is not blocked and can pursue its execution. In some cases, your initiating process simply cannot wait for the answer, in particular if the answer time can be particularly long. You should then avoid blocking message passing. If your question is about being sure that the destination process have received a given message, the answer is no, there is no such garanty. This rely on your own protocol. Message passing in Erlang is said to rely on a "send and pray" mechanism. It is up to you to build the mechanism you need on top of it. > If it's the case is there a better choice to do this than by hand (send > message and receive ack) ? If you are using OTP behaviour there is everything packed in it. You have functions to do synchronous or asynchronous calls. I hope this helps. -- Micka?l R?mond From mickael.remond@REDACTED Tue Dec 31 11:12:23 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 31 Dec 2002 11:12:23 +0100 Subject: Messages between processes In-Reply-To: <005601c2b0cb$cebf5310$1e00a8c0@design>; from eduardo@inswitch.us on Tue, Dec 31, 2002 at 01:54:49PM +0100 References: <005601c2b0cb$cebf5310$1e00a8c0@design> Message-ID: <20021231111223.D28202@TH01.TGV.NET> * Eduardo Figoli [2002-12-31 13:54:49 +0100]: > > When sending messages with parameters, between processes, should > be better to send them (the params) in binary form ? I think your question has been answer. Please could you elaborate a little bit more if you need extra precisions ? -- Micka?l R?mond From per@REDACTED Tue Dec 31 13:40:55 2002 From: per@REDACTED (Per Hedeland) Date: Tue, 31 Dec 2002 13:40:55 +0100 (CET) Subject: Acknowledge messages In-Reply-To: <20021231111032.C28202@TH01.TGV.NET> Message-ID: <200212311240.gBVCetl41088@tordmule.bluetail.com> Mickael Remond wrote: >If your question is about being sure that the destination process have received >a given message, the answer is no, there is no such garanty. This rely on your >own protocol. Message passing in Erlang is said to rely on a "send and pray" >mechanism. It is up to you to build the mechanism you need on top of it. Well, without further qualification, and especially given to someone new to Erlang, I think such a statement is rather misleading - it makes it sound like Erlang would be prone to randomly dropping messages, like, say, UDP. This is not the case, of course - if the recipient process keeps running, the network (if needed) remains up, etc, every message sent will also be received by the recipient (and there are mechanisms available to make sure you get notified if one of the "bad" things that might prevent this happens). See also: http://www.erlang.org/ml-archive/erlang-questions/199910/msg00043.html --Per Hedeland From etxuwig@REDACTED Tue Dec 31 14:15:55 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 31 Dec 2002 14:15:55 +0100 (MET) Subject: how to include OTP defiened applications in resourse file In-Reply-To: <20021231085911.88525.qmail@web8202.mail.in.yahoo.com> Message-ID: On Tue, 31 Dec 2002, Suresh S wrote: >According to your mail( can be seen below) the mod is not >necessery and we need to make use of attribute >'included_applications' in resourse file if an application >inculdes sub-applications Yes... well, it is necessary in the topmost application, but not in the ones that are included. >Here in my applicaiton i make use OTP defined applications >say SASL , EVA , MNESIA ... > >So In this case do i need to use mod key attribute or >include_applicaiton attribute , If you use the OTP applications, you can start them individually. They have their own mod attributes and contain everything needed for the application controller to start them. >now my resourse file applicatoin attribute is defined this >way {applications, [kernel,stdlib]} > >do i have to difene for SASL, EVA , MNESIA like >{applications, [kernel,stdlib,sasl,eva,mnesia]} The `applications` attribute is used to define a dependency. For example, if your application requires mnesia to be started, you should include mnesia in the `applications` list in the .app file. This list is also by the OTP release handler to determine the proper start order of applications, and the application controller will make sure that your application is not started before mnesia is up and running. /Uffe >Thanking u > >suresh s > > --- Wiger Ulf wrote: > Hi >Suresh, >> >> The passage about the 'mod' key refers to so-called >> "included applications". >> >> It is possible to create a hierarchy of >> applications, where several >> different applications are combined into one complex >> application. This can >> be very useful if you need to create a large >> "run-time complex", but still >> want to break things up into manageable units. Also, >> if you have several >> programmer teams each working on a certain part, it >> is convenient to allow >> them to package their own code as an application, >> and then build larger >> applications out of several smaller ones. >> >> The way to create a hierarchy of applications is to >> specify sub-applications >> in the 'included_applications' attribute of another >> application. This will >> be recognized by the release handler and the >> application controller. >> >> When starting the application, the OTP application >> controller only cares >> about the topmost application, and uses the 'mod' >> key in it to identify the >> start function. It is then up to that start function >> to create any processes >> needed by the sub-applications. >> >> To be precise, the sub-applications are allowed to >> have a 'mod' key as well; >> it is just ignored by the application controller. >> >> In AXD 301, for example, the ATM signaling >> application is a fairly large >> complex of smaller applications (each ATM signaling >> protocol is an >> application; generic call control is another; >> resource handling, admission >> control, routing, etc. are also applications. They >> all make up one large >> (hierarchical) application, where the startup and >> recovery procedures are >> tightly integrated using "start phases" (another >> feature of the application >> controller). >> >> In AXD 301, all applications have the same 'mod' key >> ({sysApp, >> {sysAppCB,[]}}), where sysApp:start(Type, ...) (an >> AXD 301-specific >> function) takes care of starting the topmost >> application as well as all >> included applications. It is not terribly difficult >> to write such a >> function, and it can use application:get_key(App, >> included_applications) and >> application:get_key(App, mod) to extract the >> information needed to start >> included applications automatically. >> >> Regards, >> Ulf Wiger >> >> ----- Original Message ----- >> From: "Suresh S" >> To: "Wiger Ulf" >> Cc: >> Sent: den 30 december 2002 12:13 >> Subject: mod key and its role in resourse file >> >> >> > Hi Ulf >> > >> > I have some other OTP Based applications like >> mnesian, >> > eva,.. inculded in my applications >> > >> > Acoording to Design Principles of OTP it says >> > >> > Included Applications >> > --------------------- >> > if you want several applications to include an >> > application, it has to be designed as a library >> > application without a start function (the mod key >> in >> > the .app file). >> > >> > So i should not have mod key in my resourse >> file(.app >> > file) >> > Then how do i specify start function of my >> application >> > >> > with out using mod key >> > >> > Starting Applications >> > --------------------- >> > A primary application can be started in one or two >> > steps. The first step is mandatory and the purpose >> of >> > it is to start the main supervisor of the >> application >> > and possible permanent children. The second step >> is >> > optional and its purpose is to synchronize >> processes >> > within an application. >> > >> > Thanking u sir >> > >> > regards >> > suresh s >> > --- Wiger Ulf wrote: > The >> part >> > of the OTP documentation that describes >> > > behaviours is: >> > > >> > > >> > >> >http://www.erlang.org/doc/r9b/doc/design_principles/des_princ.html#1.1 >> > > >> > > If you want to make a fault tolerant >> application, >> > > the supervisor behaviour >> > > is an essential component. The above document >> also >> > > talks about building >> > > supervision trees. The reference manual for the >> > > 'supervisor' module (part of >> > > stdlib) is also important. >> > > >> > > One of the most common behaviours is gen_server, >> the >> > > generic client-server >> > > behaviour. >> > > Here's a slightly simplified version of >> gen_server. >> > > Perhaps it will clarify >> > > how the callbacks are used. It lacks a few of >> the >> > > gen_server features (see >> > > erl -man gen_server), but behaves essentially >> like >> > > gen_server does. >> > >> > >> > >> >________________________________________________________________________ >> > Missed your favourite TV serial last night? Try >> the new, Yahoo! TV. >> > visit http://in.tv.yahoo.com >> > >________________________________________________________________________ >Missed your favourite TV serial last night? Try the new, Yahoo! TV. > visit http://in.tv.yahoo.com > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From erlang@REDACTED Tue Dec 31 14:42:29 2002 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 31 Dec 2002 10:42:29 -0300 Subject: Spawn process Message-ID: <00a601c2b0d2$7748ddc0$1400a8c0@tdapi> I have spawned a module which doesn't exist and I have received its pid. I have done the following from the shell: spawn(NotExistModule, start, [Par1]). Bernardo Paroli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mickael.remond@REDACTED Tue Dec 31 15:53:42 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 31 Dec 2002 15:53:42 +0100 Subject: Spawn process In-Reply-To: <00a601c2b0d2$7748ddc0$1400a8c0@tdapi>; from erlang@inswitch.us on Tue, Dec 31, 2002 at 10:42:29AM -0300 References: <00a601c2b0d2$7748ddc0$1400a8c0@tdapi> Message-ID: <20021231155342.F28202@TH01.TGV.NET> * Inswitch Solutions - Erlang Evaluation [2002-12-31 10:42:29 -0300]: > I have spawned a module which doesn't exist and I have received its pid. > > I have done the following from the shell: > > spawn(NotExistModule, start, [Par1]). Yes, that is the standard behaviour. If you want to be informed of what is happening on your new process, you need to link your current process to this new process. This can be done at "spawn time" by using the function spawn_link. If you use this function, you get feedback on the runtime error that occurs in the spawned process. You can thus decide what you want to do. For example, in the shell: 3> spawn_link(notExistModule,start,[]). <0.232.0> ** exited: {undef,[{notExistModule,start,[]}]} ** -- Micka?l R?mond From etxuwig@REDACTED Tue Dec 31 18:14:53 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 31 Dec 2002 18:14:53 +0100 (MET) Subject: Happy New Year and continued Erlang Hacking Message-ID: Fellow Erlangers, The other day, I checked the erlang.org statistics, and could observe that Erlang/OTP R9B has been downloaded nearly 10,000 times already. November 2002 seems to have been the most active month ever. This is good news indeed. (: This is my 10th Erlang anniversary. I came across Erlang at the Royal Institute of Technology in Stockholm in 1992, as Bjarne D?cker and Robert Virding taught "Computers in Telephony Systems" there. It was love (for Erlang) at first sight, and I`ve been lucky enough to have been able to devote most of my time at work to Erlang since then (at least since 1996, when I joined Ericsson.) I want to wish you all a Happy New Year and good luck with your continued Erlang programming. The increasing strength of the Erlang community suggests that there will be even more opportunities to work with Erlang in the coming years. For those who struggle to get acceptance from their peers because of their strange inclination towards an odd programming tool from the North, I want to finish with a quote from an amazing book that I`m currently reading -- about someone who wasn`t appreciated in his lifetime either. "Born in Poland and educated in Italy, Copernicus lived during the height of the Renaissance. Though it was destined to become an unquestioned principle of existence for the modern psyche, the central tenet of his vision [that the Earth moves around the Sun] was inconceivable to most Europeans in his own lifetime. More than any single factor, it was the Copernican insight that provoked and symbolized the drastic, fundamental break from the ancient and medieval universe to that of the modern era. [...] Yet, throughout most of his life, Copernicus held back from full publication of his extraordinary idea. (Later, in his preface to the _De Revolutionibus_, dedicated to the pope, Copernicus confessed his reluctance to reveal publicly his insight into nature`s mysteries lest it be scorned by the uninitiated -- invoking the Pythagorean practice of strict secrecy in such matters.) [...] On the last day of his life, in the year 1543, a copy of the published work was brought to Copernicus. But on that day, and even during the following several decades, there was little indication in Europe that an unprecedented revolution in the Western world view had been initiated. For most who heard of it, the new conception was so contradictory to everyday experience, so patently false, as to not require serious discussion. But as a few proficient astronomers began to find Copernicus`s argument persuasive, the opposition began to mount; and it was the religious implications of the new cosmology that quickly provoked the most intense attacks." (From "The passion of the Western mind", (c) 1991, Richard Tarnas, published by Ballantines Books, ISBN: 0-345-36089-6. ) /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From vances@REDACTED Tue Dec 31 18:15:26 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 31 Dec 2002 12:15:26 -0500 Subject: how to include OTP defiened applications in resourse file In-Reply-To: References: <20021231085911.88525.qmail@web8202.mail.in.yahoo.com> Message-ID: <20021231171526.GB28931@frogman.motivity.ca> On Tue, Dec 31, 2002 at 02:15:55PM +0100, Ulf Wiger wrote: } } If you use the OTP applications, you can start them } individually. They have their own mod attributes and contain } everything needed for the application controller to start } them. Unless they are code libraries of course in which case they are not started and so do not have a mod attribute. EVA is a good example, you should put EVA in the included_applications attribute and start it yourself using eva_sup:start_link/0 (or one of the other start functions). -Vance From martin@REDACTED Tue Dec 31 19:01:17 2002 From: martin@REDACTED (martin j logan) Date: 31 Dec 2002 12:01:17 -0600 Subject: Happy New Year and continued Erlang Hacking In-Reply-To: References: Message-ID: <1041357682.21001.22.camel@berimbau> A few proficient programmers ARE beginning to find the Erlang stance persuasive and the opposition IS beginning to mount. The "religious" implications of the new paradigm are being realized by pharisees of the OOld orthodoxy. It elicits intense, "fiery", attacks but the realization of stark and singular superiority of the new paradigm will carry us forward. The erlang renaissance is afoot have faith in that:) Press on Copernicans and Happy new year, Martin On Tue, 2002-12-31 at 11:14, Ulf Wiger wrote: > > Fellow Erlangers, > > The other day, I checked the erlang.org statistics, and > could observe that Erlang/OTP R9B has been downloaded nearly > 10,000 times already. November 2002 seems to have been the > most active month ever. This is good news indeed. (: > > This is my 10th Erlang anniversary. I came across Erlang at > the Royal Institute of Technology in Stockholm in 1992, as > Bjarne D?cker and Robert Virding taught "Computers in > Telephony Systems" there. It was love (for Erlang) at first > sight, and I`ve been lucky enough to have been able to > devote most of my time at work to Erlang since then (at > least since 1996, when I joined Ericsson.) > > I want to wish you all a Happy New Year and good luck with > your continued Erlang programming. The increasing strength > of the Erlang community suggests that there will be even > more opportunities to work with Erlang in the coming years. > > For those who struggle to get acceptance from their peers > because of their strange inclination towards an odd > programming tool from the North, I want to finish with a > quote from an amazing book that I`m currently reading -- > about someone who wasn`t appreciated in his lifetime either. > > "Born in Poland and educated in Italy, Copernicus lived > during the height of the Renaissance. Though it was destined > to become an unquestioned principle of existence for the > modern psyche, the central tenet of his vision [that the > Earth moves around the Sun] was inconceivable to most > Europeans in his own lifetime. More than any single factor, > it was the Copernican insight that provoked and symbolized > the drastic, fundamental break from the ancient and medieval > universe to that of the modern era. [...] Yet, throughout > most of his life, Copernicus held back from full publication > of his extraordinary idea. (Later, in his preface to the > _De Revolutionibus_, dedicated to the pope, Copernicus > confessed his reluctance to reveal publicly his insight into > nature`s mysteries lest it be scorned by the uninitiated -- > invoking the Pythagorean practice of strict secrecy in such > matters.) [...] On the last day of his life, in the year > 1543, a copy of the published work was brought to > Copernicus. > But on that day, and even during the following several > decades, there was little indication in Europe that an > unprecedented revolution in the Western world view had been > initiated. For most who heard of it, the new conception was > so contradictory to everyday experience, so patently false, > as to not require serious discussion. But as a few > proficient astronomers began to find Copernicus`s argument > persuasive, the opposition began to mount; and it was the > religious implications of the new cosmology that quickly > provoked the most intense attacks." > > (From "The passion of the Western mind", (c) 1991, Richard > Tarnas, published by Ballantines Books, ISBN: > 0-345-36089-6. ) > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice Networks > From vances@REDACTED Tue Dec 31 18:58:54 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 31 Dec 2002 12:58:54 -0500 Subject: how to include OTP defiened applications in resourse file In-Reply-To: <20021231171526.GB28931@frogman.motivity.ca> References: <20021231085911.88525.qmail@web8202.mail.in.yahoo.com> <20021231171526.GB28931@frogman.motivity.ca> Message-ID: <20021231175854.GC28931@frogman.motivity.ca> Thinking about this I wonder why we put stdlib in the applications key (of the application resource file) instead of the included_applications key. Since stdlib is a code library, and doesn't include a mod key in it's application resource file, it would seem that it belongs in the included_applications key. I assume it's for historical reasons. -Vance From etxuwig@REDACTED Tue Dec 31 20:15:49 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 31 Dec 2002 20:15:49 +0100 (MET) Subject: how to include OTP defiened applications in resourse file In-Reply-To: <20021231175854.GC28931@frogman.motivity.ca> Message-ID: On Tue, 31 Dec 2002, Vance Shipley wrote: >Thinking about this I wonder why we put stdlib in the >applications key (of the application resource file) instead >of the included_applications key. Since stdlib is a code >library, and doesn't include a mod key in it's application >resource file, it would seem that it belongs in the >included_applications key. > >I assume it's for historical reasons. One would not include a certain application in more than one other application, and there`s no real benefit to including it in the first place. On the other hand, if there is a dependency towards another application, it makes sense to keep it in the `applications` list, whether or not that application is in fact started. This is essentially up to the designer of stdlib, and if stdlib is changed in the future from being a "library" application into a runnable application, your code won`t break if stdlib is already in the `applications` list. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From daniel.dudley@REDACTED Tue Dec 31 21:42:53 2002 From: daniel.dudley@REDACTED (Daniel Dudley) Date: Tue, 31 Dec 2002 21:42:53 +0100 Subject: Missing bookmarks in Erlang book (pdf-version) Message-ID: <00a301c2b10d$313986a0$add0b33e@dld2000> The PDF-version of "Concurrent Programming in Erlang" contains Part 1, Programming, only; the 2nd part, Applications, is omitted. In the text, most references (links to bookmarks) are replaced by "??". However, not all of these are references to chapters or sections in Part 2. Clearly, insertion of the correct references will enhance the readability and usefulness of the book considerably. Can anyone oblige me with a list of the correct references? While on the subject of this book, I'm wondering whether anyone is working on a new version, which clearly is warranted due to, among other things, extensions to the language. If not, I might be inclined to take on that task myself -- with a little help from the language experts. For starters, I envisage three volumes: Programming, Standard Libraries and Applications. I'm hoping for some feedback from the community, so don't be shy! Godt Nytt Aar til alle! A Happy and Prosperous New Year to everyone! Daniel From ulf.wiger@REDACTED Mon Dec 30 21:37:33 2002 From: ulf.wiger@REDACTED (Wiger Ulf) Date: Mon, 30 Dec 2002 21:37:33 +0100 Subject: mod key and its role in resourse file References: <20021230111323.56939.qmail@web8205.mail.in.yahoo.com> Message-ID: <000b01c2b043$47dda280$f67a40d5@telia.com> Hi Suresh, The passage about the 'mod' key refers to so-called "included applications". It is possible to create a hierarchy of applications, where several different applications are combined into one complex application. This can be very useful if you need to create a large "run-time complex", but still want to break things up into manageable units. Also, if you have several programmer teams each working on a certain part, it is convenient to allow them to package their own code as an application, and then build larger applications out of several smaller ones. The way to create a hierarchy of applications is to specify sub-applications in the 'included_applications' attribute of another application. This will be recognized by the release handler and the application controller. When starting the application, the OTP application controller only cares about the topmost application, and uses the 'mod' key in it to identify the start function. It is then up to that start function to create any processes needed by the sub-applications. To be precise, the sub-applications are allowed to have a 'mod' key as well; it is just ignored by the application controller. In AXD 301, for example, the ATM signaling application is a fairly large complex of smaller applications (each ATM signaling protocol is an application; generic call control is another; resource handling, admission control, routing, etc. are also applications. They all make up one large (hierarchical) application, where the startup and recovery procedures are tightly integrated using "start phases" (another feature of the application controller). In AXD 301, all applications have the same 'mod' key ({sysApp, {sysAppCB,[]}}), where sysApp:start(Type, ...) (an AXD 301-specific function) takes care of starting the topmost application as well as all included applications. It is not terribly difficult to write such a function, and it can use application:get_key(App, included_applications) and application:get_key(App, mod) to extract the information needed to start included applications automatically. Regards, Ulf Wiger ----- Original Message ----- From: "Suresh S" To: "Wiger Ulf" Cc: Sent: den 30 december 2002 12:13 Subject: mod key and its role in resourse file > Hi Ulf > > I have some other OTP Based applications like mnesian, > eva,.. inculded in my applications > > Acoording to Design Principles of OTP it says > > Included Applications > --------------------- > if you want several applications to include an > application, it has to be designed as a library > application without a start function (the mod key in > the .app file). > > So i should not have mod key in my resourse file(.app > file) > Then how do i specify start function of my application > > with out using mod key > > Starting Applications > --------------------- > A primary application can be started in one or two > steps. The first step is mandatory and the purpose of > it is to start the main supervisor of the application > and possible permanent children. The second step is > optional and its purpose is to synchronize processes > within an application. > > Thanking u sir > > regards > suresh s > --- Wiger Ulf wrote: > The part > of the OTP documentation that describes > > behaviours is: > > > > > http://www.erlang.org/doc/r9b/doc/design_principles/des_princ.html#1.1 > > > > If you want to make a fault tolerant application, > > the supervisor behaviour > > is an essential component. The above document also > > talks about building > > supervision trees. The reference manual for the > > 'supervisor' module (part of > > stdlib) is also important. > > > > One of the most common behaviours is gen_server, the > > generic client-server > > behaviour. > > Here's a slightly simplified version of gen_server. > > Perhaps it will clarify > > how the callbacks are used. It lacks a few of the > > gen_server features (see > > erl -man gen_server), but behaves essentially like > > gen_server does. > > > ________________________________________________________________________ > Missed your favourite TV serial last night? Try the new, Yahoo! TV. > visit http://in.tv.yahoo.com