From yariv@REDACTED Mon May 1 17:57:00 2006 From: yariv@REDACTED (Yariv Sadan) Date: Mon, 1 May 2006 11:57:00 -0400 Subject: mnesia and large blobs Message-ID: Hi, I'm an Erlang/Mnesia newbie considering using Erlang for a future project. I would like to know how Mnesia's handling of large blobs and clobs compares to other RDBMS. I found an old discussion (from 1999) about the topic at http://www.erlang.org/ml-archive/erlang- questions/199910/msg00059.html, where it was suggested that Mnesia doesn't handle large blobs well due to the slow rebuilding of the dets file in the event of a crash and due to the large replication cost between nodes. Does anyone know if these issues are still relevant? Does Mnesia now have better handling of these features than it used to? Any insight is appreciated. Yariv From jay@REDACTED Tue May 2 04:07:29 2006 From: jay@REDACTED (Jay Nelson) Date: Mon, 01 May 2006 19:07:29 -0700 Subject: File sharing software Message-ID: <4456BEE1.7000906@duomark.com> Everyone seems to be using digital cameras and video cameras. They are emailing the results among family and friends. A new group of companies is providing a file sharing alternative instead of email, that is built on peer-to-peer or even bit torrent: http://money.cnn.com/2006/05/01/technology/business2_launchpad0501/index.htm This should be a no brainer type application for erlang, except for the big install. I know Joe has talked about setting up a public peer-to-peer network for erlang apps. This brings up the perennial question of the stripped version of erlang. If there was a 1MB install that was a single file or single click, it would be an ideal way to set up this sort of distribution network. Anyone pursuing anything along these lines? jay From yariv@REDACTED Tue May 2 05:54:51 2006 From: yariv@REDACTED (Yariv Sadan) Date: Mon, 1 May 2006 23:54:51 -0400 Subject: File sharing software In-Reply-To: <4456BEE1.7000906@duomark.com> References: <4456BEE1.7000906@duomark.com> Message-ID: <43682575-5EAB-4E42-9216-A4E79E56BA5E@pando.com> Jay, It's funny you bring up this article, because I developed Pando's P2P core in C, and actually looked at Erlang as a potential language for some backend components. I'm not an Erlang expert, but I did quite a lot of research into it and found its unique clustering features and high level semantics quite appealing. Some issues that I didn't find very reassuring, however, were mnesia's rather limited table size (2 GB according to http://www.erlang.org/doc/doc-5.4.13/lib/ stdlib-1.13.12/doc/html/index.html) and unsuitability for handling large blobs (noted at http://www.erlang.org/ml-archive/erlang- questions/199910/msg00059.html). (By the way, if anybody knows of solutions to these issues, please let me know.) Clearly, the size of the Erlang runtime made Erlang too heavy for the client, which needed to be as light as possible. I would have only considered Erlang if the runtime were no more than a few hundred KB. But then again, my personal philosophy is that when you're developing client software, stick to C/C++, which may be harder to write bulletproof code in but in the long run pay dividends in user satisfaction (a good example is how uTorrent has eclipsed Azureus as the most popular BitTorrent client primarily due to its small footprint). Having said that, maybe "Erlang lite" is a perfect fit for the app you have in mind, which I can't claim to know fully :) Yariv On May 1, 2006, at 10:07 PM, Jay Nelson wrote: Everyone seems to be using digital cameras and video cameras. They are emailing the results among family and friends. A new group of companies is providing a file sharing alternative instead of email, that is built on peer-to-peer or even bit torrent: http://money.cnn.com/2006/05/01/technology/business2_launchpad0501/ index.htm This should be a no brainer type application for erlang, except for the big install. I know Joe has talked about setting up a public peer-to-peer network for erlang apps. This brings up the perennial question of the stripped version of erlang. If there was a 1MB install that was a single file or single click, it would be an ideal way to set up this sort of distribution network. Anyone pursuing anything along these lines? jay From heinrich@REDACTED Tue May 2 08:30:09 2006 From: heinrich@REDACTED (Heinrich Venter) Date: Tue, 2 May 2006 08:30:09 +0200 Subject: strange httpd Message-ID: Julian I cant realy say what happened with these requests. However, the [54,52,56] as length means "648". It is what happens when you use something like: io:format("~w",["648"]). (instead of the ~s or ~p format) As a side note, rather use Yaws than httpd. From my experience with httpd thusfar, it was a mistake to use it in a production environment. -]-[ From vlad.xx.dumitrescu@REDACTED Tue May 2 09:09:53 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Tue, 2 May 2006 09:09:53 +0200 Subject: File sharing software Message-ID: <11498CB7D3FCB54897058DE63BE3897C018B5767@esealmw105.eemea.ericsson.se> Hi, > This brings up the perennial question of the stripped version > of erlang. If there was a 1MB install that was a single file > or single click, it would be an ideal way to set up this sort > of distribution network. > > Anyone pursuing anything along these lines? You can always look at http://erlrt.process-one.net/ for a light version of the erlang runtime. There was an announcement about it for some month ago. Seems to work nicely from the superficial testing I did. Regards, Vlad From chris@REDACTED Tue May 2 09:25:29 2006 From: chris@REDACTED (Christophe Romain) Date: Tue, 2 May 2006 09:25:29 +0200 Subject: File sharing software In-Reply-To: <4456BEE1.7000906@duomark.com> References: <4456BEE1.7000906@duomark.com> Message-ID: <4b02fdf79df70808ce12afeb7df4c949@erlang-fr.org> > This brings up the perennial question of the stripped version of > erlang. If there was a 1MB install that was a single file or single > click, it would be an ideal way to set up this sort of distribution > network. just look at erlrt http://erlrt.process-one.net/ you can use the 3Mb self extractable archive of stripped erlang with minimal library set if you need dependencies, you can install otp libraries like this: list available packages > erlrt:available(). list installed packages > erlrt:installed(). install a package > erlrt:install(mnesia). uninstall a package > erlrt:uninstall(mnesia). you can even try the experimental repos light, which is working on linux, windows and mac. regards. From mickael.remond@REDACTED Tue May 2 10:39:07 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 2 May 2006 10:39:07 +0200 Subject: IBM developerWorks article Message-ID: <20060502083907.GB17670@memphis.ilius.fr> Bruce Tate has published a nice introduction article on Erlang concurrency approach on IBM DeveloperWorks site. He compares Erlang comcurrency model with Java approach. Bruce finds that the Erlang approach for concurrent development is well suited and very efficient to develop parallel applications. Here is an interesting abstract: "So Erlang simplifies the math behind building correct programs because the interactions between modules are all explicit and well defined. Also, the property of single assignment eliminates several kinds of common concurrency bugs. I've written only a few programs in Erlang that were only marginally more than trivial applications, but it struck me for the first time I could directly employ many of the techniques that I learned in my distributed-systems coursework at the University of Texas. I'll never be a concurrency expert, but in this case, a programming language brought some theory to life for me." The full article is available from: http://www-128.ibm.com/developerworks/java/library/j-cb04186.html?ca=drs- Cheers, -- Micka?l R?mond http://www.process-one.net/ From karol.skocik@REDACTED Tue May 2 10:45:03 2006 From: karol.skocik@REDACTED (karol skocik) Date: Tue, 2 May 2006 10:45:03 +0200 Subject: Problem exporting content with XMERL Message-ID: Hi, I am trying to export content, but XMERL dies with error. The content looks like this : simple() -> {document, [{title, "Doc Title"}, {author, "Ulf Wiger"}], [{section, [{heading, "heading1"}], [{'P', "This is a paragraph of text."}, {section, [{heading, "heading2"}], [{'P', "This is another paragraph."}, {table, [{border, 1}], [{heading, [{col, "head1"}, {col, "head2"}]}, {row, [{col, "col11"}, {col, "col12"}]}, {row, [{col, "col21"}, {col, "col22"}]}]}]}]}]}. -- it is the same content as used in Ulf's presentation. Next, I am doing the same as in presentation : xmerl:export_simple(dvbh_xml:simple(), xmerl_xml, [{title, "Doc Title"}]). but there is a problem. The whole session looks like this: (ipe@REDACTED)13> dvbh_xml:simple(). {document,[{title,"Doc Title"},{author,"Ulf Wiger"}], [{section,[{heading,"heading1"}], [{'P',"This is a paragraph of text."}, {section,[{heading,"heading2"}], [{'P',"This is another paragraph."}, {table,[{border,1}], [{heading,[{col,"head1"},{col,"head2"}]}, {row,[{col,"col11"},{col,"col12"}]}, {row,[{col,"col21"},{col|...}]}]}]}]}]} (ipe@REDACTED)14> xmerl:export_simple(dvbh_xml:simple(), xmerl_xml, [{title, "Doc Title"}]). =ERROR REPORT==== 2-May-2006::10:32:28 === Error in process <0.289.0> on node 'ipe@REDACTED' with exit value: {function_clause,[{xmerl_lib,expand_content,[{document,[{title,"Doc Title"},{author,"Ulf Wiger"}],[{section,[{heading,"heading1"}],[{'P',"This is a paragraph of text."},{section,[{heading,"heading2"}],[{'P',"This is anothe... ** exited: {function_clause,[{xmerl_lib, expand_content, [{document, [{title,"Doc Title"}, {author,"Ulf Wiger"}], [{section, [{heading,"heading1"}], [{'P', "This is a paragraph of text."}, {section, [{heading,"heading2"}], [{'P', "This is another paragraph."}, {table, [{...}], [...]}]}]}]}, 1, [], false]}, {xmerl,export_simple1,3}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** Does anybody know what is the problem? I am using latest Erlang on Linux/x86. Karol From matthias@REDACTED Tue May 2 11:37:43 2006 From: matthias@REDACTED (Matthias Lang) Date: Tue, 2 May 2006 11:37:43 +0200 Subject: IBM developerWorks article In-Reply-To: <20060502083907.GB17670@memphis.ilius.fr> References: <20060502083907.GB17670@memphis.ilius.fr> Message-ID: <17495.10343.459412.25534@antilipe.corelatus.se> > The full article is available from: > http://www-128.ibm.com/developerworks/java/library/j-cb04186.html?ca=drs- I mailed the author a few nice words and reported about a couple of buglets in his examples (the third argument for spawn is a list, and the factorial example he uses is a bit big--it half kills my machine...) Another thing I noticed was that he used the 'math' module as an example. I expected that to fail with the usul 'sticky' error message, but it does actually work. In fact: | 2> m(math). | Module math compiled: Date: May 2 2006, Time: 09.24 | Compiler options: [] | Object file: /tmp/math.beam | Exports: | acos/1 fact/1 | acosh/1 fib/1 | asin/1 log/1 On the bug/feature continuum, I think this would place somewhere near the 'unintended feature' signpost. ;-) Matthias From ulf.wiger@REDACTED Tue May 2 11:58:58 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 2 May 2006 11:58:58 +0200 Subject: IBM developerWorks article Message-ID: The following phrase from the sidebar was a good one: "The programming landscape has changed since Java technology was the obvious best choice for all development projects." I kind of reminds me of those subatomic particles that are so short-lived that they exist only within the bounds of the uncertainty principle. (: /Ulf W From joelr1@REDACTED Tue May 2 12:00:00 2006 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 2 May 2006 11:00:00 +0100 Subject: Oracle on Linux Message-ID: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> Folks, Is anyone using Oracle with Erlang on Linux? Are you using a commercial ODBC driver? I'm ideally looking for an OCI binding or a free Linux ODBC driver. Thanks, Joel -- http://wagerlabs.com/ From chaitanya.chalasani@REDACTED Tue May 2 12:45:23 2006 From: chaitanya.chalasani@REDACTED (Chaitanya Chalasani) Date: Tue, 2 May 2006 16:15:23 +0530 Subject: Oracle on Linux In-Reply-To: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> Message-ID: <200605021615.23508.chaitanya.chalasani@gmail.com> On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > Folks, > > Is anyone using Oracle with Erlang on Linux? Are you using a > commercial ODBC driver? > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > Thanks, Joel > > -- > http://wagerlabs.com/ We tried using a free ODBC for oracle on linux but we faced lot of functional issues and performance issues. We built an application using OCI and used erlang ports. The performace is quite good and implemented all the features we required. -- Chaitanya Chalasani ------------------- "The ultimate truths of nature are so subtle that they can be revealed only under immense silence" From joelr1@REDACTED Tue May 2 13:25:07 2006 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 2 May 2006 12:25:07 +0100 Subject: R10B-10 install failing on Linux Message-ID: <4559F73E-E0C2-4B35-8588-B507566A3C1F@gmail.com> uname -a Linux repdb2.cur 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:32:18 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux configure --prefix=/home/jreymont/software ... make ... make install ... === Leaving application hipe make[2]: Leaving directory `/home/jreymont/otp_src_R10B-10/lib/hipe' make[1]: Leaving directory `/home/jreymont/otp_src_R10B-10/lib' cd /home/jreymont/software/lib/erlang && ./Install -minimal /home/ jreymont/software/lib/erlang /bin/sh: line 1: ./Install: No such file or directory make: *** [install.Install] Error 127 -- http://wagerlabs.com/ From matthias@REDACTED Tue May 2 13:51:29 2006 From: matthias@REDACTED (Matthias Lang) Date: Tue, 2 May 2006 13:51:29 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> References: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> Message-ID: <17495.18369.270902.849648@antilipe.corelatus.se> Kostis Sagonas writes: > I've kept quiet till now, because I did not want to reveal the HiPE > magic to the world, So, finally, zero-copy message passing is possible in Erlang. I offer the first example of abuse. Matthias ---------------------------------------------------------------------- -module(kostis). -export([go/0]). go() -> Bin = hipe_bifs:bytearray(100, 0), spawn(fun() -> wait(Bin) end), timer:sleep(5000), hipe_bifs:bytearray_update(Bin, 0, 9). wait(<<9, _/binary>>) -> io:fwrite("got the message\n"); wait(Bin) -> wait(Bin). From joelr1@REDACTED Tue May 2 14:22:51 2006 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 2 May 2006 13:22:51 +0100 Subject: R10B-10 install failing on Linux In-Reply-To: <4559F73E-E0C2-4B35-8588-B507566A3C1F@gmail.com> References: <4559F73E-E0C2-4B35-8588-B507566A3C1F@gmail.com> Message-ID: <39DB2C02-BBB5-456A-A98F-58E840374EE9@gmail.com> This appears to have nothing to do with Erlang. Somehow /usr/bin/ install ... does not install on my system :-(. On May 2, 2006, at 12:25 PM, Joel Reymont wrote: > === Leaving application hipe > make[2]: Leaving directory `/home/jreymont/otp_src_R10B-10/lib/hipe' > make[1]: Leaving directory `/home/jreymont/otp_src_R10B-10/lib' > cd /home/jreymont/software/lib/erlang && ./Install -minimal /home/ > jreymont/software/lib/erlang > /bin/sh: line 1: ./Install: No such file or directory > make: *** [install.Install] Error 127 -- http://wagerlabs.com/ From mikpe@REDACTED Tue May 2 14:28:08 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 2 May 2006 14:28:08 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: <17495.18369.270902.849648@antilipe.corelatus.se> References: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> <17495.18369.270902.849648@antilipe.corelatus.se> Message-ID: <17495.20568.678756.300346@alkaid.it.uu.se> Matthias Lang writes: > Kostis Sagonas writes: > > > I've kept quiet till now, because I did not want to reveal the HiPE > > magic to the world, > > So, finally, zero-copy message passing is possible in Erlang. I offer > the first example of abuse. > > Matthias > > ---------------------------------------------------------------------- > > -module(kostis). > -export([go/0]). > > go() -> > Bin = hipe_bifs:bytearray(100, 0), > spawn(fun() -> wait(Bin) end), > timer:sleep(5000), > hipe_bifs:bytearray_update(Bin, 0, 9). > > wait(<<9, _/binary>>) -> io:fwrite("got the message\n"); > wait(Bin) -> wait(Bin). Neat :-) Be advised that 1. Whether HiPE's bytearrays are copied or remain shared on message sends is unspecified, and currently depends on the heap model of the runtime system (private, shared, hybrid), and on the size of the array. IOW, you shouldn't rely on that aspect. 2. There are plans to change HiPE's bytearrays to improve performance. I'm not making any guarantees that this will preserve their behaviour wrt sharing/copying on message sends. They are used to good measure in the HiPE compiler, and they are clearly useful for fixing slow microbenchmarks, but programmers in general should NOT rely on them in any way. Now, if Erlang had general arrays with O(1) indexing and update operations I would be a happy programmer. But there are sound reasons, both language- philosophical ones and implementation-technical ones, why this is not the case. /Mikael From robert.virding@REDACTED Tue May 2 14:47:22 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 02 May 2006 14:47:22 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: <17495.20568.678756.300346@alkaid.it.uu.se> References: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> <17495.18369.270902.849648@antilipe.corelatus.se> <17495.20568.678756.300346@alkaid.it.uu.se> Message-ID: <445754DA.1000005@telia.com> I think it sucks! Ets tables are bad enough, at least they can be modelled with processes, but now we have global variables. :-( Robert Mikael Pettersson skrev: > Be advised that > 1. Whether HiPE's bytearrays are copied or remain shared on message > sends is unspecified, and currently depends on the heap model of > the runtime system (private, shared, hybrid), and on the size of > the array. IOW, you shouldn't rely on that aspect. > 2. There are plans to change HiPE's bytearrays to improve performance. > I'm not making any guarantees that this will preserve their > behaviour wrt sharing/copying on message sends. > > They are used to good measure in the HiPE compiler, and they are clearly > useful for fixing slow microbenchmarks, but programmers in general should > NOT rely on them in any way. > > Now, if Erlang had general arrays with O(1) indexing and update operations > I would be a happy programmer. But there are sound reasons, both language- > philosophical ones and implementation-technical ones, why this is not the case. > > /Mikael > From mats.cronqvist@REDACTED Tue May 2 14:52:06 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 02 May 2006 14:52:06 +0200 Subject: shootout - nsieve-bits benchmark In-Reply-To: <17495.20568.678756.300346@alkaid.it.uu.se> References: <200604231912.k3NJCUh4018136@spikklubban.it.uu.se> <17495.18369.270902.849648@antilipe.corelatus.se> <17495.20568.678756.300346@alkaid.it.uu.se> Message-ID: <445755F6.5060904@ericsson.com> Mikael Pettersson wrote: > Matthias Lang writes: > > Kostis Sagonas writes: > > > > > I've kept quiet till now, because I did not want to reveal the HiPE > > > magic to the world, > > > > So, finally, zero-copy message passing is possible in Erlang. I offer > > the first example of abuse. > > [...] > [bytearrays] are used to good measure in the HiPE compiler, and they are clearly > useful for fixing slow microbenchmarks, but programmers in general should > NOT rely on them in any way. i'm sure i could speed up some of the benchmarks by using linked-in drivers... but "fixing benchmarks" seems against the spirit of the Shootout. > Now, if Erlang had general arrays with O(1) indexing and update operations > I would be a happy programmer. But there are sound reasons, both language- > philosophical ones and implementation-technical ones, why this is not the case. indeed. since the bytearrays are not only undocumented and unsupported, but also very un-Erlangy, perhaps they should not be advertised on the Shootout web? mats From bertil.karlsson@REDACTED Tue May 2 15:41:59 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 02 May 2006 15:41:59 +0200 Subject: Problem exporting content with XMERL In-Reply-To: References: Message-ID: <445761A7.4000309@ericsson.com> Hi, First, you have to pass the structure as a list: xmerl:export_simple([dvbh_xml:simple()], xmerl_xml, [{title, "Doc Title"}]). Second, when I ran your example with modified input I hit another error, which is a bug in xmerl. Maybe I'll manage to deliver this bug-fix with R11. /Bertil karol skocik wrote: > Hi, > I am trying to export content, but XMERL dies with error. The > content looks like this : > > simple() -> > {document, [{title, "Doc Title"}, {author, "Ulf Wiger"}], > [{section, [{heading, "heading1"}], > [{'P', "This is a paragraph of text."}, > {section, [{heading, "heading2"}], > [{'P', "This is another paragraph."}, > {table, [{border, 1}], > [{heading, > [{col, "head1"}, > {col, "head2"}]}, > {row, > [{col, "col11"}, > {col, "col12"}]}, > {row, > [{col, "col21"}, > {col, "col22"}]}]}]}]}]}. > > -- it is the same content as used in Ulf's presentation. > > Next, I am doing the same as in presentation : > > xmerl:export_simple(dvbh_xml:simple(), xmerl_xml, [{title, "Doc > Title"}]). > but there is a problem. > > The whole session looks like this: > > (ipe@REDACTED)13> dvbh_xml:simple(). > {document,[{title,"Doc Title"},{author,"Ulf Wiger"}], > [{section,[{heading,"heading1"}], > [{'P',"This is a paragraph of text."}, > {section,[{heading,"heading2"}], > [{'P',"This is another paragraph."}, > {table,[{border,1}], > > [{heading,[{col,"head1"},{col,"head2"}]}, > > {row,[{col,"col11"},{col,"col12"}]}, > > {row,[{col,"col21"},{col|...}]}]}]}]}]} > (ipe@REDACTED)14> xmerl:export_simple(dvbh_xml:simple(), xmerl_xml, > [{title, "Doc Title"}]). > > =ERROR REPORT==== 2-May-2006::10:32:28 === > Error in process <0.289.0> on node 'ipe@REDACTED' with exit value: > {function_clause,[{xmerl_lib,expand_content,[{document,[{title,"Doc > Title"},{author,"Ulf > Wiger"}],[{section,[{heading,"heading1"}],[{'P',"This is a paragraph > of text."},{section,[{heading,"heading2"}],[{'P',"This is anothe... > > ** exited: {function_clause,[{xmerl_lib, > expand_content, > [{document, > [{title,"Doc Title"}, > {author,"Ulf Wiger"}], > [{section, > [{heading,"heading1"}], > [{'P', > "This is a paragraph of > text."}, > {section, > [{heading,"heading2"}], > [{'P', > "This is another > paragraph."}, > {table, > [{...}], > [...]}]}]}]}, > 1, > [], > false]}, > {xmerl,export_simple1,3}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > Does anybody know what is the problem? I am using latest Erlang on > Linux/x86. > > Karol From jay@REDACTED Tue May 2 20:04:57 2006 From: jay@REDACTED (Jay Nelson) Date: Tue, 02 May 2006 11:04:57 -0700 Subject: File sharing software In-Reply-To: <43682575-5EAB-4E42-9216-A4E79E56BA5E@pando.com> References: <4456BEE1.7000906@duomark.com> <43682575-5EAB-4E42-9216-A4E79E56BA5E@pando.com> Message-ID: <44579F49.2070203@duomark.com> Yariv Sadan wrote: > Jay, > > It's funny you bring up this article, because I developed Pando's P2P > core in C, and actually looked at Erlang as a potential language for > some backend components. I'm not an Erlang expert, but I did quite a > lot of research into it and found its unique clustering features and > high level semantics quite appealing. Some issues that I didn't find > very reassuring, however, were mnesia's rather limited table size (2 > GB according to http://www.erlang.org/doc/doc-5.4.13/lib/ > stdlib-1.13.12/doc/html/index.html) and unsuitability for handling > large blobs (noted at http://www.erlang.org/ml-archive/erlang- > questions/199910/msg00059.html). (By the way, if anybody knows of > solutions to these issues, please let me know.) > It doesn't seem necessary to use mnesia or blobs in a P2P scheme. The data can be kept on the users' machines. All that is needed are the addresses and the buddy connections, although I can see why you might want to upload to a 24x7 server. Binaries will do nicely in place of blobs, especially since this application has no editing and merely copies the data around to other nodes. A big index of users doesn't require a database either, but I can see why that is the approach most people use. jay From leifj@REDACTED Tue May 2 23:30:47 2006 From: leifj@REDACTED (Leif Johansson) Date: Tue, 02 May 2006 23:30:47 +0200 Subject: Billion-triple store In-Reply-To: <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> Message-ID: <4457CF87.4020701@it.su.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > > Well as the lead maintainer of kowari, I would be very happy to discuss > any requirements you might have, and see if we can't help you. My application is a sink datastore for an enterprise message-bus. My message-bus is distributed and collects event-based data from a variety of sources including syslog (from 1000s of clients), hr-systems and student administration systems (for identity-management), LDAP directories, computer-telephony integration servers and network- management servers. I want to collect all messages in a datastore normalized as RDF. The datastore can quite possibly be distributed and must be able to support a sustained rate of 1000s of insertions of small RDFs per second. How do you like them requirements :-) > > Currently the largest scalability test I am aware of for kowari was > 500million, but those results indicated that we hadn't reached our limit > yet. One of the store-layers designers did some calculations that > indicate that we should be able to scale to 1-2billion without > difficulty; although as one of the primary developers of the query layer > I am aware of some bottle necks that are likely to interfere with any > queries requiring extremely large intermediate results (~1e6 tuples). I looked at http://esw.w3.org/topic/TripleStoreScalability where the recorded claims are a bit lower... but maybe that site is out-of-date. > > At the same time, there are plans to address these issues, and to break > the scalability bottle necks that are preventing us reaching 1e10 and > 1e11 at the moment, these include promising prototypes of a new store > design to improve locality and throughput that should result in us > scaling comfortably to 1e10. I am quite interested in update scalability too... > > As far as interfacing with erlang is concerned, we currently support rmi > and soap, as well as in-process java funcalls. I am currently working > on xmlrpc support, and I am aware of plans to introduce a rest interface > as well. > > Please let me know if there is anything I can do to help. > Cheers Leif -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEV8+H8Jx8FtbMZncRAq1oAKC0TUQ9STU7ep0n1s4KAVnhkuiOQgCfQlAt qKI/0ammzDTFzbPHVkq+yz8= =nWkk -----END PGP SIGNATURE----- From ok@REDACTED Tue May 2 23:34:10 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 3 May 2006 09:34:10 +1200 (NZST) Subject: File sharing software Message-ID: <200605022134.k42LYA0F204750@atlas.otago.ac.nz> Yariv Sadan wrote: Some issues that I didn't find very reassuring, however, were mnesia's rather limited table size (2 GB according to http://www.erlang.org/doc/doc-5.4.13/lib/ stdlib-1.13.12/doc/html/index.html) I presume this is a reference to the following sentence in the documentation for the 'dets' module: The size of Dets files cannot exceed 2 GB. But what about the very next sentence? If larger tables are needed, Mnesia's table fragmentation can be used. Being a bear of very little brain, I thought this meant that while *dets* was limited to 2GB for a table, *mnesia* wasn't, and when I look at the Mnesia manual, section 1.5.3 seems to say that very thing: 1.5.3 Table Fragmentation The Concept A concept of table fragmentation has been introduced in order to cope with very large tables. The idea is to split a table into several more manageable fragments. Each fragment is implemented as a first class Mnesia table and may be replicated, have indices etc. as any other table. But the tables may neither have local content nor have the snmp connection activated. ... I must be getting senile. Try as I might, I cannot make this mean anything other than "mnesia can handle logical tables bigger than 2GB". Clearly, the size of the Erlang runtime made Erlang too heavy for the client, which needed to be as light as possible. I would have only considered Erlang if the runtime were no more than a few hundred KB. These days, that's a really strict limitation. To take a few examples lying around on my disc: The Freely Distributable Math Library (fdlibm) compiles to a binary (libm.a) that is 189 kB. /usr/lib/libc.a is 1.84 MB (so this would apparently rule out using C...) The Perl-Compatible Regular Expression library (PCRE) has a /usr/local/lib/libpcre.a that is 172 kB, and that's *without* the "90kB" of extra tables needed to support Unicode character properties (I decided I didn't want that yet). *With* that, we'd be looking at 260 kB. The GNU character encoding library, /usr/local/lib/libiconv.so, is 1.28 MB Can we think of a nice small language? How about a language that has _very_ similar data structures to Erlang, but is a much smaller language. Scheme! That's it! Well, /usr/local/lib/libgambc.so.1.1 is 1.46MB. One thing Scheme and Erlang share is arbitrary precision integers. So how big is the GNU mp library? 267 kB. If efficient bignum support is 267 kB, and if trig functions &c take 189 kB, and Erlang has bignums and trig functions (which it does), then there is NO WAY that an Erlang runtime can fit in "no more than a few hundred kB". From klacke@REDACTED Wed May 3 00:23:10 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 03 May 2006 00:23:10 +0200 Subject: File sharing software In-Reply-To: <4456BEE1.7000906@duomark.com> References: <4456BEE1.7000906@duomark.com> Message-ID: <4457DBCE.7010501@hyber.org> Jay Nelson wrote: > Everyone seems to be using digital cameras and video cameras. They are > emailing the results among family and friends. A new group of companies > is providing a file sharing alternative instead of email, that is built > on peer-to-peer or even bit torrent: > > http://money.cnn.com/2006/05/01/technology/business2_launchpad0501/index.htm > > > This should be a no brainer type application for erlang, except for the > big install. Martin Bjorklund and I had this great idea for a p2p app where Erlang would be an ideal implementaion technology. We (The erlang community) always seem to be on the lookout for this killer app, which is the one that makes Erlang widespread, famous ... etc. Anyway, the idea was to implement (originally it was an NFS server) a virtual SMB server. From the point of view of the clients, doing things like smbmount, "Map Network Drive" or Mac Go -> smb://myserver, it would just be another smbserver. The smbserver shouldn't serve files, but rather it should serve files from a virtual network of nodes connected with tunnels. The first application would be to just connect together a bunch of friends homenetworks, thus easily sharing copyrighted material over encrypted internet tunnels. The tunneling technology would have to be homegrown. It would be easy to export different views, it would be possible to have a WebUI interface to the smb server to control it .... whatnot. I still thing the idea is brilliant, it would install as a daemon on unices and as a service on win32. No GUI. It would be small. Bandwidth can be calculated, and it would be possible to look at a streamed movie which resides at my friends HD. Portnumbers should be allocated in such a way, so that traffic shaping (tc in linux speak)can be easily and automatically applied to the bulk traffic, thus ensuring a certain bandwidth once you have started to watch a movie. Perfect NAT traversal is a must. Lots and lots and lots of work, but I think it may be the killerapp we're looking for. Neither Martin, nor I are even close to have the time to work on it though. We started, but last 12 monthes we haven't done anything with it. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From yariv@REDACTED Wed May 3 01:20:14 2006 From: yariv@REDACTED (Yariv Sadan) Date: Tue, 2 May 2006 19:20:14 -0400 Subject: File sharing software In-Reply-To: <200605022134.k42LYA0F204750@atlas.otago.ac.nz> References: <200605022134.k42LYA0F204750@atlas.otago.ac.nz> Message-ID: Richard, Thanks for the reply. My response is below. On May 2, 2006, at 5:34 PM, Richard A. O'Keefe wrote: > Yariv Sadan wrote: > Some issues that I didn't find very reassuring, however, were > mnesia's rather limited table size (2 GB according to > http://www.erlang.org/doc/doc-5.4.13/lib/ > stdlib-1.13.12/doc/html/index.html) > > I presume this is a reference to the following sentence in the > documentation for the 'dets' module: > > The size of Dets files cannot exceed 2 GB. > > But what about the very next sentence? > > If larger tables are needed, Mnesia's table fragmentation can > be used. > > Being a bear of very little brain, I thought this meant that while > *dets* was limited to 2GB for a table, *mnesia* wasn't, and when I > look at the Mnesia manual, section 1.5.3 seems to say that very thing: > > 1.5.3 Table Fragmentation > > The Concept > > A concept of table fragmentation has been introduced in order to > cope with very large tables. The idea is to split a table into > several more manageable fragments. Each fragment is > implemented as > a first class Mnesia table and may be replicated, have indices > etc. > as any other table. But the tables may neither have local content > nor have the snmp connection activated. ... > > I must be getting senile. Try as I might, I cannot make this mean > anything > other than "mnesia can handle logical tables bigger than 2GB". Yes, I did see that Mnesia can fragment Dets tables that must grow over 2GB, but this solution just wasn't very appealing to me because I'd rather use a storage engine that "just works" without my having to manage table fragmentation as the data grows. Fragmentation just sounded like it would be too fragile and require too much maintenance, but then again I don't have experience with Mnesia so I may very well be wrong on this point. (However, I did post a question about these issues to the mailing list and the only answers I got were that Mnesia was indeed not very good at handling large blobs.) Too bad you didn't address my other concern, which is that, according to the older discussions, large dets tables take a considerable amount of time to fix in the event of a crash. If you're planning on running a multi-terabyte production environment with a large number of users, this isn't a characteristic you want in your storage engine. > > Clearly, the size of the Erlang runtime made Erlang too heavy for the > client, which needed to be as light as possible. I would have only > considered Erlang if the runtime were no more than a few hundred KB. > > These days, that's a really strict limitation. > To take a few examples lying around on my disc: > > The Freely Distributable Math Library (fdlibm) compiles to a > binary (libm.a) that is 189 kB. > > /usr/lib/libc.a is 1.84 MB (so this would apparently rule out > using C...) > > The Perl-Compatible Regular Expression library (PCRE) > has a /usr/local/lib/libpcre.a that is 172 kB, and that's > *without* the "90kB" of extra tables needed to support Unicode > character properties (I decided I didn't want that yet). > *With* that, we'd be looking at 260 kB. > > The GNU character encoding library, /usr/local/lib/libiconv.so, > is 1.28 MB > > Can we think of a nice small language? How about a language > that has > _very_ similar data structures to Erlang, but is a much smaller > language. > Scheme! That's it! Well, /usr/local/lib/libgambc.so.1.1 is > 1.46MB. > > One thing Scheme and Erlang share is arbitrary precision integers. > So how big is the GNU mp library? 267 kB. > > If efficient bignum support is 267 kB, and if trig functions &c take > 189 kB, and Erlang has bignums and trig functions (which it does), > then there is NO WAY that an Erlang runtime can fit in "no more than > a few hundred kB". > The tradeoff between using a high-level language and size/memory/ performance isn't always easy to weigh and the decision of which language to use depends on many variables such as the application's functionality, target audience, distribution channel, and the programmer's personal taste. As I said, my personal inclination is to stick with C/C++ and to use as few libraries as possible but I didn't suggest that's a universal truth. I actually think a stripped down version of Erlang would be pretty cool :) Yariv From andrae@REDACTED Wed May 3 03:23:44 2006 From: andrae@REDACTED (Andrae Muys) Date: Wed, 3 May 2006 11:23:44 +1000 Subject: Billion-triple store In-Reply-To: <4457CF87.4020701@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> Message-ID: <1AB8A9C4-4947-4B62-B194-673CC16D2DCE@netymon.com> On 03/05/2006, at 7:30 AM, Leif Johansson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > >> >> Well as the lead maintainer of kowari, I would be very happy to >> discuss >> any requirements you might have, and see if we can't help you. > > My application is a sink datastore for an enterprise message-bus. My > message-bus is distributed and collects event-based data from a > variety > of sources including syslog (from 1000s of clients), hr-systems and > student administration systems (for identity-management), LDAP > directories, computer-telephony integration servers and network- > management servers. I want to collect all messages in a datastore > normalized as RDF. The datastore can quite possibly be distributed > and must be able to support a sustained rate of 1000s of insertions > of small RDFs per second. > > How do you like them requirements :-) Large scale, multi-format, multi-schema, information aggregation, analysis, and inference is our primary focus. We would be very interested in any experiences you have using kowari in this area, as this sort of thing is exactly why we built it. >> Currently the largest scalability test I am aware of for kowari was >> 500million, but those results indicated that we hadn't reached our >> limit >> yet. One of the store-layers designers did some calculations that >> indicate that we should be able to scale to 1-2billion without >> difficulty; although as one of the primary developers of the query >> layer >> I am aware of some bottle necks that are likely to interfere with any >> queries requiring extremely large intermediate results (~1e6 tuples). > > I looked at http://esw.w3.org/topic/TripleStoreScalability where the > recorded claims are a bit lower... but maybe that site is out-of-date. At http://idealliance.org/proceedings/xtech05/papers/04-02-04/ you can read about the largest published test which was 250M. I am aware of internal tests prior to Tucana's closure that went higher, but they were never documented sufficiently to be published. At the time these tests were run http://www.ontotext.com/kim/performance.html was reporting 15M triples for sesame and we were having difficulty convincing people that our claims of 250M weren't vapourware. An added problem of course was our support for Jena, which simply never scaled. Because we supported jena, almost everyone who compared kowari with another triple store ignored our warnings, and just reran their jena code against kowari. The result was always abysmal as, at the time, jena was designed assuming cheap (ie memory backed) random access to triples in the store. We have since deprecated and removed Jena support from kowari. >> At the same time, there are plans to address these issues, and to >> break >> the scalability bottle necks that are preventing us reaching 1e10 and >> 1e11 at the moment, these include promising prototypes of a new store >> design to improve locality and throughput that should result in us >> scaling comfortably to 1e10. > > I am quite interested in update scalability too... update? The concept isn't particularly relevant to RDF. You have insert, read, and delete, but individual statements don't have identity so you can't update them. This isn't a kowari thing, it's a property of RDF inherited from description logic. Andrae -- Andrae Muys andrae@REDACTED Principal Kowari Consultant Netymon Pty Ltd From tobbe@REDACTED Wed May 3 09:34:04 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 03 May 2006 09:34:04 +0200 Subject: File sharing software In-Reply-To: <4457DBCE.7010501@hyber.org> References: <4456BEE1.7000906@duomark.com> <4457DBCE.7010501@hyber.org> Message-ID: Just a short comment: I've been thinking of building a Davenport look-alike, i.e using Yaws and the esmb app. it would be easy to build a Web portal through where you can access Windows/Samba servers. Using WebDav (e.g in IE you can open a web page as a Web-folder) you would get drag and drop in Windows just as for any other folder. Note: my intention was to use esmb as *one* type of backend, i.e you could replace it with ftp, p2p or whatever. --Tobbe Claes Wikstrom wrote: > Jay Nelson wrote: > >> Everyone seems to be using digital cameras and video cameras. They >> are emailing the results among family and friends. A new group of >> companies is providing a file sharing alternative instead of email, >> that is built on peer-to-peer or even bit torrent: >> >> http://money.cnn.com/2006/05/01/technology/business2_launchpad0501/index.htm >> >> >> This should be a no brainer type application for erlang, except for >> the big install. > > > Martin Bjorklund and I had this great idea for a p2p app > where Erlang would be an ideal implementaion technology. > We (The erlang community) always seem to be on the lookout > for this killer app, which is the one that makes Erlang > widespread, famous ... etc. > > Anyway, the idea was to implement (originally it was > an NFS server) a virtual SMB server. From the point of > view of the clients, doing things like smbmount, "Map > Network Drive" or Mac Go -> smb://myserver, it would just be > another smbserver. The smbserver shouldn't serve files, but > rather it should serve files from a virtual network of > nodes connected with tunnels. > > The first application would be to just connect together > a bunch of friends homenetworks, thus easily sharing > copyrighted material over encrypted internet tunnels. > The tunneling technology would have to be homegrown. > > It would be easy to export different views, it would be > possible to have a WebUI interface to the smb server to control > it .... whatnot. > > I still thing the idea is brilliant, it would install as > a daemon on unices and as a service on win32. No GUI. > It would be small. > > Bandwidth can be calculated, and it would be possible to > look at a streamed movie which resides at my friends HD. > > Portnumbers should be allocated in such a way, so that > traffic shaping (tc in linux speak)can be easily and automatically > applied to the bulk traffic, thus ensuring a certain bandwidth once you > have > started to watch a movie. > > Perfect NAT traversal is a must. > > Lots and lots and lots of work, but I think it may be the > killerapp we're looking for. Neither Martin, nor I are even > close to have the time to work on it though. We started, but > last 12 monthes we haven't done anything with it. > > > > > /klacke > > > > From leifj@REDACTED Wed May 3 11:29:52 2006 From: leifj@REDACTED (Leif Johansson) Date: Wed, 03 May 2006 11:29:52 +0200 Subject: Billion-triple store In-Reply-To: <1AB8A9C4-4947-4B62-B194-673CC16D2DCE@netymon.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> <1AB8A9C4-4947-4B62-B194-673CC16D2DCE@netymon.com> Message-ID: <44587810.2030302@it.su.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> I am quite interested in update scalability too... > > update? The concept isn't particularly relevant to RDF. You have > insert, read, and delete, but individual statements don't have identity > so you can't update them. This isn't a kowari thing, it's a property of > RDF inherited from description logic. > I meant "write" performance actually: insert+delete. MVH leifj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEWHgQ8Jx8FtbMZncRAmKUAJ9PL6ZUfDLwokU8AECeRbp0LFdZ9QCeJLWo 0Uk7VYh0V1JTCS9ih2SV6eM= =lUjn -----END PGP SIGNATURE----- From ulf.wiger@REDACTED Wed May 3 11:43:32 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 3 May 2006 11:43:32 +0200 Subject: File sharing software Message-ID: Richard A. O'Keefe wrote: > > Being a bear of very little brain, I thought this meant that while > *dets* was limited to 2GB for a table, *mnesia* wasn't, and > when I look at the Mnesia manual, section 1.5.3 seems to say > that very thing: > [...] > > I must be getting senile. Try as I might, I cannot make this > mean anything other than "mnesia can handle logical tables > bigger than 2GB". You may not be getting senile just yet. The limitation of dets is only relevant to mnesia in the case of disc_only tables, and, as you observed, those tables can be fragmented. Ram copies are limited to the address space in erlang, which is 4GB on 32-bit Erlang. On a 64-bit Erlang, one may may practical limitations before the address space is exhausted. My own personal record in one ram-only mnesia table is about 15 GB of data. The machine I was running on had only 16 GB of RAM, but there was no significant performance degradation for a 15-GB table. Yariv Sadan wrote: > Yes, I did see that Mnesia can fragment Dets tables that must > grow over 2GB, but this solution just wasn't very appealing > to me because I'd rather use a storage engine that "just > works" without my having to manage table fragmentation as the > data grows. Fragmentation just sounded like it would be too > fragile and require too much maintenance, but then again I > don't have experience with Mnesia so I may very well be wrong > on this point. I believe you are wrong on the maintenance part. There isn't really much maintenance at all. At some point, if your data set keeps growing, you might want to add more fragments. This is not at all difficult, and can be done in a running system. I personally don't think that dets is an especially good storage solution for very large databases. But in my formative years of learning database technology, the DBMS would usually take a raw partition and even bypass the file system. In the 90's, this was the only way if you were serious about reliable and efficient database storage. Perhaps this is not true anymore...? Obviously, MySQL et al don't do it that way. On the issue of binaries, nothing has changed since it was last discussed on this list, AFAIK. BR, Ulf Wiger From andrae@REDACTED Wed May 3 11:41:35 2006 From: andrae@REDACTED (Andrae Muys) Date: Wed, 3 May 2006 19:41:35 +1000 Subject: Billion-triple store In-Reply-To: <44587810.2030302@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> <1AB8A9C4-4947-4B62-B194-673CC16D2DCE@netymon.com> <44587810.2030302@it.su.se> Message-ID: On 03/05/2006, at 7:29 PM, Leif Johansson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > >>> I am quite interested in update scalability too... >> >> update? The concept isn't particularly relevant to RDF. You have >> insert, read, and delete, but individual statements don't have >> identity >> so you can't update them. This isn't a kowari thing, it's a >> property of >> RDF inherited from description logic. >> > > I meant "write" performance actually: insert+delete. Unfortunately our delete performance is not stellar. The planned revision of the store layer that we anticipate providing at least one more order of magnitude in insert performance will also address this. Unfortunately this is at least 9 months away, probably closer to 18. Of course there is the added advantage that if your data- sources are already queryable then you might not have to insert at all, as we support pluggable resolvers that can provide a real-time interface to the rdf-mapping of external data. We already support access to URL addressed rdf datasources, file-system metadata, mp3 id3 tags, and various virtual graphs (xsd, data-type, and arithmatic). Andrae -- Andrae Muys andrae@REDACTED Principal Kowari Consultant Netymon Pty Ltd From serge@REDACTED Wed May 3 13:33:15 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 03 May 2006 07:33:15 -0400 Subject: File sharing software In-Reply-To: References: Message-ID: <445894FB.6050004@hq.idt.net> Ulf Wiger (AL/EAB) wrote: > I personally don't think that dets is an especially good > storage solution for very large databases. But in my > formative years of learning database technology, the DBMS > would usually take a raw partition and even bypass the > file system. In the 90's, this was the only way if you > were serious about reliable and efficient database storage. > Perhaps this is not true anymore...? Obviously, MySQL > et al don't do it that way. Oracle doesn't bypass the file system (though it offers an option for that). We have a 2TB database storing call detail records, and Oracle's partitioning scheme (partition key by range or by value with local partition indexes) allows for good read/write performance. Of course I would never recommend using Oracle for soft-real-time queries, as the response time is by no means guaranteed, yet, if one needs a reliable database for storing very large amounts of data, I don't think Oracle has many competitors in the area. BTW, Oracle's recent acquisition of TimesTen seems to give a good combination of a real-time database cache replicated to the disk-based Oracle database. http://www.oracle.com/database/timesten.html Regards, Serge From goertzen@REDACTED Wed May 3 17:25:13 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Wed, 03 May 2006 10:25:13 -0500 Subject: R10B10 and gcc-4.0.x ? Message-ID: <4458CB59.4050405@ertw.com> Are there any known issues with compiling R10B10 with gcc-4.0.x? I am cross compiling (x86_64 to x86) and my resulting binary segfaults. strace shows that it loads a bunch of .beams and does some networking (unsuccessfully) before crashing. Of course I could just be doing something wrong with the cross compile... Thanks, Dan. From yariv@REDACTED Wed May 3 17:38:14 2006 From: yariv@REDACTED (Yariv Sadan) Date: Wed, 3 May 2006 11:38:14 -0400 Subject: File sharing software In-Reply-To: References: Message-ID: <303B78D8-991B-4383-890C-129CE86EC19A@pando.com> On May 3, 2006, at 5:43 AM, Ulf Wiger (AL/EAB) wrote: > Richard A. O'Keefe wrote: >> >> Being a bear of very little brain, I thought this meant that while >> *dets* was limited to 2GB for a table, *mnesia* wasn't, and >> when I look at the Mnesia manual, section 1.5.3 seems to say >> that very thing: >> > [...] >> >> I must be getting senile. Try as I might, I cannot make this >> mean anything other than "mnesia can handle logical tables >> bigger than 2GB". > > You may not be getting senile just yet. > The limitation of dets is only relevant to mnesia in the case > of disc_only tables, and, as you observed, those tables can be > fragmented. > > Ram copies are limited to the address space in erlang, > which is 4GB on 32-bit Erlang. On a 64-bit Erlang, one > may may practical limitations before the address space > is exhausted. My own personal record in one ram-only > mnesia table is about 15 GB of data. The machine I was > running on had only 16 GB of RAM, but there was no > significant performance degradation for a 15-GB table. > > Yariv Sadan wrote: >> Yes, I did see that Mnesia can fragment Dets tables that must >> grow over 2GB, but this solution just wasn't very appealing >> to me because I'd rather use a storage engine that "just >> works" without my having to manage table fragmentation as the >> data grows. Fragmentation just sounded like it would be too >> fragile and require too much maintenance, but then again I >> don't have experience with Mnesia so I may very well be wrong >> on this point. > > I believe you are wrong on the maintenance part. There isn't > really much maintenance at all. At some point, if your data > set keeps growing, you might want to add more fragments. This > is not at all difficult, and can be done in a running system. > > I personally don't think that dets is an especially good > storage solution for very large databases. But in my > formative years of learning database technology, the DBMS > would usually take a raw partition and even bypass the > file system. In the 90's, this was the only way if you > were serious about reliable and efficient database storage. > Perhaps this is not true anymore...? Obviously, MySQL > et al don't do it that way. > > On the issue of binaries, nothing has changed since it was > last discussed on this list, AFAIK. > > BR, > Ulf Wiger Maybe it's possible to develop for Mnesia an alternative disc only storage engine designed for storing large blobs. It wouldn't have to be an Oracle killer. It would just have to handle very large data sets, have decent performance, and avoid the rebuilding cost associated with broken dets tables. Such a solution would make Mnesia more versatile and therefore more appealing for applications for which it makes sense to sacrifice soft real-time performance for large storage capacity. What do you think? Regards, Yariv From kostis@REDACTED Wed May 3 17:50:41 2006 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 3 May 2006 17:50:41 +0200 (MEST) Subject: R10B10 and gcc-4.0.x ? In-Reply-To: Mail from 'Daniel Goertzen ' dated: Wed, 03 May 2006 10:25:13 -0500 Message-ID: <200605031550.k43Fofhw016060@spikklubban.it.uu.se> > Are there any known issues with compiling R10B10 with gcc-4.0.x? I got a new machine yesterday which runs Debian Linux. Debian comes with gcc-4.0.3 as default. I experienced trouble building R11 on it -- note: not R10B10 I then switched to gcc-4.1.0 (in fact to the whole 4.1.0 stuff such as gpp) and the troubles went away. I did not investigate the issue further, but if your system is a Debian one, then I recommend switching to gcc-4.1.0 (which is currently in 'testing' status, but appears to be very stable). Hope this helps, although I am not sure this is related to your problem. Kostis From kg9020@REDACTED Wed May 3 18:10:41 2006 From: kg9020@REDACTED (a) Date: Wed, 3 May 2006 11:10:41 -0500 Subject: parsing ip packets Message-ID: <874A226F-7FFC-49F9-AAAD-2EE89B6E8693@gmail.com> Hello, I am new learning erlang ... are there examples of parsing a ip packet to determine what time ? arthur ingram From ulf.wiger@REDACTED Wed May 3 18:45:08 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 3 May 2006 18:45:08 +0200 Subject: File sharing software Message-ID: Yariv Sadan wrote: > > Maybe it's possible to develop for Mnesia an alternative disc > only storage engine designed for storing large blobs. It > wouldn't have to be an Oracle killer. It would just have to > handle very large data sets, have decent performance, and > avoid the rebuilding cost associated with broken dets tables. > Such a solution would make Mnesia more versatile and > therefore more appealing for applications for which it makes > sense to sacrifice soft real-time performance for large > storage capacity. What do you think? This was one of my intentions with trying to prototype an API for foreign table types in mnesia (included in the RDBMS patches). Berkeley DB might be a good candidate (others have integrated berkeley_db and mnesia already, in a proprietary fashion.) After discussions with Dan Gudmundsson, we've agreed that the approach needs more thought. There may be better ways to do it. With really large tables, the synchronization protocol between nodes also needs to be looked at. /Ulf W From paris@REDACTED Wed May 3 18:47:11 2006 From: paris@REDACTED (Javier =?iso-8859-1?q?Par=EDs?=) Date: Wed, 3 May 2006 18:47:11 +0200 Subject: parsing ip packets In-Reply-To: <874A226F-7FFC-49F9-AAAD-2EE89B6E8693@gmail.com> References: <874A226F-7FFC-49F9-AAAD-2EE89B6E8693@gmail.com> Message-ID: <200605031847.11915.paris@dc.fi.udc.es> El Mi?rcoles, 3 de Mayo de 2006 18:10, a escribi?: > Hello, > > I am new learning erlang ... are there examples of parsing a ip > packet to determine what time ? Parsing a (binary) ip packet would be something like.. <<4:4/integer, % Ip Version Hd_Len:4/integer, % Header Length Tos:8/integer, % Tos Len:16/big-integer, % Packet Length Frg_Id:16/big-integer, % Fragment Id _:2/integer, % Two first flags... bah Mf:1/integer, % More Fragments flag Offset:13/big-integer, % Fragment Offset TTL:8/integer, % TTL Protocol:8/integer, % Upper layer protocol Checksum:16/big-integer, % Checksum Src_Ip:32/big-integer, % Where this pile of shit came from... Dst_Ip:32/big-integer, % Should check this against our Ip Options/binary>> = Ip_Header, % Options This would be for a rfc791 Ip packet. That is, it is a bit outdated. (For example, TOS isn't used anymore, and that field is used for explicit congestion notification, among other things). Regards. From kg9020@REDACTED Wed May 3 19:13:39 2006 From: kg9020@REDACTED (a) Date: Wed, 3 May 2006 12:13:39 -0500 Subject: parsing ip packets In-Reply-To: <200605031847.11915.paris@dc.fi.udc.es> References: <874A226F-7FFC-49F9-AAAD-2EE89B6E8693@gmail.com> <200605031847.11915.paris@dc.fi.udc.es> Message-ID: Thanks is there document or tutorial how I would apply this to a program .... I am going over lisp tutorial to get a better grasp of working with lists Is this a list description... following will following getting started and the REPOS tutorial bring up to speed to apply the code ..... thanks Arthur Ingram On May 3, 2006, at 11:47 AM, Javier Par?s wrote: > El Mi?rcoles, 3 de Mayo de 2006 18:10, a escribi?: >> Hello, >> >> I am new learning erlang ... are there examples of parsing a ip >> packet to determine what time ? > > Parsing a (binary) ip packet would be something like.. > > <<4:4/integer, % Ip Version > Hd_Len:4/integer, % Header Length > Tos:8/integer, % Tos > Len:16/big-integer, % Packet Length > Frg_Id:16/big-integer, % Fragment Id > _:2/integer, % Two first flags... bah > Mf:1/integer, % More Fragments flag > Offset:13/big-integer, % Fragment Offset > TTL:8/integer, % TTL > Protocol:8/integer, % Upper layer protocol > Checksum:16/big-integer, % Checksum > Src_Ip:32/big-integer, % Where this pile of shit came from... > Dst_Ip:32/big-integer, % Should check this against our Ip > Options/binary>> = Ip_Header, % Options > > This would be for a rfc791 Ip packet. That is, it is a bit outdated. > (For example, TOS isn't used anymore, and that field is used > for explicit congestion notification, among other things). > > Regards. From leifj@REDACTED Wed May 3 19:29:28 2006 From: leifj@REDACTED (Leif Johansson) Date: Wed, 03 May 2006 19:29:28 +0200 Subject: Billion-triple store In-Reply-To: <4457CF87.4020701@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> Message-ID: <4458E878.9090509@it.su.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Leif Johansson wrote: > >>> Well as the lead maintainer of kowari, I would be very happy to discuss >>> any requirements you might have, and see if we can't help you. > > My application is a sink datastore for an enterprise message-bus. My > message-bus is distributed and collects event-based data from a variety > of sources including syslog (from 1000s of clients), hr-systems and > student administration systems (for identity-management), LDAP > directories, computer-telephony integration servers and network- > management servers. I want to collect all messages in a datastore > normalized as RDF. The datastore can quite possibly be distributed > and must be able to support a sustained rate of 1000s of insertions > of small RDFs per second. I have done a couple of experiments with a totally brain-dead (probably) schema on a single node with {n_fragments, 1000}. I can insert ~250k statements at a sustained rate of ~2300 statements per second using disk-copies of everything and a transaction per statement. The resulting mnesia disk db is ~55M from a 25M n3 file turned into erlang statements using perl :-) Stay tuned... Cheers Leif -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEWOh48Jx8FtbMZncRAtKyAJ4g2U7qecZxe5GjWf2iRrkqlLVSuQCghmX1 XMDO8YxW6mlnZ9EPm8GkAHk= =mA6g -----END PGP SIGNATURE----- From orbitz@REDACTED Wed May 3 21:00:48 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 3 May 2006 15:00:48 -0400 Subject: erlc safety Message-ID: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> I am considering offering a webform for people to submit their code and run it through erlc and output any compilation errors or if it was successful. What do I need to worry about in terms of sandboxing? I think the biggest security risk is -include. -include ("/etc/passwd") or something like that. What should my concerns be? Are there solutions to these problems? From jeremie@REDACTED Wed May 3 21:45:19 2006 From: jeremie@REDACTED (=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=) Date: Wed, 3 May 2006 21:45:19 +0200 Subject: erlc safety In-Reply-To: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> Message-ID: <2b7b425b0605031245n61b8716nc0d9e49c48a4d112@mail.gmail.com> (Amazing! I'm working on a similar project too!) On 5/3/06, orbitz@REDACTED wrote: > > I am considering offering a webform for people to submit their code > and run it through erlc and output any compilation errors or if it > was successful. What do I need to worry about in terms of > sandboxing? I think the biggest security risk is -include. -include > ("/etc/passwd") or something like that. What should my concerns be? > Are there solutions to these problems? > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From garris@REDACTED Wed May 3 22:33:35 2006 From: garris@REDACTED (Erik Garrison) Date: Wed, 3 May 2006 16:33:35 -0400 (EDT) Subject: erlc safety In-Reply-To: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> Message-ID: On Wed, 3 May 2006 orbitz@REDACTED wrote: > I am considering offering a webform for people to submit their code > and run it through erlc and output any compilation errors or if it > was successful. What do I need to worry about in terms of > sandboxing? I think the biggest security risk is -include. -include > ("/etc/passwd") or something like that. What should my concerns be? > Are there solutions to these problems? Would *nix user permissions solve this case? You could just have a paralell environment (maybe a chrooted one) in which an otherwise unprivelaged user can compile, but not execute the resulting modules. -Erik From serge@REDACTED Wed May 3 23:37:47 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 03 May 2006 17:37:47 -0400 Subject: inets/ftp error parsing response to ftp:nlist/1 Message-ID: <445922AB.6000500@hq.idt.net> I believe there's a bug in the ftp:nlist/1 error response parser. A call to this function in an empty remote directory results in the following response: {error, " No files found\r\n"} instead of {error, Atom}, where Atom would be known to ftp:formaterror/1. Here's a trace that shows the 'trans_neg_compl' status is not being hangled separately by ftp:ctrl_result_response: 5> ftp:nlist(Pid). "Sending: EPSV" "Receiving: 229 Entering Extended Passive Mode (|||39641|)" "ASYNC CONNECT SUCCESSFUL, WAITING FOR COMPLETION" "Sending: NLST" "Receiving: 450 No files found" (<0.44.0>) call ftp:ctrl_result_response(trans_neg_compl,{state,#Port<0.111>, #Port<0.115>, true, "/home/timocl/Projects/EOTP/current", ftp_server_default, false, passive, 60000, <<"">>, {<<"">>,[],start}, <0.32.0>, {<0.32.0>,#Ref<0.0.0.151>}, {dir,[]}, false, ignore},{error," No files found\r\n"}) (<0.44.0>) returned from ftp:ctrl_result_response/3 -> {noreply, {state, #Port<0.111>, #Port<0.115>, true, "/home/timocl/Projects/EOTP/current", ftp_server_default, false, passive, 60000, <<"">>, {<<"">>,[],start}, <0.32.0>, undefined, undefined, false, ignore}} {error," No files found\r\n"} -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From klacke@REDACTED Thu May 4 00:18:58 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Thu, 04 May 2006 00:18:58 +0200 Subject: File sharing software In-Reply-To: <303B78D8-991B-4383-890C-129CE86EC19A@pando.com> References: <303B78D8-991B-4383-890C-129CE86EC19A@pando.com> Message-ID: <44592C52.4040704@hyber.org> Yariv Sadan wrote: > > > Maybe it's possible to develop for Mnesia an alternative disc only > storage engine designed for storing large blobs. It wouldn't have to be > an Oracle killer. It would just have to handle very large data sets, > have decent performance, and avoid the rebuilding cost associated with > broken dets tables. Such a solution would make Mnesia more versatile > and therefore more appealing for applications for which it makes sense > to sacrifice soft real-time performance for large storage capacity. > What do you think? > This is certainly possible, I wrote dets some 15 years ago, and it high time to rewrite completely. It's been through several enhancements within the OTP group, but the original ideas are still there. Linear (P.A Larsson algorithm) hashing for indexing and a buddy allocator for space on the file. Two major problems with dets as of today (and of yeasterday) 1. 64 bit indexing - really easy to fix 2. repair time - this is a bit harder to fix, but one solution could be along the following lines. a) keep the index and the freelist in a different file, b) have a file soley for the data. This file could be as easily repaired as a disklog file. One could just chunk through it, one term at a time, this way even large files will be fast to repair. c) when an object is put on the freelist, it needs also to be overwriten My daily 2c :-) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From kg9020@REDACTED Thu May 4 00:39:59 2006 From: kg9020@REDACTED (a) Date: Wed, 3 May 2006 17:39:59 -0500 Subject: Fwd: parsing ip packets//Newbie References: <200605031847.11915.paris@dc.fi.udc.es> Message-ID: Hello is there a good tutorial showing how to apply this code in an application ... Begin forwarded message: > From: Javier Par?s > Date: May 3, 2006 11:47:11 AM CDT > To: a > Cc: erlang-questions@REDACTED > Subject: Re: parsing ip packets > Reply-To: paris@REDACTED > > El Mi?rcoles, 3 de Mayo de 2006 18:10, a escribi?: >> Hello, >> >> I am new learning erlang ... are there examples of parsing a ip >> packet to determine what time ? > > Parsing a (binary) ip packet would be something like.. > > <<4:4/integer, % Ip Version > Hd_Len:4/integer, % Header Length > Tos:8/integer, % Tos > Len:16/big-integer, % Packet Length > Frg_Id:16/big-integer, % Fragment Id > _:2/integer, % Two first flags... bah > Mf:1/integer, % More Fragments flag > Offset:13/big-integer, % Fragment Offset > TTL:8/integer, % TTL > Protocol:8/integer, % Upper layer protocol > Checksum:16/big-integer, % Checksum > Src_Ip:32/big-integer, % Where this pile of shit came from... > Dst_Ip:32/big-integer, % Should check this against our Ip > Options/binary>> = Ip_Header, % Options > > This would be for a rfc791 Ip packet. That is, it is a bit outdated. > (For example, TOS isn't used anymore, and that field is used > for explicit congestion notification, among other things). > > Regards. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jabowery@REDACTED Thu May 4 00:52:36 2006 From: jabowery@REDACTED (James Bowery) Date: Wed, 03 May 2006 15:52:36 -0700 Subject: FC5 mt 64 beam.hybrid error Message-ID: <44593434.4020805@technicalpursuit.com> I'm attempting to install otp on a Fedora Core 5 64 bit system with multi-threading and ran into this problem: ./configure --enable-threads --prefix=/usr/local make ...etc... hipe/hipe_x86_signal.c:192: undefined reference to `__next_sigaction' collect2: ld returned 1 exit status make[3]: *** [/usr/local/src/otp_src_R10B-10/bin/x86_64-unknown-linux-gnu/beam.hybrid] Error 1 make[3]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts/emulator' make[2]: *** [hybrid] Error 2 make[2]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts/emulator' make[1]: *** [hybrid] Error 2 make[1]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts' make: *** [emulator] Error 2 From orbitz@REDACTED Thu May 4 01:02:01 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 3 May 2006 19:02:01 -0400 Subject: erlc safety In-Reply-To: References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> Message-ID: That might be a pain in the butt thouhg. With a chrooted environment I need to include EVERYTHING required in running erlc. And If i want to do this with a number of languages (haskell, c/c++, fortran, etc), that could be a real PITA and a lot of disk space (i don't believe I can use symlinks...) On May 3, 2006, at 4:33 PM, Erik Garrison wrote: > > On Wed, 3 May 2006 orbitz@REDACTED wrote: > >> I am considering offering a webform for people to submit their code >> and run it through erlc and output any compilation errors or if it >> was successful. What do I need to worry about in terms of >> sandboxing? I think the biggest security risk is -include. -include >> ("/etc/passwd") or something like that. What should my concerns be? >> Are there solutions to these problems? > > Would *nix user permissions solve this case? You could just have a > paralell environment (maybe a chrooted one) in which an otherwise > unprivelaged user can compile, but not execute the resulting modules. > > -Erik From yariv@REDACTED Thu May 4 01:31:39 2006 From: yariv@REDACTED (Yariv Sadan) Date: Wed, 3 May 2006 19:31:39 -0400 Subject: File sharing software In-Reply-To: <44592C52.4040704@hyber.org> References: <303B78D8-991B-4383-890C-129CE86EC19A@pando.com> <44592C52.4040704@hyber.org> Message-ID: <55BEAA3E-EB6C-4F89-A820-C7D48B38EA34@pando.com> Well, Claes, that's very reassuring! If you're the one who wrote dets, nobody would know better than you how to enhance it. Would you be interested in implementing this feature? (I suppose I could try to follow your guidelines and hack my own storage engine, but that would be Plan B :) ) Yariv On May 3, 2006, at 6:18 PM, Claes Wikstrom wrote: > Yariv Sadan wrote: > >> Maybe it's possible to develop for Mnesia an alternative disc >> only storage engine designed for storing large blobs. It wouldn't >> have to be an Oracle killer. It would just have to handle very >> large data sets, have decent performance, and avoid the >> rebuilding cost associated with broken dets tables. Such a >> solution would make Mnesia more versatile and therefore more >> appealing for applications for which it makes sense to sacrifice >> soft real-time performance for large storage capacity. What do >> you think? >> > > > This is certainly possible, I wrote dets some 15 years ago, and > it high time to rewrite completely. It's been through several > enhancements within the OTP group, but the original ideas are still > there. Linear (P.A Larsson algorithm) hashing for indexing and > a buddy allocator for space on the file. > > Two major problems with dets as of today (and of yeasterday) > > 1. 64 bit indexing - really easy to fix > 2. repair time - this is a bit harder to fix, but one solution > could be along the following lines. > > a) keep the index and the freelist in a different file, > b) have a file soley for the data. This file could be as easily > repaired as a disklog file. One could just chunk through it, one > term at a time, this way even large files will be fast to repair. > c) when an object is put on the freelist, it needs also to be > overwriten > > > My daily 2c :-) > > > /klacke > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > cellphone: +46 70 2097763 From Bertil@REDACTED Thu May 4 06:31:17 2006 From: Bertil@REDACTED (Bertil Askelid) Date: Wed, 3 May 2006 21:31:17 -0700 Subject: UBF Message-ID: <200605040431.k444VHSk023735@pop.lan> A couple of years ago, Joe Armstrong was working on and idea he called UBF: UBF is a language for transporting and describing complex data structures across a network. http://www.sics.se/~joe/ubf/site/home.html I'm wonder if this came to any extended use in the Erlang Community? From jay@REDACTED Thu May 4 07:40:41 2006 From: jay@REDACTED (Jay Nelson) Date: Wed, 03 May 2006 22:40:41 -0700 Subject: File sharing software Message-ID: <445993D9.9080506@duomark.com> Yariv Sadan wrote (after a series of exchanges involving using mnesia for P2P software): > Well, Claes, that's very reassuring! If you're the one who wrote > dets, nobody would know better than you how to enhance it. Would you > be interested in implementing this feature? (I suppose I could try to > follow your guidelines and hack my own storage engine, but that would > be Plan B :) ) I'm still wondering what your actual requirements are. I must be picturing a different application because I don't see the benefits of a database or dets. A few questions: 1) Do you need this for a user database (e.g., all registered members and their buddy name)? a) If so, how many users? b) Are they to be accessed any way other than by login name? 2) Do you need this for a file database (e.g., all files that can be exchanged)? a) If so, why does it have to be central? 3) Are there some other objects that you need to store (e.g., account configuration, billing, etc)? a) Do they have special access characteristics? 3) Why do you want to store blobs in a database? They won't be searchable in any way will they? 4) What features of a database do you think you need? Just curious if a database is really what solves your problem. jay From richardc@REDACTED Thu May 4 09:11:18 2006 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 04 May 2006 09:11:18 +0200 Subject: erlc safety In-Reply-To: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> Message-ID: <4459A916.20303@it.uu.se> orbitz@REDACTED wrote: > I am considering offering a webform for people to submit their code and > run it through erlc and output any compilation errors or if it was > successful. What do I need to worry about in terms of sandboxing? I > think the biggest security risk is -include. -include("/etc/passwd") or > something like that. What should my concerns be? Are there solutions to > these problems? Also note that code containing '-compile({parse_transform, foo}).' will run foo:parse_transform(Forms, Options) as a compiler stage. If previous compilation results (.beam object files) are not being cleaned out, a simple attack would be to first upload foo.erl for compilation, which contains a parse_transform/2 function (that does some arbitrarily nasty stuff if it is executed), and then later upload a module bar.erl which contains -compile({parse_transform, foo}). The same applies if you are allowed to compile several modules in a batch; just get the parse transform module compiled first, and you're in. To avoid this, you have to make sure that if .beam files are produced, they will not be in the path when the compiler is running, or alternatively run the compiler without producing .beam files (see the compiler documentation). /Richard From ryanobjc@REDACTED Thu May 4 09:14:16 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Thu, 4 May 2006 00:14:16 -0700 Subject: UBF In-Reply-To: <200605040431.k444VHSk023735@pop.lan> References: <200605040431.k444VHSk023735@pop.lan> Message-ID: <78568af10605040014m33dc913br1cd635881ebf4912@mail.gmail.com> Ironically enough I would disagree with the statement: "While the XML series of languages had the goal of having a human readable format the UBF languages take the opposite view and provide a "machine friendly" format." I would state that XML is machine readable, and not as much human readable. The original specs for the XML described in great detail how easy it was to write a parser for it. While most people don't think XML parsers are very simple, they are better than, say HTML or SGML. But again, i would say that we need more human readable formats. That's why JSON has become so popular. I know some people who are using JSON and Erlang, that is working out well for them. Why UBF? -ryan On 5/3/06, Bertil Askelid wrote: > A couple of years ago, Joe Armstrong was working on and idea he > called UBF: > > UBF is a language for transporting and describing complex data > structures across a network. > > http://www.sics.se/~joe/ubf/site/home.html > > I'm wonder if this came to any extended use in the Erlang Community? > From mikpe@REDACTED Thu May 4 09:18:05 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 4 May 2006 09:18:05 +0200 Subject: R10B10 and gcc-4.0.x ? In-Reply-To: <4458CB59.4050405@ertw.com> References: <4458CB59.4050405@ertw.com> Message-ID: <17497.43693.716154.807478@alkaid.it.uu.se> Daniel Goertzen writes: > Are there any known issues with compiling R10B10 with gcc-4.0.x? > > I am cross compiling (x86_64 to x86) and my resulting binary segfaults. > strace shows that it loads a bunch of .beams and does some networking > (unsuccessfully) before crashing. Of course I could just be doing > something wrong with the cross compile... I've been using gcc-4.0.x with x > 0 a lot for compiling Erlang/OTP, and there are no known issues with non-ancient releases. gcc-4.0.0 was buggy enough to break the Linux kernels, however. I suspect your cross-compile, esp. since Erlang/OTP isn't set up for automatic cross-compilation. /Mikael From mikpe@REDACTED Thu May 4 09:25:09 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 4 May 2006 09:25:09 +0200 Subject: FC5 mt 64 beam.hybrid error In-Reply-To: <44593434.4020805@technicalpursuit.com> References: <44593434.4020805@technicalpursuit.com> Message-ID: <17497.44117.123768.274848@alkaid.it.uu.se> James Bowery writes: > I'm attempting to install otp on a Fedora Core 5 64 bit system with > multi-threading and ran into this problem: > > ./configure --enable-threads --prefix=/usr/local > make > ...etc... > hipe/hipe_x86_signal.c:192: undefined reference to `__next_sigaction' > collect2: ld returned 1 exit status > make[3]: *** > [/usr/local/src/otp_src_R10B-10/bin/x86_64-unknown-linux-gnu/beam.hybrid] > Error 1 > make[3]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts/emulator' > make[2]: *** [hybrid] Error 2 > make[2]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts/emulator' > make[1]: *** [hybrid] Error 2 > make[1]: Leaving directory `/usr/local/src/otp_src_R10B-10/erts' > make: *** [emulator] Error 2 Two patches for making R10B-10 work on FC5 were posted to erlang-questions, at around March 27 (fix for glibc-2.4 which is the problem quoted above) and April 6 (fix for non-executable memory mappings on 32-bit x86). You should be able to find them via the mailing list archives. /Mikael From orbitz@REDACTED Thu May 4 12:04:28 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Thu, 4 May 2006 06:04:28 -0400 Subject: erlc safety In-Reply-To: <4459A916.20303@it.uu.se> References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> <4459A916.20303@it.uu.se> Message-ID: Well files will not be given a name the user can choose. The files will be stored in a mnesia database, given a temporary name for compilation and then deleted. .beam files will also be destroyed upon compilation (In theory). What about some sort of sanitation function I could run on the file prior to compilation? Is this too easy to exploit to even bother? On May 4, 2006, at 3:11 AM, Richard Carlsson wrote: > orbitz@REDACTED wrote: >> I am considering offering a webform for people to submit their >> code and run it through erlc and output any compilation errors or >> if it was successful. What do I need to worry about in terms of >> sandboxing? I think the biggest security risk is -include. - >> include("/etc/passwd") or something like that. What should my >> concerns be? Are there solutions to these problems? > > Also note that code containing '-compile({parse_transform, foo}).' > will > run foo:parse_transform(Forms, Options) as a compiler stage. If > previous > compilation results (.beam object files) are not being cleaned out, a > simple attack would be to first upload foo.erl for compilation, which > contains a parse_transform/2 function (that does some arbitrarily > nasty > stuff if it is executed), and then later upload a module bar.erl which > contains -compile({parse_transform, foo}). The same applies if you are > allowed to compile several modules in a batch; just get the parse > transform module compiled first, and you're in. To avoid this, you > have > to make sure that if .beam files are produced, they will not be in the > path when the compiler is running, or alternatively run the compiler > without producing .beam files (see the compiler documentation). > > /Richard > From richardc@REDACTED Thu May 4 12:38:22 2006 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 04 May 2006 12:38:22 +0200 Subject: erlc safety In-Reply-To: <4459A916.20303@it.uu.se> References: <6F224A09-12F1-43B2-8590-131C4F6DD5B1@ezabel.com> <4459A916.20303@it.uu.se> Message-ID: <4459D99E.9040308@it.uu.se> Richard Carlsson wrote: > Also note that code containing '-compile({parse_transform, foo}).' will > run foo:parse_transform(Forms, Options) as a compiler stage. [...] Oh, and a similar thing happens with -behaviour(frob) declarations; the compiler (in the lint stage) will call frob:behaviour_info/1. Finally, there is also a -compile({core_transform, fubar}) option, analogous to the parse_transform option. But I think that's all. :-) /Richard From invisio22@REDACTED Thu May 4 14:57:43 2006 From: invisio22@REDACTED (Eric Shun) Date: Thu, 4 May 2006 14:57:43 +0200 Subject: Public PID? Message-ID: <3f9db9f20605040557s1f2b9738i5f5f05b4ad1e8499@mail.gmail.com> Hi, I'd like to send a message to a process on another node. As I don't want to register the pid, I can't use {Node,Pid} ! Message. So I can I know the "public" pid of a process (eg: <5533,245,0>) , as self() only returns a "private" pid (eg: <0,245,0>)? So I could do: PublicPid ! Message. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kg9020@REDACTED Thu May 4 15:08:41 2006 From: kg9020@REDACTED (a) Date: Thu, 4 May 2006 08:08:41 -0500 Subject: newbie Message-ID: Hello, I am new to erlang would like a good learning process ...of how write network programs like parsing ip packets... I noticed several tutorials ... and this mail list. Is that all that is available for a Newbie with little programing experience would learning LISP help. Going forward will support for different platforms continue to grow ... Opensolaris including sparc , BSDs, Mac OS X, ..... thank you arthur ingram From yariv@REDACTED Thu May 4 15:11:30 2006 From: yariv@REDACTED (Yariv Sadan) Date: Thu, 4 May 2006 09:11:30 -0400 Subject: File sharing software In-Reply-To: <445993D9.9080506@duomark.com> References: <445993D9.9080506@duomark.com> Message-ID: <91BBB8C5-CBEB-495B-A3BD-9CD42E1F6FBA@pando.com> Jay, I guess the discussion did get a little off topic, because it started on potential uses for Erlang in building a consumer P2P app and ended in how to modify Mnesia to efficiently handle large blobs :) The application I had in mind was actually the backend piece of a client/server (or a hybrid p2p and client/server, which is Pando's architecture) application, where the central servers have to store large amounts of data. In Pando's case, for instance, our servers participate in all the swarms in order to provide reliable offline delivery, which puts massive storage requirements on our servers. I was envisioning a similar architecture, but one that uses Mnesia for storage on the backend. Would Mnesia work for Pando if it had this capability? Maybe not. But I think that this capability would make Mnesia/Erlang appealing for many other applications for which Mnesia is currently not a great option because they require storing large pools of media assets on central servers (think Flickr). (As a matter of fact, if/when Mnesia has this feature, I will go ahead and use Erlang to build a Flickr clone, which I will name FlickER, just for fun :D ) Yariv On May 4, 2006, at 1:40 AM, Jay Nelson wrote: > Yariv Sadan wrote (after a series of exchanges involving using > mnesia for P2P software): > >> Well, Claes, that's very reassuring! If you're the one who wrote >> dets, nobody would know better than you how to enhance it. Would >> you be interested in implementing this feature? (I suppose I >> could try to follow your guidelines and hack my own storage >> engine, but that would be Plan B :) ) > > > I'm still wondering what your actual requirements are. I must be > picturing a different application > because I don't see the benefits of a database or dets. A few > questions: > > 1) Do you need this for a user database (e.g., all registered > members and their buddy name)? > a) If so, how many users? > b) Are they to be accessed any way other than by login name? > > 2) Do you need this for a file database (e.g., all files that can > be exchanged)? > a) If so, why does it have to be central? > > 3) Are there some other objects that you need to store (e.g., > account configuration, billing, etc)? > a) Do they have special access characteristics? > > 3) Why do you want to store blobs in a database? They won't be > searchable in any way will they? > > 4) What features of a database do you think you need? > > > Just curious if a database is really what solves your problem. > > jay > > From matthias@REDACTED Thu May 4 15:34:26 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 4 May 2006 15:34:26 +0200 Subject: newbie In-Reply-To: References: Message-ID: <17498.738.170680.106358@antilipe.corelatus.se> arthur ingram writes: > I am new to erlang would like a good learning process ...of how write > network programs like parsing ip packets... I noticed several > tutorials ... You've asked your question four times now, in varying forms. The answers you've received were good. They pointed you in the right direction. The way forward now is more reading, more thinking, some doing and, once you've done that, perhaps more questions. Here's a top-secret page with links to Erlang documentation: http://www.erlang.org/doc.html > Going forward will support for different platforms continue > to grow ... Opensolaris including sparc , BSDs, Mac OS X, ..... According to both the README file at the top of the source tree and the Erlang FAQ, erlang already works just fine on solaris sparc, BSDs and Mac OS X. Matthias From vlad_dumitrescu@REDACTED Thu May 4 15:45:37 2006 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 4 May 2006 15:45:37 +0200 Subject: Public PID? In-Reply-To: <3f9db9f20605040557s1f2b9738i5f5f05b4ad1e8499@mail.gmail.com> Message-ID: Hi, _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Eric Shun I'd like to send a message to a process on another node. As I don't want to register the pid, I can't use {Node,Pid} ! Message. So I can I know the "public" pid of a process (eg: <5533,245,0>) , as self() only returns a "private" pid (eg: <0,245,0>)? So I could do: PublicPid ! Message. There is no public pid for a process. What you can do is send the pid through a message, and then the receiver will be able to use it. Receivers on different runtimes will see different-looking pids. Of course, you have then a chicken-and-egg problem: if the client wants to get the pid, who does it ask? It can't ask the process itself, because it doesn't know its pid. It has to be able to access some process by name, and from there retrieve the required pid; alternatively, reconsider registering the process. Why do you need to remotely access an unregistered process? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Thu May 4 16:15:09 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 4 May 2006 16:15:09 +0200 Subject: Public PID? In-Reply-To: <3f9db9f20605040557s1f2b9738i5f5f05b4ad1e8499@mail.gmail.com> References: <3f9db9f20605040557s1f2b9738i5f5f05b4ad1e8499@mail.gmail.com> Message-ID: Did you try this? Pid ! Message. I dont know why you look at how pids are written, are you transmitting those triplets over and using deprecated methods to create a pid from the triplets instead of passing the actual Pid object? On 5/4/06, Eric Shun wrote: > > Hi, > > I'd like to send a message to a process on another node. As I don't want > to register the pid, I can't use > {Node,Pid} ! Message. > So I can I know the "public" pid of a process (eg: <5533,245,0>) , as > self() only returns a "private" pid (eg: <0,245,0>)? > So I could do: > PublicPid ! Message. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpettit@REDACTED Thu May 4 16:21:26 2006 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 4 May 2006 09:21:26 -0500 Subject: UBF In-Reply-To: <78568af10605040014m33dc913br1cd635881ebf4912@mail.gmail.com> References: <200605040431.k444VHSk023735@pop.lan> <78568af10605040014m33dc913br1cd635881ebf4912@mail.gmail.com> Message-ID: <20060504142126.GA11914@vailsys.com> On Thu, May 04, 2006 at 12:14:16AM -0700, Ryan Rawson wrote: > Ironically enough I would disagree with the statement: > > "While the XML series of languages had the goal of having a human > readable format the UBF languages take the opposite view and provide a > "machine friendly" format." > > I would state that XML is machine readable, and not as much human > readable. Not readable, but friendly. Isn't it easier to parse: {string,"Hello world"} than: Hello world or: {integer,2} than: 2 In both cases the latter is clearly more verbose. > The original specs for the XML described in great detail > how easy it was to write a parser for it. While most people don't > think XML parsers are very simple, they are better than, say HTML or > SGML. UBF shouldn't be any harder, and going back and forth from XML to UBF is also pretty easy. > But again, i would say that we need more human readable formats. > That's why JSON has become so popular. Is readability really important? Is UBF unreadable? > I know some people who are using JSON and Erlang, that is working out > well for them. Why UBF? I had a lot of fun playing with Joe's UBF contract checker. You can define stateful protocols in UBF (you write a "contract") and plug them into a contract checker (see Joe's download). This provides a great way to test your protocol, and to catch protocol violations in client and server (including timing problems IIRC). -Rick > On 5/3/06, Bertil Askelid wrote: > > A couple of years ago, Joe Armstrong was working on and idea he > > called UBF: > > > > UBF is a language for transporting and describing complex data > > structures across a network. > > > > http://www.sics.se/~joe/ubf/site/home.html > > > > I'm wonder if this came to any extended use in the Erlang Community? > > From invisio22@REDACTED Thu May 4 16:36:34 2006 From: invisio22@REDACTED (Eric Shun) Date: Thu, 4 May 2006 16:36:34 +0200 Subject: Public PID? In-Reply-To: References: <3f9db9f20605040557s1f2b9738i5f5f05b4ad1e8499@mail.gmail.com> Message-ID: <3f9db9f20605040736o5d3a1c3cpf11a26a051273335@mail.gmail.com> ok nevermind, actually Pid ! Message perfectly works!! =) thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Thu May 4 17:37:41 2006 From: chsu79@REDACTED (Christian S) Date: Thu, 4 May 2006 17:37:41 +0200 Subject: Handling sets in mnesia, in a scalable way Message-ID: One can easily handle sets in mnesia by storing a list with items. Example: -record(group, {id, members, ...}). -record(user, {id, ...}). and then have #group.members keep a list of #user.id. This allow one to quickly find the users in a given group. However, this practice can in certain applications lead to huge lists. * search engines mapping keywords to documents * web-two-dot-oh-ishious tag-your-{bookmark,images,...} sites with many users A keyword could easily be used in thousand of documents. Having 10000 documents in the set would lead to huge records that are slower than necessary to update. This is mostly a theoretical question, as I havent hit this limit yet. It is just a problem i have been thinking about for some time, as it sometimes pops up when i think through interesting coding projects. Have anyone experienced a problem with sets in mnesia records growing too large, and worked around it in some clever way. Or does things run on suprisingly well even with sets that grow to ten thousand or more members? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Thu May 4 19:36:00 2006 From: jay@REDACTED (Jay Nelson) Date: Thu, 04 May 2006 10:36:00 -0700 Subject: Google SketchUp Message-ID: <445A3B80.1020902@duomark.com> Google recently purchased SketchUp (http://sketchup.google.com/ or http://www.sketchup.com/) to allow people to easily draw 3d illustrations. They also offer public storage on their servers and sharing of illustrations. Do you think this will have a big impact on erlang downloads as it competes with Wings3d? jay From camster@REDACTED Thu May 4 21:01:17 2006 From: camster@REDACTED (Richard Cameron) Date: Thu, 4 May 2006 20:01:17 +0100 Subject: ODBC on 64-bit Erlang Message-ID: <297A89C6-4842-43D3-A5D3-078B7FC2A30A@citeulike.org> Is there a good reason why the odbc application doesn't work with 64- bit Erlang on Unix? The Makefile which normally builds "odbcserver" (a port process which links with libodbc) explicitly prohibits it in this case: ifneq ($(BITS64),yes) EI_LIB = -lerl_interface -lei UNIX_TARGET = $(BIN_DIR)/odbcserver EXE_TARGET = $(UNIX_TARGET) endif There seem to be a few instances of int types being cast to void * in the source code. But, other than that, is the application fundamentally broken on 64-bit architectures, or could it be easily fixed? Richard. From james.hague@REDACTED Thu May 4 21:48:33 2006 From: james.hague@REDACTED (James Hague) Date: Thu, 4 May 2006 14:48:33 -0500 Subject: Google SketchUp In-Reply-To: <445A3B80.1020902@duomark.com> References: <445A3B80.1020902@duomark.com> Message-ID: > Google recently purchased SketchUp (http://sketchup.google.com/ or > http://www.sketchup.com/) to allow people to easily draw 3d > illustrations. They also offer public storage on their servers and > sharing of illustrations. > > Do you think this will have a big impact on erlang downloads as it > competes with Wings3d? They're two different products. Wings3D is more of a true detail-oriented modeller. SketchUp is for quickly making roughs, especially things like houses. Both are great, IMO. As a side note, SketchUp's interactive tutorials are top-notch, making it easy to get started with. From ulf@REDACTED Fri May 5 00:41:45 2006 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 05 May 2006 00:41:45 +0200 Subject: Handling sets in mnesia, in a scalable way In-Reply-To: References: Message-ID: Den 2006-05-04 17:37:41 skrev Christian S : > Have anyone experienced a problem with sets in mnesia records growing too > large, and worked > around it in some clever way. Or does things run on suprisingly well even > with sets that grow to ten > thousand or more members? I usually use ordered_set tables, and use a compound primary key: {group_members, {group_id, member_id}, ...} This scales very well. BR, Ulf W -- Ulf Wiger From ryanobjc@REDACTED Fri May 5 00:44:49 2006 From: ryanobjc@REDACTED (Ryan Rawson) Date: Thu, 4 May 2006 15:44:49 -0700 Subject: Oracle on Linux In-Reply-To: <200605021615.23508.chaitanya.chalasani@gmail.com> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605021615.23508.chaitanya.chalasani@gmail.com> Message-ID: <78568af10605041544s58c24bbfy4f1c5fe59d51d601@mail.gmail.com> I also have the same needs. Not sure if buying a commercial ODBC driver is a viable option. I havent started poking into this, but soon. -ryan On 5/2/06, Chaitanya Chalasani wrote: > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > Folks, > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > commercial ODBC driver? > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > Thanks, Joel > > > > -- > > http://wagerlabs.com/ > > We tried using a free ODBC for oracle on linux but we faced lot of functional > issues and performance issues. We built an application using OCI and used > erlang ports. The performace is quite good and implemented all the features > we required. > > -- > Chaitanya Chalasani > ------------------- > "The ultimate truths of nature are so subtle > that they can be revealed only under immense silence" > From danner.mideann@REDACTED Fri May 5 08:04:58 2006 From: danner.mideann@REDACTED (danner mideann) Date: Fri, 5 May 2006 07:04:58 +0100 Subject: Cannot compile Erlang Message-ID: <8459e2110605042304p64ec67a6n@mail.gmail.com> First of all, Hello! First post. I posted this yesterday to erlang-questions-posters, but I think it didn't work. Sorry if It did and I'm posting this twice. ------ Hi all, I downloaded erlang source code (otp_src_R10B-10.tar.gz), unpacked, ./configure' d it and tried to make it. I get this error (follow output follows the mail): Makefile.in has been updated, please re-run configure! Obviously, I ran again configure with same results. My system is an AMD64 + Mand riva Linux 2006 AMD64. Already ST*W and found no solition, only this similar mail: http://www.erlang.org/ml-archive/erlang-questions/200507/msg00430.html But not exactly same problem. Anyway, I checked if automake & autoconf were up-t o-date. This is the full output of configure and make: ** ./configure ** checking host system type... x86_64-unknown-linux-gnu checking for GNU make... yes (make) checking for a BSD compatible install... /usr/bin/install -c checking whether ln -s works... yes checking for ranlib... ranlib creating ./config.status creating Makefile configuring in lib running /bin/sh /tmp/otp_src_R10B-10/lib/configure --cache-file=.././config.cac he --srcdir=/tmp/otp_src_R10B-10/lib creating ./config.status configuring in erl_interface/. running /bin/sh /tmp/otp_src_R10B-10/lib/erl_interface/./configure --cache-file =../../.././config.cache --srcdir=/tmp/otp_src_R10B-10/lib/erl_interface/. checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking size of short... 2 checking size of int... 4 checking size of long... 8 checking size of void *... 8 checking size of long long... 8 checking for ar... ar checking for a BSD compatible install... /usr/bin/install -c checking for gethostbyname in -lnsl... yes checking for getpeername in -lsocket... no checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking for arpa/inet.h... yes checking for fcntl.h... yes checking for limits.h... yes checking for malloc.h... yes checking for netdb.h... yes checking for netinet/in.h... yes checking for stddef.h... yes checking for stdlib.h... yes checking for string.h... yes checking for sys/param.h... yes checking for sys/socket.h... yes checking for sys/select.h... yes checking for sys/time.h... yes checking for unistd.h... yes checking for uid_t in sys/types.h... yes checking for pid_t... yes checking for size_t... yes checking whether time.h and sys/time.h may both be included... yes checking for working alloca.h... yes checking for alloca... yes checking whether gcc needs -traditional... no checking for 8-bit clean memcmp... yes checking for dup2... yes checking for gethostbyaddr... yes checking for gethostbyname... yes checking for gethostbyaddr_r... yes checking for gethostbyname_r... yes checking for gethostname... yes checking for writev... yes checking for gethrtime... no checking for gettimeofday... yes checking for inet_ntoa... yes checking for memchr... yes checking for memmove... yes checking for memset... yes checking for select... yes checking for socket... yes checking for strchr... yes checking for strerror... yes checking for strrchr... yes checking for strstr... yes checking for uname... yes checking for res_gethostbyname... no checking for res_gethostbyname in -lresolv... yes checking for clock_gettime... no checking for clock_gettime in -lrt... yes checking for native win32 threads... no checking for pthread_create in -lpthread... yes checking for pthread_atfork in -lpthread... yes checking for pthread.h... yes checking for pthread/mit/pthread.h... no checking for Native POSIX Thread Library... yes checking for nptl/pthread.h... yes checking for /usr/local/include/nptl/pthread.h... no checking for /usr/include/nptl/pthread.h... yes creating ./config.status creating src/x86_64-unknown-linux-gnu/Makefile creating src/x86_64-unknown-linux-gnu/eidefs.mk creating src/x86_64-unknown-linux-gnu/config.h src/x86_64-unknown-linux-gnu/config.h is unchanged configuring in gs/. running /bin/sh /tmp/otp_src_R10B-10/lib/gs/./configure --cache-file=../../../. /config.cache --srcdir=/tmp/otp_src_R10B-10/lib/gs/. checking host system type... x86_64-unknown-linux-gnu checking for prebuilt tcl/tk in tcl/binaries/x86_64_linux-gnu.tar.gz... not foun d creating ./config.status creating tcl/x86_64-unknown-linux-gnu/Makefile creating tcl/win32/Makefile configuring in megaco/. running /bin/sh /tmp/otp_src_R10B-10/lib/megaco/./configure --cache-file=../../ .././config.cache --srcdir=/tmp/otp_src_R10B-10/lib/megaco/. checking host system type... x86_64-unknown-linux-gnu checking for flex... lex checking for yywrap in -ll... no checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for ld.sh... no checking for ld... ld checking for linker flags for loadable drivers... -shared checking for perl... perl creating ./config.status creating src/flex/x86_64-unknown-linux-gnu/Makefile configuring in odbc/. running /bin/sh /tmp/otp_src_R10B-10/lib/odbc/./configure --cache-file=../../.. /./config.cache --srcdir=/tmp/otp_src_R10B-10/lib/odbc/. checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for mixed cygwin and native VC++ environment... no checking whether make sets ${MAKE}... yes checking for ld.sh... no checking for ld... ld checking for pthread_create in -lpthread... yes checking for odbc in standard locations... no checking for SQLAllocHandle in -lodbc... no checking for main in -lodbc32... no checking for connect... yes checking for gethostbyname... yes checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for Native POSIX Thread Library... yes checking for nptl/pthread.h... yes checking for /usr/local/include/nptl/pthread.h... no checking for /usr/include/nptl/pthread.h... yes checking for fcntl.h... yes checking for netdb.h... yes checking for stdlib.h... yes checking for string.h... yes checking for sys/socket.h... yes checking for working const... yes checking for size_t... yes checking for memset... yes checking for socket... yes creating ./config.status creating c_src/x86_64-unknown-linux-gnu/Makefile configuring in snmp/. running /bin/sh /tmp/otp_src_R10B-10/lib/snmp/./configure --cache-file=../../.. /./config.cache --srcdir=/tmp/otp_src_R10B-10/lib/snmp/. checking host system type... x86_64-unknown-linux-gnu checking for perl... perl creating ./config.status creating mibs/Makefile configuring in erts running /bin/sh /tmp/otp_src_R10B-10/erts/configure --cache-file=.././config.ca che --srcdir=/tmp/otp_src_R10B-10/erts creating cache .././config.cache checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for POSIXized ISC... no checking for gcc... (cached) gcc checking whether the C compiler (gcc -g -O2 ) works... yes checking whether the C compiler (gcc -g -O2 ) is a cross-compiler... no checking whether we are using GNU C... (cached) yes checking whether gcc accepts -g... (cached) yes checking for mixed cygwin and native VC++ environment... no checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking for bison... no checking for byacc... byacc checking for perl5... /usr/bin/perl5 checking whether ln -s works... yes checking for ar... ar checking for rm... /bin/rm checking for mkdir... /bin/mkdir checking for a BSD compatible install... /usr/bin/install -c checking how to create a directory including parents... /usr/bin/install -c -d checking for Cygwin environment... no checking for mingw32 environment... no checking for executable suffix... no checking for object suffix... o checking for extra flags needed to export symbols... -Wl,-export-dynamic checking for sin in -lm... yes checking for dlopen in -ldl... yes checking for main in -linet... no checking for native win32 threads... no checking for pthread_create in -lpthread... yes checking if SIGUSR1 and SIGUSR2 can be used... yes checking if sigaltstack can be used... yes checking for Native POSIX Thread Library... yes checking for nptl/pthread.h... yes checking for /usr/local/include/nptl/pthread.h... no checking for /usr/include/nptl/pthread.h... yes checking for pthread.h... yes checking for pthread/mit/pthread.h... no checking for sys/time.h... yes checking for pthread_atfork... yes checking for pthread_mutexattr_settype... yes checking for pthread_mutexattr_setkind_np... yes checking whether the emulator should use threads... no; thread support found but not requested checking for tgetent in -lncurses... yes checking for connect... yes checking for gethostbyname... yes checking for gethostbyname_r... yes checking if netdb.h requires netinet/in.h to be previously included... yes checking for socklen_t... yes checking for h_errno declaration in netdb.h... yes checking for dirent.h that defines DIR... yes checking for opendir in -ldir... no checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking whether time.h and sys/time.h may both be included... yes checking for fcntl.h... yes checking for limits.h... yes checking for unistd.h... yes checking for syslog.h... yes checking for dlfcn.h... yes checking for ieeefp.h... no checking for sys/stropts.h... yes checking for sys/ioctl.h... yes checking for sys/time.h... (cached) yes checking for sys/uio.h... yes checking for sys/sockio.h... no checking for sys/socketio.h... no checking for net/errno.h... no checking for malloc.h... yes checking for mach-o/dyld.h... no checking for arpa/nameser.h... yes checking for sys/devpoll.h... no checking for linux/kpoll.h... no checking for sys/event.h... no checking for SO_BSDCOMPAT declaration... yes checking for INADDR_LOOPBACK in netinet/in.h... yes checking for sys_errlist declaration in stdio.h or errno.h... yes checking for working const... yes checking return type of signal handlers... void checking for off_t... yes checking for pid_t... yes checking for size_t... yes checking whether struct tm is in sys/time.h or time.h... time.h checking whether struct sockaddr has sa_len field... no checking for struct exception (and matherr function)... yes checking size of char... 1 checking size of short... 2 checking size of int... 4 checking size of long... 8 checking size of void *... 8 checking size of long long... 8 checking size of size_t... 8 checking size of off_t... 8 checking int/long/void*/size_t sizes... ok checking whether byte ordering is bigendian... no checking for getipnodebyname... no checking for getipnodebyaddr... no checking for ieee_handler... no checking for fpsetmask... no checking for finite... yes checking for isnan... yes checking for isinf... yes checking for res_gethostbyname... no checking for dlopen... yes checking for pread... yes checking for pwrite... yes checking for writev... yes checking for memmove... yes checking for strerror... yes checking for strerror_r... yes checking for strncasecmp... yes checking for gethrtime... no checking for localtime_r... yes checking for gmtime_r... yes checking for mremap... yes checking for memcpy... yes checking for mallopt... yes checking whether setvbuf arguments are reversed... no checking for vfork.h... no checking for working vfork... yes checking for vprintf... yes checking for unistd.h... (cached) yes checking for getpagesize... yes checking for working mmap... yes checking for conflicting declaration of fread... yes checking for IP version 6 support... yes checking for multicast support... yes checking how to correct for time adjustments... times checking for unreliable floating point execptions... reliable checking if gethrvtime works and how to use it... not working checking if clock_gettime works... using clock_gettime checking whether to redefine FD_SETSIZE... no checking for vperfctr_info in -lperfctr... no checking for working poll()... ok checking for compiler flags for loadable drivers... -g -O2 -I/tmp/otp_src_R10B-1 0/erts/x86_64-unknown-linux-gnu -D_GNU_SOURCE -fPIC checking for linker for loadable drivers... ld checking for linker flags for loadable drivers... -shared checking for 'runtime library path' linker flag... -R checking for a compiler that handles jumptables... gcc checking for OpenSSL >= 0.9.7 in standard locations... /usr checking for OpenSSL kerberos 5 support... no checking for kstat_open in -lkstat... no checking for javac.sh... no checking for javac... javac checking for JDK version 1.2... yes checking for c++... c++ updating cache .././config.cache creating ./config.status creating emulator/x86_64-unknown-linux-gnu/Makefile creating emulator/zlib/x86_64-unknown-linux-gnu/Makefile creating epmd/src/x86_64-unknown-linux-gnu/Makefile creating etc/common/x86_64-unknown-linux-gnu/Makefile creating include/internal/x86_64-unknown-linux-gnu/ethread.mk creating lib_src/x86_64-unknown-linux-gnu/Makefile creating ../make/x86_64-unknown-linux-gnu/otp.mk creating ../lib/ic/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/os_mon/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/ssl/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/ssl/examples/certs/x86_64-unknown-linux-gnu/Makefile creating ../lib/crypto/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/orber/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/runtime_tools/c_src/x86_64-unknown-linux-gnu/Makefile creating ../lib/asn1/c_src/x86_64-unknown-linux-gnu/Makefile creating x86_64-unknown-linux-gnu/config.h x86_64-unknown-linux-gnu/config.h is unchanged creating include/internal/x86_64-unknown-linux-gnu/ethread_header_config.h include/internal/x86_64-unknown-linux-gnu/ethread_header_config.h is unchanged ********************************************************************* ********************** APPLICATIONS DISABLED ********************** ********************************************************************* odbc : No odbc library found ********************************************************************* ** make ** cd erts/emulator && ERL_TOP=/tmp/otp_src_R10B-10 make generate depend make[1]: Entering directory `/tmp/otp_src_R10B-10/erts/emulator' make -f x86_64-unknown-linux-gnu/Makefile generate make[2]: Entering directory `/tmp/otp_src_R10B-10/erts/emulator' Makefile.in has been updated, please re-run configure! make[2]: *** [x86_64-unknown-linux-gnu/Makefile] Error 1 make[2]: Leaving directory `/tmp/otp_src_R10B-10/erts/emulator' make[1]: *** [generate] Error 2 Any ideas? Thanks in advance. Dani.- From Pieter.Rautenbach@REDACTED Fri May 5 08:25:10 2006 From: Pieter.Rautenbach@REDACTED (Pieter Rautenbach) Date: Fri, 5 May 2006 08:25:10 +0200 Subject: ODBC on 64-bit Erlang Message-ID: <88B5DDE8C1A06741B754B910DE2DEFBB8818D5@HERMES.swistgroup.com> ******************************************************** Click here to view our e-mail legal notice: http://www.tebivo.com/email.htm or call: +27 21 888 7920 ******************************************************** Hello Richard >Is there a good reason why the odbc application doesn't work with 64- >bit Erlang on Unix? The Makefile which normally builds >"odbcserver" (a port process which links with libodbc) explicitly >prohibits it in this case: > I came across this too. >ifneq ($(BITS64),yes) >EI_LIB = -lerl_interface -lei >UNIX_TARGET = $(BIN_DIR)/odbcserver >EXE_TARGET = $(UNIX_TARGET) >endif > I just removed the test condition and forced the build. After testing it seemed that odbcserver is working fine. I'm actually using it like that in a production system. I searched the web for more information on using odbcserver with 64-bit architecture, but found none. >There seem to be a few instances of int types being cast to void * in >the source code. But, other than that, is the application >fundamentally broken on 64-bit architectures, or could it be easily >fixed? > I haven't done too much code digging myself, but I couldn't see any problems. If anyone else have come to other insights, please respond. Pieter Rautenbach From dmitry.kargapolov@REDACTED Thu May 4 22:40:07 2006 From: dmitry.kargapolov@REDACTED (Dmitriy Kargapolov) Date: Thu, 04 May 2006 16:40:07 -0400 Subject: ssh_sftp connection problem Message-ID: Hi, I found that in ssh-0.9.1 ssh_sftp:connect/2,3 hangs in case when remote host is unknown. Supposedly it happens because: 1) internal ssh_cm:connect() call is implemented using gen_server:start_link: connect(Host, Port, Opts) -> gen_server:start_link(?MODULE, [client, self(), Host, Port, Opts], []). 2) when ssh_cm:init() failed because of lookup/connect timeout, parent linked process is died as well, i.e. ssh_sftp:init() is died. 3) call call ssh_cm:connect() never ends, and calling process hangs. To test just run ssh_sftp:connect(unexisting_host,[]). From karol.skocik@REDACTED Fri May 5 10:32:20 2006 From: karol.skocik@REDACTED (karol skocik) Date: Fri, 5 May 2006 10:32:20 +0200 Subject: SNMP work with values in table but not with normal values Message-ID: Hi, I hope somebody skilled in SNMP can explain me why I am getting this strange behaviour. I have MIB, funcs file, and module which contains the only one instrumentation function which returns {value, 10000}. This file is stripped version of file we use to demonstrate something what makes me worry. While I get right answer when I ask for the value of SNMP variable from agent : 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). [10000] when I do it from another Erlang shell which acts as a manager it failes : (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, [[1,3,6,1,4,1,100000,1,10,0]]). ** SNMP M-NET-IF LOG: received send_pdu message with Pdu: {pdu,'get-request', 97749231, noError, 0, [{varbind,[1,3,6,1,4,1,100000,1,10,0], 'NULL', 'NULL', undefined}]} Vsn: 'version-1' MsgData: {"public",0} Addr: {127,0,0,1} Port: 4000 ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_msg -> encode pdu ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_outgoing_msg -> encode message ** SNMP M-NET-IF TRACE: handle_send_pdu -> message generated ** SNMP M-NET-IF DEBUG: sent 46 bytes to {127,0,0,1}:4000 [#Port<0.137>] ** SNMP M-NET-IF LOG: received 46 bytes from {127,0,0,1}:4000 [#Port<0.137>] ** SNMP M-NET-IF MPD DEBUG: process_v1_v2c_msg -> entry with Vsn: 'version-1' Addr: {127,0,0,1} Port: 4000 Community: "public" HS: 30 ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> PduMS: 454 ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> was a pdu ** SNMP M-NET-IF TRACE: received pdu {ok,{noSuchName,1,[{varbind,[1,3,6,1,4,1,100000,1,10,0],'NULL','NULL',1}]}, 4997} But the interesting point is, that I can query values in tables (this is not in the example), from both agent and manager shells. I know that it worked before, but the code on my side is so minimal (and working in agent), that I can't really find out what is wrong. Plus values in tables work ok. Strange. I am sending a gzipped directory with both agent and manager code. When it is unpacked into /usr/local/src and the ebin path of agent is added to search path, it should 'work' as it is. 3> snmpa:load_mibs(["/usr/local/src/snmp_test/priv/mibs/MD-DVBH-MIB.bin"]). ok .... 10> code:add_patha("/usr/local/src/snmp_test/ebin"). true 11> l(snmp_agent). {module,snmp_agent} ... 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). [10000] now request in manager shell failes : (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, [[1,3,6,1,4,1,100000,1,10,0]]). .... not found Karol -------------- next part -------------- A non-text attachment was scrubbed... Name: snmp_test.tar.gz Type: application/x-gzip Size: 7571 bytes Desc: not available URL: From eranga@REDACTED Fri May 5 09:48:47 2006 From: eranga@REDACTED (Eranga Udesh) Date: Fri, 5 May 2006 13:48:47 +0600 Subject: ANSI IS-41 protocol stack Message-ID: <20060505081826.0A5EC19DC0F0@mail.wavenet.lk> Hi, Is there anybody with an ANSI and CAMEL ss7 protocol stack, ready to compile in Erlang? I am looking for ANSI TCAP/IS-41 and ITU-T CAMEL layers. Even somebody who can do the development of such stack is also welcome. Anybody interested to discuss commercial terms, please drop me an email off the list. Thanks, - Eranga From bjarne@REDACTED Fri May 5 12:14:20 2006 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Fri, 5 May 2006 12:14:20 +0200 Subject: Erlang/OTP User Conference 2006 References: Message-ID: <001b01c6702c$ade3d7a0$082669d4@segeltorp> Dear Erlang friends The date has now been fixed for this year's EUC, November 9. Please see the call for papers http://www.erlang.se/euc/06/ For those of you who cannot wait that long there is the ACM SIGPLAN Erlang Workshop in Portland on September 16 http://www.erlang.se/workshop/2006/ So please start writing and look forward to a couple of exciting Erlang events this Autumn (Fall). Bjarne D?cker From eranga@REDACTED Fri May 5 10:41:32 2006 From: eranga@REDACTED (Eranga Udesh) Date: Fri, 5 May 2006 14:41:32 +0600 Subject: SNMP work with values in table but not with normal values In-Reply-To: Message-ID: <20060505091113.D963019DC0DD@mail.wavenet.lk> I think you haven't loaded the MIB to the SNMP manager. - Eranga -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of karol skocik Sent: Friday, May 05, 2006 2:32 PM To: erlang-questions@REDACTED Subject: SNMP work with values in table but not with normal values Hi, I hope somebody skilled in SNMP can explain me why I am getting this strange behaviour. I have MIB, funcs file, and module which contains the only one instrumentation function which returns {value, 10000}. This file is stripped version of file we use to demonstrate something what makes me worry. While I get right answer when I ask for the value of SNMP variable from agent : 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). [10000] when I do it from another Erlang shell which acts as a manager it failes : (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, [[1,3,6,1,4,1,100000,1,10,0]]). ** SNMP M-NET-IF LOG: received send_pdu message with Pdu: {pdu,'get-request', 97749231, noError, 0, [{varbind,[1,3,6,1,4,1,100000,1,10,0], 'NULL', 'NULL', undefined}]} Vsn: 'version-1' MsgData: {"public",0} Addr: {127,0,0,1} Port: 4000 ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_msg -> encode pdu ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_outgoing_msg -> encode message ** SNMP M-NET-IF TRACE: handle_send_pdu -> message generated ** SNMP M-NET-IF DEBUG: sent 46 bytes to {127,0,0,1}:4000 [#Port<0.137>] ** SNMP M-NET-IF LOG: received 46 bytes from {127,0,0,1}:4000 [#Port<0.137>] ** SNMP M-NET-IF MPD DEBUG: process_v1_v2c_msg -> entry with Vsn: 'version-1' Addr: {127,0,0,1} Port: 4000 Community: "public" HS: 30 ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> PduMS: 454 ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> was a pdu ** SNMP M-NET-IF TRACE: received pdu {ok,{noSuchName,1,[{varbind,[1,3,6,1,4,1,100000,1,10,0],'NULL','NULL',1}]}, 4997} But the interesting point is, that I can query values in tables (this is not in the example), from both agent and manager shells. I know that it worked before, but the code on my side is so minimal (and working in agent), that I can't really find out what is wrong. Plus values in tables work ok. Strange. I am sending a gzipped directory with both agent and manager code. When it is unpacked into /usr/local/src and the ebin path of agent is added to search path, it should 'work' as it is. 3> snmpa:load_mibs(["/usr/local/src/snmp_test/priv/mibs/MD-DVBH-MIB.bin"]). ok .... 10> code:add_patha("/usr/local/src/snmp_test/ebin"). true 11> l(snmp_agent). {module,snmp_agent} ... 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). [10000] now request in manager shell failes : (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, [[1,3,6,1,4,1,100000,1,10,0]]). .... not found Karol From samuel@REDACTED Fri May 5 13:17:07 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 5 May 2006 13:17:07 +0200 Subject: error_logger and user memory usage Message-ID: <20060505111707.GA13622@nodo2.lambdastream.com> Hello, I have one application that handles relatively big binaries. There are some gen_servers that may have buffers up to 5000000 bytes in their state. The problem is that after a certain number (less than 4) of consecutive failures my system runs out of memory and starts swapping. The processes that seem to be eating the memory are error_logger and user; even after stopping the system they use more than 100 M. I reckon the problem are the verbose error reports that are written in the tty (large messages and large states in the crashing gen_servers). An easy workaround is removing error_logger_tty_h from the error_logger and living with sasl error_handler only. Any ideas about what is really happening? -- Samuel From matthias@REDACTED Fri May 5 13:32:27 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 5 May 2006 13:32:27 +0200 Subject: error_logger and user memory usage In-Reply-To: <20060505111707.GA13622@nodo2.lambdastream.com> References: <20060505111707.GA13622@nodo2.lambdastream.com> Message-ID: <17499.14283.977626.775862@antilipe.corelatus.se> Samuel Rivas writes: > The problem is that after a certain number (less than 4) of consecutive > failures my system runs out of memory and starts swapping. The processes > that seem to be eating the memory are error_logger and user; even after > stopping the system they use more than 100 M. Do things improve if you explicitly GC those processes, i.e. call erlang:garbage_collect(Pid) > I reckon the problem are the verbose error reports that are written in > the tty (large messages and large states in the crashing gen_servers). > > An easy workaround is removing error_logger_tty_h from the error_logger > and living with sasl error_handler only. I'm not sure if this is directly related to your problem, but I had problems with gigantic error reports swamping my logging system with relatively useless information. I solved it by writing my own code to format error reports. The trick is that it limits the length of printouts. http://www.corelatus.se/~matthias/trunc_io.erl Mattthias From bmk@REDACTED Fri May 5 13:33:06 2006 From: bmk@REDACTED (Micael Karlberg) Date: Fri, 05 May 2006 13:33:06 +0200 Subject: SNMP work with values in table but not with normal values In-Reply-To: References: Message-ID: <445B37F2.7040804@erix.ericsson.se> Hi, You have most likely configured the agent and/or manager incorrectly. Increase verbosity of the agent: snmpa:verbosity(master_agent, trace). snmpa:verbosity(net_if, trace). And run the get request again. This will produce _a lot of_ printouts, that hopefully will make it clear why the agent reports noSuchName. /BMK karol skocik wrote: > Hi, > I hope somebody skilled in SNMP can explain me why I am getting this > strange behaviour. > I have MIB, funcs file, and module which contains the only one > instrumentation function > which returns {value, 10000}. This file is stripped version of file we > use to demonstrate > something what makes me worry. > > While I get right answer when I ask for the value of SNMP variable > from agent : > 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). > [10000] > > when I do it from another Erlang shell which acts as a manager it failes : > (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, > [[1,3,6,1,4,1,100000,1,10,0]]). > ** SNMP M-NET-IF LOG: received send_pdu message with > Pdu: {pdu,'get-request', > 97749231, > noError, > 0, > [{varbind,[1,3,6,1,4,1,100000,1,10,0], > 'NULL', > 'NULL', > undefined}]} > Vsn: 'version-1' > MsgData: {"public",0} > Addr: {127,0,0,1} > Port: 4000 > ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_msg -> encode pdu > ** SNMP M-NET-IF MPD DEBUG: generate_v1_v2c_outgoing_msg -> encode message > ** SNMP M-NET-IF TRACE: handle_send_pdu -> message generated > ** SNMP M-NET-IF DEBUG: sent 46 bytes to {127,0,0,1}:4000 [#Port<0.137>] > ** SNMP M-NET-IF LOG: received 46 bytes from {127,0,0,1}:4000 > [#Port<0.137>] > ** SNMP M-NET-IF MPD DEBUG: process_v1_v2c_msg -> entry with > Vsn: 'version-1' > Addr: {127,0,0,1} > Port: 4000 > Community: "public" > HS: 30 > ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> PduMS: 454 > ** SNMP M-NET-IF MPD TRACE: process_v1_v2c_msg -> was a pdu > ** SNMP M-NET-IF TRACE: received pdu > {ok,{noSuchName,1,[{varbind,[1,3,6,1,4,1,100000,1,10,0],'NULL','NULL',1}]}, > 4997} > > But the interesting point is, that I can query values in tables (this > is not in the example), > from both agent and manager shells. > > I know that it worked before, but the code on my side is so minimal > (and working in agent), > that I can't really find out what is wrong. Plus values in tables work > ok. Strange. > > I am sending a gzipped directory with both agent and manager code. > When it is unpacked > into /usr/local/src and the ebin path of agent is added to search > path, it should 'work' > as it is. > > 3> snmpa:load_mibs(["/usr/local/src/snmp_test/priv/mibs/MD-DVBH-MIB.bin"]). > ok > .... > 10> code:add_patha("/usr/local/src/snmp_test/ebin"). > true > 11> l(snmp_agent). > {module,snmp_agent} > ... > 12> snmpa:get(snmp_master_agent, [[1,3,6,1,4,1,100000,1,10,0]]). > [10000] > > now request in manager shell failes : > (manager@REDACTED)6> snmpm:g("karol", {127,0,0,1}, 4000, > [[1,3,6,1,4,1,100000,1,10,0]]). > .... > not found > > > Karol From samuel@REDACTED Fri May 5 14:07:07 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 5 May 2006 14:07:07 +0200 Subject: error_logger and user memory usage In-Reply-To: <17499.14283.977626.775862@antilipe.corelatus.se> References: <20060505111707.GA13622@nodo2.lambdastream.com> <17499.14283.977626.775862@antilipe.corelatus.se> Message-ID: <20060505120707.GA14690@nodo2.lambdastream.com> Matthias Lang wrote: > Samuel Rivas writes: > > > The problem is that after a certain number (less than 4) of consecutive > > failures my system runs out of memory and starts swapping. The processes > > that seem to be eating the memory are error_logger and user; even after > > stopping the system they use more than 100 M. > > Do things improve if you explicitly GC those processes, i.e. call > > erlang:garbage_collect(Pid) They do. I had wrongly tried erlang:garbage_collect() ... Maybe the problem is that their inbox size increases so fast that they can't handle/output the error reports? > > I reckon the problem are the verbose error reports that are written in > > the tty (large messages and large states in the crashing gen_servers). > > > > An easy workaround is removing error_logger_tty_h from the error_logger > > and living with sasl error_handler only. > > I'm not sure if this is directly related to your problem, but I had > problems with gigantic error reports swamping my logging system with > relatively useless information. I solved it by writing my own code > to format error reports. The trick is that it limits the length of printouts. > > http://www.corelatus.se/~matthias/trunc_io.erl Well, that's also a problem. I'm trying to solve the big one: my system collapses before supervisors reach a reasonable restart intensity. A custom error handler using your idea of limiting the report length may be the solution for both of them. Thanks! -- Samuel From serge@REDACTED Fri May 5 15:36:45 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 05 May 2006 09:36:45 -0400 Subject: hipe segmentation fault In-Reply-To: <17461.28551.177582.208872@alkaid.it.uu.se> References: <200604051319.k35DJXWm001902@alkaid.it.uu.se> <44340446.1010108@hq.idt.net> <17461.28551.177582.208872@alkaid.it.uu.se> Message-ID: <445B54ED.7010401@hq.idt.net> Mikael, When I applied this patch to FC5 Linux 64-bit OS, Erlang compiled fine, however when I did the same on a 32-bit Linux FC5 OS, the make process failed with the errors shown below. Serge gcc -g -O3 -I/home/serge/Projects/Distrs/R10B-10/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -D_THREAD_SAFE -D_REENTRANT -DUSE_THREADS -Ibeam -Isys/unix -Isys/common -Ii686-pc-linux-gnu -Ii686-pc-linux-gnu/hybrid -Izlib -Ihipe -I../include/internal -I../include/internal/i686-pc-linux-gnu -c hipe/hipe_x86.c -o /home/serge/Projects/Distrs/R10B-10/erts/obj.hybrid.beam/i686-pc-linux-gnu/hipe_x86.o hipe/hipe_x86.c: In function 'morecore': hipe/hipe_x86.c:107: warning: implicit declaration of function 'mmap' hipe/hipe_x86.c:108: error: 'PROT_EXEC' undeclared (first use in this function) hipe/hipe_x86.c:108: error: (Each undeclared identifier is reported only once hipe/hipe_x86.c:108: error: for each function it appears in.) hipe/hipe_x86.c:108: error: 'PROT_READ' undeclared (first use in this function) hipe/hipe_x86.c:108: error: 'PROT_WRITE' undeclared (first use in this function) hipe/hipe_x86.c:109: error: 'MAP_PRIVATE' undeclared (first use in this function) hipe/hipe_x86.c:109: error: 'MAP_ANONYMOUS' undeclared (first use in this function) hipe/hipe_x86.c:114: warning: assignment makes pointer from integer without a cast hipe/hipe_x86.c:115: error: 'MAP_FAILED' undeclared (first use in this function) make[3]: *** [/home/serge/Projects/Distrs/R10B-10/erts/obj.hybrid.beam/i686-pc-linux-gnu/hipe_x86.o] Error 1 make[3]: Leaving directory `/home/serge/Projects/Distrs/R10B-10/erts/emulator' make[2]: *** [hybrid] Error 2 make[2]: Leaving directory `/home/serge/Projects/Distrs/R10B-10/erts/emulator' make[1]: *** [hybrid] Error 2 make[1]: Leaving directory `/home/serge/Projects/Distrs/R10B-10/erts' make: *** [emulator] Error 2 Mikael Pettersson wrote: > Serge Aleynikov writes: > > Mikael, > > > > Here's a bunch of info you requested. Let's continue this discussion > > outside of the mailing list's scope, and just post the resolution > > when/if it's available. > > > [gdb session omitted] > > Problem solved. According to the gdb session everything looked OK, > yet the code couldn't be executed. It turns out that with the fairly > new processor model Serge is using, the Linux kernel makes normal > data memory non-executable by default. We've seen this long ago on > AMD64 machines with 64-bit kernels, but never before on machines with > 32-bit kernels. The solution is to adapt the specially written AMD64 > code memory allocation routines for use on x86 as well. > > The patch below solves this problem. It's been checked in on the R11 > development branch and should be applied to R10B-10 as well. > > /Mikael > > --- otp-0330/erts/emulator/hipe/hipe_amd64.h.~1~ 2005-12-15 12:29:52.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_amd64.h 2006-04-06 17:46:19.000000000 +0200 > @@ -14,10 +14,6 @@ > > #define hipe_arch_name am_amd64 > > -/* for hipe_bifs_enter_code_2 */ > -extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); > -#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) > - > extern const Uint sse2_fnegate_mask[]; > > #endif /* HIPE_AMD64_H */ > --- otp-0330/erts/emulator/hipe/hipe_x86.c.~1~ 2005-12-15 12:29:53.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_x86.c 2006-04-06 19:23:59.000000000 +0200 > @@ -50,6 +50,114 @@ > return 0; > } > > +/* > + * Memory allocator for executable code. > + * > + * This is required on x86 because some combinations > + * of Linux kernels and CPU generations default to > + * non-executable memory mappings, causing ordinary > + * malloc() memory to be non-executable. > + */ > +static unsigned int code_bytes; > +static char *code_next; > + > +#if 0 /* change to non-zero to get allocation statistics at exit() */ > +static unsigned int total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs, nr_large, total_lost; > +static unsigned int atexit_done; > + > +static void alloc_code_stats(void) > +{ > + printf("\r\nalloc_code_stats: %u bytes mapped, %u joins, %u splits, %u bytes allocated, %u average alloc, %u large allocs, %u bytes lost\r\n", > + total_mapped, nr_joins, nr_splits, total_alloc, nr_allocs ? total_alloc/nr_allocs : 0, nr_large, total_lost); > +} > + > +static void atexit_alloc_code_stats(void) > +{ > + if (!atexit_done) { > + atexit_done = 1; > + (void)atexit(alloc_code_stats); > + } > +} > + > +#define ALLOC_CODE_STATS(X) do{X;}while(0) > +#else > +#define ALLOC_CODE_STATS(X) do{}while(0) > +#endif > + > +static void morecore(unsigned int alloc_bytes) > +{ > + unsigned int map_bytes; > + char *map_hint, *map_start; > + > + /* Page-align the amount to allocate. */ > + map_bytes = (alloc_bytes + 4095) & ~4095; > + > + /* Round up small allocations. */ > + if (map_bytes < 1024*1024) > + map_bytes = 1024*1024; > + else > + ALLOC_CODE_STATS(++nr_large); > + > + /* Create a new memory mapping, ensuring it is executable > + and in the low 2GB of the address space. Also attempt > + to make it adjacent to the previous mapping. */ > + map_hint = code_next + code_bytes; > + if ((unsigned long)map_hint & 4095) > + abort(); > + map_start = mmap(map_hint, map_bytes, > + PROT_EXEC|PROT_READ|PROT_WRITE, > + MAP_PRIVATE|MAP_ANONYMOUS > +#ifdef __x86_64__ > + |MAP_32BIT > +#endif > + , > + -1, 0); > + if (map_start == MAP_FAILED) { > + perror("mmap"); > + abort(); > + } > + ALLOC_CODE_STATS(total_mapped += map_bytes); > + > + /* Merge adjacent mappings, so the trailing portion of the previous > + mapping isn't lost. In practice this is quite successful. */ > + if (map_start == map_hint) { > + ALLOC_CODE_STATS(++nr_joins); > + code_bytes += map_bytes; > + } else { > + ALLOC_CODE_STATS(++nr_splits); > + ALLOC_CODE_STATS(total_lost += code_bytes); > + code_next = map_start; > + code_bytes = map_bytes; > + } > + > + ALLOC_CODE_STATS(atexit_alloc_code_stats()); > +} > + > +static void *alloc_code(unsigned int alloc_bytes) > +{ > + void *res; > + > + /* Align function entries. */ > + alloc_bytes = (alloc_bytes + 3) & ~3; > + > + if (code_bytes < alloc_bytes) > + morecore(alloc_bytes); > + ALLOC_CODE_STATS(++nr_allocs); > + ALLOC_CODE_STATS(total_alloc += alloc_bytes); > + res = code_next; > + code_next += alloc_bytes; > + code_bytes -= alloc_bytes; > + return res; > +} > + > +void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p) > +{ > + if (is_not_nil(callees)) > + return NULL; > + *trampolines = NIL; > + return alloc_code(nrbytes); > +} > + > /* called from hipe_bif0.c:hipe_bifs_make_native_stub_2() > and hipe_bif0.c:hipe_make_stub() */ > void *hipe_make_native_stub(void *beamAddress, unsigned int beamArity) > @@ -76,7 +184,7 @@ > 16 + /* 16 when both offsets are 8-bit */ > (P_BEAM_IP >= 128 ? 3 : 0) + > (P_ARITY >= 128 ? 3 : 0); > - codep = code = erts_alloc(ERTS_ALC_T_HIPE, codeSize); > + codep = code = alloc_code(codeSize); > > /* movl $beamAddress, P_BEAM_IP(%ebp); 3 or 6 bytes, plus 4 */ > codep[0] = 0xc7; > --- otp-0330/erts/emulator/hipe/hipe_x86.h.~1~ 2005-12-15 12:29:53.000000000 +0100 > +++ otp-0330/erts/emulator/hipe/hipe_x86.h 2006-04-06 17:45:48.000000000 +0200 > @@ -39,4 +39,8 @@ > extern void nbif_inc_stack_0(void); > extern void nbif_handle_fp_exception(void); > > +/* for hipe_bifs_enter_code_2 */ > +extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p); > +#define HIPE_ALLOC_CODE(n,c,t,p) hipe_alloc_code((n),(c),(t),(p)) > + > #endif /* HIPE_X86_H */ > -- Serge Aleynikov R&D Telecom, IDT Corp. Tel: (973) 438-3436 Fax: (973) 438-1464 serge@REDACTED From kg9020@REDACTED Fri May 5 17:24:51 2006 From: kg9020@REDACTED (a) Date: Fri, 5 May 2006 10:24:51 -0500 Subject: newbie In-Reply-To: <17498.738.170680.106358@antilipe.corelatus.se> References: <17498.738.170680.106358@antilipe.corelatus.se> Message-ID: <278D0034-F85F-4886-8E88-33F78F34A67B@gmail.com> Please forgive me for the misunderstanding I caused by the way I stated my questions. The information I am looking for is based on the following. The packet sniffer program is a class project normally done in Java. Java is taught at the college ... several Java books are on the shelf ...etc I have watched several Java instructors take a while to complete this project in a timely manner. I have been looking at Erlang since this past month Erlang has been successfully loaded on Solaris x86 and sparc , Mac os x, linux, and windows. I am also using the livecd The Question about current OS support my fault I am currently following the OTP tutorial material I have permission from the professor to use Erlang instead of Java. I want to be sure there there will be enough resources to finish the journey and possibly recommend the program be offered as course of instruction. I wanted to know that since there a currently no books on the shelf if Lisp would help in the learning process I have also noticed that several companies that started projects in Erlang self taught from the ACM presentations like Sendmail mentioned needing to hire a trainer to help solve some issues in there project That it is good practice to use OTP methods which superseded the methods in the original Erlang book. Art On May 4, 2006, at 8:34 AM, Matthias Lang wrote: > > arthur ingram writes: > >> I am new to erlang would like a good learning process ...of how write >> network programs like parsing ip packets... I noticed several >> tutorials ... > > You've asked your question four times now, in varying forms. The > answers you've received were good. They pointed you in the right > direction. The way forward now is more reading, more thinking, some > doing and, once you've done that, perhaps more questions. > > Here's a top-secret page with links to Erlang documentation: > > http://www.erlang.org/doc.html > >> Going forward will support for different platforms continue >> to grow ... Opensolaris including sparc , BSDs, Mac OS X, ..... > > According to both the README file at the top of the source tree and > the Erlang FAQ, erlang already works just fine on solaris sparc, BSDs > and Mac OS X. > > Matthias > From jefcrane@REDACTED Fri May 5 18:39:24 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Fri, 5 May 2006 09:39:24 -0700 (PDT) Subject: newbie In-Reply-To: <278D0034-F85F-4886-8E88-33F78F34A67B@gmail.com> Message-ID: <20060505163924.53372.qmail@web31612.mail.mud.yahoo.com> I have witnessed each attempt to answer these kind of networking implementation questions. I feel that the reason the question keeps coming up is because the answer given (RTFM like I told you the first time) is not helpful. http://www.sics.se/~joe/tutorials/client_server/client_server.html THIS link told me more than all the erlang docs combined. This should help! --- a wrote: > > > Please forgive me for the misunderstanding I caused > by the way I > stated my questions. The information I am looking > for is based on > the following. > > > The packet sniffer program is a class project > normally done in Java. > Java is taught at the college ... several Java > books are on the > shelf ...etc I have watched several Java > instructors take a while > to complete this project in a timely manner. > I have been looking at Erlang since this past > month > Erlang has been successfully loaded on Solaris > x86 and sparc , > Mac os x, linux, and windows. I am also using the > livecd > The Question about current OS support my fault > I am currently following the OTP tutorial material > I have permission from the professor to use Erlang > instead of Java. > I want to be sure there there will be enough > resources to finish > the journey and possibly recommend the program be > offered as course > of instruction. > I wanted to know that since there a currently no > books on the shelf > if Lisp would help in the learning process > I have also noticed that several companies that > started projects in > Erlang self taught from the ACM presentations like > Sendmail > mentioned needing to hire a trainer to help solve > some issues in > there project > That it is good practice to use OTP methods which > superseded the > methods in the original Erlang book. > > Art > > > > On May 4, 2006, at 8:34 AM, Matthias Lang wrote: > > > > > arthur ingram writes: > > > >> I am new to erlang would like a good learning > process ...of how write > >> network programs like parsing ip packets... I > noticed several > >> tutorials ... > > > > You've asked your question four times now, in > varying forms. The > > answers you've received were good. They pointed > you in the right > > direction. The way forward now is more reading, > more thinking, some > > doing and, once you've done that, perhaps more > questions. > > > > Here's a top-secret page with links to Erlang > documentation: > > > > http://www.erlang.org/doc.html > > > >> Going forward will support for different > platforms continue > >> to grow ... Opensolaris including sparc , BSDs, > Mac OS X, ..... > > > > According to both the README file at the top of > the source tree and > > the Erlang FAQ, erlang already works just fine on > solaris sparc, BSDs > > and Mac OS X. > > > > Matthias > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From dbarker@REDACTED Fri May 5 19:28:01 2006 From: dbarker@REDACTED (Deryk Barker) Date: Fri, 5 May 2006 10:28:01 -0700 Subject: Setting the node name after startup. Message-ID: <20060505102801.A18270@hal.cs.camosun.bc.ca> Hi, I'm pretty new to erlang but becoming increasingly keen. I am currently trying to use it (at a very elementray level) in our network programming course. The problem is our lab installation (windows...) is so tightly locked down that it is rather difficult to use the command line -sname (or -name) - and the initial working directory is on a read-inly disc (so no beam files can be written). The working_dir is easy to work around (file:set_cwd/1) but I have so far been unable to figure out if it is possible to set the node name one erl has been started. Any assistance will be graetfully received. -- |Deryk Barker, Computer Science Dept. | Music does not have to be understood| |Camosun College, Victoria, BC, Canada| It has to be listened to. | |email: dbarker@REDACTED | | |phone: +1 250 370 4452 | Hermann Scherchen. | From richardc@REDACTED Fri May 5 21:50:39 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 05 May 2006 21:50:39 +0200 Subject: Setting the node name after startup. In-Reply-To: <20060505102801.A18270@hal.cs.camosun.bc.ca> References: <20060505102801.A18270@hal.cs.camosun.bc.ca> Message-ID: <445BAC8F.1010500@it.uu.se> Deryk Barker wrote: > The working_dir is easy to work around (file:set_cwd/1) but I have so > far been unable to figure out if it is possible to set the node name > one erl has been started. See the documentation of the net_kernel module (part of the kernel application). http://www.erlang.org/doc/doc-5.4.13/lib/kernel-2.10.13/doc/html/index.html /Richard From parault2@REDACTED Sat May 6 11:06:28 2006 From: parault2@REDACTED (Patrice Rault) Date: Sat, 06 May 2006 11:06:28 +0200 Subject: System hang with Wings3D on FC5 Message-ID: <1146906388.2504.10.camel@localhost.localdomain> Hello, After a build from sources, launch Wings3D with erl -pa $ESDL_PATH/ebin -pa /home/pat/wings/ebin -run wings_start start_halt hang and freeze the system. To solve this problem, we need to change the SELinux configuration. Use the following shell command as root setsebool -P allow-execmod 1 and perhaps setsebool -P allow-execheap 1 (already on in my config for another reasons) allow_execmem and allow_execstack seem to be on by default (targeted SELinux policy). Regards. From joelr1@REDACTED Sat May 6 16:16:31 2006 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 6 May 2006 15:16:31 +0100 Subject: erl -make always recompiling Message-ID: Folks, Notice how the same files are recompiled twice. I don't do anything in between. What would be the reason for this behavior and how can I fix it? bigdaddy:~/work/Erlang/jabberlang/trunk joelr$ erl -pa ebin -make Recompile: src/xmpp_callbacks.erl Recompile: src/xmpp_echo.erl Recompile: src/xmpp_echo_behaviour.erl Recompile: src/xmpp_echo_behaviour2.erl Recompile: src/xmpp_erlang_example.erl Recompile: src/xmpp_iq.erl bigdaddy:~/work/Erlang/jabberlang/trunk joelr$ erl -pa ebin -make Recompile: src/xmpp_callbacks.erl Recompile: src/xmpp_echo.erl Recompile: src/xmpp_echo_behaviour.erl Recompile: src/xmpp_echo_behaviour2.erl Recompile: src/xmpp_erlang_example.erl Recompile: src/xmpp_iq.erl The Emakefile is below and the first two files are not recompiled. {'src/gen_xmpp_client', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp_callbacks.erl', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp_echo.erl', [{outdir, "ebin"}]}. {'src/xmpp_echo_behaviour.erl', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp_echo_behaviour2.erl', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp_erlang_example.erl', [{outdir, "ebin"},{i,"include"}]}. {'src/xmpp_iq.erl', [{outdir, "ebin"}]}. %{'error_logger_xmpp_h.erl', [{outdir, "ebin"}]}. Thanks, Joel -- http://wagerlabs.com/ From hedeland@REDACTED Sat May 6 17:19:39 2006 From: hedeland@REDACTED (Per Hedeland) Date: Sat, 6 May 2006 17:19:39 +0200 (CEST) Subject: Cannot compile Erlang In-Reply-To: <8459e2110605042304p64ec67a6n@mail.gmail.com> Message-ID: <200605061519.k46FJdVb009471@tordmule.bluetail.com> "danner mideann" wrote: > >I downloaded erlang source code (otp_src_R10B-10.tar.gz), unpacked, ./configure' >d it and tried to make it. I get this error (follow output follows the mail): > >Makefile.in has been updated, please re-run configure! Have you checked the time and *date* on your computer? As far as I know, Makefile.in should never be updated in a normal build - and of course 'make' can't know one way or the other, it just compares the time stamps on Makefile.in and Makefile, and finds that Makefile.in is newer, even though Makefile should have been generated from Makefile.in by configure. This will happen if the date/time on your box is at some point in the past, before Makefile.in was created/modified by the OTP team and packed into the distribution tarball. Another possibility might be some "weirdness" with time stamping in the file system you're using, e.g. NFS with clock skew between client and server. --Per Hedeland From serge@REDACTED Sat May 6 18:19:06 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 06 May 2006 12:19:06 -0400 Subject: hipe segmentation fault In-Reply-To: <200605052348.k45Nm5bt028836@harpo.it.uu.se> References: <200605052348.k45Nm5bt028836@harpo.it.uu.se> Message-ID: <445CCC7A.7030509@hq.idt.net> Your explanation makes perfect sense indeed, and in search for the answer, I did find that HAVE_MMAP was *not* set by configure on this machine. What is see is that if I try to do: $ rm -fr otp_src_R10B-10 $ tar xzf otp_src_R10B-10.tar.gz $ cd otp_src_R10B-10 $ ./configure --enable-threads | grep mmap checking for working mmap... yes so mmap gets defined fine. However, if I run autoconf-2.13 in erts, mmap doesn't get found: $ rm -fr otp_src_R10B-10 $ tar xzf otp_src_R10B-10.tar.gz $ cd otp_src_R10B-10/erts $ autoconf-2.13 $ cd .. $ ./configure --enable-threads | grep mmap checking for working mmap... no However, when autoconf is being used instead of autoconf-2.13 in the case above, mmap gets found all right. Anyone has any idea why? Serge Mikael Pettersson wrote: > On Fri, 05 May 2006 09:36:45 -0400, Serge Aleynikov wrote: > >>When I applied this patch to FC5 Linux 64-bit OS, Erlang compiled fine, >>however when I did the same on a 32-bit Linux FC5 OS, the make process >>failed with the errors shown below. >> >>Serge >> >>gcc -g -O3 -I/home/serge/Projects/Distrs/R10B-10/erts/i686-pc-linux-gnu >> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DHYBRID >>-DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes >>-D_THREAD_SAFE -D_REENTRANT -DUSE_THREADS -Ibeam -Isys/unix >>-Isys/common -Ii686-pc-linux-gnu -Ii686-pc-linux-gnu/hybrid -Izlib >>-Ihipe -I../include/internal -I../include/internal/i686-pc-linux-gnu -c >>hipe/hipe_x86.c -o >>/home/serge/Projects/Distrs/R10B-10/erts/obj.hybrid.beam/i686-pc-linux-gnu/hipe_x86.o >>hipe/hipe_x86.c: In function 'morecore': >>hipe/hipe_x86.c:107: warning: implicit declaration of function 'mmap' >>hipe/hipe_x86.c:108: error: 'PROT_EXEC' undeclared (first use in this >>function) >>hipe/hipe_x86.c:108: error: (Each undeclared identifier is reported only >>once >>hipe/hipe_x86.c:108: error: for each function it appears in.) >>hipe/hipe_x86.c:108: error: 'PROT_READ' undeclared (first use in this >>function) >>hipe/hipe_x86.c:108: error: 'PROT_WRITE' undeclared (first use in this >>function) >>hipe/hipe_x86.c:109: error: 'MAP_PRIVATE' undeclared (first use in this >>function) >>hipe/hipe_x86.c:109: error: 'MAP_ANONYMOUS' undeclared (first use in >>this function) >>hipe/hipe_x86.c:114: warning: assignment makes pointer from integer >>without a cast >>hipe/hipe_x86.c:115: error: 'MAP_FAILED' undeclared (first use in this >>function) > > > This means that, for some reason, an #include of was lost. > This shouldn't happen: hipe_x86.c includes global.h, which includes > sys.h, which includes erl_unix_sys.h (unless one of __WIN32__/VXWORKS/_OSE_ > is defined), which includes unless erts/configure decided > that HAVE_MMAP should be 0, which shouldn't be possible on FC5. > > I've built R10B-10 on an FC5 box (i686, 100% vanilla, no updates), > and no problems occurred. I can't explain why things don't work for you, > but simply adding "#include " at the end of the > #include directives in hipe_x86.c ought to work. > > /Mikael > From serge@REDACTED Sat May 6 19:21:06 2006 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 06 May 2006 13:21:06 -0400 Subject: hipe segmentation fault In-Reply-To: <200605061713.k46HDZo3023001@harpo.it.uu.se> References: <200605061713.k46HDZo3023001@harpo.it.uu.se> Message-ID: <445CDB02.6000807@hq.idt.net> Mikael Pettersson wrote: > On Sat, 06 May 2006 12:19:06 -0400, Serge Aleynikov wrote: > >>Your explanation makes perfect sense indeed, and in search for the >>answer, I did find that HAVE_MMAP was *not* set by configure on this >>machine. >> >>What is see is that if I try to do: >> >>$ rm -fr otp_src_R10B-10 >>$ tar xzf otp_src_R10B-10.tar.gz >>$ cd otp_src_R10B-10 >>$ ./configure --enable-threads | grep mmap >>checking for working mmap... yes > > > That's what users are supposed to do, and it clearly works. Indeed. > My guess is that the OTP team's autoconf-2.13 is different somehow > from the autoconf-2.13 .rpm in Fedora. > > Why are you regenerating erts/configure? Do you have local > modifications to erts/configure.in? We implemented SCTP support for OTP in a form of a patch that requires to modify erts/configure.in. > If you add the "#include " to hipe_x86.c as I > described, does the system then build OK, or do other things > still break because of the missing HAVE_MMAP? Yes, it does get compiled fine in that case. Serge From danner.mideann@REDACTED Sun May 7 20:47:46 2006 From: danner.mideann@REDACTED (danner mideann) Date: Sun, 7 May 2006 20:47:46 +0200 Subject: Cannot compile Erlang In-Reply-To: <200605061519.k46FJdVb009471@tordmule.bluetail.com> References: <8459e2110605042304p64ec67a6n@mail.gmail.com> <200605061519.k46FJdVb009471@tordmule.bluetail.com> Message-ID: <8459e2110605071147o52c24e6bg@mail.gmail.com> 2006/5/6, Per Hedeland : > "danner mideann" wrote: > > > >I downloaded erlang source code (otp_src_R10B-10.tar.gz), unpacked, ./configure' > >d it and tried to make it. I get this error (follow output follows the mail): > > > >Makefile.in has been updated, please re-run configure! > > Have you checked the time and *date* on your computer? As far as I know, > Makefile.in should never be updated in a normal build - and of course > 'make' can't know one way or the other, it just compares the time stamps > on Makefile.in and Makefile, and finds that Makefile.in is newer, even > though Makefile should have been generated from Makefile.in by > configure. Yes, it was this easy... I had some problems on my box and didn't checked the clock after them. It's compiling now. Thanks a lot!! From danner.mideann@REDACTED Sun May 7 20:45:33 2006 From: danner.mideann@REDACTED (danner mideann) Date: Sun, 7 May 2006 20:45:33 +0200 Subject: Cannot compile Erlang In-Reply-To: <200605061519.k46FJdVb009471@tordmule.bluetail.com> References: <8459e2110605042304p64ec67a6n@mail.gmail.com> <200605061519.k46FJdVb009471@tordmule.bluetail.com> Message-ID: <8459e2110605071145l1b2e0fb8u@mail.gmail.com> 2006/5/6, Per Hedeland : > "danner mideann" wrote: > > > >I downloaded erlang source code (otp_src_R10B-10.tar.gz), unpacked, ./configure' > >d it and tried to make it. I get this error (follow output follows the mail): > > > >Makefile.in has been updated, please re-run configure! > > Have you checked the time and *date* on your computer? As far as I know, > Makefile.in should never be updated in a normal build - and of course > 'make' can't know one way or the other, it just compares the time stamps > on Makefile.in and Makefile, and finds that Makefile.in is newer, even > though Makefile should have been generated from Makefile.in by > configure. > > This will happen if the date/time on your box is at some point in the > past, before Makefile.in was created/modified by the OTP team and packed > into the distribution tarball. Another possibility might be some > "weirdness" with time stamping in the file system you're using, e.g. NFS > with clock skew between client and server. > > --Per Hedeland > From gunilla@REDACTED Mon May 8 07:42:57 2006 From: gunilla@REDACTED (Gunilla Arendt) Date: Mon, 08 May 2006 07:42:57 +0200 Subject: erl -make always recompiling In-Reply-To: References: Message-ID: <445EDA61.9050105@erix.ericsson.se> When specifying a file name including the .erl extension in Emakefile, make:all/0,1 looks for the object code in the wrong place. This bug has been fixed in Erlang/OTP R11B. Regards, Gunilla Joel Reymont wrote: > Folks, > > Notice how the same files are recompiled twice. I don't do anything in > between. > > What would be the reason for this behavior and how can I fix it? > > bigdaddy:~/work/Erlang/jabberlang/trunk joelr$ erl -pa ebin -make > Recompile: src/xmpp_callbacks.erl > Recompile: src/xmpp_echo.erl > Recompile: src/xmpp_echo_behaviour.erl > Recompile: src/xmpp_echo_behaviour2.erl > Recompile: src/xmpp_erlang_example.erl > Recompile: src/xmpp_iq.erl > bigdaddy:~/work/Erlang/jabberlang/trunk joelr$ erl -pa ebin -make > Recompile: src/xmpp_callbacks.erl > Recompile: src/xmpp_echo.erl > Recompile: src/xmpp_echo_behaviour.erl > Recompile: src/xmpp_echo_behaviour2.erl > Recompile: src/xmpp_erlang_example.erl > Recompile: src/xmpp_iq.erl > > The Emakefile is below and the first two files are not recompiled. > > {'src/gen_xmpp_client', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp_callbacks.erl', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp_echo.erl', [{outdir, "ebin"}]}. > {'src/xmpp_echo_behaviour.erl', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp_echo_behaviour2.erl', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp_erlang_example.erl', [{outdir, "ebin"},{i,"include"}]}. > {'src/xmpp_iq.erl', [{outdir, "ebin"}]}. > %{'error_logger_xmpp_h.erl', [{outdir, "ebin"}]}. > > Thanks, Joel > > -- > http://wagerlabs.com/ > > > > > > From dmitry.kargapolov@REDACTED Sat May 6 00:17:51 2006 From: dmitry.kargapolov@REDACTED (Dmitriy Kargapolov) Date: Fri, 05 May 2006 18:17:51 -0400 Subject: ssh_sftp connection problem In-Reply-To: References: Message-ID: <445BCF0F.1030003@corp.idt.net> Dmitriy Kargapolov wrote: > Hi, > I found that in ssh-0.9.1 ssh_sftp:connect/2,3 hangs in case when remote > host is unknown. Supposedly it happens because: > > 1) internal ssh_cm:connect() call is implemented using > gen_server:start_link: > connect(Host, Port, Opts) -> > gen_server:start_link(?MODULE, [client, self(), Host, Port, Opts], []). > 2) when ssh_cm:init() failed because of lookup/connect timeout, parent > linked process is died as well, i.e. ssh_sftp:init() is died. > > 3) call call ssh_cm:connect() never ends, and calling process hangs. > > To test just run ssh_sftp:connect(unexisting_host,[]). > Not sure if the whole ssh_sftp server needs to be linked with ssh_cm, but at least for the initialization phase it's better to catch exit signal. Following patch solved problem mentioned above. Index: ssh_sftp.erl =================================================================== --- ssh_sftp.erl +++ ssh_sftp.erl @@ -284,8 +284,10 @@ {stop, Error } end; init([Host,Port,Opts]) -> + SaveFlag = process_flag(trap_exit, true), case ssh_xfer:connect(Host, Port, Opts) of {ok, Xf, RBuf} -> + process_flag(trap_exit, SaveFlag), {ok, #state { req_id = 0, xf = Xf, rep_buf=RBuf }}; Error -> {stop, Error} From mikpe@REDACTED Sat May 6 01:48:05 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 6 May 2006 01:48:05 +0200 (MEST) Subject: hipe segmentation fault Message-ID: <200605052348.k45Nm5bt028836@harpo.it.uu.se> On Fri, 05 May 2006 09:36:45 -0400, Serge Aleynikov wrote: >When I applied this patch to FC5 Linux 64-bit OS, Erlang compiled fine, >however when I did the same on a 32-bit Linux FC5 OS, the make process >failed with the errors shown below. > >Serge > >gcc -g -O3 -I/home/serge/Projects/Distrs/R10B-10/erts/i686-pc-linux-gnu > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DHYBRID >-DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes >-D_THREAD_SAFE -D_REENTRANT -DUSE_THREADS -Ibeam -Isys/unix >-Isys/common -Ii686-pc-linux-gnu -Ii686-pc-linux-gnu/hybrid -Izlib >-Ihipe -I../include/internal -I../include/internal/i686-pc-linux-gnu -c >hipe/hipe_x86.c -o >/home/serge/Projects/Distrs/R10B-10/erts/obj.hybrid.beam/i686-pc-linux-gnu/hipe_x86.o >hipe/hipe_x86.c: In function 'morecore': >hipe/hipe_x86.c:107: warning: implicit declaration of function 'mmap' >hipe/hipe_x86.c:108: error: 'PROT_EXEC' undeclared (first use in this >function) >hipe/hipe_x86.c:108: error: (Each undeclared identifier is reported only >once >hipe/hipe_x86.c:108: error: for each function it appears in.) >hipe/hipe_x86.c:108: error: 'PROT_READ' undeclared (first use in this >function) >hipe/hipe_x86.c:108: error: 'PROT_WRITE' undeclared (first use in this >function) >hipe/hipe_x86.c:109: error: 'MAP_PRIVATE' undeclared (first use in this >function) >hipe/hipe_x86.c:109: error: 'MAP_ANONYMOUS' undeclared (first use in >this function) >hipe/hipe_x86.c:114: warning: assignment makes pointer from integer >without a cast >hipe/hipe_x86.c:115: error: 'MAP_FAILED' undeclared (first use in this >function) This means that, for some reason, an #include of was lost. This shouldn't happen: hipe_x86.c includes global.h, which includes sys.h, which includes erl_unix_sys.h (unless one of __WIN32__/VXWORKS/_OSE_ is defined), which includes unless erts/configure decided that HAVE_MMAP should be 0, which shouldn't be possible on FC5. I've built R10B-10 on an FC5 box (i686, 100% vanilla, no updates), and no problems occurred. I can't explain why things don't work for you, but simply adding "#include " at the end of the #include directives in hipe_x86.c ought to work. /Mikael From mikpe@REDACTED Sat May 6 19:13:35 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 6 May 2006 19:13:35 +0200 (MEST) Subject: hipe segmentation fault Message-ID: <200605061713.k46HDZo3023001@harpo.it.uu.se> On Sat, 06 May 2006 12:19:06 -0400, Serge Aleynikov wrote: >Your explanation makes perfect sense indeed, and in search for the >answer, I did find that HAVE_MMAP was *not* set by configure on this >machine. > >What is see is that if I try to do: > >$ rm -fr otp_src_R10B-10 >$ tar xzf otp_src_R10B-10.tar.gz >$ cd otp_src_R10B-10 >$ ./configure --enable-threads | grep mmap >checking for working mmap... yes That's what users are supposed to do, and it clearly works. >so mmap gets defined fine. However, if I run autoconf-2.13 in erts, >mmap doesn't get found: > >$ rm -fr otp_src_R10B-10 >$ tar xzf otp_src_R10B-10.tar.gz >$ cd otp_src_R10B-10/erts >$ autoconf-2.13 >$ cd .. >$ ./configure --enable-threads | grep mmap >checking for working mmap... no > >However, when autoconf is being used instead of autoconf-2.13 in the >case above, mmap gets found all right. > >Anyone has any idea why? My guess is that the OTP team's autoconf-2.13 is different somehow from the autoconf-2.13 .rpm in Fedora. Why are you regenerating erts/configure? Do you have local modifications to erts/configure.in? If you add the "#include " to hipe_x86.c as I described, does the system then build OK, or do other things still break because of the missing HAVE_MMAP? /Mikael From mikpe@REDACTED Mon May 8 00:01:16 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Mon, 8 May 2006 00:01:16 +0200 (MEST) Subject: hipe segmentation fault Message-ID: <200605072201.k47M1GsO002256@harpo.it.uu.se> On Sat, 06 May 2006 13:21:06 -0400, Serge Aleynikov wrote: >> If you add the "#include " to hipe_x86.c as I >> described, does the system then build OK, or do other things >> still break because of the missing HAVE_MMAP? > >Yes, it does get compiled fine in that case. Here's a patch (for devel branch but applies to R10B as well) that adds explicit #include to those HiPE runtime system files that use mmap(). This should be unnecessary since erl_unix_sys.h includes if erts/configure found mmap(), but as Serge has shown that is not completely reliable. /Mikael --- otp-0501/erts/emulator/hipe/hipe_amd64.c.~1~ 2005-12-15 12:29:52.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_amd64.c 2006-05-07 21:03:48.000000000 +0200 @@ -4,6 +4,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #include "global.h" #include "error.h" #include "bif.h" --- otp-0501/erts/emulator/hipe/hipe_arm.c.~1~ 2005-12-16 01:45:29.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_arm.c 2006-05-07 21:03:48.000000000 +0200 @@ -4,6 +4,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #include "global.h" #include "hipe_arch.h" --- otp-0501/erts/emulator/hipe/hipe_ppc.c.~1~ 2005-12-15 18:14:43.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_ppc.c 2006-05-07 21:03:48.000000000 +0200 @@ -4,6 +4,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #include "global.h" #include "hipe_arch.h" --- otp-0501/erts/emulator/hipe/hipe_x86.c.~1~ 2006-04-06 21:08:41.000000000 +0200 +++ otp-0501/erts/emulator/hipe/hipe_x86.c 2006-05-07 21:03:48.000000000 +0200 @@ -4,6 +4,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #include "global.h" #include "hipe_arch.h" From nm@REDACTED Mon May 8 22:55:18 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 09 May 2006 01:55:18 +0500 Subject: optimization questions Message-ID: <445FB036.8090801@web.am> Hello! Can erlang vm's gurus tell me which case is more efficient R = size(Binary), [ SomeFunction(R, X) || X <- lists:seq(1, 1000) ] or [ SomeFunction(size(Binary), X) || X <- lists:seq(1, 1000) ] so - does compiler and vm understand that some parts of recursion are constant and move their calculation outside of recursion or I should do it by hand? In c/perl practice I prefer to do such optimization by hand, what about erlang? Another issue - what if size(BInary) changed to ... say self() - I mean that fetching binar sze may be faster operation than creating variable and accessign it every time. Tnanks in advance. -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From nm@REDACTED Tue May 9 01:57:50 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 09 May 2006 04:57:50 +0500 Subject: strange zlib behavoiur Message-ID: <445FDAFE.6020303@web.am> Hello all! While trying to use zlib, I've got some strange results. Please see following example 23> Z = zlib:open(). % openning zlib port #Port<0.98> % default does not work too. 24> zlib:deflateInit(Z, best_compression). ok % just putting several Kb of data 25> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- lists:seq(1,5000) ])). [] 26> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- lists:seq(1,5000) ])). [] 27> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- lists:seq(1,5000) ])). [] % no output yet from zlib library -- calling it with sync flag to get % some data - please note, that it should be called several times % to output all data 28> zlib:deflate(Z, <<>>, sync). [<<120,..............,144,...>>] 29> zlib:deflate(Z, <<>>, sync). [<<8,...>>] 30> zlib:deflate(Z, <<>>, sync). [<<146,1...>>] 31> zlib:deflate(Z, <<>>, sync). [<<149,...>>] 32> zlib:deflate(Z, <<>>, sync). % it have no more data to output - so zlib crashes. % just same behavoiur with full flush mode =ERROR REPORT==== 9-May-2006::04:38:41 === Error in process <0.57.0> with exit value: {buf_error,[{zlib,call,3},{zlib,deflate,3},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} In other hand in documentation of zlib module noted - deflate/3 compresses as much data as possible, and stops when the input buffer becomes empty. It may introduce some output latency (reading input without producing any output) except when forced to flush. *that's ok* If the parameter Flush is set to sync, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get *all input data available so far*. Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. *should* I understand this as deflate should output *all* compressed data it have at this moment - so calling deflate(Z, <<>>, finish) will not procude any more data? If not -- this is quite unclear from documentation -- I got such suspects only writing this e-mail. WIth best regards, Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From mikpe@REDACTED Tue May 9 09:31:38 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 9 May 2006 09:31:38 +0200 Subject: hipe segmentation fault In-Reply-To: <200605072201.k47M1GsO002256@harpo.it.uu.se> References: <200605072201.k47M1GsO002256@harpo.it.uu.se> Message-ID: <17504.17754.40048.325605@alkaid.it.uu.se> Mikael Pettersson writes: > On Sat, 06 May 2006 13:21:06 -0400, Serge Aleynikov wrote: > >> If you add the "#include " to hipe_x86.c as I > >> described, does the system then build OK, or do other things > >> still break because of the missing HAVE_MMAP? > > > >Yes, it does get compiled fine in that case. > > Here's a patch (for devel branch but applies to R10B as well) > that adds explicit #include to those HiPE runtime > system files that use mmap(). This should be unnecessary since > erl_unix_sys.h includes if erts/configure found > mmap(), but as Serge has shown that is not completely reliable. Sorry, scratch that and use this patch instead. The previous patch worked fine on Linux and Solaris, but broke an #include ordering constraint on Mac OSX (10.3.9). This new patch fixes that. /Mikael --- otp-0501/erts/emulator/hipe/hipe_amd64.c.~1~ 2005-12-15 12:29:52.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_amd64.c 2006-05-09 09:21:20.000000000 +0200 @@ -5,6 +5,7 @@ #include "config.h" #endif #include "global.h" +#include #include "error.h" #include "bif.h" #include "big.h" /* term_to_Sint() */ --- otp-0501/erts/emulator/hipe/hipe_arm.c.~1~ 2005-12-16 01:45:29.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_arm.c 2006-05-09 09:21:20.000000000 +0200 @@ -5,6 +5,7 @@ #include "config.h" #endif #include "global.h" +#include #include "hipe_arch.h" #include "hipe_native_bif.h" /* nbif_callemu() */ --- otp-0501/erts/emulator/hipe/hipe_ppc.c.~1~ 2005-12-15 18:14:43.000000000 +0100 +++ otp-0501/erts/emulator/hipe/hipe_ppc.c 2006-05-09 09:21:20.000000000 +0200 @@ -5,6 +5,7 @@ #include "config.h" #endif #include "global.h" +#include #include "hipe_arch.h" #include "hipe_native_bif.h" /* nbif_callemu() */ --- otp-0501/erts/emulator/hipe/hipe_x86.c.~1~ 2006-04-06 21:08:41.000000000 +0200 +++ otp-0501/erts/emulator/hipe/hipe_x86.c 2006-05-09 09:21:20.000000000 +0200 @@ -5,6 +5,7 @@ #include "config.h" #endif #include "global.h" +#include #include "hipe_arch.h" #include "hipe_native_bif.h" /* nbif_callemu() */ From tzheng@REDACTED Tue May 9 02:52:08 2006 From: tzheng@REDACTED (Tony Zheng) Date: Mon, 08 May 2006 17:52:08 -0700 Subject: time for deleting records from mnesia Message-ID: <1147135928.12718.22.camel@gateway> Hi I want to delete some selected records from my mnesia database table(t_test). I tried to use mnesia:delete_object(Record) and mnesia:delete({Tab, Key}), but both of them needed about 20 minutes when I deleted 100000 records. I want to know if there are some other method to do it faster? Thanks. 1. use mnesia:delete_object(Record) to delete 100000 records, it spent 22 minutes. F = fun() -> MatchHead = #t_test{transaction_time='$1', _='_'}, GuardDel = {'==', {element, 1, '$1'}, {date()}}, Result = '$_', ListsDel = mnesia:select(t_test,[{MatchHead, [GuardDel], [Result]}]), lists:foreach(fun(List) -> mnesia:delete_object(List) end, ListsDel) end, mnesia:transaction(F). 2. use mnesia:delete({Tab, Key}) to delete 100000 records, it spent 23 minutes. F = fun() -> MatchHead = #t_test{transaction_time='$1', _='_'}, GuardDel = {'==', {element, 1, '$1'}, {date()}}, Result = '$_', ListsDel = mnesia:select(t_test,[{MatchHead, [GuardDel], [Result]}]), lists:foreach(fun(List) -> mnesia:delete({t_test, element(2, List)}) end, ListsDel) end, mnesia:transaction(F). tony From richardc@REDACTED Tue May 9 09:49:16 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 09 May 2006 09:49:16 +0200 Subject: optimization questions In-Reply-To: <445FB036.8090801@web.am> References: <445FB036.8090801@web.am> Message-ID: <4460497C.2000207@it.uu.se> Gaspar Chilingarov wrote: > Can erlang vm's gurus tell me which case is more efficient > > R = size(Binary), > > [ SomeFunction(R, X) || X <- lists:seq(1, 1000) ] > > or > > [ SomeFunction(size(Binary), X) || X <- lists:seq(1, 1000) ] > > so - does compiler and vm understand that some parts of recursion are > constant and move their calculation outside of recursion or I should do > it by hand? The Beam compiler does not do that kind of optimization. But even if it was capable of hoisting computations out of a loop, it would also have to be able to prove that it does not change the behaviour of exceptions. For instance, if the call to lists:seq/1 crashes (maybe you've replaced the standard version with your own buggy implementation), then that exception must happen before the exception in size(Binary), if Binary turns out to be not a binary (or tuple). So, there's more work to it than you might think. Not impossible, just rarely worth the effort. > Another issue - what if size(BInary) changed to ... say self() - I mean > that fetching binary size may be faster operation than creating variable > and accessing it every time. For self() there is no point keeping it in a variable. I did some quick measuring to settle this: In a *very tight* loop, it is slightly *slower* to keep an extra parameter than to call self() repeatedly, but the difference is only about 1-2 percent. For size(Binary), you must always pass at least one extra argument around the loop: either Binary itself, or a precomputed Size. In the same *very tight* loop as above, calling size/1 on each iteration is about 15% slower. Inserting some "real work" in each iteration will make this difference much smaller. Conclusion: don't manually hoist expressions that are O(1) unless you *know* that they have a significant time constant (relative to the context that you are using them in, of course). But if they ought to be hoisted, you need to do it yourself - the compiler does not do that for you. /Richard From ulf.wiger@REDACTED Tue May 9 09:57:35 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 9 May 2006 09:57:35 +0200 Subject: time for deleting records from mnesia Message-ID: When deleting 100000 records inside one transaction, mnesia has to check the transaction store for each delete. Just to separate what is overhead from transaction- protected delete and what is storage overhead, try doing the same thing with dirty access. Hint: If you use mnesia:activity(Type, F) instead of mnesia:transaction(F), you only need to change Type from 'transaction' to e.g. 'async_dirty'. The funs you've written will work in either case. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Tony Zheng > Sent: den 9 maj 2006 02:52 > To: erlang-questions@REDACTED > Subject: time for deleting records from mnesia > > Hi > > I want to delete some selected records from my mnesia > database table(t_test). I tried to use > mnesia:delete_object(Record) and mnesia:delete({Tab, Key}), > but both of them needed about 20 minutes when I deleted > 100000 records. I want to know if there are some other method > to do it faster? Thanks. > > 1. use mnesia:delete_object(Record) to delete 100000 records, it spent > 22 minutes. > > F = fun() -> > MatchHead = #t_test{transaction_time='$1', _='_'}, > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > Result = '$_', > ListsDel = mnesia:select(t_test,[{MatchHead, > [GuardDel], [Result]}]), > lists:foreach(fun(List) -> mnesia:delete_object(List) > end, ListsDel) > end, > mnesia:transaction(F). > > 2. use mnesia:delete({Tab, Key}) to delete 100000 records, it > spent 23 minutes. > > F = fun() -> > MatchHead = #t_test{transaction_time='$1', _='_'}, > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > Result = '$_', > ListsDel = mnesia:select(t_test,[{MatchHead, > [GuardDel], [Result]}]), > lists:foreach(fun(List) -> mnesia:delete({t_test, > element(2, List)}) end, ListsDel) > end, > mnesia:transaction(F). > > > tony > > From bjorn@REDACTED Tue May 9 10:00:29 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 May 2006 10:00:29 +0200 Subject: optimization questions In-Reply-To: <445FB036.8090801@web.am> References: <445FB036.8090801@web.am> Message-ID: Gaspar Chilingarov writes: > Hello! > > > Can erlang vm's gurus tell me which case is more efficient > > > R = size(Binary), > > [ SomeFunction(R, X) || X <- lists:seq(1, 1000) ] > > or > > [ SomeFunction(size(Binary), X) || X <- lists:seq(1, 1000) ] > > > so - does compiler and vm understand that some parts of recursion are > constant and move their calculation outside of recursion or I should do > it by hand? > The Beam compiler does not attempt to move operations out of loops, so your first example is probably more efficient. Of course, if you really care about performance, you should write your own tail-recursive function to avoiding constructing a 1000 element list. > Another issue - what if size(BInary) changed to ... say self() - I mean > that fetching binar sze may be faster operation than creating variable > and accessign it every time. self() is specially optimized by the Beam loader/runtime system - it is translated to a special instruction. It would probably be better to call self() directly every time than to have it stored in a variable. If performance really is important, you must do measurements. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From chaitanya.chalasani@REDACTED Tue May 9 10:04:43 2006 From: chaitanya.chalasani@REDACTED (Chaitanya Chalasani) Date: Tue, 9 May 2006 13:34:43 +0530 Subject: Oracle on Linux In-Reply-To: <78568af10605041544s58c24bbfy4f1c5fe59d51d601@mail.gmail.com> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605021615.23508.chaitanya.chalasani@gmail.com> <78568af10605041544s58c24bbfy4f1c5fe59d51d601@mail.gmail.com> Message-ID: <200605091334.44521.chaitanya.chalasani@gmail.com> Sorry I was away for a week I will send the source for the same today. On Friday 05 May 2006 04:14, Ryan Rawson wrote: > I also have the same needs. Not sure if buying a commercial ODBC > driver is a viable option. > > I havent started poking into this, but soon. > > -ryan > > On 5/2/06, Chaitanya Chalasani wrote: > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > Folks, > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > commercial ODBC driver? > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > Thanks, Joel > > > > > > -- > > > http://wagerlabs.com/ > > > > We tried using a free ODBC for oracle on linux but we faced lot of > > functional issues and performance issues. We built an application using > > OCI and used erlang ports. The performace is quite good and implemented > > all the features we required. > > > > -- > > Chaitanya Chalasani > > ------------------- > > "The ultimate truths of nature are so subtle > > that they can be revealed only under immense silence" -- Chaitanya Chalasani ------------------- "The ultimate truths of nature are so subtle that they can be revealed only under immense silence" From dgud@REDACTED Tue May 9 10:25:27 2006 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 9 May 2006 10:25:27 +0200 Subject: strange zlib behavoiur In-Reply-To: <445FDAFE.6020303@web.am> References: <445FDAFE.6020303@web.am> Message-ID: <17504.20983.442539.795538@rian.du.uab.ericsson.se> Well, you get what (our old version) of zlib delivers, with the options set. I don't think you have any guarantees about how mush data you get after a call to zlib:deflate/3. The documentation is also mostly a cut-paste work from zlib headers. So use the source or do as the example in the doc says: zlib:deflateInit(Z), B1 = zlib:deflate(Z,Data), .... BN = zlib:deflate(Z,<< >>,finish), zlib:deflateEnd(Z), list_to_binary([B1,..,BN]), /Dan Gaspar Chilingarov writes: > Hello all! > > While trying to use zlib, I've got some strange results. > Please see following example > > > 23> Z = zlib:open(). % openning zlib port > #Port<0.98> > % default does not work too. > 24> zlib:deflateInit(Z, best_compression). > ok > % just putting several Kb of data > 25> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- > lists:seq(1,5000) ])). > [] > 26> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- > lists:seq(1,5000) ])). > [] > 27> zlib:deflate(Z,list_to_binary( [ random:uniform(255) || X <- > lists:seq(1,5000) ])). > [] > > % no output yet from zlib library -- calling it with sync flag to get > % some data - please note, that it should be called several times > % to output all data > 28> zlib:deflate(Z, <<>>, sync). > [<<120,..............,144,...>>] > 29> zlib:deflate(Z, <<>>, sync). > [<<8,...>>] > 30> zlib:deflate(Z, <<>>, sync). > [<<146,1...>>] > 31> zlib:deflate(Z, <<>>, sync). > [<<149,...>>] > 32> zlib:deflate(Z, <<>>, sync). > > % it have no more data to output - so zlib crashes. > % just same behavoiur with full flush mode > > =ERROR REPORT==== 9-May-2006::04:38:41 === > Error in process <0.57.0> with exit value: > {buf_error,[{zlib,call,3},{zlib,deflate,3},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > > In other hand in documentation of zlib module noted - > > deflate/3 compresses as much data as possible, and stops when the input > buffer becomes empty. It may introduce some output latency (reading > input without producing any output) except when forced to flush. > > *that's ok* > > If the parameter Flush is set to sync, all pending output is flushed to > the output buffer and the output is aligned on a byte boundary, so that > the decompressor can get *all input data available so far*. Flushing may > degrade compression for some compression algorithms and so it should be > used only when necessary. > > > *should* I understand this as deflate should output *all* compressed > data it have at this moment - so calling deflate(Z, <<>>, finish) will > not procude any more data? > > If not -- this is quite unclear from documentation -- I got such > suspects only writing this e-mail. > > > WIth best regards, Gaspar > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37491 419763 (mob) > i 63174784 > e nm@REDACTED From nm@REDACTED Tue May 9 10:38:42 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 09 May 2006 13:38:42 +0500 Subject: optimization questions In-Reply-To: <4460497C.2000207@it.uu.se> References: <445FB036.8090801@web.am> <4460497C.2000207@it.uu.se> Message-ID: <44605512.1030309@web.am> Hello, Richard! Richard Carlsson wrote: > Gaspar Chilingarov wrote: >> Can erlang vm's gurus tell me which case is more efficient >> >> R = size(Binary), >> >> [ SomeFunction(R, X) || X <- lists:seq(1, 1000) ] >> >> or >> >> [ SomeFunction(size(Binary), X) || X <- lists:seq(1, 1000) ] >> >> so - does compiler and vm understand that some parts of recursion are >> constant and move their calculation outside of recursion or I should do >> it by hand? > > The Beam compiler does not do that kind of optimization. But even if it > was capable of hoisting computations out of a loop, it would also have > to be able to prove that it does not change the behaviour of exceptions. > For instance, if the call to lists:seq/1 crashes (maybe you've replaced > the standard version with your own buggy implementation), then that > exception must happen before the exception in size(Binary), if Binary > turns out to be not a binary (or tuple). So, there's more work to it > than you might think. Not impossible, just rarely worth the effort. thanks a lot - I've seen C compilers doing such thing to loop variables - at least Watcom sometimes done it. > >> Another issue - what if size(BInary) changed to ... say self() - I mean >> that fetching binary size may be faster operation than creating variable >> and accessing it every time. > > For self() there is no point keeping it in a variable. I did some quick > measuring to settle this: In a *very tight* loop, it is slightly *slower* > to keep an extra parameter than to call self() repeatedly, but the > difference is only about 1-2 percent. > > For size(Binary), you must always pass at least one extra argument around > the loop: either Binary itself, or a precomputed Size. In the same *very > tight* loop as above, calling size/1 on each iteration is about 15% slower. > Inserting some "real work" in each iteration will make this difference > much smaller. > > Conclusion: don't manually hoist expressions that are O(1) unless you > *know* that they have a significant time constant (relative to the context > that you are using them in, of course). But if they ought to be hoisted, > you need to do it yourself - the compiler does not do that for you. > It was not an optimization matter at first place, but just writing more efficient code when writing it from scratch - just to make overall performance a little bit higher. -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From ke.han@REDACTED Tue May 9 16:41:28 2006 From: ke.han@REDACTED (ke han) Date: Tue, 9 May 2006 22:41:28 +0800 Subject: Billion-triple store In-Reply-To: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> Message-ID: <22582A61-C2F9-4C8C-97DC-B61E7F3D0BDF@redstarling.com> Whatever happened to the BDB backed mnesia I read about last year? Is this going to become a real mnesia backend someday? ke han On Apr 24, 2006, at 2:34 AM, Joel Reymont wrote: > Folks, > > How would I store a billion triples with Erlang? > > I don't necessarily need the full power of RDF as storing triples > in the form of {"Joel", has_a, daughter} would suffice. I would not > mind complying with RDF of course but it seems that would be an > extra burder due to the necessity of storing everything as strings, > the need to implement tries for those and the way Erlang stores > strings. > > I'm not sure how to go about storing a billion of such triples in > Mnesia. I suppose I would need to use a 64-bit machine and a > disc_only_copy table. > > Any suggestions? > > Thanks, Joel > > -- > http://wagerlabs.com/ > > > > > From A.BETIS@REDACTED Tue May 9 17:34:59 2006 From: A.BETIS@REDACTED (BETIS Alexandre) Date: Tue, 9 May 2006 17:34:59 +0200 Subject: TCP interface process crashes with no death cry Message-ID: Hello to all erlangers, We are using OTP-R10B-3 (yeah, I know, it's not current) and are witnessing something 'kind of' weird. I was wondering if this is something that was recently fixed, since I have seen in the release notes hints about similar problems. Here goes: we have a slow non-erlang TCP reader (it is slow because we are memory-analyzing it), and an erlang writer with big messages. Apparently, when we reach the point where TCP buffers are full, the erlang writer crashes (which is what we expected). The problem is that the erlang process seems to crash without emitting any 'EXIT' signal. This shucks, because our erlang code is supposed to act on that. Has anyone ever encountered something similar and found the pit where the process' death cry falls into? If not, will try to isolate the problem as a test case. Cheers, -- Alex " Ce message et ses pieces jointes sont confidentiels et exclusivement reserves a leurs destinataires qui s'assureront de l'absence de virus. CSEE Transport n'assume aucune responsabilite au titre de ce message s'il est altere, deforme, falsifie, indument utilise par des tiers ou encore s'il a cause des dommages ou pertes de toute nature. This e-mail and any attached files are confidential and exclusively intended for its addressees who will conduct appropriate virus checks. CSEE Transport shall not be liable for the message if altered, changed, falsified, unduly used by third parties nor for any damage or loss." From terrance.sullivan@REDACTED Tue May 9 19:27:21 2006 From: terrance.sullivan@REDACTED (Terrance Sullivan) Date: Tue, 9 May 2006 13:27:21 -0400 Subject: Recent BEAM documentation ? Message-ID: <3522719E-226C-4385-A9ED-1CA2D0F9AEA7@exray.ca> I recently tripped across the paper "A high performance Erlang system" by Eric Johanasson (http://user.it.uu.se/~happi/publications/ p32-johansson.pdf) which I gather was published for the PPDP 2000 conference in Montreal. Short of wading into recent source code, would people here have any recommendations for published documents that would provide more recent lower level design & implementation details on BEAM. Or is this document basically representative of the present Erlang state-of- the-art ? Thx.. \T From klacke@REDACTED Tue May 9 19:58:35 2006 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 09 May 2006 19:58:35 +0200 Subject: TCP interface process crashes with no death cry In-Reply-To: References: Message-ID: <4460D84B.2080806@hyber.org> BETIS Alexandre wrote: > > Here goes: we have a slow non-erlang TCP reader (it is slow because > we are memory-analyzing it), and an erlang writer with big messages. > Apparently, when we reach the point where TCP buffers are full, the > erlang writer crashes (which is what we expected). > This is not what is happening. The erlang process which is writing will block. If that process crashes, it's because of something else. It is probably receiving an EXIT signal from somewhere else. > The problem is that the erlang process seems to crash without > emitting any 'EXIT' signal. Not likely, > This shucks, because our erlang > code is supposed to act on that. Has anyone ever encountered > something similar and found the pit where the process' death > cry falls into? > > If not, will try to isolate the problem as a test case. Try dbg:p(Pid, all) on the process while its writing /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control cellphone: +46 70 2097763 From ulf.wiger@REDACTED Tue May 9 21:35:16 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 9 May 2006 21:35:16 +0200 Subject: time for deleting records from mnesia Message-ID: Tony Zheng wrote: > > When it works, some of error messages displayed: > > =ERROR REPORT==== 9-May-2006::11:05:41 === > Mnesia(one@REDACTED): ** WARNING ** Mnesia is overloaded: {dump_log, > > write_threshold} The warning about mnesia being overloaded mean that a dump of the transaction log has been triggered before the previous transaction log dump has been completed. That's ok. Mnesia can handle it, but it is an indication that mnesia is temporarily backlogged. BR, Ulf W From mikpe@REDACTED Tue May 9 22:06:26 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 9 May 2006 22:06:26 +0200 Subject: Recent BEAM documentation ? In-Reply-To: <3522719E-226C-4385-A9ED-1CA2D0F9AEA7@exray.ca> References: <3522719E-226C-4385-A9ED-1CA2D0F9AEA7@exray.ca> Message-ID: <17504.63042.744634.168911@alkaid.it.uu.se> Terrance Sullivan writes: > I recently tripped across the paper "A high performance Erlang > system" by Eric Johanasson (http://user.it.uu.se/~happi/publications/ > p32-johansson.pdf) which I gather was published for the PPDP 2000 > conference in Montreal. > > Short of wading into recent source code, would people here have any > recommendations for published documents that would provide more > recent lower level design & implementation details on BEAM. Or is > this document basically representative of the present Erlang state-of- > the-art ? That paper is quite old, describing essentially the culmination of the 1st generation of HiPE, which only supported UltraSPARCs and the JAM-based Erlang system. Off the top of my head, things that have happened since then: - Erlang/OTP has switched to the much better BEAM virtual machine. - The low-level data representation (aka "tagging scheme") has been completely redesigned. - BEAM optimizes blocks of floating-point operations, and uses floating-point exceptions (when possible) to reduce the number of tests needed to detect f.p. overflows/div-by-zero and such. - Core Erlang is used as the foundation in both the BEAM compiler's front-end and parts of HiPE's front-end. More rational and better support for compile-time analysis of the code. - Bit-syntax. Way cool. - Different heap models (shared, hybrid). - Multithreading (aka "the SMP system"). - HiPE has added support for x86, AMD64, PowerPC, and ARM. As a byproduct of the AMD64 work, the Erlang/OTP runtime system has been made to work much better on 64-bit machines in general. - Much more compile-time analysis and optimization in HiPE. - Much improved register allocators in HiPE. - Much improved handling of floating-point and bit syntax in HiPE. - Generational stack scanning during garbage collection in HiPE. (Helps deeply recursive programs.) And there's probably more I don't recall right now. Most relevant publications ought to be in the HiPE publications page, the EUC proceedings, or the Erlang Workshop proceedings. /Mikael From mbj@REDACTED Tue May 9 22:16:54 2006 From: mbj@REDACTED (Martin Bjorklund) Date: Tue, 09 May 2006 22:16:54 +0200 (CEST) Subject: time for deleting records from mnesia In-Reply-To: <1147135928.12718.22.camel@gateway> References: <1147135928.12718.22.camel@gateway> Message-ID: <20060509.221654.81402947.mbj@tail-f.com> Hi, You might want to try to add a mnesia:lock({table, t_test}, write) first in your fun. I.e. grab a single lock in the entire table instead of a lock on each item. (hi klacke!) Not sure how much of the overhead is there though... /martin Tony Zheng wrote: > Hi > > I want to delete some selected records from my mnesia database > table(t_test). I tried to use mnesia:delete_object(Record) and > mnesia:delete({Tab, Key}), but both of them needed about 20 minutes when > I deleted 100000 records. I want to know if there are some other method > to do it faster? Thanks. > > 1. use mnesia:delete_object(Record) to delete 100000 records, it spent > 22 minutes. > > F = fun() -> > MatchHead = #t_test{transaction_time='$1', _='_'}, > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > Result = '$_', > ListsDel = mnesia:select(t_test,[{MatchHead, [GuardDel], [Result]}]), > lists:foreach(fun(List) -> mnesia:delete_object(List) end, ListsDel) > end, > mnesia:transaction(F). > > 2. use mnesia:delete({Tab, Key}) to delete 100000 records, it spent 23 > minutes. > > F = fun() -> > MatchHead = #t_test{transaction_time='$1', _='_'}, > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > Result = '$_', > ListsDel = mnesia:select(t_test,[{MatchHead, [GuardDel], [Result]}]), > lists:foreach(fun(List) -> mnesia:delete({t_test, element(2, List)}) > end, ListsDel) > end, > mnesia:transaction(F). > > > tony > From w.a.de.jong@REDACTED Tue May 9 23:00:28 2006 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Tue, 9 May 2006 23:00:28 +0200 Subject: New version of Erlsom - XSD support for Erlang Message-ID: <407d9ef80605091400l2a8d6436n62b3594939515779@mail.gmail.com> Hello All, I have uploaded a new version of Erlsom to sourceforge. Erlsom is a set of functions that allow you to use XSDs in Erlang. You 'compile' an XSD and after that you can parse (and write) XML documents that are based on the schema. The tool will validate the XML, but, more importantly, it will also translate it to a structure (consisting of records) that corresponds to the types specified in the XSD. This makes processing of the results very convenient. I fixed quite a few bugs, and I tried to make sure that it handles errors in the schema or XML a bit better. And I added support for some additional XSD/XML features, such as: - 'all' - 'import' - 'extends' - utf-8 and utf-16 encoding I also added a function to generate definitions for the records. Interestingly, as far as I can make out, erlsom (doing validation against a pre-compiled schema) is 3-5 times as fast as xmerl (without any validation). The source code and some documentation can easily be downloaded from sourceforge. Just go to http://www.sourceforge.org/projects/erlsom and click on the 'download' button. Regards, Willem From tzheng@REDACTED Tue May 9 20:30:08 2006 From: tzheng@REDACTED (Tony Zheng) Date: Tue, 09 May 2006 11:30:08 -0700 Subject: time for deleting records from mnesia In-Reply-To: References: Message-ID: <1147199408.18890.22.camel@gateway> Hi, Ulf I used mnesia:activity(async_dirty, F) instead of mnesia:transaction(F), it was really faster than before. It just spent 1 minutes when deleting 100000 records. F = fun() -> MatchHead = #t_transaction{subrecord_id='$1', transaction_time='$2', _='_'}, GuardDel = {'==', {element, 1, '$2'}, {date()}}, Result = '$_', ListsDel = mnesia:select(t_transaction,[{MatchHead, [GuardDel], [Result]}]), lists:foreach(fun(List) -> mnesia:delete_object(List) end, ListsDel) end, mnesia:activity(async_dirty, F) When it works, some of error messages displayed: =ERROR REPORT==== 9-May-2006::11:05:41 === Mnesia(one@REDACTED): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} =ERROR REPORT==== 9-May-2006::11:05:42 === Mnesia(one@REDACTED): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} =ERROR REPORT==== 9-May-2006::11:05:42 === Mnesia(one@REDACTED): ** WARNING ** Mnesia is overloaded: {dump_log, write_threshold} I checked the mnesia table after deleting, it deleted all selected records and seemed to work well. I am not sure if I can ignore these error messages? Does it mean some failure to manipulate the mnesia table? Will it effect the data in mnesia table? Thanks. Best regards tony On Tue, 2006-05-09 at 00:57, Ulf Wiger (AL/EAB) wrote: > When deleting 100000 records inside one transaction, > mnesia has to check the transaction store for each > delete. > > Just to separate what is overhead from transaction- > protected delete and what is storage overhead, > try doing the same thing with dirty access. > > Hint: If you use mnesia:activity(Type, F) instead > of mnesia:transaction(F), you only need to change > Type from 'transaction' to e.g. 'async_dirty'. The > funs you've written will work in either case. > > BR, > Ulf W > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Tony Zheng > > Sent: den 9 maj 2006 02:52 > > To: erlang-questions@REDACTED > > Subject: time for deleting records from mnesia > > > > Hi > > > > I want to delete some selected records from my mnesia > > database table(t_test). I tried to use > > mnesia:delete_object(Record) and mnesia:delete({Tab, Key}), > > but both of them needed about 20 minutes when I deleted > > 100000 records. I want to know if there are some other method > > to do it faster? Thanks. > > > > 1. use mnesia:delete_object(Record) to delete 100000 records, it spent > > 22 minutes. > > > > F = fun() -> > > MatchHead = #t_test{transaction_time='$1', _='_'}, > > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > > Result = '$_', > > ListsDel = mnesia:select(t_test,[{MatchHead, > > [GuardDel], [Result]}]), > > lists:foreach(fun(List) -> mnesia:delete_object(List) > > end, ListsDel) > > end, > > mnesia:transaction(F). > > > > 2. use mnesia:delete({Tab, Key}) to delete 100000 records, it > > spent 23 minutes. > > > > F = fun() -> > > MatchHead = #t_test{transaction_time='$1', _='_'}, > > GuardDel = {'==', {element, 1, '$1'}, {date()}}, > > Result = '$_', > > ListsDel = mnesia:select(t_test,[{MatchHead, > > [GuardDel], [Result]}]), > > lists:foreach(fun(List) -> mnesia:delete({t_test, > > element(2, List)}) end, ListsDel) > > end, > > mnesia:transaction(F). > > > > > > tony > > > > From bjorn.ericsson@REDACTED Wed May 10 10:33:18 2006 From: bjorn.ericsson@REDACTED (=?iso-8859-1?Q?Ericsson=2C_Bj=F6rn?=) Date: Wed, 10 May 2006 10:33:18 +0200 Subject: Tool for tracing influence of macro? Message-ID: I wonder if someone has some kind of tool that can trace the influence of a static macro in an Erlang project? It needs to be able to follow variable assignments and functions calling other functions. I have a couple of macros, defined in a .hrl file, that now needs to be configured at startup, not at compile time as they are now. Thats where i need to use this. /BE This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jouni.Ryno@REDACTED Wed May 10 10:42:14 2006 From: Jouni.Ryno@REDACTED (Jouni =?ISO-8859-1?Q?Ryn=F6?=) Date: Wed, 10 May 2006 11:42:14 +0300 Subject: Linus Thorvalds has stated something about microkernels and monolithic kernels Message-ID: <1147250534.6696.5.camel@adic> which is interested to read for Erlangers, IMHO. The real link http://www.realworldtech.com/forums/index.cfm?action=detail&PostNum=4342&Thread=12&entryID=66630&roomID=11 is down (slashdotted due to http://linux.slashdot.org/article.pl?sid=06/05/10/0439246&from=rss but least this mirror: http://www.mirrordot.org/stories/3f6b22ec7a7cffcf2847b92cd5dec7e7/index.html worked regards Jouni -- Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ http://www.geo.fmi.fi/~ryno/ Finnish Meteorological Institute http://www.fmi.fi/ Space Research http://www.geo.fmi.fi/ P.O.BOX 503 Tel (+358)-9-19294656 FIN-00101 Helsinki FAX (+358)-9-19294603 Finland priv-GSM (+358)-50-5302903 "It's just zeros and ones, it cannot be hard" From launoja@REDACTED Wed May 10 12:10:47 2006 From: launoja@REDACTED (launoja@REDACTED) Date: Wed, 10 May 2006 13:10:47 +0300 Subject: Linus Thorvalds has stated something about microkernels and monolithic kernels In-Reply-To: <1147250534.6696.5.camel@adic> References: <1147250534.6696.5.camel@adic> Message-ID: On Wed, 10 May 2006 11:42:14 +0300 Jouni Ryn? wrote: > which is interested to read for Erlangers, IMHO. The >real link > http://www.realworldtech.com/forums/index.cfm?action=detail&PostNum=4342&Thread=12&entryID=66630&roomID=11 > > is down (slashdotted due to > http://linux.slashdot.org/article.pl?sid=06/05/10/0439246&from=rss > > but least this mirror: > > http://www.mirrordot.org/stories/3f6b22ec7a7cffcf2847b92cd5dec7e7/index.html > > worked Very interesting. What jumped to my eye is was Linus' statement: "The whole argument that microkernels are somehow "more secure" or "more stable" is also total crap. The fact that each individual piece is simple and secure does not make the aggregate either simple or secure." Certainly Linux kernel is modularized to keep interactions simpler and more stable? Or would it make any difference to make the whole kernel was in just one giant function instead of composed of numerous simpler functions... if little exaggeration is allowed ;) But here's an interesting link concerning microkernels and isolation - escpecially when considered Erlang in mind: http://tinyurl.com/qhuhg > regards > Jouni > -- > > Jouni Ryn? > mailto://Jouni.Ryno@REDACTED/ > http://www.geo.fmi.fi/~ryno/ > Finnish Meteorological Institute > http://www.fmi.fi/ > Space Research > http://www.geo.fmi.fi/ > P.O.BOX 503 Tel > (+358)-9-19294656 > FIN-00101 Helsinki FAX > (+358)-9-19294603 > Finland priv-GSM >(+358)-50-5302903 > > "It's just zeros and ones, it cannot be hard" Cheers, Jani Launonen From bengt.kleberg@REDACTED Wed May 10 12:19:26 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 10 May 2006 12:19:26 +0200 Subject: Linus Thorvalds has stated something about microkernels and monolithic kernels In-Reply-To: References: <1147250534.6696.5.camel@adic> Message-ID: <4461BE2E.50508@ericsson.com> On 2006-05-10 12:10, launoja@REDACTED wrote: ...deleted > Very interesting. What jumped to my eye is was Linus' statement: in my very biased opinon (i have been told how wrong i am in public by mr torvalds) he is one of the people that belive: it does not matter that i might have my facts wrong. my conclusion is correct anyway. bengt From rlenglet@REDACTED Wed May 10 13:34:39 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Wed, 10 May 2006 20:34:39 +0900 Subject: Linus Thorvalds has stated something about microkernels =?iso-8859-15?q?and=09monolithic?= kernels In-Reply-To: <4461BE2E.50508@ericsson.com> References: <1147250534.6696.5.camel@adic> <4461BE2E.50508@ericsson.com> Message-ID: <200605102034.40098.rlenglet@users.forge.objectweb.org> Bengt Kleberg wrote: > in my very biased opinon (i have been told how wrong i am in > public by mr torvalds) he is one of the people that belive: > > it does not matter that i might have my facts wrong. my > conclusion is correct anyway. Yet another case of "raymondism". http://www.softpanorama.org/OSS/bad_linux_advocacy_faq.shtml -- Romain LENGLET From mats.cronqvist@REDACTED Wed May 10 15:00:05 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 10 May 2006 15:00:05 +0200 Subject: Linus Thorvalds has stated something about microkernels and monolithic kernels In-Reply-To: References: <1147250534.6696.5.camel@adic> Message-ID: <4461E3D5.8020904@ericsson.com> launoja@REDACTED wrote: > On Wed, 10 May 2006 11:42:14 +0300 > Jouni Ryn? wrote: > >> which is interested to read for Erlangers, IMHO. [...] linus seems to be saying that for a system where global state is important (has "coherency issues"), it is counter-productive to break the system into independent parts. seems reasonable enough to me. of course, a distributed system with concurrency issues is an altogether different beast. > [...] > But here's an interesting link concerning microkernels and isolation - > escpecially when considered Erlang in mind: > http://tinyurl.com/qhuhg this appears to be written by the same Andy Tanenbaum who declared that "Linux is obsolete" in -92... (http://people.fluidsignal.com/~luferbu/misc/Linus_vs_Tanenbaum.html) 14 years later it has become "Linux is full of bugs." mats From happi@REDACTED Wed May 10 15:32:16 2006 From: happi@REDACTED (Erik Stenman) Date: Wed, 10 May 2006 15:32:16 +0200 Subject: Erlang position in Stockholm Message-ID: <4461EB60.3080301@kreditor.se> Kreditor is expanding and we are currently looking for a senior system architect and a software developer. For more information see http://www.kreditor.se/jobb/ (in Swedish only). PS. To promote Erlang usage among Swedish students, we have a competition where you can win a Sony PlayStation Portable, by writing a chat server in Erlang. See http://www.kreditor.se/jobb/competition.html for more information (in English). -- Cheers, Erik Happi Stenman _______________________________________ KREDITOR Sveav?gen 33 SE-111 34 Stockholm, Sweden Phone: +46 8 586 126 00 E-mail: erik.stenman@REDACTED Web: www.kreditor.se From S.J.Thompson@REDACTED Thu May 11 23:55:22 2006 From: S.J.Thompson@REDACTED (S.J.Thompson) Date: Thu, 11 May 2006 22:55:22 +0100 (BST) Subject: Funded PhD studentships at Kent Message-ID: PhD Studentships Computing Laboratory, University of Kent, Canterbury, UK Applications are invited for a number of PhD Research Studentships funded by EPSRC starting in September 2006. These studentships will provide tuition fees (at home/EU fees level) and, in the case of UK applicants, maintenance for a period of three years, subject to satisfactory progression through each year of study. The maintenance rate for 2006/7 is at least 12,300 pounds per annum. Candidates should have, or expect to obtain, a good first degree in Computer Science or a related discipline. An appropriate degree at Master's level would also be acceptable. You can apply for a PhD studentship in any of the department's research areas, see http://www.cs.kent.ac.uk/research/pg/researchdetails.html for research groups and suggestions for projects. Alternatively, you could contact a prospective supervisor and develop a research proposal in collaboration with them. The application process is set in motion through an on-line application form: http://www.kent.ac.uk/studying/postgrad/gradapply.html and an application for funding: http://www.cs.kent.ac.uk/research/pg/funding/bursary_app.html. Please also ensure that your supporting documentation (references, degree confirmation and TOEFL/IELTS score if necessary) is forwarded with your application. Applications must reach us by 16 June 2006. Member of the functional programming group http://www.cs.kent.ac.uk/research/groups/tcs/fp/ would be happy to discuss research topics with potential applicants. ----------------------------------------------------------------------- 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/ ----------------------------------------------------------------------- From yani.dzhurov@REDACTED Fri May 12 09:56:24 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Fri, 12 May 2006 10:56:24 +0300 Subject: how to hold lists Message-ID: <000901c67599$915b8ca0$1500a8c0@name3d6d1f4b1d> Hi guys, I need to have some kind of global variables where to hold a couple of lists. Also need them to process them pretty often by thousand of processes. How would it better and faster to hold them: -as macros -define(LIST1, [a,b,c,...]). or have a function which returns it get_list1()-> [a,b,c,..]. I have about 5-6 lists with about 50 atoms each. Is there any better approach? 10x, yani -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri May 12 10:20:40 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 12 May 2006 10:20:40 +0200 Subject: how to hold lists In-Reply-To: <000901c67599$915b8ca0$1500a8c0@name3d6d1f4b1d> References: <000901c67599$915b8ca0$1500a8c0@name3d6d1f4b1d> Message-ID: <44644558.4050105@ericsson.com> On 2006-05-12 09:56, Yani Dzhurov wrote: >...deleted > How would it better and faster to hold them: > > -as macros > > -define(LIST1, [a,b,c,?..]). > > > > or have a function which returns it > > > > get_list1()-> [a,b,c,?.]. macros will force a recompile every time you want to change a list. in that respect a function is better. macros might be very slightly faster. measure and compare to your requirements. then you know if you can take the better solution, or must take the very slightly faster one. bengt From karol.skocik@REDACTED Fri May 12 10:44:12 2006 From: karol.skocik@REDACTED (karol skocik) Date: Fri, 12 May 2006 10:44:12 +0200 Subject: SNMP - issues to resolve before making a release Message-ID: Hi, we are before making a first release of our application, with SNMP agent bundled in. Now, when I look into SNMP after some time spent on working with Erlang SNMP lib, 3 issues comes to my mind, which are quite important for me to know, before I tell my boss that evrything works ok. 1. First, we have SNMP agent v3, with authentication and privacy, and this means dependence on crypto library. However, SNMP app file does not mention anything about crypto, and that's why it is needed to explicitly write crypto into rel file, which is far from normal Erlang elegancy. Is there any reason why it is so, or it is a "feature" ;) ?? Is there any way to fix it? 2. When I have changed something in configuration which looks like this : [{snmp, [{agent, [{db_dir, "/var/lib/ipe"}, {config, [{dir, "/etc/ipe"}]}, {net_if, [{options, [{bind_to, false}]}]}]}]}, {mnesia, [{dir, "/var/lib/ipe"}]}, {yaws, [{embedded, true}, {logdir, "/var/log/ipe"}, {docroot, "/var/www/ipe"}, {include_dir, ["/var/www/ipe"]}, {listen, {0, 0, 0, 0}}]} ]. the change took always effect after restart, no matter that force_load is false by default, and this means it should take config from database - ignoring what is written in config file. Do I understand it well? In this context - what is the purpose of database in agent - especially config database? Why not just load config from conf files + config file? 3. Last but not least - when we change the machine address with our product with SNMP agent, do we need to fix the intAgentIpAddress in agent.conf to continue functioning? Karol From thomasl_erlang@REDACTED Fri May 12 10:58:24 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 12 May 2006 01:58:24 -0700 (PDT) Subject: how to hold lists In-Reply-To: <44644558.4050105@ericsson.com> Message-ID: <20060512085824.14524.qmail@web38815.mail.mud.yahoo.com> --- Bengt Kleberg wrote: > On 2006-05-12 09:56, Yani Dzhurov wrote: > >...deleted > > > How would it better and faster to hold them: > > > > -as macros > > > > -define(LIST1, [a,b,c,???..]). > > > > > > > > or have a function which returns it > > > > > > > > get_list1()-> [a,b,c,???.]. > > macros will force a recompile every time you want to > change a list. > in that respect a function is better. Good point. > macros might be very slightly faster. measure and > compare to your > requirements. then you know if you can take the > better solution, or must > take the very slightly faster one. On the other hand, with a macro, you are duplicating the same byte code many times. My guess is the function call is just about the same speed: you will have an extra function call, which may or may not mess things up, but the bytecode is more likely to be in the data cache. (On the gripping hand, there's also the potential cost in code and time of saving and restoring registers around the function call.) The salomonic approach is of course to start with the function and inline expand it "to the macro version" wherever necessary :-) An interesting simple option is to just use Hipe (ie, native compilation). As I recall, Hipe builds known terms at compile time and shares them. Option 3: If there are many frequently used, known, constant lists, then an even better approach could be to rewrite the operations on them and/or change the data structure. For example: lists:member(X, [a,b,...,z]). => my_mem(a) -> true; ... my_mem(z) -> true; my_mem(_) -> false. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From richardc@REDACTED Fri May 12 12:18:26 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 12 May 2006 12:18:26 +0200 Subject: how to hold lists In-Reply-To: <000901c67599$915b8ca0$1500a8c0@name3d6d1f4b1d> References: <000901c67599$915b8ca0$1500a8c0@name3d6d1f4b1d> Message-ID: <446460F2.3090003@it.uu.se> Yani Dzhurov wrote: > I need to have some kind of global variables where to hold a couple of > lists. Also need them to process them pretty often by thousand of processes. > [...] > I have about 5-6 lists with about 50 atoms each. > > Is there any better approach? I think that if you describe in more detail what these lists contain and how you want to use them (e.g., what does "process them" mean, more exactly?), people will be able to give you much better advice. /Richard From bmk@REDACTED Fri May 12 12:59:21 2006 From: bmk@REDACTED (Micael Karlberg) Date: Fri, 12 May 2006 12:59:21 +0200 Subject: SNMP - issues to resolve before making a release In-Reply-To: References: Message-ID: <44646A89.40506@erix.ericsson.se> Hi, karol skocik wrote: > Hi, > we are before making a first release of our application, with SNMP > agent bundled in. Now, when I look into SNMP after some time spent on > working with Erlang SNMP lib, 3 issues comes to my mind, which are > quite important for me to know, before I tell my boss that evrything > works ok. > > 1. First, we have SNMP agent v3, with authentication and privacy, and > this means dependence on crypto library. However, SNMP app file does > not mention anything about crypto, and that's why it is needed to > explicitly write crypto into rel file, which is far from normal Erlang > elegancy. Is there any reason why it is so, or it is a "feature" ;) > ?? Is there any way to fix it? The dependency of the crypto application exist only if you configure the agent to use v3! There is a comment about this in the snmp app- file. There is no way I know of to specify a conditional dependency. Maybe it should be made more clear in the SNMP documentation, that this has to be taken care of by the user of the SNMP application toolkit. > > 2. When I have changed something in configuration which looks like this : > > [{snmp, [{agent, > [{db_dir, "/var/lib/ipe"}, > {config, [{dir, "/etc/ipe"}]}, > {net_if, [{options, [{bind_to, false}]}]}]}]}, > {mnesia, [{dir, "/var/lib/ipe"}]}, > {yaws, [{embedded, true}, > {logdir, "/var/log/ipe"}, > {docroot, "/var/www/ipe"}, > {include_dir, ["/var/www/ipe"]}, > {listen, {0, 0, 0, 0}}]} > ]. > > the change took always effect after restart, no matter that force_load > is false by default, and this means it should take config from > database - ignoring what is written in config file. Do I understand it > well? > In this context - what is the purpose of database in agent - > especially config database? Why not just load config from conf files + > config file? Do you meaning the SNMP agent config file(s) (agent.conf, context.conf, standard.conf, ...) located in "/etc/ipe" (in your case)? Because if you do, the configuration is not just read but also processed, and it may take awhile to load everything, especially all the MIBs. If the mean the config you specified above (the system configuration file), then this is read only when starting and appgrade. But, in any case the snmp agent will only read this stuff when it starts. > > 3. Last but not least - when we change the machine address with our > product with SNMP agent, do we need to fix the intAgentIpAddress in > agent.conf to continue functioning? Read abot the bind_to config option in chapter "Running the application" of the User's Guide. You can ofcourse always write your own net_if module (this is supported by the agent, as long as you follow the API specification). > > Karol > > Regards, /BMK From yani.dzhurov@REDACTED Fri May 12 12:57:55 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Fri, 12 May 2006 13:57:55 +0300 Subject: how to hold lists In-Reply-To: <446460F2.3090003@it.uu.se> Message-ID: <002c01c675b2$ec847510$1500a8c0@name3d6d1f4b1d> You are right :) I need these lists to simulate some kind of enumarations. I have two big enums /100 fields each/ which I want to split in 5 lists and simulate them as enums in Erlang. For instance enum WeekDays {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday=20, Sunday} spilt them to lists days1=[monday, tuesday, wednesday, thursday, friday] And days2=[saturday, sunday]. So when I have WeekDay 1; I can easily get it from the first list; list:nth(1,days1). If I have WeekDay 22; lists:nth(22 - Offset, days2). Also I need easily to get the value of WeekDays as ints. So from thursday -> 3; So I would get the index of thursday in the list days1. This procedure looks pretty stupid in this example. But when I have large enums and need to insert new values in it /{Monday, Tuesday, Wednesday,SOME_OTHER_WEEK_DAY, Thursday, Friday, Saturday=20, Sunday}/ it would be easy to maintain. If someone else has a better idea, pls advise me:) 10x, yani -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Richard Carlsson Sent: Friday, May 12, 2006 1:18 PM To: Yani Dzhurov Cc: erlang-questions@REDACTED Subject: Re: how to hold lists Yani Dzhurov wrote: > I need to have some kind of global variables where to hold a couple of > lists. Also need them to process them pretty often by thousand of processes. > [...] > I have about 5-6 lists with about 50 atoms each. > > Is there any better approach? I think that if you describe in more detail what these lists contain and how you want to use them (e.g., what does "process them" mean, more exactly?), people will be able to give you much better advice. /Richard From joelr1@REDACTED Fri May 12 13:26:44 2006 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 May 2006 12:26:44 +0100 Subject: how to hold lists In-Reply-To: <002c01c675b2$ec847510$1500a8c0@name3d6d1f4b1d> References: <002c01c675b2$ec847510$1500a8c0@name3d6d1f4b1d> Message-ID: <8AD52B41-BD5A-41AE-B00D-3F33159C7801@gmail.com> On May 12, 2006, at 11:57 AM, Yani Dzhurov wrote: > I need these lists to simulate some kind of enumarations. > I have two big enums /100 fields each/ which I want to split in 5 > lists and > simulate them as enums in Erlang. You are not using this enums in your serialization library, are you? -- http://wagerlabs.com/ From serge@REDACTED Fri May 12 13:45:28 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 12 May 2006 07:45:28 -0400 Subject: how to hold lists In-Reply-To: <002c01c675b2$ec847510$1500a8c0@name3d6d1f4b1d> References: <002c01c675b2$ec847510$1500a8c0@name3d6d1f4b1d> Message-ID: <44647558.9070208@hq.idt.net> Looks like Thomas' advice was well suited for this problem: day(monday) -> {weekday, 1}; day(tuesday) -> {weekday, 2}; ... day(saturday) -> {weekend, 6}; % or is it 20 in your case? day(sunday) -> {weekend, 7}. is_weekday(D) -> element(1, day(D)) == weekend. day_of_week(D) -> element(2, day(D)). This should indeed be faster than working with lists. Serge Yani Dzhurov wrote: > You are right :) > > I need these lists to simulate some kind of enumarations. > I have two big enums /100 fields each/ which I want to split in 5 lists and > simulate them as enums in Erlang. > For instance > enum WeekDays {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday=20, > Sunday} > spilt them to lists > days1=[monday, tuesday, wednesday, thursday, friday] > And days2=[saturday, sunday]. > So when I have > WeekDay 1; > I can easily get it from the first list; > list:nth(1,days1). > If I have WeekDay 22; > lists:nth(22 - Offset, days2). > > Also I need easily to get the value of WeekDays as ints. > So from thursday -> 3; > So I would get the index of thursday in the list days1. > > This procedure looks pretty stupid in this example. > But when I have large enums and need to insert new values in it /{Monday, > Tuesday, Wednesday,SOME_OTHER_WEEK_DAY, Thursday, Friday, Saturday=20, > Sunday}/ it would be easy to maintain. > > If someone else has a better idea, pls advise me:) > > 10x, > > yani > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Richard Carlsson > Sent: Friday, May 12, 2006 1:18 PM > To: Yani Dzhurov > Cc: erlang-questions@REDACTED > Subject: Re: how to hold lists > > Yani Dzhurov wrote: > >>I need to have some kind of global variables where to hold a couple of >>lists. Also need them to process them pretty often by thousand of > > processes. > >>[...] >>I have about 5-6 lists with about 50 atoms each. >> >>Is there any better approach? > > > I think that if you describe in more detail what these lists contain > and how you want to use them (e.g., what does "process them" mean, > more exactly?), people will be able to give you much better advice. > > /Richard > > > > From yani.dzhurov@REDACTED Fri May 12 13:50:16 2006 From: yani.dzhurov@REDACTED (Yani Dzhurov) Date: Fri, 12 May 2006 14:50:16 +0300 Subject: how to hold lists In-Reply-To: <44647558.9070208@hq.idt.net> Message-ID: <017301c675ba$3c932180$1500a8c0@dobrosoft.local> Yeah, this is the way it's done now...or some kind of ... But now I need to add some more values to these enums... And imagine I add new_Monday at first position in my enum... Then I have to rewrite all: day(new_monday)-> {weekday, 1}; day(monday) -> {weekday, 2}; day(tuesday) -> {weekday, 3}; and I need to manage an enum with about 100 values ... and if I need to change these funs every time a new value is added /a value may be added at any position, not just the first one.../ .. it would become a hell:) So I need a better way to manage these enums. 10x, yani -----Original Message----- From: Serge Aleynikov [mailto:serge@REDACTED] Sent: Friday, May 12, 2006 2:45 PM To: Yani Dzhurov Cc: erlang-questions@REDACTED Subject: Re: how to hold lists Looks like Thomas' advice was well suited for this problem: day(monday) -> {weekday, 1}; day(tuesday) -> {weekday, 2}; ... day(saturday) -> {weekend, 6}; % or is it 20 in your case? day(sunday) -> {weekend, 7}. is_weekday(D) -> element(1, day(D)) == weekend. day_of_week(D) -> element(2, day(D)). This should indeed be faster than working with lists. Serge Yani Dzhurov wrote: > You are right :) > > I need these lists to simulate some kind of enumarations. > I have two big enums /100 fields each/ which I want to split in 5 lists and > simulate them as enums in Erlang. > For instance > enum WeekDays {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday=20, > Sunday} > spilt them to lists > days1=[monday, tuesday, wednesday, thursday, friday] > And days2=[saturday, sunday]. > So when I have > WeekDay 1; > I can easily get it from the first list; > list:nth(1,days1). > If I have WeekDay 22; > lists:nth(22 - Offset, days2). > > Also I need easily to get the value of WeekDays as ints. > So from thursday -> 3; > So I would get the index of thursday in the list days1. > > This procedure looks pretty stupid in this example. > But when I have large enums and need to insert new values in it /{Monday, > Tuesday, Wednesday,SOME_OTHER_WEEK_DAY, Thursday, Friday, Saturday=20, > Sunday}/ it would be easy to maintain. > > If someone else has a better idea, pls advise me:) > > 10x, > > yani > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Richard Carlsson > Sent: Friday, May 12, 2006 1:18 PM > To: Yani Dzhurov > Cc: erlang-questions@REDACTED > Subject: Re: how to hold lists > > Yani Dzhurov wrote: > >>I need to have some kind of global variables where to hold a couple of >>lists. Also need them to process them pretty often by thousand of > > processes. > >>[...] >>I have about 5-6 lists with about 50 atoms each. >> >>Is there any better approach? > > > I think that if you describe in more detail what these lists contain > and how you want to use them (e.g., what does "process them" mean, > more exactly?), people will be able to give you much better advice. > > /Richard > > > > From invisio22@REDACTED Fri May 12 13:55:49 2006 From: invisio22@REDACTED (Eric Shun) Date: Fri, 12 May 2006 13:55:49 +0200 Subject: Validate XML data with a XSD file Message-ID: <3f9db9f20605120455k1b925344n21a3e78a47ede533@mail.gmail.com> Hello, Is ther a way to validate XML data using an XSD file? -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge@REDACTED Fri May 12 14:10:58 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 12 May 2006 08:10:58 -0400 Subject: how to hold lists In-Reply-To: <017301c675ba$3c932180$1500a8c0@dobrosoft.local> References: <017301c675ba$3c932180$1500a8c0@dobrosoft.local> Message-ID: <44647B52.1010201@hq.idt.net> This should be easy enough if you write a function that auto-generates the source file given some constants. Yani Dzhurov wrote: > Yeah, this is the way it's done now...or some kind of ... > But now I need to add some more values to these enums... > And imagine I add new_Monday at first position in my enum... > Then I have to rewrite all: > day(new_monday)-> {weekday, 1}; > day(monday) -> {weekday, 2}; > day(tuesday) -> {weekday, 3}; > > and I need to manage an enum with about 100 values ... and if I need to > change these funs every time a new value is added /a value may be added at > any position, not just the first one.../ .. it would become a hell:) > So I need a better way to manage these enums. > > 10x, > > yani > -----Original Message----- > From: Serge Aleynikov [mailto:serge@REDACTED] > Sent: Friday, May 12, 2006 2:45 PM > To: Yani Dzhurov > Cc: erlang-questions@REDACTED > Subject: Re: how to hold lists > > Looks like Thomas' advice was well suited for this problem: > > day(monday) -> {weekday, 1}; > day(tuesday) -> {weekday, 2}; > ... > day(saturday) -> {weekend, 6}; % or is it 20 in your case? > day(sunday) -> {weekend, 7}. > > is_weekday(D) -> element(1, day(D)) == weekend. > day_of_week(D) -> element(2, day(D)). > > This should indeed be faster than working with lists. > > Serge > > > > Yani Dzhurov wrote: > >>You are right :) >> >>I need these lists to simulate some kind of enumarations. >>I have two big enums /100 fields each/ which I want to split in 5 lists > > and > >>simulate them as enums in Erlang. >>For instance >>enum WeekDays {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday=20, >>Sunday} >>spilt them to lists >>days1=[monday, tuesday, wednesday, thursday, friday] >>And days2=[saturday, sunday]. >>So when I have >>WeekDay 1; >>I can easily get it from the first list; >>list:nth(1,days1). >>If I have WeekDay 22; >>lists:nth(22 - Offset, days2). >> >>Also I need easily to get the value of WeekDays as ints. >>So from thursday -> 3; >>So I would get the index of thursday in the list days1. >> >>This procedure looks pretty stupid in this example. >>But when I have large enums and need to insert new values in it /{Monday, >>Tuesday, Wednesday,SOME_OTHER_WEEK_DAY, Thursday, Friday, Saturday=20, >>Sunday}/ it would be easy to maintain. >> >>If someone else has a better idea, pls advise me:) >> >>10x, >> >>yani >> >> >>-----Original Message----- >>From: owner-erlang-questions@REDACTED >>[mailto:owner-erlang-questions@REDACTED] On Behalf Of Richard Carlsson >>Sent: Friday, May 12, 2006 1:18 PM >>To: Yani Dzhurov >>Cc: erlang-questions@REDACTED >>Subject: Re: how to hold lists >> >>Yani Dzhurov wrote: >> >> >>>I need to have some kind of global variables where to hold a couple of >>>lists. Also need them to process them pretty often by thousand of >> >>processes. >> >> >>>[...] >>>I have about 5-6 lists with about 50 atoms each. >>> >>>Is there any better approach? >> >> >>I think that if you describe in more detail what these lists contain >>and how you want to use them (e.g., what does "process them" mean, >>more exactly?), people will be able to give you much better advice. >> >> /Richard From her@REDACTED Fri May 12 14:16:57 2006 From: her@REDACTED (Helmut Enck-Radana) Date: Fri, 12 May 2006 14:16:57 +0200 Subject: Validate XML data with a XSD file In-Reply-To: <3f9db9f20605120455k1b925344n21a3e78a47ede533@mail.gmail.co m> References: <3f9db9f20605120455k1b925344n21a3e78a47ede533@mail.gmail.com> Message-ID: <6.2.3.4.0.20060512141112.01d52e58@paradigma-software.de> At 13:55 2006-05-12, Eric Shun wrote: >Is ther a way to validate XML data using an XSD file? Did you have a look at Erlsom? http://www.erlang.org/ml-archive/erlang-questions/200601/msg00146.html http://www.erlang.org/ml-archive/erlang-questions/200605/msg00116.html -- Helmut From joelr1@REDACTED Fri May 12 14:29:35 2006 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 May 2006 13:29:35 +0100 Subject: how to hold lists In-Reply-To: <017301c675ba$3c932180$1500a8c0@dobrosoft.local> References: <017301c675ba$3c932180$1500a8c0@dobrosoft.local> Message-ID: <84338F95-0434-4AF8-9001-4909DC42C931@gmail.com> Start a gen_server, let it grab your list of atoms and assign each atom a number based on its list position. Service calls to convert atom to number. Alternatively, convert the list once and memoize it in a function. Repeated calls to the resulting function will return atom to number translations. On May 12, 2006, at 12:50 PM, Yani Dzhurov wrote: > and I need to manage an enum with about 100 values ... and if I > need to > change these funs every time a new value is added /a value may be > added at > any position, not just the first one.../ .. it would become a hell:) > So I need a better way to manage these enums. -- http://wagerlabs.com/ From danie@REDACTED Fri May 12 15:40:25 2006 From: danie@REDACTED (Danie Schutte) Date: Fri, 12 May 2006 15:40:25 +0200 Subject: variables passed as parameters Message-ID: <200605121540.26060.danie@erlfinsys.net> Just a quick question, when a list / gb_tree is passed as a parameter, is a full memcopy of the data done to the new function? The reason for my question: We would like to a have a data set passed on through various modules, and each module may / may not update this data.. We are trying to figure out if it would be faster to create a single module that manages the data in a "memory space" (like a gen_server state variable or an ets table) or wether it would not really matter in terms of speed - and the only factor to watch out for would be memory? Thanks Daniel From sebastian@REDACTED Fri May 12 16:00:14 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 12 May 2006 11:00:14 -0300 Subject: Oracle on Linux References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605021615.23508.chaitanya.chalasani@gmail.com> <78568af10605041544s58c24bbfy4f1c5fe59d51d601@mail.gmail.com> <200605091334.44521.chaitanya.chalasani@gmail.com> Message-ID: <00a001c675cc$65191a80$dc00a8c0@inswitchapp> Hi, I'm considering a solution similar to yours, but am new to Oracle so I have some questions. Has anybody tried to implement al Erlang port using ODBC under Windows? What about its performance? And about the implementation using OCI, is it easy to work with it? How faster is it than ODBC? Did you implement some kind of connection pooling with it? Or is it maybe provided by the API? Thanks, Sebastian- ----- Original Message ----- From: "Chaitanya Chalasani" To: "Ryan Rawson" Cc: "Joel Reymont" ; "Erlang Questions" Sent: Tuesday, May 09, 2006 5:04 AM Subject: Re: Oracle on Linux > Sorry I was away for a week > I will send the source for the same today. > > On Friday 05 May 2006 04:14, Ryan Rawson wrote: > > I also have the same needs. Not sure if buying a commercial ODBC > > driver is a viable option. > > > > I havent started poking into this, but soon. > > > > -ryan > > > > On 5/2/06, Chaitanya Chalasani wrote: > > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > > Folks, > > > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > > commercial ODBC driver? > > > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > > > Thanks, Joel > > > > > > > > -- > > > > http://wagerlabs.com/ > > > > > > We tried using a free ODBC for oracle on linux but we faced lot of > > > functional issues and performance issues. We built an application using > > > OCI and used erlang ports. The performace is quite good and implemented > > > all the features we required. > > > > > > -- > > > Chaitanya Chalasani > > > ------------------- > > > "The ultimate truths of nature are so subtle > > > that they can be revealed only under immense silence" > > -- > Chaitanya Chalasani > ------------------- > "The ultimate truths of nature are so subtle > that they can be revealed only under immense silence" From orbitz@REDACTED Fri May 12 17:45:04 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Fri, 12 May 2006 11:45:04 -0400 Subject: variables passed as parameters In-Reply-To: <200605121540.26060.danie@erlfinsys.net> References: <200605121540.26060.danie@erlfinsys.net> Message-ID: You can't update a list remember? You can only create a new list. Objects are immutable in Erlang, it is single assignment. On May 12, 2006, at 9:40 AM, Danie Schutte wrote: > Just a quick question, > > when a list / gb_tree is passed as a parameter, is a full memcopy > of the data > done to the new function? > > The reason for my question: We would like to a have a data set > passed on > through various modules, and each module may / may not update this > data.. > > We are trying to figure out if it would be faster to create a > single module > that manages the data in a "memory space" (like a gen_server state > variable > or an ets table) or wether it would not really matter in terms of > speed - and > the only factor to watch out for would be memory? > > Thanks > Daniel > > From leifj@REDACTED Fri May 12 21:59:59 2006 From: leifj@REDACTED (Leif Johansson) Date: Fri, 12 May 2006 21:59:59 +0200 Subject: Billion-triple store In-Reply-To: <4458E878.9090509@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> <4458E878.9090509@it.su.se> Message-ID: <4464E93F.2030607@it.su.se> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I have done a couple of experiments with a totally brain-dead (probably) > schema on a single node with {n_fragments, 1000}. I can insert ~250k > statements at a sustained rate of ~2300 statements per second using > disk-copies of everything and a transaction per statement. The resulting > mnesia disk db is ~55M from a 25M n3 file turned into erlang statements > using perl :-) > > Stay tuned... > > Cheers Leif I created a new schema which reduces the database size at the price of a ~40-50% reduction in insertion speed. I have only tried small graphs of about 100k - 1M triples. At these sizes I get ~1500 insertions per second sustained on my P4 mobile laptop. The resulting mnesia db using 100 frags for the two tables is ~ 110M in size. I am going to setup a bigger test now... Cheers Leif -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEZOk/8Jx8FtbMZncRAreyAKCvlH2boOM7Z8JEku9rn5gIA2c09gCfVwoV NjmuROk1toViWSS02jCAr/I= =mbJT -----END PGP SIGNATURE----- From joelr1@REDACTED Fri May 12 22:11:06 2006 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 12 May 2006 21:11:06 +0100 Subject: Billion-triple store In-Reply-To: <4464E93F.2030607@it.su.se> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <444CBC56.6020408@it.su.se> <6E2A467D-EFE5-4D64-A200-3F56C73A2FC5@netymon.com> <4457CF87.4020701@it.su.se> <4458E878.9090509@it.su.se> <4464E93F.2030607@it.su.se> Message-ID: <184894C5-B83A-475E-A418-E42D77D0608D@gmail.com> Leif, Keep us posted please and let me know when you get to 60-100 million triples. Also, I know a vendor who uses tries to store the strings. It does reduce space usage, specially when dealing with common namespaces. Thanks, Joel On May 12, 2006, at 8:59 PM, Leif Johansson wrote: > I created a new schema which reduces the database size at the price of > a ~40-50% reduction in insertion speed. I have only tried small graphs > of about 100k - 1M triples. At these sizes I get ~1500 insertions per > second sustained on my P4 mobile laptop. The resulting mnesia db using > 100 frags for the two tables is ~ 110M in size. > > I am going to setup a bigger test now... -- http://wagerlabs.com/ From richardc@REDACTED Fri May 12 23:00:24 2006 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 12 May 2006 23:00:24 +0200 Subject: variables passed as parameters In-Reply-To: <200605121540.26060.danie@erlfinsys.net> References: <200605121540.26060.danie@erlfinsys.net> Message-ID: <4464F768.4000803@it.uu.se> Danie Schutte wrote: > when a list / gb_tree is passed as a parameter, is a full memcopy of > the data done to the new function? No, if it's just a function call, then all data structures are passed by reference - there is no copying. Atoms, "small" integers (<2^27), etc., that fit into a single word anyway are always copied, but it does not matter, because they cannot be manipulated in memory. > The reason for my question: We would like to a have a data set > passed on through various modules, and each module may / may not > update this data.. As long as it's the same _process_ that is passing on the data from function to function (perhaps in different modules), there is no copying. If one function "updates" the data (a list or tree), it actually just creates new references into the old data, and often discards some of the old references. (Any parts of the data that can no longer be reached through a reference, are automatically recycled by the garbage collector.) However, when you pass a data structure to another process, it will be copied, because processes do not share "heap memory" (in the standard "private heap" Erlang runtime system). And if processes are on different nodes, there will of course always be copying. Side note: If you use the (still considered experimental?) "hybrid heap" version of the runtime system, or the (now discontinued, also experimental) "shared heap" version, the amount of copying between processes on the same node is reduced. > We are trying to figure out if it would be faster to create a single > module that manages the data in a "memory space" (like a gen_server > state variable or an ets table) or wether it would not really matter > in terms of speed - and the only factor to watch out for would be > memory? It's important to understand that _modules_ are not responsible for memory spaces. _Processes_ are. So, a gen_server process has its own state and memory space, and likewise an ets table is actually behaving as if it was just another process (although it is in fact implemented in C for the sake of high efficiency). When you enter data in an ets table, or look up data, the data is always copied from your process to the table, or from the table to the process, as if by sending messages. /Richard From yariv@REDACTED Fri May 12 23:02:31 2006 From: yariv@REDACTED (Yariv Sadan) Date: Fri, 12 May 2006 17:02:31 -0400 Subject: Billion-triple store In-Reply-To: <22582A61-C2F9-4C8C-97DC-B61E7F3D0BDF@redstarling.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <22582A61-C2F9-4C8C-97DC-B61E7F3D0BDF@redstarling.com> Message-ID: <4557F405-7E1C-48D5-942C-78708A35CDFF@pando.com> Hi, I just did some research into BDB. It looks like BDB only supports row level locking for Queue tables, whose records must be of fixed size (http://www.sleepycat.com/docs/gsg/C/BerkeleyDB-Core-C-GSG.pdf). Wouldn't this make BDB inappropriate for Mnesia, which allows variable-size records? Regards, Yariv On May 9, 2006, at 10:41 AM, ke han wrote: > > Whatever happened to the BDB backed mnesia I read about last year? > Is this going to become a real mnesia backend someday? > ke han > From ulf@REDACTED Sat May 13 00:22:08 2006 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 13 May 2006 00:22:08 +0200 Subject: Billion-triple store In-Reply-To: <4557F405-7E1C-48D5-942C-78708A35CDFF@pando.com> References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <22582A61-C2F9-4C8C-97DC-B61E7F3D0BDF@redstarling.com> <4557F405-7E1C-48D5-942C-78708A35CDFF@pando.com> Message-ID: Den 2006-05-12 23:02:31 skrev Yariv Sadan : > Hi, > > I just did some research into BDB. It looks like BDB only supports row > level locking for Queue tables, whose records must be of fixed size > (http://www.sleepycat.com/docs/gsg/C/BerkeleyDB-Core-C-GSG.pdf). > Wouldn't this make BDB inappropriate for Mnesia, which allows > variable-size records? I think that one should seriously consider fixed-size records if performance is a priority. Just because mnesia supports variable-size records, one doesn't have to make use of it. When designing storage structures for Erlang, one tends to think that they always must support any type, but this may incur a significant performance penalty. /Ulf W -- Ulf Wiger From yariv@REDACTED Sat May 13 01:14:48 2006 From: yariv@REDACTED (Yariv Sadan) Date: Fri, 12 May 2006 19:14:48 -0400 Subject: Billion-triple store In-Reply-To: References: <72B1B6DA-3100-476E-B979-0441BC11C96D@gmail.com> <22582A61-C2F9-4C8C-97DC-B61E7F3D0BDF@redstarling.com> <4557F405-7E1C-48D5-942C-78708A35CDFF@pando.com> Message-ID: <85E2E842-C267-4FBC-B8AD-71CC05D34E72@pando.com> > > I think that one should seriously consider fixed-size records > if performance is a priority. Just because mnesia supports > variable-size records, one doesn't have to make use of it. > > When designing storage structures for Erlang, one > tends to think that they always must support any > type, but this may incur a significant performance > penalty. > > /Ulf W I think this is a good point. Maybe it would make sense for Mnesia to have a special table type for fixed size records? Such a table could be implemented on top of Berkeley DB or in pure Erlang. What do you think? Yariv From fritchie@REDACTED Sat May 13 02:29:52 2006 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 12 May 2006 19:29:52 -0500 Subject: Billion-triple store In-Reply-To: Message of "Fri, 12 May 2006 17:02:31 EDT." <4557F405-7E1C-48D5-942C-78708A35CDFF@pando.com> Message-ID: <200605130029.k4D0TqPa017882@snookles.snookles.com> >>>>> "ys" == Yariv Sadan writes: ys> Hi, I just did some research into BDB. It looks like BDB only ys> supports row level locking for Queue tables, whose records must be ys> of fixed size ys> (http://www.sleepycat.com/docs/gsg/C/BerkeleyDB-Core-C-GSG.pdf). Berkeley DB supports several types of tables. Queue is the only that requires a fixed size, IIRC. If you insist on Berkeley DB and on record-level locking (since there really aren't "rows" in a Berkeley DB table ... unless you consider Berkeley DB table to have a fixed two-column table design), then the queue is your only major option. It is certainly possible to write non-trivial apps using table types that use (gasp!) page-level locking. -Scott From jefcrane@REDACTED Sun May 14 18:59:54 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sun, 14 May 2006 09:59:54 -0700 (PDT) Subject: Preventing multiple instances through register/2 Message-ID: <20060514165954.94863.qmail@web31605.mail.mud.yahoo.com> %%Start gen_server() start()-> %% greeting msg io:format(" Started test_server on:~p~n",[self()]), %% read user/pass case( catch register(test_server,spawn(?MODULE, load_accounts, [])) ) of {'EXIT', _} -> already_started; Pid -> ok end. --- Yes it gets caught, but it also still spawns! What's the proper way to prevent a duplicate spawn if not through case catch register(spawn) ? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From richardc@REDACTED Sun May 14 19:38:20 2006 From: richardc@REDACTED (Richard Carlsson) Date: Sun, 14 May 2006 19:38:20 +0200 Subject: Preventing multiple instances through register/2 In-Reply-To: <20060514165954.94863.qmail@web31605.mail.mud.yahoo.com> References: <20060514165954.94863.qmail@web31605.mail.mud.yahoo.com> Message-ID: <44676B0C.70003@it.uu.se> Jeff Crane wrote: > Yes it gets caught, but it also still spawns! What's > the proper way to prevent a duplicate spawn if not > through case catch register(spawn) ? Let the spawned process try to register itself, or exit if it does not succeed. In either case, send a message to the (waiting) parent process, informing it of the outcome, before terminating or getting on with the real work. /Richard -- "Having users is like optimization: the wise course is to delay it." -- Paul Graham From vladdu55@REDACTED Sun May 14 19:47:11 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 14 May 2006 18:47:11 +0100 Subject: Preventing multiple instances through register/2 In-Reply-To: <20060514165954.94863.qmail@web31605.mail.mud.yahoo.com> References: <20060514165954.94863.qmail@web31605.mail.mud.yahoo.com> Message-ID: <95be1d3b0605141047h211daefdy121a0b941531e4e1@mail.gmail.com> Hi, spawn the server and let it register itself in the initialization part. If the name is already taken, just exit. regards, Vlad On 5/14/06, Jeff Crane wrote: > > %%Start gen_server() > start()-> > %% greeting msg > io:format(" Started test_server on:~p~n",[self()]), > > %% read user/pass > case( > catch register(test_server,spawn(?MODULE, > load_accounts, [])) > ) of > {'EXIT', _} -> > already_started; > Pid -> > ok > end. > --- > > Yes it gets caught, but it also still spawns! What's > the proper way to prevent a duplicate spawn if not > through case catch register(spawn) ? > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jefcrane@REDACTED Sun May 14 22:49:22 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sun, 14 May 2006 13:49:22 -0700 (PDT) Subject: Preventing multiple instances through register/2 In-Reply-To: <95be1d3b0605141047h211daefdy121a0b941531e4e1@mail.gmail.com> Message-ID: <20060514204922.27767.qmail@web31612.mail.mud.yahoo.com> >If the name is already taken, just exit >Let the spawned process try to register itself, or exit if it does not succeed. %%Start gen_server() start()-> %% greeting msg, text output io:format(" Started test_server on:~p~n",[self()]), %% Single assign to new var, the PID of the new load_accounts/0 spawn Pid = spawn(?MODULE, load_accounts, []), %% Case on result of catch %% catch on register/2 which always goes through, even with error %% register new var as test_server case(Err = (catch register(test_server,Pid))) of %% Some kind of failure {'EXIT', _} -> %% Atom output already_registered, %% io:format(" test_server:already registered:~p~n",[Err]), %% Kill spawned process, via msg Pid ! exit; %% If it worked, leave the spawn alone _ -> %% move on good_start %% This process dies here. Spawned process is either living, or was killed. end. Can anyone explain to me why the atom already_registered does not echo to the screen, but the io:format (commented out) does? Without registering, how do you send messages to a PID from the command line? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ok@REDACTED Mon May 15 03:06:33 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 15 May 2006 13:06:33 +1200 (NZST) Subject: how to hold lists Message-ID: <200605150106.k4F16XHP289367@atlas.otago.ac.nz> "Yani Dzhurov" wrote: I need these lists to simulate some kind of enumarations. ... This procedure looks pretty stupid in this example. But when I have large enums and need to insert new values in it /{Monday, Tuesday, Wednesday,SOME_OTHER_WEEK_DAY, Thursday, Friday, Saturday=20, Sunday}/ it would be easy to maintain. If someone else has a better idea, pls advise me:) The big question is this: When you write "I ... need to insert new values ..." do you mean that *YOU* need to insert new values (perhaps with a text editor) and then a re-compile is OK, or that you need a PROGRAM acting perhaps as your agent to do this at run time? If it is the former, there is a mantra that I would like you to recite several times a day: CODE is DATA! Let's say you want the following operations on an enumeration: (1) Return the number of enumerals, N. (2) Convert from an integer 1..N to the corresponding enumeral. (3) Convert from an enumeral to the corresponding integer. (4) Test whether a symbol is a member of the set. (5) Return all the enumerals in order as a list. Let's say you would be happy with this as a module -module(ModuleName). -export([size/0,from_integer/1,to_integer/1,includes/1,members/0]). size() -> N. from_integer(1) -> Enumeral_1; ... from_integer(N) -> Enumeral_N. to_integer(Enumeral_1) -> 1; ... to_integer(Enumeral_N) -> N. includes(Enumeral_1) -> true; ... includes(Enumeral_N) -> true; includes(X) when atom(X) -> false. members() -> [Enumeral_1, ..., Enumeral_N]. Here are some macro definitions in M4 that do the job: define(`def_from_int', `define(`counter',eval(counter+1))from_integer(counter) -> $1`'ifelse($#,1, `. ', `; def_from_int(shift($@))')')dnl define(`def_to_int', `define(`counter', eval(counter+1))to_integer($1) -> counter`'ifelse($#,1, `. ', `; def_to_int(shift($@))')')dnl define(`def_inc', `includes($1) -> true; ifelse($#,1, `includes(X) when atom(X) -> false. ', `def_inc(shift($@))')')dnl define(`define_enumeration', `-module($1). -export([size/0,from_integer/1,to_integer/1,includes/1,members/0]). size() -> eval($#-1). define(`counter', 0)def_from_int(shift($@)) define(`counter', 0)def_to_int(shift($@)) def_inc(shift($@)) members() -> [shift($@)]. ')dnl Put that in file enum.m4 Put this example in every.erl.m4: define_enumeration(every, tom,dick,harry) (note no square brackets or trailing dot). Run it like this: m4 enum.m4 every.erl.m4 >every.erl And what you get is -module(every). -export([size/0,from_integer/1,to_integer/1,includes/1,members/0]). size() -> 3. from_integer(1) -> tom; from_integer(2) -> dick; from_integer(3) -> harry. to_integer(tom) -> 1; to_integer(dick) -> 2; to_integer(harry) -> 3. includes(tom) -> true; includes(dick) -> true; includes(harry) -> true; includes(X) when atom(X) -> false. members() -> [tom,dick,harry]. I chose M4 as the simplest and quickest way to do the job. Of course you could do this in Erlang. From vladdu55@REDACTED Mon May 15 09:04:11 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 15 May 2006 09:04:11 +0200 Subject: Preventing multiple instances through register/2 In-Reply-To: <20060514204922.27767.qmail@web31612.mail.mud.yahoo.com> References: <95be1d3b0605141047h211daefdy121a0b941531e4e1@mail.gmail.com> <20060514204922.27767.qmail@web31612.mail.mud.yahoo.com> Message-ID: <95be1d3b0605150004o3fe217fas2ca4f4033ed9aa77@mail.gmail.com> Hi, If you're using a gen_server, you can also use start_link/4 or start/4 with a first argument of {local, Name} or {global, Name} and the details will be handled for you. If it's a server you implement yourself, do this: start() -> spawn(?MODULE, init, []). init() -> case (catch register(test_server, self()) of {'EXIT', _} -> already_registered; % process ends here _ -> load_accounts() end. >From the shell you can send test_server ! Msg, which will find either the newly spawned process or the older one that was running. In your code, already_registered isn't returned from the function, so the value is lost The return is the value of "Pid ! exit", which is the atom 'exit'. already_registered, %% io:format(" test_server:already registered:~p~n",[Err]), %% Kill spawned process, via msg Pid ! exit; hope this helps, /Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From ejectdan@REDACTED Fri May 12 18:04:32 2006 From: ejectdan@REDACTED (ejectdan@REDACTED) Date: Fri, 12 May 2006 18:04:32 +0200 (CEST) Subject: Error: syntax error before: '_' Message-ID: <24612290.1147449872336.JavaMail.root@ps23> HI, when I compile my SNMP MIB, as: Erlang (BEAM) emulator version 5.3.6.3 [source] [hipe] [threads:0] Eshell V5.3.6.3 (abort with ^G) 1> snmp:c("MY_SIMPLE-MIB", [{db, mnesia}]). i get the following error: MY_SIMPLE-MIB.mib: 4: Error: syntax error before: '_' {error,compilation_failed} 2> Tis error succeeds because I can't use the char '_', into the MIB definition. Obviously, I must use this version of ERLANG and this character in the MIB. Anyone know how can I do to "bypass" that limitation? Thanks in advanced Daniele Tiscali ADSL 4 Mega Flat Naviga senza limiti a 19,95 Euro al mese con 4 Megabps di velocita'. Attiva subito: hai 2 MESI di canone adsl GRATIS! In piu', se sei raggiunto dalla rete Tiscali, telefoni senza pagare il canone Telecom. Scopri subito come risparmiare! http://abbonati.tiscali.it/prodotti/adsl/tc/4flat/ From richardc@REDACTED Mon May 15 09:16:56 2006 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 15 May 2006 09:16:56 +0200 Subject: Preventing multiple instances through register/2 In-Reply-To: <20060514204922.27767.qmail@web31612.mail.mud.yahoo.com> References: <20060514204922.27767.qmail@web31612.mail.mud.yahoo.com> Message-ID: <44682AE8.5050008@it.uu.se> Jeff Crane wrote: > Can anyone explain to me why the atom > already_registered does not echo to the screen, but > the io:format (commented out) does? If you do as in your example: already_registered, io:format(" test_server:already registered:~p~n",[Err]), %% Kill spawned process, via msg Pid ! exit; then the final value (which is echoed to the screen when you run the code from the shell) is that of the last expression, namely 'Pid ! exit' (and the value of that is just 'exit'). When you run several expressions separated by comma, all the results except the last are thrown away. This should work: io:format(" test_server:already registered:~p~n",[Err]), %% Kill spawned process, via msg Pid ! exit, already_registered; *But* you are still doing the registration from the "wrong" process, which makes it more complicated than it needs to be. Try something like this: start() -> Pid = spawn(?MODULE, process, [self()] end), receive {Pid, Result} -> Result end. process(Parent) -> case catch register(test_server, self()) of true -> Parent ! {self(), ok}, start_work(); _ -> Parent ! {self(), error}, exit(error) end. start_work(...) -> ... > Without registering, how do you send messages to a PID > from the command line? You can do something like this: 1> Pid = spawn(mymodule, myprocessfunction, [1,2,3]). 2> Pid ! message. but if you don't know the Pid, then you don't know it. Look at it as a sort of access control. /Richard From bengt.kleberg@REDACTED Mon May 15 09:51:01 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 15 May 2006 09:51:01 +0200 Subject: Error: syntax error before: '_' In-Reply-To: <24612290.1147449872336.JavaMail.root@ps23> References: <24612290.1147449872336.JavaMail.root@ps23> Message-ID: <446832E5.7090302@ericsson.com> On 2006-05-12 18:04, ejectdan@REDACTED wrote: > Tis error succeeds because I can't use the char '_', into the MIB > definition. > Obviously, I must use this version of ERLANG and this character in the > MIB. it is not possible to use names with '_' in a MIB. the snmp standard says so. bengt From matsola.persson@REDACTED Mon May 15 19:16:19 2006 From: matsola.persson@REDACTED (Mats-Ola Persson) Date: Mon, 15 May 2006 19:16:19 +0200 Subject: Pro-Erlang/pro-functional programming papers Message-ID: Hi, Do you guys have any good pro-Erlang/pro-functional programming paper/ articles (read propaganda) lying around somewhere? I am planning on doing some Erlang lobbying at work, it would be nice to have some *good* references :) Regards, Mats-Ola From lennart.ohman@REDACTED Mon May 15 19:45:09 2006 From: lennart.ohman@REDACTED (Lennart Ohman) Date: Mon, 15 May 2006 19:45:09 +0200 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: Message-ID: <000901c67847$4fb91aa0$0600a8c0@st.se> Hi, have you considered going for the concurrent-oriented-programming approach rather than talking about functional programming? Joe Armstrong gave a good talk at (was it MIT?) taking this approach. It was recorded but I have lost where it can be found. 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: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Mats-Ola Persson > Sent: Monday, May 15, 2006 7:16 PM > To: Erlang Questions > Subject: Pro-Erlang/pro-functional programming papers > > Hi, > > Do you guys have any good pro-Erlang/pro-functional programming paper/ > articles (read propaganda) lying around somewhere? > > I am planning on doing some Erlang lobbying at work, it would be nice > to have some *good* references :) > > Regards, > Mats-Ola > From Marc.Vanwoerkom@REDACTED Mon May 15 21:24:56 2006 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Mon, 15 May 2006 21:24:56 +0200 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: <000901c67847$4fb91aa0$0600a8c0@st.se> References: <000901c67847$4fb91aa0$0600a8c0@st.se> Message-ID: Am Mon, 15 May 2006 19:45:09 +0200 hat "Lennart Ohman" geschrieben: > have you considered going for the >concurrent-oriented-programming > approach rather than talking about functional >programming? > > Joe Armstrong gave a good talk at (was it MIT?) taking >this > approach. It was recorded but I have lost where it can >be found. http://www.sics.se/~joe/talks/ll2_2002.pdf Regards, Marc From dbarker@REDACTED Mon May 15 23:15:25 2006 From: dbarker@REDACTED (Deryk Barker) Date: Mon, 15 May 2006 14:15:25 -0700 Subject: Getting lists from ASCII input Message-ID: <20060515141525.A23204@hal.cs.camosun.bc.ca> I'm still a (raw) beginner but... I'm trying to write a program (a client - my students will write the server) which needs to allow the user to enter a list in repsonse to a prompt. I cannot quite figure out what combination of list_to_atom and atom_to_list I need to do this. e.g. if the user enter: remove [a,b,c] I'd like to be able to get the remove as an atom and the [a,b,c] as a list of three atoms. Currently, I can get the list [91,97,44,98,44,99,,93] Which has the [ command and ] as terms. I'm sure I must be missing something obvious. thanks -- |Deryk Barker, Computer Science Dept. | Music does not have to be understood| |Camosun College, Victoria, BC, Canada| It has to be listened to. | |email: dbarker@REDACTED | | |phone: +1 250 370 4452 | Hermann Scherchen. | From robert.virding@REDACTED Tue May 16 00:33:27 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 16 May 2006 00:33:27 +0200 Subject: Erlog - a prolog interpreter written in, and for, Erlang Message-ID: <446901B7.4020806@telia.com> One thing that I have always thought was missing in Erlang was a Prolog interpreter. I have now rectified that. Erlog is a prolog interpreter written in Erlang that can be called from Erlang and can call Erlang. It is the perfect tool when you need a logic inference engine within your application. Now you can finally search ETS databases as God intended. Erlog implements a subset, most of the good bits at least, of standard prolog and is reasonably conforming. It is easy to interface with the rest of Erlang as prolog terms have a very straightforward representation. There is also a simple prolog parser based on Erlang tokens and a Yecc parser which is used for loading prolog programs. Note because of a bug in Yecc you cannot directly compile the .erl file generated by yecc. A fixed version is included. There is also a man page describing the system, ad of course the code. Enjoy, Robert -------------- next part -------------- A non-text attachment was scrubbed... Name: erlog.zip Type: application/octet-stream Size: 25302 bytes Desc: not available URL: From orbitz@REDACTED Tue May 16 00:58:34 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Mon, 15 May 2006 18:58:34 -0400 Subject: Getting lists from ASCII input In-Reply-To: <20060515141525.A23204@hal.cs.camosun.bc.ca> References: <20060515141525.A23204@hal.cs.camosun.bc.ca> Message-ID: <38D1C4BF-6321-43D9-B846-DD1E53289B55@ezabel.com> You might consider using eval or writing a more intelligent parser for your list, using something like yecc to write a subset of the erlang syntax. On May 15, 2006, at 5:15 PM, Deryk Barker wrote: > I'm still a (raw) beginner but... > > I'm trying to write a program (a client - my students will write the > server) which needs to allow the user to enter a list in repsonse to a > prompt. > > I cannot quite figure out what combination of list_to_atom and > atom_to_list I need to do this. > > e.g. if the user enter: > > remove [a,b,c] > > I'd like to be able to get the remove as an atom and the [a,b,c] as a > list of three atoms. Currently, I can get the list > > [91,97,44,98,44,99,,93] > > Which has the [ command and ] as terms. > > I'm sure I must be missing something obvious. > > thanks > -- > |Deryk Barker, Computer Science Dept. | Music does not have to be > understood| > |Camosun College, Victoria, BC, Canada| It has to be listened > to. | > |email: dbarker@REDACTED > | | > |phone: +1 250 370 4452 | Hermann > Scherchen. | > From jjsanchez@REDACTED Tue May 16 01:40:29 2006 From: jjsanchez@REDACTED (Juan =?iso-8859-1?Q?Jos=E9_S=E1nchez?= Penas) Date: Tue, 16 May 2006 01:40:29 +0200 Subject: Getting lists from ASCII input In-Reply-To: <20060515141525.A23204@hal.cs.camosun.bc.ca> References: <20060515141525.A23204@hal.cs.camosun.bc.ca> Message-ID: <20060515234029.GA32684@riker.dc.fi.udc.es> Hi Deryk, On Mon, May 15, 2006 at 02:15:25PM -0700, Deryk Barker wrote: > I cannot quite figure out what combination of list_to_atom and > atom_to_list I need to do this. > > e.g. if the user enter: > > remove [a,b,c] > > I'd like to be able to get the remove as an atom and the [a,b,c] as a > list of three atoms. Currently, I can get the list I guess for the case of the list you need to scan (obtain Tokens) and then parse (convert to abstract form and then to the corresponding Erlang term). For the command part you can use directly list_to_atom (converts strings into Erlang atoms). One way of doing it would be: parse_user_input(UserInput) -> [ComString, ArgString] = string:tokens(UserInput, " "), ComTerm = list_to_atom(ComString), {ok, ArgTokens, _} = erl_scan:string(ArgString++"."), {ok, ArgTerm} = erl_parse:parse_term(ArgTokens), {ok, ComTerm, ArgTerm}. The code assumes the input string only has spaces between the command and the list. 1> test:parse_user_input("remove [1,2,3]"). {ok,remove,[1,2,3]} Hope it helps :) Best regards, -- Juan Jos? S?nchez Penas From jjsanchez@REDACTED Tue May 16 01:46:35 2006 From: jjsanchez@REDACTED (Juan =?iso-8859-1?Q?Jos=E9_S=E1nchez?= Penas) Date: Tue, 16 May 2006 01:46:35 +0200 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: References: <000901c67847$4fb91aa0$0600a8c0@st.se> Message-ID: <20060515234635.GB32684@riker.dc.fi.udc.es> Hi, On Mon, May 15, 2006 at 09:24:56PM +0200, Marc van Woerkom wrote: > >have you considered going for the concurrent-oriented-programming > >approach rather than talking about functional programming? > > > >Joe Armstrong gave a good talk at (was it MIT?) taking > >this approach. It was recorded but I have lost where it can > >be found. > > http://www.sics.se/~joe/talks/ll2_2002.pdf The video of this very nice talk is (still) available here: http://ll2.ai.mit.edu/ Direct link: http://web.mit.edu/webcast/ailab/mit-ll2-s1-09nov02-80k.ram (Only in Real Audio format :-/ ) Cheers, -- Juan Jos? S?nchez Penas From yerl@REDACTED Tue May 16 07:34:00 2006 From: yerl@REDACTED (Yerl) Date: Tue, 16 May 2006 07:34:00 +0200 Subject: Erlog - a prolog interpreter written in, and for, Erlang In-Reply-To: <446901B7.4020806@telia.com> References: <446901B7.4020806@telia.com> Message-ID: <44696448.50806@club-internet.fr> Hi Robert! Very very cool. Is there any web site describing Erlog. I want to make an Erlog port for Crux Linux. cheers /Youn?s Robert Virding a ?crit : > One thing that I have always thought was missing in Erlang was a > Prolog interpreter. I have now rectified that. > > Erlog is a prolog interpreter written in Erlang that can be called > from Erlang and can call Erlang. It is the perfect tool when you need > a logic inference engine within your application. Now you can finally > search ETS databases as God intended. > > Erlog implements a subset, most of the good bits at least, of standard > prolog and is reasonably conforming. It is easy to interface with the > rest of Erlang as prolog terms have a very straightforward > representation. > > There is also a simple prolog parser based on Erlang tokens and a Yecc > parser which is used for loading prolog programs. Note because of a > bug in Yecc you cannot directly compile the .erl file generated by > yecc. A fixed version is included. > > There is also a man page describing the system, ad of course the code. > > Enjoy, > Robert From Bruce@REDACTED Tue May 16 07:50:16 2006 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Tue, 16 May 2006 17:50:16 +1200 Subject: CDMA/3GPP2 MEID tool Message-ID: <44696818.4070104@Fitzsimons.org> Hi, You may or may not be aware that the CDMA/3GPP2 side of the mobile world is changing its mobile handset identifier from an Electronic Serial Number (ESN) to a Mobile Equipment Identifier (MEID) due to having sold far too many phones :-) (...and it was only 24 bits). MEIDs are effectively the same as GSM IMEIs but use a different range of manufacturer codes and a different check-digit calculation. See 3GPP2 X.S0008 if you want to see more/are a masochist. Why is this on the Erlang list? Well I've implemented a small page in Yaws/Erlang that allows validation of the check-digits and the calculation of the psuedo-ESN (used for backward compatibility). It was a pleasant experience to implement the SHA-1 hashing (using crypto) and the 2x LUHN checkdigit calculations. I must say that converting standards specifications into an Erlang implementation is far nicer than doing it in C/C++/Java. Some examples: http://www.neolineas.com/pesn.yaws?meid=AF0123450ABCDE - 3GPP2 example http://www.neolineas.com/pesn.yaws?meid=A00000000023299 Some helpful hints for the archive: * http://schemecookbook.org/Erlang/NumberConvOctHex shows a nice way of converting hex numbers in ASCII to usable integers (credit: BrentAFulgham ) * Using lists:flatten(string:tokens(String, " ")) is an easy, brute force, way to kill user formatting of input numbers (assuming formatting is irrelevant) * io_lib:format outputs unflattened lists when padding which will cause grief if you expect a flat "string" in later processing. Cheers, Bruce From john-olof.bauner@REDACTED Tue May 16 08:46:03 2006 From: john-olof.bauner@REDACTED (John-Olof Bauner (KI/EAB)) Date: Tue, 16 May 2006 08:46:03 +0200 Subject: Pro-Erlang/pro-functional programming papers Message-ID: Probably here: http://ll2.ai.mit.edu/ -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Lennart Ohman Sent: den 15 maj 2006 19:45 To: 'Mats-Ola Persson'; 'Erlang Questions' Subject: RE: Pro-Erlang/pro-functional programming papers Hi, have you considered going for the concurrent-oriented-programming approach rather than talking about functional programming? Joe Armstrong gave a good talk at (was it MIT?) taking this approach. It was recorded but I have lost where it can be found. 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: owner-erlang-questions@REDACTED [mailto:owner-erlang- > questions@REDACTED] On Behalf Of Mats-Ola Persson > Sent: Monday, May 15, 2006 7:16 PM > To: Erlang Questions > Subject: Pro-Erlang/pro-functional programming papers > > Hi, > > Do you guys have any good pro-Erlang/pro-functional programming paper/ > articles (read propaganda) lying around somewhere? > > I am planning on doing some Erlang lobbying at work, it would be nice > to have some *good* references :) > > Regards, > Mats-Ola > From taavi.talvik@REDACTED Mon May 15 20:30:13 2006 From: taavi.talvik@REDACTED (Taavi Talvik) Date: Mon, 15 May 2006 21:30:13 +0300 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: References: Message-ID: <144568e05e0ecf01819f681652aa90a0@elisa.ee> > Do you guys have any good pro-Erlang/pro-functional programming > paper/articles (read propaganda) lying around somewhere? > > I am planning on doing some Erlang lobbying at work, it would be nice > to have some *good* references :) Probably best and most comprehensive is: http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf best regards, taavi From leif.einar@REDACTED Mon May 15 20:48:18 2006 From: leif.einar@REDACTED (leif.einar@REDACTED) Date: Mon, 15 May 2006 20:48:18 +0200 (CEST) Subject: gs full screen window Message-ID: <56554.80.202.20.201.1147718898.squirrel@83.143.81.74> Hi! How do I start a full-screen window in gs on Linux? Previously I used heigth and widht on 6000, and my window manager would scale it down to a reasonable size, but this doesn't seem to do the trick on Fedora Core 5 anymore. Best Regards Leif Einar From matt@REDACTED Tue May 16 10:04:45 2006 From: matt@REDACTED (Matthew McDonnell) Date: Tue, 16 May 2006 09:04:45 +0100 (BST) Subject: Getting lists from ASCII input In-Reply-To: <20060515141525.A23204@hal.cs.camosun.bc.ca> References: <20060515141525.A23204@hal.cs.camosun.bc.ca> Message-ID: On Mon, 15 May 2006, Deryk Barker wrote: > I'm trying to write a program (a client - my students will write the > server) which needs to allow the user to enter a list in repsonse to a > prompt. > > I cannot quite figure out what combination of list_to_atom and > atom_to_list I need to do this. > > e.g. if the user enter: > > remove [a,b,c] > > I'd like to be able to get the remove as an atom and the [a,b,c] as a > list of three atoms. Currently, I can get the list io:scan_erl_exprs does just about what you want: 1> io:scan_erl_exprs('enter text>'). enter text>remove [a,b,c]. {ok,[{atom,1,remove}, {'[',1}, {atom,1,a}, {',',1}, {atom,1,b}, {',',1}, {atom,1,c}, {']',1}, {dot,1}], 2} Something like the following maybe? (untested, probably typos): parse() -> {ok, [ActionAtom, {'[',_}, AtomList], _Num} = io:scan_erl_exprs(), List = accumulate(AtomList,[]) {ActionAtom, List}. accumulate([{atom, _, At} | Lst], Acc) -> accumulate(Lst, [At | Acc]); accumulate([{']',_} | ], Acc) -> lists:reverse(Acc). Cheers, Matt Matt McDonnell Email: matt@REDACTED Web: http://www.matt-mcdonnell.com/ From mats.cronqvist@REDACTED Tue May 16 10:13:52 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Tue, 16 May 2006 10:13:52 +0200 Subject: Getting lists from ASCII input In-Reply-To: <20060515141525.A23204@hal.cs.camosun.bc.ca> References: <20060515141525.A23204@hal.cs.camosun.bc.ca> Message-ID: <446989C0.7050504@ericsson.com> Deryk Barker wrote: > I'm still a (raw) beginner but... > > I'm trying to write a program (a client - my students will write the > server) which needs to allow the user to enter a list in repsonse to a > prompt. > seems like a problem where using the scanner directly would be appropriate. 1> erl_scan:string("hello [a,b,c]"). {ok,[{atom,1,hello}, {'[',1}, {atom,1,a}, {',',1}, {atom,1,b}, {',',1}, {atom,1,c}, {']',1}], 1} perhaps parse the arg; 1> {ok,[{atom,_,Cmd}|R],_} = erl_scan:string("hello,[a,b,c]"), 2> {ok,Arg}=erl_parse:parse_term(R++[{dot,1}]), 3> {Cmd,Arg}. {hello,[a,b,c]} mats From nm@REDACTED Tue May 16 10:34:24 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 16 May 2006 13:34:24 +0500 Subject: Getting lists from ASCII input In-Reply-To: References: <20060515141525.A23204@hal.cs.camosun.bc.ca> Message-ID: <44698E90.1070006@web.am> Matthew McDonnell wrote: > On Mon, 15 May 2006, Deryk Barker wrote: > >> I'm trying to write a program (a client - my students will write the >> server) which needs to allow the user to enter a list in repsonse to a >> prompt. >> >> I cannot quite figure out what combination of list_to_atom and >> atom_to_list I need to do this. >> >> e.g. if the user enter: >> >> remove [a,b,c] >> >> I'd like to be able to get the remove as an atom and the [a,b,c] as a >> list of three atoms. Currently, I can get the list > > io:scan_erl_exprs does just about what you want: > > 1> io:scan_erl_exprs('enter text>'). > enter text>remove [a,b,c]. > {ok,[{atom,1,remove}, > {'[',1}, > {atom,1,a}, > {',',1}, > {atom,1,b}, > {',',1}, > {atom,1,c}, > {']',1}, > {dot,1}], > 2} > > Something like the following maybe? (untested, probably typos): > > parse() -> > {ok, [ActionAtom, {'[',_}, AtomList], _Num} = io:scan_erl_exprs(), > List = accumulate(AtomList,[]) > {ActionAtom, List}. > > accumulate([{atom, _, At} | Lst], Acc) -> > accumulate(Lst, [At | Acc]); > accumulate([{']',_} | ], Acc) -> > lists:reverse(Acc). in you input correct erlang term, you can parse them easily ;) 1> {ok, E, _} = io:scan_erl_exprs('enter text>'). enter text>[a,b,c]. {ok,[{'[',1},{atom,1,a},{',',1},{atom,1,b},{',',1},{atom,1,c},{']',1},{dot,1}], 2} 2> erl_parse:parse_term(E). {ok,[a,b,c]} 3> -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From gordonguthrie@REDACTED Tue May 16 10:44:55 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Tue, 16 May 2006 09:44:55 +0100 Subject: Comet/Hows Jaws Coming Along? Message-ID: <1147769095.446991073d100@backawinner.gg> Folks I have stumbled across a long discussion which is very germane to the (upcoming) release of Jaws and actually has a mention of Yaws! http://alex.dojotoolkit.org/?p=545 Essentially you: * build a javascript client * keep a single HTTP connection alive from the brwoser to the client * push updates up the connection This allows a smoother multi-user experience without implementing a clock- tick/check for update on the client side. Unsurprisingly there are doubts as to whether this will scale under traditional technologies like Apache. The people implementing it seem to be focussing on building their own (unthreaded) server-side components. As the article points out it is a reprise of traditionaly middleware/thick client architectures. I would surmise that the javascript client will either need to become insanely baroque to write decent clients or you will hold a 'shadow' html page on the server and chop it into chunks which you can slide down the pipe for a javascript cut'n'paste Dom walker to pop in and out. On a related matter, in the run up to Jaws, I have been playing with Ajax and Erlang myself. I have written a 'naive' spreadsheet application that creates a table and then populates each cell with an HTTP request. For grids of up to 300 cells Mozilla, Firefox and Konqueror all respond fairly zipply - with Konqueror by far and away the best. Konqueror manages up to about 2,500 concurrent requests (although at a crawl) whereas Mozilla/Firefox have long given up the ghost. I foolishly went the whole hog with a 100 by 100 grid and was picking bits of broken javascript out of my hair for a week (had to pull the battery out to drop the operating system!). When I get the time I will switch the yaws instance to a networked one and do a (still shoddy) pseudo-benchmark. However I think we can rest assured that current browsers don't handle concurrency that well! Gordon ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From chris.double@REDACTED Tue May 16 11:30:42 2006 From: chris.double@REDACTED (Chris Double) Date: Tue, 16 May 2006 21:30:42 +1200 Subject: Comet/Hows Jaws Coming Along? In-Reply-To: <1147769095.446991073d100@backawinner.gg> References: <1147769095.446991073d100@backawinner.gg> Message-ID: On 5/16/06, Gordon Guthrie wrote: > Essentially you: > * build a javascript client > * keep a single HTTP connection alive from the brwoser to the client > * push updates up the connection I have an example of doing this using Erlang and Yaws here: http://www.bluishcoder.co.nz/2005/11/pushing-events-to-browser-via-ajax.html http://www.bluishcoder.co.nz/2005/11/observers-erlang-and-server-push.html My plan was to model the web page as an Erlang process and be able to send messages to it from Erlang to get it to do things. I'm looking forward to seeing Jaws though. Any update on its progress? Chris. -- http://www.bluishcoder.co.nz From vladdu55@REDACTED Tue May 16 12:25:29 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 16 May 2006 12:25:29 +0200 Subject: "Null" group_leader? Message-ID: <95be1d3b0605160325q6849b96ei5da4de08cf784cc3@mail.gmail.com> Hi all, Is there any predefined equivalent of /dev/null when talking about group leaders? I have a RPC from Java whose output I want to ignore. best regards, Vlad From Lennart.Ohman@REDACTED Tue May 16 13:22:35 2006 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Tue, 16 May 2006 13:22:35 +0200 Subject: SV: "Null" group_leader? References: <95be1d3b0605160325q6849b96ei5da4de08cf784cc3@mail.gmail.com> Message-ID: Hi, I guess using any not in use proper pid must work. If I am not mistaken, the pid is simply used as address for I/O. And sending to a non existing pid is no crime. There is of course a risk that the pid is eventually used :-) /Lennart ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sj?land & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED ________________________________ Fr?n: owner-erlang-questions@REDACTED genom Vlad Dumitrescu Skickat: ti 2006-05-16 12:25 Till: erlang-questions@REDACTED ?mne: "Null" group_leader? Hi all, Is there any predefined equivalent of /dev/null when talking about group leaders? I have a RPC from Java whose output I want to ignore. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo@REDACTED Tue May 16 13:41:05 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 16 May 2006 13:41:05 +0200 Subject: "Null" group_leader? References: <95be1d3b0605160325q6849b96ei5da4de08cf784cc3@mail.gmail.com> Message-ID: I am afraid the proper(tm) way to do it (today) is to write a null IO server of your own and set it as your group leader. vladdu55@REDACTED (Vlad Dumitrescu) writes: > Hi all, > > Is there any predefined equivalent of /dev/null when talking about > group leaders? > > I have a RPC from Java whose output I want to ignore. > > best regards, > Vlad -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From gordonguthrie@REDACTED Tue May 16 14:46:56 2006 From: gordonguthrie@REDACTED (Gordon Guthrie) Date: Tue, 16 May 2006 13:46:56 +0100 Subject: Comet/Hows Jaws Coming Along? In-Reply-To: <1147769095.446991073d100@backawinner.gg> References: <1147769095.446991073d100@backawinner.gg> Message-ID: <1147783616.4469c9c0c5c84@backawinner.gg> To fool others convincingly, you must first fool yourself... >I have written a 'naive' spreadsheet application that creates a > table and then populates each cell with an HTTP request. Except of course it doesn't, the browser (presumably) implements the HTTP standard and opens 1 (or 2) connections and pipelines all my HTTP requests. To really test concurrency I will need to implement a DNS wildcard and then express each cell as an iFrame with a different subdomain... Gordon ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ From mickael.remond@REDACTED Tue May 16 16:05:11 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 16 May 2006 16:05:11 +0200 Subject: Erlang Beam VM in debug mode (erl +v) Message-ID: <20060516140511.GF7603@memphis.ilius.fr> Hello, I tried to build the Erlang VM in debug mode on Linux. I followed the instruction given in README.win32. I end up with a new beam.debug. However, when launching Erlang with: $ erl +v The emulator does not say I am running in debug mode. Am I missing something ? -- Micka?l R?mond http://www.process-one.net/ From ssmith@REDACTED Wed May 17 05:24:35 2006 From: ssmith@REDACTED (Steve Smith) Date: Wed, 17 May 2006 13:24:35 +1000 Subject: Small Erlang bencode library Message-ID: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Hi, As a preliminary exercise in learning Erlang I've implemented a basic bencoding library (bencoding being the serialisation system used in the bittorrent protocol). The darcs repository is available here: http://people.vislab.usyd.edu.au/~ssmith/erlang/bencode As this is my first go at declarative programming comments and corrections are welcome. Cheers, Steve From chsu79@REDACTED Wed May 17 09:58:47 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 17 May 2006 09:58:47 +0200 Subject: Small Erlang bencode library In-Reply-To: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> References: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Message-ID: This is how i would build the encoder. Mainly so that I dont have to include the type tagging pairs when the erlang terms already have types of their own. bencode(List) when is_list(List) -> [$l, [bencode(Item) || Item <- List], $e]; bencode(Int) when is_integer(Int) -> [$i, integer_to_list(Int), $e]; bencode(Bin) when is_binary(Bin) -> [integer_to_list(size(Bin)), $:, Bin]; bencode(Dict) when element(1, Dict) == dict -> Sorter = fun({Key1, _}, {Key2, _}) -> Key1 < Key2 end, Pairs = [[bencode(Key), bencode(Value)] || {Key, Value} <- lists:sort(Sorter, dict:to_list(Dict))], [$d, Pairs, $e]. Dict = dict:store(<<"foo">>, 3, dict:new()). Terms = [1,2, <<"How's this?">>, Dict]. Encoded = bencode:bencode(Terms). If you want this as a string you can do "binary_to_list(list_to_binary(Encoded))." and get "li1ei2e11:How's this?d3:fooi3eee" But the value of Encoded itself is useable, it is known as the type iolist(), sometimes even string() in documentation. You can send iolist() over sockets so pre-flattening them is not necessary. It appears that dict keys must be strings, the encoder should probably crash if a key is not. In all my whole dict encoding part suffer some code smell. Maybe someone else has a better alternative? On 5/17/06, Steve Smith wrote: > > Hi, > > As a preliminary exercise in learning Erlang I've implemented a basic > bencoding library (bencoding being the serialisation system used in the > bittorrent protocol). The darcs repository is available here: > > http://people.vislab.usyd.edu.au/~ssmith/erlang/bencode > > As this is my first go at declarative programming comments and > corrections are welcome. > > Cheers, > Steve > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuel@REDACTED Wed May 17 10:14:07 2006 From: samuel@REDACTED (Samuel Rivas) Date: Wed, 17 May 2006 10:14:07 +0200 Subject: another (minor) dialyzer patch Message-ID: <20060517081407.GA29903@nodo2.lambdastream.com> Hi, dialyzer crashes when you try to go to ".." form the root dir. Maybe it is already solved but I've attached a mini-patch to solve it, just in case. -- Samuel -------------- next part -------------- --- dialyzer.original/src/dialyzer_gui.erl 2006-03-09 17:56:09.000000000 +0100 +++ dialyzer/src/dialyzer_gui.erl 2006-05-17 10:04:05.000000000 +0200 @@ -685,12 +685,15 @@ S end. -butlast([H1, H2 | T])-> - [H1 | butlast([H2|T])]; -butlast([_]) -> +butlast([H|T])-> + [H | kill_last(T)]. + +kill_last([_H|[]]) -> + []; +kill_last([]) -> []; -butlast([]) -> - ["/"]. +kill_last([H|T]) -> + [H | kill_last(T)]. change_dir_absolute(S = #gui_state{file_wd=FWD, dir_entry=DirEntry, From thomas@REDACTED Wed May 17 13:15:26 2006 From: thomas@REDACTED (Thomas Johnsson) Date: Wed, 17 May 2006 13:15:26 +0200 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: <144568e05e0ecf01819f681652aa90a0@elisa.ee> References: <144568e05e0ecf01819f681652aa90a0@elisa.ee> Message-ID: <446B05CE.1090702@skri.net> >> Do you guys have any good pro-Erlang/pro-functional programming >> paper/articles (read propaganda) lying around somewhere? I warmly recommend Paul Grahams paper "Beating the Averages", http://www.paulgraham.com/avg.html http://www.iiia.csic.es/~puyol/TAPIA/pgtalk-rev2.pdf not because it says anything about Erlang in particular (more about Lisp, which he considers the most powerful language in existence), but because he makes some very pertiment points about powerful languages as a "secret weapon", especially for startup companies. It is also very entertaining reading. -- Thomas From bjorn@REDACTED Wed May 17 14:51:14 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 May 2006 14:51:14 +0200 Subject: Erlang/OTP R11B has been released Message-ID: Erlang/OTP R11B has been released as planned on May 17, 2006. You can download the full source distribution from http://www.erlang.org/download/otp_src_R11B-0.tar.gz For installation instructions please read the README that is part of the distribution or found here: http://www.erlang.org/download/otp_src_R11B-0.readme The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R11B-0.exe You can also download the complete HTML documentation or the Unix manual files: http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz We also want to thank all that have sent us patches, suggestions and bug reports, The OTP Team -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From matt@REDACTED Wed May 17 15:29:07 2006 From: matt@REDACTED (Matthew McDonnell) Date: Wed, 17 May 2006 14:29:07 +0100 (BST) Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: <446B05CE.1090702@skri.net> References: <144568e05e0ecf01819f681652aa90a0@elisa.ee> <446B05CE.1090702@skri.net> Message-ID: >> Do you guys have any good pro-Erlang/pro-functional programming >> paper/articles (read propaganda) lying around somewhere? If you're selling the functional side of things then look at the paper "Why Functional Programming Matters" by John Hughes http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html The "success stories" section of the Ocaml website shows some decent applications that have been made in a functional language: http://caml.inria.fr/about/successes.en.html For pro-Erlang articles the Erlang User Conference articles are useful: http://www.erlang.se/euc/ Cheers, Matt Matt McDonnell Email: matt@REDACTED Web: http://www.matt-mcdonnell.com/ From erlang@REDACTED Wed May 17 16:37:53 2006 From: erlang@REDACTED (Bernardo Paroli) Date: Wed, 17 May 2006 11:37:53 -0300 Subject: timer:sleep bug? Message-ID: <00c601c679bf$7d47cdd0$1c00a8c0@bp2> Hi, I've been testing the timer:sleep/1 function and I have some troubles with some values passed to the function. In the test I start n process and each process make a loop sleeping for x milliseconds. Below I show the example. If I run the test with sleepTest:start(100, 999) the test work fine, but if I run with sleepTest(100, 1000) the erlang process consume 100% cpu :( Is this a bug? Why with 999 milliseconds work fine and with 1000 milliseconds no? In ran the test in a Windows XP with Erlang v5.4 -module(sleepTest). -export([start/2]). start(0, _Sleep) -> ok; start(N, Sleep) -> spawn(fun() -> loop(Sleep) end), timer:sleep(10), start(N - 1, Sleep). loop(Sleep) -> timer:sleep(Sleep), loop(Sleep). Regards, Bernardo -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Wed May 17 16:52:59 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 17 May 2006 16:52:59 +0200 Subject: Erlang/OTP R11B has been released Message-ID: Bj?rn Gustavsson wrote: > > Erlang/OTP R11B has been released as planned on May 17, 2006. Any explanation as to why the "big" benchmark runs 5 times faster on 4 schedulers than on one (AMD Opteron 2 dual core) and 2.8x faster on 2 cores (AMD Athlon 64 X2)? /Ulf W From mikpe@REDACTED Wed May 17 17:19:53 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 17 May 2006 17:19:53 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: References: Message-ID: <17515.16153.702059.482643@alkaid.it.uu.se> Bjorn Gustavsson writes: > Erlang/OTP R11B has been released as planned on May 17, 2006. The documentation highlights for R11B-0 state that: >The Erlang VM with SMP support has been tested on the following platforms: > > * Solaris 10 sparc > * Suse Linux (SLES 9) x86 > * Mac OSx PPC In addition to the platforms listed above, the HiPE team has been testing the SMP system on: * Solaris 9 on SPARC and x86 * YellowDog Linux 4.1 on PowerPC * Fedora Core 3 and 4 Linux on x86 and x86-64 * Fedora Core 5 Linux on x86 /Mikael From ernie.makris@REDACTED Wed May 17 17:37:25 2006 From: ernie.makris@REDACTED (Ernie Makris) Date: Wed, 17 May 2006 11:37:25 -0400 Subject: Erlang/OTP R11B has been released In-Reply-To: References: Message-ID: <446B4335.4030507@comcast.net> Hi Erlangers, This is great news! However, the linux 2.6 (FC3,4...) run_erl patch is still not there. -0> ./run_erl tmp/ tmp "~/dev/erlang/otp_src_R11B-0/bin/erl" run_erl [29481] Wed May 17 11:22:16 2006 Could not open pty master openpty must be used. Is there any way to get this in. I don't mind patching my local copy each time, but some other people are having the same issues. My test system is a FC4 SMP system. Another welcome addition would be to allow the file_driver to open a device like /dev/urandom. I also patch my local build to allow this as well. I welcome feedback on this. I know the file_driver is built so that it should not block under normal circumstances and thats why device opens are not allowed. There is a special case in there for /dev/null, and I always add my own(in unix_efile.c) for /dev/urandom. Should there be a patchset system created for erlang if these types are changes are not wanted by the erlang powers that be.To make it convenient for people to share and test patches. Thanks Ernie Bjorn Gustavsson wrote: > Erlang/OTP R11B has been released as planned on May 17, 2006. > > You can download the full source distribution from > > http://www.erlang.org/download/otp_src_R11B-0.tar.gz > > For installation instructions please read the README that is part of > the distribution or found here: > > http://www.erlang.org/download/otp_src_R11B-0.readme > > The Windows binary distribution can be downloaded from > > http://www.erlang.org/download/otp_win32_R11B-0.exe > > You can also download the complete HTML documentation or > the Unix manual files: > > http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz > http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz > > We also want to thank all that have sent us patches, suggestions and bug > reports, > > The OTP Team > > From Jouni.Ryno@REDACTED Wed May 17 17:51:14 2006 From: Jouni.Ryno@REDACTED (Jouni Ryno) Date: Wed, 17 May 2006 18:51:14 +0300 Subject: Erlang/OTP R11B has been released In-Reply-To: <446B4335.4030507@comcast.net> References: <446B4335.4030507@comcast.net> Message-ID: <1147881074.8176.1.camel@catmind> On Wed, 2006-05-17 at 11:37 -0400, Ernie Makris wrote: > Hi Erlangers, > > This is great news! > > However, the linux 2.6 (FC3,4...) run_erl patch is still not there. > > -0> ./run_erl tmp/ tmp "~/dev/erlang/otp_src_R11B-0/bin/erl" > run_erl [29481] Wed May 17 11:22:16 2006 > Could not open pty master > > openpty must be used. Is there any way to get this in. I don't mind > patching my local copy each time, > but some other people are having the same issues. hear, hear! Jouni From garris@REDACTED Wed May 17 18:00:23 2006 From: garris@REDACTED (Erik Garrison) Date: Wed, 17 May 2006 12:00:23 -0400 (EDT) Subject: Small Erlang bencode library In-Reply-To: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> References: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Message-ID: Some time ago I heard in the erlang IRC chat about an Erlang bittorrent client which had been begun. svn://ortdotlove.net/Erlang/trunk/Bittsunami On Wed, 17 May 2006, Steve Smith wrote: > Hi, > > As a preliminary exercise in learning Erlang I've implemented a basic > bencoding library (bencoding being the serialisation system used in the > bittorrent protocol). The darcs repository is available here: > > http://people.vislab.usyd.edu.au/~ssmith/erlang/bencode > > As this is my first go at declarative programming comments and > corrections are welcome. > > Cheers, > Steve > From serge@REDACTED Wed May 17 18:21:14 2006 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 17 May 2006 12:21:14 -0400 Subject: Erlang/OTP R11B has been released In-Reply-To: <446B4335.4030507@comcast.net> References: <446B4335.4030507@comcast.net> Message-ID: <446B4D7A.4060505@hq.idt.net> There was another patch to run_erl that fixed an issue with using run_erl in combination with "-heart" option of erl. The patch also included Ernie's changes: http://www.erlang.org/ml-archive/erlang-questions/200601/msg00473.html Serge Ernie Makris wrote: > Hi Erlangers, > > This is great news! > > However, the linux 2.6 (FC3,4...) run_erl patch is still not there. > > -0> ./run_erl tmp/ tmp "~/dev/erlang/otp_src_R11B-0/bin/erl" > run_erl [29481] Wed May 17 11:22:16 2006 > Could not open pty master > > openpty must be used. Is there any way to get this in. I don't mind > patching my local copy each time, > but some other people are having the same issues. My test system is a > FC4 SMP system. > > Another welcome addition would be to allow the file_driver to open a > device like /dev/urandom. > I also patch my local build to allow this as well. I welcome feedback on > this. I know the file_driver is built so that > it should not block under normal circumstances and thats why device > opens are not allowed. There is a special > case in there for /dev/null, and I always add my own(in unix_efile.c) > for /dev/urandom. > > Should there be a patchset system created for erlang if these types are > changes are not wanted by the erlang powers that be.To make it > convenient for people to share and test patches. > > Thanks > Ernie > > Bjorn Gustavsson wrote: > >>Erlang/OTP R11B has been released as planned on May 17, 2006. >> >>You can download the full source distribution from >> >> http://www.erlang.org/download/otp_src_R11B-0.tar.gz >> >>For installation instructions please read the README that is part of >>the distribution or found here: >> >> http://www.erlang.org/download/otp_src_R11B-0.readme >> >>The Windows binary distribution can be downloaded from >> >> http://www.erlang.org/download/otp_win32_R11B-0.exe >> >>You can also download the complete HTML documentation or >>the Unix manual files: >> >> http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz >> http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz >> >>We also want to thank all that have sent us patches, suggestions and bug >>reports, >> >>The OTP Team From paulrbrown@REDACTED Wed May 17 18:42:23 2006 From: paulrbrown@REDACTED (Paul Brown) Date: Wed, 17 May 2006 09:42:23 -0700 Subject: "big" benchmark performance (was Re: Erlang/OTP R11B has been released) Message-ID: <4249453d0605170942k447c6e08t9a5c2837bb76bc24@mail.gmail.com> Hi, Ulf -- > > Erlang/OTP R11B has been released as planned on May 17, 2006. > Any explanation as to why the "big" benchmark runs 5 times faster on 4 schedulers than on one (AMD Opteron 2 dual core) and 2.8x faster on 2 cores (AMD Athlon 64 X2)? I did some fiddling with the "big" benchmark on my four-core system (2x2code, 2.5GHz PPC), and the results are here: http://mult.ifario.us/articles/2006/05/11/more-on-erlang-performance-and-threading (URL may get broken; here's a short one -- http://tinyurl.com/m75l3) The answer is that you can't think purely about hardware, as the layer below the operating system has a lot to do with the way that threads (directly correlated to Erlang schedulers) are allocated and scheduled. So, what you're seeing is that the total throughput with four schedulers is substantially higher than with two because the operating system is able to efficiently schedule four threads for execution. My $0.02 from the cheap seats. -- paulrbrown@REDACTED http://mult.ifario.us/ From rickard.s.green@REDACTED Wed May 17 18:55:55 2006 From: rickard.s.green@REDACTED (Rickard Green) Date: Wed, 17 May 2006 18:55:55 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: References: Message-ID: <446B559B.9040509@ericsson.com> Ulf Wiger (AL/EAB) wrote: > Bj?rn Gustavsson wrote: >> Erlang/OTP R11B has been released as planned on May 17, 2006. > > Any explanation as to why the "big" benchmark runs 5 times faster on 4 schedulers than on one (AMD Opteron 2 dual core) and 2.8x faster on 2 cores (AMD Athlon 64 X2)? > > /Ulf W > There is no I/0 during the big:bang test. The I/O thread of the smp emulator will be blocked in poll() during the whole test while the scheduler threads execute Erlang code. In the non smp emulator the scheduler thread also have to poll for I/O (quite frequently). This is definitely contributing, but I don't think it can explain all of it. Regards, Rickard Green, Erlang/OTP From matthias@REDACTED Wed May 17 19:38:25 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 17 May 2006 19:38:25 +0200 Subject: why does Erlang define macros reserved for the C compiler? Message-ID: <17515.24465.604700.661371@antilipe.corelatus.se> I'm looking at erts/emulator/beam/sys.h. When building Erlang, the compiler prints out a bunch of warnings about __deprecated being redefined. This seems to be C99 7.1.3 in action, i.e. identifiers starting with _ are reserved for the C compiler and C library. The defines in that file with leading underscores: __SYS_H__ _DOTS_ _VOID_ __noreturn __deprecated _POSIX_SOURCE _XOPEN_SOURCE Some of these, e.g. __deprecated, look like some sort of GCC voodoo. Does anybody know more? Matthias From matthias@REDACTED Wed May 17 19:43:04 2006 From: matthias@REDACTED (Matthias Lang) Date: Wed, 17 May 2006 19:43:04 +0200 Subject: file:position hangs when seeking off the end of a gzipped file Message-ID: <17515.24744.448548.878259@antilipe.corelatus.se> Hi, This program hangs. I didn't expect it to. One workaround is to use file:read() to do the seeking. Matthias %%---------------------------------------------------------------------- %% Test case which demonstrates an infinite hang when seeking off the end %% of gzip-compressed files. Hangs on R10B-10 and R11B-0 compiled from %% source on debian linux. %% -module(gzip_hang). -export([go/0]). filename() -> "/tmp/crash.gz". go() -> %% Create a valid gzip file {ok, F} = file:open(filename(), [write, compressed]), ok = file:write(F, "five boxing wizards jump quickly"), ok = file:close(F), %% Open it again {ok, G} = file:open(filename(), [read, compressed]), file:position(G, 123). From david.nospam.hopwood@REDACTED Wed May 17 20:42:12 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 17 May 2006 19:42:12 +0100 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: References: <144568e05e0ecf01819f681652aa90a0@elisa.ee> <446B05CE.1090702@skri.net> Message-ID: <446B6E84.1060706@blueyonder.co.uk> Matthew McDonnell wrote: >>>Do you guys have any good pro-Erlang/pro-functional programming >>>paper/articles (read propaganda) lying around somewhere? > > If you're selling the functional side of things then look at the paper > "Why Functional Programming Matters" by John Hughes > http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html Note that some of the arguments in this paper are specific to languages that support built-in lazy evaluation, which Erlang does not have. -- David Hopwood From mickael.remond@REDACTED Wed May 17 22:58:13 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 May 2006 22:58:13 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: <17515.16153.702059.482643@alkaid.it.uu.se> References: <17515.16153.702059.482643@alkaid.it.uu.se> Message-ID: <20060517205813.GA13361@memphis.process-one.net> * Mikael Pettersson [2006-05-17 17:19:53 +0200]: > Bjorn Gustavsson writes: > > Erlang/OTP R11B has been released as planned on May 17, 2006. Congratulations! That's an impressive achievement. I am looking forward playing with the new SMP feature. -- Micka?l R?mond http://www.process-one.net/ From yerl@REDACTED Thu May 18 00:15:16 2006 From: yerl@REDACTED (Yerl) Date: Thu, 18 May 2006 00:15:16 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: <20060517205813.GA13361@memphis.process-one.net> References: <17515.16153.702059.482643@alkaid.it.uu.se> <20060517205813.GA13361@memphis.process-one.net> Message-ID: <446BA074.4030501@club-internet.fr> Hi! It seems that SAE can't be built at all with this new release. With versions <= R10-10 , the below patch works perfectly. Any idea ? Best Regards, Youn?s --- otp_src_R10B-6/erts/emulator/Makefile.in 2005-05-10 17:08:05.000000000 +0200 +++ otp_src_R10B-6/erts/emulator/Makefile.in-new 2005-05-12 00:31:09.257486016 +0200 @@ -213,7 +213,7 @@ UNIX_ONLY_BUILDS = endif -all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) $(UNIX_ONLY_BUILDS) +all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) $(BINDIR)/$(EMULATOR_EXECUTABLE_SAE) $(UNIX_ONLY_BUILDS) From ssmith@REDACTED Thu May 18 02:00:29 2006 From: ssmith@REDACTED (Steve Smith) Date: Thu, 18 May 2006 10:00:29 +1000 Subject: Small Erlang bencode library In-Reply-To: References: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Message-ID: <1147910429.7733.1.camel@moth.vislab.usyd.edu.au> On Wed, 2006-05-17 at 09:58 +0200, Christian S wrote: > This is how i would build the encoder. Mainly so that I dont have to > include the type tagging > pairs when the erlang terms already have types of their own. > > bencode(List) when is_list(List) -> > [$l, [bencode(Item) || Item <- List], $e]; > bencode(Int) when is_integer(Int) -> > [$i, integer_to_list(Int), $e]; > bencode(Bin) when is_binary(Bin) -> > [integer_to_list(size(Bin)), $:, Bin]; > bencode(Dict) when element(1, Dict) == dict -> > Sorter = fun({Key1, _}, {Key2, _}) -> Key1 < Key2 end, > Pairs = [[bencode(Key), bencode(Value)] || {Key, Value} <- > lists:sort(Sorter, dict:to_list(Dict))], > [$d, Pairs, $e]. > > Dict = dict:store(<<"foo">>, 3, dict:new()). > Terms = [1,2, <<"How's this?">>, Dict]. > > Encoded = bencode:bencode(Terms). > > If you want this as a string you can do > "binary_to_list(list_to_binary(Encoded))." and get > "li1ei2e11:How's this?d3:fooi3eee" > > But the value of Encoded itself is useable, it is known as the type > iolist(), sometimes > even string() in documentation. > You can send iolist() over sockets so pre-flattening them is not > necessary. > > It appears that dict keys must be strings, the encoder should probably > crash if a key > is not. In all my whole dict encoding part suffer some code smell. > Maybe someone > else has a better alternative? > > On 5/17/06, Steve Smith wrote: > Hi, > > As a preliminary exercise in learning Erlang I've implemented > a basic > bencoding library (bencoding being the serialisation system > used in the > bittorrent protocol). The darcs repository is available > here: > > http://people.vislab.usyd.edu.au/~ssmith/erlang/bencode > > As this is my first go at declarative programming comments and > corrections are welcome. > > Cheers, > Steve > > From ssmith@REDACTED Thu May 18 02:19:19 2006 From: ssmith@REDACTED (Steve Smith) Date: Thu, 18 May 2006 10:19:19 +1000 Subject: Small Erlang bencode library In-Reply-To: References: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Message-ID: <1147911559.7733.20.camel@moth.vislab.usyd.edu.au> [There may be a blank reply with this one: I've officially had-it with Evolution now ...] On Wed, 2006-05-17 at 09:58 +0200, Christian S wrote: > This is how i would build the encoder. Hi Christian, thanks for the comments: > bencode(List) when is_list(List) -> > [$l, [bencode(Item) || Item <- List], $e]; > bencode(Int) when is_integer(Int) -> > [$i, integer_to_list(Int), $e]; > bencode(Bin) when is_binary(Bin) -> > [integer_to_list(size(Bin)), $:, Bin]; > bencode(Dict) when element(1, Dict) == dict -> > Sorter = fun({Key1, _}, {Key2, _}) -> Key1 < Key2 end, > Pairs = [[bencode(Key), bencode(Value)] || {Key, Value} <- > lists:sort(Sorter, dict:to_list(Dict))], > [$d, Pairs, $e]. My original version of the code used is_integer(), etc, but I had to move to tuples when I realised there's no reliable way to detect if a list is a string or not. I didn't know about the "element(1, Dict) == dict" trick either, that's useful. I'm not sure about the string==binary thing though, that feels like another form of tagging. Has anyone ever looked at adding stronger typing to Erlang (*strong*, not static :), eg. the ability to define new types that are checkable at runtime? At the moment it looks like people are adding their own ad-hoc typing via tagged-tuples (although matching makes this much less messy that it could be). Of course, having written my first Erlang program I now feel qualified to pick holes :) Cheers, Steve From ssmith@REDACTED Thu May 18 02:20:29 2006 From: ssmith@REDACTED (Steve Smith) Date: Thu, 18 May 2006 10:20:29 +1000 Subject: Small Erlang bencode library In-Reply-To: References: <1147836275.25022.21.camel@moth.vislab.usyd.edu.au> Message-ID: <1147911629.7733.21.camel@moth.vislab.usyd.edu.au> On Wed, 2006-05-17 at 12:00 -0400, Erik Garrison wrote: > Some time ago I heard in the erlang IRC chat about an Erlang bittorrent > client which had been begun. Thanks Erik, I'm having look at it now. The project looks pretty dead though. From sanjaya@REDACTED Thu May 18 07:51:34 2006 From: sanjaya@REDACTED (Sanjaya Vitharana) Date: Thu, 18 May 2006 11:21:34 +0530 Subject: Erlang/OTP R11B has been released References: Message-ID: <021f01c67a3f$39acebc0$9a0a10ac@wavenet.lk> 1.) http://www.erlang.org/ml-archive/erlang-questions/200510/msg00069.html Has this bug fixed in this release ? 2.) http://www.erlang.org/ml-archive/erlang-questions/200601/msg00380.html What happend to the rdbms which hope to release with OTP R11? Thanks, Sanjaya Vitharana ----- Original Message ----- From: "Bjorn Gustavsson" To: ; Sent: Wednesday, 17 May 2006 06:21 pm Subject: Erlang/OTP R11B has been released > Erlang/OTP R11B has been released as planned on May 17, 2006. > > You can download the full source distribution from > > http://www.erlang.org/download/otp_src_R11B-0.tar.gz > > For installation instructions please read the README that is part of > the distribution or found here: > > http://www.erlang.org/download/otp_src_R11B-0.readme > > The Windows binary distribution can be downloaded from > > http://www.erlang.org/download/otp_win32_R11B-0.exe > > You can also download the complete HTML documentation or > the Unix manual files: > > http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz > http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz > > We also want to thank all that have sent us patches, suggestions and bug > reports, > > The OTP Team > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > From bjorn@REDACTED Wed May 17 14:51:14 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 17 May 2006 14:51:14 +0200 Subject: Erlang/OTP R11B has been released Message-ID: Erlang/OTP R11B has been released as planned on May 17, 2006. You can download the full source distribution from http://www.erlang.org/download/otp_src_R11B-0.tar.gz For installation instructions please read the README that is part of the distribution or found here: http://www.erlang.org/download/otp_src_R11B-0.readme The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R11B-0.exe You can also download the complete HTML documentation or the Unix manual files: http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz We also want to thank all that have sent us patches, suggestions and bug reports, The OTP Team -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From b88zhou@REDACTED Wed May 17 19:40:31 2006 From: b88zhou@REDACTED (Brian Zhou) Date: Wed, 17 May 2006 17:40:31 +0000 (UTC) Subject: Erlang/OTP R11B has been released References: Message-ID: Bjorn Gustavsson erix.ericsson.se> writes: > > Erlang/OTP R11B has been released as planned on May 17, 2006. > > ... > > The OTP Team > Excellent news. However it seems SAE is broken: ... echo "compile:file(fake_error_handler), halt()." | erl Eshell V5.5 (abort with ^G) 1> ./fake_error_handler.erl:39: Warning: variable 'Other' is unused ./fake_error_handler.erl:42: Warning: variable 'Other' is unused ./fake_error_handler.erl:53: Warning: variable 'Other' is unused ./fake_error_handler.erl:55: Warning: variable 'Other' is unused ./fake_error_handler.erl:70: Warning: variable 'Current' is unused echo "compile:file(fake_demand_init), halt()." | erl Eshell V5.5 (abort with ^G) 1> echo "boot_tools:make_tools(), halt()." | erl -env ERL_BEAM_EVM /home/slug/optware/nslu2/builds/erlang-host/bin/i686-pc-linux-gnu/beam_evm Eshell V5.5 (abort with ^G) 1> done done Packing: /home/slug/optware/nslu2/builds/erlang-host/lib/stdlib Packing: /home/slug/optware/nslu2/builds/erlang-host/lib/kernel Packing: /home/slug/optware/nslu2/builds/erlang-host/lib/compiler echo "erlang.ear, ecc, and elink have been made" erlang.ear, ecc, and elink have been made ecc -W escript.erl make[1]: *** [escript.beam] Segmentation fault make[1]: Leaving directory `/home/slug/optware/nslu2/builds/erlang-host/erts/boot/src' -Brian Zhou From mattias.wadman@REDACTED Wed May 17 23:42:14 2006 From: mattias.wadman@REDACTED (Mattias Wadman) Date: Wed, 17 May 2006 23:42:14 +0200 Subject: Erlang bittorrent tracker Message-ID: <446B98B6.3000204@galaxen.se> Hello I have for some time experimenting with a bittorrent tracker in erlang, and after seeing some discussions on the list about bittorrent i thought it probably time to let other interested people have a look at it. Have not been tested very much, but have successfully been used to transfer filer between 5-6 computers running uTorrent and the official bittorrent client. I uses yaws as HTTP server to handle client requests. It also has a web interface but not sure it will work with an unmodified yaws, have done a small modification to make it possible to generate leaf tags with attributes from ehtml (for example instead of . Tell me if you want the patch. http://people.fulkod.net/mattias/fultracker.tar.gz All kinds of comments are very welcome. -Mattias From bjorn@REDACTED Thu May 18 09:43:49 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 May 2006 09:43:49 +0200 Subject: SAE (Was: Erlang/OTP R11B has been released) In-Reply-To: <446BA074.4030501@club-internet.fr> References: <17515.16153.702059.482643@alkaid.it.uu.se> <20060517205813.GA13361@memphis.process-one.net> <446BA074.4030501@club-internet.fr> Message-ID: We don't support SAE and has not supported it for a long time. It just happened to work in R10B. Our intention was to sometime make SAE work properly and support it, but there has always been other things with much higher priority on our to-do-list. Don't hold your breath. /Bjorn Yerl writes: > Hi! > It seems that SAE can't be built at all with this new release. > With versions <= R10-10 , the below patch works perfectly. > Any idea ? > > Best Regards, > Youn?s > > --- otp_src_R10B-6/erts/emulator/Makefile.in 2005-05-10 > 17:08:05.000000000 +0200 > +++ otp_src_R10B-6/erts/emulator/Makefile.in-new 2005-05-12 > 00:31:09.257486016 +0200 > @@ -213,7 +213,7 @@ > UNIX_ONLY_BUILDS = > endif > -all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) > $(UNIX_ONLY_BUILDS) > +all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) > $(BINDIR)/$(EMULATOR_EXECUTABLE_SAE) $(UNIX_ONLY_BUILDS) > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Thu May 18 09:45:40 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 18 May 2006 09:45:40 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: <446B4335.4030507@comcast.net> References: <446B4335.4030507@comcast.net> Message-ID: Sorry for that. When we received the patch, we were quite busy resolving other issues, so we decided to postpone including it. It will be probably be included in R11B-1. /Bjorn Ernie Makris writes: > Hi Erlangers, > > This is great news! > > However, the linux 2.6 (FC3,4...) run_erl patch is still not there. > > -0> ./run_erl tmp/ tmp "~/dev/erlang/otp_src_R11B-0/bin/erl" > run_erl [29481] Wed May 17 11:22:16 2006 > Could not open pty master > > openpty must be used. Is there any way to get this in. I don't mind > patching my local copy each time, > but some other people are having the same issues. My test system is a > FC4 SMP system. > > Another welcome addition would be to allow the file_driver to open a > device like /dev/urandom. > I also patch my local build to allow this as well. I welcome feedback on > this. I know the file_driver is built so that > it should not block under normal circumstances and thats why device > opens are not allowed. There is a special > case in there for /dev/null, and I always add my own(in unix_efile.c) > for /dev/urandom. > > Should there be a patchset system created for erlang if these types are > changes are not wanted by the erlang powers that be.To make it > convenient for people to share and test patches. > > Thanks > Ernie > > Bjorn Gustavsson wrote: > > Erlang/OTP R11B has been released as planned on May 17, 2006. > > > > You can download the full source distribution from > > > > http://www.erlang.org/download/otp_src_R11B-0.tar.gz > > > > For installation instructions please read the README that is part of > > the distribution or found here: > > > > http://www.erlang.org/download/otp_src_R11B-0.readme > > > > The Windows binary distribution can be downloaded from > > > > http://www.erlang.org/download/otp_win32_R11B-0.exe > > > > You can also download the complete HTML documentation or > > the Unix manual files: > > > > http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz > > http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz > > > > We also want to thank all that have sent us patches, suggestions and bug > > reports, > > > > The OTP Team > > > > > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bertil.karlsson@REDACTED Thu May 18 09:48:41 2006 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Thu, 18 May 2006 09:48:41 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: <021f01c67a3f$39acebc0$9a0a10ac@wavenet.lk> References: <021f01c67a3f$39acebc0$9a0a10ac@wavenet.lk> Message-ID: <446C26D9.2040506@ericsson.com> Sanjaya Vitharana wrote: > 1.) > http://www.erlang.org/ml-archive/erlang-questions/200510/msg00069.html > > Has this bug fixed in this release ? > > > Yes /Bertil From bengt.kleberg@REDACTED Thu May 18 10:09:22 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 18 May 2006 10:09:22 +0200 Subject: timer:sleep bug? In-Reply-To: <00c601c679bf$7d47cdd0$1c00a8c0@bp2> References: <00c601c679bf$7d47cdd0$1c00a8c0@bp2> Message-ID: <446C2BB2.5010508@ericsson.com> On 2006-05-17 16:37, Bernardo Paroli wrote: > Hi, > I've been testing the timer:sleep/1 function and I have some troubles > with some values passed to the function. In the test I start n process > and each process make a loop sleeping for x milliseconds. Below I show > the example. > If I run the test with sleepTest:start(100, 999) the test work fine, but > if I run with sleepTest(100, 1000) the erlang process consume 100% cpu :( > Is this a bug? Why with 999 milliseconds work fine and with 1000 > milliseconds no? > > In ran the test in a Windows XP with Erlang v5.4 there is no problem with this program on solaris 8 with erlang 5.4.12 bengt From bengt.kleberg@REDACTED Thu May 18 10:28:37 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 18 May 2006 10:28:37 +0200 Subject: file:position hangs when seeking off the end of a gzipped file In-Reply-To: <17515.24744.448548.878259@antilipe.corelatus.se> References: <17515.24744.448548.878259@antilipe.corelatus.se> Message-ID: <446C3035.10800@ericsson.com> On 2006-05-17 19:43, Matthias Lang wrote: > Hi, > > This program hangs. I didn't expect it to. ...deleted > {ok, G} = file:open(filename(), [read, compressed]), > file:position(G, 123). it might be worth mentioning that file:pread/3 also hangs during these circumstances (compressed file smaller than asked-for read position). and that it does not help to use raw mode. bengt From thomasl_erlang@REDACTED Thu May 18 10:36:40 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 18 May 2006 01:36:40 -0700 (PDT) Subject: Yeti (was Re: Small Erlang bencode library) In-Reply-To: <1147911559.7733.20.camel@moth.vislab.usyd.edu.au> Message-ID: <20060518083640.19605.qmail@web38814.mail.mud.yahoo.com> --- Steve Smith wrote: > Has anyone ever looked at adding stronger typing to > Erlang (*strong*, > not static :), eg. the ability to define new types > that are checkable at > runtime? Yes. I've written a system, Yeti, which permits you to define complex types that are checked at runtime. Definitions are written down inside your module and look a bit like those in the Erlang man pages, a bit like EDoc, and a bit like Python decorators: %% io_list() is a list of bytes, binaries and %% other io_lists. @type io_list() ::= [(byte() | binary() | io_list())]. %% foo/1 takes an io_list() as argument, returns %% unknown type. @spec foo(io_list()) -> @. Note that these types are both more and less general than ordinary polymorphic, algebraic types. These definitions are turned into two things: - foo/1 is decorated with type checks on input and output - io_list() is made accessible via a new function family, type_info/N So foo/1 checks its input. But you can also perform an ad hoc type check like this: 5> my_module:type_info(io_list, X). false 6> This sort of type checking can be handy, but can of course also have a great deal of overhead when data are being checked repeatedly. Yeti optimizes the generated type checking functions already, and I think one can reduce the cost at compile-time with a bit of cleverness. But the general problem is likely to remain. A benefit I didn't see when I started: it can be quite useful just to have a library of "types" available when debugging or even developing. A nice future extension might be to permit calls to type checking functions in guards: @type string() ::= [byte()]. foo(X) when string(X) -> ...; foo(a) -> ...; ... Yeti has a number of other features too, but "this message is too short to describe them" :-) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From bengt.kleberg@REDACTED Thu May 18 10:37:04 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 18 May 2006 10:37:04 +0200 Subject: why does Erlang define macros reserved for the C compiler? In-Reply-To: <17515.24465.604700.661371@antilipe.corelatus.se> References: <17515.24465.604700.661371@antilipe.corelatus.se> Message-ID: <446C3230.4060308@ericsson.com> On 2006-05-17 19:38, Matthias Lang wrote: > I'm looking at erts/emulator/beam/sys.h. ...deleted > _POSIX_SOURCE > _XOPEN_SOURCE > Does anybody know more? if the question included the ones above then these 2 are feature test macros. eg, if you want to compile a file so that it only depends upon posix limits (and no implementation-defined limits) you should define _POSIX_SOURCE. bengt From mickael.remond@REDACTED Wed May 17 22:58:13 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 17 May 2006 22:58:13 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: <17515.16153.702059.482643@alkaid.it.uu.se> References: <17515.16153.702059.482643@alkaid.it.uu.se> Message-ID: <20060517205813.GA13361@memphis.process-one.net> * Mikael Pettersson [2006-05-17 17:19:53 +0200]: > Bjorn Gustavsson writes: > > Erlang/OTP R11B has been released as planned on May 17, 2006. Congratulations! That's an impressive achievement. I am looking forward playing with the new SMP feature. -- Micka?l R?mond http://www.process-one.net/ From mikpe@REDACTED Wed May 17 17:19:53 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Wed, 17 May 2006 17:19:53 +0200 Subject: Erlang/OTP R11B has been released In-Reply-To: References: Message-ID: <17515.16153.702059.482643@alkaid.it.uu.se> Bjorn Gustavsson writes: > Erlang/OTP R11B has been released as planned on May 17, 2006. The documentation highlights for R11B-0 state that: >The Erlang VM with SMP support has been tested on the following platforms: > > * Solaris 10 sparc > * Suse Linux (SLES 9) x86 > * Mac OSx PPC In addition to the platforms listed above, the HiPE team has been testing the SMP system on: * Solaris 9 on SPARC and x86 * YellowDog Linux 4.1 on PowerPC * Fedora Core 3 and 4 Linux on x86 and x86-64 * Fedora Core 5 Linux on x86 /Mikael From ulf.wiger@REDACTED Thu May 18 11:11:27 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 18 May 2006 11:11:27 +0200 Subject: Small Erlang bencode library Message-ID: Steve Smith wrote: > > [...] > > bencode(Dict) when element(1, Dict) == dict -> > > Sorter = fun({Key1, _}, {Key2, _}) -> Key1 < Key2 end, > > Pairs = [[bencode(Key), bencode(Value)] || {Key, Value} <- > > lists:sort(Sorter, dict:to_list(Dict))], > > [$d, Pairs, $e]. > > My original version of the code used is_integer(), etc, but I > had to move to tuples when I realised there's no reliable way > to detect if a list is a string or not. Yes, this is a bit tricky. Joe Armstrong has played with the following convention in the past (e.g. in his UBF implementation): s(Str) -> {'#S', Str}. -define(S(Str), {'#S',Str}). start(Nick) -> ... {reply,{ok,_}, _} = rpc(Pid, {startService, s("irc_server"), []}), ... case rpc(Pid, {nick, s(Nick)}) of {reply, false, _} -> ... {reply, true, active} -> ... end, ... handlerRpc(active, {nick, ?S(New)}, Nick, Manager) -> case ask_manager(Manager, {change_nick,Nick,New,self()}) of ok -> {true, active, New}; error -> {false, active, Nick} end; Basically, s(string()) constructs a string object, and ?S(Str) matches on the string value. > I didn't know about the "element(1, Dict) == dict" > trick either, that's useful. ... but a violation of the common convention that you don't peek into undocumented data structures, just because you can. :) I was going to suggest that you use orddict instead of dict, partly to eliminate the need for sorting. Also, I'd stick with the tagging. > Has anyone ever looked at adding stronger typing to Erlang > (*strong*, not static :), eg. the ability to define new types > that are checkable at runtime? At the moment it looks like > people are adding their own ad-hoc typing via tagged-tuples > (although matching makes this much less messy that it could be). There have been several attempts at adding typing to Erlang. The success of Dialyzer has changed the landscape quite a bit, since dealing with types in Erlang is suddenly almost comme il faut. BR, Ulf W From ulf.wiger@REDACTED Thu May 18 11:40:54 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 18 May 2006 11:40:54 +0200 Subject: Erlang/OTP R11B has been released Message-ID: Sanjaya Vitharana wrote: > > 2.) > http://www.erlang.org/ml-archive/erlang-questions/200601/msg00380.html > > What happend to the rdbms which hope to release with OTP R11? > > Thanks, > > Sanjaya Vitharana They were excluded primarily due to lack of time - not just for testing, but also for figuring out whether they are actually the *right* thing to do. Actual "field testing" of rdbms got started a bit too late to flush out the bugs before R11 (I have a very helpful beta tester now). Finally, the rdbms patches can be divided into different categories: 1) reasonably straightforward: the hooks into the transaction handling 2) more difficult to evaluate: the table loading hooks 3) perhaps questionable: the hooks for defining new table types. Re. (2), it's important to understand whether the proposed changes would interfere with ways of making normal table loading and synchronization faster. Re. (3), one drawback was that crashes in the "external_copies" callbacks would cause mnesia to dump core. Perhaps this is unavoidable - desirable even? Another thing to look into is of course whether that particular interface is well suited to e.g. BDB. More experimentation is needed. It should be noted that external_copies is labeled as "experimental" even in rdbms. Regards, Ulf W From matthias@REDACTED Thu May 18 12:07:34 2006 From: matthias@REDACTED (Matthias Lang) Date: Thu, 18 May 2006 12:07:34 +0200 Subject: why does Erlang define macros reserved for the C compiler? In-Reply-To: <17515.24465.604700.661371@antilipe.corelatus.se> References: <17515.24465.604700.661371@antilipe.corelatus.se> Message-ID: <17516.18278.225598.740568@antilipe.corelatus.se> Attempting to answer my own question. A clue from Bengt and some googling gave me an answer for most of the defines. At least some of them are GCC voodoo: http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/Variable-Attributes.html#index-g_t_0040code_007bdeprecated_007d-attribute-1792 Grepping for the __deprecated that started me wondering reveals that it's only used in erts/emulator/beam/erl_alloc.h, to mark deprecated functions. Conclusion: the warning can be ignored. It could be eliminated by testing for an existing definition before redefining it. I still don't know why the __SYS_H__ is there. For header files in the C library, it makes perfect sense to be using names with leading underscores---they're reserved, so you can be sure you don't screw up the user's namespace. Using it in Erlang, on the other hand, makes no sense. It's probably just historical cruft. Matthias -------------------- Matthias Lang writes: > > I'm looking at erts/emulator/beam/sys.h. > > When building Erlang, the compiler prints out a bunch of warnings > about __deprecated being redefined. This seems to be C99 7.1.3 in > action, i.e. identifiers starting with _ are reserved for the C > compiler and C library. > > The defines in that file with leading underscores: > > __SYS_H__ > _DOTS_ > _VOID_ > __noreturn > __deprecated > _POSIX_SOURCE > _XOPEN_SOURCE > > Some of these, e.g. __deprecated, look like some sort of GCC > voodoo. Does anybody know more? > > Matthias From chaitanya.chalasani@REDACTED Thu May 18 12:27:12 2006 From: chaitanya.chalasani@REDACTED (Chaitanya Chalasani) Date: Thu, 18 May 2006 15:57:12 +0530 Subject: Oracle on Linux In-Reply-To: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> Message-ID: <200605181557.12584.chaitanya.chalasani@gmail.com> On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > Folks, > > Is anyone using Oracle with Erlang on Linux? Are you using a > commercial ODBC driver? > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > Thanks, Joel > > -- > http://wagerlabs.com/ I am away from my office all there days. The day I am back I will share the source. I have already got the nod from my manager.:) -- Chaitanya Chalasani ------------------- "The ultimate truths of nature are so subtle that they can be revealed only under immense silence" From ernie.makris@REDACTED Thu May 18 12:37:34 2006 From: ernie.makris@REDACTED (Ernie Makris) Date: Thu, 18 May 2006 06:37:34 -0400 Subject: Erlang/OTP R11B has been released In-Reply-To: References: <446B4335.4030507@comcast.net> Message-ID: <446C4E6E.3070109@comcast.net> Hi Bjorn, No problem. Thanks for the status, and thanks for the release. SMP is a gem. Thanks Ernie Bjorn Gustavsson wrote: > Sorry for that. When we received the patch, we were quite busy resolving > other issues, so we decided to postpone including it. It will be probably > be included in R11B-1. > > /Bjorn > > Ernie Makris writes: > > >> Hi Erlangers, >> >> This is great news! >> >> However, the linux 2.6 (FC3,4...) run_erl patch is still not there. >> >> -0> ./run_erl tmp/ tmp "~/dev/erlang/otp_src_R11B-0/bin/erl" >> run_erl [29481] Wed May 17 11:22:16 2006 >> Could not open pty master >> >> openpty must be used. Is there any way to get this in. I don't mind >> patching my local copy each time, >> but some other people are having the same issues. My test system is a >> FC4 SMP system. >> >> Another welcome addition would be to allow the file_driver to open a >> device like /dev/urandom. >> I also patch my local build to allow this as well. I welcome feedback on >> this. I know the file_driver is built so that >> it should not block under normal circumstances and thats why device >> opens are not allowed. There is a special >> case in there for /dev/null, and I always add my own(in unix_efile.c) >> for /dev/urandom. >> >> Should there be a patchset system created for erlang if these types are >> changes are not wanted by the erlang powers that be.To make it >> convenient for people to share and test patches. >> >> Thanks >> Ernie >> >> Bjorn Gustavsson wrote: >> >>> Erlang/OTP R11B has been released as planned on May 17, 2006. >>> >>> You can download the full source distribution from >>> >>> http://www.erlang.org/download/otp_src_R11B-0.tar.gz >>> >>> For installation instructions please read the README that is part of >>> the distribution or found here: >>> >>> http://www.erlang.org/download/otp_src_R11B-0.readme >>> >>> The Windows binary distribution can be downloaded from >>> >>> http://www.erlang.org/download/otp_win32_R11B-0.exe >>> >>> You can also download the complete HTML documentation or >>> the Unix manual files: >>> >>> http://www.erlang.org/download/otp_doc_html_R11B-0.tar.gz >>> http://www.erlang.org/download/otp_doc_man_R11B-0.tar.gz >>> >>> We also want to thank all that have sent us patches, suggestions and bug >>> reports, >>> >>> The OTP Team >>> >>> >>> > > From chris@REDACTED Thu May 18 14:43:42 2006 From: chris@REDACTED (Christophe Romain) Date: Thu, 18 May 2006 14:43:42 +0200 Subject: smp and kernel poll Message-ID: Hello, in erts/emulator/sys/unix/sys.c:37 we can see #if defined(ERTS_SMP) && defined(USE_KERNEL_POLL) # error "smp support and kernel poll currently not supported (use poll)" #endif I would like to apply epoll patch from sipphone http://developer.sipphone.com/ejabberd/erlang_epoll_patch/ and I wonder if there is an issue with SMP. From rickard.s.green@REDACTED Thu May 18 14:57:16 2006 From: rickard.s.green@REDACTED (Rickard Green) Date: Thu, 18 May 2006 14:57:16 +0200 Subject: smp and kernel poll In-Reply-To: References: Message-ID: <446C6F2C.1050104@ericsson.com> Kernel poll with the non-smp emulator should work as before. We haven't implemented support for kernel poll and smp (we probably will in the future). Kernel poll is automatically disabled when building the smp emulator, i.e., --enable-kernel-poll will enable kernel poll on the non-smp emulator but wont affect the smp emulator. BR, Rickard Green, Erlang/OTP Christophe Romain wrote: > Hello, > > in erts/emulator/sys/unix/sys.c:37 we can see > #if defined(ERTS_SMP) && defined(USE_KERNEL_POLL) > # error "smp support and kernel poll currently not supported (use poll)" > #endif > > I would like to apply epoll patch from sipphone > http://developer.sipphone.com/ejabberd/erlang_epoll_patch/ > and I wonder if there is an issue with SMP. > > From mikpe@REDACTED Thu May 18 15:02:59 2006 From: mikpe@REDACTED (Mikael Pettersson) Date: Thu, 18 May 2006 15:02:59 +0200 Subject: smp and kernel poll In-Reply-To: References: Message-ID: <17516.28803.502856.671689@alkaid.it.uu.se> Christophe Romain writes: > in erts/emulator/sys/unix/sys.c:37 we can see > #if defined(ERTS_SMP) && defined(USE_KERNEL_POLL) > # error "smp support and kernel poll currently not supported (use > poll)" > #endif > > I would like to apply epoll patch from sipphone > http://developer.sipphone.com/ejabberd/erlang_epoll_patch/ > and I wonder if there is an issue with SMP. If I remember correctly from our SMP task group meetings, the issue is not that epoll causes breakage, but that unix/sys.c is an #ifdef mess so we want to limit the number of APIs we use. One plan that was mentioned was to standardise on one API in sys.c (say poll()) and to emulate it if e.g. select() or epoll() is the underlying API, but that emulation is probably not implemented yet. /Mikael From rpettit@REDACTED Thu May 18 15:05:43 2006 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 18 May 2006 08:05:43 -0500 Subject: why does Erlang define macros reserved for the C compiler? In-Reply-To: <446C3230.4060308@ericsson.com> References: <17515.24465.604700.661371@antilipe.corelatus.se> <446C3230.4060308@ericsson.com> Message-ID: <20060518130543.GA20185@vailsys.com> On Thu, May 18, 2006 at 10:37:04AM +0200, Bengt Kleberg wrote: > On 2006-05-17 19:38, Matthias Lang wrote: > >I'm looking at erts/emulator/beam/sys.h. > > ...deleted > > _POSIX_SOURCE > > _XOPEN_SOURCE > > > Does anybody know more? > > if the question included the ones above then these 2 are feature test > macros. eg, if you want to compile a file so that it only depends upon > posix limits (and no implementation-defined limits) you should define > _POSIX_SOURCE. For more information you can checkout: "Advanced UNIX Programming 2nd Edition" by Rochkind and/or http://www.unix.org/version3/ If you want to ask the compiler to enforce compliance with one of the many standards (e.g. POSIX1988, POSIX1990, POSIX1993, POSIX1996, XPG3, SUS1, SUS2, SUS3) you must communicate with the compiler via macros. To tell the compiler what you want you set various macros (e.g. _POSIX_SOURCE), and to get feedback from the compiler on what is available you check for various macros set by the compiler (e.g. _POSIX_VERSION). Of course there is a nasty catch summarized in AUP2Ed by Rochkind: "Systems like FreeBSD and Darwin are pretty conservative in their claims of POSIX conformance, yet they're much more complete than pure POSIX1988 or POSIX1990 system, which included neither socket-style networking nor SystemV IPC. FreeBSD has those features, which mostly work just as they're supposed to, and lots more." So, on those systems if you write text-book standards compliant code you might not be able to take advantage of features which they support (like sockets). As a result it would appear as though writing standards-compliant code is much more difficult/tricky than many people are aware (myself included prior to reading what a mess it often becomes). -Rick From goertzen@REDACTED Thu May 18 16:29:14 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Thu, 18 May 2006 09:29:14 -0500 Subject: why does Erlang define macros reserved for the C compiler? In-Reply-To: <17516.18278.225598.740568@antilipe.corelatus.se> References: <17515.24465.604700.661371@antilipe.corelatus.se> <17516.18278.225598.740568@antilipe.corelatus.se> Message-ID: <446C84BA.7060709@ertw.com> Attached a patch that I use deal with the warnings. Cheers, Dan. Matthias Lang wrote: > Attempting to answer my own question. > > A clue from Bengt and some googling gave me an answer for most of the > defines. At least some of them are GCC voodoo: > > http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/Variable-Attributes.html#index-g_t_0040code_007bdeprecated_007d-attribute-1792 > > Grepping for the __deprecated that started me wondering reveals that > it's only used in erts/emulator/beam/erl_alloc.h, to mark deprecated > functions. > > Conclusion: the warning can be ignored. It could be eliminated by > testing for an existing definition before redefining it. > > I still don't know why the __SYS_H__ is there. For header files in the > C library, it makes perfect sense to be using names with leading > underscores---they're reserved, so you can be sure you don't screw up > the user's namespace. Using it in Erlang, on the other hand, makes > no sense. It's probably just historical cruft. > > Matthias > > -------------------- > > Matthias Lang writes: > > > > I'm looking at erts/emulator/beam/sys.h. > > > > When building Erlang, the compiler prints out a bunch of warnings > > about __deprecated being redefined. This seems to be C99 7.1.3 in > > action, i.e. identifiers starting with _ are reserved for the C > > compiler and C library. > > > > The defines in that file with leading underscores: > > > > __SYS_H__ > > _DOTS_ > > _VOID_ > > __noreturn > > __deprecated > > _POSIX_SOURCE > > _XOPEN_SOURCE > > > > Some of these, e.g. __deprecated, look like some sort of GCC > > voodoo. Does anybody know more? > > > > Matthias > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: deprecated.patch URL: From james.hague@REDACTED Thu May 18 19:07:22 2006 From: james.hague@REDACTED (James Hague) Date: Thu, 18 May 2006 12:07:22 -0500 Subject: Erlang/OTP R11B has been released In-Reply-To: <446C4E6E.3070109@comcast.net> References: <446B4335.4030507@comcast.net> <446C4E6E.3070109@comcast.net> Message-ID: SMP: Yay! This is huge! Windows quibble: *Still* no saving of window position and size! It's a pretty easy fix (I was gonna do it myself, but it sounded like it was already in the works). From goertzen@REDACTED Thu May 18 19:25:50 2006 From: goertzen@REDACTED (Daniel Goertzen) Date: Thu, 18 May 2006 12:25:50 -0500 Subject: SIGCHLD crashes beam In-Reply-To: <20060518130543.GA20185@vailsys.com> References: <17515.24465.604700.661371@antilipe.corelatus.se> <446C3230.4060308@ericsson.com> <20060518130543.GA20185@vailsys.com> Message-ID: <446CAE1E.6030301@ertw.com> I am trying to make a cross compiled erlang work, x86_64 to x86. It appears to compile fine but segfaults as soon as I run "erl" from the command line. After some tracing, I note that the beam process segfaults immediately after receiving a SIGCHLD. The SIGCHLD is created by an exiting inet_gethost process. This signal handler does *not* appear to run: erts/emulator/sys/unix/sys.c:843 /* Handle SIGCHLD signals. */ #if (defined(SIG_SIGSET) || defined(SIG_SIGNAL)) static RETSIGTYPE onchld(void) #else static RETSIGTYPE onchld(int signum) #endif { #if CHLDWTHR ASSERT(0); /* We should *never* catch a SIGCHLD signal */ #else children_died = 1; #endif } I note that check_children() at line 3283 does get called some time prior to crashing. I am continuing to debug, but I thought I'd throw this out now in case anyone can recognize what is happening and help me out. Version is R10B-10. Thanks, Dan. From matsola.persson@REDACTED Thu May 18 22:12:56 2006 From: matsola.persson@REDACTED (Mats-Ola Persson) Date: Thu, 18 May 2006 22:12:56 +0200 Subject: Pro-Erlang/pro-functional programming papers In-Reply-To: <446B6E84.1060706@blueyonder.co.uk> References: <144568e05e0ecf01819f681652aa90a0@elisa.ee> <446B05CE.1090702@skri.net> <446B6E84.1060706@blueyonder.co.uk> Message-ID: <7D640DCA-3007-4714-B1C4-021890835258@gmail.com> Hi, I have assembled the links that you sent me (I also added a few of my own) and made them available on http://www.polli.se/homepage/ Propaganda.html Drop me a line if you miss any article(s) Regards, Mats-Ola 17 maj 2006 kl. 20.42 skrev David Hopwood: > Matthew McDonnell wrote: >>>> Do you guys have any good pro-Erlang/pro-functional programming >>>> paper/articles (read propaganda) lying around somewhere? >> >> If you're selling the functional side of things then look at the >> paper >> "Why Functional Programming Matters" by John Hughes >> http://www.cs.chalmers.se/~rjmh/Papers/whyfp.html > > Note that some of the arguments in this paper are specific to > languages > that support built-in lazy evaluation, which Erlang does not have. > > -- > David Hopwood > > From robert.virding@REDACTED Thu May 18 22:19:18 2006 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 18 May 2006 22:19:18 +0200 Subject: Erlog - a prolog interpreter written in, and for, Erlang In-Reply-To: References: Message-ID: <446CD6C6.10102@telia.com> Well, I could give you the names of a few good books. :-) But, ok, I could give a few examples and show how to run them from within Erlang. The shell is a toy. I'll get on to it. It will take a week as I am taking a little holiday. Robert Joe Armstrong (AL/EAB) wrote: > Hi Robert, > > Quite a resonable subset :-) > > Are you thinking of adding some *simple* examples? > > I was thinking of something like the good 'ol father and sons > that all prolog texts have? > > /Joe > > > >>-----Original Message----- >>From: owner-erlang-questions@REDACTED >>[mailto:owner-erlang-questions@REDACTED] On Behalf Of Robert Virding >>Sent: den 16 maj 2006 00:33 >>To: erlang-questions@REDACTED >>Subject: Erlog - a prolog interpreter written in, and for, Erlang >> >>One thing that I have always thought was missing in Erlang >>was a Prolog interpreter. I have now rectified that. >> >>Erlog is a prolog interpreter written in Erlang that can be >>called from Erlang and can call Erlang. It is the perfect >>tool when you need a logic inference engine within your >>application. Now you can finally search ETS databases as God intended. >> >>Erlog implements a subset, most of the good bits at least, of >>standard prolog and is reasonably conforming. It is easy to >>interface with the rest of Erlang as prolog terms have a very >>straightforward representation. >> >>There is also a simple prolog parser based on Erlang tokens >>and a Yecc parser which is used for loading prolog programs. >>Note because of a bug in Yecc you cannot directly compile the >>.erl file generated by yecc. A fixed version is included. >> >>There is also a man page describing the system, ad of course the code. >> >>Enjoy, >>Robert >> > > From vladdu55@REDACTED Fri May 19 08:37:13 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 May 2006 08:37:13 +0200 Subject: Dialyzer: report call to undefined function Message-ID: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> hi all, I think it would be useful if Dialyzer would also report calls to undefined or unexported functions. I often spell names wrong :-) Dialyzer certainly has all the information needed, it can't generate false positive and it already reports calls where argument types don't match the actual types (which is more advanced). [Aside] How difficult would it be to make Dialyzer work incrementally? I mean that it should be possible to build the internal tables by adding and removing modules from them, without having to reread everything else. The analysis needs a global approach, but for a large project, reading the files takes the large chunk of the time. best regards, Vlad From samuel@REDACTED Fri May 19 09:05:19 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 19 May 2006 09:05:19 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> References: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> Message-ID: <20060519070519.GA30677@nodo2.lambdastream.com> Vlad Dumitrescu wrote: > I think it would be useful if Dialyzer would also report calls to > undefined or unexported functions. I often spell names wrong :-) If you are eager enough, you can already do that with xref. xref:start(xref_example). xref:add_release(xref_example, code:lib_dir(), [{verbose, false}, {warnings, false}, {name, otp}]). xref:add_application(xref_example, YourAppPath, [{name, YourAppName}]). xref:q(xref_example, "(XC - UC) | ((Fun) YourAppName : App) || (XU - X - B)"). Maybe there is a simpler way, but that works for me :) Regards -- Samuel From ulf.wiger@REDACTED Fri May 19 09:14:31 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 19 May 2006 09:14:31 +0200 Subject: Dialyzer: report call to undefined function Message-ID: Vlad Dumitrescu wrote: > > I think it would be useful if Dialyzer would also report > calls to undefined or unexported functions. I often spell > names wrong :-) Agreed. Our local patched version of Dialyzer does this. I think the initial assumption was that there are other tools that do this for you, but we felt that since Dialyzer has the information, it might as well present it. > [Aside] How difficult would it be to make Dialyzer work > incrementally? Difficult - alas. We played with this quite a lot, since we have lots and lots of erlang code in a fairly slow version control system. Running Dialyzer on the ClearCase repository took about an hour per subsystem... What we did was to prune the PLT, removing all modules that depended on the ones being analysed. But the approach that finally became useful was to incorporate Dialyzer in our simulated environment, and running it on all code currently loaded (we use -embedded code loading). This, together with some optimizations in the call graph etc., brought the time for a full system analysis down to 3 minutes (running in the background). Fredrik Svahn, one of our section managers, did some really good work there. > I mean that it should be possible to build the internal > tables by adding and removing modules from them, without > having to reread everything else. The analysis needs a global > approach, but for a large project, reading the files takes > the large chunk of the time. There are some pitfalls, though, and there is also the risk that incremental analysis will give a false sense of security. /Ulf (speaking as one who spent significant time trying to muscle in incremental analysis into Dialyzer. ;-) From vladdu55@REDACTED Fri May 19 09:29:40 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 May 2006 09:29:40 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: References: Message-ID: <95be1d3b0605190029l28ab28e8l2c69dff7d5d6be5d@mail.gmail.com> Thanks for the reply! I'm thinking ahead for things to integrate into Erlide (probably was obvious? :-) and would very much like to be able to use as much "stock code" as possible, because we have already patched versions of the scanner, parser and syntax_tools. I don't feel very comfortable having to maintain more and more variants of OTP code. I'll keep in mind what you said, and when Dialyzer integration will become the current feature to implement, I'll get back to check if your patches made it to the release or if you could consider sharing them. best regards, Vlad On 5/19/06, Ulf Wiger (AL/EAB) wrote: > > Vlad Dumitrescu wrote: > > > > I think it would be useful if Dialyzer would also report > > calls to undefined or unexported functions. I often spell > > names wrong :-) > > Agreed. Our local patched version of Dialyzer does this. > > I think the initial assumption was that there are other > tools that do this for you, but we felt that since Dialyzer > has the information, it might as well present it. > > > > [Aside] How difficult would it be to make Dialyzer work > > incrementally? > > Difficult - alas. > We played with this quite a lot, since we have lots and lots > of erlang code in a fairly slow version control system. > Running Dialyzer on the ClearCase repository took about an > hour per subsystem... > > What we did was to prune the PLT, removing all modules > that depended on the ones being analysed. > > But the approach that finally became useful was to incorporate > Dialyzer in our simulated environment, and running it on all > code currently loaded (we use -embedded code loading). This, > together with some optimizations in the call graph etc., > brought the time for a full system analysis down to 3 minutes > (running in the background). Fredrik Svahn, one of our > section managers, did some really good work there. > > > I mean that it should be possible to build the internal > > tables by adding and removing modules from them, without > > having to reread everything else. The analysis needs a global > > approach, but for a large project, reading the files takes > > the large chunk of the time. > > There are some pitfalls, though, and there is also the risk > that incremental analysis will give a false sense of security. > > /Ulf (speaking as one who spent significant time trying to > muscle in incremental analysis into Dialyzer. ;-) > From vladdu55@REDACTED Fri May 19 09:38:27 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 May 2006 09:38:27 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <20060519070519.GA30677@nodo2.lambdastream.com> References: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> <20060519070519.GA30677@nodo2.lambdastream.com> Message-ID: <95be1d3b0605190038t5d6e9b8dwa7817ce2bb0d833e@mail.gmail.com> Yes, that's a good suggestion! I thought there would be a way to use xref for that, but didn't manage to put together the required filter... Xref isn't incremental either, so it's not going all the way, but at least is doable without patching anyhting. Thanks! Vlad On 5/19/06, Samuel Rivas wrote: > Vlad Dumitrescu wrote: > > I think it would be useful if Dialyzer would also report calls to > > undefined or unexported functions. I often spell names wrong :-) > > If you are eager enough, you can already do that with xref. > > xref:start(xref_example). > xref:add_release(xref_example, code:lib_dir(), > [{verbose, false}, {warnings, false}, > {name, otp}]). > xref:add_application(xref_example, YourAppPath, [{name, YourAppName}]). > xref:q(xref_example, "(XC - UC) | ((Fun) YourAppName : App) || (XU - X - B)"). > > Maybe there is a simpler way, but that works for me :) > > Regards > -- > Samuel > From tobbe@REDACTED Fri May 19 10:56:09 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 19 May 2006 10:56:09 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <20060519070519.GA30677@nodo2.lambdastream.com> References: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> <20060519070519.GA30677@nodo2.lambdastream.com> Message-ID: Nice! (but I couldn't get it to work) Has anyone written some nice icing on top of the xref cake? I mean a collection of function which setup and executes some of useful metrics there are to be gathered from xref? The documentation of xref is good but a little bit on the terse side... Cheers, Tobbe Samuel Rivas wrote: > Vlad Dumitrescu wrote: > >>I think it would be useful if Dialyzer would also report calls to >>undefined or unexported functions. I often spell names wrong :-) > > > If you are eager enough, you can already do that with xref. > > xref:start(xref_example). > xref:add_release(xref_example, code:lib_dir(), > [{verbose, false}, {warnings, false}, > {name, otp}]). > xref:add_application(xref_example, YourAppPath, [{name, YourAppName}]). > xref:q(xref_example, "(XC - UC) | ((Fun) YourAppName : App) || (XU - X - B)"). > > Maybe there is a simpler way, but that works for me :) > > Regards From samuel@REDACTED Fri May 19 11:32:35 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 19 May 2006 11:32:35 +0200 Subject: xref example file In-Reply-To: References: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> <20060519070519.GA30677@nodo2.lambdastream.com> Message-ID: <20060519093235.GA897@nodo2.lambdastream.com> Torbjorn Tornkvist wrote: > Nice! (but I couldn't get it to work) > > Has anyone written some nice icing on top of the xref cake? > I mean a collection of function which setup and executes > some of useful metrics there are to be gathered from xref? > The documentation of xref is good but a little bit on the terse side... Not really a nice profiling application full of flashy metrics, but I have a sort of template that I use to include in my applications. Just change my_app for your application name and make my_app_app_path return the path to the app file, run my_app_xref:start(), wait, wait a little more, and run my_app_xref:all(). That should work :) If you want to profile code that is not in an application you'll need to change load_my_app to call another kind of xref:add_ function. Hope it helps -- Samuel -------------- next part -------------- %%%------------------------------------------------------------------- %%% File : my_app_xref.erl %%% Author : Samuel Rivas %%% Description : XREF useful tests for my_app %%% %%% Created : 19 May 2006 by Samuel Rivas %%%------------------------------------------------------------------- -module(my_app_xref). -module(my_app_xref). -define(XREF_SERVER, my_app_xref_server). -export([start/0, stop/0, restart/0, undefined/0, unresolved/0, deprecated/0, unused/0, all/0, reload/0, to/2, to/3]). start() -> {ok, _} = xref:start(?XREF_SERVER), load_otp(), %% Load anything that your app needs here load_my_app(), ok. stop() -> xref:stop(?XREF_SERVER). restart() -> stop(), ok = start(). reload() -> unload_my_app(), load_my_app(). undefined() -> %% Look for wrong function calls (extenal call to a function that does not %% exist) xref_query("UNDEFINED CALLS", "(XC - UC) | ((Fun) my_app : App) || (XU - X - B)"). unresolved() -> %% Look for abstract function calls (they are not errors in compile time, %% but it may be useful when searching for failure points) xref_query("UNRESOLVED CALLS", "UC | ((Fun) my_app : App) || (XU - X - B)"). deprecated() -> %% Look for deprecated functions called from my_app application (the %% compiler raises warning on that too) xref_query("DEPRECATED CALLS", "E | (Fun) my_app:App || DF"). unused() -> %% Look for exported functions that are not used nor in the white list. %% UWL is the unused white list and is created by the unused_white_list() %% function. It includes all the behaviour callbacks as well as the %% custom_white_list functions. You may edit custom_white_list function %% or add new module names to gen_events() gen_servers() and supervisors() %% functions to avoid very large list ouputs from this function %% Functions in this module are automatically whitelisted xref_query("UNUSED FUNCTIONS", "(UU * (Fun) my_app:App) - UWL"). to(Module, Function) -> to(Module, Function, "_"). to(Module, Function, Arity) when is_integer(Arity) -> to(Module, Function, integer_to_list(Arity)); to(Module, Function, Arity) -> Title = lists:flatten(io_lib:format("CALLS TO ~p:~p/~s", [Module, Function, Arity])), Query = lists:flatten(io_lib:format("E | (Fun) my_app:App || ~p:~p/~s", [Module, Function, Arity])), xref_query(Title, Query). %% Don't put my_app_ prefix, function_regexp does that for you gen_servers() -> ["conf", "facade", "worker"]. gen_events() -> ["logger"]. supervisors() -> ["supervisor"]. %% Whitelist assorted functions here custom_white_list() -> "\"my_app.*\":init/1 + \"my_app.*\":debug_stop/0 " "+ \"my_app.*\":\"(re)?start_link\"/_ + my_app_conf:save/0 " "+ my_app:\"restart|terminate\"/\"0|1\" + my_app_facade:_/_". all() -> undefined(), unresolved(), deprecated(), unused(). %%%---------------------------------------------------------------------- %%% Internal functions %%%---------------------------------------------------------------------- load_otp() -> io:format("Loading OTP applications (it may take a while)...~n"), {ok, _} = xref:add_release(?XREF_SERVER, code:lib_dir(), [{verbose, false}, {warnings, false}, {name, otp}]). load_my_app() -> io:format("Loading My_App ...~n"), {ok, _} = xref:add_application(?XREF_SERVER, my_app_app_path(), {name, my_app}), io:format("Creating unused function white list ...~n"), unused_white_list(). unload_my_app() -> ok = xref:remove_application(?XREF_SERVER, my_app). my_app_app_path() -> my_app_util:get_home() ++ "/ebin". xref_query(Message, Query) -> {ok, L} = xref:q(?XREF_SERVER, Query), io:format("~n~s:~n~n", [Message]), print_results(L). print_results(L) -> F = fun({{OMod, OFun, OAr}, {IMod, IFun, IAr}}) -> print_call(OMod, OFun, OAr, IMod, IFun, IAr); ({Mod, Fun, Ar}) -> print_function(Mod, Fun, Ar) end, lists:foreach(F, L). print_call(OMod, OFun, OAr, IMod, IFun, IAr) -> io:format("~p:~p/~p -> ~p:~p/~p~n", [OMod, OFun, OAr, IMod, IFun, IAr]). print_function(Mod, Fun, Ar) -> io:format("~p:~p/~p~n", [Mod, Fun, Ar]). unused_white_list() -> xref:forget(?XREF_SERVER, 'UWL'), Q = lists:flatten(["UWL:=(", module_regexp(gen_servers()), $:, function_regexp(gen_server_callbacks()), "/_) " "+ (", module_regexp(gen_events()), $:, function_regexp(gen_event_callbacks()), "/_) " "+ (", module_regexp(supervisors()), $:, function_regexp(supervisor_callbacks()), "/_) " "+ (", application_module(), $:, function_regexp(application_callbacks()), "/_) " "+ ", custom_white_list(), "+ (X * (Fun) my_app_xref:Mod)"]), {ok, _} = xref:q(?XREF_SERVER,Q), ok. module_regexp([]) -> "\"\""; module_regexp([H|T]) -> ["\"my_app_", H, [[$|, gen_server_prefix() | Name] || Name <- T], $"]. % xemacs keeps thinking i'm writing a string until these quotes:" function_regexp([]) -> "\"\""; function_regexp([H|T]) -> [$", H, [[$| | Name] || Name <- T], $"]. gen_server_prefix() -> "my_app_". gen_server_callbacks() -> ["code_change", "handle_(call(2)?|cast|info)", "init", "terminate"]. application_module() -> "my_app". application_callbacks() -> ["start", "stop"]. gen_event_callbacks() -> ["init", "handle_(event|call|info)", "code_change", "terminate"]. supervisor_callbacks() -> ["init"]. From igor@REDACTED Fri May 19 11:33:10 2006 From: igor@REDACTED (Igor Goryachev) Date: Fri, 19 May 2006 13:33:10 +0400 Subject: Erlang/OTP R11B has been released In-Reply-To: (Bjorn Gustavsson's message of "18 May 2006 09:45:40 +0200") References: <446B4335.4030507@comcast.net> Message-ID: <87ac9ejr55.fsf@goryachev.org> On 18 May 2006, Bjorn Gustavsson wrote: > Sorry for that. When we received the patch, we were quite busy > resolving other issues, so we decided to postpone including it. It > will be probably be included in R11B-1. Bjorn, by the way, what about epoll patch from http://developer.sipphone.com/ejabberd/erlang_epoll_patch/? When it will appear in erlang mainstream? Thanks. -- Igor Goryachev E-Mail/Jabber: igor@REDACTED From karol.skocik@REDACTED Fri May 19 13:17:14 2006 From: karol.skocik@REDACTED (karol skocik) Date: Fri, 19 May 2006 13:17:14 +0200 Subject: CRYPTO: how to get N, E from public RSA key? Message-ID: Hi, I hope somebody already solved something similar and doesn't mind sharing knowledge... I have a RSA public key which looks like this : ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA6xVgBRiY4hMm/1t6cLk5ewPCO7nf/aYRMBLczrtdQP5kP6+I/5NC0lMBsXyLqs8xIc8Wz2031cjW/DB2MIpujf0l07p4W5SX1zqmJjkoYl7VT6KMmJwAw2ccxb47TgUtPtQdSRW37l3oVXw/+xCipDAvDwi06uxvyaJoj6iy/yM= user@REDACTED I am not sure from CRYPTO doc, but the key looks like [E, N] which might be exponent and modulus of the public key. Is there any way how to get these numbers (MPints) from public key which looks like one above? I can't find any examples how to use it. Is it even possible to get these N, E from public key or something like libssl should get me that? Any help will be greatly appreciated. Karol From kostis@REDACTED Fri May 19 13:23:20 2006 From: kostis@REDACTED (kostis@REDACTED) Date: Fri, 19 May 2006 13:23:20 +0200 (MEST) Subject: Dialyzer: report call to undefined function Message-ID: <200605191123.k4JBNKf1000142@spikklubban.it.uu.se> Vlad Dumitrescu wrote: > > I think it would be useful if Dialyzer would also report calls to > undefined or unexported functions. I often spell names wrong :-) First of all, for those who have not read the release notes of R11 in detail, let me mention that Dialyzer is now part of Erlang/OTP. Part of what Vlad is asking for is already present in Dialyzer. When Dialyzer finishes its analysis, it spits out information of the form: Unknown functions: [{mod1,f,4},{mod2,g,3}] If "mod1" is one of the modules that are analyzed, this means that the function f/4 is either undefined or unexported from that module. Kostis From vladdu55@REDACTED Fri May 19 13:35:03 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 19 May 2006 13:35:03 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <200605191123.k4JBNKf1000142@spikklubban.it.uu.se> References: <200605191123.k4JBNKf1000142@spikklubban.it.uu.se> Message-ID: <95be1d3b0605190435o461831f6g2cdc7876416df4d4@mail.gmail.com> Seeing Dializer in R11 is what triggered my question :-) Is this information returned among the usual warnings and errors? From my quick glance it isn't, but I think it should. I won't be using the tools from the command line, but as Erlang functions, so things going to stdout are harder to catch. I already did that for yecc, but it's not really a good solution. regards, Vlad On 5/19/06, kostis@REDACTED wrote: > Vlad Dumitrescu wrote: > > > > I think it would be useful if Dialyzer would also report calls to > > undefined or unexported functions. I often spell names wrong :-) > > First of all, for those who have not read the release notes of R11 > in detail, let me mention that Dialyzer is now part of Erlang/OTP. > > Part of what Vlad is asking for is already present in Dialyzer. > When Dialyzer finishes its analysis, it spits out information of > the form: > > Unknown functions: [{mod1,f,4},{mod2,g,3}] > > If "mod1" is one of the modules that are analyzed, this means that > the function f/4 is either undefined or unexported from that module. > > Kostis > From samuel@REDACTED Fri May 19 14:34:10 2006 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 19 May 2006 14:34:10 +0200 Subject: xref example file In-Reply-To: <20060519093235.GA897@nodo2.lambdastream.com> References: <95be1d3b0605182337g2bc8e3f5m1c0a39ba85b26b58@mail.gmail.com> <20060519070519.GA30677@nodo2.lambdastream.com> <20060519093235.GA897@nodo2.lambdastream.com> Message-ID: <20060519123410.GA3609@nodo2.lambdastream.com> Samuel Rivas wrote: > Torbjorn Tornkvist wrote: > > Nice! (but I couldn't get it to work) > > > > Has anyone written some nice icing on top of the xref cake? > > I mean a collection of function which setup and executes > > some of useful metrics there are to be gathered from xref? > > The documentation of xref is good but a little bit on the terse side... > > Not really a nice profiling application full of flashy metrics, but I > have a sort of template that I use to include in my applications. > > Just change my_app for your application name and make my_app_app_path > return the path to the app file, run my_app_xref:start(), wait, wait a > little more, and run my_app_xref:all(). That should work :) Well, it seems I overcommited myself, it is not that easy :). There are some patterns that make the regexp compiler fail if you don't load certain modules. In custom_white_list you have to delete any reference to nonexistent module names. An easy workaround is to delete last entries and then tune it when everything is working (returning an empty string requires more changes to work). custom_white_list() -> "\"my_app.*\":init/1 + \"my_app.*\":debug_stop/0 " "+ \"my_app.*\":\"(re)?start_link\"/_". There is also a reference you must change in unused_white_list. Again, an easy workaround is deleting the offending pattern: unused_white_list() -> xref:forget(?XREF_SERVER, 'UWL'), Q = lists:flatten(["UWL:=(", module_regexp(gen_servers()), $:, function_regexp(gen_server_callbacks()), "/_) " "+ (", module_regexp(gen_events()), $:, function_regexp(gen_event_callbacks()), "/_) " "+ (", module_regexp(supervisors()), $:, function_regexp(supervisor_callbacks()), "/_) " "+ (", application_module(), $:, function_regexp(application_callbacks()), "/_) " "+ ", custom_white_list()]), {ok, _} = xref:q(?XREF_SERVER,Q), ok. After that it ... should work? Regards -- Samuel From christophe.romain@REDACTED Fri May 19 13:37:08 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Fri, 19 May 2006 13:37:08 +0200 Subject: smp and kernel poll In-Reply-To: <17516.28803.502856.671689@alkaid.it.uu.se> References: <17516.28803.502856.671689@alkaid.it.uu.se> Message-ID: <9f43e0cd96b2f2ee06757fe8041c8857@process-one.net> > One plan that was mentioned was to standardise on one API in sys.c > (say poll()) and to emulate it if e.g. select() or epoll() is the > underlying API, but that emulation is probably not implemented yet. > By the way i'm ok to help on that ! From bsder@REDACTED Sat May 20 12:00:14 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sat, 20 May 2006 03:00:14 -0700 Subject: SO_REUSEPORT and gen_tcp Message-ID: <446EE8AE.6000603@allcaps.org> Can someone help me out? I seem to be missing the function which would allow me to set the SO_REUSEPORT flag in gen_tcp. I see the: {reuseaddr, Boolean} Allows or disallows local reuse of port numbers. By default, reuse is disallowed. line. But no matching {reuseport, Boolean}. Alternatively, if this is an intentional omission, could someone please explain why? The reason I want to use this is so that I can create an incoming and an outgoing TCP connection on the same port. To forestall the inevitable "you can't do this" or "you don't want to do this", see: http://www.brynosaurus.com/pub/net/p2pnat.pdf for an explanation of how to use SO_REUSEPORT for the purposes of NAT hole punching via TCP to establish true peer-to-peer connections from behind network address translators. Thanks, -a From Tobias.Lindahl@REDACTED Sat May 20 12:37:19 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Sat, 20 May 2006 12:37:19 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <95be1d3b0605190435o461831f6g2cdc7876416df4d4@mail.gmail.com> References: <200605191123.k4JBNKf1000142@spikklubban.it.uu.se> <95be1d3b0605190435o461831f6g2cdc7876416df4d4@mail.gmail.com> Message-ID: <446EF15F.10706@it.uu.se> Vlad Dumitrescu wrote: > Seeing Dializer in R11 is what triggered my question :-) > > Is this information returned among the usual warnings and errors? From > my quick glance it isn't, but I think it should. No it is only printed. The report was originally a debug feature to let us find a suitable initial plt for Dialyzer, but we found that it was pretty useful for the user as well, so we kept the print-out. We haven't worked much on the infrastructure for getting warnings from inside of Erlang, but this is something we probably should do. Then this kind of information can be passed in some kind of structure together with the warnings. Tobias > > I won't be using the tools from the command line, but as Erlang > functions, so things going to stdout are harder to catch. I already > did that for yecc, but it's not really a good solution. > > regards, > Vlad > > On 5/19/06, kostis@REDACTED wrote: > >> Vlad Dumitrescu wrote: >> > >> > I think it would be useful if Dialyzer would also report calls to >> > undefined or unexported functions. I often spell names wrong :-) >> >> First of all, for those who have not read the release notes of R11 >> in detail, let me mention that Dialyzer is now part of Erlang/OTP. >> >> Part of what Vlad is asking for is already present in Dialyzer. >> When Dialyzer finishes its analysis, it spits out information of >> the form: >> >> Unknown functions: [{mod1,f,4},{mod2,g,3}] >> >> If "mod1" is one of the modules that are analyzed, this means that >> the function f/4 is either undefined or unexported from that module. >> >> Kostis >> From Tobias.Lindahl@REDACTED Sat May 20 13:01:40 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Sat, 20 May 2006 13:01:40 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: References: Message-ID: <446EF714.4060902@it.uu.se> Ulf Wiger (AL/EAB) wrote: > > Vlad Dumitrescu wrote: > >>I think it would be useful if Dialyzer would also report >>calls to undefined or unexported functions. I often spell >>names wrong :-) > > > Agreed. Our local patched version of Dialyzer does this. > > I think the initial assumption was that there are other > tools that do this for you, but we felt that since Dialyzer > has the information, it might as well present it. > > > >>[Aside] How difficult would it be to make Dialyzer work >>incrementally? > > > Difficult - alas. I can confirm this :-( > We played with this quite a lot, since we have lots and lots > of erlang code in a fairly slow version control system. > Running Dialyzer on the ClearCase repository took about an > hour per subsystem... > > What we did was to prune the PLT, removing all modules > that depended on the ones being analysed. > > But the approach that finally became useful was to incorporate > Dialyzer in our simulated environment, and running it on all > code currently loaded (we use -embedded code loading). This, > together with some optimizations in the call graph etc., > brought the time for a full system analysis down to 3 minutes > (running in the background). Fredrik Svahn, one of our > section managers, did some really good work there. I guess this time is for re-analyzing a small increment - not for analyzing the whole system that took several hours before? Otherwise I would be really interested in what is happening. Unfortunatly, this approach is dependent on having a running system where Dialyzer can run in the background. We have been playing with the idea of keeping checksums for modules and pruning the plt based on this. In conjunction with keeping plt:s for subsystems and keeping track of dependencies, we shoud be able to squeeze the times quite a bit, but it has not been very high on our TODO-list. > >>I mean that it should be possible to build the internal >>tables by adding and removing modules from them, without >>having to reread everything else. The analysis needs a global >>approach, but for a large project, reading the files takes >>the large chunk of the time. > > > There are some pitfalls, though, and there is also the risk > that incremental analysis will give a false sense of security. Yes, especially since warnings from the modules that was analyzed earlier will not be given again in the new analysis. In a perfect world all discrepancies are handled right away, but in my experience this is not what actually happens. Tobias (speaking as one who spent significant time trying to muscle Dialyzer into existence. ;-) > > /Ulf (speaking as one who spent significant time trying to > muscle in incremental analysis into Dialyzer. ;-) From jefcrane@REDACTED Sat May 20 21:42:11 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sat, 20 May 2006 12:42:11 -0700 (PDT) Subject: Still learning! Erlang Question In-Reply-To: <9f43e0cd96b2f2ee06757fe8041c8857@process-one.net> Message-ID: <20060520194211.83471.qmail@web31610.mail.mud.yahoo.com> I'm using a ton of debugging trying to keep track of where there are problems, as I slowly grow my app. I'm stumped as to why my Handler/1 always seems to output my debug messages, then jump back to loop/2 All received messages, even for "connected" processes are being processed by loop, when the connected ones should be processed by Handler =/ loop(Users, N) -> %%io:format(" test_server:loop running as PID :~p~n",[self()]), receive {connect, Pid, User, Password} -> io:format(" test_server:connection request from:~p ~p ~p~n",[Pid, User, Password]), case member({User, Password}, Users) of true -> io:format(" test_server:connection request approved~n"), Max = max_connections(), if N > Max -> Pid ! {test_server,{error, too_many_connections}}, loop(Users, N); true -> io:format(" test_server:connection request approved, new connection/handler!~n"), New = spawn_link(?MODULE, handler, [Pid]), Pid ! {test_server, {ok, New}}, loop(Users, N + 1) end; false -> io:format(" test_server:connection request denied~n"), Pid ! {test_server, {error, rejected}}, loop(Users, N) end; Any -> case (Any == exit) of true-> io:format(" test_server PID ~p dying now...~n", [self()]), true; false-> io:format(" test_server Any: received: ~p~n",[Any]), loop(Users, N) end end. %%io:format(" function loop() dying : ~p~n",[self()]). handler(Pid) -> io:format(" test_server:handler on:~p~n",[self()]), io:format(" test_server:handling:~p~n",[Pid]), receive {Pid, quit} -> io:format("got (quit):~p ~p~n",[Pid, quit]), Pid ! {test_server, ok}; {Pid, Op} -> io:format("got:~p ~p~n",[Pid, Op]), Pid ! {test_server, do_op(Op)}, handler(Pid) end, io:format(" function handler() dying : ~p~n",[self()]). __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From vladdu55@REDACTED Sat May 20 22:38:42 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 20 May 2006 21:38:42 +0100 Subject: Still learning! Erlang Question In-Reply-To: <20060520194211.83471.qmail@web31610.mail.mud.yahoo.com> References: <9f43e0cd96b2f2ee06757fe8041c8857@process-one.net> <20060520194211.83471.qmail@web31610.mail.mud.yahoo.com> Message-ID: <95be1d3b0605201338y66534a0rca0f6fe942e97600@mail.gmail.com> Hi, does your client sent the requests to New? It happened to me too many times to talk to the wrong process :-) Also you probably want to do New = spawn_link(?MODULE, handler, [Pid]), Pid ! {test_server, {ok, New}}, loop([{User, Password}|Users], N + 1) % <<<--- regards, Vlad On 5/20/06, Jeff Crane wrote: > I'm using a ton of debugging trying to keep track of > where there are problems, as I slowly grow my app. I'm > stumped as to why my Handler/1 always seems to output > my debug messages, then jump back to loop/2 From jefcrane@REDACTED Sun May 21 19:35:37 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sun, 21 May 2006 10:35:37 -0700 (PDT) Subject: Still learning! Erlang Question In-Reply-To: <95be1d3b0605201338y66534a0rca0f6fe942e97600@mail.gmail.com> Message-ID: <20060521173537.75817.qmail@web31614.mail.mud.yahoo.com> That was it! I was sending to the wrong process from the Hanlder. Whoopsie. --- Vlad Dumitrescu wrote: > Hi, > > does your client sent the requests to New? It > happened to me too many > times to talk to the wrong process :-) > > Also you probably want to do > New = > spawn_link(?MODULE, > handler, [Pid]), > Pid ! > {test_server, {ok, New}}, > loop([{User, > Password}|Users], > N + 1) % <<<--- > > regards, > Vlad > > On 5/20/06, Jeff Crane wrote: > > I'm using a ton of debugging trying to keep track > of > > where there are problems, as I slowly grow my app. > I'm > > stumped as to why my Handler/1 always seems to > output > > my debug messages, then jump back to loop/2 > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From jefcrane@REDACTED Sun May 21 19:39:56 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sun, 21 May 2006 10:39:56 -0700 (PDT) Subject: Language Bindings for Erlang Message-ID: <20060521173956.37941.qmail@web31601.mail.mud.yahoo.com> I would LOVE to use the HGE C++ Library for graphics within my Erlang project. I can't find any C++ binding examples =/ Is Erlang Plus dead? Is there an alternative? Would I be forced to use an Erlang<->Python<->C++ hack to use HGE from Erlang? Ew! __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From chsu79@REDACTED Sun May 21 21:24:20 2006 From: chsu79@REDACTED (Christian S) Date: Sun, 21 May 2006 21:24:20 +0200 Subject: Language Bindings for Erlang In-Reply-To: <20060521173956.37941.qmail@web31601.mail.mud.yahoo.com> References: <20060521173956.37941.qmail@web31601.mail.mud.yahoo.com> Message-ID: Follow the guidelines for ports in C, the only difference is that you will be compiling with a C++ compiler, so you need to inform the compiler to export a function without the c++ name mangling. This is done by placing your code in an: extern "C" { ... } block. What is Erlang Plus? On 5/21/06, Jeff Crane wrote: > > I would LOVE to use the HGE C++ Library for graphics > within my Erlang project. I can't find any C++ binding > examples =/ > > Is Erlang Plus dead? > Is there an alternative? > > Would I be forced to use an Erlang<->Python<->C++ hack > to use HGE from Erlang? Ew! > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon May 22 07:15:56 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 22 May 2006 07:15:56 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <446EF714.4060902@it.uu.se> References: <446EF714.4060902@it.uu.se> Message-ID: <4471490C.6020403@ericsson.com> On 2006-05-20 13:01, Tobias Lindahl wrote: ...deleted > where Dialyzer can run in the background. We have been playing with the > idea of keeping checksums for modules and pruning the plt based on this. > In conjunction with keeping plt:s for subsystems and keeping track of > dependencies, we shoud be able to squeeze the times quite a bit, but it i thought that happens when setting DIALYZER_INIT_PLT to $dialyzer_home/plt/dialyzer_otp_plt, and starting like this, the first time: dialyzer --new_plt $plt_file then always afterwards use: dialyzer --init_plt $plt_file --new_plt $plt_file how does the above work otherwise? bengt From ft@REDACTED Mon May 22 08:12:22 2006 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 22 May 2006 08:12:22 +0200 Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <446EE8AE.6000603@allcaps.org> References: <446EE8AE.6000603@allcaps.org> Message-ID: <200605220812.23027.ft@it.su.se> On Saturday 20 May 2006 12:00, Andrew Lentvorski wrote: > Can someone help me out? I seem to be missing the function which > would allow me to set the SO_REUSEPORT flag in gen_tcp. > > I see the: > > {reuseaddr, Boolean} > Allows or disallows local reuse of port numbers. By default, > reuse is disallowed. > > line. But no matching {reuseport, Boolean}. Even though it's called reuseaddr, the documentation you quoted above says it is about port numbers. reuseaddr is, in my experience, SO_REUSEPORT. Btw, if you're into NATs (which I'm not), you might be interested in STUN. I have a basic STUN server written in Erlang in the YXA source repository. /Fredrik From vladdu55@REDACTED Mon May 22 08:54:11 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 22 May 2006 08:54:11 +0200 Subject: new opcodes in R11 Message-ID: <95be1d3b0605212354w41bf8843l9d9e6a6cbab92744@mail.gmail.com> Hi! I switched to R11 in my environment, but the beams compiled here can't be run on R10: use of opcode 125; this emulator supports only up to 115 I use no_new_binaries and no_new_apply in order to be able to be able to use R10 but be able to run on R9 too. Are there any similar compiler options for R11? In any case, I think this incompatibility should be documented (it isn't in the compiler release notes). best regards, Vlad From rlenglet@REDACTED Mon May 22 08:56:34 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 22 May 2006 15:56:34 +0900 Subject: Field assignments are reordered in record creations Message-ID: <200605221556.35277.rlenglet@users.forge.objectweb.org> I just remarked that in a record creation expression, the fields assignments are reordered to match the record definition. This is significant if the fields assignments have side effects (e.g. read from a file). For instance, executing: -module(test1). -record(rec, {foo, bar}). -export([start/0]). start() -> #rec{foo = io:format("foo"), bar = io:format("bar")}. outputs: foobar{rec,ok,ok} But executing: ... -record(rec, {bar, foo}). ... #rec{foo = io:format("foo"), bar = io:format("bar")}. outputs: barfoo{rec,ok,ok} Only the order of fields in the record definition changed, but the side effects are different. Just to demonstrate that the order of assigments in a record creation is not significant, executing: ... -record(rec, {foo, bar}). ... #rec{bar = io:format("bar"), foo = io:format("foo")}. outputs: foobar{rec,ok,ok} The Erlang Reference Manual only says: "The fields may be in any order, not necessarily the same order as in the record definition, and fields can be omitted." Please someone also add that field assignments are reordered to match the order of fields in the record definition. This is not obvious. -- Romain LENGLET From Tobias.Lindahl@REDACTED Mon May 22 09:50:42 2006 From: Tobias.Lindahl@REDACTED (Tobias Lindahl) Date: Mon, 22 May 2006 09:50:42 +0200 Subject: Dialyzer: report call to undefined function In-Reply-To: <4471490C.6020403@ericsson.com> References: <446EF714.4060902@it.uu.se> <4471490C.6020403@ericsson.com> Message-ID: <44716D52.6060702@it.uu.se> Bengt Kleberg wrote: > On 2006-05-20 13:01, Tobias Lindahl wrote: > ...deleted > >> where Dialyzer can run in the background. We have been playing with >> the idea of keeping checksums for modules and pruning the plt based on >> this. In conjunction with keeping plt:s for subsystems and keeping >> track of dependencies, we shoud be able to squeeze the times quite a >> bit, but it > > > i thought that happens when setting DIALYZER_INIT_PLT to > $dialyzer_home/plt/dialyzer_otp_plt, and starting like this, the first > time: > > dialyzer --new_plt $plt_file > > then always afterwards use: > > dialyzer --init_plt $plt_file --new_plt $plt_file > > > how does the above work otherwise? The above is intended to be used to define an init plt for your own standard libraries. You should not re-analyze anything that already exists in the init plt, since the dependencies are not taken into account. Also, if you update your library you have to rebuild the plt. In the current version of Dialyzer you can edit the Makefile and specify what otp-libraries you want to have in your plt (you can find more on this subject in the documentation). For these, the libs are checked every time Dialyzer starts and a new init plt is built if something has changed. Tobias From nm@REDACTED Mon May 22 10:21:42 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 22 May 2006 13:21:42 +0500 Subject: cheap equivalent of now() Message-ID: <44717496.2040803@web.am> Hi all! I've searched erlang documentation but without any positive results... Are there a way to get unix_timestamp at low cost? Even not-so-precise as erlang:now() - it may be even a little bit illegal - say several seconds back of real time ... I wish to have time recorded with a several second precision, but making too much erlang:now() calls is not a good idea -- at least gettimeoffay() for C applications can create serios slowdown of program. Seems, that the only way to achieve this is a creating standalone process and requesting timestamp from it? -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From jefcrane@REDACTED Mon May 22 10:26:21 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Mon, 22 May 2006 01:26:21 -0700 (PDT) Subject: Language Bindings for Erlang In-Reply-To: Message-ID: <20060522082621.76935.qmail@web31601.mail.mud.yahoo.com> I am looking to build my client GUI. I would like to use, in order of preference: HGE (C++ library) Python ESDL HGE through EPI? (http://epi.sourceforge.net/docs-0.0.2/index.html) EPI (Erlang Plus Interface) is in the Erlang FAQ. Is there a way to inline C++ or Python calls in Erlang? It makes it trivial to have 1 process that's waiting and acting on server messages locally instead of having to worry about message sending to ANOTHER (GUI) process, complicating synchronization unnecessarily. --- Christian S wrote: > Follow the guidelines for ports in C, the only > difference is that you will > be > compiling with a C++ compiler, so you need to inform > the compiler to > export a function without the c++ name mangling. > > This is done by placing your code in an: extern "C" > { ... } block. > > What is Erlang Plus? > > On 5/21/06, Jeff Crane wrote: > > > > I would LOVE to use the HGE C++ Library for > graphics > > within my Erlang project. I can't find any C++ > binding > > examples =/ > > > > Is Erlang Plus dead? > > Is there an alternative? > > > > Would I be forced to use an Erlang<->Python<->C++ > hack > > to use HGE from Erlang? Ew! __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf.wiger@REDACTED Mon May 22 10:33:56 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 22 May 2006 10:33:56 +0200 Subject: Dialyzer: report call to undefined function Message-ID: That's my hacked version (I haven't checked the OTP version to see how they differ.) What I did was simply to remove all modules in the analysed set from the plt, and also the modules that depend on them, directly or indirectly. That means that if you would include e.g. lists.beam, most of the data in the plt would be thrown away. Of course, if the modules being removed from the plt are not in the analysed set, they show up at the end, when Dialyzer reports the missing modules. The --new_plt option was simply to enable saving a larger plt than that of just stdlib. /Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Bengt Kleberg > Sent: den 22 maj 2006 07:16 > To: erlang-questions@REDACTED > Subject: Re: Dialyzer: report call to undefined function > > On 2006-05-20 13:01, Tobias Lindahl wrote: > ...deleted > > where Dialyzer can run in the background. We have been playing with > > the idea of keeping checksums for modules and pruning the > plt based on this. > > In conjunction with keeping plt:s for subsystems and > keeping track of > > dependencies, we shoud be able to squeeze the times quite a > bit, but > > it > > i thought that happens when setting DIALYZER_INIT_PLT to > $dialyzer_home/plt/dialyzer_otp_plt, and starting like this, > the first time: > > dialyzer --new_plt $plt_file > > then always afterwards use: > > dialyzer --init_plt $plt_file --new_plt $plt_file > > > how does the above work otherwise? > > > bengt > From bjorn@REDACTED Mon May 22 11:11:02 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 22 May 2006 11:11:02 +0200 Subject: new opcodes in R11 In-Reply-To: <95be1d3b0605212354w41bf8843l9d9e6a6cbab92744@mail.gmail.com> References: <95be1d3b0605212354w41bf8843l9d9e6a6cbab92744@mail.gmail.com> Message-ID: We don't consider it an incompatibility, as running code in an earlier major release than it was compiled for is not a supported feature. That said, the options you can use are either 'r9' or 'r10', or to add 'no_gc_bifs' to the options you already mentioned. Note that we haven't tested those options extensively, and also note that the code quality might be slightly worse as some optimizations are not done when you use those options. /Bjorn "Vlad Dumitrescu" writes: > Hi! > > I switched to R11 in my environment, but the beams compiled here can't > be run on R10: > use of opcode 125; this emulator supports only up to 115 > > I use no_new_binaries and no_new_apply in order to be able to be able > to use R10 but be able to run on R9 too. > > Are there any similar compiler options for R11? > In any case, I think this incompatibility should be documented (it > isn't in the compiler release notes). > > best regards, > Vlad > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bsder@REDACTED Mon May 22 13:17:38 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 22 May 2006 04:17:38 -0700 Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <200605220812.23027.ft@it.su.se> References: <446EE8AE.6000603@allcaps.org> <200605220812.23027.ft@it.su.se> Message-ID: <44719DD2.3090600@allcaps.org> Well, I will take your answer as simply that nobody actually has asked for it. I was more interested if there was some sort of problem with this kind of overloading of multiply bound sockets to the same address. I see no reason for there to be (everything looks normal since the OS handles dispatching everything and it all looks like normal sockets at the API level), but I wanted to check before just blindly adding the option to the Erlang source code. Fredrik Thulin wrote: > Even though it's called reuseaddr, the documentation you quoted above > says it is about port numbers. reuseaddr is, in my experience, > SO_REUSEPORT. I believe that you are correct on Windows. However, I do not believe that is correct on any of the Unix flavors. There the two options have different semantics and do not imply one another. SO_REUSEADDR primarily allows servers to be restarted even before the TCP timeouts close a previous socket. This is primarily useful when servers crash. SO_REUSEPORT actually allows completely duplicate socket bindings for the same local IP address/port combination. This is not the case for SO_REUSEADDR. It was supposed to be used for multicast, but has turned out to be useful for getting past NATs. The advantage here is that the same local IP address/port can be used for: 1) a connection to a rendezvous server to discover the external mapping 2) an initiated connection to the other peer to open a hole in the NAT 3) the bind() so that an incoming connection on that port can connect. > Btw, if you're into NATs (which I'm not), you might be interested in > STUN. I have a basic STUN server written in Erlang in the YXA source > repository. STUN is unfortunately only useful for UDP. For most applications, you wind up having to duplicate some of the semantics of a TCP stack (retransmission and throttling, primarily), anyway. Consequently, it is generally worth the extra pain to punch the hole using TCP rather than UDP. -a From ft@REDACTED Mon May 22 13:30:54 2006 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 22 May 2006 13:30:54 +0200 Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <44719DD2.3090600@allcaps.org> References: <446EE8AE.6000603@allcaps.org> <200605220812.23027.ft@it.su.se> <44719DD2.3090600@allcaps.org> Message-ID: <200605221330.54660.ft@it.su.se> On Monday 22 May 2006 13:17, Andrew Lentvorski wrote: > Well, I will take your answer as simply that nobody actually has > asked for it. ... > Fredrik Thulin wrote: > > Even though it's called reuseaddr, the documentation you quoted > > above says it is about port numbers. reuseaddr is, in my > > experience, SO_REUSEPORT. > > I believe that you are correct on Windows. However, I do not believe > that is correct on any of the Unix flavors. > > There the two options have different semantics and do not imply one > another. > > SO_REUSEADDR primarily allows servers to be restarted even before the > TCP timeouts close a previous socket. This is primarily useful when > servers crash. > > SO_REUSEPORT actually allows completely duplicate socket bindings for > the same local IP address/port combination. This is not the case for > SO_REUSEADDR. It was supposed to be used for multicast, but has > turned out to be useful for getting past NATs. I see. I was not aware of the two different socket options, and clearly not qualified to answer your previous question. Please just disregard my previous e-mail. /Fredrik From bsder@REDACTED Mon May 22 14:02:08 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 22 May 2006 05:02:08 -0700 Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <200605221330.54660.ft@it.su.se> References: <446EE8AE.6000603@allcaps.org> <200605220812.23027.ft@it.su.se> <44719DD2.3090600@allcaps.org> <200605221330.54660.ft@it.su.se> Message-ID: <4471A840.3010601@allcaps.org> Fredrik Thulin wrote: > I see. I was not aware of the two different socket options, and clearly > not qualified to answer your previous question. Please just disregard > my previous e-mail. Er, I'm sorry if I came off officious, that was not my intent. Your email was actually very useful. Being new to Erlang, I don't know much about how the message passing and sockets interact. I wanted to make sure that I wasn't walking into some obvious, known brick wall. I have plenty of unknown brick walls to bash my head against. ;) Thanks for taking the time to respond, -a From ft@REDACTED Mon May 22 14:30:31 2006 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 22 May 2006 14:30:31 +0200 Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <4471A840.3010601@allcaps.org> References: <446EE8AE.6000603@allcaps.org> <200605221330.54660.ft@it.su.se> <4471A840.3010601@allcaps.org> Message-ID: <200605221430.31499.ft@it.su.se> On Monday 22 May 2006 14:02, Andrew Lentvorski wrote: > Fredrik Thulin wrote: > > I see. I was not aware of the two different socket options, and > > clearly not qualified to answer your previous question. Please just > > disregard my previous e-mail. > > Er, I'm sorry if I came off officious, that was not my intent. No worries, quite the opposite in fact =). I learnt something from you today, thanks. /Fredrik From chsu79@REDACTED Mon May 22 15:04:31 2006 From: chsu79@REDACTED (Christian S) Date: Mon, 22 May 2006 15:04:31 +0200 Subject: Language Bindings for Erlang In-Reply-To: <20060522082621.76935.qmail@web31601.mail.mud.yahoo.com> References: <20060522082621.76935.qmail@web31601.mail.mud.yahoo.com> Message-ID: On 5/22/06, Jeff Crane wrote: > > I am looking to build my client GUI. I would like to > use, in order of preference: > > HGE (C++ library) > Python > ESDL > HGE through EPI? > (http://epi.sourceforge.net/docs-0.0.2/index.html) > EPI (Erlang Plus Interface) is in the Erlang FAQ. > > Is there a way to inline C++ or Python calls in > Erlang? It makes it trivial to have 1 process that's > waiting and acting on server messages locally instead > of having to worry about message sending to ANOTHER > (GUI) process, complicating synchronization > unnecessarily. > > I find that inline drivers are too complex to bother with when there is the simpler alternative of having a separate process running the foreign code. Especially when prototyping something, something that doesnt desperatly need to run in the same process. I dont see how synchronization is a problem, as you can easily make calls to HGC sequential using an erlang gen_server the interface for your erlang code. And group several operations inside a anonymous function, similar to mnesia:transaction/1. So the approach I would use is to write a C++ program that reads easily parsed instructions on stdin and writes events from input and other things to stdout. From erlang you can then create a port that starts this program, and you can communicate with it through the port. Make a gen_server own the port and turn erlang terms into the "wire" protocol. If this all seems too laborous to you, perhaps you could look at wings3d which is a successful application that use foreign code libs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Mon May 22 15:31:16 2006 From: per@REDACTED (Per Hedeland) Date: Mon, 22 May 2006 15:31:16 +0200 (CEST) Subject: SO_REUSEPORT and gen_tcp In-Reply-To: <44719DD2.3090600@allcaps.org> Message-ID: <200605221331.k4MDVGJY053840@pluto.hedeland.org> Andrew Lentvorski wrote: > >Well, I will take your answer as simply that nobody actually has asked >for it. I think another reason may be that SO_REUSEPORT is an OS-specific option, i.e. it's not generally available even on Unicen, and the Erlang interfaces try to stay away from such things. >I was more interested if there was some sort of problem with this kind >of overloading of multiply bound sockets to the same address. I see no >reason for there to be (everything looks normal since the OS handles >dispatching everything and it all looks like normal sockets at the API >level), but I wanted to check before just blindly adding the option to >the Erlang source code. Having the option available surely can't be a problem, using it is another thing... You generally *want* the restriction that is present even with SO_REUSEADDR, i.e. that you can't bind two "listen" sockets to the same local address and port. If you don't have that restriction, you can inadvertently end up with say two different HTTP server processes both accepting connections on port 80, and undefined semantics as far as the TCP/IP stack selecting one or the other for incoming connections goes (might be "last one to bind() wins", or "connections alternate between the two", neither of which is likely to be useful). >SO_REUSEADDR primarily allows servers to be restarted even before the >TCP timeouts close a previous socket. This is primarily useful when >servers crash. > >SO_REUSEPORT actually allows completely duplicate socket bindings for >the same local IP address/port combination. This is not the case for >SO_REUSEADDR. Right - which means that the SO_REUSEPORT name is either a mistake or a joke:-) - the difference isn't in address vs port (the "local address" in the "standard" documentation of SO_REUSEADDR implies both local IP address and local port), but in "local" (for SO_REUSEADDR) vs "complete" or "both local and remote" (for SO_REUSEPORT). > It was supposed to be used for multicast, but has turned >out to be useful for getting past NATs. > >The advantage here is that the same local IP address/port can be used for: > >1) a connection to a rendezvous server to discover the external mapping >2) an initiated connection to the other peer to open a hole in the NAT >3) the bind() so that an incoming connection on that port can connect. Hm, well, yes, however I think the authors of the paper you referred to earlier are a bit confused. They write: "BSD systems have introduced a SO_REUSEPORT option that controls port reuse separately from address reuse", as if they think that on other systems, SO_REUSEADDR includes what SO_REUSEPORT does on BSD - this isn't the case of course, an SO_REUSEADDR that did that would simply be broken, see above. So unless they want to suggest that "TCP hole punching" can only be done on systems that implement SO_REUSEPORT or something equivalent - and it sure doesn't seem like they want to suggest that - you shouldn't actually need SO_REUSEPORT. I haven't tried any of this, but I suspect that the trick is in the details of how you do 2) and 3) above. With only SO_REUSEADDR, you can't just bind() both to the same local address+port since at that point the sockets would be completely equivalent, and the second bind() would be rejected. But if you make sure that you not just do the bind() but also initiate the connect() in 2) before you do the bind() in 3), the remote address/port would be different, and there would not be a conflict that wouldn't be allowed by SO_REUSEADDR. My guess is that someone implementing this scheme didn't take this ordering requirement into consideration (the paper certainly doesn't spell it out) and failed, and then found out about SO_REUSEPORT, that allowed it to work regardless of the order in which things were done. And after that someone jumped to the wrong conclusions about SO_REUSEPORT, both about its semantics vs those of SO_REUSEADDR and about the need to use it. I could be wrong though...:-) --Per Hedeland From mats.cronqvist@REDACTED Mon May 22 15:36:29 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 22 May 2006 15:36:29 +0200 Subject: Language Bindings for Erlang In-Reply-To: References: <20060522082621.76935.qmail@web31601.mail.mud.yahoo.com> Message-ID: <4471BE5D.4080000@ericsson.com> > So the approach I would use is to write a C++ program that reads > easily parsed instructions on stdin and writes events from input and > other things to stdout. From erlang you can then create a port that > starts this program, and you can communicate with it through the port. > Make a gen_server own the port and turn erlang terms into the "wire" > protocol. > gtkNode (@ jungerl.sourceforge.net) does (basically) this. except with the twist that the C program implements the erlang distribution protocol (a c-node in erlang lingo). if gtk2 is good enough for your gui you can probably use it right away. mats From heinrich@REDACTED Mon May 22 16:07:14 2006 From: heinrich@REDACTED (Heinrich Venter) Date: Mon, 22 May 2006 16:07:14 +0200 Subject: io:setopts expand_fun Message-ID: Hi List I was pottering around with the io module docs and came across the io:setopts function. According to docs this can take as option a function that will determine how command completion will be done. Nifty and it obviosly works, since it appeart that the erlang console uses it. But I cant manage to actually set this option with io:setopts. Any one done this before or know how it should be done? -]-[einrich From yariv@REDACTED Mon May 22 19:57:26 2006 From: yariv@REDACTED (Yariv Sadan) Date: Mon, 22 May 2006 13:57:26 -0400 Subject: File sharing software In-Reply-To: <44592C52.4040704@hyber.org> References: <303B78D8-991B-4383-890C-129CE86EC19A@pando.com> <44592C52.4040704@hyber.org> Message-ID: On May 3, 2006, at 6:18 PM, Claes Wikstrom wrote: > Yariv Sadan wrote: > >> Maybe it's possible to develop for Mnesia an alternative disc >> only storage engine designed for storing large blobs. It wouldn't >> have to be an Oracle killer. It would just have to handle very >> large data sets, have decent performance, and avoid the >> rebuilding cost associated with broken dets tables. Such a >> solution would make Mnesia more versatile and therefore more >> appealing for applications for which it makes sense to sacrifice >> soft real-time performance for large storage capacity. What do >> you think? >> > > > This is certainly possible, I wrote dets some 15 years ago, and > it high time to rewrite completely. It's been through several > enhancements within the OTP group, but the original ideas are still > there. Linear (P.A Larsson algorithm) hashing for indexing and > a buddy allocator for space on the file. > > Two major problems with dets as of today (and of yeasterday) > > 1. 64 bit indexing - really easy to fix > 2. repair time - this is a bit harder to fix, but one solution > could be along the following lines. > > a) keep the index and the freelist in a different file, > b) have a file soley for the data. This file could be as easily > repaired as a disklog file. One could just chunk through it, one > term at a time, this way even large files will be fast to repair. > c) when an object is put on the freelist, it needs also to be > overwriten > > > My daily 2c :-) > > > /klacke Hi list, I have a few questions following up on Claes's comments. I'm still an Erlang newbie (hopefully not for too long), so please bear with me if they sound simple :) - I'm a little confused about the 32 bit file offset issue. Integers in Erlang can be greater than 2^32, so how come dets offsets are limited to 32 bits? Is this a limitation of BEAM's native file IO code? - Is dets limited to 32 bit offsets even if you run Erlang on 64 bit architectures? - Is anybody planning on implementing Claes's solution to the repair time issue described above? Your answers are appreciated! Thanks, Yariv From bugmenot999@REDACTED Tue May 23 07:50:46 2006 From: bugmenot999@REDACTED (bugmenot999) Date: Tue, 23 May 2006 07:50:46 +0200 Subject: gotapi.com interface for erlang libs Message-ID: <1148359846.2970759589@as03.cooltoad.com> It would be very useful. Things can be found very fast with it. I suggest the erlang maintainers to contact gotAPI. From TFIRESTO@REDACTED Tue May 23 16:23:59 2006 From: TFIRESTO@REDACTED (Firestone, Todd (TFIRESTO)) Date: Tue, 23 May 2006 10:23:59 -0400 Subject: Picture manipulation with GS Message-ID: Hello, I am interested in knowing if it is possible to pull in the information from a bitmap, manipulate the information, and display the new bitmap. My goal is to take an arbitrary bitmap, read it in, pull the last line of information out of the bitmap, shift all the other rows down by one, and place the previous last line at the top of the bitmap. This would be placed in a loop and the picture would look like it was wrapping as it scrolled. I would appreciate any suggestions for being able to perform this function strictly in erlang and not having to depend on any C (or other) APIs. Sincerely, Todd Firestone ARINC Annapolis, MD 21401 tfiresto@REDACTED (410) 266-2238 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Tue May 23 16:38:38 2006 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 23 May 2006 16:38:38 +0200 Subject: Picture manipulation with GS In-Reply-To: References: Message-ID: <17523.7790.908119.267598@rian.du.uab.ericsson.se> Check e3d directory in the wings3d source for some examples of image handling code, it doesn't contain exactly what you want but that should be easy to write. /Dan Firestone, Todd \(TFIRESTO\) writes: > Hello, > > I am interested in knowing if it is possible to pull in the information from a bitmap, manipulate the information, and display the new bitmap. > > My goal is to take an arbitrary bitmap, read it in, pull the last line of information out of the bitmap, shift all the other rows down by one, and place the previous last line at the top of the bitmap. This would be placed in a loop and the picture would look like it was wrapping as it scrolled. > > I would appreciate any suggestions for being able to perform this function strictly in erlang and not having to depend on any C (or other) APIs. > > Sincerely, > Todd Firestone > > ARINC > Annapolis, MD 21401 > tfiresto@REDACTED > (410) 266-2238 From orbitz@REDACTED Tue May 23 21:15:17 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Tue, 23 May 2006 15:15:17 -0400 Subject: Field assignments are reordered in record creations In-Reply-To: <200605221556.35277.rlenglet@users.forge.objectweb.org> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> Message-ID: <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> I don't believe what is happen is what you think is happening. The issue is that the order of execution in a single sequence point is not defined. Your code does no say anything about which record fields gets assigned first, simply which function gets executed first. You cannot depend on the order of execution of an expression to reflect how you wrote it. Compilers are generally free to execute expressions in whatever order is easiest for them. On May 22, 2006, at 2:56 AM, Romain Lenglet wrote: > I just remarked that in a record creation expression, the fields > assignments are reordered to match the record definition. This > is significant if the fields assignments have side effects (e.g. > read from a file). > > For instance, executing: > > -module(test1). > -record(rec, {foo, bar}). > -export([start/0]). > start() -> > #rec{foo = io:format("foo"), bar = io:format("bar")}. > > outputs: > > foobar{rec,ok,ok} > > But executing: > ... > -record(rec, {bar, foo}). > ... > #rec{foo = io:format("foo"), bar = io:format("bar")}. > > outputs: > > barfoo{rec,ok,ok} > > Only the order of fields in the record definition changed, but > the side effects are different. > > Just to demonstrate that the order of assigments in a record > creation is not significant, executing: > > ... > -record(rec, {foo, bar}). > ... > #rec{bar = io:format("bar"), foo = io:format("foo")}. > > outputs: > > foobar{rec,ok,ok} > > > The Erlang Reference Manual only says: > "The fields may be in any order, not necessarily the same order > as in the record definition, and fields can be omitted." > > Please someone also add that field assignments are reordered to > match the order of fields in the record definition. This is not > obvious. > > -- > Romain LENGLET From serge@REDACTED Tue May 23 22:35:23 2006 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 23 May 2006 16:35:23 -0400 Subject: mnesia_tm process memory high watermark Message-ID: <4473720B.1080003@hq.idt.net> In a production system running mnesia database with in-memory replicas we noticed through OS_MON that mnesia_tm process was eating a lot of memory as illustrated below. Is there a recommendation on how to ensure that mnesia_tm is automatically garbage collected periodically to keep the process memory overhead manageable? Is the proper way to handle this to call erlang:system_flag(fullsweep_after, Number) or there's a better approach? Serge (drp@REDACTED)4> process_info(pid(0,63,0)). [{registered_name,mnesia_tm}, {current_function,{mnesia_tm,doit_loop,1}}, {initial_call,{proc_lib,init_p,5}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[<0.58.0>]}, {dictionary,[{'$ancestors',[mnesia_kernel_sup,mnesia_sup,<0.55.0>]}, {'$initial_call',{mnesia_sp, init_proc, [mnesia_tm,mnesia_tm,init,[<0.58.0>]]}}]}, {trap_exit,true}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.54.0>}, {heap_size,24488375}, {stack_size,20}, {reductions,21411651}, {garbage_collection,[{fullsweep_after,65535}]}] (drp@REDACTED)5> process_info(pid(0,63,0), memory). {memory,138075680} (drp@REDACTED)6> erlang:garbage_collect(pid(0,63,0)). true (drp@REDACTED)7> process_info(pid(0,63,0), memory). {memory,1352} From rprice@REDACTED Tue May 23 22:53:34 2006 From: rprice@REDACTED (Roger Price) Date: Tue, 23 May 2006 22:53:34 +0200 (CEST) Subject: An over enthusiastic warning ? Message-ID: The following code was produced by a compiler [1] which replaced unused variables U4 and U5 by wildcards, fun ([_U4|_U5]) -> fun ([_U4|_U5]) -> %% Warnings for wildcards _U4 and _U5 fun ([U4|U5]) -> fun ([U6|U7]) -> {'C',U1,U4,U5,U6,U7} end(U3) end(U2) end(U3) end(U2) but the Erlang (BEAM) emulator version 5.4.9 [source] [hipe] with Eshell V5.4.9 issued warnings: ./test0.erl:25: Warning: variable '_U4' shadowed in 'fun' ./test0.erl:25: Warning: variable '_U5' shadowed in 'fun' It seems to me that these warnings should have been suppressed in view of the leading "_". Roger [1] An implementation of the Augustsson/Wadler pattern matching compiler described in chapter 5 of "The implementation of functional programming languages" by Simon L Peyton Jones. From matthias@REDACTED Tue May 23 23:45:34 2006 From: matthias@REDACTED (Matthias Lang) Date: Tue, 23 May 2006 23:45:34 +0200 Subject: An over enthusiastic warning ? In-Reply-To: References: Message-ID: <17523.33406.414358.16688@antilipe.corelatus.se> Roger Price writes: > The following code was produced by a compiler [1] which replaced unused > variables U4 and U5 by wildcards, Calling _U4 a 'wildcard' seems a bit misleading, because it leads to the thought that _U4 is a wildcard in the same way as _ is a wildcard, which is not the case. For example: f(_U, _U) -> same; f(_U, _V) -> different. 5> roger:f(a,b). different 6> roger:f(a,a). same Matthias (aware that I've avoided most of your implied question and quite probably told you something you already know) From ok@REDACTED Wed May 24 01:15:47 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 24 May 2006 11:15:47 +1200 (NZST) Subject: An over enthusiastic warning ? Message-ID: <200605232315.k4NNFlGB068289@atlas.otago.ac.nz> Roger Price wrote: The following code was produced by a compiler [1] which replaced unused variables U4 and U5 by wildcards, fun ([_U4|_U5]) -> fun ([_U4|_U5]) -> %% Warnings for wildcards _U4 and _U5 fun ([U4|U5]) -> fun ([U6|U7]) -> {'C',U1,U4,U5,U6,U7} end(U3) end(U2) end(U3) end(U2) Wrong. "_" is a wild-card, NOTHING ELSE is a wild-card. but the Erlang (BEAM) emulator version 5.4.9 [source] [hipe] with Eshell V5.4.9 issued warnings: ./test0.erl:25: Warning: variable '_U4' shadowed in 'fun' ./test0.erl:25: Warning: variable '_U5' shadowed in 'fun' Erlang is helpful indeed to warn about this. If you want wild-cards, generate fun ([_|_]) -> fun ([_|_]) -> fun ([U4|U5]) -> fun ([U6|U7]) -> {'C',U1,U4,U5,U6,U7} end(U3) end(U2) end(U3) end(U2) Better yet, notice that "is U2 a pair" is being checked twice and "is U3 a list" is being checked twice, and generate fun([U4|U5]) -> fun ([U6|U7]) -> {'C',U1,U4,U5,U6,U7} end(U3) end(U2) From chaitanya@REDACTED Wed May 24 06:44:46 2006 From: chaitanya@REDACTED (Chaitanya Chalasani) Date: Wed, 24 May 2006 10:14:46 +0530 Subject: Oracle on Linux In-Reply-To: <200605181557.12584.chaitanya.chalasani@gmail.com> References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605181557.12584.chaitanya.chalasani@gmail.com> Message-ID: <200605241014.46638.chaitanya@pyronetworks.com> On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > Folks, > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > commercial ODBC driver? > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > Thanks, Joel > > > > -- > > http://wagerlabs.com/ > > I am away from my office all there days. The day I am back I will share the > source. I have already got the nod from my manager.:) The attachment is the c++ code of occi interface that acts as port executable. Sorry for the delay -------------- next part -------------- A non-text attachment was scrubbed... Name: vms_db_module.zip Type: application/x-zip Size: 3460 bytes Desc: not available URL: From bjorn@REDACTED Wed May 24 11:42:48 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 May 2006 11:42:48 +0200 Subject: An over enthusiastic warning ? In-Reply-To: References: Message-ID: Roger Price writes: [...] > It seems to me that these warnings should have been suppressed in view of > the leading "_". > Using variables starting with underscore only suppress warnings for unused variables. To suppress warnings for shadow, you can add the following line to the generated -compile(nowarn_shadow_vars). module. > > [1] An implementation of the Augustsson/Wadler pattern matching compiler > described in chapter 5 of "The implementation of functional programming > languages" by Simon L Peyton Jones. > For learning purposes, I suppose? The Beam compiler already implements that same algorithm. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jerome.sautret@REDACTED Wed May 24 11:43:47 2006 From: jerome.sautret@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Sautret?=) Date: Wed, 24 May 2006 11:43:47 +0200 Subject: Anonymous function and rpc Message-ID: <8397da240605240243q60d76ddr5e0fd7cbb1af42f8@mail.gmail.com> Hello all, Is it possible to pass an anonymous function as a parameter of a function called by rpc ? The strange thing is I can do it in the BEAM shell, but not in a module : % erl -sname debug Erlang (BEAM) emulator version 5.4.6 [source] [threads:0] Eshell V5.4.6 (abort with ^G) (debug@REDACTED)1> rpc:call(debug2@REDACTED, mnesia, transaction, [fun() -> ok end]). {atomic,ok} (debug@REDACTED)2> mydebug:mydebug(). {aborted,{undef,[{#Fun,[]}, {mnesia_tm,apply_fun,3}, {mnesia_tm,execute_transaction,5}, {rpc,'-handle_call/3-fun-0-',5}]}} (debug@REDACTED)3> q(). ok % cat mydebug.erl -module(mydebug). -export([mydebug/0]). mydebug() -> rpc:call(debug2@REDACTED, mnesia, transaction, [fun() -> ok end]). % EOF % Any hint welcome. Thanks, J?r?me. From vlad.xx.dumitrescu@REDACTED Wed May 24 11:48:57 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Wed, 24 May 2006 11:48:57 +0200 Subject: Anonymous function and rpc Message-ID: <11498CB7D3FCB54897058DE63BE3897C019E8C16@esealmw105.eemea.ericsson.se> Hi, I think that you have to have the same version of mydebug installed on the remote host. The shell does some magic stuff under the covers :-) /Vlad > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of J?r?me Sautret > Sent: Wednesday, May 24, 2006 11:44 AM > To: erlang-questions@REDACTED > Cc: jerome.sautret@REDACTED > Subject: Anonymous function and rpc > > Hello all, > > Is it possible to pass an anonymous function as a parameter > of a function called by rpc ? > The strange thing is I can do it in the BEAM shell, but not > in a module : > > % erl -sname debug > Erlang (BEAM) emulator version 5.4.6 [source] [threads:0] > > Eshell V5.4.6 (abort with ^G) > (debug@REDACTED)1> rpc:call(debug2@REDACTED, mnesia, transaction, > [fun() -> ok end]). > {atomic,ok} > (debug@REDACTED)2> mydebug:mydebug(). > {aborted,{undef,[{#Fun,[]}, > {mnesia_tm,apply_fun,3}, > {mnesia_tm,execute_transaction,5}, > {rpc,'-handle_call/3-fun-0-',5}]}} > (debug@REDACTED)3> q(). > ok > % cat mydebug.erl > -module(mydebug). > -export([mydebug/0]). > > mydebug() -> > rpc:call(debug2@REDACTED, mnesia, transaction, [fun() -> ok end]). > > % EOF > % > > Any hint welcome. > Thanks, > J?r?me. > From rprice@REDACTED Wed May 24 13:55:44 2006 From: rprice@REDACTED (Roger Price) Date: Wed, 24 May 2006 13:55:44 +0200 (CEST) Subject: An over enthusiastic warning ? Message-ID: Matthias Lang writes: > Calling _U4 a 'wildcard' seems a bit misleading, "Richard A. O'Keefe" writes: > Wrong. "_" is a wild-card, NOTHING ELSE is a wild-card. Bjorn Gustavsson writes: > Using variables starting with underscore only suppress warnings > for unused variables. Sorry - I have been thoroughly corrected. I should have read the reference manual more carefully. Perhaps I should go down to the railway station and apologise to everyone on platform 2. > For learning purposes, I suppose? I was wondering what would be needed to allow a function definition such as fold _G [] A -> A; fold G [X|Xs] A -> fold G Xs (G X A) . in Erlang. Roger From david.nospam.hopwood@REDACTED Wed May 24 15:42:22 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 24 May 2006 14:42:22 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> Message-ID: <447462BE.3070807@blueyonder.co.uk> orbitz@REDACTED wrote: > I don't believe what is happen is what you think is happening. The > issue is that the order of execution in a single sequence point is not > defined. Your code does no say anything about which record fields gets > assigned first, simply which function gets executed first. You cannot > depend on the order of execution of an expression to reflect how you > wrote it. Compilers are generally free to execute expressions in > whatever order is easiest for them. Erlang is not C; it has no concept of sequence points. However, you're correct that the evaluation order of arguments to an operator or function call is undefined. See section 6.3 of . -- David Hopwood From david.nospam.hopwood@REDACTED Wed May 24 15:59:46 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 24 May 2006 14:59:46 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <447462BE.3070807@blueyonder.co.uk> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> <447462BE.3070807@blueyonder.co.uk> Message-ID: <447466D2.2000102@blueyonder.co.uk> David Hopwood wrote: > orbitz@REDACTED wrote: > >>I don't believe what is happen is what you think is happening. The >>issue is that the order of execution in a single sequence point is not >>defined. Your code does no say anything about which record fields gets >>assigned first, simply which function gets executed first. You cannot >>depend on the order of execution of an expression to reflect how you >>wrote it. Compilers are generally free to execute expressions in >>whatever order is easiest for them. > > Erlang is not C; it has no concept of sequence points. However, you're > correct that the evaluation order of arguments to an operator or function > call is undefined. See section 6.3 of > . Sorry, that's Core Erlang. The corresponding statement in the Erlang reference manual is in section 6.5 of . -- David Hopwood From orbitz@REDACTED Wed May 24 17:14:48 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 24 May 2006 11:14:48 -0400 Subject: Field assignments are reordered in record creations In-Reply-To: <447466D2.2000102@blueyonder.co.uk> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> <447462BE.3070807@blueyonder.co.uk> <447466D2.2000102@blueyonder.co.uk> Message-ID: <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> So what is ,? Can I not depend on an expression prior to a , being evaluated before something after the ,? What about ; in guard statements? Is it the same idea, simply not called a sequence point? Or is the idea not existent? On May 24, 2006, at 9:59 AM, David Hopwood wrote: > David Hopwood wrote: >> orbitz@REDACTED wrote: >> >>> I don't believe what is happen is what you think is happening. The >>> issue is that the order of execution in a single sequence point >>> is not >>> defined. Your code does no say anything about which record >>> fields gets >>> assigned first, simply which function gets executed first. You >>> cannot >>> depend on the order of execution of an expression to reflect how >>> you >>> wrote it. Compilers are generally free to execute expressions in >>> whatever order is easiest for them. >> >> Erlang is not C; it has no concept of sequence points. However, >> you're >> correct that the evaluation order of arguments to an operator or >> function >> call is undefined. See section 6.3 of >> > core_erlang-1.0.3.pdf>. > > Sorry, that's Core Erlang. The corresponding statement in the Erlang > reference manual is in section 6.5 of 513634.html>. > > -- > David Hopwood > > From chsu79@REDACTED Wed May 24 19:27:59 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 24 May 2006 19:27:59 +0200 Subject: cheap equivalent of now() In-Reply-To: <44717496.2040803@web.am> References: <44717496.2040803@web.am> Message-ID: I was waiting for others' comments, but as they lacked, here goes. First of, do you really have a problem with too many gettimeofday() syscalls from your erlang program, or is it just a premature guess of a bottleneck in some code you will write? I suggest you go with erlang:now() and see. If your guess would indeed be true, then you could look at the 'timer' module. There are some functions there that could be interesting for 'driving' a timer you keep in a process. On 5/22/06, Gaspar Chilingarov wrote: > > Hi all! > > I've searched erlang documentation but without any positive results... > > Are there a way to get unix_timestamp at low cost? Even not-so-precise > as erlang:now() - it may be even a little bit illegal - say several > seconds back of real time ... > > I wish to have time recorded with a several second precision, but making > too much erlang:now() calls is not a good idea -- at least > gettimeoffay() for C applications can create serios slowdown of program. > > Seems, that the only way to achieve this is a creating standalone > process and requesting timestamp from it? > > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37491 419763 (mob) > i 63174784 > e nm@REDACTED > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.nospam.hopwood@REDACTED Thu May 25 00:24:54 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 24 May 2006 23:24:54 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> <447462BE.3070807@blueyonder.co.uk> <447466D2.2000102@blueyonder.co.uk> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> Message-ID: <4474DD36.1050200@blueyonder.co.uk> orbitz@REDACTED wrote: > So what is ,? Can I not depend on an expression prior to a , being > evaluated before something after the ,? What about ; in guard statements? > Is it the same idea, simply not called a sequence point? Or is the idea > not existent? Sequence points bring along a whole load of baggage that does not apply to Erlang. For example, in C you can have multiple side-effecting subexpressions between two sequence points, and much of the complexity of the sequence point model is only needed to deal with that case. I would strongly discourage anyone from trying to understand the evaluation order of other languages in terms of concepts from C (especially since there are significant problems with the way that the C89/C99 standards explain these concepts [1], even for sequential C). Besides, in the following C example similar to the Erlang one: make_foobar(format("foo"), format("bar")); the reason for the nondeterministic evaluation order is *not* that the order of execution between two sequence points is undefined. In C there is a sequence point before and after each function call (i.e. at least 4 sequence points in the example, besides those within the function bodies). In this example the nondeterminism arises from the unspecified [2] order of evaluation of the arguments to make_foobar, not from the order of execution between any two consecutive [1] sequence points. [1] One problem is that although the standards talk about "previous", "next" and "consecutive" sequence points, the ordering of sequence points is only partial, so it is not clear what these terms really mean. An annex that would have clarified this was dropped in final editing of C99, apparently because the C committee couldn't understand it. [2] Note that use of "undefined" in the Erlang reference manuals is closer to the use of "unspecified" in the C standard than to C's "undefined behaviour". > On May 24, 2006, at 9:59 AM, David Hopwood wrote: >> David Hopwood wrote: >>> orbitz@REDACTED wrote: >>> >>>> I don't believe what is happen is what you think is happening. The >>>> issue is that the order of execution in a single sequence point is >>>> not defined. Your code does no say anything about which record fields >>>> gets assigned first, simply which function gets executed first. You >>>> cannot depend on the order of execution of an expression to reflect how >>>> you wrote it. Compilers are generally free to execute expressions in >>>> whatever order is easiest for them. >>> >>> Erlang is not C; it has no concept of sequence points. However, you're >>> correct that the evaluation order of arguments to an operator or >>> function call is undefined. [...] -- David Hopwood From david.nospam.hopwood@REDACTED Thu May 25 00:32:29 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Wed, 24 May 2006 23:32:29 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <4474DD36.1050200@blueyonder.co.uk> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <53414D33-93FA-4EE8-853B-DC9A95485DBE@ezabel.com> <447462BE.3070807@blueyonder.co.uk> <447466D2.2000102@blueyonder.co.uk> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> Message-ID: <4474DEFD.4050707@blueyonder.co.uk> David Hopwood wrote: > [1] One problem is that although the standards talk about "previous", "next" > and "consecutive" sequence points, the ordering of sequence points is > only partial, so it is not clear what these terms really mean. An annex > that would have clarified this was dropped in final editing of C99, > apparently because the C committee couldn't understand it. For anyone who is curious about this, see Annex D in . (For historical interest only -- since it was dropped from the standard, C implementations are not obligated to follow it.) -- David Hopwood From rlenglet@REDACTED Thu May 25 04:39:55 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Thu, 25 May 2006 11:39:55 +0900 Subject: Field assignments are reordered in record creations In-Reply-To: <4474DD36.1050200@blueyonder.co.uk> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> Message-ID: <200605251139.55298.rlenglet@users.forge.objectweb.org> David, thanks a lot fot this great explanation. I expected the Erlang compiler to behave like a C compiler, and to execute subexpressions with possible side-effects in the same order as they are written... > orbitz@REDACTED wrote: > > So what is ,? Can I not depend on an expression prior to a > > , being evaluated before something after the ,? What about ; > > in guard statements? Is it the same idea, simply not called > > a sequence point? Or is the idea not existent? Yes, it is. In: start() -> format("foo"), format("bar"). the two function calls are executed in the order in which they are written, because "," in that case separates two expressions and evaluates them in order. Cf. section 6.5 in the ref cited by David Hopwood (http://citeseer.ist.psu.edu/513634.html): "The order in which the subexpressions of an expression are evaluated is not defined, with one exception: In a body, the expressions are evaluated strictly from left to right." So, using "," to separate expressions seems to be the only way to have deterministic behaviour in Erlang. -- Romain LENGLET From orbitz@REDACTED Thu May 25 05:28:23 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Wed, 24 May 2006 23:28:23 -0400 Subject: Field assignments are reordered in record creations In-Reply-To: <200605251139.55298.rlenglet@users.forge.objectweb.org> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> <200605251139.55298.rlenglet@users.forge.objectweb.org> Message-ID: Which sounds like the definition of sequence point...? Please correct me. On May 24, 2006, at 10:39 PM, Romain Lenglet wrote: > David, thanks a lot fot this great explanation. > > I expected the Erlang compiler to behave like a C compiler, and > to execute subexpressions with possible side-effects in the same > order as they are written... > >> orbitz@REDACTED wrote: >>> So what is ,? Can I not depend on an expression prior to a >>> , being evaluated before something after the ,? What about ; >>> in guard statements? Is it the same idea, simply not called >>> a sequence point? Or is the idea not existent? > > Yes, it is. In: > start() -> > format("foo"), > format("bar"). > the two function calls are executed in the order in which they > are written, because "," in that case separates two expressions > and evaluates them in order. > > Cf. section 6.5 in the ref cited by David Hopwood > (http://citeseer.ist.psu.edu/513634.html): > > "The order in which the subexpressions of an expression are > evaluated is not defined, with one exception: > In a body, the expressions are evaluated strictly from left to > right." > > So, using "," to separate expressions seems to be the only way to > have deterministic behaviour in Erlang. > > -- > Romain LENGLET From david.nospam.hopwood@REDACTED Thu May 25 06:24:56 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Thu, 25 May 2006 05:24:56 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <200605251139.55298.rlenglet@users.forge.objectweb.org> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> <200605251139.55298.rlenglet@users.forge.objectweb.org> Message-ID: <44753198.9000606@blueyonder.co.uk> Romain Lenglet wrote: > David, thanks a lot fot this great explanation. > > I expected the Erlang compiler to behave like a C compiler, and > to execute subexpressions with possible side-effects in the same > order as they are written... I think you might have misunderstood my explanation. In *both* C and Erlang, the order of evaluation of procedure arguments is unspecified (because the spec for each language explicitly says so). In Erlang, that's the whole story. All you need to know is that ',' specifies left-to-right evaluation, and other operators don't. No concept of sequence points is needed or useful. In C, it's a whole lot more complicated. In fact I'm pretty sure that most C programmers don't understand how much more complicated. There is a partial ordering of "events", where an event is one of: - reading the value of a byte, - writing a value to a byte, - designation of a byte in an object, - a function call, - a sequence point and each subexpression constrains the ordering. Then there are rules about which sets of possible orderings cause undefined and/or unspecified behaviour, which are sufficiently vague that comp.std.c can have several- month-long flamewars about how they should be interpreted. So, it's probably not a good idea to try to understand other languages' evaluation orders in terms of concepts from C. Most other languages are much simpler. -- David Hopwood From jefcrane@REDACTED Thu May 25 18:39:10 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Thu, 25 May 2006 09:39:10 -0700 (PDT) Subject: Language Bindings for Erlang In-Reply-To: <4471BE5D.4080000@ericsson.com> Message-ID: <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> >From the erlang interoperability faq (http://www.erlang.org/doc/doc-5.4.12/doc/tutorial/part_frame.html), there's 4+ ways to write a C++ erl-message reader. I want to forward messages from Erlang to and from a Python GUI via middleware. Would a C Port, C Node, or C Driver be more approriate? Also the FAQ is poor at describing how an Erl_interface implementation differs from a C Node since they both seem to use Erl_interface except that the C Node seems overly complicated by comparison. The C Linked Driver (also uses Erl_interface) is a static driver which I *think* would be most appropriate, but I would like some input, thx! --- Mats Cronqvist wrote: > > > So the approach I would use is to write a C++ > program that reads > > easily parsed instructions on stdin and writes > events from input and > > other things to stdout. From erlang you can then > create a port that > > starts this program, and you can communicate with > it through the port. > > Make a gen_server own the port and turn erlang > terms into the "wire" > > protocol. > > > > gtkNode (@ jungerl.sourceforge.net) does > (basically) this. except with the > twist that the C program implements the erlang > distribution protocol (a c-node > in erlang lingo). if gtk2 is good enough for your > gui you can probably use it > right away. > > mats > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From matthias@REDACTED Fri May 26 00:41:06 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 26 May 2006 00:41:06 +0200 Subject: Language Bindings for Erlang In-Reply-To: <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> References: <4471BE5D.4080000@ericsson.com> <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> Message-ID: <17526.12930.421962.18607@antilipe.corelatus.se> Jeff Crane writes: > I want to forward messages from Erlang to and from a > Python GUI via middleware. Would a C Port, C Node, or > C Driver be more approriate? Your question doesn't have a clearcut answer, because "appropriate" depends on how you want to weigh different factors and what _your_ particular skill and experience is. My suggestion: Start by inventing your own protocol which does a _subset_ of what you ultimately want, and then runn that protocol over stdin/stdout via the 'port' mechanism. "C Nodes" and linked-in drivers ("C driver") come under the general heading of "complicated and trouble-prone". An observation: I don't understand why you want "middleware". That suggests you're either over- or under-specifying the problem. Matthias From jefcrane@REDACTED Fri May 26 01:09:26 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Thu, 25 May 2006 16:09:26 -0700 (PDT) Subject: Language Bindings for Erlang In-Reply-To: <17526.12930.421962.18607@antilipe.corelatus.se> Message-ID: <20060525230926.93868.qmail@web31613.mail.mud.yahoo.com> > Start by inventing your own protocol which does a > _subset_ of what you > ultimately want Erlang uses a standard protocol, which can implement any communication I desire anyways. Inventing a new protocol sounds ridiculous. > runn that protocol over > stdin/stdout via the > 'port' mechanism. As per interoperability: 1.4.2 C Program On the C side, it is necessary to write functions for receiving and sending data with two byte length indicators from/to Erlang. By default, the C program should read from standard input (file descriptor 0) and write to standard output (file descriptor 1). Examples of such functions, read cmd/1 and write cmd/2, can be found in the file erl comm.c [page 24]. Note that stdin and stdout are for buffered input/output and should not be used for the communication with Erlang! --- Given the complexity and vagueness associated with almost all things erlang, it's not surprising to receive conflicting information anymore. I'm not going to bother with that. > An observation: I don't understand why you want > "middleware". That > suggests you're either over- or under-specifying the > problem. I dont understand how I'm not being understood. The question remains, how to best glue ANY LANGUAGE to erlang. Given the lack of choices in graphics/input/output handling this is probably what kills most people interest in the language. Gluing erlang to another language seems necessary for any learning project. > An observation: I don't understand why you want > "middleware". That > suggests you're either over- or under-specifying the > problem. Why is it hard to understand that there's no bindings for erlang? I dont understand why Erlang advocates so strongly insist on using erlang for everything. It seems LOGICAL to use another language for media and since C is all you have to bind to, it becomes middleware for whatever you already have or have talent for. --- Matthias Lang wrote: > Jeff Crane writes: > > > I want to forward messages from Erlang to and > from a > > Python GUI via middleware. Would a C Port, C > Node, or > > C Driver be more approriate? > > Your question doesn't have a clearcut answer, > because "appropriate" > depends on how you want to weigh different factors > and what _your_ > particular skill and experience is. > > My suggestion: > > Start by inventing your own protocol which does a > _subset_ of what you > ultimately want, and then runn that protocol over > stdin/stdout via the > 'port' mechanism. > > "C Nodes" and linked-in drivers ("C driver") come > under the general > heading of "complicated and trouble-prone". > > An observation: I don't understand why you want > "middleware". That > suggests you're either over- or under-specifying the > problem. > > Matthias __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From orbitz@REDACTED Fri May 26 01:19:32 2006 From: orbitz@REDACTED (orbitz@REDACTED) Date: Thu, 25 May 2006 19:19:32 -0400 Subject: Field assignments are reordered in record creations In-Reply-To: <44753198.9000606@blueyonder.co.uk> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> <200605251139.55298.rlenglet@users.forge.objectweb.org> <44753198.9000606@blueyonder.co.uk> Message-ID: <5F01434C-9C0B-4CB5-A071-BCD9E20C0639@ezabel.com> I'm not sure I follow your statements about C. C has sequence points, they are && || ; , ?: I'm not sure I understand what you mean about reading/writing bytes and etc have to do with ordering? And what does partial ordering mean? On May 25, 2006, at 12:24 AM, David Hopwood wrote: > Romain Lenglet wrote: >> David, thanks a lot fot this great explanation. >> >> I expected the Erlang compiler to behave like a C compiler, and >> to execute subexpressions with possible side-effects in the same >> order as they are written... > > I think you might have misunderstood my explanation. In *both* C > and Erlang, the order of evaluation of procedure arguments is > unspecified (because the spec for each language explicitly says so). > > In Erlang, that's the whole story. All you need to know is that ',' > specifies left-to-right evaluation, and other operators don't. > No concept of sequence points is needed or useful. > > > In C, it's a whole lot more complicated. In fact I'm pretty sure > that most C programmers don't understand how much more complicated. > There is a partial ordering of "events", where an event is one of: > > - reading the value of a byte, > - writing a value to a byte, > - designation of a byte in an object, > - a function call, > - a sequence point > > and each subexpression constrains the ordering. Then there are rules > about which sets of possible orderings cause undefined and/or > unspecified > behaviour, which are sufficiently vague that comp.std.c can have > several- > month-long flamewars about how they should be interpreted. > > So, it's probably not a good idea to try to understand other > languages' > evaluation orders in terms of concepts from C. Most other languages > are > much simpler. > > -- > David Hopwood > > From taavi@REDACTED Fri May 26 01:43:17 2006 From: taavi@REDACTED (Taavi Talvik) Date: Fri, 26 May 2006 02:43:17 +0300 Subject: Language Bindings for Erlang In-Reply-To: <20060525230926.93868.qmail@web31613.mail.mud.yahoo.com> References: <20060525230926.93868.qmail@web31613.mail.mud.yahoo.com> Message-ID: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> On May 26, 2006, at 2:09 AM, Jeff Crane wrote: > I dont understand how I'm not being understood. The > question remains, how to best glue ANY LANGUAGE to > erlang. Given the lack of choices in > graphics/input/output handling this is probably what > kills most people interest in the language. Gluing > erlang to another language seems necessary for any > learning project. Most reasonable way is via port program. However, question how to glue to language is probably wrong one. Better to think how to glue to "some other tool most appropriate for my problem". Talking about graphics - you can make binding to OpenGL, Gtk, xlib, native implementation of X11 protocol, even make generic binding to C language. Erlang binding for these already exist. Which way is most useful is dependent on your problem set. >> An observation: I don't understand why you want >> "middleware". That >> suggests you're either over- or under-specifying the >> problem. > > Why is it hard to understand that there's no bindings > for erlang? I dont understand why Erlang advocates so > strongly insist on using erlang for everything. It > seems LOGICAL to use another language for media and > since C is all you have to bind to, it becomes > middleware for whatever you already have or have > talent for. Not neccessarily - on graphics field look at Wings3d. Basicly pure Erlang interfaces to OpenGL. Useful and interesting stuff done in Erlang. C just happens to be there. For keeping interest gs (tk binding) is probably enough. The more universal tool is - the less useful it is. The more specialized tool is - the less generic it is. There is no such thing as generic and useful middleware. Look at your problem set - maybe there are better tools than Erlang. Maybe erlang is best tool. best regards, taavi From matthias@REDACTED Fri May 26 01:58:22 2006 From: matthias@REDACTED (Matthias Lang) Date: Fri, 26 May 2006 01:58:22 +0200 Subject: Language Bindings for Erlang In-Reply-To: <20060525230926.93868.qmail@web31613.mail.mud.yahoo.com> References: <17526.12930.421962.18607@antilipe.corelatus.se> <20060525230926.93868.qmail@web31613.mail.mud.yahoo.com> Message-ID: <17526.17566.772097.378325@antilipe.corelatus.se> Jeff Crane writes: > > Start by inventing your own protocol which does a > > _subset_ of what you ultimately want > Erlang uses a standard protocol, which can implement > any communication I desire anyways. Inventing a new > protocol sounds ridiculous. In many cases, inventing a task-specific protocol is easier than understanding and debugging a general-purpose one. > As per interoperability: > > 1.4.2 C Program > On the C side, it is necessary to write functions for > receiving and sending data with two byte length > indicators from/to Erlang. By default, the C program > should read from standard input (file descriptor 0) > and write to standard output (file descriptor 1). > Examples of such functions, read cmd/1 and > write cmd/2, can be found in the file erl comm.c [page > 24]. > Note that stdin and stdout are for buffered > input/output and should not be used for the > communication with Erlang! > --- > Given the complexity and vagueness associated with > almost all things erlang, it's not surprising to > receive conflicting information anymore. I'm not going > to bother with that. The pitfall the note in 4.2 is trying to warn you about is that the C standard IO streams, i.e. "FILE *stdin" and "FILE *stdout", are buffered. The particular protocol used in the example won't work very well in the presence of buffering. Matthias From dot@REDACTED Fri May 26 03:13:37 2006 From: dot@REDACTED (Tony Finch) Date: Fri, 26 May 2006 02:13:37 +0100 Subject: Field assignments are reordered in record creations In-Reply-To: <5F01434C-9C0B-4CB5-A071-BCD9E20C0639@ezabel.com> References: <200605221556.35277.rlenglet@users.forge.objectweb.org> <69D09740-F35F-40B9-8F1B-9A2C2A9213AA@ezabel.com> <4474DD36.1050200@blueyonder.co.uk> <200605251139.55298.rlenglet@users.forge.objectweb.org> <44753198.9000606@blueyonder.co.uk> <5F01434C-9C0B-4CB5-A071-BCD9E20C0639@ezabel.com> Message-ID: On Thu, 25 May 2006, orbitz@REDACTED wrote: > I'm not sure I follow your statements about C. C has sequence points, they > are && || ; , ?: There are also sequence points before a function call and after it returns. > I'm not sure I understand what you mean about reading/writing bytes and > etc have to do with ordering? That's part of the formal model from the (discarded) annex D. The point is that an expression may only write a location once between sequence points, and it may not read a location after it has been written before the next sequence point. > And what does partial ordering mean? If I say A > Romain Lenglet wrote: > > > > > > I expected the Erlang compiler to behave like a C compiler, and > > > to execute subexpressions with possible side-effects in the same > > > order as they are written... C does not guarantee this, and in most cases C subexpressions can be evaluated in any order. Tony. -- f.a.n.finch http://dotat.at/ WEST NORTHERN SECTION: IN NORTH, VARIABLE 3 OR 4 BECOMING NORTHEAST 4 OR 5, OCCASIONALLY 6 IN SOUTHEAST. MAINLY FAIR. MAINLY GOOD. IN SOUTH, CYCLONIC 5 TO 7, OCCASIONALLY GALE 8 IN NORTHWEST. OCCASIONAL RAIN. MODERATE OR GOOD. From jefcrane@REDACTED Fri May 26 04:53:03 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Thu, 25 May 2006 19:53:03 -0700 (PDT) Subject: Language Bindings for Erlang In-Reply-To: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> Message-ID: <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> --- Taavi Talvik wrote: > Better to think how to glue to "some other tool most > appropriate > for my problem". Um, like another language more appropriate to the task? It's like C or Erlang are the only appropriate tools, as far as responders are concerned. Logically and practically incorrect. Of course OpenGL was used by the Wings3D TEAM who have had copious amounts of time to develop for and happen to SPECIALIZE in graphical design. No surprise there. %% Have to REALLY know C to use these, how is that %% appropriate for learning or TEACHING usable Erlang? OpenGL, Gtk, esdl, xlib == native implementation of X11 protocol > even make generic binding to C language I thought this is what I was asking about. Why would port or inline driver be better than a C Node or Erl_interface? They are all generic bindings to C! What are the effective differences? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From jahakala@REDACTED Fri May 26 07:04:25 2006 From: jahakala@REDACTED (Jani Hakala) Date: Fri, 26 May 2006 08:04:25 +0300 Subject: Language Bindings for Erlang In-Reply-To: <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> (Jeff Crane's message of "Thu, 25 May 2006 09:39:10 -0700 (PDT)") References: <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> Message-ID: <87psi11ina.fsf@pingviini.kortex.jyu.fi> Jeff Crane writes: > From the erlang interoperability faq > (http://www.erlang.org/doc/doc-5.4.12/doc/tutorial/part_frame.html), > there's 4+ ways to write a C++ erl-message reader. > > I want to forward messages from Erlang to and from a > Python GUI via middleware. Would a C Port, C Node, or > C Driver be more approriate? > There is a python library called py_interface: 'The Py-Interface is a python-implementation of an Erlang node.' It should be found from http://www.lysator.liu.se/~tab/erlang/py_interface/ There's also CORBA modules included with erlang/otp that could be used to send messages to C++ side (omniorb, TAO, other corba solutions available). I haven't tested this approach myself. Jani Hakala From tobbe@REDACTED Fri May 26 08:20:28 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 26 May 2006 08:20:28 +0200 Subject: Language Bindings for Erlang In-Reply-To: <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> References: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> Message-ID: I think it is unfortunate that there doesn't exist a quick and easy way to create efficient interfaces with a C library. Once upon a time there was IG: http://www.tornkvist.org/oldstuff/ig/doc.new/ I also belive that Scott Lystig Fritchie wrote something in this area. An Erlang add-on to SWIG would be nice... http://www.swig.org/ Preferably, one should be able to choose creating a port-program, linked-in driver, C-node interface. It is up for grabs; anyone ? --Tobbe Jeff Crane wrote: > --- Taavi Talvik wrote: > >>Better to think how to glue to "some other tool most >>appropriate >>for my problem". > > > Um, like another language more appropriate to the > task? It's like C or Erlang are the only appropriate > tools, as far as responders are concerned. Logically > and practically incorrect. Of course OpenGL was used > by the Wings3D TEAM who have had copious amounts of > time to develop for and happen to SPECIALIZE in > graphical design. No surprise there. > > > %% Have to REALLY know C to use these, how is that > %% appropriate for learning or TEACHING usable Erlang? > OpenGL, > Gtk, > esdl, > xlib == native implementation of X11 protocol > > >>even make generic binding to C language > > > I thought this is what I was asking about. Why would > port or inline driver be better than a C Node or > Erl_interface? They are all generic bindings to C! > What are the effective differences? > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > From rlenglet@REDACTED Fri May 26 09:20:42 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 26 May 2006 16:20:42 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler Message-ID: <200605261620.43183.rlenglet@users.forge.objectweb.org> Hi, This is an announcement for the creation of the Dryverl project. http://dryverl.objectweb.org/ Dryverl is a compiler for Erlang-to-C bindings. Currently, it support the generation of bindings implemented as C port drivers, but it will support also implementations as C port programs and C nodes. This project is a rewrite of, and aims at continuing the EDTK project, on a more flexible and efficient implementation base. More information on the project web pages. The web site is not yet finished, and I still have to make a tarball, but the compiler is functionnal (cf. the XSL stylesheets in the SVN repository), the binding specification language is well specified in an XML Schema, and Dryverl corresponds to an actual need currently discussed on the mailing list. ;-) Any comments are welcome. -- Romain LENGLET From rlenglet@REDACTED Fri May 26 09:24:51 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 26 May 2006 16:24:51 +0900 Subject: Language Bindings for Erlang In-Reply-To: References: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> Message-ID: <200605261624.51884.rlenglet@users.forge.objectweb.org> Torbjorn Tornkvist wrote: > I think it is unfortunate that there doesn't exist a quick > and easy way to create efficient interfaces with a C > library. Once upon a time there was IG: > > http://www.tornkvist.org/oldstuff/ig/doc.new/ > > I also belive that Scott Lystig Fritchie wrote something in > this area. EDTK: the Erlang Driver Toolkit. It is no more maintained, but my Dryverl project is a continuation of EDTK, with the same general ideas. > An Erlang add-on to SWIG would be nice... > > http://www.swig.org/ > > Preferably, one should be able to choose creating a > port-program, linked-in driver, C-node interface. > It is up for grabs; anyone ? I have been working on it for some time. I am currentlyh developing an "EDTK new-generation" project: Dryverl. http://dryverl.objectweb.org/ Contributions are welcome. -- Romain LENGLET From rasmussen.bryan@REDACTED Fri May 26 09:35:56 2006 From: rasmussen.bryan@REDACTED (bryan rasmussen) Date: Fri, 26 May 2006 09:35:56 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605261620.43183.rlenglet@users.forge.objectweb.org> References: <200605261620.43183.rlenglet@users.forge.objectweb.org> Message-ID: <3bb44c6e0605260035n655faf55n1c14a05cc3999053@mail.gmail.com> Why are the bindings specified in an XML Schema? cheers, Bryan Rasmussen On 5/26/06, Romain Lenglet wrote: > Hi, > > This is an announcement for the creation of the Dryverl project. > http://dryverl.objectweb.org/ > > Dryverl is a compiler for Erlang-to-C bindings. > Currently, it support the generation of bindings implemented as C > port drivers, but it will support also implementations as C port > programs and C nodes. > > This project is a rewrite of, and aims at continuing the EDTK > project, on a more flexible and efficient implementation base. > > More information on the project web pages. > The web site is not yet finished, and I still have to make a > tarball, but the compiler is functionnal (cf. the XSL > stylesheets in the SVN repository), the binding specification > language is well specified in an XML Schema, and Dryverl > corresponds to an actual need currently discussed on the mailing > list. ;-) > > Any comments are welcome. > > -- > Romain LENGLET > From rlenglet@REDACTED Fri May 26 09:42:18 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 26 May 2006 16:42:18 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <3bb44c6e0605260035n655faf55n1c14a05cc3999053@mail.gmail.com> References: <200605261620.43183.rlenglet@users.forge.objectweb.org> <3bb44c6e0605260035n655faf55n1c14a05cc3999053@mail.gmail.com> Message-ID: <200605261642.18772.rlenglet@users.forge.objectweb.org> bryan rasmussen wrote: > Why are the bindings specified in an XML Schema? The *language* that is used to specify bindings is specified in an XML Schema. -- Romain LENGLET From ok@REDACTED Fri May 26 10:07:33 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 26 May 2006 20:07:33 +1200 (NZST) Subject: Announcing Dryverl: an Erlang-to-C binding compiler Message-ID: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> bryan rasmussen asked > Why are the bindings specified in an XML Schema? and Romain Lenglet replied The *language* that is used to specify bindings is specified in an XML Schema. Yes, but why specify the bindings in XML? This is for an Erlang interface, so surely an Erlang data structure would have been a lot more readable? XML really wasn't designed to be human-readable (and by and large, it isn't) or human-writable (and by and large, it isn't). Let's face it, XML is just an over-hyped and absurdly bulky way to write trees, and Erlang has better ways. So what am I missing here? From tobbe@REDACTED Fri May 26 11:22:56 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 26 May 2006 11:22:56 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605261620.43183.rlenglet@users.forge.objectweb.org> References: <200605261620.43183.rlenglet@users.forge.objectweb.org> Message-ID: Very nice! I'm eagerly awiting some nice documentation :-) Cheers, Tobbe Romain Lenglet wrote: > Hi, > > This is an announcement for the creation of the Dryverl project. > http://dryverl.objectweb.org/ > > Dryverl is a compiler for Erlang-to-C bindings. > Currently, it support the generation of bindings implemented as C > port drivers, but it will support also implementations as C port > programs and C nodes. > > This project is a rewrite of, and aims at continuing the EDTK > project, on a more flexible and efficient implementation base. > > More information on the project web pages. > The web site is not yet finished, and I still have to make a > tarball, but the compiler is functionnal (cf. the XSL > stylesheets in the SVN repository), the binding specification > language is well specified in an XML Schema, and Dryverl > corresponds to an actual need currently discussed on the mailing > list. ;-) > > Any comments are welcome. > From mats.cronqvist@REDACTED Fri May 26 11:33:04 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 26 May 2006 11:33:04 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: References: <200605261620.43183.rlenglet@users.forge.objectweb.org> Message-ID: <4476CB50.9040309@ericsson.com> Torbjorn Tornkvist wrote: > > Very nice! > I'm eagerly awiting some nice documentation :-) > > Cheers, Tobbe yes, very cool. some docs and a (working) example would be nice though. mats > Romain Lenglet wrote: > >> Hi, >> >> This is an announcement for the creation of the Dryverl project. >> http://dryverl.objectweb.org/ >> >> Dryverl is a compiler for Erlang-to-C bindings. >> Currently, it support the generation of bindings implemented as C port >> drivers, but it will support also implementations as C port programs >> and C nodes. >> >> This project is a rewrite of, and aims at continuing the EDTK project, >> on a more flexible and efficient implementation base. >> >> More information on the project web pages. >> The web site is not yet finished, and I still have to make a tarball, >> but the compiler is functionnal (cf. the XSL stylesheets in the SVN >> repository), the binding specification language is well specified in >> an XML Schema, and Dryverl corresponds to an actual need currently >> discussed on the mailing list. ;-) >> >> Any comments are welcome. >> > From rlenglet@REDACTED Fri May 26 11:36:14 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 26 May 2006 18:36:14 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> References: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> Message-ID: <200605261836.15195.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: > bryan rasmussen asked > > > Why are the bindings specified in an XML Schema? > > and > Romain Lenglet replied > The *language* that is used to specify bindings is specified > in an XML Schema. > > Yes, but why specify the bindings in XML? > This is for an Erlang interface, so surely an Erlang data > structure would have been a lot more readable? Not for this language, see below. > XML really wasn't designed to be human-readable (and by and > large, it isn't) or human-writable (and by and large, it > isn't). > > Let's face it, XML is just an over-hyped and absurdly bulky > way to write trees, and Erlang has better ways. Apart from the better readibility of Erlang terms compared with XML elements, what are "Erlang's better ways?" I actually agree with you that XML should be avoided when there are better alternatives (and most often there are), but I believe that for this language there are no better alternatives. > So what am I missing here? XSLT is a nice standard language for writing transformations. And there are a lot of tools around XML (for validating documents, etc.). 1- I completely agree that XML makes the language verbose. However, although Dryverl is very usable as-is, Dryverl is mainly intended to be the "assembly language" of binding specifications. The language is very general and flexible, and is usable to implement any binding. There is room for higher-level languages for simpler, specific cases, that would be compiled into the Dryverl language. >From that viewpoint, the XML specifications would be generated by tools from (hopely) more human-readable languages. Human-readibility is therefore a secondary issue for Dryverl. 2- The Dryverl language is in fact composed of XML + two dialects: an Erlang-XML dialect, and a C-XML dialect. For instance, an actual piece of specification is: = gss_acquire_cred( &, , , , , &, &, &); if (GSS_CALLING_ERROR( )) { GSS_CALLING_ERROR_TO_STRING() } This fragment of C-XML dialect code is a call to a C GSSAPI function. There is as much C code text as XML elements. This fits XML and XSLT very well. This is not a purely structured tree, i.e. there are not only XML elements: there are many large text() nodes. I am not convinced that "Erlang has better ways" to deal with such dialects. In Erlang, if we roughly follow the same structure as for DOM, the fragment above would be written as the following Erlang term: {{c-call-variable, "major_status}, "= gss_acquire_cred(&", {c-call-variable, "minor_status"}, ",", {c-call-variable, "desired_name"}, ",", {c-call-variable, "time_req"}, ",", {c-call-variable, "desired_mechs"}, ",", {c-call-variable, "cred_usage"}, ",", "&", {c-call-variable, "output_cred_handle"}, ",", "&", {c-call-variable, "actual_mechs"}, ",", "&", {c-call-variable, "time_rec"}, ");", "if (GSS_CALLING_ERROR(", {c-call-variable, "major_status"}, ")) {", {failure-atom, {"GSS_CALLING_ERROR_TO_STRING(", {c-call-variable, "major_status"}, ")" } } "}" } Is that really more readable? Is that "a better way?" I don't think so. Maybe a pure-Erlang-terms approach would be appropriate if all the language was structured (i.e. no CDATA, and only XML elements), but that is not appropriate for *this* language. Maybe you would want to define the complete grammars of those two dialects of C and Erlang, which would be extensions of the general grammars of C and Erlang, but I don't want to go into such troubles (since I don't need to!). I invite you to read the project main web page, and to actually read the language's XML Schema: http://dryverl.objectweb.org/ However, the page that would best answer your questions (the "workplan") is not yet written, sorry. -- Romain LENGLET From niall@REDACTED Fri May 26 12:19:03 2006 From: niall@REDACTED (Niall Dalton) Date: Fri, 26 May 2006 11:19:03 +0100 Subject: Language Bindings for Erlang In-Reply-To: References: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> Message-ID: <4476D617.2060707@xrnd.com> Hi, This thread brings me to a question on wrapping multithreaded libraries. I have a C node that implements a set of callbacks expected by a certain (proprietary) library by making calls to a remote erlang system. The library hijacks the execution of the C program and is internally multithreaded. I'm interested in a more efficient way to implement this as usually I can expect there to be an erlang node running on the local machine, to which I'd like to make my calls. Ideally, I'd even like to implement the callbacks directly in Erlang. However, with a c port program or c port driver (the most efficient I believe), with multiple threads entering from the C side, can I expect hilarity to ensue due to interactions with GC, signals, etc? Has any experience wrapping such upstart libs? thanks, niall From serge@REDACTED Fri May 26 13:21:56 2006 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 26 May 2006 07:21:56 -0400 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> References: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> Message-ID: <4476E4D4.2090903@hq.idt.net> If one merely looks at the XML schema definition, it does look too verbose. However, if you have prior experience with EDTK, you would discover that many EDTK limitations have been overcome by this project, just to name a few: 1. Use of ei instead of erl_interface way of coding. 2. Ability to return "out" C-call parameters to Erlang Example: Erlang: get_value_from_some_api_call() -> Value::integer() invokes C: int some_api_call(int* value); Returns: 0 - ok, -1 - error value - this is something useful to be returned to Erlang with EDTK it would be necessary to write a C-wrapper for the some_api_call() that would look like this, as it doesn't understand returning parameters by reference: int some_api_call_wrapper(struct EdtkInternalState* State) Returns: Integer value to be returned to Erlang The ok/error code is stored in the EDTK's internal State structure 2. Ability to define a partial set of parameters in a C function call to be returned to Erlang: Erlang: call_c_function(A, B, C, D, E) -> Result C: c_function(F, G) -> result The XML binding defines parameter marchaling rules. 4. Automatic selection of erlang:port_command/2 and erlang:port_call/3 depending on the presence of binary parameters passed to/from Erlang to gain speed, and avoid unnecessary copying of binaries. 5. Use of hash tables for fast access to internal variables by name/id. 6. Support of XSLT-based code generators (instead of iMatrix's codegen with proprietary syntax). 7. Support for edoc tags. etc. To summarize this, I believe Dryverl is a very good leap towards making a flexible definition of Erlang/C binings using open source code generation tools based on XSLT. Yes, it is verbose, but that verboseness gives the programmer very good control of every aspect of data marshaling between Erlang & C. Its main merit in taking the best of EDTK's experience and creating a more flexible marshaling language. Could it be done in Erlang? It consists of three types of XML/XSLT documents: 1. XML schema that defines XML elements and constraints 2. XSLT templates used to transform a user's XML document into Erlang & C code compilable into an C linked-in or port driver. 3. An XML document that a user needs to write in order to define interface to some API library in C. Of course these could be done in Erlang, but what value could Erlang's syntax or tools add to this approach to make it less verbose? Overall, if you have a need for implementing a C driver for Erlang, I suggest you to try this tool, as in the long run it will save you quite a bit of coding/debugging time. Regards, Serge Richard A. O'Keefe wrote: > bryan rasmussen asked > > Why are the bindings specified in an XML Schema? > > and > Romain Lenglet replied > The *language* that is used to specify bindings is specified in > an XML Schema. > > Yes, but why specify the bindings in XML? > This is for an Erlang interface, so surely an Erlang data structure > would have been a lot more readable? > > XML really wasn't designed to be human-readable (and by and large, it isn't) > or human-writable (and by and large, it isn't). > > Let's face it, XML is just an over-hyped and absurdly bulky way to write > trees, and Erlang has better ways. > > So what am I missing here? From rlenglet@REDACTED Fri May 26 13:58:02 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Fri, 26 May 2006 20:58:02 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <4476E4D4.2090903@hq.idt.net> References: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> <4476E4D4.2090903@hq.idt.net> Message-ID: <200605262058.03577.rlenglet@users.forge.objectweb.org> Serge Aleynikov wrote: > If one merely looks at the XML schema definition, it does look > too verbose. However, if you have prior experience with EDTK, > you would discover that many EDTK limitations have been > overcome by this project, just to name a few: > > 1. Use of ei instead of erl_interface way of coding. I bet you meant to write: 1. Generalized use of erl_interface/ei, instead of the limited driver APIs, for decoding/encoding terms. ;-) -- Romain LENGLET From sebastian@REDACTED Fri May 26 16:20:21 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 26 May 2006 11:20:21 -0300 Subject: Oracle on Linux References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605181557.12584.chaitanya.chalasani@gmail.com> <200605241014.46638.chaitanya@pyronetworks.com> Message-ID: <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> Chaitanya, thanks for the source code. Some additional questions: 1- do you use multiple connections to Oracle? How would/do you manage it (resolved in the C++ class or with multiples ports)? 2- how do you encode/decode responses (mainly in the case of SELECT statements)? Do you read responses at the Erlang side as binaries and then create the corresponding Erlang datatypes, or do you use ei to generate Erlang datatypes on the C side? 3- how do you multiplex queries (use for example a PID to identify the requester and return the response to it)? Thank you very much for your help! Regards, Sebastian- ----- Original Message ----- From: "Chaitanya Chalasani" To: "Joel Reymont" Cc: "Erlang Questions" Sent: Wednesday, May 24, 2006 1:44 AM Subject: Re: Oracle on Linux > On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > Folks, > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > commercial ODBC driver? > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > Thanks, Joel > > > > > > -- > > > http://wagerlabs.com/ > > > > I am away from my office all there days. The day I am back I will share the > > source. I have already got the nod from my manager.:) > > The attachment is the c++ code of occi interface that acts as port executable. > Sorry for the delay > From david.nospam.hopwood@REDACTED Fri May 26 16:56:38 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 26 May 2006 15:56:38 +0100 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605261836.15195.rlenglet@users.forge.objectweb.org> References: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> <200605261836.15195.rlenglet@users.forge.objectweb.org> Message-ID: <44771726.3010005@blueyonder.co.uk> Romain Lenglet wrote: > Richard A. O'Keefe wrote: > >>Yes, but why specify the bindings in XML? [...] > > XSLT is a nice standard language for writing transformations. > And there are a lot of tools around XML (for validating > documents, etc.). > > 1- I completely agree that XML makes the language verbose. > However, although Dryverl is very usable as-is, Dryverl is mainly > intended to be the "assembly language" of binding > specifications. > The language is very general and flexible, and is usable to > implement any binding. There is room for higher-level languages > for simpler, specific cases, that would be compiled into the > Dryverl language. >>From that viewpoint, the XML specifications would be generated by > tools from (hopely) more human-readable languages. I don't see the point of this extra layer. (Actually, I don't see the point of trying to encode programming language code in XML, ever.) > 2- The Dryverl language is in fact composed of XML + two > dialects: an Erlang-XML dialect, and a C-XML dialect. > For instance, an actual piece of specification is: > > = > gss_acquire_cred( > &, > , > , > , > , > &, > &, > &); > if (GSS_CALLING_ERROR( > )) { > > GSS_CALLING_ERROR_TO_STRING( name="major_status"/>) > > } > > This fragment of C-XML dialect code is a call to a C GSSAPI > function. There is as much C code text as XML elements. This > fits XML and XSLT very well. > This is not a purely structured tree, i.e. there are not only XML > elements: there are many large text() nodes. I am not convinced > that "Erlang has better ways" to deal with such dialects. > > In Erlang, if we roughly follow the same structure as for DOM, > the fragment above would be written as the following Erlang > term: > > {{c-call-variable, "major_status}, > "= gss_acquire_cred(&", > {c-call-variable, "minor_status"}, ",", > {c-call-variable, "desired_name"}, ",", > {c-call-variable, "time_req"}, ",", > {c-call-variable, "desired_mechs"}, ",", > {c-call-variable, "cred_usage"}, ",", > "&", {c-call-variable, "output_cred_handle"}, ",", > "&", {c-call-variable, "actual_mechs"}, ",", > "&", {c-call-variable, "time_rec"}, ");", > "if (GSS_CALLING_ERROR(", > {c-call-variable, "major_status"}, ")) {", > {failure-atom, > {"GSS_CALLING_ERROR_TO_STRING(", > {c-call-variable, "major_status"}, > ")" > } > } > "}" > } > > Is that really more readable? Is that "a better way?" No, but I would be strongly inclined to write it as #include "dryverl.h" ... CCV(major_status) = gss_acquire_cred( &CCV(minor_status), CCV(desired_name), CCV(time_req), CCV(desired_mechs), CCV(cred_usage), &CCV(output_cred_handle), &CCV(actual_mechs), &CCV(time_rec)); if (GSS_CALLING_ERROR(CCV(major_status))) { dryverl_failure_atom(GSS_CALLING_ERROR_TO_STRING(CCV(major_status))); } which is certainly more readable than either of the versions above -- and can be expanded to much the same thing just by running it through the C preprocessor. I would also try to get rid of the need for CCV() if at all possible (maybe by telling Dryverl any information it needs about a variable only at its declaration, rather than every use). -- David Hopwood From invisio22@REDACTED Fri May 26 21:57:08 2006 From: invisio22@REDACTED (Eric Shun) Date: Fri, 26 May 2006 21:57:08 +0200 Subject: Node communication by public IP address Message-ID: <3f9db9f20605261257n297f1d20s407ad0397121352d@mail.gmail.com> Hi, I would like to ping a node using its public IP address (over the Internet). I try to run my nodes using erl -sname node1@REDACTED but that doesnt work. How can I run both nodes so they can communicate using their IP address? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sat May 27 00:01:12 2006 From: vances@REDACTED (Vance Shipley) Date: Fri, 26 May 2006 18:01:12 -0400 Subject: Language Bindings for Erlang In-Reply-To: <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> References: <4471BE5D.4080000@ericsson.com> <20060525163910.34592.qmail@web31604.mail.mud.yahoo.com> Message-ID: <20060526220111.GA19995@frogman.motivity.ca> On Thu, May 25, 2006 at 09:39:10AM -0700, Jeff Crane wrote: } } The C Linked Driver (also uses Erl_interface) is a } static driver which I *think* would be most } appropriate, but I would like some input, thx! There are some very good reasons why this approach might not work at all. Some real life examples from my past include; needing to service events other than file handles, using a library in a language that is not C, incompatibilities between OTP and 3rd party libraries. In those cases I used ports. I have a dynamic driver which pulls in shared libraries from a commercial vendor. It worked until a recent version where it seems to have a dependency on libstdc++. I've had to modify the Erlang/OTP build to make it work again. This would probably all be considered not-my-job and if I had kept to a seperate process (i.e. a C Node) it wouldn't have consumed any of my time. On the other hand a linked in driver is a wonderful thing when it works. I have message passing applications which use a linked in driver to move binaries between embedded processors and Erlang processes. The driver receives a message from the board and it sends an erlang term to the port owner which includes the received message as a binary. For large binaries this is a zero copy operation. I use GNU {automake|autoconf|libtool} to make the Erlang binary handling portable, autoconf tests drive the generation of erlang header files from templates. E.g.: Autoconf tests create the variables SIZEOF_foo and SIZEOF_bar. Autoconf then creates messages.hrl from template messages.hrl.in: -define(FOO, @SIZEOF_foo@/integer-unsigned-native-unit:8). -define(BAR, @SIZEOF_bar@/integer-unsigned-native-unit:8). -record(message1, {foo=0, bar=0}). Then I have a codec module which maps from records to binaries and vice versa: -module(messages). -export([message1/1]). -include("messages.hrl"). message1(<>) -> #message{foo=Foo, bar=Bar}; message1(#message{foo=Foo, bar=Bar}) -> <>. I've ported automatically from SPARC to Intel to Linux painlessly. -Vance From rlenglet@REDACTED Sat May 27 05:04:06 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Sat, 27 May 2006 12:04:06 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <44771726.3010005@blueyonder.co.uk> References: <200605260807.k4Q87X5S087288@atlas.otago.ac.nz> <200605261836.15195.rlenglet@users.forge.objectweb.org> <44771726.3010005@blueyonder.co.uk> Message-ID: <200605271204.06446.rlenglet@users.forge.objectweb.org> David Hopwood wrote: > I don't see the point of this extra layer. (Actually, I don't > see the point of trying to encode programming language code in > XML, ever.) This is the first time I see someone advocating for macros for solving complex problems, instead of a domain-specific language (such as Dryverl). Dryverl doesn't encode a programming language in XML. Part of it is pure declarative XML, and part of it adds markup (i.e. new syntactic constucts) to existing languages (C and Erlang) to hide complex implementation details. This is different. So, in your opinion, any language extension (such as jTom, or even the parse_transform/2 Erlang mechanism!) is useless, because it could be done using a pre-processor. That is the very meaning of what you wrote. And I don't agree. The Dryverl compiler generates code that is about ten times the length (in number of lines) of a binding specification. If you prefer writing ten times more code, it is up to you. But I don't prefer that. If you had ever tried to write a C port driver to bind a complex C library, you would see the point of a language that is higher-level than bare C and Erlang, even using a pre-processor. > > Is that really more readable? Is that "a better way?" > > No, but I would be strongly inclined to write it as > > #include "dryverl.h" > ... > > CCV(major_status) = gss_acquire_cred( > &CCV(minor_status), > CCV(desired_name), > CCV(time_req), > CCV(desired_mechs), > CCV(cred_usage), > &CCV(output_cred_handle), > &CCV(actual_mechs), > &CCV(time_rec)); > > if (GSS_CALLING_ERROR(CCV(major_status))) { > > dryverl_failure_atom(GSS_CALLING_ERROR_TO_STRING(CCV(major_sta >tus))); } > > which is certainly more readable than either of the versions > above -- and can be expanded to much the same thing just by > running it through the C preprocessor. Surely, macros work for this very simple *fragment of specification*. This example above was *a simple example of a specification fragment to compare representations in both XML and Erlang terms*. It is clearly not representative of the complexity of a C port driver implementation. You would also have to find another mechanism to generate the driver's init and stop functions, to generate automatically switch()es for the driver's port_output and call functions to dispatch calls, find a way to generate unique command identifiers and make them consistent between the generated C code and the generated Erlang code, find a way to hide the differences in implementation details between calls made through port_call/2 and port_command/2 to the same C code, hide the details when the output term is returned as a port_call/2's return value or using the emulator's driver_output function, as determined at runtime (all that *without having to modify or duplicate your binding code / specification*!!!), etc. etc. I wish good luck to you and your pre-processor. And I am convinced that your specifications would be much less readable than using Dryverl. Another example: currently Dryverl generates the source code of two Erlang modules and two C files (one .h and one .c), for every set of bindings (i.e. from one spec. file). What you propose is to write and maintain those four files separately, and prey for them to be consistent (e.g. have consistent command identifiers). Or please can you point me to a smart *C pre-processor* that allows to specify both Erlang and C code in a single file? In EDTK and Dryverl, everything is specified in a single specification. What needs to be consistent is generated automatically. All the boring and error-prone code (unlike the trivial example above) is generated automatically, and is *not written by developers*. That is the whole point of defining a new language and a compiler. So, *yes*, for the XML elements in the trivial *fragment* above, XML is overkill. But please take a look at Dryverl and at the C port driver APIs, and you would see that there is much more to C port driver development than this simple fragment. > I would also try to get rid of the need for CCV() if at all > possible (maybe by telling Dryverl any information it needs > about a variable only at its declaration, rather than every > use). In Dryverl, I have defined new markup elements only when necessary, to hide implementation details. What you don't understand from the above example taken out of context, is that call variables must be passed between the input decoding step, the body execution step and the output encoding step in a call. So they must be declared in a struct (they are *not* local variables!), of which an instance is allocated and is passed between the several C functions that implement the several steps in every binding. If the call is asynchronous, those functions must not call themselves directly, but instead through the emulator's dryver_async function. So, once again, *yes* for this very trivial specification *fragment* above, XML and a new layer is overkill, but *not* for the code that is generated all around this code. I am currently writing a tutorial and a simple example. It will make this discussion more concrete. -- Romain LENGLET From jjsanchez@REDACTED Sat May 27 13:04:34 2006 From: jjsanchez@REDACTED (Juan =?iso-8859-1?Q?Jos=E9_S=E1nchez?= Penas) Date: Sat, 27 May 2006 13:04:34 +0200 Subject: Node communication by public IP address In-Reply-To: <3f9db9f20605261257n297f1d20s407ad0397121352d@mail.gmail.com> References: <3f9db9f20605261257n297f1d20s407ad0397121352d@mail.gmail.com> Message-ID: <20060527110434.GA14748@riker.dc.fi.udc.es> Hi, On Fri, May 26, 2006 at 09:57:08PM +0200, Eric Shun wrote: > I would like to ping a node using its public IP address (over the Internet). > I try to run my nodes using erl -sname node1@REDACTED but that doesnt > work. > How can I run both nodes so they can communicate using their IP address? Have you tried with -name instead of -sname? In my two machines it works fine. In machine 192.168.0.1 I try: $ erl -name node2@REDACTED -setcookie hicookie Erlang (BEAM) emulator version 5.4.6 [source] [threads:0] Eshell V5.4.6 (abort with ^G) (node2@REDACTED)1> register(b,self()). true (node2@REDACTED)2> receive X -> X end. Then, i do the following in machine 192.168.0.2: $ erl -name node1@REDACTED -setcookie hicookie Erlang (BEAM) emulator version 5.4.6 [source] [hipe] Eshell V5.4.6 (abort with ^G) (node1@REDACTED)3> nodes(). [] (node1@REDACTED)4> {b,'node2@REDACTED'}!hi. hi (node1@REDACTED)5> nodes(). ['node2@REDACTED'] And I receive the hi message in 192.168.0.1. Cheers. From gefla@REDACTED Sat May 27 13:25:27 2006 From: gefla@REDACTED (Gerd Flaig) Date: Sat, 27 May 2006 13:25:27 +0200 Subject: SWIG, Re: Language Bindings for Erlang References: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> <20060526025303.4228.qmail@web31609.mail.mud.yahoo.com> <200605261624.51884.rlenglet@users.forge.objectweb.org> Message-ID: <87slmv90bc.fsf_-_@kilo.pond.sub.org> Romain Lenglet writes: >> An Erlang add-on to SWIG would be nice... >> >> http://www.swig.org/ >> >> Preferably, one should be able to choose creating a >> port-program, linked-in driver, C-node interface. >> It is up for grabs; anyone ? > > I have been working on it for some time. would you please tell why you abandoned that approach and chose to roll your own instead? I wonder what options there are for C++. The obvious approach seems to be to map classes to processes and method calls to sending a message (and receiving one if the method has a type different from void). But this only feels right for large objects. For small objects, it may be appropiate to add one more option to the list: BIF-Style. On the other hand, we may not want to go down that road and also refrain from linked-in drivers whenever possible. After all, fault isolation is a nice thing to have. Goodbyte, Gerd. -- The last thing one knows in constructing a work is what to put first. -- Blaise Pascal From bsder@REDACTED Sat May 27 14:12:41 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sat, 27 May 2006 05:12:41 -0700 Subject: Avoid newbie record redundancy? Message-ID: <44784239.3000104@allcaps.org> This is almost certainly a newbie question. I have the following code: match_queue(MasterQueue) -> receive {msgPeerMaster, #rcdPeerMaster{returnSocket=Socket, masterIP=MasterIP, masterPort=MasterPort}} -> QItem = #rcdPeerMaster{returnSocket=Socket, masterIP=MasterIP, masterPort=MasterPort}, match_queue(queue:in(QItem, MasterQueue)); _ -> ?elog("HELP!~n", []) end. Is it possible to still do the match on rcdPeerMaster while not unpacking and then repacking everything? That seems like a lot of needlessly duplicated code. Thanks, -a From kruegger@REDACTED Sat May 27 15:29:29 2006 From: kruegger@REDACTED (Stephen Han) Date: Sat, 27 May 2006 06:29:29 -0700 Subject: Avoid newbie record redundancy? In-Reply-To: <44784239.3000104@allcaps.org> References: <44784239.3000104@allcaps.org> Message-ID: <86f1f5350605270629r5728717dsb7d462e4f3608d41@mail.gmail.com> Hi I am not sure whether I understand your question or not but do you want something like this? match_queue(MasterQueue) -> receive { msgPeerMaster, A } when is_record(A,rcdPeerMaster) -> match_queue(queue:in(A, MasterQueue)); _ -> ?elog("HELP!~n", []) end. regards, On 5/27/06, Andrew Lentvorski wrote: > > This is almost certainly a newbie question. I have the following code: > > match_queue(MasterQueue) -> > receive > {msgPeerMaster, > #rcdPeerMaster{returnSocket=Socket, masterIP=MasterIP, > masterPort=MasterPort}} -> > QItem = #rcdPeerMaster{returnSocket=Socket, masterIP=MasterIP, > masterPort=MasterPort}, > match_queue(queue:in(QItem, MasterQueue)); > _ -> > ?elog("HELP!~n", []) > end. > > Is it possible to still do the match on rcdPeerMaster while not > unpacking and then repacking everything? That seems like a lot of > needlessly duplicated code. > > Thanks, > -a > -------------- next part -------------- An HTML attachment was scrubbed... URL: From invisio22@REDACTED Sat May 27 15:37:08 2006 From: invisio22@REDACTED (Eric Shun) Date: Sat, 27 May 2006 15:37:08 +0200 Subject: Node communication by public IP address In-Reply-To: <20060527110434.GA14748@riker.dc.fi.udc.es> References: <3f9db9f20605261257n297f1d20s407ad0397121352d@mail.gmail.com> <20060527110434.GA14748@riker.dc.fi.udc.es> Message-ID: <3f9db9f20605270637tb56ad84ud6178d9f3c90da30@mail.gmail.com> This works fine in a LAN but doesnt work through the Internet =( I opened those ports on both side: 4369 TCP and 9100 to 9105 and typed on the erlang console: application:set_env(kernel, inet_dist_listen_min, 9100). application:set_env(kernel, inet_dist_listen_max, 9105). But when I try net_adm:ping(DistantNode) it doesn't work =( Any idea? 2006/5/27, Juan Jos? S?nchez Penas : > > Hi, > > On Fri, May 26, 2006 at 09:57:08PM +0200, Eric Shun wrote: > > I would like to ping a node using its public IP address (over the > Internet). > > I try to run my nodes using erl -sname node1@REDACTED but that doesnt > > work. > > How can I run both nodes so they can communicate using their IP address? > > Have you tried with -name instead of -sname? > > In my two machines it works fine. > > In machine 192.168.0.1 I try: > > $ erl -name node2@REDACTED -setcookie hicookie > Erlang (BEAM) emulator version 5.4.6 [source] [threads:0] > Eshell V5.4.6 (abort with ^G) > (node2@REDACTED)1> register(b,self()). > true > (node2@REDACTED)2> receive X -> X end. > > > Then, i do the following in machine 192.168.0.2: > > $ erl -name node1@REDACTED -setcookie hicookie > Erlang (BEAM) emulator version 5.4.6 [source] [hipe] > Eshell V5.4.6 (abort with ^G) > (node1@REDACTED)3> nodes(). > [] > (node1@REDACTED)4> {b,'node2@REDACTED'}!hi. > hi > (node1@REDACTED)5> nodes(). > ['node2@REDACTED'] > > And I receive the hi message in 192.168.0.1. > > Cheers. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsder@REDACTED Sat May 27 22:06:46 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sat, 27 May 2006 13:06:46 -0700 Subject: Avoid newbie record redundancy? In-Reply-To: <86f1f5350605270629r5728717dsb7d462e4f3608d41@mail.gmail.com> References: <44784239.3000104@allcaps.org> <86f1f5350605270629r5728717dsb7d462e4f3608d41@mail.gmail.com> Message-ID: <4478B156.3010100@allcaps.org> Stephen Han wrote: > Hi > > I am not sure whether I understand your question or not but do you want > something like this? > > match_queue(MasterQueue) -> > receive > { msgPeerMaster, A } when is_record(A,rcdPeerMaster) -> > match_queue(queue:in(A, MasterQueue)); > _ -> > ?elog("HELP!~n", []) > end. Yes. That's exactly what I wanted. Thanks, -a From damien_katz@REDACTED Sat May 27 22:34:01 2006 From: damien_katz@REDACTED (Damien Katz) Date: Sat, 27 May 2006 13:34:01 -0700 (PDT) Subject: Avoid newbie record redundancy? In-Reply-To: <4478B156.3010100@allcaps.org> Message-ID: <20060527203401.41224.qmail@web54509.mail.yahoo.com> Is the following also acceptable, both functionally and stylewise? I find this more readable, but most code I see written uses the when clause and is_record(). match_queue(MasterQueue) -> receive { msgPeerMaster, #rcdPeerMaster{} = A } -> match_queue(queue:in(A, MasterQueue)); _ -> ?elog("HELP!~n", []) end. --- Andrew Lentvorski wrote: > Stephen Han wrote: > > Hi > > > > I am not sure whether I understand your question > or not but do you want > > something like this? > > > > match_queue(MasterQueue) -> > > receive > > { msgPeerMaster, A } when > is_record(A,rcdPeerMaster) -> > > match_queue(queue:in(A, MasterQueue)); > > _ -> > > ?elog("HELP!~n", []) > > end. > > Yes. That's exactly what I wanted. > > Thanks, > -a > From jjsanchez@REDACTED Sat May 27 22:56:02 2006 From: jjsanchez@REDACTED (Juan =?iso-8859-1?Q?Jos=E9_S=E1nchez?= Penas) Date: Sat, 27 May 2006 22:56:02 +0200 Subject: Avoid newbie record redundancy? In-Reply-To: <20060527203401.41224.qmail@web54509.mail.yahoo.com> References: <4478B156.3010100@allcaps.org> <20060527203401.41224.qmail@web54509.mail.yahoo.com> Message-ID: <20060527205602.GA21743@riker.dc.fi.udc.es> Hi, On Sat, May 27, 2006 at 01:34:01PM -0700, Damien Katz wrote: > Is the following also acceptable, both functionally > and stylewise? I find this more readable, but most > code I see written uses the when clause and > is_record(). > > match_queue(MasterQueue) -> > receive > { msgPeerMaster, #rcdPeerMaster{} = A } -> > match_queue(queue:in(A, MasterQueue)); > _ -> > ?elog("HELP!~n", []) > end. I think both ways of doing it are functionally equivalent in this case. Besides, with your approach, you could pattern match directly parts of the record, so it is potentially more powerful: #rcdPeerMaster{field1 = Value1, field2 = Value2, ...} = A. Stylewise I also think the one you propose is nicer, but I it is very subjective. BTW, if I remember correctly, I once read somewhere that using guards is less efficient than pattern matching directly using the record type. Anyone could confirm this? Cheers. From nm@REDACTED Sat May 27 23:36:40 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 28 May 2006 02:36:40 +0500 Subject: distributing .beam files/upgrading client software Message-ID: <4478C668.7000802@web.am> Hi all! If this questions have documented answers - just please say what and where to rtfm :) Are there any more-or-less standard way to distribute .beam files to multiple hosts ? I'm mainly interested of some, say, autoupgrade feature, which will allow upgrade user software without disturbing users and when developer wishes and not when user upgrades. Beam files are quite small and can be easily downloaded to clients which makes erlang perfect for such kind of tasks, IMHO - so users are not forced to download large executable files every time. I do NOT speak about upgrading code - because I'm running non-critical application , which clients may be restarted without any problems. Another issue which interests me is now to strip this options {compile,[{options,[export_all]}, {version,"4.3.9"}, {time,{2005,12,28,8,51,18}}, {source,"/usr/home/nm/tmp/a.erl"}] from module and thus from module_info() output? compiler.erl (or something near it) should be modified? Are there way to distribute gzipped beam files - as far I looked on zlib driver - it have hooks to load gzipped files - but how the should be created? Thanks in advance. -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From bsder@REDACTED Sun May 28 00:12:11 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sat, 27 May 2006 15:12:11 -0700 Subject: Avoid newbie record redundancy? In-Reply-To: <20060527203401.41224.qmail@web54509.mail.yahoo.com> References: <20060527203401.41224.qmail@web54509.mail.yahoo.com> Message-ID: <4478CEBB.1020400@allcaps.org> Damien Katz wrote: > Is the following also acceptable, both functionally > and stylewise? I find this more readable, but most > code I see written uses the when clause and > is_record(). > > match_queue(MasterQueue) -> > receive > { msgPeerMaster, #rcdPeerMaster{} = A } -> > match_queue(queue:in(A, MasterQueue)); > _ -> > ?elog("HELP!~n", []) > end. That's nice. I like the succinctness. The followup message about increased flexibility is a nice bonus. I wish we had more extensive examples of Erlang code. It took me about three hours of hacking and reading in order to work out the try ... catch syntax to throw away malformed packet messages: receive_messages(IPSMaster) -> receive {udp, Socket, IP, InPortNo, Packet} -> try binary_to_term(Packet) of DeserializedPacket -> io:format("Got message: ~p ~p ~p ~p~n", [Socket, IP, InPortNo, DeserializedPacket]) catch error:badarg -> io:format("Caught throw error:badarg ~n", []) end, receive_messages(IPSMaster) end. -a From jefcrane@REDACTED Sun May 28 02:14:31 2006 From: jefcrane@REDACTED (Jeff Crane) Date: Sat, 27 May 2006 17:14:31 -0700 (PDT) Subject: Language Bindings for Erlang In-Reply-To: <4476D617.2060707@xrnd.com> Message-ID: <20060528001431.64109.qmail@web31603.mail.mud.yahoo.com> When I readied and compiled the Port example from the interoperability tutorial, on windows XP, I am getting strange consistent results. // From the interoperability port tutorial // read: example problem, it's just foo() and bar() complex.c port.c erl_comm.c // all compile with (MinGW) gcc -o extprg complex.c erl_comm.c port.c 1>c(complex1.erl). 2> complex1:start("extprg"). <0.41.0> 3> complex1:foo(3). 4 4> complex1:bar(4). 8 5> complex1:bar(6). 12 6> complex1:bar(5). 13 --- I'm sorry, 13??? Next call to anything foo or bar hangs the client. This is ONLY true for 5. Not 10,15,20. Can someone explain why this is? The tutorial doesn't cover it. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From serge@REDACTED Sun May 28 04:08:08 2006 From: serge@REDACTED (Serge) Date: Sat, 27 May 2006 22:08:08 -0400 Subject: Language Bindings for Erlang In-Reply-To: <20060528001431.64109.qmail@web31603.mail.mud.yahoo.com> References: <4476D617.2060707@xrnd.com> <20060528001431.64109.qmail@web31603.mail.mud.yahoo.com> Message-ID: <44790608.3010900@corp.idt.net> Not sure if this will help, but I used the attached solution to deal with a similar problem regarding a hanging port program on Windows. http://www.erlang.org/ml-archive/erlang-questions/200305/msg00259.html Serge Jeff Crane wrote: > When I readied and compiled the Port example from the > interoperability tutorial, on windows XP, I am getting > strange consistent results. > > // From the interoperability port tutorial > // read: example problem, it's just foo() and bar() > complex.c > > port.c > erl_comm.c > > // all compile with (MinGW) > gcc -o extprg complex.c erl_comm.c port.c > > 1>c(complex1.erl). > 2> complex1:start("extprg"). > <0.41.0> > 3> complex1:foo(3). > 4 > 4> complex1:bar(4). > 8 > 5> complex1:bar(6). > 12 > 6> complex1:bar(5). > 13 > --- > I'm sorry, 13??? > Next call to anything foo or bar hangs the client. > This is ONLY true for 5. Not 10,15,20. Can someone > explain why this is? The tutorial doesn't cover it. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > From rlenglet@REDACTED Sun May 28 06:18:38 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Sun, 28 May 2006 13:18:38 +0900 Subject: SWIG, Re: Language Bindings for Erlang In-Reply-To: <87slmv90bc.fsf_-_@kilo.pond.sub.org> References: <2d827d6c3ae7493e25ac9fcc49071bf0@uninet.ee> <200605261624.51884.rlenglet@users.forge.objectweb.org> <87slmv90bc.fsf_-_@kilo.pond.sub.org> Message-ID: <200605281318.39244.rlenglet@users.forge.objectweb.org> On Saturday 27 May 2006 20:25, Gerd Flaig wrote: > Romain Lenglet writes: > >> An Erlang add-on to SWIG would be nice... > >> > >> http://www.swig.org/ > >> > >> Preferably, one should be able to choose creating a > >> port-program, linked-in driver, C-node interface. > >> It is up for grabs; anyone ? > > > > I have been working on it for some time. > > would you please tell why you abandoned that approach and chose to > roll your own instead? Sorry, my sentence was ambiguous. I never considered SWIG. I meant that I have been working on my own solution that would allow "to choose creating a port-program, linked-in driver, C-node interface." But not based on SWIG. I believe that the SWIG approach is OK when languages are similar, and have similar data models, etc. But Erlang and C are so different, and the port driver model so... restrictive, that I believe that an approach that takes a C function signature and automagically generates an Erlang binding can work only for a limited category of signatures. Or a lot must be done for a binding in additional hand-written wrappers, on the Erlang side and on the C side, to make the bound function signatures fit the limitations of the binding generator. See the previous email from Serge Aleynikov about the necessity to use C wrappers to overcome limitations of EDTK. The problem is that a complete binding specification becomes scattered accross several files / wrappers, and maintenance becomes difficult. It is better to specify everything about a binding in one place, and to have consistency ensured automatically by tools (compilers...). EDTK goes one step further than a SWIG approach, e.g. by allowing to specify when and how to map C data into integer identifiers, but since EDTK is also purely declarative and it offers little control without entering into the implementation details of the port driver, it is also not general enough. The point about Dryverl is that it provides extensive *programmatic control* over the implementation of a binding, which is necessary to handle all kinds of bindings. Dryverl has different objectives than SWIG and EDTK. Both aim at simplicity. Dryverl instead aims at flexibility and generality. However, if anybody would write a SWIG-like binding generator to handle a limited category of simple cases, and which would generate Dryverl specifications (or even only skeletons of specifications), that would be very useful. > I wonder what options there are for C++. The obvious approach seems to > be to map classes to processes and method calls to sending a message > (and receiving one if the method has a type different from void). But > this only feels right for large objects. You can make the "this" pointer explicit, and pass it as the first argument in normal function calls. On the Erlang side of the binding it would be a numeric identifier. On the C side of the binding, it would be mapped into an object pointer used as the target of C++ method calls. The value map mechanism in Dryverl can be used to implement this easily. Anyway, of course, this would require that you make all of your methods virtual. I don't see how to handle non-virtual methods (e.g. non-virtual destructors) in a clean way (and automatically!). -- Romain Lenglet From ssmith@REDACTED Sun May 28 06:47:50 2006 From: ssmith@REDACTED (Steve) Date: Sun, 28 May 2006 14:47:50 +1000 Subject: http_client and large files Message-ID: <1148791670.20946.8.camel@bill> Hi, I'm just looking at the http client module in the inets library and there doesn't seem to be any provision for handling large files being returned (it wants to return the whole thing in a tuple). Is there a method of installing a custom request-handler or am I missing something else? Cheers, Steve From bsder@REDACTED Sun May 28 13:04:11 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Sun, 28 May 2006 04:04:11 -0700 Subject: gen_server -- newbie code critique? Message-ID: <447983AB.5060001@allcaps.org> I'm trying to understand the gen_server behaviors, but I really seem to be having some trouble. So, what I tried to do was just create a wrapper around a basic queue that could be accessed by multiple processes. It seems to do what I want, but I could certainly use some critque at this point. Thanks, -a -module(msqueue). -behaviour(gen_server). -define(SERVER, ?MODULE). %% API -export([start_link/0, start/0, in/1, out/0, stop/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). %% API start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). start() -> gen_server:start({local, ?SERVER}, ?MODULE, [], []). in(InObj) -> gen_server:call(?SERVER, {in, InObj}). out() -> gen_server:call(?SERVER, {out}). stop() -> gen_server:cast(?SERVER, stop). %% gen_server callbacks -record(state, {theQueue}). init([]) -> {ok, #state{theQueue=queue:new()}}. handle_call({in, InObj}, _From, State) -> QR = queue:in(InObj, State#state.theQueue), UpdatedState = #state{theQueue=QR}, {reply, ok, UpdatedState}; handle_call({out}, _From, State) -> QR = queue:out(State#state.theQueue), RR = case QR of {{value, Item}, QQ} -> {value, Item}; {empty, QQ} -> {empty} end, {reply, RR, #state{theQueue=QQ}}. handle_cast(stop, State) -> {stop, normal, State}. handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. From chsu79@REDACTED Sun May 28 13:51:40 2006 From: chsu79@REDACTED (Christian S) Date: Sun, 28 May 2006 13:51:40 +0200 Subject: http_client and large files In-Reply-To: <1148791670.20946.8.camel@bill> References: <1148791670.20946.8.camel@bill> Message-ID: You probably want the ibrowse application that is in jungerl.sourceforge.net On 5/28/06, Steve wrote: > Hi, > > I'm just looking at the http client module in the inets library and > there doesn't seem to be any provision for handling large files being > returned (it wants to return the whole thing in a tuple). Is there a > method of installing a custom request-handler or am I missing something > else? > > Cheers, > Steve > > From tobbe@REDACTED Sun May 28 18:29:03 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Sun, 28 May 2006 18:29:03 +0200 Subject: gen_server -- newbie code critique? In-Reply-To: <447983AB.5060001@allcaps.org> References: <447983AB.5060001@allcaps.org> Message-ID: Andrew Lentvorski wrote: > I'm trying to understand the gen_server behaviors, but I really seem to > be having some trouble. So, what I tried to do was just create a > wrapper around a basic queue that could be accessed by multiple > processes. > > It seems to do what I want, but I could certainly use some > critque at this point. Looks fine to me! See a minor comment below. > > Thanks, > -a > > -module(msqueue). > -behaviour(gen_server). > ...snip.... > > handle_call({out}, _From, State) -> > QR = queue:out(State#state.theQueue), > RR = case QR of I would have written: RR = case queue:out(State#state.theQueue) of > {{value, Item}, QQ} -> > {value, Item}; > {empty, QQ} -> > {empty} > end, > {reply, RR, #state{theQueue=QQ}}. > Cheers, Tobbe From ok@REDACTED Mon May 29 03:23:57 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 29 May 2006 13:23:57 +1200 (NZST) Subject: Announcing Dryverl: an Erlang-to-C binding compiler Message-ID: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> Romain Lenglet wrote: XSLT is a nice standard language for writing transformations. It is a language. True. It is a language for writing transformations. It is not a de jure standard, but it's true that it is a de facto one. "Nice", however, doesn't really fit in that sentence. Not without some emphatic negatives attached rather closely. I described XML as absurdly bulky and not humanly readable. The same could be said of XSLT, if one wished to demonstrate the art of underemphasis. XSLT is an unholy mix of at least three different syntaxes, not just different in detail, but working on different principles. It includes two different subsets of XPath, with not-quite-compatible semantics. I have half a dozen XSLT implementations on my machine. But I found that writing XML transformations in Scheme was SEVEN TIMES SHORTER. Heck, even writing transformations in *C* was about five times shorter. (Mind you, that's with my own dvm2 library, but still...) About the only thing that could make me write XSLT would be very large sums of money, or possibly a gun to my head. 2- The Dryverl language is in fact composed of XML + two dialects: an Erlang-XML dialect, and a C-XML dialect. For instance, an actual piece of specification is: = gss_acquire_cred( &, , , , , &, &, &); if (GSS_CALLING_ERROR( )) { GSS_CALLING_ERROR_TO_STRING() } When I said that Erlang had better ways than using XML, I wasn't confining myself to pure Erlang data structures. The design of little languages is an art that should not be lost just because XML exists. The great merit of little languages is that they can help us three major ways: (1) They can make it much easier to write what we do want. (1a) This requires them to be easy to WRITE, so that there is very little there that is not necessary. (1b) It also requires them to be easy to READ, so that it is easy for people to see whether we have written what we meant to write. (2) They can make it much harder to write what we do NOT want. (2a) They can make large classes of mistakes simply inexpressible. (2b) They can have specially tailored polymorphic type systems (possibly including effects or state in the type system) which make it easy to check for semantic errors. (3) They can decouple semantics from processing. As far as I can see, doing this kind of stuff in XML buys you (3). *POSSIBLY*, if it were all done using markup in such a way that a Schema could check a lot of it, it could buy you some of (2a). But XML Schemas don't buy you any of (2b), and not only does XML not help with (1a) or (1b), it actively sabotages any gains we might have had there. This fragment of C-XML dialect code is a call to a C GSSAPI function. There is as much C code text as XML elements. This fits XML and XSLT very well. Well, no, because XSLT isn't particularly good at transforming text. In Erlang, if we roughly follow the same structure as for DOM, A good way to support little languages in Erlang is through Leex and Yecc. From rlenglet@REDACTED Mon May 29 07:30:14 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 29 May 2006 14:30:14 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> Message-ID: <200605291430.15139.rlenglet@users.forge.objectweb.org> Hi, Richard A. O'Keefe wrote: > Romain Lenglet wrote: > XSLT is a nice standard language for writing transformations. > > It is a language. True. > It is a language for writing transformations. > It is not a de jure standard, but it's true that it is a de > facto one. "Nice", however, doesn't really fit in that > sentence. Not without some emphatic negatives attached rather > closely. > > I described XML as absurdly bulky and not humanly readable. > The same could be said of XSLT, if one wished to demonstrate > the art of underemphasis. I already agreed about the verbosity of XML. > XSLT is an unholy mix of at least three different syntaxes, > not just different in detail, but working on different > principles. It includes two different subsets of XPath, with > not-quite-compatible semantics. > > I have half a dozen XSLT implementations on my machine. > But I found that writing XML transformations in Scheme was > SEVEN TIMES SHORTER. Heck, even writing transformations in > *C* was about five times shorter. (Mind you, that's with my > own dvm2 library, but still...) About the only thing that > could make me write XSLT would be very large sums of money, or > possibly a gun to my head. I also know how to write nice transformation systems. However, my objective with Dryverl was not to demonstrate my skills. My objective with Dryverl was to develop something that anybody can broadly use and modify, even if I ever orphan this project. People will never be locked up with a dead transformation system that is not, or cannot be, maintained. That is exactly what happened with EDTK: it relies on the GSLgen library, which is no more maintained, and this makes the maintainance of *EDTK* difficult. If I used your dvm2 library, how could I make sure that you would maintain it as long as the Dryverl project will exist? As you write yourself, there are many implementations of XSLT 1.0. That was one main reason why I chose it. I agree that XSLT 1.0 has problems. The biggest problem is the lack of typing. If you specify a wrong XPath expression in the match attribute of a template, the template will simply never be evaluated, silently. This makes testing difficult. There are other, typed transformation systems for XML around: - Cduce. Cduce transformations are strongly typed according to an XML Schema. However, Cduce seems no more maintained, and seems appropriate only for fully structured XML documents, not documents with mostly mixed content (CDATA + elements mixed) such as Dryverl. - erlsom. Not yet mature, and does not yet implement all the XML Schema features that are used in Dryverl. - XSLT 2.0 specifies conformance rules for schema-aware processors, which solves the lack of typing of XSLT 1.0, and makes XML Schema's data model the only one used. However, XSLT 2.0 is not yet as widespread as XSLT 1.0, although Free Software schema-aware processors exist (e.g. Saxon). Therefore, I still claim that XSLT 1.0 is a nice *widespread* and usable transformation language, for which several transformation systems exist and are actively maintained. People can use, read and modify the Dryverl stylesheets (although it is verbose), *now* and at any time in the future. [...] > When I said that Erlang had better ways than using XML, I > wasn't confining myself to pure Erlang data structures. The > design of little languages is an art that should not be lost > just because XML exists. The great merit of little languages > is that they can help us three major ways: > > (1) They can make it much easier to write what we do want. > (1a) This requires them to be easy to WRITE, so that > there is very little there that is not necessary. (1b) It also > requires them to be easy to READ, so that it is easy for > people to see whether we have written what we meant to write. > (2) They can make it much harder to write what we do NOT > want. (2a) They can make large classes of mistakes simply > inexpressible. (2b) They can have specially tailored > polymorphic type systems (possibly including effects or state > in the type system) which make it easy to check for semantic > errors. (3) They can decouple semantics from processing. > > As far as I can see, doing this kind of stuff in XML buys you > (3). *POSSIBLY*, if it were all done using markup in such a > way that a Schema could check a lot of it, it could buy you > some of (2a). That is true for Dryverl. Cf. the typing example below. > But XML Schemas don't buy you any of (2b), That is plainly WRONG. This is one big feature of XML Schema: it provides typing of syntactic elements. And it supports relational constraints. For instance, here is an extract of the Dryverl XML Schema: This specifies that: 1- Value map names must be unique, i.e. the name="..." attributes in elements must be unique. 2- References to value maps must use names that are specified in the name="..." attributes of elements. For instance, the name="..." attribute in a element must be a name in a element. *That* "makes it easy to check for semantic errors". > and > not only does XML not help with (1a) or (1b), it actively > sabotages any gains we might have had there. Wrong. The use of XML Schema provides (2b) and (3), and (2a) is true for the Dryverl language. What is left from your critics is that the use of XML makes the Dryverl language verbose. And yes, I agree, that's true. > This fragment of C-XML dialect code is a call to a C GSSAPI > function. There is as much C code text as XML elements. This > fits XML and XSLT very well. > > Well, no, because XSLT isn't particularly good at transforming > text. Yes, but XSLT is good at transforming mixed content (text + markup mixed), using recursive templates and elements. *This* was my point. > A good way to support little languages in Erlang is through > Leex and Yecc. Perhaps, but they are not appropriate *to the Dryverl language*, for two reasons: 1- Dryverl is in fact composed of *six* "sub-"languages: - One structured, declarative language for specifying value maps, etc. Yes, this simple language could be specified using Leex and Yecc. - *Two* distinct "Erlang + markup" dialects. Using Yecc, you would have to specify *twice* the complete Erlang grammar + extensions. - *Three* distinct "C + markup" dialects. Using Yecc, you would have to specify *thrice* the complete C grammar (!) + extensions. Therefore, Dryverl is no more a "little language" once you use tools such as Leex and Yecc. Those tools are not appropriate for the specification of the Dryverl language. 2- Yecc is limited to the specification of context-free grammars. The grammar of Dryverl is not context-free, because the specified restrictions cannot be expressed using a context-free grammar, but can be using XML Schema's typing. I am not aware of other specification languages that provide typing like XML Schema and ASN.1. This is a strong feature. And it is not provided by Yecc. For instance, let's consider that simplified extract from the Dryverl XML Schema: Those are extracts for two of the C + XML dialects that are defined in the Dryverl language. Some elements have the same name in the two dialects: you can remark that there are two definitions of elements with the same name ( and ), but in different contexts, and with different types that define *different constraints on their contents*. These constraints specify that it is allowed to write: ... and it is allowed to write: ... but it is forbidden to write: ... This cannot be specified in a context-free grammar such as Yecc's. The two solutions that approach this, using context-free grammars, are: 1- to loose semantics, by specifying one single non-terminal for C code blocks and for and , which would be equivalent to specifying this looser XML Schema: Wrong constructs are allowed by such a schema, e.g.: ... You're loosing points (2a) and (2b). 2- by using different lexical tokens for the elements with different types, which would be equivalent to always giving different names to elements that have different types (e.g. add "di-" and "eo-" prefixes): These constraints specify that it is allowed to write: ... and it is allowed to write: ... and it is forbidden to write: ... Problem: that is no more the same language! And it makes the language artificially more complex only because of limitations in the implementation of your parser: developers have to remember the different lexical variants of elements, depending on the context. Regards, -- Romain LENGLET From mikael.karlsson@REDACTED Mon May 29 07:45:59 2006 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Mon, 29 May 2006 07:45:59 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> Message-ID: <200605290746.00262.mikael.karlsson@creado.com> Mon 29 May 2006 03:23 Richard A. O'Keefe wrote: > Romain Lenglet wrote: > XSLT is a nice standard language for writing transformations. > > It is a language. True. > It is a language for writing transformations. > It is not a de jure standard, but it's true that it is a de facto one. > "Nice", however, doesn't really fit in that sentence. > Not without some emphatic negatives attached rather closely. > .... For what it is worth: there is a small module in the (Erlang/OTP) xmerl lib called xmerl_xs to write simple XSLT like transforms in Erlang. Old user guide at: http://www.creado.com/xmerl_xs/index.html Not standard - but Erlang. Cheers Mikael From tzheng@REDACTED Wed May 24 21:32:08 2006 From: tzheng@REDACTED (Tony Zheng) Date: Wed, 24 May 2006 12:32:08 -0700 Subject: How to run distributed Erlang through a firewall? Message-ID: <1148499128.9039.77.camel@gateway> Hi I found some instructions about how to run distributed Erlang through a firewall. It said: ----------------------------------------------------------------- ...run distributed Erlang through a firewall? The simplest approach is to make an a-priori restriction to the TCP ports distributed Erlang uses to communicate through by setting the (undocumented) kernel variables 'inet_dist_listen_min' and 'inet_dist_listen_max': application:set_env(kernel, inet_dist_listen_min, 9100). application:set_env(kernel, inet_dist_listen_max, 9105). This forces Erlang to use only ports 9100--9105 for distributed Erlang traffic. ----------------------------------------------------------------- My question is: Can I use it to replicate two Erlang nodes behind the different routers on Internet? I did it as follows: 1. Created two Erlang nodes(they have the same erlangcookie):one@REDACTED and two@REDACTED They are behind the different routers: router1 and router2. 2. On one@REDACTED, set the TCP ports: (one@REDACTED)1> application:set_env(kernel, inet_dist_listen_min, 9100). ok (one@REDACTED)2> application:set_env(kernel, inet_dist_listen_max, 9101). ok 3. On two@REDACTED, set the TCP ports: (two@REDACTED)1> application:set_env(kernel, inet_dist_listen_min, 9100). ok (two@REDACTED)2> application:set_env(kernel, inet_dist_listen_max, 9101). ok 4. Forwarded the server port numbers(9100 and 9101) to Internet on both routers(router1 and router2). 5. The two Erlang nodes can't find the other one with net_adm:ping(one@REDACTED) or net_adm:ping(two@REDACTED). On one@REDACTED, (one@REDACTED)3> net_adm:ping(two@REDACTED). pang On two@REDACTED, (two@REDACTED)3> net_adm:ping(one@REDACTED). pang That means the two Erlang nodes can not replicate data each other because they can't find the other one. If I forword the two server IP address, the two erlang nodes can find each other and replicate well. But the safety is a big problem. I hope to force erlang to use only some ports for replication. Does it make sense? Is there any ideas and suggestions? Thanks. tony From jahakala@REDACTED Mon May 29 09:38:14 2006 From: jahakala@REDACTED (Jani Hakala) Date: Mon, 29 May 2006 10:38:14 +0300 Subject: How to run distributed Erlang through a firewall? In-Reply-To: <1148499128.9039.77.camel@gateway> (Tony Zheng's message of "Wed, 24 May 2006 12:32:08 -0700") References: <1148499128.9039.77.camel@gateway> Message-ID: <877j451dsp.fsf@pingviini.kortex.jyu.fi> Tony Zheng writes: > 4. Forwarded the server port numbers(9100 and 9101) to Internet on both > routers(router1 and router2). > What about port 4369 i.e. epmd? Jani Hakala From raimo@REDACTED Mon May 29 09:41:41 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 29 May 2006 09:41:41 +0200 Subject: Avoid newbie record redundancy? References: <4478B156.3010100@allcaps.org>, <20060527203401.41224.qmail@web54509.mail.yahoo.com>, <20060527205602.GA21743@riker.dc.fi.udc.es> Message-ID: I also prefer this pattern-matching approach. About efficiency: If you have several patterns, the language defines that the first pattern that matches will be picked, but the compiler optimizes the tests an reorders them to find an efficient match test sequence: case X of {a,b,c,d} -> 4; {a,b,c,_} -> 3; {a,b,_,_} -> 2; {a,_,_,_} -> 1; {_,_,_,_} -> 0; _ -> oops end if the first pattern does not match, the pattern matching code knows if the first fields are 'a', 'b', etc or not and does not retest them. The pattern is compiled into a testing code a'la: if is_tuple(X) and is_arity(4, X) -> if element(1, X) == a -> if element(2, X) == b -> if element(3, X) == c -> if element(4, X) == d -> 4; else -> 3; else -> 2; else -> 1; else -> 0; else error({badmatch,X}) But if a guard is thrown in at an unlucky position: case X of {a,b,c,d} -> 4; {a,b,c,_} -> 3; _ when is_integer(X) -> int; {a,b,_,_} -> 2; {a,_,_,_} -> 1; {_,_,_,_} -> 0; _ -> oops end the compiler is not smart enough to analyze the guard expression, it just splits the pattern matching into two sections, before or after the guard, and optimizes them separately. So in this example after the is_integer(X) guard it restarts testing if X is a tuple, if arity is 4, if element 1 is 'a', ... So here you can help the compiler by moving the is_integer() guard down to just before the _ pattern. Otherwise I do not think guard tests are partically slow. They are calls to guard BIFs, which is a wee bit slower than pattern matching code that is specalized instructions, but the standard pitfall is mixing guards with pattern matching in unlucky combinations as I described above. > Hi, > > On Sat, May 27, 2006 at 01:34:01PM -0700, Damien Katz wrote: > > Is the following also acceptable, both functionally > > and stylewise? I find this more readable, but most > > code I see written uses the when clause and > > is_record(). > > > > match_queue(MasterQueue) -> > > receive > > { msgPeerMaster, #rcdPeerMaster{} = A } -> > > match_queue(queue:in(A, MasterQueue)); > > _ -> > > ?elog("HELP!~n", []) > > end. > > I think both ways of doing it are functionally equivalent in this case. > Besides, with your approach, you could pattern match directly parts of the > record, so it is potentially more powerful: > > #rcdPeerMaster{field1 = Value1, field2 = Value2, ...} = A. > > Stylewise I also think the one you propose is nicer, but I it is very > subjective. > > BTW, if I remember correctly, I once read somewhere that using guards is > less efficient than pattern matching directly using the record type. Anyone > could confirm this? > > Cheers. > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Mon May 29 10:25:51 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 May 2006 10:25:51 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605291430.15139.rlenglet@users.forge.objectweb.org> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> Message-ID: <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> Hi, > -----Original Message----- > From: Romain Lenglet > 2- by using different lexical tokens for the elements with > different types, which would be equivalent to always giving > different names to elements that have different types (e.g. > add "di-" and "eo-" > prefixes): I apologize for barging into the discussion, but I don't agree with this statement. What you say is true for xslt because it describes the grammar as directly as a parse tree. If using a "normal" domain specific language, the definition will of course include such duplication of definitions, but this need not be visible at the syntactic level. Something like (very simplified) expr -> 'decode' decode_input : {decode, '$2'}. expr -> 'encode' encode_input : {encode, '$2'}. decode_input -> 'map' map_d: {decode_input, '$2'}. encode_input -> 'map' map_e: {encode_input, '$2'}. map_d -> id_ref_d: ['$1']. map_d -> id_ref_d ',' map_d: ['$1'|'$3']. map_e -> id_ref_e: ['$1']. map_e -> id_ref_e ',' map_e: ['$1'|'$3']. id_ref_d -> 'decode_op': decoding. id_ref_e -> 'encode_op': encoding. will work nicely as intended. Whether this is better or worse than xslt is completely another issue. Note: the C language isn't context-free either and yacc grammars can handle it. The semantic checking has only to be moved as a separate step after the parsing. I agree it's not very nice, but it works. regards, Vlad From rlenglet@REDACTED Mon May 29 10:49:04 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 29 May 2006 17:49:04 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> Message-ID: <200605291749.05052.rlenglet@users.forge.objectweb.org> Vlad Dumitrescu wrote: > I apologize for barging into the discussion, but I don't agree > with this statement. You are welcome. > What you say is true for xslt because it describes the grammar > as directly as a parse tree. s/XSLT/XML Schema/ > If using a "normal" domain specific language, the definition > will of course include such duplication of definitions, but > this need not be visible at the syntactic level. > > Something like (very simplified) > > expr -> 'decode' decode_input : {decode, '$2'}. > expr -> 'encode' encode_input : {encode, '$2'}. > > decode_input -> 'map' map_d: {decode_input, '$2'}. > > encode_input -> 'map' map_e: {encode_input, '$2'}. > > map_d -> id_ref_d: ['$1']. > map_d -> id_ref_d ',' map_d: ['$1'|'$3']. > > map_e -> id_ref_e: ['$1']. > map_e -> id_ref_e ',' map_e: ['$1'|'$3']. > > id_ref_d -> 'decode_op': decoding. > > id_ref_e -> 'encode_op': encoding. > > > will work nicely as intended. Alright, it works. :-) It is sort-of equivalent to my XML Schema: XML element names are like lexical tokens, and XML element types are like the names of non-terminals in this case. > Whether this is better or worse than xslt is completely > another issue. s/XSLT/XML Schema/ > Note: the C language isn't context-free either and yacc > grammars can handle it. The semantic checking has only to be > moved as a separate step after the parsing. I agree it's not > very nice, but it works. That was my point against some of ROK's statements: using XML Schema, you can express semantic rules that are checked by the parser. -- Romain LENGLET From vladdu55@REDACTED Mon May 29 10:59:32 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 May 2006 10:59:32 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605291749.05052.rlenglet@users.forge.objectweb.org> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> <200605291749.05052.rlenglet@users.forge.objectweb.org> Message-ID: <95be1d3b0605290159h5a4d5285t69323623f8194e7d@mail.gmail.com> On 5/29/06, Romain Lenglet wrote: > s/XSLT/XML Schema/ Right! :-) > > Note: the C language isn't context-free either and yacc > > grammars can handle it. The semantic checking has only to be > > moved as a separate step after the parsing. I agree it's not > > very nice, but it works. > > That was my point against some of ROK's statements: using XML > Schema, you can express semantic rules that are checked by the > parser. True, but I think the issue is to balance making life easy for the *Dryverl developers* by using a more powerful tool instead of using one and having to write another one (the semantic analyzer) at the expense of a much more verbose and harder to read/write language to be used by *driver developers*. I don't know if that's what Richard was aiming at, but my belief is that a tool should make life easier foremost for the end users. Otherwise they won't use it... regards, Vlad From bengt.kleberg@REDACTED Mon May 29 11:16:36 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 29 May 2006 11:16:36 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <95be1d3b0605290159h5a4d5285t69323623f8194e7d@mail.gmail.com> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> <200605291749.05052.rlenglet@users.forge.objectweb.org> <95be1d3b0605290159h5a4d5285t69323623f8194e7d@mail.gmail.com> Message-ID: <447ABBF4.7030307@ericsson.com> On 2006-05-29 10:59, Vlad Dumitrescu wrote: ...deleted > I don't know if that's what Richard was aiming at, but my belief is > that a tool should make life easier foremost for the end users. > Otherwise they won't use it... > > regards, > Vlad i agree, but then we have this: Worse is Better (http://www.dreamsongs.com/WIB.html) bengt -- EPO giudelines 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 bsder@REDACTED Mon May 29 11:29:44 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 29 May 2006 02:29:44 -0700 Subject: How to build a binary of 1024 zeros? Message-ID: <447ABF08.3000203@allcaps.org> Is there an equivalent to lists:duplicate(1024, 0), but for binaries? Obviously I can just use list_to_binary(lists:duplicate(1024,0)), but I was wondering if there was an idiom I'm missing. Filling a binary with a specific value seems like a pretty primitive operation that probably has a method I'm not seeing. Thanks, -a From bjorn@REDACTED Mon May 29 11:48:11 2006 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 29 May 2006 11:48:11 +0200 Subject: distributing .beam files/upgrading client software In-Reply-To: <4478C668.7000802@web.am> References: <4478C668.7000802@web.am> Message-ID: beam_lib can be used to make changes to .beam files such as strip out the compiler options. /Bjorn Gaspar Chilingarov writes: > Hi all! > > If this questions have documented answers - just please say what and > where to rtfm :) > > Are there any more-or-less standard way to distribute .beam files to > multiple hosts ? I'm mainly interested of some, say, autoupgrade > feature, which will allow upgrade user software without disturbing users > and when developer wishes and not when user upgrades. > > Beam files are quite small and can be easily downloaded to clients which > makes erlang perfect for such kind of tasks, IMHO - so users are not > forced to download large executable files every time. > > I do NOT speak about upgrading code - because I'm running non-critical > application , which clients may be restarted without any problems. > > Another issue which interests me is now to strip this options > {compile,[{options,[export_all]}, > {version,"4.3.9"}, > {time,{2005,12,28,8,51,18}}, > {source,"/usr/home/nm/tmp/a.erl"}] > > from module and thus from module_info() output? > compiler.erl (or something near it) should be modified? > > Are there way to distribute gzipped beam files - as far I looked on zlib > driver - it have hooks to load gzipped files - but how the should be > created? > > > Thanks in advance. > > -- > Gaspar Chilingarov > > System Administrator, > Network security consulting > > t +37491 419763 (mob) > i 63174784 > e nm@REDACTED > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vladdu55@REDACTED Mon May 29 11:58:30 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 May 2006 11:58:30 +0200 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <447ABBF4.7030307@ericsson.com> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> <200605291749.05052.rlenglet@users.forge.objectweb.org> <95be1d3b0605290159h5a4d5285t69323623f8194e7d@mail.gmail.com> <447ABBF4.7030307@ericsson.com> Message-ID: <95be1d3b0605290258t46552964td176c6c8a1c5fce8@mail.gmail.com> On 5/29/06, Bengt Kleberg wrote: > On 2006-05-29 10:59, Vlad Dumitrescu wrote: > ...deleted > > I don't know if that's what Richard was aiming at, but my belief is > > that a tool should make life easier foremost for the end users. > > Otherwise they won't use it... > > > > regards, > > Vlad > > i agree, but then we have this: Worse is Better > (http://www.dreamsongs.com/WIB.html) Yes, but these choices are heavily dependent on the relative "badness" and "goodness" - not everything that is worse is better :-) The article says that WiB so that things can gain a wide base fast, which in this case might not be very relevant, as there's no competition. Also, I think I would like to use this argument in a different way: let Dryverl be "worse" in the meaning of not providing a complete semantic analysis at parse time, but instead having a smooth learning curve. Add this analysis later. My personal bias is that I would rather code a driver from scratch (because then I at least understand what's happening) than using an overly complicated tool. I can't say where the break-even point is, and I don't want to imply that Dryverl's use of xml is overly complicated - but from the few examples I seen it does seem possible for it to be so. /Vlad From vladdu55@REDACTED Mon May 29 12:00:19 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 29 May 2006 12:00:19 +0200 Subject: How to build a binary of 1024 zeros? In-Reply-To: <447ABF08.3000203@allcaps.org> References: <447ABF08.3000203@allcaps.org> Message-ID: <95be1d3b0605290300w3a3e5bebqe1c1b4ec585d2ff@mail.gmail.com> Hi, On 5/29/06, Andrew Lentvorski wrote: > Is there an equivalent to lists:duplicate(1024, 0), but for binaries? <<0:8192>> works for me. /Vlad From rlenglet@REDACTED Mon May 29 12:01:06 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 29 May 2006 19:01:06 +0900 Subject: How to build a binary of 1024 zeros? In-Reply-To: <447ABF08.3000203@allcaps.org> References: <447ABF08.3000203@allcaps.org> Message-ID: <200605291901.07026.rlenglet@users.forge.objectweb.org> Andrew Lentvorski wrote: > Is there an equivalent to lists:duplicate(1024, 0), but for > binaries? <<0:1024>> -- Romain LENGLET From rlenglet@REDACTED Mon May 29 12:03:46 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 29 May 2006 19:03:46 +0900 Subject: How to build a binary of 1024 zeros? In-Reply-To: <447ABF08.3000203@allcaps.org> References: <447ABF08.3000203@allcaps.org> Message-ID: <200605291903.55639.rlenglet@users.forge.objectweb.org> Andrew Lentvorski wrote: > Is there an equivalent to lists:duplicate(1024, 0), but for > binaries? Sorry, the correct expression is: <<0:(8*1024)>> -- Romain LENGLET From matthias@REDACTED Mon May 29 12:12:59 2006 From: matthias@REDACTED (Matthias Lang) Date: Mon, 29 May 2006 12:12:59 +0200 Subject: How to build a binary of 1024 zeros? In-Reply-To: <200605291901.07026.rlenglet@users.forge.objectweb.org> References: <447ABF08.3000203@allcaps.org> <200605291901.07026.rlenglet@users.forge.objectweb.org> Message-ID: <17530.51499.646111.243680@antilipe.corelatus.se> Romain Lenglet writes: > Andrew Lentvorski wrote: > > Is there an equivalent to lists:duplicate(1024, 0), but for > > binaries? > > <<0:1024>> <<0:8192>>, assuming Andrew means 1024 octets. But that only works for the special cases 0x00 and 0xff, i.e. you can't do the equivalent of lists:duplicate(1024, 99). Matthias From nm@REDACTED Mon May 29 12:33:30 2006 From: nm@REDACTED (Gaspar Chilingarov) Date: Mon, 29 May 2006 15:33:30 +0500 Subject: distributing .beam files/upgrading client software In-Reply-To: References: <4478C668.7000802@web.am> Message-ID: <447ACDFA.7030503@web.am> Bjorn Gustavsson wrote: > beam_lib can be used to make changes to .beam files such as strip > out the compiler options. > > /Bjorn > thanks . what about distributing beam files to clients - should I implement my own distribution protocol? > Gaspar Chilingarov writes: > >> Hi all! >> >> If this questions have documented answers - just please say what and >> where to rtfm :) >> >> Are there any more-or-less standard way to distribute .beam files to >> multiple hosts ? I'm mainly interested of some, say, autoupgrade >> feature, which will allow upgrade user software without disturbing users >> and when developer wishes and not when user upgrades. >> >> Beam files are quite small and can be easily downloaded to clients which >> makes erlang perfect for such kind of tasks, IMHO - so users are not >> forced to download large executable files every time. >> >> I do NOT speak about upgrading code - because I'm running non-critical >> application , which clients may be restarted without any problems. >> >> Another issue which interests me is now to strip this options >> {compile,[{options,[export_all]}, >> {version,"4.3.9"}, >> {time,{2005,12,28,8,51,18}}, >> {source,"/usr/home/nm/tmp/a.erl"}] >> >> from module and thus from module_info() output? >> compiler.erl (or something near it) should be modified? >> >> Are there way to distribute gzipped beam files - as far I looked on zlib >> driver - it have hooks to load gzipped files - but how the should be >> created? >> >> >> Thanks in advance. >> >> -- >> Gaspar Chilingarov >> >> System Administrator, >> Network security consulting >> >> t +37491 419763 (mob) >> i 63174784 >> e nm@REDACTED >> > -- Gaspar Chilingarov System Administrator, Network security consulting t +37491 419763 (mob) i 63174784 e nm@REDACTED From tobbe@REDACTED Mon May 29 13:33:58 2006 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 29 May 2006 13:33:58 +0200 Subject: How to build a binary of 1024 zeros? In-Reply-To: <447ABF08.3000203@allcaps.org> References: <447ABF08.3000203@allcaps.org> Message-ID: Andrew Lentvorski wrote: > Is there an equivalent to lists:duplicate(1024, 0), but for binaries? What about: -define(BYTE, integer-unit:8). % Nice syntactic sugar... <<0:1024/?BYTE>> --Tobbe From bsder@REDACTED Mon May 29 13:58:06 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 29 May 2006 04:58:06 -0700 Subject: Parsing an incoming Shoutcast request Message-ID: <447AE1CE.7050605@allcaps.org> Another newbie question. I'm trying to do something very similar to the Shoutcast server sample code from Practical Common Lisp. The initial request from an MP3 client to the streaming server (which I want to write in Erlang) looks very much like HTTP. GET / HTTP/1.1\r\n Host: 127.0.0.1:33669\r\n User-Agent: VLC media player - version 0.8.5 Janus - VideoLAN team\r\n Range: bytes=0-\r\n Icy-MetaData: 1\r\n Connection: Close\r\n \r\n Now, I know have to do the gen_tcp:listen and gen_tcp:accept to get the actual connection socket. Once, I have that socket, though, I either need to do something with messages and {active, once} or gen_tcp:recv() and {active, false}. I can't see a particularly obvious way to structure this for pattern matches to make things easy. Given that this looks like it should be very ripe for some form of pattern match, I thought I would try asking those with more experience for some friendly advice before plowing ahead and writing lots of very stupid code. Thanks, -a From ke.han@REDACTED Mon May 29 16:08:42 2006 From: ke.han@REDACTED (ke han) Date: Mon, 29 May 2006 22:08:42 +0800 Subject: auto-generated record access functions In-Reply-To: References: Message-ID: <618048A9-BC89-4A48-8265-751CC47EB2A9@redstarling.com> Ulf, I've just tested your record access generator. I'm getting some errors. I compile test.erl which is: -module(test). -compile({parse_transform, exprecs}). -record(person, {firstName, lastName, birthDate}). -export_records([person]). compile results: (note, my erlc is a bash script which adds path, includes and outputs in the correct places) > erlc test.erl using /Users/jhancock/bin/erlc ./test.erl:4: function '#new-person'/0 undefined ./test.erl:4: function '#set-person'/2 undefined ./test.erl:4: function '#get-person'/2 undefined ./test.erl:4: function '#info-person'/1 undefined ./test.erl:4: function '#new-person'/1 undefined I just tried your exact example from the April 19 posting. -module(test). -compile({parse_transform, exprecs}). -record(a, {a, b, c}). -export_records([a]). same type of errors. any ideas? thanks, ke han On Apr 19, 2006, at 12:35 AM, Ulf Wiger ((AL/EAB)) wrote: > > I've written a small(-ish) parse transform that > generates code for accessing exported records. > > I did read through ROK's abstract patterns proposal > once more, but decided that it would be too much to > try to implement _that_. The current hack does use > function names that are somewhat similar to ROK's > abstract patterns, but I don't think that will be a > problem (mainly because I don't envision that anyone > would use this stuff if the abstract patterns were > available.) > > The idea is to use records as before, but for module- > local use. For outside callers, records are 'exported' > by including a -export_records([RecName]) directive. > The following code extract illustrates the kind of > code laid out by the parse_transform: > > -module(test). > -compile({parse_transform, exprecs}). > -record(a, {a, b, c}). > -export_records([a]). > > %%% generated code > -export(['#new-a'/0, '#new-a'/1, > '#get-a'/2, '#set-a'/2, > '#info-a'/1]). > > '#new-a'() -> #a{}. > '#new-a'(Vals) -> '#set-a'(Vals, #a{}). > > '#get-a'(Attrs, R) when is_list(Attrs) -> > ['#get-a'(A, R) || A <- Attrs]; > '#get-a'(a, R) -> R#a.a; > '#get-a'(b, R) -> R#a.b; > '#get-a'(c, R) -> R#a.c. > > '#set-a'(Vals, Rec) -> > F = fun ([], R, _F1) -> R; > ([{a, V} | T], R, F1) -> F1(T, R#a{a = V}, F1); > ([{b, V} | T], R, F1) -> F1(T, R#a{b = V}, F1); > ([{c, V} | T], R, F1) -> F1(T, R#a{c = V}, F1) > end, > F(Vals, Rec, F). > > '#info-a'(fields) -> record_info(fields, a). > > %%% end generated code > > > A short shell dialogue to illustrate the use: > > Eshell V5.4.12 (abort with ^G) > 1> test:'#new-a'(). > {a,undefined,undefined,undefined} > 2> test:'#set-a'([{a,1},{c,3}], v(1)). > {a,1,undefined,3} > 3> test:'#set-a'([{b,2}], v(2)). > {a,1,2,3} > 4> test:'#get-a'(b, v(3)). > 2 > 5> test:'#get-a'([a,c], v(3)). > [1,3] > 6> test:'#info-a'(fields). > [a,b,c] > > > Parse transformery attached. It's based on the stools_id_trans module > that I posted a while back, but with improved error handling > (controlled > errors in the parse_transform module are reported as regular > compilation > errors.) > > BR, > Ulf W > From joe.armstrong@REDACTED Mon May 29 16:27:40 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 29 May 2006 16:27:40 +0200 Subject: Parsing an incoming Shoutcast request Message-ID: This is covered in "Joe's spitting in the sawdust Erlang tutorials Tutorial number 2" (http://www.sics.se/~joe/tutorials/web_server/web_server.html) You want to spawn (presumably) one handler/per connection - I have a module that does this: http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl tcp_server exports a number of useful things. Including: start_raw_server(Port, Fun, Max) Which starts a listening server on which accepts a maximum of connections. Each connection is handled by , which runs in a separate parallel processes and communicates with the client. I'll just quote from the comments at the start of the module %% To setup a lister %% start_server(Port) -> %% S = self(), %% process_flag(trap_exit, true), %% tcp_server:start_raw_server(Port, %% fun(Socket) -> input_handler(Socket, S) end, %% 15, %% 0) %% loop(). %% The loop() process is a central controller that all %% processes can use to synchronize amongst themselves if necessary %% It ends up as the variable "Controller" in the input_handler %% A typical server is written like this: %% input_handler(Socket, Controller) -> %% receive %% {tcp, Socket, Bin} -> %% ... %% gen_tcp:send(Socket, ...) %% %% {tcp_closed, Socket} -> %% %% Any -> %% ... %% %% end. This input handler probably is what you want. One of these is spawned/per connection. The local variable Controller can be used to communicate with the master process (ie the process evaluating loop()). tcp_server.erl is very useful - I use it for virtually every networking application that I write :-) /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of > Andrew Lentvorski > Sent: den 29 maj 2006 13:58 > To: erlang-questions@REDACTED > Subject: Parsing an incoming Shoutcast request > > Another newbie question. > > I'm trying to do something very similar to the Shoutcast > server sample code from Practical Common Lisp. The initial > request from an MP3 client to the streaming server (which I > want to write in Erlang) looks very much like HTTP. > > GET / HTTP/1.1\r\n > Host: 127.0.0.1:33669\r\n > User-Agent: VLC media player - version 0.8.5 Janus - VideoLAN team\r\n > Range: bytes=0-\r\n > Icy-MetaData: 1\r\n > Connection: Close\r\n > \r\n > > Now, I know have to do the gen_tcp:listen and gen_tcp:accept > to get the actual connection socket. > > Once, I have that socket, though, I either need to do > something with messages and {active, once} or gen_tcp:recv() > and {active, false}. > > I can't see a particularly obvious way to structure this for > pattern matches to make things easy. > > Given that this looks like it should be very ripe for some > form of pattern match, I thought I would try asking those > with more experience for some friendly advice before plowing > ahead and writing lots of very stupid code. > > Thanks, > -a > From thomasl_erlang@REDACTED Mon May 29 16:38:54 2006 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 29 May 2006 07:38:54 -0700 (PDT) Subject: Parsing an incoming Shoutcast request In-Reply-To: <447AE1CE.7050605@allcaps.org> Message-ID: <20060529143854.16564.qmail@web38804.mail.mud.yahoo.com> --- Andrew Lentvorski wrote: > Another newbie question. > > I'm trying to do something very similar to the > Shoutcast server sample > code from Practical Common Lisp. The initial > request from an MP3 client > to the streaming server (which I want to write in > Erlang) looks very > much like HTTP. > > GET / HTTP/1.1\r\n > Host: 127.0.0.1:33669\r\n > User-Agent: VLC media player - version 0.8.5 Janus - > VideoLAN team\r\n > Range: bytes=0-\r\n > Icy-MetaData: 1\r\n > Connection: Close\r\n > \r\n > > Now, I know have to do the gen_tcp:listen and > gen_tcp:accept to get the > actual connection socket. > > Once, I have that socket, though, I either need to > do something with > messages and {active, once} or gen_tcp:recv() and > {active, false}. > > I can't see a particularly obvious way to structure > this for pattern > matches to make things easy. Start with setting the socket in {packet,line} mode, which delivers messages in units of "lines". See "man inet" for details. You can then match on each incoming line, something like this (OK, I haven't checked that this actually works, but the principle should be clear): match_header_line(<<"\r\n">>, State) -> header_done(State); match_header_line(<<"User agent:", Name/binary>>, State) -> add_user_agent(Name, State); ... Alternatively, and even simpler: if the protocol is close enough to HTTP, there is the semi-secret {packet, http} mode. Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rlenglet@REDACTED Mon May 29 16:39:32 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Mon, 29 May 2006 23:39:32 +0900 Subject: Dryverl version 0.1 is released Message-ID: <200605292339.32768.rlenglet@users.forge.objectweb.org> Dryverl version 0.1 is available for download: http://forge.objectweb.org/forum/forum.php?forum_id=1018 A working Hello World example is included in the release. There is no documentation yet. -- Romain LENGLET From david.nospam.hopwood@REDACTED Mon May 29 17:00:40 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Mon, 29 May 2006 16:00:40 +0100 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605291430.15139.rlenglet@users.forge.objectweb.org> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> Message-ID: <447B0C98.5090905@blueyonder.co.uk> Romain Lenglet wrote: > 1- Dryverl is in fact composed of *six* "sub-"languages: > > - One structured, declarative language for specifying value maps, etc. > Yes, this simple language could be specified using Leex and Yecc. > > - *Two* distinct "Erlang + markup" dialects. Using Yecc, you would > have to specify *twice* the complete Erlang grammar + extensions. > > - *Three* distinct "C + markup" dialects. Using Yecc, you would have > to specify *thrice* the complete C grammar (!) + extensions. and this counters Richard's critique how, exactly?? -- David Hopwood From david.nospam.hopwood@REDACTED Mon May 29 17:20:56 2006 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Mon, 29 May 2006 16:20:56 +0100 Subject: Worse is worse In-Reply-To: <447ABBF4.7030307@ericsson.com> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <95be1d3b0605290125o6e9ae55bg2c8c0f4d91853395@mail.gmail.com> <200605291749.05052.rlenglet@users.forge.objectweb.org> <95be1d3b0605290159h5a4d5285t69323623f8194e7d@mail.gmail.com> <447ABBF4.7030307@ericsson.com> Message-ID: <447B1158.8010903@blueyonder.co.uk> Bengt Kleberg wrote: > On 2006-05-29 10:59, Vlad Dumitrescu wrote: > ...deleted > >> I don't know if that's what Richard was aiming at, but my belief is >> that a tool should make life easier foremost for the end users. >> Otherwise they won't use it... > > i agree, but then we have this: Worse is Better > (http://www.dreamsongs.com/WIB.html) Sometimes worse is just worse. I could not agree more with Gabriel a.k.a. Bourbaki's conclusion: # But the real quarrel with the ["worse is better"] paper I have is about what # it teaches people. The paper states that a good strategy to adopt when trying # to make things better is this: # # ...it is undersirable to go for the right thing first; better to get half # of the right thing available so it spreads like a virus. Once people are # hooked, take the time to improve it to 90% of the right thing. # # This advice is corrosive. It warps the minds of youth. It is never a good # idea to intentionally aim for anything less than the best, though one might # have to compromise in order to succeed. Maybe Richard means one should aim # high but make sure you shoot -- sadly he didn't say that. He said "worse is # better," and though it might be an attractive, mind-grabbing headline seducing # people into reading his paper, it teaches the wrong lesson -- a lesson he may # not intend, or a lesson poorly stated. I know he can say the right thing, # and I wish he had. About the PC-losering example: there is an obvious "third way", where a retry loop for each call is abstracted in a user-mode library, so that applications never have to deal with retries, and the kernel does not have to deal with the complexity of PC-losering. This approach, of hiding implemenentation complexity by use of abstraction, is clearly better than WIB or TRT in almost all other cases, too -- as you would expect, since WIB and TRT are just caricatures. -- David Hopwood From christophe.romain@REDACTED Mon May 29 17:57:26 2006 From: christophe.romain@REDACTED (Christophe Romain) Date: Mon, 29 May 2006 17:57:26 +0200 Subject: distributing .beam files/upgrading client software In-Reply-To: <447ACDFA.7030503@web.am> References: <4478C668.7000802@web.am> <447ACDFA.7030503@web.am> Message-ID: <19d25d2b7f10aaddfed1034d585f3cee@process-one.net> Hi, > what about distributing beam files to clients - should I implement my > own distribution protocol? you can look at http://erlrt.process-one.net/?page=Z-REPOS this is a generic way to distribute beam files with binaries for all supported platforms using REPOS. e.g.: erlrt:install(mnesia). erlrt:install(ejabberd). % this will install all .beam and all .so for your platform erlrt:uninstall(megaco). available soon: erlrt:upgrade(). % will keep up to date all installed otp libraries and packaged software. a new version of erlrt is under work. it will support: windows, macos powerpc, linux (alpha/amd64/arm/hppa/ia64/mips/mipsel/powerpc/s380/sparc/x86) and sunos sparc. this new version will be directly usable and is neadly ready to be published. regards. From ulf.wiger@REDACTED Mon May 29 18:28:11 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 29 May 2006 18:28:11 +0200 Subject: auto-generated record access functions Message-ID: I believe it's because your module has no hand-written functions. The parse-transform module I wrote looks for the first function in order to create the record access functions before it. If there are no functions in the module, it will simply not generate the access functions, but it will go on and try to export them. That's not a feature. It didn't occur to me at the time that people would want to create modules with no functions in them. (: BR, Ulf W > -----Original Message----- > From: ke han [mailto:ke.han@REDACTED] > Sent: den 29 maj 2006 16:09 > To: Ulf Wiger (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: Re: auto-generated record access functions > > Ulf, > I've just tested your record access generator. I'm getting > some errors. > > I compile test.erl which is: > > -module(test). > -compile({parse_transform, exprecs}). > -record(person, {firstName, lastName, birthDate}). > -export_records([person]). > > compile results: (note, my erlc is a bash script which adds > path, includes and outputs in the correct places) > erlc > test.erl using /Users/jhancock/bin/erlc > ./test.erl:4: function '#new-person'/0 undefined > ./test.erl:4: function '#set-person'/2 undefined > ./test.erl:4: function '#get-person'/2 undefined > ./test.erl:4: function '#info-person'/1 undefined > ./test.erl:4: function '#new-person'/1 undefined > > I just tried your exact example from the April 19 posting. > -module(test). > -compile({parse_transform, exprecs}). > -record(a, {a, b, c}). > -export_records([a]). > > same type of errors. > > any ideas? > thanks, ke han > > > > > On Apr 19, 2006, at 12:35 AM, Ulf Wiger ((AL/EAB)) wrote: > > > > > I've written a small(-ish) parse transform that generates code for > > accessing exported records. > > > > I did read through ROK's abstract patterns proposal once more, but > > decided that it would be too much to try to implement _that_. The > > current hack does use function names that are somewhat similar to > > ROK's abstract patterns, but I don't think that will be a problem > > (mainly because I don't envision that anyone would use this > stuff if > > the abstract patterns were > > available.) > > > > The idea is to use records as before, but for module- local > use. For > > outside callers, records are 'exported' > > by including a -export_records([RecName]) directive. > > The following code extract illustrates the kind of code laid out by > > the parse_transform: > > > > -module(test). > > -compile({parse_transform, exprecs}). > > -record(a, {a, b, c}). > > -export_records([a]). > > > > %%% generated code > > -export(['#new-a'/0, '#new-a'/1, > > '#get-a'/2, '#set-a'/2, > > '#info-a'/1]). > > > > '#new-a'() -> #a{}. > > '#new-a'(Vals) -> '#set-a'(Vals, #a{}). > > > > '#get-a'(Attrs, R) when is_list(Attrs) -> > > ['#get-a'(A, R) || A <- Attrs]; > > '#get-a'(a, R) -> R#a.a; > > '#get-a'(b, R) -> R#a.b; > > '#get-a'(c, R) -> R#a.c. > > > > '#set-a'(Vals, Rec) -> > > F = fun ([], R, _F1) -> R; > > ([{a, V} | T], R, F1) -> F1(T, R#a{a = V}, F1); > > ([{b, V} | T], R, F1) -> F1(T, R#a{b = V}, F1); > > ([{c, V} | T], R, F1) -> F1(T, R#a{c = V}, F1) > > end, > > F(Vals, Rec, F). > > > > '#info-a'(fields) -> record_info(fields, a). > > > > %%% end generated code > > > > > > A short shell dialogue to illustrate the use: > > > > Eshell V5.4.12 (abort with ^G) > > 1> test:'#new-a'(). > > {a,undefined,undefined,undefined} > > 2> test:'#set-a'([{a,1},{c,3}], v(1)). > > {a,1,undefined,3} > > 3> test:'#set-a'([{b,2}], v(2)). > > {a,1,2,3} > > 4> test:'#get-a'(b, v(3)). > > 2 > > 5> test:'#get-a'([a,c], v(3)). > > [1,3] > > 6> test:'#info-a'(fields). > > [a,b,c] > > > > > > Parse transformery attached. It's based on the > stools_id_trans module > > that I posted a while back, but with improved error handling > > (controlled errors in the parse_transform module are reported as > > regular compilation > > errors.) > > > > BR, > > Ulf W > > > > From ke.han@REDACTED Mon May 29 19:35:49 2006 From: ke.han@REDACTED (ke han) Date: Tue, 30 May 2006 01:35:49 +0800 Subject: auto-generated record access functions In-Reply-To: References: Message-ID: <55C1DEC5-2F37-4F97-AB6B-EE1FCDC32D03@redstarling.com> Ulf, thanks. I'll look into this when I start again tomorrow. What I'm trying to do is use your record access in a framework so the module person will use a record #person to store its data. In the simplest case, an "instance of person" would be just the record which would be used in conjunction with the person module to get and set values via a controller which is a process. More complex models could be processes and would work in a similar fashion (the controller would just have to know to send the message differently). I'm trying to figure out a way to make this somewhat transparent to the framework user. One thing I want to do with your record access is to start off a model as an empty module definition (as in my example). As the programmer adds behavior (e.g. validations on the various attributes of the record), they would add functions to the module. So, I'm going to pretty quickly have to figure out how to take your record access to the next level. For example, start with the empty module person as: -module(person). -compile({parse_transform, exprecs}). -record(person, {firstName, lastName, birthDate}). -export_records([person]). Then when the programmer is ready to add validation for the birthDate, they add the function: birthDate(Date) -> validateDate(Date). This function would be not exported and called (when it exists) by your record set function (set-person/2 in this case). This would also imply I want your record access functions to handle exceptions in a certain way as well. That is, if birthDate/1 throws an exception, the set does not happen. This provides the beginnings of an "attribute framework", which is an essential part for easily creating models and controllers. good night, ke han On May 30, 2006, at 12:28 AM, Ulf Wiger ((AL/EAB)) wrote: > > I believe it's because your module has no hand-written functions. > > The parse-transform module I wrote looks for the first function in > order > to create the record access functions before it. If there are no > functions in the module, it will simply not generate the access > functions, but it will go on and try to export them. > > That's not a feature. It didn't occur to me at the time that people > would want to create modules with no functions in them. (: > > BR, > Ulf W > >> -----Original Message----- >> From: ke han [mailto:ke.han@REDACTED] >> Sent: den 29 maj 2006 16:09 >> To: Ulf Wiger (AL/EAB) >> Cc: erlang-questions@REDACTED >> Subject: Re: auto-generated record access functions >> >> Ulf, >> I've just tested your record access generator. I'm getting >> some errors. >> >> I compile test.erl which is: >> >> -module(test). >> -compile({parse_transform, exprecs}). >> -record(person, {firstName, lastName, birthDate}). >> -export_records([person]). >> >> compile results: (note, my erlc is a bash script which adds >> path, includes and outputs in the correct places) > erlc >> test.erl using /Users/jhancock/bin/erlc >> ./test.erl:4: function '#new-person'/0 undefined >> ./test.erl:4: function '#set-person'/2 undefined >> ./test.erl:4: function '#get-person'/2 undefined >> ./test.erl:4: function '#info-person'/1 undefined >> ./test.erl:4: function '#new-person'/1 undefined >> >> I just tried your exact example from the April 19 posting. >> -module(test). >> -compile({parse_transform, exprecs}). >> -record(a, {a, b, c}). >> -export_records([a]). >> >> same type of errors. >> >> any ideas? >> thanks, ke han >> >> >> >> >> On Apr 19, 2006, at 12:35 AM, Ulf Wiger ((AL/EAB)) wrote: >> >>> >>> I've written a small(-ish) parse transform that generates code for >>> accessing exported records. >>> >>> I did read through ROK's abstract patterns proposal once more, but >>> decided that it would be too much to try to implement _that_. The >>> current hack does use function names that are somewhat similar to >>> ROK's abstract patterns, but I don't think that will be a problem >>> (mainly because I don't envision that anyone would use this >> stuff if >>> the abstract patterns were >>> available.) >>> >>> The idea is to use records as before, but for module- local >> use. For >>> outside callers, records are 'exported' >>> by including a -export_records([RecName]) directive. >>> The following code extract illustrates the kind of code laid out by >>> the parse_transform: >>> >>> -module(test). >>> -compile({parse_transform, exprecs}). >>> -record(a, {a, b, c}). >>> -export_records([a]). >>> >>> %%% generated code >>> -export(['#new-a'/0, '#new-a'/1, >>> '#get-a'/2, '#set-a'/2, >>> '#info-a'/1]). >>> >>> '#new-a'() -> #a{}. >>> '#new-a'(Vals) -> '#set-a'(Vals, #a{}). >>> >>> '#get-a'(Attrs, R) when is_list(Attrs) -> >>> ['#get-a'(A, R) || A <- Attrs]; >>> '#get-a'(a, R) -> R#a.a; >>> '#get-a'(b, R) -> R#a.b; >>> '#get-a'(c, R) -> R#a.c. >>> >>> '#set-a'(Vals, Rec) -> >>> F = fun ([], R, _F1) -> R; >>> ([{a, V} | T], R, F1) -> F1(T, R#a{a = V}, F1); >>> ([{b, V} | T], R, F1) -> F1(T, R#a{b = V}, F1); >>> ([{c, V} | T], R, F1) -> F1(T, R#a{c = V}, F1) >>> end, >>> F(Vals, Rec, F). >>> >>> '#info-a'(fields) -> record_info(fields, a). >>> >>> %%% end generated code >>> >>> >>> A short shell dialogue to illustrate the use: >>> >>> Eshell V5.4.12 (abort with ^G) >>> 1> test:'#new-a'(). >>> {a,undefined,undefined,undefined} >>> 2> test:'#set-a'([{a,1},{c,3}], v(1)). >>> {a,1,undefined,3} >>> 3> test:'#set-a'([{b,2}], v(2)). >>> {a,1,2,3} >>> 4> test:'#get-a'(b, v(3)). >>> 2 >>> 5> test:'#get-a'([a,c], v(3)). >>> [1,3] >>> 6> test:'#info-a'(fields). >>> [a,b,c] >>> >>> >>> Parse transformery attached. It's based on the >> stools_id_trans module >>> that I posted a while back, but with improved error handling >>> (controlled errors in the parse_transform module are reported as >>> regular compilation >>> errors.) >>> >>> BR, >>> Ulf W >>> >> >> From vances@REDACTED Mon May 29 20:23:48 2006 From: vances@REDACTED (Vance Shipley) Date: Mon, 29 May 2006 14:23:48 -0400 Subject: gen_server -- newbie code critique? In-Reply-To: <447983AB.5060001@allcaps.org> References: <447983AB.5060001@allcaps.org> Message-ID: <20060529182348.GA32590@frogman.motivity.ca> Andrew, Your use of State has some style problems. On Sun, May 28, 2006 at 04:04:11AM -0700, Andrew Lentvorski wrote: } } -record(state, {theQueue}). } } init([]) -> } {ok, #state{theQueue=queue:new()}}. } } handle_call({in, InObj}, _From, State) -> } QR = queue:in(InObj, State#state.theQueue), } UpdatedState = #state{theQueue=QR}, } {reply, ok, UpdatedState}; You are using a record to store the State however it contains only one field. Until you need more fields you might as well get rid of the record: init([]) -> {ok, queue:new()}. However if you do plan on adding fields later keep the #state{} record but then you'll need to update it instead of recreating it: handle_call({in, InObj}, _From, State) -> QR = queue:in(InObj, State#state.theQueue), {reply, ok, State#state{theQueue = QR}}; -Vance From sebastian@REDACTED Mon May 29 20:29:24 2006 From: sebastian@REDACTED (Sebastian Bello) Date: Mon, 29 May 2006 15:29:24 -0300 Subject: Oracle on Linux References: <03962D7A-C731-44F1-950A-631D6892071A@gmail.com> <200605181557.12584.chaitanya.chalasani@gmail.com> <200605241014.46638.chaitanya@pyronetworks.com> <001701c680cf$86bf2fe0$6500a8c0@inswitchapp> Message-ID: <01e601c6834d$d0f33cc0$6500a8c0@inswitchapp> An additional question: 4- how do you handle transactions? Sebastian- ----- Original Message ----- From: "Sebastian Bello" To: "Chaitanya Chalasani" Cc: "Erlang Questions" Sent: Friday, May 26, 2006 11:20 AM Subject: Re: Oracle on Linux > Chaitanya, > > thanks for the source code. > > Some additional questions: > 1- do you use multiple connections to Oracle? How would/do you manage it > (resolved in the C++ class or with multiples ports)? > 2- how do you encode/decode responses (mainly in the case of SELECT > statements)? Do you read responses at the Erlang side as binaries and then > create the corresponding Erlang datatypes, or do you use ei to generate > Erlang datatypes on the C side? > 3- how do you multiplex queries (use for example a PID to identify the > requester and return the response to it)? > > Thank you very much for your help! > Regards, > Sebastian- > > > ----- Original Message ----- > From: "Chaitanya Chalasani" > To: "Joel Reymont" > Cc: "Erlang Questions" > Sent: Wednesday, May 24, 2006 1:44 AM > Subject: Re: Oracle on Linux > > > > On Thursday 18 May 2006 15:57, Chaitanya Chalasani wrote: > > > On Tuesday 02 May 2006 15:30, Joel Reymont wrote: > > > > Folks, > > > > > > > > Is anyone using Oracle with Erlang on Linux? Are you using a > > > > commercial ODBC driver? > > > > > > > > I'm ideally looking for an OCI binding or a free Linux ODBC driver. > > > > > > > > Thanks, Joel > > > > > > > > -- > > > > http://wagerlabs.com/ > > > > > > I am away from my office all there days. The day I am back I will share > the > > > source. I have already got the nod from my manager.:) > > > > The attachment is the c++ code of occi interface that acts as port > executable. > > Sorry for the delay > > > From bsder@REDACTED Tue May 30 00:05:53 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Mon, 29 May 2006 15:05:53 -0700 Subject: Parsing an incoming Shoutcast request In-Reply-To: References: Message-ID: <447B7041.9090409@allcaps.org> Joe Armstrong (AL/EAB) wrote: > This is covered in "Joe's spitting in the sawdust Erlang tutorials > Tutorial number 2" > (http://www.sics.se/~joe/tutorials/web_server/web_server.html) > > You want to spawn (presumably) one handler/per connection - > > I have a module that does this: > > http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl I stared at the code a while. I clearly don't understand all of the subtleties because I don't quite get why the dire comments are needed. So, my question is: What concerns prevented you from using the gen_server/supervisor behaviors? I'd rather not run blindly into them given that the comments indicate that it took two Erlang experts to get this code correct originally. Thanks, -a From damien_katz@REDACTED Tue May 30 01:56:34 2006 From: damien_katz@REDACTED (Damien Katz) Date: Mon, 29 May 2006 16:56:34 -0700 (PDT) Subject: how "synchronous" is exit? Message-ID: <20060529235634.52258.qmail@web54509.mail.yahoo.com> When issuing an exit(Pid, kill) to a another process, is there any guarantee that the process, and all its linked child processes, are dead before continuing? If not, can anyone tell me a good way to wait on a process tree to die before continuing an action? From rlenglet@REDACTED Tue May 30 03:43:17 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 30 May 2006 10:43:17 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <447B0C98.5090905@blueyonder.co.uk> References: <200605290123.k4T1NvhF104637@atlas.otago.ac.nz> <200605291430.15139.rlenglet@users.forge.objectweb.org> <447B0C98.5090905@blueyonder.co.uk> Message-ID: <200605301043.17999.rlenglet@users.forge.objectweb.org> David Hopwood wrote: > Romain Lenglet wrote: > > 1- Dryverl is in fact composed of *six* "sub-"languages: > > > > - One structured, declarative language for specifying value > > maps, etc. Yes, this simple language could be specified > > using Leex and Yecc. > > > > - *Two* distinct "Erlang + markup" dialects. Using Yecc, > > you would have to specify *twice* the complete Erlang > > grammar + extensions. > > > > - *Three* distinct "C + markup" dialects. Using Yecc, you > > would have to specify *thrice* the complete C grammar (!) + > > extensions. > > and this counters Richard's critique how, exactly?? This counters the "small language" argument. As Vlad Dimitrescu confirmed, using Yecc you would have to define all those 6 grammars, separately (mostly duplicated...). This is no more a "small language". -- Romain LENGLET From ok@REDACTED Tue May 30 06:50:19 2006 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 30 May 2006 16:50:19 +1200 (NZST) Subject: Announcing Dryverl: an Erlang-to-C binding compiler Message-ID: <200605300450.k4U4oJnJ116757@atlas.otago.ac.nz> I downloaded dryverl-0.1 from the ObjectWeb site. gzcat ...tar.gz | tar xvf - cd dryverl-0.1 ./configure --prefix=/users/local make ... make[1]: \ Entering directory `/home/users/okeefe_r/erlang.d/dryverl-0.1/examples' /home/users/okeefe_r/erlang.d/dryverl-0.1/build-aux/install-sh -d \ hello_build && cd hello_build && ./hello/configure && \ make DRYVERL_HOME=./.. \ PATH=/home/users/okeefe_r/erlang.d/dryverl-0.1/examples/../scripts:\ .:/home/users/okeefe_r/commands.d:/users/local/bin:/opt/SUNWspro/bin:\ /usr/ccs/bin:/usr/java1.2/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:\ /usr/ucb:/users/local/teTeX/bin/sparc-sun-solaris2.9:\ /usr/openwin/bin:/usr/dt/bin: /home/users/okeefe_r/export/ghc-4.08.1/tmp/bin: /home/users/okeefe_r/export/hbc.d/bin-sparc-solaris2.5/exe: /home/users/okeefe_r/export/ocaml-3.00/tmp/bin: /home/users/okeefe_r/export/eclipse.d/sparc_sunos5/bin/sparc_sunos5: /users/local/mercury/bin dist && \ mv dryverl_hello-0.1.tar.gz .. /bin/bash: ./hello/configure: No such file or directory make[1]: *** [dryverl_hello-0.1.tar.gz] Error 127 make[1]: \ Leaving directory `/home/users/okeefe_r/erlang.d/dryverl-0.1/examples' make: *** [all-recursive] Error 1 ./examples/hello_build is empty. There is no ./examples/hello_build/hello/configure, but there _is_ an examples/hello/configure I think the line hello_build && cd hello_build && ./hello/configure && \ should be hello_build && cd hello_build && ../hello/configure && \ ^^ Looking at examples/Makefile, it is quite hard to see what is going on. I can't quite see where $(srcdir) is set, but wherever it is set, it is wrong for this example. Patching the corresponding line of the Makefile to use ../hello/configure instead of $(srcdir)/hello/configure gets a long way further. By the way, six languages in one tool is a little overwhelming. It would be much simpler for bears of very little brain if interfacing between Erlang and C only required them to know Erlang, C, and maybe *one* more notation. From rlenglet@REDACTED Tue May 30 08:08:49 2006 From: rlenglet@REDACTED (Romain Lenglet) Date: Tue, 30 May 2006 15:08:49 +0900 Subject: Announcing Dryverl: an Erlang-to-C binding compiler In-Reply-To: <200605300450.k4U4oJnJ116757@atlas.otago.ac.nz> References: <200605300450.k4U4oJnJ116757@atlas.otago.ac.nz> Message-ID: <200605301508.49301.rlenglet@users.forge.objectweb.org> Richard A. O'Keefe wrote: > I downloaded dryverl-0.1 from the ObjectWeb site. [...] > Looking at examples/Makefile, it is quite hard to see what is > going on. I can't quite see where $(srcdir) is set, but > wherever it is set, it is wrong for this example. ?Patching > the corresponding line of the Makefile to use > ../hello/configure instead of $(srcdir)/hello/configure gets a > long way further. srcdir is set by the configure script. The problem is that if ?????????????????????????? building in-tree srcdir is set to ".", which is a relative path, and my Makefile.am did not deal well with a relative srcdir. I always tested out-of-tree building, and using absolute paths to configure, so I did not encounter that case. That bug is fixed in version 0.1.1: http://forge.objectweb.org/forum/forum.php?forum_id=1020 Thanks for the report. > By the way, six languages in one tool is a little > overwhelming. It would be much simpler for bears of very > little brain if interfacing between Erlang and C only required > them to know Erlang, C, and maybe *one* more notation. As David Hopwood remarked from my previous fragment of spec, the Erlang+XML and C+XML dialects are similar to simple Erlang+macros and C+macros languages. For instance, in the Erlang+XML dialects, only three elements have been defined. See complex "EncodeInputErlangCode" and "DecodeOutputErlangCode" element types in the XMLSchema. However, this does not mean that this can be implemented using only pre-processors, because having all fragments specifying a binding in the same specification file is essential: there are semantic constraints between the fragments of a binding, in the different dialects. For instance, if the decode-input C fragment contains XML elements for decoding binaries passed by reference, there must be a corresponding encoding Erlang fragment in the encode-input. -- Romain LENGLET From yarivvv@REDACTED Tue May 30 08:26:19 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 30 May 2006 02:26:19 -0400 Subject: system calls and threading question Message-ID: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> Hi, I have a question about how Erlang handles system calls: what effect (if any) does a function call that leads to system call invocation (e.g. os:cmd) have on the scheduler? Do such system calls block the entire BEAM process (and hence all lightweight Erlang processes) or are they handled in a separate system thread (or thread pool), such that other lightweight processes are not blocked? Thanks in advance, Yariv From matthias@REDACTED Tue May 30 08:48:55 2006 From: matthias@REDACTED (Matthias Lang) Date: Tue, 30 May 2006 08:48:55 +0200 Subject: system calls and threading question In-Reply-To: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> References: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> Message-ID: <17531.60119.56784.977992@antilipe.corelatus.se> Yariv Sadan writes: > I have a question about how Erlang handles system calls: what effect > (if any) does a function call that leads to system call invocation > (e.g. os:cmd) have on the scheduler? Do such system calls block the > entire BEAM process You can verify for yourself that work done in os:cmd does _not_ tie up the entire erlang node: 1> spawn(fun() -> os:cmd("sleep 1000") end). <0.42.0> 2> 3 + 4. 7 Matthias From chsu79@REDACTED Tue May 30 08:54:39 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 30 May 2006 08:54:39 +0200 Subject: how "synchronous" is exit? In-Reply-To: <20060529235634.52258.qmail@web54509.mail.yahoo.com> References: <20060529235634.52258.qmail@web54509.mail.yahoo.com> Message-ID: Use erlang:monitor/2 perhaps? > A 'DOWN' message will be sent to the monitoring process if Item dies, if Item > does not exist, or if the connection is lost to the node which Item resides on. On 5/30/06, Damien Katz wrote: > When issuing an exit(Pid, kill) to a another process, > is there any guarantee that the process, and all its > linked child processes, are dead before continuing? > > If not, can anyone tell me a good way to wait on a > process tree to die before continuing an action? > From richardc@REDACTED Tue May 30 08:58:22 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 30 May 2006 08:58:22 +0200 Subject: how "synchronous" is exit? In-Reply-To: <20060529235634.52258.qmail@web54509.mail.yahoo.com> References: <20060529235634.52258.qmail@web54509.mail.yahoo.com> Message-ID: <447BED0E.3000405@it.uu.se> Damien Katz wrote: > When issuing an exit(Pid, kill) to a another process, > is there any guarantee that the process, and all its > linked child processes, are dead before continuing? No. Signals (exit/2 sends a signal) are asynchronous, just like messages. In fact, messages are a special case of signals. > If not, can anyone tell me a good way to wait on a > process tree to die before continuing an action? Either using old-school bidirectional process links and setting the trap_exit process flag in the watching process, or the more modern, unidirectional process monitors. See http://www.erlang.org/doc/doc-5.5/lib/kernel-2.11/doc/html/erlang.html and http://www.erlang.org/doc/doc-5.5/doc/reference_manual/processes.html#10.6 (sections 10.6-10.8) for details. /Richard From samuel@REDACTED Tue May 30 09:19:02 2006 From: samuel@REDACTED (Samuel Rivas) Date: Tue, 30 May 2006 09:19:02 +0200 Subject: system calls and threading question In-Reply-To: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> References: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> Message-ID: <20060530071902.GA30755@nodo2.lambdastream.com> Yariv Sadan wrote: > I have a question about how Erlang handles system calls: what effect > (if any) does a function call that leads to system call invocation > (e.g. os:cmd) have on the scheduler? Do such system calls block the > entire BEAM process (and hence all lightweight Erlang processes) or > are they handled in a separate system thread (or thread pool), such > that other lightweight processes are not blocked? os:cmd does not make system calls itself; it creates a port, so the system call is invoked in a separate os thread (that is, outside the erlang runtime). Regards -- Samuel From tzheng@REDACTED Mon May 29 22:41:35 2006 From: tzheng@REDACTED (Tony Zheng) Date: Mon, 29 May 2006 13:41:35 -0700 Subject: How to run distributed Erlang through a firewall? In-Reply-To: <877j451dsp.fsf@pingviini.kortex.jyu.fi> References: <1148499128.9039.77.camel@gateway> <877j451dsp.fsf@pingviini.kortex.jyu.fi> Message-ID: <1148935295.26626.7.camel@gateway> Hi I tried to use port 4369 and forworded it in the routers. But it didn't work. The two erlang nodes couldn't find each other with net_adm:ping() command. I used net_adm:names() to check the port number of erlang node. They are created a dynamic port number by erlang, not for 4369. tony On Mon, 2006-05-29 at 00:38, Jani Hakala wrote: > Tony Zheng writes: > > > 4. Forwarded the server port numbers(9100 and 9101) to Internet on both > > routers(router1 and router2). > > > What about port 4369 i.e. epmd? > > Jani Hakala From joe.armstrong@REDACTED Tue May 30 10:15:38 2006 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 30 May 2006 10:15:38 +0200 Subject: Parsing an incoming Shoutcast request Message-ID: > -----Original Message----- > From: Andrew Lentvorski [mailto:bsder@REDACTED] > Sent: den 30 maj 2006 00:06 > To: Joe Armstrong (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: Re: Parsing an incoming Shoutcast request > > Joe Armstrong (AL/EAB) wrote: > > This is covered in "Joe's spitting in the sawdust Erlang tutorials > > Tutorial number 2" > > (http://www.sics.se/~joe/tutorials/web_server/web_server.html) > > > > You want to spawn (presumably) one handler/per connection - > > > > I have a module that does this: > > > > http://www.sics.se/~joe/tutorials/web_server/tcp_server.erl > > I stared at the code a while. I clearly don't understand all > of the subtleties because I don't quite get why the dire > comments are needed. I guess you mean the "don't mess with the following code unless you really know what you're doing .. bit" This is a frightener - and it means what it says. Code like this looks simple (hopefully it is the least complex code that does the job) but getting it correct is not simple. *proving* code like this to be correct is impossible (proving code very similar to this, but with certain simplifications, is just about possible). So I believe this code to be correct - the comments are witness to the fact that when I write it went through several what were not correct. Fortunately, you don't have to understand it in order to use it - just understand the API. The basic idea tcp_server.erl is to provide a routine start_raw_server(Port, Max, Fun, Len) You call this and you get the following: One process per/session which evaluates Fun(Socket, Controller) Controller is a Global process that can be used to synchronise all the child processes (if you need to do this). So the simplest possible server is created with something like this: start_raw_server(Port, Max, fun handle/2, 0). where handle(Socket, Controller) -> receive {Socket, tcp, Socket, Bin} -> ... {tcp_closed, Socket} -> ... end. Which is pretty much all that you need. The rest is just concerned with parsing and responding to the packets in Bin. > > So, my question is: > > What concerns prevented you from using the > gen_server/supervisor behaviors? > Nothing - you could, merge the code in tcp_server into a gen_server but the result would probably be a mess and obscure what you are trying to do. gen_server is designed primarily for writing servers in a classic client-server architecture. The underlying assumption in gen_server was that the client was an erlang client, and that RPCs between the client and server are Erlang RPCs. gen_server provides a number of "bells and whistles" in the form of debugging support, decent diagnostics when things crash etc. It was not designed for lightweight servers that need no error recovery, nor for handling non erlang messages. In the TCP case packets might be fragmented, and some protocols will be involved, recombining the packets, and parsing the protocol can be done in a gen_server, but this is not what it was designed for. The architecture I would choose is as follows: p +-------------+ u +--------+ t ---socket ---| defragment |-----| parse |---------- Server +-------------+ +--------+ | | p +-------------+ u +--------+ t | ---socket ---| defragment |-----| parse |-------| +-------------+ +--------+ | | | p +-------------+ u +--------+ t | ---socket ---| defragment |-----| parse |-------+ +-------------+ +--------+ For each session you create pipeline of two processes. The first defragments the packets the second parses complete packets. In the diagram p means "fragmented TCP packets" u means "unfragmented packets" t means erlang terms. After parsing only erlang terms are "seen". Now if the protocol is particulary simple you might like to merge defragmentation and parsing into the same process - but you should remember that this is an optimisation. Another optimisation is not to parse the entire packet, since the application might not wish to examine all the data in the protocol. So some kind of lazy parser might be appropriate. Having parsed the protocol we are now in the erlang world where everything is represented by pure erlang terms and pure erlang messages - so there are no messy fragmented packets or protocol parsing problems. NOW we can gen_servers. The backend server *is* appropriate to write as a gen_server. What about supervisors? - these are totally orgthogal to the above - they are added to define error recovery zones - a small application with only a couple of server will probably not need supervisors. Supervisors are mainly used when you have dozens of servers to monitor. The OTP behaviours are not magic bullets, they are just libraries of erlang code for performing repetitious tasks in a consistent manner. The main benefit of using (say) gen_servers is organisational - if you have a large team of programmers (say a few hundred) and they are all writing client-servers, then it might be a good idea if they all go about this the same way. The OTP libraries were written to the standardise the way severs, etc.- were written, this was so that one programmer in a large organisation could understand the code of another programmer in the same organisation. There are, of course, no such benefits in a small one-person project. Writing a client-server in Erlang is really easy. You need to understand send receive and spawn. Making it fault tolerant is easy (you need to understand spawn_link, links, and exit signals). You can have 95% of all the fun by understanding how to roll-your own client-servers using spawn, send, receive etc. gen_server provides one commonly used architectural pattern, in a context where it is suitable for large programmer teams. Another source of information might be to look in the examples I wrote years ago http://www.erlang.org/examples/examples-2.0.html Scroll down and look at: FTP Some code which might help you is the ftp client and server which shows how and FTP like server would have been implemented if the implementation language had been erlang. SOS A simple operating system (think of this as OTP very lite) and RSA Everything you ever wanted to secure your applications :-) Have fun /Joe > I'd rather not run blindly into them given that the comments > indicate that it took two Erlang experts to get this code > correct originally. > > Thanks, > -a > From bsder@REDACTED Tue May 30 11:43:12 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 30 May 2006 02:43:12 -0700 Subject: Parsing an incoming Shoutcast request In-Reply-To: References: Message-ID: <447C13B0.8090300@allcaps.org> Thanks for the longer explanation. It's fairly hard to understand the idioms and architectural tradeoffs without a large body of code to work from. Joe Armstrong (AL/EAB) wrote: > The OTP behaviours are not magic bullets, they are just libraries of > erlang code for performing repetitious tasks in a consistent manner. > > The main benefit of using (say) gen_servers is organisational - if you > have > a large team of programmers (say a few hundred) and they are all writing > > client-servers, then it might be a good idea if they all go about this > the same way. Surprisingly, I find gen_server, at least, useful in a one-man project. The reason is that I am not an expert Erlang programmer. The OTP gen_server framework gives structure while I struggle to climb the learning curve. While I understand the mechanics of the basic commands by themselves, I don't yet automatically see the patterns of how they go together. In fact, I would argue that one of the easiest ways to explain gen_server modules is that they are akin to a "Class" from a more traditional Object Oriented language. They encapsulate "state" (which would be the member variables) and provide an API (which would be the member functions). As a bonus, they are "active" instead of passive. This gives me a whole host of behaviors that I cannot replicate in a more traditional OO language. I know that I have just horrified 99% of the readers on this list. Please pardon my ignorance until I shake off the shackles of thinking in other languages and start thinking in Erlang. It is entirely possible I will find gen_server to be complete overkill as I get better. That's fine. At that point, I can make an active informed choice because I will know what I am doing. > Another source of information might be to look in the examples > I wrote years ago > > http://www.erlang.org/examples/examples-2.0.html I will dig through those. Thanks, -a From ulf.wiger@REDACTED Tue May 30 13:18:26 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 30 May 2006 13:18:26 +0200 Subject: auto-generated record access functions Message-ID: Hi, I modified the parse_transform somewhat so that it correctly handles modules with no hand-written functions. My exhaustive testing was to compile this module: -module(test2). -compile({parse_transform, exprecs}). -record(r, {a1, a2}). -export_records([r]). and verify that the functions were generated appropriately. Regarding the special requirements on exception semantics, my first instinct is to stick to the default erlang semantics. This is only a quick hack to solve a specific problem. You are of course free to extend the parse_transform to suit your needs. To back up this claim, I've inserted an EPL statement in the file. BR, Ulf W > -----Original Message----- > From: ke han [mailto:ke.han@REDACTED] > Sent: den 29 maj 2006 19:36 > To: Ulf Wiger (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: Re: auto-generated record access functions > > Ulf, > thanks. I'll look into this when I start again tomorrow. > What I'm trying to do is use your record access in a > framework so the module person will use a record #person to > store its data. In the simplest case, an "instance of > person" would be just the record which would be used in > conjunction with the person module to get and set values via > a controller which is a process. More complex models could > be processes and would work in a similar fashion (the > controller would just have to know to send the message > differently). > I'm trying to figure out a way to make this somewhat > transparent to the framework user. > > One thing I want to do with your record access is to start > off a model as an empty module definition (as in my example). > As the programmer adds behavior (e.g. validations on the > various attributes of the record), they would add functions > to the module. > So, I'm going to pretty quickly have to figure out how to > take your record access to the next level. > > For example, start with the empty module person as: > -module(person). > -compile({parse_transform, exprecs}). > -record(person, {firstName, lastName, birthDate}). > -export_records([person]). > > Then when the programmer is ready to add validation for the > birthDate, they add the function: > > birthDate(Date) -> > validateDate(Date). > > This function would be not exported and called (when it > exists) by your record set function (set-person/2 in this > case). This would also imply I want your record access > functions to handle exceptions in a certain way as well. > That is, if birthDate/1 throws an exception, the set does not happen. > This provides the beginnings of an "attribute framework", > which is an essential part for easily creating models and controllers. > > good night, ke han > > > On May 30, 2006, at 12:28 AM, Ulf Wiger ((AL/EAB)) wrote: > > > > > I believe it's because your module has no hand-written functions. > > > > The parse-transform module I wrote looks for the first function in > > order to create the record access functions before it. If > there are no > > functions in the module, it will simply not generate the access > > functions, but it will go on and try to export them. > > > > That's not a feature. It didn't occur to me at the time that people > > would want to create modules with no functions in them. (: > > > > BR, > > Ulf W > > > >> -----Original Message----- > >> From: ke han [mailto:ke.han@REDACTED] > >> Sent: den 29 maj 2006 16:09 > >> To: Ulf Wiger (AL/EAB) > >> Cc: erlang-questions@REDACTED > >> Subject: Re: auto-generated record access functions > >> > >> Ulf, > >> I've just tested your record access generator. I'm getting some > >> errors. > >> > >> I compile test.erl which is: > >> > >> -module(test). > >> -compile({parse_transform, exprecs}). > >> -record(person, {firstName, lastName, birthDate}). > >> -export_records([person]). > >> > >> compile results: (note, my erlc is a bash script which adds path, > >> includes and outputs in the correct places) > erlc test.erl using > >> /Users/jhancock/bin/erlc > >> ./test.erl:4: function '#new-person'/0 undefined > >> ./test.erl:4: function '#set-person'/2 undefined > >> ./test.erl:4: function '#get-person'/2 undefined > >> ./test.erl:4: function '#info-person'/1 undefined > >> ./test.erl:4: function '#new-person'/1 undefined > >> > >> I just tried your exact example from the April 19 posting. > >> -module(test). > >> -compile({parse_transform, exprecs}). > >> -record(a, {a, b, c}). > >> -export_records([a]). > >> > >> same type of errors. > >> > >> any ideas? > >> thanks, ke han > >> > >> > >> > >> > >> On Apr 19, 2006, at 12:35 AM, Ulf Wiger ((AL/EAB)) wrote: > >> > >>> > >>> I've written a small(-ish) parse transform that generates > code for > >>> accessing exported records. > >>> > >>> I did read through ROK's abstract patterns proposal once > more, but > >>> decided that it would be too much to try to implement _that_. The > >>> current hack does use function names that are somewhat similar to > >>> ROK's abstract patterns, but I don't think that will be a problem > >>> (mainly because I don't envision that anyone would use this > >> stuff if > >>> the abstract patterns were > >>> available.) > >>> > >>> The idea is to use records as before, but for module- local > >> use. For > >>> outside callers, records are 'exported' > >>> by including a -export_records([RecName]) directive. > >>> The following code extract illustrates the kind of code > laid out by > >>> the parse_transform: > >>> > >>> -module(test). > >>> -compile({parse_transform, exprecs}). > >>> -record(a, {a, b, c}). > >>> -export_records([a]). > >>> > >>> %%% generated code > >>> -export(['#new-a'/0, '#new-a'/1, > >>> '#get-a'/2, '#set-a'/2, > >>> '#info-a'/1]). > >>> > >>> '#new-a'() -> #a{}. > >>> '#new-a'(Vals) -> '#set-a'(Vals, #a{}). > >>> > >>> '#get-a'(Attrs, R) when is_list(Attrs) -> > >>> ['#get-a'(A, R) || A <- Attrs]; > >>> '#get-a'(a, R) -> R#a.a; > >>> '#get-a'(b, R) -> R#a.b; > >>> '#get-a'(c, R) -> R#a.c. > >>> > >>> '#set-a'(Vals, Rec) -> > >>> F = fun ([], R, _F1) -> R; > >>> ([{a, V} | T], R, F1) -> F1(T, R#a{a = V}, F1); > >>> ([{b, V} | T], R, F1) -> F1(T, R#a{b = V}, F1); > >>> ([{c, V} | T], R, F1) -> F1(T, R#a{c = V}, F1) > >>> end, > >>> F(Vals, Rec, F). > >>> > >>> '#info-a'(fields) -> record_info(fields, a). > >>> > >>> %%% end generated code > >>> > >>> > >>> A short shell dialogue to illustrate the use: > >>> > >>> Eshell V5.4.12 (abort with ^G) > >>> 1> test:'#new-a'(). > >>> {a,undefined,undefined,undefined} > >>> 2> test:'#set-a'([{a,1},{c,3}], v(1)). > >>> {a,1,undefined,3} > >>> 3> test:'#set-a'([{b,2}], v(2)). > >>> {a,1,2,3} > >>> 4> test:'#get-a'(b, v(3)). > >>> 2 > >>> 5> test:'#get-a'([a,c], v(3)). > >>> [1,3] > >>> 6> test:'#info-a'(fields). > >>> [a,b,c] > >>> > >>> > >>> Parse transformery attached. It's based on the > >> stools_id_trans module > >>> that I posted a while back, but with improved error handling > >>> (controlled errors in the parse_transform module are reported as > >>> regular compilation > >>> errors.) > >>> > >>> BR, > >>> Ulf W > >>> > >> > >> > > -------------- next part -------------- A non-text attachment was scrubbed... Name: exprecs.erl Type: application/octet-stream Size: 10731 bytes Desc: exprecs.erl URL: From bsder@REDACTED Tue May 30 13:22:48 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 30 May 2006 04:22:48 -0700 Subject: Erlang port to the Java Virtual Machine Message-ID: <447C2B08.9010206@allcaps.org> Has anyone done any work on porting Erlang to the JVM? I know that the JVM is less than ideal (lack of tagged data types, lack of tail recursion, problems with dispatch). However, the JVM has some advantages in terms of deployment, external OS control, and GUI integration that would be useful even in a fully interpreted mode. Thanks, -a From luke@REDACTED Tue May 30 13:39:02 2006 From: luke@REDACTED (Luke Gorrie) Date: Tue, 30 May 2006 13:39:02 +0200 Subject: erlang:fault/1 vs. erlang:exit/1 Message-ID: Howdy, Just a friendly reminder that thanks to Richard Carlsson's EUC talk we know that the best way to signal a crash-error is by calling erlang:fault(Reason) and not erlang:exit(Reason). This is because 'fault' will helpfully wrap the crash reason with a backtrace saying where it comes from whereas exit will not. Example: 8> catch erlang:fault(foo). {'EXIT',{foo,[{erl_eval,do_apply,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]}} 9> catch erlang:exit(foo). {'EXIT',foo} This makes crashes caused by 'fault' much easier to track down than ones caused by 'exit'. I suggest using 'fault' as your default choice. I was a bit confused today while trying to track down a crash with reason 'badarg' (no backtrace) which turned out to come from an 'exit' in gen_tcp:connect/4. Maybe that could be a 'fault' instead. Cheerio, -Luke From richardc@REDACTED Tue May 30 15:14:10 2006 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 30 May 2006 15:14:10 +0200 Subject: erlang:fault/1 vs. erlang:exit/1 In-Reply-To: References: Message-ID: <447C4522.3040400@it.uu.se> Luke Gorrie wrote: > Just a friendly reminder that thanks to Richard Carlsson's EUC talk we > know that the best way to signal a crash-error is by calling > erlang:fault(Reason) and not erlang:exit(Reason). This is because > 'fault' will helpfully wrap the crash reason with a backtrace saying > where it comes from whereas exit will not. Basically, when you *really* do mean "terminate the process, giving Term as the reason if anyone is watching this process", use exit(Term). If you mean "a crashing error occurred", i.e., something rather unexpected happened, which callers are not really expected to handle, then use erlang:error(Reason), which is just a better name for erlang:fault(Reason). If you want to throw an exception that a caller might want to catch, then use throw(Term), and *document* that your function might throw that exception. This lets callers program for the common case and blissfully ignore exceptions that they are not prepared to handle. If your function does not really have a "common case", though, you should probably return something like {ok, Value}/{error, Reason}, but please remember that this forces all callers to do _something_ in the error case (and they must always strip the {ok, ...} part in the success case). So design your interfaces with care. > This makes crashes caused by 'fault' much easier to track down than > ones caused by 'exit'. I suggest using 'fault' as your default choice. I suggest you use the name erlang:error/1, since this matches the exception class you will see in a try...catch. E.g.: try erlang:error(foo) catch error:foo -> ok end but the behaviour is the same - erlang:fault/1 is just an older synonym. As a final detail, the latest stack trace is always available through the call erlang:get_stacktrace(), after catching an exception (regardless of the exception type). However, when a process dies due to an exception, the stacktrace is included in the exit term if the exception had type 'error' (or 'throw', which is converted to an 'error' when it causes the process to terminate), but it is not included when the type is 'exit', which is what Luke is referring to above. To summarize, there is a difference between exceptions and the "exit terms" that are passed in signals when processes die. Here endeth the lesson. /Richard From yarivvv@REDACTED Tue May 30 15:37:52 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Tue, 30 May 2006 09:37:52 -0400 Subject: system calls and threading question In-Reply-To: <20060530071902.GA30755@nodo2.lambdastream.com> References: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> <20060530071902.GA30755@nodo2.lambdastream.com> Message-ID: <17244f480605300637m4b4c73b2x6af5abc8ab53c6ac@mail.gmail.com> > os:cmd does not make system calls itself; it creates a port, so the > system call is invoked in a separate os thread (that is, outside the > erlang runtime). > > Regards > -- > Samuel > Thanks for the response. That's what I expected, but I wanted to make sure :) By the way, is this how *all* native calls are handled, even "lightweight" ones such as erlang:date(), or are only potentially expensive calls handled in a different system thread? Regards, Yariv From samuel@REDACTED Tue May 30 16:59:22 2006 From: samuel@REDACTED (Samuel Rivas) Date: Tue, 30 May 2006 16:59:22 +0200 Subject: system calls and threading question In-Reply-To: <17244f480605300637m4b4c73b2x6af5abc8ab53c6ac@mail.gmail.com> References: <17244f480605292326p74cf0676mfb32beaad753a7c7@mail.gmail.com> <20060530071902.GA30755@nodo2.lambdastream.com> <17244f480605300637m4b4c73b2x6af5abc8ab53c6ac@mail.gmail.com> Message-ID: <20060530145922.GB6732@nodo2.lambdastream.com> Yariv Sadan wrote: > > os:cmd does not make system calls itself; it creates a port, so the > >system call is invoked in a separate os thread (that is, outside the > >erlang runtime). > > Thanks for the response. That's what I expected, but I wanted to make sure > :) > > By the way, is this how *all* native calls are handled, even > "lightweight" ones such as erlang:date(), or are only potentially > expensive calls handled in a different system thread? Well, that would depend on the implementation. It just happens that os:cmd(Command) simply: "Executes Command in a command shell of the target OS, captures the standard output of the command and returns this result as a string" That has nothing to do with "native calls", you can execute anything you can run from an OS shell: 1> os:cmd("make"). "make: *** No targets specified and no makefile found. Stop.\n" Aside, erland:date() is a bif, so I'd bet it is pretty efficient. -- Samuel From jerome.sautret@REDACTED Tue May 30 17:16:31 2006 From: jerome.sautret@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Sautret?=) Date: Tue, 30 May 2006 17:16:31 +0200 Subject: Anonymous function and rpc In-Reply-To: <11498CB7D3FCB54897058DE63BE3897C019E8C16@esealmw105.eemea.ericsson.se> References: <11498CB7D3FCB54897058DE63BE3897C019E8C16@esealmw105.eemea.ericsson.se> Message-ID: <8397da240605300816q4f2cf838x13b27b507f174144@mail.gmail.com> 2006/5/24, Vlad Dumitrescu XX (LN/EAB) : > > [mailto:owner-erlang-questions@REDACTED] On Behalf Of J?r?me Sautret > > > > Hello all, > > > > Is it possible to pass an anonymous function as a parameter > > of a function called by rpc ? > > The strange thing is I can do it in the BEAM shell, but not > > in a module : > > > > % erl -sname debug > > Erlang (BEAM) emulator version 5.4.6 [source] [threads:0] > > > > Eshell V5.4.6 (abort with ^G) > > (debug@REDACTED)1> rpc:call(debug2@REDACTED, mnesia, transaction, > > [fun() -> ok end]). > > {atomic,ok} > > (debug@REDACTED)2> mydebug:mydebug(). > > {aborted,{undef,[{#Fun,[]}, > > {mnesia_tm,apply_fun,3}, > > {mnesia_tm,execute_transaction,5}, > > {rpc,'-handle_call/3-fun-0-',5}]}} > > (debug@REDACTED)3> q(). > > ok > > % cat mydebug.erl > > -module(mydebug). > > -export([mydebug/0]). > > > > mydebug() -> > > rpc:call(debug2@REDACTED, mnesia, transaction, [fun() -> ok end]). > > > > % EOF > > % > Hi, > > I think that you have to have the same version of mydebug installed on the remote host. The shell does some magic stuff under the covers :-) > > /Vlad Thanks for the answer, it works now. I've used a rpc call on code:load_binary to send my function on the remote node. Well, too bad that the magic stuffs aren't include in the rpc call ;-). J?r?me. From chandrashekhar.mullaparthi@REDACTED Tue May 30 18:19:06 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 30 May 2006 17:19:06 +0100 Subject: How to run distributed Erlang through a firewall? In-Reply-To: <1148499128.9039.77.camel@gateway> References: <1148499128.9039.77.camel@gateway> Message-ID: On 24/05/06, Tony Zheng wrote: > > Hi > > I found some instructions about how to run distributed Erlang through a > firewall. It said: > ----------------------------------------------------------------- > ...run distributed Erlang through a firewall? > The simplest approach is to make an a-priori restriction to the TCP > ports distributed Erlang uses to communicate through by setting the > (undocumented) kernel variables 'inet_dist_listen_min' and > 'inet_dist_listen_max': > > application:set_env(kernel, inet_dist_listen_min, 9100). > application:set_env(kernel, inet_dist_listen_max, 9105). > > This forces Erlang to use only ports 9100--9105 for distributed Erlang > traffic. > ----------------------------------------------------------------- > > My question is: Can I use it to replicate two Erlang nodes behind the > different routers on Internet? I did it as follows: > 1. Created two Erlang nodes(they have the same > erlangcookie):one@REDACTED and two@REDACTED They > are behind the different routers: router1 and router2. > 2. On one@REDACTED, set the TCP ports: > (one@REDACTED)1> application:set_env(kernel, > inet_dist_listen_min, 9100). You have to set this in your sys.config. Then your kernel setting will take effect when it starts up. The way you are doing it above, the kernel has already started listening on a random port so your application:set_env has no effect. Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From chsu79@REDACTED Tue May 30 20:51:48 2006 From: chsu79@REDACTED (Christian S) Date: Tue, 30 May 2006 20:51:48 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447C2B08.9010206@allcaps.org> References: <447C2B08.9010206@allcaps.org> Message-ID: On 5/30/06, Andrew Lentvorski wrote: > Has anyone done any work on porting Erlang to the JVM? > > I know that the JVM is less than ideal (lack of tagged data types, lack > of tail recursion, problems with dispatch). However, the JVM has some > advantages in terms of deployment, external OS control, and GUI > integration that would be useful even in a fully interpreted mode. I'm just curious but... Which advantages exactly? From damien_katz@REDACTED Tue May 30 21:44:04 2006 From: damien_katz@REDACTED (Damien Katz) Date: Tue, 30 May 2006 12:44:04 -0700 (PDT) Subject: how "synchronous" is exit? In-Reply-To: <447BED0E.3000405@it.uu.se> Message-ID: <20060530194404.91049.qmail@web54511.mail.yahoo.com> Ok, so it appears the code should do something like this: Ref = erlang:monitor(process, Pid), exit(Pid, kill), receive {'DOWN', Ref, process, Pid, Reason} -> do_something() end Just to be sure, am I guaranteed the 'DOWN' message will only be received *after* the whole linked process tree under Pid is killed? The reason I ask, I have a process tree that modifies a file. The file sub-process is in the process tree. My code wants to kill that process tree and start a new one that modifies the same file. Incomplete writes are not a problems, but race conditions are. I have to be sure another process isn't still making writes to the file, so I have to make sure the whole process tree is dead. --- Richard Carlsson wrote: > Damien Katz wrote: > > When issuing an exit(Pid, kill) to a another > process, > > is there any guarantee that the process, and all > its > > linked child processes, are dead before > continuing? > > No. Signals (exit/2 sends a signal) are > asynchronous, just > like messages. In fact, messages are a special case > of signals. > > > If not, can anyone tell me a good way to wait on a > > process tree to die before continuing an action? > > Either using old-school bidirectional process links > and > setting the trap_exit process flag in the watching > process, > or the more modern, unidirectional process monitors. > See > http://www.erlang.org/doc/doc-5.5/lib/kernel-2.11/doc/html/erlang.html > and > http://www.erlang.org/doc/doc-5.5/doc/reference_manual/processes.html#10.6 > (sections 10.6-10.8) for details. > > /Richard > > From robert.virding@REDACTED Tue May 30 22:58:20 2006 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 30 May 2006 22:58:20 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447C2B08.9010206@allcaps.org> References: <447C2B08.9010206@allcaps.org> Message-ID: <447CB1EC.4080301@telia.com> Not having tail recursion is a serious problem, Erlang is not usable without it! If the underlying machine does not directly support it then you have to implement it yourself which means you have to go in at a lower level and do more work yourself. Many years ago there were attempts to implement other high-level languages on the JVM, there may be recent ones but I don't know about them, check the literature to see how they managed. Erlang has similar problems. Another major difficulty is that JVM tasking is too heavy for Erlang. Robert Andrew Lentvorski wrote: > Has anyone done any work on porting Erlang to the JVM? > > I know that the JVM is less than ideal (lack of tagged data types, lack > of tail recursion, problems with dispatch). However, the JVM has some > advantages in terms of deployment, external OS control, and GUI > integration that would be useful even in a fully interpreted mode. > > Thanks, > -a > From bsder@REDACTED Tue May 30 23:37:37 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 30 May 2006 14:37:37 -0700 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CB1EC.4080301@telia.com> References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> Message-ID: <447CBB21.2050003@allcaps.org> Robert Virding wrote: > Not having tail recursion is a serious problem, Erlang is not usable > without it! If the underlying machine does not directly support it then > you have to implement it yourself which means you have to go in at a > lower level and do more work yourself. Sure. But the implementations of JRuby and JScheme seem to work fine without support for JVM tail recursion. > Many years ago there were attempts to implement other high-level > languages on the JVM, there may be recent ones but I don't know about > them, check the literature to see how they managed. Erlang has similar > problems. They work, more or less. There are implementations of Ruby, Python, Javascript, Common Lisp and Scheme on the JVM. Common Lisp and Scheme are actually considered to be separate here because Scheme requires tail recursion whereas Common Lisp does not. > Another major difficulty is that JVM tasking is too heavy for Erlang. So are OS threads. Erlang seems to sidestep that rather neatly. In addition, the JVM is about to get a much lighter threading-type primitive. People in the web server space have also been complaining about the heft of Java threads, too. -a From bsder@REDACTED Wed May 31 00:00:52 2006 From: bsder@REDACTED (Andrew Lentvorski) Date: Tue, 30 May 2006 15:00:52 -0700 Subject: Erlang port to the Java Virtual Machine In-Reply-To: References: <447C2B08.9010206@allcaps.org> Message-ID: <447CC094.602@allcaps.org> Christian S wrote: > On 5/30/06, Andrew Lentvorski wrote: >> Has anyone done any work on porting Erlang to the JVM? >> >> I know that the JVM is less than ideal (lack of tagged data types, lack >> of tail recursion, problems with dispatch). However, the JVM has some >> advantages in terms of deployment, external OS control, and GUI >> integration that would be useful even in a fully interpreted mode. > > I'm just curious but... Which advantages exactly? Deployment: Java Web Start -- Click and run. No install required. External OS Control Launch an external media handler Put a task in the system tray (coming in Java 1.6). GUI Integration: Tk and Gtk only - that pretty much makes my point (Yes, I know about the wx bindings. I've used wx. Never again.) Bonus: Java external libraries There are a lot of libraries in Java which could then be called without having to create large, special-purpose wrappers. -a From ulf.wiger@REDACTED Wed May 31 00:56:47 2006 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 31 May 2006 00:56:47 +0200 Subject: how "synchronous" is exit? Message-ID: Richard replied that it isn't synchronous at all. Even for exit(Pid, kill), Pid will be scheduled in order to handle the exit. When the reason is 'kill', the handling will never involve user code in Pid. In the following example, you can see the timing issues: Eshell V5.4.12 (abort with ^G) 1> process_flag(trap_exit, true). false 2> GotExit = fun(P) -> receive {'EXIT',P,_} -> true after 0 -> false end end. #Fun 3> Pid = spawn_link(fun() -> timer:sleep(timer:minutes(10)) end). <0.34.0> 4> exit(Pid,kill), {erlang:is_process_alive(Pid), GotExit(Pid)}. {false,true} 5> 5> process_flag(priority,high). normal 6> Pid2 = spawn_link(fun() -> timer:sleep(timer:minutes(10)) end). <0.38.0> 7> exit(Pid2,kill), {erlang:is_process_alive(Pid2), GotExit(Pid2)}. {false,false} 8> GotExit(Pid2). true That is, is_process_alive(P) will immediately return false, if the process P is dead or has been scheduled for termination, but you can not be sure that exit messages have been propagated, even to the process that killed P. It is *very* unwise to make assumptions in this realm, for the sake of speed. My first version of proc_reg in jungerl did this - even making use of ets:insert_new() and other tricks in order to ensure timing safety. It was all for naught, as a session with QuickCheck mercilessly illustrated. We found a timing bug that was both very difficult to even comprehend, and practically impossible to fix without rendering all optimizations useless. BR, Ulf W > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Damien Katz > Sent: den 30 maj 2006 01:57 > To: erlang-questions@REDACTED > Subject: how "synchronous" is exit? > > When issuing an exit(Pid, kill) to a another process, is > there any guarantee that the process, and all its linked > child processes, are dead before continuing? > > If not, can anyone tell me a good way to wait on a process > tree to die before continuing an action? > From fig@REDACTED Wed May 31 04:35:49 2006 From: fig@REDACTED (Michael FIG) Date: Tue, 30 May 2006 20:35:49 -0600 (CST) Subject: Asynchronous ODBC Message-ID: <9667228.4021149042949684.JavaMail.root@zimbra> Hi all, I'm new to (but falling in love with) Erlang, and I'm interested in porting a medium-sized project that is a soft realtime system. It took a lot of work to get the database interactions correct, due to the latency of the database connection. Eventually, we settled on a caching asynchronous database system that used a message queue for multiple requests. Other constraints forced us to make the production system multithreaded, but I am hoping to get away from that in the Erlang implementation. Looking at odbc.erl, everything is written in a synchronous style, so it appears the only way to use it asynchronously is to write an asynchronous wrapper for it and run the wrapper on another node so that when it blocks during each call() it doesn't block the caller of the wrapper. I can think of a couple of ways to modify the odbc.erl code to allow asynchronous calls (whose results get sent to a user-specified pid, maybe with a ref that can be used to match up replies to requests), but I wanted to write here first to see if there is any advice for solving this problem, or anybody who's come up against it before. It is quite important to me that this solution also allow for multiple ODBC connections within the same Erlang node, none of which would block the other. Thanks in advance for any help you can offer, -- Michael FIG , PMP VP Technology MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From rikard.johansson@REDACTED Tue May 30 14:28:42 2006 From: rikard.johansson@REDACTED (Rikard Johansson) Date: Tue, 30 May 2006 14:28:42 +0200 Subject: Record definition order in R11-B0 - incompatibility Message-ID: <1148992122.12892.119.camel@tt> Hi all, The example below works fine in older versions (R9C2 and R10B9 tested) but fail to compile with R11B0. $ /usr/local/lib/erlang-R11B0/bin/erlc rtest.erl ./rtest.erl:5: record r1 undefined The reason is appearently to be that record r1 is referenced before it is declared, if I swap the two definitions it compiles nicely. Besides being questionable coding style, is there a way to make this compile with R11 other than re-writing the code? -module(rtest). -record(r2, {a=#r1{d=1}, b}). -record(r1, {d, e}). -export([t/1]). t(r1) -> #r1{}; t(r2) -> #r2{}. Regards, /Rikard From vladdu55@REDACTED Wed May 31 08:37:10 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 31 May 2006 08:37:10 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CBB21.2050003@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> <447CBB21.2050003@allcaps.org> Message-ID: <95be1d3b0605302337j7c2be3a0w52d4836918e7dd5b@mail.gmail.com> Hi, > > Another major difficulty is that JVM tasking is too heavy for Erlang. > > So are OS threads. Erlang seems to sidestep that rather neatly. Yes, but it sidesteps by using its own VM. I don't suppose you mean that the Erlang VM should be implemented on top of the Java VM? In any case, it would have to be an almost-from-scratch implementation. regards, Vlad From tzheng@REDACTED Wed May 31 01:51:50 2006 From: tzheng@REDACTED (Tony Zheng) Date: Tue, 30 May 2006 16:51:50 -0700 Subject: How to run distributed Erlang through a firewall? In-Reply-To: References: <1148499128.9039.77.camel@gateway> Message-ID: <1149033109.12130.20.camel@gateway> Hi Chandru I created a sys.config in my erlang installed directory(/usr/local/erlang/bin). The sys.config file contained these contents: [{kernel,[{inet_dist_listen_min, 9100},{inet_dist_listen_max, 9101}]}]. Then I started the erl command and used net_adm:names() to check the port number of erlang node. It didn't take effect and still created a dynamic port number by erlang. Are there any suggestions about that? Thanks. $ erl -name one -config /usr/local/erlang/bin/sys Erlang (BEAM) emulator version 5.4.12 [source] [hipe] Eshell V5.4.12 (abort with ^G) (one@REDACTED)1> net_adm:names(). {ok,[{"one",43178}]} Best regards tony On Tue, 2006-05-30 at 09:19, Chandru wrote: > > You have to set this in your sys.config. Then your kernel setting will > take effect when it starts up. The way you are doing it above, the > kernel has already started listening on a random port so your > application:set_env has no effect. > > Chandru > > From vladdu55@REDACTED Wed May 31 08:45:09 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 31 May 2006 08:45:09 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CC094.602@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> Message-ID: <95be1d3b0605302345h562dd301tdd457a964cc351a5@mail.gmail.com> On 5/31/06, Andrew Lentvorski wrote: > GUI Integration: > Tk and Gtk only - that pretty much makes my point > (Yes, I know about the wx bindings. I've used wx. Never again.) > > Bonus: Java external libraries > There are a lot of libraries in Java which could then be called without > having to create large, special-purpose wrappers. In order to get that (i.e. direct access to Java code) one would first have to devise a way to represent Java objects and calls to Java code in Erlang. I can't see any other way than creating some kind of generic wrappers. (But of course it's known that I've been wrong before :-) On the other hand, if there was a way to do this generic wrapping behind the scenes, it would be easier to start by letting accessing Java via a socket connection or jinterface. [To counter the argument about starting two VMs, it is reasonable to believe that implementing JErlang would be also a large application, so memory consumption might be the same but in one OS process instead of two] regards, Vlad From raimo@REDACTED Wed May 31 08:49:45 2006 From: raimo@REDACTED (Raimo Niskanen) Date: 31 May 2006 08:49:45 +0200 Subject: how "synchronous" is exit? References: <447BED0E.3000405@it.uu.se>, <20060530194404.91049.qmail@web54511.mail.yahoo.com> Message-ID: damien_katz@REDACTED (Damien Katz) writes: > Ok, so it appears the code should do something like > this: > > Ref = erlang:monitor(process, Pid), > exit(Pid, kill), > receive > {'DOWN', Ref, process, Pid, Reason} -> > do_something() > end > > Just to be sure, am I guaranteed the 'DOWN' message > will only be received *after* the whole linked process > tree under Pid is killed? No, you are not. When a process dies it sends exit signals to all it is linked to. Its 'DOWN' message gets sent somewhere here. Then the linked processes will do the exit when they get sheduled in themselves, could be much later... You will have to monitor the critical process. Either directly or indirectly; to get the property you assumed you will have to write it a'la a supervisor, i.e a top- level process that monitors its children and when ordered to die kills its children, waits for the 'DOWN' message from them all, and then exits itself. Perhaps a standard supervisor does this, I do not know. > > The reason I ask, I have a process tree that modifies > a file. The file sub-process is in the > process tree. > > My code wants to kill that process tree and start a > new one that modifies the same file. Incomplete writes > are not a problems, but race conditions are. I have to > be sure another process isn't still making writes to > the file, so I have to make sure the whole process > tree is dead. > > --- Richard Carlsson wrote: > > > Damien Katz wrote: > > > When issuing an exit(Pid, kill) to a another > > process, > > > is there any guarantee that the process, and all > > its > > > linked child processes, are dead before > > continuing? > > > > No. Signals (exit/2 sends a signal) are > > asynchronous, just > > like messages. In fact, messages are a special case > > of signals. > > > > > If not, can anyone tell me a good way to wait on a > > > process tree to die before continuing an action? > > > > Either using old-school bidirectional process links > > and > > setting the trap_exit process flag in the watching > > process, > > or the more modern, unidirectional process monitors. > > See > > > http://www.erlang.org/doc/doc-5.5/lib/kernel-2.11/doc/html/erlang.html > > and > > > http://www.erlang.org/doc/doc-5.5/doc/reference_manual/processes.html#10.6 > > (sections 10.6-10.8) for details. > > > > /Richard > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From samuel@REDACTED Wed May 31 09:10:28 2006 From: samuel@REDACTED (Samuel Rivas) Date: Wed, 31 May 2006 09:10:28 +0200 Subject: how "synchronous" is exit? In-Reply-To: References: <20060530194404.91049.qmail@web54511.mail.yahoo.com> Message-ID: <20060531071028.GB17691@nodo2.lambdastream.com> Raimo Niskanen wrote: > You will have to monitor the critical process. Either > directly or indirectly; to get the property you assumed > you will have to write it a'la a supervisor, i.e a top- > level process that monitors its children and when > ordered to die kills its children, waits for the > 'DOWN' message from them all, and then exits itself. > Perhaps a standard supervisor does this, I do not know. It does if you set Shutdown as infinity. Regards -- Samuel From Hans.Bolinder@REDACTED Wed May 31 10:00:01 2006 From: Hans.Bolinder@REDACTED (Hans.Bolinder@REDACTED) Date: Wed, 31 May 2006 10:00:01 +0200 Subject: Record definition order in R11-B0 - incompatibility In-Reply-To: <1148992122.12892.119.camel@tt> References: <1148992122.12892.119.camel@tt> Message-ID: <17533.19713.902814.432156@gargle.gargle.HOWL> [Rikard Johansson:] > The example below works fine in older versions (R9C2 and R10B9 tested) > but fail to compile with R11B0. > > $ /usr/local/lib/erlang-R11B0/bin/erlc rtest.erl > ./rtest.erl:5: record r1 undefined > > The reason is appearently to be that record r1 is referenced before it > is declared, if I swap the two definitions it compiles nicely. > > Besides being questionable coding style, is there a way to make this > compile with R11 other than re-writing the code? > > -module(rtest). > -record(r2, {a=#r1{d=1}, b}). > -record(r1, {d, e}). > -export([t/1]). > > t(r1) -> > #r1{}; > t(r2) -> > #r2{}. There is no way to make this compile under R11B; you'll have to rewrite the code. There used to be a problem with record definitions referring to each other--the linter would loop forever. An easily implemented fix was to forbid forward references such as the one in your example. Introducing this incompatibility was made less awkward by the fact that the Erlang specification states that the scope of the record declaration starts immediately after its lexical occurrence ($8.4). See also the release notes for STDLIB 1.13.12 and 1.14 (OTP-5878). Best regards, Hans Bolinder, Erlang/OTP From mats.cronqvist@REDACTED Wed May 31 10:07:43 2006 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Wed, 31 May 2006 10:07:43 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CC094.602@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> Message-ID: <447D4ECF.8030209@ericsson.com> Andrew Lentvorski wrote: > Christian S wrote: > > GUI Integration: > Tk and Gtk only - that pretty much makes my point > (Yes, I know about the wx bindings. I've used wx. Never again.) i don't get the point. you consider Tk and Gtk (and wx, obviously) to be no good? what would it take to make you happy then? mats -- Premature optimization is the root of all evil in programming. C. A. R. Hoare From bengt.kleberg@REDACTED Wed May 31 10:09:38 2006 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 31 May 2006 10:09:38 +0200 Subject: Asynchronous ODBC In-Reply-To: <9667228.4021149042949684.JavaMail.root@zimbra> References: <9667228.4021149042949684.JavaMail.root@zimbra> Message-ID: <447D4F42.5000002@ericsson.com> On 2006-05-31 04:35, Michael FIG wrote: ...deleted > Looking at odbc.erl, everything is written in a synchronous style, so it appears the only way to use it asynchronously is to write an asynchronous wrapper for it and run the wrapper on another node so that when it blocks during each call() it doesn't block the caller of the wrapper. imho it would be sufficient to have the wrapper in another process (created by erlang:spawn/1). there is no need to involve another node. please accept my apology if i have misunderstood something. bengt -- EPO giudelines 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 May 31 10:31:40 2006 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 31 May 2006 09:31:40 +0100 Subject: How to run distributed Erlang through a firewall? In-Reply-To: <1149033109.12130.20.camel@gateway> References: <1148499128.9039.77.camel@gateway> <1149033109.12130.20.camel@gateway> Message-ID: On 31/05/06, Tony Zheng wrote: > > Hi Chandru > > I created a sys.config in my erlang installed > directory(/usr/local/erlang/bin). The sys.config file contained these > contents: > > [{kernel,[{inet_dist_listen_min, 9100},{inet_dist_listen_max, > 9101}]}]. > > Then I started the erl command and used net_adm:names() to check the > port number of erlang node. It didn't take effect and still created a > dynamic port number by erlang. Are there any suggestions about that? > Thanks. > > $ erl -name one -config /usr/local/erlang/bin/sys > Erlang (BEAM) emulator version 5.4.12 [source] [hipe] > > Eshell V5.4.12 (abort with ^G) > (one@REDACTED)1> net_adm:names(). > {ok,[{"one",43178}]} What does application:get_all_env(kernel) return? Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From Micic_V@REDACTED Wed May 31 10:33:04 2006 From: Micic_V@REDACTED (Valentin Micic [ MTN - Innovation Centre ]) Date: Wed, 31 May 2006 10:33:04 +0200 Subject: Erlang R9C-2 NODE stops accepting new connections Message-ID: <23684C9CDF88C04FA8800AA825EADF51031F4628@MTNMAIL.mtn.co.za> Hi, We have a reoccurring problem on one of our nodes, call it node1@REDACTED Under some circumstances (we suspect intermittent network instability), the main listening port (the port that is published with EPMD) stops accepting new connections. The active connections are serviced though. I did verify that empd (using epmd -names) has an entry indicating node1 and port, say, P1. Using netstat, I did verify that port P1 is used. I've used pfiles (Solaris 9) to verify that this port is used by this particular run-time (node1@REDACTED). Finally, in desperation, I've attempted to telnet to this particular port, and noticed that netstat reports SYN_SENT, but no further action is taken. This indicates a potential problem with SOLARIS, however, had a similar situation on LINUX as well, thus, concluding that it might be ERLANG related. It seems that erlang process that is servicing this erlang port (linked-in tcp driver) somehow lost a link to it, however without terminating it, as indicated by messege: #Port<0.7>: tcp_inet: Input driver gone away without deselecting! Any ideas? V. NOTE: This e-mail message is subject to the MTN Group disclaimer see http://www.mtn.co.za/disclaimer -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Wed May 31 10:54:36 2006 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 31 May 2006 10:54:36 +0200 Subject: how "synchronous" is exit? In-Reply-To: <20060530194404.91049.qmail@web54511.mail.yahoo.com> References: <20060530194404.91049.qmail@web54511.mail.yahoo.com> Message-ID: <447D59CC.7080305@it.uu.se> Damien Katz wrote: > Just to be sure, am I guaranteed the 'DOWN' message > will only be received *after* the whole linked process > tree under Pid is killed? No. There is no built-in concept of process trees in Erlang. The down-message is only valid for the linked/monitored process. > My code wants to kill that process tree and start a > new one that modifies the same file. Incomplete writes > are not a problems, but race conditions are. I have to > be sure another process isn't still making writes to > the file, so I have to make sure the whole process > tree is dead. Two ways of doing this: 1. Make supervision a part of your process tree structure, so that each process in the tree is responsible for tracking its immediate children, and children also need to watch their parents so that they can terminate if their parent is killed. This can get hairy if you want to make sure that it's foolproof. If this is what you want, but don't want to roll your own solution, then you should start reading up on OTP and supervision trees. 2. Spawn a separate process that just does tracking and nothing else. Let new processes in the tree send a message to the tracker first thing when they are started, and have the tracker add a monitor for each such process. If you use links between processes in the tree (and do not trap signals), they will all terminate if one of them does (e.g., the root process of the tree). So to delete the tree, you kill one process and send a message to the tracker to enter the cleanup phase. The tracker will then wait until it has received down-messages for all watched processes, and finally send a 'done'-reply and terminate. For a new process tree, start a new tracker process. This should be fairly straightforward to implement. /Richard From dcocoyer@REDACTED Wed May 31 12:15:19 2006 From: dcocoyer@REDACTED (dcocoyer) Date: Wed, 31 May 2006 12:15:19 +0200 Subject: OpenSSL and hardware acceleration Message-ID: <447D6CB7.6090600@altern.org> Hi, I'm trying to set up Erlang ssl and crypto libraries to make use of my motherboard hardware acceleration (VIA padlock engine). OpenSSL (0.9.8b) is already using it (I can check it using 'openssl speed -evp aes-128-cbc -engine padlock' and it works), but when I use the accelerated ciphers under Erlang, the speed and cpu usage show that hardware acceleration is not used at all. My search on the web lead me to two lines of C code that should be added to the application that makes use of OpenSSL. (http://www.logix.cz/michal/devel/padlock/) #include int main () { [...] /* Init available hardware crypto engines. */ ENGINE_load_builtin_engines(); ENGINE_register_all_complete(); [...] } I tried to add these to esock_openssl.c in the esock_ssl_init(void) function, but still no acceleration. Is there a mean to check the current (openssl) engine used from Erlang (exept a small speed test program which I did)? Is this the correct place to add these lines in esock_openssl.c, will they be called by ssl:start() ? Is esock_openssl.c also called by crypto:start() ? Thanks for you help, Desir? Cocoyer From yarivvv@REDACTED Wed May 31 15:12:34 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 31 May 2006 09:12:34 -0400 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CC094.602@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> Message-ID: <17244f480605310612j3b01d7a8m4ed04169a007131@mail.gmail.com> > Bonus: Java external libraries > There are a lot of libraries in Java which could then be called without > having to create large, special-purpose wrappers. > I looked at jinterface (never used it), and it seems like it would be possible to write a generic tool that would expose any Java api to Erlang via rpc using jinterface behind the scenes. It would be used by starting up a JVM as in java -jar erljava.jar -name jvm1 -input foo.jar if foo.jar had a class such as package mypkg; class Foo { public static String echo(String arg) { return arg; } } Erlang could invoke using a call such as Str = call(jvm1, mypkg_foo, func, ["echo this"]). Handling non-static functions is a bit harder as it would require setting up remote stubs for remote objects. I hope I'm not totally off track here :) Yariv From yarivvv@REDACTED Wed May 31 15:18:59 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 31 May 2006 09:18:59 -0400 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <17244f480605310612j3b01d7a8m4ed04169a007131@mail.gmail.com> References: <447C2B08.9010206@allcaps.org> <447CC094.602@allcaps.org> <17244f480605310612j3b01d7a8m4ed04169a007131@mail.gmail.com> Message-ID: <17244f480605310618o7c9b6c4eme995c1264d5357f3@mail.gmail.com> > Handling non-static functions is a bit harder as it would require > setting up remote stubs for remote objects. > I meant local stubs for remote objects :) From vlad.xx.dumitrescu@REDACTED Wed May 31 15:58:31 2006 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Wed, 31 May 2006 15:58:31 +0200 Subject: Erlang port to the Java Virtual Machine Message-ID: <11498CB7D3FCB54897058DE63BE3897C01A48EBC@esealmw105.eemea.ericsson.se> Hi, > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] On Behalf Of Yariv Sadan > I looked at jinterface (never used it), and it seems like it > would be possible to write a generic tool that would expose > any Java api to Erlang via rpc using jinterface behind the > scenes. Well, yes, of course it's possible. In order to avoid any stubs, it is not only that the API has to use static methods, but also only use as arguments and return values simple types or OtpErlang* ones. And in that case, the rpcs are very little more than the regular rpcs used with jinterface. Since Erlang is basically a server-oriented environment, my feeling is that the way to go would be the other way around: build a Java application that is only the presentation layer and let it do RPCs to the Erlang server. This way, no stubs are needed. The remaining issue is the handling of RPCs so that one can make calls from different Java threads. Regards, Vlad From mickael.remond@REDACTED Wed May 31 17:20:11 2006 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 31 May 2006 17:20:11 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <447CBB21.2050003@allcaps.org> References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> <447CBB21.2050003@allcaps.org> Message-ID: <20060531152011.GA22347@memphis.ilius.fr> * Andrew Lentvorski [2006-05-30 14:37:37 -0700]: > Robert Virding wrote: > >Not having tail recursion is a serious problem, Erlang is not usable > >without it! If the underlying machine does not directly support it then > >you have to implement it yourself which means you have to go in at a > >lower level and do more work yourself. > > Sure. But the implementations of JRuby and JScheme seem to work fine > without support for JVM tail recursion. It depends what you think if fine. Last time I checked Jython (Python interpreter in Java) was just 10 time slower than Python. This probably makes it unusable except for small scripts. It do not even talk of tail recursion. A coworker used to Erlang tride to program the same in other languages (such as Python). A tail recursion loop killed the interpreter pretty quickly. So yes, I think those implementations work as proof of concept, but I am not sure that they are more than small toys, that will never be used in production systems. When you get used to Erlang, you realized that its virtual machine is superior to the JVM and it take a big part in Erlang success. -- Micka?l R?mond http://www.process-one.net/ From mrzullo@REDACTED Wed May 31 17:44:44 2006 From: mrzullo@REDACTED (zubi) Date: 31 May 2006 15:44:44 -0000 Subject: QuickCheck tool for Erlang Message-ID: <20060531154444.4281.qmail@webmail18.rediffmail.com> ? Hi all, I am currently doing research on automated testing for Erlang programs. For this I have been looking at many potential techniques that can aid this process. QuickCheck for Erlang seems to be an excellent tool, but that is not publicly available. Can anybody help me in getting that. Also any comments on testing for Erlang are most welcome. Many thanks, Zubair -------------- next part -------------- An HTML attachment was scrubbed... URL: From tzheng@REDACTED Wed May 31 18:23:16 2006 From: tzheng@REDACTED (Tony Zheng) Date: Wed, 31 May 2006 09:23:16 -0700 Subject: How to run distributed Erlang through a firewall? In-Reply-To: References: <1148499128.9039.77.camel@gateway> <1149033109.12130.20.camel@gateway> Message-ID: <1149092596.18967.11.camel@gateway> Hi Chandru As you suggested, I used application:get_all_env(kernel) to check the return value. It seems it is correct to set up the env parameters for port number. But erlang node still gave a dynamic port number. How can I make it to take effect? Thanks. (one@REDACTED)1> application:get_all_env(kernel). [{inet_dist_listen_min,9100}, {included_applications,[]}, {inet_dist_listen_max,9101}, {error_logger,tty}] (one@REDACTED)2> net_adm:names(). {ok,[{"one",49062}]} Best regards tony On Wed, 2006-05-31 at 01:31, Chandru wrote: > On 31/05/06, Tony Zheng wrote: > Hi Chandru > > I created a sys.config in my erlang installed > directory(/usr/local/erlang/bin). The sys.config file > contained these > contents: > > [{kernel,[{inet_dist_listen_min, > 9100},{inet_dist_listen_max, > 9101}]}]. > > Then I started the erl command and used net_adm:names() to > check the > port number of erlang node. It didn't take effect and still > created a > dynamic port number by erlang. Are there any suggestions about > that? > Thanks. > > $ erl -name one -config /usr/local/erlang/bin/sys > Erlang (BEAM) emulator version 5.4.12 [source] [hipe] > > Eshell V5.4.12 (abort with ^G) > (one@REDACTED)1> net_adm:names(). > {ok,[{"one",43178}]} > > > What does application:get_all_env(kernel) return? > > Chandru > > > From chsu79@REDACTED Wed May 31 20:08:14 2006 From: chsu79@REDACTED (Christian S) Date: Wed, 31 May 2006 20:08:14 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <20060531152011.GA22347@memphis.ilius.fr> References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> <447CBB21.2050003@allcaps.org> <20060531152011.GA22347@memphis.ilius.fr> Message-ID: On 5/31/06, Mickael Remond wrote: > When you get used to Erlang, you realized that its virtual machine is > superior to the JVM and it take a big part in Erlang success. Now, have anyone considered making a java compiler that targets beam? :) From yarivvv@REDACTED Wed May 31 20:36:40 2006 From: yarivvv@REDACTED (Yariv Sadan) Date: Wed, 31 May 2006 14:36:40 -0400 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <11498CB7D3FCB54897058DE63BE3897C01A48EBC@esealmw105.eemea.ericsson.se> References: <11498CB7D3FCB54897058DE63BE3897C01A48EBC@esealmw105.eemea.ericsson.se> Message-ID: <17244f480605311136r69d3d79bm2ec81501007d9d02@mail.gmail.com> > Well, yes, of course it's possible. In order to avoid any stubs, it is > not only that the API has to use static methods, but also only use as > arguments and return values simple types or OtpErlang* ones. And in that > case, the rpcs are very little more than the regular rpcs used with > jinterface. Why must stubs be avoided? Couldn't an Erlang->Java RPC mechanism support stubs? Also, I think that if an RPC function call returns a serialized Java object, and Erlang function could parse the response and return an Erlang tuple representing the Java object. It's hackish, but may be useful. The interface would be something like java_serializer:deserialize(SerializedJavaObject) -> {ok, Tuple} | {error} > Since Erlang is basically a server-oriented environment, my feeling is > that the way to go would be the other way around: build a Java > application that is only the presentation layer and let it do RPCs to > the Erlang server. This way, no stubs are needed. > I think both RPC types (Erlang -> Java and Java -> Erlang) should be supported as they answer different needs. For instance, if you already have an application with a presentation layer written in Erlang, and you want to make use of some Java library for a small part of the application (for example, CAPTCHA generation, for which I don't think Erlang has a library), it would be advantageous to expose the Java api to Erlang via an easy-to-use rpc wrapper. Again, I hope I'm not horribly off track here given my limited experience with Erlang and jinterface :) Regards, Yariv From erlang@REDACTED Wed May 31 21:13:00 2006 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 31 May 2006 12:13:00 -0700 Subject: Asynchronous ODBC In-Reply-To: <447D4F42.5000002@ericsson.com> References: <9667228.4021149042949684.JavaMail.root@zimbra> <447D4F42.5000002@ericsson.com> Message-ID: <20060531191300.GD15666@cougora.autosys.us> On Wed, May 31, 2006 at 10:09:38AM +0200, Bengt Kleberg wrote: > On 2006-05-31 04:35, Michael FIG wrote: > ...deleted > >Looking at odbc.erl, everything is written in a synchronous style, so it > >appears the only way to use it asynchronously is to write an asynchronous > >wrapper for it and run the wrapper on another node so that when it blocks > >during each call() it doesn't block the caller of the wrapper. > > imho it would be sufficient to have the wrapper in another process > (created by erlang:spawn/1). there is no need to involve another node. > please accept my apology if i have misunderstood something. > > > bengt > -- > EPO giudelines 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." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I agree with bengt (with, apparently, the same understanding of your question). Here is an extract of code I use in a production system which works fine for the last year ... ---------- -module(x). -export([x/0]). funA(Req) spawn_link(dbexp, callComplete, [Req#crec.callid]) , ... . --------- -module(dbexp). -export([callComplete/1]). callComplete(CallId) -> % used from command line for testing or as % spawn(dbexp, callComplete, [CallId]) for background updates % Ref = ?MODULE:conn(1000) , %% wrapper for odbc:connect/2 Z = "update callinfo set complete_ts=NOW() where callid = " ++ integer_to_list(CallId) ++ " ;" , case odbc:sql_query(Ref, Z) of {updated, Return} -> odbc:disconnect(Ref), {updated, Return} ; {error, Error} -> odbc:disconnect(Ref), expmaster:log_error(?MODULE, ?LINE, 'dbexp:callComplete,odbc:sql_query', Error), {error, Error} end . ---------- ~Michael From fig@REDACTED Wed May 31 22:17:14 2006 From: fig@REDACTED (Michael FIG) Date: Wed, 31 May 2006 14:17:14 -0600 (CST) Subject: Asynchronous ODBC Message-ID: <4888552.4441149106634833.JavaMail.root@zimbra> Hi, >> imho it would be sufficient to have the wrapper in another process >> (created by erlang:spawn/1). there is no need to involve another node. >> please accept my apology if i have misunderstood something. > >I agree with bengt (with, apparently, the same understanding of your >question). Ahh. I think I see now. I was under the mistaken understanding that all other processes on a node block during gen_server:call. Now I think I understand that any "receive", no matter how deeply nested, allows other processes to run. So then the "spawn"ed wrapper just insulates the caller from the process that blocks during gen_server:call. Is that correct? If so, then that's really good, and finally an escape from the nuisances of event-driven programming (my experience with Visual Basic 6, where DoEvents was truly horrid... you'd either reenter your code or blow up the stack if you aren't careful). Nice. -- Michael FIG , PMP VP Technology MarkeTel Multi-Line Dialing Systems, Ltd. Phone: (306) 359-6893 ext. 528 From bernardp@REDACTED Wed May 31 22:28:53 2006 From: bernardp@REDACTED (Pierpaolo BERNARDI) Date: Wed, 31 May 2006 22:28:53 +0200 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <20060531152011.GA22347@memphis.ilius.fr> References: <447C2B08.9010206@allcaps.org> <447CB1EC.4080301@telia.com> <447CBB21.2050003@allcaps.org> <20060531152011.GA22347@memphis.ilius.fr> Message-ID: On Wed, 31 May 2006 17:20:11 +0200, Mickael Remond wrote: > It depends what you think if fine. Last time I checked Jython (Python > interpreter in Java) was just 10 time slower than Python. This probably > makes it unusable except for small scripts. ... > So yes, I think those implementations work as proof of concept, but I am > not sure that they are more than small toys, that will never be used in > production systems. I wish it were so. Unfortunately jithon is used as extension language of at least one big financial application. 8^( P. From mikael.karlsson@REDACTED Wed May 31 22:51:57 2006 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Wed, 31 May 2006 22:51:57 +0200 Subject: QuickCheck tool for Erlang In-Reply-To: <20060531154444.4281.qmail@webmail18.rediffmail.com> References: <20060531154444.4281.qmail@webmail18.rediffmail.com> Message-ID: <200605312251.57897.mikael.karlsson@creado.com> Hi Zubair, Quickcheck is publicly available as a part of the jungerl project on sourceforge.net, so if you check out the source it will be in one of the libraries, see: http://sourceforge.net/projects/jungerl The Erlang/OTP folks has also published their own test_server, see: http://www.erlang.org/project/test_server/index.html I also know that they have built a very nice framework on top of that called common_test. I do not know of the current plans to publish that though. Regards Mikael onsdag 31 maj 2006 17:44 skrev zubi: > Hi all, > > I am currently doing research on automated testing for Erlang programs. For > this I have been looking at many potential techniques that can aid this > process. QuickCheck for Erlang seems to be an excellent tool, but that is > not publicly available. Can anybody help me in getting that. Also any > comments on testing for Erlang are most welcome. > > Many thanks, > Zubair From vladdu55@REDACTED Wed May 31 23:27:26 2006 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 31 May 2006 22:27:26 +0100 Subject: Erlang port to the Java Virtual Machine In-Reply-To: <17244f480605311136r69d3d79bm2ec81501007d9d02@mail.gmail.com> References: <11498CB7D3FCB54897058DE63BE3897C01A48EBC@esealmw105.eemea.ericsson.se> <17244f480605311136r69d3d79bm2ec81501007d9d02@mail.gmail.com> Message-ID: <95be1d3b0605311427w1e7cabbaj9be6cedbccea7612@mail.gmail.com> On 5/31/06, Yariv Sadan wrote: > > Well, yes, of course it's possible. In order to avoid any stubs, it is > > not only that the API has to use static methods, but also only use as > > arguments and return values simple types or OtpErlang* ones. And in that > > case, the rpcs are very little more than the regular rpcs used with > > jinterface. > > Why must stubs be avoided? Couldn't an Erlang->Java RPC mechanism support stubs? Well, not *must* but implementing everything properly requires something that feels like an ORB implementation. That's not an easy thing to do... so one could use the existing CORBA support, but all these layers are making everything very heavyweight, and we're not even talking about the real useful stuff, it's just intercommunnication... /Vlad