From debianlm@REDACTED Wed Nov 1 09:32:31 2006 From: debianlm@REDACTED (debianlm) Date: Wed, 1 Nov 2006 16:32:31 +0800 (CST) Subject: [erlang-questions] http-poll failed? Message-ID: <325007.69980.qm@web15003.mail.cnb.yahoo.com> hi, I have configured my ejabberd such like that. "{5280, ejabberd_http, [http_poll, web_admin]}". but when I visit the URL link http://myhost:5280/http-poll ,I get the failue notice as following : XML parser error?element not found position?http://myhost:5280/http-poll/ ??1???1 . at that time , I can manage my ejabberd by visit http://myhost:5280/admin. thanks a lost for any help. --------------------------------- ??????-3.5G???20M?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikael.karlsson@REDACTED Wed Nov 1 10:40:40 2006 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Wed, 1 Nov 2006 10:40:40 +0100 Subject: [erlang-questions] ErlyWeb In-Reply-To: References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> <200610310802.31407.mikael.karlsson@creado.com> Message-ID: <200611011040.41348.mikael.karlsson@creado.com> I agree with all your statements, maybe I was a bit unclear in my own ones, I did not mean that you should mix infrastructure applications and web applications (actually one of the reasons I started to work on yapp), but that it is good to try and fit web applications, developed with ErlyWeb for instance, into an OTP style. One of the reasons for doing so is that you can make use of the OTP release handler for adding/upgrading your web apps while the server(s) is (are) running. The problem is that, as you say, have different roles: Server maintainer, app deployer, web applications developer, and as an applications developer you do not have control over all the other applications running on the web server that makes up to one OTP release package. This means that one actually have to build OTP release package scripts on the web server in order to deploy new (or upgrade old) web applications (or infrastucture apps from Erlang/OTP itself or Yaws.) I do not think this is a problem if you have the right tools made. I look forward to see the presentations on ErlHive at EUC and see what it brings to us, but Ulf has also made a nice OTP Release handling tutorial on trapexit.org which I can recommend, and one of the things that you learn is that you can have several "roots" for different application types. The directory structure I would like to see for an Enterprise Yaws/ErlyWeb would be something like: /usr/local/lib/erlang - for Erlang/OTP /home/yaws/yawsroot/ - Yaws/web infrastructure apps lib/yaws-1.65/ lib/yaws-1.62/ lib/yapp-0.2/ lib/yfront-1.0/ lib/ydeployrelease-1.0/ lib/erltl-xx/ lib/younameit-x.y/ /home/yaws/approot/ Web apps root releases/ - OTP Release handler stuff lib/webapp1-1.2/ lib/webapp1-1.3/ lib/webapp2-1.0/ uzw. So I develop my web app, tar it, HTTP POST it to my web server(s) app download directory, and let the deployer, which probably is also me, untar it in the webapps lib directory, make new OTP release package files, and deploy it ( all this using a nice web GUI developed in ErlyWeb, and having support for clustered servers, of course :-). /Mikael On Mov 01 2006 06:16 Jon Hancock wrote: > On Oct 31, 2006, at 3:02 PM, Mikael Karlsson wrote: >... > > Observation: > > Erlang/OTP by default packages the app/ebin and app/priv > > directories into > > releases (functions like systools:make_tar/2 etc). So you might > > consider > > using priv/www (or priv/docroot) instead of www as your docroot > > directory. > > Not a big deal really since you can include other directories too with > > optional parameters to systools:make_tar, but it could be good to > > stick to > > the OTP default way. > > Yaws itself does not do this, but uses the www directory for some > > reason. > > Maybe the Yaws www files are not supposed to be in ones own web > > application > > release. > > I think its best to keep apps developed on yaws/erlyweb separate from > the yaws/erlyweb libraries. > This means doing things pretty much inline with how Yariv has > released things. There are a few minor structural problems with the > current app directories. And there is a need to move the erlyweb > libraries themselves into an OTP style and encourage its installation > in the erlang libs directory. But I would not suggest to merge the > two worlds. > > As a point to consider, think of the type of user that updates the > core erlang/OTP libraries on a server compared to the app programmer > working with the www structure. These are two very different roles > (even if its the same person). > > As to the yaws install structure. I'm not a huge fan of its > defaults, but they are easily changed and the defaults are sane. I > put yaws log/temp/conf and the apps that run on yaws in their own > yaws home owned by a yaws user/group. I leave the yaws libraries > installed in their default install location. > > I'm guessing that projects like yapp and some stuff Ulf has alluded > to will round up the overall structure and things will come together > in a few more months. > > ke han From kithsiri@REDACTED Wed Nov 1 12:20:12 2006 From: kithsiri@REDACTED (Kithsiri) Date: Wed, 01 Nov 2006 17:20:12 +0600 Subject: [erlang-questions] Checking the Connection Message-ID: <454882EC.8090601@wavenet.lk> Hi all, I'm try to find whether the connection to a remote node is present or not. For that I used node.ping("remote",2000). I used a timeout period because i want fast reply from remote node. It give reply soon when connection is present, but it is not give reply within timeout period if the connection failed. Can someone please give me a way to check the connection state within a limited period of time. Thank You, Kithsiri. From ben@REDACTED Wed Nov 1 12:58:55 2006 From: ben@REDACTED (Ben Butler-Cole) Date: Wed, 1 Nov 2006 03:58:55 -0800 (PST) Subject: [erlang-questions] Using EUnit from the shell Message-ID: <20061101115855.91851.qmail@web30807.mail.mud.yahoo.com> I'm just starting to use EUnit. I'd like to integrate it with an automated build script (I'm using Rake). So I need to find a way of running EUnit tests from the shell and having them return an error if the tests fail. Has anyone come up with a way of doing this? The best I've managed is erl -noshell -run my_test test -run erlang halt This prints out error messages if tests fail, but doesn't tell the shell that there has been a problem. Any suggestions greatly appreciated. Ben From richardc@REDACTED Wed Nov 1 13:12:14 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 01 Nov 2006 13:12:14 +0100 Subject: [erlang-questions] Using EUnit from the shell In-Reply-To: <20061101115855.91851.qmail@web30807.mail.mud.yahoo.com> References: <20061101115855.91851.qmail@web30807.mail.mud.yahoo.com> Message-ID: <45488F1E.6020406@it.uu.se> Ben Butler-Cole wrote: > I'm just starting to use EUnit. I'd like to integrate it with an > automated build script (I'm using Rake). > > So I need to find a way of running EUnit tests from the shell and > having them return an error if the tests fail. > > Has anyone come up with a way of doing this? > > The best I've managed is > > erl -noshell -run my_test test -run erlang halt > > This prints out error messages if tests fail, but doesn't tell the > shell that there has been a problem. > > Any suggestions greatly appreciated. Sorry that I haven't done anything to improve this yet. My intention was to make a command line interface similar to that of edoc. I've just been too %/&#? busy lately. Meanwhile, no, there is no simple way of getting a success-or-failure flag back to the OS. A temporary hack would be to detect errors using grep. /Richard From chsu79@REDACTED Wed Nov 1 13:30:44 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 1 Nov 2006 13:30:44 +0100 Subject: [erlang-questions] Checking the Connection In-Reply-To: <454882EC.8090601@wavenet.lk> References: <454882EC.8090601@wavenet.lk> Message-ID: There is erlang:monitor_node(Node, Flag) I dont know how often and what ping time erlang distribution uses to classify a node as alive or down. From wilbjor@REDACTED Wed Nov 1 13:58:37 2006 From: wilbjor@REDACTED (Jordan Wilberding) Date: Wed, 01 Nov 2006 06:58:37 -0600 Subject: [erlang-questions] Checking the Connection In-Reply-To: <454882EC.8090601@wavenet.lk> References: <454882EC.8090601@wavenet.lk> Message-ID: <454899FD.6000203@iit.edu> I am not completely sure I understand your question, but for timeouts on our small server we wrote, we just start a new thread of the following function: loop_check_alive_nodes(UserList) -> receive {From, stop} -> From ! ok after 450000 -> DeadUserList = lists:filter(fun(X) -> not check_process_alive(element(1, X)) end, UserList), ... end. check_process_alive(Pid) when is_pid(Pid) -> case rpc:call(node(Pid), erlang, is_process_alive, [Pid]) of true -> true; _ -> false end. Thanks! Jordan Wilberding Kithsiri wrote: > Hi all, > I'm try to find whether the connection to a remote node is present > or not. For that I used > node.ping("remote",2000). I used a timeout period because i want fast > reply from remote node. It give reply soon when connection is present, > but it is not give reply within timeout period if the connection failed. > Can someone please give me a way to check the connection state within a > limited period of time. > > Thank You, > Kithsiri. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From xpdoka@REDACTED Wed Nov 1 18:50:25 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Wed, 1 Nov 2006 18:50:25 +0100 (CET) Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <1162248862.26664.299.camel@matt.sipphone.com> Message-ID: <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> Hi Eric, > Shouldn't that debate happen then? Having this quasi > experimental aspect of the language that some find useful > and some don't that may or may not go away seems to be a > problem. I agree, although in fact the debate keeps coming back. I'll reiterate the points I made several years ago, and then I suppose I should put my energy into providing the alternative solution ;-) Sean pointed out: > It looks a bit like Java and is therefore not to the taste > of many hardcore Erlang hackers. Yes, but it's not just snobbery: I worked for years with C++ namespaces and Java packages, and they have problems that I would not like to relive with Erlang. The current Erlang package system confuses several issues: - avoiding module name clashes - grouping related modules together logically (semantically) - grouping related modules together physically (file system) NAME CLASHES ------------ Using packages to avoid name clashes has two flaws: 1) it only reduces the likelyhood of a name clash, and if one occurs nevertheless you are back to square one; 2) it forces you to deal all the time with a problem that may never occur, or rarely occurs. Both of these are because the problem is being dealt with at the wrong time. Name clashes should not be avoided before they occur, they should be resolved if and when they occur. SEMANTIC STRUCTURE ------------------ There is something to be said for being able to use the same name in different contexts, being able to distinguish them when necessary but not bother when in a given context. For example, Graphic.Train (a graphical UI object) and Radio.Train (representing a radio connection with a train): it's nice to call them both Trains, and not to need to specify Radio all the time in the rest of the Radio code. This comes up a lot in object-oriented designs, but in Erlang, I am not so sure. Modules don't map to classes. Modules are already closer to what packages can be used for from a design perspective. In any case, the name clash avoidance situation comes and spoils this otherwise legitimate use of packages, because: 1) to further reduce the chance of clash, no one resists the temptation of introducing additional levels (company name, product, ...) which have NO value in terms of describing the design and NEGATIVE value in terms of making the code clearer. 2) because packages encourage you to think about this kind of structure too soon, the package organisation is usually too complex and often does not even map to the code dependencies. PHYSICAL STRUCTURE ------------------ Forcing the package structure to be mapped to a directory structure is a real pain. First, the directory structure becomes so much more complex. It's not only in the editor (I am not an Emacs newbie, and I use tags - although I haven't checked if they work with packages yet), it's also all the rest: things you do in the shell, scripts, makefiles, version management... Richard O'Keefe argued that it's even a mistake to force any mapping onto the filesystem (even module names): http://www.erlang.org/ml-archive/erlang-questions/200309/msg00044.html Ideally, I would like Erlang to have no files at all, like Smalltalk. In a sense, any kind of mapping seems contrary to this ideal. On the other hand, I suppose writing tools that hide the filesystem is easier if the tools can make strong assumptions about the organisation of files. ALTERNATIVE SOLUTIONS --------------------- The simplest way to resolve name clashes after they occur is to rename one of the modules. Better support for automated refactoring would make this easy, and I guess that covers 99% of the name clash situations. Beyond that, the most elegant solutions to these issues were pinpointed by Bertrand Meyer and are implemented in the Eiffel language. Regarding logical organisation, he points out that a language's basic organisational unit (the class in Eiffel, the module in Erlang) is itself sufficient to express multiple, nested levels. To group several modules together logically, use a module: it can provide a simplified, or unified, or modified, or concatenated, or whatever, facade for the group of related modules. I admit that this argument is a bit stronger in Eiffel, where you can use inheritance (including multiple inheritance without the pain). In Erlang, you'd have to hand-code all the delegation of function calls to the other modules. In practice though, you rarely need to do this for all functions, and providing a simplified front-end is enough. Regarding name clashes, Eiffel has a system to resolve name clashes once they occur: you can locally, in a class or a group of classes, rename another class and use it under a different name. In Erlang, that would amount to being able to add a: -rename("external/foo", bar). attribute to a foo module to allow it to refer to another foo module as bar, or as a compile option to allow an entire application to use bar to refer to a foo module from another application. Note that this mechanism can do more than just solve name clashes: it can be used to make code clearer when a module name that made sense in its original context gets used in a different context. It has been argued that this mechanism would be difficult to implement in Erlang: http://www.erlang.org/ml-archive/erlang-questions/200309/msg00045.html I find it hard to believe it would be impossible, though it might require modifications in the runtime system. Even if a renaming mechanism is too difficult to implement, I don't think packages system in its current form is satisfactory and I vote for it not to be officially adopted. Regards, Dominic Williams http://www.dominicwilliams.net ---- From sean.hinde@REDACTED Wed Nov 1 19:43:46 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 1 Nov 2006 18:43:46 +0000 Subject: [erlang-questions] Package Support/Use In-Reply-To: <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> Message-ID: <818A39B8-62B0-4F8B-8DAD-3A9721E7E74C@gmail.com> On 1 Nov 2006, at 17:50, Dominic Williams wrote: Lots of good stuff.. > > 1) it only reduces the likelyhood of a name clash, and if > one occurs nevertheless you are back to square one; Absolutely. I would even go as far as to argue that it is a hidden benefit for community projects to have a single flat namespace. The Erlang world does not need 3 projects with the module name 'http_client', or 2 projects with the module 'ssh_cm'. If a name clash helps to consolidate even 1 such project into a single stronger code base then it has been a benefit. > > In any case, the name clash avoidance situation comes and > spoils this otherwise legitimate use of packages, because: > > 1) to further reduce the chance of clash, no one resists the > temptation of introducing additional levels (company > name, product, ...) which have NO value in terms of > describing the design and NEGATIVE value in terms of > making the code clearer. > > 2) because packages encourage you to think about this kind > of structure too soon, the package organisation is > usually too complex and often does not even map to the > code dependencies. Great points. Totally agree. It is hard enough to get into an existing large project without heavily misleading historical organisational cruft. > > Ideally, I would like Erlang to have no files at all, like > Smalltalk. In a sense, any kind of mapping seems contrary to > this ideal. On the other hand, I suppose writing tools that > hide the filesystem is easier if the tools can make strong > assumptions about the organisation of files. Here I disagree. I very much like the simple mapping of 1 module == 1 file with the same name. Every layer of indirection is another thing to distract from the difficult enough business of writing clean elegant and correct code. > > Even if a renaming mechanism is too difficult to implement, > I don't think packages system in its current form is > satisfactory and I vote for it not to be officially adopted. One more Vote from me. Great post! Sean From cyberlync@REDACTED Wed Nov 1 21:06:40 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 1 Nov 2006 12:06:40 -0800 Subject: [erlang-questions] Package Support/Use In-Reply-To: <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> Message-ID: I am going to try to answer some of this. On 11/1/06, Dominic Williams wrote: > Hi Eric, > > Sean pointed out: > > > It looks a bit like Java and is therefore not to the taste > > of many hardcore Erlang hackers. > > Yes, but it's not just snobbery: I worked for years with C++ > namespaces and Java packages, and they have problems that I > would not like to relive with Erlang. > > The current Erlang package system confuses several issues: > > - avoiding module name clashes > > - grouping related modules together logically > (semantically) > > - grouping related modules together physically (file > system) > > NAME CLASHES > ------------ > > Using packages to avoid name clashes has two flaws: > > 1) it only reduces the likelyhood of a name clash, and if > one occurs nevertheless you are back to square one; Very true. However, it does does a reasonably good job of reducing the the likelihood. As we have seen so often in the past, many times a 'Good Enough' solution that is available now is better then a perfect solution that might be available at some point in the (distant) future. > 2) it forces you to deal all the time with a problem that > may never occur, or rarely occurs. True as well. However, packages have other benefits that reduce the onerousness of this task. > Both of these are because the problem is being dealt with at > the wrong time. Name clashes should not be avoided before > they occur, they should be resolved if and when they occur. I would like to see an example of this that works when the name clashes are between third party modules. > > SEMANTIC STRUCTURE > ------------------ > > There is something to be said for being able to use the same > name in different contexts, being able to distinguish them > when necessary but not bother when in a given context. For > example, Graphic.Train (a graphical UI object) and > Radio.Train (representing a radio connection with a train): > it's nice to call them both Trains, and not to need to > specify Radio all the time in the rest of the Radio code. > > This comes up a lot in object-oriented designs, but in > Erlang, I am not so sure. Modules don't map to > classes. Modules are already closer to what packages can be > used for from a design perspective. It has very little to do with classes and everything to do with contexts. Erlang has just as much context as any other language. A 'worker_supervisor' in one application (or even one context) may be doing a completely different thing then a 'worker_supervisor' in another. > In any case, the name clash avoidance situation comes and > spoils this otherwise legitimate use of packages, because: > > 1) to further reduce the chance of clash, no one resists the > temptation of introducing additional levels (company > name, product, ...) which have NO value in terms of > describing the design and NEGATIVE value in terms of > making the code clearer. True, however, this is a sociological issue not a technical one. It also depends very much on standards a community has set. We have the power to set our one standards on what is the right and wrong way to name packages. > > 2) because packages encourage you to think about this kind > of structure too soon, the package organisation is > usually too complex and often does not even map to the > code dependencies. Very true, once again its a sociological problem rather then a technical one. I don't actually have a solution here except to encourage people to not do this. I will say that bringing up problems these types of sociological problems isn't very helpful. Saying that users will do this or users will do that is just hand waving. User might do that and some users probably will, but that doesn't imply that they can't be lead in the right direction. > PHYSICAL STRUCTURE > ------------------ > > Forcing the package structure to be mapped to a directory > structure is a real pain. I tend to agree with you here, but I am somewhat mixed on the issue. > First, the directory structure becomes so much more > complex. It's not only in the editor (I am not an Emacs > newbie, and I use tags - although I haven't checked if they > work with packages yet), it's also all the rest: things you > do in the shell, scripts, makefiles, version management... > > Richard O'Keefe argued that it's even a mistake to force any > mapping onto the filesystem (even module names): > > http://www.erlang.org/ml-archive/erlang-questions/200309/msg00044.html > > Ideally, I would like Erlang to have no files at all, like > Smalltalk. In a sense, any kind of mapping seems contrary to > this ideal. On the other hand, I suppose writing tools that > hide the filesystem is easier if the tools can make strong > assumptions about the organisation of files. I have to disagree with you here. The filesystem is the lingua franca of all developement releated tools. Editors, version control systems, differs, etc all speak to each other via the filesystem. Once you remove the filesystem you remove the ability to use all of these other systems and you end up reimplenting poor copies of them your your environments world. This is an old old argument that has been rehashed over and over again in the various lists. Its not worth rehashing here. Suffice it to say that modules are currently intrinsically tied to the filesystem. This is unlikely to change anytime soon so continuing the trend shouldn't be an issue. > ALTERNATIVE SOLUTIONS > --------------------- > > The simplest way to resolve name clashes after they occur is > to rename one of the modules. Better support for automated > refactoring would make this easy, and I guess that covers > 99% of the name clash situations. This works well only if you control the entire code base. If I pull module A from one open source project and module B from another I don't want to change anything in module A or B. Touching files in either invalidates all the tests that may have been run and it gives me a local version that I now have to maintain. Neither of these things are acceptable. > [snip good arguments for an eiffelish approach] There are any number of very large problems with this approach in erlang. Registered proc names alone would make this difficult and Vlad sites quite a few more issues in his response. In any case, all of this is blue sky and would take a huge amount of effort on the part of the implementors and change the semantics of the language to some extent for the users. Given the resources Ericsson devotes to Erlang this might have a chance of happening sometime in the distant future. Packages are available now and the work. This is the pragmatic approach that Erlang has always taken there isn't any reason not to take this approach again. > Even if a renaming mechanism is too difficult to implement, > I don't think packages system in its current form is > satisfactory and I vote for it not to be officially adopted. > > Regards, > > Dominic Williams > http://www.dominicwilliams.net > > ---- > > > > From cyberlync@REDACTED Wed Nov 1 21:15:28 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 1 Nov 2006 12:15:28 -0800 Subject: [erlang-questions] Package Support/Use In-Reply-To: <818A39B8-62B0-4F8B-8DAD-3A9721E7E74C@gmail.com> References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> <818A39B8-62B0-4F8B-8DAD-3A9721E7E74C@gmail.com> Message-ID: On 11/1/06, Sean Hinde wrote: > > On 1 Nov 2006, at 17:50, Dominic Williams wrote: > > Lots of good stuff.. > > > Absolutely. I would even go as far as to argue that it is a hidden > benefit for community projects to have a single flat namespace. The > Erlang world does not need 3 projects with the module name > 'http_client', or 2 projects with the module 'ssh_cm'. This is a pretty arbitrary statement. I am not sure it holds water. There is nothing wrong with different projects implementing the same thing. We already have two http client applications and two web servers, etc. It so happens that the libs shipped with otp are well known so name clashes weren't an issue. However, as the foss community grows it becomes very likely that projects may not know about one another or worse come up with the same name for different functionality. Its not hard to see that happening. > If a name clash helps to consolidate even 1 such project into a > single stronger code base then it has been a benefit. No it hasn't. The main problem is that these clashes aren't necessarily visible during creation of the projects. The become visible only after some third party user tries to use them together. Once that happens the third party user has very little recourse in how he moves forward. > > > > In any case, the name clash avoidance situation comes and > > spoils this otherwise legitimate use of packages, because: > > > > 1) to further reduce the chance of clash, no one resists the > > temptation of introducing additional levels (company > > name, product, ...) which have NO value in terms of > > describing the design and NEGATIVE value in terms of > > making the code clearer. > > > > 2) because packages encourage you to think about this kind > > of structure too soon, the package organisation is > > usually too complex and often does not even map to the > > code dependencies. > > Great points. Totally agree. It is hard enough to get into an > existing large project without heavily misleading historical > organisational cruft. Organizational cruft always exists. Providing deeper directory structure isn't going to add significantly to it. From ulf@REDACTED Wed Nov 1 22:04:26 2006 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 01 Nov 2006 22:04:26 +0100 Subject: [erlang-questions] Package Support/Use: Episode IV - A New Hope In-Reply-To: <454904B5.3030809@bredband.net> References: <96EEE65C-11BE-4A20-93CC-5FA018BCD516@gmail.com> <454904B5.3030809@bredband.net> Message-ID: Den 2006-11-01 21:33:57 skrev Richard Carlsson : > I know that Ulf has tried out packages pretty > extensively before, but only in open source side projects as far as I > know. So there you have it: Well, this is (will be) an Open Source project too. /-: (I'm not sure in which way this is bad, though.) Anyway, erlhive's use of packages is ... different. It's sort of a community framework, where the calling convention for using other user's modules is erlhive.User.Module (If you want to use package names inside your own account, the dotted parts could just trail off into the sunset on the right side. It still starts with e.g. erlhive.uwiger...) Of course, modules are not stored in a file structure, but in the database (where else?) (I do allow the module name to be non-dotted, and erlhive makes it a dotted name anyway. The reason for this was to simplify copying of modules between user accounts.) So, I had an obvious namespace problem, and instead of doing arbitrary atom munging in the background, packages seemed the obvious solution. BR, Ulf W -- Ulf Wiger From qrilka@REDACTED Wed Nov 1 22:23:39 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 2 Nov 2006 00:23:39 +0300 Subject: [erlang-questions] Questions about Erlang documentation Message-ID: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Investigating Erlang official documents I see a moment which I do not understand: In a lot of chapters I see something like "gen_server(3)" mentioned (That's from http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/gen_server.html ). The first thought was about functions and their arity, but that's not a function of course. So what exactly is this? And one more question: I occasionally find misprints in docs - Is there any email where I should send information about them? BR, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Wed Nov 1 22:43:02 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 1 Nov 2006 21:43:02 +0000 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <7AD73596-1176-4079-9199-3787EAFFE160@gmail.com> On 1 Nov 2006, at 21:23, Kirill Zaborski wrote: > Investigating Erlang official documents I see a moment which I do > not understand: > In a lot of chapters I see something like "gen_server(3)" mentioned > (That's from http://www.erlang.org/doc/doc-5.5.1/doc/ > design_principles/gen_server.html ). The first thought was about > functions and their arity, but that's not a function of course. So > what exactly is this? This follows the UNIX convention of including the man page chapter in parentheses after the name. If you have downloaded and installed the erlang man pages tar you can do: % erl -man gen_server gen_server(3) ERLANG MODULE DEFINITION gen_server(3) MODULE gen_server - Generic Server Behaviour DESCRIPTION A behaviour module for implementing the server of a client- server rela- tion. A generic server process (gen_server) implemented using this mod- ule will have a standard set of interface functions and include func-...... > And one more question: I occasionally find misprints in docs - Is > there any email where I should send information about them? You could send them to erlang-bugs@REDACTED, where with luck and a following wind they will raise to the top of the priority list of someone at Ericsson. BR, Sean From taavi@REDACTED Wed Nov 1 22:44:19 2006 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 1 Nov 2006 23:44:19 +0200 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: On Nov 1, 2006, at 11:23 PM, Kirill Zaborski wrote: > In a lot of chapters I see something like "gen_server(3)" mentioned > (That's from > http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/ > gen_server.html ). The first thought was about functions and their > arity, but that's not a function of course. So what exactly is this? Typical unix'ism: man 3 gen_server http://www.december.com/unix/ref/mansec.html Manual section 3 is "library" and gen_server is part of erlang/OTP library. best regards, taavi From lennart.ohman@REDACTED Wed Nov 1 22:44:58 2006 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Wed, 1 Nov 2006 22:44:58 +0100 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <000701c6fdfe$fa3c8ab0$0200a8c0@st.se> Hi, I believe the (3) notation should be read section 3 as in traditional UNIX man-pages, where section 3 was (is) library functions. Best Regards Lennart ------------------------------------------------------------- Lennart Ohman office : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 67 35 Sehlstedtsgatan 6 fax : +46-8-667 82 30 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Kirill Zaborski > Sent: Wednesday, November 01, 2006 10:24 PM > To: erlang-questions List > Subject: [erlang-questions] Questions about Erlang documentation > > Investigating Erlang official documents I see a moment which I do not > understand: > In a lot of chapters I see something like "gen_server(3)" mentioned > (That's from http://www.erlang.org/doc/doc- > 5.5.1/doc/design_principles/gen_server.html > 5.5.1/doc/design_principles/gen_server.html> ). The first thought was > about functions and their arity, but that's not a function of course. So > what exactly is this? > And one more question: I occasionally find misprints in docs - Is there > any email where I should send information about them? > > BR, > Kirill. From vladdu55@REDACTED Wed Nov 1 22:46:22 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 1 Nov 2006 21:46:22 +0000 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <95be1d3b0611011346r136654bdxc886a19cf1da9bda@mail.gmail.com> On 11/1/06, Kirill Zaborski wrote: > In a lot of chapters I see something like "gen_server(3)" mentioned (That's > from > http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/gen_server.html > ). The first thought was about functions and their arity, but that's not a > function of course. So what exactly is this? Hi, That is a reference to the man page, which can be seen under non-Windows OS:s with for example erl -man gen_server The man page contains exactly the same information as the html documentation. best regards, Vlad From rpettit@REDACTED Wed Nov 1 22:46:24 2006 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 1 Nov 2006 15:46:24 -0600 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <20061101214624.GH25292@vailsys.com> On Thu, Nov 02, 2006 at 12:23:39AM +0300, Kirill Zaborski wrote: > Investigating Erlang official documents I see a moment which I do not > understand: > In a lot of chapters I see something like "gen_server(3)" mentioned (That's > from > http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/gen_server.html ). > The first thought was about functions and their arity, but that's not a > function of course. So what exactly is this? In the UNIX world something of the form: foo(N) in documentation typically refers to the man page for "foo" in section "N", as in gen_server(3) which is the man page for the gen_server module in section 3 of the erlang manual. -Rick From qrilka@REDACTED Wed Nov 1 22:48:25 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 2 Nov 2006 00:48:25 +0300 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <7AD73596-1176-4079-9199-3787EAFFE160@gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> <7AD73596-1176-4079-9199-3787EAFFE160@gmail.com> Message-ID: <337538cb0611011348p451db5b8k2dbd15156dfa128d@mail.gmail.com> Well, thanks Sean. Too much Windows habits I have :) Must install Linux... Must intall Linux... On 11/2/06, Sean Hinde wrote: > > > On 1 Nov 2006, at 21:23, Kirill Zaborski wrote: > > > Investigating Erlang official documents I see a moment which I do > > not understand: > > In a lot of chapters I see something like "gen_server(3)" mentioned > > (That's from http://www.erlang.org/doc/doc-5.5.1/doc/ > > design_principles/gen_server.html ). The first thought was about > > functions and their arity, but that's not a function of course. So > > what exactly is this? > > This follows the UNIX convention of including the man page chapter in > parentheses after the name. If you have downloaded and installed the > erlang man pages tar you can do: > > % erl -man gen_server > > gen_server(3) ERLANG MODULE DEFINITION > gen_server(3) > > MODULE > gen_server - Generic Server Behaviour > > DESCRIPTION > A behaviour module for implementing the server of a client- > server rela- > tion. A generic server process (gen_server) implemented using > this mod- > ule will have a standard set of interface functions and > include func-...... > > > > And one more question: I occasionally find misprints in docs - Is > > there any email where I should send information about them? > > You could send them to erlang-bugs@REDACTED, where with luck and a > following wind they will raise to the top of the priority list of > someone at Ericsson. > > BR, > Sean > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Nov 1 22:49:42 2006 From: bob@REDACTED (Bob Ippolito) Date: Wed, 1 Nov 2006 13:49:42 -0800 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <6a36e7290611011349n7b81990arf868f6e4942613a6@mail.gmail.com> On 11/1/06, Kirill Zaborski wrote: > Investigating Erlang official documents I see a moment which I do not > understand: > In a lot of chapters I see something like "gen_server(3)" mentioned (That's > from > http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/gen_server.html > ). The first thought was about functions and their arity, but that's not a > function of course. So what exactly is this? > And one more question: I occasionally find misprints in docs - Is there any > email where I should send information about them? Looks like it's referring to a man page. -bob From kruegger@REDACTED Thu Nov 2 00:34:03 2006 From: kruegger@REDACTED (Stephen Han) Date: Wed, 1 Nov 2006 15:34:03 -0800 Subject: [erlang-questions] job openings Message-ID: <86f1f5350611011534na471269oe157dfff2a17e6e6@mail.gmail.com> Hi We have job openings for Erlang programmer, knowing erlang is definitely plus. http://jobsearch.monster.com/getjob.asp?JobID=47564154&AVSDM=2006%2D10%2D10+13%3A57%3A54&Logo=1&JobTitle=NVG+Senior+Networ%2E%2E%2E&q=erlang&sort=rv&vw=b&brd=1&cy=US&Image1.x=0&Image1.y=0&dcjvlid=883 regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Nov 2 02:40:06 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 2 Nov 2006 14:40:06 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> "Eric Merritt" praised packages: Package names offer a well understood and well tested solution to this problem. They are even in the language right now, but their unsupported (going away any time) status makes them unusable. Package names may be well understood, but one of the things we understand about them is that they are wrong, as in "inside-out, back-to-front, and going away from you on the other side" (Goon Show quote). What do I mean? Let's take a tiny example where we have a "master" module 'arnold' and some supporting modules 'betty' and 'cody'. What we really want to do is to wrap them up somehow and expose onle 'arnold': -flotilla(arnold). -module(arnold, "src/arnold.erl"). -module(betty, "src/betty.erl"). -module(cody, "src/cody.erl"). -export(arnold, [start/0,serve/1,stop/0]). >From the outside, this flotilla looks like a single module exporting some functions. On the inside, arnold, betty, and cody can refer to each other directly by simple names. They can also refer to "pervasive" modules from Erlang/OTP by simple names. What happens if we use Java-style package names? First, we have to choose a single GLOBALLY usable package name. For example, I might have to use nz.ac.otago.cs.ok.arnold nz.ac.otago.cs.ok.betty nz.ac.otago.cs.ok.cody and now the modules have to refer to each other by these complex names. They don't have to mention these names repeatedly (given the preprocessor, that's obvious), but they do have to mention the prefix at least once. Now we have a maintenance problem and a forgery problem. The forgery problem is that nothing actually stops anyone using any module name they like. There is no REAL difference between nz.ac.otago.cs.ok.arnold and nz_ac_otago_cs_ok_arnold; one uses dots and the other uses underscores. Big deal. Someone else decides to use nz.ac.otago.cs.ok for some modules? Just what is there to stop them? There is NOTHING that can stop someone reusing one of my dotted module names for something else. Just as any Erlang programmer anywhere can use nz_ac_otago_cs_ok_arnold, so any Erlang programmer anywhere can use nz.ac.otago.cs.ok.arnold. The maintenance problem is that if I want to copy some modules into another package, I have to hunt down and rename all the dotted names. Of course that's true with underscore prefixes as well; the point is that dotted names fail to provide any advantage here. Basically, there are three kinds of module names we want to use: - module names in our own application/flotilla/cluster. These names need to be RELATIVE, so that the entire thing can be moved around with at most one change in one file. - names for modules provided by Erlang/OTP itself. These names are very common and need to be short, but we don't want new names added here to conflict with our own names. - names for other applications/flotillas/clusters. For these we typically need some kind of ABSOLUTE name. The problem with the present Erlang language is that there is a single global name space for modules. The fundamental problem with package names is that they don't change that: there is still a single global name space for modules, except now module names can contain dots as well as underscores. Big deal. No, what we need to do is to reify module name spaces and allow more than one of them. They should be actual run time data structures that can be explored. From ok@REDACTED Thu Nov 2 03:07:51 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 2 Nov 2006 15:07:51 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use: Episode IV - A New Hope Message-ID: <200611020207.kA227p63226005@atlas.otago.ac.nz> "Ulf Wiger" wrote: Anyway, erlhive's use of packages is ... different. It's sort of a community framework, where the calling convention for using other user's modules is erlhive.User.Module How fortunate you are to have no name clashes amongst Users! One year when I was an undergraduate at the University of Auckland, I got my exam results in the mail as usual. I opened the letter cheerfully, and got a nasty shock. C, C-, D, F, what the heck? How could I possibly have done so badly? Hang on a bit, I didn't sit in any of those papers! Yes, there was another Richard O'Keefe. Now that's in one city with about 800 000 people. Extrapolate that to the whole population of web users. Pity the Smiths, Changs, and Singhs of this world! What this means in practice of course is that the names used in the dotted module names (for which erlhive_User_Module would have been every bit as good) have to be managed by erlhive and cannot be freely chosen by users. In fact, you might as well maintain a data base mapping users to surrogates (as in William Kent's "Data and Reality") and the surrogates might as well be 7 base-36 digits assigned at random. (Enough to give everyone on the planet 13 surrogates.) From rsaccon@REDACTED Thu Nov 2 08:14:50 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 2 Nov 2006 04:14:50 -0300 Subject: [erlang-questions] ErlyWeb In-Reply-To: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> Message-ID: I tried to integrate erlyweb into the webapp I am building, and I am facing currently the following problems: erlyweb:compile(AppRoot, Options) compiles everything in the src-directory, but ignores the {i, MyIncludeDir} option I try to set. And I have many modules with a JSON entrypoint and so far I compiled them automatically with eclipse erlide (on file save), and I would like to keep that. Wouldn't it make sense that erlyweb:compile just compiles those files created with erlyweb ? erlyweb seems currently to be tied to SQL databases (I hope I am wrong). I have a fast clustered cache (still in early development) and a slow BerkleyDB-like persistent storage (Amazon S3) and I need figure out how to make an erlydb version for such needs. Any thoughts on that ? What is the roadmap for erlydb ? regards -- Roberto Saccon From kithsiri@REDACTED Thu Nov 2 08:32:59 2006 From: kithsiri@REDACTED (Kithsiri) Date: Thu, 02 Nov 2006 13:32:59 +0600 Subject: [erlang-questions] Checking the Connection In-Reply-To: References: <454882EC.8090601@wavenet.lk> Message-ID: <45499F2B.4060605@wavenet.lk> Christian S wrote: > There is erlang:monitor_node(Node, Flag) > > I dont know how often and what ping time erlang distribution uses to > classify a node as alive or down. > > Hi all, Thanks for replies. But I have a Java API which connect to a remote Erlang node through a VPN. I created a Erlang node in Java API OtpNode node = new OtpNode("gurka"); (Erlang documentation - jinterface) and I want to get the state of the VPN connection quickly. If the VPN connection is present node.ping("remote",2000) (Erlang documentation - jinterface) will give response (true) quickly. If connection is down it should give response (false) within 2 seconds. But the problem is it hangs around 1 minute to give response. But I need to know the state of the connection within few seconds from a java node. Now I think you all understand my question. Any suggestions greatly appreciated. Thanks, Kithsiri. From nils.muellner@REDACTED Thu Nov 2 08:59:23 2006 From: nils.muellner@REDACTED (=?ISO-8859-15?Q?Nils_M=FCllner?=) Date: Thu, 02 Nov 2006 08:59:23 +0100 Subject: [erlang-questions] 2 questions Message-ID: <4549A55B.5090408@heh.uni-oldenburg.de> hi, i have two questions: 1: is there a standard ide? currently i use erlide plugin for eclipse, but i don't find the debugger implemented in there... 2: as i have to import every module i'd like to use, i wanted to ask, if there is a nice way to browse one folder for possible modules, list them and then let the user choose one without the need to import them all. reason: of my program is extended later, it would be nice to be able to write modules that are automatically detected. kind regards, nils From vladdu55@REDACTED Thu Nov 2 09:35:37 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 2 Nov 2006 09:35:37 +0100 Subject: [erlang-questions] 2 questions In-Reply-To: <4549A55B.5090408@heh.uni-oldenburg.de> References: <4549A55B.5090408@heh.uni-oldenburg.de> Message-ID: <95be1d3b0611020035x4cc96426w68374b2a9cac631d@mail.gmail.com> Hi, On 11/2/06, Nils M?llner wrote: > 1: is there a standard ide? currently i use erlide plugin for > eclipse, but i don't find the debugger implemented in there... The standard IDE is still Emacs. We're working on erlide, but there's still a lot to do. The debugger is the next big feature that we are targeting, but I can't give a time estimate now. > 2: as i have to import every module i'd like to use, i wanted to > ask, if there is a nice way to browse one folder for possible modules, > list them and then let the user choose one without the need to import > them all. reason: of my program is extended later, it would be nice to > be able to write modules that are automatically detected. I'm not sure what you mean. One doesn't *have* to import any module, just use Module:Function(). The only thing importing does is let you write less text (i.e. just Function()), at the price of having to worry about function name clashes. best regards, Vlad From ke.han@REDACTED Thu Nov 2 09:41:10 2006 From: ke.han@REDACTED (ke han) Date: Thu, 2 Nov 2006 16:41:10 +0800 Subject: [erlang-questions] ErlyWeb In-Reply-To: References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> Message-ID: <04E14815-ACCD-46F1-8796-964F9137CE99@redstarling.com> On Nov 2, 2006, at 3:14 PM, Roberto Saccon wrote: > I tried to integrate erlyweb into the webapp I am building, and I am > facing currently the following problems: > > erlyweb:compile(AppRoot, Options) compiles everything in the > src-directory, but ignores the {i, MyIncludeDir} option I try to set. > And I have many modules with a JSON entrypoint and so far I compiled > them automatically with eclipse erlide (on file save), and I would > like to keep that. Wouldn't it make sense that erlyweb:compile just > compiles those files created with erlyweb ? It is very important that erlyweb allow static HTML and yaws code to co-exist (both in the same yaws docroot and in the same ebin and src directories). Perhaps the current compile utils are overly presumptuous? I hope any current limitations will get addressed quickly as this would greatly hinder my usage. Its ok that erlyweb doesn't do everything in its early releases, but it does need to ensure users can code around limitations. > > erlyweb seems currently to be tied to SQL databases (I hope I am > wrong). I have a fast clustered cache (still in early development) and > a slow BerkleyDB-like persistent storage (Amazon S3) and I need figure > out how to make an erlydb version for such needs. Any thoughts on that > ? What is the roadmap for erlydb ? Don't want to speak too much for Yariv, but ;-) its my understanding erlyweb is fairly well decoupled from the models it uses (or at least intended to be). This also means the models you use can use whatever data retrieval solutions you like. ke han > > regards > -- > Roberto Saccon > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From ke.han@REDACTED Thu Nov 2 09:54:31 2006 From: ke.han@REDACTED (ke han) Date: Thu, 2 Nov 2006 16:54:31 +0800 Subject: [erlang-questions] 2 questions In-Reply-To: <4549A55B.5090408@heh.uni-oldenburg.de> References: <4549A55B.5090408@heh.uni-oldenburg.de> Message-ID: <1119387A-5AE4-4462-9373-705A2FB9605C@redstarling.com> On Nov 2, 2006, at 3:59 PM, Nils M?llner wrote: > hi, > i have two questions: > 1: is there a standard ide? currently i use erlide plugin for > eclipse, but i don't find the debugger implemented in there... nope...your best bets are erlide, vim plugins or emacs (which apparently is very useful if you know how to use it ;)). I always use the debugger built into erlang alongside my standard editor (TextMate) or erlide. Not sure how/if an eclipse compliant debugger could be done for erlide. > 2: as i have to import every module i'd like to use, i wanted to > ask, if there is a nice way to browse one folder for possible modules, > list them and then let the user choose one without the need to import > them all. reason: of my program is extended later, it would be nice to > be able to write modules that are automatically detected. not really sure what you mean...the way I handle things is to simply put my custom libraries in either the core erlang/OTP lib directory or have a separate lib directory and start up the erlang vm referencing this additional path. This method ensures your modules are easily referencable within the vm and erlang shell. if your referring to the way the debugger works, I don't have any good advice for you as I find the debugger not friendly for choosing modules. I make it a practice to always compile my code with debug info so its ready when I need it. ke han > > kind regards, > nils > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From qrilka@REDACTED Thu Nov 2 10:12:32 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 2 Nov 2006 12:12:32 +0300 Subject: [erlang-questions] 2 questions In-Reply-To: <95be1d3b0611020035x4cc96426w68374b2a9cac631d@mail.gmail.com> References: <4549A55B.5090408@heh.uni-oldenburg.de> <95be1d3b0611020035x4cc96426w68374b2a9cac631d@mail.gmail.com> Message-ID: <337538cb0611020112w6d528dacwced409dfa9dd3fcd@mail.gmail.com> Are there any resources about using Erlang in Emacs? And also are there any resources about debugging Erlang (in Emacs or simply in erl)? I searched for some tutorial and it seems like there is almost nothing except documentation about dbg. On 11/2/06, Vlad Dumitrescu wrote: > > Hi, > > On 11/2/06, Nils M?llner wrote: > > 1: is there a standard ide? currently i use erlide plugin for > > eclipse, but i don't find the debugger implemented in there... > > The standard IDE is still Emacs. We're working on erlide, but there's > still a lot to do. The debugger is the next big feature that we are > targeting, but I can't give a time estimate now. > > > 2: as i have to import every module i'd like to use, i wanted to > > ask, if there is a nice way to browse one folder for possible modules, > > list them and then let the user choose one without the need to import > > them all. reason: of my program is extended later, it would be nice to > > be able to write modules that are automatically detected. > > I'm not sure what you mean. One doesn't *have* to import any module, > just use Module:Function(). The only thing importing does is let you > write less text (i.e. just Function()), at the price of having to > worry about function name clashes. > > best regards, > Vlad > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yarivvv@REDACTED Thu Nov 2 13:21:40 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 2 Nov 2006 07:21:40 -0500 Subject: [erlang-questions] ErlyWeb In-Reply-To: References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> Message-ID: <17244f480611020421x65e72ad6r7a292f6569cd2ee3@mail.gmail.com> On 11/2/06, Roberto Saccon wrote: > I tried to integrate erlyweb into the webapp I am building, and I am > facing currently the following problems: > > erlyweb:compile(AppRoot, Options) compiles everything in the > src-directory, but ignores the {i, MyIncludeDir} option I try to set. > And I have many modules with a JSON entrypoint and so far I compiled > them automatically with eclipse erlide (on file save), and I would > like to keep that. Wouldn't it make sense that erlyweb:compile just > compiles those files created with erlyweb ? I will look into that, thanks. I'm also going to try to allow for automatic compilation in dev mode. > > erlyweb seems currently to be tied to SQL databases (I hope I am > wrong). I have a fast clustered cache (still in early development) and > a slow BerkleyDB-like persistent storage (Amazon S3) and I need figure > out how to make an erlydb version for such needs. Any thoughts on that > ? What is the roadmap for erlydb ? Actually, ErlyWeb doesn't require ErlyDB. Just keep your models outside of src/components and you'll be able to use them directly. The only ErlyDB integration point is in the compilation phase (and when you're using -erlyweb_magic(on).), so yes, it is quite decoupled. Cheers, Yariv From serge@REDACTED Thu Nov 2 13:43:36 2006 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 02 Nov 2006 07:43:36 -0500 Subject: [erlang-questions] 2 questions In-Reply-To: <337538cb0611020112w6d528dacwced409dfa9dd3fcd@mail.gmail.com> References: <4549A55B.5090408@heh.uni-oldenburg.de> <95be1d3b0611020035x4cc96426w68374b2a9cac631d@mail.gmail.com> <337538cb0611020112w6d528dacwced409dfa9dd3fcd@mail.gmail.com> Message-ID: <4549E7F8.10804@hq.idt.net> Kirill Zaborski wrote: > Are there any resources about using Erlang in Emacs? > And also are there any resources about debugging Erlang (in Emacs or simply > in erl)? I searched for some tutorial and it seems like there is almost > nothing except documentation about dbg. Debugger: http://www.erlang.org/doc/doc-5.5.1/lib/debugger-3.1/doc/html/part_frame.html http://www.erlang.org/doc/doc-5.5.1/lib/debugger-3.1/doc/html/index.html Erlang offers a very powerful tracing facility. In fact, once you are accustomed to it, you will rarely need to use a debugger. The dbg tracing docs are here: http://www.erlang.org/doc/doc-5.5.1/lib/runtime_tools-1.6/doc/html/dbg.html Yet, the example of dbg is documented in a rather non-intuitive place (scroll closer to the middle of the page): http://www.erlang.org/doc/doc-5.5.1/lib/stdlib-1.14.1/doc/html/ms_transform.html The link below (at the bottom of the page) has an extension of the Erlang shell that simplifies usage of tracing facility: http://forum.trapexit.org/viewtopic.php?t=6206 Serge > On 11/2/06, Vlad Dumitrescu wrote: >> >> Hi, >> >> On 11/2/06, Nils M?llner wrote: >> > 1: is there a standard ide? currently i use erlide plugin for >> > eclipse, but i don't find the debugger implemented in there... >> >> The standard IDE is still Emacs. We're working on erlide, but there's >> still a lot to do. The debugger is the next big feature that we are >> targeting, but I can't give a time estimate now. >> >> > 2: as i have to import every module i'd like to use, i wanted to >> > ask, if there is a nice way to browse one folder for possible modules, >> > list them and then let the user choose one without the need to import >> > them all. reason: of my program is extended later, it would be nice to >> > be able to write modules that are automatically detected. >> >> I'm not sure what you mean. One doesn't *have* to import any module, >> just use Module:Function(). The only thing importing does is let you >> write less text (i.e. just Function()), at the price of having to >> worry about function name clashes. >> >> best regards, >> Vlad >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From yarivvv@REDACTED Thu Nov 2 14:12:58 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Thu, 2 Nov 2006 08:12:58 -0500 Subject: [erlang-questions] ErlyWeb In-Reply-To: <04E14815-ACCD-46F1-8796-964F9137CE99@redstarling.com> References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> <04E14815-ACCD-46F1-8796-964F9137CE99@redstarling.com> Message-ID: <17244f480611020512k4cdf3cd0hd1c2d2c7f89f1700@mail.gmail.com> > > It is very important that erlyweb allow static HTML and yaws code to > co-exist (both in the same yaws docroot and in the same ebin and src > directories). Perhaps the current compile utils are overly > presumptuous? > I hope any current limitations will get addressed quickly as this > would greatly hinder my usage. > Its ok that erlyweb doesn't do everything in its early releases, but > it does need to ensure users can code around limitations. The current compile utility ignores anything that doesn't have the 'erl' or 'et' extensions. In addition, it only treats .erl files in /src/components as (ErlyDB) models or controllers. Any .erl file you have in /src will just be compiled regularly, and .yaws and .html files are ignored. When I tested it, .html and .yaws both worked -- just put them in /www. > > Don't want to speak too much for Yariv, but ;-) its my understanding > erlyweb is fairly well decoupled from the models it uses (or at least > intended to be). This also means the models you use can use whatever > data retrieval solutions you like. > ke han That's true. Just keep all .erl files that don't end with _view or _controller outside of src/components, and then you won't even have to call erlydb:start :) Cheers, Yariv From rsaccon@REDACTED Thu Nov 2 15:31:45 2006 From: rsaccon@REDACTED (Roberto Saccon) Date: Thu, 2 Nov 2006 11:31:45 -0300 Subject: [erlang-questions] ErlyWeb In-Reply-To: <17244f480611020421x65e72ad6r7a292f6569cd2ee3@mail.gmail.com> References: <17244f480610271419m793d723cj3f89e8f1e00648f7@mail.gmail.com> <17244f480611020421x65e72ad6r7a292f6569cd2ee3@mail.gmail.com> Message-ID: Thanks for the answers, I am happy to see that my assumption was wrong, about erlyweb being tied to mysql. Now I have a different problem: I have created several components which represent different pages of a website, for example the main page (to be accessed as: http://someurl/myapp/index) src/componenents/index/ contains index_contoller.erl ------------------------- -module(index_controller). -export([index/1]). index(A) -> {data, "hello world"}. index_view.erl -------------------- before <%@ index(Data) %> after I expected that after compiling with erlyweb to get a page rendered with the outer template (myapp_app_view.et) and inside the inner-template (index_view.erl) with <%@ index(Data) %> substituted by "hello world", but all I get is just the outer template. Any idea how I can get it right ? regards -- Roberto Saccon From chandrashekhar.mullaparthi@REDACTED Thu Nov 2 18:51:46 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 2 Nov 2006 17:51:46 +0000 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> Message-ID: On 02/11/06, Richard A. O'Keefe wrote: > > "Eric Merritt" praised packages: > Package names offer a well understood and well tested solution > to this problem. They are even in the language right now, but > their unsupported (going away any time) status makes them > unusable. > > Package names may be well understood, but one of the things we understand > about them is that they are wrong, as in "inside-out, back-to-front, and > going away from you on the other side" (Goon Show quote). [snipped loads of good explanation] I agree. Please let's not have packages. They are so ugly. I hated them when I first saw them in Java and it still feels the same. We once had one of our module names clash with one of OTP's module names. We renamed our module and the problem disappeared. This is once in 7 years. As Dominic Williams said earlier, they force you to deal with a problem every day which only happens once in a blue moon. Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvg@REDACTED Thu Nov 2 20:40:06 2006 From: rvg@REDACTED (Rudolph van Graan) Date: Thu, 2 Nov 2006 21:40:06 +0200 Subject: [erlang-questions] Compiler Crash and Bug? Message-ID: <4D38A7EF-60B0-41A8-ADD5-1AA2C92841F9@patternmatched.com> Hi there, The following code causes the compiler (R10B-10) to crash and to go into an infinite loop (R10B-3) like this: emr_api_SUITE: function test_listall_sub_users/1+4267: Internal consistency check failed - please report this bug. Instruction: {get_list,{x,1022},{x,1023},{x,1024}} Error: {invalid_store,{x,1024},term}: test_listall_sub_users(doc) -> ["Test api's listall for sub users"]; test_listall_sub_users(suite) -> []; test_listall_sub_users(_Config) -> [{emr_user,<<85,115,101,114,49>>,1,1,"Parent Company User" ,"Surname",1235467890123,"password",12345,"123456",true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First address line","Second Address line","Third address line","City",123}, {emr_user,<<85,115,101,114,50>>,2,2,"Second Company User" ,"Surname",3215467890123,"password",12345,"123456",true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First address line","Second Address line","Third address line","City",123}, {emr_user,<<85,115,101,114,51>>,3,3,"Third Company User" ,"Surname",2315467890123,"password",12345,"123456",true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First address line","Second Address line","Third address line","City",123}, {emr_user,<<85,115,101,114,52>>,4,4,"Second Company's Child User","Surname",1115467890123,"password",12345,"123456",true,0, {{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First address line","Second Address line","Third address line","City", 123}] = emr_api:listall_sub_users(list_to_binary("administrator")), ok. is this a known issue? Regards, Rudolph From james.hague@REDACTED Thu Nov 2 21:19:46 2006 From: james.hague@REDACTED (James Hague) Date: Thu, 2 Nov 2006 14:19:46 -0600 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> Message-ID: On 11/2/06, Chandru wrote: > > I agree. Please let's not have packages. They are so ugly. I hated them when > I first saw them in Java and it still feels the same. We once had one of our > module names clash with one of OTP's module names. We renamed our module and > the problem disappeared. This is once in 7 years. As Dominic Williams said > earlier, they force you to deal with a problem every day which only happens > once in a blue moon. I also agree. Packages are pretty in a way, but they're a heavyweight solution to a simple problem. I would much rather see some effort put into cleaning up the existing libraries. Get rid of all the pre-fun functions that use "apply." Add some obviously missing functions like revmap. Etc. James From jay@REDACTED Fri Nov 3 02:42:21 2006 From: jay@REDACTED (Jay Nelson) Date: Thu, 02 Nov 2006 17:42:21 -0800 Subject: [erlang-questions] Never let it fail! Message-ID: <454A9E7D.9040706@duomark.com> Here is an alternative to the "let it fail" philosophy. They take the opposite tack. http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf This was presented at OOPSLA 2006. jay From jay@REDACTED Fri Nov 3 02:45:17 2006 From: jay@REDACTED (Jay Nelson) Date: Thu, 02 Nov 2006 17:45:17 -0800 Subject: [erlang-questions] Never let it fail! Message-ID: <454A9F2D.8030207@duomark.com> Here's an alternative to the "let it fail" philosophy. They take the opposite tack. This was presented at OOPSLA 2006. http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf jay From bob@REDACTED Fri Nov 3 04:53:40 2006 From: bob@REDACTED (Bob Ippolito) Date: Thu, 2 Nov 2006 19:53:40 -0800 Subject: [erlang-questions] Never let it fail! In-Reply-To: <454A9E7D.9040706@duomark.com> References: <454A9E7D.9040706@duomark.com> Message-ID: <6a36e7290611021953y3d54d26fy7e36ec7cc3c4323b@mail.gmail.com> On 11/2/06, Jay Nelson wrote: > Here is an alternative to the "let it fail" philosophy. They take the > opposite tack. > > http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf > > This was presented at OOPSLA 2006. > Fail fast + supervisor restart seems like it's pretty much equivalent to being failure oblivious. Just easier to debug :) -bob From ok@REDACTED Fri Nov 3 04:57:46 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 3 Nov 2006 16:57:46 +1300 (NZDT) Subject: [erlang-questions] Never let it fail! Message-ID: <200611030357.kA33vkdM233343@atlas.otago.ac.nz> Jay Nelson drew our attention to http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf It takes guts to stand up in public and say "Can achieve previously inconceivable levels of cluelessness (and therefore functionality) in successful deployed systems" and "Software should be [...] not correct" and "If you want to reduce cost and difficulty of producing acceptable software * Make more errors acceptable * Leave more errors in system" (Or, "Everything would be fine if users would learn to love the lash.") Hey, I'm using some software like that right now. I was trying to copy and paste that text from the PDF file, viewing it in Acrobat Reader, to this plain old terminal. My keyboard has a "Copy" key; this kind of computer has had such a key for, what, 20 years? And Acrobat DOES NOT UNDERSTAND IT and doesn't understand that it doesn't understand it. Unrecognised keypresses are quietly ignored. It's only when you paste and get something from half an hour ago that you discover the cluelessness of Acrobat Reader. 10 minutes of irritation on my part, several times a week, added up over however many users. No, we are *NOT* "doing ... Great". We are creating oceans of low-level misery that we don't need to, and it's being saying "never mind the quality, read the feature list" who deserve the blame. Or take this advice: [Drat. That's the FOURTH time I've been caught by Acrobat. Why is that the ONLY program I use that doesn't understand the Copy key?] "Perform dynamic bounds checks Discard out of bounds writes Manufacture values for out of bounds reads" Telling people that their programs should be allowed to go around hallucinating certainly takes guts. I'm not sure it takes a brain. Their advice further on about hiding memory leak problems reminds me of a science fiction story I read in Analog several years ago. In outline, someone had developed a general medical treatment box -- didn't do surgery or handle broken bones, but did handle infectious diseases, cancer, and auto-immune type stuff. (Basically by using gobble-de-good to stimulate the body's own defences.) Wonderful, everyone is fine, but now there is this new social problem: Box addicts, who find they have to take a treatment every day or they don't feel well any more. Punchline: Smallpox has made a comeback, the Box addicts weren't addicts at all, they were genuinely sick, and the Box was masking their symptoms and thereby helping Smallpox to spread. I think you can see the relevance of this to the idea of *hiding* memory leaks (or any other kind of problem) instead of logging and restarting so that someone KNOWS about the problem and can fix it. These slides are starting to scare me, people. What kinds of errors do they talk about? - reading outside the bounds of an array. Indexing outside a tuple is caught in Erlang. - writing outside the bounds of an array. There is no such thing as writing into an array in Erlang; this kind of error cannot happen. - memory leaks due to failing to call free. There is no free() in Erlang; this can't happen quite as simply. (You _can_ get stuff retained longer than you expected, though.) If one process starts stealing all of memory, you can just kill it. Their laudable aim is SURVIVABLE software; software where the presence of a fault doesn't mean the loss of a service. But Erlang gives you that in a much simpler, much safer, and agreeably biological way: apoptosis plus the OTP behaviours. Apoptosis is when a cell that gets into trouble kills itself. The organism can grow another one. In the same way, an Erlang process that starts going insane ISN'T told "that's wonderful, hallucinate and survive", it is killed, and the supervisor or whatever can grow another one. To twist a famous quotation, on reading this idea about trying to build robust large scale systems in an unsafe language originally designed for systems about as powerful as a modern wristwatch, by means of catching what few errors the language _can_ catch and pretending they never happened, my reaction is It's magnificent, but it isn't sane. Oh, oh! The woodpeckers are coming! From bjorn@REDACTED Fri Nov 3 05:29:03 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 03 Nov 2006 05:29:03 +0100 Subject: [erlang-questions] Compiler Crash and Bug? In-Reply-To: <4D38A7EF-60B0-41A8-ADD5-1AA2C92841F9@patternmatched.com> References: <4D38A7EF-60B0-41A8-ADD5-1AA2C92841F9@patternmatched.com> Message-ID: R11B-1 gives you a clearer error message: emr_api_SUITE: function test_listall_sub_users/1+1659: An implementation limit was reached. Try reducing the complexity of this function. Instruction: {get_list,{x,1022},{x,1023},{x,1024}} /Bjorn Rudolph van Graan writes: > Hi there, > > The following code causes the compiler (R10B-10) to crash and to go > into an infinite loop (R10B-3) like this: > > emr_api_SUITE: function test_listall_sub_users/1+4267: > Internal consistency check failed - please report this bug. > Instruction: {get_list,{x,1022},{x,1023},{x,1024}} > Error: {invalid_store,{x,1024},term}: > > > test_listall_sub_users(doc) -> > ["Test api's listall for sub users"]; > test_listall_sub_users(suite) -> > []; > test_listall_sub_users(_Config) -> > [{emr_user,<<85,115,101,114,49>>,1,1,"Parent Company > User" ,"Surname",1235467890123,"password",12345,"123456",true, > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > address line","Second Address line","Third address line","City",123}, > {emr_user,<<85,115,101,114,50>>,2,2,"Second Company > User" ,"Surname",3215467890123,"password",12345,"123456",true, > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > address line","Second Address line","Third address line","City",123}, > {emr_user,<<85,115,101,114,51>>,3,3,"Third Company > User" ,"Surname",2315467890123,"password",12345,"123456",true, > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > address line","Second Address line","Third address line","City",123}, > {emr_user,<<85,115,101,114,52>>,4,4,"Second Company's Child > User","Surname",1115467890123,"password",12345,"123456",true,0, > {{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > address line","Second Address line","Third address line","City", > 123}] = emr_api:listall_sub_users(list_to_binary("administrator")), > ok. > > is this a known issue? > > Regards, > > Rudolph > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Fri Nov 3 07:22:48 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 03 Nov 2006 07:22:48 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> Message-ID: <454AE038.5040900@ericsson.com> On 2006-11-02 18:51, Chandru wrote: ...deleted > one of our module names clash with one of OTP's module names. We renamed > our module and the problem disappeared. This is once in 7 years. As otp is in the standard distribution. packages will help reducing module name clashes between third party products. the kind where A and B spend 7 years developing, and C wants to use both their products. if possible to adopt to erlng, the eiffel solution is better. imho. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bengt.kleberg@REDACTED Fri Nov 3 07:28:19 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 03 Nov 2006 07:28:19 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> Message-ID: <454AE183.7030402@ericsson.com> On 2006-11-02 21:19, James Hague wrote: > On 11/2/06, Chandru wrote: >> I agree. Please let's not have packages. They are so ugly. I hated them when ...deleted > I also agree. Packages are pretty in a way, but they're a heavyweight > solution to a simple problem. > > I would much rather see some effort put into cleaning up the existing > libraries. Get rid of all the pre-fun functions that use "apply." would it be correct to use ''ironic'' to describe the fact that the only effort (that i know of), to clean up the existing libraries, uses packages? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From xpdoka@REDACTED Fri Nov 3 08:17:18 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Fri, 3 Nov 2006 08:17:18 +0100 (CET) Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> Message-ID: <33177.81.249.50.157.1162538238.squirrel@www.geekisp.com> Hi Richard, > No, what we need to do is to reify module name spaces and allow more than > one of them. They should be actual run time data structures that can be > explored. Sounds interesting, could you elaborate? Thanks, Dominic Williams http://www.dominicwilliams.net ---- From yerl@REDACTED Fri Nov 3 08:23:42 2006 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 3 Nov 2006 08:23:42 +0100 Subject: [erlang-questions] TrapExit Message-ID: An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Fri Nov 3 09:38:05 2006 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 3 Nov 2006 09:38:05 +0100 Subject: [erlang-questions] : Package Support/Use In-Reply-To: <454AE038.5040900@ericsson.com> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> <454AE038.5040900@ericsson.com> Message-ID: <20061103083805.GA27509@erix.ericsson.se> Can someone explain this eiffel solution, that many deem better... On Fri, Nov 03, 2006 at 07:22:48AM +0100, Bengt Kleberg wrote: > On 2006-11-02 18:51, Chandru wrote: > ...deleted > > one of our module names clash with one of OTP's module names. We renamed > > our module and the problem disappeared. This is once in 7 years. As > > otp is in the standard distribution. packages will help reducing module > name clashes between third party products. the kind where A and B spend > 7 years developing, and C wants to use both their products. > > if possible to adopt to erlng, the eiffel solution is better. imho. > > > bengt > -- > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Fri Nov 3 10:18:31 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 3 Nov 2006 10:18:31 +0100 Subject: [erlang-questions] Never let it fail! In-Reply-To: <200611030357.kA33vkdM233343@atlas.otago.ac.nz> Message-ID: Richard A. O'Keefe wrote: > > It takes guts to stand up in public and say > "Can achieve previously inconceivable levels of cluelessness (and > therefore functionality) in successful deployed systems" > and > "Software should be [...] not correct" > and > "If you want to reduce cost and difficulty of producing > acceptable software > * Make more errors acceptable > * Leave more errors in system" > > (Or, "Everything would be fine if users would learn to love > the lash.") A the Erlang Workshop in Pittsburgh, Mats Cronqvist gave a presentation about debugging a large Erlang system. One memorable quote was "the majority of errors were not programming errors, but rather a working implementation of the wrong thing". While the idea of masking errors ought to be applicable at some levels (e.g. error-correcting RAM), I agree with you that higher priority should be put on (1) eliminating the possibility of the error happening, or (2) disallowing the erroneous behaviour by throwing an exception. Their examples are different from "self-healing hardware" (EC RAM) in that their errors are caused by faulty program logic. BR, Ulf W From vladdu55@REDACTED Fri Nov 3 10:27:33 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 3 Nov 2006 10:27:33 +0100 Subject: [erlang-questions] Hijacking console output Message-ID: <95be1d3b0611030127s1ff916cct852cdd2d3aab45e8@mail.gmail.com> Hello, I would like to be able to redirect all console output to my own handler. If I understand the code properly, a way to achieve this is by starting the runtime with something amounting to erl -run user start "[MyMod, MyFun, MyArgs]" where MyMod:MyFun(MyArgs) returns a pid that will act as the new driver. Is this correct? Implementing the stuff just to find out it's not the right way wouldn't be too pleasant :-) The above would miss erlang:display() output, of course, and probably all printouts from the boot process (but I guess this can be lived with). best regards, Vlad From vladdu55@REDACTED Fri Nov 3 10:59:26 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 3 Nov 2006 10:59:26 +0100 Subject: [erlang-questions] Extending the io server Message-ID: <95be1d3b0611030159g49438bd7lc00de97eba8f244b@mail.gmail.com> Hi again, I think it would be useful if the io requests would include the pid of the original sender and a timestamp. A custom io driver could then process these requests depending on who sent them. For example in an IDE, one could then have the output from different processes in different windows, or mark each process' output with its own color -- which I would find extremely useful. The timestamp would help synchronizing the flow in different windows. In other words, this would resemble a lightweight variant of the new Inviso OTP application, only it would trace io output. Inviso seems quite unwieldy to setup, probably because it's not a high-level tool, just a framework. This means that for simpler use cases (one node), being able to filter output printouts could achieve a lot of what the user needs. best regards, Vlad From vladdu55@REDACTED Fri Nov 3 11:05:14 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 3 Nov 2006 11:05:14 +0100 Subject: [erlang-questions] Extending the io server In-Reply-To: <95be1d3b0611030159g49438bd7lc00de97eba8f244b@mail.gmail.com> References: <95be1d3b0611030159g49438bd7lc00de97eba8f244b@mail.gmail.com> Message-ID: <95be1d3b0611030205s4fcbd946jb6a44ebe1bbbe9dd@mail.gmail.com> > I think it would be useful if the io requests would include the pid of > the original sender and a timestamp. I forgot to ask: what do you think? I will probably give it a try for Erlide, to see how it could look and feel like, but it doesn't feel so good to have to hack the core OTP code (and maintain it after each release) if the community interest is lacking. best regards, Vlad From vladdu55@REDACTED Fri Nov 3 11:38:49 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 3 Nov 2006 11:38:49 +0100 Subject: [erlang-questions] Hijacking console output In-Reply-To: <95be1d3b0611030127s1ff916cct852cdd2d3aab45e8@mail.gmail.com> References: <95be1d3b0611030127s1ff916cct852cdd2d3aab45e8@mail.gmail.com> Message-ID: <95be1d3b0611030238uf6839b9t3a454702b97e1eea@mail.gmail.com> On 11/3/06, Vlad Dumitrescu wrote: > I would like to be able to redirect all console output to my own > handler. Following my other question about extending the io server, it came to me that a simpler way to capture output (while one is already hacking the io module) -- let io:format send the requests to both the normal output driver and to the new handler. This way, the intrusion is minimal. It could even be done without hacking the io source, by using Smerl. best regards, Vlad From ulf.wiger@REDACTED Fri Nov 3 11:42:23 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 3 Nov 2006 11:42:23 +0100 Subject: [erlang-questions] Compiler Crash and Bug? In-Reply-To: Message-ID: So, specifically, the LHS of the pattern match is too complex? I made a quick attempt to break out some of the common hard-coded strings and bind them to variables. That seemed to be enough to make it compile. e.g. f() -> X123456 = "123456", Surname = "Surname", [{emr_user,<<85,115,101,114,49>>,1,1,"Parent Company User", Surname,1235467890123,"password",12345,X123456,true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},X123456, "First address line","Second Address line","Third address line", "City",123}, {emr_user,<<85,115,101,114,50>>,2,2,"Second Company User", Surname,3215467890123,"password",12345,X123456,true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456", "First address line","Second Address line","Third address line", "City",123}, {emr_user,<<85,115,101,114,51>>,3,3,"Third Company User", Surname,2315467890123,"password",12345,X123456,true, 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},X123456, "First address line","Second Address line","Third address line", "City",123}, {emr_user,<<85,115,101,114,52>>,4,4,"Second Company's Child User", Surname,1115467890123,"password",12345,X123456,true,0, {{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},X123456, "First address line","Second Address line","Third address line", "City",123}] = emr_api:listall_sub_users(list_to_binary("administrator")). BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Bjorn Gustavsson > Sent: den 3 november 2006 05:29 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Compiler Crash and Bug? > > R11B-1 gives you a clearer error message: > > emr_api_SUITE: function test_listall_sub_users/1+1659: > An implementation limit was reached. > Try reducing the complexity of this function. > > Instruction: {get_list,{x,1022},{x,1023},{x,1024}} > > /Bjorn > > Rudolph van Graan writes: > > > Hi there, > > > > The following code causes the compiler (R10B-10) to crash and to go > > into an infinite loop (R10B-3) like this: > > > > emr_api_SUITE: function test_listall_sub_users/1+4267: > > Internal consistency check failed - please report this bug. > > Instruction: {get_list,{x,1022},{x,1023},{x,1024}} > > Error: {invalid_store,{x,1024},term}: > > > > > > test_listall_sub_users(doc) -> > > ["Test api's listall for sub users"]; > > test_listall_sub_users(suite) -> > > []; > > test_listall_sub_users(_Config) -> > > [{emr_user,<<85,115,101,114,49>>,1,1,"Parent Company > > User" > ,"Surname",1235467890123,"password",12345,"123456",true, > > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > > address line","Second Address line","Third address > line","City",123}, > > {emr_user,<<85,115,101,114,50>>,2,2,"Second Company > > User" > ,"Surname",3215467890123,"password",12345,"123456",true, > > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > > address line","Second Address line","Third address > line","City",123}, > > {emr_user,<<85,115,101,114,51>>,3,3,"Third Company > > User" > ,"Surname",2315467890123,"password",12345,"123456",true, > > 0,{{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > > address line","Second Address line","Third address > line","City",123}, > > {emr_user,<<85,115,101,114,52>>,4,4,"Second Company's Child > > User","Surname",1115467890123,"password",12345,"123456",true,0, > > {{2006,1,1},{10,12,25}},{{2006,2,1},{10,12,25}},"123456","First > > address line","Second Address line","Third address line","City", > > 123}] = > emr_api:listall_sub_users(list_to_binary("administrator")), > > ok. > > > > is this a known issue? > > > > Regards, > > > > Rudolph > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Fri Nov 3 13:03:41 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 03 Nov 2006 13:03:41 +0100 Subject: [erlang-questions] regexp is slow Message-ID: <454B301D.3050208@ericsson.com> somebody (virding?) was asking for a regexp benchmark. here's one where erlang is a 1000 or so times slower than java... much of that might be from the io of course. http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=hipe&id=0 mats From vladdu55@REDACTED Fri Nov 3 13:54:37 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 3 Nov 2006 13:54:37 +0100 Subject: [erlang-questions] Extending the io server In-Reply-To: <95be1d3b0611030205s4fcbd946jb6a44ebe1bbbe9dd@mail.gmail.com> References: <95be1d3b0611030159g49438bd7lc00de97eba8f244b@mail.gmail.com> <95be1d3b0611030205s4fcbd946jb6a44ebe1bbbe9dd@mail.gmail.com> Message-ID: <95be1d3b0611030454o245ca421g3e4eb0a6ec67bbef@mail.gmail.com> Well, what's a lunch break without some heavyweight coding? :-) I have implemented a module that at runtime modifies the io server to send copies of all requests to a specified process. The implementation uses Smerl (thanks Yariv! :-) and will be included in Erlide. For now you can get it from TrapExit http://forum.trapexit.org/viewtopic.php?t=6664. Usage: *stdio_handler:install(Handler) when is_atom(Handler) Handler has to be a process' name because we can't get an abstract form for pids... *stdio_handler:uninstall() We change the second clause of io:request/2 from request(Pid, Request) when pid(Pid) -> Mref = erlang:monitor(process,Pid), Pid ! {io_request,self(),Pid,io_request(Pid, Request)}, wait_io_mon_reply(Pid,Mref); with request(Pid, Request) when pid(Pid) -> case proccess_info(Pid, group_leader} of {group_leader, Pid} -> catch *Handler* ! {request, Pid, Request, self(), erlang:now()}; _ -> ok end, Mref = erlang:monitor(process,Pid), Pid ! {io_request,self(),Pid,io_request(Pid, Request)}, wait_io_mon_reply(Pid,Mref); We only want to capture standard_io output, i.e. where the group_leader is its own group_leader. So now your process will get notified when something gets read or written. best regards, Vlad From francesco@REDACTED Fri Nov 3 13:49:13 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 03 Nov 2006 12:49:13 +0000 Subject: [erlang-questions] Obfuscated Erlang Competition Deadline tonight Message-ID: <454B3AC9.5050508@erlang-consulting.com> Just a reminder that we need your submissions for the obfuscated competition by tonight, as I will be forwarding them to the judges first thing tomorrow morning... And considering the submissions from last year, I take it they will need all the time they can get to figure out what is going on :-)... Email them to euc06@REDACTED following the instructions located at http://www.erlang-consulting.com/obfuscatederlang.html See you all in Stockholm next week! Francesco -- http://www.erlang-consulting.com From ke.han@REDACTED Fri Nov 3 17:26:43 2006 From: ke.han@REDACTED (ke han) Date: Sat, 4 Nov 2006 00:26:43 +0800 Subject: [erlang-questions] tcl Tile Message-ID: <179B2AF9-A312-4209-9100-E880E6F84DFE@redstarling.com> I discovered the Tile libraries for tcl/tk today. http://wiki.tcl.tk/ 11075 It seems this is the tcl solution to enabling existing GUIs to not look so "horrible" ;-) Does anyone know how/if this could be used in the existing erlang tools to make things like the debugger just a touch easier to use? ke han From james.hague@REDACTED Fri Nov 3 18:51:51 2006 From: james.hague@REDACTED (James Hague) Date: Fri, 3 Nov 2006 11:51:51 -0600 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454AE183.7030402@ericsson.com> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> <454AE183.7030402@ericsson.com> Message-ID: On 11/3/06, Bengt Kleberg wrote: > > would it be correct to use ''ironic'' to describe the fact that the only > effort (that i know of), to clean up the existing libraries, uses packages? :) Yes, I know. But obviously packages aren't going over all that well or they'd be standard by now. James From sean.hinde@REDACTED Fri Nov 3 19:02:33 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 3 Nov 2006 18:02:33 +0000 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454AE183.7030402@ericsson.com> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> <454AE183.7030402@ericsson.com> Message-ID: <968A18DA-56F0-4645-B6C9-E5EC4275B356@gmail.com> On 3 Nov 2006, at 06:28, Bengt Kleberg wrote: > On 2006-11-02 21:19, James Hague wrote: >> On 11/2/06, Chandru wrote: >>> I agree. Please let's not have packages. They are so ugly. I >>> hated them when > > ...deleted >> I also agree. Packages are pretty in a way, but they're a >> heavyweight >> solution to a simple problem. >> >> I would much rather see some effort put into cleaning up the existing >> libraries. Get rid of all the pre-fun functions that use "apply." > > would it be correct to use ''ironic'' to describe the fact that the > only > effort (that i know of), to clean up the existing libraries, uses > packages? The irony is slightly reduced by the fact that the cleanup was being done by the implementor of packages :-) Sean From ulf.wiger@REDACTED Fri Nov 3 19:50:46 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 3 Nov 2006 19:50:46 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: Message-ID: James Hague wrote: > > But obviously packages aren't going over all > that well or they'd be standard by now. That could be the case, but it's sort of a chicken-and-egg problem too. Bengt obviously likes packages, but doesn't use them because it's an experimental feature. Obviously, a many people aren't even aware of the existence of packages, since they aren't documented (at least not in the OTP documentation.) Also, we don't have a terrible namespace problem in Erlang, partly because not that many people develop reusable components in Erlang ... yet. (: It could be argued that we should deal with the problem once it's obviously a problem. OTOH, when it's obviously a problem, changing the language is also obviously going to be more difficult than it is today. ROK's 'flotilla' concept also hasn't been adopted. Does that mean it's obviuosly a bad idea? What about abstract patterns, or structs? They've certainly been debated long enough, but are still not in the language. Does that mean they shouldn't be? (I have to practice writing 'obviously', because I mistype it every time...) BR, Ulf W From vances@REDACTED Fri Nov 3 20:49:08 2006 From: vances@REDACTED (Vance Shipley) Date: Fri, 3 Nov 2006 14:49:08 -0500 Subject: [erlang-questions] Local and remote sends In-Reply-To: <38278.83.204.242.174.1162301445.squirrel@www.geekisp.com> References: <3A76756EED583B43A4AD704E29CCD079741196@mail.aprsmartlogik.com> <38278.83.204.242.174.1162301445.squirrel@www.geekisp.com> Message-ID: <20061103194908.GA54787@frogman.motivity.ca> On Tue, Oct 31, 2006 at 02:30:45PM +0100, Dominic Williams wrote: } } The solution is for your code NOT TO KNOW who (and in your } case what) it is sending messages to. Pass it the } destination of send operations in some way (extra argument } to each function, extra initialisation argument, parameter } of an abstract module...) I agree completely. That's the FP way. More here: http://www.erlang.org/ml-archive/erlang-questions/200507/msg00283.html -Vance From xpdoka@REDACTED Fri Nov 3 21:06:59 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Fri, 3 Nov 2006 21:06:59 +0100 (CET) Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> Message-ID: <61721.82.238.225.199.1162584419.squirrel@www.geekisp.com> Hi Eric, > True, however, this is a sociological issue not a > technical one. It also depends very much on standards a > community has set. We have the power to set our one > standards on what is the right and wrong way to name > packages. > [...] > I will say that bringing up problems these types of > sociological problems isn't very helpful. Saying that > users will do this or users will do that is just hand > waving. User might do that and some users probably will, > but that doesn't imply that they can't be lead in the > right direction. Compared to some other language communities I have known, this one is actually rather weak on community standards. I'll just offer three examples: - naming (camel case vs. underscore) - returning tagged values vs. throwing - using OTP or not The standard libraries themselves are sadly lacking in homogoneity. There is no consistent naming system, no consistent ordering of arguments, various strategies for error handling... Also, the more Erlang spreads into open source, web development and so on (and this prospect has been offered as an argument for needing a solution to name clashes...), the more likely it becomes that whatever standards we do have become diluted. However, out of interest and to see whether there would be a consensus, what would those standards of right and wrong ways of naming packages be? >> The simplest way to resolve name clashes after they occur >> is to rename one of the modules. Better support for >> automated refactoring would make this easy, and I guess >> that covers 99% of the name clash situations. > > This works well only if you control the entire code > base. If I pull module A from one open source project and > module B from another I don't want to change anything in > module A or B. Touching files in either invalidates all > the tests that may have been run and it gives me a local > version that I now have to maintain. Neither of these > things are acceptable. How about a parse transform? Regards, Dominic Williams http://www.dominicwilliams.net ---- From james.hague@REDACTED Fri Nov 3 21:39:15 2006 From: james.hague@REDACTED (James Hague) Date: Fri, 3 Nov 2006 14:39:15 -0600 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: Message-ID: On 11/3/06, Ulf Wiger (TN/EAB) wrote: > > ROK's 'flotilla' concept also hasn't been adopted. > Does that mean it's obviuosly a bad idea? What about > abstract patterns, or structs? They've certainly been > debated long enough, but are still not in the > language. Does that mean they shouldn't be? The difference is that packages exist right now and are in the OTP distribution. They're just still flagged as experimental. Abstract patterns and structs stopped at the written description phases. I don't know what the flotilla concept is. (BTW, I think it's fantastic that packages were prototyped.) Now if structs were in part of the Erlang system and hardly anyone used them, then yes, I think that would be a bad sign :) James From ulf@REDACTED Fri Nov 3 21:44:11 2006 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 03 Nov 2006 21:44:11 +0100 Subject: [erlang-questions] Package Support/Use: Episode IV - A New Hope In-Reply-To: <200611020207.kA227p63226005@atlas.otago.ac.nz> References: <200611020207.kA227p63226005@atlas.otago.ac.nz> Message-ID: Den 2006-11-02 03:07:51 skrev Richard A. O'Keefe : > How fortunate you are to have no name clashes amongst Users! Well, it sort of has to be resolved anyway, since you can only call modules that belong to registered users(*), and in order to register, you have to pick a unique alias. (*) and normal modules known to be safe. > What this means in practice of course is that the names used in > the dotted module names (for which erlhive_User_Module would have > been every bit as good) have to be managed by erlhive and cannot be > freely chosen by users. They can freely choose whatever comes after 'erlhive.User.' Sure, I could have used erlhive_User_Module instead, but I fail to see the point of inventing my own way of denoting a structured module name, when there is already support in Erlang (albeit experimental) for this. > In fact, you might as well maintain a > data base mapping users to surrogates (as in William Kent's > "Data and Reality") and the surrogates might as well be 7 > base-36 digits assigned at random. (Enough to give everyone > on the planet 13 surrogates.) I could have done this too, but personally don't see it as an improvement over the scheme I chose. (From your other mail): > The forgery problem is that nothing actually stops anyone using any > module name they like. But in my case, I solve that by disallowing attempts to do this. (Hopefully, I'm pretty sure it's not possible to do this in erlhive.) BR, Ulf W -- Ulf Wiger From cyberlync@REDACTED Fri Nov 3 22:11:33 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Fri, 3 Nov 2006 13:11:33 -0800 Subject: [erlang-questions] Package Support/Use In-Reply-To: <61721.82.238.225.199.1162584419.squirrel@www.geekisp.com> References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> <61721.82.238.225.199.1162584419.squirrel@www.geekisp.com> Message-ID: On 11/3/06, Dominic Williams wrote: > Hi Eric, > > Compared to some other language communities I have known, > this one is actually rather weak on community > standards. I'll just offer three examples: > > - naming (camel case vs. underscore) > - returning tagged values vs. throwing > - using OTP or not I don't actually think there is that much ambiquity here. Underscore is the accepted practice, tagged values are the accepted practice and OTP is the accepted practice. Some may use the alternatives but that doesn't mean that the community standards are weak. > The standard libraries themselves are sadly lacking in > homogeneity. There is no consistent naming system, no > consistent ordering of arguments, various strategies for > error handling... This is, most unfortunately, true. > > Also, the more Erlang spreads into open source, web > development and so on (and this prospect has been offered as > an argument for needing a solution to name clashes...), the > more likely it becomes that whatever standards we do have > become diluted. Only if we let them. We, as a community, have control of this. > However, out of interest and to see whether there would be a > consensus, what would those standards of right and wrong > ways of naming packages be? > Thats a good question. We could just adopt the java approach and go with the reversed domain name. I personally wouldn't like that approach. We could also go with the way of the OID folks and have people register their top level namespace. This is probably a better approach but there are many others. > >> The simplest way to resolve name clashes after they occur > >> is to rename one of the modules. Better support for > >> automated refactoring would make this easy, and I guess > >> that covers 99% of the name clash situations. > > > > This works well only if you control the entire code > > base. If I pull module A from one open source project and > > module B from another I don't want to change anything in > > module A or B. Touching files in either invalidates all > > the tests that may have been run and it gives me a local > > version that I now have to maintain. Neither of these > > things are acceptable. > > How about a parse transform? This wouldn't work for the same reasons that implementing renaming in the language is hard. Its very difficult to tell what is a 'name' and what isn't. > > Regards, > > Dominic Williams > http://www.dominicwilliams.net > > ---- > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From nm@REDACTED Fri Nov 3 22:41:57 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 04 Nov 2006 01:41:57 +0400 Subject: [erlang-questions] Erlang distribution without working DNS? Message-ID: <454BB7A5.8030103@web.am> Hi all! Is it possible run erlang distribution protocol without working DNS servers for nodes located on different machines? I've found no reasonable way for it. Thanks in advance, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From serge@REDACTED Fri Nov 3 22:47:08 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 03 Nov 2006 16:47:08 -0500 Subject: [erlang-questions] Erlang distribution without working DNS? In-Reply-To: <454BB7A5.8030103@web.am> References: <454BB7A5.8030103@web.am> Message-ID: <454BB8DC.8030109@hq.idt.net> We use /etc/hosts entries for that purpose, and everything seems to work fine. Gaspar Chilingarov wrote: > Hi all! > > > Is it possible run erlang distribution protocol without working DNS > servers for nodes located on different machines? > > I've found no reasonable way for it. > > Thanks in advance, Gaspar > > -- Serge Aleynikov Routing R&D, IDT Telecom Tel: +1 (973) 438-3436 Fax: +1 (973) 438-1464 From ulf@REDACTED Sat Nov 4 00:12:37 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 04 Nov 2006 00:12:37 +0100 Subject: [erlang-questions] Erlang distribution without working DNS? In-Reply-To: <454BB7A5.8030103@web.am> References: <454BB7A5.8030103@web.am> Message-ID: Den 2006-11-03 22:41:57 skrev Gaspar Chilingarov : > Hi all! > > > Is it possible run erlang distribution protocol without working DNS > servers for nodes located on different machines? > > I've found no reasonable way for it. Have you meditated over the following section of the ERTS User's Guide? http://www.erlang.org/doc/doc-5.5.1/erts-5.5.1/doc/html/inet_cfg.html#7 BR, Ulf W -- Ulf Wiger From robert.virding@REDACTED Sat Nov 4 03:39:56 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 04 Nov 2006 03:39:56 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: <454B301D.3050208@ericsson.com> References: <454B301D.3050208@ericsson.com> Message-ID: <454BFD7C.9070301@telia.com> That was me. Now I will see if I can improve our standing, at least not to crash. :-) Robert Mats Cronqvist wrote: > somebody (virding?) was asking for a regexp benchmark. > > here's one where erlang is a 1000 or so times slower than java... much of > that might be from the io of course. > > http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=hipe&id=0 > > mats > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From jefcrane@REDACTED Sat Nov 4 09:50:15 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sat, 4 Nov 2006 00:50:15 -0800 (PST) Subject: [erlang-questions] How to Convert a Mixed Term to String Message-ID: <20061104085015.30478.qmail@web31601.mail.mud.yahoo.com> When testing my app by reading a file, I could easily pull a string like: "{String1,{atom2,{3,4}},5,6}" But when I pull from an erlang MySQL implementation, I end up with: {"String1",{atom2,{3,4}},5,6} and I cannot figure out how to convert it to: "{String1,{atom2,{3,4}},5,6}" since transforms seem to always remove the curly braces. Can anyone describe how they would go about this? It's really frustrating to be stuck on a formatting issue. __________________________________________________________________________________________ Check out the New Yahoo! Mail - Fire up a more powerful email and get things done faster. (http://advision.webevents.yahoo.com/mailbeta) From dmitrii@REDACTED Sat Nov 4 10:09:57 2006 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Sat, 4 Nov 2006 11:09:57 +0200 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <1162248862.26664.299.camel@matt.sipphone.com> <65243.82.238.225.199.1162403425.squirrel@www.geekisp.com> <61721.82.238.225.199.1162584419.squirrel@www.geekisp.com> Message-ID: > > > Thats a good question. We could just adopt the java approach and go > with the reversed domain name. I personally wouldn't like that > approach. We could also go with the way of the OID folks and have > people register their top level namespace. This is probably a better > approach but there are many others. If there was a central repository of opensource erlang libraries, the problem of name clashes would be virtually non-existent since every developer would have to register a unique name in that repository before releasing anything. See ruby gems, for instance... -------------- next part -------------- An HTML attachment was scrubbed... URL: From nm@REDACTED Sun Nov 5 00:36:50 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 05 Nov 2006 03:36:50 +0400 Subject: [erlang-questions] Erlang distribution without working DNS? In-Reply-To: References: <454BB7A5.8030103@web.am> Message-ID: <454D2412.9020605@web.am> Ulf Wiger wrote: > Den 2006-11-03 22:41:57 skrev Gaspar Chilingarov : > >> Hi all! >> >> >> Is it possible run erlang distribution protocol without working DNS >> servers for nodes located on different machines? >> >> I've found no reasonable way for it. > > Have you meditated over the following section of the ERTS User's Guide? > > http://www.erlang.org/doc/doc-5.5.1/erts-5.5.1/doc/html/inet_cfg.html#7 > > BR, > Ulf W > --Ulf Wiger > Great! I believed that it's somewhere there, but .... we have no helper monkey in office yet -- probably because of low radiation level, and it is sometimes difficult to get correct keywords on google to fetch correct info. Thanks a lot :) -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From nm@REDACTED Sun Nov 5 00:51:06 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 05 Nov 2006 03:51:06 +0400 Subject: [erlang-questions] quick search page Message-ID: <454D276A.2070000@web.am> Hi all! I would like to share with you link to this small page, which contains two search forms - for erlang documentation and for erlang mailing lists http://zanazan.am/erlang/ It was inspired by my previous question. Google default search produces too much results with too much noise even for simple queries ever you know what to search and it's very useful to search only in official documentation to keep noise level very low. If you have any ideas or suggestions please do not hesitate to contact me. PS. I know that similar page exists on erlang.org -- but it is a little bit heavyweight. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From kalap.kabat@REDACTED Sun Nov 5 09:37:18 2006 From: kalap.kabat@REDACTED (user) Date: Sun, 5 Nov 2006 08:37:18 +0000 (UTC) Subject: [erlang-questions] quick search page References: <454D276A.2070000@web.am> Message-ID: Gaspar Chilingarov web.am> writes: > > Hi all! > > I would like to share with you link to this small page, which contains > two search forms - for erlang documentation and for erlang mailing lists > > http://zanazan.am/erlang/ > Good job, it's certainly nicer than google. An even better solution would be having a GotAPI interface for OTP/Erlang: http://gotapi.com/ http://start.gotapi.com/ I don't know why the Erlang maintainers don't contact them. It would certainly be a big plus for Erlang if there were such a snazzy, easy to use interface for the documentation. From igwan@REDACTED Sun Nov 5 14:20:33 2006 From: igwan@REDACTED (igwan) Date: Sun, 05 Nov 2006 14:20:33 +0100 Subject: [erlang-questions] Iteration over records/record fields ? Message-ID: <454DE521.1030309@free.fr> Hi, For a project of mine, I have to import some XML elements into a bunch of Mnesia tables. Each record I defined map exactly to the structure of each XML element. Example : XML : Simpson Homer J. ...
742 Evergreen T.
42.293,12.942,0 ...
after parsing and transformation, I get a list like : [{person, [{name, "Simpson"}, {firstname, "Homer J."}, ... ]}, {house, [{address, "742 Evergreen T."}, {coordinates, "42.293,12.942,0"}, ...], ... ] The corresponding record I define : -record(person, { name = [], firstname = [], ... }). -record(house, { address = [], coordinates = [], .... }). ... The problem is that I have an important list of records defined (about 30), each having about 20 to 40 fields. How can I programmatically iterate over my list to populate my records ? I wish I could write #RecordName.Field or record_info(fields, RecordName), with RecordName and Field being variables, and iterate in list comprehensions and lists:foldl but that doesn't seem possible. Is there a way around ? (I wish I could also avoid macros. ^^). I also heard of the Smerl trickery, is that the way to go ? Thanks igwan From yarivvv@REDACTED Sun Nov 5 17:15:07 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Sun, 5 Nov 2006 11:15:07 -0500 Subject: [erlang-questions] ErlyWeb Google Group Message-ID: <17244f480611050815n6e211387l92c96a83a876952e@mail.gmail.com> Hi, I started a new Google group for ErlyWeb developers so as to not pollute the erlang-questions and erlyaws lists with too many ErlyWeb-specific issues. You can join it here: http://groups.google.com/group/erlyweb Cheers, Yariv From w.a.de.jong@REDACTED Sun Nov 5 19:32:18 2006 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Sun, 5 Nov 2006 19:32:18 +0100 Subject: [erlang-questions] Iteration over records/record fields ? In-Reply-To: <454DE521.1030309@free.fr> References: <454DE521.1030309@free.fr> Message-ID: <407d9ef80611051032g6630556cl5db807693c467e4b@mail.gmail.com> Hi Igwan, If I understand correctly, you could solve your problem by using Erlsom (http://sourceforge.net/projects/erlsom). You have to define an XML schema (XSD) for the XML. Normally that shouldn't be very difficult. On the basis of this schema, Erlsom can parse the XML. The output is a record (or a nested structure of records, depending on the structure of the XML). Good luck, Willem. On 11/5/06, igwan wrote: > Hi, > > For a project of mine, I have to import some XML elements into a bunch > of Mnesia tables. Each record I defined map exactly to the structure of > each XML element. > > Example : > > XML : > > Simpson > Homer J. > ... > > > >
742 Evergreen T.
> 42.293,12.942,0 > ... >
> > after parsing and transformation, I get a list like : > [{person, [{name, "Simpson"}, {firstname, "Homer J."}, ... ]}, > {house, [{address, "742 Evergreen T."}, {coordinates, > "42.293,12.942,0"}, ...], > ... ] > > The corresponding record I define : > -record(person, { name = [], firstname = [], ... }). > -record(house, { address = [], coordinates = [], .... }). > ... > > The problem is that I have an important list of records defined (about > 30), each having about 20 to 40 fields. > How can I programmatically iterate over my list to populate my records ? > > I wish I could write #RecordName.Field or record_info(fields, > RecordName), with RecordName and Field being variables, and iterate in > list comprehensions and lists:foldl but that doesn't seem possible. Is > there a way around ? (I wish I could also avoid macros. ^^). I also > heard of the Smerl trickery, is that the way to go ? > > Thanks > > igwan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Sun Nov 5 23:41:08 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 05 Nov 2006 23:41:08 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: <454B301D.3050208@ericsson.com> References: <454B301D.3050208@ericsson.com> Message-ID: <454E6884.1010508@telia.com> I had a little look at this and did some very basic ecn-marking to see where the time went. Basically the problem is that you have a large file, ~100k, of DNA data and you run some regexp on this to inspect and process the data. There are two types operations: 1. global substitutions, regexp:gsub 2. counting occuring patterns regexp:matches Counting patterns was no problem, that went fast. It was the substitution part that was taking most of the time. Not finding the matching parts of the data but doing the actual substitutions. This is one part of the code which much be improved, it was never considered that it would process such large amounts of data. Having the data in a binary would definitely NOT help here, it would result in an enormous amount of copying. I did not measure the io bit. One thing at a time. Robert Mats Cronqvist wrote: > somebody (virding?) was asking for a regexp benchmark. > > here's one where erlang is a 1000 or so times slower than java... much of > that might be from the io of course. > > http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=hipe&id=0 > > mats > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From adam@REDACTED Mon Nov 6 00:48:44 2006 From: adam@REDACTED (Adam Lindberg) Date: Sun, 5 Nov 2006 23:48:44 +0000 Subject: [erlang-questions] quick search page In-Reply-To: References: <454D276A.2070000@web.am> Message-ID: <6344005f0611051548n678b9492nb7cb09b0a3c0317c@mail.gmail.com> Also there is the Erlang Search Engine in Google Co-op. It can be found here: http://shurl.org/erlang It limits Google's searches to a subset of Erlang related pages. Cheers Adam On 11/5/06, user wrote: > Gaspar Chilingarov web.am> writes: > > > > > Hi all! > > > > I would like to share with you link to this small page, which contains > > two search forms - for erlang documentation and for erlang mailing lists > > > > http://zanazan.am/erlang/ > > > > Good job, it's certainly nicer than google. > > An even better solution would be having a GotAPI interface for OTP/Erlang: > > http://gotapi.com/ > http://start.gotapi.com/ > > I don't know why the Erlang maintainers don't contact them. It would certainly > be a big plus for Erlang if there were such a snazzy, easy to use interface for > the documentation. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Adam Lindberg Mobile: +447960721616 Web: http://www.namsisi.com From ugglan@REDACTED Mon Nov 6 01:04:39 2006 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Mon, 6 Nov 2006 01:04:39 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 Message-ID: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Just a heads up for anyone else who uses Ubuntu. Erlang seems to have trouble loading external libraries/driver on a Ubuntu 6.10 "Egdy Eft" system. I've just spent the better part of the weekend trying to figure out what was going wrong. First it seemed like a problem with Yaws, because erlang compiled fine and "worked". But yaws stopped with a "exec 1: setuid_drv.so :not found". After much reinstalling and experimenting with different versions I discovered that it was all dynamic loading of libraries that failed. For example "crypto:start()." in the erl shell crashed in a similar fashion. Maybe there is a simple solution to the problem, but at the moment it eludes me, so I've downgraded. The same packages and erlang-versions work perfectly fine in Ubuntu 6.06, so if you're using Ubuntu and Erlang, don't upgrade ubuntu yet. /tobias -------------- next part -------------- An HTML attachment was scrubbed... URL: From ugglan@REDACTED Mon Nov 6 01:40:36 2006 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Mon, 6 Nov 2006 01:40:36 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: <5c402a550611051640t21d5e98ag4c90b11b8bd50092@mail.gmail.com> Ah, to clarify, I've been testing the i386 release of xubuntu on a rather old system so I shouldn't be too fast to generalize. But the bug has been reported by others here: I only wanted to mention it here since I hadn't heard of it on this list and just maybe save a couple of hours of time for someone else! /tobias On 11/6/06, RCB wrote: > > Tobias, > I'm using 6.10 on a PPC release of Ubuntu and crypto:start() works for > me. fyi! > Rich > > > On 11/5/06, Tobias L?fgren < ugglan@REDACTED> wrote: > > > > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to have > > trouble loading external libraries/driver on a Ubuntu 6.10 "Egdy Eft" > > system. > > > > > -- > Rich Beerman > Cupertino, California > mobile: 408/221-2444 > fax: 408/255-7944 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangx@REDACTED Mon Nov 6 02:10:00 2006 From: erlangx@REDACTED (Michael McDaniel) Date: Sun, 5 Nov 2006 17:10:00 -0800 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611051640t21d5e98ag4c90b11b8bd50092@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <5c402a550611051640t21d5e98ag4c90b11b8bd50092@mail.gmail.com> Message-ID: <20061106010955.GA8047@delora.autosys.us> I have a 6.10 upgrade from 6.06 on a laptop and crypto:start() works here also. $ uname -a Linux delora 2.6.17-10-386 #2 Fri Oct 13 18:41:40 UTC 2006 i686 GNU/Linux $ erl -name fu Eshell V5.5.1 (abort with ^G) (fu@REDACTED)1> application:start(sasl). ok =PROGRESS REPORT==== 5-Nov-2006::17:07:00 === blah blah blah ... =PROGRESS REPORT==== 5-Nov-2006::17:07:00 === application: sasl started_at: 'fu@REDACTED' (fu@REDACTED)2> crypto:start(). =PROGRESS REPORT==== 5-Nov-2006::17:07:05 === supervisor: {local,crypto_sup} started: [{pid,<0.56.0>}, {name,crypto_server}, {mfa,{crypto_server,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 5-Nov-2006::17:07:05 === application: crypto started_at: 'fu@REDACTED' ok (fu@REDACTED)3> Note that crypto:start() gives 'ok' even without starting sasl first. ~Michael On Mon, Nov 06, 2006 at 01:40:36AM +0100, Tobias L?fgren wrote: > Ah, to clarify, I've been testing the i386 release of xubuntu on a rather old > system so I shouldn't be too fast to generalize. But the bug has been reported > by others here: < https://launchpad.net/distros/ubuntu/+source/erlang/+bug/ > 68163> > > I only wanted to mention it here since I hadn't heard of it on this list and > just maybe save a couple of hours of time for someone else! > > /tobias > > On 11/6/06, RCB < rcbeerman@REDACTED> wrote: > > Tobias, > I'm using 6.10 on a PPC release of Ubuntu and crypto:start() works for me. > fyi! > Rich > > > > On 11/5/06, Tobias L fgren < ugglan@REDACTED> wrote: > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to have > trouble loading external libraries/driver on a Ubuntu 6.10 "Egdy Eft" > system. > > > > -- > Rich Beerman > Cupertino, California > mobile: 408/221-2444 > fax: 408/255-7944 > > > !DSPAM:52,454e84b5251561258462197! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > !DSPAM:52,454e84b5251561258462197! -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From ok@REDACTED Mon Nov 6 03:38:08 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 6 Nov 2006 15:38:08 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> Dominic Williams wrote: Compared to some other language communities I have known, this one is actually rather weak on community standards. I'll just offer three examples: - naming (camel case vs. underscore) May I request a compiler option, enabled by default, to flag every occurrence of baStudlyCaps as a style error? - returning tagged values vs. throwing I thought we did have advice about that? I can't remember where I saw it, but it was along the lines of "don't use exceptions except for things that are really exceptional". In other languages, for example, coming to the end of a file is NOT exceptional; most "files" HAVE an end. So a language shouldn't indicate reaching the end of a file (for the first time, at least) by raising an exception. - using OTP or not The advice I see here is consistent: use it. From ok@REDACTED Mon Nov 6 03:45:06 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 6 Nov 2006 15:45:06 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611060245.kA62j6qY249226@atlas.otago.ac.nz> "James Hague" wrote: The difference is that packages exist right now and are in the OTP distribution. They're just still flagged as experimental. Abstract patterns and structs stopped at the written description phases. I am one person. I am paid to do other things. If anyone wanted to fund me to spend some time implementing either or both, I'd love to do that. Right now I really ought to be marking assignments, sigh. Someone has already mentioned Eiffel's LACE, which solves the module (class) name clash problem from the outside. LACE is a nice idea, and the reified module name spaces I mentioned are partly inspired by LACE and partly by Obliq and partly by a declarative configuration language for Mesa developed at Xerox. And it's not entirely unlike SASL. From ulf@REDACTED Mon Nov 6 07:09:28 2006 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 06 Nov 2006 07:09:28 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: <454E6884.1010508@telia.com> References: <454B301D.3050208@ericsson.com> <454E6884.1010508@telia.com> Message-ID: Den 2006-11-05 23:41:08 skrev Robert Virding : > Counting patterns was no problem, that went fast. It was the > substitution part that was taking most of the time. Not finding the > matching parts of the data but doing the actual substitutions. This is > one part of the code which much be improved, it was never considered > that it would process such large amounts of data. Having the data in a > binary would definitely NOT help here, it would result in an enormous > amount of copying. Well, the HiPE team's byte_array to the rescue then, eh? ;-) /Ulf W -- Ulf Wiger From matthias@REDACTED Mon Nov 6 08:25:14 2006 From: matthias@REDACTED (Matthias Lang) Date: Mon, 6 Nov 2006 08:25:14 +0100 Subject: [erlang-questions] How to Convert a Mixed Term to String In-Reply-To: <20061104085015.30478.qmail@web31601.mail.mud.yahoo.com> References: <20061104085015.30478.qmail@web31601.mail.mud.yahoo.com> Message-ID: <17742.58202.380173.686215@antilipe.corelatus.se> Jeff Crane writes: > When testing my app by reading a file, I could easily > pull a string like: > "{String1,{atom2,{3,4}},5,6}" > > But when I pull from an erlang MySQL implementation, I > end up with: > {"String1",{atom2,{3,4}},5,6} > and I cannot figure out how to convert it to: > "{String1,{atom2,{3,4}},5,6}" > since transforms seem to always remove the curly > braces. > > Can anyone describe how they would go about this? > > It's really frustrating to be stuck on a formatting issue. Based on the limited information you've given, in conjunction with the level of previous questions you've asked on the mailing list, my guess is that you are confused about what a 'term' is. The following is a term: {"String1",{atom2,{3,4}},5,6} The following is a string. The string does _not_ represent a valid term: "{String1,{atom2,{3,4}},5,6}" Since the two are _not_ alternative representations of the same thing, at least not under the definition of "an Erlang term", Erlang isn't going to solve it for you with some "formatting fix". You can, of course, write your own code to convert between the two under some set of rules which you can invent. Or, you could read up on terms, for instance in chapter 2 of the Erlang reference manual. It is also possible that you've mistyped the examples in your question, in which case my answer is mostly irrelevant. Matthias From bertil.karlsson@REDACTED Mon Nov 6 08:56:16 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Mon, 06 Nov 2006 08:56:16 +0100 Subject: [erlang-questions] Iteration over records/record fields ? In-Reply-To: <454DE521.1030309@free.fr> References: <454DE521.1030309@free.fr> Message-ID: <454EEAA0.40707@ericsson.com> It is easy to extract xml values first parsing the xml document with xmerl_scan:file/[1,2] and then using xmerl_xpath:string/2 to extract values. /Bertil igwan wrote: > Hi, > > For a project of mine, I have to import some XML elements into a bunch > of Mnesia tables. Each record I defined map exactly to the structure of > each XML element. > > Example : > > XML : > > Simpson > Homer J. > ... > > > >
742 Evergreen T.
> 42.293,12.942,0 > ... >
> > after parsing and transformation, I get a list like : > [{person, [{name, "Simpson"}, {firstname, "Homer J."}, ... ]}, > {house, [{address, "742 Evergreen T."}, {coordinates, > "42.293,12.942,0"}, ...], > ... ] > > The corresponding record I define : > -record(person, { name = [], firstname = [], ... }). > -record(house, { address = [], coordinates = [], .... }). > ... > > The problem is that I have an important list of records defined (about > 30), each having about 20 to 40 fields. > How can I programmatically iterate over my list to populate my records ? > > I wish I could write #RecordName.Field or record_info(fields, > RecordName), with RecordName and Field being variables, and iterate in > list comprehensions and lists:foldl but that doesn't seem possible. Is > there a way around ? (I wish I could also avoid macros. ^^). I also > heard of the Smerl trickery, is that the way to go ? > > Thanks > > igwan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Mon Nov 6 09:05:21 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 06 Nov 2006 09:05:21 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> Message-ID: <454EECC1.7040007@ericsson.com> Richard A. O'Keefe wrote: > Dominic Williams wrote: > - returning tagged values vs. throwing > > I thought we did have advice about that? I can't remember where > I saw it, but it was along the lines of "don't use exceptions > except for things that are really exceptional". In other languages, > for example, coming to the end of a file is NOT exceptional; most > "files" HAVE an end. So a language shouldn't indicate reaching the end > of a file (for the first time, at least) by raising an exception. i hope you misremember, cause returning tagged tuples is truly abominable. only a closet C programmer would use that idiom. mats From bob@REDACTED Mon Nov 6 09:36:39 2006 From: bob@REDACTED (Bob Ippolito) Date: Mon, 6 Nov 2006 00:36:39 -0800 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454EECC1.7040007@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> Message-ID: <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> On 11/6/06, Mats Cronqvist wrote: > Richard A. O'Keefe wrote: > > Dominic Williams wrote: > > - returning tagged values vs. throwing > > > > I thought we did have advice about that? I can't remember where > > I saw it, but it was along the lines of "don't use exceptions > > except for things that are really exceptional". In other languages, > > for example, coming to the end of a file is NOT exceptional; most > > "files" HAVE an end. So a language shouldn't indicate reaching the end > > of a file (for the first time, at least) by raising an exception. > > i hope you misremember, cause returning tagged tuples is truly abominable. > only a closet C programmer would use that idiom. > I recall reading something along those lines, but I don't remember where exactly. It's clear that much of the standard library prefers to return tagged tuples instead of using exceptions. -bob From bengt.kleberg@REDACTED Mon Nov 6 09:46:34 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 06 Nov 2006 09:46:34 +0100 Subject: [erlang-questions] : Package Support/Use In-Reply-To: <20061103083805.GA27509@erix.ericsson.se> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> <454AE038.5040900@ericsson.com> <20061103083805.GA27509@erix.ericsson.se> Message-ID: <454EF66A.3030807@ericsson.com> On 2006-11-03 09:38, Raimo Niskanen wrote: > Can someone explain this eiffel solution, that many deem better... i had confused the class renaming feature with the LACE renaming feature. (it was > 10 years since i wrote in eiffel). so ''object-oriented software construction'' is not the right place to look in. this is a paper i managed to find that discuss module renaming: http://se.ethz.ch/projects/alan_fehr/report.pdf i apologise for the lack of information. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From jla415@REDACTED Sun Nov 5 16:28:04 2006 From: jla415@REDACTED (jla415) Date: Sun, 5 Nov 2006 07:28:04 -0800 (PST) Subject: [erlang-questions] Iteration over records/record fields ? In-Reply-To: <454DE521.1030309@free.fr> References: <454DE521.1030309@free.fr> Message-ID: <7186073.post@talk.nabble.com> since record_info is evaluated at compile time you will need to setup a function to map your records to fields and use that to look up the name and order of the fields fields(person) -> record_info(fields, person); fields(place) -> record_info(fields, place); fields(thing) -> record_info(fields, thing). and use that to do your mapping... eg: erlang:list_to_tuple([RecType] ++ lists:map(fun(X) -> proplists:get_value(X, RecProps) end, fields(RecType)). D?sir? Cocoyer wrote: > > Hi, > > For a project of mine, I have to import some XML elements into a bunch > of Mnesia tables. Each record I defined map exactly to the structure of > each XML element. > > Example : > > XML : > > Simpson > Homer J. > ... > > > >
742 Evergreen T.
> 42.293,12.942,0 > ... >
> > after parsing and transformation, I get a list like : > [{person, [{name, "Simpson"}, {firstname, "Homer J."}, ... ]}, > {house, [{address, "742 Evergreen T."}, {coordinates, > "42.293,12.942,0"}, ...], > ... ] > > The corresponding record I define : > -record(person, { name = [], firstname = [], ... }). > -record(house, { address = [], coordinates = [], .... }). > ... > > The problem is that I have an important list of records defined (about > 30), each having about 20 to 40 fields. > How can I programmatically iterate over my list to populate my records ? > > I wish I could write #RecordName.Field or record_info(fields, > RecordName), with RecordName and Field being variables, and iterate in > list comprehensions and lists:foldl but that doesn't seem possible. Is > there a way around ? (I wish I could also avoid macros. ^^). I also > heard of the Smerl trickery, is that the way to go ? > > Thanks > > igwan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- View this message in context: http://www.nabble.com/-erlang-questions--Iteration-over-records-record-fields---tf2577510.html#a7186073 Sent from the Erlang Questions mailing list archive at Nabble.com. From mats.cronqvist@REDACTED Mon Nov 6 10:20:30 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 06 Nov 2006 10:20:30 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> Message-ID: <454EFE5E.9080407@ericsson.com> Bob Ippolito wrote: > It's clear that much of the standard library prefers to return tagged > tuples instead of using exceptions. true enough. i believe rectifying this was one of the motivations behind the rewrite of the standard libraries referred to earlier in this thread. mats From chsu79@REDACTED Mon Nov 6 10:36:19 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 6 Nov 2006 10:36:19 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> Message-ID: On 11/6/06, Bob Ippolito wrote: > On 11/6/06, Mats Cronqvist wrote: > > Richard A. O'Keefe wrote: > > > Dominic Williams wrote: > > > - returning tagged values vs. throwing > > i hope you misremember, cause returning tagged tuples is truly abominable. > > only a closet C programmer would use that idiom. How are tagged tuples bad? How do one reason for such an opinion? I share the despise for C programming nowdays, but there I learned to love sprinkling assert() sanity checks all over the code. They caught so many errors that I thought were impossible. I find that tagged tuples does much of the same for me in Erlang. Crash as soon as possible when code derails off what I intended it to do. Nor do I find this to exclude the use of throwing exceptions. With the terminology of "top-down programming", I find that exceptions are good for the "top" part of a program, exceptions that indicate that some stage went wrong (ex failure to read config, sql database could not be connected to...) and tagged tuples + pattern matching are good for the "bottom" part of programming, code that implement the different stages. From klacke@REDACTED Mon Nov 6 10:46:30 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Mon, 06 Nov 2006 10:46:30 +0100 Subject: [erlang-questions] boring bug report Message-ID: <454F0476.6010209@hyber.org> I'm running yaws at www.hyber.org and the beam process was fucked up. I couldn't get a shell into the node, thus it is non trivial to figure out what happened. Anyway, I attach as much info as I can. I realize that this is not sufficent for finding the bug, thus this report is more of a existence proof showing that there is a bug in the central poll loop - thus serious. [root@REDACTED]src > uname -a Linux gnejs 2.6.13-gentoo-r3 #1 Thu Oct 27 22:29:37 CEST 2005 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux First the strace, which shows that poll repeatedly reports 2 pipes as ready to read, a read attempt is done which returns 0, but the fds are still part of the readset. Note furtherdown that it looks as if the pipe buffers are full. poll([{fd=3, events=POLLIN|POLLRDNORM}, {fd=10, events=POLLIN|POLLRDNORM}, {fd=13, events=POLLIN|POLLRDNORM}, {fd=445, events=POLLIN|POLLOUT|POLLRDNORM, revents=POLLHUP}, {fd=341, events=POLLIN|POLLOUT|POLLRDNORM, revents=POLLHUP}], 5, 0) = 2 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2025}, NULL) = 0 read(445, "", 65536) = 0 read(341, "", 65536) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2147}, NULL) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2252}, NULL) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2358}, NULL) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2463}, NULL) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2568}, NULL) = 0 times({tms_utime=48330945, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2673}, NULL) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2787}, NULL) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2892}, NULL) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 2997}, NULL) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 3102}, NULL) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 3208}, NULL) = 0 poll([{fd=3, events=POLLIN|POLLRDNORM}, {fd=10, events=POLLIN|POLLRDNORM}, {fd=13, events=POLLIN|POLLRDNORM}, {fd=445, events=POLLIN|POLLOUT|POLLRDNORM, revents=POLLHUP}, {fd=341, events=POLLIN|POLLOUT|POLLRDNORM, revents=POLLHUP}], 5, 0) = 2 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661, 3338}, NULL) = 0 read(445, "", 65536) = 0 read(341, "", 65536) = 0 times({tms_utime=48330946, tms_stime=61652394, tms_cutime=15118, tms_cstime=3101}) = -1847126572 gettimeofday({1162804661 [root@REDACTED]yaws > lsof -p 13901 | egrep '445|341' beam 13901 root 44u IPv4 3072001 TCP h200n2fls31o899.telia.com:http->crawl-66-249-65-134.googlebot.com:34149 (CLOSE_WAIT) beam 13901 root 198u IPv4 3393419 TCP h200n2fls31o899.telia.com:http->crawl-66-249-65-42.googlebot.com:65535 (CLOSE_WAIT) beam 13901 root 266u IPv4 3576948 TCP h200n2fls31o899.telia.com:http->crawl-66-249-65-42.googlebot.com:33417 (CLOSE_WAIT) beam 13901 root 297u IPv4 3594452 TCP h200n2fls31o899.telia.com:http->livebot-65-54-188-138.search.live.com:26155 (CLOSE_WAIT) beam 13901 root 341r FIFO 0,5 3651470 pipe beam 13901 root 445r FIFO 0,5 3829601 pipe beam 13901 root 646u IPv4 4113443 TCP h200n2fls31o899.telia.com:http->crawl-66-249-65-138.googlebot.com:34155 (CLOSE_WAIT) beam 13901 root 667u IPv4 4139850 TCP h200n2fls31o899.telia.com:http->crawl-66-249-65-138.googlebot.com:41341 (CLOSE_WAIT) [root@REDACTED]yaws > =ERROR REPORT==== 5-Nov-2006::06:37:27 === Yaws process died: {{badmatch,{error,emfile}}, [{yaws_server,cache_file,4}, {yaws_server,handle_request,3}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p,5}]} =ERROR REPORT==== 5-Nov-2006::06:53:48 === Error in process <0.25662.18> with exit value: {enfile,[{erlang,open_port,[{spawn,"zip -q -1 -r - ."},[{cd,"/var/yaws/www"},use_stdio,binary,exit_status]]},{yaws_ls,zip,2} ]} [root@REDACTED]yaws > ps aguxww | grep zip root 29041 0.0 0.0 1740 552 pts/1 R+ 10:25 0:00 grep zip [root@REDACTED]yaws > top top - 10:26:07 up 84 days, 11:20, 3 users, load average: 0.99, 1.00, 1.00 Tasks: 97 total, 4 running, 93 sleeping, 0 stopped, 0 zombie Cpu0 : 65.8% us, 7.6% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 26.6% si Mem: 1034188k total, 791604k used, 242584k free, 253548k buffers Swap: 1004052k total, 148k used, 1003904k free, 184772k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 13901 root 25 0 45636 38m 1632 R 71.1 3.8 18337:12 beam 6599 root 16 0 2740 1440 1036 R 25.4 0.1 4840:28 gkrellmd 29048 root 15 0 2072 1092 832 R 1.3 0.1 0:00.02 top 1 root 16 0 1428 484 420 S 0.0 0.0 0:02.83 init 2 root 34 19 0 0 0 S 0.0 0.0 0:00.12 ksoftirqd/0 ........... [root@REDACTED]yaws > netstat -anp | grep beam tcp 0 0 127.0.0.1:40101 0.0.0.0:* LISTEN 13901/beam tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13901/beam tcp 1 0 217.209.72.200:80 66.249.72.208:39990 CLOSE_WAIT 13901/beam tcp 1 0 217.209.72.200:80 65.55.213.33:19051 CLOSE_WAIT 13901/beam tcp 1 0 217.209.72.200:80 66.249.72.104:40816 CLOSE_WAIT 13901/beam tcp 1 0 217.209.72.200:80 66.249.72.104:61052 CLOSE_WAIT 13901/beam tcp 1 0 217.209.72.200:80 66.249.72.104:54650 CLOSE_WAIT 13901/beam ...... Lot's and lots of CLOSE_WAIT sockets [root@REDACTED]yaws > netstat -anp | grep beam | wc -l 652 Accesslog showing last time a request was shipped. [root@REDACTED]yaws > tail yaws.hyber.org.access S010600207801ae82.vc.shawcable.net - - [05/Nov/2006:06:57:19 +0100] "GET /icons/pdf.gif HTTP/1.0" 404 261 "http://yaws.hyber.org/" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" S010600207801ae82.vc.shawcable.net - - [05/Nov/2006:06:57:22 +0100] "GET /favicon.ico HTTP/1.0" 404 259 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" S010600207801ae82.vc.shawcable.net - - [05/Nov/2006:06:57:49 +0100] "GET /favicon.ico HTTP/1.0" 404 259 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" S010600207801ae82.vc.shawcable.net - - [05/Nov/2006:06:57:58 +0100] "GET /index.yaws HTTP/1.0" 404 258 "http://yaws.hyber.org/" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" crawl-66-249-65-138.googlebot.com - - [05/Nov/2006:06:58:34 +0100] "GET /redirect2.yaws HTTP/1.1" 404 262 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" lj612545.inktomisearch.com - - [05/Nov/2006:06:59:25 +0100] "GET /robots.txt HTTP/1.0" 404 258 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" lj611447.inktomisearch.com - - [05/Nov/2006:06:59:25 +0100] "GET /contact.yaws HTTP/1.0" 404 260 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" dsl-189-142-83-233.prod-infinitum.com.mx - - [05/Nov/2006:07:01:35 +0100] "GET / HTTP/1.1" 200 18088 "http://www.google.com.mx/search?hl=es&q=yaws&btnG=B%C3%BAsqueda+en+Google&meta=" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" dsl-189-142-83-233.prod-infinitum.com.mx - - [05/Nov/2006:07:01:41 +0100] "GET / HTTP/1.1" 200 18088 "http://www.google.com.mx/search?hl=es&q=yaws&btnG=B%C3%BAsqueda+en+Google&meta=" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" dsl-189-142-83-233.prod-infinitum.com.mx - - [05/Nov/2006:07:01:41 +0100] "GET /icons/back.gif HTTP/1.1" 404 262 "http://yaws.hyber.org/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" The erlang version, [root@REDACTED]src > /usr/local/bin/erl Erlang (BEAM) emulator version 5.4.10 [source] [hipe] Eshell V5.4.10 (abort with ^G) 1> -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From thomasl_erlang@REDACTED Mon Nov 6 10:47:02 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 6 Nov 2006 01:47:02 -0800 (PST) Subject: [erlang-questions] regexp is slow In-Reply-To: <454E6884.1010508@telia.com> Message-ID: <20061106094702.64501.qmail@web38811.mail.mud.yahoo.com> --- Robert Virding wrote: > 2. counting occuring patterns regexp:matches > > Counting patterns was no problem, that went fast. It > was the > substitution part that was taking most of the time. > Not finding the > matching parts of the data but doing the actual > substitutions. This is > one part of the code which much be improved, it was > never considered > that it would process such large amounts of data. > Having the data in a > binary would definitely NOT help here, it would > result in an enormous > amount of copying. i haven't looked at the precise problem, but would it help to return a list of binaries instead? Cut out the match and put in the substitute instead: [..., <<"before match">>, <<"substitution">>, <<"between matches">>, <<"next subst">>, ... ] In the larger scheme of things, it might be nice to have some way to stream large binaries (aka map, fold, ...) more transparently. Maybe Jay Nelson's paper at the 2005 workshop could be a starting point? Best, Thomas ____________________________________________________________________________________ Everyone is raving about the all-new Yahoo! Mail (http://advision.webevents.yahoo.com/mailbeta/) From xpdoka@REDACTED Mon Nov 6 10:49:51 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Mon, 6 Nov 2006 10:49:51 +0100 (CET) Subject: [erlang-questions] : Package Support/Use In-Reply-To: <20061103083805.GA27509@erix.ericsson.se> References: <200611020140.kA21e6dr226161@atlas.otago.ac.nz> <454AE038.5040900@ericsson.com> <20061103083805.GA27509@erix.ericsson.se> Message-ID: <7926.83.204.231.84.1162806591.squirrel@www.geekisp.com> Hi Raimo, > Can someone explain this eiffel solution, that many deem better... In Eiffel, as in Erlang, the code for a class can directly reference another class, by name, without doing anything like an #include. There is only a single, global namespace for class names. A cluster of classes is a bit like an Erlang application: it's a collection of source files residing in a directory. LACE is a Language for the Assembly of Clusters in Eiffel. It's an external file (not Eiffel source code) that provides the compilation system with some additional information about how to compile, run, and assemble the clusters. One of the things you can do in a LACE file is to specify that cluster A is going to rename class Foo from cluster B, and call it Bar instead. Cluster A is then free to have its own Foo class, or to use a Foo class from a third cluster C. Hope that helps, Dominic Williams http://www.dominicwilliams.net ---- From bengt.kleberg@REDACTED Mon Nov 6 10:58:34 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 06 Nov 2006 10:58:34 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454EFE5E.9080407@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454EFE5E.9080407@ericsson.com> Message-ID: <454F074A.1050909@ericsson.com> On 2006-11-06 10:20, Mats Cronqvist wrote: > Bob Ippolito wrote: >> It's clear that much of the standard library prefers to return tagged >> tuples instead of using exceptions. > > true enough. i believe rectifying this was one of the motivations behind the > rewrite of the standard libraries referred to earlier in this thread. you are correct. from the ''CONVENTIONS'' file: - A function should *not* return wrapped values like {ok,Value}/{error,Reason} to indicate success or failure. The assumed behaviour should be success, and failures should be signalled by exceptions, as described below. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From qrilka@REDACTED Mon Nov 6 11:08:01 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Mon, 6 Nov 2006 13:08:01 +0300 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454F074A.1050909@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454EFE5E.9080407@ericsson.com> <454F074A.1050909@ericsson.com> Message-ID: <337538cb0611060208p23de5a62wbbc47460b89fc526@mail.gmail.com> Where does this file come from? I do not see such a file in my Erlang distribution... On 11/6/06, Bengt Kleberg wrote: > > On 2006-11-06 10:20, Mats Cronqvist wrote: > > Bob Ippolito wrote: > >> It's clear that much of the standard library prefers to return tagged > >> tuples instead of using exceptions. > > > > true enough. i believe rectifying this was one of the motivations > behind the > > rewrite of the standard libraries referred to earlier in this thread. > > you are correct. from the ''CONVENTIONS'' file: > > - A function should *not* return wrapped values like > {ok,Value}/{error,Reason} to indicate success or > failure. The assumed behaviour should be success, > and failures should be signalled by exceptions, > as described below. > > > bengt > -- > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Mon Nov 6 11:30:49 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 6 Nov 2006 11:30:49 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: Message-ID: Christian S wrote: > > > > only a closet C programmer would use that idiom. > > How are tagged tuples bad? How do one reason for such an opinion? > > I share the despise for C programming nowdays, but there I > learned to love sprinkling assert() sanity checks all over > the code. They caught so many errors that I thought were impossible. > > I find that tagged tuples does much of the same for me in Erlang. > Crash as soon as possible when code derails off what I > intended it to do. Nor do I find this to exclude the use of > throwing exceptions. With tagged return values, you either use case statements to check whether the call worked. To use my favourite example: case timer:send_after(Time, timeout) of {ok, TimerRef} -> %% continue happily ...; {error, Reason} -> %% ...!? A free beer at the EUC to anyone who can %% figure out a useful alternative to crashing. ... end. or use assertions: {ok, TimerRef} = timer:send_after(Time, timeout), ... The problem with the latter is that if your function contains several of those constructs, say: read_data() -> {ok, Bin_a} = file:read_file("a"), {ok, Bin_b} = file:read_file("b"), {ok, Bin_c} = file:read_file("c"), [Bin_a, Bin_b, Bin_c]. and you get an exit with {badmatch, {error, enoent}}, you're lost regarding what particular line caused the error, unless the Reason part is unique for all constructs. On the other hand, if the called function exits, like: 2> erlang:start_timer(a,self(),timeout). =ERROR REPORT==== 6-Nov-2006::11:29:22 === Error in process <0.40.0> with exit value: {badarg,[{erlang,start_timer,[a,<0.40.0>,timeout]},{erl_eval,do_apply,5} ,{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {badarg,[{erlang,start_timer,[a,<0.40.0>,timeout]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** and the exit message reports the actual arguments passed to the crashed function, I'm much better off. BR, Ulf W From mats.cronqvist@REDACTED Mon Nov 6 11:34:49 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 06 Nov 2006 11:34:49 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> Message-ID: <454F0FC9.2090701@ericsson.com> Christian S wrote: > On 11/6/06, Bob Ippolito wrote: >> On 11/6/06, Mats Cronqvist wrote: >> > Richard A. O'Keefe wrote: >> > > Dominic Williams wrote: >> > > - returning tagged values vs. throwing >> > i hope you misremember, cause returning tagged tuples is truly >> abominable. >> > only a closet C programmer would use that idiom. > > How are tagged tuples bad? How do one reason for such an opinion? as a really dumb example, consider three functions open(Filename), read(FileDescriptor), and process_data(Data) that can either fail or return useful data. in C you'd do something like this; if ( ( fd = open(name)) == NULL ) return -1; if ( read(fd,&data) == -1 ) return -2; if ( process_data(&data,&pd) == -1 ) return -3; return 0; in Traditional Erlang something like this; {ok,FD} = open(Name), {ok,Data} = read(FD), {ok,PD} = process_data(Data), in BettErl (tm); process_data(read(open(Name))), TradErl is more verbose and binds worthless intermediate variables. TradErl has poor error reporting. it will either succeed or fail with "badmatch". not very helpful. the BettErl function will either succeed or throw useful stuff like {couldnt_open,Name} or {read_failure,enoent}, because that's how functions are written in BettErl; they either returns proper data or throws something meaningful. so, to answer your question, tagged tuples encourages verbose code with poor error reporting. in short, bad style. IMO. mats p.s. i'm aware there are some oopses in the meta-code (e.g. memory leaks). but i don't think that has any bearing on my conclusion. From ulf.wiger@REDACTED Mon Nov 6 11:37:48 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 6 Nov 2006 11:37:48 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> Message-ID: Richard A. O'Keefe wrote: > > In other languages, for example, coming to the end of a file > is NOT exceptional; most "files" HAVE an end. So a language > shouldn't indicate reaching the end of a file (for the first > time, at least) by raising an exception. I agree that a library function, "read the next N bytes of data", can return eof as a normal value. One could argue that a function "starting at position P, read N bytes of data", should not. It all boils down to whether an outcome is expected or not. In a large number of cases, there is a limited set of return types that are useful, and I think one should never, as a rule, return a useless result as a normal value. To continue with the file library, why, for example, does file:read/2 not crash when fed garbage? 3> file:read(bugger, 32). {error,einval} 4> file:read(bugger, a). {error,einval} BR, Ulf W From olivier.sambourg@REDACTED Mon Nov 6 11:54:36 2006 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Mon, 6 Nov 2006 11:54:36 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454F0FC9.2090701@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454F0FC9.2090701@ericsson.com> Message-ID: Hi, You could also use an assertion macro (which was suggested to me a while back on this list): -define(match(ExpectedResult, Expr, Error), ExpectedResult = fun() -> Res = (catch (Expr)), case Res of ExpectedResult -> Res; _ -> throw({match_error, Error}) end end()). And use it like this: ?match({ok,FD}, open(Name), open_file_error), ?match({ok,Data}, read(FD), read_data_error), etc. Keeps the TradErl philosophy, but with better error reporting. And you don't need to figure out every possible error in either open() or read() (but you still can if you want or if you have to : the exception will be thrown before the failed assertion) Olivier On 11/6/06, Mats Cronqvist wrote: > > Christian S wrote: > > On 11/6/06, Bob Ippolito wrote: > >> On 11/6/06, Mats Cronqvist wrote: > >> > Richard A. O'Keefe wrote: > >> > > Dominic Williams wrote: > >> > > - returning tagged values vs. throwing > >> > i hope you misremember, cause returning tagged tuples is truly > >> abominable. > >> > only a closet C programmer would use that idiom. > > > > How are tagged tuples bad? How do one reason for such an opinion? > > as a really dumb example, consider three functions open(Filename), > read(FileDescriptor), and process_data(Data) that can either fail or > return > useful data. in C you'd do something like this; > > if ( ( fd = open(name)) == NULL ) return -1; > if ( read(fd,&data) == -1 ) return -2; > if ( process_data(&data,&pd) == -1 ) return -3; > return 0; > > in Traditional Erlang something like this; > > {ok,FD} = open(Name), > {ok,Data} = read(FD), > {ok,PD} = process_data(Data), > > in BettErl (tm); > > process_data(read(open(Name))), > > TradErl is more verbose and binds worthless intermediate variables. > > TradErl has poor error reporting. > it will either succeed or fail with "badmatch". not very helpful. the > BettErl > function will either succeed or throw useful stuff like > {couldnt_open,Name} or > {read_failure,enoent}, because that's how functions are written in > BettErl; they > either returns proper data or throws something meaningful. > > so, to answer your question, tagged tuples encourages verbose code with > poor > error reporting. > in short, bad style. IMO. > > mats > > p.s. i'm aware there are some oopses in the meta-code (e.g. memory leaks). > but i > don't think that has any bearing on my conclusion. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Mon Nov 6 11:58:21 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 06 Nov 2006 11:58:21 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: Message-ID: "Ulf Wiger \(TN/EAB\)" writes: > > To continue with the file library, why, for example, does file:read/2 > not crash when fed garbage? > > 3> file:read(bugger, 32). > {error,einval} > 4> file:read(bugger, a). > {error,einval} > For no good reason, I would say. In newer code, we generally fail with an exception if a function is given arguments of the wrong type. I guess that we could change that to R12B, our even for R11B-3 if our commercial customers don't think that it would break anything. It would give Dialyzer better type information, allowing it to find more problems. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From richardc@REDACTED Mon Nov 6 12:22:25 2006 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 06 Nov 2006 12:22:25 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454F074A.1050909@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454EFE5E.9080407@ericsson.com> <454F074A.1050909@ericsson.com> Message-ID: <454F1AF1.8030107@it.uu.se> Bengt Kleberg wrote: > you are correct. from the ''CONVENTIONS'' file: > > - A function should *not* return wrapped values like > {ok,Value}/{error,Reason} to indicate success or > failure. The assumed behaviour should be success, > and failures should be signalled by exceptions, > as described below. A clarification: the mentioned file was part of my attempt to rewrite the standard libraries (but I only got as far as reorganizing the existing functions). It is not part of the Erlang distribution, with the exception that the alternative (packaged) names for all built-in functions can be used, unofficially; e.g., erl.lang.list:length/1. This remains experimental. Furthermore, the quoted statement needs to be qualified along the lines of what R. O'Keefe mentioned: exceptions should be used for conditions that are exceptional. There will always be a grey zone here, since it depends on how the function is used, so one needs to consider carefully what the _common_usage_ of the function will be. If you usually would write code that does not bother to handle the special cases - or that couldn't do anything meaningful even if you would like it to - then the special cases should probably be signalled using exceptions. If the code would typically always check for the special case anyway (regardless of how it is implemented), it should probably be handled by a special return value (e.g., if you have something like an iterator, you'd usually need to check if the end has been reached). End-of-file is definitely in the grey area, since many, but far from all read operations will read until eof. /Richard From bengt.kleberg@REDACTED Mon Nov 6 11:56:46 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 06 Nov 2006 11:56:46 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <337538cb0611060208p23de5a62wbbc47460b89fc526@mail.gmail.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454EFE5E.9080407@ericsson.com> <454F074A.1050909@ericsson.com> <337538cb0611060208p23de5a62wbbc47460b89fc526@mail.gmail.com> Message-ID: <454F14EE.8000204@ericsson.com> Kirill Zaborski On 2006-11-06 11:08, Kirill Zaborski wrote: > Where does this file come from? I do not see such a file in my Erlang > distribution... sorry about that. i should have said that the file is part of the new standard library that was mentioned in the email i was answering to. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From mats.cronqvist@REDACTED Mon Nov 6 12:32:34 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 06 Nov 2006 12:32:34 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454F0FC9.2090701@ericsson.com> Message-ID: <454F1D52.8030101@ericsson.com> Olivier Sambourg wrote: > Hi, > > You could also use an assertion macro (which was suggested to me a while > back on this list): > [some coyote ugly code] > And use it like this: > > ?match({ok,FD}, open(Name), open_file_error), > ?match({ok,Data}, read(FD), read_data_error), well, you could of course do that. an objective problem is of course that to read this code it's not enough to know erlang, you must also understand what ?match does. a subjective problem is that it is so ugly it makes my toes curl. mats From chsu79@REDACTED Mon Nov 6 13:36:21 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 6 Nov 2006 13:36:21 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454F0FC9.2090701@ericsson.com> Message-ID: On 11/6/06, Olivier Sambourg wrote: > You could also use an assertion macro (which was suggested to me a while > back on this list): > > ?match({ok,FD}, open(Name), open_file_error), > ?match({ok,Data}, read(FD), read_data_error), > etc. And just look how pretty the code is! :) > > {ok,FD} = open(Name), > > {ok,Data} = read(FD), > > {ok,PD} = process_data(Data), I dont mind intermediate variables at all when they can be given useful names, I find that they double as comments then. Plus,... I type faster than I code. The fact that badmatch exceptions have less information (source location!) than one would desire is unfortunate (not changeable due to backwards compat?). As for what is truly exceptional and what isn't: I think it is the choice of the programmer to pick what "story" he/she wants to present: If the code above takes a wiki page name from the user, tries to find/open it and then parse it for a web presentation, then it isnt so exceptional if the page doesnt exist. I would like to claim that a nonlocal exit using exceptions would make the intent of the code harder to read if open threw an exception. If the code instead opens a file using a name that was stored in an ets table, a table with the intent that all filenames in the table exist in the filesystem. Then it really is an exception if the file cant be opened. Deciding what error handling to do at the point 'open' returns is difficult and one better jump directly to the exception handler from inside 'open'. I reject neither exceptions nor tagged tuples, I want both as options in the standard libraries. From nm@REDACTED Mon Nov 6 14:22:16 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 06 Nov 2006 17:22:16 +0400 Subject: [erlang-questions] quick search page In-Reply-To: <6344005f0611051548n678b9492nb7cb09b0a3c0317c@mail.gmail.com> References: <454D276A.2070000@web.am> <6344005f0611051548n678b9492nb7cb09b0a3c0317c@mail.gmail.com> Message-ID: <454F3708.7010909@web.am> Erlang search engine form is also integrated. I'll add some JS a little bit later to make search more convient. Adam Lindberg wrote: > Also there is the Erlang Search Engine in Google Co-op. It can be found here: > > http://shurl.org/erlang > > It limits Google's searches to a subset of Erlang related pages. > > Cheers > Adam > > On 11/5/06, user wrote: >> Gaspar Chilingarov web.am> writes: >> >>> Hi all! >>> >>> I would like to share with you link to this small page, which contains >>> two search forms - for erlang documentation and for erlang mailing lists >>> >>> http://zanazan.am/erlang/ >>> >> Good job, it's certainly nicer than google. >> >> An even better solution would be having a GotAPI interface for OTP/Erlang: >> >> http://gotapi.com/ >> http://start.gotapi.com/ >> >> I don't know why the Erlang maintainers don't contact them. It would certainly >> be a big plus for Erlang if there were such a snazzy, easy to use interface for >> the documentation. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From thomasl_erlang@REDACTED Mon Nov 6 14:52:27 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 6 Nov 2006 05:52:27 -0800 (PST) Subject: [erlang-questions] Package Support/Use In-Reply-To: Message-ID: <20061106135227.74692.qmail@web38808.mail.mud.yahoo.com> --- "Ulf Wiger (TN/EAB)" wrote: > The problem with the latter is that if your function > contains several of > those constructs, say: > > > read_data() -> > {ok, Bin_a} = file:read_file("a"), > {ok, Bin_b} = file:read_file("b"), > {ok, Bin_c} = file:read_file("c"), > [Bin_a, Bin_b, Bin_c]. > > and you get an exit with {badmatch, {error, > enoent}}, you're lost > regarding what particular line caused the error, > unless the Reason part > is unique for all constructs. The underlying problem here is that the standard exceptions are uninformative to the point of uselessness. If the compiler instead would generate something like smart exceptions (which is, alas, at best a partial solution; see jungerl), which also include information about module, line, arguments, etc., then that problem would go away. Or, if I can dream, one could do even better with some support from the VM. Regarding exceptions vs tagged tuples, I theoretically prefer exceptions but have found that I often need to use tagged tuples in practice. If I instead will have to wrap calls in catch to figure out and handle (usually undocumented) exception values, not a terrible lot has been gained. Best, Thomas ____________________________________________________________________________________ Sponsored Link Free Uniden 5.8GHz Phone System with Packet8 Internet Phone Service http://www.getpacket8.net/yahoo2 From mats.cronqvist@REDACTED Mon Nov 6 14:41:30 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 06 Nov 2006 14:41:30 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454F0FC9.2090701@ericsson.com> Message-ID: <454F3B8A.8000408@ericsson.com> Christian S wrote: >> > {ok,FD} = open(Name), >> > {ok,Data} = read(FD), >> > {ok,PD} = process_data(Data), > > I dont mind intermediate variables at all when they can be given useful > names, > I find that they double as comments then. Plus,... I type faster than > I code. in BettErl you could of course write; FD = open(Name), Data = read(FD), PD = process_data(Data), > The fact that badmatch exceptions have less information > (source location!) than one would desire is unfortunate (not > changeable due to backwards compat?). see smart_exceptions (in jungerl) by Thomas Lindgren. i don't know if there is a good reason not to include this in OTP. performance? > As for what is truly exceptional and what isn't: I think it is the > choice of the programmer to pick what "story" he/she wants to present: i see it as "exception" (a case that does not conform to a rule or generalization), not "exceptional" (extraordinary). e.g. if i read 1,000 bytes from a file, it is not exceptional that i get an eof, but it is an exception. hence file:read/2 should return data or throw. e.g. to fold over 1,000 byte blocks; fold(FD,Fun,Acc) -> try fold(FD,Fun,Fun(file:read(FD,1000),Acc)) catch eof -> Acc end. > I reject neither exceptions nor tagged tuples, I want both as options > in the standard libraries. two versions of each function? mats From samuelrivas@REDACTED Mon Nov 6 15:24:09 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Mon, 6 Nov 2006 15:24:09 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <6a36e7290611060036w7d1acb2dr5c62984d4a26f986@mail.gmail.com> <454F0FC9.2090701@ericsson.com> Message-ID: <20061106142409.GA21593@lambdastream.com> Christian S wrote: > I reject neither exceptions nor tagged tuples, I want both as options > in the standard libraries. When you call a function that uses exceptions you can either catch the exception if you want or ignore it if it is meaningless in the context. Higher level functions can catch the exception later. With tagged values you _must_ handle the tagged value, even if you want to ignore error cases. So with exceptions you already have the choice. Regards. -- Samuel From richardc@REDACTED Mon Nov 6 17:04:21 2006 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 06 Nov 2006 17:04:21 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061106135227.74692.qmail@web38808.mail.mud.yahoo.com> References: <20061106135227.74692.qmail@web38808.mail.mud.yahoo.com> Message-ID: <454F5D05.3010103@it.uu.se> Thomas Lindgren wrote: > Regarding exceptions vs tagged tuples, I theoretically > prefer exceptions but have found that I often need to > use tagged tuples in practice. If I instead will have > to wrap calls in catch to figure out and handle > (usually undocumented) exception values, not a > terrible lot has been gained. Exceptions need to be documented as part of the function interface. And yes, this information can be tricky both to get right in the first place, and to keep up to date. But it must be done. In fact, the problem is just another instance of the problem of returning values that you get from a call to some library function: if the library function is updated, so that it might suddenly yield a value that previous versions would never return, then your own function can suddenly also return this value (unless you check the return values of all functions you call, and do ...well, something, about it). If you (anyone) thinks this does not happen in statically typed languages, think again: If a function is declared to return 'int', but actually returns only a subset of int, within a certain range (perhaps error codes), the compiler will not be able to check if a caller is expecting values within that range. Hence, your function, nicely documented to return values in the range 1-100, might suddenly return 101. If you think enums or range types can fix this, try it with strings instead of integers. The only way to guarantee that you pass on exactly the data you claim to do, is to run a complete check for well-formedness on it (this can be done in assertions or pre/postconditions), or to always build your own return values from scratch (as a function of what the library function returned). The angst over exceptions as part of function signatures in the Java world is precisely because people are suddenly confronted with a lot more of this kind of dynamic typing than they have been used to: In Java, what class of exceptions should you say that your function might throw? You probably can't change the interface later. If you would need to add a call to some library function, that might throw an exception that is outside the class that you declared, you're stuck handling it somehow (perhaps by throwing a different exception that fits your interface). Exceptions are a side-band transfer mechanism, and making exceptions part of the function prototype does not interact well with evolution of code. C# probably made a better decision. Enough ranting for now, /Richard From erlangx@REDACTED Mon Nov 6 19:07:38 2006 From: erlangx@REDACTED (Michael McDaniel) Date: Mon, 6 Nov 2006 10:07:38 -0800 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454EECC1.7040007@ericsson.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> Message-ID: <20061106180738.GD11200@delora.autosys.us> On Mon, Nov 06, 2006 at 09:05:21AM +0100, Mats Cronqvist wrote: > Richard A. O'Keefe wrote: > > Dominic Williams wrote: > > - returning tagged values vs. throwing > > > > I thought we did have advice about that? I can't remember where > > I saw it, but it was along the lines of "don't use exceptions > > except for things that are really exceptional". In other languages, > > for example, coming to the end of a file is NOT exceptional; most > > "files" HAVE an end. So a language shouldn't indicate reaching the end > > of a file (for the first time, at least) by raising an exception. > > i hope you misremember, cause returning tagged tuples is truly abominable. > only a closet C programmer would use that idiom. > > mats _______________________________________________ containing a variety of suggestions ... http://www.erlang.se/doc/programming_rules.shtml ~M From robert.virding@REDACTED Mon Nov 6 23:29:02 2006 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 06 Nov 2006 23:29:02 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: References: <454B301D.3050208@ericsson.com> <454E6884.1010508@telia.com> Message-ID: <454FB72E.8040606@telia.com> Ulf Wiger wrote: > Den 2006-11-05 23:41:08 skrev Robert Virding : > >> Counting patterns was no problem, that went fast. It was the >> substitution part that was taking most of the time. Not finding the >> matching parts of the data but doing the actual substitutions. This is >> one part of the code which much be improved, it was never considered >> that it would process such large amounts of data. Having the data in a >> binary would definitely NOT help here, it would result in an enormous >> amount of copying. > > > Well, the HiPE team's byte_array to the rescue then, eh? ;-) The problem is that any array representation is not right, you get a large amount of byte shifting which is costly. For example the first pass is a substitution which removes all newlines and some specific lines. The problem is that the current implementation is overly naive ans results in excessive creation of lists. Robert P.S. Yes the first pass could be done in a better way but it is actually part of the problem, a pre-defined must be used to do this. From robert.virding@REDACTED Mon Nov 6 23:40:06 2006 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 06 Nov 2006 23:40:06 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: <20061106094702.64501.qmail@web38811.mail.mud.yahoo.com> References: <20061106094702.64501.qmail@web38811.mail.mud.yahoo.com> Message-ID: <454FB9C6.1050004@telia.com> Thomas Lindgren wrote: > > --- Robert Virding wrote: > > >>2. counting occuring patterns regexp:matches >> >>Counting patterns was no problem, that went fast. It >>was the >>substitution part that was taking most of the time. >>Not finding the >>matching parts of the data but doing the actual >>substitutions. This is >>one part of the code which much be improved, it was >>never considered >>that it would process such large amounts of data. >>Having the data in a >>binary would definitely NOT help here, it would >>result in an enormous >>amount of copying. > > > i haven't looked at the precise problem, but would it > help to return a list of binaries instead? Cut out the > match and put in the substitute instead: > > [..., > <<"before match">>, > <<"substitution">>, > <<"between matches">>, > <<"next subst">>, > ... > ] > > In the larger scheme of things, it might be nice to > have some way to stream large binaries (aka map, fold, > ...) more transparently. Maybe Jay Nelson's paper at > the 2005 workshop could be a starting point? In this case it wouldn't help at all as the result from each substitution is passed directly into a new subst. You loop over a pre-defined set of substitutions threading the result through. Both the problem and the way it is to be solved is defined: 1. read in the file and pass through a subst which removes all newlines and some specific lines. 2. count the number occurences of about 10 regexps. 3. do a sequence of substitutions, about 10-12, on the data. 4. write out some statistics. This means that you either need to have -> operations (lists, binaries, whatever) or be able to handle complex combinations. Robert From robert.virding@REDACTED Tue Nov 7 00:07:18 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 07 Nov 2006 00:07:18 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061106180738.GD11200@delora.autosys.us> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> Message-ID: <454FC026.4050903@telia.com> Sorry, I find this discussion completely ridiculous! Having everything as an exception is just as stupid and difficult to manage as having nothing as an exception! Irrespective if you define the exceptions as part of the documentation of a function, it is not a documentation problem as such. Save exceptions for things which are truly exceptional or program errors or where things have gone wrong. If the arguments to file:open have the wrong format or are wrong then it is a program error and should be signalled with an exception, if the file does not exist then it is application dependant whether it is an exception or an accepted return. If I signal both as an exception then I will always have to be able to handle the exception case which will realy complicate the programmers job. "Let's see which exceptions signaled a file which wasn't there? Ah, these 5 exceptions handle that case. I know I will write a new library function which handles these cases for me which will make my life easier." Perhaps we should have used {yes,Value}|{no,Reason} instead of the more loaded ok/error? I have been known to have rather dogmatic views sometimes (often) but soem commonsense is needed. Robert From ok@REDACTED Tue Nov 7 03:32:18 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 7 Nov 2006 15:32:18 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> Mats Cronqvist wrote: as a really dumb example, consider three functions open(Filename), read(FileDescriptor), and process_data(Data) that can either fail or return useful data. in C you'd do something like this; if ( ( fd = open(name)) == NULL ) return -1; if ( read(fd,&data) == -1 ) return -2; if ( process_data(&data,&pd) == -1 ) return -3; return 0; That's pretty unforgivable C: nowhere does it close the file, and file descriptors are a resource in fairly short supply. (And of course open has either 2 or 3 arguments, and read has 3.) (And of course there are four possible outcomes for read(fd, sizeof data, &data) : result == sizeof data => success : result < sizeof data && result > 0 => partial read; if you are reading a known structure from a disc file it's probably a bad case, if you are reading from a terminal or a tape drive this can be expected on practically every read : result == 0 => normal end of file : result < 0 => some exceptional problem in Traditional Erlang something like this; {ok,FD} = open(Name), {ok,Data} = read(FD), {ok,PD} = process_data(Data), Again, that is pretty unforgivable Erlang: if open/1 creates a resource which will not be automatically freed. As has been pointed out on this list before, just define ok({ok,X}) -> X; ok(Error) -> signal some kind of error. and your Traditional Erlang can become ok(process_data(ok(read(ok(open(Name)))))) in BettErl (tm); process_data(read(open(Name))), TradErl is more verbose and binds worthless intermediate variables. Verbose, yes, a little bit. But it certainly doesn't REQUIRE you to "bind worthless intermediate variables", that's a straw man. Traditional Erlang, with the ok/1 function, gives you the CHOICE of looking at the error result or not, and if you choose not to, there are NO intermediate variables unless you want them. TradErl has poor error reporting. it will either succeed or fail with "badmatch". not very helpful. Again, this is only because the example is a straw man. With the ok/1 function, you DON'T 'fail with "badmatch"', you get the full information that the function returned. So no, The "TradErl" approach is IN NO WAY INFERIOR with regard to error reporting. the BettErl function will either succeed or throw useful stuff like {couldnt_open,Name} or {read_failure,enoent}, because that's how functions are written in BettErl; And the Traditional Erlang version with the ok/1 function does exactly the same thing. so, to answer your question, tagged tuples encourages verbose code with poor error reporting. in short, bad style. IMO. Nope. All you have demonstrated is that bad code *can* be written in the traditional style, not that it *must* be. mats p.s. i'm aware there are some oopses in the meta-code (e.g. memory leaks). but i don't think that has any bearing on my conclusion. It has a major bearing on your conclusion, which was an argument about "bad style". A style that encourages leaks can hardly be called a good style, now can it? The score sheet now looks like this: Traditional Throw-happy More verbose A little no Worse error reporting no no Encourages leaks no yes The real issue is how exceptional the exceptional condition is and whether it is likely that the caller can do anything in an error case other than pass it on. A regular expression not matching is not exceptional. A regular expression having bad syntax IS exceptional. Reaching the end of a file *between* characters is not exceptional. Reaching the end of a file *within* the UTF-8 byte sequence for a character IS exceptional. For me in the open/read/process example, the really important thing is - if the file cannot be opened, is there likely to be anything the immediate caller can do about it? (Probably not: good case for an exception.) - if the read fails, is there anything the caller can do about it? A negative result from read(2) counts as exceptional; there is probably nothing the program can do about it (except when errno is EAGAIN, of course). There is something the caller MUST do, and that is close the file. EAGAIN is a strange special case here; in a language which supports lightweight processes we wouldn't need anything like that, so I don't want to use it in an argument either wey. EINTR is nasty. I do not believe I have ever seen a C program that handles it correctly, and I'm not only not sure what "correctly" would mean, to the extent that I think I know, I don't really believe it's POSSIBLE to handle correctly. Again, if it were Erlang all the way down, I don't believe cases like that would exist. - if process_data fails, is there anything the caller can do about it? Probably not, but does the process_data/1 function know where the problem should be logged? What does the code *really* look like in these two cases? % tagged results Channel = ok(open(Name)), Outcome = read(Channel), close(Channel), case Outcome of {ok,Data} -> ok(process_data(Data)) ; _ -> ok(Outcome) end % exceptions Channel = open(Name), try Data = read(Channel), after close(Channel) end, process_data(Data) Funny how the difference becomes less clear-cut when you make the example more realistic, isn't it? Any rate, as the person who designed and implemented exception handling in Quintus Prolog and single-handedly installed exception reporting throughout the entire QP system and library, I am not opposed to exceptions as such. What I am opposed to is designing in the use of exceptions without *thinking* about them, and specifically without thinking about whether a particular outcome really is exceptional or should be handled as part of normal control flow. One way to think about it is this: if this outcome occurs, would I be happy for the entire calling process to drop dead (with a suitable error report)? If the answer is "yes", then an exception is probably the right thing. From jay@REDACTED Tue Nov 7 04:54:23 2006 From: jay@REDACTED (Jay Nelson) Date: Mon, 06 Nov 2006 19:54:23 -0800 Subject: [erlang-questions] Parsing with regexp (was regexp is slow) Message-ID: <4550036F.8090401@duomark.com> Thomas Lindgren wrote: >/ i haven't looked at the precise problem, but would it />/ help to return a list of binaries instead? ... />/ In the larger scheme of things, it might be nice to />/ have some way to stream large binaries (aka map, fold, />/ ...) more transparently. Maybe Jay Nelson's paper at />/ the 2005 workshop could be a starting point? / Robert Virding wrote: > In this case it wouldn't help at all as the result from each > substitution is passed directly into a new subst. You loop over a > pre-defined set of substitutions threading the result through. The goal of the paper was to come up with a very efficient way to handle exactly these types of situations, where a subset of a large piece of data needs to be found / extracted and then transformed in some way. Using Joe's "inefficient coding style" works for small problems, but the heap quickly blows up when things get converted to lists. If you filter them and garbage collect you might get by but not if the data source is 10s of MBs. regexps are concise and convenient in a lot of situations, but there are two things I don't like: when the pattern gets to be so complicated that it can no longer be understood, and when it leads to particularly inefficient handling of data. As long as the data size isn't too big, the latter case shouldn't matter, unless it needs to execute many times. In erlang, a more efficient approach (and the one I tried to embrace in the paper), was to read the full data source as a single large binary. Any filtering or extraction was done so that the result was a list of sub-binaries pointing to the original data (essentially a struct with a pointer and a length which can be constructed quickly) without creating any intermediate structures or any garbage to collect. The filtered list could then be transformed, resulting in computational effort only being taken on the elements of the data stream that mattered. The fact that regexp uses substitution is an artifact of implementation or of sticking to the user's understanding of the model. It is not necessary to solve the problem. The sub-binary approach led to the natural desire for binary comprehensions. When that is soon available in the language, this approach will be very clear and reasonably efficient (although not as efficient as the BIFs, which really screamed). I have been working more on patterns, parsing and extraction, but I won't have anything to say about it publicly for a few more months. jay From ok@REDACTED Tue Nov 7 06:28:43 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 7 Nov 2006 18:28:43 +1300 (NZDT) Subject: [erlang-questions] Reified environments (was: Re: Package Support/Use) Message-ID: <200611070528.kA75Sho4257148@atlas.otago.ac.nz> I've been asked what I meant when I talked about reifying module environments and having more than one of them. You can think of this message as a *draft* description. To my surprise, it turns out that this approach not only does most of what I want without too much hassle, it can even provide something uncommonly like packages! One reason that this should be considered a draft is that there's a programmatic interface here, but no declarative interface, and the "application" support in OTP should be extended to provide a declarative interface. In the description I use variable names with a leading % sign and unquoted function names with a leading % sign. These are not to be taken literally; they are just a way of talking. To start with, I propose to distinguish between three different representations of a module. Two of them are file based, and one isn't. +---------------+ | Source form | .erl, .yrl, &c +---------------+ | | compile v +---------------+ | Object form | .jam, .beam, &c +---------------+ but also a data type | | bind v +---------------+ | Bound form | only a data type +---------------+ Compiling the source form of a module gives you the module in object form. These are normally though of as file based, although I have noted before that you could use compressed abstract syntax trees as an object form and that with a good compressor, the whole of the Erlang sources for Erlang/OTP would fit neatly into an amount of memory that the average Java program would sneer at as too small for Hello World. The point of Object form is to be something machine-independent with all the work other than native code generation that you'd expect to be done at compile time, done. However, the idea of modules with parameters has already been introduced into Erlang. And there is one more parameter that we don't normally think about, because at the moment there is only one of it. While most of Erlang is based on pure functions, there are some notable exceptions. And some of those exceptions are pretty bad: - each atom names a global variable whose value is a module (or nothing). - each atom names a global variable whose value is a process (or nothing). We have a *single* global name space for modules. (Packages do not really change this.) Let's call that %ME (for Module Environment). -import(M, [F/N]). acts as if F(X1, ..., XN) -> M:F(X1, ..., XN). had been written. M:F(X1, ..., XN) as a function call acts like (%deref(%flookup(%mlookup(%ME, M, KM), F, N, KF)) )(X1, ..., XN) where KM is true if M is an atom, false if it is a variable, KF is true if F is an atom, false if it is a variable. %mlookup(Module_Environment, Module, Create) when module(Module) -> Module; %mlookup(Module_Environment, Module, Create) when atom(Module) -> look the Module name up in the Module_Environment, if it was found -> the result is that module ; true = Create -> create a module object with no exports, install it in the module environment, the result is that new module ; true -> raise an error %mlookup(Module_Environment, Module, Create) -> raise an error because Module is the wrong type of thing. and %flookup(Module, Name, Arity, Create) when function(Name) -> if arity(Name) == Arity -> the result is the address of the function ; true -> raise an error end; %flookup(Module, Name, Arity, Create) when module(Module), atom(name), integer(Arity), Arity >= 0 -> look up Name/Arity in Module, if a {Function,Name,Arity} block was found -> the result is the address of the function ; true = Create -> create a function which will raise an error, install it in the Module, the result is that new function ; raise an error end; %flookup(Module, Name, Arity, Create) -> raise an error. At this point I am not concerned about {Module,Name} pairs. I take it that they are going to disappear. The reason that I made the %deref part explicit is that we expect m:f(X, Y) to turn into something like ld 'm:f/2', %l7 ld [X], %o0 call %l7 ld [Y], %o1 which is just one load instruction longer than a normal call. Part of the normal process of loading an object module into memory and preparing it for execution is doing the m:f/2 lookup at load time. Now that modules have parameters, we expect something more to happen: when we supply parameters to a module, we expect "preparing for execution" to involve substituting parameter values for parameters and doing constant propagation and any other optimisations enabled by that. I call the step of filling in parameters, including the addresses where the addresses of imported functions are/will be stored, constant propagation, other optimisation, and generation of native code BINDING. In the present setup, there is only one module environment, so every module has the same value for %ME. But there is no reason why that HAS to be so. And supplying a module with an environment to use for %ME is no different in principle from supplying a binding for any other parameter. The result of binding a module (to an environment, any other parameters, and of course a particular node) is a data structure in the shared heap of a node. While there is a name in the -module declaration, the module is not yet known by that name. A bound module is *just* a data structure. It referred to *other* modules by name, but that doesn't mean that they can refer to it. So imagine we have {ok,Object} = %compile(Source), {ok,Module} = %bind(Object, %ME, [Arguments]), Now we have something that we can pass around and invoke functions in: Module:module_info() for example. There's one more step: INSTALLING. A module may be installed under some name. ok = %install(%ME, Name, Module) A module may be installed under any number of names. If I want to talk about colour:yellow() and you want to talk about color:yellow(), there's no reason why we can't be talking about the same thing. (Currently there is an assumption that two different module names refer to two different modules, but since nothing stops the bodies of the source forms being identical, I doubt whether anyone relies on that.) You can install a module under a name that is not used, or that has a dummy definition created by %mlookup(). It might be advisable to have a separate Old_Module = %reinstall(%ME, Name, Module) for when you expect the module name to be in use, and Old_Module = %uninstall(%ME, Name) for when you want to undefine a module. All these names have % signs; just as the low level code management functions in Erlang shouldn't be used in ordinary user code, so these things need to have higher level wrappers. That's another reason this is a draft. All of this would just be a pointless variation on what we have now except for one thing. Who said there could only be one module environment? Suppose we want a flotilla of three modules 'a', 'b', 'c', with 'a' as the facade of the whole thing, called 'm'. E = %module:new_environment(), {ok,AO} = %module:load(a), {ok,BO} = %module:load(b), {ok,CO} = %module:load(c), {ok,AB} = %module:bind(AO, E, []), {ok,BB} = %module:bind(BO, E, []), {ok,CB} = %module:bind(CO, E, []), ok = %module:install(E, AB, %module:name(AO)), ok = %module:install(E, BB, %module:name(BO)), ok = %module:install(E, CB, %module:name(CO)), ok = %module:install(%ME, AB, m) In environment E, the only modules are a, b, c. In %ME, the module a is accessible under the name m, and b and c cannot be named at all. This fixes one weakness in the package system, which is that the package system does not provide any way of protecting the internal modules of an application. If one module can access module X under the package system, then EVERY module can access module X. Under the "multiple environment" scheme, we get encapsulation we can rely on. Of course, it's too bad that E doesn't contain any of the built in Erlang modules. So we really need E = %module:new_environment(), ok = %module:install_erlang_modules(E), ... Now we do have a problem, and it's this. Under the current scheme, if a module m1 wants to tell module m2 to call back to m1 for some things, it can do -module(m1). ... f(Init) -> m2:start(Init, m1). That doesn't work to well in the reified environments scheme, where we expect m1 to be usable when it doesn't *have* a name, not yet being registered anywhere, or when it is installed under some other name, and where we would like m2 to be able to call back to m1 despite m1 and m2 having different name spaces. The answer is to use -module(m1). ... f(Init) -> m2:start(Init, ?MODULE). and just change the expansion of ?MODULE to something that returns the actual module, not its name. Passing module names around between modules that were *bound* in the same environment *does* work, without any rewriting. Unlike packages, this doesn't actually involve any language changes, or any source-to-source transformation done by the compiler, so there are no corner cases where the transformations don't quite work. Now we add one more wrinkle. Instead of a module environment being a map from module names to modules, it becomes a PAIR of maps, one from module names to modules, and one from environment names to modules. I have to go home in a few minutes, so I'm going to just outline the idea. M1:M2:M3:F(X1, ..., Xn) => (%deref(%flookup(%mlookup(%elookup(%elookup(%ME, M1), M2), M3, KM), F, N, KF)))(X1, ..., Xn) where %elookup looks up an environment in the "environment fork" of an environment, while :M1:M2:M3:F(X1, ..., Xn) => (%deref(%flookup(%mlookup(%elookup(%elookup(%EE, M1), M2), M3, KM), F, N, KF)))(X1, ..., Xn) where %EE is an Erlang "root environment". And thus we get packages. You can use names like :erlang:lists:reverse(Xs) or you can just ensure that lists:reverse(Xs) works by installing :erlang:lists in your environment. The thing I have to skip now is what something like m1:m2:m3 or :m1:m2:m3 means on its own, and yes, that can be done in a context- independent way. From ulf@REDACTED Tue Nov 7 08:50:29 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 07 Nov 2006 08:50:29 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> References: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> Message-ID: Den 2006-11-07 03:32:18 skrev Richard A. O'Keefe : > > in Traditional Erlang something like this; > > {ok,FD} = open(Name), > {ok,Data} = read(FD), > {ok,PD} = process_data(Data), > > Again, that is pretty unforgivable Erlang: if open/1 creates > a resource which will not be automatically freed. Incorrect. The file will be closed automatically if the process dies. (But if the surrounding call is caught, this will of course not happen.) > As has been > pointed out on this list before, just define > > ok({ok,X}) -> X; > ok(Error) -> signal some kind of error. > > and your Traditional Erlang can become > > ok(process_data(ok(read(ok(open(Name)))))) > > in BettErl (tm); > > process_data(read(open(Name))), > > TradErl is more verbose and binds worthless > intermediate variables. > > Verbose, yes, a little bit. But it certainly doesn't > REQUIRE you to "bind worthless intermediate variables", > that's a straw man. But in fact, lots of erlang code out there actually looks like this (and I think it's fair to say that Mats has seen more Erlang code than most). The style of programming Mats calls TradErl is also used in examples (without ok/1 wrappers, which I believe to be rather uncommon) in OTP documentation. The 1-minute google test gave me the gen_tcp man page: http://www.erlang.org/doc/doc-5.5.1/lib/kernel-2.11.1/doc/html/gen_tcp.html where example code looks like: server() -> {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, {active, false}]), {ok, Sock} = gen_tcp:accept(LSock), {ok, Bin} = do_recv(Sock, []), ok = gen_tcp:close(Sock), Bin. > Traditional Erlang, with the ok/1 function, gives you the CHOICE > of looking at the error result or not, and if you choose not to, > there are NO intermediate variables unless you want them. > > TradErl has poor error reporting. > > it will either succeed or fail with "badmatch". not very helpful. > > Again, this is only because the example is a straw man. With the > ok/1 function, you DON'T 'fail with "badmatch"', you get the full > information that the function returned. Again, a correction is in order. Failing with "badmatch" doesn't mean that you only get 'badmatch'. You actually get the whole term that didn't match. In the file examples, you would get e.g. {badmatch, {error, enoent}}, but no information about what file operation caused it. In order for your ok/1 wrapper to give you any more than that, you have to provide it with some additional info. This is perhaps one reason why they're not used more often. > So no, The "TradErl" approach > is IN NO WAY INFERIOR with regard to error reporting. My experience is that it is. In many cases, the badmatch errors are sufficient, but too often they're not. This has the effect of prompting many programmers to write case statements even when they shouldn't have to. It's difficult to get them to change, partly because many programmers seem reluctant to have their program crash. > The real issue is how exceptional the exceptional condition is and > whether it is likely that the caller can do anything in an error > case other than pass it on. Agreed. > A regular expression not matching is not exceptional. > A regular expression having bad syntax IS exceptional. > Reaching the end of a file *between* characters is not exceptional. > Reaching the end of a file *within* the UTF-8 byte sequence for a > character IS exceptional. Agreed. > > For me in the open/read/process example, the really important thing is > > - if the file cannot be opened, > is there likely to be anything the immediate caller can > do about it? > (Probably not: good case for an exception.) But instead you get a wrapped error code, whether the reason be that the file doesn't exist, it exists but you don't have access to it, or you passed junk input to the function. The latter is a bug, and will be fixed, if I understood Bj?rn correctly. > - if the read fails, is there anything the caller can do about it? > A negative result from read(2) counts as exceptional; there is > probably nothing the program can do about it (except when errno > is EAGAIN, of course). > There is something the caller MUST do, and that is close the file. In C, but not in Erlang. The caller also has the option of dying, in which case the file will be closed automatically, as will all ports held by erlang processes. In some cases, even an Erlang programmer must take care to clean up a resource. In the file case, it's obviously when the caller _catches_ an error and continues. To make this easy, the new try construct has an 'after' clause: termize_file(Name) -> {ok,F} = file:open(Name, [read,binary]), try {ok,Bin} = file:read(F, 1024*1024), binary_to_term(Bin) after file:close(F) end. Example taken from the Erlang Reference Manual. Ironically, the function contains two TradErl assertions that can both fail with very similar 'badmatch' exceptions. What it does show, however, is how you can signal with 'try ... after' that a sequence _can_ fail, and that the file (if it were opened) will not be left opened. As you use this construct in your later example, I'm aware that you know about it. > What does the code *really* look like in these two cases? > > % tagged results > > Channel = ok(open(Name)), > Outcome = read(Channel), > close(Channel), > case Outcome > of {ok,Data} -> ok(process_data(Data)) > ; _ -> ok(Outcome) > end > > % exceptions > > Channel = open(Name), > try > Data = read(Channel), > after > close(Channel) > end, > process_data(Data) > > Funny how the difference becomes less clear-cut when you make the > example more realistic, isn't it? But in the "tagged results" example above, you don't close the Channel if read/1 crashes, right? > One way to think about it is this: > > if this outcome occurs, would I be happy for the entire calling > process to drop dead (with a suitable error report)? > > If the answer is "yes", then an exception is probably the right thing. Absolutely. This is why timer:send_after/2 returning {error, Reason} is my favourite example of bad use of tagged return values. I've never been able to figure out what fruitful action the caller should take when the system responds, "sorry, you can't start a timer at this point in time." (: BR, Ulf W -- Ulf Wiger From robert.virding@REDACTED Tue Nov 7 08:55:07 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 07 Nov 2006 08:55:07 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> Message-ID: <45503BDB.3030106@telia.com> Richard A. O'Keefe wrote: > Dominic Williams wrote: > Compared to some other language communities I have known, > this one is actually rather weak on community > standards. I'll just offer three examples: > > - naming (camel case vs. underscore) > > May I request a compiler option, enabled by default, to flag > every occurrence of baStudlyCaps as a style error? Definitely! A while back someone sent out a reference to a paper discussing the legibility of various styles (was that you Richard?), could they please send that reference again? Robert From robert.virding@REDACTED Tue Nov 7 09:03:20 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 07 Nov 2006 09:03:20 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> References: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> Message-ID: <45503DC8.1000409@telia.com> All I can say is that I completely agree with Richard here. And that I have NEVER EVER written a file handling sequence in a serious application as simply as your test case, it's always more complex. Robert Richard A. O'Keefe wrote: > Mats Cronqvist wrote: > as a really dumb example, consider three functions open(Filename), > read(FileDescriptor), and process_data(Data) that can either fail or return > useful data. in C you'd do something like this; > > if ( ( fd = open(name)) == NULL ) return -1; > if ( read(fd,&data) == -1 ) return -2; > if ( process_data(&data,&pd) == -1 ) return -3; > return 0; > > That's pretty unforgivable C: nowhere does it close the file, > and file descriptors are a resource in fairly short supply. > (And of course open has either 2 or 3 arguments, and read has 3.) > (And of course there are four possible outcomes for > read(fd, sizeof data, &data) > : result == sizeof data => success > : result < sizeof data && result > 0 => partial read; > if you are reading a known structure from a disc file > it's probably a bad case, if you are reading from a terminal > or a tape drive this can be expected on practically every read > : result == 0 => normal end of file > : result < 0 => some exceptional problem > > in Traditional Erlang something like this; > > {ok,FD} = open(Name), > {ok,Data} = read(FD), > {ok,PD} = process_data(Data), > > Again, that is pretty unforgivable Erlang: if open/1 creates a resource > which will not be automatically freed. As has been pointed out on this > list before, just define > > ok({ok,X}) -> X; > ok(Error) -> signal some kind of error. > > and your Traditional Erlang can become > > ok(process_data(ok(read(ok(open(Name)))))) > > in BettErl (tm); > > process_data(read(open(Name))), > > TradErl is more verbose and binds worthless intermediate variables. > > Verbose, yes, a little bit. But it certainly doesn't REQUIRE > you to "bind worthless intermediate variables", that's a straw man. > Traditional Erlang, with the ok/1 function, gives you the CHOICE > of looking at the error result or not, and if you choose not to, > there are NO intermediate variables unless you want them. > > TradErl has poor error reporting. > > it will either succeed or fail with "badmatch". not very helpful. > > Again, this is only because the example is a straw man. With the > ok/1 function, you DON'T 'fail with "badmatch"', you get the full > information that the function returned. So no, The "TradErl" approach > is IN NO WAY INFERIOR with regard to error reporting. > > the BettErl function will either succeed or throw useful stuff > like {couldnt_open,Name} or {read_failure,enoent}, because that's how > functions are written in BettErl; > > And the Traditional Erlang version with the ok/1 function does exactly the > same thing. > > so, to answer your question, tagged tuples encourages verbose > code with poor error reporting. in short, bad style. IMO. > > Nope. All you have demonstrated is that bad code *can* be written in > the traditional style, not that it *must* be. > > mats > > p.s. i'm aware there are some oopses in the meta-code (e.g. > memory leaks). but i don't think that has any bearing on my > conclusion. > > It has a major bearing on your conclusion, which was an argument about > "bad style". A style that encourages leaks can hardly be called a good > style, now can it? The score sheet now looks like this: > > Traditional Throw-happy > > More verbose A little no > Worse error reporting no no > Encourages leaks no yes > > The real issue is how exceptional the exceptional condition is and > whether it is likely that the caller can do anything in an error > case other than pass it on. > > A regular expression not matching is not exceptional. > A regular expression having bad syntax IS exceptional. > Reaching the end of a file *between* characters is not exceptional. > Reaching the end of a file *within* the UTF-8 byte sequence for a > character IS exceptional. > > For me in the open/read/process example, the really important thing is > > - if the file cannot be opened, > is there likely to be anything the immediate caller can do about it? > (Probably not: good case for an exception.) > > - if the read fails, is there anything the caller can do about it? > A negative result from read(2) counts as exceptional; there is > probably nothing the program can do about it (except when errno > is EAGAIN, of course). > There is something the caller MUST do, and that is close the file. > > EAGAIN is a strange special case here; in a language which supports > lightweight processes we wouldn't need anything like that, so I > don't want to use it in an argument either wey. > > EINTR is nasty. I do not believe I have ever seen a C program that > handles it correctly, and I'm not only not sure what "correctly" > would mean, to the extent that I think I know, I don't really > believe it's POSSIBLE to handle correctly. Again, if it were > Erlang all the way down, I don't believe cases like that would exist. > > - if process_data fails, is there anything the caller can do about it? > Probably not, but does the process_data/1 function know where the > problem should be logged? > > What does the code *really* look like in these two cases? > > % tagged results > > Channel = ok(open(Name)), > Outcome = read(Channel), > close(Channel), > case Outcome > of {ok,Data} -> ok(process_data(Data)) > ; _ -> ok(Outcome) > end > > % exceptions > > Channel = open(Name), > try > Data = read(Channel), > after > close(Channel) > end, > process_data(Data) > > Funny how the difference becomes less clear-cut when you make the > example more realistic, isn't it? > > Any rate, as the person who designed and implemented exception handling > in Quintus Prolog and single-handedly installed exception reporting > throughout the entire QP system and library, I am not opposed to exceptions > as such. What I am opposed to is designing in the use of exceptions > without *thinking* about them, and specifically without thinking about > whether a particular outcome really is exceptional or should be handled > as part of normal control flow. One way to think about it is this: > > if this outcome occurs, would I be happy for the entire calling > process to drop dead (with a suitable error report)? > > If the answer is "yes", then an exception is probably the right thing. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From samuelrivas@REDACTED Tue Nov 7 09:08:51 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Tue, 7 Nov 2006 09:08:51 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values (was Package Support/Use) In-Reply-To: <454FC026.4050903@telia.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> <454FC026.4050903@telia.com> Message-ID: <20061107080851.GA6907@lambdastream.com> Robert Virding wrote: > Having everything as an exception is just as stupid and difficult to > manage as having nothing as an exception! Irrespective if you define the > exceptions as part of the documentation of a function, it is not a > documentation problem as such. > > Save exceptions for things which are truly exceptional or program errors > or where things have gone wrong. > > If the arguments to file:open have the wrong format or are wrong then it > is a program error and should be signalled with an exception, if the > file does not exist then it is application dependant whether it is an > exception or an accepted return. If I signal both as an exception then I > will always have to be able to handle the exception case which will > realy complicate the programmers job. You only have to handle the exception case if you need it. You can try-catch matching with enoent exception ignoring any other exception if you want. With tagged values you have to add an extra case to propagate the errors you do not handle. try file:open("foo.txt") of Descriptor -> do_something(Descriptor) catch enoent -> do_another_thing() end end Versus case file:open("foo.txt") of {ok, Descriptor} -> do_something(Descriptor); {error, enoent} -> do_another_thing(); {error, Reason} -> {error, Reason} end. > "Let's see which exceptions signaled a file which wasn't there? Ah, > these 5 exceptions handle that case. I know I will write a new library > function which handles these cases for me which will make my life easier." But that is a problem of error handling. How do tagged values improve it? You also have to know which values signal which errors. > Perhaps we should have used {yes,Value}|{no,Reason} instead of the more > loaded ok/error? > > I have been known to have rather dogmatic views sometimes (often) but > soem commonsense is needed. I find tagged-values to be against common sense, though. Maybe we look at them as the natural way because they have been there for a long time, but they are inconvenient IMO. Think about file:open type: "It is a function that receives a file name and returns a tuple. The first element of the tuple is either ok, or error. If the first element is ok, the second element is a file descriptor. Otherwise, the second element is a term() indicating an error". Whereas the expected type should be : "It is a function that receives a file name and returns a file descriptor (DOT)". So, I am changing the problem of "what is an exception?" by "is the function type clear and simple?". If you prefer the first type for file:open, then eof, enoent, etc. are not exceptions. However, I'd rather have the second data type; it is less astonishing. For what you call "program errors", there is another exception level: errors. With try-catch you can distinguish between throws (exceptions), exits, and errors. Now the problem is learning to use each of them in the right situation, but this is another matter. Regards. -- Samuel From bengt.kleberg@REDACTED Tue Nov 7 09:09:50 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 07 Nov 2006 09:09:50 +0100 Subject: [erlang-questions] this was the email from richard o'keefe about readable code Message-ID: <45503F4E.5030904@ericsson.com> i have asked permission to resend it. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." -------------- next part -------------- An embedded message was scrubbed... From: "Richard A. O'Keefe" Subject: Re: Re: Noob - Getting Started Infinte Loop? Date: Fri, 1 Sep 2006 14:54:25 +1200 (NZST) Size: 6739 URL: From mats.cronqvist@REDACTED Tue Nov 7 09:10:25 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 07 Nov 2006 09:10:25 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <454FC026.4050903@telia.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> <454FC026.4050903@telia.com> Message-ID: <45503F71.6090405@ericsson.com> Robert Virding wrote: > Sorry, I find this discussion completely ridiculous! wow. > Having everything as an exception is just as stupid and difficult to > manage as having nothing as an exception! no. > I have been known to have rather dogmatic views sometimes (often) but > soem commonsense is needed. sadly, i see a lot of dogma but little common sense in your post. mats From ulf.wiger@REDACTED Tue Nov 7 09:15:32 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 7 Nov 2006 09:15:32 +0100 Subject: [erlang-questions] regexp is slow In-Reply-To: <454FB72E.8040606@telia.com> Message-ID: Robert Virding wrote: > > > Well, the HiPE team's byte_array to the rescue then, eh? ;-) > > The problem is that any array representation is not right, > you get a large amount of byte shifting which is costly. For > example the first pass is a substitution which removes all > newlines and some specific lines. Yeah, I know. Limiting regexp to only same-length substitutions probably wouldn't go over so well. (: /U From mikpe@REDACTED Tue Nov 7 10:16:14 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 7 Nov 2006 10:16:14 +0100 (MET) Subject: [erlang-questions] R11B-1 on Solaris 10 Message-ID: <200611070916.kA79GEqN020796@harpo.it.uu.se> On Wed, 25 Oct 2006 09:39:52 +0200 (MEST), Mikael Pettersson wrote: >On Tue, 24 Oct 2006 18:24:20 +0100, Chandru wrote: >> We tried building 64-bit R11B-1 on a AMD Opteron platform running Solaris >> 10. The only way we could get it to build was by changing line 1352 in >> erts/configure to: >> >> i86pc) ARCH=amd64;; >> >> It seems that 'uname -p' returns i386 instead of x86_64 under Solaris 10. > >I see that Solaris' `man uname` describes -p as preferred over -m, but >they fail to mention that uname -p is functionally inferior to -m. > >In any case, what does `uname -a`, `isalist`, and `optisa `isalist`` >report on Solaris 10 on AMD64? > >erts/configure.in uses `uname -m` not `uname -p`, so unless Sun has >broken uname, it should report 64-bit capability. > >As a last resort (if Sun indeed broke uname), we can add a test in >erts/configure.in to check for 64-bit capability via the C compiler. Using the C compiler to check for 32-vs-64 bit mode is the change we finally implemented and which will appear in R11B-2. It was needed to support 64-bit mode on Solaris 10, but it also handles the case where e.g. Linux or FreeBSD is running a 64-bit kernel on AMD64 but the user for whatever reason is using a compiler that generates 32-bit code. /Mikael From mats.cronqvist@REDACTED Tue Nov 7 12:58:20 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 07 Nov 2006 12:58:20 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> References: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> Message-ID: <455074DC.9090806@ericsson.com> in this thread i've argued that returning tagged tuples is inferior to always returning a value or throwing. i tried to illustrate my point by writing snippets of meta-code; but (stupidly) choose an example involving a file descriptor (i did point out that it's meta-code and that i'm not properly handling the file descriptor). i compared C style, traditional erlang style (TradErl) and throwing style (BettErl). richard o'keefee (rok) feel that returning tagged tuples is better. he points out that my example is not proper, working code. this is indeed true but (i feel) irrelevant. he introduces a third erlang style (RokErl); "just define ok({ok,X}) -> X; ok(Error) -> signal some kind of error." he then goes on to argue that RokErl is just as good as BettErl. that's not actually true (since you only get the term that didn't match, and no info where it came from), and in any case irrelevant to my point; that TradErl (i.e. the bulk of existing code) is needlessly verbose and gives poor error info. since my (poorly chosen, i know) example didn't attempt to close the file, rok swiftly concludes that file-closing is difficult in the BettErl style, and asks; "A style that encourages leaks can hardly be called a good style, now can it?". shame-facedly, i have to answer "no". OTOH, that's a bit like asking "hey richard, have you given up smoking crack yet?", isn't it? please answer yes or no. rok says; "The real issue is how exceptional the exceptional condition is and whether it is likely that the caller can do anything in an error case other than pass it on." i think the real issue is if one regards "exceptions" as truly exceptional things, or if they are just exceptions to a rule. e.g. if i read from a file, the rule is that i get data, and an exception is that i reach eof. rok goes on by creating an example of his own in which RokErl and BettErl look similar, and triumphantly exclaims; "Funny how the difference becomes less clear-cut when you make the example more realistic, isn't it?" hilarious. of course, the difference is the introduction of the ok() wrapper. which, IMO, is a lame kludge. The score sheet now looks like this: TradErl BettErl RokErl More verbose yes no a little Worse error reporting yes no a little Encourages leaks no no no Lame Kludge Factor 0 0 1 whatever. seems to me rok has shown that the proper way to use the tagged tuple idiom is to write wrappers that removes the tags. and even then it is still worse than the exception throwing style. but admittedly, my original example was lame. here's a better one. i do realize that the TradErl implementetion can be shortened (by using e.g. macros, wrappers, parse transforms, whatnot). but the point is that this is the way most existing (good) code looks. fold/3 calls Fun/2 with the contents of FileName, broken up in 1000 char blocks. %% BettErl style. fold/3 returns the final Acc or throws. %% open/2 and read/2 returns an FD/Data or throws fold(FileName,Fun,Acc) -> FD = open(FileName,[read]), try fld(FD,Fun,Acc) after close(FD) end. fld(FD,Fun,Acc) -> try fld(FD,Fun,Fun(read(FD,1000),Acc)) catch eof -> Acc end. %% TradErl style %% tfold/3 returns {ok,Acc} or {error,R} tfold(FileName,Fun,Acc) -> case file:open(FileName,[read]) of {ok,FD} -> case catch tfld(FD,Fun,Acc) of {'EXIT',R} -> %% we need this is Fun crashes file:close(FD), {error,R}; {error,R} -> file:close(FD), {error,R}; {ok,Val} -> file:close(FD), {ok,Val} end; {error,R} -> {file_open_error,FileName,R} end. tfld(FD,Fun,Acc) -> case file:read(FD,1000) of {ok, Data} -> tfld(FD,Fun,Fun(Data,Acc)); eof -> {ok,Acc}; {error, Reason} -> {error,Reason} end. From francesco@REDACTED Tue Nov 7 13:35:13 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Tue, 07 Nov 2006 12:35:13 +0000 Subject: [erlang-questions] TrapExit In-Reply-To: References: Message-ID: <45507D81.8040300@erlang-consulting.com> It is all database driven, so your options would be either to use a crawler or to mirror the databases. Francesco -- http://www.erlang-consulting.com yerl@REDACTED wrote: > Hi guys! > > Is it possible to have an offline version of TrapExit? > > cheers > Youn?s > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > From chsu79@REDACTED Tue Nov 7 14:03:22 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 7 Nov 2006 14:03:22 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values (was Package Support/Use) In-Reply-To: <20061107080851.GA6907@lambdastream.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> <454FC026.4050903@telia.com> <20061107080851.GA6907@lambdastream.com> Message-ID: On 11/7/06, Samuel Rivas wrote: > try file:open("foo.txt") of > Descriptor -> > do_something(Descriptor) > catch > enoent -> > do_another_thing() > end > end > > Versus > > case file:open("foo.txt") of > {ok, Descriptor} -> > do_something(Descriptor); > {error, enoent} -> > do_another_thing(); > {error, Reason} -> > {error, Reason} > end. Why do you have the {error, Reason} case? If you dont expect it to happen or dont have a strategy to handle it, you can let the case fail. The {error, Reason} will be included in the bad match exception if it occurs. case file:open("foo.txt") of {ok, Descriptor} -> do_something(Descriptor); {error, enoent} -> do_another_thing() end As for external resources that we're dealing with in the example, it is important to close the Descriptor in an 'after' section so it is done whatever happens in the 'do_something' function. If I am not mistaken, the after/finally/dynamic-unwind of the "try Expr of Cases catch ... after Restore end" is just protecting the "Expr" part and not exceptions occuring in the Cases. If closing isnt done in 'after' then it could even be a bad idea to handle exceptions and restarting, imagine an exception handler that keeps opening and failing on 'do_something' a 1000 times a second, not knowing a descriptor is leaked every time. This is why I'm often reluctant to use exceptions as indicator that something went one way or another. If there has been an exception then something happened that I had not planned/thought of when writing the program. I dont know what state the exceptional situation left the system in. With this view on exceptions, exception usage should be used to hang on as much information as possible on the exception data, so the error log makes post mortem debugging easier. The original statement was that tuple tagging is bad style, not criticism of exceptions. Exceptions are fine and should be used when appropriate, but I personally dont find that exceptions are an argument against tuple tagged return values. From thomasl_erlang@REDACTED Tue Nov 7 14:15:12 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 7 Nov 2006 05:15:12 -0800 (PST) Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061106142409.GA21593@lambdastream.com> Message-ID: <20061107131512.42252.qmail@web38812.mail.mud.yahoo.com> --- Samuel Rivas wrote: > When you call a function that uses exceptions you > can either catch the > exception if you want or ignore it if it is > meaningless in the context. > Higher level functions can catch the exception > later. > > With tagged values you _must_ handle the tagged > value, even if you > want to ignore error cases. Note that, going in the other direction, you can also straightforwardly generate an exception from a returned tagged value (e.g., badmatch), which then can be handled by higher-level functions, etc. So, at least for Erlang, I'm not sure your argument is conclusive. Best, Thomas ____________________________________________________________________________________ Sponsored Link Get an Online or Campus degree Associate's, Bachelor's, or Master's - in less than one year. http://www.findtherightschool.com From Bob.Cowdery@REDACTED Tue Nov 7 14:46:22 2006 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Tue, 7 Nov 2006 13:46:22 -0000 Subject: [erlang-questions] Help on dictionary search Message-ID: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> I wonder if someone could help me with what I guess must seem a fairly elementary problem. I have a dictionary of the form [{class, [Pid, Pid, Pid ...]}, {class1[...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. I think it's something like this, but I get lost on the details and don't know how to 'do something' with the head. Do I need to return a new dictionary. search({_,[_, Pid, _]}, H|T) -> %% we have a match of the Pid %% do something with it! search({_,[_, Pid, _]}, _|T) -> %% no match so recurse with the rest search ({_,[_, Pid, _]}, T); search({_,[_, Pid, _]}, []) -> ok Thanks Bob From serge@REDACTED Tue Nov 7 15:04:09 2006 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 07 Nov 2006 09:04:09 -0500 Subject: [erlang-questions] Help on dictionary search In-Reply-To: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> References: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> Message-ID: <45509259.70704@hq.idt.net> Try this (from problem statement I assume by a dictionary you mean a list rather than the dict module): remove_pid(Pid, Dict) -> remove_pid(Pid, Dict, []). remove_pid(_Pid, _Dict = [], Acc) -> lists:reverse(Acc); remove_pid(Pid, [{Class, List} | Tail], Acc) -> case [P || P <- List, P =/= Pid] of [] -> remove_pid(Pid, Tail, Acc); L -> remove_pid(Pid, Tail, [{Class, L} | Acc]) end. [Not tested]. Bob Cowdery wrote: > I wonder if someone could help me with what I guess must seem a fairly elementary problem. > > I have a dictionary of the form [{class, [Pid, Pid, Pid ...]}, {class1[...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. > > I think it's something like this, but I get lost on the details and don't know how to 'do something' with the head. Do I need to return a new dictionary. > > search({_,[_, Pid, _]}, H|T) -> > %% we have a match of the Pid > %% do something with it! > search({_,[_, Pid, _]}, _|T) -> > %% no match so recurse with the rest > search ({_,[_, Pid, _]}, T); > search({_,[_, Pid, _]}, []) -> > ok > > Thanks > Bob > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From thomasl_erlang@REDACTED Tue Nov 7 15:02:52 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 7 Nov 2006 06:02:52 -0800 (PST) Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611070232.kA72WIYV252204@atlas.otago.ac.nz> Message-ID: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> --- "Richard A. O'Keefe" wrote: > Any rate, as the person who designed and implemented exception handling in Quintus Prolog and single-handedly installed exception reporting throughout the entire QP system and library, I am not opposed to exceptions as such. What I am opposed to is designing in the use of exceptions without *thinking* about them, and specifically without thinking about whether a particular outcome really is exceptional or should be handled as part of normal control flow. One way to think about it is this: if this outcome occurs, would I be happy for the entire calling process to drop dead (with a suitable error report)? If the answer is "yes", then an exception is probably the right thing." === (Sorry about the sloppy quoting.) It's somewhat drastically put, but basically I agree. I won't claim the following is a universal property, but at least it turns up often enough in my code. Higher-level handlers can only do so much when an exception arrives, e.g., log that "some file operation returned this POSIX error" or whatnot. This is because most of the context has been lost when the exception arrives. This tends (in my experience) to push sensible error handling or reporting fairly close to the source of the exception. And as we get closer, tagged values start getting more attractive. I'm not sure if there is a good way out of this semi-dilemma for Erlang. Some languages (Common Lisp and Smalltalk, I believe) use a related concept, "conditions", for error handling, which might be of interest. Perhaps conditions could be adapted to Erlang (smart exceptions have a sketch of how to do this, but it would need some development to work cleanly). It's anyone's guess whether such a rewrite would be backwards compatible, of course. Best, Thomas ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail. http://new.mail.yahoo.com From bengt.kleberg@REDACTED Tue Nov 7 15:13:57 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 07 Nov 2006 15:13:57 +0100 Subject: [erlang-questions] Help on dictionary search In-Reply-To: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> References: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> Message-ID: <455094A5.1000104@ericsson.com> On 2006-11-07 14:46, Bob Cowdery wrote: > I wonder if someone could help me with what I guess must seem a fairly elementary problem. > > I have a dictionary of the form [{class, [Pid, Pid, Pid ...]}, {class1[...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. first do it right. if that is too slow, make it faster. when you say dictionary, is that some erlang supported data structure? if that is the case you might want to disregard the following: first remove Pid, then clean up the result: remove( Pid, Dictionary_list ) -> Fun = fun({Class, Pid_list}) -> {Class, lists:remove( Pid, Pid_list )} end, lists:map( Fun, Dictionary_list ). clean_up( Dictionary_list ) -> Fun = fun({_Class, []}) -> false; (_Item) -> true end, lists:filter( Fun, Dictionary_list ). bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From thomasl_erlang@REDACTED Tue Nov 7 15:22:09 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 7 Nov 2006 06:22:09 -0800 (PST) Subject: [erlang-questions] Package Support/Use In-Reply-To: <45474357.2000808@it.uu.se> Message-ID: <20061107142209.45108.qmail@web38813.mail.mud.yahoo.com> --- Richard Carlsson wrote: > But what I think you were looking for, was to have a > way of > getting the full name of a "local" module as an > atom, given > only its unqualified name. In fact, I had > experimentally included > a pseudo-BIF 'expanded(Atom)' (or some such name) - > expanded at > compile time, if possible. But at the time, I was a > bit afraid to > add a new predefined name and was not sure how > useful it would turn > out to be, so it was never included in the system. > Mea culpa, I guess. > > But it is not too late to add such an operator now. > Its semantics > could easily be defined in terms of the full name of > the containing > module, i.e., the value of ?MODULE, and a couple of > the name- > manipulation functions in the 'packages' kernel > module. Making the > compiler recognize and expand it statically when > possible, is quite > simple, and can be done regardless of whether the > function is > automatically imported or not. Any name suggestions? Doing so would remove that objection, at least, so I recommend it. In that case, I'd say an expanded name should (of course) expand to itself, and also suggest that operations which expect module names should always logically behave as if they first expand the name. If the compiler can do it statically, so much the better. (NB: this may not be a complete or working solution. Caveat lector.) However, I can't promise such an operator will convince me to actually use packages. I too have an uneasy suspicion that the whole concept needs further thinking, and perhaps "legacy Erlang" is not the vehicle for this. But that's an issue for another time. Best, Thomas ____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com From samuelrivas@REDACTED Tue Nov 7 15:28:05 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Tue, 7 Nov 2006 15:28:05 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061107131512.42252.qmail@web38812.mail.mud.yahoo.com> References: <20061106142409.GA21593@lambdastream.com> <20061107131512.42252.qmail@web38812.mail.mud.yahoo.com> Message-ID: <20061107142805.GA16037@lambdastream.com> Thomas Lindgren wrote: > > With tagged values you _must_ handle the tagged > > value, even if you > > want to ignore error cases. > > Note that, going in the other direction, you can also > straightforwardly generate an exception from a > returned tagged value (e.g., badmatch), which then can > be handled by higher-level functions, etc. So, at > least for Erlang, I'm not sure your argument is > conclusive. Sure you can, but it is a matter of simplicity. If you try to handle badmatches then you'd probably want to discern between {ok, Value}/{error, Reason} badmatches and programming errors. The former could either be handled or not, the later must crash the application. Anyway, you still have to extract the value from the tag-tuple {ok, What_I_Really_Wanted} = foo() While without tags, foo() is just what you want. As I wrote in other post, now the problem is saying "what you really want". Regards -- Samuel From thomasl_erlang@REDACTED Tue Nov 7 15:37:47 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 7 Nov 2006 06:37:47 -0800 (PST) Subject: [erlang-questions] Help on dictionary search In-Reply-To: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> Message-ID: <20061107143747.86091.qmail@web38807.mail.mud.yahoo.com> --- Bob Cowdery wrote: > I wonder if someone could help me with what I guess > must seem a fairly elementary problem. > > I have a dictionary of the form [{class, [Pid, Pid, > Pid ...]}, {class1[...]}, ...]. A given Pid can > appear in one or more classes. Given a Pid I want to > delete all instances of that Pid from the dictionary > and if the class then has an empty list to remove > the class. Generally I look up the dictionary by > class and don't mind a linear search for the delete > as its occational. > > I think it's something like this, but I get lost on > the details and don't know how to 'do something' > with the head. Do I need to return a new dictionary. > How about this? The following function deletes the PID from all the class lists, but can leave {class, []} behind, which you don't want: delete_pid(PID, Classes) -> [ {Class, [ P || P <- PIDs, P =/= PID ]} || {Class, PIDs} <- Classes ]. There are a couple of ways to get rid of empty classes. Use an extra pass: delete_empty_classes(Classes) -> [ {Class, PIDS} || {Class, PIDs} <- Classes, PIDs =/= [] ]. then run delete_pid1(PID, Classes) -> delete_empty_classes(delete_pid(PID, Classes)) or rewrite delete_pid/2 to directly discard empty classes: delete_pid2(PID, [{Class, PIDs}|Classes]) -> case [ P || P <- PIDs, P =/= PID ] of [] -> delete_pid2(PID, Classes); Ps -> [{Class, Ps}|delete_pid2(PID, Classes)] end; delete_pid2(PID, []) -> []. That can also be written as a fold: delete_pid3(PID, Classes) -> lists:foldr( fun({Class, PIDs}, Acc) -> case [ P || P <- PIDs, P =/= PID ] of [] -> Acc; Ps -> [{Class,Ps}|Acc] end end, [], Classes). Warning: not extensively tested :-) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From Bob.Cowdery@REDACTED Tue Nov 7 15:40:53 2006 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Tue, 7 Nov 2006 14:40:53 -0000 Subject: [erlang-questions] Help on dictionary search Message-ID: <3A76756EED583B43A4AD704E29CCD079715CE7@mail.aprsmartlogik.com> Serge Thank you very much. It seems to work, which I guess would be no great surprise to you. I will figure out how later. You managed to reply before I even saw my message reflected, that's what I call service! Bob Try this (from problem statement I assume by a dictionary you mean a list rather than the dict module): remove_pid(Pid, Dict) -> remove_pid(Pid, Dict, []). remove_pid(_Pid, _Dict = [], Acc) -> lists:reverse(Acc); remove_pid(Pid, [{Class, List} | Tail], Acc) -> case [P || P <- List, P =/= Pid] of [] -> remove_pid(Pid, Tail, Acc); L -> remove_pid(Pid, Tail, [{Class, L} | Acc]) end. [Not tested]. Bob Cowdery wrote: > I wonder if someone could help me with what I guess must seem a fairly elementary problem. > > I have a dictionary of the form [{class, [Pid, Pid, Pid ...]}, {class1[...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. > > I think it's something like this, but I get lost on the details and don't know how to 'do something' with the head. Do I need to return a new dictionary. > > search({_,[_, Pid, _]}, H|T) -> > %% we have a match of the Pid > %% do something with it! > search({_,[_, Pid, _]}, _|T) -> > %% no match so recurse with the rest > search ({_,[_, Pid, _]}, T); > search({_,[_, Pid, _]}, []) -> > ok > > Thanks > Bob > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bjorn@REDACTED Tue Nov 7 15:39:51 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Nov 2006 15:39:51 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061107131512.42252.qmail@web38812.mail.mud.yahoo.com> References: <20061107131512.42252.qmail@web38812.mail.mud.yahoo.com> Message-ID: Thomas Lindgren writes: > --- Samuel Rivas wrote: > > > When you call a function that uses exceptions you > > can either catch the > > exception if you want or ignore it if it is > > meaningless in the context. > > Higher level functions can catch the exception > > later. > > > > With tagged values you _must_ handle the tagged > > value, even if you > > want to ignore error cases. > > Note that, going in the other direction, you can also > straightforwardly generate an exception from a > returned tagged value (e.g., badmatch), which then can > be handled by higher-level functions, etc. So, at > least for Erlang, I'm not sure your argument is > conclusive. Also note that generating an exception from a tagged value is probably slightly more efficient. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From chsu79@REDACTED Tue Nov 7 15:45:16 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 7 Nov 2006 15:45:16 +0100 Subject: [erlang-questions] Help on dictionary search In-Reply-To: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> References: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> Message-ID: On 11/7/06, Bob Cowdery wrote: > I have a dictionary of the form [{class, [Pid, Pid, Pid ...]}, {class1[...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. A suggestion, use the 'sets' module (or at least 'ordsets' if the list representation is important). remove_pid(Classes, Pid) -> Classes1 = [{Class, sets:del_element(Pid, Set)} || {Class, Set} <- Classes], Classes2 = [{Class, Set} || {Class, Set} <- Classes1, sets:size(Set) =/= 0]. [also untested] From Bob.Cowdery@REDACTED Tue Nov 7 15:48:36 2006 From: Bob.Cowdery@REDACTED (Bob Cowdery) Date: Tue, 7 Nov 2006 14:48:36 -0000 Subject: [erlang-questions] Help on dictionary search Message-ID: <3A76756EED583B43A4AD704E29CCD0797411A3@mail.aprsmartlogik.com> Thanks for the additional replies guys. Wow, so many approaches, I can see I am going to have to do some homework on this! I get the jist of how to do things but I choke on the detail. I really don't use erlang enough yet to get proficient. Bob _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From samuelrivas@REDACTED Tue Nov 7 15:50:35 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Tue, 7 Nov 2006 15:50:35 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values (was Package Support/Use) In-Reply-To: References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> <454FC026.4050903@telia.com> <20061107080851.GA6907@lambdastream.com> Message-ID: <20061107145034.GA15949@lambdastream.com> Christian S wrote: > > case file:open("foo.txt") of > > {ok, Descriptor} -> > > do_something(Descriptor); > > {error, enoent} -> > > do_another_thing(); > > {error, Reason} -> > > {error, Reason} > > end. > > Why do you have the {error, Reason} case? > > If you dont expect it to happen or dont have a strategy to handle it, > you can let the case fail. The {error, Reason} will be included in the > bad match exception if it occurs. Because they may be other functions that would be able to handle the exception in higher levels. And they should receive that exception, nor a combination of badmatches, case_clauses, function_clauses, etc. Those are errors, not exceptions. > [snipped] > This is why I'm often reluctant to use exceptions as indicator that > something went one way or another. If there has been an exception then > something happened that I had not planned/thought of when writing the > program. I dont know what state the exceptional situation left the > system in. With this view on exceptions, exception usage should be > used to hang on as much information as possible on the exception data, > so the error log makes post mortem debugging easier. An exception is something you do not expect in the _function_ you are writing, not in the application. If you are writing a function to open a file you expect that this file exists. If you write a function to check whether a file exists or not, you do not expect the file exists, so if it does not it is not an exception. For debug information, an exception may be handled at some application level (e.g by a supervisor) or it may not. If it is not handled it becomes an error (e.g. a nocatch for throws). Errors carry a trace that is intended to provide that debugging information for crashes that _you did not expect_. > The original statement was that tuple tagging is bad style, not > criticism of exceptions. Exceptions are fine and should be used when > appropriate, but I personally dont find that exceptions are an > argument against tuple tagged return values. No, the argument against tagged values is that they are complicated and astonishing return types. file:open, for example, should return a file descriptor. Regards -- Samuel From dmitrii@REDACTED Tue Nov 7 15:55:46 2006 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Tue, 7 Nov 2006 16:55:46 +0200 Subject: [erlang-questions] [OT] List traffic Message-ID: I wonder what's the stats on list traffic lately? Because I used to read all mail that would come in from this list. Now I can barely keep up :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Tue Nov 7 16:42:54 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 7 Nov 2006 16:42:54 +0100 Subject: [erlang-questions] [OT] List traffic In-Reply-To: Message-ID: Here's one place where you can look at the traffic stats: http://dir.gmane.org/gmane.comp.lang.erlang.general BR, Ulf W ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Dmitrii Dimandt Sent: den 7 november 2006 15:56 To: erlang-questions Subject: [erlang-questions] [OT] List traffic I wonder what's the stats on list traffic lately? Because I used to read all mail that would come in from this list. Now I can barely keep up :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Tue Nov 7 16:59:35 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 7 Nov 2006 16:59:35 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values (was Package Support/Use) In-Reply-To: <20061107145034.GA15949@lambdastream.com> References: <200611060238.kA62c8Vm247763@atlas.otago.ac.nz> <454EECC1.7040007@ericsson.com> <20061106180738.GD11200@delora.autosys.us> <454FC026.4050903@telia.com> <20061107080851.GA6907@lambdastream.com> <20061107145034.GA15949@lambdastream.com> Message-ID: > > The original statement was that tuple tagging is bad style, not > > criticism of exceptions. Exceptions are fine and should be used when > > appropriate, but I personally dont find that exceptions are an > > argument against tuple tagged return values. > > No, the argument against tagged values is that they are complicated and > astonishing return types. file:open, for example, should return a file > descriptor. To go further off-topic on an off-subject discussion: For file access I prefer inspiration from with-* functions in lisp. That is with_open_file(Name, Mode, Fun) when is_function(Fun, 1) -> {ok, File} = open(Name, Mode), try Fun(File) after close(File) end. This function could be rewritten to throw more informative exceptions on various error cases. This API makes it natural to use exceptions when a Fun cant be called with the open file. The programmer has all intent that Fun should be called with an open FD and no intent for the file to not exist. From thomasl_erlang@REDACTED Tue Nov 7 17:15:32 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 7 Nov 2006 08:15:32 -0800 (PST) Subject: [erlang-questions] Reified environments (was: Re: Package Support/Use) In-Reply-To: <200611070528.kA75Sho4257148@atlas.otago.ac.nz> Message-ID: <20061107161533.21192.qmail@web38807.mail.mud.yahoo.com> --- "Richard A. O'Keefe" wrote: > I've been asked what I meant when I talked about > reifying module > environments and having more than one of them. You > can think of > this message as a *draft* description. Interesting proposal, though I haven't absorbed it fully. Generically, I think there are a few basic issues to be considered: 1. How are names resolved within a module (scoping) 2. How are names visible outside a module (hiding) 3. When are names resolved? (e.g., at runtime, compile time, "package assembly time", ...) 4. Also, given that we have a language with code change, we have to handle "relinking" on code change. I can see several options for how that should be done. What I like about your proposal: - it seems decently similar to ordinary linking and library building - it avoids conflating names, name spaces, object code, loaded code, files, ... - reification is a good principle (at unguarded moments, I might claim it's more important/useful than static typing) The drawback is that it seems more complex than the current model. Not a big problem for me, but I think the common case should be straightforward and unsurprising to use. (Your proposal may be perfectly so, but I haven't really thought it through.) Also, I'm not sure how it relates to the constructs of other languages; most seem to be oriented towards statically building components and assembling them into an executable. Erlang would need a bit more dynamism as per point #4. We could also discuss the finer details of code change, such as how closures or records really should be handled. At this point, it strikes me that I'd actually like to see some requirements. The take-home point might be: "So, what functionality do we expect our reified environment or packaging system to provide?" Best, Thomas ____________________________________________________________________________________ Want to start your own business? Learn how on Yahoo! Small Business. http://smallbusiness.yahoo.com/r-index From pacini@REDACTED Tue Nov 7 19:31:22 2006 From: pacini@REDACTED (Filippo Pacini) Date: Tue, 07 Nov 2006 19:31:22 +0100 Subject: [erlang-questions] sgte - an erlang template engne Message-ID: <4550D0FA.9080402@sgconsulting.it> Hi all, I'm working on an template engine based on String Template (www.stringtemplate.org) You can get a first release here: http://blog.sgconsulting.it/entry.html?identry=52 Any comments and suggestions are appreciated. thanks, filippo From garry@REDACTED Tue Nov 7 19:54:01 2006 From: garry@REDACTED (Garry Hodgson) Date: Tue, 7 Nov 2006 13:54:01 -0500 (EST) Subject: [erlang-questions] problem with global registration Message-ID: <2006110713541162925640@k2.sage.att.com> i'm having some trouble with the global registration that's implied by passing { global, ?MODULE } to the gen_server:start that i call in a module's start() routine. i want to centralize logging, and be able to enable/disable log levels on the fly for debug purposes. specifically, i want to run my server the usual way, and then use the "-run" arg to erl to run another erlang program to disable logging. so i use: erl -sname debug -setcookie keebler -run master debugctrl on the function this invokes is: debugctrl( [ OnOff ] ) -> case OnOff of "on" -> util:enable( debug ); "off" -> util:disable( debug ) end, halt(). the util:enable() function that this calls is: enable( Log ) -> gen_server:call( { global, util }, { enable, Log }, 10000 ). when i run the control program, it fails, reporting the following: {"init terminating in do_boot", {noproc,{gen_server,call,[{global,util},{enable,debug},10000]}}} if i run my server in the erlang shell, then i can run "util:enable( debug)." and it works fine. of course, that's running in the same node. the util process is started using { global, util }. my understanding is that this would globally register it. all the cookies match. it's running on the same machine (although i'll need to be able to do the same thing from other machines). this application is not being run via otp proper (i.e. the supervisor/app/release/etc stuff). it's an older app that i'm slowly converting, using gen_server whenever i need to add a new process. so, anyone want to tell me what detail i've foolishly overlooked? or whether i'm just completely off base. suggestions for a better approach are welcome, as well. thanks ---- Garry Hodgson, Senior Software Geek, AT&T CSO But I'm not giving in an inch to fear 'Cause I promised myself this year I feel like I owe it...to someone. From ulf.wiger@REDACTED Tue Nov 7 20:22:22 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 7 Nov 2006 20:22:22 +0100 Subject: [erlang-questions] problem with global registration In-Reply-To: <2006110713541162925640@k2.sage.att.com> Message-ID: Where does your global server 'util' start? When you call debugctrl() using the -run argument, the call will be dispatched pretty early. Chances are your globally registered process hasn't had time to start yet. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Garry Hodgson > Sent: den 7 november 2006 19:54 > To: Erlang > Subject: [erlang-questions] problem with global registration > > i'm having some trouble with the global registration that's > implied by passing { global, ?MODULE } to the > gen_server:start that i call in a module's start() routine. > i want to centralize logging, and be able to enable/disable > log levels on the fly for debug purposes. > > specifically, i want to run my server the usual way, and then > use the "-run" arg to erl to run another erlang program to > disable logging. so i use: > > erl -sname debug -setcookie keebler -run master debugctrl on > > the function this invokes is: > > debugctrl( [ OnOff ] ) -> > case OnOff of > "on" -> > util:enable( debug ); > "off" -> > util:disable( debug ) > end, > halt(). > > the util:enable() function that this calls is: > > enable( Log ) -> > gen_server:call( { global, util }, { enable, Log }, 10000 ). > > > when i run the control program, it fails, reporting the following: > > {"init terminating in do_boot", > > {noproc,{gen_server,call,[{global,util},{enable,debug},10000]}}} > > if i run my server in the erlang shell, then i can run > "util:enable( debug)." > and it works fine. of course, that's running in the same node. > > the util process is started using { global, util }. > my understanding is that this would globally register it. > all the cookies match. it's running on the same machine > (although i'll need to be able to do the same thing from > other machines). this application is not being run via otp > proper (i.e. the supervisor/app/release/etc stuff). > it's an older app that i'm slowly converting, using > gen_server whenever i need to add a new process. > > so, anyone want to tell me what detail i've foolishly overlooked? > or whether i'm just completely off base. suggestions for a > better approach are welcome, as well. > > thanks > > ---- > Garry Hodgson, Senior Software Geek, AT&T CSO > > But I'm not giving in an inch to fear > 'Cause I promised myself this year > I feel like I owe it...to someone. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From garry@REDACTED Tue Nov 7 20:34:35 2006 From: garry@REDACTED (Garry Hodgson) Date: Tue, 7 Nov 2006 14:34:35 -0500 (EST) Subject: [erlang-questions] problem with global registration In-Reply-To: References: Message-ID: <2006110714341162928075@k2.sage.att.com> "Ulf Wiger \(TN/EAB\)" wrote: > Where does your global server 'util' start? the main server process, running on node "main", calls util:start(). after it's been running a while, happily logging messages, i run the other program, with the "-run master debugctrl on". this runs on same machine, as node "debug". > When you call debugctrl() using the -run argument, > the call will be dispatched pretty early. but i have the same problem if i run erlang by hand: $ erl -sname debug -setcookie keebler Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] Eshell V5.3.6.3 (abort with ^G) (debug@REDACTED)1> master:debugctrl( ["on"] ). ** exited: {noproc,{gen_server,call,[{global,util},{enable,debug},10000]}} ** (debug@REDACTED)2> ---- Garry Hodgson, Senior Software Geek, AT&T CSO But I'm not giving in an inch to fear 'Cause I promised myself this year I feel like I owe it...to someone. From ulf.wiger@REDACTED Tue Nov 7 20:45:24 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 7 Nov 2006 20:45:24 +0100 Subject: [erlang-questions] problem with global registration In-Reply-To: <2006110714341162928075@k2.sage.att.com> Message-ID: Make sure your nodes have a chance to connect before running debugctrl(). Global will not synchronize the global registry until the nodes have connected. Before that, your name lookup will fail, unless the globally registered process is running in the same node as the caller. A single message to the other node, or an rpc:call() will do. BR, Ulf W > -----Original Message----- > From: Garry Hodgson [mailto:garry@REDACTED] > Sent: den 7 november 2006 20:35 > To: Ulf Wiger (TN/EAB); Erlang > Subject: Re: RE: [erlang-questions] problem with global registration > > "Ulf Wiger \(TN/EAB\)" wrote: > > > Where does your global server 'util' start? > > the main server process, running on node "main", calls util:start(). > after it's been running a while, happily logging messages, i > run the other program, with the "-run master debugctrl on". > this runs on same machine, as node "debug". > > > When you call debugctrl() using the -run argument, the call will be > > dispatched pretty early. > > but i have the same problem if i run erlang by hand: > > $ erl -sname debug -setcookie keebler > Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] > > Eshell V5.3.6.3 (abort with ^G) > (debug@REDACTED)1> master:debugctrl( ["on"] ). > ** exited: > {noproc,{gen_server,call,[{global,util},{enable,debug},10000]}} ** > (debug@REDACTED)2> > > > ---- > Garry Hodgson, Senior Software Geek, AT&T CSO > > But I'm not giving in an inch to fear > 'Cause I promised myself this year > I feel like I owe it...to someone. > > From garry@REDACTED Tue Nov 7 20:52:12 2006 From: garry@REDACTED (Garry Hodgson) Date: Tue, 7 Nov 2006 14:52:12 -0500 (EST) Subject: [erlang-questions] problem with global registration In-Reply-To: References: Message-ID: <2006110714521162929132@k2.sage.att.com> "Ulf Wiger \(TN/EAB\)" wrote: > Make sure your nodes have a chance to connect > before running debugctrl(). > > Global will not synchronize the global registry > until the nodes have connected. Before that, > your name lookup will fail, unless the globally > registered process is running in the same node > as the caller. > > A single message to the other node, or an rpc:call() > will do. that did it: Eshell V5.3.6.3 (abort with ^G) (debug@REDACTED)2> net_adm:ping( 'fathom@REDACTED' ). pong (debug@REDACTED)3> master:debugctrl( ["on"] ). ok thanks! ---- Garry Hodgson, Senior Software Geek, AT&T CSO But I'm not giving in an inch to fear 'Cause I promised myself this year I feel like I owe it...to someone. From rpettit@REDACTED Tue Nov 7 21:14:15 2006 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 7 Nov 2006 14:14:15 -0600 Subject: [erlang-questions] using mnesia to mirror SQL tables Message-ID: <20061107201415.GA2521@vailsys.com> Is anyone using mnesia to mirror SQL tables (or views)? If so, what is your procedure for updating the mirror? In erlang, I would probably update such a mirror by doing: 1) pull new copy of SQL table/view into ETS (for sanity checking) 2) as a transaction: a) mnesia:clear_table/1 on "old" mirror b) populate new table with copy from ETS 3) ets:delete/1 on "temporary" table In C I would probably update such a mirror by doing: 1) pull new copy of SQL table/view into memory (for sanity checking) 2) under mutex/lock: a) switch the mirror pointer from old copy to new 3) delete the old copy The erlang update procedure consists of a table clear followed by repopulating the table. The C mirror update procedure consists of a simple pointer swap (since the old and new copies can co-exist). It seems to me the C approach blocks clients for a very short period of time, whereas _my_ erlang approach (which may be flawed) could block considerably longer. The data cannot co-exist in the erlang solution as that would require two mnesia tables. I suppose I could stick a process in between mnesia and the clients, one which would maintain 2 mnesia tables (e.g. mirror_a and mirror_b) and point clients at the one which was "most up to date". This would allow for concurrent updates of the "other" table without blocking clients, and for a very rapid switch between mirror_a and mirror_b by simply routing clients to one or the other. The biggest problem with this approach is I was hoping to make the entire mirror process transparent to clients (who would simply access the mirror by performing direct mnesia read operations on the one and only mirror table). Having to know which of a couple mnesia tables holds the most recent version of the mirror makes direct use of the mnesia API impossible. This also makes it harder for clients to request a local ram copy of the mirror (something easily done when the mnesia API can be used directly without going through any traffic cop process). Any comments/suggestions would be greatly appreciated. -Rick From cyberdanx@REDACTED Wed Nov 8 00:37:50 2006 From: cyberdanx@REDACTED (Chris Campbell) Date: Tue, 7 Nov 2006 23:37:50 +0000 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: I compiled erlang myself and have the same issue, although the shell does not crash. Any word on a fix yet? From mogorman@REDACTED Wed Nov 8 01:54:51 2006 From: mogorman@REDACTED (Matthew O'Gorman) Date: Tue, 7 Nov 2006 18:54:51 -0600 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: if your replace symlink /bin/sh which currently points to /bin/dash to point instead to /bin/bash does that solve scripting problems? so rm /bin/sh ln -s /bin/bash /bin/sh mog On 11/7/06, Chris Campbell wrote: > I compiled erlang myself and have the same issue, although the shell > does not crash. Any word on a fix yet? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Wed Nov 8 02:58:53 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 8 Nov 2006 14:58:53 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611080158.kA81wrsL257082@atlas.otago.ac.nz> In response to > {ok,FD} = open(Name), I wrote: > Again, that is pretty unforgivable Erlang: IF OPEN/1 CREATES > A RESOURCE WHICH WILL NOT BE AUTOMATICALLY FREED. Ulf Wiger retorted: Incorrect. The file will be closed automatically if the process dies. But how does that contradict my IF? The only open/1 I can find in the on-line documents is win32reg:open(OpenModeList). The documentation is a little confusing; one would expect the result to be a RegHandle, but we aren't told that, and we are NOT told that the registry handle will be automatically closed if the process dies. Nor are we told whether sending the handle to another process will give the other process access to the registry or not. There is epp:open(File_Name, Include_Path[, Predefined_Macros]), which opens a file for preprocessing. The epp manual page does NOT say that the file will be automatically closed if the process dies. Nor are we told whether sending the Epp result to another process will give the other process the ability to read from the file or not. There is also erl_tar:open(File_Name, Open_Mode_List), which opens a tar file for reading or writing. There is an internal link in the erl_tar manual page (under close/1) to open/1, but no open/1 is described. We are NOT told that the tar file will be automatically closed if the process dies. Nor are we told whether sending the descriptor to another process will give the other process access to the tar file or not. Curiously, the index in the on-line stdlib reference manual contains no entry for file:open(_, _), which makes me wonder what else that index is missing. (Come to think of it, the file: module isn't in the table of contents side bar. Ohhh, it's in the KERNEL. I must say that the distinction between kernel and stdlib in the Erlang documentation is about as helpful as the distinction between (2) and (3) in the UNIX manual is to the average C programmer, which is to say that it is a pain in the neck, to put it politely. At the very least we need a unified function index.) disk_log:open(Option_List) IS documented as automatically closing the log when any owner process dies, but although we are explicitly told that the log process is linked to the owner process, we are NOT told that it is linked to user processes, and a reasonable inference from the disk_log: manual page would be that failure of a user process to close the log will result in the log staying open. gen_udp:open(Port[, Options]) -> {ok,Socket} | ... Since the port number becomes associated with the calling process, it would make a great deal of sense for such a port to be automatically closed when the calling process dies, but the documentation does NOT say so. You can change the controlling_process/2 of a UDP socket, which means that you can force messages to be delivered to a process that is not expecting them. We can imagine situations where a supervisor creates a socket and passes control of it to a worker, and if the worker dies, the supervisor creates another and passes control of the socket to that, so it isn't entirely obvious that automatic closing is always wanted. Certainly no-one reading the documentation would imagine that it ever happened. wrap_log_reader:open(File_Name[, N]) -> {ok,Continuation} | ... The documentation does NOT say that the log reader is closed automatically when the calling process dies. Nor does it say whether passing a continuation to another process works. file:open(File_Name, Options) -> {ok,IO_Device} | ... Now this one *does* say IO_Device is really the pid of the process which handles the file. This process is linked to the process which originally opened the file. If any process to which the IO_Device is linked terminates, the file will be closed and the process itself will be terminated. But this is not the function which was called in the example! Now imagine the following situation: A user interface offers features like "Decompress file". When you select that option, it pops up a file selection dialogue so that you can choose the file to decompress, and another one so that you can choose the destination. The user interface itself tries to open these file, so that it can report problems quickly and simply. When the files are successfully opened, it spawns a new decompressor process, passing it the IO_Devices for the two files. The input is not in fact the result of compression, so the decompressor encounters what it thinks of as bad data, and dies. But that wasn't the process that opened the files, so they are not automatically closed. The user interface code expected the decompressor to deal with everything, including closing the files, so it has long forgotten all about them. LEAK! Clearly, there needs to be a file:controlling_process(IO_Device, PID) so that the user interface can do PID = spawn(decompressor, start Options), controlling_process(Source_Device, PID), controlling_process(Destination_Device, PID), PID!{decompress, Source_Device, Destination_Device, self()} Actually, that's not perfect. It's amazing what you find (or don't find) when you look hard at the documentation. There are GENERAL issues for all X = <( create resource handle )>, ... <( close resource handle )>(X) patterns. (1) Will the resource be automatically closed if the calling process dies? (2) If the handle is sent to another process, will the other process be able to use the resource? (3) If the answers to (1) and (2) are "yes", is there a way to transfer ownership of a resource from the sender to the receiver? These answers need to be given EXPLICITLy in the documentation of each such resource. To return to the original point, we were given no particular reason to believe that open/1 was really the file:open/2 function, and since most of the 'open' functions are NOT documented as auto-close, Ulf Wiger has no grounds for his dogmatic "incorrect". > Verbose, yes, a little bit. But it certainly doesn't > REQUIRE you to "bind worthless intermediate variables", > that's a straw man. But in fact, lots of erlang code out there actually looks like this (and I think it's fair to say that Mats has seen more Erlang code than most). So what? My point is that IT DOESN'T HAVE TO BE THAT WAY, and the fact that it often _is_ that way really doesn't contradict or even weaken my point at all. Let me give you an very good analogy. Last night I spent more hours than I care to remember trying to read some of the R11B Erlang compiler, and that was just the beam*.?rl files. When I got my hands on the Quintus compiler, it had just two comments, one of which was the copyright notice. The beam*.?rl files are better than that, but not a LOT better. Practically all the documentation I needed to understand what I was reading existed. If I had to maintain those files, it would take me a couple of weeks to document them before I could start (as it did take me a couple of weeks to document the QP compiler before I could maintain it). This is the commenting equivalent of the style Mats was criticising. BUT you cannot fault the Erlang syntax for this! Banning comments because the comments that _are_ there aren't as helpful as they should be would not be a step forward. The style of programming Mats calls TradErl This may be the source of confusion. I thought he was calling the *INTERFACE* (returning tagged values instead of exceptions) TradErl. Ulf Wiger says he was calling the STYLE OF (AB)USING that interface TradErl. The 1-minute google test gave me the gen_tcp man page: http://www.erlang.org/doc/doc-5.5.1/lib/kernel-2.11.1/doc/html/gen_tcp.html where example code looks like: server() -> {ok, LSock} = gen_tcp:listen(5678, [binary, {packet, 0}, {active, false}]), {ok, Sock} = gen_tcp:accept(LSock), {ok, Bin} = do_recv(Sock, []), ok = gen_tcp:close(Sock), Bin. Which would be better, while retaining the traditional Erlang *interfaces*, as server() -> Sock = ok(gen_tcp:accept( gen_tcp:listen(5678, [binary,{packet,0},{active,false}]))), Answer = do_recv(Sock, []), gen_tcp:close(Sock), ok(Answer). By the way, do we have another documentation problem here? The documentation for gen_tcp:listen(Port, Options) says "The returned socket Listen_Socket can only be used in calls to accept/1,2." Does that mean that you can't call gen_tcp:close(LSocket)? What DOES happen if you don't close a listen socket? Let's see server/0 with careful closing, assuming for the sake of argument that listen sockets SHOULD be closed. Certainly in a UNIX implementation, where you call socket(), then bind(), then listen(), and that's your Listen_Socket, and then call accept() on that, which is your gen_tcp:accept/1,2, the listen socket takes a file descriptor slot and has to be closed like any other file descriptor. So we'd have server() -> % exception version Listen_Socket = gen_tcp:listen(5678, [binary,{packet,0},{active,false}]), try Accept_Socket = gen_tcp:accept(Listen_Socket), try do_recv(Accept_Socket, []) after gen_tcp:close(Accept_Socket) end after gen_tcp:close(Listen_Socket) end. compared with server() -> % traditional version case gen_tcp:listen(5678, [binary,{packet,0},{active,false}]) of {ok,Listen_Socket} -> case gen_tcp:accept(Listen_Socket) of {ok,Accept_Socket} -> Answer = do_recv(Accept_Socket, []), gen_tcp:close(Accept_Socket) ; E -> Answer = E end, gen_tcp:close(Listen_Socket) ; E -> Answer = E end, Answer. This is admittedly the kind of code I'd start writing combinators for in Haskell. But it is no longer than the exception-handling version and introduces no variables that the exception-handling version does not have to introduce. I DO NOT REGARD EITHER VERSION AS PLEASANT. The exception-based version is too much like Java for my taste, and worse, it separates the two key operations (open and close) far too much. Sadly, the Lisp unwind-protect form does the same thing. So let me illustrate what I consider to be a better presentation with the aid of a macro: (define-macro (let-protected Bindings Cleanup . Body) `(let Bindings (unwind-protect (begin ,@ Body) ,Cleanup))) (define (server) (let-protected ((Listen-Socket (gen-tcp:listen 5678 '(binary (packet 0) (active #f))))) (gen-tcp:close Listen-Socket) (let-protected ((Accept-Socket (gen-tcp:accept Listen-Socket))) (gen-tcp:close Accept-Socket) (do-recv Accept-Socket '())))) This puts the close right next to the open where you can SEE it and habitually check that it is there. > The real issue is how exceptional the exceptional condition is and > whether it is likely that the caller can do anything in an error > case other than pass it on. Agreed. > A regular expression not matching is not exceptional. > A regular expression having bad syntax IS exceptional. > Reaching the end of a file *between* characters is not exceptional. > Reaching the end of a file *within* the UTF-8 byte sequence for a > character IS exceptional. Agreed. > - if the read fails, is there anything the caller can do about it? > A negative result from read(2) counts as exceptional; there is > probably nothing the program can do about it (except when errno > is EAGAIN, of course). > There is something the caller MUST do, and that is close the file. In C, but not in Erlang. We are back to the issue I discussed at length in the earlier part of this message. There is NO reason to believe that the process calling read is the same as the process that opened the file, so there is NO reason to believe that the death of THIS process will result in the file being automatically closed. > What does the code *really* look like in these two cases? > > % tagged results > > Channel = ok(open(Name)), > Outcome = read(Channel), > close(Channel), > case Outcome > of {ok,Data} -> ok(process_data(Data)) > ; _ -> ok(Outcome) > end > > % exceptions > > Channel = open(Name), > try > Data = read(Channel), > after > close(Channel) > end, > process_data(Data) > > Funny how the difference becomes less clear-cut when you make the > example more realistic, isn't it? But in the "tagged results" example above, you don't close the Channel if read/1 crashes, right? That's because read/1 is written in the tagged results style and DOESN'T crash. If you can make unfounded assumptions about an undocumented and probably non-existent open/1, I can make them about an undocumented and probably non-existent read/1. Fair's fair. Is there any prospect of fixing try..after..end to have its parts in the right order? Actually, broadening the scope of the 'let' keyword I've hinted at before, let V1 = E1, ... after Cleanup in Body end would give us server() -> let Listen_Socket = gen_tcp:listen(5789, [binary,{packet,0},{active,false}]) after gen_tcp:close(Listen_Socket) in let Accept_Socket = gen_tcp:accept(Listen_Socket) after gen_tcp:close(Accept_Socket) in do_rev(Accept_Socket, []) end end. which is quite pretty, because all of the references to a resource are grouped together in a _single_ form. From ok@REDACTED Wed Nov 8 04:29:03 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 8 Nov 2006 16:29:03 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611080329.kA83T3W9260791@atlas.otago.ac.nz> Mats Cronqvist wrote: richard o'keefee (rok) feel that returning tagged tuples is better. NO I DO NOT. This misses the whole point of everything I have said, which is that *SOMETIMES* tagged tuples are better and *SOMETIMES* exceptions are better. "just define ok({ok,X}) -> X; ok(Error) -> signal some kind of error." he then goes on to argue that RokErl is just as good as BettErl. that's not actually true (since you only get the term that didn't match, and no info where it came from), But if you call exit(Term) or throw(Term), you only get the term that was thrown, and no info on where it came from. and in any case irrelevant to my point; that TradErl (i.e. the bulk of existing code) is needlessly verbose and gives poor error info. I thought that "TradErl" meant the "tagged tuples" interface style. It now appears that "TradErl" means something different, namely the way that "the bulk of existing code" (ab)uses that interface style. It is important to distinguish those two things. I *am* defending the tagged tuples interface style as appropriate in many many cases. I am *not* defending "the bulk of existing code". As for "where it came from", I expect an error term to tell me WHAT THE PROBLEM IS. The only time I ever want it to tell me where it came from is when the problem description is *wrong* and I need to fix the code that creates the problem description. When exceptions were added to Quintus Prolog, it was often the case that an exception raised in one place needed to be reported *as if* it had been raised in another, for the simple reason that the place where it was actually raised was deep inside system code that the user couldn't get at in any way. OTOH, that's a bit like asking "hey richard, have you given up smoking crack yet?", isn't it? please answer yes or no. Not in the least. If the advocate of a particular style uses it in a poor way, that really is evidence that the style may not be as good as he thinks. In my dialect, crack is OED sense 5 "Brisk talk, conversation". rok says; "The real issue is how exceptional the exceptional condition is and whether it is likely that the caller can do anything in an error case other than pass it on." i think the real issue is if one regards "exceptions" as truly exceptional things, or if they are just exceptions to a rule. e.g. if i read from a file, the rule is that i get data, and an exception is that i reach eof. How is that useful? *EVERYTHING* is an exception to some rule. I am having a hard to trying to understand the distinction between "truly exceptional" and "exceptions to a rule". Look, the function sqrt() almost never returns 2.6. So shall we call returning 2.6 and exception to the rule and require sqrt(6.76) to throw an exception? Just because something is an exception to one rule doesn't mean it doesn't conform to some other rule. If you try to read from a file, the rule is that you get data IF THERE IS DATA TO BE HAD, or an end-of-file indication if there is not. You apparently prefer the Fortran rule, where you have to use i = 1 do read(Unit, fmt=Format, end=999) a(i) i = i+1 end do 999 .... because Fortran regards end of file as unusual. I prefer the C/Lisp/ Scheme/Prolog/Burroughs Algol rule, where end of file is expected and you write i = 0; while ((E = scanf(Format, &a[i])) == 1) i++; if (E != 0) handle problem because you simply get a cleaner control structure. hilarious. of course, the difference is the introduction of the ok() wrapper. which, IMO, is a lame kludge. It's only "lame" because Erlang is pretty pathetic at combinators. The Haskell equivalent is perfectly respectable. whatever. seems to me rok has shown that the proper way to use the tagged tuple idiom is to write wrappers that removes the tags. and even then it is still worse than the exception throwing style. You have left one big thing out. Exception throwing is a non-local transfer of control. It's goto on steroids. It's not _quite_ as unstructured as you can get, but it's close. but the point is that this is the way most existing (good) code looks. fold/3 calls Fun/2 with the contents of FileName, broken up in 1000 char blocks. %% BettErl style. fold/3 returns the final Acc or throws. %% open/2 and read/2 returns an FD/Data or throws fold(FileName,Fun,Acc) -> FD = open(FileName,[read]), try fld(FD,Fun,Acc) after close(FD) end. fld(FD,Fun,Acc) -> try fld(FD,Fun,Fun(read(FD,1000),Acc)) catch eof -> Acc end. YIKE! This is HORRIBLE! It's horrible in too many ways. Amongst other things, it tacitly assumes that Fun will not throw an 'eof' exception; the check for eof is in effect associated with the wrong function call. Let's suppose that the interface of read/2 were cleaned up to go like this: read(IO_Device, Number) -> binary() | string() | eof If more than 0 bytes but fewer than Number remain, a short binary or string will be returned. If no bytes remain, eof will be returned. If IO_Device or Number is inappropriate or something goes wrong while reading, an exception will be thrown [details omitted]. Now we have fld(Device, Fun, Acc) -> case file:read(Device, 1000) of eof -> Acc ; Block -> fld(Device, Fun, Fun(Block, Acc)) end. Notice the difference? The test for 'eof' is visibly associated with the right function call. If Fun should happen to throw something, this code will never mistakenly try to catch it. Oh, remember that I am *happy* with exceptions for things like file-doesn't-exist. SOMETIMES exceptions are right, SOMETIMES another approach. One thing I don't know is how cheap it is to set up an exception handler in Erlang. In Quintus Prolog, it was fairly cheap, but not zero cost. The "case" version requires one compare-and-branch per iteration; if you have C++-style zero-cost handler setup, you can beat that. But you lose something else: the "case" version is tail recursive, while the "try" version is not. In a trivial test case, the setup cost appeared to be negligible (about 80 CPU instructions). Well done, Erlang implementors! But the space cost of not being tail recursive is definitely something to think about. Doubtless I will be savaged for having the temerity to take an example seriously. %% TradErl style %% tfold/3 returns {ok,Acc} or {error,R} tfold(FileName,Fun,Acc) -> case file:open(FileName,[read]) of {ok,FD} -> case catch tfld(FD,Fun,Acc) of {'EXIT',R} -> %% we need this is Fun crashes file:close(FD), {error,R}; {error,R} -> file:close(FD), {error,R}; {ok,Val} -> file:close(FD), {ok,Val} end; {error,R} -> {file_open_error,FileName,R} end. NO! This is not good style in anybody's book. To start with, recall that I do *not* want to defend exceptions for file opening. I think that's a case where exceptions are *right*. But suppose that we use the tagged tuple interface style inappropriately. It is STILL the case that an error term should say WHAT THE PROBLEM IS, in particular that a file could not be opened, and which one. That is, it is very unhelpful for open(File_Name, Modes) to return {error,posix()}. It should be {error,{open,File_Name,Modes,posix()}}. Again, recall that I am not concerned to defend the existing body of Erlang code as such. I am defending the use of tagged tuples SOME OF THE TIME. It so happens that this is NOT one of the uses that I want to defend, but if one *is* going to return error terms one should d--- well return ALL the relevant information in the error term. Also, I have already said that while reaching the end of a file is hardly something one should be surprised by or unprepared to handle, OTHER errors in reading SHOULD be exceptions. So what's the style I advocate for this example? fold(File_Name, Fun, Acc) -> Device = file:open(File_Name, [read]), try fld(Device, Fun, Acc) after file:close(Device) end. fld(Device, Fun, Acc) -> case read(Device, 1000) of eof -> Acc ; Block -> fld(Device, Fun, Fun(Block, Acc)) end. That's right: exceptions used for things you AREN'T prepared to handle, appropriate return values for things that you ARE prepared to handle. Simple, but not simplistic. Using tagged tuples all the time means that your language doesn't have to have exception handling at all. The mess with exit and throw which Mats has so ably demonstrated in his "TradErl" version of fold/3 is serious encouragement not to use *old* Erlang exception handling if you could avoid it. Hence the interfaces in the library. (Actually, TradErl reminds me a whole lot of how you do I/O in Clean. And I would happily use Clean still if only they supported it on Solaris.) Using exception handling all the time isn't that great either. Do much with Java and you will quickly come to loathe the way that exception handling distorts your code. The new 'try' form in Erlang is a big improvement on what we had before, but even so it is obtrusive and gets in the way of TRO. Being totally committed to neither of these, but using now one, now the other, isn't as easy to think. It requires careful judgement when designing the interface of a function. But that's our job. From ok@REDACTED Wed Nov 8 04:50:49 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 8 Nov 2006 16:50:49 +1300 (NZDT) Subject: [erlang-questions] Help on dictionary search Message-ID: <200611080350.kA83onGo251699@atlas.otago.ac.nz> "Bob Cowdery" wrote: I have a dictionary of the form [ {class, [Pid, Pid, Pid ...]}, {class, [...]}, ...]. A given Pid can appear in one or more classes. Given a Pid I want to delete all instances of that Pid from the dictionary and if the class then has an empty list to remove the class. Generally I look up the dictionary by class and don't mind a linear search for the delete as its occational. The best way to do this is to use the library, but you knew that. lists:delete(Elem, List) is clearly appropriate for deleting something from a list. If we didn't already have it, delete(X, [X|T]) -> T; delete(X, [H|T]) -> [H|delete(X, T)]; delete(_, [] ) -> []. Or using list comprehension syntax, delete(X, L) -> [Y | Y <- L, Y /= X]. So you are going to have to do something to every {Class,Pid_List} tuple in your dictionary. It's a simple recursion, complicated only by the need to decide whether to put something back or not: two_level_delete(Elem, [{Class,List}|Tuples]) -> case lists:delete(Elem, List) of [] -> two_level_delete(Elem, Tuples) ; List1 -> [{Class,List1} | two_level_delete(Elem, Tuples)] end. It's really not surprising that a structure with two levels of lists has an algorithm with two levels of loops. List comprehensions can be helpful. In particular, they let us combine "map" (do something do each element) with "filter" (select some elements). Erlang list comprehension syntax, according to section 6.22 of the reference manual, is rather limited compared with other functional languages that have list comprehension, where you can bind a new variable in the qualifiers. What I want to write is two_level_delete(Elem, Dict) -> [{Class,List1} || {Class,List0} <- Dict, List1 = lists:delete(Elem, List0), List1 .= []]. You _can_ write this, but it doesn't work, because Erlang takes ( = ) in a qualifier list as just an expression whose result should be true or false, and of course it's a list. This is a real PAIN. One hack would be to write List1 <- [lists:delete(Elem, List0)], which is ugly. In this case, we can fold the binding into the test, which is even uglier. two_level_delete(Elem, Dict) -> [{Class,List1} || {Class,List0} <- Dict, (List1 = [X || X <- List0, X /= Elem]) /= []]. All things considered, the simple hand-written recursion calling lists:delete/2 is probably the easiest read in this case. From ok@REDACTED Wed Nov 8 05:20:32 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 8 Nov 2006 17:20:32 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611080420.kA84KWN2166562@atlas.otago.ac.nz> I should point out that my initial experience with exception handling was in PL/I, where the original idea was that the system would set a whole bunch of pseudo-variables, like ONSOURCE, which was the variable that the system thought held the bad data. You were expected to *assign* to ONSOURCE and then *resume* the faulting statement. My experience was that the only time I was ever able to "repair" the error was when I had enough information to stop the exception being raised in the first place. Let's see, ONCHAR* the character that caused a conversion to fail ONCODE a number telling you what kind of error it was ONCONDCOND the name of the CONDITION-type error as a string ONCONDID one of (currently) 23 numeric codes, including condid_endfile ONCOUNT the number of conditions not yet handled ONFILE the name of the file that had a problem as a string ONGSOURCE* like ONCHAR but for DBCS characters ONKEY the key of the record that had an i/o problem, as a string ONLOC the name of the procedure that had a problem ONSOURCE* the field that caused a conversion to fail, as a string ONSUBCODE a number with more detail about I/O errors ONWCHAR* wide character version of ONCHAR ONWSOURCE* wide character version of ONSOURCE Note that ONFILE is an identifier, as a string, not an actual file you can use. Oh, and if you didn't want the faulting statement resumed, you had to use a GOTO. So ON ENDFILE(FRED) BEGIN GOTO FRED_ENDED; END; DO WHILE('1'B); READ FILE(FRED) INTO(SOME_RECORD); process the record; END; FRED_ENDED: I'm sure you will appreciate why I am so firmly convinced that end of file should not be regarded as exceptional. Curiously enough, while PL/I has a SUBSCRIPTRANGE condition -- not enabled by default --, it does not give you an ONSUBSCRIPT feature to find out what the bad subscript was. How happy I am not to be using PL/I! From ok@REDACTED Wed Nov 8 05:49:15 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 8 Nov 2006 17:49:15 +1300 (NZDT) Subject: [erlang-questions] Reified environments (was: Re: Package Support/Use) Message-ID: <200611080449.kA84nFhb260277@atlas.otago.ac.nz> I was going to send part 2 today, but it looks as though part 1A had better come first. Interesting proposal, though I haven't absorbed it fully. Generically, I think there are a few basic issues to be considered: 1. How are names resolved within a module (scoping) I explained that. In order to call anything in a module, that module must be BOUND in an environment. All module names in that module, whether static or dynamic, are sought in that environment. That's what it's for. 2. How are names visible outside a module (hiding) Modules only define functions. They are visible outside the module (or not) just as they are now. A module is visible under some name in some environment if and only it is installed in that environment. Just like now, in fact, except there's more than one environment. 3. When are names resolved? (e.g., at runtime, compile time, "package assembly time", ...) Names that are statically known are resolved to addresses at load time. Because Erlang allows hot loading, those addresses are only dereferenced when they are actually used. 4. Also, given that we have a language with code change, we have to handle "relinking" on code change. I can see several options for how that should be done. But that's already in there. Practically nothing changes. Certainly nothing is _different_. The drawback is that it seems more complex than the current model. Not a big problem for me, but I think the common case should be straightforward and unsurprising to use. (Your proposal may be perfectly so, but I haven't really thought it through.) Yes, but the "common case" of my proposal is (almost) exactly what we have now. That's the whole point of it, really. One change is this. :module() returns that module as a module object. This would be a compiler- generated function like :module_info(). This means that other_mod(foo, bar, [1,2]) might ask other_mod to invoke foo:bar(1,2) according to the definition of 'foo' that _it_ sees, whereas other_mod(foo:module(), bar, [1,2]) would ask other_mod to invoke foo:bar(1,2) according to the defition of 'foo' that the _caller_ sees. This means that the preferred way of mentioning the current module changes from ?MODULE to module(). Also, I'm not sure how it relates to the constructs of other languages; Not much. It was partly inspired by a misremembering of Luca Cardelli's Obliq language, and partly by a Xerox PARC configuration language, and partly by another latent-typed functional language I can't remember. There's certainly some atmospheric influence from Tcl nested interpreters, and if I haven't reinvented *some* aspect of SafeErlang I shall be astonished. most seem to be oriented towards statically building components and assembling them into an executable. That's why the reified environments proposal is different. Erlang would need a bit more dynamism as per point #4. Dynamism is the *point* of making environments into objects you can dynamically install stuff in and uninstall it from. We could also discuss the finer details of code change, such as how closures or records really should be handled. Joe Armstrong and I have both proposed essentially the same replacement for records. The same data type is found in IBM Prolog, and is the main data structure in Obliq. We could argue about the details, but the concept is clear. We know what *could* do the job of records, without -record declarations, and it has been implemented by other people. (Yes, that's why I decided to look at the Erlang compiler.) As for closures, the only thing I can say for the reified environments proposal is that it doesn't change anything relevant to closures, so at least it doesn't make the problems worse. At this point, it strikes me that I'd actually like to see some requirements. The take-home point might be: "So, what functionality do we expect our reified environment or packaging system to provide?" 1. Dynamic. 2. No new syntax in modules, only new data types and functions. 3. If you don't use it, you get what you have now, or close enough. 4. No nasty surprises: statically known and dynamically known names should behave exactly the same. 5. Encapsulation: it should be possible for one module in an application to access the others without thereby making it possible for every module in the system to access them. 6. Ease of migration: it should be possible to wrap up a bunch of modules and stuff them into an environment without changing those modules (provided they don't use packages). Those are some of the requirements I had in mind for reified environments. From matthias@REDACTED Wed Nov 8 08:35:02 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 8 Nov 2006 08:35:02 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611080158.kA81wrsL257082@atlas.otago.ac.nz> References: <200611080158.kA81wrsL257082@atlas.otago.ac.nz> Message-ID: <17745.34982.75770.249699@antilipe.corelatus.se> Richard A. O'Keefe writes: > In response to > > {ok,FD} = open(Name), > > I wrote: > > Again, that is pretty unforgivable Erlang: IF OPEN/1 CREATES > > A RESOURCE WHICH WILL NOT BE AUTOMATICALLY FREED. > > Ulf Wiger retorted: > Incorrect. The file will be closed automatically if the > process dies. > > But how does that contradict my IF? I'm rather reminded of this cartoon. http://www.xkcd.com/c169.html Your first sentence is pretty weird. It looks like a statement "_that_ is pretty unforgivable erlang" followed by an all-caps explanation, with some dubious punctuation separating the two. But no! It turns out that it was actually a completely unsupported statement followed by an irrelevant all-caps rant which can be retrospectively contrived into being an escape hatch. Matthias From bengt.kleberg@REDACTED Wed Nov 8 08:59:38 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 08 Nov 2006 08:59:38 +0100 Subject: [erlang-questions] documentation error in zip module Message-ID: <45518E6A.9000504@ericsson.com> greetings, i think that the return value for zip:create/3 is wrong in the documentation. the way i read it, it claims to be {"name", Binary} = zip:create( "name", Files, [memory] ). but i am getting {ok, {"name", Binary}} = zip:create( "name", Files, [memory] ). it is difficult to tell since the ''prototypes'' are incomplete. they say: zip(Name, FileList) zip(Name, FileList, Options) create(Name, FileList) create(Name, FileList, Options) the usual -> RetValue is missing. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From richardc@REDACTED Wed Nov 8 09:58:34 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 08 Nov 2006 09:58:34 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611080420.kA84KWN2166562@atlas.otago.ac.nz> References: <200611080420.kA84KWN2166562@atlas.otago.ac.nz> Message-ID: <45519C3A.8090100@it.uu.se> Richard A. O'Keefe wrote: > I'm sure you will appreciate why I am so firmly convinced that end of file > should not be regarded as exceptional. As Ulf (I think) noted, perhaps there should really be two different interfaces: one for random reading, where you expect the data to be there (and it is an exception if you reach eof), and one for sequential reading, returning {read, X}/eof. /Richard From samuelrivas@REDACTED Wed Nov 8 10:18:38 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Wed, 8 Nov 2006 10:18:38 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc Message-ID: <20061108091838.GA418@lambdastream.com> Hello, Is there any simple way to document a public .hrl file with record definitions. I would like to document the record definitions in the hrl file, but I do not know how to make edoc parse it, nor how to document a record (apart from the ad-hoc solution of document the in the XHTML part of type definitions and link those types from the overview.edoc file). Regards. -- Samuel From pronay.biswas@REDACTED Wed Nov 8 10:33:30 2006 From: pronay.biswas@REDACTED (pronay.biswas@REDACTED) Date: Wed, 8 Nov 2006 15:03:30 +0530 Subject: [erlang-questions] eheap_alloc problem Message-ID: <94350539FC77154CBBF37A9B9284133D017C6A26@HYD-MKD-MBX01.wipro.com> Hi, We are facing process related issue with our server implemented in Erlang.The Server stopped running after 5 hrs of TC(Test case) execution. The server stopped with message: ... eheap_alloc: Cannot allocate 785672 bytes of memory (of type "heap"). 20856 Abort What may be reason for that??? Thanks and Regards, Pronay The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Wed Nov 8 10:49:08 2006 From: lukas@REDACTED (garazdawi) Date: Wed, 08 Nov 2006 09:49:08 +0000 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 References: Message-ID: <20061108094908.595595A1E9@mail.erlangsystems.com> I had the same problem with crypto on my Ubuntu Edgy installation. I had to add -fno-stack-protector to the CFLAGS when compiling the crypto driver inorder to solve this. I think that it has something to do with the gcc that is used but I'm not sure. See http://forum.trapexit.org/viewtopic.php?t=6630 for more details about my fix. Lukas -- Erlang Training & Consulting _________________________________________________________ Post sent from http://www.trapexit.org From richardc@REDACTED Wed Nov 8 10:49:03 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 08 Nov 2006 10:49:03 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <20061108091838.GA418@lambdastream.com> References: <20061108091838.GA418@lambdastream.com> Message-ID: <4551A80F.5070706@it.uu.se> Samuel Rivas wrote: > Hello, > > Is there any simple way to document a public .hrl file with record > definitions. I would like to document the record definitions in the hrl > file, but I do not know how to make edoc parse it, nor how to document a > record (apart from the ad-hoc solution of document the in the XHTML part > of type definitions and link those types from the overview.edoc file). > > Regards. It hasn't been documented yet, but look in the lib/edoc/src/edoc.hrl file for an example, along with the (currently out-commented) use of the @headerfile tag in lib/edoc/src/edoc_extract.erl. /Richard From tobbe@REDACTED Wed Nov 8 11:11:40 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 08 Nov 2006 11:11:40 +0100 Subject: [erlang-questions] eheap_alloc problem In-Reply-To: <94350539FC77154CBBF37A9B9284133D017C6A26@HYD-MKD-MBX01.wipro.com> References: <94350539FC77154CBBF37A9B9284133D017C6A26@HYD-MKD-MBX01.wipro.com> Message-ID: pronay.biswas@REDACTED wrote: > Hi, > > We are facing process related issue with our server implemented in > Erlang.The Server stopped running after 5 hrs of TC(Test case) execution. > The server stopped with message: > ... > eheap_alloc: Cannot allocate 785672 bytes of memory (of type "heap"). > 20856 Abort You have allocated too much memory. You probably gor an erl_crash.dump file. I can recommend to put it into the Erlang crash_dump viewer. Look for what the system executed when it crashed. Look for large processes (memmory wise). --Tobbe > > What may be reason for that??? > > Thanks and Regards, > Pronay > > The information contained in this electronic message and any attachments > to this message are intended for the exclusive use of the addressee(s) > and may contain proprietary, confidential or privileged information. If > you are not the intended recipient, you should not disseminate, > distribute or copy this e-mail. Please notify the sender immediately and > destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The recipient > should check this email and any attachments for the presence of viruses. > The company accepts no liability for any damage caused by any virus > transmitted by this email. > > www.wipro.com > From kostis@REDACTED Wed Nov 8 11:20:22 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 08 Nov 2006 12:20:22 +0200 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <4551A80F.5070706@it.uu.se> References: <20061108091838.GA418@lambdastream.com> <4551A80F.5070706@it.uu.se> Message-ID: <4551AF66.5070902@cs.ntua.gr> Richard Carlsson wrote: > Samuel Rivas wrote: > >>Hello, >> >> Is there any simple way to document a public .hrl file with record >>definitions. I would like to document the record definitions in the hrl >>file, but I do not know how to make edoc parse it, nor how to document a >>record (apart from the ad-hoc solution of document the in the XHTML part >>of type definitions and link those types from the overview.edoc file). >> >> Regards. > > > It hasn't been documented yet, but look in the lib/edoc/src/edoc.hrl > file for an example, It has also not been documented anywhere, but for the needs of the Dialyzer and TypEr tools, we have experimentally modified the parser in the upcoming Erlang/OTP R11B-2 release to accept type declarations in records. So, Richard's example from the above file that currently looks as: ------------------------------------------ %% @type tag() = #tag{name = atom(), %% line = integer(), %% data = term()} -record(tag, {name, line = 0, data}). ------------------------------------------ is possible to be written as simply as: ------------------------------------------------------------- -record(tag, {name :: atom(), line = 0 :: integer(), data}). ------------------------------------------------------------- I must stress that this feature is currently UNDOCUMENTED, EXPERIMENTAL (i.e., bound to change or even disappear) and totally UNSUPPORTED. We do have plans to make this a reality and integrate it with the rest of OTP (e.g. use types which are compatible or recognizable by edoc). But this will have to wait for a future OTP release -- perhaps R12. However, since at least one user asked for this ability, we invite the community for comments and wishes. Best, Kostis From samuelrivas@REDACTED Wed Nov 8 11:47:56 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Wed, 8 Nov 2006 11:47:56 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <4551AF66.5070902@cs.ntua.gr> References: <20061108091838.GA418@lambdastream.com> <4551A80F.5070706@it.uu.se> <4551AF66.5070902@cs.ntua.gr> Message-ID: <20061108104756.GA1517@lambdastream.com> Kostis Sagonas wrote: > It has also not been documented anywhere, but for the needs of the > Dialyzer and TypEr tools, we have experimentally modified the parser in > the upcoming Erlang/OTP R11B-2 release to accept type declarations in > records. > > So, Richard's example from the above file that currently looks as: > [snipped] > is possible to be written as simply as: > > ------------------------------------------------------------- > -record(tag, {name :: atom(), line = 0 :: integer(), data}). > ------------------------------------------------------------- > [snipped] > However, since at least one user asked for this ability, we invite the > community for comments and wishes. I think it is a good idea to inline type documentation in the record declarations. This avoid mistyping when you duplicate field names. However, I was wondering on something like doxygen's /**< */ blocks to keep current comment syntax. A quick example: %% @type foo = record() -record(foo, { bar, % @fieldType bar = integer() baz % @fieldType baz = bool() }). Undoubtedly, previous notation can be improved with more careful thinking. I had not thought of unifying type definitions for dyalizer, typer and edoc, but is seems a great idea. Regards -- Samuel From theepan@REDACTED Wed Nov 8 11:40:53 2006 From: theepan@REDACTED (theeepan) Date: Wed, 8 Nov 2006 16:40:53 +0600 Subject: [erlang-questions] eheap_alloc problem In-Reply-To: <94350539FC77154CBBF37A9B9284133D017C6A26@HYD-MKD-MBX01.wipro.com> Message-ID: <000701c70322$5f23c6a0$040710ac@wavenet.lk> Are you using Erlang port-driver to communicate to out side world? If so, is there a possibility, where after some time, a big chunk of data is written to the port? Check whether the number of Erlang process in the system keeps on increasing with time. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of pronay.biswas@REDACTED Sent: Wednesday, November 08, 2006 3:34 PM To: erlang-questions@REDACTED Subject: [erlang-questions] eheap_alloc problem Hi, We are facing process related issue with our server implemented in Erlang.The Server stopped running after 5 hrs of TC(Test case) execution. The server stopped with message: ... eheap_alloc: Cannot allocate 785672 bytes of memory (of type "heap"). 20856 Abort What may be reason for that??? Thanks and Regards, Pronay The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From gunilla@REDACTED Wed Nov 8 12:14:56 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Wed, 08 Nov 2006 12:14:56 +0100 Subject: [erlang-questions] Questions about Erlang documentation In-Reply-To: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> References: <337538cb0611011323r3c2c5c1cu8078474fb273b44c@mail.gmail.com> Message-ID: <4551BC30.3070706@erix.ericsson.se> You've already got a number of replies, but I can add that the reason for using the Unix man page convention "see xyz(3)" is mainly to avoid having to use longer (and IMO clumsier) constructions such as "see the documentation for xyz" all the time. Also, by using "xyz(3)" it should be clear that it is the *documentation* for xyz you should look at, not the module itself. Send the documentation bug reports to the erlang-bugs mailing list. / Gunilla, Erlang/OTP team Kirill Zaborski wrote: > Investigating Erlang official documents I see a moment which I do not > understand: > In a lot of chapters I see something like "|gen_server(3)" |mentioned > (That's from > http://www.erlang.org/doc/doc-5.5.1/doc/design_principles/gen_server.html > ). The first thought was about functions and their arity, but that's not > a function of course. So what exactly is this? > And one more question: I occasionally find misprints in docs - Is there > any email where I should send information about them? > > BR, > Kirill. From richardc@REDACTED Wed Nov 8 12:59:09 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 08 Nov 2006 12:59:09 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <20061108104756.GA1517@lambdastream.com> References: <20061108091838.GA418@lambdastream.com> <4551A80F.5070706@it.uu.se> <4551AF66.5070902@cs.ntua.gr> <20061108104756.GA1517@lambdastream.com> Message-ID: <4551C68D.7010905@it.uu.se> Samuel Rivas wrote: > I think it is a good idea to inline type documentation in the record > declarations. This avoid mistyping when you duplicate field names. > However, I was wondering on something like doxygen's /**< */ blocks to > keep current comment syntax. A quick example: > > %% @type foo = record() > -record(foo, { > bar, % @fieldType bar = integer() > baz % @fieldType baz = bool() > }). > > Undoubtedly, previous notation can be improved with more careful > thinking. I'm not too happy either about having to duplicate field names both in the record declaration and in the edoc description, but allowing edoc to use the form you suggested (and I have certainly thought about it before, believe me) would require it to run the "epp_dodger" module in a more exact mode in order to match the comments with the corresponding fields (making it a bit slower, and more importantly: a lot more likely to barf on weird uses of macros). Using a proper language extension like that prototyped by the HiPE guys is much better, when/if it becomes available, so I'm not going to implement the same thing with comments. Meanwhile, you will have to live with some duplication. /Richard From samuelrivas@REDACTED Wed Nov 8 13:57:23 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Wed, 8 Nov 2006 13:57:23 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <4551C68D.7010905@it.uu.se> References: <20061108091838.GA418@lambdastream.com> <4551A80F.5070706@it.uu.se> <4551AF66.5070902@cs.ntua.gr> <20061108104756.GA1517@lambdastream.com> <4551C68D.7010905@it.uu.se> Message-ID: <20061108125723.GA4066@lambdastream.com> Richard Carlsson wrote: > Samuel Rivas wrote: > >%% @type foo = record() > >-record(foo, { > > bar, % @fieldType bar = integer() > > baz % @fieldType baz = bool() > > }). > I'm not too happy either about having to duplicate field names both in > the record declaration and in the edoc description, but allowing edoc to > use the form you suggested (and I have certainly thought about it > before, believe me) would require it to run the "epp_dodger" module in a > more exact mode in order to match the comments with the corresponding > fields (making it a bit slower, and more importantly: a lot more likely > to barf on weird uses of macros). Using a proper language extension like > that prototyped by the HiPE guys is much better, when/if it becomes > available, so I'm not going to implement the same thing with comments. > Meanwhile, you will have to live with some duplication. I see. Until improved type definitions are available, would it be worth checking that the field names in the documentation are in the record definition? For example, edoc already checks other things like function arity: %% @spec foo(bar, baz) -> [] foo(_) -> []. Edoc will complain about bad arity in the specification. I do not know whether it is to expensive to do the same thing for records, knowing that they may change in a future. Regards. -- Samuel From richardc@REDACTED Wed Nov 8 14:14:57 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 08 Nov 2006 14:14:57 +0100 Subject: [erlang-questions] Documenting records and .hrls with edoc In-Reply-To: <20061108125723.GA4066@lambdastream.com> References: <20061108091838.GA418@lambdastream.com> <4551A80F.5070706@it.uu.se> <4551AF66.5070902@cs.ntua.gr> <20061108104756.GA1517@lambdastream.com> <4551C68D.7010905@it.uu.se> <20061108125723.GA4066@lambdastream.com> Message-ID: <4551D851.5000707@it.uu.se> Samuel Rivas wrote: > I see. Until improved type definitions are available, would it be worth > checking that the field names in the documentation are in the record > definition? Yes, that's a good idea. Edoc is not doing much right now (in general) to check that declarations actually match the code; it tends to just trust what you write. This could be improved. > For example, edoc already checks other things like function arity: > > %% @spec foo(bar, baz) -> [] > foo(_) -> > []. > > Edoc will complain about bad arity in the specification. I do not know > whether it is to expensive to do the same thing for records, knowing that > they may change in a future. It's not expensive, just a matter of programming. And I've had way too little spare time lately, alas. Patches are happily accepted. /Richard From bjorn@REDACTED Wed Nov 8 15:17:21 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Nov 2006 15:17:21 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. Message-ID: Bug fix release : otp_src_R11B-2 Build date : 2006-11-07 This is bug fix release 2 for the R11B release. You can download the full source distribution from http://www.erlang.org/download/otp_src_R11B-2.tar.gz http://www.erlang.org/download/otp_src_R11B-2.readme Note: To unpack the TAR archive you need a GNU TAR compatible program. For instance, on MacOS X before 10.3 you must use the 'gnutar' command; you can't use the 'tar' command or StuffIt to unpack the sources. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R11B-2.exe On-line documentation can be found at http://www.erlang.org/doc.html. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R11B-2.tar.gz http://www.erlang.org/download/otp_doc_man_R11B-2.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ft@REDACTED Wed Nov 8 17:04:06 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 8 Nov 2006 17:04:06 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. References: Message-ID: <004201c7034f$84fb4d30$161e0bc1@it.su.se> Bjorn Gustavsson wrote: > Bug fix release : otp_src_R11B-2 > Build date : 2006-11-07 from the README : > OTP-6294 The strict_record_tests option is now default; that is, > reading a field from a record using the > Record#record_tag.field syntax will fail if Record is not a > record of the correct type. Excellent change! I found two bugs of record confusion in YXA right away. One in a test case but one in actual code (covered by a test case, fortunately!). The first one was my records request and response, #request{method, uri, header, body} and #response{method, uri, header, body} the header element was used but with the wrong record type. Went unnoticed because the header element was in the same place in both records. The second was basically this #info{foo, bar} and #extended_info{foo, bar, baz} /Fredrik From ke.han@REDACTED Wed Nov 8 17:41:38 2006 From: ke.han@REDACTED (ke han) Date: Thu, 9 Nov 2006 00:41:38 +0800 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> Tobias, I am installing erlang on ubuntu for the first time. It is OTP R11B-1 on "ubuntu 6.06.1 server". This is a new install of ubuntu and all I added after the install was: openssh, build-essential, libncurses5-dev, libssl-dev and openssl. These last three items I added in order to get ./configure to work. When I run make, it dies as follows: jhancock@REDACTED:~/otp_src_R11B-1$ make cd erts/emulator && ERL_TOP=/home/jhancock/otp_src_R11B-1 make generate depend make[1]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ emulator' make -f i686-pc-linux-gnu/Makefile generate make[2]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ emulator' /bin/mkdir -p i686-pc-linux-gnu/opt/plain /bin/mkdir -p obj/i686-pc-linux-gnu/opt/plain LANG=C /usr/bin/perl utils/beam_makeops -outdir i686-pc-linux-gnu/opt/ plain \ -emulator /home/jhancock/otp_src_R11B-1/lib/compiler/ src/genop.tab beam/ops.tab beam/frag_ops.tab hipe/hipe_ops.tab LANG=C /usr/bin/perl utils/make_tables -src i686-pc-linux-gnu - include i686-pc-linux-gnu beam/atom.names beam/bif.tab hipe/ hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab hipe/hipe_x86.tab LANG=C /usr/bin/perl utils/make_version -o i686-pc-linux-gnu/ erl_version.h R11B 5.5.1 i686-pc-linux-gnu LANG=C /usr/bin/perl utils/make_driver_tab -o i686-pc-linux-gnu/ driver_tab.c obj/i686-pc-linux-gnu/opt/plain/efile_drv.o obj/i686-pc- linux-gnu/opt/plain/ddll_drv.o obj/i686-pc-linux-gnu/opt/plain/ inet_drv.o obj/i686-pc-linux-gnu/opt/plain/zlib_drv.o obj/i686-pc- linux-gnu/opt/plain/ram_file_drv.o obj/i686-pc-linux-gnu/opt/plain/ ttsl_drv.o LANG=C /usr/bin/perl utils/make_alloc_types -src beam/erl_alloc.types -dst i686-pc-linux-gnu/opt/plain/erl_alloc_types.h threads hipe unix LANG=C /usr/bin/perl utils/make_preload -old /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/otp_ring0.beam /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/init.beam /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/prim_inet.beam /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/prim_file.beam /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/erl_prim_loader.beam /home/jhancock/ otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/preload.c m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h /bin/sh: m4: command not found make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' make[1]: *** [generate] Error 2 make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' make: *** [depend] Error 2 Any idea what I need to have on ubuntu 6.06.1 server in order to get a good compile?? thanks, ke han On Nov 6, 2006, at 8:04 AM, Tobias L?fgren wrote: > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > have trouble loading external libraries/driver on a Ubuntu 6.10 > "Egdy Eft" system. > > I've just spent the better part of the weekend trying to figure out > what was going wrong. First it seemed like a problem with Yaws, > because erlang compiled fine and "worked". But yaws stopped with a > "exec 1: setuid_drv.so :not found". > > After much reinstalling and experimenting with different versions I > discovered that it was all dynamic loading of libraries that > failed. For example "crypto:start()." in the erl shell crashed in a > similar fashion. > > Maybe there is a simple solution to the problem, but at the moment > it eludes me, so I've downgraded. The same packages and erlang- > versions work perfectly fine in Ubuntu 6.06, so if you're using > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > /tobias > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From mikpe@REDACTED Wed Nov 8 18:19:36 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 8 Nov 2006 18:19:36 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> Message-ID: <17746.4520.63738.106950@alkaid.it.uu.se> ke han writes: > Tobias, > I am installing erlang on ubuntu for the first time. It is OTP > R11B-1 on "ubuntu 6.06.1 server". > This is a new install of ubuntu and all I added after the install was: > openssh, build-essential, libncurses5-dev, libssl-dev and openssl. > These last three items I added in order to get ./configure to work. > > When I run make, it dies as follows: ... > otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/preload.c > m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ > hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h > /bin/sh: m4: command not found > make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 > make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make[1]: *** [generate] Error 2 > make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make: *** [depend] Error 2 > > Any idea what I need to have on ubuntu 6.06.1 server in order to get > a good compile?? The line "m4: command not found" contains a fairly strong clue. From erlangx@REDACTED Wed Nov 8 18:21:22 2006 From: erlangx@REDACTED (Michael McDaniel) Date: Wed, 8 Nov 2006 09:21:22 -0800 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> Message-ID: <20061108172122.GC20760@delora.autosys.us> # apt-get install m4 ~M On Thu, Nov 09, 2006 at 12:41:38AM +0800, ke han wrote: > Tobias, > I am installing erlang on ubuntu for the first time. It is OTP > R11B-1 on "ubuntu 6.06.1 server". > This is a new install of ubuntu and all I added after the install was: > openssh, build-essential, libncurses5-dev, libssl-dev and openssl. > These last three items I added in order to get ./configure to work. > > When I run make, it dies as follows: > > jhancock@REDACTED:~/otp_src_R11B-1$ make > cd erts/emulator && ERL_TOP=/home/jhancock/otp_src_R11B-1 make > generate depend > make[1]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > make -f i686-pc-linux-gnu/Makefile generate > make[2]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > /bin/mkdir -p i686-pc-linux-gnu/opt/plain > /bin/mkdir -p obj/i686-pc-linux-gnu/opt/plain > LANG=C /usr/bin/perl utils/beam_makeops -outdir i686-pc-linux-gnu/opt/ > plain \ > -emulator /home/jhancock/otp_src_R11B-1/lib/compiler/ > src/genop.tab beam/ops.tab beam/frag_ops.tab hipe/hipe_ops.tab > LANG=C /usr/bin/perl utils/make_tables -src i686-pc-linux-gnu - > include i686-pc-linux-gnu beam/atom.names beam/bif.tab hipe/ > hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab hipe/hipe_x86.tab > LANG=C /usr/bin/perl utils/make_version -o i686-pc-linux-gnu/ > erl_version.h R11B 5.5.1 i686-pc-linux-gnu > LANG=C /usr/bin/perl utils/make_driver_tab -o i686-pc-linux-gnu/ > driver_tab.c obj/i686-pc-linux-gnu/opt/plain/efile_drv.o obj/i686-pc- > linux-gnu/opt/plain/ddll_drv.o obj/i686-pc-linux-gnu/opt/plain/ > inet_drv.o obj/i686-pc-linux-gnu/opt/plain/zlib_drv.o obj/i686-pc- > linux-gnu/opt/plain/ram_file_drv.o obj/i686-pc-linux-gnu/opt/plain/ > ttsl_drv.o > LANG=C /usr/bin/perl utils/make_alloc_types -src beam/erl_alloc.types > -dst i686-pc-linux-gnu/opt/plain/erl_alloc_types.h threads hipe unix > LANG=C /usr/bin/perl utils/make_preload -old /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/otp_ring0.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/init.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_inet.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_file.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erl_prim_loader.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/preload.c > m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ > hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h > /bin/sh: m4: command not found > make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 > make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make[1]: *** [generate] Error 2 > make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make: *** [depend] Error 2 > > Any idea what I need to have on ubuntu 6.06.1 server in order to get > a good compile?? > > thanks, ke han > > > On Nov 6, 2006, at 8:04 AM, Tobias L?fgren wrote: > > > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > > have trouble loading external libraries/driver on a Ubuntu 6.10 > > "Egdy Eft" system. > > > > I've just spent the better part of the weekend trying to figure out > > what was going wrong. First it seemed like a problem with Yaws, > > because erlang compiled fine and "worked". But yaws stopped with a > > "exec 1: setuid_drv.so :not found". > > > > After much reinstalling and experimenting with different versions I > > discovered that it was all dynamic loading of libraries that > > failed. For example "crypto:start()." in the erl shell crashed in a > > similar fashion. > > > > Maybe there is a simple solution to the problem, but at the moment > > it eludes me, so I've downgraded. The same packages and erlang- > > versions work perfectly fine in Ubuntu 6.06, so if you're using > > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > > > > /tobias > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,455208f6251567072184826! > > -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From jahakala@REDACTED Wed Nov 8 18:25:54 2006 From: jahakala@REDACTED (Jani Hakala) Date: Wed, 08 Nov 2006 19:25:54 +0200 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> (ke han's message of "Thu\, 9 Nov 2006 00\:41\:38 +0800") References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> Message-ID: <87lkmlsvdp.fsf@pingviini.kortex.jyu.fi> ke han writes: > /bin/sh: m4: command not found > Pay attention to this line. A package named m4 is probably missing. In debian package control file there are these lines: Build-Depends: perl, debhelper (>= 4.0.0), autoconf (>= 2.50), openssl, libssl-dev, m4, libncurses5-dev, dpatch, autotools-dev, unixodbc-dev You may need more of these packages. Jani Hakala From Martin.Logan@REDACTED Wed Nov 8 18:43:06 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Wed, 8 Nov 2006 11:43:06 -0600 Subject: [erlang-questions] sgte - an erlang template engne In-Reply-To: <4550D0FA.9080402@sgconsulting.it> Message-ID: <26AB42AB6A76E2419D26E66ECF1538462CF796@chiresexc02.resource.corp.lcl> I like the interface and the functionality looks promising. One comment, one question for you. Comment: You should use edoc for all your documentation, it is part of the erlang release now and generates great docs - you can see some examples at my site www.erlware.org under "fslib" or "G.A.S" docs. Second thing, the question, you are using a gen_server, but it appears that you are not keeping any state, why not use a plain old library instead of the server? Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Filippo Pacini Sent: Tuesday, November 07, 2006 12:31 PM To: Erlang Users' List Subject: [erlang-questions] sgte - an erlang template engne Hi all, I'm working on an template engine based on String Template (www.stringtemplate.org) You can get a first release here: http://blog.sgconsulting.it/entry.html?identry=52 Any comments and suggestions are appreciated. thanks, filippo _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From ft@REDACTED Wed Nov 8 19:32:49 2006 From: ft@REDACTED (Fredrik Thulin) Date: Wed, 8 Nov 2006 19:32:49 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. References: <004201c7034f$84fb4d30$161e0bc1@it.su.se> Message-ID: <007801c70364$4be06ac0$161e0bc1@it.su.se> Fredrik Thulin wrote: ... > The first one was my records request and response, > > #request{method, uri, header, body} and > #response{method, uri, header, body} duh, the #response record is #response{status, reason, header, body} /Fredrik From xpdoka@REDACTED Wed Nov 8 20:19:35 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Wed, 8 Nov 2006 20:19:35 +0100 (CET) Subject: [erlang-questions] Package Support/Use In-Reply-To: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> Message-ID: <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> Hi Thomas, Thomas Lindgren wrote : > Higher-level handlers can only do so much when an > exception arrives, e.g., log that "some file operation > returned this POSIX error" or whatnot. This is because > most of the context has been lost when the exception > arrives. This tends (in my experience) to push sensible > error handling or reporting fairly close to the source of > the exception. And as we get closer, tagged values start > getting more attractive. I would distinguish two usages of the word "context". Low-level context, which I tend to call "details", is the type of runtime error, where it occurred, and its immediate context (operands or arguments). It seems to me that this information is what you need to make a correction to the code, but is useless to recover at runtime. High-level context is higher up the call stack, and is what was being attempted when the error occurred. This is where the software can be designed to retry, or try an alternate strategy, or give up, or ask for different input. So, I would say that error reporting (or at least gathering of error details) should occur close to the source, but not handling. Regards, Dominic Williams http://www.dominicwilliams.net ---- From pacini@REDACTED Wed Nov 8 20:25:32 2006 From: pacini@REDACTED (Filippo Pacini) Date: Wed, 08 Nov 2006 20:25:32 +0100 Subject: [erlang-questions] sgte - an erlang template engne In-Reply-To: <26AB42AB6A76E2419D26E66ECF1538462CF796@chiresexc02.resource.corp.lcl> References: <26AB42AB6A76E2419D26E66ECF1538462CF796@chiresexc02.resource.corp.lcl> Message-ID: <45522F2C.3000509@sgconsulting.it> Logan, Martin wrote: > I like the interface and the functionality looks promising. One > comment, one question for you. thanks > > Comment: You should use edoc for all your documentation, it is part of > the erlang release now and generates great docs - you can see some > examples at my site www.erlware.org under "fslib" or "G.A.S" docs. I'm quite new to erlang. I'd read something regarding edoc, but didn't know it was the "standard" for documentation. I'll rewrite the docs using edoc. > > Second thing, the question, you are using a gen_server, but it appears > that you are not keeping any state, why not use a plain old library > instead of the server? I'd thought to embed a cache in the template engine to store the compiled templates. That's why I used the gen_server. I'm not sure anymore that this is the right thing to do, so it might change. Maybe I released the code too early, but I needed some feedback. filippo From Martin.Logan@REDACTED Wed Nov 8 22:26:30 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Wed, 8 Nov 2006 15:26:30 -0600 Subject: [erlang-questions] sgte - an erlang template engne In-Reply-To: <45522F2C.3000509@sgconsulting.it> Message-ID: <26AB42AB6A76E2419D26E66ECF1538462CF799@chiresexc02.resource.corp.lcl> -----Original Message----- From: Filippo Pacini [mailto:pacini@REDACTED] Sent: Wednesday, November 08, 2006 1:26 PM To: Logan, Martin Cc: Erlang Users' List Subject: Re: [erlang-questions] sgte - an erlang template engne Logan, Martin wrote: > I like the interface and the functionality looks promising. One > comment, one question for you. thanks > > Comment: You should use edoc for all your documentation, it is part of > the erlang release now and generates great docs - you can see some > examples at my site www.erlware.org under "fslib" or "G.A.S" docs. I'm quite new to erlang. I'd read something regarding edoc, but didn't know it was the "standard" for documentation. I'll rewrite the docs using edoc. > > Second thing, the question, you are using a gen_server, but it appears > that you are not keeping any state, why not use a plain old library > instead of the server? I'd thought to embed a cache in the template engine to store the compiled templates. That's why I used the gen_server. I'm not sure anymore that this is the right thing to do, so it might change. Sounds like a good idea to me. From ugglan@REDACTED Thu Nov 9 01:55:57 2006 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Thu, 9 Nov 2006 01:55:57 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> Message-ID: <5c402a550611081655p45c481b1u6bb4287e0396a108@mail.gmail.com> As others have mentioned, you need the m4 package, I cheated a bit and did: sudo apt-get build-dep erlang which installs everything needed for building from source. Especially useful as when starting from an almost empty ubuntu server install as I did. /tobias On 11/8/06, ke han wrote: > > Tobias, > I am installing erlang on ubuntu for the first time. It is OTP > R11B-1 on "ubuntu 6.06.1 server". > This is a new install of ubuntu and all I added after the install was: > openssh, build-essential, libncurses5-dev, libssl-dev and openssl. > These last three items I added in order to get ./configure to work. > > When I run make, it dies as follows: > > jhancock@REDACTED:~/otp_src_R11B-1$ make > cd erts/emulator && ERL_TOP=/home/jhancock/otp_src_R11B-1 make > generate depend > make[1]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > make -f i686-pc-linux-gnu/Makefile generate > make[2]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > /bin/mkdir -p i686-pc-linux-gnu/opt/plain > /bin/mkdir -p obj/i686-pc-linux-gnu/opt/plain > LANG=C /usr/bin/perl utils/beam_makeops -outdir i686-pc-linux-gnu/opt/ > plain \ > -emulator /home/jhancock/otp_src_R11B-1/lib/compiler/ > src/genop.tab beam/ops.tab beam/frag_ops.tab hipe/hipe_ops.tab > LANG=C /usr/bin/perl utils/make_tables -src i686-pc-linux-gnu - > include i686-pc-linux-gnu beam/atom.names beam/bif.tab hipe/ > hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab hipe/hipe_x86.tab > LANG=C /usr/bin/perl utils/make_version -o i686-pc-linux-gnu/ > erl_version.h R11B 5.5.1 i686-pc-linux-gnu > LANG=C /usr/bin/perl utils/make_driver_tab -o i686-pc-linux-gnu/ > driver_tab.c obj/i686-pc-linux-gnu/opt/plain/efile_drv.o obj/i686-pc- > linux-gnu/opt/plain/ddll_drv.o obj/i686-pc-linux-gnu/opt/plain/ > inet_drv.o obj/i686-pc-linux-gnu/opt/plain/zlib_drv.o obj/i686-pc- > linux-gnu/opt/plain/ram_file_drv.o obj/i686-pc-linux-gnu/opt/plain/ > ttsl_drv.o > LANG=C /usr/bin/perl utils/make_alloc_types -src beam/erl_alloc.types > -dst i686-pc-linux-gnu/opt/plain/erl_alloc_types.h threads hipe unix > LANG=C /usr/bin/perl utils/make_preload -old /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/otp_ring0.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/init.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_inet.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_file.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erl_prim_loader.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/preload.c > m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ > hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h > /bin/sh: m4: command not found > make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 > make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make[1]: *** [generate] Error 2 > make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > make: *** [depend] Error 2 > > Any idea what I need to have on ubuntu 6.06.1 server in order to get > a good compile?? > > thanks, ke han > > > On Nov 6, 2006, at 8:04 AM, Tobias L?fgren wrote: > > > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > > have trouble loading external libraries/driver on a Ubuntu 6.10 > > "Egdy Eft" system. > > > > I've just spent the better part of the weekend trying to figure out > > what was going wrong. First it seemed like a problem with Yaws, > > because erlang compiled fine and "worked". But yaws stopped with a > > "exec 1: setuid_drv.so :not found". > > > > After much reinstalling and experimenting with different versions I > > discovered that it was all dynamic loading of libraries that > > failed. For example "crypto:start()." in the erl shell crashed in a > > similar fashion. > > > > Maybe there is a simple solution to the problem, but at the moment > > it eludes me, so I've downgraded. The same packages and erlang- > > versions work perfectly fine in Ubuntu 6.06, so if you're using > > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > > > > /tobias > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Thu Nov 9 02:32:09 2006 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 09 Nov 2006 02:32:09 +0100 Subject: [erlang-questions] Parsing with regexp (was regexp is slow) In-Reply-To: <4550036F.8090401@duomark.com> References: <4550036F.8090401@duomark.com> Message-ID: <45528519.2020005@telia.com> OK, a few comments. The program which was mentioned was specifically for bench-marking regexps, so there is not much you can do about that. You are probably right that in some/many cases regexps are not the best solution, but if it is something which people know about then they will use them and we must give them a godd implementation. When you talk about spliting the binary do you mean that this is done internally and transparently to the user? Or does the user see the list of segments? The origianl implementation of binaries had this capability of referencing segments of a large binary. Very good for pulling the binary apart. Although you could use it for splicing together if you were careful. Robert Jay Nelson wrote: > > Robert Virding wrote: > > >>In this case it wouldn't help at all as the result from each >>substitution is passed directly into a new subst. You loop over a >>pre-defined set of substitutions threading the result through. > > > > The goal of the paper was to come up with a very efficient way to > handle exactly these types of situations, where a subset of a large > piece of data needs to be found / extracted and then transformed in > some way. Using Joe's "inefficient coding style" works for small > problems, but the heap quickly blows up when things get converted > to lists. If you filter them and garbage collect you might get by > but not if the data source is 10s of MBs. > > regexps are concise and convenient in a lot of situations, but there > are two things I don't like: when the pattern gets to be so complicated > that it can no longer be understood, and when it leads to particularly > inefficient handling of data. As long as the data size isn't too big, > the latter case shouldn't matter, unless it needs to execute many times. > > In erlang, a more efficient approach (and the one I tried to embrace > in the paper), was to read the full data source as a single large binary. > Any filtering or extraction was done so that the result was a list of > sub-binaries pointing to the original data (essentially a struct with > a pointer and a length which can be constructed quickly) without creating > any intermediate structures or any garbage to collect. The filtered > list could then be transformed, resulting in computational effort only > being taken on the elements of the data stream that mattered. > > The fact that regexp uses substitution is an artifact of implementation > or of sticking to the user's understanding of the model. It is not > necessary to solve the problem. > > The sub-binary approach led to the natural desire for binary comprehensions. > When that is soon available in the language, this approach will be very clear > and reasonably efficient (although not as efficient as the BIFs, which > really screamed). > > I have been working more on patterns, parsing and extraction, but I won't > have anything to say about it publicly for a few more months. From jay@REDACTED Thu Nov 9 02:49:19 2006 From: jay@REDACTED (Jay Nelson) Date: Wed, 08 Nov 2006 17:49:19 -0800 Subject: [erlang-questions] Parsing with regexp (was regexp is slow) In-Reply-To: <45528519.2020005@telia.com> References: <4550036F.8090401@duomark.com> <45528519.2020005@telia.com> Message-ID: <4552891F.5020102@duomark.com> Robert Virding wrote: > The program which was mentioned was specifically for bench-marking > regexps, so there is not much you can do about that. True, but a substitution which replaces a substring with nothing can be done by excision. > > You are probably right that in some/many cases regexps are not the > best solution, but if it is something which people know about then > they will use them and we must give them a godd implementation. True and I use them myself. I would like to see them apply to strings or binaries transparently. > > When you talk about spliting the binary do you mean that this is done > internally and transparently to the user? Or does the user see the > list of segments? The origianl implementation of binaries had this > capability of referencing segments of a large binary. Very good for > pulling the binary apart. Although you could use it for splicing > together if you were careful. I have been looking at it several ways, but typically an extraction from a big binary results in a list of segments that match the desired pattern. So you would get back a list of binaries. These could be turned into strings at the end to get the greatest performance benefit, but a more typical result. It is using the segmenting referencing technique you described. My paper last year did this with BIFs saving time by precomputing and allocating all needed memory. I am trying now with pure erlang because the new binary comprehensions may provide enough performance to skip the BIFs and I wanted the flexibility to change the API as I learn what is useful and what doesn't work. My latest effort involves splitting a large binary into a series of records efficiently. This allows for easy use of flat files as data sources, or for more convenient parsing of a binary protocol. I am still working on a good API and solid documentation before I release this library. If the library stabilizes and is shown acceptable by the community, I will go back to looking at BIFs that could speed the performance of the library. They would be available for others to use, but most likely the library API would be the interface level and the BIFs would be hidden and called inside the library. jay From ckerr@REDACTED Thu Nov 9 03:03:20 2006 From: ckerr@REDACTED (Cameron Kerr) Date: Thu, 9 Nov 2006 15:03:20 +1300 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: It's not something as simple as needing to do a 'sudo ldconfig' is it? On 6/11/2006, at 1:04 PM, Tobias L?fgren wrote: > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > have trouble loading external libraries/driver on a Ubuntu 6.10 > "Egdy Eft" system. > > I've just spent the better part of the weekend trying to figure out > what was going wrong. First it seemed like a problem with Yaws, > because erlang compiled fine and "worked". But yaws stopped with a > "exec 1: setuid_drv.so :not found". > > After much reinstalling and experimenting with different versions I > discovered that it was all dynamic loading of libraries that > failed. For example "crypto:start()." in the erl shell crashed in a > similar fashion. > > Maybe there is a simple solution to the problem, but at the moment > it eludes me, so I've downgraded. The same packages and erlang- > versions work perfectly fine in Ubuntu 6.06, so if you're using > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > /tobias > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- ? Cameron Kerr ? ? ckerr@REDACTED ? ? ? ? Telecommunications Teaching Fellow & SysAdmin ? ? ? http://humbledown.org/blog/ ? ? 021 02 333 294 ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Thu Nov 9 03:10:24 2006 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 09 Nov 2006 03:10:24 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> Message-ID: <45528E10.8050208@telia.com> There are so many threads now in this discussion I will comment the last one. Couldn't we have a forum instead of a mailing list? Today you have the possibility of having three types of returns from a (library) functions: yes it worked; no it didn't; and it crashed exceptionally. In most contexts they mean different things. If you remove the no option then the user who needs this will have to try to work this out by looking at the exceptions. Unless the the libraries are specificaly written with this in mind and extremely well documented then this will be well-nigh impossible to do. Why did I get this 'badarg', was it a "no" answer or were my arguments wrong? In many cases you need to differentiate this. If file:open bombs it would be very nice to know if I couldn't open the file or if my arguments were wrong. That is not the same thing and handling them as such will not make users happy. There will be written an aweful lot of wrapper functions to help you remember: file_open(Name, Opts) -> try file:crashing_open(Name, Opts) of Pid -> {ok,Pid} catch error:not_found -> {error,not_found}; error:permission -> {error,permission}; end. Unfortunately I have to know, and remember, them all. User friendly. In the dict library these cases are handled separately, there is dict:find which has a tagged return indicating if the value was found, and there is dict:fetch which assumes that it is there. The user uses the one which matches the requirements. It is then much easier to comprehend the true intentions rather than wrapping things in catch/try. It actually reminds me of a very funny Monty Python sketch. A customer in a restaurant points out that his fork is dirty, everyone working in the restaurant gets very worked-up, pandamonium follows and it ends with the head chef committing suicide. Unfortunately I can't remember in which episode it was. BUT THEN AGAIN - it would simplify writing many of the libraries. For example in io when scanning/parsing a file there would be no need to try and recover on an error to keep going - just BANG exception and let the some other process handle it. Epp detects an error - BANG exception. Hell we could do it for the compiler as well. Why go to all the trouble to keep track of errors and warnings and return something helpful? It detects an error - BANG exception and let the user handle it. Seeing we have removed the grey area between right and exception warnings have to go - BANG exception. The compiler would return ModuleName | {ModuleName,Bin} (untagged) depending on the arguments, and the exceptions {'EXIT',wrong} and {'EXIT',unused_variable}. I can get on to it next week perhaps. Of course Bj?rn would have put some work into optimising catch/try. Robert From ok@REDACTED Thu Nov 9 03:27:58 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 9 Nov 2006 15:27:58 +1300 (NZDT) Subject: [erlang-questions] Package Support/Use Message-ID: <200611090227.kA92RwMf265260@atlas.otago.ac.nz> I wrote: > I'm sure you will appreciate why I am so firmly convinced that end > of file should not be regarded as exceptional. Richard Carlsson replied: As Ulf (I think) noted, perhaps there should really be two different interfaces: one for random reading, where you expect the data to be there (and it is an exception if you reach eof), and one for sequential reading, returning {read, X}/eof. But there *ARE* two different interfaces already! And they *ARE* different in exactly that way! For sequential reading we have file:read(Device, Count) -> {ok,Data} | eof | {error,Reason} For random reading we have file:pread(Device, Location, Count) -> {ok,Data} | {error,Reason} As usual, the documentation could stand some work. The documentation of file:pread/3 says Combines position/2 and read/2 in one operation, which is more efficient than calling them one at a time. If Device [was] opened in raw mode ... Location [may] only be an integer, and the current position of the file is undefined after the operation. But if you did case file:position(Device, Location) of {ok,_} -> file:read(Device, Count) ; Error -> Error end then 'eof' would be a possible result of file:pread/3, which it isn't. Nor is it clear what happens if you ask for more bytes than are available; *presumably* you get a short block. From sandhya.adabala@REDACTED Thu Nov 9 06:44:34 2006 From: sandhya.adabala@REDACTED (sandhya.adabala@REDACTED) Date: Thu, 9 Nov 2006 11:14:34 +0530 Subject: [erlang-questions] Erlang Nodes Reconnection problem Message-ID: <7BCD17BB75C4464D866EB5A20D5E889E02050AF3@HYD-MKD-MBX01.wipro.com> Hi Chandru , Thanks for your inputs.Actually I have tried checking the erlang messages using erlsnoop on solaris pc. I observed flow of erlang messages from Linux node to solaris node once it is up after a 12hrs halt.But the strange thing is that the erlang node is printing those messages very late say after 15-20 minutes. This strange behaviour is not observed if the linux pc is rebooted after less than 3 hrs halt. I think that leaving the erlang node in diconnected mode for more than 12 hrs is causing the descrepancy but don't know the exact reason. Pls share your thoughts on this. Thanks & Regards, Sandhya ________________________________ From: Chandru [mailto:chandrashekhar.mullaparthi@REDACTED] Sent: Friday, October 27, 2006 2:19 PM To: Sandhya Adabala (WT01 - IP-Multimedia Carrier & Ent Networks) Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Nodes Reconnection problem Hi, Can you snoop on the traffic using snoop/tcpdump or some such tool and see what messages are flying on the network? Or you can try erlsnoop to observe messages being exchanged. http://www.erlang.org/contrib/erlsnoop-1.0.tgz Chandru On 27/10/06, sandhya.adabala@REDACTED wrote: Hi All, We are facing a very strange problem with erlang run time system "Erlang (BEAM) emulator version 5.3.6.3". Here is the problem: We have an erlang node running on solaris PC which communicates with another erlang node running on Linux PC. Whenever the Linux PC is halted[Solaris Erlang Node waits in a loop for reconnection to linux PC Node] and restarted after a long time say 12 hrs,the communication between the erlang nodes on Linux PC and Solaris box is not happening properly.After the long halt the solaris erlang node is able to send messages to Linux erlang node,but the replies sent by Linux PC are reaching the erlang node very late say after 2-3 hrs.We had to restart the solaris erlang node to make everything work normally.We are not facing the issue if the linux PC is halted and restarted after 1-3 Hrs. We are stuck up with this issue and couldn't progress much on this. Could any one of you help me in resolving this issue Thans & Regards, Sandhya The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Nov 9 07:56:14 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 Nov 2006 07:56:14 +0100 Subject: [erlang-questions] Segmented binaries (was Parsing with regexp...) In-Reply-To: <45528519.2020005@telia.com> References: <4550036F.8090401@duomark.com> <45528519.2020005@telia.com> Message-ID: Actually, the original bit syntax prototype had sub binaries and segmented binaries. Sub binaries are just a reference to a part of a larger binary. They are typically when you match out a binary using the bit syntax. A segmented binary is a binary that consists of several smaller binaries. Segmented binaries were typically created when binaries were concatenated. We implemented sub binaries in R7B, but not segmented binaries. The main reason was that binary matching became very complicated. We might implement something similar to segmented binaries in a future release. Our plan is that a segmented binary will be consolidated into one contigous binary if you attempt do binary matching on it, thus avoiding the complexity of matching a dis-contigous binary. /Bjorn Robert Virding writes: > > When you talk about spliting the binary do you mean that this is done > internally and transparently to the user? Or does the user see the list > of segments? The origianl implementation of binaries had this capability > of referencing segments of a large binary. Very good for pulling the > binary apart. Although you could use it for splicing together if you > were careful. > > Robert -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jay@REDACTED Thu Nov 9 08:29:55 2006 From: jay@REDACTED (Jay Nelson) Date: Wed, 08 Nov 2006 23:29:55 -0800 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive Message-ID: <4552D8F3.4070001@duomark.com> I collaborated with Ulf on a presentation entitled "Message Receive Fundamentals". I was looking forward to attending the conference with its strong agenda this year, alas it was not to be. Due to time constraints, the presentation will be part of the program but will not be presented. The briefing is online at http://www.duomark.com/erlang/ under the Erlang Tutorials section. It is in HTML rather than PDF or PPT. The main line of the presentation is just 4 slides, but the overview slide has links to subsections that are loops which return to the overview. It covers the basic syntax of the receive statement, some recommendations on usage and then some examples of beginning to intermediate problems. The genesis of the presentation was an issue that cropped up when I was doing the "Concurrent Caching" paper. I wanted write thru to take precedence over any pending read of the cache. As shown in the Fundamentals briefing, the problem of having a high priority message requires 4 processes and the ACKing of all messages if you want to avoid N! + N performance (where N is the number of messages on the queue). This result seemed counterintuitive to me. Erlang makes message sending and receiving trivial, yet the single sequential queue made it extremely difficult to efficiently handle some messages before others. As a result of the briefing I added a suggested language change to introduce a control message queue which is separate from the existing data message queue. A quick summary of the proposal is given in the last slide of the presentation. A detailed description is given at http://www.duomark.com/erlang/proposals/outofband.html (a link is available on the general erlang page under "Proposals for Erlang Enhancements"). Please provide any feedback you think relevant to the problem. jay From samuelrivas@REDACTED Thu Nov 9 08:41:15 2006 From: samuelrivas@REDACTED (Samuel Rivas) Date: Thu, 9 Nov 2006 08:41:15 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <45528E10.8050208@telia.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> <45528E10.8050208@telia.com> Message-ID: <20061109074115.GA22368@lambdastream.com> Robert Virding wrote: > In many cases you need to differentiate this. If file:open bombs it > would be very nice to know if I couldn't open the file or if my > arguments were wrong. That is not the same thing and handling them as > such will not make users happy. I suppose that is why try does not catch errors unless you force it to do so. > There will be written an aweful lot of wrapper functions to help you > remember: > > file_open(Name, Opts) -> > try file:crashing_open(Name, Opts) of > Pid -> {ok,Pid} > catch > error:not_found -> {error,not_found}; > error:permission -> {error,permission}; > > > end. I do not get that point: file_open_tagged_version(Name, Opts) -> try file_open_throwing_version(Name, Opts) of Pid -> {ok, Pid} catch Reason -> {error, Reason} end. You need not know, nor write, all the possible Reasons. Naturally, there is the opposite version: file_open_throwing_version(Name, Opts) -> case file_open_tagged_version(Name, Opts) of {ok, Pid} -> Pid; {error, Reason} -> throw(Reason) end. I do not see why throwing (or exiting, or erroring) is worse in terms of documentation for error cases. > BUT THEN AGAIN - it would simplify writing many of the libraries. For > example in io when scanning/parsing a file there would be no need to try > and recover on an error to keep going - just BANG exception and let the > some other process handle it. Epp detects an error - BANG exception. > Hell we could do it for the compiler as well. Why go to all the trouble > to keep track of errors and warnings and return something helpful? It > detects an error - BANG exception and let the user handle it. Seeing we > have removed the grey area between right and exception warnings have to > go - BANG exception. The compiler would return ModuleName | > {ModuleName,Bin} (untagged) depending on the arguments, and the > exceptions {'EXIT',wrong} and {'EXIT',unused_variable}. Here you are talking about applications, not about functions. In both tagged and throwing approaches error handling is still needed somewhere in the application. Regards -- Samuel From ke.han@REDACTED Thu Nov 9 09:18:46 2006 From: ke.han@REDACTED (ke han) Date: Thu, 9 Nov 2006 16:18:46 +0800 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611081655p45c481b1u6bb4287e0396a108@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> <5c402a550611081655p45c481b1u6bb4287e0396a108@mail.gmail.com> Message-ID: Thanks Tobias, it appears you install erlang from some ubuntu repo. I have always installed erlang on linux from source download at erlang.org. Which repo do you need to uncomment in ubuntu to find erlang? Its not in the default ones. Also, as a new ubuntu server user, I am concerned with opening up any but the core supported repos as they may bring in unsupported items when I install or upgrade. What is your approach? I am experimenting with a setup for what would be a production server, not some internal dev box. I come from a FreeBSD world, so I'm used to starting minimal and adding only what I need. thanks, ke han On Nov 9, 2006, at 8:55 AM, Tobias L?fgren wrote: > As others have mentioned, you need the m4 package, I cheated a bit > and did: > > sudo apt-get build-dep erlang > > which installs everything needed for building from source. > Especially useful as when starting from an almost empty ubuntu > server install as I did. > > /tobias > > On 11/8/06, ke han wrote: > Tobias, > I am installing erlang on ubuntu for the first time. It is OTP > R11B-1 on "ubuntu 6.06.1 server". > This is a new install of ubuntu and all I added after the install was: > openssh, build-essential, libncurses5-dev, libssl-dev and openssl. > These last three items I added in order to get ./configure to work. > > When I run make, it dies as follows: > > jhancock@REDACTED:~/otp_src_R11B-1$ make > cd erts/emulator && ERL_TOP=/home/jhancock/otp_src_R11B-1 make > generate depend > make[1]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > make -f i686-pc-linux-gnu/Makefile generate > make[2]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > /bin/mkdir -p i686-pc-linux-gnu/opt/plain > /bin/mkdir -p obj/i686-pc-linux-gnu/opt/plain > LANG=C /usr/bin/perl utils/beam_makeops -outdir i686-pc-linux-gnu/opt/ > plain \ > -emulator /home/jhancock/otp_src_R11B-1/lib/compiler/ > src/genop.tab beam/ops.tab beam/frag_ops.tab hipe/hipe_ops.tab > LANG=C /usr/bin/perl utils/make_tables -src i686-pc-linux-gnu - > include i686-pc-linux-gnu beam/atom.names beam/bif.tab hipe/ > hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab hipe/hipe_x86.tab > LANG=C /usr/bin/perl utils/make_version -o i686-pc-linux-gnu/ > erl_version.h R11B 5.5.1 i686-pc-linux-gnu > LANG=C /usr/bin/perl utils/make_driver_tab -o i686-pc-linux-gnu/ > driver_tab.c obj/i686-pc-linux-gnu/opt/plain/efile_drv.o obj/i686-pc- > linux-gnu/opt/plain/ddll_drv.o obj/i686-pc-linux-gnu/opt/plain/ > inet_drv.o obj/i686-pc-linux-gnu/opt/plain/zlib_drv.o obj/i686-pc- > linux-gnu/opt/plain/ram_file_drv.o obj/i686-pc-linux-gnu/opt/plain/ > ttsl_drv.o > LANG=C /usr/bin/perl utils/make_alloc_types -src beam/erl_alloc.types > -dst i686-pc-linux-gnu/opt/plain/erl_alloc_types.h threads hipe unix > LANG=C /usr/bin/perl utils/make_preload -old /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/otp_ring0.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/init.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_inet.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/prim_file.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erl_prim_loader.beam /home/jhancock/ > otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/ > preload.c > m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ > hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h > /bin/sh: m4: command not found > make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 > make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > make[1]: *** [generate] Error 2 > make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/ > emulator' > make: *** [depend] Error 2 > > Any idea what I need to have on ubuntu 6.06.1 server in order to get > a good compile?? > > thanks, ke han > > > On Nov 6, 2006, at 8:04 AM, Tobias L?fgren wrote: > > > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > > have trouble loading external libraries/driver on a Ubuntu 6.10 > > "Egdy Eft" system. > > > > I've just spent the better part of the weekend trying to figure out > > what was going wrong. First it seemed like a problem with Yaws, > > because erlang compiled fine and "worked". But yaws stopped with a > > "exec 1: setuid_drv.so :not found". > > > > After much reinstalling and experimenting with different versions I > > discovered that it was all dynamic loading of libraries that > > failed. For example "crypto:start()." in the erl shell crashed in a > > similar fashion. > > > > Maybe there is a simple solution to the problem, but at the moment > > it eludes me, so I've downgraded. The same packages and erlang- > > versions work perfectly fine in Ubuntu 6.06, so if you're using > > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > > > > /tobias > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Thu Nov 9 11:12:07 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 9 Nov 2006 10:12:07 +0000 Subject: [erlang-questions] Erlang Nodes Reconnection problem In-Reply-To: <7BCD17BB75C4464D866EB5A20D5E889E02050AF3@HYD-MKD-MBX01.wipro.com> References: <7BCD17BB75C4464D866EB5A20D5E889E02050AF3@HYD-MKD-MBX01.wipro.com> Message-ID: On 09/11/06, sandhya.adabala@REDACTED wrote: > > Hi Chandru , > > Thanks for your inputs.Actually I have tried checking the > erlang messages using erlsnoop on solaris pc. > I observed flow of erlang messages from Linux node to solaris > node once it is up after a 12hrs halt.But the > strange thing is that the erlang node is printing those > messages very late say after 15-20 minutes. > This strange behaviour is not observed if the linux pc is > rebooted after less than 3 hrs halt. > Can you post the capture file or traces so we can have a look? Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Thu Nov 9 11:45:28 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 9 Nov 2006 11:45:28 +0100 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive In-Reply-To: <4552D8F3.4070001@duomark.com> References: <4552D8F3.4070001@duomark.com> Message-ID: I'm not completly convinced that out-of-band message queues is needed. I simply have not thought enough about the example problem you present for motivating it. But assuming they are very useful tools. Why do I just want only one priority mailbox per process? Why not priority over priority? PriorityPid = oob(Pid), PriorityPid ! {a, message} HigherPriorityPid = oob(PriorityPid), SuperHighPriorityPid = oob(HigherPriorityPid),.... you get the idea. That is, store the destination priority in the Pid object. For selectively chosing priority queue in receive, introduce a new guard that only works there. receive Message when priority() > 1 -> ...; ... end From lenartlad@REDACTED Thu Nov 9 13:03:21 2006 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 09 Nov 2006 13:03:21 +0100 Subject: [erlang-questions] Problem with installing OTP test server in Debian/Etch (testing) Message-ID: <45531909.1040307@volny.cz> Hello, I am new to Erlang world (I come from Smalltalk one) and I am quite impressed with Erlang capabilities but still a little confused by its (complex) syntax... :-). I downloaded OTP test server from erlang.org but was unable to install it because make failed with message saying that files 'target.mk', 'otp.mk' and 'otp_subdir.mk' are missing - and they really are, I scanned my entire hardrive in the hunt for them. There is alo no configure script present that could generate them... I am using erlang 11.b.1.dfsg-1 from debian repository. Just for the sake of fullness, it uses Erlang (BEAM) emulator version 5.5.1 and init:script_id() returns {"OTP APN 181 01", "R11B"}. So my questions are: * What am I missing or doing wrong (where can I find those files)? * Are there any alternative test frameworks (which one would you recommend)? Thank you, Ladislav Lenart From sandhya.adabala@REDACTED Thu Nov 9 13:36:15 2006 From: sandhya.adabala@REDACTED (sandhya.adabala@REDACTED) Date: Thu, 9 Nov 2006 18:06:15 +0530 Subject: [erlang-questions] Erlang Nodes Reconnection problem Message-ID: <7BCD17BB75C4464D866EB5A20D5E889E02050DFC@HYD-MKD-MBX01.wipro.com> Hi Again, Here is the snippet of the ERL Snoop log captured after the Linux PC Node is up: ######################################################################## ############# 09:19:24.634965 [ aims-pc-75:32773 (gmc@REDACTED) > Jupiter:56689 (aimsserver@REDACTED) ] 141 REG_SEND from: #Pid to: global_name_server 09:19:24.638970 [ Jupiter:56689 (aimsserver@REDACTED) > aims-pc-75:32773 (gmc@REDACTED) ] 69 MONITOR from: #Pid to: net_kernel ref: #Ref 09:19:24.642976 [ Jupiter:56689 (aimsserver@REDACTED) > aims-pc-75:32773 (gmc@REDACTED) ] 86 REG_SEND from: #Pid to: net_kernel 09:19:24.643224 [ aims-pc-75:32773 (gmc@REDACTED) > Jupiter:56689 (aimsserver@REDACTED) ] 67 SEND to: #Pid 09:19:24.646930 [ Jupiter:56689 (aimsserver@REDACTED) > aims-pc-75:32773 (gmc@REDACTED) ] 123 REG_SEND from: #Pid to: global_name_server 09:19:24.647133 [ Jupiter:56689 (aimsserver@REDACTED) > aims-pc-75:32773 (gmc@REDACTED) ] 72 SEND to: #Pid 09:19:24.647178 [ aims-pc-75:32773 (gmc@REDACTED) > Jupiter:56689 (aimsserver@REDACTED) ] 56 SEND to: #Pid 09:19:24.647201 [ Jupiter:56689 (aimsserver@REDACTED) > aims-pc-75:32773 (gmc@REDACTED) ] 37 DEMONITOR from: #Pid to: net_kernel ref: #Ref 09:19:24.647552 [ aims-pc-75:32773 (gmc@REDACTED) > Jupiter:56689 (aimsserver@REDACTED) ] 54 SEND to: #Pid " " " " " " ######################################################################## ############# Below is the snippet of my application log which displays the messages received: 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:19.24 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} [Here the solaris application is sending messages but is not getting replies] ' ' ' ' ' ' ' ' '' ' ' 2006.11.09, 09:41.37 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:41.37 ---hw_erl (#0): sending {admin,{aloha,0,[0,[]]}} 2006.11.09, 09:41.37 hw: from_hw <0.75.0>: {admin,{aloha,3,[0,[]]}} [It is getting message only after 20 minutes] ################################################################# Let me know if you want further details.. ________________________________ From: Chandru [mailto:chandrashekhar.mullaparthi@REDACTED] Sent: Thursday, November 09, 2006 3:42 PM To: Sandhya Adabala (WT01 - IP-Multimedia Carrier & Ent Networks) Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Erlang Nodes Reconnection problem On 09/11/06, sandhya.adabala@REDACTED wrote: Hi Chandru , Thanks for your inputs.Actually I have tried checking the erlang messages using erlsnoop on solaris pc. I observed flow of erlang messages from Linux node to solaris node once it is up after a 12hrs halt.But the strange thing is that the erlang node is printing those messages very late say after 15-20 minutes. This strange behaviour is not observed if the linux pc is rebooted after less than 3 hrs halt. Can you post the capture file or traces so we can have a look? Chandru The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ranitrue@REDACTED Thu Nov 9 14:58:39 2006 From: ranitrue@REDACTED (selva rani) Date: Thu, 9 Nov 2006 19:28:39 +0530 Subject: [erlang-questions] Use of records Message-ID: <6b79c4a90611090558q25bc4f1bqd6c4bf55ab9447@mail.gmail.com> I have a doubt while using records... Is record field values are being updated using the same variable? If i assigned some values in one module and want to change a few fields in the record, should i pass the variable name to other module where i want to put a new value? Or is there any other way of handling it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Thu Nov 9 16:02:23 2006 From: jay@REDACTED (Jay Nelson) Date: Thu, 09 Nov 2006 07:02:23 -0800 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive In-Reply-To: References: <4552D8F3.4070001@duomark.com> Message-ID: <455342FF.4030205@duomark.com> Christian S wrote: > I'm not completly convinced that out-of-band message queues is needed. > I simply have not thought enough about the example problem you present > for motivating it. But assuming they are very useful tools. Why do I > just want only one priority mailbox per process? I may have muddied the waters by using a priority example. That was what caused me the original issue so I've stuck with it as the problem. I really want a way for certain messages to not got jammed up at the back of a long queue. This works to separate "control" messages from "data" messages, but could be used (or abused) for "priority" messages. On the webpage I talk about the complexity multiple mailboxes adds to the user's code and the likelihood of using the wrong mailbox. It also makes for a complicated syntax. > Why not priority over > priority? > > PriorityPid = oob(Pid), > PriorityPid ! {a, message} > HigherPriorityPid = oob(PriorityPid), > SuperHighPriorityPid = oob(HigherPriorityPid),.... you get the idea. Actually, I don't get the idea. You are creating a new process for each priority level? I don't know what oob/1 does. Does it launch a new middleman process? If so, how does the Highest priority jump in front of lower priorities when forwarding messages? The problem has changed a bit now. In the original there is a single destination that all communicating processes make a request of (think gen_server). Adding a priority to the message should not cause all callers to change the way they access the service. It should merely be a change behind the server's facade. So you would add a router and worker processes as I did in the presentation slides. > > That is, store the destination priority in the Pid object. For > selectively chosing priority queue in receive, introduce a new guard > that only works there. > > receive > Message when priority() > 1 -> ...; > ... > end > > Again, I may be confused by your example, but the following does not work at all. Assume message queue = [ {1, Msg}, {3, Msg}, {1, Msg}, {2, Msg} ] loop() -> receive {P3, Msgh} when P3 == 3 -> handle_high(Msgh), loop(); {P2, Msgm} when P2 == 2 -> handle_med(Msgm), loop(); {P1, Msgl} when P1 == 1 -> handle_low(Msgl), loop() end. The first message is matched against all clauses before continuing to the next message. The low priority message is processed first. So all the messages are processed in the order of arrival on the queue. If you split the receive to 3 separate receive statements, you end up with N! + N! + N scans across the queue if only low priority messages arrive and you'll have to poll to see if there are new messages. If you introduce a new attribute on all messages in the queue that is a VM internal flag for priority, you get the same N! + N! + N scanning unless you do the work on message receive to build a structure other than a sequential list. But putting priority requires a client process to be able to omnisciently choose its pecking position in the ecology of processes and process requests. If you are proposing priority as a new concept, I think it limits the usefulness of the feature. I see a benefit for an arbitrary number of channels for two communicating processes. The channel approach avoids the priority aproach's "client omniscience problem". The drawbacks for multi-channel are: 1) Complexity of syntax 2) Difficulty of the resulting user models 3) Debugging requires a lot of message tracing 4) Mistakes are easy to make when juggling channel handles 5) Different syntax for existing receive code My proposal tried to not disrupt the existing receive code or unnecessarily complicate the implementation for the VM, yet make a significant impact on a class of problems without intrusive syntax. The limitation is that you only have two channels and the question is whether that provides enough capability to be worth the effort. jay From chsu79@REDACTED Thu Nov 9 16:14:10 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 9 Nov 2006 16:14:10 +0100 Subject: [erlang-questions] Use of records In-Reply-To: <6b79c4a90611090558q25bc4f1bqd6c4bf55ab9447@mail.gmail.com> References: <6b79c4a90611090558q25bc4f1bqd6c4bf55ab9447@mail.gmail.com> Message-ID: Record1 = Record#gurka{foo=bar} will create a new gurka record bound to the variable called Record1, but foo set to bar. The old one still exists. Record1 gets all values from Record, except those values changed between curly brackets (foo=bar in my example). I'm not sure what your next questions are about. If you want to use this module in other modules you either include the .hrl or implement and export functions to access the record. Such as: Record1 = vegetables:gurka_foo(Record, bar) bar = vegetables:gurka_foo(Record) On 11/9/06, selva rani wrote: > I have a doubt while using records... > Is record field values are being updated using the same variable? > If i assigned some values in one module and want to change a few fields in > the record, should i pass the variable name to other module where i want to > put a new value? Or is there any other way of handling it? From ugglan@REDACTED Thu Nov 9 17:10:32 2006 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Thu, 9 Nov 2006 17:10:32 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <9A7DCB6A-B674-49D2-991F-13B0057FA55F@redstarling.com> <5c402a550611081655p45c481b1u6bb4287e0396a108@mail.gmail.com> Message-ID: <5c402a550611090810m14d2f92ar5c6cb3ade20cf6ff@mail.gmail.com> First: I am not qualified to give any expert advice on how to set up production quality servers. However like probably most every other programmer in the world, I have had to anyway of course. I build from source too, though I "cheat" with the dependencies. "sudo apt-get build-dep erlang" installs all packages needed to BUILD the latest erlang-package from source, though not the erlang packages themselves. This gives you a (hopefully) perfect environment to build from source yourself (ie. "worked for me"). I don't think you need to worry to much about packages added if you keep an eye open while running apt-get if you only add "universe" and "multiverse", I think you'll be more likely to run into problems if you try to build all dependencies from source yourself. Anyway, this is starting to get more ubuntu-related than erlang, maybe we should continue in private rather than on erlang-questions if you have more questions? /Tobias On 11/9/06, ke han wrote: > > Thanks Tobias, it appears you install erlang from some ubuntu repo. I > have always installed erlang on linux from source download at erlang.org > . Which repo do you need to uncomment in ubuntu to find erlang? Its not > in the default ones. > Also, as a new ubuntu server user, I am concerned with opening up any but > the core supported repos as they may bring in unsupported items when I > install or upgrade. > What is your approach? > I am experimenting with a setup for what would be a production server, not > some internal dev box. I come from a FreeBSD world, so I'm used to starting > minimal and adding only what I need. > thanks, ke han > > On Nov 9, 2006, at 8:55 AM, Tobias L?fgren wrote: > > As others have mentioned, you need the m4 package, I cheated a bit and > did: > > sudo apt-get build-dep erlang > > which installs everything needed for building from source. Especially > useful as when starting from an almost empty ubuntu server install as I did. > > > /tobias > > On 11/8/06, ke han wrote: > > > > Tobias, > > I am installing erlang on ubuntu for the first time. It is OTP > > R11B-1 on "ubuntu 6.06.1 server". > > This is a new install of ubuntu and all I added after the install was: > > openssh, build-essential, libncurses5-dev, libssl-dev and openssl. > > These last three items I added in order to get ./configure to work. > > > > When I run make, it dies as follows: > > > > jhancock@REDACTED:~/otp_src_R11B-1$ make > > cd erts/emulator && ERL_TOP=/home/jhancock/otp_src_R11B-1 make > > generate depend > > make[1]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > > emulator' > > make -f i686-pc-linux-gnu/Makefile generate > > make[2]: Entering directory `/home/jhancock/otp_src_R11B-1/erts/ > > emulator' > > /bin/mkdir -p i686-pc-linux-gnu/opt/plain > > /bin/mkdir -p obj/i686-pc-linux-gnu/opt/plain > > LANG=C /usr/bin/perl utils/beam_makeops -outdir i686-pc-linux-gnu/opt/ > > plain \ > > -emulator /home/jhancock/otp_src_R11B-1/lib/compiler/ > > src/genop.tab beam/ops.tab beam/frag_ops.tab hipe/hipe_ops.tab > > LANG=C /usr/bin/perl utils/make_tables -src i686-pc-linux-gnu - > > include i686-pc-linux-gnu beam/atom.names beam/bif.tab hipe/ > > hipe_bif0.tab hipe/hipe_bif1.tab hipe/hipe_bif2.tab hipe/hipe_x86.tab > > LANG=C /usr/bin/perl utils/make_version -o i686-pc-linux-gnu/ > > erl_version.h R11B 5.5.1 i686-pc-linux-gnu > > LANG=C /usr/bin/perl utils/make_driver_tab -o i686-pc-linux-gnu/ > > driver_tab.c obj/i686-pc-linux-gnu/opt/plain/efile_drv.o obj/i686-pc- > > linux-gnu/opt/plain/ddll_drv.o obj/i686-pc-linux-gnu/opt/plain/ > > inet_drv.o obj/i686-pc-linux-gnu/opt/plain/zlib_drv.o obj/i686-pc- > > linux-gnu/opt/plain/ram_file_drv.o obj/i686-pc-linux-gnu/opt/plain/ > > ttsl_drv.o > > LANG=C /usr/bin/perl utils/make_alloc_types -src beam/erl_alloc.types > > -dst i686-pc-linux-gnu/opt/plain/erl_alloc_types.h threads hipe unix > > LANG=C /usr/bin/perl utils/make_preload -old /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/otp_ring0.beam /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/init.beam /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/prim_inet.beam /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/prim_file.beam /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/erl_prim_loader.beam /home/jhancock/ > > otp_src_R11B-1/lib/kernel/ebin/erlang.beam > i686-pc-linux-gnu/preload.c > > m4 -DTARGET=i686-pc-linux-gnu -DOPSYS=linux -DARCH=x86 hipe/ > > hipe_x86_asm.m4 > i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h > > /bin/sh: m4: command not found > > make[2]: *** [i686-pc-linux-gnu/opt/plain/hipe_x86_asm.h] Error 127 > > make[2]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > > make[1]: *** [generate] Error 2 > > make[1]: Leaving directory `/home/jhancock/otp_src_R11B-1/erts/emulator' > > > > make: *** [depend] Error 2 > > > > Any idea what I need to have on ubuntu 6.06.1 server in order to get > > a good compile?? > > > > thanks, ke han > > > > > > On Nov 6, 2006, at 8:04 AM, Tobias L?fgren wrote: > > > > > > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to > > > have trouble loading external libraries/driver on a Ubuntu 6.10 > > > "Egdy Eft" system. > > > > > > I've just spent the better part of the weekend trying to figure out > > > what was going wrong. First it seemed like a problem with Yaws, > > > because erlang compiled fine and "worked". But yaws stopped with a > > > "exec 1: setuid_drv.so :not found". > > > > > > After much reinstalling and experimenting with different versions I > > > discovered that it was all dynamic loading of libraries that > > > failed. For example "crypto:start()." in the erl shell crashed in a > > > similar fashion. > > > > > > Maybe there is a simple solution to the problem, but at the moment > > > it eludes me, so I've downgraded. The same packages and erlang- > > > versions work perfectly fine in Ubuntu 6.06, so if you're using > > > Ubuntu and Erlang, don't upgrade ubuntu yet. > > > > > > > > > /tobias > > > > > > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ugglan@REDACTED Thu Nov 9 17:18:57 2006 From: ugglan@REDACTED (=?ISO-8859-1?Q?Tobias_L=F6fgren?=) Date: Thu, 9 Nov 2006 17:18:57 +0100 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> Message-ID: <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> I don't think so, but honestly I can't remember if I tried it. So it probably was, haha. I now have a stable environment based on 6.06 I'm actually using, so I don't have any 6.10 environment to doublecheck it on anymore. Thanks anyway! /tobias On 11/9/06, Cameron Kerr wrote: > > It's not something as simple as needing to do a 'sudo ldconfig' is it? > On 6/11/2006, at 1:04 PM, Tobias L?fgren wrote: > > > Just a heads up for anyone else who uses Ubuntu. Erlang seems to have > trouble loading external libraries/driver on a Ubuntu 6.10 "Egdy Eft" > system. > > I've just spent the better part of the weekend trying to figure out what > was going wrong. First it seemed like a problem with Yaws, because erlang > compiled fine and "worked". But yaws stopped with a "exec 1: setuid_drv.so > :not found". > > After much reinstalling and experimenting with different versions I > discovered that it was all dynamic loading of libraries that failed. For > example "crypto:start()." in the erl shell crashed in a similar fashion. > > Maybe there is a simple solution to the problem, but at the moment it > eludes me, so I've downgraded. The same packages and erlang-versions work > perfectly fine in Ubuntu 6.06, so if you're using Ubuntu and Erlang, don't > upgrade ubuntu yet. > > > /tobias > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > -- > ? Cameron Kerr ? ? ckerr@REDACTED ? ? ? > ? Telecommunications Teaching Fellow & SysAdmin ? > ? ? http://humbledown.org/blog/ ? ? 021 02 333 294* *? > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Thu Nov 9 22:05:35 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 09 Nov 2006 22:05:35 +0100 Subject: [erlang-questions] Problem with installing OTP test server in Debian/Etch (testing) In-Reply-To: <45531909.1040307@volny.cz> References: <45531909.1040307@volny.cz> Message-ID: Ladislav Lenart skrev: > Hello, > > I am new to Erlang world (I come from Smalltalk one) and I am > quite impressed with Erlang capabilities but still a little > confused by its (complex) syntax... :-). > > I downloaded OTP test server from erlang.org but was unable to > install it because make failed with message saying that files > 'target.mk', 'otp.mk' and 'otp_subdir.mk' > are missing - and they really are, I scanned my entire hardrive > in the hunt for them. There is alo no configure script present > that could generate them... > > I am using erlang 11.b.1.dfsg-1 from debian repository. Just > for the sake of fullness, it uses > Erlang (BEAM) emulator version 5.5.1 > and init:script_id() returns > {"OTP APN 181 01", "R11B"}. > > So my questions are: > * What am I missing or doing wrong (where can I find those > files)? > * Are there any alternative test frameworks (which one would > you recommend)? An alternative could be: http://code.google.com/p/yatsy --Tobbe > > Thank you, > > Ladislav Lenart > From roger.larsson@REDACTED Fri Nov 10 00:06:33 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 10 Nov 2006 00:06:33 +0100 Subject: [erlang-questions] [RFC] smarter receive In-Reply-To: <4552D8F3.4070001@duomark.com> References: <4552D8F3.4070001@duomark.com> Message-ID: <200611100006.33238.roger.larsson@norran.net> Is it impossible to make the current receive smarter? >From Concurrent Programming in ERLANG: priority_receive() -> receive interrupt -> interrupt after 0 -> receive AnyMessage -> AnyMessage end end Suppose the input queue has grown long. The first receive above walks the queue and finds nothing. Why not remember this position for next time? Since the test is constant none of the already scanned messages will match next time either! Simple rule: unless the match has changed it is possible to restart from the previous position. This holds even for AnyMessage since it matched the first message it can continue from there the next time. A more problematic example would be receive_next(Pid) -> receive {Pid, Value} -> ... end. But note that even in the last case a smart receive scanner could skip all non tuples and all non two-tuples and never having to revisit them. (It might be possible to be smarter than that - receive could keep the previously matched value {<123.123.123>, _ }) Now lets try this on your example: loop(State) -> receive %% *1 {pause, _From} -> wait_for_resume(), loop(State) after 0 -> receive %% *2 {pause, _From} -> wait_for_resume(), loop(State) {DataMsg, From} -> NewState = send_response(From, DataMsg), loop(NewState) end end. wait_for_resume() -> receive %% *3 {resume, _From} ->> ok end. Receive *1 would skip all non two tuples with first tuple 'pause'. Receive *3 would skip all non two tuples with first tuple 'resume'. Receive *2 would skip all non two tuples. AND since the process does no other receive (unless send_response does...) any message skipped by all three will NEVER be received... An improvement could be to add some syntaxtic sugar to avoid repeating the prioritized part of the receive... Something like. receive {prio1, Data} -> ... {prio2a, Data} after 0 -> ... {prio2b, Data} after 0 -> ... Anything after 1000 -> report_old(Anything) after 10000 -> timeout... end. In core Erlang this would be expanded to three receive statements. (It would be possible to cache one message_scan_location per match - reusing it from any receive in that process! Remaining to solve is where to start the scan - prio2a and prio2b could have different message_scan_locations so begin with the oldest.. which one is is oldest? And caches works well until you reach the magic limit where things falls apart...) Comments? /RogerL From chsu79@REDACTED Fri Nov 10 00:48:11 2006 From: chsu79@REDACTED (Christian S) Date: Fri, 10 Nov 2006 00:48:11 +0100 Subject: [erlang-questions] Help on dictionary search In-Reply-To: References: <3A76756EED583B43A4AD704E29CCD0797411A2@mail.aprsmartlogik.com> Message-ID: > remove_pid(Classes, Pid) -> > Classes1 = [{Class, sets:del_element(Pid, Set)} || {Class, Set} <- Classes], > Classes2 = [{Class, Set} || {Class, Set} <- Classes1, sets:size(Set) =/= 0]. > > [also untested] I just learned more about the '--' operator's semantics: C = [{a, [1,2,3]}, {b, [4,5,6]}, {c, [1]}]. Pid = 1. [{Class, Set--[Pid]} || {Class, Set} <- C, [] =/= Set--[Pid]]. gives [{a, [2,3]}, {b, [4,5,6]}] It isnt pretty, but it is silly! :) From jay@REDACTED Fri Nov 10 04:14:33 2006 From: jay@REDACTED (Jay Nelson) Date: Thu, 09 Nov 2006 19:14:33 -0800 Subject: [erlang-questions] [RFC] smarter receive Message-ID: <4553EE99.9060500@duomark.com> I wasn't sure that this message was about "proposal to enhance message receive" because the thread name changed. You quoted a book I never mentioned and then had code that looked very similar to mine. I assume this is somehow related and will try to answer. > Why not remember this position for next time? > Since the test is constant none of the already scanned messages will match > next time either! This only helps in the case of constant data. If there is a variable that could change because it is a loop argument or the result of another receive, then you must resort back to the full scanning method. This would solve the problem in some cases, but not all, while making the implementation more complex. >Remaining to solve is where to start the scan - prio2a and prio2b could have > different message_scan_locations so begin with the oldest.. which one is > oldest? You don't want to change the fundamental semantics of receive in that messages are scanned from earliest to latest, and that the order of pattern clauses in a receive statement matters (they are evaluated sequentially against a single message). It is possible to arrange this in your scenario, but you wouldn't want to adopt an approach that makes the bookkeeping required to manage the semantics to be too involved. Right now message receive is simple and fast to perform, therefore it is highly reliable. It only becomes slow when you combine selective receive with a very long message queue. This can happen when there are multiple requesters filling the queue, or the server handling requests has a lot to do for a single request. jay From surindar.shanthi@REDACTED Fri Nov 10 07:35:17 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Fri, 10 Nov 2006 12:05:17 +0530 Subject: [erlang-questions] tracing process in a file Message-ID: <42ea5fb60611092235u85d105frd63634b516dee138@mail.gmail.com> Dear all, I would like to trace a process to a file when it starts at the background. Which module can help in achieving the above. As i don't have enough time now to go through all the modules. Kindly help me. -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From tobbe@REDACTED Fri Nov 10 09:24:02 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 10 Nov 2006 09:24:02 +0100 Subject: [erlang-questions] The #erlang channel ar irc.freenode.net Message-ID: After having met all Erlang friends at the EUC yesterday, I tought I should remind everyone that there exist an Erlang chat channel at irc.freenode.net. It is easy to join in, for example if you use Emacs-22 you just type: M-x irc For Emacs 21 find the rcirc.el module. For a GUI approach, try Gaim, Chatzilla, Xchat, Kopete, etc... Cheers, Tobbe (nick: etnt) ------------------------------------------------------------ Ps. Perhaps there should be an HowTo for some of the Erlang oldtimers (eh...myself included :-) Anyway, to setup Gaim: 1. Choose the meny Tools/Accounts then choose: Protocol: IRC Screen Name: Server: irc.freenode.net That is it! Now Save and click the Online checkbox in the Accounts window. You will now get a window divided in three parts. In the bottom part type: /j #erlang click on the #erlang tab and start chatting away. You can now also click on the '+ Add' button to create a shortcut in your 'Buddy List'. From richardc@REDACTED Fri Nov 10 10:36:04 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 10 Nov 2006 10:36:04 +0100 Subject: [erlang-questions] Package Support/Use In-Reply-To: <200611090227.kA92RwMf265260@atlas.otago.ac.nz> References: <200611090227.kA92RwMf265260@atlas.otago.ac.nz> Message-ID: <45544804.2040805@it.uu.se> Richard A. O'Keefe wrote: > For random reading we have > > file:pread(Device, Location, Count) -> {ok,Data} | {error,Reason} > > As usual, the documentation could stand some work. It certainly does. The docs also claim that, for pread/3: Data = [char()] | binary() | eof which is bogus. There has been some confusion with the function pread/2 in the documentation. For pread/3, it should say that: file:pread(Device, Location, Count) -> {ok,Data} | eof | {error,Reason} where Data = [char()] | binary() A quick experiment furthermore indicates that: - if Location is beyond the last byte of the file, file:pread/3 returns 'eof' (documented for pread/2, but not for pread/3) - if Count is 0, pread/3 returns 'eof' (weird and undocumented) while read/2 returns an empty list if Count is 0. - if less than Count bytes can be read, pread/3 silently truncates the result (this is only documented for read/2), as long as the starting position is legal Even if pread/3 was cleaned up a bit, I'd also like to have a function that does not combine seek and read (the part of the program that does the seek might not be the same as that which does the read), and that always reports an error if not enough bytes can be read. /Richard From chsu79@REDACTED Fri Nov 10 10:48:28 2006 From: chsu79@REDACTED (Christian S) Date: Fri, 10 Nov 2006 10:48:28 +0100 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive In-Reply-To: <455342FF.4030205@duomark.com> References: <4552D8F3.4070001@duomark.com> <455342FF.4030205@duomark.com> Message-ID: On 11/9/06, Jay Nelson wrote: > Actually, I don't get the idea. You are creating a new process for > each priority level? I don't know what oob/1 does. Does it launch > a new middleman process? If so, how does the Highest priority > jump in front of lower priorities when forwarding messages? No, the idea was that it creates a Pid object that refers to the same process but another priority level. My thought was that you get less specialization. Imagine you pass a message to some server process and want a priority message back: Server ! {req, oob(self()), Request}, receive {reply, Server, Response} when priority() > 1 -> ... end Server doesnt need to know that this message is delivered with increased priority. receive doesnt scan the congested priority() == 0 mailbox. I dont think I like creeping featurism of priority mailboxes. Is the goal mainly increased efficiency (over a routing process) in that cache example? From datacompboy@REDACTED Fri Nov 10 11:59:15 2006 From: datacompboy@REDACTED (datacompboy) Date: Fri, 10 Nov 2006 10:59:15 +0000 Subject: [erlang-questions] Simple multi-case References: Message-ID: <20061110105915.A455E5A1F8@mail.erlangsystems.com> Is there simple syntax for simple multi-case clauses? F.e.: case getstatus(Id) of free -> doX(); online -> doX(); busy -> doY() end Fine, but what if I need to call two functions? I want just write case getstatus(Id) of free || online -> doX(), doZ(), ok; busy -> doY() end instead of case getstatus(Id) of free -> doX(), doZ(), ok; online -> doX(), doZ(), ok; busy -> doY() end Since there more than one call, but too small code to move it into separate fun. For now that possible only as case getstatus(Id) of S when (S==free) orelse (S==online) -> doX(), doZ(), ok; busy -> doY() end But may be I have missed something, and there simpler syntax? -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From chsu79@REDACTED Fri Nov 10 13:21:39 2006 From: chsu79@REDACTED (Christian S) Date: Fri, 10 Nov 2006 13:21:39 +0100 Subject: [erlang-questions] Simple multi-case In-Reply-To: <20061110105915.A455E5A1F8@mail.erlangsystems.com> References: <20061110105915.A455E5A1F8@mail.erlangsystems.com> Message-ID: > For now that possible only as > case getstatus(Id) of > S when (S==free) orelse (S==online) -> doX(), doZ(), ok; > busy -> doY() > end Do = case getstatus(Id) of free -> x; online -> x; busy -> y end, case Do of x -> doX(); y -> doY(); end. Not less typing, but perhaps a more table-like overview of what to do and thus more readable code. From raimo+erlang-questions@REDACTED Fri Nov 10 13:52:16 2006 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 10 Nov 2006 13:52:16 +0100 Subject: [erlang-questions] : Simple multi-case In-Reply-To: References: <20061110105915.A455E5A1F8@mail.erlangsystems.com> Message-ID: <20061110125216.GA24341@erix.ericsson.se> Or nest them: case case getstatus(Id) of free -> x; online -> x; busy -> y end of x -> doX(); y -> doY(); end. On Fri, Nov 10, 2006 at 01:21:39PM +0100, Christian S wrote: > > For now that possible only as > > case getstatus(Id) of > > S when (S==free) orelse (S==online) -> doX(), doZ(), ok; > > busy -> doY() > > end > > Do = > case getstatus(Id) of > free -> x; > online -> x; > busy -> y > end, > > case Do of > x -> doX(); > y -> doY(); > end. > > Not less typing, but perhaps a more table-like overview of what to do > and thus more readable code. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From roger.larsson@REDACTED Fri Nov 10 16:06:38 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Fri, 10 Nov 2006 16:06:38 +0100 Subject: [erlang-questions] [RFC] smarter receive In-Reply-To: <4553EE99.9060500@duomark.com> References: <4553EE99.9060500@duomark.com> Message-ID: <200611101606.38644.roger.larsson@norran.net> On Friday 10 November 2006 04:14, Jay Nelson wrote: > I wasn't sure that this message was about "proposal to enhance message > receive" > because the thread name changed. You quoted a book I never mentioned and > then had code that looked very similar to mine. I assume this is > somehow related > and will try to answer. Yes, it is another proposal. > > > Why not remember this position for next time? > > Since the test is constant none of the already scanned messages will > > match > > > next time either! > > This only helps in the case of constant data. If there is a variable > that could change because it is a loop argument or the result of > another receive, then you must resort back to the full scanning method. > This would solve the problem in some cases, but not all, while making > the implementation more complex. I know - I wrote that too :-) OK, lets try to simplify as much as possible, what is the most common case? I would guess it is: Tuple with first element a constant atom. (It would be quite easy to rewrite code in this way... easier than rewriting code to match your proposal anyway) Each receive statement needs to save a pointer to how far in the queue it has searched or each match could cache the same info. Any receive with a match all would not need to save anything. > >> - - - > > You don't want to change the fundamental semantics of receive in that > messages are scanned from earliest to latest, and that the order of pattern > clauses in a receive statement matters I never intended to change the semantics. Implementation could change... /RogerL From mogorman@REDACTED Fri Nov 10 17:08:33 2006 From: mogorman@REDACTED (Matthew O'Gorman) Date: Fri, 10 Nov 2006 10:08:33 -0600 Subject: [erlang-questions] euc conference videos / slides? Message-ID: Are there any videos of the euc conference or slides for those of us who couldn't attend the conference this year? Mog From calmasy@REDACTED Fri Nov 10 18:40:09 2006 From: calmasy@REDACTED (=?ISO-8859-1?Q?Count_L=E1szl=F3_de_Alm=E1sy?=) Date: Fri, 10 Nov 2006 10:40:09 -0700 Subject: [erlang-questions] trying to understand i/o threading (erl +A) Message-ID: Greetings, I'm attempting to understand the i/o threading option to erl better (i.e, erl +A): +A size Sets the number of threads in async thread pool, valid range is 0-1024. Default is 0. Is there a metric one can use to gage how many threads I should start for an application such as the Yaws webserver? My system has 1GB of main memory. Should I just use the maximum (1024)? I'm assuming there is a point of diminishing returns somewhere, but I don't know where that would be. Right now I'd just be picking a random number and I'd rather not do that. Advice appreciated. -- Cheers, L?szl? From robert.virding@REDACTED Sat Nov 11 01:41:55 2006 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 11 Nov 2006 01:41:55 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <20061109074115.GA22368@lambdastream.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> <45528E10.8050208@telia.com> <20061109074115.GA22368@lambdastream.com> Message-ID: <45551C53.6030003@telia.com> The problem is that I want to differentiate between different types of error/exceptions. I DON'T JUST want errors or JUST exceptions. Both have their place. So for file:open I want errors in arguments, wrong data types, bad options etc. to generate exceptions as these are clearly programming errors and it would then be best here to generate an exception to indicate that this was serious and must be fixed. Other errors like file not existing or wrong permissions should generate a tagged return value. To do this I have to keep track of the error reasons so I can differentiate between them and get the right handling. N.B. this has to be done in both directions. It is worse for the documentation as I have to document ALL the different error values to be able to do this separation. A concrete example: I want to scan a list of directories searching for and processing a list of files in each directory. If a file/directory does not exist then it is not an error but just keep on going. However, it IS an error if I call file:open(FileName, rad) (instead of read) and an exception must be generated but the program is wrong. I may have missed something but to do this, I think, very reasonable separation requires keeping track of which errors generate what tageed/exception values. It is easy for file:open to do it but difficult for me. As it was originally written file:open did this. Aomething I read recently inidicated that it does not now do that, but I could be wrong there. Sorry compile:file is a library function. If you are suggesting that we treat functions and applications, which consist of functions and are called through functions, differently then I think you are on very loose ground. What is the difference? Size, how many functions they call, if they are bifs, or what? If my compiler is really small has it suddenly become a function? I don't you can present any reasonable and understandable rule for separating them. Anyway I WANT the compiler to generate an exception if there is a program error in it. Just as I want to library functions to do. Should applications not generate exceptions? Which is what you are suggesting I don't see why I cannot have the best of both worlds when the system can provide it for me. Why be forced to do a lot of extra and nit-picky work when the system can easily do it for me? Have a new class in try, 'no', so I an easily get what I need and you can have just exceptions. Einstein said something like "Things should be as simple as possible, but not too simple". Robert P.S. Good EUC! Samuel Rivas wrote: > Robert Virding wrote: > >>In many cases you need to differentiate this. If file:open bombs it >>would be very nice to know if I couldn't open the file or if my >>arguments were wrong. That is not the same thing and handling them as >>such will not make users happy. > > > I suppose that is why try does not catch errors unless you force it to > do so. > > >>There will be written an aweful lot of wrapper functions to help you >>remember: >> >>file_open(Name, Opts) -> >> try file:crashing_open(Name, Opts) of >> Pid -> {ok,Pid} >> catch >> error:not_found -> {error,not_found}; >> error:permission -> {error,permission}; >> >> >> end. > > > I do not get that point: > > file_open_tagged_version(Name, Opts) -> > try file_open_throwing_version(Name, Opts) of > Pid -> {ok, Pid} > catch > Reason -> {error, Reason} > end. > > You need not know, nor write, all the possible Reasons. Naturally, > there is the opposite version: > > file_open_throwing_version(Name, Opts) -> > case file_open_tagged_version(Name, Opts) of > {ok, Pid} -> Pid; > {error, Reason} -> throw(Reason) > end. > > I do not see why throwing (or exiting, or erroring) is worse in terms > of documentation for error cases. > > >>BUT THEN AGAIN - it would simplify writing many of the libraries. For >>example in io when scanning/parsing a file there would be no need to try >>and recover on an error to keep going - just BANG exception and let the >>some other process handle it. Epp detects an error - BANG exception. >>Hell we could do it for the compiler as well. Why go to all the trouble >>to keep track of errors and warnings and return something helpful? It >>detects an error - BANG exception and let the user handle it. Seeing we >>have removed the grey area between right and exception warnings have to >>go - BANG exception. The compiler would return ModuleName | >>{ModuleName,Bin} (untagged) depending on the arguments, and the >>exceptions {'EXIT',wrong} and {'EXIT',unused_variable}. > > > Here you are talking about applications, not about functions. In both > tagged and throwing approaches error handling is still needed somewhere > in the application. > > Regards From ulf@REDACTED Sat Nov 11 16:06:44 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 11 Nov 2006 16:06:44 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <45551C53.6030003@telia.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> <45528E10.8050208@telia.com> <20061109074115.GA22368@lambdastream.com> <45551C53.6030003@telia.com> Message-ID: Den 2006-11-11 01:41:55 skrev Robert Virding : > The problem is that I want to differentiate between different > types of error/exceptions. I DON'T JUST want errors or JUST > exceptions. Both have their place. I think our recommendation (inasfar as there's been one) has been to not throw exceptions at the end user. Some interface functions may be intuitively written such that they either produce a correct result or exit. Obviously, some OTP library functions do just that, and it's usually when there is no sensible 'error' value to present: lists:reverse(foo) -> {error, 'eh?'} One could of course argue that the compiler could throw an exception if a module doesn't compile. That exception would probably then be compile:file(F, Opts) -> ... erlang:error(Errors) How then the compiler goes about collecting the errors, and not suddenly breaking on the first error, just because it wants to avoid packing an error tuple, would of course be up to the compiler designer. It's certainly not obvious that throwing exceptions makes for clearer code, when you're obviously going to continue searching for more errors anyway. The problem in a large system (such as ...uh, the AXD 301), is that you have tons of internal components that, in a sense have managed interfaces between each other. Many of the sequences run across several such component boundaries, but the division is in a sense arbitrary - we may choose to divide things into blocks because it makes more sense from a project perspective to do so, it's all our code; it's all our environment, and the environment is relatively well controlled. There is then one rule in particular, that I feel is relevant to the discussion: "Trust internal users. Do not trust external users." Since we trust users of internal interfaces to know what they're doing, we can also devise the interfaces to reflect the corresponding trust, that our component also does what it's supposed to. If it doesn't, it should rightfully be an exception. Not trusting external users also means that you expect them to misuse the interface, and test all input. One can then also assume a more bureaucratic stance and respond "Sorry, but you haven't filled out the form correctly. Can't help you. Have a good day."(*) - in Erlang/POSIX speak, abbreviated to e.g. {error, einval}. While "we" like this to be the default policy, there will be a significant number of interfaces that really should return with a slightly more gentle touch. The thing is, that all the code that wraps case clauses around function calls, not only is more verbose, but also risks hiding the error, rather than throwing an exception as close to the original weirdness as possible. (*) For the human equivalent to throwing exceptions in user interaction, I take great pleasure in watching "House, M.D.": Effective, but nobody likes him much. /Ulf W -- Ulf Wiger From robert.virding@REDACTED Mon Nov 13 00:14:00 2006 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 13 Nov 2006 00:14:00 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> <45528E10.8050208@telia.com> <20061109074115.GA22368@lambdastream.com> <45551C53.6030003@telia.com> Message-ID: <4557AAB8.7060303@telia.com> Hello Ulf, All I can say is "I agree completely". It must be, of course, the application and its solution which decides where and how errors are to be handled. What I was protesting against was the dogmatic :-) view that all library functions should always generate exceptions. Which is as wrong as saying that never should. Your point about internal and external users is one that can never be stated too many times. Robert Ulf Wiger wrote: > Den 2006-11-11 01:41:55 skrev Robert Virding : > >> The problem is that I want to differentiate between different >> types of error/exceptions. I DON'T JUST want errors or JUST >> exceptions. Both have their place. > > > I think our recommendation (inasfar as there's been one) has been > to not throw exceptions at the end user. Some interface functions may > be intuitively written such that they either produce a correct > result or exit. Obviously, some OTP library functions do just > that, and it's usually when there is no sensible 'error' value > to present: > > lists:reverse(foo) -> {error, 'eh?'} > > One could of course argue that the compiler could throw an > exception if a module doesn't compile. That exception would > probably then be > > compile:file(F, Opts) -> ... erlang:error(Errors) > > How then the compiler goes about collecting the errors, > and not suddenly breaking on the first error, just because > it wants to avoid packing an error tuple, would of course > be up to the compiler designer. It's certainly not obvious > that throwing exceptions makes for clearer code, when you're > obviously going to continue searching for more errors anyway. > > The problem in a large system (such as ...uh, the AXD 301), > is that you have tons of internal components that, in a sense > have managed interfaces between each other. Many of the sequences > run across several such component boundaries, but the division is > in a sense arbitrary - we may choose to divide things into blocks > because it makes more sense from a project perspective to do so, > it's all our code; it's all our environment, and the environment > is relatively well controlled. > > There is then one rule in particular, that I feel is relevant to > the discussion: > > "Trust internal users. Do not trust external users." > > Since we trust users of internal interfaces to know what they're > doing, we can also devise the interfaces to reflect the > corresponding trust, that our component also does what it's > supposed to. If it doesn't, it should rightfully be an exception. > > Not trusting external users also means that you expect them to > misuse the interface, and test all input. One can then also > assume a more bureaucratic stance and respond "Sorry, but you > haven't filled out the form correctly. Can't help you. > Have a good day."(*) - in Erlang/POSIX speak, abbreviated to e.g. > {error, einval}. > > While "we" like this to be the default policy, there will be a > significant number of interfaces that really should return > with a slightly more gentle touch. The thing is, that all the > code that wraps case clauses around function calls, not only > is more verbose, but also risks hiding the error, rather than > throwing an exception as close to the original weirdness as > possible. > > (*) For the human equivalent to throwing exceptions in user > interaction, I take great pleasure in watching "House, M.D.": > Effective, but nobody likes him much. > > /Ulf W From ok@REDACTED Mon Nov 13 01:49:00 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 13 Nov 2006 13:49:00 +1300 (NZDT) Subject: [erlang-questions] Simple multi-case Message-ID: <200611130049.kAD0n03w291160@atlas.otago.ac.nz> "datacompboy" asked: Is there simple syntax for simple multi-case clauses? It is not clear to me what "multi-case clauses" means; from the example it looks a whole lot like decision tables. Since there more than one call, but too small code to move it into separate fun. There is no such thing as code that is too small to move into a separate function. Bear in mind that the Erlang compiler *can* expand simple functions in-line, so splitting small chunks out need not have any run-time overhead at all. From fritchie@REDACTED Mon Nov 13 04:59:33 2006 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 12 Nov 2006 21:59:33 -0600 Subject: [erlang-questions] Announce: EDTK version 1.5 candidate 1 Message-ID: <200611130359.kAD3xXwg059886@snookles.snookles.com> Greetings. Thanks to an awful lot of hard work by Chris Newcombe, I am pleased to announce a release candidate, #1, of version 1.5 of EDTK, the Erlang Driver ToolKit. http://www.snookles.com/erlang/edtk/ I confess I haven't looked at it much, between house repair projects and $#^&$#!^%! problems with RSI. It is possible that only the Berkeley DB driver will even compile. Please see *all* of the various README* files. In the next few days, I hope to take a look at the other drivers (bundled as examples) for portability, etc. Chris has included a PowerPoint summary of what he did to create a robust Erlang <-> Berkeley DB 4.5 driver. I've split that out from the tarball, for those who might be interested without wanting to download the entire tarball. To those gentle readers who have contributed bugfixes, etc. to me, it is quite possible that they are not present in this new RC tarball. If so, it's entirely my fault, and I owe you an apology. I'll do what I can to merge those things in, as long as my fingers cooperate. -Scott From datacompboy@REDACTED Mon Nov 13 06:41:37 2006 From: datacompboy@REDACTED (datacompboy) Date: Mon, 13 Nov 2006 05:41:37 +0000 Subject: [erlang-questions] Simple multi-case References: Message-ID: <20061113054137.A5A3F5A41B@mail.erlangsystems.com> >> Since there more than one call, but too small code to move it >> into separate fun. > There is no such thing as code that is too small to move into a separate function. separate function -- more chars to type, and code far from table itself. separate function is not a problem to speed of runtime, but that problem for development speed. I need at least create new function name, that must contain info about "what doing here", but not "how it doing that", since after some changes name will be wrong... Cascade CASEs better, than just copy code, and better than separate function for short results. As for now, its my decision:) But may be in future, parse transform. But far, future.... -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From bengt.kleberg@REDACTED Mon Nov 13 09:20:51 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 13 Nov 2006 09:20:51 +0100 Subject: [erlang-questions] trying to understand i/o threading (erl +A) In-Reply-To: References: Message-ID: <45582AE3.8030206@ericsson.com> On 2006-11-10 18:40, Count L?szl? de Alm?sy wrote: > Greetings, > > I'm attempting to understand the i/o threading option to erl better > (i.e, erl +A): > > +A size > Sets the number of threads in async thread pool, valid range is > 0-1024. Default is 0. > > Is there a metric one can use to gage how many threads I should start > for an application such as the Yaws webserver? My system has 1GB of ...deleted the ''Efficiency Guide'' says: ''If you have time critical code that is running too slow. Do not waste your time trying to guess what might be slowing it down. The best approach is to profile your code to find the bottlenecks and concentrate your efforts on optimizing them.'' in your case i would suggest measuring the performance of your application(s?) with increasing values for size, until the performance stops increasing. that might sound like hard work. as an alternative, i think i saw somewhere that _if_ your platform uses the async thread pool you could try setting size to one more than the number of processors on your system. in this day and age i could furthermore guess that processors could be replaced with number of cores. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From raimo+erlang-questions@REDACTED Mon Nov 13 09:16:13 2006 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 13 Nov 2006 09:16:13 +0100 Subject: [erlang-questions] Simple multi-case In-Reply-To: <20061113054137.A5A3F5A41B@mail.erlangsystems.com> References: <20061113054137.A5A3F5A41B@mail.erlangsystems.com> Message-ID: <20061113081613.GA27988@erix.ericsson.se> I'll try to elaborate on why multi-case is not a part or the Erlang language (yet). The general syntax would have to allow something like: case foo(Bar) of {ok,Result} | {error,{notfound,Reason}} -> %% Result and Reason can not both be bound here. {ok,Result,Reason}; %% Unsafe variable compile error! {error,einval=Reason} = Error -> Error; {error,Reason} -> {error,Reason} end, {done,Reason} %% Is Reason bound here? No - unsafe too. So, there would have to be a rule that any variable used in a multi-case-clause body would have to be bound in all multi-case-patterns (or of course before the case), which would be another rule as clumsy as the not to well known that if a variable is bound in all case clauses or case bodies it is bound after the case. It would be awkward at least for the compiler writer, and just as ugly as the export-from case rule that (many argue) should be removed but can not be. On Mon, Nov 13, 2006 at 05:41:37AM +0000, datacompboy wrote: > > >> Since there more than one call, but too small code to move it > >> into separate fun. > > > There is no such thing as code that is too small to move into a separate function. > > separate function -- more chars to type, and code far from table itself. > separate function is not a problem to speed of runtime, but that problem for development speed. I need at least create new function name, that must contain info about "what doing here", but not "how it doing that", since after some changes name will be wrong... > > Cascade CASEs better, than just copy code, and better than separate function for short results. As for now, its my decision:) > > But may be in future, parse transform. But far, future.... > -- > --- suicide proc near\n call death\n suicide endp > _________________________________________________________ > Post sent from http://www.trapexit.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From roger.larsson@REDACTED Mon Nov 13 09:48:32 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Mon, 13 Nov 2006 09:48:32 +0100 Subject: [erlang-questions] Simple multi-case In-Reply-To: <20061113054137.A5A3F5A41B@mail.erlangsystems.com> References: <20061113054137.A5A3F5A41B@mail.erlangsystems.com> Message-ID: <200611130948.32733.roger.larsson@norran.net> On Monday 13 November 2006 06:41, datacompboy wrote: > >> Since there more than one call, but too small code to move it > >> into separate fun. > > > > There is no such thing as code that is too small to move into a separate > > function. > > separate function -- more chars to type, and code far from table itself. > separate function is not a problem to speed of runtime, but that problem > for development speed. Most code is typed only once but read many times... There might be a reason why both functions needs to be run - why? Put the reason somewhere in the code. > I need at least create new function name, that must > contain info about "what doing here", but not "how it doing that", since > after some changes name will be wrong... Do you have a corporate policy that every functions needs to have full documentation? Then it might be the policy that is in error... doXZ()->doX(), doZ(). Might not be necessary to document with 20 lines of comments... > What about using funs? Light weight separate functions :-) -module(test). -export([doTest/1]). doX()->io:fwrite("X"). doY()->io:fwrite("Y"). doZ()->io:fwrite("Z"). doTest(Id)-> DoXZ = fun () -> doX(), doZ(), ok end, case Id of free -> DoXZ(); online -> DoXZ(); busy -> doY() end. /RogerL From ulf.wiger@REDACTED Mon Nov 13 10:12:13 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 13 Nov 2006 10:12:13 +0100 Subject: [erlang-questions] who won the obfuscated erlang competition? Message-ID: ... or did I miss the announcement at the EUC? /Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From datacompboy@REDACTED Mon Nov 13 10:43:58 2006 From: datacompboy@REDACTED (datacompboy) Date: Mon, 13 Nov 2006 09:43:58 +0000 Subject: [erlang-questions] gen_server concurrency References: Message-ID: <20061113094358.3E1905A41B@mail.erlangsystems.com> We lost concurrency, when use gen_server for store items in mnesia. Is that good? F.e., mnesia:write() can be run in parallel, if it will save data in several spread tables, but if we call gen_server:cast(logger, {log, Message}) we lost that case, and all writes will be run in sequence... May be there otp-way to work really in parallel? -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From nem@REDACTED Mon Nov 13 11:32:18 2006 From: nem@REDACTED (Geoff Cant) Date: Mon, 13 Nov 2006 11:32:18 +0100 Subject: [erlang-questions] Off Topic: Stockholm Erlangers Message-ID: Hi everyone, I really enjoyed meeting the Stockholm Erlang crowd at the EUC last week. I'm going to be in Stockholm for a little while longer so if anyone would like to meet up and talk Erlang, please give me a call (+46 73 664 44 36) or drop me an email. Cheers, -- Geoff Cant From luna@REDACTED Mon Nov 13 13:59:43 2006 From: luna@REDACTED (Daniel Luna) Date: Mon, 13 Nov 2006 13:59:43 +0100 (CET) Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> Message-ID: I've had similar problems when upgrading to 6.10. The problem went away after downgrading gcc to 4.0. gcc --version gcc-4.1 (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) # Don't worry it's just a symlink sudo rm /usr/bin/gcc sudo ln -s gcc-4.0 /usr/bin/gcc gcc --version gcc (GCC) 4.0.4 20060630 (prerelease) (Ubuntu 4.0.3-4) You may have to install gcc-4.0. Not sure whether it's part of the normal install. HTH /Luna On Thu, 9 Nov 2006, Tobias L?fgren wrote: > I don't think so, but honestly I can't remember if I tried it. So it > probably was, haha. > > I now have a stable environment based on 6.06 I'm actually using, so I don't > have any 6.10 environment to doublecheck it on anymore. > > Thanks anyway! > /tobias > > On 11/9/06, Cameron Kerr wrote: >> >> It's not something as simple as needing to do a 'sudo ldconfig' is it? >> On 6/11/2006, at 1:04 PM, Tobias L?fgren wrote: >> >> >> Just a heads up for anyone else who uses Ubuntu. Erlang seems to have >> trouble loading external libraries/driver on a Ubuntu 6.10 "Egdy Eft" >> system. >> >> I've just spent the better part of the weekend trying to figure out what >> was going wrong. First it seemed like a problem with Yaws, because erlang >> compiled fine and "worked". But yaws stopped with a "exec 1: setuid_drv.so >> :not found". >> >> After much reinstalling and experimenting with different versions I >> discovered that it was all dynamic loading of libraries that failed. For >> example "crypto:start()." in the erl shell crashed in a similar fashion. >> >> Maybe there is a simple solution to the problem, but at the moment it >> eludes me, so I've downgraded. The same packages and erlang-versions work >> perfectly fine in Ubuntu 6.06, so if you're using Ubuntu and Erlang, don't >> upgrade ubuntu yet. >> >> >> /tobias >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> -- >> Cameron Kerr ckerr@REDACTED >> Telecommunications Teaching Fellow & SysAdmin >> http://humbledown.org/blog/ 021 02 333 294* * >> >> >> >> > -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From rlenglet@REDACTED Mon Nov 13 14:46:03 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 13 Nov 2006 22:46:03 +0900 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> Message-ID: <200611132246.03382.rlenglet@users.forge.objectweb.org> Daniel Luna wrote: > I've had similar problems when upgrading to 6.10. The problem > went away after downgrading gcc to 4.0. > > gcc --version > gcc-4.1 (GCC) 4.1.2 20060928 (prerelease) (Ubuntu > 4.1.1-13ubuntu5) > > # Don't worry it's just a symlink > sudo rm /usr/bin/gcc > sudo ln -s gcc-4.0 /usr/bin/gcc You should NEVER modify package-managed directories and files by hand! Let's do it the right way. There are several cases. 1) If you have a problem with GCC 4.0 only when compiling Erlang, then you don't need to modify your system. In that case, as in any case, you can always specify the C compiler as an argument to ./configure scripts generated using GNU Autoconf: ./configure CC=/usr/bin/gcc-4.0 ... It can also be set in the environment: CC=/usr/bin/gcc-4.0 ./configure ... Cf. Autoconf's AC_PROG_CC macro, which is used also by Erlang/OTP. 2) You have problems with most of the software that you compile. Therefore, you want to make GCC 4.0 the default, instead of GCC 4.1. 2.1) In that case, either you use /usr/bin/cc instead of /usr/bin/gcc, and make profit from the fact that /usr/bin/cc is already an alternative: sudo update-alternatives --install \ /usr/bin/cc cc /usr/bin/gcc-4.0 100 sudo update-alternatives --set cc /usr/bin/gcc-4.0 And force ./configure to use /usr/bin/cc as the C compiler: ./configure CC=/usr/bin/cc 2.2) Or you can divert /usr/bin/gcc, and make it a new alternative: sudo dpkg-divert --divert /usr/bin/gcc-default \ --rename --add /usr/bin/gcc sudo update-alternatives --install \ /usr/bin/gcc gcc /usr/bin/gcc-4.0 100 sudo update-alternatives --set gcc /usr/bin/gcc-4.0 And then let ./configure detect and use /usr/bin/gcc. > gcc --version > gcc (GCC) 4.0.4 20060630 (prerelease) (Ubuntu 4.0.3-4) > > > You may have to install gcc-4.0. Not sure whether it's part of > the normal install. > > HTH > > /Luna -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From luna@REDACTED Mon Nov 13 15:23:01 2006 From: luna@REDACTED (Daniel Luna) Date: Mon, 13 Nov 2006 15:23:01 +0100 (CET) Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: <200611132246.03382.rlenglet@users.forge.objectweb.org> References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> <200611132246.03382.rlenglet@users.forge.objectweb.org> Message-ID: On Mon, 13 Nov 2006, Romain Lenglet wrote: > Daniel Luna wrote: >> I've had similar problems when upgrading to 6.10. The problem >> went away after downgrading gcc to 4.0. >> >> gcc --version >> gcc-4.1 (GCC) 4.1.2 20060928 (prerelease) (Ubuntu >> 4.1.1-13ubuntu5) >> >> # Don't worry it's just a symlink >> sudo rm /usr/bin/gcc >> sudo ln -s gcc-4.0 /usr/bin/gcc > > You should NEVER modify package-managed directories and files by > hand! [SNIP] > 2.2) Or you can divert /usr/bin/gcc, and make it a new > alternative: > > sudo dpkg-divert --divert /usr/bin/gcc-default \ > --rename --add /usr/bin/gcc > > sudo update-alternatives --install \ > /usr/bin/gcc gcc /usr/bin/gcc-4.0 100 > > sudo update-alternatives --set gcc /usr/bin/gcc-4.0 > > And then let ./configure detect and use /usr/bin/gcc. Thanks! This is exactly what I wanted. Unfortunately I still have to do something by hand: > sudo update-alternatives --config gcc There is only 1 program which provides gcc (/usr/bin/gcc-4.1). Nothing to configure. So I still need to tell Ubuntu that gcc-4.0 is gcc... :-( /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From sean.hinde@REDACTED Mon Nov 13 15:38:56 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 13 Nov 2006 14:38:56 +0000 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <5c402a550611090818s6d8b7f25ved2896817eb35498@mail.gmail.com> <200611132246.03382.rlenglet@users.forge.objectweb.org> Message-ID: On 13 Nov 2006, at 14:23, Daniel Luna wrote: > So I still need to tell Ubuntu that gcc-4.0 is gcc... :-( I seem to recall there is a program 'gcc-select' which does this in a slick way. Sean From rlenglet@REDACTED Mon Nov 13 15:41:05 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 13 Nov 2006 23:41:05 +0900 Subject: [erlang-questions] Erlang doesn't like ubuntu 6.10 In-Reply-To: References: <5c402a550611051604s60e46c34r932daf6cda7018b9@mail.gmail.com> <200611132246.03382.rlenglet@users.forge.objectweb.org> Message-ID: <200611132341.05425.rlenglet@users.forge.objectweb.org> Daniel Luna wrote: > On Mon, 13 Nov 2006, Romain Lenglet wrote: > > 2.2) Or you can divert /usr/bin/gcc, and make it a new > > alternative: > > > > sudo dpkg-divert --divert /usr/bin/gcc-default \ > > --rename --add /usr/bin/gcc > > > > sudo update-alternatives --install \ > > /usr/bin/gcc gcc /usr/bin/gcc-4.0 100 > > > > sudo update-alternatives --set gcc /usr/bin/gcc-4.0 > > > > And then let ./configure detect and use /usr/bin/gcc. [...] > Unfortunately I still have to do something by hand: > > sudo update-alternatives --config gcc > > There is only 1 program which provides gcc > (/usr/bin/gcc-4.1). Nothing to configure. > > So I still need to tell Ubuntu that gcc-4.0 is gcc... :-( No! The message: > There is only 1 program which provides gcc > (/usr/bin/gcc-4.1). Nothing to configure. only means that for the gcc alternative, you have only one choice (/usr/bin/gcc-4.0), and therefore /usr/bin/gcc-4.0 is selected/linked by default. Since you have no choice, you have "Nothing to configure". You can check that the alternative link is actually correctly created: ls -l /usr/bin/gcc ls -l /etc/alternatives/gcc If you had several choices for that alternative, then you must execute: sudo update-alternatives --config gcc and select /usr/bin/gcc-4.0 by hand, or instead execute directly: sudo update-alternatives --set gcc /usr/bin/gcc-4.0 which should have the same effect. Regards, -- Romain LENGLET From xpdoka@REDACTED Mon Nov 13 17:45:01 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Mon, 13 Nov 2006 17:45:01 +0100 (CET) Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive In-Reply-To: References: <4552D8F3.4070001@duomark.com> <455342FF.4030205@duomark.com> Message-ID: <29835.83.199.118.145.1163436301.squirrel@www.geekisp.com> Jay Nelson wrote: > As a result of the briefing I added a suggested language > change to introduce a control message queue which is > separate from the existing data message queue. It seems to me that your suggestion introduces a new syntax without providing new semantics. Using send and selective receive it is already possible, semantically, to have messages of different priorities. Christian S wrote: > Is the goal mainly increased efficiency [...]? It's a bit more than just increased efficiency. As Pascal Brisset pointed out last year (*), the current implementation of selective receive can cause the system to become suddenly overloaded and throughput to dwindle to almost nothing. Instead of adding new syntax can't the implementation be improved? That way, the language stays simpler and all existing code benefits from the improvement. Regarding implementation, Jay wrote: > It is possible to arrange this in your scenario, but you > wouldn't want to adopt an approach that makes the > bookkeeping required to manage the semantics to be too > involved. Right now message receive is simple and fast to > perform, therefore it is highly reliable. > > It only becomes slow when you combine selective receive > with a very long message queue. This can happen when > there are multiple requesters filling the queue, or the > server handling requests has a lot to do for a single > request. You're using the phrase "highly reliable" in a way that I am not familiar with. It seems to me that an implementation that is slightly less efficient in normal conditions but is well-behaved (i.e. slows down linearly) under stress would be preferable. (*) http://www.erlang.org/ml-archive/erlang-questions/200511/msg00154.html Regards, Dominic Williams http://www.dominicwilliams.net ---- From joseerlang@REDACTED Mon Nov 13 18:00:03 2006 From: joseerlang@REDACTED (Jose Antonio) Date: Mon, 13 Nov 2006 18:00:03 +0100 Subject: [erlang-questions] [erlang-question] Problem with erlsoap-0.3 Message-ID: <4558A493.3050007@gmail.com> I am trying to run erlsoap-0.3 but I have problems with module application. #erl -erlsoap ../config/httpd.conf Erlang (BEAM) emulator version 5.4.9 [source] [hipe] Eshell V5.4.9 (abort with ^G) 1> application:start(inets). ok 2> application:start(erlsoap). =INFO REPORT==== 13-Nov-2006::17:49:59 === application: erlsoap exited: "invalid return value from mod_soap:start(normal,config) -> {'EXIT', {undef, [{config, read_from_file, [\"erlsoap.conf\"]}, {mod_soap,s tart,2},\n {application_master,start_it_old,4}]}}" type: temporary {error,"invalid return value from mod_soap:start(normal,config) -> {'EXIT',\n {undef,\n [{config,\n read_from_file,\n [\"erlsoap.conf\"]},\n {mod_soap,start, 2},\n {application_master,start_it_old,4}]}}"} 3> application:get_env(erlsoap,inets_conf). {ok,"/home/jgarcia/Bajadas/erlsoap-0.3/config/httpd.conf"} Configuration File (httpd.conf): Port 8888 ServerName localhost SocketType ip_comm Modules mod_alias mod_auth mod_esi mod_actions mod_cgi mod_include mod_dir mod_get mod_head mod_log mod_disk_log mod_soap DefaultType text/plain Any idea? Regards From chris.newcombe@REDACTED Mon Nov 13 19:11:06 2006 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Mon, 13 Nov 2006 10:11:06 -0800 Subject: [erlang-questions] Announce: EDTK version 1.5 candidate 1 In-Reply-To: <200611130359.kAD3xXwg059886@snookles.snookles.com> References: <200611130359.kAD3xXwg059886@snookles.snookles.com> Message-ID: <781dd98c0611131011p2b4e72cdg368008a9cfdffc9f@mail.gmail.com> I'll be releasing a second EDTK 1.5 candidate later today, with some config improvements and better docs on building/patching the required version of BDB. > Chris has included a PowerPoint summary of what he did to create a > robust Erlang <-> Berkeley DB 4.5 driver. The powerpoint is a little old, but I included it as it has some useful context & rationale. There is a lot of detail in the README-cnewcom file. If you want to send bug-reports/suggestions without cluttering up the mailing-list, it's probably fastest (and easier on Scott's hands) if you email me directly, or at least cc me if you email Scott. Chris On 11/12/06, Scott Lystig Fritchie wrote: > Greetings. Thanks to an awful lot of hard work by Chris Newcombe, I > am pleased to announce a release candidate, #1, of version 1.5 of > EDTK, the Erlang Driver ToolKit. > > http://www.snookles.com/erlang/edtk/ > > I confess I haven't looked at it much, between house repair projects > and $#^&$#!^%! problems with RSI. It is possible that only the > Berkeley DB driver will even compile. Please see *all* of the various > README* files. In the next few days, I hope to take a look at the > other drivers (bundled as examples) for portability, etc. > > Chris has included a PowerPoint summary of what he did to create a > robust Erlang <-> Berkeley DB 4.5 driver. I've split that out from > the tarball, for those who might be interested without wanting to > download the entire tarball. > > To those gentle readers who have contributed bugfixes, etc. to me, it > is quite possible that they are not present in this new RC tarball. > If so, it's entirely my fault, and I owe you an apology. I'll do what > I can to merge those things in, as long as my fingers cooperate. > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From tobbe@REDACTED Mon Nov 13 21:06:34 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 13 Nov 2006 21:06:34 +0100 Subject: [erlang-questions] [erlang-question] Problem with erlsoap-0.3 In-Reply-To: <4558A493.3050007@gmail.com> References: <4558A493.3050007@gmail.com> Message-ID: <4558D04A.9000805@tornkvist.org> Not sure if this will solve your problem, but you can find a newer version of erlsoap here: http://forum.trapexit.org/viewtopic.php?t=6331 I think it could be a good idea to setup an erlsoap repository, e.g at google (or at least put it in jungerl ?). If we can get Erik Reitsmas blessing I could fix this. Opinions anyone ? Erik (if you read this) what do you think ? --Tobbe Jose Antonio skrev: > I am trying to run erlsoap-0.3 but I have problems with module application. > #erl -erlsoap ../config/httpd.conf > Erlang (BEAM) emulator version 5.4.9 [source] [hipe] > > Eshell V5.4.9 (abort with ^G) > 1> application:start(inets). > ok > 2> application:start(erlsoap). > > =INFO REPORT==== 13-Nov-2006::17:49:59 === > application: erlsoap > exited: "invalid return value from mod_soap:start(normal,config) -> > {'EXIT', > {undef, > [{config, > read_from_file, [\"erlsoap.conf\"]}, > {mod_soap,s > tart,2},\n > {application_master,start_it_old,4}]}}" > > type: temporary > {error,"invalid return value from mod_soap:start(normal,config) -> > {'EXIT',\n > {undef,\n > [{config,\n > read_from_file,\n > [\"erlsoap.conf\"]},\n > {mod_soap,start, > 2},\n > {application_master,start_it_old,4}]}}"} > 3> application:get_env(erlsoap,inets_conf). > {ok,"/home/jgarcia/Bajadas/erlsoap-0.3/config/httpd.conf"} > > Configuration File (httpd.conf): > Port 8888 > ServerName localhost > SocketType ip_comm > Modules mod_alias mod_auth mod_esi mod_actions mod_cgi mod_include > mod_dir mod_get mod_head mod_log mod_disk_log mod_soap > DefaultType text/plain > > Any idea? > Regards > From olgeni@REDACTED Mon Nov 13 21:22:57 2006 From: olgeni@REDACTED (Jimmy Olgeni) Date: Mon, 13 Nov 2006 21:22:57 +0100 (CET) Subject: [erlang-questions] Orber and NAT Message-ID: <20061113212118.P22538@olgeni.olgeni> Hello, Is there a way to make a Corba object visible _both_ on the local network and across NAT? Using the NAT flag in Orber seems to cut the local network out... Or is it a job for add_alternate_iiop_address? bye, jimmy From Martin.Logan@REDACTED Mon Nov 13 21:36:16 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Mon, 13 Nov 2006 14:36:16 -0600 Subject: [erlang-questions] gen_server concurrency In-Reply-To: <20061113094358.3E1905A41B@mail.erlangsystems.com> Message-ID: <26AB42AB6A76E2419D26E66ECF1538462CF7D8@chiresexc02.resource.corp.lcl> I am not sure if I understand you. Gen_server is just a process like any other. One call to start_link will produce exactly one process. If you want concurrency use more than one process, whether that process is a gen_server or not makes no difference. Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of datacompboy Sent: Monday, November 13, 2006 3:44 AM To: erlang-questions@REDACTED Subject: [erlang-questions] gen_server concurrency We lost concurrency, when use gen_server for store items in mnesia. Is that good? F.e., mnesia:write() can be run in parallel, if it will save data in several spread tables, but if we call gen_server:cast(logger, {log, Message}) we lost that case, and all writes will be run in sequence... May be there otp-way to work really in parallel? -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Mon Nov 13 21:57:36 2006 From: erlang@REDACTED (Peter Lund) Date: Mon, 13 Nov 2006 14:57:36 -0600 Subject: [erlang-questions] : Simple multi-case In-Reply-To: <20061110125216.GA24341@erix.ericsson.se> References: <20061110105915.A455E5A1F8@mail.erlangsystems.com> <20061110125216.GA24341@erix.ericsson.se> Message-ID: <4558DC40.5060402@lundata.se> or case getstatus(Id) of X when X==free; X==online -> doX(); busy -> doY() end, Raimo Niskanen skrev: > Or nest them: > case case getstatus(Id) of > free -> x; > online -> x; > busy -> y > end of > x -> doX(); > y -> doY(); > end. > > On Fri, Nov 10, 2006 at 01:21:39PM +0100, Christian S wrote: > >>> For now that possible only as >>> case getstatus(Id) of >>> S when (S==free) orelse (S==online) -> doX(), doZ(), ok; >>> busy -> doY() >>> end >>> >> Do = >> case getstatus(Id) of >> free -> x; >> online -> x; >> busy -> y >> end, >> >> case Do of >> x -> doX(); >> y -> doY(); >> end. >> >> Not less typing, but perhaps a more table-like overview of what to do >> and thus more readable code. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > From Martin.Logan@REDACTED Mon Nov 13 22:00:04 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Mon, 13 Nov 2006 15:00:04 -0600 Subject: [erlang-questions] gen_server concurrency In-Reply-To: <26AB42AB6A76E2419D26E66ECF1538462CF7D8@chiresexc02.resource.corp.lcl> Message-ID: <26AB42AB6A76E2419D26E66ECF1538462CF7D9@chiresexc02.resource.corp.lcl> To clarify my poorly worded last sentence: One call to start_link will produce exactly one process. If you want concurrency use more than one process, whether those processes are gen_server's or not makes no difference. -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Logan, Martin Sent: Monday, November 13, 2006 2:36 PM To: erlang-questions@REDACTED Subject: Re: [erlang-questions] gen_server concurrency I am not sure if I understand you. Gen_server is just a process like any other. One call to start_link will produce exactly one process. If you want concurrency use more than one process, whether that process is a gen_server or not makes no difference. Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of datacompboy Sent: Monday, November 13, 2006 3:44 AM To: erlang-questions@REDACTED Subject: [erlang-questions] gen_server concurrency We lost concurrency, when use gen_server for store items in mnesia. Is that good? F.e., mnesia:write() can be run in parallel, if it will save data in several spread tables, but if we call gen_server:cast(logger, {log, Message}) we lost that case, and all writes will be run in sequence... May be there otp-way to work really in parallel? -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Tue Nov 14 00:22:18 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 14 Nov 2006 12:22:18 +1300 (NZDT) Subject: [erlang-questions] Simple multi-case Message-ID: <200611132322.kADNMIck260121@atlas.otago.ac.nz> I wrote: There is no such thing as code that is too small to move into a separate function. "datacompboy" replied: separate function -- more chars to type, and code far from table itself. More characters to type? (a) If it makes the code clearer, what the heck does THAT matter? (b) You can probably use machine aid. For example, it should be a small matter to program Emacs or an Emacs-like editor (such as Alpha) so as to add an "extract function" command. Select the expression you want to be the body, type some chord, and presto chango, there's a function. (This kind of thing is apparently routine in Eclipse thse days.) (c) If the body of the function is so small that this is a problem, then it won't hurt to type it twice in the case expression; if it's big enough to be annoying to write twice in the case expression, you'll probably type *less* by making it a function. (d) Give a specific example and then we can discuss the issue without wandering off into generalities. Code far from the table itself? (e) Certainly not! Common_Case = fun () -> .... end, case Whatever of foo -> Common_Case() ; bar -> Common_Case() ; ugh -> uncommon_case() end Apparently the Erlang compiler *doesn't* inline a local function like this, but it *could*, and arguably it should. The main point is that the function *doesn't* have to be far from the case. separate function is not a problem to speed of runtime, but that problem for development speed. I need at least create new function name, that must contain info about "what doing here", but not "how it doing that", since after some changes name will be wrong... So? Cascade CASEs better, than just copy code, and better than separate function for short results. As for now, its my decision:) Let me make another suggestion. The difficulty you are encountering is a typical "code smell", of the kind that should suggest a refactoring. What kind of refactoring? In this case: a DATA refactoring. Suppose you have type t() -> fee | fie | foe | fum and you find yourself wanting to write case X of fee | fie -> boo() ; foe | fum -> jum() end Is this just an exceptional case? If so, put up with writing the case bodies twice. If it's *not* an exceptional case; if you think you are likely to need this again, that's a sign that you should have type t() -> {bee,(fee|fie)} | {fly,(foe|fum)} and the case expression should be case X of {bee,_} -> boo() ; {fly,_} -> jum() end As I said above, let's see a real example. From calmasy@REDACTED Tue Nov 14 03:48:38 2006 From: calmasy@REDACTED (=?ISO-8859-1?Q?Count_L=E1szl=F3_de_Alm=E1sy?=) Date: Mon, 13 Nov 2006 19:48:38 -0700 Subject: [erlang-questions] trying to understand i/o threading (erl +A) In-Reply-To: <45582AE3.8030206@ericsson.com> References: <45582AE3.8030206@ericsson.com> Message-ID: On 11/13/06, Bengt Kleberg wrote: > in your case i would suggest measuring the performance of your > application(s?) with increasing values for size, until the performance > stops increasing. I was hoping for a better understanding of +A as opposed to just using trial and error for every application. > that might sound like hard work. as an alternative, i think i saw > somewhere that _if_ your platform uses the async thread pool you could > try setting size to one more than the number of processors on your > system. in this day and age i could furthermore guess that processors > could be replaced with number of cores. In other words, no one else knows the answer to my question either. -- Cheers, L?szl? From jay@REDACTED Tue Nov 14 04:49:01 2006 From: jay@REDACTED (Jay Nelson) Date: Mon, 13 Nov 2006 19:49:01 -0800 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive Message-ID: <45593CAD.9060100@duomark.com> > It seems to me that your suggestion introduces a new syntax > without providing new semantics. Using send and selective > receive it is already possible, semantically, to have > messages of different priorities. Yes, you are right, I see that now. I also see that I didn't handle priority properly. It requires nested receives: receive -> {priority_msg, Data1} -> priority(Data1) after 0 -> receive {normal_msg, Data2} -> normal(Data2) after 0 -> none end end. This pattern applies in the current syntax and in the syntax I proposed. The problem is you end up polling because you can't wait inside either of the nested receive clauses. Control protocols such as pause and resume can also be implemented using selective receive. > Instead of adding new syntax can't the implementation be > improved? That way, the language stays simpler and all > existing code benefits from the improvement. You are absolutely right. The syntax I proposed adds nothing over selective receive. There might be an alternate syntax that improves things, but the behavior of receive under load is the real problem. The problem is that the default behavior of selective receive is to check the first message against all clauses, then the second message, so that it becomes convoluted to nest the cases. > You're using the phrase "highly reliable" in a way that I am > not familiar with. I intended to mean that the implementation inside the VM of the receive statement is simple -- just a list -- and therefore is easy to verify. If it were more complex it would be harder to verify and debug, therefore more likely to contain obscure errors. On reflection, the complexity of the receive implementation is less a concern than the difficulty for users to implement a protocol properly and efficiently. Based on the behavioral problems that Pascal pointed out, a more complex implementation which exhibits better behavior would be of greatest benefit to the user community. jay From pupeno@REDACTED Tue Nov 14 05:44:51 2006 From: pupeno@REDACTED (Pupeno) Date: Tue, 14 Nov 2006 04:44:51 +0000 Subject: [erlang-questions] Erlang and autoconf/make Message-ID: <200611140444.54467.pupeno@pupeno.com> Hello, I am slowly trying to turn my SCons[1]-based projects into autoconf/make-based projects. In a sense it is a step backwards, but if choosing a more mainstream building system makes my lib easier to use better (and I'll have to maintain one less application, that is, I won't have to maintain SConsErlang). I am open to any suggestion about something that I might be doing wrong or not totally right. This is my configure.in http://software.pupeno.com/Serlvers/configure.in it is really small, and this is the main Makefile.am http://software.pupeno.com/Serlvers/src/Makefile.am And in that last one is where I am worried. I have to list the sources and the beam files, is that needed ? I have to also put the .app among the (automatically generated) beam files, is that needed as well ? I mean, isn't there a better way ? Something closer to what I've done with SCons[2] ? Thank you. -- Pupeno (http://pupeno.com) [1] http://pupeno.com/software/scons-erlang [2] http://software.pupeno.com/Serlvers/SConstruct, lines 22-27 and 36-38 PS: Congratulations to those that made possible such a successful event last week! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlenglet@REDACTED Tue Nov 14 06:54:31 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 14 Nov 2006 14:54:31 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611140444.54467.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> Message-ID: <200611141454.32021.rlenglet@users.forge.objectweb.org> Hi, Pupeno wrote: > Hello, > I am slowly trying to turn my SCons[1]-based projects into > autoconf/make-based projects. In a sense it is a step > backwards, but if choosing a more mainstream building system > makes my lib easier to use better (and I'll have to maintain > one less application, that is, I won't have to maintain > SConsErlang). > I am open to any suggestion about something that I might be > doing wrong or not totally right. This is my configure.in > http://software.pupeno.com/Serlvers/configure.in > it is really small, And you can make it smaller! I believe that you reused the configure.ac from gtknode, which is good, but you don't need as much as in gtknode. For instance, you don't need to check for erl_interface, since you don't have C code here. (?) Therefore, your configure.ac can be reduced to: AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED, serlvers) AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez) dnl Require autoconf version >=2.59c. first one with erlang macros AC_PREREQ(2.59c) dnl Require automake version >=1.9.5. AM_INIT_AUTOMAKE(1.9.5) AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT Oh, and please call your file configure.ac instead of configure.in. This has been the new convention for a while. Since we require Autoconf version >= 2.59c, we are sure that the Autoconf that will be used supports that convention. > and this is the main Makefile.am > http://software.pupeno.com/Serlvers/src/Makefile.am > And in that last one is where I am worried. I have to list the > sources and the beam files, is that needed ? I have to also > put the .app among the (automatically generated) beam files, > is that needed as well ? I mean, isn't there a better way ? If your .app file is not generated, and is therefore a "source file", then it must be explicitly included in the distributed files (EXTRA_DIST), like the .erl files, and it must *not* be included in the files to clean (CLEANFILES). However, since your .app file must be installed in a directory different from .../src/, you can't add your .app files into the erlsrc_DATA variable, so you must define new erlapp* variables: erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/src erlsrc_DATA = dns_msg.erl gen_chargen.erl gen_daytime.erl gen_dns.erl gen_echo.erl gen_time.erl launcher.erl EXTRA_DIST = $(erlsrc_DATA) erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/ebin erlbeam_DATA = dns_msg.beam gen_chargen.beam gen_daytime.beam gen_dns.beam gen_echo.beam gen_time.beam launcher.beam CLEANFILES = $(erlbeam_DATA) erlappdir = $(erlbeamdir) erlapp_DATA = serlvers.app EXTRA_DIST += $(erlapp_DATA) SUFFIXES = .erl .beam .erl.beam: $(ERLC) $(ERLCFLAGS) -b beam $< And likewise, you should define a series of variables for every other kind of source or generated files (.rel, etc.) if you have any. Now, your files are nice and clean! (^_^) > Something closer to what I've done with SCons[2] ? Thank you. Sorry, I don't know much about SCons. But the files above seem to do the same as yours. Hopefully, Ruslan Babayev may add support for Erlang in Automake, to help writing Makefile.am files. Until then, we will have to explicitly write separate sets of variables for different kinds of files, in Makefile.am files, as shown above. Regards, -- Romain LENGLET -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From roger.larsson@REDACTED Tue Nov 14 07:24:10 2006 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 14 Nov 2006 07:24:10 +0100 Subject: [erlang-questions] EUC 2006 / proposal to enhance message receive In-Reply-To: <45593CAD.9060100@duomark.com> References: <45593CAD.9060100@duomark.com> Message-ID: <200611140724.10553.roger.larsson@norran.net> On Tuesday 14 November 2006 04:49, Jay Nelson wrote: > > It seems to me that your suggestion introduces a new syntax > > without providing new semantics. Using send and selective > > receive it is already possible, semantically, to have > > messages of different priorities. > > Yes, you are right, I see that now. I also see that I didn't handle > priority properly. It requires nested receives: > > receive -> > {priority_msg, Data1} -> priority(Data1) > after > 0 -> > receive > {normal_msg, Data2} -> normal(Data2) > after > 0 -> none > end > end. > > This pattern applies in the current syntax and in the syntax I proposed. > The problem is you end up polling because you can't wait inside either > of the nested receive clauses. > And a waiting version... receive -> {priority_msg, Data1} -> priority(Data1) after 0 -> receive {priority_msg, Data1} -> priority(Data1) {normal_msg, Data2} -> normal(Data2) end end. I earlier proposed a slight syntax change, to avoid the repeated line. But should expand to the equivalent of the code above (with double receives). [ie letting the after choice be a part of the guard] receive -> {priority_msg, Data1} -> priority(Data1) {normal_msg, Data2} after 0 -> normal(Data2) end. /RogerL From erik.reitsma@REDACTED Tue Nov 14 08:58:03 2006 From: erik.reitsma@REDACTED (Erik Reitsma (RY/ETM)) Date: Tue, 14 Nov 2006 08:58:03 +0100 Subject: [erlang-questions] [erlang-question] Problem with erlsoap-0.3 In-Reply-To: <4558D04A.9000805@tornkvist.org> Message-ID: <110BA8ACEE682C479D0B008B6BE4AEB1034E2B1E@esealmw107.eemea.ericsson.se> Hi Tobbe (& others), I have not used or even seen erlsoap for quite some time. I do not have plans with it now (although I may need a SOAP interface in the future, who knows...). Tobbe wrote: > Not sure if this will solve your problem, but you can find a > newer version of erlsoap here: > > http://forum.trapexit.org/viewtopic.php?t=6331 > > I think it could be a good idea to setup an erlsoap > repository, e.g at google (or at least put it in jungerl ?). > If we can get Erik Reitsmas blessing I could fix this. You have my blessing to put erlsoap (my version or an updated version) on jungerl or google. Hopefully I will be able to benefit from the improvements and perhaps someday I will return to the world of SOAP and WSDL. > Opinions anyone ? I think I have brought erlsoap as far as I needed it to be at the time. Since then there are some new libraries (erlsom), which would make things easier. I am sure a lot can be (or has been) improved, and anyone willing and able to make those improvements is welcome to do so. > Erik (if you read this) what do you think ? Yes, I am still here, using Erlang on a daily basis, even though I have not been at the EUC for some years... *Erik. From bjorn@REDACTED Tue Nov 14 09:53:34 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Nov 2006 09:53:34 +0100 Subject: [erlang-questions] trying to understand i/o threading (erl +A) In-Reply-To: References: <45582AE3.8030206@ericsson.com> Message-ID: Using +A option can only speed up file I/O. It is typically used in embedded system where you don't have any local file system, only NFS file systems. You are unlikely to gain anything in other configurations. /Bjorn "Count L?szl? de Alm?sy" writes: > On 11/13/06, Bengt Kleberg wrote: > > in your case i would suggest measuring the performance of your > > application(s?) with increasing values for size, until the performance > > stops increasing. > > I was hoping for a better understanding of +A as opposed to just using > trial and error for every application. > > > that might sound like hard work. as an alternative, i think i saw > > somewhere that _if_ your platform uses the async thread pool you could > > try setting size to one more than the number of processors on your > > system. in this day and age i could furthermore guess that processors > > could be replaced with number of cores. > > In other words, no one else knows the answer to my question either. > > -- > Cheers, L?szl? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From datacompboy@REDACTED Tue Nov 14 10:21:23 2006 From: datacompboy@REDACTED (datacompboy) Date: Tue, 14 Nov 2006 09:21:23 +0000 Subject: [erlang-questions] Simple multi-case References: Message-ID: <20061114092123.7E5735A1F9@mail.erlangsystems.com> Guest wrote: and the case expression should be case X of {bee,_} -> boo() ; {fly,_} -> jum() end (end of quote) hmmm... I think, that also good idea. But not return {bee, X} / {fly, X} but have fun that map X to bee/fly. then, case getType(X) of bee -> boo(); fly -> jum() end -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From dmitrii@REDACTED Tue Nov 14 11:10:09 2006 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Tue, 14 Nov 2006 12:10:09 +0200 Subject: [erlang-questions] [erlang-question] Problem with erlsoap-0.3 In-Reply-To: <110BA8ACEE682C479D0B008B6BE4AEB1034E2B1E@esealmw107.eemea.ericsson.se> References: <4558D04A.9000805@tornkvist.org> <110BA8ACEE682C479D0B008B6BE4AEB1034E2B1E@esealmw107.eemea.ericsson.se> Message-ID: Erlsoap has been upgraded to version 0.4.3 See http://forum.trapexit.org/viewtopic.php?t=6331 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Nov 14 11:38:01 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 14 Nov 2006 11:38:01 +0100 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611140444.54467.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> Message-ID: <45599C89.4060104@ericsson.com> On 2006-11-14 05:44, Pupeno wrote: > Hello, > I am slowly trying to turn my SCons[1]-based projects into autoconf/make-based > projects. In a sense it is a step backwards, but if choosing a more > mainstream building system makes my lib easier to use ...deleted have you also considered turning the erlang based projects over to java? : -) bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From ulf.wiger@REDACTED Tue Nov 14 11:53:21 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Tue, 14 Nov 2006 11:53:21 +0100 Subject: [erlang-questions] trying to understand i/o threading (erl +A) In-Reply-To: Message-ID: In my experience, you will gain lots with +A even when you have a local file system, e.g. if you have applications that to tons of disk I/O. When playing around with Mnesia, I've encountered situations where the shell became unresponsive, while mnesia was busy dumping large amounts of data to disk. Another symptom was that CPU load went down dramatically and the VM just seemed to be constantly waiting. Re-running the experiments with +A made a world of difference. /Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of > Bjorn Gustavsson > Sent: den 14 november 2006 09:54 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] trying to understand i/o > threading (erl +A) > > Using +A option can only speed up file I/O. It is typically > used in embedded system where you don't have any local file > system, only NFS file systems. > You are unlikely to gain anything in other configurations. > > /Bjorn > > "Count L?szl? de Alm?sy" writes: > > > On 11/13/06, Bengt Kleberg wrote: > > > in your case i would suggest measuring the performance of your > > > application(s?) with increasing values for size, until the > > > performance stops increasing. > > > > I was hoping for a better understanding of +A as opposed to > just using > > trial and error for every application. > > > > > that might sound like hard work. as an alternative, i think i saw > > > somewhere that _if_ your platform uses the async thread pool you > > > could try setting size to one more than the number of > processors on > > > your system. in this day and age i could furthermore guess that > > > processors could be replaced with number of cores. > > > > In other words, no one else knows the answer to my question either. > > > > -- > > Cheers, L?szl? > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Tue Nov 14 11:45:59 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 14 Nov 2006 11:45:59 +0100 Subject: [erlang-questions] documentation error in zip:list_dir() ? Message-ID: <45599E67.1040605@ericsson.com> greetings i think there is an error in the documentation of zip:list_dir( ). it says: ''The result value is the tuple {ok, List}, where List contains the zip archive comment as the first element. The rest is tuples: {filename(), fileinfo(), CompSize, Comment}, where CompSize is the compressed size of the file in the archive and Comment is the files comment.'' and this is what i get: zip:list_dir( "a.zip"). {ok,[{zip_comment,[]}, {zip_file,"afile", {file_info,16878, regular, read_write, {{2006,11,13},{18,59,15}}, {{2006,11,13},{18,59,15}}, {{2006,11,13},{18,59,15}}, 54, 1, 0, 0, 0, 0, 0}, [], 0, 6843}]} bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From mats.cronqvist@REDACTED Tue Nov 14 13:21:18 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 14 Nov 2006 13:21:18 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <4557AAB8.7060303@telia.com> References: <20061107140252.64565.qmail@web38804.mail.mud.yahoo.com> <59701.88.131.23.130.1163013575.squirrel@www.geekisp.com> <45528E10.8050208@telia.com> <20061109074115.GA22368@lambdastream.com> <45551C53.6030003@telia.com> <4557AAB8.7060303@telia.com> Message-ID: <4559B4BE.3020301@ericsson.com> Robert Virding wrote: > What I was protesting against was the dogmatic :-) view that all library > functions should always generate exceptions. Which is as wrong as saying that > never should. a little dogmatism never killed anyone... well i guess it did actually. so maybe i should de-dogmatize a little; the OTP libraries (and most other code too) rely entirely too much on tagged tuples, and should throw much more often. e.g. file:open/2, which as far as i can tell, never throws. file:open(blurg,rad) -> {error,einval} the question of when to throw and when to return {error,R} can of course be discussed ad infinitum(*). Robert Virding also wrote (about functions that always throws): > To [differentiate between different types of error/exceptions] I have to keep > track of the error reasons so I can differentiate between them and get the > right handling. N.B. this has to be done in both directions. It is worse for > the documentation as I have to document ALL the different error values to be > able to do this separation. well, often you do want to keep track of the error reasons. perhaps the function author doesn't have the same opinion as you about what is "exceptional". in any case, i fully expect the author of a library function to "document ALL the different error values". seems you are suggesting that this is optional if you're returning {error,R}, but mandatory if you're throwing R. mats (*) for file:open/2 in particular, i see no reason for it to do anything but throw or return the fd. if the file should be there, that's what you want; if you don't know if the file exists/is readable, you should call read_file_info/1 first. x([File|Fs],Fun,Acc) -> case file:read_file_info(File) of {ok,#file_info{access=read}} -> x(Fs,Fun,[Fun(file:open(File,[read]))|Acc]); _ -> x(Fs,Fun,Acc) end. file:read_file_info/1 btw should (imo) never throw :> to whom it may concern; i know this is not proper erlang code. it's blub, so give it a rest. From pupeno@REDACTED Tue Nov 14 15:06:48 2006 From: pupeno@REDACTED (Pupeno) Date: Tue, 14 Nov 2006 14:06:48 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <45599C89.4060104@ericsson.com> References: <200611140444.54467.pupeno@pupeno.com> <45599C89.4060104@ericsson.com> Message-ID: <200611141406.51931.pupeno@pupeno.com> On Tuesday 14 November 2006 10:38, Bengt Kleberg wrote: > On 2006-11-14 05:44, Pupeno wrote: > > Hello, > > I am slowly trying to turn my SCons[1]-based projects into > > autoconf/make-based projects. In a sense it is a step backwards, but if > > choosing a more mainstream building system makes my lib easier to use > > ...deleted > > have you also considered turning the erlang based projects over to java? > > : -) No, there's a limit that's wap before that. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From pupeno@REDACTED Tue Nov 14 15:24:21 2006 From: pupeno@REDACTED (Pupeno) Date: Tue, 14 Nov 2006 14:24:21 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611141454.32021.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611141454.32021.rlenglet@users.forge.objectweb.org> Message-ID: <200611141424.22466.pupeno@pupeno.com> On Tuesday 14 November 2006 05:54, Romain Lenglet wrote: > I believe that you reused the configure.ac from gtknode, That's where I copied it from. > you don't need to check for erl_interface, since you don't have > C code here. (?) Yes, it is commented out. > Therefore, your configure.ac can be reduced to: > > AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED, > serlvers) > AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez) > > dnl Require autoconf version >=2.59c. first one with erlang > macros > AC_PREREQ(2.59c) > dnl Require automake version >=1.9.5. > AM_INIT_AUTOMAKE(1.9.5) > > AC_ERLANG_NEED_ERLC > > AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_TARNAME, > AC_PACKAGE_VERSION) > > AC_CONFIG_FILES([Makefile src/Makefile]) > > AC_OUTPUT No need for AC_ERLANG_SUBST_ROOT_DIR AC_ERLANG_SUBST_LIB_DIR AC_ERLANG_SUBST_INSTALL_LIB_DIR ? > Oh, and please call your file configure.ac instead of > configure.in. This has been the new convention for a while. > Since we require Autoconf version >= 2.59c, we are sure that the > Autoconf that will be used supports that convention. Oh, ok, done. Thanks. > > and this is the main Makefile.am > > http://software.pupeno.com/Serlvers/src/Makefile.am > > And in that last one is where I am worried. I have to list the > > sources and the beam files, is that needed ? I have to also > > put the .app among the (automatically generated) beam files, > > is that needed as well ? I mean, isn't there a better way ? > > If your .app file is not generated, It can be generated ? > and is therefore a "source > file", then it must be explicitly included in the distributed > files (EXTRA_DIST), like the .erl files, and it must *not* be > included in the files to clean (CLEANFILES). > However, since your .app file must be installed in a directory > different from .../src/, you can't add your .app files into the > erlsrc_DATA variable, so you must define new erlapp* variables: > > erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/src > erlsrc_DATA = dns_msg.erl gen_chargen.erl gen_daytime.erl > gen_dns.erl gen_echo.erl gen_time.erl launcher.erl > EXTRA_DIST = $(erlsrc_DATA) > > erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_serlvers)/ebin > erlbeam_DATA = dns_msg.beam gen_chargen.beam gen_daytime.beam > gen_dns.beam gen_echo.beam gen_time.beam launcher.beam > CLEANFILES = $(erlbeam_DATA) > > erlappdir = $(erlbeamdir) > erlapp_DATA = serlvers.app > EXTRA_DIST += $(erlapp_DATA) > > SUFFIXES = .erl .beam > .erl.beam: > $(ERLC) $(ERLCFLAGS) -b beam $< > > > > And likewise, you should define a series of variables for every > other kind of source or generated files (.rel, etc.) if you have > any. Ok, thanks. > Hopefully, Ruslan Babayev may add support for Erlang in Automake, > to help writing Makefile.am files. Until then, we will have to > explicitly write separate sets of variables for different kinds > of files, in Makefile.am files, as shown above. Oh, I see what is missing now. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From joseerlang@REDACTED Tue Nov 14 16:49:24 2006 From: joseerlang@REDACTED (Jose Antonio) Date: Tue, 14 Nov 2006 16:49:24 +0100 Subject: [erlang-questions] [erlang-question] Problem with erlsoap-0.3 In-Reply-To: <4558D04A.9000805@tornkvist.org> References: <4558A493.3050007@gmail.com> <4558D04A.9000805@tornkvist.org> Message-ID: <4559E584.6000206@gmail.com> Thanks Guys. By the way, I have detected a bug in code : sms_demo:start(), sms_demo:send_sms_local("test"), sms_demo:send_sms_local_multi(["test1", "test2"]), get_status_local("some_id"). !--- the module is missing ;-) Torbjorn Tornkvist wrote: > > Not sure if this will solve your problem, but you can > find a newer version of erlsoap here: > > http://forum.trapexit.org/viewtopic.php?t=6331 > > I think it could be a good idea to setup an erlsoap > repository, e.g at google (or at least put it in jungerl ?). > If we can get Erik Reitsmas blessing I could fix this. > > Opinions anyone ? > Erik (if you read this) what do you think ? > > --Tobbe > > Jose Antonio skrev: >> I am trying to run erlsoap-0.3 but I have problems with module >> application. >> #erl -erlsoap ../config/httpd.conf >> Erlang (BEAM) emulator version 5.4.9 [source] [hipe] >> >> Eshell V5.4.9 (abort with ^G) >> 1> application:start(inets). >> ok >> 2> application:start(erlsoap). >> >> =INFO REPORT==== 13-Nov-2006::17:49:59 === >> application: erlsoap >> exited: "invalid return value from mod_soap:start(normal,config) >> -> {'EXIT', >> {undef, >> [{config, >> read_from_file, [\"erlsoap.conf\"]}, >> {mod_soap,s >> tart,2},\n >> {application_master,start_it_old,4}]}}" >> >> type: temporary >> {error,"invalid return value from mod_soap:start(normal,config) -> >> {'EXIT',\n >> {undef,\n >> [{config,\n >> read_from_file,\n >> [\"erlsoap.conf\"]},\n >> {mod_soap,start, >> 2},\n >> {application_master,start_it_old,4}]}}"} >> 3> application:get_env(erlsoap,inets_conf). >> {ok,"/home/jgarcia/Bajadas/erlsoap-0.3/config/httpd.conf"} >> >> Configuration File (httpd.conf): Port 8888 >> ServerName localhost >> SocketType ip_comm >> Modules mod_alias mod_auth mod_esi mod_actions mod_cgi mod_include >> mod_dir mod_get mod_head mod_log mod_disk_log mod_soap >> DefaultType text/plain >> >> Any idea? >> Regards >> > > From ok@REDACTED Tue Nov 14 20:19:33 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 15 Nov 2006 08:19:33 +1300 (NZDT) Subject: [erlang-questions] Exceptions vs Tagged Values Message-ID: <200611141919.kAEJJXas298257@atlas.otago.ac.nz> Mats Cronqvist wrote: the OTP libraries (and most other code too) rely entirely too much on tagged tuples, and should throw much more often. Now we have agreement! (*) for file:open/2 in particular, i see no reason for it to do anything but throw or return the fd. if the file should be there, that's what you want; if you don't know if the file exists/is readable, you should call read_file_info/1 first. The fact that read_file_info/1 succeeds and says the file is accessible does NOT guarantee that you will be able to open the file. Some possible reasons: - you may have reached the limit of some system or Erlang run-time resource required by open files but not required by read_file_info/1. (For example, in C+POSIX, access() doesn't require a file descriptor, but open() does.) - the world is concurrent. Between the return from read_file_info/1 and the call to the file opening function, the process may be suspended (by Erlang or the operating system) and some other (Erlang or operating system) process may alter the file system. The fact that this is rare doesn't mean it won't happen, it just means that it will happen to customers instead of during your own tests. I have faced this problem in C and in implementing I/O support for Prolog. The *only* way to be sure that opening a file will work is to try to open the file. Nothing else tells you *exactly* what you need to know. What's really needed is a set of design principles which will enable programmers to *predict* whether a library function will throw or return a tagged tuple without having to remember. For Quintus Prolog, we managed that. I was able to classify exceptions into 16 classes. (Quintus "simplified" that be fusing my "error" classes with my "failure" classes; I still think that was a mistake, but the distinction wouldn't be useful for Erlang.) I'm on a mailing list for the revision of the Prolog standard; just last week there was a proposal to add some new built-in predicates, and a question about what errors should be detected. The answer was unanimuous, which was a very pleasant outcome. What's more, there seemed to be agreement about the _reasons_ for the decision. So at least at the level of something like the 'lists' module, it can be done. From ulf@REDACTED Tue Nov 14 21:58:10 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 14 Nov 2006 21:58:10 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <200611141919.kAEJJXas298257@atlas.otago.ac.nz> References: <200611141919.kAEJJXas298257@atlas.otago.ac.nz> Message-ID: Den 2006-11-14 20:19:33 skrev Richard A. O'Keefe : > (*) for file:open/2 in particular, i see no reason for it to do > anything but throw or return the fd. if the file should be > there, that's what you want; if you don't know if the file > exists/is readable, you should call read_file_info/1 first. > > The fact that read_file_info/1 succeeds and says the file is accessible > does NOT guarantee that you will be able to open the file. > Some possible reasons: > [...] > I have faced this problem in C and in implementing I/O support for > Prolog. > The *only* way to be sure that opening a file will work is to try to open > the file. Nothing else tells you *exactly* what you need to know. But in most cases, read_file_info() does tell you whether or not you can expect file:open() to work, given that some exceptional condition (e.g. out of file descriptors) does not happen, and that there isn't a race condition for the file (which could also be regarded as exceptional. In these cases, I'd be willing to live with read_file_info() telling me that I should be able to expect it to work, and then file:open() throwing an exception if it still doesn't. BR, Ulf W -- Ulf Wiger From xpdoka@REDACTED Tue Nov 14 22:45:26 2006 From: xpdoka@REDACTED (Dominic Williams) Date: Tue, 14 Nov 2006 22:45:26 +0100 (CET) Subject: [erlang-questions] Reified environments (was: Re: Package Support/Use) In-Reply-To: <20061107161533.21192.qmail@web38807.mail.mud.yahoo.com> References: <20061107161533.21192.qmail@web38807.mail.mud.yahoo.com> Message-ID: <61393.82.238.225.199.1163540726.squirrel@www.geekisp.com> Richard A. O'Keefe wrote: > I've been asked what I meant when I talked about reifying > module environments and having more than one of them. You > can think of this message as a *draft* description. It took me a while to get to grips with your proposal, but I think the overall concept is brilliant. Thomas Lindgren wrote: > At this point, it strikes me that I'd actually like to see > some requirements. The take-home point might be: "So, what > functionality do we expect our reified environment or > packaging system to provide?" Personally, I had these stories in mind: - no need to change existing code - module names shouldn't be cluttered with non-design parts just to avoid potential future name clashes - actual name clashes may be resolved easily when they actually occur - possible to group related modules into a common context, within which the context name does not need to be explicited Richard's proposal nicely fits all of these, I think. I had been elaborating a different proposal, so I'll try and finish it anyway, at least for the sake of comparison. Regards, Dominic Williams http://www.dominicwilliams.net ---- From ok@REDACTED Tue Nov 14 23:27:54 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 15 Nov 2006 11:27:54 +1300 (NZDT) Subject: [erlang-questions] Exceptions vs Tagged Values Message-ID: <200611142227.kAEMRs3S302365@atlas.otago.ac.nz> I pointed out that > The *only* way to be sure that opening a file will work is to try to open > the file. Nothing else tells you *exactly* what you need to know. and gave two explicit reasons why. Ulf Wiger replied: But in most cases, read_file_info() does tell you whether or not you can expect file:open() to work, given that some exceptional condition (e.g. out of file descriptors) does not happen, and that there isn't a race condition for the file (which could also be regarded as exceptional. Why should we tolerate for a single instant an approach which sort of works most of the time kind of if you don't have bad luck when there is a 100% reliable solution which is more efficient as well? file:read_file_info/1 is basically a call to stat(2), at least in UNIX. So to check using read_file_info and then open requires *two* trips to the operating system. And it builds a record, only one field of which is relevant to the question "could I open this file". So just calling file:open/2 is clearly more efficient. By actual measurement on my machine, a successful call to file:open(File_Name, [read]) takes 0.23 milliseconds (including a successful call to file:close(Device)), while a successful call to file:read_file_info(File_Name) takes 0.27 milliseconds. In these cases, I'd be willing to live with read_file_info() telling me that I should be able to expect it to work, and then file:open() throwing an exception if it still doesn't. In that case you are willing to live with a limit of opening 2000 files per second on my machine, while I would be able to open 4000 files per second. I also tried a measurement that involved opening and reading a small file, which is clearly more useful. open+read+close: 0.54 msec, read_file_info+open+read+close: 0.91 msec. So I could read 2000 small files per second, while someone who checks every time with file:read_file_info/1 could only manage 1100 files per second. I really honestly cannot see any sense in living with an unreliable method when the reliable one is so much faster. And of course file:read_file_info/1 is useless for answering the question "would I be allowed to open this file for output". Note that my argument against using file:read_file_info/1 to approximate the question "would I be able to open this file" instead of using file:open/2 to get an exact answer is *NOT* an argument for tagged tuples. It is an argument against using file:read_file_info/1 in this way; file:open/2 would still be the simpler faster method if it could only return a device or raise an exception. From chris.newcombe@REDACTED Wed Nov 15 01:13:40 2006 From: chris.newcombe@REDACTED (Chris Newcombe) Date: Tue, 14 Nov 2006 16:13:40 -0800 Subject: [erlang-questions] Example use of Berkeley DB Message-ID: <781dd98c0611141613w5a9cf624n4cdd9fd6e971182d@mail.gmail.com> EDTK v1.5 (available from http://www.snookles.com/erlang/) contains a complete driver for Berkeley DB. The test-suite shows several different ways to use the driver (different layers of APIs). But it might help to have an example of the recommended style of use. So here it is. This example does not use replication -- I will post another example later for that. BTW, I have sent a second EDTK v1.5 release candidate to Scott, so that should be available on his server soon. Unless someone finds a problem, that second candidate will become the release. But the previous candidate is fine for experimentation. regards, Chris After building EDTK and the berkeley_db driver, drop the following two files into edtk-1.5/examples/berkeley_db and run the first one. # File: examples_no_replication.sh erlc -v -W +debug_info examples_no_replication.erl mkdir -p example_bdb_data_dir # Note that berkeley_db_drv.so must be in the Erlang *code* path # (that happens to already be the case with this example) LD_LIBRARY_PATH=../../../BerkeleyDB.4.5/lib \ erl -s examples_no_replication example_1 # File: examples_no_replication.erl -module(examples_no_replication). -export([example_1/0]). %% It is possible to use the berkeley_db driver in several different %% ways (the regression tests give examples of each). %% %% This file shows the recommended way. %% Note that we don't need to include any .hrl files -define(BDB_PC,berkeley_db_port_coordinator). -define(BDB_H, berkeley_db_helpers). -define(BDB, berkeley_db_drv). %% Internal functions exported for use with ?BDB_H:do_txn -export([txn_fun_simple_put/2, txn_fun_simple_get/2, txn_fun_put_account/2, txn_fun_get_account_by_email/2]). example_1() -> %% The port-coordiantor can be owned by a normal OTP supervisor %% (not shown here). %% %% This call creates a process that is locally registered as %% 'berkeley_db_port_coordinator'. (You can also run multiple %% named port-coordinators, but most applications don't need to do %% that.) %% %% The only required argument is a BDB 'environment' directory, %% which must already exist. (There are a lot of optional %% configuration arguments, not shown here.) {ok, _ServerPid} = ?BDB_PC:start_link("example_bdb_data_dir"), %% Now some example transactions %% %% Applications should call ?BDB_H:do_txn/2, which executes a %% {Module, Function, ExtraArgs} and will retry that operationq %% some number of times if BDB throws a deadlock exception. (See %% BDB documentation for an explanation of deadlocks and how to %% minimize them). %% Do a simple write (to a single key in a single database table) %% (note that key and data arguments may be strings or binaries) ok = ?BDB_H:do_txn({?MODULE, txn_fun_simple_put, {"my-key", "my-data"}}, 3), %% Read it back (note that retrieved data is always returned as %% binaries) <<"my-data">> = ?BDB_H:do_txn({?MODULE, txn_fun_simple_get, "my-key"}, 3), %% A slightly more complex example: a multi-part transaction %% involving several databases ExampleAccountObj = [{email_addr, "my-email-address"}, {balance, 100}], ok = ?BDB_H:do_txn({?MODULE, txn_fun_put_account, {"my-account-name", ExampleAccountObj}}, 3), {<<"my-account-name">>, AccountObjBin} = ?BDB_H:do_txn({?MODULE, txn_fun_get_account_by_email, "my-email-address"}, 3), ExampleAccountObj = binary_to_term(AccountObjBin), %% Clean shutdown %% %% If owned by a supervisor, the port-coordinator should have a %% 'Shutdown policy' that is an integer (maybe 5000) - to allow it %% to cleanly close BDB. Note that as BDB uses transactions and %% write-ahead logging, any committed data is safe even if the %% port-coordinator crashes or is killed. ok = ?BDB_PC:stop(), io:format("Done.~n"), erlang:halt(). txn_fun_simple_put(BdbPort, {Key, Data}) -> %% ... this creates the database on first use DB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "test.db"), %% Passing 'void' as the transaction handle means 'auto-commit') ok = ?BDB:db_put(BdbPort, DB, void, Key, Data, []). txn_fun_simple_get(BdbPort, Key) -> DB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "test.db"), ?BDB:db_get_data(BdbPort, DB, void, Key, []). txn_fun_put_account(BdbPort, {AccountName, AccountObj}) -> {value, {email_addr, EmailAddr}} = lists:keysearch(email_addr, 1, AccountObj), AccountDB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "account.db"), IndexEmailDB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "index_email_to_account.db"), Txn = ?BDB:txn_begin(BdbPort, void, []), ok = ?BDB:db_put(BdbPort, AccountDB, Txn, AccountName, term_to_binary(AccountObj), []), ok = ?BDB:db_put(BdbPort, IndexEmailDB, Txn, EmailAddr, AccountName, []), ok = ?BDB:txn_commit(BdbPort, Txn, []). txn_fun_get_account_by_email(BdbPort, EmailAddr) -> AccountDB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "account.db"), IndexEmailDB = ?BDB_PC:get_db_handle(BdbPort, bdb_DB_BTREE, "index_email_to_account.db"), Txn = ?BDB:txn_begin(BdbPort, void, []), AccountName = ?BDB:db_get_data(BdbPort, IndexEmailDB, Txn, EmailAddr, []), AccountObj = ?BDB:db_get_data(BdbPort, AccountDB, Txn, AccountName, []), ok = ?BDB:txn_commit(BdbPort, Txn, []), {AccountName, AccountObj}. From pupeno@REDACTED Wed Nov 15 04:58:59 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 03:58:59 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611141454.32021.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611141454.32021.rlenglet@users.forge.objectweb.org> Message-ID: <200611150359.05421.pupeno@pupeno.com> The only thing that still bothers me a bit is that on configure it says: checking for Erlang/OTP library installation base directory... ${exec_prefix}/lib/erlang/lib checking for Erlang/OTP 'serlvers' library installation subdirectory... ${libdir}/erlang/lib/serlvers-0.0.0 Shouldn't it say: checking for Erlang/OTP library installation base directory... /usr/lib/erlang/lib checking for Erlang/OTP 'serlvers' library installation subdirectory... /usr/local/lib/erlang/lib/serlvers-0.0.0 Something I can do about it ? Thanks. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlenglet@REDACTED Wed Nov 15 05:22:34 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 13:22:34 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611141424.22466.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> <200611141454.32021.rlenglet@users.forge.objectweb.org> <200611141424.22466.pupeno@pupeno.com> Message-ID: <200611151322.34487.rlenglet@users.forge.objectweb.org> On Tuesday 14 November 2006 23:24, Pupeno wrote: > > AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED, > > serlvers) > > AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez) > > > > dnl Require autoconf version >=2.59c. first one with erlang > > macros > > AC_PREREQ(2.59c) > > dnl Require automake version >=1.9.5. > > AM_INIT_AUTOMAKE(1.9.5) > > > > AC_ERLANG_NEED_ERLC > > > > AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_TARNAME, > > AC_PACKAGE_VERSION) > > > > AC_CONFIG_FILES([Makefile src/Makefile]) > > > > AC_OUTPUT > > No need for > > AC_ERLANG_SUBST_ROOT_DIR > AC_ERLANG_SUBST_LIB_DIR > AC_ERLANG_SUBST_INSTALL_LIB_DIR > > ? The macros have dependencies between them, expressed by "AC_REQUIRE(..)" macro calls in their implementation. For instance, if one writes AC_REQUIRE(AC_ERLANG_NEED_ERLC) then the macro AC_ERLANG_NEED_ERLC is called if and only if it has not already been called. That way, AC_ERLANG_SUBST_INSTALL_LIB_DIR is required by AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...). And calls to AC_ERLANG_SUBST_ROOT_DIR and AC_ERLANG_SUBST_LIB_DIR were not necessary anyway in gtknode's configure.ac. (By the way, Mats, I think that you should remove those calls in gtknode...) I think that I added those explicit calls in gtknode's configure.ac, only to demonstrate the use of the available macros. (^_^) It must be noted that AC_ERLANG_NEED_ERLC is also required by AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...), since the ERLC variable (i.e., the erlc command) is used to compile tests written in Erlang, like in this macro. However, since you explicitly use the ERLC variable in your Makefile.am, I think that it is better to explicitly keep the call to AC_ERLANG_NEED_ERLC in your configure.ac. That way, if one day you need to comment out the call to AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(...,...), ERLC will still be substituted. [...] > > > and this is the main Makefile.am > > > http://software.pupeno.com/Serlvers/src/Makefile.am > > > And in that last one is where I am worried. I have to list > > > the sources and the beam files, is that needed ? I have to > > > also put the .app among the (automatically generated) beam > > > files, is that needed as well ? I mean, isn't there a > > > better way ? > > > > If your .app file is not generated, > > It can be generated ? It could. Why not? (^_^) Ruslan Babayev has thought of a way to substitute the version numbers in .app files, with the versions of actually installed libraries. However, adding the support for that in Autoconf has been rejected by Autoconf maintainers. They reject anything that has to do with version numbers, since it is contrary to Autoconf's philosophy. Anyway, we could do such substitutions easily with a short Erlang program. Any volunteer to develop that? The configuration+build process would then be: 1) one checks with Autoconf that all required libraries are installed, and that they have all the required features (exported functions, etc.), etc. 2) at build time, one can generate the .app files to reflect the version numbers of the installed libraries. [...] Regards, -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From rlenglet@REDACTED Wed Nov 15 05:32:05 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 13:32:05 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611150359.05421.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> <200611141454.32021.rlenglet@users.forge.objectweb.org> <200611150359.05421.pupeno@pupeno.com> Message-ID: <200611151332.05517.rlenglet@users.forge.objectweb.org> Pupeno wrote: > The only thing that still bothers me a bit is that on > configure it says: > > checking for Erlang/OTP library installation base directory... > ${exec_prefix}/lib/erlang/lib > checking for Erlang/OTP 'serlvers' library installation > subdirectory... ${libdir}/erlang/lib/serlvers-0.0.0 > > Shouldn't it say: > > checking for Erlang/OTP library installation base > directory... /usr/lib/erlang/lib > checking for Erlang/OTP 'serlvers' library installation > subdirectory... /usr/local/lib/erlang/lib/serlvers-0.0.0 > > Something I can do about it ? That is normal, and that is even required as for the GNU Coding Standards! (I can't give you the URL, since the gnu.org server is not accessible right now) Installation dirs should keep their prefix un-substituted, so that they can be changed at the last moment when calling make. That substitution in installation directories must be done by make. That is why, it is strongly advised to have Autoconf's configure scripts rewrite only Makefiles, and not other kinds of files, because if you rewrite variables in a file that is not interpreted by make, you may have some prefixes unsubstituted. Of course, you don't have that problem with variables that are not installation directories (e.g., @PACKAGE_TARNAME@, etc.). Anyway, you should not worry. You can check that your Makefiles actually already work! (^_^) Regards, -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From pupeno@REDACTED Wed Nov 15 07:01:47 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 06:01:47 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611140444.54467.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> Message-ID: <200611150601.51978.pupeno@pupeno.com> BTW, I've found this way of writing it: %.beam: %.erl $(ERLC) $(ERLCFLAGS) -b beam $< instead of SUFFIXES = .erl .beam .erl.beam: $(ERLC) $(ERLCFLAGS) -b beam $< which seems to be the current way of doing it. And it is more readable. -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From pupeno@REDACTED Wed Nov 15 07:16:16 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 06:16:16 +0000 Subject: [erlang-questions] Start me up. Message-ID: <200611150616.17000.pupeno@pupeno.com> Hello, I have what I would call an application or program (from the Linux point of view) written in Erlang. It is also an Erlang application [1]. I can start and stop my app just fine from the Erlang prompt but people don't live in Erlang prompts and the init scripts of most OSs expects an actual program in /usr/bin or similar and not just an Erlang function. That means I ended up writing a script[2] to wrap the Erlang function into something that is friendly with the OS. That means the script ended having a configuration file[3] which means the script[2] has to be processed with sed[4] to perform some string replacements[5]. Isn't there a better alternative ? this really, really sucks. Thanks. -- Pupeno (http://pupeno.com) [1] Some Erlang applications are also just libs from a Linux point of view. [2] http://software.pupeno.com/FanterlasticFour/scripts/fanterlasticfour.sh [3] http://software.pupeno.com/FanterlasticFour/configs/fanterlasticfour.sh [4] line 8 on http://software.pupeno.com/FanterlasticFour/scripts/Makefile.am [5] line 23 on the script[2] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlenglet@REDACTED Wed Nov 15 07:39:42 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 15:39:42 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611150601.51978.pupeno@pupeno.com> References: <200611140444.54467.pupeno@pupeno.com> <200611150601.51978.pupeno@pupeno.com> Message-ID: <200611151539.42939.rlenglet@users.forge.objectweb.org> Pupeno wrote: > BTW, I've found this way of writing it: > > %.beam: %.erl > $(ERLC) $(ERLCFLAGS) -b beam $< > > instead of > > SUFFIXES = .erl .beam > .erl.beam: > $(ERLC) $(ERLCFLAGS) -b beam $< > > which seems to be the current way of doing it. And it is more > readable. Yes, you're right, thanks! But I believed that pattern rules were a GNU Make'ism? I believe that BSD Make supports only implicit rules, and not pattern rules. Therefore, I believe that implicit rules are more portable. Maybe I am wrong. Since Automake is supposed to generate Makefiles that do not require GNU Make, it may be a good idea to not depend on GNU Make in your Makefile.am. -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From lcoquelle@REDACTED Wed Nov 15 08:15:07 2006 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Wed, 15 Nov 2006 15:15:07 +0800 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611151539.42939.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611150601.51978.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> Message-ID: Thanks guys! I learned a lot with this thread :) But can I ask one more thing? ... I would like a summary: could you please give us the final version of configure.ac and Makefile.amthat can be used as template of any erlanguish application? On 11/15/06, Romain Lenglet wrote: > > Pupeno wrote: > > BTW, I've found this way of writing it: > > > > %.beam: %.erl > > $(ERLC) $(ERLCFLAGS) -b beam $< > > > > instead of > > > > SUFFIXES = .erl .beam > > .erl.beam: > > $(ERLC) $(ERLCFLAGS) -b beam $< > > > > which seems to be the current way of doing it. And it is more > > readable. > > Yes, you're right, thanks! > But I believed that pattern rules were a GNU Make'ism? > I believe that BSD Make supports only implicit rules, and not > pattern rules. Therefore, I believe that implicit rules are more > portable. Maybe I am wrong. > > Since Automake is supposed to generate Makefiles that do not > require GNU Make, it may be a good idea to not depend on GNU > Make in your Makefile.am. > > -- > Romain LENGLET > Pr. Chiba Shigeru Group > Dept. of Mathematical and Computing Sciences > Tokyo Institute of Technology > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rlenglet@REDACTED Wed Nov 15 08:49:38 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 16:49:38 +0900 Subject: [erlang-questions] Start me up. In-Reply-To: <200611150616.17000.pupeno@pupeno.com> References: <200611150616.17000.pupeno@pupeno.com> Message-ID: <200611151649.38816.rlenglet@users.forge.objectweb.org> Pupeno wrote: > Hello, > I have what I would call an application or program (from the > Linux point of view) written in Erlang. It is also an Erlang > application [1]. I can start and stop my app just fine from > the Erlang prompt but people don't live in Erlang prompts and > the init scripts of most OSs expects an actual program in > /usr/bin or similar and not just an Erlang function. That > means I ended up writing a script[2] to wrap the Erlang > function into something that is friendly with the OS. That > means the script ended having a configuration file[3] which > means the script[2] has to be processed with sed[4] to perform > some string replacements[5]. > Isn't there a better alternative ? this really, really sucks. It does not really sucks. That is the normal way of doing. However, I have attached better versions of your files. Notably, you should detect and substitute the paths to detected commands (erl, run_erl, erl_call), in your configuration file, and in the defaults section in your script. To do that, see the detection code added in configure.ac, and the substitutions in Makefile.am. The paths NAMEFILE, LOGDIR and PIPEDIR should include the normal ${localstatedir} prefix. Therefore, they should be substituted as well. Your configuration script should go into .../etc (the ${sysconfdir} directory). See the new variables in the Makefile.am, and the substitution in your script. Since your fanterlasticfour file is an executable script, you can use the SCRIPTS primary variable name for this file, instead of DATA, in the Makefile.am. Also, every executable command and every configuration file should have a manpage. This is mandatory as for the Debian GNU/Linux policy, for instance. I can write manpages for you, if you ask gently. (^_^) Regards, -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology -------------- next part -------------- AC_INIT(Modules to write servers, 0.0.0, pupeno@REDACTED, serlvers) AC_COPYRIGHT(Copyright (C) 2006 Jose Pablo Pupeno Fernandez) dnl Require autoconf version >=2.59c. first one with erlang macros AC_PREREQ(2.59c) dnl Require automake version >=1.9.5. AM_INIT_AUTOMAKE(1.9.5) dnl ---------------------------------------- dnl The interesting part! AC_ERLANG_NEED_ERL AC_ARG_VAR([RUN_ERL], [Erlang/OTP interpreter runner [autodetected]])dnl if test -n "$RUN_ERL"; then AC_MSG_CHECKING([for run_erl]) AC_MSG_RESULT([$RUN_ERL]) else AC_PATH_TOOL(RUN_ERL, run_erl, [not found], []) fi if test "$RUN_ERL" = "not found"; then AC_MSG_ERROR([Erlang/OTP interpreter runner (run_erl) not found but required]) fi AC_ARG_VAR([ERL_CALL], [Erlang/OTP distributed node caller [autodetected]])dnl if test -n "$ERL_CALL"; then AC_MSG_CHECKING([for erl_call]) AC_MSG_RESULT([$ERL_CALL]) else AC_PATH_TOOL(ERL_CALL, erl_call, [not found], []) fi if test "$ERL_CALL" = "not found"; then AC_MSG_ERROR([Erlang/OTP distributed node caller (erl_call) not found but required]) fi dnl ---------------------------------------- AC_CONFIG_FILES([Makefile]) AC_OUTPUT -------------- next part -------------- # Name of the Erlang node. NAME="fanterlasticfour" # Some paths where Fanterlastic Four is going to write files. NAMEFILE="@NAMEFILE@" LOGDIR="@LOGDIR@" PIPEDIR="@PIPEDIR@" # Programs that Fanterlastic Four needs. ERL="@ERL@" RUN_ERL="@RUN_ERL@" ERL_CALL="@ERL_CALL@" -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile.am Type: text/x-makefile Size: 977 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fanterlasticfour.in Type: application/x-shellscript Size: 2340 bytes Desc: not available URL: From rlenglet@REDACTED Wed Nov 15 09:00:35 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 17:00:35 +0900 Subject: [erlang-questions] Start me up. In-Reply-To: <200611151649.38816.rlenglet@users.forge.objectweb.org> References: <200611150616.17000.pupeno@pupeno.com> <200611151649.38816.rlenglet@users.forge.objectweb.org> Message-ID: <200611151700.35586.rlenglet@users.forge.objectweb.org> I just wrote: [...] > However, I have attached better versions of your files. [...] But there was a bug in the Makefile.am I have just sent: CONFIG_FILE should be CONFIGFILE I have attached a corrected file. -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile.am Type: text/x-makefile Size: 976 bytes Desc: not available URL: From bengt.kleberg@REDACTED Wed Nov 15 09:55:27 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 15 Nov 2006 09:55:27 +0100 Subject: [erlang-questions] documentation error in zip module (another one) Message-ID: <455AD5FF.8090009@ericsson.com> greetings, in the documentation for the zip module: ''extract(Archive, Options) -> RetValue Types: Name = filename() | binary() Options = [Option] Option = {files, FileList} | keep_old_files | verbose | memory | {file_filter, FileFilter}'' - memory is not explained - file_filter has #zip_file{} which is not described, nor is it explained where i can find it. - {files, List} is explained but gives the following: 4> zip:extract( "a.zip", [{files,["atmp"]}]). {error,{bad_option,{files,["atmp"]}}} bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bengt.kleberg@REDACTED Wed Nov 15 09:56:52 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 15 Nov 2006 09:56:52 +0100 Subject: [erlang-questions] Start me up. In-Reply-To: <200611150616.17000.pupeno@pupeno.com> References: <200611150616.17000.pupeno@pupeno.com> Message-ID: <455AD654.8060407@ericsson.com> On 2006-11-15 07:16, Pupeno wrote: > Hello, > I have what I would call an application or program (from the Linux point of > view) written in Erlang. It is also an Erlang application [1]. I can start > and stop my app just fine from the Erlang prompt but people don't live in > Erlang prompts and the init scripts of most OSs expects an actual program > in /usr/bin or similar and not just an Erlang function. have you had a look at escript? would it help? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From bengt.kleberg@REDACTED Wed Nov 15 10:09:06 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 15 Nov 2006 10:09:06 +0100 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611151539.42939.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611150601.51978.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> Message-ID: <455AD932.8040904@ericsson.com> On 2006-11-15 07:39, Romain Lenglet wrote: ...deleted > Since Automake is supposed to generate Makefiles that do not > require GNU Make, it may be a good idea to not depend on GNU > Make in your Makefile.am. according to a automake webpage (http://directory.fsf.org/automake.html): ''Automake - Generates Makefile.in files 'Automake' automatically generates make files compliant with the GNU coding standards. It was inspired by the 4.4 BSD make and include files, but aims to be portable and to confrom to the GNU standards for Make file variables and targets.'' bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From rlenglet@REDACTED Wed Nov 15 10:39:15 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 15 Nov 2006 18:39:15 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <455AD932.8040904@ericsson.com> References: <200611140444.54467.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> <455AD932.8040904@ericsson.com> Message-ID: <200611151839.15354.rlenglet@users.forge.objectweb.org> Bengt Kleberg wrote: > On 2006-11-15 07:39, Romain Lenglet wrote: > ...deleted > > > Since Automake is supposed to generate Makefiles that do not > > require GNU Make, it may be a good idea to not depend on GNU > > Make in your Makefile.am. > > according to a automake webpage > (http://directory.fsf.org/automake.html): ''Automake - > Generates Makefile.in files > 'Automake' automatically generates make files compliant with > the GNU coding standards. It was inspired by the 4.4 BSD make > and include files, but aims to be portable and to confrom to > the GNU standards for Make file variables and targets.'' But this quote tells nothing about the compatibility of Makefiles generated by Automake with non-GNU make programs, e.g. BSD make, which was the topic. This quote only says that Automake is functionally similar to the non-standard features found in BSD Make: macros, loops, etc. In GNU, they decided to implement such features outside of Make, hence in Automake. The GNU Coding Standards are referenced here about the standard variables (libdir, prefix, localstatedir, DESTDIR, etc. etc.) and targets (all, install, clean, dist, etc.). Not about GNU make, or about the compatibility of Automake with it. But from information found on the web, Automake has been generating Makefiles that can be interpreted by Makes other than GNU Make, since Automake version 1.4 (around year 2000). Regards, -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From bengt.kleberg@REDACTED Wed Nov 15 11:06:04 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 15 Nov 2006 11:06:04 +0100 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611151839.15354.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> <455AD932.8040904@ericsson.com> <200611151839.15354.rlenglet@users.forge.objectweb.org> Message-ID: <455AE68C.8070402@ericsson.com> On 2006-11-15 10:39, Romain Lenglet wrote: > Bengt Kleberg wrote: ...deleted >> ''Automake - >> Generates Makefile.in files >> 'Automake' automatically generates make files compliant with >> the GNU coding standards. It was inspired by the 4.4 BSD make >> and include files, but aims to be portable and to confrom to >> the GNU standards for Make file variables and targets.'' > > But this quote tells nothing about the compatibility of Makefiles > generated by Automake with non-GNU make programs, e.g. BSD make, > which was the topic. i searched for a clearification of your statement ''Automake is supposed to generate Makefiles that do not require GNU Make''. the quote was the closest i came to such a clearification. your subsequent reply was much clearer. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From chandrashekhar.mullaparthi@REDACTED Wed Nov 15 11:16:22 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 15 Nov 2006 10:16:22 +0000 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: <200611142227.kAEMRs3S302365@atlas.otago.ac.nz> References: <200611142227.kAEMRs3S302365@atlas.otago.ac.nz> Message-ID: Quite frequently, I resort to returning tagged tuples as well because I want to print nice error messages to logs for the Support team to look at. They can't understand crash reports and I don't blame them for it. What would be nice though is for the programmer to be able to specify what additional information should be included in an exception should a match expression fail. At the moment, we get a badmatch exception which is not very useful when you want to report exactly what went wrong. Here is some pseudo code to illustrate my point. foo() -> try do_something() catch exit:{{badmatch, {error, enoent}}, opening_file1_failed} -> ok; exit:{{badmatch, {error, enofile}}, opening_file2_failed} -> ok; exit:Reason -> {'EXIT', Reason} end. do_something() -> {ok, Iod1}:{exception, opening_file1_failed} = file:open("file1.txt", [read, raw]), {ok, Iod2}:{exception, opening_file2_failed} = file:open("file2.txt", [write, raw]), bar(Iod1, Iod2). cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick@REDACTED Wed Nov 15 11:20:01 2006 From: nick@REDACTED (Niclas Eklund) Date: Wed, 15 Nov 2006 11:20:01 +0100 (MET) Subject: [erlang-questions] Orber and NAT In-Reply-To: <20061113212118.P22538@olgeni.olgeni> Message-ID: Hello! It will be supported in the next version of Orber, which will be released as soon as some new stuff has been added to the SSL application. The goal is to release Orber and SSL within a week or so. To get it going you need to do the following: * Set the Orber environment flags for NAT and current interface. * Define {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]} and/or {local, DefaultNATPort, [{Port, NATPort}]}. * Perhaps use IOP_ServiceContext containing the local interface. You will be able to read more in chapters Configuration, Firewall Configuration and Interface Configuration. Using add_alternate_iiop_address isn't the way to go. Why? Because then the IOR would contain both the NAT-address and the internal address. Best regards, Nick On Mon, 13 Nov 2006, Jimmy Olgeni wrote: > > Hello, > > Is there a way to make a Corba object visible _both_ on the local > network and across NAT? Using the NAT flag in Orber seems to cut the > local network out... Or is it a job for add_alternate_iiop_address? > > bye, > jimmy > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mats.cronqvist@REDACTED Wed Nov 15 12:18:59 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 15 Nov 2006 12:18:59 +0100 Subject: [erlang-questions] Exceptions vs Tagged Values In-Reply-To: References: <200611142227.kAEMRs3S302365@atlas.otago.ac.nz> Message-ID: <455AF7A3.1090900@ericsson.com> Chandru wrote: > What would be nice though is for the programmer to be able to specify what > additional information should be included in an exception should a match > expression fail. At the moment, we get a badmatch exception which is not > very useful when you want to report exactly what went wrong. Here is some > pseudo code to illustrate my point. isn't this just because file:open/2 (and many other lib functions) has such crappy error reporting? if it returned, say, {error,{error_opening,FileName,no_permission}} you could just toss the {badmatch,{error,}} cruft and be happy. mats p.s. it throwing {error_opening,FileName,no_permission} would of course be even better :> From pupeno@REDACTED Wed Nov 15 13:06:41 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 12:06:41 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: References: <200611140444.54467.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> Message-ID: <200611151206.48817.pupeno@pupeno.com> On Wednesday 15 November 2006 07:15, Ludovic Coquelle wrote: > Thanks guys! I learned a lot with this thread :) > But can I ask one more thing? ... I would like a summary: > could you please give us the final version of configure.ac and > Makefile.amthat can be used as template of any erlanguish application? I can point you to my project: http://software.pupeno.com/FanterlasticFour/configure.ac http://software.pupeno.com/FanterlasticFour/Makefile.am http://software.pupeno.com/FanterlasticFour/src/Makefile.am -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From nils.muellner@REDACTED Wed Nov 15 13:32:15 2006 From: nils.muellner@REDACTED (=?ISO-8859-15?Q?Nils_M=FCllner?=) Date: Wed, 15 Nov 2006 13:32:15 +0100 Subject: [erlang-questions] 2 questions: Guards & Variables Message-ID: <455B08CF.30206@heh.uni-oldenburg.de> hi, i currently implement depth first search tree for distributed fault-tolerance measurement. the enclosed module is just one part. to run the attached file 1. enter sample matrix: Matrix = [{a,0.1,pid,[{b,0.1},{c,0.1},{d,0.1}], cur, stab},{b,0.1,pid,[{e,0.1},{f,0.1}], cur, stab},{c,0.1,pid,[{g,0.1}], cur, stab},{d,0.1,pid,[{h,0.1},{i,0.1}], cur, stab},{e,0.1,pid,[], cur, stab},{f,0.1,pid,[], cur, stab},{g,0.1,pid,[], cur, stab},{h,0.1,pid,[], cur, stab},{i,0.1,pid,[], cur, stab}]. 2 compile c(dfs_init_matrix). 3. run dfs_init_matrix:dfs_init_matrix(Matrix). questions: 1. in line 81 (in function rip_neighbours the line Bool = lists:member(First, Raw_Neighbours),) i have to assign the desired value to variable Bool. if i used it directly in the if following clause i get a guard error. why do i have to use this work-araound and why is it not possible to directly use if lists:member(First, Raw_Neighbours) -> ... as guard? 2. in the end, everything is correctly assigned into variable Return_Value in line 50. but when i return this value, everything gets corrupted... why? further information: *the tree built can be seen in http://www.mue-tech.com/DFS.png *the desired result is written to variable Return_Value and printed before crash *the matrix has the following structure [{Node_Name,Node_Fault_Possibility,Node_PID,[{Neighbours_Name, Link_Fault_Possibility}, more_neighbours],Current_Value,Stable_Value},more_nodes] *the function gets a matrix where all current values are arbitrary. to run the simulator (super module), this module has to assign the stable path (Stable_Value) for each node and finally add the list, in which the nodes will be visited by dfs-algorithm (compare: http://en.wikipedia.org/wiki/Depth-first_search ) thanks in advance for any help... kind regards nils m?llner -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: dfs_init_matrix.erl URL: From pupeno@REDACTED Wed Nov 15 13:36:27 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 12:36:27 +0000 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611151539.42939.rlenglet@users.forge.objectweb.org> References: <200611140444.54467.pupeno@pupeno.com> <200611150601.51978.pupeno@pupeno.com> <200611151539.42939.rlenglet@users.forge.objectweb.org> Message-ID: <200611151236.29684.pupeno@pupeno.com> On Wednesday 15 November 2006 06:39, Romain Lenglet wrote: > Yes, you're right, thanks! > But I believed that pattern rules were a GNU Make'ism? Oh, didn't know that. > I believe that BSD Make supports only implicit rules, and not > pattern rules. Therefore, I believe that implicit rules are more > portable. Maybe I am wrong. > > Since Automake is supposed to generate Makefiles that do not > require GNU Make, it may be a good idea to not depend on GNU > Make in your Makefile.am. Can any BSDer confirm this ? -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From pupeno@REDACTED Wed Nov 15 14:10:14 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 15 Nov 2006 13:10:14 +0000 Subject: [erlang-questions] Start me up. In-Reply-To: <200611151649.38816.rlenglet@users.forge.objectweb.org> References: <200611150616.17000.pupeno@pupeno.com> <200611151649.38816.rlenglet@users.forge.objectweb.org> Message-ID: <200611151310.20312.pupeno@pupeno.com> Hey! Thank you a lot for all the files! This is starting to look good. run_erl is found correctly because it is located in /usr/bin/run_erl [1] but erl_call is not on a common path, it is only on /usr/lib/erlang/lib/erl_interface-3.5.5.1/bin/erl_call [2]. Defining ERL_CALL it is easy to control, but I'd like the scripts to be a bit more intelligent and try to find it on $(ERLANG_INSTALL_LIB_DIR)/erl_interface-*/bin/, is that possible ? Thanks. -- Pupeno (http://pupeno.com) [1] This, as other paths, are distribution specific, I am talking about my distro here but it is likely to be applicable to others without change. [2] If this isn't so on Debian it may be because they've payed attention to my bug requests/fixes. I already submitted a bug report for my distro. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From jay@REDACTED Wed Nov 15 14:35:14 2006 From: jay@REDACTED (Jay Nelson) Date: Wed, 15 Nov 2006 05:35:14 -0800 Subject: [erlang-questions] Message Scanning Source Message-ID: <455B1792.6010001@duomark.com> Where is the message scanning and message receive source in the baseline? Also, where is the queuing of message send? jay From bengt.kleberg@REDACTED Wed Nov 15 15:51:18 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 15 Nov 2006 15:51:18 +0100 Subject: [erlang-questions] tracing process in a file In-Reply-To: <42ea5fb60611092235u85d105frd63634b516dee138@mail.gmail.com> References: <42ea5fb60611092235u85d105frd63634b516dee138@mail.gmail.com> Message-ID: <455B2966.1010301@ericsson.com> On 2006-11-10 07:35, Surindar Sivanesan wrote: > > Dear all, > I would like to trace a process to a file when it starts at the background. > Which module can help in achieving the above. i never saw an answer to this question, so here is my suggestion: dbg:tracer( process, fun(P, {fun{ok, Pid}) -> io:fwrite(Pid, "~p", [P]), {ok, Pid} end}, file:open( "afile", [write] )} ) the you should be able to do dbg:tp(your_module, []). or have a look at the dbg module for better granularity of traceing. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From rlenglet@REDACTED Wed Nov 15 16:30:30 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 16 Nov 2006 00:30:30 +0900 Subject: [erlang-questions] Start me up. In-Reply-To: <200611151310.20312.pupeno@pupeno.com> References: <200611150616.17000.pupeno@pupeno.com> <200611151649.38816.rlenglet@users.forge.objectweb.org> <200611151310.20312.pupeno@pupeno.com> Message-ID: <200611160030.30281.rlenglet@users.forge.objectweb.org> Pupeno wrote: > Hey! Thank you a lot for all the files! This is starting to > look good. > > run_erl is found correctly because it is located in > /usr/bin/run_erl [1] but erl_call is not on a common path, it > is only > on /usr/lib/erlang/lib/erl_interface-3.5.5.1/bin/erl_call [2]. > Defining ERL_CALL it is easy to control, but I'd like the > scripts to be a bit more intelligent and try to find it on > $(ERLANG_INSTALL_LIB_DIR)/erl_interface-*/bin/, is that > possible ? Sure! On a second thought, replace calls to AC_PATH_TOOL by calls to AC_PATH_PROG, in your configure.ac. It makes more sense here. And in calls to either AC_PATH_TOOL or AC_PATH_PROG, etc., the last argument is an optional custom PATH. Therefore, to check for erl_call and run_erl, let's simply add checks for the root directory and erl_interface's directory, and add the detected paths as arguments to AC_PATH_PROG. Cf. the attached patch to your configure.ac. BTW, I am using Debian, where erl_call is symlinked in /usr/bin, so I did not remark that issue. -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology -------------- next part -------------- A non-text attachment was scrubbed... Name: configure.ac.patch Type: text/x-diff Size: 1327 bytes Desc: not available URL: From rpettit@REDACTED Wed Nov 15 22:08:29 2006 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 15 Nov 2006 15:08:29 -0600 Subject: [erlang-questions] 2 questions: Guards & Variables In-Reply-To: <455B08CF.30206@heh.uni-oldenburg.de> References: <455B08CF.30206@heh.uni-oldenburg.de> Message-ID: <20061115210829.GF5313@vailsys.com> On Wed, Nov 15, 2006 at 01:32:15PM +0100, Nils M?llner wrote: > hi, > i currently implement depth first search tree for distributed > fault-tolerance measurement. the enclosed module is just one part. > > to run the attached file > 1. enter sample matrix: > Matrix = [{a,0.1,pid,[{b,0.1},{c,0.1},{d,0.1}], cur, > stab},{b,0.1,pid,[{e,0.1},{f,0.1}], cur, stab},{c,0.1,pid,[{g,0.1}], > cur, stab},{d,0.1,pid,[{h,0.1},{i,0.1}], cur, stab},{e,0.1,pid,[], > cur, stab},{f,0.1,pid,[], cur, stab},{g,0.1,pid,[], cur, > stab},{h,0.1,pid,[], cur, stab},{i,0.1,pid,[], cur, stab}]. > 2 compile > c(dfs_init_matrix). > 3. run > dfs_init_matrix:dfs_init_matrix(Matrix). > > questions: > 1. in line 81 (in function rip_neighbours the line Bool = > lists:member(First, Raw_Neighbours),) i have to assign the desired value > to variable Bool. if i used it directly in the if following clause i > get a guard error. why do i have to use this work-araound and why is it > not possible to directly use > if > lists:member(First, Raw_Neighbours) -> > ... > as guard? Functions could introduce side-effects (which are disallowed in erlang guards). > 2. in the end, everything is correctly assigned into variable > Return_Value in line 50. but when i return this value, everything gets > corrupted... why? No time to answer this atm--sorry. -Rick > further information: > *the tree built can be seen in http://www.mue-tech.com/DFS.png > *the desired result is written to variable Return_Value and printed > before crash > *the matrix has the following structure > [{Node_Name,Node_Fault_Possibility,Node_PID,[{Neighbours_Name, > Link_Fault_Possibility}, > more_neighbours],Current_Value,Stable_Value},more_nodes] > *the function gets a matrix where all current values are arbitrary. to > run the simulator (super module), this module has to assign the stable > path (Stable_Value) for each node and finally add the list, in which the > nodes will be visited by dfs-algorithm (compare: > http://en.wikipedia.org/wiki/Depth-first_search ) > > thanks in advance for any help... > > kind regards > nils m?llner > -module(dfs_init_matrix). > -export([dfs_init_matrix/1]). > dfs_init_matrix(Matrix)-> > My_Elem = get_elem(a,Matrix), > {Name, Node_Fault, PID, Neighbours, Current, _} = My_Elem, > New_My_Elem = {Name, Node_Fault, PID, Neighbours, Current, [root]}, > Rest_Matrix = lists:delete(My_Elem, Matrix), > Stable_Matrix = [New_My_Elem], > Path = [root], > Iterative_List = [root], > My_Children = get_children(Iterative_List, Matrix, a), > [Next_Child|Other_Children] = My_Children, > Receive = do_init(Next_Child, Path, Stable_Matrix, Rest_Matrix, Matrix, Iterative_List, Other_Children), > Receive. > > do_init(My_Name, Path, Stable_Matrix, Rest_Matrix, Matrix, It_List, My_Brothers) -> > My_Elem = get_elem(My_Name, Matrix), > {Name, NFP, PID, Nei, Cur, _} = My_Elem, > New_Path = lists:append(Path,[My_Name]), > Stable_My_Elem = {Name, NFP, PID, Nei, Cur, New_Path}, > New_Stable_Matrix = lists:append(Stable_Matrix, [Stable_My_Elem]), > New_Rest_Matrix = lists:delete(My_Elem, Rest_Matrix), > New_It_List = lists:append(It_List,[My_Name]), > My_Children = get_children(New_It_List, Matrix, My_Name), > if > length(New_Rest_Matrix) > 0 -> > if > length(My_Children) > 0 -> > [Next_Child|Other_Children] = My_Children, > {New_New_Stable_Matrix, New_New_Rest_Matrix, New_New_It_List} = do_init(Next_Child, New_Path, New_Stable_Matrix, New_Rest_Matrix, Matrix, New_It_List, Other_Children); > true -> > New_New_Stable_Matrix = New_Stable_Matrix, > New_New_Rest_Matrix = New_Rest_Matrix, > New_New_It_List = New_It_List > end, > if > length(My_Brothers) > 0 -> > [Next_Brother|Other_Brothers] = My_Brothers, > {New_New_New_Stable_Matrix, New_New_New_Rest_Matrix, New_New_New_It_List} = do_init(Next_Brother, Path, New_New_Stable_Matrix, New_New_Rest_Matrix, Matrix, New_New_It_List, Other_Brothers); > true -> > New_New_New_Stable_Matrix = New_New_Stable_Matrix, > New_New_New_Rest_Matrix = New_New_Rest_Matrix, > New_New_New_It_List = New_New_It_List > end, > {New_New_New_Stable_Matrix,New_New_New_Rest_Matrix,New_New_New_It_List}; > true -> > New_New_Stable_Matrix = lists:keysort(1,New_Stable_Matrix), > Return_Value = {New_It_List, New_New_Stable_Matrix}, > io:format("READ THIS!!!~p~n",[Return_Value]), > Return_Value > end. > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > get_children(Iterative_List, Matrix, Name)-> > Elem = get_elem(Name,Matrix), > {_, _, _, Neighbours, _, _} = Elem, > Raw_Neighbours = raw_neighbours(Neighbours,[]), > rip_neighbours(Raw_Neighbours,Iterative_List). > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > get_elem(Elem, Client_List)-> > [First|Rest] = Client_List, > {Name, _,_,_,_,_} = First, > if > Name == Elem -> > First; > true -> > get_elem(Elem, Rest) > end. > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > raw_neighbours([],Neighbours)-> > Neighbours; > raw_neighbours(Full_List,Neighbours)-> > [First|Rest] = Full_List, > {Name,_} = First, > New_Neighbours = lists:append(Neighbours,[Name]), > raw_neighbours(Rest,New_Neighbours). > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > rip_neighbours(Raw_Neighbours,[])-> > Raw_Neighbours; > rip_neighbours(Raw_Neighbours,Iterative_List)-> > [First|Rest] = Iterative_List, > Bool = lists:member(First, Raw_Neighbours), > if > First == root -> > New_Raw_Neighbours = Raw_Neighbours; > true -> > if > Bool -> > New_Raw_Neighbours = lists:delete(First, Raw_Neighbours); > true -> > New_Raw_Neighbours = Raw_Neighbours > end > end, > rip_neighbours(New_Raw_Neighbours,Rest). > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From tobbe@REDACTED Thu Nov 16 00:48:04 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 16 Nov 2006 00:48:04 +0100 Subject: [erlang-questions] Orber and NAT In-Reply-To: References: <20061113212118.P22538@olgeni.olgeni> Message-ID: Niclas Eklund skrev: > Hello! > > It will be supported in the next version of Orber, which will be released > as soon as some new stuff has been added to the SSL application. The goal > is to release Orber and SSL within a week or so. May I ask what new thing you're planning for SSL ? Would it be possible to have support for the {fd, Fd} option (as for gen_tcp) ? --Tobbe To get it going you need > to do the following: > > * Set the Orber environment flags for NAT and current interface. > > * Define {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]} and/or > {local, DefaultNATPort, [{Port, NATPort}]}. > > * Perhaps use IOP_ServiceContext containing the local interface. > > You will be able to read more in chapters Configuration, Firewall > Configuration and Interface Configuration. > > Using add_alternate_iiop_address isn't the way to go. Why? Because then > the IOR would contain both the NAT-address and the internal address. > > Best regards, > > Nick > > On Mon, 13 Nov 2006, Jimmy Olgeni wrote: >> Hello, >> >> Is there a way to make a Corba object visible _both_ on the local >> network and across NAT? Using the NAT flag in Orber seems to cut the >> local network out... Or is it a job for add_alternate_iiop_address? >> >> bye, >> jimmy >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions >> > > > From ok@REDACTED Thu Nov 16 03:27:54 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 16 Nov 2006 15:27:54 +1300 (NZDT) Subject: [erlang-questions] Erlang and autoconf/make Message-ID: <200611160227.kAG2RsVW311571@atlas.otago.ac.nz> Romain Lenglet wrote: > But I believed that pattern rules were a GNU Make'ism? Pupeno asked: Can any BSDer confirm this ? I don't run BSD on any of my machines. However, I *can* tell you that (1) On Alpha OSF V5.1, the manual page for 'make' mentions % in only two contexts: the shell prompt for sample commands and various NLS escapes in MANPATH. (2) I have an on-line copy of the Single Unix Specification, Version 3. The description of 'make' says "There are two types of rule: 1. Inference rules, which have one target name with at least one period ('.') and no slash ('/') 2. Target rules, which can have more than one target name." No pattern rules. In fact the rationale at the end says "Consideration was given to adding emtarules to the POSIX make. This would make %.o: %.c the same as .c.o:. This is quite useful and available from some vendors, but it would cause too many changes to this make to support,. It would have introduced rule chaining and new substitution rules. However, the rules for target names have been set to reserve the '%' and '"' characters. These are traditionally used to implement metarules and quoting of target names, respectively. Implementors are strongly encouraged to use these characters only for these purposes." If the Automake people didn't do their design with a copy of the SUS (or POSIX.2 or SVID or ...) in front of them, I will be very surprised. From pupeno@REDACTED Thu Nov 16 04:18:42 2006 From: pupeno@REDACTED (Pupeno) Date: Thu, 16 Nov 2006 03:18:42 +0000 Subject: [erlang-questions] Start me up. In-Reply-To: <200611160030.30281.rlenglet@users.forge.objectweb.org> References: <200611150616.17000.pupeno@pupeno.com> <200611151310.20312.pupeno@pupeno.com> <200611160030.30281.rlenglet@users.forge.objectweb.org> Message-ID: <200611160318.46135.pupeno@pupeno.com> On Wednesday 15 November 2006 15:30, you wrote: > Cf. the attached patch to your configure.ac. Thank you. > BTW, I am using Debian, where erl_call is symlinked in /usr/bin, Yes, I reported the issue on Debian... or actually, I think I made the fix myself (I am a member of the erlang-pkg group in berlios) :) -- Pupeno (http://pupeno.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlenglet@REDACTED Thu Nov 16 05:39:18 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 16 Nov 2006 13:39:18 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611160227.kAG2RsVW311571@atlas.otago.ac.nz> References: <200611160227.kAG2RsVW311571@atlas.otago.ac.nz> Message-ID: <200611161339.18875.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: > Romain Lenglet wrote: > > But I believed that pattern rules were a GNU Make'ism? > > Pupeno asked: > Can any BSDer confirm this ? > > I don't run BSD on any of my machines. I have installed NetBSD make (pmake) on Debian (package pmake): it supports pattern rules. I have also found a FreeBSD 6.1 box here: its make does *NOT* support pattern rules. And by the way, even when using implicit rules, the syntax: SUFFIXES = .erl .beam is *NOT* supported by FreeBSD make. One must use: .SUFFIXES: .erl .beam This syntax is supported by GNU make, pmake and FreeBSD make. Therefore, I strongly suggest to not use pattern rules, and to use implicit rules instead, such as: .SUFFIXES: .erl .beam .rel .script .boot .erl.beam: $(ERLC) $(ERLCFLAGS) -b beam $< .rel.script: $(ERLC) $(ERLCFLAGS) -b beam $< .rel.boot: $(ERLC) $(ERLCFLAGS) -b beam $< > However, I *can* tell you that > (1) On Alpha OSF V5.1, the manual page for 'make' mentions % > in only two contexts: the shell prompt for sample commands > and various NLS escapes in MANPATH. > (2) I have an on-line copy of the Single Unix Specification, > Version 3. The description of 'make' says "There are two types > of rule: 1. Inference rules, which have one target name with > at least one period ('.') and no slash ('/') > 2. Target rules, which can have more than one target name." > No pattern rules. In fact the rationale at the end says > "Consideration was given to adding emtarules to the > POSIX make. This would make %.o: %.c the same as .c.o:. This > is quite useful and available from some vendors, but it would > cause too many changes to this make to support,. It would > have introduced rule chaining and new substitution rules. > However, the rules for target names have been set to reserve > the '%' and '"' characters. These are traditionally used to > implement metarules and quoting of target names, respectively. > Implementors are strongly encouraged to use these characters > only for these purposes." Thanks for the information! > If the Automake people didn't do their design with a copy of > the SUS (or POSIX.2 or SVID or ...) in front of them, I will > be very surprised. Yes, Automake generates Makefiles that are portable and can be interpreted by any make. It lets one write some GNU-specific extensions, like pattern rules, or the use of $< and $@ in explicit rules, but that is the coder's responsibility then if the Makefile is not portable. The only GNU-specific extension supported by Automake is the += affectations of variables, cf. the Automake manual: -8<------- Note that most GNU make extensions are not recognized by Automake. Using such extensions in a Makefile.am will lead to errors or confusing behavior. A special exception is that the GNU make append operator, +=, is supported. This operator appends its right hand argument to the variable specified on the left. Automake will translate the operator into an ordinary = operator; += will thus work with any make program. -8<------- Regards, -- Romain LENGLET From jaiswal.vikash@REDACTED Thu Nov 16 07:48:39 2006 From: jaiswal.vikash@REDACTED (jaiswal.vikash@REDACTED) Date: Thu, 16 Nov 2006 12:18:39 +0530 Subject: [erlang-questions] problem with epmd process of erlang Message-ID: Hello , I'm facing a problem with epmd process of erlang . From one node ( A ) when I'm spawning a process on second node ( B ), most of the time the process on second node is getting spawned . But in some occasions the process on second node ( B ) is not getting spawned at all . I am not able to establish any connection between the nodes A and B . At this point I'm getting an error " PORT2_RESP(error) " for the second node's ( B ) process ( This I can see by running the epmd process in debug mode ) . Now if do init 3 followed by init 4 , the problem gets solved . Can anyone suggest as to why the error comes up and why does it come up only once in a while ? Also , is there any solution other then doing init 3 and init 4 on the system ? Here I would like to add that the above scenario holds only when the two nodes ( A and B ) are running on the same system . This problem NEVER occurs when the two nodes are on two different system . I'm using the following : Linux : RHEL 4 ( kernel 2.6.16.13 ) Erlang : Version 5.3.6.3 Regards , Vikash The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From joost.damad@REDACTED Thu Nov 16 08:12:41 2006 From: joost.damad@REDACTED (Joost Yervante Damad) Date: Thu, 16 Nov 2006 08:12:41 +0100 Subject: [erlang-questions] inet / active once Message-ID: <200611160812.42167.joost.damad@siemens.com> Hi, recently I've been playing with the erlang programming language, and I like it. I wrote a few test servers, and I especially like the inet active once mechanism for having automatically framed messages, even over a TCP connection, in combination with the {packet, PacketType} option. Yesterday, I wanted to try something more heavy and implement a simple DIAMETER stack, however it's header format does not match any of the existing packet types available, because it has a header like this: byte1: version byte2-4: packet length I did some digging in the OTP code and it seems the packet types are implemented in inet_drv.c. I see now two possibilities, either I expand inet_drv.c to have a new package type, or I use {active, false}, and implemented the message framing in erlang. Is there another possibilty? What is the recommended aproach? Greetings, Joost Damad From rlenglet@REDACTED Thu Nov 16 08:39:58 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 16 Nov 2006 16:39:58 +0900 Subject: [erlang-questions] Erlang and autoconf/make In-Reply-To: <200611161339.18875.rlenglet@users.forge.objectweb.org> References: <200611160227.kAG2RsVW311571@atlas.otago.ac.nz> <200611161339.18875.rlenglet@users.forge.objectweb.org> Message-ID: <200611161639.58522.rlenglet@users.forge.objectweb.org> Recently I wrote: [...] > And by the way, even when using implicit rules, the syntax: > SUFFIXES = .erl .beam > is *NOT* supported by FreeBSD make. > > One must use: > .SUFFIXES: .erl .beam > This syntax is supported by GNU make, pmake and FreeBSD make. Stupid me. Yes, in Makefiles, one must use a .SUFFIXES target. But in Makefile.am files, one must use a SUFFIXES variable! And then, automake generates a .SUFFIXES target from the content of the SUFFIXES variable defined in Makefile.am files. As a consequence, this is correct in a Makefile, but wrong in a Makefile.am: .SUFFIXES: .erl .beam .rel .script .boot And in a Makefile.am, one should really write: SUFFIXES = .erl .beam .rel .script .boot Sorry for the confusion. -- Romain LENGLET Pr. Chiba Shigeru Group Dept. of Mathematical and Computing Sciences Tokyo Institute of Technology From klacke@REDACTED Thu Nov 16 09:26:31 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 16 Nov 2006 09:26:31 +0100 Subject: [erlang-questions] inet / active once In-Reply-To: <200611160812.42167.joost.damad@siemens.com> References: <200611160812.42167.joost.damad@siemens.com> Message-ID: <455C20B7.10109@hyber.org> Joost Yervante Damad wrote: > Hi, > > recently I've been playing with the erlang programming language, and I like > it. I wrote a few test servers, and I especially like the inet active once > mechanism for having automatically framed messages, even over a TCP > connection, in combination with the {packet, PacketType} option. > > Yesterday, I wanted to try something more heavy and implement a simple > DIAMETER stack, however it's header format does not match any of the existing > packet types available, because it has a header like this: > > byte1: version > byte2-4: packet length > > I did some digging in the OTP code and it seems the packet types are > implemented in inet_drv.c. > > I see now two possibilities, either I expand inet_drv.c to have a new package > type, or I use {active, false}, and implemented the message framing in > erlang. > > Is there another possibilty? What is the recommended aproach? I'd recommend to first implement the whole thing without touching inet_drv.c Later - if you want to go ahead with the diameter impl. and use it in production and you _also_ have performance issues - then attack the inet_drv.c code. Several reasons 1. easy to get it wrong in inet_drv.c 2. You'll be in the air faster if you don't touch inet_drv.c 3. OTP crew may not want your inet_drv.c fixes /klacke From henri.tuhola@REDACTED Thu Nov 16 11:34:55 2006 From: henri.tuhola@REDACTED (Henri Tuhola) Date: Thu, 16 Nov 2006 12:34:55 +0200 Subject: [erlang-questions] Coloring variable bindings to lessen ambiguity. Message-ID: <20061116103455.GA5824@cheery-desktop> Hi. I noticed that it causes very odd consequences if you mistakenly interpret variable occurrence to variable binding, like. Lets take this kind of part: receive {Port, {data, Data}} -> ok end. You know what Data -variable does here? Right. Now lets add some more: Port ! {self(), {command, Data}, receive {Port, {data, Data}} -> ok end. You notice that your earlier line changes it's meaning in really fast pace. The code is ambiguous for human reader. There are few ways to solve this problem, I think that coloring the first occurrence of variable in scope by color editor would solve it all without any changes into the language! ie: first, when it'd be alone like this: fn(Port) -> receive {Port, {data, Data}} -> ok end. Would cause the occurence of 'Data' on the second line to be colorised, thus 'Port' on the first line. Now when you'd add this: fn(Port) -> Data = 23, receive {Port, {data, Data}} -> ok end. 'Data' right after the first arrow would be coloured and the latter variable would be white. Benefit is that you'd clearly see whether Data is referenced or bound! It'd require the text editor to understand the language scope, how hard this can be? T: Henri Tuhola. From vladdu55@REDACTED Thu Nov 16 12:03:48 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 16 Nov 2006 12:03:48 +0100 Subject: [erlang-questions] Coloring variable bindings to lessen ambiguity. In-Reply-To: <20061116103455.GA5824@cheery-desktop> References: <20061116103455.GA5824@cheery-desktop> Message-ID: <95be1d3b0611160303j2e3c4fbara21951caa42c1848@mail.gmail.com> Hi, On 11/16/06, Henri Tuhola wrote: > There are few ways to solve this problem, I think that coloring the > first occurrence of variable in scope by color editor would solve it all > without any changes into the language! ... > It'd require the text editor to understand the language scope, how hard > this can be? I guess it depends what editor we are talking about :-) VIM (and the like) can't handle this. Emacs and Erlide could. I would guess that it wouldn't be too difficult to add support for this in ESense (because it already has a lot of nifty ways to understand the code). Starting from scratch is probably not worth it unless one has a broader goal in view. In Erlide it would be relatively easy to add such a finesse. The only issue is that such "semantic highlights" should be handled separately from the regular highlighting and thus have to be plugged in somehow. If you would like to add this as a feature request for erlide (go to http://sourceforge.net/tracker/?func=add&group_id=58889&atid=489194), I will definitely look at it but I can't promise any time frame (or maybe there are other takers?) best regards, Vlad From vipin@REDACTED Thu Nov 16 15:08:06 2006 From: vipin@REDACTED (vipin) Date: Thu, 16 Nov 2006 19:38:06 +0530 Subject: [erlang-questions] Erlang node communicating to mysql node. Message-ID: <455C70C6.8000908@picopeta.com> Hi, We are facing a peculiar problem when an erlang node is inserting data to a remote mysql database. The Mysql table has the following schema:- id INT(10) contents BLOB The contents field contains binary data/images. We connect to the mysql database using mysql:connect/7 and when the binary data has to be sent we use mysql:fetch/2. Now, when the binary data is large (even 4K is too large) then the transaction does not complete! Could someone provide some valuable insights as to how to solve this? warm regards, Vipin Puri From per@REDACTED Fri Nov 17 01:45:17 2006 From: per@REDACTED (Per Hedeland) Date: Fri, 17 Nov 2006 01:45:17 +0100 (CET) Subject: [erlang-questions] inet / active once In-Reply-To: <200611160812.42167.joost.damad@siemens.com> Message-ID: <200611170045.kAH0jHRF045931@pluto.hedeland.org> Joost Yervante Damad wrote: > >recently I've been playing with the erlang programming language, and I like >it. I wrote a few test servers, and I especially like the inet active once >mechanism for having automatically framed messages, even over a TCP >connection, in combination with the {packet, PacketType} option. Hm, {packet, PacketType} provides framing, but this is orthogonal to {active, false|once|true} - i.e you can have framing (if inet_drv supports the framing you need) in any of those modes. >I see now two possibilities, either I expand inet_drv.c to have a new package >type, or I use {active, false}, and implemented the message framing in >erlang. > >Is there another possibilty? What is the recommended aproach? I'd agree with Klacke, don't touch inet_drv until you're sure that you need to.:-) Also, read carefully the documentation for gen_tcp:recv() to see how the semantics differ from Unix/Posix recv()/read(), which makes it much more convenient to "implement" the framing in Erlang. I.e. you recv() as many bytes as you need to find the length of the message, then recv() that many bytes - you never get less than you asked for, and inet_drv and the I/O system handles the buffering and (non-)blocking/polling for you. --Per Hedeland From joost.damad@REDACTED Fri Nov 17 08:39:43 2006 From: joost.damad@REDACTED (Joost Yervante Damad) Date: Fri, 17 Nov 2006 08:39:43 +0100 Subject: [erlang-questions] inet / active once In-Reply-To: <200611170045.kAH0jHRF045931@pluto.hedeland.org> References: <200611170045.kAH0jHRF045931@pluto.hedeland.org> Message-ID: <200611170839.43538.joost.damad@siemens.com> On Friday 17 November 2006 01:45, Per Hedeland wrote: > I'd agree with Klacke, don't touch inet_drv until you're sure that you > need to.:-) Also, read carefully the documentation for gen_tcp:recv() to > see how the semantics differ from Unix/Posix recv()/read(), which makes > it much more convenient to "implement" the framing in Erlang. I.e. you > recv() as many bytes as you need to find the length of the message, then > recv() that many bytes - you never get less than you asked for, and > inet_drv and the I/O system handles the buffering and > (non-)blocking/polling for you. Oh! I overlooked that. This simplifies things alot indeed! I guess I'll throw away my current overly complex framing code, and use recv/2. Thanks, Joost From sanjaya@REDACTED Fri Nov 17 12:36:02 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Fri, 17 Nov 2006 17:06:02 +0530 Subject: [erlang-questions] http:request - {autoredirect, true} with HTTP 302 Message-ID: <00fe01c70a3c$91c06890$9a0810ac@wavenet.lk> Hi How the HTTP Error Code 302, should work with {autoredirect,true} in erlang http:request .... ??? I have expected to reach the final destination with {autoredirect,true}. But it stops in a half way with empty result when HTTP Error Code 302 comes. Regards, Sanjaya Vitharana [wavenet1@REDACTED wavenet1]$ links -source "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1" http://203.115.0.73/cf/sc1/_menu/answer.php a1163751629114526000 1> URL="http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1". "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1" 18> http:request(get, {URL, []}, [{timeout, 10000},{autoredirect,true}],[]). {ok,{{"HTTP/1.1",302,"Found"}, [{"cache-control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"}, {"connection","Keep-Alive"}, {"date","Fri, 17 Nov 2006 08:44:25 GMT"}, {"pragma","no-cache"}, {"location", "http://203.115.0.73/cf/sc1/_menu/index.php?cli=114526000&session=a1163753065114526000&serverid=1"}, {"server","Apache/2.0.54 (Unix) PHP/5.0.3"}, {"content-length","0"}, {"content-type","text/html"}, {"expires","Thu, 19 Nov 1981 08:52:00 GMT"}, {"x-powered-by","PHP/5.0.3"}, {"set-cookie","PHPSESSID=a1163753065114526000; path=/"}, {"keep-alive","timeout=15, max=100"}], []}} 19> -------------- next part -------------- An HTML attachment was scrubbed... URL: From pupeno@REDACTED Fri Nov 17 13:10:38 2006 From: pupeno@REDACTED (Pupeno) Date: Fri, 17 Nov 2006 12:10:38 +0000 Subject: [erlang-questions] Start me up. In-Reply-To: <200611151700.35586.rlenglet@users.forge.objectweb.org> References: <200611150616.17000.pupeno@pupeno.com> <200611151649.38816.rlenglet@users.forge.objectweb.org> <200611151700.35586.rlenglet@users.forge.objectweb.org> Message-ID: <200611171210.59365.pupeno@pupeno.com> With all this config [1] it makes sense when one installs on /usr/local (it uses /usr/local/etc, /usr/local/var, /usr/local/bin) but when installing on /usr it doesn't make much sense because it uses /usr/etc, /usr/var [2]. Is this ok ? is this a correct default ? On Wednesday 15 November 2006 08:00, Romain Lenglet wrote: > I just wrote: > [...] > > > However, I have attached better versions of your files. > > [...] > > But there was a bug in the Makefile.am I have just sent: > CONFIG_FILE should be CONFIGFILE > > I have attached a corrected file. -- Pupeno (http://pupeno.com) [1] The end result is http://software.pupeno.com/FanterlasticFour/configure.ac and http://software.pupeno.com/FanterlasticFour/script/Makefile.am [2] Actually, I'd say it's Unix that doesn't make sense here, and I can quote myself "/usr is obsolete [...] time to get rid of /usr forever!! throw it to the trash can!!"[3], but let's not go there now. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rlenglet@REDACTED Fri Nov 17 13:33:33 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 17 Nov 2006 21:33:33 +0900 Subject: [erlang-questions] Start me up. In-Reply-To: <200611171210.59365.pupeno@pupeno.com> References: <200611150616.17000.pupeno@pupeno.com> <200611151700.35586.rlenglet@users.forge.objectweb.org> <200611171210.59365.pupeno@pupeno.com> Message-ID: <200611172133.34932.rlenglet@users.forge.objectweb.org> Pupeno wrote: > With all this config [1] it makes sense when one installs on > /usr/local (it uses /usr/local/etc, /usr/local/var, > /usr/local/bin) but when installing on /usr it doesn't make > much sense because it uses /usr/etc, /usr/var [2]. Is this ok > ? is this a correct default ? Yes, it is the correct default. If one is installing in the top directories, e.g. one creates a Debian package, it seems to be considered a special case. You should do nothing special in your configure.ac or Makefile.am, to take that special case into account. Users/packagers must call configure like that: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var As you noted, this problem concerns only the sysconfdir and localstatedir variables. I just checked in the Autoconf implementation that no other variable is concerned. Regards, -- Romain LENGLET From nick@REDACTED Fri Nov 17 13:41:31 2006 From: nick@REDACTED (Niclas Eklund) Date: Fri, 17 Nov 2006 13:41:31 +0100 (MET) Subject: [erlang-questions] Orber and NAT In-Reply-To: Message-ID: Hello! To allow the user to split SSL accept action into two (transport and handshake). Adding {fd, Fd} would require quite a few changes, which is why that option will not be included in the next SSL version. /Nick On Thu, 16 Nov 2006, Torbjorn Tornkvist wrote: > Niclas Eklund skrev: > > Hello! > > > > It will be supported in the next version of Orber, which will be released > > as soon as some new stuff has been added to the SSL application. The goal > > is to release Orber and SSL within a week or so. > > May I ask what new thing you're planning for SSL ? > Would it be possible to have support for the {fd, Fd} > option (as for gen_tcp) ? > > --Tobbe > > To get it going you need > > to do the following: > > > > * Set the Orber environment flags for NAT and current interface. > > > > * Define {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]} and/or > > {local, DefaultNATPort, [{Port, NATPort}]}. > > > > * Perhaps use IOP_ServiceContext containing the local interface. > > > > You will be able to read more in chapters Configuration, Firewall > > Configuration and Interface Configuration. > > > > Using add_alternate_iiop_address isn't the way to go. Why? Because then > > the IOR would contain both the NAT-address and the internal address. > > > > Best regards, > > > > Nick > > > > On Mon, 13 Nov 2006, Jimmy Olgeni wrote: > >> Hello, > >> > >> Is there a way to make a Corba object visible _both_ on the local > >> network and across NAT? Using the NAT flag in Orber seems to cut the > >> local network out... Or is it a job for add_alternate_iiop_address? > >> > >> bye, > >> jimmy > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://www.erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From yerl@REDACTED Fri Nov 17 15:21:07 2006 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 17 Nov 2006 15:21:07 +0100 Subject: [erlang-questions] TrapExit is very slow Message-ID: An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Fri Nov 17 16:46:34 2006 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Fri, 17 Nov 2006 23:46:34 +0800 Subject: [erlang-questions] How to wrap a function of any arity Message-ID: I would like to wrap a function into another which send the the result of the inner function to some external process. Let say I have a function called "compute" and a log process "logger": I want to create a new function with something like: Log_compute = wrap_fun(compute, logger). wrap_fun(Fun, Pid) -> fun(AllArgs) -> Res = Fun(AllArgs), Pid ! Res end. But I don't know how to do that with a function of any arity (the code above work only for function of arity 1). Is this do-able? if not, how should I do? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Fri Nov 17 17:24:23 2006 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Sat, 18 Nov 2006 00:24:23 +0800 Subject: [erlang-questions] How to wrap a function of any arity In-Reply-To: <290b3ba10611170805w61376032hcfec15040f8caad4@mail.gmail.com> References: <290b3ba10611170805w61376032hcfec15040f8caad4@mail.gmail.com> Message-ID: Sorry I did not give a good explanation of what I try to do. I would like to write the function "wrap_fun" so that I can call it with different inner functions. Let say I have different functions: compute_one/1 compute_two/2 I would like to be able to write: Log_compute_one = wrap_fun(compute_one, logger), Log_compute_two = wrap_fun(compute_two, logger). On 11/18/06, t ty wrote: > > Unfortunately I'm not very sure what you need. You can always encode > all the params into a list also funs can also take multi params > > wrap_fun(Fun, Pid) -> > fun(One, Two, Three) -> > Res = Fun(One, Two, Three) > Pid ! Res > end. > > t > > On 11/17/06, Ludovic Coquelle wrote: > > I would like to wrap a function into another which send the the result > of > > the inner function to some external process. > > Let say I have a function called "compute" and a log process "logger": I > > want to create a new function with something like: > > > > Log_compute = wrap_fun(compute, logger). > > > > wrap_fun(Fun, Pid) -> > > fun(AllArgs) -> > > Res = Fun(AllArgs), > > Pid ! Res > > end. > > > > But I don't know how to do that with a function of any arity (the code > above > > work only for function of arity 1). > > Is this do-able? if not, how should I do? > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Fri Nov 17 17:23:35 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Fri, 17 Nov 2006 17:23:35 +0100 Subject: [erlang-questions] How to wrap a function of any arity In-Reply-To: Message-ID: Instead of passing the function name, pass a fun: Log_compute = wrap_fun(fun() -> compute(AllArgs) end, logger). wrap_fun(Fun, Pid) -> Res = Fun(), Pid ! Res. The fun acts as a "closure" and inherits the state from its surroundings. It can fully encapsulate the data needed, so there is no need for any arguments. (The example now feels a bit contrived, but perhaps you get the point anyway?) BR, Ulf W ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Ludovic Coquelle Sent: den 17 november 2006 16:47 To: erlang-questions@REDACTED Subject: [erlang-questions] How to wrap a function of any arity I would like to wrap a function into another which send the the result of the inner function to some external process. Let say I have a function called "compute" and a log process "logger": I want to create a new function with something like: Log_compute = wrap_fun(compute, logger). wrap_fun(Fun, Pid) -> fun(AllArgs) -> Res = Fun(AllArgs), Pid ! Res end. But I don't know how to do that with a function of any arity (the code above work only for function of arity 1). Is this do-able? if not, how should I do? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lcoquelle@REDACTED Fri Nov 17 17:32:40 2006 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Sat, 18 Nov 2006 00:32:40 +0800 Subject: [erlang-questions] How to wrap a function of any arity In-Reply-To: References: Message-ID: Ok, that's what I do for now, but it doesn't really fit my need: I do not know the arguments at the time to wrap the function. I wanted to first wrap the function and then apply the resulting wrapped function with different arguments. The idea was to propose an API which get any function from an external module, and transform it (wrap) in another kind of function that I can use in my framework. Anyway, if it is not possible I will revise my design. Thanks On 11/18/06, Ulf Wiger (TN/EAB) wrote: > > > Instead of passing the function name, pass a fun: > > Log_compute = wrap_fun(fun() -> compute(AllArgs) end, logger). > > wrap_fun(Fun, Pid) -> > Res = Fun(), > Pid ! Res. > > The fun acts as a "closure" and inherits the state from its surroundings. > It can fully encapsulate the data needed, so there is no need for any > arguments. > > (The example now feels a bit contrived, but perhaps you get the point > anyway?) > > BR, > Ulf W > > ------------------------------ > *From:* erlang-questions-bounces@REDACTED [mailto: > erlang-questions-bounces@REDACTED] *On Behalf Of *Ludovic Coquelle > *Sent:* den 17 november 2006 16:47 > *To:* erlang-questions@REDACTED > *Subject:* [erlang-questions] How to wrap a function of any arity > > I would like to wrap a function into another which send the the result of > the inner function to some external process. > Let say I have a function called "compute" and a log process "logger": I > want to create a new function with something like: > > Log_compute = wrap_fun(compute, logger). > > wrap_fun(Fun, Pid) -> > fun(AllArgs) -> > Res = Fun(AllArgs), > Pid ! Res > end. > > But I don't know how to do that with a function of any arity (the code > above work only for function of arity 1). > Is this do-able? if not, how should I do? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kalap.kabat@REDACTED Fri Nov 17 17:48:57 2006 From: kalap.kabat@REDACTED (user) Date: Fri, 17 Nov 2006 16:48:57 +0000 (UTC) Subject: [erlang-questions] =?utf-8?q?Coloring_variable_bindings_to_lessen?= =?utf-8?q?=09ambiguity=2E?= References: <20061116103455.GA5824@cheery-desktop> <95be1d3b0611160303j2e3c4fbara21951caa42c1848@mail.gmail.com> Message-ID: Vlad Dumitrescu gmail.com> writes: > > Hi, > > On 11/16/06, Henri Tuhola gmail.com> wrote: > > There are few ways to solve this problem, I think that coloring the > > first occurrence of variable in scope by color editor would solve it all > > without any changes into the language! > ... > > It'd require the text editor to understand the language scope, how hard > > this can be? > > I guess it depends what editor we are talking about VIM (and the > like) can't handle this. Emacs and Erlide could. With quick hack it can be done with Emacs using only the standard erlang mode. Here's a naive implementation. It can be fooled by funs within the function if the fun binds variables which shadow other variables bound in the outer function, but it's bad programming practice anyway. Copy this code into your emacs *before* erlang stuff is loaded (so that the erlang-load-hook is run) and off you go: (require 'cl) (defface my-bound-var-face '((t (:background "yellow"))) "") (defun my-erlang-highlight-bound-vars (limit) (when (re-search-forward (concat "[^?]\\(\\<" erlang-variable-regexp "\\>\\)") limit t) (if (or (eq (get-text-property (point) 'face) 'font-lock-comment-face) (eq (get-text-property (point) 'face) 'font-lock-string-face) (save-match-data (let ((var (match-string 1)) (pos (point))) (save-excursion (erlang-beginning-of-clause) (re-search-forward (concat "[^?]\\(\\<" var "\\>\\)") limit t) (> pos (point)))))) (set-match-data (list 0 0))) t)) (defun my-erlang-highlight-setup (font-lock-add-keywords 'erlang-mode '((my-erlang-highlight-bound-vars . (1 'my-bound-var-face t t))) t)) (add-hook 'erlang-load-hook 'my-erlang-highlight-setup) From nm@REDACTED Fri Nov 17 22:31:14 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sat, 18 Nov 2006 01:31:14 +0400 Subject: [erlang-questions] How to wrap a function of any arity In-Reply-To: References: Message-ID: <455E2A22.3070801@web.am> Ludovic Coquelle wrote: > Sorry I did not give a good explanation of what I try to do. I would > like to > write the function "wrap_fun" so that I can call it with different inner > functions. Let say I have different functions: > compute_one/1 > compute_two/2 > I would like to be able to write: > Log_compute_one = wrap_fun(compute_one, logger), > Log_compute_two = wrap_fun(compute_two, logger). > you can test function arity and wrap it in a different ways. 2> F = fun(X) -> ok end. #Fun 3> is_function(F). true 4> is_function(F, 1). true 5> is_function(F, 2). false so your code should look like this: wrap_fun(Fun, Pid) -> case Fun of Fun when is_function(Fun, 1) -> fun(AllArgs) -> Res = Fun(AllArgs), Pid ! Res end; Fun when is_function(Fun, 2) -> fun(X, X1) -> Res = Fun(X, X1), Pid ! Res end; ... end. This is a little bit ugly, but should work. In other hand, if you use functions with arity > 10 - I think it's better to fix programming style, than write wrapper function to any arity. Usually most of that arguments should be packet in a some State record/tuple. > > On 11/18/06, t ty wrote: >> >> Unfortunately I'm not very sure what you need. You can always encode >> all the params into a list also funs can also take multi params >> >> wrap_fun(Fun, Pid) -> >> fun(One, Two, Three) -> >> Res = Fun(One, Two, Three) >> Pid ! Res >> end. >> >> t >> >> On 11/17/06, Ludovic Coquelle wrote: >> > I would like to wrap a function into another which send the the result >> of >> > the inner function to some external process. >> > Let say I have a function called "compute" and a log process >> "logger": I >> > want to create a new function with something like: >> > >> > Log_compute = wrap_fun(compute, logger). >> > >> > wrap_fun(Fun, Pid) -> >> > fun(AllArgs) -> >> > Res = Fun(AllArgs), >> > Pid ! Res >> > end. >> > >> > But I don't know how to do that with a function of any arity (the code >> above >> > work only for function of arity 1). >> > Is this do-able? if not, how should I do? >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://www.erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From vladdu55@REDACTED Fri Nov 17 23:30:27 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 17 Nov 2006 22:30:27 +0000 Subject: [erlang-questions] How to wrap a function of any arity In-Reply-To: <455E2A22.3070801@web.am> References: <455E2A22.3070801@web.am> Message-ID: <95be1d3b0611171430o1ede8915hcd67fefdd7052b7a@mail.gmail.com> Hi, On 11/17/06, Gaspar Chilingarov wrote: > you can test function arity and wrap it in a different ways. > 2> F = fun(X) -> ok end. > #Fun > 3> is_function(F). > true > 4> is_function(F, 1). > true > 5> is_function(F, 2). > false Or one can wrap all arguments in a list and use apply(Fun, Args) instead of Fun(Args). best regards, Vlad From andyk@REDACTED Sat Nov 18 00:01:11 2006 From: andyk@REDACTED (Andy Khan) Date: Fri, 17 Nov 2006 23:01:11 +0000 Subject: [erlang-questions] Passing arguments to erlang from the command line Message-ID: <200611172301.11644.andyk@andykhan.freeserve.co.uk> Hi, I'm playing with the pingpong example in the tutorial, and I'm trying to launch the ping process directly from the command line. When I run the program as follows: >erl -sname ping -run pingpong start_ping pong@REDACTED I get the following output: =ERROR REPORT==== 17-Nov-2006::16:55:37 === Error in process <0.34.0> on node 'ping@REDACTED' with exit value: {badarg,[{pingpong,ping,2}]} However, if I first start the erlang shell and then invoke the start_ping method, everying works fine: >erl -sname ping Eshell V5.5.2 (abort with ^G) (ping@REDACTED)1> pingpong:start_ping(pong@REDACTED). I must be missing something about passing arguments from the command line (I've shown my hacked about version of the ping code below). Can anybody help? Regards Andy ping(N, Pong_Node) -> {pong, Pong_Node} ! {ping, self()}, io:format("ping waiting for input~n", []), receive pong -> io:format("Ping received pong~n", []) end, ping(N - 1, Pong_Node). start_ping(Pong_Node) -> spawn(pingpong, ping, [3, Pong_Node]). From jahakala@REDACTED Sat Nov 18 01:33:59 2006 From: jahakala@REDACTED (Jani Hakala) Date: Sat, 18 Nov 2006 02:33:59 +0200 Subject: [erlang-questions] Passing arguments to erlang from the command line In-Reply-To: <200611172301.11644.andyk@andykhan.freeserve.co.uk> (Andy Khan's message of "Fri\, 17 Nov 2006 23\:01\:11 +0000") References: <200611172301.11644.andyk@andykhan.freeserve.co.uk> Message-ID: <87lkm9r3t4.fsf@pingviini.kortex.jyu.fi> Andy Khan writes: > Hi, > > I'm playing with the pingpong example in the tutorial, and I'm trying to > launch the ping process directly from the command line. When I run the > program as follows: > >>erl -sname ping -run pingpong start_ping pong@REDACTED > >From the erl man page: -run Mod [Func [Arg1, Arg2, ...]] (init flag): Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1, Arg2, ...] as argument. All arguments are passed as strings. See init(3). So pong@REDACTED ends up being a string. How about using -eval "pingpong:start_ping(pong@REDACTED)" Jani Hakala From surindar.shanthi@REDACTED Sat Nov 18 09:26:46 2006 From: surindar.shanthi@REDACTED (Surindar Sivanesan) Date: Sat, 18 Nov 2006 13:56:46 +0530 Subject: [erlang-questions] tracing process in a file In-Reply-To: <455B2966.1010301@ericsson.com> References: <42ea5fb60611092235u85d105frd63634b516dee138@mail.gmail.com> <455B2966.1010301@ericsson.com> Message-ID: <42ea5fb60611180026l26d47b56neefdc8414a6d64c6@mail.gmail.com> Thanks a lot for your suggestion Bengt. I'll try your suggestion On 11/15/06, Bengt Kleberg wrote: > > On 2006-11-10 07:35, Surindar Sivanesan wrote: > > > > Dear all, > > I would like to trace a process to a file when it starts at the > background. > > Which module can help in achieving the above. > > i never saw an answer to this question, so here is my suggestion: > > dbg:tracer( process, fun(P, {fun{ok, Pid}) -> io:fwrite(Pid, "~p", [P]), > {ok, Pid} end}, file:open( "afile", [write] )} ) > > the you should be able to do > dbg:tp(your_module, []). > > or have a look at the dbg module for better granularity of traceing. > > > bengt > -- > EPO guidelines 1978: "If the contribution to the known art resides > solely in a computer program then the subject matter is not > patentable in whatever manner it may be presented in the claims." > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- with regards, S.Surindar -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrickerj@REDACTED Sat Nov 18 23:15:44 2006 From: patrickerj@REDACTED (Pat e) Date: Sat, 18 Nov 2006 23:15:44 +0100 Subject: [erlang-questions] OpenBGPD Erlang alternative Message-ID: Hi, I just wanted to ask if there is an Erlang alternative to OpenBGPD routing software? Erlang should be good at this, right?? ;) Why im asking this is becouse we will be putting 4 to 5 PoP's accross the world (EU, US, Asia, South America) and instead of using InterNAP/Avaya(RouteScience) hardware it would be much cheaper to take several AMD powered blades and cut those 250-500K$ to 50-100K$ in cost. Erricson guy's/gal's what do you say?? Thanks. :) From patrickerj@REDACTED Sat Nov 18 23:17:50 2006 From: patrickerj@REDACTED (Pat e) Date: Sat, 18 Nov 2006 23:17:50 +0100 Subject: [erlang-questions] OpenBGPD Erlang alternative In-Reply-To: References: Message-ID: Sorry, Ericsson gal's/guy's :) On 11/18/06, Pat e wrote: Hi, I just wanted to ask if there is an Erlang alternative to OpenBGPD routing software? > > Erlang should be good at this, right?? ;) > > Why im asking this is becouse we will be putting 4 to 5 PoP's accross > the world (EU, US, Asia, South America) and instead of using > InterNAP/Avaya(RouteScience) hardware it would be much cheaper to take > several AMD powered blades and cut those 250-500K$ to 50-100K$ in > cost. > > Erricson guy's/gal's what do you say?? > > Thanks. :) > From ulf@REDACTED Sun Nov 19 00:26:55 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 19 Nov 2006 00:26:55 +0100 Subject: [erlang-questions] OpenBGPD Erlang alternative In-Reply-To: References: Message-ID: Den 2006-11-18 23:15:44 skrev Pat e : > Hi, > > I just wanted to ask if there is an Erlang alternative to OpenBGPD > routing software? Not that I know of. I'd recommend looking at Zebra, but it seems from the OpenBGPD testimonials, that many of their users think it's better than Zebra. > Erlang should be good at this, right?? ;) Well, some of it, but I believe that a lot of the heavy work lies in stuff like longest-prefix match processing, which is not that easy to do efficiently in erlang. BR, Ulf W -- Ulf Wiger From tomas.abrahamsson@REDACTED Sun Nov 19 16:47:51 2006 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Sun, 19 Nov 2006 16:47:51 +0100 Subject: [erlang-questions] OpenBGPD Erlang alternative In-Reply-To: References: Message-ID: > > I just wanted to ask if there is an Erlang alternative to OpenBGPD > > routing software? [...] > > Erlang should be good at this, right?? ;) > > Well, some of it, but I believe that a lot of the heavy work > lies in stuff like longest-prefix match processing, which > is not that easy to do efficiently in erlang. On the topic of routing algorithms and data structures, there's an interesting paper on TRASH (LC-trie + hash) at http://www.csc.kth.se/~snilsson/public/papers/trash/ BRs Tomas From ulf@REDACTED Sun Nov 19 22:29:52 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 19 Nov 2006 22:29:52 +0100 Subject: [erlang-questions] max_heap_size option Message-ID: erlang:spawn_opt() has a 'min_heap_size' option for performance tuning. This has turned out to be very useful in practice, esp. in cases where you know that a process is going to need a big heap fairly quickly. How about adding a 'max_heap_size' option? I just finished adding memory supervision to erlhive. In erlhive, it's doable, since I'm doing code transformations anyway, but it obviously adds overhead, since it's done in Erlang code. I haven't studied the C code to figure out how it could be implemented. Perhaps doing a check once GC is finished, and throwing an exception if the limit is exceeded, would be simplest? BR, Ulf W -- Ulf Wiger From lcoquelle@REDACTED Mon Nov 20 01:26:26 2006 From: lcoquelle@REDACTED (Ludovic Coquelle) Date: Mon, 20 Nov 2006 08:26:26 +0800 Subject: [erlang-questions] Accumulator and recursion Message-ID: Hi, Fairly simple questions about Erlang internal behavior... (I'm learning!) I have a function which store all the message she get: memoryloop(PidToSendResult, Memory) -> receive {store, Data} -> memoryloop(PidToSendResult, [Data|Memory]); stop -> PidToSendResult ! Memory end. I wonder: (1) will the (tail) recursion make a real copy (free/realloc) of data which doens't change? I mean if I have not only a Pid to pass but a big state configuration list, should I do the same way? (2) append an element to a list is supposed to create a new list from the previous list state adding the element. Again the same question: is it a real copy of all the data? any hiden optimization? if it is a real copy, is it another datastructure to use to implement my function "memoryloop" ? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From hokan.stenholm@REDACTED Mon Nov 20 02:07:28 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 20 Nov 2006 02:07:28 +0100 Subject: [erlang-questions] Accumulator and recursion In-Reply-To: References: Message-ID: <4560FFD0.3060506@bredband.net> Ludovic Coquelle wrote: > Hi, > Fairly simple questions about Erlang internal behavior... (I'm learning!) > > I have a function which store all the message she get: > memoryloop(PidToSendResult, Memory) -> > receive > {store, Data} -> memoryloop(PidToSendResult, [Data|Memory]); > stop -> PidToSendResult ! Memory > end. > > I wonder: > (1) will the (tail) recursion make a real copy (free/realloc) of data > which > doens't change? I mean if I have not only a Pid to pass but a big state > configuration list, should I do the same way? > (2) append an element to a list is supposed to create a new list from the > previous list state adding the element. Again the same question: is it a > real copy of all the data? No, only a partial list (containg the new elements) needs to be allocated internaly, as it is safe to point the tail of the new memory block, to the head of the old list - it's safe as erlang doesn't allow you to change the content of a "variable" like OldList - a variable is mearly a name/reference for a piece of unchanging data, not a editable memory area. This is how it works: ------------------- OldList = [1,2,3,4,5] | 1 | 2 | 3 | 4 | 5 | list in memory [*] ^------------------- / | | ----------------- | | | -------------- | NewList = [a,b,c | OldList] | | a | b | c | *--- memory allocated for NewList | -------------- | ------------ | -------- | NewList2 = [foo | OldList] | foo | *-- memory allocated for NewList2 -------- So buidling a "new" list is cheap if it is based on a previous one. Also note that several list may share parts of their content (elements/list sequences) with other terms or lists, which may allow you to save memory in some case. Note: passing data between processes may involve copying, especialy if its between different physical machines, local processes may not do this depending on which kind of memory/GC sheme you use/compile/start erlang with. [*] : this is actualy a linked list of pointers to erlang terms like; 1,2,a,foo, [1,23], {a,b,foo} > any hiden optimization? if it is a real copy, is > it another datastructure to use to implement my function "memoryloop" ? > > Thanks! > > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Mon Nov 20 02:28:46 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 20 Nov 2006 14:28:46 +1300 (NZDT) Subject: [erlang-questions] How to wrap a function of any arity Message-ID: <200611200128.kAK1SktB340438@atlas.otago.ac.nz> "Ludovic Coquelle" wrote: Sorry I did not give a good explanation of what I try to do. I would like to write the function "wrap_fun" so that I can call it with different inner functions. Let say I have different functions: compute_one/1 compute_two/2 I would like to be able to write: Log_compute_one = wrap_fun(compute_one, logger), Log_compute_two = wrap_fun(compute_two, logger). I'm sorry, but that makes me feel ill. Just because the Erlang *compiler* doesn't require types doesn't mean that an Erlang *designer* can ignore them. You could quite easily write wrap_fun/2 so that it *accepts* functions of any arity but delivers a function of one argument, a list: wrap_fun(Module, Name, Pid) -> fun (Argument_List) -> Pid ! apply(Module, Name, Argument_List) end. But it would be better to do something like wrap_fun0(F, P) -> fun () -> F() ! P end. wrap_fun1(F, P) -> fun (X1) -> F(X1) ! P end. ... wrap_fun9(F, P) -> fun (X1,X2,X3,X4,X5,X6,X7,X8,X9)->F(X1,X2,X3,X4,X5,X6,X7,X8,X9)!P end. and then write Log_compute_one = wrap_fun1(compute_one, logger), Log_compute_two = wrap_fun2(compute_two, logger). From ingela@REDACTED Mon Nov 20 09:08:43 2006 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 20 Nov 2006 09:08:43 +0100 Subject: [erlang-questions] http:request - {autoredirect, true} with HTTP 302 References: Message-ID: <17761.25227.357140.514567@gargle.gargle.HOWL> Hi ! The intention is that 302 (301, 303 and 307) should be redirected automatically only if the request method was get or head. (As in your case). The http client used to be too generous in its redirecting but unfortunately it seems when restricting it the 302 code became too restricted, that will be fixed for the next release. > Hi > > How the HTTP Error Code 302, should work with {autoredirect,true} in erlang http:request .... ??? > > I have expected to reach the final destination with {autoredirect,true}. But it stops in a half way with empty result when HTTP Error Code 302 comes. > > Regards, > > Sanjaya Vitharana > > > [wavenet1@REDACTED wavenet1]$ links -source "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1" > > > > http://203.115.0.73/cf/sc1/_menu/answer.php > a1163751629114526000 > > > 1> URL="http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1". > "http://localhost/cf/ivr_test.php?cli=114526000|2421996,N/A&ch=6&serverid=1" > > > 18> http:request(get, {URL, []}, [{timeout, 10000},{autoredirect,true}],[]). > {ok,{{"HTTP/1.1",302,"Found"}, > [{"cache-control", > "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"}, > {"connection","Keep-Alive"}, > {"date","Fri, 17 Nov 2006 08:44:25 GMT"}, > {"pragma","no-cache"}, > {"location", > "http://203.115.0.73/cf/sc1/_menu/index.php?cli=114526000&session=a1163753065114526000&serverid=1"}, > {"server","Apache/2.0.54 (Unix) PHP/5.0.3"}, > {"content-length","0"}, > {"content-type","text/html"}, > {"expires","Thu, 19 Nov 1981 08:52:00 GMT"}, > {"x-powered-by","PHP/5.0.3"}, > {"set-cookie","PHPSESSID=a1163753065114526000; path=/"}, > {"keep-alive","timeout=15, max=100"}], > []}} > 19> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://www.erlang.org/pipermail/erlang-questions/attachments/20061117/9a7dec41/attachment-0001.html > > ------------------------------ > -- Ingela Ericsson AB - OTP team From dinesh.titanz@REDACTED Mon Nov 20 16:04:57 2006 From: dinesh.titanz@REDACTED (dinesh sundar) Date: Mon, 20 Nov 2006 20:34:57 +0530 Subject: [erlang-questions] help: fetching data from records at single instance Message-ID: <77e5015c0611200704o389f2ddeu30dd7aa6c59f5d27@mail.gmail.com> Hi all, I have created the record with three fields.and i have update the data in all the three fields .now i need to fetch all the data from the fields can i fetch this data from these fields at single instance i hav tried a lot but i could'nt do it exmple: -record(person,{name,phone,address}). so from the above record i need to fetch the name , phone and address at the single instance Thanx -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.hague@REDACTED Mon Nov 20 16:11:20 2006 From: james.hague@REDACTED (James Hague) Date: Mon, 20 Nov 2006 09:11:20 -0600 Subject: [erlang-questions] Easy way to tell of SMP is enabled Message-ID: How can I tell if SMP support is enabled for the emulator? I want to verify that I compiled it correctly for SMP support. From chsu79@REDACTED Mon Nov 20 17:38:26 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 20 Nov 2006 17:38:26 +0100 Subject: [erlang-questions] help: fetching data from records at single instance In-Reply-To: <77e5015c0611200704o389f2ddeu30dd7aa6c59f5d27@mail.gmail.com> References: <77e5015c0611200704o389f2ddeu30dd7aa6c59f5d27@mail.gmail.com> Message-ID: > I have created the record with three fields.and i have update > the data in all the three fields .now i need to fetch all the data from the > fields > can i fetch this data from these fields at single instance i > hav tried a lot but i could'nt do it > exmple: > -record(person,{name,phone,address}). > so from the above record i need to fetch the name , > phone and address at the single instance #person{name=Name, phone=Phone, address=Address} = Record Is that what you want? Let Name, Phone and Address be unbound variables. From sean.hinde@REDACTED Mon Nov 20 17:56:41 2006 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 20 Nov 2006 16:56:41 +0000 Subject: [erlang-questions] help: fetching data from records at single instance In-Reply-To: <77e5015c0611200704o389f2ddeu30dd7aa6c59f5d27@mail.gmail.com> References: <77e5015c0611200704o389f2ddeu30dd7aa6c59f5d27@mail.gmail.com> Message-ID: <8789A641-74FE-4055-A452-37603A3BFD72@gmail.com> On 20 Nov 2006, at 15:04, dinesh sundar wrote: > Hi all, > > I have created the record with three fields.and i have > update the data in all the three fields .now i need to fetch all > the data from the fields > can i fetch this data from these fields at single > instance i hav tried a lot but i could'nt do it > > > exmple: > > -record(person,{name,phone,address}). > so from the above record i need to fetch > the name , phone and address at the single instance #person{name = Name, phone = Phone, address = Address} = Variable Sean From calmasy@REDACTED Mon Nov 20 18:50:41 2006 From: calmasy@REDACTED (=?ISO-8859-1?Q?Count_L=E1szl=F3_de_Alm=E1sy?=) Date: Mon, 20 Nov 2006 10:50:41 -0700 Subject: [erlang-questions] Easy way to tell of SMP is enabled In-Reply-To: References: Message-ID: On 11/20/06, James Hague wrote: > How can I tell if SMP support is enabled for the emulator? I want to > verify that I compiled it correctly for SMP support. Start erl with the '-smp' option and it will show you the # of procs it sees: $ erl -smp Erlang (BEAM) emulator version 5.5.2 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.2 (abort with ^G) 1> -- Cheers, L?szl? From ulf.wiger@REDACTED Mon Nov 20 19:16:05 2006 From: ulf.wiger@REDACTED (Ulf Wiger (TN/EAB)) Date: Mon, 20 Nov 2006 19:16:05 +0100 Subject: [erlang-questions] Easy way to tell of SMP is enabled In-Reply-To: Message-ID: erlang:system_info(smp_support) -> true | false or call erlang:system_info(system_version) and parse the string. BR, Ulf W > -----Original Message----- > From: erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] On Behalf Of James Hague > Sent: den 20 november 2006 16:11 > To: Erlang Users' List > Subject: [erlang-questions] Easy way to tell of SMP is enabled > > How can I tell if SMP support is enabled for the emulator? I > want to verify that I compiled it correctly for SMP support. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From Martin.Logan@REDACTED Mon Nov 20 20:59:12 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Mon, 20 Nov 2006 13:59:12 -0600 Subject: [erlang-questions] Passing arguments to erlang from the command line In-Reply-To: <200611172301.11644.andyk@andykhan.freeserve.co.uk> Message-ID: <26AB42AB6A76E2419D26E66ECF1538468B33C3@chiresexc02.resource.corp.lcl> I wrote a small script to show you why this does not work -module(test). -export([test/1]). test(Arg) -> io:format("arg = ~p~n", [Arg]). I will first invoke the script from the erl shell and then from the command line with the run option as you do. ---------- from the command shell ------------ 1> test:test(martin@REDACTED). arg = martin@REDACTED ok 2> ---------- from the command line ------------ martinjlogan@REDACTED:~$ erl -run test test martin@REDACTED Erlang (BEAM) emulator version 5.4.12 [source] [hipe] arg = ["martin@REDACTED"] Eshell V5.4.12 (abort with ^G) See the problem? :) Cheers, Martin -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Andy Khan Sent: Friday, November 17, 2006 5:01 PM To: erlang-questions@REDACTED Subject: [erlang-questions] Passing arguments to erlang from the command line Hi, I'm playing with the pingpong example in the tutorial, and I'm trying to launch the ping process directly from the command line. When I run the program as follows: >erl -sname ping -run pingpong start_ping pong@REDACTED I get the following output: =ERROR REPORT==== 17-Nov-2006::16:55:37 === Error in process <0.34.0> on node 'ping@REDACTED' with exit value: {badarg,[{pingpong,ping,2}]} However, if I first start the erlang shell and then invoke the start_ping method, everying works fine: >erl -sname ping Eshell V5.5.2 (abort with ^G) (ping@REDACTED)1> pingpong:start_ping(pong@REDACTED). I must be missing something about passing arguments from the command line (I've shown my hacked about version of the ping code below). Can anybody help? Regards Andy ping(N, Pong_Node) -> {pong, Pong_Node} ! {ping, self()}, io:format("ping waiting for input~n", []), receive pong -> io:format("Ping received pong~n", []) end, ping(N - 1, Pong_Node). start_ping(Pong_Node) -> spawn(pingpong, ping, [3, Pong_Node]). _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From dsolaz@REDACTED Tue Nov 21 08:46:20 2006 From: dsolaz@REDACTED (Daniel Solaz) Date: Tue, 21 Nov 2006 08:46:20 +0100 Subject: [erlang-questions] erl_interface documentation inaccuracies Message-ID: <200611210846.20896.dsolaz@sistelcom.com> Hello. While writing my first erl_interface experiments I noticed a couple of minor inaccuracies in the documentation. Sample code in the Interoperability Tutorial is correct, at least in the case of erl_publish(): The erl_publish() function does not return a file descriptor. Apparently, the returned value should be ignored in case of success. The ERL_PID_NODE and ERL_PORT_NODE macros don't return an ETERM* but a const char*. Regards. -Daniel From sgolovan@REDACTED Tue Nov 21 15:22:48 2006 From: sgolovan@REDACTED (Sergei Golovan) Date: Tue, 21 Nov 2006 17:22:48 +0300 Subject: [erlang-questions] IPv6 support in inet_gethost Message-ID: Hi! As far as I understand, inet_gethost uses getipnodebyname and getipnodebyaddr functions. It seems that both functions aren't implemented in Linux (probably they require some unusual libraries?). Mikael Magnusson has sent a patch (attached, patch is for R11B-2) to Debian bugs database. It adds IPv6 addresses resolution using gethostbyname2 and gethostbyaddr. I hope it will be useful not only for Debian users. Best wishes! -- Sergei Golovan -------------- next part -------------- A non-text attachment was scrubbed... Name: otp_gethostbyname2_in6_addr.patch Type: application/octet-stream Size: 1596 bytes Desc: not available URL: From jahakala@REDACTED Tue Nov 21 15:41:50 2006 From: jahakala@REDACTED (Jani Hakala) Date: Tue, 21 Nov 2006 16:41:50 +0200 Subject: [erlang-questions] IPv6 support in inet_gethost In-Reply-To: (Sergei Golovan's message of "Tue\, 21 Nov 2006 17\:22\:48 +0300") References: Message-ID: <87hcwsoo9d.fsf@pingviini.kortex.jyu.fi> "Sergei Golovan" writes: > Hi! > > As far as I understand, inet_gethost uses getipnodebyname and > getipnodebyaddr functions. > > It seems that both functions aren't implemented in Linux (probably > they require some unusual libraries?). > The man page says that "These functions are deprecated. Use getaddrinfo(3) and getnameinfo(3) instead." "NOTES These functions have been present in glibc 2.1.91-95, but were removed again. Several Unix-like systems support them, but all call them deprecated." > Mikael Magnusson has sent a patch (attached, patch is for R11B-2) to > Debian bugs database. It adds IPv6 addresses resolution using > gethostbyname2 and gethostbyaddr. > gethostbyname2 is a GNU extension. > I hope it will be useful not only for Debian users. > Using getaddrinfo and getnameinfo might be a better idea then? Jani Hakala From ft@REDACTED Tue Nov 21 15:57:08 2006 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 21 Nov 2006 15:57:08 +0100 Subject: [erlang-questions] IPv6 support in inet_gethost In-Reply-To: <87hcwsoo9d.fsf@pingviini.kortex.jyu.fi> References: <87hcwsoo9d.fsf@pingviini.kortex.jyu.fi> Message-ID: <456313C4.6070701@it.su.se> Jani Hakala wrote: ... >> I hope it will be useful not only for Debian users. >> > Using getaddrinfo and getnameinfo might be a better idea then? Surely. My colleague Love H?rnquist ?strand wrote such a patch once, but it could never be accepted by the OTP group because with getaddrinfo you don't get the same hostent aliases as you do with gethostbyname. This broke the Ericsson test suite for NIS on Solaris (or something equally yucky), and as far as I know no progress was ever made. A workaround is to issue these two commands to make your Erlang node use the good ol' native Erlang resolver : ets:insert(inet_db, {res_ns, [{{127, 0, 0, 1}, 53}]}). ets:insert(inet_db, {res_lookup, [dns]}). Substitute {127, 0, 0, 1} with the address of your resolver - I don't know if it works with an IPv6 tuple. /Fredrik From pupeno@REDACTED Wed Nov 22 02:42:50 2006 From: pupeno@REDACTED (Pupeno) Date: Wed, 22 Nov 2006 01:42:50 +0000 Subject: [erlang-questions] eunit, what's the status ? Message-ID: <1164159770.12101.24.camel@pulab> Hello, I've been using eunit quite heavily some time ago and now I want to use it again (I am again working on that project). I remember that there was eunit 1.0 and eunit 2.0, which was beta. I now see eunit 1.1 at Process-one's site: https://support.process-one.net/doc/display/CONTRIBS/EUnit (http://freshmeat.net/projects/eunit/, http://freshmeat.net/projects/eunit/?branch_id=19903&release_id=213163) But then I see that Richard Carlsson was working on eunit 2.0 (http://www3.erlang.org/ml-archive/erlang-questions/200604/msg00171.html) but there's no trace of it on http://user.it.uu.se/~richardc/eunit/, except for a presentation. Does anybody know about the fate of eunit 2.0 ? is it hidden somewhere else ? what is its status ? Thank you. -- Pupeno (http://pupeno.com) From cyberlync@REDACTED Wed Nov 22 03:33:06 2006 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 21 Nov 2006 18:33:06 -0800 Subject: [erlang-questions] eunit, what's the status ? In-Reply-To: <1164159770.12101.24.camel@pulab> References: <1164159770.12101.24.camel@pulab> Message-ID: I know that he is working on it. I have had conversations about it with him in the recent past. However, I have sent a patch and a couple of questions in the last three or four weeks without getting any response. So I don't know how active he is at the moment. In any case, the best thing is to get the source from svn and use that. svn co http://svn.process-one.net/contribs/trunk/eunit eunit That equates to eunit 2.0 On 11/21/06, Pupeno wrote: > Hello, > I've been using eunit quite heavily some time ago and now I want to use > it again (I am again working on that project). I remember that there was > eunit 1.0 and eunit 2.0, which was beta. I now see eunit 1.1 at > Process-one's site: > https://support.process-one.net/doc/display/CONTRIBS/EUnit > (http://freshmeat.net/projects/eunit/, > http://freshmeat.net/projects/eunit/?branch_id=19903&release_id=213163) > But then I see that Richard Carlsson was working on eunit 2.0 > (http://www3.erlang.org/ml-archive/erlang-questions/200604/msg00171.html) but there's no trace of it on http://user.it.uu.se/~richardc/eunit/, except for a presentation. > Does anybody know about the fate of eunit 2.0 ? is it hidden somewhere > else ? what is its status ? > Thank you. > -- > Pupeno (http://pupeno.com) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From francesco@REDACTED Wed Nov 22 12:29:36 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 22 Nov 2006 11:29:36 +0000 Subject: [erlang-questions] TrapExit is very slow In-Reply-To: References: Message-ID: <456434A0.90305@erlang-consulting.com> One of us was running some stress tests on another Erlang system on the same machine.. They got a little out of hand, using up all the swap memory, eventually killing the machine :-). The forum was up and running again on Monday, and the wiki was fully restored Tuesday morning. For those of you who have not visited for a while, Eric Merritt with help from some colleagues did an amazing job at moving over the Erlang cook Book. The URL is http://wiki.trapexit.org/index.php/Category:CookBook Rudolph van Gran moved all his Erlang notes, especially on those dealing with testing, comparisons to other languages, interfacing Erlang, and more... http://wiki.trapexit.org/index.php/Category:Testing http://wiki.trapexit.org/index.php/Category:Erlang_and_Other_Languages http://wiki.trapexit.org/index.php/Category:Interfacing_Erlang Last, but not least, lots of new contributions have come in to tutorial sections. See them at http://wiki.trapexit.org/index.php/Category:HowTo A BIG thank you to everyone contributing contents and others who are active in the forum. If you have tutorials and other material you would like to add, let us know. Francesco -- http://www.erlang-consulting.com yerl@REDACTED wrote: > Hi guys! > > What happened to TrapExit? Seems to be down. > > cheers > Youn?s > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > From francesco@REDACTED Wed Nov 22 12:33:53 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 22 Nov 2006 11:33:53 +0000 Subject: [erlang-questions] who won the obfuscated erlang competition? In-Reply-To: References: Message-ID: <456435A1.3050203@erlang-consulting.com> It was not announced. The judges called it a tie between Laurent Picouleau and Richard Carlsson. Laurent submitted a Sudoku solver which when compiled, did not produce a beam file... And Richard Carlsson, through his ingenious use of the error handler, produced something simple, but really obfuscated. We hope to post the results this week, so you can all have a laugh. Regards, Francesco -- http://www.erlang-consulting.com Ulf Wiger (TN/EAB) wrote: > > ... or did I miss the announcement at the EUC? > > /Ulf W > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > From david.nospam.hopwood@REDACTED Wed Nov 22 16:08:04 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 22 Nov 2006 15:08:04 +0000 Subject: [erlang-questions] Never let it fail! In-Reply-To: <454A9E7D.9040706@duomark.com> References: <454A9E7D.9040706@duomark.com> Message-ID: <456467D4.7020802@blueyonder.co.uk> Jay Nelson wrote: > Here is an alternative to the "let it fail" philosophy. They take the > opposite tack. > > http://www.cs.utexas.edu/users/wcook/Drafts/2006/RinardOOPSLA06.pdf > > This was presented at OOPSLA 2006. Their tack isn't opposite. However, I don't find their arguments convincing. I think their observations are too dependent on the behaviour of poorly written C programs. In particular, they consider the effect of ignoring bounds checking failures relative to terminating a program, but only for existing programs that were developed without any form of bounds checking. They don't consider whether developing software in a language where bounds errors (for example) are reported immediately would have prevented most of those bugs from being present in the released software. Also, they compare their approach only to termination of the entire program on failure; not to Erlang-style supervision hierarchies (or even to exceptions!) With regard to memory leaks, what they are suggesting is obviously strictly inferior to automatic garbage collection. -- David Hopwood From Martin.Logan@REDACTED Wed Nov 22 18:25:54 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Wed, 22 Nov 2006 11:25:54 -0600 Subject: [erlang-questions] who won the obfuscated erlang competition? In-Reply-To: <456435A1.3050203@erlang-consulting.com> Message-ID: <26AB42AB6A76E2419D26E66ECF1538468B33F7@chiresexc02.resource.corp.lcl> I thought the rule stipulated that it had to compile? -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Francesco Cesarini Sent: Wednesday, November 22, 2006 5:34 AM To: Ulf Wiger (TN/EAB) Cc: Erlang Subject: Re: [erlang-questions] who won the obfuscated erlang competition? It was not announced. The judges called it a tie between Laurent Picouleau and Richard Carlsson. Laurent submitted a Sudoku solver which when compiled, did not produce a beam file... And Richard Carlsson, through his ingenious use of the error handler, produced something simple, but really obfuscated. We hope to post the results this week, so you can all have a laugh. Regards, Francesco -- http://www.erlang-consulting.com Ulf Wiger (TN/EAB) wrote: > > ... or did I miss the announcement at the EUC? > > /Ulf W > >----------------------------------------------------------------------- - > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions From qrilka@REDACTED Wed Nov 22 22:35:22 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 23 Nov 2006 00:35:22 +0300 Subject: [erlang-questions] Compiling Erlang in Kubuntu 6.0.6 Message-ID: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> I'm a Linux newbie (at last I have installed it :) ) and now I'm trying to install Erlang on my Kubunttu. There were some problems with packages but I've solved them. Right now I can not run make, it says: hipe/hipe_mkliterals.c:351: error: 'X86_LEAF_WORDS' undeclared here (not in a function) hipe/hipe_mkliterals.c:352: error: 'X86_NR_ARG_REGS' undeclared here (not in a function) There is just 1 link in Google about this issue and it says that I need to disable HiPE with ./configure --disable-hipe. I've tried this but I get the same error. I'm stuck :( Maybe I miss something else? BR, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpe@REDACTED Wed Nov 22 23:03:08 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 22 Nov 2006 23:03:08 +0100 Subject: [erlang-questions] Compiling Erlang in Kubuntu 6.0.6 In-Reply-To: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> References: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> Message-ID: <17764.51484.903450.4743@alkaid.it.uu.se> Kirill Zaborski writes: > I'm a Linux newbie (at last I have installed it :) ) and now I'm trying to > install Erlang on my Kubunttu. There were some problems with packages but > I've solved them. Right now I can not run make, it says: > hipe/hipe_mkliterals.c:351: error: 'X86_LEAF_WORDS' undeclared here (not in > a function) > hipe/hipe_mkliterals.c:352: error: 'X86_NR_ARG_REGS' undeclared here (not in > a function) > There is just 1 link in Google about this issue and it says that I need to > disable HiPE with ./configure --disable-hipe. I've tried this but I get the > same error. > I'm stuck :( > Maybe I miss something else? Post a build log from a freshly unpacked OTP R11B-2 tar ball, complete with the initial ./configure command and the subsequent make command. The errors could be caused by 'm4' failures earlier in the build. From olgeni@REDACTED Wed Nov 22 23:19:41 2006 From: olgeni@REDACTED (Jimmy Olgeni) Date: Wed, 22 Nov 2006 23:19:41 +0100 (CET) Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: References: Message-ID: <20061122231454.K17991@olgeni.olgeni> Hello! On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > http://www.erlang.org/download/otp_src_R11B-2.readme >From the release notes: "Note: configure will refuse to enable kernel poll support on FreeBSD since kqueue have problems with (at least) pipes on all version of FreeBSD that we have tested." Do you know which FreeBSD versions were tested? It would be useful to know if RELENG_6 still has this bug =) -- jimmy From qrilka@REDACTED Thu Nov 23 00:27:41 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Thu, 23 Nov 2006 02:27:41 +0300 Subject: [erlang-questions] Compiling Erlang in Kubuntu 6.0.6 In-Reply-To: <17764.51484.903450.4743@alkaid.it.uu.se> References: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> <17764.51484.903450.4743@alkaid.it.uu.se> Message-ID: <337538cb0611221527v44588087k10f75aba59be3095@mail.gmail.com> On 11/23/06, Mikael Pettersson wrote: > > Kirill Zaborski writes: > > I'm a Linux newbie (at last I have installed it :) ) and now I'm trying > to > > install Erlang on my Kubunttu. There were some problems with packages > but > > I've solved them. Right now I can not run make, it says: > > hipe/hipe_mkliterals.c:351: error: 'X86_LEAF_WORDS' undeclared here (not > in > > a function) > > hipe/hipe_mkliterals.c:352: error: 'X86_NR_ARG_REGS' undeclared here > (not in > > a function) > > There is just 1 link in Google about this issue and it says that I need > to > > disable HiPE with ./configure --disable-hipe. I've tried this but I get > the > > same error. > > I'm stuck :( > > Maybe I miss something else? > > Post a build log from a freshly unpacked OTP R11B-2 tar ball, > complete with the initial ./configure command and the subsequent > make command. > > The errors could be caused by 'm4' failures earlier in the build. Yep there was an error about m4, but I've installed it (as some other packages). It looks like there were some wrong intermediate result resulting in this error. But I didn't find a way to clean up directory after erroneous ./configure. But now I've run 'sudo apt-get build-dep erlang' and and started installation from the beginning. Looks like it started to compile, it's too late in Moscow - need some sleep. And sorry about not very Erlang-specific issues :) Thanks, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard.s.green@REDACTED Thu Nov 23 00:45:11 2006 From: rickard.s.green@REDACTED (Rickard Green) Date: Thu, 23 Nov 2006 00:45:11 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: <20061122231454.K17991@olgeni.olgeni> References: <20061122231454.K17991@olgeni.olgeni> Message-ID: <4564E107.2080601@ericsson.com> The newest FreeBSD which we test on is 6.1-RELEASE which had the bug. /Rickard Green, Erlang/OTP Jimmy Olgeni wrote: > Hello! > > On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > >> http://www.erlang.org/download/otp_src_R11B-2.readme > >>From the release notes: > > "Note: configure will refuse to enable kernel poll support on FreeBSD since kqueue have problems with (at least) pipes on all version of FreeBSD that we have tested." > > Do you know which FreeBSD versions were tested? It would be useful to > know if RELENG_6 still has this bug =) > From pupeno@REDACTED Thu Nov 23 06:25:38 2006 From: pupeno@REDACTED (Pupeno) Date: Thu, 23 Nov 2006 05:25:38 +0000 Subject: [erlang-questions] Compiling Erlang in Kubuntu 6.0.6 In-Reply-To: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> References: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> Message-ID: <1164259538.19606.3.camel@pulab.pupeno.com> I think it is easier to use the packages and building the unstable packages in a stable Kubuntu is a matter of a couple of commands. Add the unstable repo to /etc/apt/sources.list, aptitude update, fakeroot apt-get source --build erlang, wait some time and voila! Yes, this is rough, if you need more info I can write a detailed tutorial in my blog. On Thu, 2006-11-23 at 00:35 +0300, Kirill Zaborski wrote: > I'm a Linux newbie (at last I have installed it :) ) and now I'm > trying to install Erlang on my Kubunttu. There were some problems with > packages but I've solved them. Right now I can not run make, it says: > hipe/hipe_mkliterals.c:351: error: 'X86_LEAF_WORDS' undeclared here > (not in a function) > hipe/hipe_mkliterals.c:352: error: 'X86_NR_ARG_REGS' undeclared here > (not in a function) > There is just 1 link in Google about this issue and it says that I > need to disable HiPE with ./configure --disable-hipe. I've tried this > but I get the same error. > I'm stuck :( > Maybe I miss something else? > > BR, > Kirill. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Pupeno (http://pupeno.com) From bengt.kleberg@REDACTED Thu Nov 23 08:25:37 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 23 Nov 2006 08:25:37 +0100 Subject: [erlang-questions] who won the obfuscated erlang competition? In-Reply-To: <26AB42AB6A76E2419D26E66ECF1538468B33F7@chiresexc02.resource.corp.lcl> References: <26AB42AB6A76E2419D26E66ECF1538468B33F7@chiresexc02.resource.corp.lcl> Message-ID: <45654CF1.6020502@ericsson.com> On 2006-11-22 18:25, Logan, Martin wrote: > I thought the rule stipulated that it had to compile? interesting enough it said ''when compiled, did not produce a beam file''. since the rule was not: ''must produce a beam file'' it could be ok. i can imagine at least one way to compile without producing a (visible) beam file. bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From avindev@REDACTED Thu Nov 23 09:42:15 2006 From: avindev@REDACTED (Arbow) Date: Thu, 23 Nov 2006 16:42:15 +0800 Subject: [erlang-questions] how can I get the ip address from a socket Message-ID: Deal all: I wrote a simple echo_server, want to print incoming connections ip address. case gen_tcp:accept(ListenSocket) of {ok, ClientSocket} -> ............. I got the ClientSocket, and output it : io:format("Socket ~p connected~n", [ClientSocket]), The simple output is: Socket #Port<0.96> connected Now I want to get the ip address and port of these remote peers, how I can do ? I can't find any releative functions from module gen_tcp. Thanks. From avindev@REDACTED Thu Nov 23 09:49:36 2006 From: avindev@REDACTED (Arbow) Date: Thu, 23 Nov 2006 16:49:36 +0800 Subject: [erlang-questions] how can I get the ip address from a socket In-Reply-To: References: Message-ID: Problem solved, I found inet:peername/1 :) From chsu79@REDACTED Thu Nov 23 09:51:56 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 23 Nov 2006 09:51:56 +0100 Subject: [erlang-questions] how can I get the ip address from a socket In-Reply-To: References: Message-ID: inet:peername/1 On 11/23/06, Arbow wrote: > Deal all: > > I wrote a simple echo_server, want to print incoming > connections ip address. > > case gen_tcp:accept(ListenSocket) of > {ok, ClientSocket} -> ............. > > I got the ClientSocket, and output it : > > io:format("Socket ~p connected~n", [ClientSocket]), > > The simple output is: > Socket #Port<0.96> connected > > Now I want to get the ip address and port of these remote peers, how I > can do ? I can't find any releative functions from module gen_tcp. > > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From mikpe@REDACTED Thu Nov 23 11:01:14 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 23 Nov 2006 11:01:14 +0100 Subject: [erlang-questions] Compiling Erlang in Kubuntu 6.0.6 In-Reply-To: <337538cb0611221527v44588087k10f75aba59be3095@mail.gmail.com> References: <337538cb0611221335s6ceb30c0x5126044c79bea2b2@mail.gmail.com> <17764.51484.903450.4743@alkaid.it.uu.se> <337538cb0611221527v44588087k10f75aba59be3095@mail.gmail.com> Message-ID: <17765.29035.14810.179206@alkaid.it.uu.se> Kirill Zaborski writes: > On 11/23/06, Mikael Pettersson wrote: > > > > Kirill Zaborski writes: > > > I'm a Linux newbie (at last I have installed it :) ) and now I'm trying > > to > > > install Erlang on my Kubunttu. There were some problems with packages > > but > > > I've solved them. Right now I can not run make, it says: > > > hipe/hipe_mkliterals.c:351: error: 'X86_LEAF_WORDS' undeclared here (not > > in > > > a function) > > > hipe/hipe_mkliterals.c:352: error: 'X86_NR_ARG_REGS' undeclared here > > (not in > > > a function) > > > There is just 1 link in Google about this issue and it says that I need > > to > > > disable HiPE with ./configure --disable-hipe. I've tried this but I get > > the > > > same error. > > > I'm stuck :( > > > Maybe I miss something else? > > > > Post a build log from a freshly unpacked OTP R11B-2 tar ball, > > complete with the initial ./configure command and the subsequent > > make command. > > > > The errors could be caused by 'm4' failures earlier in the build. > > > Yep there was an error about m4, but I've installed it (as some other > packages). It looks like there were some wrong intermediate result resulting > in this error. But I didn't find a way to clean up directory after erroneous > ./configure. That explains it. You got broken intermediate generated files that weren't regenerated once you installed m4, and this lead to the build errors you quoted above. An rm -rf of the Erlang/OTP source tree followed by a fresh unpack/configure/make sequence should have worked. From alex.arnon@REDACTED Thu Nov 23 11:01:54 2006 From: alex.arnon@REDACTED (Alex Arnon) Date: Thu, 23 Nov 2006 12:01:54 +0200 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: <4564E107.2080601@ericsson.com> References: <20061122231454.K17991@olgeni.olgeni> <4564E107.2080601@ericsson.com> Message-ID: <944da41d0611230201u663166b7vf2f32d70f9d0ffc4@mail.gmail.com> How about OpenBSD? On 11/23/06, Rickard Green wrote: > > The newest FreeBSD which we test on is 6.1-RELEASE which had the bug. > > /Rickard Green, Erlang/OTP > > Jimmy Olgeni wrote: > > Hello! > > > > On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > > > >> http://www.erlang.org/download/otp_src_R11B-2.readme > > > >>From the release notes: > > > > "Note: configure will refuse to enable kernel poll support on FreeBSD > since kqueue have problems with (at least) pipes on all version of FreeBSD > that we have tested." > > > > Do you know which FreeBSD versions were tested? It would be useful to > > know if RELENG_6 still has this bug =) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Nov 23 11:09:48 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Nov 2006 11:09:48 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: <944da41d0611230201u663166b7vf2f32d70f9d0ffc4@mail.gmail.com> References: <20061122231454.K17991@olgeni.olgeni> <4564E107.2080601@ericsson.com> <944da41d0611230201u663166b7vf2f32d70f9d0ffc4@mail.gmail.com> Message-ID: We found no kqueue problems in OpenBSD. /Bjorn "Alex Arnon" writes: > How about OpenBSD? > > On 11/23/06, Rickard Green wrote: > > > > The newest FreeBSD which we test on is 6.1-RELEASE which had the bug. > > > > /Rickard Green, Erlang/OTP > > > > Jimmy Olgeni wrote: > > > Hello! > > > > > > On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > > > > > >> http://www.erlang.org/download/otp_src_R11B-2.readme > > > > > >>From the release notes: > > > > > > "Note: configure will refuse to enable kernel poll support on FreeBSD > > since kqueue have problems with (at least) pipes on all version of FreeBSD > > that we have tested." > > > > > > Do you know which FreeBSD versions were tested? It would be useful to > > > know if RELENG_6 still has this bug =) > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From alex.arnon@REDACTED Thu Nov 23 13:37:06 2006 From: alex.arnon@REDACTED (Alex Arnon) Date: Thu, 23 Nov 2006 14:37:06 +0200 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: References: <20061122231454.K17991@olgeni.olgeni> <4564E107.2080601@ericsson.com> <944da41d0611230201u663166b7vf2f32d70f9d0ffc4@mail.gmail.com> Message-ID: <944da41d0611230437k30b4f1exbe0940ef5e25f212@mail.gmail.com> Does Erlang/OTP compile with kqueue support out of the box on OpenBSD? On 23 Nov 2006 11:09:48 +0100, Bjorn Gustavsson wrote: > > We found no kqueue problems in OpenBSD. > > /Bjorn > > "Alex Arnon" writes: > > > How about OpenBSD? > > > > On 11/23/06, Rickard Green wrote: > > > > > > The newest FreeBSD which we test on is 6.1-RELEASE which had the bug. > > > > > > /Rickard Green, Erlang/OTP > > > > > > Jimmy Olgeni wrote: > > > > Hello! > > > > > > > > On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > > > > > > > >> http://www.erlang.org/download/otp_src_R11B-2.readme > > > > > > > >>From the release notes: > > > > > > > > "Note: configure will refuse to enable kernel poll support on > FreeBSD > > > since kqueue have problems with (at least) pipes on all version of > FreeBSD > > > that we have tested." > > > > > > > > Do you know which FreeBSD versions were tested? It would be useful > to > > > > know if RELENG_6 still has this bug =) > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rickard.s.green@REDACTED Thu Nov 23 14:11:31 2006 From: rickard.s.green@REDACTED (Rickard Green) Date: Thu, 23 Nov 2006 14:11:31 +0100 Subject: [erlang-questions] Erlang/OTP R11B-2 has been released. In-Reply-To: <944da41d0611230437k30b4f1exbe0940ef5e25f212@mail.gmail.com> References: <20061122231454.K17991@olgeni.olgeni> <4564E107.2080601@ericsson.com> <944da41d0611230201u663166b7vf2f32d70f9d0ffc4@mail.gmail.com> <944da41d0611230437k30b4f1exbe0940ef5e25f212@mail.gmail.com> Message-ID: <45659E03.1080800@ericsson.com> Yes. /Rickard Green, Erlang/OTP Alex Arnon wrote: > Does Erlang/OTP compile with kqueue support out of the box on OpenBSD? > > On 23 Nov 2006 11:09:48 +0100, *Bjorn Gustavsson* < > bjorn@REDACTED > wrote: > > We found no kqueue problems in OpenBSD. > > /Bjorn > > "Alex Arnon" > > writes: > > > How about OpenBSD? > > > > On 11/23/06, Rickard Green < rickard.s.green@REDACTED > > wrote: > > > > > > The newest FreeBSD which we test on is 6.1-RELEASE which had > the bug. > > > > > > /Rickard Green, Erlang/OTP > > > > > > Jimmy Olgeni wrote: > > > > Hello! > > > > > > > > On Wed, 8 Nov 2006, Bjorn Gustavsson wrote: > > > > > > > >> http://www.erlang.org/download/otp_src_R11B-2.readme > > > > > > > > >>From the release notes: > > > > > > > > "Note: configure will refuse to enable kernel poll support on > FreeBSD > > > since kqueue have problems with (at least) pipes on all version > of FreeBSD > > > that we have tested." > > > > > > > > Do you know which FreeBSD versions were tested? It would be > useful to > > > > know if RELENG_6 still has this bug =) > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > From francesco@REDACTED Thu Nov 23 16:51:02 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 23 Nov 2006 15:51:02 +0000 Subject: [erlang-questions] who won the obfuscated erlang competition? In-Reply-To: <26AB42AB6A76E2419D26E66ECF1538468B33F7@chiresexc02.resource.corp.lcl> References: <26AB42AB6A76E2419D26E66ECF1538468B33F7@chiresexc02.resource.corp.lcl> Message-ID: <4565C366.1010905@erlang-consulting.com> There is the beauty.. It does compile :-) Luckily, the author included instructions on how to bypass the bug and generate a beam file. Francesco -- http://www.erlang-consulting.com Logan, Martin wrote: >I thought the rule stipulated that it had to compile? > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Francesco >Cesarini >Sent: Wednesday, November 22, 2006 5:34 AM >To: Ulf Wiger (TN/EAB) >Cc: Erlang >Subject: Re: [erlang-questions] who won the obfuscated erlang >competition? > >It was not announced. The judges called it a tie between Laurent >Picouleau and Richard Carlsson. Laurent submitted a Sudoku solver which >when compiled, did not produce a beam file... And Richard Carlsson, >through his ingenious use of the error handler, produced something >simple, but really obfuscated. We hope to post the results this week, so > >you can all have a laugh. > >Regards, >Francesco >-- >http://www.erlang-consulting.com > >Ulf Wiger (TN/EAB) wrote: > > > >>... or did I miss the announcement at the EUC? >> >>/Ulf W >> >>----------------------------------------------------------------------- >> >> >- > > >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > From ft@REDACTED Fri Nov 24 10:17:13 2006 From: ft@REDACTED (Fredrik Thulin) Date: Fri, 24 Nov 2006 10:17:13 +0100 Subject: [erlang-questions] eldap patch Message-ID: <4566B899.2040207@it.su.se> Hi Can someone jungerly please commit this patch to eldap for me? These are the fixes that I have had to make in order to use eldap in YXA. It is mostly fixes for using eldap to connect to an LDAP server over SSL, and one case of incorrect record being used (found thanks to the change in R11B-2). Suggested commit message : do_connect: don't use error-prone ssl:peercert/2 do_connect: don't write stuff to console do_connect: don't fail worse on connection failures if SSL is used, than if not ldap_closed_p: fix detection of shut down SSL connections exec_simple_bind_reply: fix usage of incorrect record (that used to work 'by accident') Thanks! /Fredrik PS. No, I don't want to set up a sourceforge account. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: yxa-eldap-patch1 URL: From tobbe@REDACTED Fri Nov 24 10:39:09 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 24 Nov 2006 10:39:09 +0100 Subject: [erlang-questions] eldap patch In-Reply-To: <4566B899.2040207@it.su.se> References: <4566B899.2040207@it.su.se> Message-ID: <4566BDBD.1030600@tornkvist.org> Fredrik Thulin wrote: > Hi > > Can someone jungerly please commit this patch to eldap for me? Done! Cheers, Tobbe From attila.rajmund.nohl@REDACTED Fri Nov 24 18:24:48 2006 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Fri, 24 Nov 2006 18:24:48 +0100 (CET) Subject: [erlang-questions] How to avoid copying code? Message-ID: Hello! I have a couple of modules (20-30) which define the same macros, like this: module1.erl: -define(FOO, "something1"). -define(BAR, "else1"). module2.erl: -define(FOO, "something2"). -define(BAR, "similar2"). And I also have a function in these modules that return the data of these macros: get_data() -> {?FOO, ?BAR}. Obviously this function definition is exactly the same in all 20-30 modules, which I don't really like. Is there a way to define this function only once? In Java I'd create an abstract ancestor class for module1 and module2, declare the FOO and BAR variables there, also implement the get_data() in the ancestor class and assign values to FOO and BAR in the constructor of module1 and module2 (there is only one instance of module1, etc. classes in the program). Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From kostis@REDACTED Fri Nov 24 18:37:08 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 24 Nov 2006 18:37:08 +0100 Subject: [erlang-questions] How to avoid copying code? In-Reply-To: References: Message-ID: <45672DC4.6000408@cs.ntua.gr> attila.rajmund.nohl@REDACTED wrote: > Hello! > > I have a couple of modules (20-30) which define the same macros, like > this: > module1.erl: > -define(FOO, "something1"). > -define(BAR, "else1"). > > module2.erl: > -define(FOO, "something2"). > -define(BAR, "similar2"). > > And I also have a function in these modules that return the data of > these macros: > > get_data() -> > {?FOO, ?BAR}. > > Obviously this function definition is exactly the same in all 20-30 > modules, which I don't really like. Is there a way to define this > function only once? In Java I'd create an abstract ancestor class for > module1 and module2, declare the FOO and BAR variables there, also > implement the get_data() in the ancestor class and assign values to FOO > and BAR in the constructor of module1 and module2 (there is only one > instance of module1, etc. classes in the program). I am not sure this is what you are asking, but if you just want to avoid code duplication, put the function in an .hrl file and then use an -include in its place. Kostis From tumanian@REDACTED Fri Nov 24 20:44:22 2006 From: tumanian@REDACTED (Gurgen Tumanian) Date: Fri, 24 Nov 2006 23:44:22 +0400 Subject: [erlang-questions] Starting crypto app in werl Message-ID: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> Hi, what i am trying to do, is to start the crypto application from erlang shell that is running on a windows machine. I am using R11B on Windows XP Media Center edition(i know, i know, it stinks). when i do crypto:start(). i get the following error report. =INFO REPORT==== 24-Nov-2006::23:39:55 === application: crypto exited: {shutdown,{crypto_app,start,[normal,[]]}} type: temporary {error,{shutdown,{crypto_app,start,[normal,[]]}}} what can i do to fix this? googling didn't give results, so I will appreciate any clue or link. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangx@REDACTED Fri Nov 24 20:57:53 2006 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 24 Nov 2006 11:57:53 -0800 Subject: [erlang-questions] Starting crypto app in werl In-Reply-To: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> References: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> Message-ID: <20061124195753.GB17663@delora.autosys.us> C:\WINDOWS\system32\libssl.dll and/or ssleay32.dll exist ? I have just started using Erlang on Windows and that is a guess. Also try application:start(sasl). before crypto:start() and see if more information is provided. ~Michael On Fri, Nov 24, 2006 at 11:44:22PM +0400, Gurgen Tumanian wrote: > Hi, > what i am trying to do, is to start the crypto application from erlang shell > that is running on a windows machine. I am using R11B on Windows XP Media > Center edition(i know, i know, it stinks). > > when i do > crypto:start(). > > i get the following error report. > > =INFO REPORT==== 24-Nov-2006::23:39:55 === > application: crypto > exited: {shutdown,{crypto_app,start,[normal,[]]}} > type: temporary > {error,{shutdown,{crypto_app,start,[normal,[]]}}} > > what can i do to fix this? googling didn't give results, so I will > appreciate any clue or link. Thanks > !DSPAM:52,45674c90251561499522626! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > !DSPAM:52,45674c90251561499522626! -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From tumanian@REDACTED Fri Nov 24 21:30:16 2006 From: tumanian@REDACTED (Gurgen Tumanian) Date: Sat, 25 Nov 2006 00:30:16 +0400 Subject: [erlang-questions] Starting crypto app in werl In-Reply-To: <20061124195753.GB17663@delora.autosys.us> References: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> <20061124195753.GB17663@delora.autosys.us> Message-ID: <85d11a2e0611241230u37140462m7da6edf1d6381b0f@mail.gmail.com> Guess i have none of them. Still, i launched sasl before crypto, a got the following =CRASH REPORT==== 25-Nov-2006::00:25:31 === crasher: pid: <0.55.0> registered_name: crypto_server error_info: {einval,[{erlang,open_port, [{spawn, "crypto_drv elibcrypto c:/PROGRA~1/ERL55~ 1.1/lib/crypto-1.5/priv/lib/win32/elibcrypto"}, []]}, {crypto_server,init,1}, {gen_server,init_it,6}, {proc_lib,init_p,5}]} initial_call: {gen,init_it, [gen_server, <0.54.0>, <0.54.0>, {local,crypto_server}, crypto_server, [], []]} ancestors: [crypto_sup,<0.53.0>] messages: [] links: [<0.54.0>] dictionary: [] trap_exit: true status: running heap_size: 987 stack_size: 21 reductions: 694 neighbours: {error,{shutdown,{crypto_app,start,[normal,[]]}}} -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangx@REDACTED Fri Nov 24 21:45:37 2006 From: erlangx@REDACTED (Michael McDaniel) Date: Fri, 24 Nov 2006 12:45:37 -0800 Subject: [erlang-questions] Starting crypto app in werl In-Reply-To: <85d11a2e0611241230u37140462m7da6edf1d6381b0f@mail.gmail.com> References: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> <20061124195753.GB17663@delora.autosys.us> <85d11a2e0611241230u37140462m7da6edf1d6381b0f@mail.gmail.com> Message-ID: <20061124204537.GD17663@delora.autosys.us> Hmm, maybe I'm steering you wrong and you do not need the openssl dlls. I checked my R11B-2 installation on Windows XP and have C:\Program Files\erl5.5.2\lib\crypto-1.5\priv\lib\crypto_drv.dll but there is no C:\Program Files\erl5.5.2\lib\crypto-1.5\priv\lib\win32 directory at all ~M On Sat, Nov 25, 2006 at 12:30:16AM +0400, Gurgen Tumanian wrote: > > Guess i have none of them. > Still, i launched sasl before crypto, a got the following > > =CRASH REPORT==== 25-Nov-2006::00:25:31 === > crasher: > pid: <0.55.0> > registered_name: crypto_server > error_info: {einval,[{erlang,open_port, > [{spawn, > "crypto_drv elibcrypto c:/PROGRA~1/ > ERL55~ > 1.1/lib/crypto-1.5/priv/lib/win32/elibcrypto"}, > []]}, > {crypto_server,init,1}, > {gen_server,init_it,6}, > {proc_lib,init_p,5}]} > initial_call: {gen,init_it, > [gen_server, > <0.54.0>, > <0.54.0>, > {local,crypto_server}, > crypto_server, > [], > []]} > ancestors: [crypto_sup,< 0.53.0>] > messages: [] > links: [<0.54.0>] > dictionary: [] > trap_exit: true > status: running > heap_size: 987 > stack_size: 21 > reductions: 694 > neighbours: > {error,{shutdown,{crypto_app,start,[normal,[]]}}} > > !DSPAM:52,45675691251561919120578! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > !DSPAM:52,45675691251561919120578! -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From igwan@REDACTED Fri Nov 24 22:45:50 2006 From: igwan@REDACTED (igwan) Date: Fri, 24 Nov 2006 22:45:50 +0100 Subject: [erlang-questions] Starting crypto app in werl In-Reply-To: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> References: <85d11a2e0611241144o5f86e410o47716f845712ea3b@mail.gmail.com> Message-ID: <4567680E.4020608@free.fr> Gurgen Tumanian a ?crit : > Hi, > what i am trying to do, is to start the crypto application from erlang > shell that is running on a windows machine. I am using R11B on > Windows XP Media Center edition(i know, i know, it stinks). > Have you installed OpenSSL ? ( http://www.slproweb.com/products/Win32OpenSSL.html ), it's needed for the cypto application. igwan From hokan.stenholm@REDACTED Sat Nov 25 02:42:23 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 25 Nov 2006 02:42:23 +0100 Subject: [erlang-questions] How to avoid copying code? In-Reply-To: References: Message-ID: <45679F7F.3010506@bredband.net> attila.rajmund.nohl@REDACTED wrote: >Hello! > >I have a couple of modules (20-30) which define the same macros, like >this: >module1.erl: >-define(FOO, "something1"). >-define(BAR, "else1"). > >module2.erl: >-define(FOO, "something2"). >-define(BAR, "similar2"). > >And I also have a function in these modules that return the data of >these macros: > >get_data() -> > {?FOO, ?BAR}. > >Obviously this function definition is exactly the same in all 20-30 >modules, which I don't really like. Is there a way to define this >function only once? In Java I'd create an abstract ancestor class for >module1 and module2, declare the FOO and BAR variables there, also >implement the get_data() in the ancestor class and assign values to FOO >and BAR in the constructor of module1 and module2 (there is only one >instance of module1, etc. classes in the program). > > Bye,NAR > > One possible way to remove the need for having multiple get_data/0 functions would be to write something like: module1.erl: foo() -> "something1". bar() -> "else1". module2.erl: foo() -> "something2". bar() -> "else2". single_get_data_module.erl: get_data(Module) -> {Module:foo(), Module:bar()}. You can then call single_get_data_module:get_data/1 with the appropriate module, when you need a specific tuple. From hokan.stenholm@REDACTED Sat Nov 25 02:47:20 2006 From: hokan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 25 Nov 2006 02:47:20 +0100 Subject: [erlang-questions] How to avoid copying code? In-Reply-To: <45679F7F.3010506@bredband.net> References: <45679F7F.3010506@bredband.net> Message-ID: <4567A0A8.5070405@bredband.net> H?kan Stenholm wrote: >attila.rajmund.nohl@REDACTED wrote: > > > >>Hello! >> >>I have a couple of modules (20-30) which define the same macros, like >>this: >>module1.erl: >>-define(FOO, "something1"). >>-define(BAR, "else1"). >> >>module2.erl: >>-define(FOO, "something2"). >>-define(BAR, "similar2"). >> >>And I also have a function in these modules that return the data of >>these macros: >> >>get_data() -> >> {?FOO, ?BAR}. >> >>Obviously this function definition is exactly the same in all 20-30 >>modules, which I don't really like. Is there a way to define this >>function only once? In Java I'd create an abstract ancestor class for >>module1 and module2, declare the FOO and BAR variables there, also >>implement the get_data() in the ancestor class and assign values to FOO >>and BAR in the constructor of module1 and module2 (there is only one >>instance of module1, etc. classes in the program). >> >> Bye,NAR >> >> >> >> >One possible way to remove the need for having multiple get_data/0 >functions would be to write something like: > >module1.erl: >foo() -> "something1". >bar() -> "else1". > >module2.erl: >foo() -> "something2". >bar() -> "else2". > >single_get_data_module.erl: >get_data(Module) -> > {Module:foo(), Module:bar()}. > > >You can then call single_get_data_module:get_data/1 with the appropriate >module, when you need a specific tuple. > > minor clarification, Module is a module name e.g. single_get_data_module:get_data(module1) would return {"something1", "else1"} >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > > From christophe.romain@REDACTED Sat Nov 25 11:24:34 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Sat, 25 Nov 2006 11:24:34 +0100 Subject: [erlang-questions] CEAN 1.0 beta available Message-ID: Hello The Comprehensive Erlang Archive Network is available for testing. CEAN aims to be a central place to find erlang packaged code. It now includes 193 binary packages, available for 17 platforms, using R11B-2. Packages are installed using erlang command line: administration is the same regardless of the host system. Multi-host shared installation is possible: you can build your USB key running your Erlang application on windows, mac, linux using REPOS repository. All information is on web site http://cean.process-one.net We are actually working on: - packages classification into categories (if you have any suggestion, you're welcome). - package finder improvement (keywords combination, usage of description, etc...) - debian packages generation We did not test the whole repository, some packages may be broken. Any help would be appreciated ! - package description checking - package testing - finding missing packages A build script is almost ready to allow people to build archives from a package description file. Then, archives could be integrated to CEAN. This will be released on the site at http://cean.process-one.net/ contrib/ as soon as tests and documentation will be finished. Known issue: ejabberd available only on MacOS X, Linux x86, Windows erl_cgi available only on MacOS X PowerPC, Linux x86 gtkNode available only on MacOS X PowerPC, Linux x86 OpenBSD-x86 and SunOS-Sparc are available with R11B-0 in production distribution only Best Regards. From mazen@REDACTED Sat Nov 25 11:53:47 2006 From: mazen@REDACTED (Mazen) Date: Sat, 25 Nov 2006 10:53:47 +0000 Subject: [erlang-questions] How to avoid copying code? References: Message-ID: <20061125105348.0879F5A06A@mail.erlangsystems.com> Guest wrote: Hello! I have a couple of modules (20-30) which define the same macros, like this: module1.erl: -define(FOO, "something1"). -define(BAR, "else1"). module2.erl: -define(FOO, "something2"). -define(BAR, "similar2"). And I also have a function in these modules that return the data of these macros: get_data() -> {?FOO, ?BAR}. Obviously this function definition is exactly the same in all 20-30 modules, which I don't really like. Is there a way to define this function only once? In Java I'd create an abstract ancestor class for module1 and module2, declare the FOO and BAR variables there, also implement the get_data() in the ancestor class and assign values to FOO and BAR in the constructor of module1 and module2 (there is only one instance of module1, etc. classes in the program). Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions Post recived from mailinglist (end of quote) If i understand you correctly (you having programmed Java and all), you see get_data() as an accessor function (method?) to the "object's" (this case being the module's) data. This is clearly a very object oriented way of seeing things. So first my personal answer would be: You should probably try to change your design according to the tools you have (in this case Erlang). Secondly im curious: Why would you want to have accessor functions to data that is static? _________________________________________________________ Post sent from http://www.trapexit.org From dmitrii@REDACTED Sat Nov 25 13:23:04 2006 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Sat, 25 Nov 2006 14:23:04 +0200 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: References: Message-ID: I hit Reply instead of Reply to All, so the ltter went directly to Christophe Romain, not to the list. Here's the conversation: > Is version control planned? yes, of course ! first version handling for CEAN 1.1 it will be possible, at least, to upgrade/downgrade to a determined version. but i would like to be able to mix several versions of the same app, and that is a harder problem. I have to think about that before handling version in order to take the right technical decision that will not make future cean version incompatible. Best Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From machinshin2002@REDACTED Sat Nov 25 16:19:23 2006 From: machinshin2002@REDACTED (Vat Raghavan) Date: Sat, 25 Nov 2006 07:19:23 -0800 (PST) Subject: [erlang-questions] CEAN 1.0 beta available Message-ID: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> this may be a stupid question, but how is this different from what already exists in JungERL ? --vat ----- Original Message ---- From: Christophe Romain To: erlang-questions List Sent: Saturday, November 25, 2006 5:24:34 AM Subject: [erlang-questions] CEAN 1.0 beta available Hello The Comprehensive Erlang Archive Network is available for testing. CEAN aims to be a central place to find erlang packaged code. It now includes 193 binary packages, available for 17 platforms, using R11B-2. Packages are installed using erlang command line: administration is the same regardless of the host system. Multi-host shared installation is possible: you can build your USB key running your Erlang application on windows, mac, linux using REPOS repository. All information is on web site http://cean.process-one.net We are actually working on: - packages classification into categories (if you have any suggestion, you're welcome). - package finder improvement (keywords combination, usage of description, etc...) - debian packages generation We did not test the whole repository, some packages may be broken. Any help would be appreciated ! - package description checking - package testing - finding missing packages A build script is almost ready to allow people to build archives from a package description file. Then, archives could be integrated to CEAN. This will be released on the site at http://cean.process-one.net/ contrib/ as soon as tests and documentation will be finished. Known issue: ejabberd available only on MacOS X, Linux x86, Windows erl_cgi available only on MacOS X PowerPC, Linux x86 gtkNode available only on MacOS X PowerPC, Linux x86 OpenBSD-x86 and SunOS-Sparc are available with R11B-0 in production distribution only Best Regards. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://www.erlang.org/mailman/listinfo/erlang-questions ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com From christophe.romain@REDACTED Sat Nov 25 17:15:52 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Sat, 25 Nov 2006 17:15:52 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> Message-ID: <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> > this may be a stupid question, but how is this different from what > already exists in JungERL ? jungerl is a source repository cean is a "beam" repository (cean includes compiled jungerl code by the way) example, to install pgsql, you must cvs checkout pgsql or jungerl then configure then make then install using cean, whatever your host system is cean:install(pgsql) and you have a ready to use postgresql driver From dirtyundies@REDACTED Sat Nov 25 22:51:09 2006 From: dirtyundies@REDACTED (Mikkel Jensen) Date: Sat, 25 Nov 2006 22:51:09 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> Message-ID: <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> Looks very nice, hopefully this will become the standard tool for package management! Unfortunately I can't seem to get the Windows version to work with Erlide. I'm guessing this is a problem with relative paths as I get the following error when I try to invoke erl.exe from the commandline: C:\>erl {"init terminating in do_boot",{'cannot get bootfile','../../../bin/start.boot'}} Crash dump was written to: erl_crash.dump init terminating in do_boot () The start.bat script works fine ofcourse! - Mikkel From qrilka@REDACTED Sat Nov 25 23:43:58 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Sun, 26 Nov 2006 01:43:58 +0300 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: References: Message-ID: <337538cb0611251443h2b82efa0yd7019d59b7984e81@mail.gmail.com> I tried to run a simple scenario on my Kubuntu: 1. ./cean_installer.sh 2. cean:install(yaws) 3. yaws:start(). YAWS hangs with the message "sh: line 0: exec: setuid_drv: not found" Tried to get some info with help of toolbar application, installed it with cean:install(toolbar). Running toolbar:start generated the following message: Error in startup script: couldn't read file "/home/qrilka/downloads/cean/erlang/lib/gs-1.5.5/priv/linux-x86/gstk.tcl": no such file or directory ** exited: {startup_timeout,toolbar} ** What am I doing wrong? Best Regards, Kirill On 11/25/06, Christophe Romain wrote: > > Hello > > The Comprehensive Erlang Archive Network is available for testing. > CEAN aims to be a central place to find erlang packaged code. > > It now includes 193 binary packages, available for 17 platforms, > using R11B-2. > Packages are installed using erlang command line: administration is > the same regardless of the host system. Multi-host shared > installation is possible: you can build your USB key running your > Erlang application on windows, mac, linux using REPOS repository. > > All information is on web site http://cean.process-one.net > > We are actually working on: > - packages classification into categories (if you have any > suggestion, you're welcome). > - package finder improvement (keywords combination, usage of > description, etc...) > - debian packages generation > > We did not test the whole repository, some packages may be broken. > Any help would be appreciated ! > - package description checking > - package testing > - finding missing packages > > A build script is almost ready to allow people to build archives from > a package description file. Then, archives could be integrated to CEAN. > This will be released on the site at http://cean.process-one.net/ > contrib/ as soon as tests and documentation will be finished. > > Known issue: > ejabberd available only on MacOS X, Linux x86, Windows > erl_cgi available only on MacOS X PowerPC, Linux x86 > gtkNode available only on MacOS X PowerPC, Linux x86 > OpenBSD-x86 and SunOS-Sparc are available with R11B-0 in production > distribution only > > > Best Regards. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christophe.romain@REDACTED Sun Nov 26 02:40:56 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Sun, 26 Nov 2006 02:40:56 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <337538cb0611251443h2b82efa0yd7019d59b7984e81@mail.gmail.com> References: <337538cb0611251443h2b82efa0yd7019d59b7984e81@mail.gmail.com> Message-ID: <356E1D63-8494-4B33-AC22-CEE56936DBEA@process-one.net> > "sh: line 0: exec: setuid_drv: not found" this is a known issue, but yaws is working as this in embedded mode anyway. From christophe.romain@REDACTED Sun Nov 26 02:48:05 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Sun, 26 Nov 2006 02:48:05 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> Message-ID: <933DCC29-2DA0-4EFE-BD0D-457B008D18F4@process-one.net> > C:\>erl > {"init terminating in do_boot",{'cannot get > bootfile','../../../bin/start.boot'}} well, i'm not a windows user and did not tested erl did you launched erts-5.5.2/windows/bin/erl.exe ? cean is started with start.bat on windows and start.sh on other systems if anyone can help making direct call to erl working... that could be a good point. From qrilka@REDACTED Sun Nov 26 09:21:37 2006 From: qrilka@REDACTED (Kirill Zaborski) Date: Sun, 26 Nov 2006 11:21:37 +0300 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <356E1D63-8494-4B33-AC22-CEE56936DBEA@process-one.net> References: <337538cb0611251443h2b82efa0yd7019d59b7984e81@mail.gmail.com> <356E1D63-8494-4B33-AC22-CEE56936DBEA@process-one.net> Message-ID: <337538cb0611260021y7b93655fn33ebfc3487e42a@mail.gmail.com> So I can simply ignore it? (I saw some talk about this issue erlrt and REPOS but could understand what does the problem mean) And what about problems with gs? On 11/26/06, Christophe Romain wrote: > > > "sh: line 0: exec: setuid_drv: not found" > this is a known issue, but yaws is working as this in embedded mode > anyway. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dirtyundies@REDACTED Sun Nov 26 15:02:55 2006 From: dirtyundies@REDACTED (Mikkel Jensen) Date: Sun, 26 Nov 2006 15:02:55 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <933DCC29-2DA0-4EFE-BD0D-457B008D18F4@process-one.net> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> <933DCC29-2DA0-4EFE-BD0D-457B008D18F4@process-one.net> Message-ID: <1cc074cf0611260602wdf099a2x98a74e42b172d41a@mail.gmail.com> > cean is started with start.bat on windows and start.sh on other systems > if anyone can help making direct call to erl working... that could be > a good point. Having compared my existing Erlang installation to the CEAN version I seem to have located the problem in the "erl.ini" file. After having switched to absolute paths I am now able to invoke erl directly and from Erlide. Whats more, newly installed modules are immediately available in the editor without having to restart Eclipse, very nice! - Mikkel From christophe.romain@REDACTED Sun Nov 26 15:10:56 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Sun, 26 Nov 2006 15:10:56 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <1cc074cf0611260602wdf099a2x98a74e42b172d41a@mail.gmail.com> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> <933DCC29-2DA0-4EFE-BD0D-457B008D18F4@process-one.net> <1cc074cf0611260602wdf099a2x98a74e42b172d41a@mail.gmail.com> Message-ID: <9B4BD7EE-057A-41FD-9158-DBA8112AEEA1@process-one.net> direct call to erl.exe should work when you chdir to the bin directory first (erlide cartainly does not do that) we can not fix absolute paths into erl.ini since we are not using an installer on windows. actually you can move the cean directory everywhere you need. From dirtyundies@REDACTED Sun Nov 26 17:15:21 2006 From: dirtyundies@REDACTED (Mikkel Jensen) Date: Sun, 26 Nov 2006 17:15:21 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: <9B4BD7EE-057A-41FD-9158-DBA8112AEEA1@process-one.net> References: <20061125151923.61349.qmail@web31507.mail.mud.yahoo.com> <870013B7-E17E-46C7-BC2B-54884088E747@process-one.net> <1cc074cf0611251351q87eeae1o6fa74f8e0acb7624@mail.gmail.com> <933DCC29-2DA0-4EFE-BD0D-457B008D18F4@process-one.net> <1cc074cf0611260602wdf099a2x98a74e42b172d41a@mail.gmail.com> <9B4BD7EE-057A-41FD-9158-DBA8112AEEA1@process-one.net> Message-ID: <1cc074cf0611260815x33bc9379o29619d87b6d0f274@mail.gmail.com> Tried installing the crypto application on win32 and ran into a small problem: Apparently the crypto_drv.dll file is not installed alongside the beam files, so I had to copy it from an existing installation. Are external resources managed by CEAN or is it just beam files? - Mikkel From nils.muellner@REDACTED Sun Nov 26 20:45:58 2006 From: nils.muellner@REDACTED (=?ISO-8859-15?Q?Nils_M=FCllner?=) Date: Sun, 26 Nov 2006 20:45:58 +0100 Subject: [erlang-questions] Erlang and Matlab Message-ID: <4569EEF6.3090904@heh.uni-oldenburg.de> Hi, I'm currently implementing a simulator for graphs, trees und similar structures. The output is the configuration of a matrix (the status of each node) and the number of the according step. My question: is it possible to stream the current output to Matlab for post-processing? An alternative approach would be to simulate N steps, stream everything into a file, open the file with Matlab and see if a certain delta is reached; if not, the scheduler continues. This is repeated until Matlab confirms that a desired stability in the behaviour of the graph is reached. Kind regards, Nils From marthin@REDACTED Mon Nov 27 00:16:18 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Mon, 27 Nov 2006 01:16:18 +0200 Subject: [erlang-questions] Common cold or exotic disease Message-ID: <00ca01c711b0$e4ed1f10$4800a8c0@MPGL00> Guys, My yaws log is riddled with Yaws process died: {{error,econnreset}, [{yaws,gen_tcp_send,2}, {yaws_server,deliver_accumulated,5}, {yaws_server,handle_ut,4}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p,5}]} Results (what gets to clients) - apparently not affected. Performance - affected. Frequency - Sickeningly often but sadly not consistently enough for a straight forward trace. Before I waste time and energy to trace, isolate and replicate the problem, does anybody recognise it as symptomatic of some known problem on my, gen_tcp or yaws's side? Thanks Marthin From marthin@REDACTED Mon Nov 27 05:42:30 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Mon, 27 Nov 2006 06:42:30 +0200 Subject: [erlang-questions] Common cold or exotic disease? Message-ID: <00cb01c711de$75f4ae10$4800a8c0@MPGL00> Guys, My yaws log is riddled with Yaws process died: {{error,econnreset}, [{yaws,gen_tcp_send,2}, {yaws_server,deliver_accumulated,5}, {yaws_server,handle_ut,4}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p,5}]} Results (what gets to clients) - apparently not affected. Performance - affected. Frequency - Sickeningly often but sadly not consistently enough for a straight forward trace. Before I waste time and energy to trace, isolate and replicate the problem, does anybody recognise it as symptomatic of some known problem on my, gen_tcp or yaws's side? Thanks Marthin From bengt.kleberg@REDACTED Mon Nov 27 08:57:38 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 27 Nov 2006 08:57:38 +0100 Subject: [erlang-questions] How to avoid copying code? In-Reply-To: <20061125105348.0879F5A06A@mail.erlangsystems.com> References: <20061125105348.0879F5A06A@mail.erlangsystems.com> Message-ID: <456A9A72.90601@ericsson.com> On 2006-11-25 11:53, Mazen wrote: ...deleted > Obviously this function definition is exactly the same in all 20-30 > modules, which I don't really like. Is there a way to define this > function only once? In Java I'd create an abstract ancestor class for how about having one module with the common code for this function, and then let all 20-30 other modules call this module for the common parts and only supply the module specific things (like values) on the 20-30 modules? bengt -- EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." From francesco@REDACTED Mon Nov 27 08:42:38 2006 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 27 Nov 2006 07:42:38 +0000 Subject: [erlang-questions] Common cold or exotic disease? In-Reply-To: <00cb01c711de$75f4ae10$4800a8c0@MPGL00> References: <00cb01c711de$75f4ae10$4800a8c0@MPGL00> Message-ID: <456A96EE.4010308@erlang-consulting.com> We have had similar problems in one of our client sites. We suspect the problem was with the inets driver and buffer overflows. The quick fix was to take a later version of the inets application, which solved the problem. Unfortunately, I do not have the inets version we were working with at hand. Will email it later today. Note that we were not running yaws. Regards, Francesco -- http://www.erlang-consulting.com Marthin Laubscher wrote: >Guys, > >My yaws log is riddled with > >Yaws process died: {{error,econnreset}, > [{yaws,gen_tcp_send,2}, > {yaws_server,deliver_accumulated,5}, > {yaws_server,handle_ut,4}, > {yaws_server,aloop,3}, > {yaws_server,acceptor0,2}, > {proc_lib,init_p,5}]} > >Results (what gets to clients) - apparently not affected. > >Performance - affected. > >Frequency - Sickeningly often but sadly not consistently enough for a >straight forward trace. > >Before I waste time and energy to trace, isolate and replicate the problem, >does anybody recognise it as symptomatic of some known problem on my, >gen_tcp or yaws's side? > >Thanks > >Marthin > > > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > From tobbe@REDACTED Mon Nov 27 09:53:57 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 27 Nov 2006 09:53:57 +0100 Subject: [erlang-questions] CEAN 1.0 beta available In-Reply-To: References: Message-ID: Excellente !! And here is a short session showing how to quickly deploy Yaws. --------------------------------------------------------------------- cean # ./start.sh Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.2 (abort with ^G) 1> cean:install(yaws). + compiler md5=<<110,234,169,104,95,149,68,50,43,241,10,196,247,222,157,126>> + fd_server md5=<<20,226,169,70,190,39,130,177,126,27,19,202,27,102,139,161>> + inets md5=<<19,105,15,109,40,101,51,109,135,112,237,103,3,222,24,177>> + mnesia md5=<<148,166,102,84,120,129,104,128,77,254,79,176,144,36,61,138>> + ssl md5=<<177,107,178,165,217,252,116,88,130,146,29,132,216,7,109,65>> + tools md5=<<192,165,89,32,255,13,131,179,97,92,37,255,139,20,171,179>> + xmerl md5=<<162,71,177,169,168,89,150,167,41,136,16,142,95,229,185,226>> + xmlrpc md5=<<221,141,193,136,115,42,102,157,76,121,251,167,2,255,64,47>> + yaws md5=<<"\b??+????\b?\tdW?Le">> ok 2> file:make_dir("/tmp/abc"). ok 3> file:write_file("/tmp/abc/index.yaws", <<"hello world">>). ok 4> inet:i(). Port Module Recv Sent Owner Local Address Foreign Address State Port Module Recv Sent Owner Local Address Foreign Address State ok 5> GL=[{trace,false},{tmpdir,"/tmp"},{flags,[{auth_log,false},{copy_errlog,false}]}]. [{trace,false},{tmpdir,"/tmp"},{flags,[{auth_log,false},{copy_errlog,false}]}] 6> SL=[{port,8000},{dir_listings, true},{flags,[{access_log,false}]}]. [{port,8000},{dir_listings,true},{flags,[{access_log,false}]}] 7> yaws:start_embedded("/tmp/abc", SL, GL). =INFO REPORT==== 27-Nov-2006::09:44:05 === Yaws: Listening to 127.0.0.1:8000 for servers - http://localhost:8000 under /tmp/abc ok 8> inet:i(). Port Module Recv Sent Owner Local Address Foreign Address State 87 inet_tcp 0 0 <0.49.0> localhost:8000 *:* ACCEPTING Port Module Recv Sent Owner Local Address Foreign Address State ok ----------------------------------------------------------------------- Now, point your browser to: http://localhost:8000/ Cheers, Tobbe (nb: you also got mnesia,ssl,xmerl,xmlrpc,fd_server...etc...very nice! Christophe Romain wrote: > Hello > > The Comprehensive Erlang Archive Network is available for testing. > CEAN aims to be a central place to find erlang packaged code. > > It now includes 193 binary packages, available for 17 platforms, > using R11B-2. > Packages are installed using erlang command line: administration is > the same regardless of the host system. Multi-host shared > installation is possible: you can build your USB key running your > Erlang application on windows, mac, linux using REPOS repository. > > All information is on web site http://cean.process-one.net > > We are actually working on: > - packages classification into categories (if you have any > suggestion, you're welcome). > - package finder improvement (keywords combination, usage of > description, etc...) > - debian packages generation > > We did not test the whole repository, some packages may be broken. > Any help would be appreciated ! > - package description checking > - package testing > - finding missing packages > > A build script is almost ready to allow people to build archives from > a package description file. Then, archives could be integrated to CEAN. > This will be released on the site at http://cean.process-one.net/ > contrib/ as soon as tests and documentation will be finished. > > Known issue: > ejabberd available only on MacOS X, Linux x86, Windows > erl_cgi available only on MacOS X PowerPC, Linux x86 > gtkNode available only on MacOS X PowerPC, Linux x86 > OpenBSD-x86 and SunOS-Sparc are available with R11B-0 in production > distribution only > > > Best Regards. > From attila.rajmund.nohl@REDACTED Mon Nov 27 13:43:16 2006 From: attila.rajmund.nohl@REDACTED (attila.rajmund.nohl@REDACTED) Date: Mon, 27 Nov 2006 13:43:16 +0100 (CET) Subject: [erlang-questions] How to avoid copying code? In-Reply-To: <456A9A72.90601@ericsson.com> References: <20061125105348.0879F5A06A@mail.erlangsystems.com> <456A9A72.90601@ericsson.com> Message-ID: On Mon, 27 Nov 2006, Bengt Kleberg wrote: > On 2006-11-25 11:53, Mazen wrote: > ...deleted >> Obviously this function definition is exactly the same in all 20-30 >> modules, which I don't really like. Is there a way to define this >> function only once? In Java I'd create an abstract ancestor class for > > how about having one module with the common code for this function, and > then let all 20-30 other modules call this module for the common parts > and only supply the module specific things (like values) on the 20-30 > modules? Actually this is what I'm trying to achieve. My problem was that how should I pass the module-specific values (in macros) to the common code. However, If I not call the common parts, but include them directly, I won't need to pass these data. For example, instead of: lib.erl: f(SomeData, ModuleSpecifiData) -> ... module.erl: lib:f(something, ?moduleData). I'd try this: lib.hrl: f(SomeData) -> ... use ?moduleData here module.erl: -include(lib.hrl). f(something). Bye,NAR -- "Beware of bugs in the above code; I have only proved it correct, not tried it." From luna@REDACTED Mon Nov 27 15:03:25 2006 From: luna@REDACTED (Daniel Luna) Date: Mon, 27 Nov 2006 15:03:25 +0100 (CET) Subject: [erlang-questions] How to avoid copying code? In-Reply-To: References: Message-ID: On Fri, 24 Nov 2006, attila.rajmund.nohl@REDACTED wrote: > Hello! > > I have a couple of modules (20-30) which define the same macros, like > this: > module1.erl: > -define(FOO, "something1"). > -define(BAR, "else1"). > > module2.erl: > -define(FOO, "something2"). > -define(BAR, "similar2"). > > And I also have a function in these modules that return the data of > these macros: > > get_data() -> > {?FOO, ?BAR}. > > Obviously this function definition is exactly the same in all 20-30 > modules, which I don't really like. Is there a way to define this > function only once? In Java I'd create an abstract ancestor class for > module1 and module2, declare the FOO and BAR variables there, also > implement the get_data() in the ancestor class and assign values to FOO > and BAR in the constructor of module1 and module2 (there is only one > instance of module1, etc. classes in the program). You could place the get_data() function in an included file. module1.erl: -include("stuff.hrl"). -define(FOO, "something1"). -define(BAR, "else1"). module2.erl: -include("stuff.hrl"). -define(FOO, "something2"). -define(BAR, "similar2"). stuff.hrl: get_data() -> {?FOO, ?BAR}. For more advanced usage of this kind of generic code there are a couple of uses in HiPE. See for instance "cfg.inc" and friends. Or "hipe_ssa_const_prop.inc". Or take a look at the amd64-backend. /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From H.Li@REDACTED Mon Nov 27 15:45:11 2006 From: H.Li@REDACTED (H.Li) Date: Mon, 27 Nov 2006 14:45:11 +0000 Subject: [erlang-questions] [Job Advert] Message-ID: <20061127144511.GA23032@myrtle.kent.ac.uk> Job: Erlang Training and Consulting and the University of Kent This announcment concerns a job opportunity at Erlang Training and Consulting and the University of Kent under the auspices of the Knowledge Transfer Partnerships scheme. Knowledge Transfer Partnerships support partnerships between business and universities or research organisations. For this KTP, Erlang Training and Consulting have joined forces with the Computing Laboratory at the University of Kent to create a KTP Associate position, with the aim of developing generic software components and adopting refactoring into the development process to speed up the deployment of new systems. Knowledge Transfer Partnerships: - Provide a springboard to accelerate your career - Offer an opportunity to gain valuable R&D experience in a commercial environment - Develop your personal, business and academic skills - Benefit from a strong support network involving company staff, academic experts and KTP consultants - Opportunity to lead and manage a project with defined goals - Deliver an excellent chance of a permanent post with the company partner - Provide business management qualifications - Offer an interesting, varied and challenging role Project The objective of the project is the development of a number of software components and techniques including: - A set of software components accessible through a web based interface. - Generic versions of the software components developed as above. - Routines and procedures for commercial systems release and deployment. - Refactoring support for component extraction. - Exemplar product for operation and maintenance as developed above. - Training for ETC's staff over generic component extraction and usage. The suitable candidate will: - Be qualified to a good honours degree (2.1 or 1st) in MSc or BSc in Computer Science, or equivalent and ideally have experience of using Erlang and of working with industry. - Have a grounding in functional and concurrent programming, and in computer systems and an evidence of passion for technology. If you'd like to discuss any aspects of this position please mail me at s.j.thompson@REDACTED If you are interested in this exciting career opportunity please send CV and a one-page summary (three copies of each) quoting reference 121, together with the names and addresses of three referees to Staff Recruitment, Room 121, Registry, University of Kent, Canterbury, Kent CT2 7NZ. Or email, Jobvacancies@REDACTED Please ensure that all documents are attached in Word or PDF format only. Closing date for applications: 1/12/2006, Interviews will be held at the ETC offices in London on the 12/12/2006. For full job specification please visit: http://www.kent.ac.uk/jobs/research/121.html Simon ----------------------------------------------------------------------- Simon Thompson S.J.Thompson@REDACTED Director and Professor of Logic and Computation Computing Laboratory phone: +44-1227-823820 University of Kent fax: +44-1227-762811 Canterbury, Kent CT2 7NF, UK www.cs.kent.ac.uk/~sjt/ ----------------------------------------------------------------------- ----- End forwarded message ----- From patrickerj@REDACTED Mon Nov 27 16:37:35 2006 From: patrickerj@REDACTED (Pat e) Date: Mon, 27 Nov 2006 16:37:35 +0100 Subject: [erlang-questions] Mnesia table per user? Message-ID: I am thinking about using Partition Attributes Across (PAX) modeling for our db. Now besides using mutual attributes for all users (gender, address, .....) we are thinking about using a table for each customer forum comments, blogs, personal correspondence.... Now would it be resource wise to have table with binary data in it for each user, counting by 100,000 - 1MM users?? Only thing i see valuable in this is the ease of account management, i.e. when abuse comes into place by the user his account, and his messages in separate personal table can be easily removed from the system. What do you think?? Thanks in advance, Patrick From Martin.Logan@REDACTED Mon Nov 27 18:08:19 2006 From: Martin.Logan@REDACTED (Logan, Martin) Date: Mon, 27 Nov 2006 11:08:19 -0600 Subject: [erlang-questions] who won the obfuscated erlang competition? In-Reply-To: <4565C366.1010905@erlang-consulting.com> Message-ID: <26AB42AB6A76E2419D26E66ECF1538468B3411@chiresexc02.resource.corp.lcl> You crazy kids and your tricks ;-) -----Original Message----- From: Francesco Cesarini [mailto:francesco@REDACTED] Sent: Thursday, November 23, 2006 9:51 AM To: Logan, Martin Cc: Ulf Wiger (TN/EAB); Erlang Subject: Re: [erlang-questions] who won the obfuscated erlang competition? There is the beauty.. It does compile :-) Luckily, the author included instructions on how to bypass the bug and generate a beam file. Francesco -- http://www.erlang-consulting.com Logan, Martin wrote: >I thought the rule stipulated that it had to compile? > >-----Original Message----- >From: erlang-questions-bounces@REDACTED >[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Francesco >Cesarini >Sent: Wednesday, November 22, 2006 5:34 AM >To: Ulf Wiger (TN/EAB) >Cc: Erlang >Subject: Re: [erlang-questions] who won the obfuscated erlang >competition? > >It was not announced. The judges called it a tie between Laurent >Picouleau and Richard Carlsson. Laurent submitted a Sudoku solver which >when compiled, did not produce a beam file... And Richard Carlsson, >through his ingenious use of the error handler, produced something >simple, but really obfuscated. We hope to post the results this week, so > >you can all have a laugh. > >Regards, >Francesco >-- >http://www.erlang-consulting.com > >Ulf Wiger (TN/EAB) wrote: > > > >>... or did I miss the announcement at the EUC? >> >>/Ulf W >> >>---------------------------------------------------------------------- - >> >> >- > > >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://www.erlang.org/mailman/listinfo/erlang-questions >> >> >> >> > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://www.erlang.org/mailman/listinfo/erlang-questions > > > > From ulf@REDACTED Tue Nov 28 00:14:38 2006 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 28 Nov 2006 00:14:38 +0100 Subject: [erlang-questions] Mnesia table per user? In-Reply-To: References: Message-ID: Den 2006-11-27 16:37:35 skrev Pat e : > I am thinking about using Partition Attributes Across (PAX) modeling > for our db. > Now besides using mutual attributes for all users (gender, address, > .....) we are thinking about using a table for each customer forum > comments, blogs, personal correspondence.... That is certainly elegant in some ways, but... > Now would it be resource wise to have table with binary data in it for > each user, counting by 100,000 - 1MM users?? For that many users, you won't be able to have a table each. Each erlang node is limited to around 50,000 ets tables (the limit is configurable, but that's the ballpark, I think. In the old days, there were some parts in the ets code that would actually do a linear seach through the table of tables.) Also, mnesia will do fine with a few thousand tables, but will probably be in deep trouble with a million. The table loading code is not designed for that. BR, Ulf W -- Ulf Wiger From tty.erlang@REDACTED Tue Nov 28 18:27:32 2006 From: tty.erlang@REDACTED (t ty) Date: Tue, 28 Nov 2006 12:27:32 -0500 Subject: [erlang-questions] Slave node terminating Message-ID: <290b3ba10611280927u276beac8y4df1f371bbac8370@mail.gmail.com> For some reason my slave nodes are terminating and I'm not sure why or how to prevent it from happening. Version of erl is: Erlang (BEAM) emulator version 5.5.1 [source] [async-threads:0] [hipe] under Linux (SuSE 10.1). I am starting the system with Yaws (v1.64) in embedded mode. Yaws is working fine but for some odd reason any slave nodes I start terminates after a minute or two. If I do not have Yaws running the slave nodes stay up pass this critical time. How can I get the slave nodes to indicate why they are terminating ? I tried running sasl on the slave nodes but did not get any extra info. Thanks t From klacke@REDACTED Tue Nov 28 21:50:17 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 28 Nov 2006 21:50:17 +0100 Subject: [erlang-questions] Common cold or exotic disease In-Reply-To: <00ca01c711b0$e4ed1f10$4800a8c0@MPGL00> References: <00ca01c711b0$e4ed1f10$4800a8c0@MPGL00> Message-ID: <456CA109.4080808@hyber.org> Marthin Laubscher wrote: > Guys, > > My yaws log is riddled with > Yaws process died: {{error,econnreset}, > [{yaws,gen_tcp_send,2}, > {yaws_server,deliver_accumulated,5}, > {yaws_server,handle_ut,4}, > {yaws_server,aloop,3}, > {yaws_server,acceptor0,2}, > {proc_lib,init_p,5}]} > Results (what gets to clients) - apparently not affected. > Performance - affected. > Frequency - Sickeningly often but sadly not consistently enough for a > straight forward trace. > > Before I waste time and energy to trace, isolate and replicate the problem, > does anybody recognise it as symptomatic of some known problem on my, Same error/issue as we've had up on the list here earlier. It's the client that close its end before we get to deliver all data for a request. It's not an error and thus shouldn't produce any data in the errorlog. Fixed this one as well in CVS. Next release ..... /klacke From nm@REDACTED Tue Nov 28 20:05:13 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 28 Nov 2006 23:05:13 +0400 Subject: [erlang-questions] bug in {packet, http} with extra-long headers Message-ID: <456C8869.4020302@web.am> Hi there! It seems that socket opened with option {packet, http} have a bug when some really huge header comes in. First portion of Header line is read properly and second half returned as {http_error, Text} tuple. Size of first part is about 1600 symbols. May be there are limitations in http option implementation in C code, which restrict it to 1.5k? In practice I'm trying to do quite ordinary thing -- send http request to ebay.com :) and it stores a lot of info in a cookie (over 2k). Should I find some place in C code and just fix it to larger number, or there is some workaround? Thanks, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e nm@REDACTED From marthin@REDACTED Tue Nov 28 23:08:54 2006 From: marthin@REDACTED (Marthin Laubscher) Date: Wed, 29 Nov 2006 00:08:54 +0200 Subject: [erlang-questions] Common cold or exotic disease In-Reply-To: <456CA109.4080808@hyber.org> Message-ID: <000a01c71339$d16c0750$4800a8c0@MPGL00> > Claes Wikstrom wrote: > > Marthin Laubscher wrote: > > Guys, > > > > My yaws log is riddled with > > Yaws process died: {{error,econnreset}, > > [{yaws,gen_tcp_send,2}, > > {yaws_server,deliver_accumulated,5}, > > {yaws_server,handle_ut,4}, > > {yaws_server,aloop,3}, > > {yaws_server,acceptor0,2}, > > {proc_lib,init_p,5}]} > > Results (what gets to clients) - apparently not affected. > > Performance - affected. > > Frequency - Sickeningly often but sadly not consistently enough for a > > straight forward trace. > > > > Before I waste time and energy to trace, isolate and replicate the > problem, > > does anybody recognise it as symptomatic of some known problem on my, > > Same error/issue as we've had up on the list here earlier. It's > the client that close its end before we get to deliver all data for > a request. It's not an error and thus shouldn't produce any data > in the errorlog. Fixed this one as well in CVS. > Next release ..... > > > /klacke Thank you so much. I looked for but missed the previous discussion probably because of wrong keywords. Perhaps you refer to the http://erlang.org/ml-archive/erlang-questions/200603/msg00173.html thread which got a bit inflamed? If it's going to happen often and means nothing then not crashing but recovering quickly seems the way to go. On a pragmatic level, is it truly not an error or (another) something a server has no opportunity/means to control? Most importantly, how would (with/without the mod) one interpret the log when trying prove/disprove incomplete data causing client issues. In our case we're not aware of anything (of value) actually not reaching the client but I would need to consider whether that's what happens or not. Thanks again, Marthin From karol.skocik@REDACTED Wed Nov 29 13:36:56 2006 From: karol.skocik@REDACTED (karol skocik) Date: Wed, 29 Nov 2006 13:36:56 +0100 Subject: [erlang-questions] yaws session timeout Message-ID: Hi, I know that's not very polite to ask specific Yaws questions on Erlang's general mailing list, but I hope somebody could help me with sessions in Yaws. Sorry for this, I would like to avoid signing to yet another one mailing-list I would like to know whether it is possible to extend time to live (TTL) value of already created session. The reason for this is that while the user can be inactive in our application for more than 30 minutes, other ajax requests are served simultaneously on the background, showing some monitorings to user. But since this is not meant as user interaction, session expires and user has to log in again. I know there is a function yaws_api:replace_cookie_session(Cookie, NewOpaque), but I don't know how to pass the TTL information this way. Is there some simple solution help me out? Thank you, Karol From mickael.remond@REDACTED Wed Nov 29 14:18:06 2006 From: mickael.remond@REDACTED (=?ISO-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Wed, 29 Nov 2006 14:18:06 +0100 Subject: [erlang-questions] eio error on startup Message-ID: <355662E6-6848-48DD-9DB7-F6C94DCB7566@process-one.net> Hello, I was wondering if someone has already seen this type of error during node startup ? =CRASH REPORT==== 29-Nov-2006::11:18:23 === crasher: pid: <0.28.0> registered_name: [] error_info: eio initial_call: {gen,init_it, [gen_server, <0.9.0>, <0.9.0>, supervisor_bridge, [user_sup,[],self], []]} ancestors: [kernel_sup,<0.8.0>] messages: [] links: [<0.9.0>] dictionary: [] trap_exit: true status: running heap_size: 233 stack_size: 21 reductions: 188 Do you know what it means ? It happens on Erlang R11B-0 Thank you ! -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Wed Nov 29 15:26:52 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 29 Nov 2006 15:26:52 +0100 Subject: [erlang-questions] yaws session timeout In-Reply-To: References: Message-ID: <456D98AC.20300@hyber.org> karol skocik wrote: > > I know there is a function yaws_api:replace_cookie_session(Cookie, > NewOpaque), but I don't know how to pass the TTL information this way. > Is there some simple solution help me out? > If you invoke replace_cookie__session() the ttl will be updated as in now() + originalTTL Thus - using replace_cookie_session() will also give the session new and more time. See code in yaws_session_server.erl /klacke From chandrashekhar.mullaparthi@REDACTED Wed Nov 29 18:46:52 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 29 Nov 2006 17:46:52 +0000 Subject: [erlang-questions] Slave node terminating In-Reply-To: <290b3ba10611280927u276beac8y4df1f371bbac8370@mail.gmail.com> References: <290b3ba10611280927u276beac8y4df1f371bbac8370@mail.gmail.com> Message-ID: On 28/11/06, t ty wrote: > > How can I get the slave nodes to indicate why they are terminating ? I > tried running sasl on the slave nodes but did not get any extra info. > Did you configure sasl to specify where it should write it's log files? We have something like this in our sys.config {sasl, [{error_logger_mf_dir, "/export/home/otpuser/blahblah/sasl_logfiles/"}, {error_logger_mf_maxbytes, 100000}, {error_logger_mf_maxfiles, 8}]} This then produces binary log files which can be "read" using the rb module. Chandru From tty.erlang@REDACTED Wed Nov 29 19:00:55 2006 From: tty.erlang@REDACTED (t ty) Date: Wed, 29 Nov 2006 13:00:55 -0500 Subject: [erlang-questions] Slave node terminating In-Reply-To: References: <290b3ba10611280927u276beac8y4df1f371bbac8370@mail.gmail.com> Message-ID: <290b3ba10611291000w21904588o919b7bb59c2b3dca@mail.gmail.com> What I had was -sasl sasl_error_logger '{file, \"/var/log/slave.log}\" as Args to slave:start_link. I also traped exit and found the exit status was normal. For some reason if I used slave:start_link with the embedded Yaws the slave nodes would terminate but if I use slave:start it works fine (as in running overnight). I'll give your options a try. Thanks t On 11/29/06, Chandru wrote: > On 28/11/06, t ty wrote: > > > > How can I get the slave nodes to indicate why they are terminating ? I > > tried running sasl on the slave nodes but did not get any extra info. > > > > > Did you configure sasl to specify where it should write it's log > files? We have something like this in our sys.config > > {sasl, [{error_logger_mf_dir, > "/export/home/otpuser/blahblah/sasl_logfiles/"}, > {error_logger_mf_maxbytes, 100000}, > {error_logger_mf_maxfiles, 8}]} > > This then produces binary log files which can be "read" using the rb module. > > Chandru > From fbg111@REDACTED Thu Nov 30 08:04:22 2006 From: fbg111@REDACTED (fbg111) Date: Wed, 29 Nov 2006 23:04:22 -0800 (PST) Subject: [erlang-questions] Erlang & PS3/Cell? Message-ID: <7614559.post@talk.nabble.com> I've been thinking about getting a PS3 mainly to install Linux on and play around with the Cell. Anyone know if Erlang can run processes on the Cell's SPE's? Anyone else thinking about this too? Thanks, Byron -- View this message in context: http://www.nabble.com/Erlang---PS3-Cell--tf2730018.html#a7614559 Sent from the Erlang Questions mailing list archive at Nabble.com. From chsu79@REDACTED Thu Nov 30 10:12:02 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 30 Nov 2006 10:12:02 +0100 Subject: [erlang-questions] Erlang & PS3/Cell? In-Reply-To: <7614559.post@talk.nabble.com> References: <7614559.post@talk.nabble.com> Message-ID: I'm quite eager to play with the Cell processor as well. From what I understand the SPEs have their own instruction set, have SIMD ALUs and are restricted to 256kb of local memory. Somehow I doubt Erlang is a good language to take advantage of the SPE's abilities. Not only is there no target for the SPE's instruction set, erlang isnt very good for expressing programs that can be parallellised. (Concurrency is not parallellism.) Erlang could potentially be good on the Cell's controlling PPC chip, loading code to SPEs and reacting when results have been obtained. Doing the operative work. Maybe to set up several ps3s in a cluster for heavy calculations. On 11/30/06, fbg111 wrote: > > I've been thinking about getting a PS3 mainly to install Linux on and play > around with the Cell. Anyone know if Erlang can run processes on the Cell's > SPE's? Anyone else thinking about this too? Thanks, > > Byron > -- > View this message in context: http://www.nabble.com/Erlang---PS3-Cell--tf2730018.html#a7614559 > Sent from the Erlang Questions mailing list archive at Nabble.com. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions >