From joachim.durchholz@REDACTED Sat Nov 1 03:10:41 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Sat, 01 Nov 2003 03:10:41 +0100 Subject: EBCDIC (was: Language change proposal) In-Reply-To: <20031031144636.3271.qmail@web40803.mail.yahoo.com> References: <20031031144636.3271.qmail@web40803.mail.yahoo.com> Message-ID: <3FA31621.2020608@web.de> Eric Merritt wrote: > EBCDIC is far, far from dead. Its usually only used > on big iron like a 390 but its still used in the > midrange realm on the as400s too. I wouldn't mind > seeing erlang for 400s or 390s. Then you have some of > the most reliable code running on some of the most > reliable hardware on the planet. That's indeed true. AS/400 boxes are known for their rock-solid hardware. (The software is quite stable as well, though RPG sucks even when it's stable.) Having Erlang on these platforms might create a new niche for it. Erlang's stability claims would certainly ring a bell with those stability-minded enough to pay the price for an AS/400. Note that OS/400 (the operating system shipped with AS/400) comes with a Posix subsystem that actually uses ASCII, so at least for these machines, no EBCDIC support is required. I think that the AS/400 also ship with Linux, so it might be that Erlang is already running on some AS/400 boxes :-) BTW OS/400, even with a Posix subsystem, is a quite different beast than Unix. Anybody who uses Erlang on OS/400 should expect to write wrappers for many OS services. Regards, Jo From hakan.stenholm@REDACTED Sat Nov 1 05:11:56 2003 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 1 Nov 2003 05:11:56 +0100 Subject: Language change proposal In-Reply-To: <3FA23BB6.7020301@web.de> Message-ID: <88271E76-0C21-11D8-94DC-000393B8AB26@mbox304.swipnet.se> > Richard A. O'Keefe wrote: >> One of the long term goals for Erlang is that it should support >> Unicode; > > This is something that I'd advise against. > True, it would be nice to be able to write your source code using > native-language identifiers witout having to worry about ASCII > representation. > However, there are two problems here: There is also the problem of mixing native language identifiers with the english ones from the OTP libs, which is bound to look rather odd and might possibly be confusing in some cases, where the words mean different things in each languages. It also limits the portability of the code as fewer people can understand it - imagine Linux written in finish. > > 1) If somebody gives me software to maintain, I might hit a, say, > Chinese glyph somewhere. I'd have to download the proper font just to > be able to look at the sources. I might also be just a bit tricky to figure out how to write the glyph/s, if it's something like japanese, chinese or korean. > I have programmed in Java, which also uses Unicode. I tend to avoid > the German special characters ??????? even if I program in German; I > use their transcriptions AE OE UE ae oe ue ss instead. > > 2) There are many glyphs that look the same. For example, that "a" > letter might actually have an entirely different encoding since it's > from the Russian alphabet. > > Unicode also has issues with letter case. Isn't this really a kind of design error/bug/feature in erlang ? While I personally would prefer code to be written in english I don't see any real problems with using Unicode. The simplest way would probably be to introduce some kind of standard upper case marker (character) in the case that there is no upper case version of a character. Another somewhat more confusing choice would be to require that functions can only start with upper case Unicode letters (possibly only the characters supplied in the current erlang character set). > For one, there is no good mapping of lowercase and uppercase letters > (and cannot be: for example, the German ? has no uppercase equivalent, > it transliterates to SS or SZ depending on personal whim). > Additionally, Unicode has /three/ lettercase categories: lower, upper, > and title case. (The latter information is gleaned from the Haskell > language report, I don't know anything further about Unicode.) > > (There's also a portability issue: there are still EBCDIC machines > around that don't support Unicode. I don't think this is relevant for > Erlang though *g*) > > > My personal idea about Unicode is that it is massively overengineered > for simple tasks like representing source code. > With one exception: it would be very nice if the language allowed > Unicode within string literals. That's more a question of how to > integrate binary data into source code well. It might also be useful in comments, if they aren't written in english - japanese, russian and other languages that have completely different character sets will be rather tedious to encode in some kind of ASCII/latin1 version. From joachim.durchholz@REDACTED Sat Nov 1 10:40:52 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Sat, 01 Nov 2003 10:40:52 +0100 Subject: Language change proposal In-Reply-To: <88271E76-0C21-11D8-94DC-000393B8AB26@mbox304.swipnet.se> References: <88271E76-0C21-11D8-94DC-000393B8AB26@mbox304.swipnet.se> Message-ID: <3FA37FA4.10007@web.de> H?kan Stenholm wrote: > There is also the problem of mixing native language identifiers with the > english ones from the OTP libs, which is bound to look rather odd and > might possibly be confusing in some cases, where the words mean > different things in each languages. It also limits the portability of > the code as fewer people can understand it - imagine Linux written in > finish. That's less of a problem: anybody who writes code that should be used by an international audience knows that he should write in English. That's also the reason why Linux is written in English - had Linus stuck to Finnish identifiers, Linux wouldn't be an international platform. >> 1) If somebody gives me software to maintain, I might hit a, say, >> Chinese glyph somewhere. I'd have to download the proper font just to >> be able to look at the sources. > > I might also be just a bit tricky to figure out how to write the > glyph/s, if it's something like japanese, chinese or korean. The software that displays Unicode is supposed to do that for you. Actually there are issues that I haven't seen properly handled yet; for example, one Far-East script (Indonesian IIRC) has glyphs that /go around/ their neighbouring glyph. Human writing is indeed a strange, aesthetically wonderful but technically over-complicated beast - and Unicode is designed for aesthetics and completeness, not for making life easy on the programs that use it. >> Unicode also has issues with letter case. > > Isn't this really a kind of design error/bug/feature in erlang ? > While I personally would prefer code to be written in english I don't > see any real problems with using Unicode. I don't, too - but why use Unicode if you're writing in English anyway? Even 7-bit ASCII is enough. Heck, even the common subset of EBCDIC and ASCII would be enough! > The simplest way would > probably be to introduce some kind of standard upper case marker > (character) in the case that there is no upper case version of a > character. Another somewhat more confusing choice would be to require > that functions can only start with upper case Unicode letters (possibly > only the characters supplied in the current erlang character set). Too complicated, too much of a burden on the programmer to remember correctly, too much of a burden on the maintainer to interpret correctly. At least that was my initial reaction. Seeing a concrete example of how this is done elegantly in practice, I might reconsider :-) >> With one exception: it would be very nice if the language allowed >> Unicode within string literals. That's more a question of how to >> integrate binary data into source code well. > > It might also be useful in comments, if they aren't written in english - > japanese, russian and other languages that have completely different > character sets will be rather tedious to encode in some kind of > ASCII/latin1 version. Agreed. Though the Russians tend to manage somehow - I've been seeing a lot of Russion software lately. Actually, all the non-Western languages have ways of transliterating to Western script. AFAIK there are even several schemes to choose from for any such language. Re comment usage: In my book, comments are an integral part of the source code. If a comment isn't necessary to understand the code, it's redundant and should be removed, if it's necessary, it should be written in the same language as the source code. From this point of view, there's no need for extra allowances in comments. Things might be different in programming courses - students will be pretty occupied with wrapping their minds around programming concepts, having to transliterate and translate would be an additional and unwanted burden. Just my 2c. Regards, Jo From richardc@REDACTED Sat Nov 1 13:30:23 2003 From: richardc@REDACTED (Richard Carlsson) Date: Sat, 01 Nov 2003 13:30:23 +0100 Subject: Language change proposal In-Reply-To: <3FA37FA4.10007@web.de> References: <88271E76-0C21-11D8-94DC-000393B8AB26@mbox304.swipnet.se> <3FA37FA4.10007@web.de> Message-ID: <3FA3A75F.6060207@csd.uu.se> Joachim Durchholz wrote: > That's also the reason why Linux is written in English - had Linus stuck > to Finnish identifiers, Linux wouldn't be an international platform. And please note that if Linus had coded using his mother tongue, he would have written in Swedish, not Finnish. /Richard From jonathan@REDACTED Sat Nov 1 23:56:51 2003 From: jonathan@REDACTED (jonathan@REDACTED) Date: Sat, 01 Nov 2003 22:56:51 -0000 Subject: Language change proposal In-Reply-To: <3FA3A75F.6060207@csd.uu.se> References: <3FA37FA4.10007@web.de> Message-ID: <3FA43A33.12578.D695E9@localhost> On 1 Nov 2003 at 13:30, Richard Carlsson wrote: > Joachim Durchholz wrote: > > > That's also the reason why Linux is written in English - had Linus stuck > > to Finnish identifiers, Linux wouldn't be an international platform. > > And please note that if Linus had coded using his mother tongue, > he would have written in Swedish, not Finnish. > > /Richard I suspect this is now a common belief - the Linux equivalent "Finux" in Neal Stephenson's novel "Cryptonomicon" is Finnish. - Jonathan Coupe From hakan.stenholm@REDACTED Sun Nov 2 02:20:59 2003 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 2 Nov 2003 02:20:59 +0100 Subject: Language change proposal In-Reply-To: <3FA37FA4.10007@web.de> Message-ID: >>> 1) If somebody gives me software to maintain, I might hit a, say, >>> Chinese glyph somewhere. I'd have to download the proper font just >>> to be able to look at the sources. If your lucky they may actually be included with OS, but even if they are not, I assume that a decent editor has at least some kind of fallback method to display them say as their unicode integer code e.g. \2345, which is probably just as in/comprehensible as the chinese glyph. >> I might also be just a bit tricky to figure out how to write the >> glyph/s, if it's something like japanese, chinese or korean. > > The software that displays Unicode is supposed to do that for you. I don't think thats really going to help if you want to figure out how to write say a japanese or chinese character on a regular keyboard - you can of course always do a copy and paste of the text. > Actually there are issues that I haven't seen properly handled yet; > for example, one Far-East script (Indonesian IIRC) has glyphs that /go > around/ their neighbouring glyph. > Human writing is indeed a strange, aesthetically wonderful but > technically over-complicated beast - and Unicode is designed for > aesthetics and completeness, not for making life easy on the programs > that use it. > >>> Unicode also has issues with letter case. >> Isn't this really a kind of design error/bug/feature in erlang ? >> While I personally would prefer code to be written in english I don't >> see any real problems with using Unicode. > > I don't, too - but why use Unicode if you're writing in English > anyway? Even 7-bit ASCII is enough. Heck, even the common subset of > EBCDIC and ASCII would be enough! Well some additional symbol (none letter) characters (like +,-,@ and ^) might be nice and come in handy as operators in different kinds of scientific notations. > > > The simplest way would >> probably be to introduce some kind of standard upper case marker >> (character) in the case that there is no upper case version of a >> character. Another somewhat more confusing choice would be to require >> that functions can only start with upper case Unicode letters >> (possibly only the characters supplied in the current erlang >> character set). > > Too complicated, too much of a burden on the programmer to remember > correctly, too much of a burden on the maintainer to interpret > correctly. > > At least that was my initial reaction. Seeing a concrete example of > how this is done elegantly in practice, I might reconsider :-) (note: I'm assuming we only want non-english identifiers, strings and atoms) In erlang we could require all variables/functions to start with either upper case ASCII characters (for compatibility with the current OTP libs) if the identifier is in pure ASCII and otherwise start the identifier with some special character (to mark them as upper case) say @ or some other character that isn't used in the context in which function and variable identifiers are used. It could look something like this: %% multiply ? by @g?nger_tv?(@?) -> @? * 2. %% how to call @g?nger_tv?/1 test() -> io:format("~p~n", [ @g?nger_tv?(3) ]). Strings could no longer be considered to be lists of bytes. I don't know if this would be a problem to generalize them to lists of integers, but it may be wiser to add a proper (unicode) string type - which probably requires some way to distinguish them from the current strings, maybe something like: @"my unicode string". Atoms may require a similar solution if they can contain unicode. Functions like atom_to_list/1 will probably still work ok if strings remain list of integers, but if a real string type is used it will obviously be preferable to have a atom_to_string/1 that returns a string, but we will still need to support (at least transitionally) atom_to_list/1 for at least, the ASCII subset of atom identifiers. > >>> With one exception: it would be very nice if the language allowed >>> Unicode within string literals. That's more a question of how to >>> integrate binary data into source code well. >> It might also be useful in comments, if they aren't written in >> english - japanese, russian and other languages that have completely >> different character sets will be rather tedious to encode in some >> kind of ASCII/latin1 version. > > Agreed. > Though the Russians tend to manage somehow - I've been seeing a lot of > Russion software lately. I guess russian isn't that hard as they mostly use different symbols for the same letters ("sounds") so it should be a simple mapping to latin letters. > Actually, all the non-Western languages have ways of transliterating > to Western script. AFAIK there are even several schemes to choose from > for any such language. The problem with transliterations is that they tend to be lossy. For example japanese (which I know a little bit) suffers from this, while the actual transliteration is straightforward, it gets somewhat more difficult to actually read and understand the latinized (transliterated) version - as japanese has a fair amount of word that sound the same way, but which are spelled with different Kanji (chinese symbols), which make them easily distinguishable in japanese writing but not with the latin character set. > Re comment usage: In my book, comments are an integral part of the > source code. If a comment isn't necessary to understand the code, it's > redundant and should be removed, if it's necessary, it should be > written in the same language as the source code. > From this point of view, there's no need for extra allowances in > comments. This kind of assumes a reasonable fluency in english grammar and vocabulary, so while I as well, prefer the comments in english or at least in the same language as the code (so that technical terminology doesn't get confused), there may be cases where it might be wiser to let the programmer write at least the comments in non-english so that they can clearly express what they intended with the code. From joachim.durchholz@REDACTED Sun Nov 2 12:49:30 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Sun, 02 Nov 2003 12:49:30 +0100 Subject: Language change proposal In-Reply-To: References: Message-ID: <3FA4EF4A.8010708@web.de> H?kan Stenholm wrote: > >>> While I personally would prefer code to be written in english I don't >>> see any real problems with using Unicode. >> >> I don't, too - but why use Unicode if you're writing in English >> anyway? Even 7-bit ASCII is enough. Heck, even the common subset of >> EBCDIC and ASCII would be enough! > > Well some additional symbol (none letter) characters (like +,-,@ and ^) > might be nice and come in handy as operators in different kinds of > scientific notations. If you want to represent scientific notations, you'd indeed need unicode. I'm missing the arrow that indicates vectors, the tabular layout of matrices, the vertical bars that indicate determinants, the double vertical bars that indicate various norm operations, etc. etc. BTW the common subset of ASCII and EBCDIC does include the arithmetic operators :-) >> Though the Russians tend to manage somehow - I've been seeing a lot of >> Russion software lately. > > I guess russian isn't that hard as they mostly use different symbols for > the same letters ("sounds") so it should be a simple mapping to latin > letters. Actually, there are several mappings to choose from. AFAIK this is the case for any language that doesn't use the Latin alphabet, even for Chinese and other Far-East languages. Regards, Jo From Jouni.Ryno@REDACTED Sun Nov 2 18:37:58 2003 From: Jouni.Ryno@REDACTED (Jouni Ryno) Date: Sun, 02 Nov 2003 19:37:58 +0200 Subject: io:fread and report_error ? Message-ID: <1067794678.1020.12.camel@catmind.ryno> >From the document of the io:fread: {error, What} The read operation failed and the parameter What can be used as argument to report_error/1 to produce an error message. report_error/1 ? Is this defined somewhere, could not find anywhere ... regards Jouni -- Jouni Ryno Finnish Meteorological Institute From ecb@REDACTED Sat Nov 1 16:43:03 2003 From: ecb@REDACTED (Eric Baur) Date: Sat, 1 Nov 2003 10:43:03 -0500 Subject: Latest Erlang on Mac OS X Panther In-Reply-To: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> References: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> Message-ID: <14299E56-0C82-11D8-ADEA-000A95864718@robeybaur.org> Doh! I screwed up a one line patch. Impressive. Let's try again. ------------------------------------------------------------------ *** Makefile.in.orig Sat Nov 1 09:59:57 2003 --- Makefile.in Sat Nov 1 10:01:08 2003 *************** *** 138,144 **** ifeq ($(TARGET),win32) LIBS = @LIBS@ @THR_LIBS@ -L$(ERL_TOP)/erts/obj$(TYPEMARKER)/$(TARGET) -lz else ! LIBS = @LIBS@ @THR_LIBS@ -L$(ERL_TOP)/erts/obj/$(TARGET) -lz endif ELIB_FLAGS = -DENABLE_ELIB_MALLOC -DELIB_ALLOC_IS_CLIB -DELIB_HEAP_SBRK --- 138,144 ---- ifeq ($(TARGET),win32) LIBS = @LIBS@ @THR_LIBS@ -L$(ERL_TOP)/erts/obj$(TYPEMARKER)/$(TARGET) -lz else ! LIBS = @LIBS@ @THR_LIBS@ $(ERL_TOP)/erts/obj/$(TARGET)/libz.a endif ELIB_FLAGS = -DENABLE_ELIB_MALLOC -DELIB_ALLOC_IS_CLIB -DELIB_HEAP_SBRK On Oct 31, 2003, at 10:23 AM, Sean Hinde wrote: > It appears to be failing to find the already compiled zlib included in > the erts directory structure. This seems to suggest some weird error > which causes zlib to be compiled in a way which the linker can't use, > or some weird new compiler stufff in the final linking stage. > > Very odd. > > Sean > > > On Friday, October 31, 2003, at 02:33 pm, Micael Karlberg wrote: > >> A google indicate that it's defined in zlib (zlib/zutil.h). >> >> /BMK >> >> Eric Newhuis writes: >>> Just to keep this thread alive I will say that no, this doesn't seem >>> to >>> be the only problem. I've not had time to investigate further mostly >>> due to my indulgence in attempting to get distel working on my >>> Panther >>> Mac on R9B-0. >>> >>> I do remember that there were some problems copying files during the >>> make. And I do remember seeing another target complain about >>> undefined >>> z_errmsg. Perhaps if I knew what z_errmsg is I could take the next >>> step. I suppose I shall have to look at the erts source. >>> >>> I have no problem using the pre-built R9B-0 Mac OS/X release on >>> Panther. I've been using it for a week now without any problems. >>> However I have not tried anything that invokes the GUI. >>> >>> >>>> Is that linking problem only for the Shared Heap emulator? >>>> >>>> In that case, a simply workaround would be to comment out >>>> the building of the Shared Heap emulator from the Makefile, >>>> as it is not critical for building the rest of OTP. >> >> -- >> Micael Karlberg Ericsson AB, ?lvsj? Sweden >> Tel: +46 8 727 5668 EAB/UHK/KD - OTP Product Development >> ECN: 851 5668 Mail: micael.karlberg@REDACTED >> Fax: +46 8 727 5775 > From ecb@REDACTED Sat Nov 1 14:58:39 2003 From: ecb@REDACTED (Eric Baur) Date: Sat, 1 Nov 2003 08:58:39 -0500 Subject: Latest Erlang on Mac OS X Panther In-Reply-To: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> References: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> Message-ID: <7F0AEE92-0C73-11D8-ADEA-000A95864718@robeybaur.org> It seems that the linker is picking up the dynamically linked native version of libz if you use the crufty old -L/-l silliness. The attached simple patch fixes it. Judicious use of -Bstatic for gcc build might be an alternative. -------------- next part -------------- A non-text attachment was scrubbed... Name: link.patch Type: application/octet-stream Size: 693 bytes Desc: not available URL: -------------- next part -------------- On Oct 31, 2003, at 10:23 AM, Sean Hinde wrote: > It appears to be failing to find the already compiled zlib included in > the erts directory structure. This seems to suggest some weird error > which causes zlib to be compiled in a way which the linker can't use, > or some weird new compiler stufff in the final linking stage. > > Sean > > > On Friday, October 31, 2003, at 02:33 pm, Micael Karlberg wrote: > >> A google indicate that it's defined in zlib (zlib/zutil.h). >> >> /BMK >> >> Eric Newhuis writes: >>> Just to keep this thread alive I will say that no, this doesn't seem >>> to >>> be the only problem. I've not had time to investigate further mostly >>> due to my indulgence in attempting to get distel working on my >>> Panther >>> Mac on R9B-0. >>> >>> I do remember that there were some problems copying files during the >>> make. And I do remember seeing another target complain about >>> undefined >>> z_errmsg. Perhaps if I knew what z_errmsg is I could take the next >>> step. I suppose I shall have to look at the erts source. >>> >>> I have no problem using the pre-built R9B-0 Mac OS/X release on >>> Panther. I've been using it for a week now without any problems. >>> However I have not tried anything that invokes the GUI. >>> >>> >>>> Is that linking problem only for the Shared Heap emulator? >>>> >>>> In that case, a simply workaround would be to comment out >>>> the building of the Shared Heap emulator from the Makefile, >>>> as it is not critical for building the rest of OTP. >> >> -- >> Micael Karlberg Ericsson AB, ?lvsj? Sweden >> Tel: +46 8 727 5668 EAB/UHK/KD - OTP Product Development >> ECN: 851 5668 Mail: micael.karlberg@REDACTED >> Fax: +46 8 727 5775 > From mikael.karlsson@REDACTED Mon Nov 3 00:59:33 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Mon, 3 Nov 2003 00:59:33 +0100 Subject: Enterprise Erlang Beams? In-Reply-To: References: <200308221539.45014.mikael.karlsson@creado.com> <200309022102.13087.mikael.karlsson@creado.com> Message-ID: <200311030059.33052.mikael.karlsson@creado.com> Hi, sorry for a bit slow response on this topic but I hope things are not (dead) cold. I had a some kind of analogy in mind, but the idea is quite vague. What I like about EJB containers is the transaction support that means that you should not need to worry about the transaction yourself. It comes "for free" in some kind of declarative manner. Leaving out all the problems with security, for the moment, the analogy would be to spawn off a gen_server (or gen_fsm for a stateful session bean?) as a worker thread within a transaction. Parts of the contents of the server State could map to the persistent store and be used at commit/fallback time, without the gen_server explicitly taking part in the transaction. One could maybe even have some kind of persistent behaviour were the gen_server is spawned with a state that is restored from the database. (It could be spawned on another node as well.) Regards Mikael Wed 03 september 2003 08:56 Vlad Dumitrescu wrote: > Hello, > > First, let me remind you that I am no J2EE "power user" either. So I may be > dead wrong, but this is what I think and I welcome criticism. > > ----- Original Message ----- > From: "Mikael Karlsson" > > > Wed 27 augusti 2003 10:36 Vlad Dumitrescu wrote: > > > - I don't think it would be good to try to imitate J2EE. > > > > OK, I guess you would like to have some kind of transaction support > > still? > > Yes, of course. What I meant was that I think it is the application > server's functionality that has to be replicated, not necessarily by using > anything similar to Java beans. Maybe you didn't mean that either, but it > wasn't clear (the name Erlang Beams is a pun against such an analogy) and I > think it is important to point it out. > > > > - An aspect where Java has the upper hand is security: JVM is acting as > > > a sandbox, while BeamVM isn't. This might be important. > > > > I am not sure I understand why this is important on the server side. What > > security issues are adressed by the JVM that makes an Erlang > > implementation too risky? Is it programming mistakes or vulnerability to > > external attacks? > > Both. That it is so simple in a distributed environment such as Erlang to > run on another node something like os:cmd("rm -rf /") is giving me shivers. > If malevolent code sneaks into the system, then everything is wide open. > Programming errors might not be as destructive, but they can happen. > > An EJB can't do some things that a regular bean can: > - no threading > - no graphics > - can't be a network server (**) > - can't write to static fields (*) > - no IO (**) > - can't load native libraries (***) > - can't use 'this' as argument ore return value (**) > - no loopback calls (i.e. EJB are non-reentrant) (*) > I marked with stars according to how much I think each of those are related > to security issues. Except for the last one (I think), Java EE and the app > server enforce these limitations. Something similar should be present in > any other implementation of an app server. > > Of course, it's possible to equate EJB = Erlang process, and set the > responsibility of not doing anything "bad" to the programmers, but I > wouldn't want to use such an app server in a production environment. Not > even if it was me who wrote all code. > > I think too that an Erlang app server could be a very good product, but > there are still issues to be solved. Hopefully this discussion will lead to > some advances. I'm glad you started it. > > regards, > /Vlad From ok@REDACTED Mon Nov 3 02:48:38 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 3 Nov 2003 14:48:38 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311030148.hA31mcQf062007@atlas.otago.ac.nz> I wrote that: > One of the long term goals for Erlang is that it should support Unicode; Note that this wasn't a _recommendation_, it was a straightforward report of fact. Jonas Barklund's "es_std_0.6.ps" states plainly in section 3 that "Standard Erlang" uses Unicode. As it happens, I DO recommend that Erlang should support Unicode, but it wasn't me that said it back in 1998. Joachim Durchholz wrote:, This is something that I'd advise against. ... 1) If somebody gives me software to maintain, I might hit a, say, Chinese glyph somewhere. I'd have to download the proper font just to be able to look at the sources. es_std_0.6.ps describes \u escapes exactly like Java/C++/C99. This means that it is quite untrue that you would need special fonts to look at sources. (Not that suitable free fonts haven't been available for several years now, ...) Not that the result would be particularly readable, but then, if I gave you source code full of identifiers like "waea", "tuhituhi", "kupenga", "tiimata", and so on, you wouldn't find that particularly readable despite it using none but ASCII letters. You cannot realistically maintain software in a language you can't at least read, which of course is why Chinese Erlang programmers should be allowed to use Chinese words. 2) There are many glyphs that look the same. For example, that "a" letter might actually have an entirely different encoding since it's from the Russian alphabet. True: U+0430 CRYLLIC SMALL LETTER A. It's not clear how much of a problem this is in practice. In any case, since people expect to work with XML, this is a problem Erlang *has* to live with somehow. Unicode also has issues with letter case. More precisely, the world's scripts have issues with letter case. For one, there is no good mapping of lowercase and uppercase letters (and cannot be: for example, the German has no uppercase equivalent, it transliterates to SS or SZ depending on personal whim). Case conversion is not a simple one-to-one mapping. That's not Unicode's fault, that's just the way things are. There are, for example, two conventions for converting lower case to upper case in French (lose the accents/keep the accents). There's the point, spelled out in the Unicode book itself, that the Turkish upper case equivalent of "i" is not "I" but capital-I-with-dot-above, and the Turkish lower case equivalent of "I" is not "i" but lower-case-dotless-i. Since Erlang is a case sensitive language, this is a non-problem: you don't care about case conversion when processing Erlang sources because you don't ever do it. When it comes to data, it's up to the application to decide whether to use locale-sensitive case mapping or the case mapping tables that are available free from unicode.org. Additionally, Unicode has /three/ lettercase categories: lower, upper, and title case. (The latter information is gleaned from the Haskell language report, I don't know anything further about Unicode.) This is true. Again, I don't see what the problem is. If you want to find a stick to beat Unicode with, there are stouter ones. (Like the fact that the encoding of a glyph is not unique, and there is a bewildering choice of normalisation forms.) (There's also a portability issue: there are still EBCDIC machines around that don't support Unicode. I don't think this is relevant for Erlang though *g*) What machines are those? Certainly not IBM ones; z/Architecture has hardware support for Unicode. If it comes to that, there are probably still a few PDP-11s in service that only support ASCII. What of it? My personal idea about Unicode is that it is massively overengineered for simple tasks like representing source code. It is, on the other hand, the only international widely supported large character set standard around, and it _wasn't_ engineered just for simple tasks. What are the advantages of keeping some XML data as atoms? The same as the advantages of keeping any other data as atoms. Atoms are physically compact and testing for atom equality is very fast; if you want to write a program that transforms XML to something else, you'd be mad to do it in XSLT if you could do it in Erlang, and that means pattern matching against XML trees is interesting. SWI Prolog doesn't just store generic identifiers and attribute names as atoms, it stores #PCDATA as atoms as well, and SWI Prolog is used with very large RDF files. (Mind you, SWI Prolog is a multithreaded system whose atom table _is_ garbage collected.) About ISO Latin and Windows: That's one of the reasons why I don't use umlauts in my source code, except when it comes to literal strings. And I'm painfully aware that having umlauts in strings makes my sources nonportable; the better solution is to have some internationalization support. As a matter of fact, vowels with umlauts and the sharp-s character are no trouble at all: ISO Latin 1, ISO Latin 9 (=8859-15), MacRoman, and Windows all support them perfectly well. The big problem is things like English quotation marks, which MacRoman and Windows support, but none of the ISO 8859 character sets. Even if we confine Erlang to 8-bit character sets, people DO have reason to use different 8-bit character sets, and some way of indicating _which_ 8-bit character set was used is going to be increasingly important. (I repeat my observation that ISO Latin 9 has a Euro character and ISO Latin 1 does not, so there is a strong incentive for Europeans to switch to ISO Latin 9 as their default character set.) PS: the words are "wire", "write", "net", and "start". From ok@REDACTED Mon Nov 3 03:43:57 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 3 Nov 2003 15:43:57 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> =?ISO-8859-1?Q?H=E5kan_Stenholm?= wrote: > Unicode also has issues with letter case. Isn't this really a kind of design error/bug/feature in erlang ? No. Erlang requires that some characters be classified as upper-case letters (I'd include title-case letters in that set) and some other characters be classified as not-upper-case letters (include lower case, non-case, syllables, logograms). The upper case letters should contain the 26 ASCII ones; the not-upper-case-letters should contain the 26 ASCII ones; the two sets should be disjoint; various other characters (digits, layout, punctuation) should also be disjoint. Works fine for Unicode. This was all sorted out for the ISO Prolog standard. While I personally would prefer code to be written in english I don't see any real problems with using Unicode. The simplest way would probably be to introduce some kind of standard upper case marker (character) in the case that there is no upper case version of a character. Erlang syntax doesn't *care* whether there is an upper case version of a character or not. People writing in Chinese, Japenese, Korean, &c should start their variables with an "_" (like people writing Prolog for those languages); that's enough. The problem was first considered for Prolog back in about 1983, as far as I know; Quintus implemented this solution (variable starts with any upper case letter; if your script doesn't have upper case letters, use a leading "_") by about 1985 or 1986. Another somewhat more confusing choice would be to require that functions can only start with upper case Unicode letters (possibly only the characters supplied in the current erlang character set). That would certainly be confusing, since Erlang function names normally start with not-upper-case letters. By the way, the Unicode book spells out clear, simple, and usable rules for identifier syntax. I wish people would read that before trying to solve problems that don't actually exist. (There are more than enough Unicode problems that _do_ exist...) [Unicode] might also be useful in comments, if they aren't written in english - japanese, russian and other languages that have completely different character sets will be rather tedious to encode in some kind of ASCII/latin1 version. Heck, IBM mainframe programmers have been able to use wide characters in strings and comments for at least 20 years. In Fortran, yet. My point is that IF you are going to do this, you had better say up front with a -erlang(Encoding,Version) declaration, which character set you are using in those comments and strings, lest they be misunderstood. From ok@REDACTED Mon Nov 3 04:06:51 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 3 Nov 2003 16:06:51 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311030306.hA336p7O012266@atlas.otago.ac.nz> Joachim Durchholz wrote: The software that displays Unicode is supposed to do that for you. Actually there are issues that I haven't seen properly handled yet; for example, one Far-East script (Indonesian IIRC) has glyphs that /go around/ their neighbouring glyph. Indonesian can be written in ASCII. He may be thinking of some Indic script. I don't, too - but why use Unicode if you're writing in English anyway? Because quite a lot of the characters you want for writing English are not available in ASCII, most obviously, but not limited to, the 6..9 66..99 quotation marks (and NO, '..' ".." are *NOT* adequate substitutes). I can't even write my father's name in ASCII. Not to mention the fact that this country has two official languages, and one of them requires letters that are not available even in ISO Latin 1. I can't even write the name of my University in Latin 1, far less ASCII. Agreed. Though the Russians tend to manage somehow - I've been seeing a lot of Russion software lately. Actually, all the non-Western languages have ways of transliterating to Western script. AFAIK there are even several schemes to choose from for any such language. Note that many such transliteration schemes use diacritical marks, which means that they don't map to ASCII, and may have trouble mapping to Latin 1. The whole reason that Unicode has three alphabetic cases is to support a historic Cyrillic->Latin transliteration scheme. From Bengt.Kleberg@REDACTED Mon Nov 3 09:21:06 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 03 Nov 2003 09:21:06 +0100 Subject: Language change proposal In-Reply-To: <3FA43A33.12578.D695E9@localhost> References: <3FA37FA4.10007@web.de> <3FA43A33.12578.D695E9@localhost> Message-ID: <3FA60FF2.1080003@ericsson.com> jonathan@REDACTED wrote: > On 1 Nov 2003 at 13:30, Richard Carlsson wrote: > > >>Joachim Durchholz wrote: >> ...deleted >>And please note that if Linus had coded using his mother tongue, >>he would have written in Swedish, not Finnish. >> >> /Richard > > > I suspect this is now a common belief - the Linux equivalent "Finux" > in Neal Stephenson's novel "Cryptonomicon" is Finnish. > presumably everybody already knows, but anyway: finland is a bilingual country (like belgium, perhaps?). most people living there speak finish, but some speak swedish. mr torvalds could be finish, but speak/write swedish. bengt From mickael.remond@REDACTED Mon Nov 3 09:34:16 2003 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 3 Nov 2003 09:34:16 +0100 Subject: 8-pages article on Erlang in Linux Magazine France Message-ID: <20031103083416.GA17296@cgey.com> Hello, Linux Magazine France (november 2003 issue) has published an 8-pages introduction article on Erlang. This is the first article of a series by Yan Denet. It seems that the Erlang community is getting stronger in France. That's great ! -- Micka?l R?mond http://www.erlang-projects.org/ From Bengt.Kleberg@REDACTED Mon Nov 3 09:52:08 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 03 Nov 2003 09:52:08 +0100 Subject: io:fread and report_error ? In-Reply-To: <1067794678.1020.12.camel@catmind.ryno> References: <1067794678.1020.12.camel@catmind.ryno> Message-ID: <3FA61738.7090607@ericsson.com> Jouni Ryno wrote: >>From the document of the io:fread: > > {error, What} > The read operation failed and the parameter What can be used as > argument to report_error/1 to produce an error message. > > report_error/1 ? Is this defined somewhere, could not find anywhere ... > presumably this is a documentation error. imho it should be format_error/1. the idea is/was that any module that returns ''{error, What}'' (which function in the module that returns this does not matter), should have a format_error/1. the latter function will give a nice explanation of the error, meant for humans. like plan9: printf("%r"); if this is familiar. bengt From Vlad.Dumitrescu@REDACTED Mon Nov 3 09:51:57 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 03 Nov 2003 09:51:57 +0100 Subject: list problems Message-ID: Hi, Since the downtime a few days ago, I don't get anything from the list to my regular email address, nor could I get through from there or another address at home. Is it only my problem, or are there others in the same situation? (Well, if there are any, it's quite difficult to know since they won't read this question :-) What I mean is, did the subscriber list get messed up somehow? regards, Vlad From e.newhuis@REDACTED Sun Nov 2 20:23:25 2003 From: e.newhuis@REDACTED (Eric Newhuis) Date: Sun, 2 Nov 2003 13:23:25 -0600 Subject: Latest Erlang on Mac OS X Panther In-Reply-To: <98CCA072-0BB8-11D8-B19F-000A95D9A520@futuresource.com> References: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> <98CCA072-0BB8-11D8-B19F-000A95D9A520@futuresource.com> Message-ID: <0773219B-0D6A-11D8-B19F-000A95D9A520@mac.com> After applying the patch (removing the -L from erts/emulator/Makefile.in) the build now stops with the following. I am continuing to investigate but there may be someone out there who is faster than I am. ld: can't map file: .../otp_src_R9C-0/erts/obj/powerpc-apple-darwin7.0.0 ((os/kern) invalid argument) make[3]: *** [.../otp_src_R9C-0/bin/powerpc-apple-darwin7.0.0/beam] Error 1 ... From e.newhuis@REDACTED Sun Nov 2 22:04:58 2003 From: e.newhuis@REDACTED (Eric Newhuis) Date: Sun, 2 Nov 2003 15:04:58 -0600 Subject: Latest Erlang on Mac OS X Panther In-Reply-To: <0773219B-0D6A-11D8-B19F-000A95D9A520@mac.com> References: <3EBBFCF0-0BB6-11D8-A2CF-000A95927CCE@mac.com> <98CCA072-0BB8-11D8-B19F-000A95D9A520@futuresource.com> <0773219B-0D6A-11D8-B19F-000A95D9A520@mac.com> Message-ID: <372AE3B0-0D78-11D8-B19F-000A95D9A520@mac.com> Please disregard my last email. I messed up the application of the patch. Now it works just fine. R9C on Panther. Awesome. > After applying the patch (removing the -L from > erts/emulator/Makefile.in) the build now stops with the following. I > am continuing to investigate but there may be someone out there who is > faster than I am. > > ld: can't map file: > .../otp_src_R9C-0/erts/obj/powerpc-apple-darwin7.0.0 ((os/kern) > invalid argument) > make[3]: *** [.../otp_src_R9C-0/bin/powerpc-apple-darwin7.0.0/beam] > Error 1 > ... > From banat82@REDACTED Mon Nov 3 11:39:51 2003 From: banat82@REDACTED (mohammad banat) Date: Mon, 3 Nov 2003 02:39:51 -0800 (PST) Subject: design pattern using erlang Message-ID: <20031103103951.32620.qmail@web41812.mail.yahoo.com> hello i am a student in a jordinian university and i want to make a project that is a gate way but by using design pattern , this pattern should be implemented in erlang i got the information about erlang in your web site and in other sites , but i feel that i still need more, so if you can help me and supply me with some more information supported with some small examples in order to get better understanding about how to write a programs using erlang and if u can help me more by give me some notes how to start the implementation of patterns like(reactor) please help me in the nearest chance --------------------------------- Do you Yahoo!? Exclusive Video Premiere - Britney Spears -------------- next part -------------- An HTML attachment was scrubbed... URL: From joachim.durchholz@REDACTED Mon Nov 3 12:42:48 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Mon, 03 Nov 2003 12:42:48 +0100 Subject: Language change proposal In-Reply-To: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> Message-ID: <3FA63F38.8010105@web.de> Richard A. O'Keefe wrote: > By the way, the Unicode book spells out clear, simple, and usable rules > for identifier syntax. Ah, wonderful. Do you have a URL, or a set of promising Google keywords? Regards, Jo From fredrik.linder@REDACTED Mon Nov 3 14:26:33 2003 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Mon, 3 Nov 2003 14:26:33 +0100 Subject: 2D in erlang Message-ID: Hello folks I'm looking for an erlang 2D-tool to with windows, menus, bullets and stuff. Do you know of any, except for the gs one? Cheers /Fredrik From mwilligs@REDACTED Mon Nov 3 15:27:08 2003 From: mwilligs@REDACTED (mwilligs@REDACTED) Date: Mon, 3 Nov 2003 11:27:08 -0300 (PYST) Subject: No subject Message-ID: <32917.65.198.40.11.1067869628.squirrel@unimail.uninet.com.py> I have this code: cre_SubtractRequest(TerminationID, AuditDescriptor)-> #'SubtractRequest'{terminationID=[#megaco_term_id{id=TerminationID}], auditDescriptor=AuditDescriptor}. cre_AuditDescriptor(AuditToken)-> #'AuditDescriptor'{auditToken=AuditToken}. I want to build this megaco command in Erlang: Context = 1 { substract = Epha {Audit{Statistics}} } But I don't know how to use a token If my code is ok, how can I make to insert the token "Statistics" in my megaco command? Thanks in advance From cyberlync@REDACTED Mon Nov 3 15:35:33 2003 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 3 Nov 2003 06:35:33 -0800 (PST) Subject: Language change proposal In-Reply-To: <200311030148.hA31mcQf062007@atlas.otago.ac.nz> Message-ID: <20031103143533.31912.qmail@web40812.mail.yahoo.com> > (There's also a portability issue: there are still > EBCDIC machines > around that don't support Unicode. I don't think > this is relevant for > Erlang though *g*) > > What machines are those? Certainly not IBM ones; > z/Architecture has > hardware support for Unicode. If it comes to that, > there are probably > still a few PDP-11s in service that only support > ASCII. What of it? Sure the IBM machines support ununicodebut at the cost of doubling the size required to store your character based data. Most shops ararn going to go this route, dadasdn big iron is still not cheap. Also I wowouldn compare 390s and 400s to PDP-11s. PDP-11s have not been produced in many years, nor have they been supported. 390s and 400s have been constantly supported and upgraded over ththeirifetimes, this looks to continue inindefinitely390s and 400s are not dead architectures by any ststretchf the imagination. __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ From cyberlync@REDACTED Mon Nov 3 15:42:29 2003 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 3 Nov 2003 06:42:29 -0800 (PST) Subject: 2D in erlang In-Reply-To: Message-ID: <20031103144229.98017.qmail@web40803.mail.yahoo.com> I don't believe there is anything besides gs in the standard distro. You can do 2-d with ESDL and SDL, but that wont give you a gui system (which is what it looks like you want). There is an erlang binding to gtk, but I am not sure what state its in. You could also write your own binding to the lib of choice, edtk makes it pretty strait forward. erlgtk. http://erlgtk.sourceforge.net/ esdl http://esdl.sourceforge.net/ edtk http://www.snookles.com/erlang/edtk/ --- Fredrik Linder wrote: > Hello folks > > I'm looking for an erlang 2D-tool to with windows, > menus, bullets and stuff. > Do you know of any, except for the gs one? > > Cheers > /Fredrik > > __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ From hal@REDACTED Mon Nov 3 15:48:20 2003 From: hal@REDACTED (Hal Snyder) Date: Mon, 03 Nov 2003 08:48:20 -0600 Subject: Language change proposal In-Reply-To: <3FA63F38.8010105@web.de> (Joachim Durchholz's message of "Mon, 03 Nov 2003 12:42:48 +0100") References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> <3FA63F38.8010105@web.de> Message-ID: <87oevtmrt7.fsf@ghidra.vail> Joachim Durchholz writes: > Richard A. O'Keefe wrote: >> By the way, the Unicode book spells out clear, simple, and usable rules >> for identifier syntax. > > Ah, wonderful. > Do you have a URL, or a set of promising Google keywords? I couldn't help it: google: unicode "identifier syntax" ... http://www.unicode.org/reports/tr31/ OTOH we could just say variables begin with capital Latin/Cyrillic letter, katakana, zhuyin, or any hanzi with "ren" radical ... (j/k). From mickael.remond@REDACTED Mon Nov 3 16:03:02 2003 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 3 Nov 2003 16:03:02 +0100 Subject: 2D in erlang In-Reply-To: References: Message-ID: <20031103150302.GE20096@cgey.com> * Fredrik Linder [2003-11-03 14:26:33 +0100]: > Hello folks > > I'm looking for an erlang 2D-tool to with windows, menus, bullets and stuff. > Do you know of any, except for the gs one? You can try erl GTK: http://erlgtk.sourceforge.net/ -- Micka?l R?mond http://www.erlang-projects.org/ From michael@REDACTED Mon Nov 3 17:08:35 2003 From: michael@REDACTED (Michael Hobbs) Date: Mon, 3 Nov 2003 10:08:35 -0600 (CST) Subject: Language change proposal In-Reply-To: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> Message-ID: <1659.66.41.245.83.1067875715.squirrel@mail.hobbshouse.org> Richard A. OKeefe said: > My point > is that IF you are going to do this, you had better say up front with a > -erlang(Encoding,Version) declaration, which character set you are using > in those comments and strings, lest they be misunderstood. Not to sidetrack this topic even further, but I will... :-) I've always found it interesting that the XML specification does not explicitly specify which encoding should be used for the encoding declaration. (e.g. "") The closest it comes to making such a specification is the line, "it is an error for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8." That line seems to imply that if an entity contains an encoding declaration, then the whole entity must be encoded with that encoding. This presents a chicken-or-egg problem in that how is an XML processor to process an encoding declaration before it knows what the encoding is? So, to bring the wagons back around to Erlang, if there ever is an -erlang(Encoding, Version) declaration, it would be nice if it is clearly stated what encoding should be used for the "-erlang(Encoding, Version)" text. - Michael Hobbs From mlogan@REDACTED Mon Nov 3 18:04:13 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 03 Nov 2003 11:04:13 -0600 Subject: design pattern using erlang In-Reply-To: <20031103103951.32620.qmail@web41812.mail.yahoo.com> References: <20031103103951.32620.qmail@web41812.mail.yahoo.com> Message-ID: <1067879053.24050.412.camel@dhcp-lom-194-186.futuresource.com> First get a really good sense of what the pattern is trying to accomplish. You now go ahead and write modules that are either libraries or spawn processes. I struggle with mapping out a clear path for you. You really need to understand and write a few programs in erlang. It is a different paradigm. You will not have objects and inheritance. What you will have are modules and processes. The thing that you are going to need to concentrate on is typically; what are the concurrent activities in your system. Those should be made into processes. Each process should have a well defined interface. This interface should hide the messaging format, or the "alphabet" of your process. This interface and process should be encapsulated by a single module. In the end you will have a system of processes communicating through interfaces. Kind of like a system of objects communicating through interfaces. You will loose inheritance and strong typing and gain true and beautiful concurrency:) Find a pattern that emphasizes concurrency and then decompose it into modules and processes. I must now ask why you choose the reactor. The reactor is a pattern that emphasizes an event based and single threaded implementation. I suggest that you not follow the reactor to the letter, if your assignment mandates that you do then choose another pattern. I also recommend that you use OTP. If you learn nothing else of OTP learn the following. Really LEARN THE FOLLOWING: Learn and use the supervisor and learn and use the gen_server. Use sasl for its logging and reporting. Martin On Mon, 2003-11-03 at 04:39, mohammad banat wrote: > hello > i am a student in a jordinian university and i want to make a > project that is a gate way but by using design pattern , this pattern > should be implemented in erlang > i got the information about erlang in your web site and in other sites > , but i feel that i still need more, so if you can help me and supply > me with some more information supported with some small examples in > order to get better understanding about how to write a programs using > erlang and if u can help me more by give me some notes how to start > the implementation of patterns like(reactor) > > please help me in the nearest chance > > > ______________________________________________________________________ > Do you Yahoo!? > Exclusive Video Premiere - Britney Spears From micael.karlberg@REDACTED Mon Nov 3 18:07:06 2003 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Mon, 3 Nov 2003 18:07:06 +0100 Subject: No subject In-Reply-To: <32917.65.198.40.11.1067869628.squirrel@unimail.uninet.com.py> References: <32917.65.198.40.11.1067869628.squirrel@unimail.uninet.com.py> Message-ID: <16294.35642.835593.774752@gargle.gargle.HOWL> Hi, mwilligs@REDACTED writes: > I have this code: > > cre_SubtractRequest(TerminationID, AuditDescriptor)-> > #'SubtractRequest'{terminationID=[#megaco_term_id{id=TerminationID}], > auditDescriptor=AuditDescriptor}. > > cre_AuditDescriptor(AuditToken)-> > #'AuditDescriptor'{auditToken=AuditToken}. > > I want to build this megaco command in Erlang: > > Context = 1 > { > substract = Epha {Audit{Statistics}} > } > > But I don't know how to use a token > > If my code is ok, how can I make to insert the token "Statistics" in my > megaco command? There is no statistics token for auditToken in AuditDescriptor. The auditToken in the AuditDescriptor is either a the atom asn1_NOVALUE or a list of tokens (statistics is not one of them), so: cre_AuditDescriptor(AuditToken) when atom(AuditToken) -> #'AuditDescriptor'{auditToken = [AuditToken]}; cre_AuditDescriptor(Tokens) when list(Tokens) -> #'AuditDescriptor'{auditToken = [Tokens]}. If I read chapter 7.2.3, of RFC3525 correctly (yes, I know we do not yet support this rfc), there is no need to specify statistics. It is the default. "By default, the Statistics parameter is returned to report information collected on the Termination or Terminations specified in the Command. The information reported applies to the Termination's or Terminations' existence in the Context from which it or they are being subtracted. The AuditDescriptor is optional. If present, the command will return only those descriptors as specified in the AuditDescriptor, which may be empty. If omitted, the Statistics descriptor is returned, by default. Possible return values are the same as those to Add." > > Thanks in advance /BMK From joachim.durchholz@REDACTED Tue Nov 4 01:35:08 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Tue, 04 Nov 2003 01:35:08 +0100 Subject: Language change proposal In-Reply-To: <1659.66.41.245.83.1067875715.squirrel@mail.hobbshouse.org> References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> <1659.66.41.245.83.1067875715.squirrel@mail.hobbshouse.org> Message-ID: <3FA6F43C.1020102@web.de> Michael Hobbs wrote: > That line seems to imply that if an entity contains an encoding > declaration, then the whole entity must be encoded with that encoding. > This presents a chicken-or-egg problem in that how is an XML processor to > process an encoding declaration before it knows what the encoding is? The first byte of an entity is always a specific character (probably "<" for XML). Assuming the entity is correct, the XML processor can infer at least a first estimate of what encoding was used, and later check it against the encoding declarations. > So, to bring the wagons back around to Erlang, if there ever is an > -erlang(Encoding, Version) declaration, it would be nice if it is clearly > stated what encoding should be used for the "-erlang(Encoding, Version)" > text. The declaration should use the same encoding as the rest of the source file. Proceed as follows: IF first two characters are hex FEFF or FFFE THEN assume Unicode ELSEIF first character is EBCDIC encoding of "-" THEN assume the intersection of all EBCDIC code pages parse first line IF it's not something like "-erlang(EBCDIC-whatever, Version)" THEN report error, abort compilation END load requested EBCDIC code page ELSEIF first character is ASCII encoding of "-" THEN assume the intersection of all ASCII code pages (Latin-1, ...) parse first line IF it's not something like "-erlang(Encoding, Version)" (where "Encoding" is one of the supported ASCII code pages) THEN report error, abort compilation END load requested ASCII code page ELSE assume 7-bit ASCII ENDIF Just my 2c. Regards, Jo From Vlad.Dumitrescu@REDACTED Tue Nov 4 08:38:10 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 04 Nov 2003 08:38:10 +0100 Subject: Tree structures Message-ID: Hi, Are there any libraries that handle tree structures? I didn't find any advertised as such, but many applications could have such a module for internal use. What I have in mind is a tree where nodes look like {Key, Value, [ChildrenList]} Thanks in advance. Regards, Vlad From lennart.ohman@REDACTED Tue Nov 4 09:31:17 2003 From: lennart.ohman@REDACTED (=?ISO-8859-1?Q?Lennart_=D6hman?=) Date: Tue, 04 Nov 2003 09:31:17 +0100 Subject: Tree structures In-Reply-To: References: Message-ID: <3FA763D5.3070407@st.se> Hi, I believe there was an AVL tree once. And I made a B-plus tree for the (now) very ancient DB3 database. Maybe they have been removed from the distribution. I might have them somewhere if you are interested. /Lennart Vlad Dumitrescu wrote: > Hi, > > Are there any libraries that handle tree structures? I didn't find any advertised as such, but many applications could have such a module for internal use. > > What I have in mind is a tree where nodes look like {Key, Value, [ChildrenList]} > > Thanks in advance. Regards, > Vlad > -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From Vlad.Dumitrescu@REDACTED Tue Nov 4 09:53:53 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 04 Nov 2003 09:53:53 +0100 Subject: Tree structures In-Reply-To: <3FA763D5.3070407@st.se> References: <3FA763D5.3070407@st.se> Message-ID: Hi Lennart, You made me realise I didn't specify my question. The distribution has gb_trees which implements AVL trees, but I need "regular", unordered, unstructured ones. It's probably very simple to write an implementation, but if there already was a tested one, why not use it? Thanks anyway! regards, Vlad From bry@REDACTED Tue Nov 4 10:40:21 2003 From: bry@REDACTED (bryan) Date: Tue, 4 Nov 2003 10:40:21 +0100 Subject: erlang eval? In-Reply-To: <3F9D1DA2.7B818CF8@eth.ericsson.se> Message-ID: <000001c3a2b7$aaea42e0$2001a8c0@bryans> Is there an eval function in erlang, for evaluation of strings as erlang code? If so what module is it in? From fredrik.linder@REDACTED Tue Nov 4 12:03:57 2003 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Tue, 4 Nov 2003 12:03:57 +0100 Subject: 2D in erlang In-Reply-To: <20031103144229.98017.qmail@web40803.mail.yahoo.com> Message-ID: Thank you, both of you! And yes, it's a giu system I'm after :-) I've have a look at this. /Fredrik %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Mickael Remond > Sent: den 3 november 2003 16:03 > To: Fredrik Linder > Cc: Erlang-Questions@REDACTED Org > Subject: Re: 2D in erlang > > > * Fredrik Linder [2003-11-03 > 14:26:33 +0100]: > > > Hello folks > > > > I'm looking for an erlang 2D-tool to with windows, menus, > bullets and stuff. > > Do you know of any, except for the gs one? > > You can try erl GTK: > > http://erlgtk.sourceforge.net/ > > -- > Mickael Remond > http://www.erlang-projects.org/ > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Eric Merritt > Sent: den 3 november 2003 15:42 > To: erlang-questions@REDACTED > Subject: Re: 2D in erlang > > > I don't believe there is anything besides gs in the > standard distro. You can do 2-d with ESDL and SDL, but > that wont give you a gui system (which is what it > looks like you want). There is an erlang binding to > gtk, but I am not sure what state its in. You could > also write your own binding to the lib of choice, edtk > makes it pretty strait forward. > > erlgtk. > http://erlgtk.sourceforge.net/ > > esdl > http://esdl.sourceforge.net/ > > edtk > http://www.snookles.com/erlang/edtk/ > > --- Fredrik Linder > wrote: > > Hello folks > > > > I'm looking for an erlang 2D-tool to with windows, > > menus, bullets and stuff. > > Do you know of any, except for the gs one? > > > > Cheers > > /Fredrik > > > > > > > __________________________________ > Do you Yahoo!? > Exclusive Video Premiere - Britney Spears > http://launch.yahoo.com/promos/britneyspears/ > > From fredrik.linder@REDACTED Tue Nov 4 12:03:26 2003 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Tue, 4 Nov 2003 12:03:26 +0100 Subject: design pattern using erlang In-Reply-To: <1067879053.24050.412.camel@dhcp-lom-194-186.futuresource.com> Message-ID: Another thing you could have a look at is the 'Design Principles', and especially the behaviour concept. It is a nice tool for "coupling" modules together. And yes, you'll loose inheritance, but you'd still have the powerful (process) collaboration. So, you'd really don't loose anything (anything important that is ;-). Good Luck /Fredrik > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Martin J. Logan > Sent: den 3 november 2003 18:04 > To: mohammad banat > Cc: erlang-questions@REDACTED > Subject: Re: design pattern using erlang > > > First get a really good sense of what the pattern is trying to > accomplish. You now go ahead and write modules that are either libraries > or spawn processes. I struggle with mapping out a clear path for you. > You really need to understand and write a few programs in erlang. It is > a different paradigm. You will not have objects and inheritance. What > you will have are modules and processes. The thing that you are going to > need to concentrate on is typically; what are the concurrent activities > in your system. Those should be made into processes. Each process should > have a well defined interface. This interface should hide the messaging > format, or the "alphabet" of your process. This interface and process > should be encapsulated by a single module. In the end you will have a > system of processes communicating through interfaces. Kind of like a > system of objects communicating through interfaces. You will loose > inheritance and strong typing and gain true and beautiful concurrency:) > Find a pattern that emphasizes concurrency and then decompose it into > modules and processes. I must now ask why you choose the reactor. The > reactor is a pattern that emphasizes an event based and single threaded > implementation. I suggest that you not follow the reactor to the letter, > if your assignment mandates that you do then choose another pattern. > > I also recommend that you use OTP. If you learn nothing else of OTP > learn the following. Really LEARN THE FOLLOWING: Learn and use the > supervisor and learn and use the gen_server. Use sasl for its logging > and reporting. > > Martin > > On Mon, 2003-11-03 at 04:39, mohammad banat wrote: > > hello > > i am a student in a jordinian university and i want to make a > > project that is a gate way but by using design pattern , this pattern > > should be implemented in erlang > > i got the information about erlang in your web site and in other sites > > , but i feel that i still need more, so if you can help me and supply > > me with some more information supported with some small examples in > > order to get better understanding about how to write a programs using > > erlang and if u can help me more by give me some notes how to start > > the implementation of patterns like(reactor) > > > > please help me in the nearest chance > > > > > > ______________________________________________________________________ > > Do you Yahoo!? > > Exclusive Video Premiere - Britney Spears > > > From svg@REDACTED Tue Nov 4 11:51:50 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 04 Nov 2003 15:51:50 +0500 (YEKT) Subject: erlang eval? In-Reply-To: <000001c3a2b7$aaea42e0$2001a8c0@bryans> References: <3F9D1DA2.7B818CF8@eth.ericsson.se> <000001c3a2b7$aaea42e0$2001a8c0@bryans> Message-ID: <20031104.155150.70214972.svg@surnet.ru> Good day, bry> Is there an eval function in erlang, for evaluation of strings as erlang bry> code? If so what module is it in? Look at the following modules: erl_scan erl_parse erl_eval Small example: 1> FunStr = "fun (A) -> A+B end.". ... 2> {ok, Tokens, _} = erl_scan:string(FunStr). ... 3> {ok, [Form]} = erl_parse:parse_exprs(Tokens). ... 4> Bindings = erl_eval:add_binding('B', 2, erl_eval:new_bindings()). ... 5> {value, Fun, _} = erl_eval:expr(Form, Bindings). .. 6> Fun(1). 3 Best Regards, Vladimir Sekissov From magnus.thoang@REDACTED Tue Nov 4 10:46:22 2003 From: magnus.thoang@REDACTED (Magnus Thoang) Date: Tue, 04 Nov 2003 10:46:22 +0100 Subject: Concerning erlang's bit syntax Message-ID: <3FA7756E.1070102@ericsson.com> Hi, I like erlang's bit syntax. It makes my life easier in almost all situations where I need to shuffle bytes around. I was surprised, though, when the code I had ran in the erlang shell had to be rewritten for the compiler: This matching works (R9C) in the shell but cannot be put in a module: <> = <<0,0,0,6,$e,$r,$l,$a,$n,$g,1,2,3,4,5,6,7,8>> When trying to compile the above expression, the compiler gives an error about StrSize being unbound (in the 'Str:StrSize/binary' expression). The documentation is not clear about this case, but it mentions a somewhat similar function head as not being allowed. It is just a minor annoyance, but is there a good reason for this? -- Magnus Tho?ng From erlang@REDACTED Mon Nov 3 18:08:40 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 3 Nov 2003 17:08:40 +0000 Subject: revised SciTE syntax lexer In-Reply-To: <20031027155620.75829751.erlang@manderp.freeserve.co.uk> References: <20031027155620.75829751.erlang@manderp.freeserve.co.uk> Message-ID: <20031103170840.4a3834e2.erlang@manderp.freeserve.co.uk> Hi Chris, I've had a good look into the Erlang Reference Manual 4.7.3 Draft 0.7 (is there a more up to date reference?) for the keyword list, and I realise that I've only allowed for one type of "keyword" token. Erlang also defines a few operators, some predefined attributes and some other reserved words too which although not keywords may be candidates for highlighting. I'll send you what I've got, and wait to hear what you think. The files are tested against v1.53, but I doubt that there will be any changes against the latest version that will prevent using v1.56 Pete. ----- Original Message ----- From: "Chris Pressey" To: "Peter-Henry Mander" Sent: Friday, October 31, 2003 10:02 PM Subject: Re: revised SciTE syntax lexer > On Mon, 27 Oct 2003 15:56:20 +0000 > Peter-Henry Mander wrote: > > > Hi SciTE+Erlang users, > > > > I've updated the SciTE Erlang syntax highlighter with a few bug > > fixes. The most significant fixes are:- > > folding the fun() -> ... end notation and _not_ folding the fun > > funct_name/arity notation. parsing radix numbers correctly (with > > radix error highlighting too :-) > > > > I've cleaned the lexer code too, so the number of > > intermediary/unresolved states in erlang.properties file is reduced. > > > > If anyone (Chris Pressey? James Hague?) in here would like to > > test-drive the fix, please let me know. If there's no objection to > > me posting the .tar.bz2 file on the mailing list, I will do so. > > > > Pete. > > Sure, I'm interested. > > Also, FWIW: 'begin' is actually a keyword, and 'call' actually isn't. > (Is it part of OTP? Is OTP stuff highlighted the same as keywords?) > > -Chris > -- "The Tao of Programming flows far away and returns on the wind of morning." -------------- next part -------------- A non-text attachment was scrubbed... Name: SciteErlangLex-1.53.tar.gz Type: application/x-gzip Size: 31619 bytes Desc: not available URL: From bjorn@REDACTED Tue Nov 4 14:41:31 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 04 Nov 2003 14:41:31 +0100 Subject: Concerning erlang's bit syntax In-Reply-To: <3FA7756E.1070102@ericsson.com> References: <3FA7756E.1070102@ericsson.com> Message-ID: Works fine for me. Are you sure compiled the module with a R9C compiler? (It will now work with previous releases.) /Bjorn Magnus Thoang writes: > Hi, > > I like erlang's bit syntax. It makes my life easier in almost all > situations where I need to shuffle bytes around. > > I was surprised, though, when the code I had ran in the erlang shell > had to be rewritten for the compiler: > > This matching works (R9C) in the shell but cannot be put in a module: > > <> = > <<0,0,0,6,$e,$r,$l,$a,$n,$g,1,2,3,4,5,6,7,8>> > > When trying to compile the above expression, the compiler gives an > error about StrSize being unbound (in the 'Str:StrSize/binary' > expression). > > The documentation is not clear about this case, but it mentions a > somewhat similar function head as not being allowed. > > It is just a minor annoyance, but is there a good reason for this? > > -- > Magnus Tho?ng > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From luke@REDACTED Tue Nov 4 15:34:09 2003 From: luke@REDACTED (Luke Gorrie) Date: 04 Nov 2003 15:34:09 +0100 Subject: Tree structures In-Reply-To: References: <3FA763D5.3070407@st.se> Message-ID: "Vlad Dumitrescu" writes: > Hi Lennart, > > You made me realise I didn't specify my question. The distribution has > gb_trees which implements AVL trees, but I need "regular", unordered, > unstructured ones. Isn't that just a nested list? Or nested 2-tuples for a binary tree? -Luke From luke@REDACTED Tue Nov 4 15:42:42 2003 From: luke@REDACTED (Luke Gorrie) Date: 04 Nov 2003 15:42:42 +0100 Subject: Tree structures In-Reply-To: References: Message-ID: "Vlad Dumitrescu" writes: > Are there any libraries that handle tree structures? I didn't find > any advertised as such, but many applications could have such a > module for internal use. > > What I have in mind is a tree where nodes look like {Key, Value, > [ChildrenList]} Oops, my last reply didn't make much sense. If there is no ordering/balancing/etc in these trees, what operations are you interested in getting from a library? -Luke From Vlad.Dumitrescu@REDACTED Tue Nov 4 15:53:06 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 04 Nov 2003 15:53:06 +0100 Subject: Tree structures In-Reply-To: References: Message-ID: Luke wrote: >If there is no ordering/balancing/etc in these trees, what operations are you >interested in getting from a library? I didn't mean it's rocket science :-) I am just lazy and didn't want to write it myself! What I want is operations like insert_sibling_before, insert_sibling_after, insert_child_first, insert_child_last. Also it should be possible to move around entire subtrees. In the meanwhile, I managed to find an implementation that I had written myself, which was not a 100% match, but it can be adapted. It would be nice if stdlib did include such nice data structures and algorithms. I plan to contribute my implementation when it's ready. regards, Vlad From erlang@REDACTED Tue Nov 4 17:26:19 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Tue, 4 Nov 2003 16:26:19 +0000 Subject: revised SciTE syntax lexer In-Reply-To: <20031103170840.4a3834e2.erlang@manderp.freeserve.co.uk> References: <20031027155620.75829751.erlang@manderp.freeserve.co.uk> <20031103170840.4a3834e2.erlang@manderp.freeserve.co.uk> Message-ID: <20031104162619.74647418.erlang@manderp.freeserve.co.uk> Hi Chris, hi Scite+Erlang users, The Erlang lexer has been incorporated into the SciTE distribution available from http://www.scintilla.org/ Yay! :-) Pete. -- "The Tao of Programming flows far away and returns on the wind of morning." From michael@REDACTED Tue Nov 4 17:22:19 2003 From: michael@REDACTED (Michael Hobbs) Date: Tue, 4 Nov 2003 10:22:19 -0600 (CST) Subject: Language change proposal In-Reply-To: <3FA6F43C.1020102@web.de> References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> <1659.66.41.245.83.1067875715.squirrel@mail.hobbshouse.org> <3FA6F43C.1020102@web.de> Message-ID: <1804.66.41.245.83.1067962939.squirrel@mail.hobbshouse.org> Joachim Durchholz said: > Michael Hobbs wrote: >> That line seems to imply that if an entity contains an encoding >> declaration, then the whole entity must be encoded with that encoding. >> This presents a chicken-or-egg problem in that how is an XML processor >> to process an encoding declaration before it knows what the encoding >> is? > > The first byte of an entity is always a specific character (probably "<" > for XML). > Assuming the entity is correct, the XML processor can infer at least a > first estimate of what encoding was used, and later check it against the > encoding declarations. Okay, before you wrote this, I hadn't realized that every character encoding (besides UTF-16 and EBCDIC) is a superset of ASCII. I had ass-u-me-d that there are some character encodings that have a wildly different binary representation, like ASCII vs. EBCDIC. After doing some searching though, I have discovered that every character encoding that I could find uses the same standard Latin letters and symbols for the bytes between 0x20 - 0x7F. The world is a little less chaotic that I had thought, - Michael Hobbs From magnus.thoang@REDACTED Tue Nov 4 19:07:54 2003 From: magnus.thoang@REDACTED (Magnus Thoang) Date: Tue, 04 Nov 2003 19:07:54 +0100 Subject: Concerning erlang's bit syntax In-Reply-To: <3FA7756E.1070102@ericsson.com> References: <3FA7756E.1070102@ericsson.com> Message-ID: <3FA7EAFA.4010405@ericsson.com> Bjorn Gustavsson wrote: > > Works fine for me. > > Are you sure compiled the module with a R9C compiler? > (It will now work with previous releases.) > Great, I see now that it works with a proper R9C installation of erlang. (I posted after trying to compile with my linux installation, a Gentoo ebuild labelled "dev-lang/erlang 9c-r1". Judging from the version of erts, 5.2.3.3, this is *not* R9C.) Thanks. -- Magnus Tho?ng ?V/EAB/UPD/EP Connectivity and Control Nodes Ericsson AB Tel: + 46 8 719 22 41 Fax: + 46 8 719 77 50 Mobile: + 46 70 309 01 83 mailto:magnus.thoang@REDACTED From joe@REDACTED Tue Nov 4 20:02:01 2003 From: joe@REDACTED (Joe Armstrong) Date: Tue, 4 Nov 2003 20:02:01 +0100 (CET) Subject: Bug in string.erl Message-ID: Bug in string.erl This took me 45 mins to find I had some variable X which I *thought* contained a list > string:substr(X, 1, 20). [] But is was an atom ... did I get an exit - No for > string:substr(aa, 1, 20). [] Wow (Static type systems 1, Joe 0) The code in string.erl says --- quote --- substr1([C|String], L) when L > 0 -> [C|substr1(String, L-1)]; substr1(String, L) -> []. %Be nice! --- end quote --- I rather like the "%Be nice!" comment. IMHO all the functions in string should exit when the "string" argument is not a list - I'm not asking that you "deep check" the list but a little help might be nice /Joe From joachim.durchholz@REDACTED Tue Nov 4 19:05:27 2003 From: joachim.durchholz@REDACTED (Joachim Durchholz) Date: Tue, 04 Nov 2003 19:05:27 +0100 Subject: Language change proposal In-Reply-To: <1804.66.41.245.83.1067962939.squirrel@mail.hobbshouse.org> References: <200311030243.hA32hvwC026043@atlas.otago.ac.nz> <1659.66.41.245.83.1067875715.squirrel@mail.hobbshouse.org> <3FA6F43C.1020102@web.de> <1804.66.41.245.83.1067962939.squirrel@mail.hobbshouse.org> Message-ID: <3FA7EA67.1000106@web.de> Michael Hobbs wrote: > Joachim Durchholz said: > >>Michael Hobbs wrote: >> >>>That line seems to imply that if an entity contains an encoding >>>declaration, then the whole entity must be encoded with that encoding. >>>This presents a chicken-or-egg problem in that how is an XML processor >>>to process an encoding declaration before it knows what the encoding >>>is? >> >>The first byte of an entity is always a specific character (probably "<" >> for XML). >>Assuming the entity is correct, the XML processor can infer at least a >>first estimate of what encoding was used, and later check it against the >> encoding declarations. > > > Okay, before you wrote this, I hadn't realized that every character > encoding (besides UTF-16 and EBCDIC) is a superset of ASCII. Oh, there /are/ character sets that vary wildly. The Leibniz Computer Center in Munich had several CDC computers, which sported non-standard word sizes (48-bit words), non-standard character sets (6-bit, A-Z are codes 1-32, 0-9 are 33-44), and a raw computing power that exceeded the best IBM machines by a factor of ten, and stayed the fastest machine on the market until about 1960 (when it was outdone by its own chief engineer who had founded his own company, Cray Research *g*). You can find this and other CDC-related character sets at http://www.informatik.uni-hamburg.de/RZ/software/gnu/utilities/recode_9.html if you're interested :-) Actually, the "recode" tool still understand these character sets, supposedly because recode originated on a CDC :-) These encodings are more of historical interest than anything else, though. I'm pretty sure that only few machines with truly non-ASCII non-EBCDIC encodings exist, and that even fewer would call for an Erlang port... Regards, Jo From vlad.dumitrescu@REDACTED Tue Nov 4 20:03:38 2003 From: vlad.dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 4 Nov 2003 20:03:38 +0100 Subject: more about the list problems Message-ID: <006301c3a306$941b1540$b1b842d5@VLAD1> Hi again, When sending to the list, or to majordomo@REDACTED from my Hotmail account, I just get back "Delivery Status Notification (Failure)". I'm not familiar with the mail protocols - does it mean that something is wrong with Hotmail, or does erlang.org refuse messages from there? regards, Vlad From kent@REDACTED Tue Nov 4 20:56:44 2003 From: kent@REDACTED (Kent Boortz) Date: 04 Nov 2003 20:56:44 +0100 Subject: more about the list problems In-Reply-To: <006301c3a306$941b1540$b1b842d5@VLAD1> References: <006301c3a306$941b1540$b1b842d5@VLAD1> Message-ID: I'm the moderator and get all bounces and error notifications. I get tons of error and warnings from different mail relays and unfortunately I don't know the protocol that well to understand exactly what they mean. In your case one error message is "sheryq@REDACTED",\ "Vlad Dumitrescu" ,\ "Katsuya Tomioka" \ ...Deferred: Operation timed out with mx4.hotmail.com. To me it looks like a problem on hotmails side but I may be wrong, kent From luke@REDACTED Tue Nov 4 21:24:29 2003 From: luke@REDACTED (Luke Gorrie) Date: 04 Nov 2003 21:24:29 +0100 Subject: Fancy tools support! Message-ID: Allo allo, I have some late items for the "Erlang wishlist" survey from the other month or year. I'd like some new and exciting runtime features for doing helpful things in development tools like Distel. Some of this might already exist without my knowing it - I'm looking for feedback. In particular: Cross referencing, e.g. %% who_calls(Module, Function, Arity) -> [{M,F,A}] %% List all the known callers of Module:Function/Arity. Simple enough - of course it can't be perfect what with 'apply', but it can still be much better and more convenient than 'grep'. It's very nice to get hyperlinks to all callers of a function at the touch of a key in Emacs. (I think Thomas Lindgren has a parse transform for adding this to module_info? Jungerl it?) Online function documentation (like Lisp "docstrings"). I would like to do this: 1> code:apropos("sort", lists). [{lists,sort,1}, {lists,sort,2}, {lists,usort,1}, {lists,keysort,2}, {lists,ukeysort,2}] 2> code:doc(lists, keysort, 2). "keysort(Index, List) -> [SortedList] Sort a list of tuples by comparing the Index'th elements." This way we can have good online documentation in Emacs, just like it has for Emacs Lisp. It requires some `edoc' or `fdoc' like way to attach documentation to functions such that it ends up in e.g. module_info/0. Argument list summaries. When I type the '(' in "lists:sort(", I want to see a message reminding me of the arguments I can use, like this: lists:sort(List) lists:sort(Fun, List) This is probably hard with multiple clauses and general pattern matching, but probably a reasonable arglist approximation could be generated from a function's parse tree. If that's realistic, I'd like to be able to grab the parse tree and do this at runtime. (Can I already get this from modules compiled with +debug_info somehow?) Debugging without an interpreter ("always available"). Only fuzzy ideas, but I've seen debug-related BIFs and always wondered what they do and how one might use them? Tracing of function calls, message sends, etc. This is an exception - I gather the runtime support is already great, I just haven't figured out how to use it. Can someone think of some nice high-level (Emacs) interface for tracing? I think in the end it's absolutely essential that this stuff is always available, without having to run batch-mode programs, recompile with new flags, or add parse_transform annotations. Otherwise it's just too hard to get into the habbit of using it (for me at least). Meanwhile, if people have nice parse-transforms for this stuff, it could be nice to make the Jungerl use them by default and hack support into Distel as a testbed. Maybe we can hatch some schemes at EUC. P.S., the apropos feature could be really good! I learned about lists:usort/1 while faking up its output -- the number of times I've written that function badly myself while it was right there..... P.P.S., I can't find the 'xref' manual in the R9C docs, did that disappear or am I just overlooking it? Cheers, Luke From Johan.Blom@REDACTED Tue Nov 4 21:32:50 2003 From: Johan.Blom@REDACTED (Johan.Blom@REDACTED) Date: Tue, 04 Nov 2003 21:32:50 +0100 Subject: ANN: xmerl-0.19 Message-ID: <3FA80CF2.7060701@mobilearts.se> Hi, I have finally got myself together and merged all received patches, patched it myself quite a bit and updated the documentation (now using edoc!!). As one can expect (almost a year since the last release...) there are *LOTS* of new stuff in this release. Apart from improved documentation, we now have validation support (Sebastian Becuwe), better namespace handling (Erik Reitsma, Ulf Wiger), XSL:ish support in the Erlang way (Mikael Karlsson) and further improvements to the export functionality (Richard Carlsson). Not to mention a large number of bug fixes. See http://cvs.sourceforge.net/viewcvs.py/*checkout*/sowap/xmerl/changes.txt?rev=1.29 for a more complete list of changes. Also the following incompatibles should be noted: - Changed the fetch function to return Result ::= {ok, {file, Filename}, GlobalState'} | {ok, {string, String}, GlobalState'} | {ok, not_fetched, GlobalState'} - xmerl:export/[1,2] now takes a list of valid xmerl defined records, used to accept only #xmlElement{} - Renamed xmerl_eventp:file/2 to xmerl_eventp:stream/2 - Moved is_letter/1,is_namechar/1,detect_charset/1,detect_charset/2 from xmerl_scan to xmerl_lib Enjoy! Johan Blom Mobile Arts From vlad.dumitrescu@REDACTED Tue Nov 4 22:21:25 2003 From: vlad.dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 4 Nov 2003 22:21:25 +0100 Subject: Fancy tools support! References: Message-ID: <000f01c3a319$e0cfcad0$b1b842d5@VLAD1> From: "Luke Gorrie" >I'd like some new and exciting runtime features for > doing helpful things in development tools like Distel. Some of this > might already exist without my knowing it - I'm looking for feedback. I'm all behind you on this! :-) > Cross referencing, e.g. > %% who_calls(Module, Function, Arity) -> [{M,F,A}] > %% List all the known callers of Module:Function/Arity. > Simple enough - of course it can't be perfect what with 'apply', but > it can still be much better and more convenient than 'grep'. It's > very nice to get hyperlinks to all callers of a function at the > touch of a key in Emacs. (I think Thomas Lindgren has a parse > transform for adding this to module_info? Jungerl it?) Hmm, one really needs to use xref every time something is compiled in order to get accurate info, and thet might make compilation slow. Approximations (like for example callers from the standard libraries) would still be useful, but it can be dangerous to rely on an incomplete list. > Online function documentation (like Lisp "docstrings"). > Argument list summaries. Yes! I'd like to add background automatic compilation whenever a file is saved in Emacs (? la Eclipse). Then one could also run xref, without (big) penalty. regards, Vlad From info@REDACTED Wed Nov 5 00:47:18 2003 From: info@REDACTED (Levada.com) Date: Wed, 5 Nov 2003 00:47:18 +0100 Subject: Converting C to English with Perl Message-ID: <365301c3a32e$00474640$0700a8c0@ulla> Hello, you Erlang gurus out there. Being an Erlang newbie I am often trying to understand the sample code snippets that are discussed on your fine mailing list. Is there maybe in Erlang anything like "Converting C to English with Perl"? See the corresponding article in the Perl Journal 03/2000 http://www.foo.be/docs/tpj/issues/vol5_3/tpj0503-0012.html as well as this article in the Perl Journal 04/1998 as it's basis "The man(1) of descent - So who cares about parsing anyway?" http://www.foo.be/docs/tpj/issues/vol3_4/tpj0304-0010.html It would help me to quickly "cut, paste and parse" the Erlang code snippets to better understand what its all about. It might even make a very nice tool for automatic documentation... Isn't the Erlang grammar file for Emacs doing something similar? Cheers Ingmar From ok@REDACTED Wed Nov 5 02:25:29 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 5 Nov 2003 14:25:29 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311050125.hA51PTKO088990@atlas.otago.ac.nz> I wrote: > By the way, the Unicode book spells out clear, simple, and usable rules > for identifier syntax. Joachim Durchholz replied: Ah, wonderful. Do you have a URL, or a set of promising Google keywords? Well, it doesn't take the brain of a Feynman to figure out that the Unicode book is the best place to look, or failing that, www.unicode.org. In fact it's Section 5.15 "Identifiers" in the Unicode 4.0 book, and a draft replacement for that section can be found in http://www.unicode.org/reports/tr31/ "The formal syntax provided here is intended to capture the general intent that an identifier consists of a string of characters that begins with a letter or an ideograph, and then includes any number of letters, ideographs, digits, or underscores. Each programming language standard has its own identifier syntax; different programming languages have different conventions for the use of certain characters from the ASCII range ($, @, #, _) in identifiers. To extend such a syntax to cover the full behavior of a Unicode implementation, implementers need only combine these specific rules with the sample syntax provided here. Syntactic Rule := ( | )* " Since Erlang _doesn't_ use anything other than letters, digits, and underscores, the Unicode rules would apply exactly. There are some subtleties to all this concerning normalisation and the non-breaking format characters, but once you've figured out how to represent a classification scheme for over a million characters economically (not, actually, all that hard), the rest is easy. From cpressey@REDACTED Wed Nov 5 02:43:09 2003 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 4 Nov 2003 17:43:09 -0800 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> Message-ID: <20031104174309.2f018638.cpressey@catseye.mine.nu> I'm happy to report that I've gotten erlgtk 0.9.7 to build happily on both Windows (with generous help from Patrik Nyblom) and FreeBSD. The Windows version uses GTK+ 2.2 and works for me on both Windows 98 and Windows XP. A pre-built package is available at: http://catseye.webhop.net/projects/erlgtk-0.9.7a_2.0_win/ Note that the tarball is nearly 3 megs, as it includes all the DLL's (ATK, Pango, etc) required to run GTK+ 2.2 on Windows. I've also updated the FreeBSD port to 0.9.7, and made it so that it can be built with either GTK+ 1.2 or 2.x. A port skeleton (hopefully to be submitted to the FreeBSD ports tree in the near future, pending Jimmy Olgeni's okay) is available at: http://catseye.webhop.net/freebsd/ports/x11-toolkits/erlgtk/ And pre-built packages are available at: http://catseye.webhop.net/freebsd/packages/erlgtk-0.9.7_gtk1.2.tgz http://catseye.webhop.net/freebsd/packages/erlgtk-0.9.7_gtk2.0.tgz These have been tested on FreeBSD 4.9-STABLE i386 (I currently lack the resources to test on 5.x or alpha[1].) erlgtk itself is getting to the stage where it's pretty good - there's a known issue where multiline textboxes with GTK+ 2.x aren't handled, but other than that, it's pretty decent. There are quite a few things it can do that GS just can't - for example, intercepting and cancelling a request to close a window. -Chris [1] According to bento, there's some kind of hidden error when building Erlang R9C under FreeBSD on the alpha architecture - erl builds, but it can't seem to run anything correctly. Unfortunately, without access to one of these machines, I can only guess what the problem is. Does anyone here have access to/experience with one of these beasts? From ok@REDACTED Wed Nov 5 02:46:35 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 5 Nov 2003 14:46:35 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311050146.hA51kZic069936@atlas.otago.ac.nz> Eric Merritt replied: Sure the IBM machines support ununicodebut at the cost of doubling the size required to store your character based data. This claim is quite untrue. First off, for the people who really REALLY need Unicode, they were going to be using 16 bits per character anyway. Their storage costs don't go up at all. As I believe I've mentioned, IBM have supported "DBCS" (Double-Byte Character Sets) for decades. Second, in addition to UTF-8, which is good for ASCII, there is Unicode Technical Report 6, which describes a compressed storage format for Unicode which can handle Latin 1 with *no* expansion, several other 8-bit schemes with 1 byte of overhead, and CJK strings also with 1 byte of overhead, no matter what the length of the string. Typically what you do is store text in some compressed form on disc, unpack it if and only if you are going to do some processing, and then repack on the way out. 390s and 400s are not dead architectures by any ststretchf the imagination. Someone who knows that the current 64-bit "360" architecture is called z/Architecture clearly *knows* that; as does someone who has read the z/Architecture Principles of Operation closely enough to know about the Unicode support instructions. From ok@REDACTED Wed Nov 5 03:19:31 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 5 Nov 2003 15:19:31 +1300 (NZDT) Subject: Language change proposal Message-ID: <200311050219.hA52JVqD028935@atlas.otago.ac.nz> I proposed -erlang(Encoding, Version). "Michael Hobbs" came up with the obvious question: This presents a chicken-or-egg problem in that how is an XML processor to process an encoding declaration before it knows what the encoding is? The XML specification spells this out in as much detail as one could possibly wish. document ::= prolog element Misc* prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? XMLDecl ::= '' Either an XML document has an XML declaration or it doesn't. If it doesn't, the encoding must be UTF-8 (or, maybe UTF-16 with a Byte Order Mark). If it does have an XML declaration, then the first 5 characters must literally be ' ' " = space, tab, cr, lf, a-z A-Z 0-9 - _ . : and these are all in the invariant part of ISO 646. I'm not sure whether "_" has the same encoding in every version of EBCDIC, but anything you find in an encoding which is _not_ a letter, digit, hyphen, dot, or colon may be assumed to be an underscore. The following encoding names are defined by XML: UTF-8 UTF-16 ISO-10646-UCS-2 ISO-10646-UCS-4 ISO-8859-1 ... ISO-8859-9 (presumably this should go up to ISO-8859-15) ISO-2022-JP Shift_JIS EUC-JP with a recommendation that other encoding names be taken from then IANA registry, and matching should ignore case. Since an Erlang source file would either literally begin with an -erlang declaration or else not have one at all, we could pull exactly the same kind of auto-detection trick, looking for a "-" instead of "<". To better fit Erlang syntax, we'd convert the XML/IANA names to lower case and replace '-' by '_', so -erlang(iso_8859_1, [10,3,1]). So, to bring the wagons back around to Erlang, if there ever is an -erlang(Encoding, Version) declaration, it would be nice if it is clearly stated what encoding should be used for the "-erlang(Encoding, Version)" text. The same as the encoding used for the rest of the file, of course. Just exactly like XML. (People do actually _read_ the XML specification before spouting about it, don't they?) From cyberlync@REDACTED Wed Nov 5 04:05:55 2003 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 4 Nov 2003 19:05:55 -0800 (PST) Subject: Language change proposal In-Reply-To: <200311050146.hA51kZic069936@atlas.otago.ac.nz> Message-ID: <20031105030555.53312.qmail@web40803.mail.yahoo.com> > This claim is quite untrue. > > First off, for the people who really REALLY need > Unicode, > they were going to be using 16 bits per character > anyway. > Their storage costs don't go up at all. As I > believe I've > mentioned, IBM have supported "DBCS" (Double-Byte > Character > Sets) for decades. You are right, but the person I was responding to (I forget who now) implied that ebcdic should simple be replaced with unicode where erlang could be used. This implies that it force shops that do not currently use unicode to use it. > Typically what you do is store text in some > compressed form on > disc, unpack it if and only if you are going to do > some processing, > and then repack on the way out. I am not familiar enough with the admin side to verify this either way. > 390s and 400s are not dead architectures > by any ststretchf the imagination. > > Someone who knows that the current 64-bit "360" > architecture is > called z/Architecture clearly *knows* that; as does > someone who > has read the z/Architecture Principles of Operation > closely enough > to know about the Unicode support instructions. The 390s and 400s do have new names, I am not aware of too many people who use these names in day to day speech. In fact, IBM has just named a new laptop line the iSeries as well, if you call for support and use iSeries instead of 400 you will most likly be forwarded to support for the laptop (we have had this experience serveral times). So yes the terminology I use is somewhat out of date, but there is a reason I use it. As an aside, both the 390 and 400 are greater then 64 bit architecures (though I forget which now, I think 128 but I could be wrong). In any case, we are very very off topic ;) __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree From bernardp@REDACTED Tue Nov 4 20:07:42 2003 From: bernardp@REDACTED (Pierpaolo BERNARDI) Date: Tue, 4 Nov 2003 20:07:42 +0100 Subject: Tree structures References: Message-ID: <018101c3a355$3e9b0400$0ff36850@c1p4e3> From: "Vlad Dumitrescu" > What I want is operations like insert_sibling_before, insert_sibling_after, > insert_child_first, insert_child_last. Also it should be possible to move > around entire subtrees. Perhaps this is overkill, and not exactly what you want, but have you considered the digraph module from stdlib? Cheers P. From Bengt.Kleberg@REDACTED Wed Nov 5 07:41:31 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Wed, 05 Nov 2003 07:41:31 +0100 Subject: Fancy tools support! In-Reply-To: References: Message-ID: <3FA89B9B.6020500@ericsson.com> Luke Gorrie wrote: > Allo allo, > > I have some late items for the "Erlang wishlist" survey from the other > month or year. I'd like some new and exciting runtime features for > doing helpful things in development tools like Distel. Some of this > might already exist without my knowing it - I'm looking for feedback. i would like to thank you for all your hard work with distel. even if you ''only'' build emacs tools, they act as an inspiration for shell/erlang programs that use stdin/stdout and integrates well with wily. ...deleted > > P.S., the apropos feature could be really good! I learned about > lists:usort/1 while faking up its output -- the number of times I've > written that function badly myself while it was right there..... the person that wrote ''know your libraries'' did not know about otp... > P.P.S., I can't find the 'xref' manual in the R9C docs, did that > disappear or am I just overlooking it? http://erlang.org/doc/r9c/lib/tools-2.3/doc/html/index.html (i find it incredible that i found this. ever since i started to use http://www.corelatus.com/~matthias/modules.html my ability to guess where things are hidden in the erlang documentation has atropofied tremendously :-) bengt From erlang@REDACTED Wed Nov 5 08:22:39 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 5 Nov 2003 07:22:39 +0000 Subject: Bug in string.erl In-Reply-To: References: Message-ID: <20031105072239.4902b1c7.erlang@manderp.freeserve.co.uk> Hi Joe, I beg to differ: static type systems *might* have helped find the bug, but the bug was introduced by someone "being nice" (sarcasm?), and the fact that they explicitly added a catch-all would also have defeated static typing. The programmer's _intent_ was utterly wrong, so don't mark yourself down (-: Moral: Don't be nice, especially in libraries! I've been bitten by assuming that "being nice" in my support/library modules would help me later on, but I've found that having libraries that are "awkward bastards" actually prevents my code from running quietly mad until an 'EXIT' of some sort pops up miles from the real scene of action! Pete. On Tue, 4 Nov 2003 20:02:01 +0100 (CET) Joe Armstrong wrote: > > Bug in string.erl > > This took me 45 mins to find > > I had some variable X which I *thought* contained a list > > > string:substr(X, 1, 20). > [] > > But is was an atom ... did I get an exit - No for > > > string:substr(aa, 1, 20). > [] > > Wow (Static type systems 1, Joe 0) > > The code in string.erl says > > --- quote --- > > substr1([C|String], L) when L > 0 -> [C|substr1(String, L-1)]; > substr1(String, L) -> []. %Be nice! > > --- end quote --- > > I rather like the "%Be nice!" comment. > > IMHO all the functions in string should exit when the "string" argument > is not a list - I'm not asking that you "deep check" the list but a little > help might be nice > > /Joe > > > > > -- "The Tao of Programming flows far away and returns on the wind of morning." From thomas.arts@REDACTED Wed Nov 5 08:46:54 2003 From: thomas.arts@REDACTED (Thomas Arts) Date: Wed, 5 Nov 2003 08:46:54 +0100 Subject: Bug in string.erl References: Message-ID: <003501c3a370$fbe0e370$6a924cc0@ituniv398> Hi Joe > But is was an atom ... did I get an exit - No for > > > string:substr(aa, 1, 20). > [] > > Wow (Static type systems 1, Joe 0) ... > IMHO all the functions in string should exit when the "string" argument > is not a list - I'm not asking that you "deep check" the list but a little > help might be nice Well... IMHO you are responsible to give the right arguments to well typed functions, like the substr one. The whole idea with type systems is that they guarantee that the function works well IF you provide the right types. Therefore, you do not have to check the type and that is far more efficient at runtime. /Thomas --- Dr Thomas Arts Program Manager Software Engineering and Management IT-university in Gothenburg Box 8718, 402 75 Gothenburg, Sweden http://www.ituniv.se/ Tel +46 31 772 6031 Fax +46 31 772 4899 From Vlad.Dumitrescu@REDACTED Wed Nov 5 09:32:29 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 05 Nov 2003 09:32:29 +0100 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: <20031104174309.2f018638.cpressey@catseye.mine.nu> References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> < > <20031104174309.2f018638.cpressey@catseye.mine.nu> Message-ID: Hi, Wow, that's great! :-) But... trying to run the Windows binary distro as-is, I can't get to start examples/all:run(). Some windows flash briefly and disappear right away, and that's all. The output is 1> all:run(). HELLOWORLD HELLOWORLD2 PACKBOX TABLE BUTTONS RANGEWIDGETS PROGRESSBAR LABEL ARROW PIXMAP CLIST ENTRY ASPECTFRAME NOTEBOOK SCROLLEDWIN STATUSBAR RE_ENTRY IP_TEST BUTTON_SWAP true 2> gdk window= {7068648,16567208} 2> match([], {kclosure,{comp_class,"\n"}}) = nomatch 2> Trying again a couple of times, I also get =ERROR REPORT==== 5-Nov-2003::09:30:49 === Error in process <0.135.0> with exit value: {badarg,[{ets,lookup,[gtk_enum,{'GtkJustification','GTK_JUSTIFY_LEFT'}]},{gtk, enum,2},{gtk,label_set_justify,2},{label,main,0}]} 4> ** exited: {badarg,[{ets,lookup, [gtk_enum,{'GtkJustification','GTK_JUSTIFY_LEFT'}]}, {gtk,enum,2}, {gtk,label_set_justify,2}, {label,main,0}]} ** This is on Win2k, with R9C. regards, Vlad From cpressey@REDACTED Wed Nov 5 09:53:20 2003 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 5 Nov 2003 00:53:20 -0800 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> <20031104174309.2f018638.cpressey@catseye.mine.nu> Message-ID: <20031105005320.34361dc5.cpressey@catseye.mine.nu> On Wed, 05 Nov 2003 09:32:29 +0100 "Vlad Dumitrescu" wrote: > Hi, > > Wow, that's great! :-) > > But... trying to run the Windows binary distro as-is, I can't get to > start examples/all:run(). Some windows flash briefly and disappear > right away, and that's all. Hmmm... interesting, I get that too. I think it has to do with recent GTK+ 2.x changes (temporarily disabling the multiline textbox examples.) Try running them one at a time, i.e. 1> clist:run(). 2> notebook:run(). 3> ip_test:run(). ...that way should be much more predictable. Definately try wheelbarrow:run(). Betcha GS can't do *that* :) -Chris From Vlad.Dumitrescu@REDACTED Wed Nov 5 10:02:53 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 05 Nov 2003 10:02:53 +0100 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: <20031105005320.34361dc5.cpressey@catseye.mine.nu> References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> < > < > <20031104174309.2f018638.cpressey@catseye.mine.nu> < > <20031105005320.34361dc5.cpressey@catseye.mine.nu> Message-ID: > Try running them one at a time, i.e. Yes, I did that and they run fine. Cool! Now I "only" have to learn GTK :-) /Vlad From bjorn@REDACTED Wed Nov 5 10:17:32 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Nov 2003 10:17:32 +0100 Subject: Fancy tools support! In-Reply-To: References: Message-ID: Luke Gorrie writes: [...] > Cross referencing, e.g. > %% who_calls(Module, Function, Arity) -> [{M,F,A}] > %% List all the known callers of Module:Function/Arity. > Simple enough - of course it can't be perfect what with 'apply', but > it can still be much better and more convenient than 'grep'. It's > very nice to get hyperlinks to all callers of a function at the > touch of a key in Emacs. (I think Thomas Lindgren has a parse > transform for adding this to module_info? Jungerl it?) > That would be difficult to add, as the Erlang run-time system does not keep any information about the callers to any given function. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From Bengt.Kleberg@REDACTED Wed Nov 5 10:50:41 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Wed, 05 Nov 2003 10:50:41 +0100 Subject: Fancy tools support! In-Reply-To: References: Message-ID: <3FA8C7F1.2000103@ericsson.com> Bjorn Gustavsson wrote: > Luke Gorrie writes: > ...deleted > >> Cross referencing, e.g. >> %% who_calls(Module, Function, Arity) -> [{M,F,A}] >> %% List all the known callers of Module:Function/Arity. >> Simple enough - of course it can't be perfect what with 'apply', but >> it can still be much better and more convenient than 'grep'. It's ...deleted > > That would be difficult to add, as the Erlang run-time system does not > keep any information about the callers to any given function. would it be possible to do it at the same level as ''xref'' operates at? (ie only staticly known callers). bengt From Johan.Blom@REDACTED Wed Nov 5 11:07:27 2003 From: Johan.Blom@REDACTED (Johan.Blom@REDACTED) Date: Wed, 05 Nov 2003 11:07:27 +0100 Subject: ANN: xmerl-0.19 In-Reply-To: <3FA80CF2.7060701@mobilearts.se> References: <3FA80CF2.7060701@mobilearts.se> Message-ID: <3FA8CBDF.90107@mobilearts.se> ... and you may download it from http://sowap.sourceforge.net/ (or rather http://prdownloads.sowap.sourceforge.net/sowap/xmerl-0.19.tar.gz ) /Johan Johan Blom wrote: > Hi, > > I have finally got myself together and merged all received patches, > patched it myself quite a bit and updated the documentation (now using > edoc!!). > > As one can expect (almost a year since the last release...) there are > *LOTS* of new stuff in this release. Apart from improved documentation, > we now have validation support (Sebastian Becuwe), better namespace > handling (Erik Reitsma, Ulf Wiger), XSL:ish support in the Erlang way > (Mikael Karlsson) and further improvements to the export functionality > (Richard Carlsson). Not to mention a large number of bug fixes. > See > http://cvs.sourceforge.net/viewcvs.py/*checkout*/sowap/xmerl/changes.txt?rev=1.29 > > for a more complete list of changes. > > Also the following incompatibles should be noted: > - Changed the fetch function to return > Result ::= > {ok, {file, Filename}, GlobalState'} | > {ok, {string, String}, GlobalState'} | > {ok, not_fetched, GlobalState'} > > - xmerl:export/[1,2] now takes a list of valid xmerl defined records, > used to accept only #xmlElement{} > > - Renamed xmerl_eventp:file/2 to xmerl_eventp:stream/2 > > - Moved is_letter/1,is_namechar/1,detect_charset/1,detect_charset/2 from > xmerl_scan to xmerl_lib > > Enjoy! > Johan Blom > Mobile Arts > > > > From Erik.Stenman@REDACTED Wed Nov 5 12:02:04 2003 From: Erik.Stenman@REDACTED (Erik Stenman) Date: Wed, 5 Nov 2003 12:02:04 +0100 Subject: Fancy tools support! In-Reply-To: Message-ID: <200311051102.hA5B2Uf34739@hades.cslab.ericsson.net> Bjorn Gustavsson writes > > Luke Gorrie writes: > > [...] > > Cross referencing, e.g. > > %% who_calls(Module, Function, Arity) -> [{M,F,A}] > > %% List all the known callers of Module:Function/Arity. > > Simple enough - of course it can't be perfect what with > 'apply', but > > it can still be much better and more convenient than 'grep'. It's > > very nice to get hyperlinks to all callers of a function at the > > touch of a key in Emacs. (I think Thomas Lindgren has a parse > > transform for adding this to module_info? Jungerl it?) > > > > That would be difficult to add, as the Erlang run-time system > does not keep any information about the callers to any given function. HiPE keeps this information, but of course only for loaded functions... /Erik From luke@REDACTED Wed Nov 5 12:19:17 2003 From: luke@REDACTED (Luke Gorrie) Date: 05 Nov 2003 12:19:17 +0100 Subject: Fancy tools support! In-Reply-To: <200311051102.hA5B2Uf34739@hades.cslab.ericsson.net> References: <200311051102.hA5B2Uf34739@hades.cslab.ericsson.net> Message-ID: "Erik Stenman" writes: > > > Bjorn Gustavsson writes > > > > Luke Gorrie writes: > > > > [...] > > > Cross referencing, e.g. > > > %% who_calls(Module, Function, Arity) -> [{M,F,A}] > > > %% List all the known callers of Module:Function/Arity. > > > Simple enough - of course it can't be perfect what with > > 'apply', but > > > it can still be much better and more convenient than 'grep'. It's > > > very nice to get hyperlinks to all callers of a function at the > > > touch of a key in Emacs. (I think Thomas Lindgren has a parse > > > transform for adding this to module_info? Jungerl it?) > > > > > > > That would be difficult to add, as the Erlang run-time system > > does not keep any information about the callers to any given function. > > HiPE keeps this information, but of course only for loaded functions... How does one extract it? I was thinking about the loaded vs. unloaded. I think the solution is to just load everything accessible in the codepath into the BEAM process while one is developing. Then, if each module_info gave a list like [{function, F, calls, [{M,F,A}]}, ...] then who_calls(M,F,A) could be implemented as just a 'fold' over every module's module_info - which could probably be done "instantaneously" for interactive purposes. I think Thomas Lindgren said he has a parse-transform that does just this (written to speed up xref-like tools). That would seem the right mechanism - though maybe my definition of "runtime support" is a bit loose :-) -Luke From erlang@REDACTED Wed Nov 5 12:17:51 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 5 Nov 2003 11:17:51 +0000 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: <20031105005320.34361dc5.cpressey@catseye.mine.nu> References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> <20031104174309.2f018638.cpressey@catseye.mine.nu> <20031105005320.34361dc5.cpressey@catseye.mine.nu> Message-ID: <20031105111751.5946d7ab.erlang@manderp.freeserve.co.uk> Hi Chris, I've given the binary distribution a go on a Linux machine, but it sits there very quietly, no errors or any feedback when I try all the suggested invokations. It could be that it expects to sit somewhere specific, I just tar -zxf it in my home directory and tried as-is. I'm not running BSD. Pete. On Wed, 5 Nov 2003 00:53:20 -0800 Chris Pressey wrote: > On Wed, 05 Nov 2003 09:32:29 +0100 > "Vlad Dumitrescu" wrote: > > > Hi, > > > > Wow, that's great! :-) > > > > But... trying to run the Windows binary distro as-is, I can't get to > > start examples/all:run(). Some windows flash briefly and disappear > > right away, and that's all. > > Hmmm... interesting, I get that too. I think it has to do with recent > GTK+ 2.x changes (temporarily disabling the multiline textbox examples.) > > Try running them one at a time, i.e. > > 1> clist:run(). > 2> notebook:run(). > 3> ip_test:run(). > > ...that way should be much more predictable. > > Definately try wheelbarrow:run(). Betcha GS can't do *that* :) > > -Chris > -- "The Tao of Programming flows far away and returns on the wind of morning." From bry@REDACTED Wed Nov 5 13:35:16 2003 From: bry@REDACTED (bryan) Date: Wed, 5 Nov 2003 13:35:16 +0100 Subject: inets or yaws? In-Reply-To: <3FA8C7F1.2000103@ericsson.com> Message-ID: <004701c3a399$44967260$2001a8c0@bryans> I'm thinking about porting an xml-based site I have to an erlang webserver, I would like to do yaws, but I think that inets might be easier for me to do a quicker move to. Anyone have performance reports on inets? also is inets still gonna be included in future distributions, or be maintained if not included? From micael.karlberg@REDACTED Wed Nov 5 14:56:13 2003 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Wed, 5 Nov 2003 14:56:13 +0100 Subject: inets or yaws? In-Reply-To: <004701c3a399$44967260$2001a8c0@bryans> References: <3FA8C7F1.2000103@ericsson.com> <004701c3a399$44967260$2001a8c0@bryans> Message-ID: <16297.381.252007.824423@gargle.gargle.HOWL> bryan writes: > > I'm thinking about porting an xml-based site I have to an erlang > webserver, I would like to do yaws, but I think that inets might be > easier for me to do a quicker move to. Anyone have performance reports > on inets? > > also is inets still gonna be included in future distributions, or be > maintained if not included? We have no plans to remove inets from OTP. /BMK From rvg@REDACTED Wed Nov 5 15:31:23 2003 From: rvg@REDACTED (Rudolph van Graan) Date: Wed, 5 Nov 2003 16:31:23 +0200 Subject: Starting a gen_server on a remote node or is it failover? Message-ID: <1F42BB97D787C048BCC519FF28048AC36814@galileo.ifoni.com> Hi all, I have been thinking about a specific problem for a while now. In short the, scenario is this. Suppose one needs a distributed system where an application ["The Application"] is configured for failover [using kernel configuration]. One can thus assume that the application is running somewhere on a node in the system and will be restarted as configured. Suppose this application supervises a number of resources [as in gen server processes] of which there can be only one instance of each in the system at any time [Think a single connection to an external system, etc.] [System = entire distributed system]. If "The Application" is a supervisor implementation, it is trivial to have these resources run on the same node as the supervisor. They will then move wherever the application is running depending on configuration. Now, suppose I don't want the resource processes to run on the same node necessarily, but on an arbitrary node. This is primarily for load-balancing purposes. How should I build this? The one thing I have to note is that "The Application" is *not* aware of how many or which resource processes it is supervising - these are determined dynamically when the application/supervisor starts. I know one can build an application per resource, but that is not practical for me, as these things are very dynamic. It is obvious for me that erlang can easily manage the failover of entire applications, but how does one manage smaller entities [as in gen_server] failover? Now back to my question... I cannot seem to figure out how to convince a gen_server to start remotely as gen_servers can only be started as: start(Module, Args, Options) -> Result start(ServerName, Module, Args, Options) -> Result start_link(Module, Args, Options) -> Result start_link(ServerName, Module, Args, Options) -> Result [Note the absence of a (Node,ServerName,...) version.) If I could do this, without messing in gen_server.erl or gen.erl, it might be possible to have the application supervisor spawn a gen_server remotely and manage it. All that then remains is to give the supervisor the ability to determine where to start the gen_server on failure [On the same node as previously, or if the node has failed, on a backup node]. Has anyone done something similar or know of an alternative approach which might not be obvious to me? Thank you in advance, Rudolph From luke@REDACTED Wed Nov 5 16:08:44 2003 From: luke@REDACTED (Luke Gorrie) Date: 05 Nov 2003 16:08:44 +0100 Subject: Unicode - the lighter side In-Reply-To: <20031105030555.53312.qmail@web40803.mail.yahoo.com> References: <20031105030555.53312.qmail@web40803.mail.yahoo.com> Message-ID: One nice thing about Unicode is that you get a lot of extra APL-esque gadget characters. I grabbed some code off the 'net [1] that lets you put these to use in Emacs - so you get both syntax-colouring and syntax-pretty-symbolifying. It's pretty cute. If you load the attached file into Emacs, and then do `M-x pretty-erlang' in an Erlang buffer, it swizzles in some fancy symbols. For example, this contrived code: -module(sugar). -compile(export_all). negative(X) -> abs(X) /= X. positive(X) -> not negative(X) and (X /= 0). zero(X) -> not negative(X) and not positive(X). between(X, Y, Z) -> (X>=Y) and (X= receive wakeup -> ok after Timeout -> timeout end. Looks like the picture here: http://www.bluetail.com/~luke/misc/sugar.png You'll need to have the right fonts. It "just works" for me, having installed all the Debian font packages a ways back. Cheers, Luke (champion of all that is crass) [1]: http://www.emacswiki.org/cgi-bin/wiki.pl/PrettyLambda -------------- next part -------------- A non-text attachment was scrubbed... Name: unicode-symbol.el Type: application/emacs-lisp Size: 2651 bytes Desc: not available URL: From thomasl_erlang@REDACTED Wed Nov 5 16:15:53 2003 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 5 Nov 2003 07:15:53 -0800 (PST) Subject: Fancy tools support! In-Reply-To: Message-ID: <20031105151553.54958.qmail@web41903.mail.yahoo.com> --- Luke Gorrie wrote: > Then, if each module_info gave a list like > > [{function, F, calls, [{M,F,A}]}, ...] > > then who_calls(M,F,A) could be implemented as just a > 'fold' over every > module's module_info - which could probably be done > "instantaneously" > for interactive purposes. > > I think Thomas Lindgren said he has a > parse-transform that does just > this (written to speed up xref-like tools). That > would seem the right > mechanism - though maybe my definition of "runtime > support" is a bit > loose :-) As I recall, that parse transform essentially stored the module's known remote calls as a module_info key-value. (Adding the whole static call graph instead is straightforward, though.) I'll see if I can find it. Best, Thomas __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree From luca.manai@REDACTED Wed Nov 5 17:09:28 2003 From: luca.manai@REDACTED (Luca Manai (AL/EAB)) Date: Wed, 05 Nov 2003 17:09:28 +0100 Subject: Function or Macro... Message-ID: <3FA920B8.E7C489B3@ericsson.com> Hello, I was asking me if there are advantages in using a macro (when possible and when it is not disorienting for the reader) instead of a function. Is there behind erlang a mechanism of parameter allocation on the stack when a function is called (like in C)? Or may be the matter is much more complex... Thanks. Luca. - PS: I hope the question does make sense... I wasn't sure about that. From ulf.wiger@REDACTED Wed Nov 5 17:51:15 2003 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 5 Nov 2003 17:51:15 +0100 Subject: surprising result with hipe compilation Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F540259A@ESEALNT442.al.sw.ericsson.se> From: Kostis Sagonas [mailto:kostis@REDACTED] >Ulf, I have looked at your program and have trouble obtaining > the behaviour that you are observing. When compiled to native > code, the code is consistently 20-40 % faster than BEAM (and > arguably more than that). This is interesting. > Some more comments: > - The benchmark reads data from a file which is handled as a stream > Performing I/O can be give a big flactuation in times. Ideally, > the benchmark should be re-written so that the data is read once > from the file (converted to a list or binary), and the time to > process the data is reported. True. I decided not to do that, since the measured differences were large enough that they couldn't be blamed on file.erl. Interestingly, your figures are equally consistent, but in the opposite direction. > - timer:tc is NOT the best possible way to measure time; > ideally, some more accurate time measurements should be used. I think timer:tc is Ok, as long as the job is significantly large, or one runs enough iterations. In this case, I wasn't really interested in any differences smaller than, say, 20%. I will pretend that this didn't happen for now, unless you want to come visiting and perform your own measurements on my particular machine. ;) /Uffe From cpressey@REDACTED Wed Nov 5 19:42:04 2003 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 5 Nov 2003 10:42:04 -0800 Subject: erlgtk 0.9.7 (was: Re: 2D in erlang) In-Reply-To: <20031105111751.5946d7ab.erlang@manderp.freeserve.co.uk> References: <20031103144229.98017.qmail@web40803.mail.yahoo.com> <20031104174309.2f018638.cpressey@catseye.mine.nu> <20031105005320.34361dc5.cpressey@catseye.mine.nu> <20031105111751.5946d7ab.erlang@manderp.freeserve.co.uk> Message-ID: <20031105104204.06af2180.cpressey@catseye.mine.nu> On Wed, 5 Nov 2003 11:17:51 +0000 Peter-Henry Mander wrote: > Hi Chris, 'lo Pete, > I've given the binary distribution a go on a Linux machine, but it > sits there very quietly, no errors or any feedback when I try all the > suggested invokations. > > It could be that it expects to sit somewhere specific, I just tar -zxf > it in my home directory and tried as-is. I'm not running BSD. Well, Linux and FreeBSD are similar, but not quite *that* similar :) I suppose I could have been more clear about these being FreeBSD-only packages - in FreeBSD all you have to say is # pkg_add erlgtk-0.9.7_gtk2.0.tgz ...and everything will be put in its proper place, pending the proper dependencies. Unlike ex11, erlgtk isn't 100% Pure Erlang - there's a native binary, the port program 'gtk_drv', which is probably what's unresponsive on your Linux system. (This makes some sense now that I think about it - the binary executable format is the same on the two OSes AFAIK, but the syscall parameter passing discipline is different, so nothing interesting happens.) If I had the skills and the resources, I'd put together an RPM or a dpkg or one of those emerge-y things for Gentoo, but this would be entirely new to me. (If anyone who does know how does want to make one, though, I'll happily host it alongside my Windows and FreeBSD ones.) Currently your best bet on Linux is probably installing from source. It's not too hard at all, especially if you use the latest sources from Sourceforge. You can build and use it from right inside the CVS tree. HTH, -Chris From vlad.dumitrescu@REDACTED Wed Nov 5 19:49:03 2003 From: vlad.dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 5 Nov 2003 19:49:03 +0100 Subject: Starting a gen_server on a remote node or is it failover? References: <1F42BB97D787C048BCC519FF28048AC36814@galileo.ifoni.com> Message-ID: <002901c3a3cd$83db8210$16b842d5@VLAD1> From: "Rudolph van Graan" >I cannot seem to figure > out how to convince a gen_server to start remotely as gen_servers can > only be started as: > > start(Module, Args, Options) -> Result > start(ServerName, Module, Args, Options) -> Result > start_link(Module, Args, Options) -> Result > start_link(ServerName, Module, Args, Options) -> Result > > [Note the absence of a (Node,ServerName,...) version.) Hi, Have you tried for example rpc:call(Node, gen_server, start, [Args, Options])? regards, Vlad From kostis@REDACTED Wed Nov 5 17:37:53 2003 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 5 Nov 2003 17:37:53 +0100 (MET) Subject: surprising result with hipe compilation In-Reply-To: Mail from '"Ulf Wiger (AL/EAB)" ' dated: Thu, 30 Oct 2003 17:06:31 +0100 Message-ID: <200311051637.hA5GbrtC008300@hamberg.it.uu.se> Ulf Wiger wrote: > I called timer:tc(...) several times and picked the fastest one. > > >If one repeats the timer:tc call, the runtime for both BEAM and > >native code is reduced to normal levels, and native code is > >consistently (for your code) faster than BEAM. > > This is not what happens on my machine (a 400 MHz Ultra 10): > .... DELETED .... > When compiled with hipe, the code runs significantly slower. Ulf, I have looked at your program and have trouble obtaining the behaviour that you are observing. When compiled to native code, the code is consistently 20-40 % faster than BEAM (and arguably more than that). There is indeed a variation in the times that are reported; see below. What I get here is: 1. ON SPARC ----------- @hamberg [~/HiPE/tests/uffe] uname -a SunOS hamberg.it.uu.se 5.9 Generic_112233-08 sun4u sparc SUNW,Ultra-80 @hamberg [~/HiPE/tests/uffe] ~/HiPE/otp/bin/erlc *.erl @hamberg [~/HiPE/tests/uffe] ~/HiPE/otp/bin/erl Erlang (BEAM) emulator version 5.4.2003.10.26 [source] [hipe] Eshell V5.4.2003.10.26 (abort with ^G) 1> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [4722,4789,4791,4824,4835,4859,4873,4943,4958,4960,5035,5394,5444,5654,101111] 2> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [4594,4699,4699,4761,4785,4816,4840,4847,4899,4900,4904,4982,5068,5569,6389] 3> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [4591,4650,4711,4732,4782,4787,4792,4797,4838,4846,4871,4958,4980,5030,5179] 4> halt(). hmberg [~/HiPE/tests/uffe] ~/HiPE/otp/bin/erlc +native *.erl @hamberg [~/HiPE/tests/uffe] ~/HiPE/otp/bin/erl Erlang (BEAM) emulator version 5.4.2003.10.26 [source] [hipe] Eshell V5.4.2003.10.26 (abort with ^G) 1> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [3225,3265,3314,3354,3379,3405,3427,3475,3500,3557,3590,3638,3645,3987,295080] 2> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [3194,3288,3328,3432,3480,3483,3502,3525,3532,3534,3540,3719,3884,3972,4086] 3> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [3190,3231,3279,3348,3359,3365,3419,3461,3474,3574,3685,3779,3990,4213,4446] Things to notice - loading native code takes 3x more time (295080 vs 101111) - one can argue that Ulf's benchmark is indeed a random-number generator, but one can more or less claim that: - Times for BEAM are in the range [4591 - 5000] - Times for HiPE are in the range [3190 - 3700] 2. ON x86 ----------- @fan [~/HiPE/tests/uffe] uname -a Linux fan.it.uu.se 2.4.20-20.9custom #1 SMP Tue Nov 4 21:55:46 CET 2003 i686 i686 i386 GNU/Linux @fan [~/HiPE/tests/uffe] ~/HiPE/otp-x86/bin/erlc *.erl @fan [~/HiPE/tests/uffe] ~/HiPE/otp-x86/bin/erl Erlang (BEAM) emulator version 5.4.2003.10.26 [source] [hipe] Eshell V5.4.2003.10.26 (abort with ^G) 1> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [1304,1316,1319,1321,1328,1332,1332,1353,1356,1369,1392,1422,1439,1619,14387] 2> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [1275,1276,1292,1316,1328,1338,1348,1360,1376,1380,1384,1409,1421,1461,1590] 3> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [1260,1261,1270,1291,1304,1318,1327,1342,1348,1348,1359,1393,1413,1483,1522] 4> halt(). @fan [~/HiPE/tests/uffe] ~/HiPE/otp-x86/bin/erlc +native *.erl @fan [~/HiPE/tests/uffe] ~/HiPE/otp-x86/bin/erl Erlang (BEAM) emulator version 5.4.2003.10.26 [source] [hipe] Eshell V5.4.2003.10.26 (abort with ^G) 1> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [843,865,866,873,880,894,897,902,908,917,919,923,951,979,52391] 2> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [863,872,917,920,934,941,957,958,959,960,975,983,1043,1078,1357] 3> lists:sort([element(1,timer:tc(test,run,[])) || _ <- lists:seq(1,15) ]). [857,859,870,871,881,884,895,906,911,917,931,936,950,962,1091] More or less we get a similar picture here. - Times for BEAM are in the range [1260 - 1600] - Times for HiPE are in the range [ 850 - 1100] Some more comments: - The benchmark reads data from a file which is handled as a stream Performing I/O can be give a big flactuation in times. Ideally, the benchmark should be re-written so that the data is read once from the file (converted to a list or binary), and the time to process the data is reported. - timer:tc is NOT the best possible way to measure time; ideally, some more accurate time measurements should be used. Kostis From robert.virding@REDACTED Wed Nov 5 23:10:13 2003 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 5 Nov 2003 23:10:13 +0100 Subject: Bug in string.erl References: Message-ID: <007701c3a3e9$96093880$2100a8c0@virding.org> ----- Original Message ----- From: "Joe Armstrong" To: Sent: Tuesday, November 04, 2003 8:02 PM Subject: Bug in string.erl > But is was an atom ... did I get an exit - No for > > > string:substr(aa, 1, 20). > [] > > Wow (Static type systems 1, Joe 0) > > The code in string.erl says > > --- quote --- > > substr1([C|String], L) when L > 0 -> [C|substr1(String, L-1)]; > substr1(String, L) -> []. %Be nice! > > --- end quote --- > > I rather like the "%Be nice!" comment. > > IMHO all the functions in string should exit when the "string" argument > is not a list - I'm not asking that you "deep check" the list but a little > help might be nice Yes it is defintely a bug. The problem is that I was trying to be nice in the case where the desried substring length is longer than the remaining string inwhich case the substring just gets the remaining characters. So string:substr("abcd", 2, 5) -> "cd" The second should of course be: substr1(String, L) when list(String) -> []. %Be nice! Robert From raimo@REDACTED Thu Nov 6 09:01:09 2003 From: raimo@REDACTED (Raimo Niskanen) Date: Thu, 06 Nov 2003 09:01:09 +0100 Subject: Bug in string.erl References: , <007701c3a3e9$96093880$2100a8c0@virding.org> Message-ID: I have put this on my TODO list for R10, let's hope I find the time. I saw that there are more functions in the module that possibly also are too forgiving. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB Robert Virding wrote: > ----- Original Message ----- > From: "Joe Armstrong" > To: > Sent: Tuesday, November 04, 2003 8:02 PM > Subject: Bug in string.erl > > >> But is was an atom ... did I get an exit - No for >> >> > string:substr(aa, 1, 20). >> [] >> >> Wow (Static type systems 1, Joe 0) >> >> The code in string.erl says >> >> --- quote --- >> >> substr1([C|String], L) when L > 0 -> [C|substr1(String, L-1)]; >> substr1(String, L) -> []. %Be nice! >> >> --- end quote --- >> >> I rather like the "%Be nice!" comment. >> >> IMHO all the functions in string should exit when the "string" argument >>is not a list - I'm not asking that you "deep check" the list but a little >>help might be nice > > > Yes it is defintely a bug. The problem is that I was trying to be nice in the case where the desried substring length is longer than the remaining string inwhich case the substring just gets the remaining characters. So > > string:substr("abcd", 2, 5) -> "cd" > > The second should of course be: > > substr1(String, L) when list(String) -> []. %Be nice! > > Robert > From bry@REDACTED Thu Nov 6 12:06:33 2003 From: bry@REDACTED (bryan) Date: Thu, 6 Nov 2003 12:06:33 +0100 Subject: inets question, performance running time? In-Reply-To: <16297.381.252007.824423@gargle.gargle.HOWL> Message-ID: <001f01c3a456$0a3f2900$2001a8c0@bryans> Any performance stats out there on inets, would like to see info on inets running on untended machine. Anyone running inets as a server, how often do you have to do restarts? From tobbe@REDACTED Thu Nov 6 12:34:59 2003 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 06 Nov 2003 12:34:59 +0100 Subject: inets question, performance running time? In-Reply-To: <001f01c3a456$0a3f2900$2001a8c0@bryans> References: <001f01c3a456$0a3f2900$2001a8c0@bryans> Message-ID: <3FAA31E3.7030905@bluetail.com> bryan wrote: >Any performance stats out there on inets, would like to see info on >inets running on untended machine. > >Anyone running inets as a server, how often do you have to do restarts? > > Did anyone answer your question about inets vs. yaws ? Anyway, if you are staring from scratch, I think you should try Yaws. It is easy and fun, what more can you ask for... :-) , it also have an active community, mailing list, etc.. Cheers , Tobbe From ulf.wiger@REDACTED Thu Nov 6 12:39:08 2003 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 6 Nov 2003 12:39:08 +0100 Subject: inets question, performance running time? Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F540259E@ESEALNT442.al.sw.ericsson.se> You will find some figures in http://www.erlang.se/euc/02/johan.ppt /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of bryan Sent: den 6 november 2003 12:07 To: erlang-questions@REDACTED Subject: inets question, performance running time? Any performance stats out there on inets, would like to see info on inets running on untended machine. Anyone running inets as a server, how often do you have to do restarts? -------------- next part -------------- A non-text attachment was scrubbed... Name: ppt.txt Type: application/octet-stream Size: 224 bytes Desc: not available URL: From bry@REDACTED Thu Nov 6 13:37:19 2003 From: bry@REDACTED (bryan) Date: Thu, 6 Nov 2003 13:37:19 +0100 Subject: inets question, performance running time? In-Reply-To: <3FAA31E3.7030905@bluetail.com> Message-ID: <002301c3a462$b86f7b90$2001a8c0@bryans> Yeah the inets vs yaws question got answered. The reason why I'm leaning towards inets: 1. The site I'm porting is an xml based site, much of the current functionality is provided by an xslt-based solution. The solution is very similar to what I understand of mod_xsl 2. The site might need to run on windows. I've had some problems with getting Yaws running on Windows (if you have a link to something like an idiot's guide for getting Yaws running on Windows that would probably help me change my mind. ) -----Original Message----- From: Torbjorn Tornkvist [mailto:tobbe@REDACTED] Sent: Thursday, November 06, 2003 12:35 PM To: bryan Cc: erlang-questions@REDACTED Subject: Re: inets question, performance running time? bryan wrote: >Any performance stats out there on inets, would like to see info on >inets running on untended machine. > >Anyone running inets as a server, how often do you have to do restarts? > > Did anyone answer your question about inets vs. yaws ? Anyway, if you are staring from scratch, I think you should try Yaws. It is easy and fun, what more can you ask for... :-) , it also have an active community, mailing list, etc.. Cheers , Tobbe From cyberlync@REDACTED Thu Nov 6 15:25:03 2003 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 6 Nov 2003 06:25:03 -0800 (PST) Subject: inets question, performance running time? In-Reply-To: <002301c3a462$b86f7b90$2001a8c0@bryans> Message-ID: <20031106142503.37513.qmail@web40802.mail.yahoo.com> Bryan, On of the otp guys recently posted that they are droping inets from otp. I am not sure what this means for support, but I figure that it means that inets won't be maintained anymore. So even with the windows issues it has (why, why, run a web site on windows? masocist are we ;) yaws may be the better long term choice. --- bryan wrote: > Yeah the inets vs yaws question got answered. The > reason why I'm leaning > towards inets: > > 1. The site I'm porting is an xml based site, much > of the current > functionality is provided by an xslt-based solution. > The solution is > very similar to what I understand of mod_xsl > 2. The site might need to run on windows. I've had > some problems with > getting Yaws running on Windows (if you have a link > to something like an > idiot's guide for getting Yaws running on Windows > that would probably > help me change my mind. ) > > > > -----Original Message----- > From: Torbjorn Tornkvist [mailto:tobbe@REDACTED] > > Sent: Thursday, November 06, 2003 12:35 PM > To: bryan > Cc: erlang-questions@REDACTED > Subject: Re: inets question, performance running > time? > > bryan wrote: > > >Any performance stats out there on inets, would > like to see info on > >inets running on untended machine. > > > >Anyone running inets as a server, how often do you > have to do restarts? > > > > > > Did anyone answer your question about inets vs. yaws > ? > > Anyway, if you are staring from scratch, I think you > should try Yaws. > It is easy and fun, what more can you ask for... :-) > , it also have an > active community, mailing list, etc.. > > Cheers , Tobbe > > > __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree From Vlad.Dumitrescu@REDACTED Thu Nov 6 15:21:00 2003 From: Vlad.Dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 06 Nov 2003 15:21:00 +0100 Subject: inets question, performance running time? In-Reply-To: <002301c3a462$b86f7b90$2001a8c0@bryans> References: <002301c3a462$b86f7b90$2001a8c0@bryans> Message-ID: Hi, I don't have a guide to making it run on Windows, but the main problem is related to the configure script and the makefile defining things like for example ERL="/cygdrive/c/program/erl/bin/erl" which should in fact read ERL=/cygdrive/c/program/erl/bin/erl i.e. whithout quotes. good luck! /Vlad From vlad_dumitrescu@REDACTED Mon Nov 3 11:58:01 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 3 Nov 2003 11:58:01 +0100 Subject: Enterprise Erlang Beams? References: <200308221539.45014.mikael.karlsson@creado.com> <200309022102.13087.mikael.karlsson@creado.com> <200311030059.33052.mikael.karlsson@creado.com> Message-ID: From: "Mikael Karlsson" > I had a some kind of analogy in mind, but the idea is quite vague. What I like > about EJB containers is the transaction support that means that you should > not need to worry about the transaction yourself. It comes "for free" in some > kind of declarative manner. > > Leaving out all the problems with security, for the moment, the analogy would > be to spawn off a gen_server (or gen_fsm for a stateful session bean?) as a > worker thread within a transaction. Parts of the contents of the server State > could map to the persistent store and be used at commit/fallback time, > without the gen_server explicitly taking part in the transaction. > > One could maybe even have some kind of persistent behaviour were the > gen_server is spawned with a state that is restored from the database. (It > could be spawned on another node as well.) Oh, you meant like that... Yes, it's a cool idea. I'm not sure what would be the best way to do something like this "the Erlang way", but I feel it deserves some more thought. What is needed at first sight is a way to automatically apply transactional semantics to each call to this process. On the other hand, having semantics described in other place than the source code is not really very much fun. I find it difficult to keep track of every detail, when there are 4-5 files describing what one single bean does, sometimes whith very subtle dependencies... Adding some syntactic sugar to define transactional properties wolud add to the language, something not very popular these days :-) regards, Vlad From jerome@REDACTED Thu Nov 6 15:36:25 2003 From: jerome@REDACTED (=?iso-8859-1?b?Suly9G1l?= Desquilbet) Date: Thu, 6 Nov 2003 15:36:25 +0100 Subject: Getting Tk running on Mac OS 10.3 for erlang gs Message-ID: <1068129385.3faa5c699a13c@ssl.ouvaton.coop> Hello, I would appreciate some advice on how to get Tk on Mac OS 10.3. Starting from the sources, Tcl compiles and installs just fine. However, I have problems to build Tk, from the latest UNIX src packages. Before spending more time on Tk, I am wondering whether it is the easier path to go. For exemple, would it be better to install fink? Is there a prebuilt package somewhere I have missed? Thanks, J?r?me. From micael.karlberg@REDACTED Thu Nov 6 15:43:26 2003 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Thu, 6 Nov 2003 15:43:26 +0100 Subject: inets question, performance running time? In-Reply-To: <20031106142503.37513.qmail@web40802.mail.yahoo.com> References: <002301c3a462$b86f7b90$2001a8c0@bryans> <20031106142503.37513.qmail@web40802.mail.yahoo.com> Message-ID: <16298.24078.122543.869444@gargle.gargle.HOWL> With the risk of repeating myself: We are _not_ dropping inets from OTP /BMK Eric Merritt writes: > Bryan, > > On of the otp guys recently posted that they are > droping inets from otp. I am not sure what this means > for support, but I figure that it means that inets > won't be maintained anymore. So even with the windows > issues it has (why, why, run a web site on windows? > masocist are we ;) yaws may be the better long term > choice. > > > --- bryan wrote: > > Yeah the inets vs yaws question got answered. The > > reason why I'm leaning > > towards inets: > > > > 1. The site I'm porting is an xml based site, much > > of the current > > functionality is provided by an xslt-based solution. > > The solution is > > very similar to what I understand of mod_xsl > > 2. The site might need to run on windows. I've had > > some problems with > > getting Yaws running on Windows (if you have a link > > to something like an > > idiot's guide for getting Yaws running on Windows > > that would probably > > help me change my mind. ) > > > > > > > > -----Original Message----- > > From: Torbjorn Tornkvist [mailto:tobbe@REDACTED] > > > > Sent: Thursday, November 06, 2003 12:35 PM > > To: bryan > > Cc: erlang-questions@REDACTED > > Subject: Re: inets question, performance running > > time? > > > > bryan wrote: > > > > >Any performance stats out there on inets, would > > like to see info on > > >inets running on untended machine. > > > > > >Anyone running inets as a server, how often do you > > have to do restarts? > > > > > > > > > > Did anyone answer your question about inets vs. yaws > > ? > > > > Anyway, if you are staring from scratch, I think you > > should try Yaws. > > It is easy and fun, what more can you ask for... :-) > > , it also have an > > active community, mailing list, etc.. > > > > Cheers , Tobbe > > > > > > > > > __________________________________ > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard > http://antispam.yahoo.com/whatsnewfree -- Micael Karlberg Ericsson AB, ?lvsj? Sweden Tel: +46 8 727 5668 EAB/UHK/KD - OTP Product Development ECN: 851 5668 Mail: micael.karlberg@REDACTED Fax: +46 8 727 5775 From bry@REDACTED Thu Nov 6 16:16:37 2003 From: bry@REDACTED (bryan) Date: Thu, 6 Nov 2003 16:16:37 +0100 Subject: inets question, performance running time? In-Reply-To: <20031106142503.37513.qmail@web40802.mail.yahoo.com> Message-ID: <000401c3a478$f92fdc40$2001a8c0@bryans> > On of the otp guys recently posted that they are >droping inets from otp. I think you misread that, Micael Karlberg replied to my original post a propos continued support of inets yesterday as follows "We have no plans to remove inets from OTP." >why, why, run a web site on windows? >masocist are we ; well actually we have a product that among its tasks generates sitecode for various server-side platforms, asp, asp.net, php partially done, for running xml-based sites. I want to be able to generate sites that will run on either inets or yaws, I'm considering it might need to run on Windows for customer purposes. Right now of course I just want to build a port of our generated code, to see how it works on either one. :) From cyberlync@REDACTED Thu Nov 6 18:12:37 2003 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 6 Nov 2003 09:12:37 -0800 (PST) Subject: inets question, performance running time? In-Reply-To: <16298.24078.122543.869444@gargle.gargle.HOWL> Message-ID: <20031106171237.61861.qmail@web40806.mail.yahoo.com> --- Micael Karlberg wrote: > With the risk of repeating myself: > > We are _not_ dropping inets from OTP > Well, looks like I am wearing a bit of egg today. I am sorry, I completly misread your previous post. I was kind of wondering how inets could be removed without angering some of yalls paying customers. Once again, I am sorry for dispensing false information. __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree From Brad.Dill@REDACTED Thu Nov 6 15:58:48 2003 From: Brad.Dill@REDACTED (Brad Dill) Date: Thu, 6 Nov 2003 09:58:48 -0500 Subject: Question: Erlang/OTP and viruses Message-ID: Question We are using Erlang/OTP R8B in a Windows 2000/XP environment. With the resent news of viruses like Blaster, more people are wanting to use programs like Norton and MacAfee on their servers. Has any testing been done with Erlang/OTP runing in a Window environment with anti-virus software. Any known problems? Any known testing? Thanks Brad Dill From mwilligs@REDACTED Thu Nov 6 20:52:28 2003 From: mwilligs@REDACTED (mwilligs@REDACTED) Date: Thu, 6 Nov 2003 16:52:28 -0300 (PYST) Subject: Reply command In-Reply-To: <16294.35642.835593.774752@gargle.gargle.HOWL> References: <32917.65.198.40.11.1067869628.squirrel@unimail.uninet.com.py> <16294.35642.835593.774752@gargle.gargle.HOWL> Message-ID: <32929.65.198.40.11.1068148348.squirrel@unimail.uninet.com.py> We want to send that Reply package: MEGACO/1 ... Transaction = 1237{ Context = 1 { Subtract = Trunk1/line1{Audit{}} } So we modify the 'megaco_test_mg.erl' file in this function: handle_megaco_request({handle_trans_request, CH, _PV, _AR}, S) -> ED = cre_error_descr(?megaco_not_implemented, "Transaccion no soportada"), {{discard_ack, ED}, S#mg{conn_handle = CH}}; We modify like this: handle_megaco_request({handle_trans_request, CH, _PV, _AR}, S) -> %ED = cre_error_descr(?megaco_not_implemented, "Transaccion no soportada"), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SUBR = cre_ammsReply(?A4444), ED = cre_commandRep({subtractReply, SUBR}), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {{discard_ack, [ED]}, S#mg{conn_handle = CH}}; cre_commandRep(Cmd)-> #'CommandRequest'{ command = Cmd}. cre_ammsReply(Id)-> #'AmmsReply'{ terminationID = [#megaco_term_id{id=Id}]}. What is wrong in my code? Thanks in advance. From sean.hinde@REDACTED Fri Nov 7 00:46:46 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 6 Nov 2003 23:46:46 +0000 Subject: Getting Tk running on Mac OS 10.3 for erlang gs In-Reply-To: <1068129385.3faa5c699a13c@ssl.ouvaton.coop> Message-ID: <7B8AB8E6-10B3-11D8-B958-000A95927CCE@mac.com> On Thursday, November 6, 2003, at 02:36 pm, J?r?me Desquilbet wrote: > Hello, > I would appreciate some advice on how to get Tk on Mac OS 10.3. > Starting from the sources, Tcl compiles and installs just fine. > However, > I have problems to build Tk, from the latest UNIX src packages. > Before spending more time on Tk, I am wondering whether it is the > easier > path to go. For exemple, would it be better to install fink? Is there a > prebuilt package somewhere I have missed? > Thanks, > J?r?me. > > > There are pre-built packages available for Tcl and Tk at their sourceforge site which work well (ish) with Erlang (at least they did in 10.2). Sean From luke@REDACTED Fri Nov 7 10:20:34 2003 From: luke@REDACTED (Luke Gorrie) Date: 07 Nov 2003 10:20:34 +0100 Subject: Unicode - the lighter side In-Reply-To: References: <20031105030555.53312.qmail@web40803.mail.yahoo.com> Message-ID: Luke Gorrie writes: > One nice thing about Unicode is that you get a lot of extra APL-esque > gadget characters. I grabbed some code off the 'net [1] that lets you > put these to use in Emacs - so you get both syntax-colouring and > syntax-pretty-symbolifying. (Sorry I didn't mention: the code I posted only works in GNU Emacs 21. Doing unicodey stuff in an Emacs-portable way is impossible as far as I know.) -Luke From micael.karlberg@REDACTED Fri Nov 7 12:00:48 2003 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Fri, 7 Nov 2003 12:00:48 +0100 Subject: Reply command In-Reply-To: <32929.65.198.40.11.1068148348.squirrel@unimail.uninet.com.py> References: <32917.65.198.40.11.1067869628.squirrel@unimail.uninet.com.py> <16294.35642.835593.774752@gargle.gargle.HOWL> <32929.65.198.40.11.1068148348.squirrel@unimail.uninet.com.py> Message-ID: <16299.31584.350056.625726@gargle.gargle.HOWL> Hi, There is no "command reply" type. Instead, you wrap this as follows: handle_megaco_request({handle_trans_request, CH, _PV, AR}, S) -> do_something_usefull_with_the_request(CH, AR), %% Compose a reply ContextId = 1, AmmsReply = cre_ammsReply(?A4444), CmdReply = [{subtractReply, AmmsReply}], ActReplies = [cre_actionReply(ContextId, CmdReply)], {discard_ack, ActReplies}. You can find more message examples by looking at the megaco_codec_test.erl file (search for e.g. 'msg25(Mid)'). /BMK mwilligs@REDACTED writes: > We want to send that Reply package: > > MEGACO/1 ... > Transaction = 1237{ > Context = 1 { > Subtract = Trunk1/line1{Audit{}} > } > > > > So we modify the 'megaco_test_mg.erl' file in this function: > > handle_megaco_request({handle_trans_request, CH, _PV, _AR}, S) -> > ED = cre_error_descr(?megaco_not_implemented, "Transaccion no > soportada"), > {{discard_ack, ED}, S#mg{conn_handle = CH}}; > > > > > > We modify like this: > > > handle_megaco_request({handle_trans_request, CH, _PV, _AR}, S) -> > %ED = cre_error_descr(?megaco_not_implemented, "Transaccion no > soportada"), > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > SUBR = cre_ammsReply(?A4444), > ED = cre_commandRep({subtractReply, SUBR}), > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > {{discard_ack, [ED]}, S#mg{conn_handle = CH}}; > > > cre_commandRep(Cmd)-> > #'CommandRequest'{ command = Cmd}. > > cre_ammsReply(Id)-> > #'AmmsReply'{ terminationID = [#megaco_term_id{id=Id}]}. > > > > What is wrong in my code? > > Thanks in advance. -- Micael Karlberg Ericsson AB, ?lvsj? Sweden Tel: +46 8 727 5668 EAB/UHK/KD - OTP Product Development ECN: 851 5668 Mail: micael.karlberg@REDACTED Fax: +46 8 727 5775 From jerome@REDACTED Fri Nov 7 14:32:44 2003 From: jerome@REDACTED (=?iso-8859-1?b?Suly9G1l?= Desquilbet) Date: Fri, 7 Nov 2003 14:32:44 +0100 Subject: Getting Tk running on Mac OS 10.3 for erlang gs In-Reply-To: <7B8AB8E6-10B3-11D8-B958-000A95927CCE@mac.com> References: <7B8AB8E6-10B3-11D8-B958-000A95927CCE@mac.com> Message-ID: <1068211964.3fab9efcb083b@ssl.ouvaton.coop> > > I would appreciate some advice on how to get Tk on Mac OS 10.3. > > Starting from the sources, Tcl compiles and installs just fine. > > However, > > I have problems to build Tk, from the latest UNIX src packages. > > Before spending more time on Tk, I am wondering whether it is the > > easier path to go. > There are pre-built packages available for Tcl and Tk at their > sourceforge site which work well (ish) with Erlang (at least they did > in 10.2). Thanks for your help. I have found TclTkAqua-8.4.4.dmg TclTkAquaBI-8.4.4.0.dmg TclTkAquaStandalone-8.4.4.dmg (BTW, what are the differences?) at http://sourceforge.net/project/showfiles.php?group_id=10894 Is it what you are thinking of? Actually, while browsing I discovered http://mini.net/tcl/1013 and http://www.maths.mq.edu.au/~steffen/tcltk/ . Thanks again, J?r?me. From jerome@REDACTED Fri Nov 7 15:17:50 2003 From: jerome@REDACTED (=?iso-8859-1?b?Suly9G1l?= Desquilbet) Date: Fri, 7 Nov 2003 15:17:50 +0100 Subject: Getting Tk running on Mac OS 10.3 for erlang gs In-Reply-To: <1068211964.3fab9efcb083b@ssl.ouvaton.coop> References: <7B8AB8E6-10B3-11D8-B958-000A95927CCE@mac.com> <1068211964.3fab9efcb083b@ssl.ouvaton.coop> Message-ID: <1068214670.3faba98eccc31@ssl.ouvaton.coop> Selon J?r?me Desquilbet : > > > I would appreciate some advice on how to get Tk on Mac OS 10.3. > > > Starting from the sources, Tcl compiles and installs just fine. > > > > However, > > > I have problems to build Tk, from the latest UNIX src packages. > > > Before spending more time on Tk, I am wondering whether it is > the > > > easier path to go. > > > There are pre-built packages available for Tcl and Tk at their > > sourceforge site which work well (ish) with Erlang (at least they > did > > in 10.2). > > Thanks for your help. I have found > TclTkAqua-8.4.4.dmg > TclTkAquaBI-8.4.4.0.dmg > TclTkAquaStandalone-8.4.4.dmg > (BTW, what are the differences?) http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/ answers this question... > at http://sourceforge.net/project/showfiles.php?group_id=10894 > Is it what you are thinking of? > Actually, while browsing I discovered http://mini.net/tcl/1013 and > http://www.maths.mq.edu.au/~steffen/tcltk/ . ... and tells that the port for Mac OS 10.3 is not available yet. J?r?me. From joe@REDACTED Fri Nov 7 16:38:29 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 7 Nov 2003 16:38:29 +0100 (CET) Subject: Bug in string.erl In-Reply-To: <007701c3a3e9$96093880$2100a8c0@virding.org> Message-ID: > Yes it is defintely a bug. The problem is that I was trying to be nice in the case where the desried substring length is longer than the remaining string inwhich case the substring just gets the remaining characters. So > > string:substr("abcd", 2, 5) -> "cd" > > The second should of course be: > > substr1(String, L) when list(String) -> []. %Be nice! My goodness - I didn't realise you'd written the code - there was a comment in it :-) /Joe > > Robert > > From sean.hinde@REDACTED Fri Nov 7 17:20:28 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 7 Nov 2003 16:20:28 +0000 Subject: Getting Tk running on Mac OS 10.3 for erlang gs In-Reply-To: <1068211964.3fab9efcb083b@ssl.ouvaton.coop> Message-ID: <4CC8C216-113E-11D8-B958-000A95927CCE@mac.com> On Friday, November 7, 2003, at 01:32 pm, J?r?me Desquilbet wrote: >>> I would appreciate some advice on how to get Tk on Mac OS 10.3. >>> Starting from the sources, Tcl compiles and installs just fine. >>> However, >>> I have problems to build Tk, from the latest UNIX src packages. >>> Before spending more time on Tk, I am wondering whether it is the >>> easier path to go. > >> There are pre-built packages available for Tcl and Tk at their >> sourceforge site which work well (ish) with Erlang (at least they did >> in 10.2). > > Thanks for your help. I have found > TclTkAqua-8.4.4.dmg > TclTkAquaBI-8.4.4.0.dmg > TclTkAquaStandalone-8.4.4.dmg > (BTW, what are the differences?) As far as I could make out last time I looked the main difference is size! I seem to recall I installed the last one. Sean From sean.hinde@REDACTED Fri Nov 7 17:56:12 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 7 Nov 2003 16:56:12 +0000 Subject: Getting Tk running on Mac OS 10.3 for erlang gs In-Reply-To: <1068214670.3faba98eccc31@ssl.ouvaton.coop> Message-ID: <4B188DAB-1143-11D8-B958-000A95927CCE@mac.com> On Friday, November 7, 2003, at 02:17 pm, J?r?me Desquilbet wrote: > > ... and tells that the port for Mac OS 10.3 is not available yet. > Ah, I didn't read this far. I guess that we must wait or fix! Sean From hakan.stenholm@REDACTED Fri Nov 7 18:24:26 2003 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 7 Nov 2003 18:24:26 +0100 Subject: Function or Macro... In-Reply-To: <3FA920B8.E7C489B3@ericsson.com> Message-ID: <3C8FA208-1147-11D8-94DC-000393B8AB26@mbox304.swipnet.se> On onsdag, nov 5, 2003, at 17:09 Europe/Stockholm, Luca Manai (AL/EAB) wrote: > Hello, > > I was asking me if there are advantages in using a macro (when possible > and > when it is not disorienting for the reader) instead of a function. I don't think so, have never heard or read anything that implied that this would be the case. > > Is there behind erlang a mechanism of parameter allocation on the > stack when a function is called (like in C)? > Or may be the matter is much more complex... > Thanks. > > Luca. > - > PS: I hope the question does make sense... I wasn't sure about that. > From eschrijvers@REDACTED Sat Nov 8 23:46:23 2003 From: eschrijvers@REDACTED (Eljakim Schrijvers) Date: Sat, 8 Nov 2003 23:46:23 +0100 Subject: Newbie question Message-ID: <001301c3a64a$2273a1e0$6601a8c0@Simon> Having used Miranda as well as Mathematic for a long time I figured it was time to look into Erlang. I ran into the following strange behaviour (line 18>) 16> [X || X <- [7,8], X>3]. [7,8] 17> [X || X <- [7], X>3]. [7] 18> [X || X <- [8], X>3]. "\b" I do not understand what the "\b" means, or where it comes from. I presume the system looks at [8] as a representation of the ASCII \b character?? How can I tell it to just respond with [8] on my screen? Yours, Kim From lennart.ohman@REDACTED Sun Nov 9 00:26:49 2003 From: lennart.ohman@REDACTED (=?windows-1252?Q?Lennart_=D6hman?=) Date: Sun, 09 Nov 2003 00:26:49 +0100 Subject: Newbie question In-Reply-To: <001301c3a64a$2273a1e0$6601a8c0@Simon> References: <001301c3a64a$2273a1e0$6601a8c0@Simon> Message-ID: <3FAD7BB9.9000507@st.se> Hi, since strings in Erlang simply are lists of ascii values the shell tries to display such as strings rather than lists of integers. You presume correctly, "\b" is the printable representation of backspace. (So all lists containing only printable ascii values will be displayed as strings. All other lists as lists). Best Regards, Lennart Try: io:format("~w",[ [8] ]) Eljakim Schrijvers wrote: > Having used Miranda as well as Mathematic for a long time > I figured it was time to look into Erlang. > > I ran into the following strange behaviour (line 18>) > 16> [X || X <- [7,8], X>3]. > [7,8] > 17> [X || X <- [7], X>3]. > [7] > 18> [X || X <- [8], X>3]. > "\b" > > I do not understand what the "\b" means, or where it comes > from. I presume the system looks at [8] as a representation > of the ASCII \b character?? > > How can I tell it to just respond with [8] on my screen? > > Yours, > > Kim -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From bjarne@REDACTED Sun Nov 9 11:44:09 2003 From: bjarne@REDACTED (=?Windows-1252?Q?Bjarne_D=E4cker?=) Date: Sun, 09 Nov 2003 11:44:09 +0100 Subject: Welcome to EUC'2003 !!! Message-ID: <002f01c3a6ae$688b8440$f70769d4@segeltorp> Hello All Erlang users, developers, friends, hangers-on etc. are invited to this year's Erlang/OTP User Conference. Please see the invitation at http://www.erlang.se/euc/03/ and the exciting conference programme at http://www.erlang.se/euc/03/Programme.html To register for the EUC'2003 just send an e-mail to euc@REDACTED Welcome Bjarne (on behalf of the Erlang/OTP team) -------------- next part -------------- An HTML attachment was scrubbed... URL: From bry@REDACTED Mon Nov 10 13:36:47 2003 From: bry@REDACTED (bryan) Date: Mon, 10 Nov 2003 13:36:47 +0100 Subject: doesn't tapestry sound like it should be written in erlang? In-Reply-To: <002f01c3a6ae$688b8440$f70769d4@segeltorp> Message-ID: <000001c3a787$4f491900$2001a8c0@bryans> http://www.cs.berkeley.edu/~ravenben/tapestry/html/background.html "Tapestry is an overlay network that sits at the application layer (on top of an Operating System). Deployed as a network connecting a set of machines, Tapestry allows any member node to route messages to any other node in the network, given a location and network independent name. Furthermore, Tapestry functions as a decentralized directory service for any objects residing on nodes in the network. A node in a Tapestry network can advertise or "publish" location information about an object it possesses. Any other Tapestry node can then act as a client, and send messages to this object, as long as it knew the object's unique identifier. These messages route through the overlay from node to node until they arrive at the node where the object is stored, such that the path taken is a small factor longer than the shortest path from the client node to the object's location." Maybe I'm just weird but I was reading thru this and thinking, why does it always have to be java. Ah well.. -------------- next part -------------- An HTML attachment was scrubbed... URL: From garry@REDACTED Mon Nov 10 19:22:53 2003 From: garry@REDACTED (Garry Hodgson) Date: Mon, 10 Nov 2003 13:22:53 -0500 (EST) Subject: doesn't tapestry sound like it should be written in erlang? In-Reply-To: <000001c3a787$4f491900$2001a8c0@bryans> References: <000001c3a787$4f491900$2001a8c0@bryans> Message-ID: <2003111013221068488565@k2.sage.att.com> "bryan" wrote: > Maybe I'm just weird but I was reading thru this and thinking, why does > it always have to be java. cause if you did it in erlang you'd be done too soon, and then you'd have to think up something else to do. though, come to think of it, it might take the same amount of time. 10% to implement, and 90% explaining why you didn't do it in java. not that i'm cynical or anything. ---- Garry Hodgson, Technology Consultant, AT&T Labs Be happy for this moment. This moment is your life. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeinhorn@REDACTED Mon Nov 10 21:13:09 2003 From: jeinhorn@REDACTED (Jeff Einhorn) Date: 10 Nov 2003 14:13:09 -0600 Subject: Escript question. Message-ID: <1068495189.20635.13.camel@dhcp-lom-195-14.futuresource.com> Is there an easy way to specify a -name/setcookie type option in a escript, so that it can talk to existing nodes. thanks for your time, -jeff -- Jeffrey M. Einhorn Platform Systems Design and Integration Manager FutureSource, LLC jeinhorn@REDACTED http://www.futuresource.com From HEINRICH.VENTER@REDACTED Tue Nov 11 08:28:15 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Tue, 11 Nov 2003 09:28:15 +0200 Subject: pool and fully qualified node names Message-ID: Hi Something is puzzling me. I start an erlang node with a fully qualified name erl -name test@REDACTED -config sys When I start a new pool from this node with pool:start(thingy). The results are a bit confusing. My .hosts.erlang file contains two fully qualified node names 'dev.mynodes.net'. 'hsm.mynodes.net'. But the pool creation gives the following errors =ERROR REPORT==== 11-Nov-2003::09:24:31 === ** System running to use fully qualified hostnames ** ** Hostname dev is illegal ** =ERROR REPORT==== 11-Nov-2003::09:24:32 === ** System running to use fully qualified hostnames ** ** Hostname hsm is illegal ** BUT the slave node starts up correctly if I have a look at pool:get_nodes() If I use short names I dont get the error, but then the local node is not included in the pool. Then I have a second question: Does the slave node only look for modules only in the standard lib directories? Does any one have an example (or wisdom to share) of using pool? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From serge@REDACTED Tue Nov 11 13:44:29 2003 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 11 Nov 2003 07:44:29 -0500 Subject: binaries vs lists Message-ID: <3FB0D9AD.1030603@hq.idt.net> Hi! I was wonderting if someone could contribute a thought to the following question regarding efficiency. I have an Erlang TCP client that processes a binary stream which needs to be post-processed by removing escaped bytes. Let's say, that byte 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a message separator. The variable hex messages are within 512 bytes each. What would be faster for Erlang: 1. Declare a socket to return a *list* of bytes, and do something like: unescape([], Msg) -> {lists:reverse(Msg), []}; unescape([16#FE, 1 | T], Msg) -> unescape(T, [16#FF | Msg]); unescape([16#FF | Bytes]=NextMsg, Msg) -> {lists:reverse(Msg), NextMsg}; unescape([H | T], Msg) -> unescape(T, [H | Msg]); 2. Alternatively, declare a socket to return *binaries*, and do: unescape(<<>>, Msg) -> {binary_to_list(Msg), <<>>}; unescape(<<16#FE, 1, T>>, Msg) -> unescape(T, concat_binary([Msg, 16#FF])); unescape(<<16#FF, Bytes>> = NextMsg, Msg) -> {binary_to_list(Msg), NextMsg}; unescape(<>, Msg) -> unescape(T, concat_binary([Msg, H])); Intuitively I think that the binary approach should work faster, but I want to make sure that concat_binary is not expensive to do for every byte in a stream. Thanks. Serge From Bengt.Kleberg@REDACTED Tue Nov 11 14:24:28 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Tue, 11 Nov 2003 14:24:28 +0100 Subject: binaries vs lists In-Reply-To: <3FB0D9AD.1030603@hq.idt.net> References: <3FB0D9AD.1030603@hq.idt.net> Message-ID: <3FB0E30C.7080000@ericsson.com> Serge Aleynikov wrote: > Hi! > > I was wonderting if someone could contribute a thought to the following > question regarding efficiency. > does it have to be efficient? have you found this to be a bottle neck? > I have an Erlang TCP client that processes a binary stream which needs > to be post-processed by removing escaped bytes. Let's say, that byte > 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a > message separator. The variable hex messages are within 512 bytes each. > if i understood the 512 bytes statement correctly, it is ok to build the list on the stack, thus avoiding lists:reverse/1 in solution 1. > What would be faster for Erlang: > > 1. Declare a socket to return a *list* of bytes, and do something like: > ...deleted > > 2. Alternatively, declare a socket to return *binaries*, and do: > ...deleted > > Intuitively I think that the binary approach should work faster, but I > want to make sure that concat_binary is not expensive to do for every > byte in a stream. have you tried to measure the performance of both? i do not know about your intuition, but mine is very unreliable. bengt From serge@REDACTED Tue Nov 11 15:58:18 2003 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 11 Nov 2003 09:58:18 -0500 Subject: binaries vs lists In-Reply-To: <3FB0E30C.7080000@ericsson.com> References: <3FB0D9AD.1030603@hq.idt.net> <3FB0E30C.7080000@ericsson.com> Message-ID: <3FB0F90A.8070906@hq.idt.net> Bengt Kleberg wrote: > Serge Aleynikov wrote: > >> Hi! >> >> I was wonderting if someone could contribute a thought to the >> following question regarding efficiency. >> > > does it have to be efficient? have you found this to be a bottle neck? The expected flow is over 1000 binary messages / second. I haven't yet found this to be a bottleneck, but I'd prefer to have the extra CPU time available for other Erlang tasks. >> I have an Erlang TCP client that processes a binary stream which needs >> to be post-processed by removing escaped bytes. Let's say, that byte >> 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a >> message separator. The variable hex messages are within 512 bytes each. >> > > if i understood the 512 bytes statement correctly, it is ok to build the > list on the stack, thus avoiding lists:reverse/1 in solution 1. Do I have a control over where the list is being built (heap/stack)? Or this is purely dependent on the list size? If so, are you implying that I should append items at the end instead of doing it in front, and using lists:reverse/1 ? Serge From mlogan@REDACTED Tue Nov 11 16:22:28 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 11 Nov 2003 09:22:28 -0600 Subject: doesn't tapestry sound like it should be written in erlang? In-Reply-To: <000001c3a787$4f491900$2001a8c0@bryans> References: <000001c3a787$4f491900$2001a8c0@bryans> Message-ID: <1068564147.552.21.camel@dhcp-lom-194-186.futuresource.com> You have got to love reading "new" research along the lines of, each overlay can be called a "node" and nodes will have within them objects with cluster wide unique "keys" that can be referenced from any location... I had a dream once that I had been programming everyday with a full implementation of all these "new" "ideas" for the last four years. Even funnier part of the dream is that the technology had been around for ten. Could you believe that in my dream people who wanted to use this novel technology were met with resistance. Thank god we don't all live in my twisted dreams. Ok. back to OO QBasic, got to get some real work done. Cheers, Martin On Mon, 2003-11-10 at 06:36, bryan wrote: > http://www.cs.berkeley.edu/~ravenben/tapestry/html/background.html > > > > ?Tapestry is an overlay network that sits at the application layer (on > top of an Operating System). Deployed as a network connecting a set of > machines, Tapestry allows any member node to route messages to any > other node in the network, given a location and network independent > name. Furthermore, Tapestry functions as a decentralized directory > service for any objects residing on nodes in the network. A node in a > Tapestry network can advertise or "publish" location information about > an object it possesses. Any other Tapestry node can then act as a > client, and send messages to this object, as long as it knew the > object's unique identifier. These messages route through the overlay > from node to node until they arrive at the node where the object is > stored, such that the path taken is a small factor longer than the > shortest path from the client node to the object's location.? > > > > Maybe I?m just weird but I was reading thru this and thinking, why > does it always have to be java. > > > > Ah well?. > > From Bengt.Kleberg@REDACTED Tue Nov 11 16:44:05 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Tue, 11 Nov 2003 16:44:05 +0100 Subject: binaries vs lists In-Reply-To: <3FB0F90A.8070906@hq.idt.net> References: <3FB0D9AD.1030603@hq.idt.net> <3FB0E30C.7080000@ericsson.com> <3FB0F90A.8070906@hq.idt.net> Message-ID: <3FB103C5.40208@ericsson.com> Serge Aleynikov wrote: > Bengt Kleberg wrote: > >> Serge Aleynikov wrote: >> ...deleted >>> I have an Erlang TCP client that processes a binary stream which >>> needs to be post-processed by removing escaped bytes. Let's say, >>> that byte 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value >>> is used as a message separator. The variable hex messages are within >>> 512 bytes each. >>> >> >> if i understood the 512 bytes statement correctly, it is ok to build >> the list on the stack, thus avoiding lists:reverse/1 in solution 1. > > > Do I have a control over where the list is being built (heap/stack)? Or > this is purely dependent on the list size? If so, are you implying that > I should append items at the end instead of doing it in front, and using > lists:reverse/1 ? > if you build a list in an accumulator this is (usually :-) done using heap space: fn([], Acc) -> lists:reverse(Acc); fn([H | T], Acc) -> fn(T, [H | Acc]). if you build a list using 'cons' this is ''usually'' done using stack space: fn([]) -> []; fn([H | T]) -> [H | fn(T)]). you can crash your process if it uses too much space. stack space is usually smaller than heap space. however, in this case you seemed to say that there was a maximum of 512 bytes to a list. which usually is available on your stack. bengt From bjorn@REDACTED Tue Nov 11 17:08:04 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 11 Nov 2003 17:08:04 +0100 Subject: binaries vs lists In-Reply-To: <3FB0D9AD.1030603@hq.idt.net> References: <3FB0D9AD.1030603@hq.idt.net> Message-ID: concat_binary/1 is definitely inefficient if done for each byte. You should build a list instead. /Bjorn Serge Aleynikov writes: > Hi! > > I was wonderting if someone could contribute a thought to the > following question regarding efficiency. > > I have an Erlang TCP client that processes a binary stream which needs > to be post-processed by removing escaped bytes. Let's say, that byte > 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a > message separator. The variable hex messages are within 512 bytes > each. > > What would be faster for Erlang: > > 1. Declare a socket to return a *list* of bytes, and do something like: > > unescape([], Msg) -> {lists:reverse(Msg), []}; > unescape([16#FE, 1 | T], Msg) -> unescape(T, [16#FF | Msg]); > unescape([16#FF | Bytes]=NextMsg, Msg) -> > {lists:reverse(Msg), NextMsg}; > unescape([H | T], Msg) -> unescape(T, [H | Msg]); > > 2. Alternatively, declare a socket to return *binaries*, and do: > > unescape(<<>>, Msg) -> {binary_to_list(Msg), <<>>}; > unescape(<<16#FE, 1, T>>, Msg) -> > unescape(T, concat_binary([Msg, 16#FF])); > unescape(<<16#FF, Bytes>> = NextMsg, Msg) -> > {binary_to_list(Msg), NextMsg}; > unescape(<>, Msg) -> > unescape(T, concat_binary([Msg, H])); > > Intuitively I think that the binary approach should work faster, but I > want to make sure that concat_binary is not expensive to do for every > byte in a stream. > > Thanks. > > Serge > > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From per.gustafsson@REDACTED Tue Nov 11 16:57:05 2003 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Tue, 11 Nov 2003 16:57:05 +0100 (MET) Subject: binaries vs lists In-Reply-To: <3FB0D9AD.1030603@hq.idt.net> References: <3FB0D9AD.1030603@hq.idt.net> Message-ID: On Tue, 11 Nov 2003, Serge Aleynikov wrote: > Hi! > > I was wonderting if someone could contribute a thought to the following > question regarding efficiency. > > I have an Erlang TCP client that processes a binary stream which needs > to be post-processed by removing escaped bytes. Let's say, that byte > 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value is used as a > message separator. The variable hex messages are within 512 bytes each. > > What would be faster for Erlang: > > 1. Declare a socket to return a *list* of bytes, and do something like: > > unescape([], Msg) -> {lists:reverse(Msg), []}; > unescape([16#FE, 1 | T], Msg) -> unescape(T, [16#FF | Msg]); > unescape([16#FF | Bytes]=NextMsg, Msg) -> > {lists:reverse(Msg), NextMsg}; > unescape([H | T], Msg) -> unescape(T, [H | Msg]); > > 2. Alternatively, declare a socket to return *binaries*, and do: > > unescape(<<>>, Msg) -> {binary_to_list(Msg), <<>>}; > unescape(<<16#FE, 1, T>>, Msg) -> > unescape(T, concat_binary([Msg, 16#FF])); > unescape(<<16#FF, Bytes>> = NextMsg, Msg) -> > {binary_to_list(Msg), NextMsg}; > unescape(<>, Msg) -> > unescape(T, concat_binary([Msg, H])); > > Intuitively I think that the binary approach should work faster, but I > want to make sure that concat_binary is not expensive to do for every > byte in a stream. > > Thanks. > > Serge > > > I think it would be reasonable to do something like this: unescape(<<>>, Msg) -> {lists:reverse(Msg), <<>>}; unescape(<<16#FE, 1, T/binary>>, Msg) -> unescape(T, [16#FF|Msg])); unescape(<<16#FF, _Bytes/binary>> = NextMsg, Msg) -> {lists:reverse(Msg), NextMsg}; unescape(<>, Msg) -> unescape(T, [H | Msg])); Because concat_binary would require that the binary is copied each time something is concatenated to it and since the result of the operation should be a list it is reasonable to build this list directly instead of first constructing a binary (Which is costly) and then turning it into a list. /Per From vlad_dumitrescu@REDACTED Tue Nov 11 20:47:12 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Nov 2003 20:47:12 +0100 Subject: Pocket PC Message-ID: Hi, Does anyone know if there is any idea to even think about porting Erlang to Pocket PC? regards, Vlad From enano@REDACTED Tue Nov 11 20:58:12 2003 From: enano@REDACTED (Miguel Barreiro) Date: Tue, 11 Nov 2003 20:58:12 +0100 (CET) Subject: Pocket PC In-Reply-To: References: Message-ID: > Does anyone know if there is any idea to even think about porting Erlang to > Pocket PC? Does Erlang on Linux on the Pocket PC count? :-) From vlad_dumitrescu@REDACTED Tue Nov 11 21:15:48 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 11 Nov 2003 21:15:48 +0100 Subject: Pocket PC References: Message-ID: From: "Miguel Barreiro" > > Does anyone know if there is any idea to even think about porting Erlang to > > Pocket PC? > Does Erlang on Linux on the Pocket PC count? :-) I wish it did :-) Forgot to mention I meant "PocketPC, the OS from Microsoft". Until I will afford to buy one such thingie that I will be able to hack and tweak, it's only what's installed on it from the start that I can use. /Vlad From ulf.wiger@REDACTED Tue Nov 11 23:45:35 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 11 Nov 2003 23:45:35 +0100 Subject: doesn't tapestry sound like it should be written in erlang? In-Reply-To: <1068564147.552.21.camel@dhcp-lom-194-186.futuresource.com> References: <000001c3a787$4f491900$2001a8c0@bryans> <1068564147.552.21.camel@dhcp-lom-194-186.futuresource.com> Message-ID: On 11 Nov 2003 09:22:28 -0600, Martin J. Logan wrote: I had a dream once that I had been programming everyday with > a full implementation of all these "new" "ideas" for the last four > years. Even funnier part of the dream is that the technology had been > around for ten. This is a bit like those Apple ads a few years back: "In Windows 95, you can delete files by dragging them to a trash can. Imagine that..." "In Windows 95, you can have file names longer than 8 characters. Imagine that..." etc. It made for cute commercials, but in the end, it probably didn't make a difference. People still thought it was a novelty to be able to use a trashcan icon on the desktop, and half the world probably still believes Bill Gates invented the concept. ;-) /Uffe -- Ulf Wiger From massimo.cesaro@REDACTED Wed Nov 12 08:54:46 2003 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 12 Nov 2003 08:54:46 +0100 Subject: How Mnemosyne cursors are used ? Message-ID: <1068573115.14324.13.camel@xam> I'd like to have a function that when called returns, up to N records from a Mnesia table. The records are extracted using a Mnemosyne query, and I thought the I could do something like this: get_page(StartDate, EndDate, Result, MaxLines) -> Q = query [C || C <- table(cdr), C.date >= StartDate, C.date =< EndDate, C.result = Result ] end, F= fun() -> Cursor = mnemosyne:cursor(Q), L = mnemosyne:next_answers(Cursor, MaxLines, MaxLines), [Cursor, L] end, % Get the first MaxLines records {R, [C, L]}= mnesia:transaction(F), % format and display records format_cdr(L), % Get another block of records K = mnesia:transaction(fun() -> mnemosyne:next_answers(C) end), format_cdr(K); mnemosyne:delete_cursors(Cursors); I get the first block correctly, but on the second mnemosyne:next_answers() call, I have a "wrong transaction" error. Clearly this is not the way the cursors should be used, but then how can I query the database in discrete blocks (let say that I want to print the records on different pages of a report), maintaining the cursor status between separate calls ? Puzzled... Massimo From raimo@REDACTED Wed Nov 12 10:13:01 2003 From: raimo@REDACTED (Raimo Niskanen) Date: Wed, 12 Nov 2003 10:13:01 +0100 Subject: binaries vs lists References: <3FB0E30C.7080000@ericsson.com>, <3FB0F90A.8070906@hq.idt.net>, <3FB103C5.40208@ericsson.com> Message-ID: About stack space vs heap space. There is always room on the stack in Erlang, at least compared to the heap. They lie in the same memory block, grow towards each other, and when they collide the garbage collector gets them a larger memory block to grow in. So the only way to run out of stack or heap space is that the virtual machine runs out of memory. One single Erlang process can not run out of memory alone. If you have a large stack, it might slow down the garbage collector. It it rarely a problem, but I think this is why: When garbage collecting, the garbage collector takes a new clean memory block and copies all live data from the old one to the new. It finds all live data by starting from the root set, and the root set is chiefly the stack. The grabage collector scans the stack linearily and when it finds a term that is complex, i.e lies on the heap, it traverses the term and copies it over to the new heap. So, if there is much data on the stack that is not complex terms, for example integers and atoms, there is much of the stack that is scanned in vain - wasting time. An old truth in the Erlang community is that you always should build a list reversed and then reverse it at the end - lists:reverse() is a BIF, it is fast. Benchmarks I have made indicates that this truth is not quite as true nowdays. Building the list on the stack often wins. Use the solution that gives most readable code, and change if it becomes a problem. There are certainly extreme cases that are bad for any strategy. Some warnings then. Appending to a list is expensive. The whole list must be traversed to find the tail. If you do this in a tight loop it is absolutely better to build the list backwards and reverse at the end. You will go from quadratic time complexity down to linear. Concatenating binaries is really expensive. To create the result binary all data must be copied. If you append data to a binary by concatenating it is absolutely better to build a list of bytes (it can also contain sublists or binaries to any depth) and do list_to_binary/1 at the end. This is also an improvement from quadratic to linear time complexity (at least!). -- / Raimo Niskanen, Erlang/OTP, Ericsson AB Bengt Kleberg wrote: > Serge Aleynikov wrote: > >> Bengt Kleberg wrote: >> >>> Serge Aleynikov wrote: >>> > ...deleted > >>>> I have an Erlang TCP client that processes a binary stream which >>>> needs to be post-processed by removing escaped bytes. Let's say, >>>> that byte 16$FF is escaped as <<16#FE, 16$01>>, and the 16#FF value >>>> is used as a message separator. The variable hex messages are >>>> within 512 bytes each. >>>> >>> >>> if i understood the 512 bytes statement correctly, it is ok to build >>> the list on the stack, thus avoiding lists:reverse/1 in solution 1. >> >> >> >> Do I have a control over where the list is being built (heap/stack)? >> Or this is purely dependent on the list size? If so, are you implying >> that I should append items at the end instead of doing it in front, >> and using lists:reverse/1 ? >> > if you build a list in an accumulator this is (usually :-) done using > heap space: > fn([], Acc) -> > lists:reverse(Acc); > fn([H | T], Acc) -> > fn(T, [H | Acc]). > > > if you build a list using 'cons' this is ''usually'' done using stack > space: > fn([]) -> > []; > fn([H | T]) -> > [H | fn(T)]). > > you can crash your process if it uses too much space. stack space is > usually smaller than heap space. however, in this case you seemed to say > that there was a maximum of 512 bytes to a list. which usually is > available on your stack. > > > bengt > From massimo.cesaro@REDACTED Wed Nov 12 10:16:05 2003 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 12 Nov 2003 10:16:05 +0100 Subject: How Mnemosyne cursors are used ? In-Reply-To: <4A04D694-14EE-11D8-95BB-000A95927CCE@mac.com> References: <4A04D694-14EE-11D8-95BB-000A95927CCE@mac.com> Message-ID: <1068628566.1525.12.camel@xam> On Wed, 2003-11-12 at 09:57, Sean Hinde wrote: > Check out ets:select in all its forms which allows you to retrieve a > table in chunks. The match syntax would certainly allow you to > formulate the query you have here. Also check out ets:fun2ms which > allows easy generation of the match code. > I used ets:select and also considered using ets:fun2ms, but what I'd like to avoid is rewriting persistent cursors logic. I'm doing the query from a Yaws page. It is a report where I can define a start date, an end date and the number of lines per page. Then the page is dynamically generated from Yaws, and each time I click the "Next" button on the web page, the idea was to pass the cursor state as a cookie to continue returning records. I thought of using Mnemosyne queries as well, but the requirement of initialising the query with mnemosyne:init_query/1 each time render useless this method as well. My aim is to allow for a report-like functionality from a Yaws application, hence the integration between Yaws and ets/Mnesia would avoid the need to export the records to another dbms and and use another web server (I'm becoming an Erlang addict!). The number of record I expect to handle is relatively small (less than 5000), the function is just a call trace log. > e.g > > ets:fun2ms(#cdr{date = Date, result = Res}) when (Date >= StartDate) > and (Date =< EndDate) and (Res == Result) -> true; > (_) -> false > end). > > (Untested, though based on running code in one of my systems). > > Sean > Thanks, Massimo From sean.hinde@REDACTED Wed Nov 12 11:01:54 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 12 Nov 2003 10:01:54 +0000 Subject: How Mnemosyne cursors are used ? In-Reply-To: <1068628566.1525.12.camel@xam> Message-ID: <3E968AA2-14F7-11D8-95BB-000A95927CCE@mac.com> On Wednesday, November 12, 2003, at 09:16 am, Massimo Cesaro wrote: > On Wed, 2003-11-12 at 09:57, Sean Hinde wrote: >> Check out ets:select in all its forms which allows you to retrieve a >> table in chunks. The match syntax would certainly allow you to >> formulate the query you have here. Also check out ets:fun2ms which >> allows easy generation of the match code. >> > I used ets:select and also considered using ets:fun2ms, but what I'd > like to avoid is rewriting persistent cursors logic. > I'm doing the query from a Yaws page. It is a report where I can define > a start date, an end date and the number of lines per page. > Then the page is dynamically generated from Yaws, and each time I click > the "Next" button on the web page, the idea was to pass the cursor > state > as a cookie to continue returning records. I thought of using Mnemosyne > queries as well, but the requirement of initialising the query with > mnemosyne:init_query/1 each time render useless this method as well. > My aim is to allow for a report-like functionality from a Yaws > application, hence the integration between Yaws and ets/Mnesia would > avoid the need to export the records to another dbms and and use > another > web server (I'm becoming an Erlang addict!). > The number of record I expect to handle is relatively small (less than > 5000), the function is just a call trace log. You could try to encode the Continuation term returned from ets:select/3 and pass back it as the cookie. Sean From massimo.cesaro@REDACTED Wed Nov 12 12:00:23 2003 From: massimo.cesaro@REDACTED (Massimo Cesaro) Date: 12 Nov 2003 12:00:23 +0100 Subject: How Mnemosyne cursors are used ? In-Reply-To: <3E968AA2-14F7-11D8-95BB-000A95927CCE@mac.com> References: <3E968AA2-14F7-11D8-95BB-000A95927CCE@mac.com> Message-ID: <1068634824.1529.20.camel@xam> On Wed, 2003-11-12 at 11:01, Sean Hinde wrote: > > On Wednesday, November 12, 2003, at 09:16 am, Massimo Cesaro wrote: > > > On Wed, 2003-11-12 at 09:57, Sean Hinde wrote: > >> Check out ets:select in all its forms which allows you to retrieve a > >> table in chunks. The match syntax would certainly allow you to > >> formulate the query you have here. Also check out ets:fun2ms which > >> allows easy generation of the match code. > >> > > You could try to encode the Continuation term returned from > ets:select/3 and pass back it as the cookie. Yes, I think that make sense. I simply overlooked it because I was too much focused on Mnemosyne queries. Probably using ets:select/3 and ets:fun2ms to generate queries (like you suggested in your first answer), and then passing subsequent client requests using the Continuation term with ets:select/1 is the solution to this problem. > > Sean Again, thank you for the support Sean. Massimo > From erlang@REDACTED Wed Nov 12 12:47:53 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 12 Nov 2003 11:47:53 +0000 Subject: mention of Erlang on EETimes. Message-ID: <20031112114753.68e7a356.erlang@manderp.freeserve.co.uk> Hi Gurus, This story was published a while back and the reference to Erlang is fleeting, but it is in there. http://www.eetimes.com/story/OEG20030818S0080 -- "The Tao of Programming flows far away and returns on the wind of morning." From D.WILLIAMS@REDACTED Wed Nov 12 15:05:33 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Wed, 12 Nov 2003 15:05:33 +0100 Subject: binaries vs lists Message-ID: Raimo Niskanen wrote: > About stack space vs heap space. [...] Thanks. Useful and interesting advice. Regards, Dominic Williams. From klacke@REDACTED Wed Nov 12 15:26:09 2003 From: klacke@REDACTED (Klacke) Date: Wed, 12 Nov 2003 15:26:09 +0100 Subject: inets question, performance running time? In-Reply-To: References: <002301c3a462$b86f7b90$2001a8c0@bryans> Message-ID: <20031112142609.GA15142@bluetail.com> On Thu, Nov 06, 2003 at 03:21:00PM +0100, Vlad Dumitrescu wrote: > Hi, > > I don't have a guide to making it run on Windows, but the main problem is related to the configure script and the makefile defining things like for example > > ERL="/cygdrive/c/program/erl/bin/erl" > which should in fact read > ERL=/cygdrive/c/program/erl/bin/erl > i.e. whithout quotes. > Quotes should be there. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From enewhuis@REDACTED Wed Nov 12 15:46:38 2003 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 12 Nov 2003 08:46:38 -0600 Subject: doesn't tapestry sound like it should be written in erlang? In-Reply-To: References: <000001c3a787$4f491900$2001a8c0@bryans> <1068564147.552.21.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <050C7F06-151F-11D8-8363-000A95D9A520@futuresource.com> I think we must determine who invented the first physical trash can if proper credit can be given at all. Pressing even further we must determine who created the first trash. > a difference. People still thought it was a novelty to be able to use > a trashcan icon on the desktop, and half the world probably still > believes Bill Gates invented the concept. ;-) From vlad_dumitrescu@REDACTED Wed Nov 12 16:05:34 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 12 Nov 2003 16:05:34 +0100 Subject: inets question, performance running time? References: <002301c3a462$b86f7b90$2001a8c0@bryans> <20031112142609.GA15142@bluetail.com> Message-ID: From: "Klacke" > > I don't have a guide to making it run on Windows, but the main problem is related to the configure script and the makefile defining things like for example > > > > ERL="/cygdrive/c/program/erl/bin/erl" > > which should in fact read > > ERL=/cygdrive/c/program/erl/bin/erl > > i.e. whithout quotes. > > > > Quotes should be there. Strange, because removing them was the only way I could make it compile. With quites, it tries to find a file with the strange (and illegal) name "/cygdrive/c/program/erl/bin/erl" /Vlad From luke@REDACTED Wed Nov 12 16:47:00 2003 From: luke@REDACTED (Luke Gorrie) Date: 12 Nov 2003 16:47:00 +0100 Subject: mention of Erlang on EETimes. In-Reply-To: <20031112114753.68e7a356.erlang@manderp.freeserve.co.uk> References: <20031112114753.68e7a356.erlang@manderp.freeserve.co.uk> Message-ID: Peter-Henry Mander writes: > This story was published a while back and the reference to Erlang is > fleeting, but it is in there. > > http://www.eetimes.com/story/OEG20030818S0080 That is the most non-sequitur article I have ever read. I would like to see the program that wrote it :-) From luke@REDACTED Wed Nov 12 16:18:28 2003 From: luke@REDACTED (Luke Gorrie) Date: 12 Nov 2003 16:18:28 +0100 Subject: escript problem? In-Reply-To: <3FB1FE06.8050401@ina.fr> References: <3FB1FE06.8050401@ina.fr> Message-ID: Hi Youn?s, I don't know the answer to your question, so I'm Cc'ing this to the erlang-questions@REDACTED mailing list. > I've tried to use escript (http://www.sics.se/~joe/sae.html#escript) > yesterday. When I've test the -mode(compile) the test script crash. > I've attached the test script (test.erl) and the crash dump > (erl_crash.dump.gz). > Could you help me to understand what happen? I would add my question: what's the status of escript? I just noticed that it comes with R9C-0, though in my 'make install' setup it doesn't seem to work. > #!/usr/bin/env escript > > %-mode(compile). > > main(_) -> > {match, ["name","domain.com"]} = > groups(" name@REDACTED ", " *\\([^ ]+\\)@\\([^ ]+\\)"), > > {match, []} = groups("abcd", ".*bc"), > > {match, ["bcd"]} = groups("abcdefgh", "a\\(.*\\)efgh"), > > {match, ["cd","h"]} = groups("abcdefh", ".*\\(c.\\).*\\(.\\)"), > > RE_URL="\\(.+\\)://\\(.+\\)\\(/.+\\)(\\?\\(.*\\)(&\\(.*\\))*)?", > {match, ["http","localhost:80","/script"]} = > groups("http://localhost:80/script", RE_URL), > > {match, ["http","localhost","/script","arg"]} = > groups("http://localhost/script?arg", RE_URL), > > {match, ["http","localhost","/script","arg","arg2"]} = > groups("http://localhost/script?arg&arg2", RE_URL), > > {match, ["http","localhost:81","/script","arg","arg2","arg3"]} = > groups("http://localhost:81/script?arg&arg2&arg3", RE_URL), > {match, ["http","localhost:81","/script","arg","arg2","arg3", "arg4","arg5","arg6"]} = > groups("http://localhost:81/script?arg&arg2&arg3&arg4&arg5&arg6", RE_URL), > ok. > > groups(S, RE) -> > Res = gregexp:groups(S, RE), > io:format("~p: ~p~n", [S, Res]), > Res. From bjarne@REDACTED Wed Nov 12 22:42:32 2003 From: bjarne@REDACTED (=?Windows-1252?Q?Bjarne_D=E4cker?=) Date: Wed, 12 Nov 2003 22:42:32 +0100 Subject: Making reliable distributed systems in the presence of software errors Message-ID: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> http://www.sics.se/~joe/thesis/spikblad.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke@REDACTED Wed Nov 12 23:54:33 2003 From: luke@REDACTED (Luke Gorrie) Date: 12 Nov 2003 23:54:33 +0100 Subject: Making reliable distributed systems in the presence of software errors In-Reply-To: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> References: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> Message-ID: =?Windows-1252?Q?Bjarne_D=E4cker?= writes: > http://www.sics.se/~joe/thesis/spikblad.html Nice typography! :-) From robert.virding@REDACTED Thu Nov 13 00:32:35 2003 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 13 Nov 2003 00:32:35 +0100 Subject: Bug in string.erl References: Message-ID: <005101c3a975$40690cc0$2100a8c0@virding.org> > > Yes it is defintely a bug. The problem is that I was trying to be nice in the case where the desried substring length is longer than the remaining string inwhich case the substring just gets the remaining characters. So > > > > string:substr("abcd", 2, 5) -> "cd" > > > > The second should of course be: > > > > substr1(String, L) when list(String) -> []. %Be nice! > > My goodness - I didn't realise you'd written the code - there was a > comment in it :-) Ah, I must have been feeling benevolent that day. And if you notice it was too informative. :-) Robert From joe@REDACTED Thu Nov 13 11:01:58 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 13 Nov 2003 11:01:58 +0100 (CET) Subject: Making reliable distributed systems in the presence of software errors In-Reply-To: Message-ID: On 12 Nov 2003, Luke Gorrie wrote: > =?Windows-1252?Q?Bjarne_D=E4cker?= writes: > > > http://www.sics.se/~joe/thesis/spikblad.html > > Nice typography! :-) > Thanks - Shameless plug follows. Hello all Erlangers ... You might like to *read* http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf The central problem this thesis is "How to make reliable systems in the presence of software errors". We know how to make reliable systems in the presence of *hardware* errors (answer replicate) - but what about *software* errors - here replication does not help - replicating faulty software doesn't help at all - it just makes matters worse - instead of one failing program we have two failing programs, both of which fail for exactly the same reason. Since most things fail because of software errors this problem seems much more interesting than the "hardware" fault-tolerance problem. Erlang is part of the story - the thesis contains (among other things) - A philosophy of programming (Called Concurrency Oriented Programming) - A description of Erlang - Examples of how to program in Erlang - A method for programming fault tolerant systems - A description of an implementation of this method (ie a description of the major OTP behaviours) - Examples of how to program with the OTP behaviours - Case studies to see if the method works (I claim it does) - A method for specifying the interaction between components (UBF) Much of the material in the thesis can be viewed as "the missing Erlang documentation" since it records not "how things are done" but, more importantly "why things were done" Have a good read /Joe From erlang@REDACTED Thu Nov 13 08:50:26 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 13 Nov 2003 07:50:26 +0000 Subject: Making reliable distributed systems in the presence of software errors In-Reply-To: References: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> Message-ID: <20031113075026.1eb3d1ba.erlang@manderp.freeserve.co.uk> On 12 Nov 2003 23:54:33 +0100 Luke Gorrie wrote: > =?Windows-1252?Q?Bjarne_D=E4cker?= writes: > > > http://www.sics.se/~joe/thesis/spikblad.html > > Nice typography! :-) All the better for reading! Thanks for announcing this Bjarne, and a *huge* thanks to Joe who gives us so much! I so sorry I could not attend the EUC, I would have loved to be there. I may have been able to repay a debt, long overdue, towards all of you who have been an immense help and moral support, and specifically to buy Joe the countless beers I owe him (-: Maybe during next year? Pete. -- "The Tao of Programming flows far away and returns on the wind of morning." From matthias@REDACTED Thu Nov 13 13:51:39 2003 From: matthias@REDACTED (Matthias Lang) Date: Thu, 13 Nov 2003 13:51:39 +0100 Subject: Making reliable distributed systems in the presence of software errors In-Reply-To: <20031113075026.1eb3d1ba.erlang@manderp.freeserve.co.uk> References: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> <20031113075026.1eb3d1ba.erlang@manderp.freeserve.co.uk> Message-ID: <16307.32347.170336.86772@antilipe.corelatus.se> Peter-Henry Mander writes: > I so sorry I could not attend the EUC, I would have loved to > be there. You made me think I'd missed the EUC by a week! But no, the EUC is on Tuesday November 18 2003, so you haven't missed it yet. Matthias From erlang@REDACTED Thu Nov 13 14:19:58 2003 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 13 Nov 2003 13:19:58 +0000 Subject: Making reliable distributed systems in the presence of software errors In-Reply-To: <16307.32347.170336.86772@antilipe.corelatus.se> References: <001a01c3a965$e1c6d080$9f0c69d4@segeltorp> <20031113075026.1eb3d1ba.erlang@manderp.freeserve.co.uk> <16307.32347.170336.86772@antilipe.corelatus.se> Message-ID: <20031113131958.7e9ea48f.erlang@manderp.freeserve.co.uk> On Thu, 13 Nov 2003 13:51:39 +0100 Matthias Lang wrote: > Peter-Henry Mander writes: > > > I so sorry I could not attend the EUC, I would have loved to > > be there. > > You made me think I'd missed the EUC by a week! > > But no, the EUC is on Tuesday November 18 2003, so you haven't missed > it yet. Sorry Matthias, wrong tense. Probably because I'm tense too. But the fact remains, unless I happen to forcefully abducted and taken to Sweden, I shall remain in Blighty during the whole event. *sigh* )-: Pete. -- "The Tao of Programming flows far away and returns on the wind of morning." From enano@REDACTED Fri Nov 14 12:27:08 2003 From: enano@REDACTED (Miguel Barreiro) Date: Fri, 14 Nov 2003 12:27:08 +0100 (CET) Subject: Sendfile in erlang Message-ID: Hi, I'm not sure whether the proper list is e-questions or e-patches, but this is a small patch anyway. This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is a system call present in Linux 2.2, AIX 5 and later kernels, and similar interfaces are present in recent versions of Solaris and possibly other Unices. The usual loop of read()ing from a file and then send()ing to a socket or write()ing to another file has an unnecesarily large overhead: copying data from kernel space to user space on read, and then back to kernel space again on write() or send(). Besides, if we are reading from Erlang, that means getting all those data chunks into the erlang runtime memory management system only to get them out again immediately and then GC them sometime in the future. Very often (think of a web or file server) our program has no use for that read data except sending it out again. Sendfile(f,t,o,c) simply instructs the kernel (the OS kernel, not $ROOTDIR/lib/kernel) to read c bytes at offset o of file descriptor f and write them again to file descriptor t. No data is moved to/from user space. ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down the pipe. Make sure you have a well supported network card before trying. The patch is for testing purposes - I'd be glad to hear comments. I have kept the kernel sendfile semantics: it may write less bytes than requested, just like the send(2) syscall; return value is {ok, SentBytes} or {error, Reason}. Maybe it would be more polite to behave like gen_tcp:send instead and make sure all data is sent, or else return an error. More ugly details: it needs the socket descriptor *number*, so for now you have to call the undocumented function get_fd in prim_inet. An example: {ok,From}=file:open(Filename,[read,raw]), {ok,Sock}=gen_tcp:connect(Host,Port,[binary,{packet,0}]), {ok,SockFD}=prim_inet:getfd(Sock), {ok,Sent}=file:sendfile(From,SockFD,Pos,Block), No guarantees, backup first, parachute not included, etc. Regards, Miguel -------------- next part -------------- diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/common/efile_drv.c ./erts/emulator/drivers/common/efile_drv.c --- ../orig/otp_src_R9B-1/erts/emulator/drivers/common/efile_drv.c Wed Oct 9 16:22:22 2002 +++ ./erts/emulator/drivers/common/efile_drv.c Fri Nov 14 11:42:26 2003 @@ -50,6 +50,7 @@ #define FILE_PREADV 25 #define FILE_SETOPT 26 #define FILE_IPREAD 27 +#define FILE_SENDFILE 28 /* Return codes */ @@ -317,6 +318,11 @@ size_t offset; char name[1]; } read_file; + struct { + Sint destfd; + off_t offset; + size_t size; + } sendfile; } c; char b[1]; }; @@ -799,6 +805,32 @@ invoke_name(data, efile_chdir); } + +static void invoke_sendfile(void *data) +{ + struct t_data *d = (struct t_data *) data; + int fd = (int) d->fd; + int destfd = (int) d->c.sendfile.destfd; + off_t offset = (off_t) d->c.sendfile.offset; + + + if ((d->result_ok = efile_sendfile(&d->errInfo, fd, destfd, offset, + &(d->c.sendfile.size)))) + d->again=0; + else { + switch(d->errInfo.posix_errno){ + case 0: /*ok*/ + case EBADF: + case EINVAL: + case EIO: + d->again = 0; + break; + default: + d->again = 1; + }; + } +} + static void invoke_fsync(void *data) { struct t_data *d = (struct t_data *) data; @@ -1563,6 +1595,12 @@ } free_data(data); break; +#ifdef __linux__ + case FILE_SENDFILE: + reply_Uint(desc, d->c.sendfile.size); + free_data(data); + break; +#endif case FILE_MKDIR: case FILE_RMDIR: case FILE_CHDIR: @@ -1713,6 +1751,22 @@ command = *(uchar*)buf++; switch(command) { + + case FILE_SENDFILE: + { + d = EF_SAFE_ALLOC(sizeof(struct t_data) -1 +20); + + d->fd = fd; + d->c.sendfile.destfd = get_int32(buf); + d->c.sendfile.offset = get_int32(buf + 8); /* TODO: get_64? */ + d->c.sendfile.size = get_int32(buf + 16); /* idem */ + d->command = command; + d->invoke = invoke_sendfile; + d->free = free_data; + d->level = 2; /*?*/ + goto done; + } + case FILE_MKDIR: { diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/common/erl_efile.h ./erts/emulator/drivers/common/erl_efile.h --- ../orig/otp_src_R9B-1/erts/emulator/drivers/common/erl_efile.h Wed Oct 2 23:20:42 2002 +++ ./erts/emulator/drivers/common/erl_efile.h Mon Nov 10 04:35:56 2003 @@ -148,8 +148,10 @@ char* buffer, size_t size); int efile_link(Efile_error* errInfo, char* old, char* new); int efile_symlink(Efile_error* errInfo, char* old, char* new); - - +#ifdef __linux__ +int efile_sendfile(Efile_error* errInfo, int fd, int outfd, off_t offset, + size_t* count); +#endif diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/unix/unix_efile.c ./erts/emulator/drivers/unix/unix_efile.c --- ../orig/otp_src_R9B-1/erts/emulator/drivers/unix/unix_efile.c Wed Oct 2 23:20:57 2002 +++ ./erts/emulator/drivers/unix/unix_efile.c Fri Nov 14 11:43:42 2003 @@ -72,6 +72,10 @@ # endif #endif /* !VXWORKS */ +#ifdef __linux__ +#include +#endif + #ifdef SUNOS4 # define getcwd(buf, size) getwd(buf) #endif @@ -775,6 +779,24 @@ { close(fd); } + + +#ifdef __linux__ +int +efile_sendfile(Efile_error* errInfo, + int fd, + int outfd, + off_t offset, + size_t* countptr + ) +{ + int r; + r=sendfile(outfd, fd, &offset, *countptr); + if(r>=0) *countptr=r; + return check_error(r,errInfo); +} + +#endif int efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ Binary files ../orig/otp_src_R9B-1/lib/kernel/ebin/prim_file.beam and ./lib/kernel/ebin/prim_file.beam differ diff -ur ../orig/otp_src_R9B-1/lib/kernel/src/file.erl ./lib/kernel/src/file.erl --- ../orig/otp_src_R9B-1/lib/kernel/src/file.erl Wed Oct 2 23:15:30 2002 +++ ./lib/kernel/src/file.erl Fri Nov 14 11:34:48 2003 @@ -37,7 +37,7 @@ -export([open/2, close/1, read/2, write/2, pread/2, pread/3, pwrite/2, pwrite/3, - position/2, truncate/1, sync/1, + position/2, truncate/1, sendfile/4, sync/1, copy/2, copy/3]). %% High level operations -export([consult/1, path_consult/2, eval/1, path_eval/2, path_open/3]). @@ -562,6 +562,12 @@ pwrite(_, _, _) -> {error, einval}. + +%enano@REDACTED +sendfile(#file_descriptor{module = Module} = Handle, DestFD, Offset, Bytes) -> + Module:sendfile(Handle, DestFD, Offset, Bytes); +sendfile(Other,_,_,_) -> + {error, einval}. sync(File) when pid(File) -> diff -ur ../orig/otp_src_R9B-1/lib/kernel/src/prim_file.erl ./lib/kernel/src/prim_file.erl --- ../orig/otp_src_R9B-1/lib/kernel/src/prim_file.erl Wed Oct 2 23:30:06 2002 +++ ./lib/kernel/src/prim_file.erl Fri Nov 14 11:35:39 2003 @@ -24,7 +24,7 @@ %%% Interface towards a single file's contents. Uses ?FD_DRV. %% Generic file contents operations --export([open/2, close/1, sync/1, position/2, truncate/1, +-export([open/2, close/1, sendfile/4, sync/1, position/2, truncate/1, write/2, pwrite/2, pwrite/3, read/2, pread/2, pread/3, copy/3]). %% Specialized file operations @@ -92,6 +92,7 @@ -define(FILE_PREADV, 25). -define(FILE_SETOPT, 26). -define(FILE_IPREAD, 27). +-define(FILE_SENDFILE, 28). %% Driver responses -define(FILE_RESP_OK, 0). @@ -284,7 +285,10 @@ pwrite(#file_descriptor{module = ?MODULE}, _, _) -> {error, einval}. - +%% Returns {error, Reason} | ok. +sendfile(Filedes, DestFD, Offset, Bytes) -> + #file_descriptor{module = ?MODULE, data = {Port, _}}=Filedes, + drv_command(Port, <>). %% Returns {error, Reason} | ok. sync(#file_descriptor{module = ?MODULE, data = {Port, _}}) -> From Bengt.Kleberg@REDACTED Fri Nov 14 13:35:30 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Fri, 14 Nov 2003 13:35:30 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: <3FB4CC12.2020402@ericsson.com> Miguel Barreiro wrote: > Hi, > > I'm not sure whether the proper list is e-questions or e-patches, but this > is a small patch anyway. > > This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly other > Unices. The usual loop of read()ing from a file and then send()ing to a while not beeing an unices, this is looks like sys->stream() from inferno. bengt From sean.hinde@REDACTED Fri Nov 14 14:45:38 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 13:45:38 +0000 Subject: Sendfile in erlang In-Reply-To: Message-ID: On Friday, November 14, 2003, at 11:27 am, Miguel Barreiro wrote: > This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is > a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly other > Unices. The usual loop of read()ing from a file and then send()ing to a > socket or write()ing to another file has an unnecesarily large > overhead: > copying data from kernel space to user space on read, and then back to > kernel space again on write() or send(). Besides, if we are reading > from > Erlang, that means getting all those data chunks into the erlang > runtime > memory management system only to get them out again immediately and > then > GC them sometime in the future. Very often (think of a web or file > server) > our program has no use for that read data except sending it out again. > > Sendfile(f,t,o,c) simply instructs the kernel (the OS kernel, not > $ROOTDIR/lib/kernel) to read c bytes at offset o of file descriptor f > and > write them again to file descriptor t. No data is moved to/from user > space. This looks like an excellent addition to Erlang. I'd fully support this being adopted by the OTP team. > ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks > over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of > about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps > down > the pipe. Make sure you have a well supported network card before > trying. The 55Mbps matches well with my measurements on a 1GHz PPC. We would use this tomorrow if it were beefed up with some of your suggestions and the normal OTP extra safe semantics. Brilliant! Sean From luke@REDACTED Fri Nov 14 16:36:58 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 16:36:58 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Miguel Barreiro writes: > ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks > over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of > about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down > the pipe. Make sure you have a well supported network card before trying. Great stuff! Could you please post your benchmark programs too? I'm curious to try the unoptimised version in Oprofile (best program of the year) and see what kills the performance - user/kernel copies, context switches, erlang GC, select(), etc. If I remember correctly, Per Bergqvist was sending 10Mbps through Erlang on Celerons with only a fraction of the CPU with the kpoll'ified emulator. I've long suspected that one could move pretty much the whole network stack into userspace without much performance loss, if you just chose the interface well. I'm interested to find out if this is bollocks :-) P.S., Oprofile is at http://oprofile.sourceforge.net/. It is a whole-system profiler for Linux that will simultaneously profile *everything* on the whole system, including all applications, kernel interrupt handlers, etc. Completely amazing. Cheers, Luke From ulf.wiger@REDACTED Fri Nov 14 16:43:55 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 14 Nov 2003 16:43:55 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: On 14 Nov 2003 16:36:58 +0100, Luke Gorrie wrote: > I've long suspected that one could move pretty much the whole network > stack into userspace without much performance loss, if you just chose > the interface well. I'm interested to find out if this is bollocks :-) My wet dream is that one should always start by developing a reference implementation of any given protocol in Erlang. Then -- only if performance is not good enough -- implement (or buy) one in C. The Erlang-based implementation will help you understand the protocol fully, can serve as an education and testing tool, and should eventually (this should be a goal for the development of Erlang) be the preferred implementation to use in your commercial product. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From hal@REDACTED Fri Nov 14 16:34:58 2003 From: hal@REDACTED (Hal Snyder) Date: Fri, 14 Nov 2003 09:34:58 -0600 Subject: Sendfile in erlang In-Reply-To: (Miguel Barreiro's message of "Fri, 14 Nov 2003 12:27:08 +0100 (CET)") References: Message-ID: <87smkrrmjh.fsf@ghidra.vail> Miguel Barreiro writes: > I'm not sure whether the proper list is e-questions or e-patches, > but this is a small patch anyway. Great idea. Touches on one of my wishes for Erlang. I wish Erlang wrapped nearly all of libc (and libnsl for Solaris), sort of the way Perl does. Being an old C dog, I like to have all my favorite system calls close at hand. It's one reason why Java feels so hampering, like playing the piano with mittens on - Java implementors took away as much of the OS as possible originally (run anywhere, etc), and only restore it under duress. Any time I see an API I want to put a decent intepreter on top of it. It makes a very powerful combination. > Maybe it would be more polite to behave like gen_tcp:send instead > and make sure all data is sent, or else return an error. Having seen Sean's reply I don't want to put a damper on that as he has real use for it. OTOH, I would be ok with libc/system call semantics, see above... > More ugly details: it needs the socket descriptor *number*, so for > now you have to call the undocumented function get_fd in prim_inet Same as above - Sorry for rambling, and again, well done! From luke@REDACTED Fri Nov 14 17:14:00 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 17:14:00 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Ulf Wiger writes: > My wet dream is that one should always start by developing a reference > implementation of any given protocol in Erlang. Then -- only if performance > is not good enough -- implement (or buy) one in C. The Erlang-based > implementation will help you understand the protocol fully, can serve > as an education and testing tool, and should eventually (this should be > a goal for the development of Erlang) be the preferred implementation > to use in your commercial product. Did this just the other month when building a "distributed ethernet switch" out of Linux boxes. There's already a switch in Linux ('bridge' module), we just needed the "distributed" part. No worries - wrote a virtual network device in Erlang with the 'tuntap' application from Jungerl. To Linux it looks like a network card, but frames sent/received just go to Erlang - which tunnels them over UDP between other nodes. Ultimately we did want more performance - the bottleneck seemed to be the user/kernel interface. But by then it was all very well understood, and took one day to port the traffic code into a kernel module. Amazing every now and then when things go as they should. :-) Dream-wise though, I would prefer to use shared-memory between user and kernel space for packet buffers to avoid the copies and keep the logic in userspace. Linux seems to already have features in this direction. -Luke From sean.hinde@REDACTED Fri Nov 14 17:22:39 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 16:22:39 +0000 Subject: Sendfile in erlang In-Reply-To: <87smkrrmjh.fsf@ghidra.vail> Message-ID: > Any time I see an API I want to put a decent intepreter on top of it. > It makes a very powerful combination. > > >> Maybe it would be more polite to behave like gen_tcp:send instead >> and make sure all data is sent, or else return an error. > > Having seen Sean's reply I don't want to put a damper on that as he > has real use for it. OTOH, I would be ok with libc/system call > semantics, see above... Maybe this is what the OTP team also decide, or some combination of direct/indirect mapping. I have great faith in their ability to make these things consistent :-) Sean From luke@REDACTED Fri Nov 14 17:25:30 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 17:25:30 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Luke Gorrie writes: > Dream-wise though, I would prefer to use shared-memory between user > and kernel space for packet buffers to avoid the copies and keep the > logic in userspace. Linux seems to already have features in this > direction. (Isn't performance speculation a dangerous business? Here I assume it's _copying_ that's the bottleneck, which I have no measurements what-so-ever to back up.) From sean.hinde@REDACTED Fri Nov 14 17:42:14 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 16:42:14 +0000 Subject: Sendfile in erlang In-Reply-To: Message-ID: <8021CE51-16C1-11D8-95BB-000A95927CCE@mac.com> On Friday, November 14, 2003, at 03:36 pm, Luke Gorrie wrote: > Miguel Barreiro writes: > >> ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB >> chunks >> over 1000Base-T between 1GHz Pentium3 machines sustains a throughput >> of >> about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps >> down >> the pipe. Make sure you have a well supported network card before >> trying. > > Great stuff! > > Could you please post your benchmark programs too? I'm curious to try > the unoptimised version in Oprofile (best program of the year) and see > what kills the performance - user/kernel copies, context switches, > erlang GC, select(), etc. If I remember correctly, Per Bergqvist was > sending 10Mbps through Erlang on Celerons with only a fraction of the > CPU with the kpoll'ified emulator. That would be superb. I was at a loss in my testing to see what was making things slow. Klacke mentioned to me sometime that he was getting much greater throughput once upon a time so I just put this down to LAN congestion.. Please share any results you get Thanks, Sean From sean.hinde@REDACTED Fri Nov 14 17:22:39 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 16:22:39 +0000 Subject: Sendfile in erlang In-Reply-To: <87smkrrmjh.fsf@ghidra.vail> Message-ID: > Any time I see an API I want to put a decent intepreter on top of it. > It makes a very powerful combination. > > >> Maybe it would be more polite to behave like gen_tcp:send instead >> and make sure all data is sent, or else return an error. > > Having seen Sean's reply I don't want to put a damper on that as he > has real use for it. OTOH, I would be ok with libc/system call > semantics, see above... Maybe this is what the OTP team also decide, or some combination of direct/indirect mapping. I have great faith in their ability to make these things consistent :-) Sean From Bengt.Kleberg@REDACTED Fri Nov 14 13:35:30 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Fri, 14 Nov 2003 13:35:30 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: <3FB4CC12.2020402@ericsson.com> Miguel Barreiro wrote: > Hi, > > I'm not sure whether the proper list is e-questions or e-patches, but this > is a small patch anyway. > > This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly other > Unices. The usual loop of read()ing from a file and then send()ing to a while not beeing an unices, this is looks like sys->stream() from inferno. bengt From sean.hinde@REDACTED Fri Nov 14 14:45:38 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 13:45:38 +0000 Subject: Sendfile in erlang In-Reply-To: Message-ID: On Friday, November 14, 2003, at 11:27 am, Miguel Barreiro wrote: > This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is > a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly other > Unices. The usual loop of read()ing from a file and then send()ing to a > socket or write()ing to another file has an unnecesarily large > overhead: > copying data from kernel space to user space on read, and then back to > kernel space again on write() or send(). Besides, if we are reading > from > Erlang, that means getting all those data chunks into the erlang > runtime > memory management system only to get them out again immediately and > then > GC them sometime in the future. Very often (think of a web or file > server) > our program has no use for that read data except sending it out again. > > Sendfile(f,t,o,c) simply instructs the kernel (the OS kernel, not > $ROOTDIR/lib/kernel) to read c bytes at offset o of file descriptor f > and > write them again to file descriptor t. No data is moved to/from user > space. This looks like an excellent addition to Erlang. I'd fully support this being adopted by the OTP team. > ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks > over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of > about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps > down > the pipe. Make sure you have a well supported network card before > trying. The 55Mbps matches well with my measurements on a 1GHz PPC. We would use this tomorrow if it were beefed up with some of your suggestions and the normal OTP extra safe semantics. Brilliant! Sean From luke@REDACTED Fri Nov 14 17:14:00 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 17:14:00 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Ulf Wiger writes: > My wet dream is that one should always start by developing a reference > implementation of any given protocol in Erlang. Then -- only if performance > is not good enough -- implement (or buy) one in C. The Erlang-based > implementation will help you understand the protocol fully, can serve > as an education and testing tool, and should eventually (this should be > a goal for the development of Erlang) be the preferred implementation > to use in your commercial product. Did this just the other month when building a "distributed ethernet switch" out of Linux boxes. There's already a switch in Linux ('bridge' module), we just needed the "distributed" part. No worries - wrote a virtual network device in Erlang with the 'tuntap' application from Jungerl. To Linux it looks like a network card, but frames sent/received just go to Erlang - which tunnels them over UDP between other nodes. Ultimately we did want more performance - the bottleneck seemed to be the user/kernel interface. But by then it was all very well understood, and took one day to port the traffic code into a kernel module. Amazing every now and then when things go as they should. :-) Dream-wise though, I would prefer to use shared-memory between user and kernel space for packet buffers to avoid the copies and keep the logic in userspace. Linux seems to already have features in this direction. -Luke From ulf.wiger@REDACTED Fri Nov 14 16:43:55 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 14 Nov 2003 16:43:55 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: On 14 Nov 2003 16:36:58 +0100, Luke Gorrie wrote: > I've long suspected that one could move pretty much the whole network > stack into userspace without much performance loss, if you just chose > the interface well. I'm interested to find out if this is bollocks :-) My wet dream is that one should always start by developing a reference implementation of any given protocol in Erlang. Then -- only if performance is not good enough -- implement (or buy) one in C. The Erlang-based implementation will help you understand the protocol fully, can serve as an education and testing tool, and should eventually (this should be a goal for the development of Erlang) be the preferred implementation to use in your commercial product. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From luke@REDACTED Fri Nov 14 16:36:58 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 16:36:58 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Miguel Barreiro writes: > ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks > over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of > about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down > the pipe. Make sure you have a well supported network card before trying. Great stuff! Could you please post your benchmark programs too? I'm curious to try the unoptimised version in Oprofile (best program of the year) and see what kills the performance - user/kernel copies, context switches, erlang GC, select(), etc. If I remember correctly, Per Bergqvist was sending 10Mbps through Erlang on Celerons with only a fraction of the CPU with the kpoll'ified emulator. I've long suspected that one could move pretty much the whole network stack into userspace without much performance loss, if you just chose the interface well. I'm interested to find out if this is bollocks :-) P.S., Oprofile is at http://oprofile.sourceforge.net/. It is a whole-system profiler for Linux that will simultaneously profile *everything* on the whole system, including all applications, kernel interrupt handlers, etc. Completely amazing. Cheers, Luke From hal@REDACTED Fri Nov 14 16:34:58 2003 From: hal@REDACTED (Hal Snyder) Date: Fri, 14 Nov 2003 09:34:58 -0600 Subject: Sendfile in erlang In-Reply-To: (Miguel Barreiro's message of "Fri, 14 Nov 2003 12:27:08 +0100 (CET)") References: Message-ID: <87smkrrmjh.fsf@ghidra.vail> Miguel Barreiro writes: > I'm not sure whether the proper list is e-questions or e-patches, > but this is a small patch anyway. Great idea. Touches on one of my wishes for Erlang. I wish Erlang wrapped nearly all of libc (and libnsl for Solaris), sort of the way Perl does. Being an old C dog, I like to have all my favorite system calls close at hand. It's one reason why Java feels so hampering, like playing the piano with mittens on - Java implementors took away as much of the OS as possible originally (run anywhere, etc), and only restore it under duress. Any time I see an API I want to put a decent intepreter on top of it. It makes a very powerful combination. > Maybe it would be more polite to behave like gen_tcp:send instead > and make sure all data is sent, or else return an error. Having seen Sean's reply I don't want to put a damper on that as he has real use for it. OTOH, I would be ok with libc/system call semantics, see above... > More ugly details: it needs the socket descriptor *number*, so for > now you have to call the undocumented function get_fd in prim_inet Same as above - Sorry for rambling, and again, well done! From enano@REDACTED Fri Nov 14 12:27:08 2003 From: enano@REDACTED (Miguel Barreiro) Date: Fri, 14 Nov 2003 12:27:08 +0100 (CET) Subject: Sendfile in erlang Message-ID: Hi, I'm not sure whether the proper list is e-questions or e-patches, but this is a small patch anyway. This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is a system call present in Linux 2.2, AIX 5 and later kernels, and similar interfaces are present in recent versions of Solaris and possibly other Unices. The usual loop of read()ing from a file and then send()ing to a socket or write()ing to another file has an unnecesarily large overhead: copying data from kernel space to user space on read, and then back to kernel space again on write() or send(). Besides, if we are reading from Erlang, that means getting all those data chunks into the erlang runtime memory management system only to get them out again immediately and then GC them sometime in the future. Very often (think of a web or file server) our program has no use for that read data except sending it out again. Sendfile(f,t,o,c) simply instructs the kernel (the OS kernel, not $ROOTDIR/lib/kernel) to read c bytes at offset o of file descriptor f and write them again to file descriptor t. No data is moved to/from user space. ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down the pipe. Make sure you have a well supported network card before trying. The patch is for testing purposes - I'd be glad to hear comments. I have kept the kernel sendfile semantics: it may write less bytes than requested, just like the send(2) syscall; return value is {ok, SentBytes} or {error, Reason}. Maybe it would be more polite to behave like gen_tcp:send instead and make sure all data is sent, or else return an error. More ugly details: it needs the socket descriptor *number*, so for now you have to call the undocumented function get_fd in prim_inet. An example: {ok,From}=file:open(Filename,[read,raw]), {ok,Sock}=gen_tcp:connect(Host,Port,[binary,{packet,0}]), {ok,SockFD}=prim_inet:getfd(Sock), {ok,Sent}=file:sendfile(From,SockFD,Pos,Block), No guarantees, backup first, parachute not included, etc. Regards, Miguel -------------- next part -------------- diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/common/efile_drv.c ./erts/emulator/drivers/common/efile_drv.c --- ../orig/otp_src_R9B-1/erts/emulator/drivers/common/efile_drv.c Wed Oct 9 16:22:22 2002 +++ ./erts/emulator/drivers/common/efile_drv.c Fri Nov 14 11:42:26 2003 @@ -50,6 +50,7 @@ #define FILE_PREADV 25 #define FILE_SETOPT 26 #define FILE_IPREAD 27 +#define FILE_SENDFILE 28 /* Return codes */ @@ -317,6 +318,11 @@ size_t offset; char name[1]; } read_file; + struct { + Sint destfd; + off_t offset; + size_t size; + } sendfile; } c; char b[1]; }; @@ -799,6 +805,32 @@ invoke_name(data, efile_chdir); } + +static void invoke_sendfile(void *data) +{ + struct t_data *d = (struct t_data *) data; + int fd = (int) d->fd; + int destfd = (int) d->c.sendfile.destfd; + off_t offset = (off_t) d->c.sendfile.offset; + + + if ((d->result_ok = efile_sendfile(&d->errInfo, fd, destfd, offset, + &(d->c.sendfile.size)))) + d->again=0; + else { + switch(d->errInfo.posix_errno){ + case 0: /*ok*/ + case EBADF: + case EINVAL: + case EIO: + d->again = 0; + break; + default: + d->again = 1; + }; + } +} + static void invoke_fsync(void *data) { struct t_data *d = (struct t_data *) data; @@ -1563,6 +1595,12 @@ } free_data(data); break; +#ifdef __linux__ + case FILE_SENDFILE: + reply_Uint(desc, d->c.sendfile.size); + free_data(data); + break; +#endif case FILE_MKDIR: case FILE_RMDIR: case FILE_CHDIR: @@ -1713,6 +1751,22 @@ command = *(uchar*)buf++; switch(command) { + + case FILE_SENDFILE: + { + d = EF_SAFE_ALLOC(sizeof(struct t_data) -1 +20); + + d->fd = fd; + d->c.sendfile.destfd = get_int32(buf); + d->c.sendfile.offset = get_int32(buf + 8); /* TODO: get_64? */ + d->c.sendfile.size = get_int32(buf + 16); /* idem */ + d->command = command; + d->invoke = invoke_sendfile; + d->free = free_data; + d->level = 2; /*?*/ + goto done; + } + case FILE_MKDIR: { diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/common/erl_efile.h ./erts/emulator/drivers/common/erl_efile.h --- ../orig/otp_src_R9B-1/erts/emulator/drivers/common/erl_efile.h Wed Oct 2 23:20:42 2002 +++ ./erts/emulator/drivers/common/erl_efile.h Mon Nov 10 04:35:56 2003 @@ -148,8 +148,10 @@ char* buffer, size_t size); int efile_link(Efile_error* errInfo, char* old, char* new); int efile_symlink(Efile_error* errInfo, char* old, char* new); - - +#ifdef __linux__ +int efile_sendfile(Efile_error* errInfo, int fd, int outfd, off_t offset, + size_t* count); +#endif diff -ur ../orig/otp_src_R9B-1/erts/emulator/drivers/unix/unix_efile.c ./erts/emulator/drivers/unix/unix_efile.c --- ../orig/otp_src_R9B-1/erts/emulator/drivers/unix/unix_efile.c Wed Oct 2 23:20:57 2002 +++ ./erts/emulator/drivers/unix/unix_efile.c Fri Nov 14 11:43:42 2003 @@ -72,6 +72,10 @@ # endif #endif /* !VXWORKS */ +#ifdef __linux__ +#include +#endif + #ifdef SUNOS4 # define getcwd(buf, size) getwd(buf) #endif @@ -775,6 +779,24 @@ { close(fd); } + + +#ifdef __linux__ +int +efile_sendfile(Efile_error* errInfo, + int fd, + int outfd, + off_t offset, + size_t* countptr + ) +{ + int r; + r=sendfile(outfd, fd, &offset, *countptr); + if(r>=0) *countptr=r; + return check_error(r,errInfo); +} + +#endif int efile_fsync(Efile_error *errInfo, /* Where to return error codes. */ Binary files ../orig/otp_src_R9B-1/lib/kernel/ebin/prim_file.beam and ./lib/kernel/ebin/prim_file.beam differ diff -ur ../orig/otp_src_R9B-1/lib/kernel/src/file.erl ./lib/kernel/src/file.erl --- ../orig/otp_src_R9B-1/lib/kernel/src/file.erl Wed Oct 2 23:15:30 2002 +++ ./lib/kernel/src/file.erl Fri Nov 14 11:34:48 2003 @@ -37,7 +37,7 @@ -export([open/2, close/1, read/2, write/2, pread/2, pread/3, pwrite/2, pwrite/3, - position/2, truncate/1, sync/1, + position/2, truncate/1, sendfile/4, sync/1, copy/2, copy/3]). %% High level operations -export([consult/1, path_consult/2, eval/1, path_eval/2, path_open/3]). @@ -562,6 +562,12 @@ pwrite(_, _, _) -> {error, einval}. + +%enano@REDACTED +sendfile(#file_descriptor{module = Module} = Handle, DestFD, Offset, Bytes) -> + Module:sendfile(Handle, DestFD, Offset, Bytes); +sendfile(Other,_,_,_) -> + {error, einval}. sync(File) when pid(File) -> diff -ur ../orig/otp_src_R9B-1/lib/kernel/src/prim_file.erl ./lib/kernel/src/prim_file.erl --- ../orig/otp_src_R9B-1/lib/kernel/src/prim_file.erl Wed Oct 2 23:30:06 2002 +++ ./lib/kernel/src/prim_file.erl Fri Nov 14 11:35:39 2003 @@ -24,7 +24,7 @@ %%% Interface towards a single file's contents. Uses ?FD_DRV. %% Generic file contents operations --export([open/2, close/1, sync/1, position/2, truncate/1, +-export([open/2, close/1, sendfile/4, sync/1, position/2, truncate/1, write/2, pwrite/2, pwrite/3, read/2, pread/2, pread/3, copy/3]). %% Specialized file operations @@ -92,6 +92,7 @@ -define(FILE_PREADV, 25). -define(FILE_SETOPT, 26). -define(FILE_IPREAD, 27). +-define(FILE_SENDFILE, 28). %% Driver responses -define(FILE_RESP_OK, 0). @@ -284,7 +285,10 @@ pwrite(#file_descriptor{module = ?MODULE}, _, _) -> {error, einval}. - +%% Returns {error, Reason} | ok. +sendfile(Filedes, DestFD, Offset, Bytes) -> + #file_descriptor{module = ?MODULE, data = {Port, _}}=Filedes, + drv_command(Port, <>). %% Returns {error, Reason} | ok. sync(#file_descriptor{module = ?MODULE, data = {Port, _}}) -> From luke@REDACTED Fri Nov 14 17:25:30 2003 From: luke@REDACTED (Luke Gorrie) Date: 14 Nov 2003 17:25:30 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: Luke Gorrie writes: > Dream-wise though, I would prefer to use shared-memory between user > and kernel space for packet buffers to avoid the copies and keep the > logic in userspace. Linux seems to already have features in this > direction. (Isn't performance speculation a dangerous business? Here I assume it's _copying_ that's the bottleneck, which I have no measurements what-so-ever to back up.) From sean.hinde@REDACTED Fri Nov 14 17:42:14 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 14 Nov 2003 16:42:14 +0000 Subject: Sendfile in erlang In-Reply-To: Message-ID: <8021CE51-16C1-11D8-95BB-000A95927CCE@mac.com> On Friday, November 14, 2003, at 03:36 pm, Luke Gorrie wrote: > Miguel Barreiro writes: > >> ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB >> chunks >> over 1000Base-T between 1GHz Pentium3 machines sustains a throughput >> of >> about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps >> down >> the pipe. Make sure you have a well supported network card before >> trying. > > Great stuff! > > Could you please post your benchmark programs too? I'm curious to try > the unoptimised version in Oprofile (best program of the year) and see > what kills the performance - user/kernel copies, context switches, > erlang GC, select(), etc. If I remember correctly, Per Bergqvist was > sending 10Mbps through Erlang on Celerons with only a fraction of the > CPU with the kpoll'ified emulator. That would be superb. I was at a loss in my testing to see what was making things slow. Klacke mentioned to me sometime that he was getting much greater throughput once upon a time so I just put this down to LAN congestion.. Please share any results you get Thanks, Sean From cpressey@REDACTED Sat Nov 15 21:00:00 2003 From: cpressey@REDACTED (Chris Pressey) Date: Sat, 15 Nov 2003 12:00:00 -0800 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: <20031115120000.71ca5efd.cpressey@catseye.mine.nu> On Fri, 14 Nov 2003 12:27:08 +0100 (CET) Miguel Barreiro wrote: > > Hi, > > I'm not sure whether the proper list is e-questions or e-patches, but > this is a small patch anyway. > > This draft patch adds a sendfile() interface to Erlang. Yowza! :) > Sendfile(2) is a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly > other Unices. Yes, it's in FreeBSD as well. I've adapted the patch for FreeBSD; it builds alright, but I haven't had time to test it yet. I've included it in an experimental & unofficial port skeleton for Erlang, which can be found at: http://catseye.webhop.net/freebsd/ports/lang/erlang/ -Chris From alexey@REDACTED Sun Nov 16 17:58:32 2003 From: alexey@REDACTED (Alexey Shchepin) Date: Sun, 16 Nov 2003 18:58:32 +0200 Subject: ejabberd 0.5 released Message-ID: <87u154uu6f.fsf@alex.sevcom.net> Hi! I would like to announce the first stable release of ejabberd 0.5. ejabberd is a Free and Open Source fault-tolerant distributed Jabber server. It is writen mostly in Erlang. The main features of ejabberd is: * Works on most of popular platforms: *nix (tested on Linux, FreeBSD and NetBSD) and Win32 * Distributed: You can run ejabberd on a cluster of machines and all of them will serve one Jabber domain. * Fault-tolerance: You can setup an ejabberd cluster so that all the information required for a properly working service will be stored permanently on more than one node. This means that if one of the nodes crashes, then the others will continue working without disruption. You can also add or replace more nodes ``on the fly''. * Built-in Multi-User Chat service * Built-in IRC transport * Built-in Publish-Subscribe service * Built-in Jabber Users Directory service based on users vCards From bruce@REDACTED Sun Nov 16 22:27:36 2003 From: bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 17 Nov 2003 10:27:36 +1300 Subject: ejabberd 0.5 released In-Reply-To: <87u154uu6f.fsf@alex.sevcom.net> References: <87u154uu6f.fsf@alex.sevcom.net> Message-ID: <1069018056.19276.3.camel@localhost> On Mon, 2003-11-17 at 05:58, Alexey Shchepin wrote: > Hi! > > I would like to announce the first stable release of ejabberd 0.5. Awesome...I'll download and install it the moment you tell us where it is. I'm looking forward to having a decent Jabberd for our company :-) /Bruce -- Bruce Fitzsimons From per@REDACTED Mon Nov 17 07:14:15 2003 From: per@REDACTED (Per Bergqvist) Date: Mon, 17 Nov 2003 07:14:15 +0100 Subject: Sendfile in erlang In-Reply-To: Message-ID: <200311170614.hAH6EFF16657@tessla.levonline.com> Hi, Just a note if you consider introducing this as standard in OTP... (just hoping ...) I did a similiar thing a couple of years ago with similiar results. The difference was that I introduces a new send directive to gen_tcp which allowed to mixing gen_tcp:send and gen_tcp:sendfile call on the socket. Also added a send_urgent directive to send urgent tcp data ... /Per ------------------- > > Hi, > > I'm not sure whether the proper list is e-questions or e-patches, but this > is a small patch anyway. > > This draft patch adds a sendfile() interface to Erlang. Sendfile(2) is a > system call present in Linux 2.2, AIX 5 and later kernels, and similar > interfaces are present in recent versions of Solaris and possibly other > Unices. The usual loop of read()ing from a file and then send()ing to a > socket or write()ing to another file has an unnecesarily large overhead: > copying data from kernel space to user space on read, and then back to > kernel space again on write() or send(). Besides, if we are reading from > Erlang, that means getting all those data chunks into the erlang runtime > memory management system only to get them out again immediately and then > GC them sometime in the future. Very often (think of a web or file server) > our program has no use for that read data except sending it out again. > > Sendfile(f,t,o,c) simply instructs the kernel (the OS kernel, not > $ROOTDIR/lib/kernel) to read c bytes at offset o of file descriptor f and > write them again to file descriptor t. No data is moved to/from user > space. > > > ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks > over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of > about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down > the pipe. Make sure you have a well supported network card before trying. > > The patch is for testing purposes - I'd be glad to hear comments. I have > kept the kernel sendfile semantics: it may write less bytes than > requested, just like the send(2) syscall; return value is {ok, SentBytes} > or {error, Reason}. Maybe it would be more polite to behave like > gen_tcp:send instead and make sure all data is sent, or else return an > error. More ugly details: it needs the socket descriptor *number*, so for > now you have to call the undocumented function get_fd in prim_inet. An > example: > > {ok,From}=file:open(Filename,[read,raw]), > {ok,Sock}=gen_tcp:connect(Host,Port,[binary,{packet,0}]), > {ok,SockFD}=prim_inet:getfd(Sock), > {ok,Sent}=file:sendfile(From,SockFD,Pos,Block), > > > No guarantees, backup first, parachute not included, etc. > > Regards, > > Miguel > From tobbe@REDACTED Mon Nov 17 09:25:09 2003 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 17 Nov 2003 09:25:09 +0100 Subject: ejabberd 0.5 released In-Reply-To: <1069018056.19276.3.camel@localhost> References: <87u154uu6f.fsf@alex.sevcom.net> <1069018056.19276.3.camel@localhost> Message-ID: <3FB885E5.6030602@bluetail.com> I guess this is the homepage: http://ejabberd.jabberstudio.org/ Cheers, Tobbe Bruce Fitzsimons wrote: >On Mon, 2003-11-17 at 05:58, Alexey Shchepin wrote: > > >>Hi! >> >>I would like to announce the first stable release of ejabberd 0.5. >> >> > >Awesome...I'll download and install it the moment you tell us where it >is. I'm looking forward to having a decent Jabberd for our company :-) > >/Bruce > > > From p-news@REDACTED Mon Nov 17 09:31:31 2003 From: p-news@REDACTED (Per Einar =?iso-8859-1?q?Str=F6mme?=) Date: Mon, 17 Nov 2003 09:31:31 +0100 Subject: ejabberd 0.5 released In-Reply-To: <1069018056.19276.3.camel@localhost> References: <87u154uu6f.fsf@alex.sevcom.net> <1069018056.19276.3.camel@localhost> Message-ID: <200311170931.31613.p-news@telia.com> s Hej Bruce ! > > Awesome...I'll download and install it the moment you tell us where it > is. Looks like this is the place: http://www.jabber.org/ Look under Download/servers Rgrds Per Einar -------------------------------------------------------------------------------- Per Einar Str?mme p-news@REDACTED -------------------------------------------------------------------------------- s?ndagen den 16 november 2003 22.27 wrote Bruce Fitzsimons: > On Mon, 2003-11-17 at 05:58, Alexey Shchepin wrote: > > Hi! > > > > I would like to announce the first stable release of ejabberd 0.5. > > Awesome...I'll download and install it the moment you tell us where it > is. I'm looking forward to having a decent Jabberd for our company :-) > > /Bruce From enewhuis@REDACTED Sun Nov 16 03:23:51 2003 From: enewhuis@REDACTED (Eric Newhuis) Date: Sat, 15 Nov 2003 20:23:51 -0600 Subject: UML <-> Erlang Message-ID: Anyone tried mapping UML to Erlang / Erlang to UML? www.gentleware.com has a nice-looking UML tool. It would be nice to reverse-engineer my OTP-based code to avoid building the diagrams from scratch. On a related subject I believe Ward-Mellor DFD might be the closest match to Erlang in finding a visual language for design. I'd like to conjecture that the Erlang programming model and Ward-Mellor DFD are equivalent (like Elliptical Curves and Modular Forms are equivalent) but I won't be so bold. Sincerely, Eric Newhuis From jerome@REDACTED Mon Nov 17 12:48:49 2003 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Mon, 17 Nov 2003 12:48:49 +0100 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: <01ED391C-18F4-11D8-B58B-003065E00134@desquilbet.org> There may be an impedance mismatch between UML (object-oriented) and Erlang (functional and process-oriented). Not to say that it is impossible, but to say that several different approaches to map UML and Erlang could be equally valid. The best I think would be to start from example, like yours maybe, and see what it would give in UML. Then to generalize and define precise mapping rules, that could be implemented in a tool. I am curious to see examples of the mappings you have in mind. Thanks, J?r?me. Le 16 nov. 03, ? 03:23, Eric Newhuis a ?crit : > Anyone tried mapping UML to Erlang / Erlang to UML? > > www.gentleware.com has a nice-looking UML tool. It would be nice to > reverse-engineer my OTP-based code to avoid building the diagrams from > scratch. > > On a related subject I believe Ward-Mellor DFD might be the closest > match to Erlang in finding a visual language for design. I'd like to > conjecture that the Erlang programming model and Ward-Mellor DFD are > equivalent (like Elliptical Curves and Modular Forms are equivalent) > but I won't be so bold. > > Sincerely, > Eric Newhuis > From Bengt.Kleberg@REDACTED Mon Nov 17 13:47:06 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 17 Nov 2003 13:47:06 +0100 Subject: Sendfile in erlang In-Reply-To: References: Message-ID: <3FB8C34A.8040403@ericsson.com> > On 14 Nov 2003 16:36:58 +0100, Luke Gorrie wrote: > >> I've long suspected that one could move pretty much the whole network >> stack into userspace without much performance loss, if you just chose >> the interface well. I'm interested to find out if this is bollocks :-) > since the Tanenbaum vs Torvalds discussion more than 10 years ago ''everybody knows'' that macrokernels are better (as in faster) than microkernels. but the potential of microkernels to let the user choose the interface has shown very substantial performance boosts. see http://www.pdos.lcs.mit.edu/exo . bengt From ulf.wiger@REDACTED Mon Nov 17 13:52:32 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 17 Nov 2003 13:52:32 +0100 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: On Sat, 15 Nov 2003 20:23:51 -0600, Eric Newhuis wrote: > Anyone tried mapping UML to Erlang / Erlang to UML? I've looked into it from time to time, but never actually tried implementing it (partly because I don't think it's altogether a great idea.) One could do partial mappings, but I think it would be important to be clear about which things do not map well. Here's my biggest gripe: UML 1.5 doesn't support synchronous calls (UML 2.0 does, but IMHO not necessarily well). The fundamental principle of UML is event-based programming, which is only a subset of what Erlang programming is about. Thus, if you would specify your program using UML and go to too much semantic detail, you would unecessarily (and perhaps even dangerously) limit yourself in your programming. You'd also have a hard time modeling selective receive, process linking and exit semantics (e.g. supervision trees and other recovery semantics.) UML doesn't offer any means of specifying fine-grained error recovery, as far as I can tell. Using UML for some structure diagrams is OK, as long as you pick abstractions that map well to Erlang. But specifying concurrency aspects in UML is about as much fun as a root canal, compared to doing it in Erlang from scratch. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From enano@REDACTED Mon Nov 17 13:55:31 2003 From: enano@REDACTED (Miguel Barreiro) Date: Mon, 17 Nov 2003 13:55:31 +0100 (CET) Subject: Sendfile in erlang In-Reply-To: References: Message-ID: > Could you please post your benchmark programs too? I'm curious to try My original test case was a bit buried inside much larger code - I guess a simpler test case like this will be best suited so anyone can try it. Just create a large enough file, create listeners on the receiving end and start a network performance monitoring tool. I suggest netcat to receive the streams ("nc -v -l -p 10000 >/dev/null" from the unix shell to listen on port 10000 and send received data to the bit bucket), and nload ("nload -t 1000 -o 500000 -i 500000") to display a nice ASCII graph - for those not openview-oriented, that is :-) > the unoptimised version in Oprofile (best program of the year) and see > what kills the performance - user/kernel copies, context switches, > erlang GC, select(), etc. If I remember correctly, Per Bergqvist was > sending 10Mbps through Erlang on Celerons with only a fraction of the > CPU with the kpoll'ified emulator. Kpoll is something I want to test, too. BTW, I'm pretty amazed by Oprofile. Great hint. Regards, Miguel -------------- next part -------------- -module(sftest). -author('enano@REDACTED'). -compile(export_all). -define(BLOCK,4096). -define(NUMBLOCKS,65536). % Usage: create a large file (at least 2*?BLOCK*?NUMBLOCKS), create a few % listeners on the receiving end (say, nc -l -v -p 10000 >/dev/null), launch % a network performance monitor. Try nload -t 1000 for a nice ASCII graph. % start(File_to_send, Dest_host, Base_dest_port, Number_of_concurrent_senders) start() -> start("bigfile","matrix5",10000,4). start(File,Host,BasePort,0) -> ok; start(File,Host,BasePort,Num) -> spawn(?MODULE,task,[File,Host,BasePort+Num-1]), start(File,Host,BasePort,Num-1). task(Filename,Host,Port) -> io:format("~n~p -> ~p:~p",[Filename,Host,Port]), {ok,File}=file:open(Filename,[read,raw]), {ok,Sock}=gen_tcp:connect(Host,Port,[binary,{packet,0}]), {Time,_}=timer:tc(?MODULE,loop_send,[File,Sock,?NUMBLOCKS]), io:format("~nloop_send: ~p usecs~n",[Time]), {ok,SockFD}=prim_inet:getfd(Sock), {Time2,_}=timer:tc(?MODULE,loop_sendfile,[File,SockFD,?NUMBLOCKS]), io:format("~nloop_sendfile: ~p usecs~n",[Time2]), receive after 2000 -> ok end. % loop_send(From_descriptor, To_descriptor, Number_of_iterations) loop_send(From,To,0) -> ok; loop_send(From,To,Iters) -> {ok,Bin}=file:read(From,?BLOCK), gen_tcp:send(To,Bin), loop_send(From,To,Iters-1). % loop_sendfile(From_descriptor, To_descriptor, Number_of_iterations) loop_sendfile(From,To,Iters) -> loop_sendfile(From,To,0,Iters). loop_sendfile(_,_,_,0) -> ok; loop_sendfile(From,To,Pos,Iters) -> do_sendfile(From,To,Pos,?BLOCK), loop_sendfile(From,To,Pos+?BLOCK,Iters-1). do_sendfile(From,To,Pos,Block) -> {ok,Sent}=file:sendfile(From,To,Pos,Block), if Sent==Block -> ok; true -> do_sendfile(From,To,Pos+Sent,Block-Sent) end. From enano@REDACTED Mon Nov 17 15:25:13 2003 From: enano@REDACTED (Miguel Barreiro) Date: Mon, 17 Nov 2003 15:25:13 +0100 (CET) Subject: Sendfile in erlang In-Reply-To: <87smkrrmjh.fsf@ghidra.vail> References: <87smkrrmjh.fsf@ghidra.vail> Message-ID: > I wish Erlang wrapped nearly all of libc (and libnsl for Solaris), > sort of the way Perl does. Being an old C dog, I like to have all my So do I - I've often wished some ioctl / fcntl functions had an erlang equivalence, for example. From HEINRICH.VENTER@REDACTED Mon Nov 17 15:19:59 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Mon, 17 Nov 2003 16:19:59 +0200 Subject: UML <-> Erlang Message-ID: If UML is not that well suited to Erlang, what tool is? Our own needs entail things like specifying module interfaces (OTP gen_server etc), selective receive interfaces and process relationships (parents, siblings resource owners etc). UML should be fine for expressing the interfaces clearly. But like Uffe said, thats only half the story :) What do some of the other people use to model with? -]-[ ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From enano@REDACTED Mon Nov 17 15:43:33 2003 From: enano@REDACTED (Miguel Barreiro) Date: Mon, 17 Nov 2003 15:43:33 +0100 (CET) Subject: Sendfile in erlang In-Reply-To: <200311170614.hAH6EFF16657@tessla.levonline.com> References: <200311170614.hAH6EFF16657@tessla.levonline.com> Message-ID: > The difference was that I introduces a new send directive to > gen_tcp which allowed to mixing gen_tcp:send and gen_tcp:sendfile call > on the socket. That would be even cleaner. However, sendfile() destination can be a TCP or UDP socket. It could even be a file, although it's not yet implemented. The only requirement is that the source is a "real" file and not a socket, named pipe or device. From enewhuis@REDACTED Mon Nov 17 15:44:46 2003 From: enewhuis@REDACTED (Eric Newhuis) Date: Mon, 17 Nov 2003 08:44:46 -0600 Subject: UML <-> Erlang In-Reply-To: <01ED391C-18F4-11D8-B58B-003065E00134@desquilbet.org> References: <01ED391C-18F4-11D8-B58B-003065E00134@desquilbet.org> Message-ID: <96E3CC9A-190C-11D8-AF02-000A95D9A520@futuresource.com> Well for starters... I'm not sure I understand the mismatch between OO and Erlang. OO to me is a way of thinking about design. And Erlang is a specific programming language. There seem to be many things from the OO perspective that are realized perfectly in Erlang. Even OO has modeled the notion of a process. An "active object", as it has been called, is an object with its own local thread of control. This has been explained previously as a class that has a constructor that starts a thread that executes the "real code" while the class interface functions post messages onto the thread's message queue for dispatching. Thus methods can execute asynchronously w.r.t each instance/object. Taking an approach like this it would be a simple matter to port the "structure" of Erlang code to C++. (Not too sure about the functional bits. Replacing pattern matching and LCO with C++ counterparts would be almost but not quite the exact opposite of pleasure.) One can model active objects in UML. Perhaps one should even declare a stereotype <> to denote such classes in the design. Then, whenever one sees one of these <> stereotypes in the design one knows that one is (potentially) dealing with an asynchronously communicating parallel process (methods can still be synchronous or asynchronous case by case). Incidentally one of the reasons I decided to use Erlang was because I understood the ActiveObject pattern and I was thrilled to see how easy it was to implement in Erlang. Most of our code is like an ActiveObject. A gen_server is an ActiveObject. Erlang is far more general purpose, however, and so if I would like to communicate design intentions less ambiguously I should use a stereotype. ActiveObject seems to carry the same implications both in C++ and Erlang. And I can use UML to assist in the design of either approach. I think UML through association with specific OO programming languages may have left its more theoretical roots. Grady Booch, one of the early men behind UML has long supported the asynchronous communicating process concepts in his design methodology. Hopefully those interested in UML can still find those aspects that suit UML well for this mode of thinking. -e > There may be an impedance mismatch between UML (object-oriented) and > Erlang (functional and process-oriented). Not to say that it is > impossible, but to say that several different approaches to map UML > and Erlang could be equally valid. > The best I think would be to start from example, like yours maybe, and > see what it would give in UML. Then to generalize and define precise > mapping rules, that could be implemented in a tool. I am curious to > see examples of the mappings you have in mind. From seungbong_han@REDACTED Mon Nov 17 19:45:15 2003 From: seungbong_han@REDACTED (SEUNG BONG HAN) Date: Mon, 17 Nov 2003 10:45:15 -0800 (PST) Subject: IDL rescursive structure. Message-ID: <20031117184516.98986.qmail@web10104.mail.yahoo.com> Can I compile this IDL in ic module? struct A { long i; sequence next; }; It seems like OMG IDL supports that syntax but when I tried to compile it in IC, I got an error. I am using R9C-0 in NetBSD 1.6.1 regards,. --------------------------------- Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Mon Nov 17 19:48:49 2003 From: vances@REDACTED (Vance Shipley) Date: Mon, 17 Nov 2003 13:48:49 -0500 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: <20031117184849.GC13259@frogman.motivity.ca> On Mon, Nov 17, 2003 at 04:19:59PM +0200, HEINRICH VENTER wrote: } If UML is not that well suited to Erlang, what tool is? SDL. -Vance From matthias@REDACTED Mon Nov 17 20:32:33 2003 From: matthias@REDACTED (Matthias Lang) Date: Mon, 17 Nov 2003 20:32:33 +0100 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: <16313.8785.829470.968201@antilipe.corelatus.se> HEINRICH VENTER writes: > Our own needs entail things like specifying module interfaces > (OTP gen_server etc), selective receive interfaces and process > relationships (parents, siblings resource owners etc). > What do some of the other people use to model with? Maurice Castro presented an interesting paper at the 1999 Erlang Users' Conference. His paper looks at the questions you're asking. It's archived at http://www.erlang.se/euc/99/Event.ps or, if you don't have a postscript viewer and are prepared to put up with really blurry text: http://www.serc.rmit.edu.au/70erlangtr/SERC-0096.pdf I don't use this notation. The only diagrams I draw are supervision trees. I have implemented several things which were specified in SDL. It's fairly easy to translate them straight into Erlang, but I've never felt inspired to go the other way, i.e. use SDL as a way to document Erlang. Matthias From alexey@REDACTED Mon Nov 17 21:48:11 2003 From: alexey@REDACTED (Alexey Shchepin) Date: Mon, 17 Nov 2003 22:48:11 +0200 Subject: SSL in Erlang/OTP Message-ID: <87islirab8.fsf@alex.sevcom.net> Hi! Can anyone help with following issues with SSL application? * ssl:accept locks when when one TCP connection is established, but SSL handshake is not finished. E.g. if Yaws is listen for SSL connections on port 443 and someone runs "telnet this.server 443" (note that this is not SSL-enabled telnet), then noone will be able to retreive web pages via this port until this connection will be closed. As temporary solution I use ssl:accept with small timeout value, but this is just workaround. IMHO ssl:accept should not have such behaviour. * ssl:send locks if another process runs ssl:recv on the same port. And I can't use "{active, true}" option, because I need flow control. Again, as a temporary solution I use timeout value in ssl:recv/3, so ssl:send can work several times in second. But this makes notable increase of CPU load: e.g. with ejabberd on jabber.ru (~440 connected users, ~100 using SSL) with 20ms timeout -- CPU load is ~40%, with 200ms -- 9-12%, with SSL switched off -- 3-4%. * (Feature Request) Many protocols have some kinds of STARTTLS command (e.g. IMAP, POP3 (RFC2595), Jabber/XMPP). So this would be great to have ability to convert gen_tcp sockets to ssl ones. From tobbe@REDACTED Mon Nov 17 23:04:09 2003 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 17 Nov 2003 23:04:09 +0100 Subject: SSL in Erlang/OTP In-Reply-To: <87islirab8.fsf@alex.sevcom.net> References: <87islirab8.fsf@alex.sevcom.net> Message-ID: <3FB945D9.2090201@bluetail.com> Alexey Shchepin wrote: > >* (Feature Request) Many protocols have some kinds of STARTTLS command > (e.g. IMAP, POP3 (RFC2595), Jabber/XMPP). So this would be great to have > ability to convert gen_tcp sockets to ssl ones. > > You can add LDAP to the above. The 'eldap' code (at sourceforge) supports LDAPS (i.e LDAP over an SSL tunnel), but it would indeed be nice to also have support for STARTTLS. Cheers, Tobbe From enewhuis@REDACTED Mon Nov 17 15:27:28 2003 From: enewhuis@REDACTED (Eric Newhuis) Date: Mon, 17 Nov 2003 08:27:28 -0600 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: <2BE06F58-190A-11D8-AF02-000A95D9A520@wideopenwest.com> What are the odds of a number of Erlang supporters convincing the UML community that there is more work to do to truly have a "Unified" modeling language? Does anyone know how one could accomplish this? Maybe the first step is to list the problems? But perhaps one should also list the things that might work well in UML's present form. I would like to investigate UML in its current state to design some additions to a year-old architecture. I think UML offers a number of possibilities. 1. Since it is standardized, does it have clarity over ad-hoc diagramming approaches when many parties new to Erlang are involved in the design process? 2. Could a class be used to model a gen_server? And if the Erlang application has many gen_servers then wouldn't simple UML class diagrams help illustrate the design better than other approaches? 3. Can UML's state diagrams show some insights on particularly nasty problems? 4. If parts of the system had to be developed in some other language then wouldn't access to a UML design provide a good starting point for coding? 5. Are there other areas where UML would work well with Erlang? From ok@REDACTED Tue Nov 18 03:21:57 2003 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 18 Nov 2003 15:21:57 +1300 (NZDT) Subject: UML <-> Erlang Message-ID: <200311180221.hAI2LvPH255481@atlas.otago.ac.nz> The thing that might _really_ be interesting to map to Erlang is BPMN (Business Process Modelling Notation). Someone with a SAP background told me that BPMN is a _far_ better fit to real business information systems than UML is, and after looking at the BPMN draft for several days I came to the conclusion that it should be possible to map at least a large chunk of BPMN onto Erlang fairly directly. From nick@REDACTED Tue Nov 18 09:30:51 2003 From: nick@REDACTED (Niclas Eklund) Date: Tue, 18 Nov 2003 09:30:51 +0100 (MET) Subject: IDL rescursive structure. In-Reply-To: <20031117184516.98986.qmail@web10104.mail.yahoo.com> Message-ID: Hello! The answer is no; IC doesn't support rescursive structures yet. /Nick On Mon, 17 Nov 2003, SEUNG BONG HAN wrote: > Can I compile this IDL in ic module? > > struct A { > long i; > sequence next; > }; > > It seems like OMG IDL supports that syntax but when I tried to compile > it in IC, I got an error. > > I am using R9C-0 in NetBSD 1.6.1 > > regards,. > > > --------------------------------- > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard From D.WILLIAMS@REDACTED Tue Nov 18 10:04:26 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Tue, 18 Nov 2003 10:04:26 +0100 Subject: UML <-> Erlang Message-ID: Hello Eric, > What are the odds of a number of Erlang supporters convincing the > UML community that there is more work to do to truly have a > "Unified" modeling language? Does anyone know how one could > accomplish this? Maybe the first step is to list the problems? But > perhaps one should also list the things that might work well in > UML's present form. UML is now managed by the OMG (Object Management Group), so the only way to influence UML's evolution is to become a member and participate in work groups. They have various classes of membership: the more you pay the more influence you have (simplifying a bit). > I would like to investigate UML in its current state to design some > additions to a year-old architecture. I think UML offers a number of > possibilities. UML offers so many possibilities it makes me uneasy... > 1. Since it is standardized, does it have clarity over ad-hoc > diagramming approaches when many parties new to Erlang are involved > in the design process? In my opinion, no. Standardisation has not made UML clear, it has made UML big and complicated and unsatisfying to almost everyone in an attempt to please everyone. > 2. Could a class be used to model a gen_server? And if the Erlang > application has many gen_servers then wouldn't simple UML class > diagrams help illustrate the design better than other approaches? Sure, it is possible map Erlang modules to classes (without member data and without inheritance), behaviours to interfaces. However, UML is /very/ tightly coupled to C++/Java programming constructs, and I believe you will find this a bit frustrating, especially if you are using tools. On the other hand, in its effort to embrace every existing modeling notation on the planet, UML has some diagrams that are not strictly object-oriented: sequence diagrams, state diagrams and deployment diagrams may be more suitable to representing concurrent erlang processes. But again: just use the high level notation. The details are also tightly coupled to C++/Java. Disclaimer: I no longer really believe in and use visual modeling, other than drawing on a whiteboard during team design discussions, for which an informal ad hoc notation is all we need. So my recommendation may be biased... I have heard that SDL and the MSC notation are a better fit with Erlang... but I have not tried. Regards, Dominic Williams. From HEINRICH.VENTER@REDACTED Tue Nov 18 11:15:49 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Tue, 18 Nov 2003 12:15:49 +0200 Subject: UML <-> Erlang Message-ID: It would seem that there is a general feeling that UML is not quite suited to the task. The question begs, what IS suited to Erlang. having a look at some of the sugestions (SDL etc), but we use ad hoc diagrams as well. Perhaps we can find some comonality in all the ad hoc methods for Erlang and find a better tool that way? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From div@REDACTED Tue Nov 18 11:39:43 2003 From: div@REDACTED (Carl-Johan Kihlbom) Date: Tue, 18 Nov 2003 11:39:43 +0100 Subject: urlget errors (inet:gethostbyname) on Mac OS X In-Reply-To: References: Message-ID: <852C0A17-19B3-11D8-8E55-000A9599FB7E@newcode.se> I've downloaded the urlget module from http://www.erlang.org/examples/small_examples/urlget.erl but I can't get it working. When I try to download a file by invoking e.g. urlget:direct("http://slashdot.org") it returns {error,{socket_error,nxdomain}}. As far as I can tell it tries to resolve the hostname by inet:gethostbyname. inet:gethostbyname("slashdot.org") returns {error,nxdomain}. I'm using Erlang/OTP R9B-0 on Mac OS X 10.3.1. urlget works fine for my classmates who are using Windows XP (sadly). Any ideas on what's wrong? Best regards, Carl-Johan Kihlbom Software Engineering & Management IT University of G?teborg From carsten@REDACTED Tue Nov 18 12:14:53 2003 From: carsten@REDACTED (Carsten Schultz) Date: Tue, 18 Nov 2003 12:14:53 +0100 Subject: urlget errors (inet:gethostbyname) on Mac OS X In-Reply-To: <852C0A17-19B3-11D8-8E55-000A9599FB7E@newcode.se> References: <852C0A17-19B3-11D8-8E55-000A9599FB7E@newcode.se> Message-ID: <20031118111453.GQ30341@penne.localnet> Hi Carl-Johan! On Tue, Nov 18, 2003 at 11:39:43AM +0100, Carl-Johan Kihlbom wrote: > As far as I can tell it tries to resolve the hostname by > inet:gethostbyname. inet:gethostbyname("slashdot.org") returns > {error,nxdomain}. There have been two threads in Octobre having `gethostbyname' in their subject lines, you might want to have a look at the explanations there. Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.fu-mathe-team.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From seungbong_han@REDACTED Tue Nov 18 19:48:46 2003 From: seungbong_han@REDACTED (SEUNG BONG HAN) Date: Tue, 18 Nov 2003 10:48:46 -0800 (PST) Subject: IDL rescursive structure. In-Reply-To: Message-ID: <20031118184846.28087.qmail@web10107.mail.yahoo.com> Is there any work-around for this situation? regards, Niclas Eklund wrote: Hello! The answer is no; IC doesn't support rescursive structures yet. /Nick On Mon, 17 Nov 2003, SEUNG BONG HAN wrote: > Can I compile this IDL in ic module? > > struct A { > long i; > sequence next; > }; > > It seems like OMG IDL supports that syntax but when I tried to compile > it in IC, I got an error. > > I am using R9C-0 in NetBSD 1.6.1 > > regards,. > > > --------------------------------- > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard --------------------------------- Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Tue Nov 18 21:31:21 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 18 Nov 2003 21:31:21 +0100 Subject: UML <-> Erlang In-Reply-To: References: Message-ID: On Tue, 18 Nov 2003 10:04:26 +0100, WILLIAMS Dominic wrote: > I have heard that SDL and the MSC notation are a better fit with > Erlang... but I have not tried. As of the UML 2.0 draft standard, SDL has basically been assimilated into UML. According to TeleLogic, a long-standing SDL tool developer, some quirks of SDL were fixed in the process. OTOH, SDL users who now get migrated to UML 2 have to go back to school, and have a tendency to balk at all the surrounding (seemingly unnecessary) complexity, which they suddenly have to understand in order to make things work. UML 2 also attempts to standardize Action Language semantics -- not syntax, mind you. I don't know if Erlang, or a derivative thereof, would fit the bill. That might be interesting... /Uffe -- Ulf Wiger From ulf.wiger@REDACTED Tue Nov 18 21:41:17 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 18 Nov 2003 21:41:17 +0100 Subject: UML <-> Erlang In-Reply-To: <200311180221.hAI2LvPH255481@atlas.otago.ac.nz> References: <200311180221.hAI2LvPH255481@atlas.otago.ac.nz> Message-ID: Looks interesting. /Uffe On Tue, 18 Nov 2003 15:21:57 +1300 (NZDT), Richard A. O'Keefe wrote: > The thing that might _really_ be interesting to map to Erlang is BPMN > (Business Process Modelling Notation). Someone with a SAP background > told me that BPMN is a _far_ better fit to real business information > systems than UML is, and after looking at the BPMN draft for several > days I came to the conclusion that it should be possible to map at least > a large chunk of BPMN onto Erlang fairly directly. > -- Ulf Wiger From nick@REDACTED Wed Nov 19 14:27:58 2003 From: nick@REDACTED (Niclas Eklund) Date: Wed, 19 Nov 2003 14:27:58 +0100 (MET) Subject: IDL rescursive structure. In-Reply-To: <20031118184846.28087.qmail@web10107.mail.yahoo.com> Message-ID: The only way is to avoid using rescursive structures (i.e. change the IDL specification). Note, Anonymous Types was deprecated in CORBA-2.4: sequence next; // Deprecated. Unless you must represent a tree, you can use: struct A { long i; }; typedef sequence ASeq; /Nick > Is there any work-around for this situation? > > regards, > > Niclas Eklund wrote: > > Hello! > > The answer is no; IC doesn't support rescursive structures yet. > > /Nick > > On Mon, 17 Nov 2003, SEUNG BONG HAN wrote: > > > Can I compile this IDL in ic module? > > > > struct A { > > long i; > > sequence next; > > }; > > > > It seems like OMG IDL supports that syntax but when I tried to compile > > it in IC, I got an error. > > > > I am using R9C-0 in NetBSD 1.6.1 > > > > regards,. From C.Reinke@REDACTED Wed Nov 19 15:05:10 2003 From: C.Reinke@REDACTED (C.Reinke) Date: Wed, 19 Nov 2003 14:05:10 +0000 Subject: Petri Nets <-> Erlang (was: UML <-> Erlang) In-Reply-To: Message from "HEINRICH VENTER" of "Tue, 18 Nov 2003 12:15:49 +0200." Message-ID: > It would seem that there is a general feeling that UML is not > quite suited to the task. The question begs, what IS suited to > Erlang. having a look at some of the sugestions (SDL etc), but we > use ad hoc diagrams as well. Perhaps we can find some comonality > in all the ad hoc methods for Erlang and find a better tool that > way? One graphical notation I'd strongly suggest to look into are Petri Nets, especially high-level, or Coloured Petri Nets: Petri Nets World -- online services for the international Petri Nets community http://www.daimi.au.dk/PetriNets/ Petri Nets (PN) describe communicating automata - the state machines you all know and love in a concurrent setting, with localised state, localised state transitions, and explicit, asynchronous communication between subsystems. Very much in the spirit of Erlang. High-level nets add inscriptions in some programming language, to describe data structures and their processing (example inscription languages are predicate logic, Standard ML, Haskell, or Java). If you were to use Erlang-coloured nets, you could use a single uniform notation to go from first graphical sketches of a system, to abstract models that can serve as specifications and as the basis for simulating systems (to search for performance problems), to full implementations where the net part serves as structured and executable documentation. PN do have a proper, and simple formal basis that allows for analysis and simulation, but they also provide a simple, intuitive graphical notation accessible to non-experts. PN predate UML and have been widely used (including, but by no means limited to modeling, analysis and performance evaluation of manufacturing and telecomunication systems) - they also form the background for some workflow and business process modeling systems, and they are behind some of the model checking tools you may have heard about in other contexts. Please have a look, and let me know what you think. Cheers, Claus PS. The Petri Nets Home Page provides links/references to everything, including introductions, applications, tools. Of more dubious value are an overview talk I gave myself a long time ago to my colleagues here in Kent: http://www.cs.kent.ac.uk/~cr3/talks/#PetriNets and a paper outlining how to obtain a simple but cheap first implementation of F-coloured PN (for some functional language F) by embedding them into their inscription language F: http://www.cs.kent.ac.uk/people/staff/cr3/publications/HCPN.html From peter@REDACTED Wed Nov 19 20:15:31 2003 From: peter@REDACTED (Peter H|gfeldt) Date: Wed, 19 Nov 2003 20:15:31 +0100 (MET) Subject: limitations of SSL In-Reply-To: <7bsmlcccvy.fsf_-_@schultze.ird.idealx.com> Message-ID: Hello, On Wed, 29 Oct 2003, Nicolas Niclausse wrote: > > Hello, > > The SSL Release Notes state that ?Erlang SSL applicaton does not support > session ?, and hence you can't reuse SSL id accross connections; Is it > planned for the next release of Erlang ? No, there are currently no such plans. > > I tried to handle more than 1024 concurrent connections with Yaws; it > works well with HTTP (i raised my system's limit with 'ulimit -n 2048'), > but don't with HTTPS (on a Linux system with erlang R9C). Is it > possible to raise this limit with HTTPS (SSL) ? In the Erlang/OTP SSL port program one (1) socket is required for each listen, and two (2) sockets are required for successful connect or accept (one socket to the outside world, one socket to the Erlang OS process). /Peter > > -- > Nicolas NICLAUSSE IDEALX S.A.S. > T?l:01 44 42 00 00 http://IDEALX.com/ > From peter@REDACTED Wed Nov 19 20:37:35 2003 From: peter@REDACTED (Peter H|gfeldt) Date: Wed, 19 Nov 2003 20:37:35 +0100 (MET) Subject: SSL in Erlang/OTP In-Reply-To: <87islirab8.fsf@alex.sevcom.net> Message-ID: Hi, On Mon, 17 Nov 2003, Alexey Shchepin wrote: > Hi! > > Can anyone help with following issues with SSL application? > > * ssl:accept locks when when one TCP connection is established, but SSL > handshake is not finished. E.g. if Yaws is listen for SSL connections on > port 443 and someone runs "telnet this.server 443" (note that this is not > SSL-enabled telnet), then noone will be able to retreive web pages via this > port until this connection will be closed. As temporary solution I use > ssl:accept with small timeout value, but this is just workaround. IMHO > ssl:accept should not have such behaviour. In Erlang/OTP SSL you can have several processes, each waiting for an ssl:accept/N on one and the the same port. That is needed to obtain acceptable (no pun intended) parallellism. That it not practically possible with gen_tcp:accept/N (if you try it you will get an error return). I think gen_tcp should accept multiple accepts as well. > > * ssl:send locks if another process runs ssl:recv on the same port. And I > can't use "{active, true}" option, because I need flow control. Again, as a > temporary solution I use timeout value in ssl:recv/3, so ssl:send can work > several times in second. But this makes notable increase of CPU load: > e.g. with ejabberd on jabber.ru (~440 connected users, ~100 using SSL) with > 20ms timeout -- CPU load is ~40%, with 200ms -- 9-12%, with SSL switched > off -- 3-4%. When an SSL-connection has been established all data flow through gen_tcp to/from the SSL portprogram, which is then just a multiplexer of data (slow connections will not impair fast connections). Seems as if your problem is really a gen_tcp problem? > * (Feature Request) Many protocols have some kinds of STARTTLS command > (e.g. IMAP, POP3 (RFC2595), Jabber/XMPP). So this would be great to have > ability to convert gen_tcp sockets to ssl ones. Ok, I am not familiar with STARTTLS or similar, but I will investigate it. /Peter From mlogan@REDACTED Wed Nov 19 21:45:17 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 19 Nov 2003 14:45:17 -0600 Subject: Match Spec Message-ID: <1069274716.2673.41.camel@dhcp-lom-194-186.futuresource.com> I could not remember if there was some "free standing" implementation of the match specs. I want to filter packets coming in off the wire with match spec syntax. Does anyone know if I can do this. I looked on the mailing list archives but did not see anything of the sort. Cheers, Martin From lennart.ohman@REDACTED Wed Nov 19 22:14:20 2003 From: lennart.ohman@REDACTED (=?ISO-8859-1?Q?Lennart_=D6hman?=) Date: Wed, 19 Nov 2003 22:14:20 +0100 Subject: Match Spec In-Reply-To: <1069274716.2673.41.camel@dhcp-lom-194-186.futuresource.com> References: <1069274716.2673.41.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <3FBBDD2C.4040704@st.se> To my knowledge match specs can only be used in ETS selects and in tracing. /Lennart Martin J. Logan wrote: > I could not remember if there was some "free standing" implementation of > the match specs. I want to filter packets coming in off the wire with > match spec syntax. Does anyone know if I can do this. I looked on the > mailing list archives but did not see anything of the sort. > > Cheers, > Martin > -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From hal@REDACTED Thu Nov 20 00:16:21 2003 From: hal@REDACTED (Hal Snyder) Date: Wed, 19 Nov 2003 17:16:21 -0600 Subject: euc2003 Message-ID: <87k75w7xve.fsf@ghidra.vail> EUC 2003 is over. What fun - listening to the (other) presenters, as well as hanging out around Stockhom with various Erlang enthusiasts before the con. I want to try QuickCheck, the system for stating and testing program properties presented by John Hughes. Danie Schutte's banking project in South Africa sounds fascinating; with today's shenanigans in the international currency business making news in the U.S., maybe they should call Teba to get some suggestions on how to clean things up quickly. Comments from Ulf Wiger and Joe Armstrong provided me strong motivation for continued work with UBF, including cleanup of the C/C++ driver. And maybe the bindable bit size enhancement to binaries mentioned by Kenneth Lundin in the tour of new features in R9C will help Martin Logan with the packet filtering issues he just asked about on the mailing list. From luke@REDACTED Thu Nov 20 00:51:22 2003 From: luke@REDACTED (Luke Gorrie) Date: 20 Nov 2003 00:51:22 +0100 Subject: euc2003 In-Reply-To: <87k75w7xve.fsf@ghidra.vail> References: <87k75w7xve.fsf@ghidra.vail> Message-ID: Hal Snyder writes: > I want to try QuickCheck, the system for stating and testing program > properties presented by John Hughes. I imported QuickCheck into the Jungerl from here: http://www.math.chalmers.se/~rjmh/ErlangQC/ The online version seems a bit older than the one presented, it doesn't handle recursively defined generators (as the 'sets' one is). I'll steal the latest code for Jungerl when John gets a chance to put it online, and until then there's a simpler example in there. P.S., cool demo with the phones :-) -Luke From luke@REDACTED Thu Nov 20 07:30:22 2003 From: luke@REDACTED (Luke Gorrie) Date: 20 Nov 2003 07:30:22 +0100 Subject: HiPE - faster than I thought :-) Message-ID: Ahoy, I reran my little HiPE benchmarks, and could not reproduce the results I claimed to have got at EUC. I can neither confirm nor deny that anything has changed in my setup. :-) The benchmark was doing "ehtml" generation with yaws, both the normal way (yaws_api:ehtml_expand) and the fast way (yaws_api:ehtml_expander). On my microbenchmark (attached) HiPE doubles the speed in both cases. Very nice indeed :-) Cheers, Luke -------------- next part -------------- A non-text attachment was scrubbed... Name: hipe_bench.erl Type: text/x-erlang-source Size: 11049 bytes Desc: yaws/hipe benchmark module URL: From svg@REDACTED Thu Nov 20 10:09:13 2003 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 20 Nov 2003 14:09:13 +0500 (YEKT) Subject: Match Spec In-Reply-To: <1069274716.2673.41.camel@dhcp-lom-194-186.futuresource.com> References: <1069274716.2673.41.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <20031120.140913.68045827.svg@surnet.ru> Good day, You can use erlang:match_spec_test/3. The only problem - match spec is parsed every time in this BIF. 7> MS = ets:fun2ms(fun ({A, B}) -> A end). [{{'$1','$2'},[],['$1']}] 8> erlang:match_spec_test([], MS, table). {ok,false,[],[]} 9> erlang:match_spec_test({a, b}, MS, table). {ok,a,[],[]} mlogan> I could not remember if there was some "free standing" implementation of mlogan> the match specs. I want to filter packets coming in off the wire with mlogan> match spec syntax. Does anyone know if I can do this. I looked on the mlogan> mailing list archives but did not see anything of the sort. mlogan> mlogan> Cheers, mlogan> Martin mlogan> Best Regards, Vladimir Sekissov From bjorn@REDACTED Thu Nov 20 13:51:57 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Nov 2003 13:51:57 +0100 Subject: euc2003 In-Reply-To: References: <87k75w7xve.fsf@ghidra.vail> Message-ID: It can handle recursive generators if you limit the size of the generated sets. At the end of this email, I've attached a module that does some tests on the gb_sets module. /Bjorn Luke Gorrie writes: > The online version seems a bit older than the one presented, it > doesn't handle recursively defined generators (as the 'sets' one > is). I'll steal the latest code for Jungerl when John gets a chance to > put it online, and until then there's a simpler example in there. > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? -module(gb_sets_check). -compile(export_all). -include("quickcheck.hrl"). t() -> qc:quickcheck(prop_union_commutes()), qc:quickcheck(prop_intersection_commutes()), qc:quickcheck(prop_subset()), qc:quickcheck(prop_empty()), qc:quickcheck(prop_not_empty()), %% Intentionally failing property. qc:quickcheck(prop_difference_commutes()), ok. prop_union_commutes() -> ?FORALL(X,gb_set(), ?FORALL(Y,gb_set(), equal(gb_sets:union(X, Y), gb_sets:union(Y, X)))). prop_intersection_commutes() -> ?FORALL(X,gb_set(), ?FORALL(Y,gb_set(), equal(gb_sets:intersection(X, Y), gb_sets:intersection(Y, X)))). prop_difference_commutes() -> ?FORALL(X,gb_set(), ?FORALL(Y,gb_set(), equal(gb_sets:difference(X, Y), gb_sets:difference(Y, X)))). prop_subset() -> ?FORALL(X,gb_set(), ?FORALL(Y,gb_set(), begin S = gb_sets:union(X, Y), gb_sets:is_subset(X, S) andalso gb_sets:is_subset(Y, S) end)). prop_empty() -> ?FORALL(X,gb_set(), ?IMPLIES(gb_sets:size(X) == 0, gb_sets:is_empty(X))). prop_not_empty() -> ?FORALL(X,gb_set(), ?IMPLIES(gb_sets:size(X) /= 0, not gb_sets:is_empty(X))). gb_set() -> ?SIZED(N, resize(min(50, N), frequency( [{6,?LET(L, list(int()), return({'@',gb_sets,from_list,[L]}))}, {6,?LET(L, list(int()), return({'@',gb_sets,from_ordset,[{'@',ordsets,from_list,[L]}]}))}, {6,?LET(S,gb_set(),?LET(E,int(), return({'@',gb_sets,add,[E,S]})))}, {2,return({'@',gb_sets,empty,[]})}, {2,?LET(E,int(), return({'@',gb_sets,singleton,[E]}))}, {1,?LET(P,function(bool()),?LET(S,gb_set(), return({'@',gb_sets,filter,[P,S]})))} ]))). equal(X, Y) -> gb_sets:to_list(X) =:= gb_sets:to_list(Y). min(A, B) when A < B -> A; min(_, B) -> B. From alexey@REDACTED Thu Nov 20 22:11:54 2003 From: alexey@REDACTED (Alexey Shchepin) Date: Thu, 20 Nov 2003 23:11:54 +0200 Subject: SSL in Erlang/OTP In-Reply-To: (Peter H|gfeldt's message of "Wed, 19 Nov 2003 20:37:35 +0100 (MET)") References: Message-ID: <87oev67nj9.fsf@alex.sevcom.net> Hello, Peter! On Wed, 19 Nov 2003 20:37:35 +0100 (MET), you said: >> Can anyone help with following issues with SSL application? >> >> * ssl:accept locks when when one TCP connection is established, but SSL >> handshake is not finished. E.g. if Yaws is listen for SSL connections on >> port 443 and someone runs "telnet this.server 443" (note that this is not >> SSL-enabled telnet), then noone will be able to retreive web pages via this >> port until this connection will be closed. As temporary solution I use >> ssl:accept with small timeout value, but this is just workaround. IMHO >> ssl:accept should not have such behaviour. PH> In Erlang/OTP SSL you can have several processes, each waiting for an PH> ssl:accept/N on one and the the same port. That is needed to obtain PH> acceptable (no pun intended) parallellism. I.e. I need to run several such processess?: accept(ListenSocket, Opts) -> case ssl:accept(ListenSocket) of {ok, Socket} -> % Start new process for Socket accept(ListenSocket, Opts); {error, Reason} -> ... end. But even if I run e.g. 1000 such parallell accepts, malicious user still can open 1000 connections with the way I describe above (with ssl:accept locking), which will make service unaccessible for other users. So IMHO ssl:accept should return immediately after TCP connection to listened port will be established with new socket in "handshaking" state. In this state must be possible to know sockname (e.g. to prevent many conections from one host), and data sended with ssl:send will be writed to queue, which will be sended after handshaking. PH> That it not practically possible with gen_tcp:accept/N (if you try it you PH> will get an error return). I think gen_tcp should accept multiple accepts PH> as well. >> * ssl:send locks if another process runs ssl:recv on the same port. And I >> can't use "{active, true}" option, because I need flow control. Again, as >> a temporary solution I use timeout value in ssl:recv/3, so ssl:send can >> work several times in second. But this makes notable increase of CPU load: >> e.g. with ejabberd on jabber.ru (~440 connected users, ~100 using SSL) with >> 20ms timeout -- CPU load is ~40%, with 200ms -- 9-12%, with SSL switched >> off -- 3-4%. PH> When an SSL-connection has been established all data flow through gen_tcp PH> to/from the SSL portprogram, which is then just a multiplexer of data PH> (slow connections will not impair fast connections). PH> Seems as if your problem is really a gen_tcp problem? I think this is ssl_broker problem, look: %% recv - passive mode %% handle_call({recv, Client, Length, Timeout}, From, St) when St#st.status =/= closed, St#st.active == false -> debug(St, "recv: client = ~w~n", [Client]), Reply = gen_tcp:recv(St#st.proxysock, Length, Timeout), {reply, Reply, St}; (This is part of ssl_broker.erl from R8B, but R9C do almost the same) After ssl:recv call, appropriate ssl_broker process hangs inside gen_tcp:recv, and can't process other requests (including ssl:send). It seems this can be solved by moving gen_tcp:recv call to another process... What about something like this: recv(Socket, Length, Timeout) when record(Socket, sslsocket) -> Req = {recv, self()}, ProxySock = gen_server:call(Socket#sslsocket.pid, Req, infinity), case gen_tcp:recv(St#st.proxysock, Length, Timeout) of {ok, _} = Result -> Result; {error, timeout} -> {error, timeout}; {error, Reason} = Error -> gen_server:call(Socket#sslsocket.pid, {switch to closing state}, infinity), Error end. handle_call({recv, Client}, From, St) when St#st.status =/= closed, St#st.active == false -> debug(St, "recv: client = ~w~n", [Client]), Reply = St#st.proxysock, {reply, Reply, St}; I.e. gen_tcp:recv will be executed in process that calls ssl:recv. >> * (Feature Request) Many protocols have some kinds of STARTTLS command >> (e.g. IMAP, POP3 (RFC2595), Jabber/XMPP). So this would be great to have >> ability to convert gen_tcp sockets to ssl ones. PH> Ok, I am not familiar with STARTTLS or similar, but I will investigate it. Thanks! From kostis@REDACTED Thu Nov 20 18:21:54 2003 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 20 Nov 2003 18:21:54 +0100 (MET) Subject: New HiPE version Message-ID: <200311201721.hAKHLs8B010951@hamberg.it.uu.se> Open source users who are interested in getting the latest version of the HiPE compiler can periodically visit the page: http://www.csd.uu.se/projects/hipe/snapshots/ For example, today we released a snapshot (otp-20031120-1752.tar.gz) which among other things differs from the version of HiPE in R9C-1 in that: - M:F(...) (apply/N) calls get compiled to directly call native code - constants in the constant pool area are stored only once - has better code generation for binaries - overall provides faster compilation - fixes some obscure bugs. Feedback welcome! Kostis Sagonas (for the HiPE team) From Bengt.Kleberg@REDACTED Fri Nov 21 07:44:40 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Fri, 21 Nov 2003 07:44:40 +0100 Subject: SSL in Erlang/OTP In-Reply-To: <87oev67nj9.fsf@alex.sevcom.net> References: <87oev67nj9.fsf@alex.sevcom.net> Message-ID: <3FBDB458.3040100@ericsson.com> Alexey Shchepin wrote: > Hello, Peter! > > On Wed, 19 Nov 2003 20:37:35 +0100 (MET), you said: ...deleted > > PH> In Erlang/OTP SSL you can have several processes, each waiting for an > PH> ssl:accept/N on one and the the same port. That is needed to obtain > PH> acceptable (no pun intended) parallellism. > > I.e. I need to run several such processess?: > > accept(ListenSocket, Opts) -> > case ssl:accept(ListenSocket) of > {ok, Socket} -> > % Start new process for Socket > accept(ListenSocket, Opts); > {error, Reason} -> ... > end. > > But even if I run e.g. 1000 such parallell accepts, malicious user still can > open 1000 connections with the way I describe above (with ssl:accept locking), > which will make service unaccessible for other users. > > So IMHO ssl:accept should return immediately after TCP connection to listened > port will be established with new socket in "handshaking" state. In this state > must be possible to know sockname (e.g. to prevent many conections from one > host), and data sended with ssl:send will be writed to queue, which will be ...deleted it is not enough to stop many connections from one host. think ddos (distributed denial of service). bengbt From joe@REDACTED Fri Nov 21 08:49:41 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 21 Nov 2003 08:49:41 +0100 (CET) Subject: RSA question Message-ID: Has anybody interfaced the rsa encode/decode rotuines with Erlang? More specifically the RSA_public_encrypt, RSA_private_decrypt routines in the crypto(3) part of open SSL. All I want to do is encode/decode a message digest. (It turns out that my "pure Erlang" (TM) solution to this problem is too slow - and I now want a more efficient solution - I have (as the wise men said) made it right, now I want to make it fast) /Joe From bjorn@REDACTED Fri Nov 21 09:07:21 2003 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 21 Nov 2003 09:07:21 +0100 Subject: New HiPE version In-Reply-To: Kostis Sagonas's message of "Thu, 20 Nov 2003 18:21:54 +0100 (MET)" References: <200311201721.hAKHLs8B010951@hamberg.it.uu.se> Message-ID: Note that the OTP parts are based on our development branch of R10B, NOT on R9C. That means that you should only use the snapshot for evaluation purposes, not for any kind of serious production use. /Bjorn Kostis Sagonas writes: > Open source users who are interested in getting the latest > version of the HiPE compiler can periodically visit the page: > > http://www.csd.uu.se/projects/hipe/snapshots/ > > For example, today we released a snapshot (otp-20031120-1752.tar.gz) > which among other things differs from the version of HiPE in R9C-1 > in that: > > - M:F(...) (apply/N) calls get compiled to directly call native code > - constants in the constant pool area are stored only once > - has better code generation for binaries > - overall provides faster compilation > - fixes some obscure bugs. > > Feedback welcome! > > Kostis Sagonas (for the HiPE team) > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From vlad_dumitrescu@REDACTED Fri Nov 21 09:19:55 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 21 Nov 2003 09:19:55 +0100 Subject: Gen_server mesh Message-ID: Hi all, I have a slight problem, and there may be a better solution than hacking the gen_server behaviour - only I can't come up with any. The setting is a mesh of intercommunicating processes. I want to use the OTP framework, but since the setup isn't really client-server, it doesn't work all the time. The problem is that there may be circular call chains, which result in a dead-lockand a timeout. Using delayed replies could work, but the question is where to use it? Using it everywhere adds extra complexity, but might be a necessary evil. Are there any other solutions to this? regards, Vlad From vlad_dumitrescu@REDACTED Fri Nov 21 09:27:04 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 21 Nov 2003 09:27:04 +0100 Subject: gen_server partial replies Message-ID: I got an idea: would it be possible to add partial replies from a gen_server? Would it be useful, or just too specialized? What I mean by partial replies is something like this: call find_all_primes_less_than(1000000) {partial_reply, [1, 3, 5, 7]} {partial_reply, [1, 3, 5, 7, 9, ..., 131]} {partial_reply, [1, ..., 1003]} ... {reply, [1, ..., 999997]} The effect would be that the partial reply would be added to previous ones, until a full reply is received (containing the whole answer). This way lenghty operations could be monitored, and there is backwards compatibility (older clients just ignore partial replies). It might also be possible to let the partial replies be chunks of the whole answer, and the concatenation would take place at the receiver. This would lower the traffic, but isn't backwards compatible. What do you think? regards, Vlad From joe@REDACTED Fri Nov 21 11:32:53 2003 From: joe@REDACTED (Joe Armstrong) Date: Fri, 21 Nov 2003 11:32:53 +0100 (CET) Subject: Gen_server mesh In-Reply-To: Message-ID: Please explain more - what is a mesh? Questions: 1) Do nodes come and go at random 2) How do the nodes know about each other a) They know about a random selection of other nodes (like gnutella) b) They know about all other nodes (like napster) c) they know a lot about "nearby" nodes and little about "far away" nodes (like chord, tapestry, pastry, CAN, ) which are all really the same d) Something else 3) How many nodes? Cheers /Joe On Fri, 21 Nov 2003, Vlad Dumitrescu wrote: > Hi all, > > I have a slight problem, and there may be a better solution than hacking the > gen_server behaviour - only I can't come up with any. > > The setting is a mesh of intercommunicating processes. I want to use the OTP > framework, but since the setup isn't really client-server, it doesn't work all > the time. The problem is that there may be circular call chains, which result in > a dead-lockand a timeout. > > Using delayed replies could work, but the question is where to use it? Using it > everywhere adds extra complexity, but might be a necessary evil. > > Are there any other solutions to this? > > regards, > Vlad > > From vlad_dumitrescu@REDACTED Fri Nov 21 12:04:24 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 21 Nov 2003 12:04:24 +0100 Subject: Gen_server mesh References: Message-ID: Hi, > Please explain more - what is a mesh? In the current setup, there is only one Erlang node. The mesh is made of processes. There is nothing to restrict them to just one node. I couldn't find a better word than "mesh" to describe that the processes don't interact in the usual client-server way, but in a more or less impredictible way. I don't have yet a very clear picture of what the structure looks like, I just got a problem with a deadlock... Hopefully, I will have something to show soonish (but DHYB :). Maybe another way to state my question is: what might give best results - trying to bring order in the communication and use the usual gen_server, or allowing the hell to go loose and provide support for it? regards, Vlad From thomas.arts@REDACTED Fri Nov 21 15:48:16 2003 From: thomas.arts@REDACTED (Thomas Arts) Date: Fri, 21 Nov 2003 15:48:16 +0100 Subject: euc2003 References: <87k75w7xve.fsf@ghidra.vail> Message-ID: <002d01c3b03f$2643ed80$6500a8c0@ituniv398> Hi Luke As Bj?rn already pointed out, the version does handle recursive datatypes definitions. A manual would have been useful ;-/. A generator should be made such that it does not generate an infinite datastructure. This is solved by first selecting a random number (i.e. number of applications of constructor rules) and then building the datatype of that size. The Size parameter should decrease with at least 1 in every recursive call in the generation. In that sense, the function below seems to me still able to produce an infinite datastructure: > gb_set() -> > ?SIZED(N, resize(min(50, N), > frequency( > [{6,?LET(L, list(int()), > return({'@',gb_sets,from_list,[L]}))}, > {6,?LET(L, list(int()), > return({'@',gb_sets,from_ordset,[{'@',ordsets,from_list,[L]}]}))}, > {6,?LET(S,gb_set(),?LET(E,int(), > return({'@',gb_sets,add,[E,S]})))}, > {2,return({'@',gb_sets,empty,[]})}, > {2,?LET(E,int(), > return({'@',gb_sets,singleton,[E]}))}, > {1,?LET(P,function(bool()),?LET(S,gb_set(), > return({'@',gb_sets,filter,[P,S]})))} > ]))). A better definition would be gd_set() -> ?SIZED(Size,gd_set(Size)). gd_set(Size) -> frequency( [{6,?LET(L, list(int()), return({'@',gb_sets,from_list,[L]}))}, {6,?LET(L, list(int()), return({'@',gb_sets,from_ordset,[{'@',ordsets,from_list,[L]}]}))}, {6,?LET(S,gb_set(Size-1), % change here ?LET(E,int(), return({'@',gb_sets,add,[E,S]})))}, {2,return({'@',gb_sets,empty,[]})}, {2,?LET(E,int(), return({'@',gb_sets,singleton,[E]}))}, {1,?LET(P,function(bool()),?LET(S,gb_set(Size-1), % change here return({'@',gb_sets,filter,[P,S]})))} ]). Note that this Size is NOT the size of the set (i.e. number of elements), but the number of applications of a function to construct a set. Moreover, it is a kind of maximum number of applications, since if the non-recursive branch is chosen, the size will be less. If you now feel that this set is too small for a certain property, you could resize it for testing that property, e.g.: instead of prop_not_empty() -> ?FORALL(X,gb_set(), ?IMPLIES(gb_sets:size(X) /= 0, not gb_sets:is_empty(X))). one can use: prop_not_empty() -> ?FORALL(X,resize(80,gb_set()), ?IMPLIES(gb_sets:size(X) /= 0, not gb_sets:is_empty(X))). Note that the sets are bigger and testing takes longer. If you find that the numbers in the sets are to restricted, i.e., you only get sets with elements between -20 and +20, then you can do the following in the gd_set definition: gd_set(Size) -> frequency( [{6,?LET(L, list(resize(2000,int())), return({'@',gb_sets,from_list,[L]}))}, {6,?LET(L, list(resize(2000,int())), return({'@',gb_sets,from_ordset,[{'@',ordsets,from_list,[L]}]}))}, {6,?LET(S,gb_set(Size-1), % change here ?LET(E,resize(2000,int()), return({'@',gb_sets,add,[E,S]})))}, {2,return({'@',gb_sets,empty,[]})}, {2,?LET(E,int(), return({'@',gb_sets,singleton,[E]}))}, {1,?LET(P,function(bool()),?LET(S,gb_set(Size-1), % change here return({'@',gb_sets,filter,[P,S]})))} ]). making the integers taken from a larger interval. Similar, one can take larger lists as generators by writing resize(100,list()). Hope this clarifies a bit our thoughts. John and I are going to write a paper about quickcheck and make some documentation and examples as soon as time permits. Cool that we got so much positive feedback on this application! Thomas --- Dr Thomas Arts Program Manager Software Engineering and Management IT-university in Gothenburg Box 8718, 402 75 Gothenburg, Sweden http://www.ituniv.se/ Tel +46 31 772 6031 Fax +46 31 772 4899 From Bengt.Kleberg@REDACTED Fri Nov 21 17:29:56 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Fri, 21 Nov 2003 17:29:56 +0100 Subject: gen_server partial replies In-Reply-To: References: Message-ID: <3FBE3D84.3030903@ericsson.com> Vlad Dumitrescu wrote: > I got an idea: would it be possible to add partial replies from a gen_server? > Would it be useful, or just too specialized? > > What I mean by partial replies is something like this: > > call find_all_primes_less_than(1000000) > > {partial_reply, [1, 3, 5, 7]} > {partial_reply, [1, 3, 5, 7, 9, ..., 131]} > {partial_reply, [1, ..., 1003]} > ... > {reply, [1, ..., 999997]} > > The effect would be that the partial reply would be added to previous ones, > until a full reply is received (containing the whole answer). This way lenghty > operations could be monitored, and there is backwards compatibility (older > clients just ignore partial replies). > why do you want to do a partial reply? if it is to free up the server for other call's, then you could 1 spawn a new process 2 return {noreply, State}; 3 use gen_server:reply(Pid, Reply), from the spawned process, when ready to do so bengt From carsten@REDACTED Sat Nov 22 01:08:22 2003 From: carsten@REDACTED (Carsten Schultz) Date: Sat, 22 Nov 2003 01:08:22 +0100 Subject: Restricting distributed Erlang to one host Message-ID: <20031122000821.GW30341@penne.localnet> Hi everyone, is there a way to allow only nodes from the same host to connect? This should not rely on DNS. Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.fu-mathe-team.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From mlogan@REDACTED Sat Nov 22 02:48:20 2003 From: mlogan@REDACTED (Martin J. Logan) Date: 21 Nov 2003 19:48:20 -0600 Subject: Restricting distributed Erlang to one host In-Reply-To: <20031122000821.GW30341@penne.localnet> References: <20031122000821.GW30341@penne.localnet> Message-ID: <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> Yeah, have your .erlang.cookie file be unique per host. Cheers, Martin On Fri, 2003-11-21 at 18:08, Carsten Schultz wrote: > Hi everyone, > > is there a way to allow only nodes from the same host to connect? > This should not rely on DNS. > > Greetings, > > Carsten From carsten@REDACTED Sat Nov 22 08:43:19 2003 From: carsten@REDACTED (Carsten Schultz) Date: Sat, 22 Nov 2003 08:43:19 +0100 Subject: Restricting distributed Erlang to one host In-Reply-To: <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> References: <20031122000821.GW30341@penne.localnet> <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <20031122074319.GX30341@penne.localnet> On Fri, Nov 21, 2003 at 07:48:20PM -0600, Martin J. Logan wrote: > Yeah, have your .erlang.cookie file be unique per host. Oh, I'm sorry, I was not clear enough in my original question. For security reasons I do not want to rely on cookies for this but want to have connections from different hosts being rejected right away. Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.fu-mathe-team.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From james@REDACTED Sat Nov 22 04:51:09 2003 From: james@REDACTED (James Hague) Date: Fri, 21 Nov 2003 21:51:09 -0600 Subject: Status of escript for Windows? Message-ID: <3FBE88CD.4833.3E1B35@localhost> This would be oh, so useful, for stealthily distributing Erlang applications. How much work does the Windows version of escript need in order to become usable? From ulf.wiger@REDACTED Sat Nov 22 13:21:20 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 22 Nov 2003 13:21:20 +0100 Subject: Restricting distributed Erlang to one host In-Reply-To: <20031122074319.GX30341@penne.localnet> References: <20031122000821.GW30341@penne.localnet> <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> <20031122074319.GX30341@penne.localnet> Message-ID: You can use net_kernel:allow(Nodes) to make sure that only the right nodes connect. The nodes could make themselves known e.g. through a http-based login procedure, or you could easily write a gen_tcp-based registration protocol. Hacking net_kernel.erl is perhaps a more manly way to go about it, but hardly recommended. In this case, the function to attack is setup/4, an it would be a trivial hack. /Uffe On Sat, 22 Nov 2003 08:43:19 +0100, Carsten Schultz wrote: > On Fri, Nov 21, 2003 at 07:48:20PM -0600, Martin J. Logan wrote: >> Yeah, have your .erlang.cookie file be unique per host. > > Oh, I'm sorry, I was not clear enough in my original question. For > security reasons I do not want to rely on cookies for this but want to > have connections from different hosts being rejected right away. > > Greetings, > > Carsten > -- Ulf Wiger From sean.hinde@REDACTED Sat Nov 22 13:23:49 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Sat, 22 Nov 2003 12:23:49 +0000 Subject: Restricting distributed Erlang to one host In-Reply-To: <20031122074319.GX30341@penne.localnet> Message-ID: On Saturday, November 22, 2003, at 07:43 am, Carsten Schultz wrote: > On Fri, Nov 21, 2003 at 07:48:20PM -0600, Martin J. Logan wrote: >> Yeah, have your .erlang.cookie file be unique per host. > > Oh, I'm sorry, I was not clear enough in my original question. For > security reasons I do not want to rely on cookies for this but want to > have connections from different hosts being rejected right away. > There is a new kernel application parameter called inet_dist_use_interface. This allows you to specify the IP address to bind the distribution listen address to, which should do what you wish. Sean From carsten@REDACTED Sat Nov 22 13:36:27 2003 From: carsten@REDACTED (Carsten Schultz) Date: Sat, 22 Nov 2003 13:36:27 +0100 Subject: Restricting distributed Erlang to one host In-Reply-To: References: <20031122074319.GX30341@penne.localnet> Message-ID: <20031122123627.GY30341@penne.localnet> On Sat, Nov 22, 2003 at 12:23:49PM +0000, Sean Hinde wrote: > There is a new kernel application parameter called > inet_dist_use_interface. This allows you to specify the IP address to > bind the distribution listen address to, You mean, I could set it to the loopback interface? > which should do what you wish. That should indeed work nicely. Thanks, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.fu-mathe-team.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From micke@REDACTED Sat Nov 22 13:49:22 2003 From: micke@REDACTED (Michael Fogeborg) Date: Sat, 22 Nov 2003 13:49:22 +0100 Subject: Online Erlang Lectures? Message-ID: <5.1.0.14.1.20031122134901.00bc0de8@online.no> I just found the site on SICP and the online SICP Video Lectures !! ( http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/ ) What a great idea! Could this be done for Erlang also ? From mikael.karlsson@REDACTED Sat Nov 22 14:59:39 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sat, 22 Nov 2003 14:59:39 +0100 Subject: gen_server partial replies In-Reply-To: <3FBE3D84.3030903@ericsson.com> References: <3FBE3D84.3030903@ericsson.com> Message-ID: <200311221459.40426.mikael.karlsson@creado.com> fredag 21 november 2003 17:29 skrev Bengt Kleberg: > > why do you want to do a partial reply? if it is to free up the server > for other call's, then you could > 1 spawn a new process > 2 return {noreply, State}; > 3 use gen_server:reply(Pid, Reply), from the spawned process, when ready > to do so > > > bengt Great info, I did not know this! I can see from the gen_server code that this works for handle_call/3 were you have a choice of returning {reply, Reply, NState} or {noreply, NState}. In the system documentation: http://www.erlang.org/doc/r9c/doc/design_principles/part_frame.html this is not obvious to me though, as I can only see the asynchronous handle_cast mentioned for {noreply, NState}. I think this is a common pattern in many situations were you want to have a choice of returning at once or later. If I have a (proxy) cache I want to return at once at hits, but later if I have to go and ask a remote system for information. One thing in the gen_server code bothers me a bit though. There is the main loop function which calls the handle_msg function which calls the loop function and so on. Is this OK for an infinite process? Will the compiler handle the stack properly? loop(Parent, Name, State, Mod, Time, Debug) -> ... handle_msg(Msg, Parent, Name, State, Mod, Time); handle_msg({'$gen_call', From, Msg}, Parent, Name, State, Mod, _Time) -> case catch Mod:handle_call(Msg, From, State) of {reply, Reply, NState} -> reply(From, Reply), loop(Parent, Name, NState, Mod, infinity, []); ... Mikael From mickael.remond@REDACTED Sat Nov 22 15:14:39 2003 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 22 Nov 2003 14:14:39 +0000 Subject: Restricting distributed Erlang to one host In-Reply-To: <20031122074319.GX30341@penne.localnet> References: <20031122000821.GW30341@penne.localnet> <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> <20031122074319.GX30341@penne.localnet> Message-ID: <20031122141439.GA3654@erlang.dyndns.org> * Carsten Schultz [2003-11-22 08:43:19 +0100]: > On Fri, Nov 21, 2003 at 07:48:20PM -0600, Martin J. Logan wrote: > > Yeah, have your .erlang.cookie file be unique per host. > > Oh, I'm sorry, I was not clear enough in my original question. For > security reasons I do not want to rely on cookies for this but want to > have connections from different hosts being rejected right away. Another option is to set up your firewall to do the job for you. By default, epmd is using port 4369. You can set up your firewall to prevent some hosts to access this port on your system. Cheers, -- Micka?l R?mond http://www.erlang-projects.org/ From mickael.remond@REDACTED Sat Nov 22 15:24:51 2003 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 22 Nov 2003 14:24:51 +0000 Subject: Erlang and Nebula 3D game engine Message-ID: <20031122142451.GB3654@erlang.dyndns.org> Hello, As a follow-up to the conference, here as some online Erlang 3D related links: - Paper of my EUC 2003 presentation: http://www.erlang-projects.org/Public/projects/games/game_development_usi/view - Nebula Erlang binding: http://www.erlang-projects.org/Public/projects/games/nebula-erlang_bindin/view The Nebula web site is http://nebuladevice.sourceforge.net/cgi-bin/twiki/view/Nebula/WebHome Your feedback is of course welcome. -- Micka?l R?mond http://www.erlang-projects.org/ From dsolaz@REDACTED Sat Nov 22 15:15:03 2003 From: dsolaz@REDACTED (Daniel Solaz) Date: Sat, 22 Nov 2003 15:15:03 +0100 Subject: Restricting distributed Erlang to one host In-Reply-To: <20031122074319.GX30341@penne.localnet> References: <20031122000821.GW30341@penne.localnet> <1069465700.2673.78.camel@dhcp-lom-194-186.futuresource.com> <20031122074319.GX30341@penne.localnet> Message-ID: <200311221515.04121.dsolaz@sistelcom.com> Then it wouldn't be distributed ;) On Saturday 22 November 2003 08:43, Carsten Schultz wrote: > Oh, I'm sorry, I was not clear enough in my original question. For > security reasons I do not want to rely on cookies for this but want > to have connections from different hosts being rejected right away. Looks like epmd can't be told to listen on localhost:4369 only... Set firewall rules. Don't need DNS for that. -Daniel From hal@REDACTED Sat Nov 22 18:55:54 2003 From: hal@REDACTED (Hal Snyder) Date: Sat, 22 Nov 2003 11:55:54 -0600 Subject: namespace packages and releases Message-ID: <87r8002sph.fsf@ghidra.vail> Has anyone built a release involving packages? I get stuck building .boot and .script from .rel: Here I'm trying to add an application "sample" to a previously working release of Scott Fritchie's tcpbalance. Relative to the directory where compilation is happening, the added files are ../../lib/org/erlang/sample/ sample.app sample_app.beam sample_sup.beam sample.beam I have tried both bare module names and module names with package prefix in the .app file. No success with either. 1. What should the .app file look like when using packages? Package prefix on module names, or not? I suspect application names should support package prefixes as well, but don't know if that's the case. 2. What should the .rel file look like when using packages? Package prefix on application names, or not? So far I have not found a working combination. I am using R9C-0 on FreeBSD-5.0 btw. erlc -W -pz ../../lib/tcpbalance/ebin -pa /usr/ports/lang/erlang/work/otp_src_R9C-0/erts/lib /sasl/ebin -I/usr/ports/lang/erlang/work/otp_src_R9C-0/lib/kernel/ebin -I/usr/ports/lang/erl ang/work/otp_src_R9C-0/lib/stdlib/ebin -pz ../../lib tcpbalance_rel.rel {{module_not_found,sample,'org.erlang.sample.sample_app'}, {'org.erlang.sample.sample_app','$$ignore$$', sample, "1.0", "/usr/home/hal/work/otp/releases/tcpbalance_rel/../../lib/o rg/erlang/sample"}} From ulf.wiger@REDACTED Sat Nov 22 19:32:23 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 22 Nov 2003 19:32:23 +0100 Subject: namespace packages and releases In-Reply-To: <87r8002sph.fsf@ghidra.vail> References: <87r8002sph.fsf@ghidra.vail> Message-ID: On Sat, 22 Nov 2003 11:55:54 -0600, Hal Snyder wrote: > Has anyone built a release involving packages? > > I get stuck building .boot and .script from .rel: I have. I've sent patches for e.g. systools_make to OTP (at least I think I did), but they don't seem to have made it into R9C. Without some patching, it won't work. > Here I'm trying to add an application "sample" to a previously working > release of Scott Fritchie's tcpbalance. Relative to the directory > where compilation is happening, the added files are > > ../../lib/org/erlang/sample/ > sample.app > sample_app.beam > sample_sup.beam > sample.beam > > I have tried both bare module names and module names with package > prefix in the .app file. No success with either. > > 1. What should the .app file look like when using packages? Package > prefix on module names, or not? Yes, package prefix on module names. > I suspect application names should support package prefixes as well, > but don't know if that's the case. No. > 2. What should the .rel file look like when using packages? Package > prefix on application names, or not? Application names have no package prefix. It's still a flat structure (well, except for included apps, that is.) > So far I have not found a working combination. I am using R9C-0 on > FreeBSD-5.0 btw. If you can wait 'til Monday, I'll send some patches. /Uffe -- Ulf Wiger From micke@REDACTED Sat Nov 22 13:35:41 2003 From: micke@REDACTED (Michael Fogeborg) Date: Sat, 22 Nov 2003 13:35:41 +0100 Subject: Online Erlang Lectures? Message-ID: <5.1.0.14.1.20031122133234.00bb1338@online.no> I just found the site in SICP and the online SICP Video Lectures !! ( http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/ ) What a great idea! Could this be done for Erlang also ? From taj.khattra@REDACTED Sat Nov 22 22:32:56 2003 From: taj.khattra@REDACTED (Taj Khattra) Date: Sat, 22 Nov 2003 13:32:56 -0800 Subject: Online Erlang Lectures? In-Reply-To: <5.1.0.14.1.20031122133234.00bb1338@online.no> References: <5.1.0.14.1.20031122133234.00bb1338@online.no> Message-ID: <20031122213256.GA15661@localhost.localdomain> On Sat, Nov 22, 2003 at 01:35:41PM +0100, Michael Fogeborg wrote: > I just found the site in SICP and the online SICP Video Lectures !! > ( http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/ ) > What a great idea! Could this be done for Erlang also ? the only online Erlang related webcast i'm aware of is Joe's "Concurrency Oriented Programming in Erlang" LL2 talk at http://ll2.ai.mit.edu/ -taj From Chandrashekhar.Mullaparthi@REDACTED Sat Nov 22 23:48:18 2003 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Sat, 22 Nov 2003 22:48:18 -0000 Subject: gen_server partial replies Message-ID: > -----Original Message----- > From: Mikael Karlsson [mailto:mikael.karlsson@REDACTED] > Sent: 22 November 2003 14:00 > To: Bengt Kleberg; - Erlang Questions > Subject: Re: gen_server partial replies > > One thing in the gen_server code bothers me a bit though. > There is the main > loop function which calls the handle_msg function which calls > the loop > function and so on. Is this OK for an infinite process? Will > the compiler > handle the stack properly? > > loop(Parent, Name, State, Mod, Time, Debug) -> ... > handle_msg(Msg, Parent, Name, State, Mod, Time); > > handle_msg({'$gen_call', From, Msg}, Parent, Name, State, > Mod, _Time) -> > case catch Mod:handle_call(Msg, From, State) of > {reply, Reply, NState} -> > reply(From, Reply), > loop(Parent, Name, NState, Mod, infinity, []); > ... The handle_msg and loop function are tail-recursive functions, so they wont cause the stack to grow. The compiler ensures that tail-recursive functions operate in constant stack space. Here is an example of a function which is not tail-recursive. The function adds all the numbers in a list. Here you can see that each element of the list is being saved on the stack and the addition takes place when all the elements have been saved on the stack and it unwinds. The larger the list, the larger the stack will be. add([H | T]) -> H + add(T); add([]) -> 0. The same function can be written in a tail-recursive manner as follows. Here an extra variable is used to store the result of the addition each time and nothing is saved on the stack. add(List) -> add(List, 0). add([H | T], Acc) -> add(T, H + Acc); add([], Acc) -> Acc. cheers Chandru NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From mikael.karlsson@REDACTED Sun Nov 23 21:09:26 2003 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sun, 23 Nov 2003 21:09:26 +0100 Subject: gen_server partial replies In-Reply-To: References: Message-ID: <200311232109.26743.mikael.karlsson@creado.com> Sat 22 november 2003 23:48 Chandrashekhar Mullaparthi wrote: > > -----Original Message----- > > From: Mikael Karlsson [mailto:mikael.karlsson@REDACTED] > > Sent: 22 November 2003 14:00 > > To: Bengt Kleberg; - Erlang Questions > > Subject: Re: gen_server partial replies > > > > One thing in the gen_server code bothers me a bit though. > > There is the main > > loop function which calls the handle_msg function which calls > > the loop > > function and so on. Is this OK for an infinite process? Will > > the compiler > > handle the stack properly? > > > > loop(Parent, Name, State, Mod, Time, Debug) -> ... > > handle_msg(Msg, Parent, Name, State, Mod, Time); > > > > handle_msg({'$gen_call', From, Msg}, Parent, Name, State, > > Mod, _Time) -> > > case catch Mod:handle_call(Msg, From, State) of > > {reply, Reply, NState} -> > > reply(From, Reply), > > loop(Parent, Name, NState, Mod, infinity, []); > > ... > > The handle_msg and loop function are tail-recursive functions, so they wont > cause the stack to grow. The compiler ensures that tail-recursive functions > operate in constant stack space. > ... Thanks Chandru, I wasn't sure this was valid for calls between functions as well. /Mikael From ulf.wiger@REDACTED Mon Nov 24 10:19:47 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 24 Nov 2003 10:19:47 +0100 Subject: namespace packages and releases In-Reply-To: <87r8002sph.fsf@ghidra.vail> References: <87r8002sph.fsf@ghidra.vail> Message-ID: On Sat, 22 Nov 2003 11:55:54 -0600, Hal Snyder wrote: > Has anyone built a release involving packages? > > I get stuck building .boot and .script from .rel: Here's a patch of systools_make.erl against OTP R9B. It should work against the R9C version as well, but I haven't actually verified that. The patch makes it possible to build boot scripts even when using package semantics. Note that the application names remain the same. Example: lib/mywww-1.0/ ebin/ mywww.app base/ socket.beam http.beam session.beam cgi/ parse.beam eval.beam src/ base/ socket.erl ... cgi/ parse.erl ... The app file would look like this: {application, mywww, [{version, "1.0"}, {modules, ['mywww.base.socket','mywww.base.http',mywww.base.session', 'mywww.cgi.parse',mywww.cgi.eval']} ...]}. And the code path should be set to .../lib/foo-1.0/ebin, if you want to access the code using erl -pz ... or similar. You can skip the quotes around module names if you're only using OTP R9C or later, but with R9B, they have to be there. What remains (AFAIK) is to modify erl_prim_loader.erl, but this also involves rebuilding beam. This step is required if you want to use embedded code loading, but otherwise, you'll be fine with the systools_make patch. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S -------------- next part -------------- A non-text attachment was scrubbed... Name: systools_make.erl.diff Type: application/octet-stream Size: 2397 bytes Desc: not available URL: From Bengt.Kleberg@REDACTED Mon Nov 24 10:28:54 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 24 Nov 2003 10:28:54 +0100 Subject: gen_server partial replies In-Reply-To: <200311221459.40426.mikael.karlsson@creado.com> References: <3FBE3D84.3030903@ericsson.com> <200311221459.40426.mikael.karlsson@creado.com> Message-ID: <3FC1CF56.5090705@ericsson.com> Mikael Karlsson wrote: > fredag 21 november 2003 17:29 skrev Bengt Kleberg: > ...deleted > > > Great info, I did not know this! > I can see from the gen_server code that this works for handle_call/3 were you > have a choice of returning {reply, Reply, NState} or {noreply, NState}. > In the system documentation: > http://www.erlang.org/doc/r9c/doc/design_principles/part_frame.html > this is not obvious to me though, as I can only see the asynchronous > handle_cast mentioned for {noreply, NState}. i only knew about this because i had the privilige of attending an otp course (by Cesarini Consulting Ltd, see http://www.erlang-consulting.com/training_fs.html). it helps having a teacher that has read all the docuemntatiuon and found the most relevant bits. the manual page for gen_server (as found by matthias excellent web page http://www.corelatus.com/~matthias/modules.html) says (about handle_call/3): If the functions returns {noreply,NewState} or {noreply,NewState,Timeout}, the gen_server will continue executing with NewState. Any reply to From must be given explicitly using gen_server:reply/2. just one sentence, but there it is. bengt From vlad_dumitrescu@REDACTED Mon Nov 24 11:12:28 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 24 Nov 2003 11:12:28 +0100 Subject: gen_server partial replies References: <3FBE3D84.3030903@ericsson.com> <200311221459.40426.mikael.karlsson@creado.com> Message-ID: > fredag 21 november 2003 17:29 skrev Bengt Kleberg: > > why do you want to do a partial reply? if it is to free up the server > > for other call's, then you could > > 1 spawn a new process > > 2 return {noreply, State}; > > 3 use gen_server:reply(Pid, Reply), from the spawned process, when ready > > to do so What I had in mind was a way to handle requests that take a lot of time and return a lot of data. If I want or need to display some progress reports, or to be able to handle a crash before all data is returned (so that it's not recomputed), then it would be nice with a way to split the results in chunks. Of course I can write a specific implementation, but I was wondering if this might be something to handle in a general, standard way. regards, Vlad From Bengt.Kleberg@REDACTED Mon Nov 24 11:57:17 2003 From: Bengt.Kleberg@REDACTED (Bengt Kleberg) Date: Mon, 24 Nov 2003 11:57:17 +0100 Subject: gen_server partial replies In-Reply-To: References: <3FBE3D84.3030903@ericsson.com> <200311221459.40426.mikael.karlsson@creado.com> Message-ID: <3FC1E40D.6050800@ericsson.com> Vlad Dumitrescu wrote: ...deleted > What I had in mind was a way to handle requests that take a lot of time and > return a lot of data. If I want or need to display some progress reports, or to > be able to handle a crash before all data is returned (so that it's not > recomputed), then it would be nice with a way to split the results in chunks. pass a callback function to handle_cast/3. let the worker use the callback, with the partial data, while it is computing. when all is done you supply a ''stop sign'' instead of the normal data. bengt From sean.hinde@REDACTED Mon Nov 24 12:29:33 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 24 Nov 2003 11:29:33 +0000 Subject: gen_server partial replies In-Reply-To: Message-ID: <7A3A3084-1E71-11D8-95BB-000A95927CCE@mac.com> On Monday, November 24, 2003, at 10:12 am, Vlad Dumitrescu wrote: >> fredag 21 november 2003 17:29 skrev Bengt Kleberg: >>> why do you want to do a partial reply? if it is to free up the server >>> for other call's, then you could >>> 1 spawn a new process >>> 2 return {noreply, State}; >>> 3 use gen_server:reply(Pid, Reply), from the spawned process, when >>> ready >>> to do so > > What I had in mind was a way to handle requests that take a lot of > time and > return a lot of data. If I want or need to display some progress > reports, or to > be able to handle a crash before all data is returned (so that it's not > recomputed), then it would be nice with a way to split the results in > chunks. This seems to be getting some way from what might be accomplished by a synchronous call - the calling process would need to use a darned clever implementation of gen_server:call to handle all of the out of band signals as well as the bits of answer. It does sound very like an implementation of handle_cast :-) Sean From vlad_dumitrescu@REDACTED Mon Nov 24 12:56:52 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 24 Nov 2003 12:56:52 +0100 Subject: gen_server partial replies References: <3FBE3D84.3030903@ericsson.com> <200311221459.40426.mikael.karlsson@creado.com> <3FC1E40D.6050800@ericsson.com> Message-ID: From: "Bengt Kleberg" > pass a callback function to handle_cast/3. let the worker use the > callback, with the partial data, while it is computing. when all is done > you supply a ''stop sign'' instead of the normal data. Yes, this is a good way to do it. thanks. Vlad From luke@REDACTED Mon Nov 24 18:01:39 2003 From: luke@REDACTED (Luke Gorrie) Date: 24 Nov 2003 18:01:39 +0100 Subject: euc2003 In-Reply-To: <002d01c3b03f$2643ed80$6500a8c0@ituniv398> References: <87k75w7xve.fsf@ghidra.vail> <002d01c3b03f$2643ed80$6500a8c0@ituniv398> Message-ID: "Thomas Arts" writes: > As Bj?rn already pointed out, the version does handle recursive > datatypes definitions. We have this pretty well covered now, but all the same here's the follow-up that John Hughes mailed me earlier: I saw your mail on the Erlang list archive, but I haven't figured out how to contribute myself yet. Maybe you could copy this to the list? I simplified the sets generator in my talk, and avoided talking about the need to limit the size of generated sets in order to ensure termination. It's the only simplification I made, and seemed necessary given that the talk anyway threatened to exceed the slot. But maybe that was a mistake... I hadn't really expected that people would immediately try out the code on the slides! Mea culpa. Anyway, the solution we use is to observe the size parameter that all generators receive, and then use it to limit the size of sets generated. I should explain that while all generators receive a size parameter, which increases gradually during testing, its interpretation is entirely up to the programmer. For example, here is the sets generator I used for the results in the talk: set() -> ?SIZED(Size,set(trunc(math:sqrt(Size))+1)). set(0) -> return({'@',sets,new,[]}); set(Size) -> frequency([return({'@',sets,new,[]}), {6,?LET(L,list(int()),return({'@',sets,from_list,[L]}))}, {6,?LET(S,set(Size-1),?LET(E,int(),return({'@',sets,add_element,[E,S]})))}, ?LET(S,set(Size-1),?LET(E,int(),return({'@',sets,del_element,[E,S]}))), ?LET({S1,S2},two(set(Size div 3)),return({'@',sets,union,[S1,S2]})), ?LET({S1,S2},two(set(Size div 3)),return({'@',sets,intersection,[S1,S2]})), ?LET({S1,S2},two(set(Size div 3)),return({'@',sets,subtract,[S1,S2]})), ?LET(S,set(Size-1),?LET(P,function(bool()),return({'@',sets,filter,[P,S]}))) ]). If one sticks to 100 tests, the size only ranges up to 21, so maybe taking its square root was a bit drastic... it's a question of judgement how large test cases one wants vis a vis how faast one wants testing to be. At any rate, you see that a small modification of the code I showed ensures that generation terminates. One principle we try to follow is that as the size parameter increases, so all possible sets should be generatable. Thus if we continue testing long enough, any fault will eventually be revealed. John From HEINRICH.VENTER@REDACTED Tue Nov 25 09:44:14 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Tue, 25 Nov 2003 10:44:14 +0200 Subject: Supervisor shutdown Message-ID: Hello List I have a bit of an odd question regarding the shut down of applications. I have the following sequence application -> supervisor -> gen_server The gen_server does all the weird and wonderful stuff and needs to be shut down in an orderly fashion. To do that I have a terminate/2 function. BUT, If I stop the application with application:stop(myapp). what happens is that the supervisor process gets terminated and thus the gen_server gets terminated too (without calling the terminate/2 function). Then I though I'd be clever and use the exported application stop/1 function to call the supervisor:terminate_child/2 function, but this also just kills the child process without calling the termiante/2 function. Next I thought I'd kill the gen_server directly in the stop/1 function with my stop/0 function in the gen_server. But then the supervisor jumped in and restarted the gen_server as soon as it realised that it is dead. So how do I stop the application and ensure that my gen_server terminate code gets executed?? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From gunilla@REDACTED Tue Nov 25 10:11:32 2003 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 25 Nov 2003 10:11:32 +0100 Subject: Supervisor shutdown References: Message-ID: <3FC31CC4.54763C4@erix.ericsson.se> Snip from the gen_server man page: "If the gen_server is part of a supervision tree and is ordered by its supervisor to terminate, this function will be called with Reason=shutdown if the following conditions apply: * the gen_server has been set to trap exit signals, and * the shutdown strategy as defined in the supervisor's child specification is an integer timeout value, not brutal_kill. " Best regards, Gunilla HEINRICH VENTER wrote: > > Hello List > > I have a bit of an odd question regarding the shut down of applications. I have the following sequence > > application -> supervisor -> gen_server > > The gen_server does all the weird and wonderful stuff and needs to be shut down in an orderly fashion. To do that I have a terminate/2 function. > BUT, If I stop the application with application:stop(myapp). what happens is that the supervisor process gets terminated and thus the gen_server gets terminated too (without calling the terminate/2 function). > Then I though I'd be clever and use the exported application stop/1 function to call the supervisor:terminate_child/2 function, but this also just kills the child process without calling the termiante/2 function. > Next I thought I'd kill the gen_server directly in the stop/1 function with my stop/0 function in the gen_server. But then the supervisor jumped in and restarted the gen_server as soon as it realised that it is dead. > > So how do I stop the application and ensure that my gen_server terminate code gets executed?? > > -]-[einrich > > ##################################################################################### > The information contained in this message and or attachments is intended > only for the person or entity to which it is addressed and may contain > confidential and/or privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance upon, > this information by persons or entities other than the intended recipient > is prohibited. If you received this in error, please contact the sender and > delete the material from any system and destroy all copies. > ##################################################################################### -- _____Gunilla Arendt______________________________________________ EAB/UKH/KD Erlang/OTP Product Development Gunilla.Arendt@REDACTED +46-8-7275730 ecn 851 5730 From richardc@REDACTED Mon Nov 24 23:03:57 2003 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 24 Nov 2003 23:03:57 +0100 (CET) Subject: EDoc beta release Message-ID: Finally ready for eager beta testers out there: EDoc 0.4! http://user.it.uu.se/~richardc/edoc Needs at least OTP R8B. Requires the new beta version of the syntax tools, as well as xmerl 0.19 (all found in the same directory above). Documentation is incomplete (grep for options - fun for all the family!) Have fun and send me your bug reports! /Richard -- Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From vlad_dumitrescu@REDACTED Tue Nov 25 10:32:35 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 10:32:35 +0100 Subject: Supervisor shutdown References: Message-ID: From: "HEINRICH VENTER" > So how do I stop the application and ensure that my gen_server terminate code gets executed?? Hi, It should work without any tweaks. From documentation of gen_server, the terminate callback: If the gen_server is part of a supervision tree and is ordered by its supervisor to terminate, this function will be called with Reason=shutdown if the following conditions apply: -the gen_server has been set to trap exit signals, and -the shutdown strategy as defined in the supervisor's child specification is an integer timeout value, not brutal_kill. Maybe these conditions aren't met? regards, Vlad From ulf.wiger@REDACTED Tue Nov 25 11:04:42 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Nov 2003 11:04:42 +0100 Subject: Supervisor shutdown In-Reply-To: References: Message-ID: On Tue, 25 Nov 2003 10:32:35 +0100, Vlad Dumitrescu wrote: > From: "HEINRICH VENTER" >> So how do I stop the application and ensure that my gen_server >> terminate code > gets executed?? > > Hi, > > It should work without any tweaks. From documentation of gen_server, the > terminate callback: > > If the gen_server is part of a supervision tree and is ordered by its > supervisor to terminate, this function will be called with > Reason=shutdown if the following conditions apply: > -the gen_server has been set to trap exit signals, and > -the shutdown strategy as defined in the supervisor's > child specification is an integer timeout value, > not brutal_kill. ...and the gen_server has been started with gen_server:start_link(...), not gen_server:start(...). /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From vlad_dumitrescu@REDACTED Tue Nov 25 11:34:08 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 11:34:08 +0100 Subject: Supervisor shutdown References: Message-ID: From: "Ulf Wiger" > >> So how do I stop the application and ensure that my gen_server > >> terminate code > > gets executed?? > > > > If the gen_server is part of a supervision tree and is ordered by its > > supervisor to terminate, this function will be called with > > Reason=shutdown if the following conditions apply: > > -the gen_server has been set to trap exit signals, and > > -the shutdown strategy as defined in the supervisor's > > child specification is an integer timeout value, > > not brutal_kill. > > ...and the gen_server has been started with gen_server:start_link(...), > not gen_server:start(...). Mmmm, not necessarily with start_link. The child can use any function to start, but it is *required* to create the link in some way. However, I haven't seen yet any child using something else than start_link :-) BTW, wouldn't it be better if the supervisor would check that the link was created, or maybe better, create it itself? Since the specs make the link mandatory, why not impose the requirement in the code too? regards, Vlad From gunilla@REDACTED Tue Nov 25 11:52:20 2003 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 25 Nov 2003 11:52:20 +0100 Subject: Supervisor shutdown References: Message-ID: <3FC33464.D6DB9EEF@erix.ericsson.se> No, the supervisor *is* required to call start_link! Simply linking is not enough, as the gen_server can be linked to any process but it must also be able to separate EXIT signals from its supervisor from other EXIT signals! That is what start_link ensures. And yes, there are alternative start strategies that in retrospect might have been better choices. For example, simply providing the supervisor with the name of the callback module(s) and make it responsible for starting its child processes the correct way. Best regards, Gunilla Vlad Dumitrescu wrote: > > From: "Ulf Wiger" > > >> So how do I stop the application and ensure that my gen_server > > >> terminate code > > > gets executed?? > > > > > > If the gen_server is part of a supervision tree and is ordered by its > > > supervisor to terminate, this function will be called with > > > Reason=shutdown if the following conditions apply: > > > -the gen_server has been set to trap exit signals, and > > > -the shutdown strategy as defined in the supervisor's > > > child specification is an integer timeout value, > > > not brutal_kill. > > > > ...and the gen_server has been started with gen_server:start_link(...), > > not gen_server:start(...). > > Mmmm, not necessarily with start_link. The child can use any function to start, > but it is *required* to create the link in some way. > However, I haven't seen yet any child using something else than start_link :-) > > BTW, wouldn't it be better if the supervisor would check that the link was > created, or maybe better, create it itself? Since the specs make the link > mandatory, why not impose the requirement in the code too? > > regards, > Vlad -- _____Gunilla Arendt______________________________________________ EAB/UKH/KD Erlang/OTP Product Development Gunilla.Arendt@REDACTED +46-8-7275730 ecn 851 5730 From HEINRICH.VENTER@REDACTED Tue Nov 25 12:09:46 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Tue, 25 Nov 2003 13:09:46 +0200 Subject: Supervisor shutdown Message-ID: > -the gen_server has been set to trap exit signals, and I seem to have missed this bit. Now that it traps the exit signals with process_flag(trap_exit, true) Everything works out smoothely, or rather more smoothely. I have a spanner to throw in the works now however :) The gen_sever spawns some worker processes that need to be termianted. These processes might not terminate immediately when the stop message is sent to them. (I have discovered a falw in the curent design but will post to a separate thread about this) The gen_server can not terminate before all its workers have terminated in an orderly fasion, BUT since the stop function executes in a handle_call and the workers notify the gen_server of their termination through a different handle_call. This brings me to the {noreply, State} mentioned in another thread. How do I know the PID where to send the response at the later time when I am ready to quit? The process dictionary perhaps? Then use the function that notifies the gen_server of the process termination to check if all the processes are down and then reply with the {stop, normal, ok, State} message instead of {reply, State} Does this make sense? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From sean.hinde@REDACTED Tue Nov 25 12:27:47 2003 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 25 Nov 2003 11:27:47 +0000 Subject: EDoc beta release In-Reply-To: Message-ID: <6582A7EC-1F3A-11D8-95BB-000A95927CCE@mac.com> On Monday, November 24, 2003, at 10:03 pm, Richard Carlsson wrote: > > Finally ready for eager beta testers out there: EDoc 0.4! Well, not wishing to disappoint :-) It runs perfectly on all of the existing edoc'd source code files we have created here. And the application level pages are exactly what I imagined. Thank you. Sean From HEINRICH.VENTER@REDACTED Tue Nov 25 12:23:36 2003 From: HEINRICH.VENTER@REDACTED (HEINRICH VENTER) Date: Tue, 25 Nov 2003 13:23:36 +0200 Subject: receive pitfall Message-ID: Hi again List A pitfall I have stepped in twice now, and I thought I'd share :) Be careful of a general term in your receive statements! Your general term WILL catch anything and everything, including messages that might be intended for the same process in a different "state". This is something you have to be especialy weary of when you have more than one receive statement in the same process, but perhaps in different functions. For example a() -> receive cmd_1 -> b(), a(); cmd_2 -> a(); Else -> error end. b() -> receive stuff -> ok; Else -> b() end. In this case if the messages that are sent are cmd_1, cmd_2, stuff it will seem to work correctly, but the cmd_2 message will be lost. Even worse, if you are trapping EXIT messages, you might throw that away inadvertandly! I presume the best practice would be to rather use an after clause in a receive than a generic term in case something unexpected happens? -]-[einrich ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From ulf.wiger@REDACTED Tue Nov 25 12:41:42 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Nov 2003 12:41:42 +0100 Subject: receive pitfall In-Reply-To: References: Message-ID: On Tue, 25 Nov 2003 13:23:36 +0200, HEINRICH VENTER wrote: > Hi again List > > A pitfall I have stepped in twice now, and I thought I'd share :) > > Be careful of a general term in your receive statements! Your general > term WILL catch anything and everything, including messages that might > be intended for the same process in a different "state". This is > something you have to be especialy weary of when you have more than one > receive statement in the same process, but perhaps in different > functions. You may want to have one state (e.g. an idle() state) where unknown messages are handled/discarded, and then stick to selective receive in the substates. As you've found, introducing catch-alls in the sub- states can have serious side-effects. One of the great things about Erlang is the possibility to encapsulate dialogues using selective receive. This is the reduction of the event/state matrix that Mike Williams was talking about at EUC2003. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From raimo@REDACTED Tue Nov 25 12:42:24 2003 From: raimo@REDACTED (Raimo Niskanen) Date: Tue, 25 Nov 2003 12:42:24 +0100 Subject: Supervisor shutdown References: Message-ID: The idea of tossing around a State variable in the gen_server is to store such things as a pid() for a reply. State is commonly a record, so just add a field. Using the process dictionary is more "ugly", since it is used by e.g the gen_server code itself. If your worker processes have such an intircate protocol with the gen_server you might think about if they should form a supervision tree of their own, and your current gen_server should be a supervisor. It is a common tactic to not let the worker processes trap exit, and just get instantly killed when the gen_server exits, provided you can make them stupid enough. Making a new supervision tree is probably too heavy, though. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB HEINRICH VENTER wrote: >> -the gen_server has been set to trap exit signals, and > > I seem to have missed this bit. Now that it traps the exit signals with > > process_flag(trap_exit, true) > > Everything works out smoothely, or rather more smoothely. > > I have a spanner to throw in the works now however :) > > The gen_sever spawns some worker processes that need to be termianted. These processes might not terminate immediately when the stop message is sent to them. (I have discovered a falw in the curent design but will post to a separate thread about this) The gen_server can not terminate before all its workers have terminated in an orderly fasion, BUT since the stop function executes in a handle_call and the workers notify the gen_server of their termination through a different handle_call. > This brings me to the {noreply, State} mentioned in another thread. > How do I know the PID where to send the response at the later time when I am ready to quit? The process dictionary perhaps? Then use the function that notifies the gen_server of the process termination to check if all the processes are down and then reply with the {stop, normal, ok, State} message instead of {reply, State} > Does this make sense? > > -]-[einrich > > ##################################################################################### > The information contained in this message and or attachments is intended > only for the person or entity to which it is addressed and may contain > confidential and/or privileged material. Any review, retransmission, > dissemination or other use of, or taking of any action in reliance upon, > this information by persons or entities other than the intended recipient > is prohibited. If you received this in error, please contact the sender and > delete the material from any system and destroy all copies. > ##################################################################################### From ulf.wiger@REDACTED Tue Nov 25 12:56:50 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Nov 2003 12:56:50 +0100 Subject: Supervisor shutdown In-Reply-To: References: Message-ID: On Tue, 25 Nov 2003 13:09:46 +0200, HEINRICH VENTER wrote: > The gen_sever spawns some worker processes that need to be termianted. > These processes might not terminate immediately when the stop message is > sent to them. (I have discovered a falw in the curent design but will > post to a separate thread about this) The gen_server can not terminate > before all its workers have terminated in an orderly fasion, BUT since > the stop function executes in a handle_call and the workers notify the > gen_server of their termination through a different handle_call. You can use monitors to make sure that your server doesn't hang while waiting for a child process that may have died trying to do the orderly shutdown: terminate_children(Children) -> MRefs = lists:foldl( fun(Child, Acc) -> MRef = erlang:monitor(process, Child), Child ! {self(), shutdown}, [MRef | Acc] end, [], Children), collect_mrefs(MRefs). collect_mrefs(MRrefs) -> timer:sleep(100), collect_mrefs(MRefs, []). collect_mrefs(Rest, Left) -> receive {'DOWN',MRef,process,_,_} -> collect_mrefs(Rest, Left) after 0 -> collect_mrefs(MRefs, [MRef|Left]) end; collect_mrefs([], [_|_] = Left) -> collect_mrefs(Left); collect_mrefs([], []) -> done. If you want to be really paranoid, you could start a timer using erlang:send_after() before entering the collect_.. loop. This way (if you keep the child pids as well), you can do your own version of brutal_kill if the children never terminate on their own accord. It would then be good if the child doesn't call the parent synchronously in order to notify it of their own death (in general, it's a bad idea to have gen_server:call() in both directions between two processes.) > This brings me to the {noreply, State} mentioned in another thread. > How do I know the PID where to send the response at the later time when > I am ready to quit? The process dictionary perhaps? You can keep a 'pending' list in your State variable. > Then use the function that notifies the gen_server of the process > termination to check if all the processes are down and then reply with > the {stop, normal, ok, State} message instead of {reply, State} > Does this make sense? As mentioned above, it's dangerous to only rely on the children telling the parent that they are about to die. Monitors are quite handy for this sort of thing. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From vlad_dumitrescu@REDACTED Tue Nov 25 13:03:11 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 13:03:11 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: From: "Gunilla Arendt" > No, the supervisor *is* required to call start_link! I don't mean to argue with the OTP team :-) but the supervisor docs say, when describing children specifications: |StartFunc defines the function call used to start the child process. It should be a |module-function-arguments tuple {M,F,A} used as apply(M,F,A). | |The start function must create and link to the child process, and should return |{ok,Child} or {ok,Child,Info} where Child is the pid of the child process and Info an |arbitrary term which is ignored by the supervisor. Vlad From gunilla@REDACTED Tue Nov 25 13:15:42 2003 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 25 Nov 2003 13:15:42 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: <3FC347ED.B629D9FE@erix.ericsson.se> Then the documentation is not correct, very sorry about that. Best regards, Gunilla Vlad Dumitrescu wrote: > > From: "Gunilla Arendt" > > No, the supervisor *is* required to call start_link! > > I don't mean to argue with the OTP team :-) but the supervisor docs say, when > describing children specifications: > > |StartFunc defines the function call used to start the child process. It should > be a > |module-function-arguments tuple {M,F,A} used as apply(M,F,A). > | > |The start function must create and link to the child process, and should return > |{ok,Child} or {ok,Child,Info} where Child is the pid of the child process and > Info an > |arbitrary term which is ignored by the supervisor. > > Vlad -- _____Gunilla Arendt______________________________________________ EAB/UKH/KD Erlang/OTP Product Development Gunilla.Arendt@REDACTED +46-8-7275730 ecn 851 5730 From ulf.wiger@REDACTED Tue Nov 25 13:27:00 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Nov 2003 13:27:00 +0100 Subject: Supervisor shutdown In-Reply-To: <3FC33464.D6DB9EEF@erix.ericsson.se> References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: On Tue, 25 Nov 2003 11:52:20 +0100, Gunilla Arendt wrote: > And yes, there are alternative start strategies that in retrospect > might have been better choices. For example, simply providing > the supervisor with the name of the callback module(s) and make it > responsible for starting its child processes the correct way. ...perhaps a good time for me to remind the adventurous that I once wrote an alternative supervisor (super_hack.erl) that (a) offered a different child_spec() syntax, where one specified the wanted behaviour instead of an {M,F,A} (b) made it possible for a child to find out how many restarts had been carried out, including the reason for the first crash, and how far the restart had escalated. (c) ...while being fully backward compatible. Some code to illustrate the type of information made available to the child during restart (non-blocking, so it can be called during the init phase): restart_info() -> #restarts{total = Total, recent = Recent, ordered = Ordered, escalation = Escalation, mode = Mode, intensity = Intensity, period = Period, restarts = Restarts} = get_restart_info(), [{total, Total}, {recent, Recent}, {ordered, Ordered}, {escalation, Escalation}, {mode, Mode}, {maxR, Intensity}, {maxT, Period}, {restarts, Restarts}]. 'ordered' as in 'ordered restarts', i.e. when someone calls restart_child(). This hack has been mentioned before. Perhaps I should take the hint, but I still think it was a good idea. (: http://www.erlang.org/ml-archive/erlang-questions/200307/msg00154.html http://www.erlang.org/ml-archive/erlang-questions/200102/msg00176.html Here's an extract from the README file, explaining what hacks were made to the supervisor module: supervisor.erl -------------- 1) Support for a new ChildSpecification: {Name, Behaviour, BehaviourOptions, SupervisionOptions} SupervisionOptions ::= [Option] Option ::= {child_type, worker | supervisor} | {restart_type, permanent | transient | temporary} | {shutdown, Shutdown : integer() | infinity} | {modules, [module()]} | {maxR, MaxR : integer() | undefined} | {maxT, MaxT : integer() | undefined} This ChildSpec doesn't just specify a function that the supervisor should call; it specifies the behaviour of the process. This raises the level of abstraction of the specification, making an important modelling detail more visible. If maxR and maxT are specified for a child, the supervisor options MaxR and MaxT must be specified as 'per_child'. To this end, it is also legal for the CallbackModule:init/1 function to return: {ok, {Strategy, per_child}, ChildSpecs} which is the same as: {ok, {Strategy, per_child, per_child}, ChildSpecs} The reason for allowing per_child restart frequency is that different children under a supervisor may (probably do) have different "weights", and it is easier to specify different frequencies than creating multiple supervisors. Whether the supervisor uses the old (aggregated) restart frequency or per_child restart frequencies can be checked by the child, using the function supervisor:restart_info(mode) -> aggregated | per_child. Examples are found in testsup.erl and testsup2.erl 2) Added init_it/6, which is used to wrap Behaviour:init_it/6 3) This also allowed inserting restart information into the process dictionary of the child, and 4) adding the API functions restart_info/0 and restart_info/1. restart_info() -> [{total, NoOfTotalRestartsThisChild}, {recent, NoOfRestartsWithinMaxT}, {ordered, NoOfOrderedRestarts}, {escalation, Escalation}, {mode, Mode}, {maxR, MaxR}, {maxT, Period}, {restarts, [Timestamp]}] If Mode == aggregated, then MaxR and MaxT will be the aggregated values; otherwise, they will be the values for this particular child. Escalation is [] if there has been no escalation; otherwise, it will be [RestartsAtLowestLevel | EscalationAtNextHigherLevel] **** And finally some example code illustrating the above init([]) -> {ok, {{one_for_one, per_child, per_child}, [ %% example 1: a generic server {testserver, gen_server, [{module, testserver}, {args, []}, {regname, {local,testserver}}], [{child_type, worker}, {restart_type, permanent}, {maxR, 3}, {maxT, 30}, {shutdown, 2000}, {modules, [testserver]}]}, %% example 2: a gen_fsm {testfsm, gen_fsm, [{module, testfsm}, {args, []}], [{child_type, worker}, {restart_type, permanent}, {maxR, 10}, {maxT, 30}, {shutdown, 2000}, {modules, [testfsm]}]}, %% example 3: a gen_event {testevent, gen_event, [{regname, {global, testevent}}], [{child_type, worker}, {restart_type, permanent}, {maxR, 20}, {maxT, 30}, {shutdown, 2000}, {modules, dynamic}]} ]}}. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From ulf.wiger@REDACTED Tue Nov 25 13:31:33 2003 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Nov 2003 13:31:33 +0100 Subject: Supervisor shutdown In-Reply-To: References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: On Tue, 25 Nov 2003 13:03:11 +0100, Vlad Dumitrescu wrote: > From: "Gunilla Arendt" >> No, the supervisor *is* required to call start_link! > > I don't mean to argue with the OTP team :-) but the supervisor docs say, > when describing children specifications: Yes, but there is a small quirk in the gen_server.erl module that causes it not to heed the shutdown protocol if started with gen_server:start(), even if you _do_ create the link in some other way. From the supervisor side, everything is fine, but the gen_server doesn't recognise the supervisor as its parent. So, when the child is a gen_server, the start function must be {gen_server, start_link, [...]} in order for everything to work correctly. The same goes for gen_fsm and gen_event. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From vlad_dumitrescu@REDACTED Tue Nov 25 13:44:55 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 13:44:55 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: From: "Ulf Wiger" > Yes, but there is a small quirk in the gen_server.erl module that > causes it not to heed the shutdown protocol if started with > gen_server:start(), even if you _do_ create the link in some other > way. From the supervisor side, everything is fine, but the gen_server > doesn't recognise the supervisor as its parent. > > So, when the child is a gen_server, the start function must be > {gen_server, start_link, [...]} in order for everything to > work correctly. > > The same goes for gen_fsm and gen_event. Okay, now I see... This should be documented, I think, because using supervisors may be confusing enough even whithout hidden inconsistencies. In any case it's probably safer to always use start_link and perhaps unlinking afterwards, than using start and linking later. regards, Vlad From vlad_dumitrescu@REDACTED Tue Nov 25 14:17:14 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 14:17:14 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: From: "Ulf Wiger" > ...perhaps a good time for me to remind the adventurous that I > once wrote an alternative supervisor (super_hack.erl) Cool! I'm interested. Do you have a link to the archive? /Vlad From gunilla@REDACTED Tue Nov 25 14:22:31 2003 From: gunilla@REDACTED (Gunilla Arendt) Date: Tue, 25 Nov 2003 14:22:31 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> <3FC347ED.B629D9FE@erix.ericsson.se> Message-ID: <3FC35797.CA2EA89E@erix.ericsson.se> Let me correct myself: The supervisor documentation is correct. (The supervisor has no other requirements on the start function for a child process than that it creates and links to it as described.) However the gen_server|fsm|event man pages are not. It says "A gen_server started using start_link is linked to the calling process, this function must be used if the gen_server is included in a supervision tree." which gives the impression that the only difference between start and start_link is the linking, which it is not, as Ulf described. These man pages have now been corrected. Best regards, Gunilla Gunilla Arendt wrote: > > Then the documentation is not correct, very sorry about that. > > Best regards, Gunilla > > Vlad Dumitrescu wrote: > > > > From: "Gunilla Arendt" > > > No, the supervisor *is* required to call start_link! > > > > I don't mean to argue with the OTP team :-) but the supervisor docs say, when > > describing children specifications: > > > > |StartFunc defines the function call used to start the child process. It should > > be a > > |module-function-arguments tuple {M,F,A} used as apply(M,F,A). > > | > > |The start function must create and link to the child process, and should return > > |{ok,Child} or {ok,Child,Info} where Child is the pid of the child process and > > Info an > > |arbitrary term which is ignored by the supervisor. > > > > Vlad > -- _____Gunilla Arendt______________________________________________ EAB/UKH/KD Erlang/OTP Product Development Gunilla.Arendt@REDACTED +46-8-7275730 ecn 851 5730 From nicolas.niclausse@REDACTED Tue Nov 25 18:39:51 2003 From: nicolas.niclausse@REDACTED (Nicolas Niclausse) Date: Tue, 25 Nov 2003 18:39:51 +0100 Subject: limitations of SSL In-Reply-To: (Peter H|gfeldt's message of "Wed, 19 Nov 2003 20:15:31 +0100 (MET)") References: Message-ID: <7bfzgcfiu0.fsf@schultze.ird.idealx.com> >>>>> "Peter" == Peter H|gfeldt writes: >> The SSL Release Notes state that ?Erlang SSL applicaton does not >> support session ?, and hence you can't reuse SSL id accross >> connections; Is it planned for the next release of Erlang ? Peter> No, there are currently no such plans. too bad >> I tried to handle more than 1024 concurrent connections with Yaws; >> it works well with HTTP (i raised my system's limit with 'ulimit -n >> 2048'), but don't with HTTPS (on a Linux system with erlang R9C). >> Is it possible to raise this limit with HTTPS (SSL) ? Peter> In the Erlang/OTP SSL port program one (1) socket is required Peter> for each listen, and two (2) sockets are required for successful Peter> connect or accept (one socket to the outside world, one socket Peter> to the Erlang OS process). Yes, i understand that; my application is a proxy using ssl in both ways, therefore 4 sockets are used for each client. The problem is that the max number of file descriptors used by ssl_esock is set at compile time (FD_SETSIZE). That's not the case with gen_tcp Therefore (on Linux) by default, my proxy can't handle more that 256 simultaneous users ... I can try to raise FD_SETSIZE and recompile erlang, but it should be easier than that, no ? -- Nicolas NICLAUSSE IDEALX S.A.S. T?l:01 44 42 00 00 http://IDEALX.com/ From vlad_dumitrescu@REDACTED Tue Nov 25 13:03:11 2003 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Nov 2003 13:03:11 +0100 Subject: Supervisor shutdown References: <3FC33464.D6DB9EEF@erix.ericsson.se> Message-ID: From: "Gunilla Arendt" > No, the supervisor *is* required to call start_link! I don't mean to argue with the OTP team :-) but the supervisor docs say, when describing children specifications: |StartFunc defines the function call used to start the child process. It should be a |module-function-arguments tuple {M,F,A} used as apply(M,F,A). | |The start function must create and link to the child process, and should return |{ok,Child} or {ok,Child,Info} where Child is the pid of the child process and Info an |arbitrary term which is ignored by the supervisor. Vlad From joe@REDACTED Wed Nov 26 11:38:58 2003 From: joe@REDACTED (Joe Armstrong) Date: Wed, 26 Nov 2003 11:38:58 +0100 (CET) Subject: ANNOUNCE - tutorial Message-ID: People keep asking my about my wiki which is running (in case you forgot) at http://www.bluetail.com/wiki/ (still up and running after 2 years ..... :-) If you want to make your own wiki then look at http://www.sics.se/~joe/tutorials/wiki/wiki.html /Joe From eduardo@REDACTED Wed Nov 26 15:48:13 2003 From: eduardo@REDACTED (Eduardo Figoli) Date: Wed, 26 Nov 2003 11:48:13 -0300 Subject: Concurrent file access Message-ID: <001c01c3b42d$313bda80$1e00a8c0@design> Does anyone has experience with concurrent file access ? N processes accesing files (open/write/read/close) through a shared folder in Windows 2000. Thanks to all, ef -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter@REDACTED Wed Nov 26 20:48:28 2003 From: peter@REDACTED (Peter H|gfeldt) Date: Wed, 26 Nov 2003 20:48:28 +0100 (MET) Subject: limitations of SSL In-Reply-To: <7bfzgcfiu0.fsf@schultze.ird.idealx.com> Message-ID: On Tue, 25 Nov 2003, Nicolas Niclausse wrote: > >>>>> "Peter" == Peter H|gfeldt writes: > > >> The SSL Release Notes state that ?Erlang SSL applicaton does not > >> support session ?, and hence you can't reuse SSL id accross > >> connections; Is it planned for the next release of Erlang ? > > Peter> No, there are currently no such plans. > > too bad > > >> I tried to handle more than 1024 concurrent connections with Yaws; > >> it works well with HTTP (i raised my system's limit with 'ulimit -n > >> 2048'), but don't with HTTPS (on a Linux system with erlang R9C). > >> Is it possible to raise this limit with HTTPS (SSL) ? > > Peter> In the Erlang/OTP SSL port program one (1) socket is required > Peter> for each listen, and two (2) sockets are required for successful > Peter> connect or accept (one socket to the outside world, one socket > Peter> to the Erlang OS process). > > > Yes, i understand that; my application is a proxy using ssl in both > ways, therefore 4 sockets are used for each client. > > The problem is that the max number of file descriptors used by ssl_esock > is set at compile time (FD_SETSIZE). That's not the case with gen_tcp > > Therefore (on Linux) by default, my proxy can't handle more that 256 > simultaneous users ... > > I can try to raise FD_SETSIZE and recompile erlang, but it should be > easier than that, no ? Yes, it should be easier than that, but currently it is not. On recent versions of Unix you can set FD_SETSIZE at compile time (on the now quite old Redhat 7.2 (linux-2.4.7-10) you can't, but on later versions I think you can; on Solaris 8 you can). An immediate solution for you would then be to rebuild the SSL port program (ssl_esock) with FD_SETSIZE set, for instance in the Makefile (I assume you know how to do that). The "final" solution is to replace `select' with `poll', which does not have a FD_SETSIZE limitation; at least for Unix. I will add the improvement request to our todo-list for the next release. /Peter > > -- > Nicolas NICLAUSSE IDEALX S.A.S. > T?l:01 44 42 00 00 http://IDEALX.com/ > From peter@REDACTED Wed Nov 26 21:10:11 2003 From: peter@REDACTED (Peter H|gfeldt) Date: Wed, 26 Nov 2003 21:10:11 +0100 (MET) Subject: SSL in Erlang/OTP In-Reply-To: <87oev67nj9.fsf@alex.sevcom.net> Message-ID: Yes, I agree that ssl:recv/x and ssl:send/x should behave as gen_tcp:recv/x and gen_tcp:send/x do. I will add that request to the todo-list for the next release. I also agree that there should be some kind of "pre_accept" that returns a "raw" non-SSL socket, to be closed on reasons you have mentioned (although I think a firewall is the proper agent for denying attacks). I will add that request to the todo-list. With a "pre_accept" and a "post_accept" that does SSL handshaking, it is natural to add also a "pre_connect" and a corresponding "post_connect". That will achieve your request for a "STARTTTLS" command (there must of course be a well-defined protocol on top for this). I will add that to the todo-list. /Peter > Hello, Peter! > > On Wed, 19 Nov 2003 20:37:35 +0100 (MET), you said: > > >> Can anyone help with following issues with SSL application? > >> > >> * ssl:accept locks when when one TCP connection is established, but SSL > >> handshake is not finished. E.g. if Yaws is listen for SSL connections on > >> port 443 and someone runs "telnet this.server 443" (note that this is not > >> SSL-enabled telnet), then noone will be able to retreive web pages via this > >> port until this connection will be closed. As temporary solution I use > >> ssl:accept with small timeout value, but this is just workaround. IMHO > >> ssl:accept should not have such behaviour. > > PH> In Erlang/OTP SSL you can have several processes, each waiting for an > PH> ssl:accept/N on one and the the same port. That is needed to obtain > PH> acceptable (no pun intended) parallellism. > > I.e. I need to run several such processess?: > > accept(ListenSocket, Opts) -> > case ssl:accept(ListenSocket) of > {ok, Socket} -> > % Start new process for Socket > accept(ListenSocket, Opts); > {error, Reason} -> ... > end. > > But even if I run e.g. 1000 such parallell accepts, malicious user still can > open 1000 connections with the way I describe above (with ssl:accept locking), > which will make service unaccessible for other users. > > So IMHO ssl:accept should return immediately after TCP connection to listened > port will be established with new socket in "handshaking" state. In this state > must be possible to know sockname (e.g. to prevent many conections from one > host), and data sended with ssl:send will be writed to queue, which will be > sended after handshaking. > > PH> That it not practically possible with gen_tcp:accept/N (if you try it you > PH> will get an error return). I think gen_tcp should accept multiple accepts > PH> as well. > > >> * ssl:send locks if another process runs ssl:recv on the same port. And I > >> can't use "{active, true}" option, because I need flow control. Again, as > >> a temporary solution I use timeout value in ssl:recv/3, so ssl:send can > >> work several times in second. But this makes notable increase of CPU load: > >> e.g. with ejabberd on jabber.ru (~440 connected users, ~100 using SSL) with > >> 20ms timeout -- CPU load is ~40%, with 200ms -- 9-12%, with SSL switched > >> off -- 3-4%. > > PH> When an SSL-connection has been established all data flow through gen_tcp > PH> to/from the SSL portprogram, which is then just a multiplexer of data > PH> (slow connections will not impair fast connections). > > PH> Seems as if your problem is really a gen_tcp problem? > > I think this is ssl_broker problem, look: > > %% recv - passive mode > %% > handle_call({recv, Client, Length, Timeout}, From, St) > when St#st.status =/= closed, St#st.active == false -> > debug(St, "recv: client = ~w~n", [Client]), > Reply = gen_tcp:recv(St#st.proxysock, Length, Timeout), > {reply, Reply, St}; > > (This is part of ssl_broker.erl from R8B, but R9C do almost the same) > > After ssl:recv call, appropriate ssl_broker process hangs inside gen_tcp:recv, > and can't process other requests (including ssl:send). It seems this can be > solved by moving gen_tcp:recv call to another process... What about something > like this: > > recv(Socket, Length, Timeout) when record(Socket, sslsocket) -> > Req = {recv, self()}, > ProxySock = gen_server:call(Socket#sslsocket.pid, Req, infinity), > case gen_tcp:recv(St#st.proxysock, Length, Timeout) of > {ok, _} = Result -> Result; > {error, timeout} -> {error, timeout}; > {error, Reason} = Error -> > gen_server:call(Socket#sslsocket.pid, {switch to closing state}, infinity), > Error > end. > > handle_call({recv, Client}, From, St) > when St#st.status =/= closed, St#st.active == false -> > debug(St, "recv: client = ~w~n", [Client]), > Reply = St#st.proxysock, > {reply, Reply, St}; > > I.e. gen_tcp:recv will be executed in process that calls ssl:recv. > > >> * (Feature Request) Many protocols have some kinds of STARTTLS command > >> (e.g. IMAP, POP3 (RFC2595), Jabber/XMPP). So this would be great to have > >> ability to convert gen_tcp sockets to ssl ones. > > PH> Ok, I am not familiar with STARTTLS or similar, but I will investigate it. > > Thanks! > From nicolas.niclausse@REDACTED Thu Nov 27 10:09:28 2003 From: nicolas.niclausse@REDACTED (Nicolas Niclausse) Date: Thu, 27 Nov 2003 10:09:28 +0100 Subject: limitations of SSL In-Reply-To: (Peter H|gfeldt's message of "Wed, 26 Nov 2003 20:48:28 +0100 (MET)") References: Message-ID: <7bptfekwjb.fsf@schultze.ird.idealx.com> >>>>> "Peter" == Peter H|gfeldt ?crivait: Peter> An immediate solution for you would then be to rebuild the SSL Peter> port program (ssl_esock) with FD_SETSIZE set, for instance in Peter> the Makefile (I assume you know how to do that). Ok, I will try that Peter> The "final" solution is to replace `select' with `poll', which Peter> does not have a FD_SETSIZE limitation; at least for Unix. That would be nice Peter> I will add the improvement request to our todo-list for the next Peter> release. thanks ! -- Nicolas NICLAUSSE IDEALX S.A.S. T?l:01 44 42 00 00 http://IDEALX.com/ From D.WILLIAMS@REDACTED Thu Nov 27 10:51:23 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Thu, 27 Nov 2003 10:51:23 +0100 Subject: GS: editor Message-ID: Hello, I would like a GS editor object to send keypress events, but without actually entering the typed characters in the editor window. Configuring it with {keypress,true} gives me the events I need, but the characters appear in the editor. Configuring it with {enable,false},{keypress,true} prevents characters appearing, but also blocks the events... Any suggestions? Thanks, Dominic Williams. From D.WILLIAMS@REDACTED Thu Nov 27 12:59:59 2003 From: D.WILLIAMS@REDACTED (WILLIAMS Dominic) Date: Thu, 27 Nov 2003 12:59:59 +0100 Subject: editor Message-ID: > I would like a GS editor object to send keypress events, but > without actually entering the typed characters in the editor window. OK, I found a way: the editor has {enable,false}, and I catch events by putting {keypress,true} on the window containing the editor. I am still interested if there is a way to do it such that the event comes from the editor, not from the window... Thanks, Dominic Williams. From joe@REDACTED Thu Nov 27 14:15:59 2003 From: joe@REDACTED (Joe Armstrong) Date: Thu, 27 Nov 2003 14:15:59 +0100 (CET) Subject: Extension to Erlang Message-ID: Hi Guys, I'd lkie to posproe an einotsexn to the fatrnoimig civoentonns uesd in io:foamrt. I'd lkie to see a ~w wichh wpars the opuutt text. I have wtteirn warp.erl wihch waprs a flie (apdepned) - it should be pttery esay to ilnudce tihs itno the sraatdnd laiirebrs. This ieda is besad on smoe ctintug edge reecrash at Cgramidbe Uientvsiry which has shwon that it deosn't rellay mttear how wrods are selpt as long as the frist and lsat lrttees are cecorrt. Cehers /Joe ---- cut ---- -module(warp). -import(lists, [map/2, reverse/1]). -export([file/1, word/1]). file(F) -> {ok, B} = file:read_file(F), L = binary_to_list(B), L1 = tokenise(L, []), Lines = map(fun warp_line/1, L1), file:write_file(F ++ ".warp", Lines). is_alpha(X) when X >= $a, X =< $z -> true; is_alpha(X) when X >= $A, X =< $Z -> true; is_alpha(X) -> false. tokenise(All = [H|T], L) -> case is_alpha(H) of true -> {Word, Rest} = collect_while(fun is_alpha/1, All), tokenise(Rest, [{word,Word}|L]); false -> tokenise(T, [H|L]) end; tokenise([], L) -> reverse(L). collect_while(Pred, L) -> collect_while(Pred, L, []). collect_while(pred, [], L) -> {[], reverse(L)}; collect_while(Pred, All = [H|T], L) -> case Pred(H) of true -> collect_while(Pred, T, [H|L]); false -> {reverse(L), All} end. warp_line({word,L}) -> word(L); warp_line(X) -> X. word([X]) -> X; word([H|T]) -> [Last|R] = reverse(T), [H|reverse([Last|warp_word(R, [])])]. warp_word([], L) -> L; warp_word(L1, L2) -> N = random:uniform(length(L1)), {H,T} = take_nth(N, L1, []), warp_word(T, [H|L2]). take_nth(1, [H|T], L) -> {H, T ++ L}; take_nth(N, [H|T], L) -> take_nth(N-1, T, [H|L]). From david.wallin@REDACTED Thu Nov 27 15:43:46 2003 From: david.wallin@REDACTED (david wallin) Date: Thu, 27 Nov 2003 14:43:46 +0000 Subject: has anybody written a BF interpreter in Erlang? Message-ID: <1ADECCA2-20E8-11D8-B4AC-000393536F4E@ul.ie> Hi, Subject says it all, don't make me spell it out more than that. http://home.planet.nl/~faase009/Ha_BF.html ...and for Luke: http://www.delysid.org/emacs/bf.html cheers, --david. From bry@REDACTED Thu Nov 27 22:10:19 2003 From: bry@REDACTED (bry@REDACTED) Date: Thu, 27 Nov 2003 22:10:19 CET Subject: mnesia_session Message-ID: <200311272210807.SM00956@Debug> I'm in the preliminary sketching out of some stuff I want to work on in the near future, for this work I want to use mnesia, but I don't want to use erlang for all my code, so I want to interface to mnesia from a third language, unfortunately (or fortunately from my point of view) this language doesn't have corba, and hell, come to think of it, I don't have corba, or more than a cursory acquaintence with idl! so what I would like to do is to communicate via a port from language a to erlang and pass in tables to mnesia. is there anything like that in tutorial or implementation form already? From hal@REDACTED Thu Nov 27 22:30:16 2003 From: hal@REDACTED (Hal Snyder) Date: Thu, 27 Nov 2003 15:30:16 -0600 Subject: mnesia_session In-Reply-To: <200311272210807.SM00956@Debug> (bry@xdocs.dk's message of "Thu, 27 Nov 2003 22:10:19 CET") References: <200311272210807.SM00956@Debug> Message-ID: <871xrtlct3.fsf@ghidra.vail> bry@REDACTED writes: > I'm in the preliminary sketching out of some > stuff I want to work on in the near future, > for this work I want to use mnesia, but I > don't want to use erlang for all my code, so > I want to interface to mnesia from a third > language, unfortunately (or fortunately > from my point of view) this language doesn't > have corba, and hell, come to think of it, I > don't have corba, or more than a cursory > acquaintence with idl! > so what I would like to do is to communicate > via a port from language a to erlang and > pass in tables to mnesia. > is there anything like that in tutorial or > implementation form already? It depends on your app, the other languages, etc. Have you looked at UBF? I would start there in many cases. http://www.sics.se/~joe/ubf/site/home.html or you could look at erl_interface http://www.erlang.org/doc/r9c/lib/erl_interface-3.4/doc/html/index.html or jinterface http://www.erlang.org/doc/r9c/lib/jinterface-1.2.1.1/doc/html/index.html or yaws http://yaws.hyber.org/ or inets http://www.erlang.org/doc/r9c/lib/inets-3.0.6/doc/html/index.html or unix pipe (Erlang port) - we do this to some SQL servers http://www.erlang.org/doc/r9c/lib/kernel-2.9/doc/html/erlang.html#open_port%2 maybe even SNMP http://www.drxyzzy.org/mnesia-snmp/index.html From rprice@REDACTED Thu Nov 27 23:09:52 2003 From: rprice@REDACTED (Roger Price) Date: Thu, 27 Nov 2003 23:09:52 +0100 (CET) Subject: Relation to Pi Calculus Message-ID: David Van Horn wrote [1] > I've heard that Erlang is essentially an implementation of the untyped > pi calculus. Is this a fair characterization? Which variant of the pi > calculus most closely resembles Erlang (eg, asynchronous pi, distributed > pi, seal, join, etc.)? Could someone provide examples of Erlang > primitives that closely rememble the pi calculus primitives: input, > output, and restriction? Sorry for the much delayed comment - Richard Carlsson has already explained [2] that Erlang is a lot larger than the pi calculus. Although Erlang is not in itself an implementation of an untyped pi calculus, I have found that it is a excellent vehicle for implementing emulators of pi calculi "hardware". I implemented a subset of Pierce and Turner's Pict [3] using the equivalences Pi calculus | Erlang ---------------+------------- input process | explicit fun output process | argument to function path | Erlang process My subset is asynchronous, higher-order, polyadic and concurrent with automatic compile-time typing ? la ML. It is not deterministic, polymorphic (except for a few list operations), linear or sequenced. There is no sub-typing. Although the implementation is potentially distributable over more than one processor, I do not do this. Erlang gives remarkably good performance. My first implementation was a denotational semantics based interpreter in SML/NJ at 30 reductions/sec on a 1GHz Intel PC. I re-wrote this in John Reppy's Concurrent ML and achieved 300-500 reductions/sec [4]. I re-wrote again to issue Erlang source code and achieved 10000 reductions per second for simple programs such as factorial(n), n=1000. On a more ambitious program with heavy animated graphics such as ant raids [5], I get up to 3000 reductions per second. Some notes on the emulator: All Erlang processes run the same program which waits to receive explicit funs and arguments, and applies them eagerly. Although there are typically 2500 Erlang processes active at any one time, the pi calculus concurrency is often only 20. I rolled my own garbage collection of no-longer-needed paths. A path has an average life of less than one second. Erlang's own garbage collection seems to thrash on long runs: I fixed this by setting erlang:system_flag(fullsweep_after,0). Debugging in the pi calculus is _difficult_. When 2000 identical Erlang processes talk themselves in a spaghetti deadlock, you need all the help you can get. I added a lot of extra code and data structure to help out, but this slows things down. I would be very interested to hear of other attempts to use Erlang to implement pi calculi. Roger [1] http://www.erlang.org/ml-archive/erlang-questions/200310/msg00108.html [2] http://www.erlang.org/ml-archive/erlang-questions/200310/msg00141.html [3] http://www.cis.upenn.edu/~bcpierce/papers/pict-design.ps [4] To be fair, Concurrent ML is a _synchronous_ language and the additional engineering needed for asynchronous one-way communication really slows things down. [5] "Swarm Intelligence", Eric Bonabeau, Marco Dorigo, Guy Theraulz, chapter 2.2.3. From nick@REDACTED Fri Nov 28 09:06:03 2003 From: nick@REDACTED (Niclas Eklund) Date: Fri, 28 Nov 2003 09:06:03 +0100 (MET) Subject: mnesia_session In-Reply-To: <871xrtlct3.fsf@ghidra.vail> Message-ID: I agree with Hal - it depends on your application, but the other languages shouldn't(?!) be a problem. CORBA language mappings (that I know of): * Erlang * C/C++ * Smalltalk * Ada * Java * Lisp * COBOL * Python * Tcl * Perl Understanding IDL is rather simple; for those who have used C/C++ or Java it's just like a walk in the park and a compact way to define your API (especially compared to, for example, XML etc). You can find a step-by-step description via: http://www.erlang.org/doc/r9c/lib/orber-3.4.2/doc/html/ch_idl_to_erlang_mapping.html#6 /Nick On Thu, 27 Nov 2003, Hal Snyder wrote: > bry@REDACTED writes: > > > I'm in the preliminary sketching out of some > > stuff I want to work on in the near future, > > for this work I want to use mnesia, but I > > don't want to use erlang for all my code, so > > I want to interface to mnesia from a third > > language, unfortunately (or fortunately > > from my point of view) this language doesn't > > have corba, and hell, come to think of it, I > > don't have corba, or more than a cursory > > acquaintence with idl! > > > so what I would like to do is to communicate > > via a port from language a to erlang and > > pass in tables to mnesia. > > > is there anything like that in tutorial or > > implementation form already? > > It depends on your app, the other languages, etc. > > Have you looked at UBF? I would start there in many cases. > http://www.sics.se/~joe/ubf/site/home.html > > or you could look at erl_interface > http://www.erlang.org/doc/r9c/lib/erl_interface-3.4/doc/html/index.html > > or jinterface > http://www.erlang.org/doc/r9c/lib/jinterface-1.2.1.1/doc/html/index.html > > or yaws > http://yaws.hyber.org/ > > or inets > http://www.erlang.org/doc/r9c/lib/inets-3.0.6/doc/html/index.html > > or unix pipe (Erlang port) - we do this to some SQL servers > http://www.erlang.org/doc/r9c/lib/kernel-2.9/doc/html/erlang.html#open_port%2 > > maybe even SNMP > http://www.drxyzzy.org/mnesia-snmp/index.html From tony@REDACTED Fri Nov 28 10:39:34 2003 From: tony@REDACTED (Tony Rogvall) Date: 28 Nov 2003 10:39:34 +0100 Subject: SSL in Erlang/OTP In-Reply-To: References: Message-ID: <1070012374.28758.42.camel@bit.hemma.se> On Wed, 2003-11-26 at 21:10, Peter H|gfeldt wrote: > Yes, I agree that ssl:recv/x and ssl:send/x should behave as > gen_tcp:recv/x and gen_tcp:send/x do. > > I will add that request to the todo-list for the next release. > Did not Bluetail send the ssl driver to OTP? The Bluetail ssl driver was a clone of gen_tcp. It did support reading sessions (even reading encoded sessions that could be sent to other nodes or stored in mnesia for distrubuted SSL sessions :-) My idea is to integrate ssl in gen_tcp to make life alot easier. Think of STARTTLS/HTTP Upgrade .... It is also "easy" to snoop SSLv3/SessionID's, then push back the client-hello with gen_tcp:unrecv, then ssl:accept (VOILA) Bluetail folks, did you send the ssl_drv ???? /Tony -- Tony Rogvall -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part URL: From rprice@REDACTED Fri Nov 28 17:36:35 2003 From: rprice@REDACTED (Roger Price) Date: Fri, 28 Nov 2003 17:36:35 +0100 (CET) Subject: Relation to Pi Calculus In-Reply-To: Message-ID: On Fri, 28 Nov 2003, Joe Armstrong wrote: > Have you written this stuff up? I'd love to read more about it. > Are you distributing the implementation? Hello Joe, I have a lot of documentation, but I am currently stuck in a compiler problem with validation of pattern matching. When I can guarantee that there will be no 'function_clause' errors at run-time, I will test with the latest Erlang distribution R9C-0, and then I would be happy to make the work available (GPL). Best Regards, Roger From cpressey@REDACTED Sat Nov 29 01:57:35 2003 From: cpressey@REDACTED (Chris Pressey) Date: Fri, 28 Nov 2003 16:57:35 -0800 Subject: has anybody written a BF interpreter in Erlang? In-Reply-To: <1ADECCA2-20E8-11D8-B4AC-000393536F4E@ul.ie> References: <1ADECCA2-20E8-11D8-B4AC-000393536F4E@ul.ie> Message-ID: <20031128165735.0ca04338.cpressey@catseye.mine.nu> On Thu, 27 Nov 2003 14:43:46 +0000 david wallin wrote: > Hi, > > Subject says it all, don't make me spell it out more than that. Why soitainly. Nyuk nyuk nyuk. http://www3.telus.net/~cpressey/distfiles/pibfi-2003.0505.tgz Hm, it's probably the most feature-rich BF interpreter currently in existence, come to think of it :) -Chris From hal@REDACTED Sat Nov 29 04:40:29 2003 From: hal@REDACTED (Hal Snyder) Date: Fri, 28 Nov 2003 21:40:29 -0600 Subject: has anybody written a BF interpreter in Erlang? In-Reply-To: <1ADECCA2-20E8-11D8-B4AC-000393536F4E@ul.ie> (david wallin's message of "Thu, 27 Nov 2003 14:43:46 +0000") References: <1ADECCA2-20E8-11D8-B4AC-000393536F4E@ul.ie> Message-ID: <87ptfb6dw2.fsf@ghidra.vail> david wallin writes: > Subject says it all, don't make me spell it out more than that. > > http://home.planet.nl/~faase009/Ha_BF.html > > ...and for Luke: > > http://www.delysid.org/emacs/bf.html Anyone else look at this and think PDP-8 microcode?