From laheadle@REDACTED Tue Feb 1 07:33:16 2005 From: laheadle@REDACTED (Lyn Headley) Date: Mon, 31 Jan 2005 22:33:16 -0800 (PST) Subject: another Workflow system In-Reply-To: Message-ID: <20050201063316.37153.qmail@web30706.mail.mud.yahoo.com> Hi Bob, your workflow system reminds me of the system I'm working on, although not exactly. My system facilitates 2-party "complex conversations" (it's designed for working social theorists, e.g. professors, grad students, etc, but should work for any kind of complex conversation). right now it's a quick and dirty distel/erlang program looking for a more robust network semantics and backend. the idea is that a conversation consists of a series of topics, where a topic is displayed in an emacs frame and contains 4 buffers called perspectives, which represent positions in the evolving argument/dialogue. like so: ---------------------------- | self-strong | other-weak | |--------------------------- |other-strong | self-weak | ---------------------------- where self-strong is my position, other-strong is your position, self-weak is my reply to your position, and other-weak is your reply to my position. then at any time i can either 1) rewrite self-strong 2) rewrite self-weak or 3) create a new topic. now here's where the workflow comes in. once we've got two (or more) topics going we'll have several fairly independent lines of dialogue going. Thus I may be writing a reply on topic one while you update topic two. The difficulty for my system is that, although it is useful for the system to inform me when my partner has made a "move," this doesn't mean my partner must wait on my reply before moving again. in fact, if I make a change and don't like it, I can just change it again. So I suppose my system needs something like an event notification engine, rather than the strict turn-based ordering you can rely on. But I like the tabbed interface idea with Green and Red indicating the "needs attention" status of the tab. And I'm thinking of going over to UBF at some point too. So i'll be curious to see where your project heads. best, Lyn Headley __________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com From thomas.xa.johnsson@REDACTED Tue Feb 1 08:34:13 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Tue, 1 Feb 2005 08:34:13 +0100 Subject: Concatenating atoms Message-ID: There appears to be no cheaper way to concatenate two atom than list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) ... or have I missed something? -- Thomas From raimo@REDACTED Tue Feb 1 08:58:47 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 01 Feb 2005 08:58:47 +0100 Subject: Concatenating atoms References: Message-ID: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > There appears to be no cheaper way to concatenate two atom than > > list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) > > ... or have I missed something? > -- Thomas Nope. You have to create a new atom that just happens to have a string representation that is the concatenation of two other atoms string representations in the runtime system. All atoms have the same size; one machine word. It is like a unique integer with a string representation. The entries in the atom table may differ in size, but that is just one place in the runtime system. When you create an atom you have to first check that its string representation does not already exist in the atom table and if not create a new entry with a new unique integer. The atom table has got a fixed max size, so creating atoms during runtime is often not a good idea, unless it happens a limited number of times. If creating new atoms with new different string representations is a part of the normal application processing, the atom table will be filled one day and the runtime system fails. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bfulg@REDACTED Tue Feb 1 09:10:26 2005 From: bfulg@REDACTED (Brent Fulgham) Date: Tue, 1 Feb 2005 00:10:26 -0800 Subject: Documentation Search Path Patches Message-ID: <88c369de4370c7eef846f287a9cbdab3@pacbell.net> These patches have been reported a few times (and applied in the Debian and DarwinPorts packages of Erlang.) Could they please be applied to upstream OTP so that package maintainers do not have to keep applying the same patches? -------------- next part -------------- A non-text attachment was scrubbed... Name: brent.diff Type: application/octet-stream Size: 10364 bytes Desc: not available URL: -------------- next part -------------- Thanks, -Brent -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part URL: From dietmar@REDACTED Tue Feb 1 09:30:21 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Tue, 01 Feb 2005 09:30:21 +0100 Subject: how to use send_notification Message-ID: <41FF3E1D.50804@ast.dfs.de> Hi ! Actually I am trying to send a trap (SNMPv1 ) but NOTE ! this function is only for ... Use send_notification instead .. -> ok. But how to use send_notification ? My questions: send_notification(Agent,Notification,Receiver) Agent is the PID of my agent in the call to snmp:start(). Notification is something I choose for example 'shutdown' Receiver what is that supposed to be ? I need to send a trap/notification the Network Management Station in out LAN on which a commercial and expensive software is willing the receive the trap/notification) Any hint ? Regards Dietmar From thomas.xa.johnsson@REDACTED Tue Feb 1 09:41:29 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Tue, 1 Feb 2005 09:41:29 +0100 Subject: Concatenating atoms Message-ID: Yes, this performance issue occurs when the created atoms already exist in the atom table. (If the newly created atoms don't exist previously the atom table will be filled up quickly, in which case we will have a different problem!) So it ought to be a fairly fast operation to check whether the concatenation of two atoms exist already in the atom table? -- Thomas -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Raimo Niskanen Sent: den 1 februari 2005 08:59 To: erlang-questions@REDACTED Subject: Re: Concatenating atoms thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > There appears to be no cheaper way to concatenate two atom than > > list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) > > ... or have I missed something? > -- Thomas Nope. You have to create a new atom that just happens to have a string representation that is the concatenation of two other atoms string representations in the runtime system. All atoms have the same size; one machine word. It is like a unique integer with a string representation. The entries in the atom table may differ in size, but that is just one place in the runtime system. When you create an atom you have to first check that its string representation does not already exist in the atom table and if not create a new entry with a new unique integer. The atom table has got a fixed max size, so creating atoms during runtime is often not a good idea, unless it happens a limited number of times. If creating new atoms with new different string representations is a part of the normal application processing, the atom table will be filled one day and the runtime system fails. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo@REDACTED Tue Feb 1 09:56:20 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 01 Feb 2005 09:56:20 +0100 Subject: Concatenating atoms References: Message-ID: Looking up an atom name in the atom table is fast. It is a hash table. Creating the atom name to look for (creating the two parts and appending) is also rather fast. All those operations are BIFs. You will produce some garbage for the GC, - one cons cell (two machine words) per character in Atom1 and two per character in Atom2 (I guess), so it is hopefully not very much. thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > Yes, this performance issue occurs when the created atoms already exist in the atom table. > (If the newly created atoms don't exist previously the atom table will be filled up quickly, > in which case we will have a different problem!) > So it ought to be a fairly fast operation to check whether the concatenation of two atoms > exist already in the atom table? > -- Thomas > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Raimo Niskanen > Sent: den 1 februari 2005 08:59 > To: erlang-questions@REDACTED > Subject: Re: Concatenating atoms > > > thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > > > There appears to be no cheaper way to concatenate two atom than > > > > list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) > > > > ... or have I missed something? > > -- Thomas > > Nope. > > You have to create a new atom that just happens to have a string > representation that is the concatenation of two other atoms > string representations in the runtime system. > > All atoms have the same size; one machine word. It is like a unique > integer with a string representation. The entries in the atom > table may differ in size, but that is just one place in the > runtime system. > > When you create an atom you have to first check that its string > representation does not already exist in the atom table and if > not create a new entry with a new unique integer. > > The atom table has got a fixed max size, so creating atoms during > runtime is often not a good idea, unless it happens a limited > number of times. If creating new atoms with new different string > representations is a part of the normal application processing, the > atom table will be filled one day and the runtime system fails. > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From nm@REDACTED Tue Feb 1 10:07:10 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 01 Feb 2005 13:07:10 +0400 Subject: [newbie] refactor function? Message-ID: <41FF46BE.9030003@web.am> Hello All! what is a correct way of writing following function (initQuota/1) -- probably i got problems thinking in a functional way ;) ? i wish to get rid of last two cases. following function just adds to list of tuples with range descriptions initial zero value, which will be changed later in application. -cut- testInitQuota() -> [{ single, "AAA", 0 }] = initQuota( [ { single, "AAA" } ] ), [{ range, "AAA", "BBB", 0 }] = initQuota( [ { range, "AAA", "BBB" } ] ), [{ single, "AAA", 0 },{ range, "AAA", "BBB", 0 }] = initQuota( [ { single, "AAA" },{ range, "AAA", "BBB" } ] ). initQuota([Head | QuotaList]) -> lists:reverse(initQuota(Head, QuotaList, [])). initQuota( { range, Value1, Value2 }, [Head | QuotaList], NewList ) -> initQuota( Head, QuotaList, [ { range, Value1, Value2, 0 } ] ++ NewList ); initQuota( { single, Value1 }, [Head | QuotaList], NewList ) -> initQuota( Head, QuotaList, [ { single, Value1, 0 } ] ++ NewList ); initQuota( { range, Value1, Value2 }, [], NewList ) -> [ { range, Value1, Value2, 0 } ] ++ NewList; initQuota( { single, Value1 }, [], NewList ) -> [ { single, Value1, 0 } ] ++ NewList. -cut- another way -- what is a common way to traverse list, find one element, and replace it with new data? are there any functions in lists: module or i should write it myself ? -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From thomas.xa.johnsson@REDACTED Tue Feb 1 10:10:52 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Tue, 1 Feb 2005 10:10:52 +0100 Subject: Concatenating atoms Message-ID: What I was driving at (sorry for not being clear): both the hashing and the comparison of atoms could presumably be done *without actually* (re)creating the concatenated atom (especially not using intermediate lists)? -- Thomas -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] Sent: den 1 februari 2005 09:56 To: erlang-questions@REDACTED Subject: Re: Concatenating atoms Looking up an atom name in the atom table is fast. It is a hash table. Creating the atom name to look for (creating the two parts and appending) is also rather fast. All those operations are BIFs. You will produce some garbage for the GC, - one cons cell (two machine words) per character in Atom1 and two per character in Atom2 (I guess), so it is hopefully not very much. thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > Yes, this performance issue occurs when the created atoms already exist in the atom table. > (If the newly created atoms don't exist previously the atom table will be filled up quickly, > in which case we will have a different problem!) > So it ought to be a fairly fast operation to check whether the concatenation of two atoms > exist already in the atom table? > -- Thomas > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Raimo Niskanen > Sent: den 1 februari 2005 08:59 > To: erlang-questions@REDACTED > Subject: Re: Concatenating atoms > > > thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > > > There appears to be no cheaper way to concatenate two atom than > > > > list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) > > > > ... or have I missed something? > > -- Thomas > > Nope. > > You have to create a new atom that just happens to have a string > representation that is the concatenation of two other atoms > string representations in the runtime system. > > All atoms have the same size; one machine word. It is like a unique > integer with a string representation. The entries in the atom > table may differ in size, but that is just one place in the > runtime system. > > When you create an atom you have to first check that its string > representation does not already exist in the atom table and if > not create a new entry with a new unique integer. > > The atom table has got a fixed max size, so creating atoms during > runtime is often not a good idea, unless it happens a limited > number of times. If creating new atoms with new different string > representations is a part of the normal application processing, the > atom table will be filled one day and the runtime system fails. > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Tue Feb 1 10:13:52 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Feb 2005 10:13:52 +0100 Subject: [newbie] refactor function? In-Reply-To: <41FF46BE.9030003@web.am> References: <41FF46BE.9030003@web.am> Message-ID: <41FF4850.1000900@ericsson.com> Gaspar Chilingarov wrote: ...deleted > following function just adds to list of tuples with range descriptions > initial zero value, which will be changed later in application. you might want to consider using records (instead of tuples). ...deleted > another way -- what is a common way to traverse list, find one element, > and replace it with new data? are there any functions in lists: module take a look at lists:keyreplace/4 bengt From joe.armstrong@REDACTED Tue Feb 1 10:15:02 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 1 Feb 2005 10:15:02 +0100 Subject: another Workflow system Message-ID: What fun - before you can make a UBF spec (which might be overkill) you have to decide on an architecture and model the data structures you need. Here's a few thoughts on this: Architecture 1 - centralised server First we need a model of the conversation. Id rather like to see this: +-------------+ +-------------+ | +-------------+ | | | SS | SW | | | |-------------| |-+ | OS | OW |-+ +-------------+ This your diagram but with a time axis - ie I'd like to see how the argument state changes with time - the top of the stack is the current state of the argument - each stack frame represents a snapshot of the argument at a particular time. On a centralised server we can model everything as all_arguments => [id] list of all arguments in the system. Each argument has a unique Id argument[id] => {userId1, userId2, [{What,Time,Str}] The individual arguments - UserId1, UserId2 are (Self and Other) What is ss, os, sw or ow ie which part of the argument has changed notify[UserId] => [Id] a notification array - for each user this has a list of Id's of the arguments which have changes since they last modified the argument The client protocol is easy: First authenticate the user (say using challenge/response and a shared secret) Then send {update,Id,U,What,Str} messages to the server Id = the argument Id, U = the authenticated user, What is one of ss,os,sw or ow The server updates the argument[Id] entry and adds Id to notify[U1] where U1 is the other person in the conversation. It removes id from notify[U] if it were present. Now you have to make some design decisions. How should we store these conversations? - these are design chooses: - One per file - Everything in one file - Everything in dets - Everything in mnesuia - Everything in an external data base etc. I'd start with the simplest (one per file, and use term_to_binary etc. :-) Then the interface - emacs is fine but scary for naive users. Id use yaws (for form generatation) + an embedded JavaScript rich text editor << aside www.kevinroth.com/rte/demo.htm is great for this. BTW if anybody is interested I have made several changes to this editor to beautify the code if you are interested mail me >> You could easily make a form (in yaws) with four squares in it with a wysiwyg RTE editor in each and a Send button. Then you need a bit os stuff for account creation - this is (I think) included in the yaws distribution. Architecture 2 Is like 1 but you make a hot standby/failover node Read my http://www.sics.se/~joe/tutorials/robust_server/robust_server.html to see how to do this (this uses a replicated mnesia data base) Architecture 3 Umm - peer to peer - keep the conversations on the peers. The server now just maintains list of the hostnames of all the users etc. This is beginning to get tricky since there are no of-the-shelf P2P infrastructures that can be used for this. > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Lyn Headley > Sent: den 1 februari 2005 07:33 > To: Bob.Smart@REDACTED; erlang-questions@REDACTED > Subject: another Workflow system > > > Hi Bob, > > your workflow system reminds me of the system I'm working on, > although not exactly. My system facilitates 2-party "complex > conversations" (it's designed for working social theorists, e.g. > professors, grad students, etc, but should work for any kind of > complex conversation). right now it's a quick and dirty > distel/erlang program looking for a more robust network semantics > and backend. the idea is that a conversation consists of a series > of topics, where a topic is displayed in an emacs frame and > contains 4 buffers called perspectives, which represent positions > in the evolving argument/dialogue. > > like so: > > ---------------------------- > | self-strong | other-weak | > |--------------------------- > |other-strong | self-weak | > ---------------------------- > > where self-strong is my position, other-strong is your position, > self-weak is my reply to your position, and other-weak is your > reply to my position. then at any time i can either > > 1) rewrite self-strong > 2) rewrite self-weak or > 3) create a new topic. > > now here's where the workflow comes in. once we've got two (or > more) topics going we'll have several fairly independent lines of > dialogue going. Thus I may be writing a reply on topic one while > you update topic two. The difficulty for my system is that, > although it is useful for the system to inform me when my partner > has made a "move," this doesn't mean my partner must wait on my > reply before moving again. in fact, if I make a change and don't > like it, I can just change it again. So I suppose my system needs > something like an event notification engine, rather than the > strict turn-based ordering you can rely on. But I like the tabbed > interface idea with Green and Red indicating the "needs > attention" status of the tab. And I'm thinking of going over to > UBF at some point too. So i'll be curious to see where your > project heads. > > best, > Lyn Headley > > > > > > __________________________________ > Do you Yahoo!? > The all-new My Yahoo! - What will yours do? > http://my.yahoo.com > From raimo@REDACTED Tue Feb 1 11:09:03 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 01 Feb 2005 11:09:03 +0100 Subject: Concatenating atoms References: Message-ID: Aah, okay... Yes, of course it could be done with a new BIF, but currently there is no cheaper way of doing it. But this sounds like an odd special case to me, and we do not want to encourage application programmers to dynamically create atoms. If we add such a BIF, I am sure someone wants a BIF that creates an atom consisting of a base atom and an integer string suffix. Or, I might be wrong - this is not an odd special case - or you have an application where performance in this operation is essential. Is it an actual problem for you? thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > What I was driving at (sorry for not being clear): > both the hashing and the comparison of atoms could presumably be done *without actually* > (re)creating the concatenated atom (especially not using intermediate lists)? > -- Thomas > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 1 februari 2005 09:56 > To: erlang-questions@REDACTED > Subject: Re: Concatenating atoms > > > Looking up an atom name in the atom table is fast. It is a hash table. > Creating the atom name to look for (creating the two parts and > appending) is also rather fast. All those operations are BIFs. > You will produce some garbage for the GC, - one cons cell (two > machine words) per character in Atom1 and two per character in > Atom2 (I guess), so it is hopefully not very much. > > > > thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > > > Yes, this performance issue occurs when the created atoms already exist in the atom table. > > (If the newly created atoms don't exist previously the atom table will be filled up quickly, > > in which case we will have a different problem!) > > So it ought to be a fairly fast operation to check whether the concatenation of two atoms > > exist already in the atom table? > > -- Thomas > > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Raimo Niskanen > > Sent: den 1 februari 2005 08:59 > > To: erlang-questions@REDACTED > > Subject: Re: Concatenating atoms > > > > > > thomas.xa.johnsson@REDACTED (Thomas Johnsson XA LN/EAB) writes: > > > > > There appears to be no cheaper way to concatenate two atom than > > > > > > list_to_atom(atom_to_list(Atom1) ++ atom_to_list(Atom2)) > > > > > > ... or have I missed something? > > > -- Thomas > > > > Nope. > > > > You have to create a new atom that just happens to have a string > > representation that is the concatenation of two other atoms > > string representations in the runtime system. > > > > All atoms have the same size; one machine word. It is like a unique > > integer with a string representation. The entries in the atom > > table may differ in size, but that is just one place in the > > runtime system. > > > > When you create an atom you have to first check that its string > > representation does not already exist in the atom table and if > > not create a new entry with a new unique integer. > > > > The atom table has got a fixed max size, so creating atoms during > > runtime is often not a good idea, unless it happens a limited > > number of times. If creating new atoms with new different string > > representations is a part of the normal application processing, the > > atom table will be filled one day and the runtime system fails. > > > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Tue Feb 1 11:41:58 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Feb 2005 02:41:58 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050201104159.78980.qmail@web41907.mail.yahoo.com> --- Raimo Niskanen wrote: > we do not want > to encourage application programmers to dynamically > create atoms. As an alternative to discouraging developers, I'd like to encourage the Erlang implementation community to, at long last, implement an atom GC :-) (Well, I really do.) Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 From thomasl_erlang@REDACTED Tue Feb 1 11:46:11 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Feb 2005 02:46:11 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050201104611.33569.qmail@web41904.mail.yahoo.com> --- "Thomas Johnsson XA (LN/EAB)" wrote: > So it ought to be a fairly fast operation to check > whether the concatenation of two atoms > exist already in the atom table? To chime in a bit: It _would_ be useful to have some way to check whether an atom with a given name already exists. Compiler writers and other "gensym users" would appreciate it (at least some -- me -- would). Come to think of it, good old Lisp gensym would come in handy too. Best, Thomas __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail From joe.armstrong@REDACTED Tue Feb 1 12:18:14 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 1 Feb 2005 12:18:14 +0100 Subject: Concatenating atoms Message-ID: > Thomas Lindgren wrote > As an alternative to discouraging developers, I'd like > to encourage the Erlang implementation community to, > at long last, implement an atom GC :-) (Well, I really > do.) > > Best, > Thomas Nja - Ummm - we're garbing the wrong thing - we should be garbing the code space and not the atom space, atoms should be local to modules and not global at all. There should not be a global atom table in the first place - it violates the principle of isolation. The atom table is an efficiency lack which should never have be made. With a little carefull re-design we could eliminate the atom table and then no GC is required. This would mean that each module would have to have its own private atom table. With a little thought (little = about 10 years :-) we could arrange that: - atom comparisons within the same module is atomic - atom comparisons of atoms in two different modules is atomic the second time it is made is a hash table lookup the first time it is made Atoms would be represented as (AtomTag, Pointer) -> (LocalHashTablePointer) -> Value (RemotehashTablePointer) ie each Atom (a tagged pointer) points to two words. The first is a pointer to the local module hash table The second is zero (initially) is used to cache a hint pointer (the hint points to an atom in a remote module which is known to be the same as the local atom) - when two or more modules use the same atom - the numerically lowest pointer should be used. This would need a few more changes: - we don't move code - we garbage collect code (ie not have two versions) - when code Is finally removed (by GC) then we sweep all code spaces zeroing any cached remote hash table pointers basically we should not garb the atom table - we should garb the code space - and we should dynamically cache atom and function start addresses. The idea of having two versions of code is silly anyway - we should have N versions and garb away old versions. Atoms should not be global, but local to individual modules and cacheable hint pointers should be used to optimise atom comparison and function start address resolution. Code should be first class - but probably represented by special frozen heap objects since it is likely to hang around for a long time and moving it would be expensive since we would have to invalidate the cached heap references Cheers /Joe From thomasl_erlang@REDACTED Tue Feb 1 14:10:54 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Feb 2005 05:10:54 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050201131054.17320.qmail@web41908.mail.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > > Thomas Lindgren wrote > > [atom gc!] > > Nja - Ummm - we're garbing the wrong thing - we > should be garbing > the code space and not the atom space, atoms should > be local to modules > and not global at all. ... > There should not be a global > atom table in the > first place - it violates the principle of > isolation. Violates it in what way? The serious issue about atoms as implemented today, in my mind, is that (a) you may run out of them, (b) once you have created one, you can never get rid of it. (Except by restarting the VM.) > [atoms should be put in per-module atom tables] How would dynamically created atoms be handled? > [code should be garbage collected] I think I agree with this, regardless of the treatment of atoms, but I'd probably want a mechanism to manage the various loaded module versions too.(*) In particular, the great advantage of the current code model ("as you know, Bob" :-) is never getting space leaks due to obsolete module versions hanging around. A requirement should be that new schemes not be too vulnerable to that either. By the way, that multithreaded Erlang had code GC, didn't it? Were there any lessons on how well it worked? Best, Thomas (*) Actually, I want a lot of things when it comes to modules :-) __________________________________ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 From joe.armstrong@REDACTED Tue Feb 1 15:23:27 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 1 Feb 2005 15:23:27 +0100 Subject: Concatenating atoms Message-ID: > > > > Thomas Lindgren wrote > > > [atom gc!] > > > > Nja - Ummm - we're garbing the wrong thing - we > > should be garbing > > the code space and not the atom space, atoms should > > be local to modules > > and not global at all. > ... > > There should not be a global > > atom table in the > > first place - it violates the principle of > > isolation. > > Violates it in what way? Things are isolated if they do not share anything. Modules (after loading) share pointers into hash tables Which is *evil* > > The serious issue about atoms as implemented today, in > my mind, is that (a) you may run out of them, (b) once > you have created one, you can never get rid of it. > (Except by restarting the VM.) > > > [atoms should be put in per-module atom tables] > > How would dynamically created atoms be handled? > Put them on the local heap and compare each time :-) I'm not even sure if having an atom table etc. saves much time. Suppose we did atom comparisons the hard way, testing *each* time that the data in the atoms was identical how long would this take? On a 32 bit machine this might involve comparing 2-3 words for equality. +---------+ +--------+ | tag ---|-----------> | Length | +---------+ +--------+ | chars | +--------+ | ... | +--------+ An 8 character atom would involve comparing 3 words for equality etc. Since you get good locality of refence I suspect this is a pretty efficient operation Various optimisations are possible (for example using a crc32 checksum for long atoms etc) On a 64 bit machine things become interesting Assume (short) characters are restricted to a-zA-Z0-9_- (64 possible characters) Each (short) character takes 6 bits so in 64 bits we could pack say 4 tag bits + 10 characters. Now we could make two types of atoms (short and long) short atoms must be <= 10 short characters. This would be nice because longSillyAtomNamesThatAreTotallyUnreadable would be less attractive :-) /Joe > > [code should be garbage collected] > > I think I agree with this, regardless of the treatment > of atoms, but I'd probably want a mechanism to manage > the various loaded module versions too.(*) > > In particular, the great advantage of the current code > model ("as you know, Bob" :-) is never getting space > leaks due to obsolete module versions hanging around. > A requirement should be that new schemes not be too > vulnerable to that either. > > By the way, that multithreaded Erlang had code GC, > didn't it? Were there any lessons on how well it > worked? > > Best, > Thomas > > (*) Actually, I want a lot of things when it comes to > modules :-) > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Find what you need with new enhanced search. > http://info.mail.yahoo.com/mail_250 > From nm@REDACTED Tue Feb 1 16:56:37 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Tue, 01 Feb 2005 19:56:37 +0400 Subject: [newbie] refactor function? In-Reply-To: <41FF4850.1000900@ericsson.com> References: <41FF46BE.9030003@web.am> <41FF4850.1000900@ericsson.com> Message-ID: <41FFA6B5.1020604@web.am> Bengt Kleberg wrote: > Gaspar Chilingarov wrote: > ...deleted > >> following function just adds to list of tuples with range descriptions >> initial zero value, which will be changed later in application. > > > you might want to consider using records (instead of tuples). > one question to clarify thing -- when i have function, which splits list to head and tail, i always need to have separate clause for empty list case, am i ? -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From thomasl_erlang@REDACTED Tue Feb 1 16:56:25 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 1 Feb 2005 07:56:25 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050201155625.19506.qmail@web41904.mail.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > > > There should not be a global > > > atom table in the > > > first place - it violates the principle of > > > isolation. > > > > Violates it in what way? > > Things are isolated if they do not share anything. > > Modules (after loading) share pointers into hash > tables > Which is *evil* Heh, well, erts is probably best viewed as Mordor in that case :-) Though to get "isolation" right, your two processes are already running distributed Erlang on two geographically separated PCs communicating over wireless, and hence won't be sharing an atom table anyway :-) > I'm not even sure if having an atom table etc. > saves much time. > Suppose we did atom comparisons the hard way, > testing *each* time > that the data in the atoms was identical how long > would this take? Easy enough to guesstimate, I suppose: how often do you match atoms vs atoms? What is the new and old cost of comparison, in cycles? How many new atoms are allocated during execution? What is the cost of allocating an atom (new vs old)? How many total cycles does the old scheme require? Putting it all together means the new scheme will need New_cycles = Old_cycles + AtomCompares*(New1-Old1) + AtomCreations*(New2-Old2). Speedup is Old_cycles/New_cycles. Presto! (At least as an approximation; the extra memory operations may mess things up.) Well, as long as the atom API/expected behaviour remains the same (or, more to the point, better), I certainly won't oppose your idea on principle. Rather, it's an implementation trade off. Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From bengt.kleberg@REDACTED Tue Feb 1 16:28:51 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Feb 2005 16:28:51 +0100 Subject: Concatenating atoms In-Reply-To: References: Message-ID: <41FFA033.4060703@ericsson.com> Joe Armstrong (AL/EAB) wrote: ...deleted > Now we could make two types of atoms (short and long) short atoms > must be <= 10 short characters. > > This would be nice because longSillyAtomNamesThatAreTotallyUnreadable would > be less attractive :-) it would not stop those of us (like me) that use long_silly_names_that_are_totally_readable bengt From Manjeet.Singh.Sardar@REDACTED Tue Feb 1 17:48:57 2005 From: Manjeet.Singh.Sardar@REDACTED (Manjeet.Singh Sardar (AC/EDD)) Date: Tue, 1 Feb 2005 17:48:57 +0100 Subject: undef problem even when the module is present. Message-ID: Hi, I have developed ftp clients modules to support passive mode for ipv4 and ipv6(courtesy to Erlang users)by modifying the ftp.erl file from the R8 version.It is working fine but sometimes i get a "undef" error(i know that this error comes when the called module is not found) when trying ftp open function. could someone give me some idea what could be the mistake i am making. Pls see that this error occurs only sometimes, rest of the time it works fine, but once this error comes it contiuesly occur till i restart the application. {'EXIT',{undef,[{my_ftp_passive_ipv6,open,["5001:1::8"]},{my_ftp,ftp_client,8}]}} Thanks and Regards Manjeet From bengt.kleberg@REDACTED Tue Feb 1 17:52:42 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Feb 2005 17:52:42 +0100 Subject: [newbie] refactor function? In-Reply-To: <41FFA6B5.1020604@web.am> References: <41FFA6B5.1020604@web.am> Message-ID: <41FFB3DA.4040201@ericsson.com> Gaspar Chilingarov wrote: ...deleted > one question to clarify thing -- when i have function, which splits list > to head and tail, i always need to have separate clause for empty list > case, am i ? yes, if it is ok to get an empty list as an argument. if you know/expect/mandate that the argument list should always have a head and a tail you do not need a clause for the empty list. bengt From bengt.kleberg@REDACTED Tue Feb 1 17:57:07 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Feb 2005 17:57:07 +0100 Subject: undef problem even when the module is present. In-Reply-To: References: Message-ID: <41FFB4E3.5030408@ericsson.com> Manjeet.Singh Sardar (AC/EDD) wrote: ...deleted > It is working fine but sometimes i get a "undef" error(i know that this error comes when the called module is not found) just to make sure. it is also possible to get ''undef'' if the module exists, but the fucntion does not. note that module:function/1 is different from module:function/2 bengt From sean.hinde@REDACTED Tue Feb 1 17:57:05 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 1 Feb 2005 16:57:05 +0000 Subject: Documentation Search Path Patches In-Reply-To: <88c369de4370c7eef846f287a9cbdab3@pacbell.net> References: <88c369de4370c7eef846f287a9cbdab3@pacbell.net> Message-ID: <4D6470C0-7472-11D9-9DE5-000A95927CCE@mac.com> Hi, I also just spent some time playing with Darwinports for R10B-2, and concluded that most of these patches are no longer needed - the doc path does not have html in the middle of it. The only part I needed was the one for using "open" instead of "netscape". If I can figure out how to submit a patch to darwinports I will. Regards, Sean On 1 Feb 2005, at 08:10, Brent Fulgham wrote: > These patches have been reported a few times (and applied in the > Debian and DarwinPorts packages of Erlang.) Could they please be > applied to upstream OTP so that package maintainers do not have to > keep applying the same patches? > > > > Thanks, > > -Brent From bengt.kleberg@REDACTED Tue Feb 1 18:02:43 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Feb 2005 18:02:43 +0100 Subject: snmp users guide Message-ID: <41FFB633.50509@ericsson.com> greetings, i am doing my first work on snmp/erlang. i am looking into the users guide as found on: http://www.erlang.se/doc/doc-5.4.3/lib/snmp-4.0.4/doc/html/part_frame.html in chapter 8.2 Default Implementation, it is mentioned the following: snmp_test_mgr:start_link(...) however, my system does not have the module snmp_test_mgr. this is what i get from erl -version Erlang (THREADS,HIPE) (BEAM) emulator version 5.4 should i complain about the installation of my system? should i mention this as a documentation bug? bengt From Manjeet.Singh.Sardar@REDACTED Tue Feb 1 18:14:45 2005 From: Manjeet.Singh.Sardar@REDACTED (Manjeet.Singh Sardar (AC/EDD)) Date: Tue, 1 Feb 2005 18:14:45 +0100 Subject: undef problem even when the module is present. Message-ID: Hi Bengt, the function is defined and is exported as well like -export([open/1]). Regards Manjeet -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] Sent: Tuesday, February 01, 2005 5:57 PM To: Erlang-Questions (E-mail) Subject: Re: undef problem even when the module is present. Manjeet.Singh Sardar (AC/EDD) wrote: ...deleted > It is working fine but sometimes i get a "undef" error(i know that this error comes when the called module is not found) just to make sure. it is also possible to get ''undef'' if the module exists, but the fucntion does not. note that module:function/1 is different from module:function/2 bengt From carsten@REDACTED Tue Feb 1 19:36:09 2005 From: carsten@REDACTED (Carsten Schultz) Date: Tue, 1 Feb 2005 19:36:09 +0100 Subject: [newbie] refactor function? In-Reply-To: <41FF46BE.9030003@web.am> References: <41FF46BE.9030003@web.am> Message-ID: <20050201183608.GA8517@penne.localnet> Hi! On Tue, Feb 01, 2005 at 01:07:10PM +0400, Gaspar Chilingarov wrote: > Hello All! > > what is a correct way of writing following function (initQuota/1) -- > probably i got problems thinking in a functional way ;) ? > > i wish to get rid of last two cases. > > following function just adds to list of tuples with range descriptions > initial zero value, which will be changed later in application. > > -cut- > testInitQuota() -> > [{ single, "AAA", 0 }] = initQuota( [ { single, "AAA" } ] ), > [{ range, "AAA", "BBB", 0 }] = > initQuota( [ { range, "AAA", "BBB" } ] ), > [{ single, "AAA", 0 },{ range, "AAA", "BBB", 0 }] = > initQuota( [ { single, "AAA" },{ range, "AAA", "BBB" } ] ). > > initQuota([Head | QuotaList]) -> > lists:reverse(initQuota(Head, QuotaList, [])). > > initQuota( { range, Value1, Value2 }, [Head | QuotaList], NewList ) -> > initQuota( Head, QuotaList, [ { range, Value1, Value2, 0 } ] ++ > NewList ); > initQuota( { single, Value1 }, [Head | QuotaList], NewList ) -> > initQuota( Head, QuotaList, [ { single, Value1, 0 } ] ++ NewList ); > initQuota( { range, Value1, Value2 }, [], NewList ) -> > [ { range, Value1, Value2, 0 } ] ++ NewList; > initQuota( { single, Value1 }, [], NewList ) -> > [ { single, Value1, 0 } ] ++ NewList. > -cut- Well I would first write a specification of what the function should do, like initQuota(X) -> lists:map(fun({range, Value1, Value2}) -> {range, Value1, Value2, 0}; ({single, Value1}) -> {single, Value1} end, X). :-) If you do not like funs like this, that would have been initQuota(List) -> lists:map(fun initQuotaElement/1, List). initQuotaElement({range, Value1, Value2}) -> {range, Value1, Value2, 0}; initQuotaElement({single, Value1}) -> {single, Value1}. BTW, the problem with your solution seems to be that you are doing to pattern matches at once, although they are independent of each other. You could have written: initQuota(Val, List, NewList) -> NewVal = case Val of {range, Value1, Value2} -> {range, Value1, Value2, 0}; {single, Value1} -> {single, Value1, 0} end, case List of [] -> [NewVal | NewList]; [Head | Tail] -> initQuota(Head, Tail, [NewVal | NewList]) end. However, there is no need for the first argument of initQuota. A usual formulation along your lines would have been initQuota(List) -> initQuota(List, []). initQuota([], Acc) -> lists:reverse(Acc); initQuota([{single, Val}|Tail], Acc) -> initQuota(Tail, [{single, Val, 0}|Acc]); initQuota([{range, Val1, Val2}|Tail], Acc) -> initQuota(Tail, [{range, Val1, Val2, 0}|Acc]). (Your formulation is equivalent to the above, but with initQuota(List=[_|_]) -> initQuota(List, []).) HTH, Carsten -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. From kostis@REDACTED Tue Feb 1 20:26:10 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 1 Feb 2005 20:26:10 +0100 (MET) Subject: [newbie] refactor function? In-Reply-To: Mail from 'Bengt Kleberg ' dated: Tue, 01 Feb 2005 17:52:42 +0100 Message-ID: <200502011926.j11JQANN005788@spikklubban.it.uu.se> Bengt Kleberg wrote: > Gaspar Chilingarov wrote: > ...deleted > > one question to clarify thing -- when i have function, which splits list > > to head and tail, i always need to have separate clause for empty list > > case, am i ? > > yes, if it is ok to get an empty list as an argument. > if you know/expect/mandate that the argument list should always have a > head and a tail you do not need a clause for the empty list. The correct answer is that in _most_ cases you do need a clause for the empty list and one for the [H|T] one, but in general it really depends on what you want to do. For example, think of how you would write a function that returns the last element of a list (i.e., the lists:last/1 function). Kostis. From kostis@REDACTED Tue Feb 1 20:36:05 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 1 Feb 2005 20:36:05 +0100 (MET) Subject: Integer part of a float Message-ID: <200502011936.j11Ja5ph006107@spikklubban.it.uu.se> I am looking for a built-in function that returns the integer part of a (positive) float, something like floor/1, and although I've spent quite some time looking for this, I cannot find it, Is it true that there there is no built-in like that? Kostis. PS. I know I can write it myself by float_to_list, search for "." and then do list_to_integer but I am surprised that I could not find this as a built-in. From luke@REDACTED Tue Feb 1 21:07:54 2005 From: luke@REDACTED (Luke Gorrie) Date: 01 Feb 2005 21:07:54 +0100 Subject: Integer part of a float References: <200502011936.j11Ja5ph006107@spikklubban.it.uu.se> Message-ID: Kostis Sagonas writes: > I am looking for a built-in function that returns the integer > part of a (positive) float, something like floor/1, and although > I've spent quite some time looking for this, I cannot find it, trunc/1 ? From erlang@REDACTED Tue Feb 1 21:16:02 2005 From: erlang@REDACTED (Peter L) Date: Tue, 1 Feb 2005 21:16:02 +0100 (CET) Subject: Documentation Search Path Patches Message-ID: <61317.82.182.146.59.1107288962.squirrel@www69.webcows.se> For FreeBSD 5.3 I found an erlang port to R10B-2. In the Makefile I found out the email adress of the "MAINTAINER" (Jimmy Olgeni). I emailed him to get your run_erl.c patch included into the port for FreeBSD 5.3. When I last night installed 5.3 on my server at home it worked perfectly alright (except for run_erl). With the port I am now also able to attach with to_erl (after the run_erl fix) which I could not do without the port... /Peter > -----Ursprungligt meddelande----- > Fran: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]For Sean Hinde > Skickat: den 1 februari 2005 17:57 > Till: Brent Fulgham > Kopia: erlang-questions@REDACTED; erlang-patches@REDACTED > Amne: Re: Documentation Search Path Patches > > > Hi, > > I also just spent some time playing with Darwinports for R10B-2, and concluded that most of these patches are no longer needed - the doc path does not have html in the middle of it. > > The only part I needed was the one for using "open" instead of > "netscape". > > If I can figure out how to submit a patch to darwinports I will. > > Regards, > Sean > > > On 1 Feb 2005, at 08:10, Brent Fulgham wrote: > > > These patches have been reported a few times (and applied in the Debian and DarwinPorts packages of Erlang.) Could they please be applied to upstream OTP so that package maintainers do not have to keep applying the same patches? > > > > > > > > Thanks, > > > > -Brent From petite.abeille@REDACTED Tue Feb 1 21:45:04 2005 From: petite.abeille@REDACTED (PA) Date: Tue, 1 Feb 2005 21:45:04 +0100 Subject: [OT] post-structuralist object oriented system Message-ID: <7339757534875de21bdc1da889b20870@gmail.com> Not really a question, but rather for your entertainment: "Lua?s Story of O" http://alt.textdrive.com/lua/19/lua-story-of-o Cheers -- PA, Onnay Equitursay http://alt.textdrive.com/ From kramer@REDACTED Wed Feb 2 00:47:50 2005 From: kramer@REDACTED (Reto Kramer) Date: Tue, 1 Feb 2005 15:47:50 -0800 Subject: test_server:start_node/3 - want to choose host Message-ID: How can I specify which host the test_server:start_node/3 call starts a node on? I set {remote,true} in the options, but cannot figure out how to tell the start_node call to fire up a new node on a host other than the first in the {hosts, [First, Second]} list in the .spec file. Test server gurus - please help - this seems too basic to be true ;-) Thanks, - Reto From ok@REDACTED Wed Feb 2 02:06:26 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 2 Feb 2005 14:06:26 +1300 (NZDT) Subject: Concatenating atoms Message-ID: <200502020106.j1216QLt234968@atlas.otago.ac.nz> Thomas Lindgren wrote: It _would_ be useful to have some way to check whether an atom with a given name already exists. Compiler writers and other "gensym users" would appreciate it (at least some -- me -- would). I don't see how this would be useful. Process one: Does "XYZZY 27" exist? Oh good, no! Process two: Does "XYZZY 27" exist? Oh good, no! Create 'XYZZY 27' as new gensym. Process one: Create 'XYZZY 27' as new gensym. Use it as a "private" key in a table. Process two: Use 'XYZZY 27' as a "private" key in a table. Now two processes are both holding onto what they think is a new atom. This is a classic concurrent programming bug resulting from unguarded mutation of a global shared variable. The Erlang answer is isolation, Isolation, ISOLATION! Whatever the atom symbol table looks like, no process should be able to detect *changes* to it due to the activity of other processes. In any case, surely the Erlang equivalent of gensyms is 'references'? From ok@REDACTED Wed Feb 2 03:08:45 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 2 Feb 2005 15:08:45 +1300 (NZDT) Subject: Concatenating atoms Message-ID: <200502020208.j1228jNT235673@atlas.otago.ac.nz> If memory serves me correctly, the Logix implementation of Flat Concurrent Prolog treated atoms pretty much as Joe would like. 'xyzzy' was always *equal* to 'xyzzy' but there might be more than one *copy* of it. If I recall correctly (and here I probably don't) when the unification code matched up two references to physically distinct things that turned out to be the same values, it bent one reference to point to the other copy. (No backtracking in FCP, so safe.) Presumably the garbage collector was global rather than per-process. The key point is that in a system like this there is no practical way for a process to know or discover whether a particular atom 'exists'. From joe.armstrong@REDACTED Wed Feb 2 09:10:13 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 2 Feb 2005 09:10:13 +0100 Subject: Concatenating atoms Message-ID: > Thomas Lindgren > Sent: den 1 februari 2005 16:56 > To: erlang-questions@REDACTED > Subject: RE: Concatenating atoms > > > I'm not even sure if having an atom table etc. > > saves much time. > > Suppose we did atom comparisons the hard way, > > testing *each* time > > that the data in the atoms was identical how long > > would this take? > > Easy enough to guesstimate, I suppose: how often do > you match atoms vs atoms? What is the new and old cost > of comparison, in cycles? How many new atoms are > allocated during execution? What is the cost of > allocating an atom (new vs old)? How many total cycles > does the old scheme require? > > Putting it all together means the new scheme will need > New_cycles = Old_cycles + AtomCompares*(New1-Old1) + > AtomCreations*(New2-Old2). Speedup is > Old_cycles/New_cycles. Presto! Speedup = (... above ...) - cycles to do GC +/- cycles to handle page faults + cycles spent while system was down because it crashed because the atom table was filled - ... + Speedups gained because I can write more efficient code. The last factor is important - why. Because I *know* that the atom table is not garbaged I *avoid* code that create atoms. Thus, for example, my XML parser represents the 's as strings and NOT atoms. This means that all my XML application have to written in a deliberately inefficient manner (for the sake of correctness) - if there were atom table GC OR no GC at all then I could change my parser to reprent tags as atoms, which is obviously "The right thing to do" (TM) (A one line change - since the code is thoughtfully provisioned for this eventuality) Upresto! /Joe > > (At least as an approximation; the extra memory > operations may mess things up.) > > Well, as long as the atom API/expected behaviour > remains the same (or, more to the point, better), I > certainly won't oppose your idea on principle. Rather, > it's an implementation trade off. > > Best, > Thomas > > > > > __________________________________ > Do you Yahoo!? > The all-new My Yahoo! - Get yours free! > http://my.yahoo.com > > From joe.armstrong@REDACTED Wed Feb 2 09:11:42 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 2 Feb 2005 09:11:42 +0100 Subject: Concatenating atoms Message-ID: > Richard A. O'Keefe > The Erlang answer is isolation, Isolation, ISOLATION! yes, Yes, YES! /Joe From vlad_dumitrescu@REDACTED Wed Feb 2 09:17:05 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 2 Feb 2005 09:17:05 +0100 Subject: about UBF Message-ID: Hi, Because the latest references to UBF made my brain to feel dizzy again, I decided to check if I am the only one in this situation and to propose a way to solve the problem ;-) Problem: * what are people referring to when thay say "UBF"? Is it UBF-A or UBF-B? Sometimes it can be guessed from the context, but I always get confused at first... The only things that relate UBF-A and UBF-B is that Joe invented them and that UBF-B can use UBF-A as a lower layer. But it could just as well use XML, Erlang external format, text, or pigeons. Proposal: * UBF-A is what the name says it is, a binary format, therefore I suggest it will be named UBF. * UBF-B is a protocol describing language, therefore I suggest it will be named UPD (Universal Protocol Description) [other name suggestions are welcome] Does anyone think it's meaningful to remove the overloaded name? best regards, Vlad From vlad_dumitrescu@REDACTED Wed Feb 2 09:41:38 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 2 Feb 2005 09:41:38 +0100 Subject: about UPD (aka UBF-B) Message-ID: Me again, better to split the two issues. Thinking about UPD and remembering Joe's earlier call for middle-men (http://www.erlang.org/ml-archive/erlang-questions/200405/msg00032.html), I got an idea. * Instead of beginning with a middle-men library, wouldn't it be easier to begin with an UPD library? Describing a protocol is easier than directly implementing a client and a server. Anyone mastering a protocol can do it. Going then from UPD to implementation is rather straightforward, but may be tedious. If one needs a middle-man that doesn't yet exist, one can take the UPD spec and do the work, without needing to master the protocol. What do you think? regards, Vlad From dietmar@REDACTED Wed Feb 2 10:23:45 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Wed, 02 Feb 2005 10:23:45 +0100 Subject: snmp mnesia Message-ID: <42009C21.2030304@ast.dfs.de> HI ! Did I find something strange ? I am using Distributed Erlang , SNMP, Mnesia. Yesterday I decided to enhance my MIB incorporate an additional index: externalInterfacesEntry OBJECT-TYPE SYNTAX ExternalInterfacesEntry ACCESS not-accessible STATUS mandatory DESCRIPTION "A list of the external 4D-Planner interfaces " INDEX { hIndex,externalInterfaceIndex } ::= { externalInterfacesList 1 } ExternalInterfacesEntry ::= SEQUENCE { hIndex DisplayString (SIZE(0..10)), <----this entry is new externalInterfaceIndex INTEGER (1.. 30), externalInterfaceIdent DisplayString (SIZE(0..10)), externalInterfaceStatus INTEGER, externalInterfaceCommand INTEGER, externalInterfaceCommandResult INTEGER, externalInterfaceRowStatus RowStatus } hIndex OBJECT-TYPE SYNTAX DisplayString (SIZE(0..10)) ACCESS read-only STATUS mandatory DESCRIPTION "A index that uniquely identifies an entry in the processesList table. " ::= { externalInterfacesEntry 1 } externalInterfaceIndex OBJECT-TYPE SYNTAX INTEGER (1.. 30) ACCESS read-only STATUS mandatory DESCRIPTION "A index that uniquely identifies an entry in the externalInterfaces table." ::= { externalInterfacesEntry 2 } I changed the database initialization,header files, deleted and created new tables but asking my agent I got: * SNMP A-NET-IF INFO: time in agent: 25801 mysec ** SNMP MASTER-AGENT LOG: apply: snmp_generic,table_func,[get_next, [], [0], {externalInterfacesList,mnesia}] ** SNMP MASTER-AGENT LOG: returned: [{[1,4,119,107,115,50,1],"wks2"}] =ERROR REPORT==== 2-Feb-2005::09:51:09 === ** User error: Got "wks2" from {snmp_generic,table_func,[{externalInterfacesList,mnesia}]}. Using wrongType despite the fact that this is right ! I was looking for what might have caused this "misbehavior" and couldn't find anything ---- until I deleted the mnesa schema and created a new one. Now it works ! As far as I understand deleteing the schema should not be necessary ?? Any advice ? Regards Dietmar From bjorn@REDACTED Wed Feb 2 11:11:07 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 02 Feb 2005 11:11:07 +0100 Subject: Concatenating atoms In-Reply-To: References: Message-ID: "Joe Armstrong \(AL/EAB\)" writes: [...] > Modules (after loading) share pointers into hash tables > Which is *evil* > We intentionally violate many good design principles and in general do many evil things inside the emulator, so that Erlang application developers can write clean and fast Erlang applications. Performance DOES matter. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Wed Feb 2 11:29:11 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 02 Feb 2005 11:29:11 +0100 Subject: Documentation Search Path Patches In-Reply-To: <4D6470C0-7472-11D9-9DE5-000A95927CCE@mac.com> References: <88c369de4370c7eef846f287a9cbdab3@pacbell.net> <4D6470C0-7472-11D9-9DE5-000A95927CCE@mac.com> Message-ID: That's too bad. :-) I guess that the maintainer for Darwinports must have eliminated the html sub-directory himself/herself. I intend to include the patch in OTP R10B-3 (with corrections, because it was not entirely correct). Now the documentation search will correctly for our binary releases and for an open-source build where the documentation tar file has been unpacked directly on top of it. /Bj?rn Sean Hinde writes: > Hi, > > I also just spent some time playing with Darwinports for R10B-2, and > concluded that most of these patches are no longer needed - the doc > path does not have html in the middle of it. > > The only part I needed was the one for using "open" instead of > "netscape". > > If I can figure out how to submit a patch to darwinports I will. > > Regards, > Sean > > > On 1 Feb 2005, at 08:10, Brent Fulgham wrote: > > > These patches have been reported a few times (and applied in the > > Debian and DarwinPorts packages of Erlang.) Could they please be > > applied to upstream OTP so that package maintainers do not have to > > keep applying the same patches? > > > > > > > > Thanks, > > > > -Brent > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Wed Feb 2 11:30:26 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 2 Feb 2005 02:30:26 -0800 (PST) Subject: Concatenating atoms In-Reply-To: <200502020106.j1216QLt234968@atlas.otago.ac.nz> Message-ID: <20050202103026.5416.qmail@web41906.mail.yahoo.com> --- "Richard A. O'Keefe" wrote: > Thomas Lindgren wrote: > It _would_ be useful to have some way to check > whether > an atom with a given name already exists. Compiler > writers and other "gensym users" would appreciate > it > (at least some -- me -- would). > > I don't see how this would be useful. Well, in my sequential compiler code it still would, though a straightforward gensym might be what I really need (to avoid the concurrency issue that you subsequently describe). Your point about using ref:s for uniqueness is well taken, but they are not nearly as convenient for what I'm doing (which is hooking into the existing Erlang compiler). At present, I instead rely on being "nearly sure" that the atom name is unique, which is somewhat unsatisfactory: the equivalent of "security by obscurity". (I vaguely seem to recall that ref:s are, or at least were, not entirely guaranteed to be unique either, but that might be an implementation detail.) Detecting changes to the atom table seems at the face of it no worse than detecting changes to an ets table, though I'm willing to be convinced otherwise. Best, Thomas __________________________________ Do you Yahoo!? All your favorites on one personal page ? Try My Yahoo! http://my.yahoo.com From erlang@REDACTED Wed Feb 2 11:39:29 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 2 Feb 2005 10:39:29 +0000 Subject: SAE in OTP-R10B-2 Message-ID: <20050202103929.6fdd7203.erlang@manderp.freeserve.co.uk> Hi Gurus, I tried and failed to install Joe's Stand Alone Erlang toolkit. The output from make is copied below. Has anyone here (Dr. Joe for e.g.?) managed to resurrect it for R10B-2? Is anyone else trying to use SAE? I notice that ecc is no longer part of OTP, and the FAQ does mention its removal from therein. The links to ear, ecc, elink and escript are broken in /usr/local/bin/ which hints that in a previous version they were included. Pete. _______________________________________________________________ erl reports version 5.4.2.1 [source] [hipe] [1032] make # make distribution cd src; make all make[1]: Entering directory `/home/pmander/Erlang/SAE-StandAloneErlang/sae-r9b0-1/src' /usr/local/lib/erlang/bin/ecc boot_tools_mk.erl make[1]: /usr/local/lib/erlang/bin/ecc: Command not found make[1]: *** [boot_tools_mk.beam] Error 127 make[1]: Leaving directory `/home/pmander/Erlang/SAE-StandAloneErlang/sae-r9b0-1/src' make: *** [all] Error 2 -- "The Tao of Programming flows far away and returns on the wind of morning." From joe.armstrong@REDACTED Wed Feb 2 11:39:56 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 2 Feb 2005 11:39:56 +0100 Subject: Concatenating atoms Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Bjorn > Gustavsson > Sent: den 2 februari 2005 11:11 > To: erlang-questions@REDACTED > Subject: Re: Concatenating atoms > > > "Joe Armstrong \(AL/EAB\)" writes: > [...] > > Modules (after loading) share pointers into hash tables > > Which is *evil* > > > > We intentionally violate many good design principles and > in general do many evil things inside the emulator, so that > Erlang application developers can write clean and fast > Erlang applications. > > Performance DOES matter. Yes, and I would very much like to write "clean and fast Erlang applications" that create very large numbers of atoms - the fastest algorithms involve creating very large numers of atoms - but this is a no-no so I use strings where efficient algorithm would have used atoms. Certain design decisions within the emulator force me to write code in a less-than-optimal way - now it's fine by me to evil things in the emulator to manke things run fast - but not when the evil things force me to program in an artificial and inefficeint way as is the case with atoms. /Joe > > /Bj?rn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > From nm@REDACTED Wed Feb 2 11:44:42 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Wed, 02 Feb 2005 14:44:42 +0400 Subject: [newbie] refactor function? In-Reply-To: <20050201183608.GA8517@penne.localnet> References: <41FF46BE.9030003@web.am> <20050201183608.GA8517@penne.localnet> Message-ID: <4200AF1A.3060802@web.am> Hi! Carsten Schultz wrote: > Hi! > > On Tue, Feb 01, 2005 at 01:07:10PM +0400, Gaspar Chilingarov wrote: > >>Hello All! >> >>what is a correct way of writing following function (initQuota/1) -- >>probably i got problems thinking in a functional way ;) ? >> >>i wish to get rid of last two cases. >> >>following function just adds to list of tuples with range descriptions >>initial zero value, which will be changed later in application. >> >>-cut- >>testInitQuota() -> >> [{ single, "AAA", 0 }] = initQuota( [ { single, "AAA" } ] ), >> [{ range, "AAA", "BBB", 0 }] = >> initQuota( [ { range, "AAA", "BBB" } ] ), >> [{ single, "AAA", 0 },{ range, "AAA", "BBB", 0 }] = >> initQuota( [ { single, "AAA" },{ range, "AAA", "BBB" } ] ). >> >>initQuota([Head | QuotaList]) -> >> lists:reverse(initQuota(Head, QuotaList, [])). >> >>initQuota( { range, Value1, Value2 }, [Head | QuotaList], NewList ) -> >> initQuota( Head, QuotaList, [ { range, Value1, Value2, 0 } ] ++ >>NewList ); >>initQuota( { single, Value1 }, [Head | QuotaList], NewList ) -> >> initQuota( Head, QuotaList, [ { single, Value1, 0 } ] ++ NewList ); >>initQuota( { range, Value1, Value2 }, [], NewList ) -> >> [ { range, Value1, Value2, 0 } ] ++ NewList; >>initQuota( { single, Value1 }, [], NewList ) -> >> [ { single, Value1, 0 } ] ++ NewList. >>-cut- > > > Well I would first write a specification of what the function should > do, like > > initQuota(X) -> > lists:map(fun({range, Value1, Value2}) -> > {range, Value1, Value2, 0}; > ({single, Value1}) -> > {single, Value1} > end, X). > > :-) > > If you do not like funs like this, that would have been > > initQuota(List) -> > lists:map(fun initQuotaElement/1, List). > > initQuotaElement({range, Value1, Value2}) -> > {range, Value1, Value2, 0}; > initQuotaElement({single, Value1}) -> > {single, Value1}. > thats ok -- elegant and very short way to write this i need. > BTW, the problem with your solution seems to be that you are doing to > pattern matches at once, although they are independent of each other. > You could have written: > > initQuota(Val, List, NewList) -> > NewVal = case Val of > {range, Value1, Value2} -> > {range, Value1, Value2, 0}; > {single, Value1} -> > {single, Value1, 0} > end, > case List of > [] -> > [NewVal | NewList]; > [Head | Tail] -> > initQuota(Head, Tail, [NewVal | NewList]) > end. > this was the most useful answer for me -- i've missed at all that case statement could return any value ... > However, there is no need for the first argument of initQuota. A > usual formulation along your lines would have been > > initQuota(List) -> > initQuota(List, []). > > initQuota([], Acc) -> > lists:reverse(Acc); > initQuota([{single, Val}|Tail], Acc) -> > initQuota(Tail, [{single, Val, 0}|Acc]); > initQuota([{range, Val1, Val2}|Tail], Acc) -> > initQuota(Tail, [{range, Val1, Val2, 0}|Acc]). > > (Your formulation is equivalent to the above, but with > initQuota(List=[_|_]) -> > initQuota(List, []).) > > HTH, > > Carsten > in case of joining single element to list [ Element | List ] is equal to [ Element ] ++ List but [ List | Element ] creates nested list instead of List ++ [ Element ] why it works in this way -- so, are there any general rule which i can learn, or it's a special case? -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From jabba@REDACTED Wed Feb 2 11:56:27 2005 From: jabba@REDACTED (Jani Launonen) Date: Wed, 2 Feb 2005 12:56:27 +0200 (EET) Subject: Multiprocessing EVM propaganda (was: Re: Concatenating atoms) In-Reply-To: References: Message-ID: > "Joe Armstrong \(AL/EAB\)" writes: > [...] >> Modules (after loading) share pointers into hash tables >> Which is *evil* >> > > We intentionally violate many good design principles and > in general do many evil things inside the emulator, so that > Erlang application developers can write clean and fast > Erlang applications. This is a point of view that I've been thinking too with regard to multithreading EVM. If EVM does take care of the multithreading for multiprocessor machines it makes application developers job a whole lot easier and more simpler --- no need to develop a load balancing mechanics for each problem. Let EVM run Erlang processes with their isolation properties in different threads (or processes --- make it a choice in a start up time how many threads one EVM can use for Erlang processes. It makes EVM developers life more difficult but application developers could build more clean applications) and let OS make judgement where and when each thread executes. It would make newbies easy to get advantage of Erlang and multiprocessors machines automagically --- that would certainly help underline Erlang's suitability to highly parallel processing that seems to be inevitable in some years. > Performance DOES matter. > > /Bj?rn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From bjorn@REDACTED Wed Feb 2 12:02:48 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 02 Feb 2005 12:02:48 +0100 Subject: Concatenating atoms In-Reply-To: References: Message-ID: "Joe Armstrong \(AL/EAB\)" writes: [..] > > Certain design decisions within the emulator force me to write code > in a less-than-optimal way - now it's fine by me to evil things in the > emulator to manke things run fast - but not when the evil things force > me to program in an artificial and inefficeint way as is the case with atoms. > That's better. :-) We are aware of the atom problems, and we might fix it in a future release. Whatever solution will require an extensive rewrite of the emulator, because atoms are handled everywhere. Don't hold your breath! /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Wed Feb 2 12:22:08 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 2 Feb 2005 03:22:08 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050202112208.49256.qmail@web41907.mail.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > Speedup = (... above ...) - cycles to do GC > +/- cycles to handle page faults > + cycles spent while system was down because it > crashed because the atom table was filled > - ... > + Speedups gained because I can write more > efficient code. I started out with looking at the details of your estimate (is it speedup or cycles?) but I think the core issue is really another one. First: I fully support not running out of atoms -- I hardly would have asked for atom GC if I didn't. I think it's an implementation flaw to have to worry about such a thing. Second: Whether the proper method of managing atoms is atom GC, per-module atom tables with a new data representation, or something else, is an engineering issue. If your formula above indicates success, implement your proposal and see if it was right. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From bengt.kleberg@REDACTED Wed Feb 2 12:49:03 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 02 Feb 2005 12:49:03 +0100 Subject: [newbie] refactor function? In-Reply-To: <4200AF1A.3060802@web.am> References: <4200AF1A.3060802@web.am> Message-ID: <4200BE2F.9090906@ericsson.com> Gaspar Chilingarov wrote: ...deleted > in case of joining single element to list > > > [ Element | List ] is equal to [ Element ] ++ List > but [ List | Element ] creates nested list instead of > List ++ [ Element ] [ List | Element ] does not create a ''proper'' list. you can not add an item to the end of a list. ++ appends 2 lists. you can not use it on items. bengt From huss01@REDACTED Wed Feb 2 13:36:59 2005 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Wed, 2 Feb 2005 13:36:59 +0100 Subject: [newbie] refactor function? In-Reply-To: <4200BE2F.9090906@ericsson.com> References: <4200AF1A.3060802@web.am> <4200BE2F.9090906@ericsson.com> Message-ID: Since you want a general rule: * If E is an element (of any type) and L is a list, [E | L] returns a list beginning with E and continuing with the elements of L. However, [...|...] is more general. The truth is that: * If E1 and E2 are Erlang terms (of any type), [E1 | E2] creats a pair (usually referred to as a cons or a cons cell) containing E1 and E2. For example, creating a cons cell with the terms 1 and 2 is done using [1 | 2] (try it in the shell!). Since cons cells normally are used to create lists (next paragraph), this is sometimes called an improper list. Regarding lists, they can be recursively defined by noting that a list is: * Either the empty list, denoted [], or * A pair [E | L], where E is any Erlang term and L is a list. Thus, the following are all lists: [] [3 | []] [2 | [3 | []]] [1 | [2 | [3 | []]]] Since lists are common, there is a special, more convenient notation for them. The above lists can instead be written: [] [3] [2, 3] [1, 2, 3] However, this is just so called syntactic sugar for the above notations. Knowing this makes a number of "strange" special cases disappear. E.g., [H | T] = [1, 2, 3] yielding H==1 and T==[2,3]. Why? Simple, rewrite the list into its "true form": [H | T] = [1 | [2 | [3 | []]]] => H==1, T==[2 | [3 | []]] (== [2,3]) No magic... The ++ operator is intended to operate on two lists and returns a new list containing all elements from the left operand followed by all the elements of the right operand. (Also, adding items to the end of a list often leads to inefficiencies, but "first make it work then make it fast" :-) /H?kan On Wed, 02 Feb 2005 12:49:03 +0100, Bengt Kleberg wrote: > Gaspar Chilingarov wrote: > ...deleted > > in case of joining single element to list > > > > > > [ Element | List ] is equal to [ Element ] ++ List > > but [ List | Element ] creates nested list instead of > > List ++ [ Element ] > > [ List | Element ] does not create a ''proper'' list. > > you can not add an item to the end of a list. > ++ appends 2 lists. you can not use it on items. > > > bengt > From bfulg@REDACTED Wed Feb 2 18:37:55 2005 From: bfulg@REDACTED (Brent Fulgham) Date: Wed, 2 Feb 2005 09:37:55 -0800 (PST) Subject: Documentation Search Path Patches In-Reply-To: Message-ID: <20050202173755.39561.qmail@web81203.mail.yahoo.com> --- Bjorn Gustavsson wrote: > I guess that the maintainer for Darwinports must > have eliminated the html sub-directory > himself/herself. Yes, I think so. > I intend to include the patch in OTP R10B-3 (with > corrections, because it was not entirely correct). What was wrong with it? (I ask in the hope that I can learn from the mistake!) > Now the documentation search will correctly for our > binary releases and for an open-source build where > the documentation tar file has been > unpacked directly on top of it. Excellent! What about the run_erl.c patch needed for FreeBSD/MacOS X? (http://www.erlang.org/ml-archive/erlang-questions/200412/msg00061.html) It would be nice to have that change as well. Best regards, -BRent From tty@REDACTED Wed Feb 2 18:39:02 2005 From: tty@REDACTED (tty@REDACTED) Date: Wed, 2 Feb 2005 12:39:02 -0500 Subject: jinterface and erlang node Message-ID: Hello, I'm prototyping an Erlang server which needs to connect with an existing Java client. For simplicity I'm using a simple 'echo' server. I converted a simplified Java client into an Erlang node using jinterface. Unfortunately at this point I am unable to send/receive messages from the Erlang server. My Java code starts as: --------------------- node = new OtpNode("java_client"); mbox = node.createNode("client1"); // the following returns true node.ping("server", 100); --------------------- The Erlang server is globally registered as 'echo_srv'. If I do a net_adm:world() I see 'java_client@REDACTED' and I can net:ping it. I also wrote an Erlang client which was successful in sending/receiving messages from 'echo_srv'. How do I go about sending/receiving messages using jinterface ? The steps seem to involve creating a OtpErlangPid which requires a PID in external format (how can I get this) or from a node, id, serial, creation tuple (what are these, in particular id, serial, creation ?). Any hints/code fragments are welcome. Thanks tee tty@REDACTED From vlad_dumitrescu@REDACTED Wed Feb 2 20:10:17 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 2 Feb 2005 20:10:17 +0100 Subject: jinterface and erlang node References: Message-ID: From: > My Java code starts as: > --------------------- > node = new OtpNode("java_client"); > mbox = node.createNode("client1"); maybe you mean mbox = node.createMbox("client1"); > How do I go about sending/receiving messages using jinterface ? You can use the created mbox to send and receive messages. The mbox is the equivalent of an Erlang process (seen from the outside), as it has a unique pid, and a registered name "client1" See the jinterface documentation for details, examples are provided. If it's still unclear, ask again! Good luck! regards, Vlad From lencionil@REDACTED Wed Feb 2 22:16:21 2005 From: lencionil@REDACTED (leo lencioni) Date: Wed, 2 Feb 2005 18:16:21 -0300 Subject: ICMP Ping Message-ID: <2dda5cae05020213161444d4dc@mail.gmail.com> I'am new to erlang, and I want to write a simple ICMP ping logger as an example I read the documentation and I found that erlang has support for raw sockets. 1) Can erlang generate and send an ICMP Echo request? 2) Where I can find an example? Thanks in avance for your help, Leo Carlos Lencioni From tty@REDACTED Wed Feb 2 22:59:11 2005 From: tty@REDACTED (tty@REDACTED) Date: Wed, 2 Feb 2005 16:59:11 -0500 Subject: jinterface and erlang node Message-ID: Thanks Tobbe, I took a look at it although its not what I need at the moment. Although I mention Java client, this client is really a bridge. What I intend to do is as below: Erlang Server <---> Java Client <---> Java Server An Erlang server driving a Java client which injects requests to a Java server. The Java server may send responses back to the Java client which in turn has to inform the Erlang server. Both Java client and Java server have been written. I'll be modifying the Java client to talk to the Erlang server and I decided to go with one of two options (Erlang port or jinterface). I was hoping I could use jinterface as it seems the easiest in terms of communication protocol and appears as an Erlang node (with those added benefits). Thanks all the same. I am of the opinion that I can never see enough sample code! Regards tee -------- Original Message -------- From: Torbjorn Tornkvist To: tty@REDACTED Cc: erlang-questions@REDACTED Subject: Re: jinterface and erlang node Date: Wed, 02 Feb 2005 22:35:02 +0100 > > I assume it is the Java client that connects to the Erlang server ? > I've written a simple chat-application in the form of a Java applet > that talks to an Erlang server. It works nice with Yaws and Erlang-R9 > and is using xml-rpc for the communication. If you think it could be > useful to study, then you'll find it here: > > http://www.tornkvist.org/echat.tgz > > Cheers, Tobbe > (Ps. It doesn't work with R10 because of a missing test in ucs.erl which > I reported earlier today. BTW: did that mail vanish ?) > > > tty@REDACTED wrote: > > >Hello, > > > >I'm prototyping an Erlang server which needs to connect with an existing Java client. For simplicity I'm using a simple 'echo' server. I converted a simplified Java client into an Erlang node using jinterface. Unfortunately at this point I am unable to send/receive messages from the Erlang server. > > > >My Java code starts as: > > --------------------- > >node = new OtpNode("java_client"); > >mbox = node.createNode("client1"); > > > >// the following returns true > >node.ping("server", 100); > > > > --------------------- > > > >The Erlang server is globally registered as 'echo_srv'. > >If I do a net_adm:world() I see 'java_client@REDACTED' and I can net:ping it. > > > >I also wrote an Erlang client which was successful in sending/receiving messages from 'echo_srv'. > > > >How do I go about sending/receiving messages using jinterface ? > > > >The steps seem to involve creating a OtpErlangPid which requires a PID in external format (how can I get this) or from a node, id, serial, creation tuple (what are these, in particular id, serial, > >creation ?). > > > >Any hints/code fragments are welcome. > > > >Thanks > > > >tee > >tty@REDACTED > > > > > > > > > > > > > > From sean.hinde@REDACTED Thu Feb 3 00:59:00 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 2 Feb 2005 23:59:00 +0000 Subject: SAE in OTP-R10B-2 In-Reply-To: <20050202103929.6fdd7203.erlang@manderp.freeserve.co.uk> References: <20050202103929.6fdd7203.erlang@manderp.freeserve.co.uk> Message-ID: <685D9AE1-7576-11D9-9DE5-000A95927CCE@mac.com> Ahh, SAE works great in R10B-2, you just need to do a few extra manual steps which I can't quite recall at the moment. I also hacked the linker so that if it detects a file called a certain name in the current directory it uses that as ring0 rather than the one embedded in some other random file in the SAE directory. Lovely ! Hours of fun. Sean On 2 Feb 2005, at 10:39, Peter-Henry Mander wrote: > Hi Gurus, > > I tried and failed to install Joe's Stand Alone Erlang toolkit. The > output from make is copied below. Has anyone here (Dr. Joe for e.g.?) > managed to resurrect it for R10B-2? Is anyone else trying to use SAE? > > I notice that ecc is no longer part of OTP, and the FAQ does mention > its > removal from therein. The links to ear, ecc, elink and escript are > broken in /usr/local/bin/ which hints that in a previous version they > were included. > > Pete. > _______________________________________________________________ > > erl reports version 5.4.2.1 [source] [hipe] > > [1032] make > # make distribution > cd src; make all > make[1]: Entering directory > `/home/pmander/Erlang/SAE-StandAloneErlang/sae-r9b0-1/src' > /usr/local/lib/erlang/bin/ecc boot_tools_mk.erl > make[1]: /usr/local/lib/erlang/bin/ecc: Command not found > make[1]: *** [boot_tools_mk.beam] Error 127 > make[1]: Leaving directory > `/home/pmander/Erlang/SAE-StandAloneErlang/sae-r9b0-1/src' > make: *** [all] Error 2 > > -- > "The Tao of Programming > flows far away > and returns > on the wind of morning." > From khan.saifi@REDACTED Thu Feb 3 06:34:45 2005 From: khan.saifi@REDACTED (Saifi Khan) Date: Thu, 3 Feb 2005 11:04:45 +0530 Subject: ex11 widget standardization Message-ID: Hi: I am a ex11 newbie and I recently downloaded and build the package. The demo is fantastic and very fast! Is there is any plan to have widgets standardization ? Something like GTK+, Qt widgets? For example, currently the toolbar works very well, however the look and feel is not something that the enduser would be able to appreciate. While searching through the archives, I could not find what is the overall strategy for GUI toolkit, widgets or accessability. Anybody knows ? Many, thanks to Joe Armstrong for ex11. -- thanks Saifi Khan. From valentin@REDACTED Thu Feb 3 08:17:00 2005 From: valentin@REDACTED (Valentin Micic) Date: Thu, 3 Feb 2005 09:17:00 +0200 Subject: Concatenating atoms References: Message-ID: <045501c509c0$5b57d1e0$0100a8c0@MONEYMAKER2> > Violates it in what way? ... > > Modules (after loading) share pointers into > hash tables Which is *evil* > Well, they also share BIF's and the run-time.. where does isolation stop? One-process-one-run-time? OTOH & IMHO GC might be far more dificult to implement. As much as I've never explored erts source, somehow I assumed that module as well as function names are part of the same atom name-space... What are we going to gain by introducing GC for atoms? I've run out of the atom table space once. It was by mistake, of course. I don't think I'll run out ever again -- seems much easier to use my brain instead. V. From thomas.xa.johnsson@REDACTED Thu Feb 3 09:11:23 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Thu, 3 Feb 2005 09:11:23 +0100 Subject: Hipe? RE: Concatenating atoms Message-ID: What is the situation in HiPe wrt this discussion ie atom table space / running out of it / GC it, etc? -- Thomas From bjorn@REDACTED Thu Feb 3 10:52:56 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 03 Feb 2005 10:52:56 +0100 Subject: Documentation Search Path Patches In-Reply-To: <20050202173755.39561.qmail@web81203.mail.yahoo.com> References: <20050202173755.39561.qmail@web81203.mail.yahoo.com> Message-ID: Brent Fulgham writes: [...] > What was wrong with it? (I ask in the hope that I can > learn from the mistake!) Some of the documentation paths were still incorrect because they used code:priv_dir/1 instead of code:lib_dir/1; also there were extra semicolons in the case in tool_util.erl which gave "syntax error" from the compiler. > > > What about the run_erl.c patch needed for > FreeBSD/MacOS X? > (http://www.erlang.org/ml-archive/erlang-questions/200412/msg00061.html) > It would be nice to have that change as well. My plan is to change mknod() to mkfifo() unconditionally; as far as I know only ancient Unices don't have mkfifo(). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Thu Feb 3 11:26:38 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 3 Feb 2005 11:26:38 +0100 (MET) Subject: Hipe? RE: Concatenating atoms In-Reply-To: Mail from '"Thomas Johnsson XA (LN/EAB)" ' dated: Thu, 3 Feb 2005 09:11:23 +0100 Message-ID: <200502031026.j13AQcsm026475@spikklubban.it.uu.se> Thomas Johnsson asked: > What is the situation in HiPe wrt this discussion ie > atom table space / running out of it / GC it, etc? HiPE and BEAM (i.e., native code and bytecode) happily co-exist in a hipe-enabled Erlang/OTP system. For this to happen, most data representation and data structures of the emulator are shared. In particular, native code uses the same atom table used by BEAM. Thus, depending on your point of view, the situation in HiPE is as good or as bad as in BEAM. Kostis. From thomasl_erlang@REDACTED Thu Feb 3 11:35:39 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 3 Feb 2005 02:35:39 -0800 (PST) Subject: Concatenating atoms In-Reply-To: <045501c509c0$5b57d1e0$0100a8c0@MONEYMAKER2> Message-ID: <20050203103539.84937.qmail@web41902.mail.yahoo.com> --- Valentin Micic wrote: > What are we going to gain by > introducing GC for atoms? I've > run out of the atom table space once. It was by > mistake, of course. I don't > think I'll run out ever again -- seems much easier > to use my brain instead. Good for you! I think there are several reasons for having an atom GC. The basic problem is, every time you create an atom, you take one more step towards rebooting your node. While the distance to the cliff may be long (and may certainly be reached more quickly by other means :-) there is currently no way to turn back. If you want to be sure never to create new atoms, you need to be careful about: - your own code, of course - using third party utilities that can create new atoms (e.g., file:consult and friends) - creating new named ets or mnesia tables - registering new named processes - contacting new nodes - loading new modules (module names are atoms) - loading new versions of old modules with new exported function names (more atoms) - other people working on your system after you've left and likely a number of other situations. Clearly, a lot of systems function well without an atom GC. I can appreciate that atom GC may be difficult to implement well. But not having it still seems like an unnecessary complication. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 From joe.armstrong@REDACTED Thu Feb 3 12:06:24 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 3 Feb 2005 12:06:24 +0100 Subject: Concatenating atoms Message-ID: > -----Original Message----- > From: Matthias Lang [mailto:matthias@REDACTED] > Sent: den 3 februari 2005 09:28 > To: Joe Armstrong (AL/EAB) > Subject: RE: Concatenating atoms > > > Joe Armstrong (AL/EAB) writes: > > > Yes, and I would very much like to write "clean and fast > > Erlang applications" that create very large numbers of atoms > > - the fastest algorithms involve creating very large numers > > of atoms - but this is a no-no so I use strings where efficient > > algorithm would have used atoms. > > Can you provide an example of such an algorithm? > Yes - the "obvious" example is the Erlang compiler. Variables in Erlang get tokenised as (for example) suppose I have a variable name "HttpCommandName" in line 1234 of a program. The scanner (which precedes parsing) will represent this as {var,1234,'HttpCommandName'} - and this value will retained in the parse tree of the program. << run epp:parse_file("XXX.erl", "", "") to see the parse tree generated for XXX.erl >> This representation of a variable is very efficient, since the compiler often checks different variables for equality. running member('HttpCommandname', ['var1','Var2','HttpCommandname', ...]) is *much* more efficient than running running member("HttpCommandname", ["var1","Var2","HttpCommandname", ...]) since head matching in the clause member(H, [H|T]) Is much more efficient if only atom comparisons are involved. So efficient way or representing variables in the compiler is to represent each variable as an atom. The trouble is that *each time we run the compiler* all the variable names used in the program get turned into atoms and are added to the atom table of the Erlang run-time system. So writing a "compiler server" (this is a program which accepts Erlang programs, compiles them and returns the compiled code) is impossible - sooner or later we run of atom space. Note that *after* the compiler has run it would (or should be) possible to garb away all the variable names that we created during the parsing process. This problem might sound contrived but it is not it is a very common situation. *Every* parser which accepts inputs from a communication channel suffers from this problem is the set of atoms that it can create is unbounded. Example: Suppose I want to quickly verify that an xml data structure is correct (ie verified) I cannot safely represent hoho The *natural* representation is a) {abc, [{one,"123"},{def,"xyz"}], [{pcdata,"hoho"}]} But I have to choose a "bad" representation b) {"abc", [{"one","123"},{"def","xyz"}], [{pcdata,"hoho"}]} And *all* code that manipulates these data structure will be less efficient. The very fact of parsing the above data struct ensures that the atoms abc,one,def will end up in the atom table. If the tag alphabet is unbounded then the atom table will eventually overflow. This gives us a number of design choices. 1) Accept that I have incorrect implementation that will one day crash 2) Prove that the atom table cannot overflow because the alphabet is finite and will not overflow the atom table 3) Uses strings instead of atoms I choose 3) because correctness is more important to me than speed - one day it will crash and that is unacceptable. 2) is impossible Pragmatically 1) may not happen very often and the consequences of a crash might not be important but still I don't like this. Suppose somebody decides to use Erlang to build a nuclear powerstation and uses my XML parser to control the unit which pushes the fuel rods in and out of the core - and one day the atom table overflows .... The wise men said - "get it right before you make it fast" /Joe > Matthias > From joe.armstrong@REDACTED Thu Feb 3 12:12:18 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 3 Feb 2005 12:12:18 +0100 Subject: Concatenating atoms Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Thomas Lindgren > Sent: den 2 februari 2005 12:22 > To: erlang-questions@REDACTED > Subject: RE: Concatenating atoms > > > > --- "Joe Armstrong (AL/EAB)" > wrote: > > > Speedup = (... above ...) - cycles to do GC > > +/- cycles to handle page faults > > + cycles spent while system was down because it > > crashed because the atom table was filled > > - ... > > + Speedups gained because I can write more > > efficient code. > > I started out with looking at the details of your > estimate (is it speedup or cycles?) but I think the > core issue is really another one. > > First: I fully support not running out of atoms -- I > hardly would have asked for atom GC if I didn't. I > think it's an implementation flaw to have to worry > about such a thing. > > Second: Whether the proper method of managing atoms is > atom GC, per-module atom tables with a new data > representation, or something else, is an engineering > issue. If your formula above indicates success, > implement your proposal and see if it was right. > Absolutely - I have no idea which approach is best. I have a "gut feeling" that a true 64 bit erlang with two forms of atoms would be best Short atoms (10 packed characters) which fit into a single and Long atoms in a local module table with a cached hint pointer. Unfortunately (as Bj?rn pointed out) this is not a minor change - this is a pretty bit re-write before you get to know the answer. /Joe > Best, > Thomas > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - You care about security. So do we. > http://promotions.yahoo.com/new_mail > From klacke@REDACTED Thu Feb 3 11:18:42 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Thu, 3 Feb 2005 11:18:42 +0100 Subject: ICMP Ping In-Reply-To: <2dda5cae05020213161444d4dc@mail.gmail.com> References: <2dda5cae05020213161444d4dc@mail.gmail.com> Message-ID: <20050203101842.GA13089@hyber.org> On Wed, Feb 02, 2005 at 06:16:21PM -0300, leo lencioni wrote: > I'am new to erlang, and I want to write a simple > ICMP ping logger as an example > > I read the documentation and I found that erlang has > support for raw sockets. > Wow, where did you read that. This was news to me anyway. > 1) Can erlang generate and send an ICMP Echo request? Assuming the above is correct, sure. An alternative could be to use the tun/tap driver found in jungerl, that could sureley be used to introduce raw IP packets on the network. To read the packet, you'd have to setup your routes i such a way so that return packets find their way up to userspace. http://jungerl.sourceforge.net/ > 2) Where I can find an example? > For RAW packets, nowhere I think !! /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From joe.armstrong@REDACTED Thu Feb 3 13:26:08 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 3 Feb 2005 13:26:08 +0100 Subject: ex11 widget standardization Message-ID: Wow - a user :-) Overall strategy: 1) Fix a reasonably intuitive way of programming GUIs 2) Prototype it 3a) *Define* a graphics GUI protocol 3a) *Define* a look-and-feel 4) Implement it 1) For many years I didn't really know how graphics should be programmed Callbacks suck - in early attempts I made One window = One processes With "if the process dies the widow dies and vice versa" semantics. This is wrong. EX11 convinced me that the correct model is One process per object in a hierarchical tree Expose protocols towards the objects and NOT APIs So in ex11 *everything* is a process buttons, sliders, entries, ... all are processes. All obey a generic protocol and a private protocol. So all objects can be moved with an Obj ! {move,X,Y} message Active objects (buttons etc) can be sent functions Button ! {onClick, Fun} Meaning evaluate F() when you click on the button etc. Irrespective of the underlying model (wish, gtk, X11) the Erlang programmer should perceive a GUI as a collection of communicating processes. IMHO this makes for a highly intuitive and easy to program way of making GUIS. << It's rather like the OO way of programming a GUI where EVERY control is an object - here every control is a process>> 2) Ex11 works reasonably well but not out-of-the-box on all makes and flavours of X11 and displays (in particular color handling on non 24 bit color displays) 3a) The protocol should be something like this This is a summary of some of http://www.sics.se/~joe/ex11/widgets/ex11.html Win !! {makeButton, X, Y, Width, Ht, Color, Str) => Button Button ! {onClick, Fun/1} - Evaluate F(X) when clicked. X is the mouse position. Button ! {set, Str} Change the text in the button Win !! {makeDragBox, X, Y, Width, Height, Border, Color) => DragBox DragBox ! {onDrag, F/2} evaluate F(X,Y) when dragged to X,Y Win !! {makeEntry, X, Y, Width, Str) => Entry Entry ! {onReturn, Fun/1} - Evaluate F(Str) when return is pressed in the entry. Entry ! {set, Str} Set the entry Entry !! read => Str Read the entry ... Win Button Entry DragBox etc are all processes !! is an infix RPC. A !! B => C is short for C = rpc(A, B) 3b) Needs help from a graphics designer 4) EX11 is non portable to windows (ie based on X11) and has certain problems in starting up (ie handling non 24 bit color displays) I started three days ago (by coincidence) seeing if I could use a wish backend to ex11 - this works very nicely, I am half way through the widgets and have managed to retain ex11 programming model. 5) Volunteers I would like volunteers for the following: a) test my new graphics stuff and help with TCL widget programming (any TCL buffs out there) b) test run my new stuff on windows and package with freewrap c) Discuss and help maintain the widget protocol spec d) Provide inputs for graphics look-and-feel e) implement the entire protocols with *different* back-ends (ie GTK/xwwidgets etc.) Anybody who is interested please mail me (Oh and there is also a sub-project) The Erlang desktop (like smalltalk) /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Saifi Khan > Sent: den 3 februari 2005 06:35 > To: erlang-questions@REDACTED > Subject: ex11 widget standardization > > > Hi: > > I am a ex11 newbie and I recently downloaded and build the package. > The demo is fantastic and very fast! > > Is there is any plan to have widgets standardization ? > Something like GTK+, Qt widgets? > > For example, currently the toolbar works very well, however > the look and feel > is not something that the enduser would be able to appreciate. > > While searching through the archives, I could not find what is the > overall strategy for GUI toolkit, widgets or accessability. > Anybody knows ? > > Many, thanks to Joe Armstrong for ex11. > > -- > thanks > Saifi Khan. From dietmar@REDACTED Thu Feb 3 15:16:35 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Thu, 03 Feb 2005 15:16:35 +0100 Subject: send_trap Message-ID: <42023243.7050609@ast.dfs.de> Hi ! Because I don't know how to use send_notification I use send_trap Using it this way: errorTrap(ErrorText) -> snmpa:send_trap(snmp_master_agent,startupTrap,"standard trap",[{errorText,ErrorText}]). causes: cmmc@REDACTED)79> ** SNMP MASTER-AGENT LOG: send trap request: Trap: startupTrap NotifyName: "standard trap" ContextName: [] Recv: no_receiver <------- Varbinds: [{errorText,"Something_was_wrong_with_the_user"}] What does Recv mean ? regards Dietmar From lencionil@REDACTED Thu Feb 3 16:23:06 2005 From: lencionil@REDACTED (leo lencioni) Date: Thu, 3 Feb 2005 12:23:06 -0300 Subject: ICMP Ping In-Reply-To: <20050203101842.GA13089@hyber.org> References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> Message-ID: <2dda5cae050203072360bf131e@mail.gmail.com> Sorry for asking such question without reading in detail the manual. Reading twice I understand that option raw in inet:setops has nothing to do with IP raw sockets. I will go to jungerl and take a look to the TUN/TAP driver. Thanks for your time. On Thu, 3 Feb 2005 11:18:42 +0100, klacke@REDACTED wrote: > On Wed, Feb 02, 2005 at 06:16:21PM -0300, leo lencioni wrote: > > I'am new to erlang, and I want to write a simple > > ICMP ping logger as an example > > > > I read the documentation and I found that erlang has > > support for raw sockets. > > > > Wow, where did you read that. This was news to me anyway. > > > > 1) Can erlang generate and send an ICMP Echo request? > > Assuming the above is correct, sure. > > An alternative could > be to use the tun/tap driver found in jungerl, that could > sureley be used to introduce raw IP packets on the network. > To read the packet, you'd have to setup your routes i such > a way so that return packets find their way up to userspace. > > http://jungerl.sourceforge.net/ > > > > 2) Where I can find an example? > > > > For RAW packets, nowhere I think !! > > /klacke > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > From ulf.wiger@REDACTED Thu Feb 3 16:57:09 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 3 Feb 2005 16:57:09 +0100 Subject: Concatenating atoms Message-ID: Joe wrote: > *Every* parser which accepts inputs from a communication > channel suffers from this > problem is the set of atoms that it can create is unbounded. > This gives us a number of design choices. > > 1) Accept that I have incorrect implementation that > will one day crash > 2) Prove that the atom table cannot overflow because > the alphabet is > finite and will not overflow the atom table > 3) Uses strings instead of atoms This might be a good time to point out that xmerl converts element and attribute names to atoms. I've seen complaints on the list that xmerl is slow. All other things being equal, switching over to using strings instead would slow it down considerably (not that I've measured this). /Uffe From thomas.xa.johnsson@REDACTED Thu Feb 3 17:28:11 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Thu, 3 Feb 2005 17:28:11 +0100 Subject: Concatenating atoms Message-ID: .. And this might be a good time to suggest an alternative in applications like these: use integers/bignums instead of atoms. Like: string_to_integer([]) -> 0; string_to_integer([C|S]) -> C bor (string_to_integer(S) bsl 8). integer_to_string(0) -> []; integer_to_string(I) -> [I band 16#ff | integer_to_string(I bsr 8)]. 30> A = stringinteger:string_to_integer("hej hopp i lingonskogen!"). 819731492177739986812987346725244519542754012099320112488 31> stringinteger:integer_to_string(A). "hej hopp i lingonskogen!" Hopefully bignums are "represented sensibly" ie in one chunk, or at least more compactly than strings ... are they? -- Thomas -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] Sent: den 3 februari 2005 16:57 To: erlang-questions@REDACTED Subject: RE: Concatenating atoms Joe wrote: > *Every* parser which accepts inputs from a communication > channel suffers from this > problem is the set of atoms that it can create is unbounded. > This gives us a number of design choices. > > 1) Accept that I have incorrect implementation that > will one day crash > 2) Prove that the atom table cannot overflow because > the alphabet is > finite and will not overflow the atom table > 3) Uses strings instead of atoms This might be a good time to point out that xmerl converts element and attribute names to atoms. I've seen complaints on the list that xmerl is slow. All other things being equal, switching over to using strings instead would slow it down considerably (not that I've measured this). /Uffe From Chandrashekhar.Mullaparthi@REDACTED Thu Feb 3 17:28:51 2005 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 3 Feb 2005 16:28:51 -0000 Subject: Concatenating atoms Message-ID: In the same vein, when we started using Yaws in one of our services, we had to change it so that headers received in HTTP requests were not converted to atoms. If we hadn't done that, a rogue HTTP client could easily bring our erlang node down. > -----Original Message----- > From: Ulf Wiger (AL/EAB) [mailto:ulf.wiger@REDACTED] > Sent: 03 February 2005 15:57 > To: erlang-questions@REDACTED > Subject: RE: Concatenating atoms > > > > Joe wrote: > > > *Every* parser which accepts inputs from a communication > > channel suffers from this > > problem is the set of atoms that it can create is unbounded. > > > > This gives us a number of design choices. > > > > 1) Accept that I have incorrect implementation that > > will one day crash > > 2) Prove that the atom table cannot overflow because > > the alphabet is > > finite and will not overflow the atom table > > 3) Uses strings instead of atoms > > > This might be a good time to point out that xmerl > converts element and attribute names to atoms. > > I've seen complaints on the list that xmerl is slow. > All other things being equal, switching over to using > strings instead would slow it down considerably > (not that I've measured this). > > /Uffe > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From joe.armstrong@REDACTED Thu Feb 3 17:41:19 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 3 Feb 2005 17:41:19 +0100 Subject: Concatenating atoms Message-ID: Neat - great idea I hadn't thought of that I'm not sure that bigints is a good idea though - it might cause internal problems but binaries would be garbed and binary comparisons are presumably faster than list comparisions. So the variable Abc on line 23 of my program could be represented as {var,23,<<"abc">>} Yes - I will immediately change my XML parser to this representation :-) (and a potential compiler bug can be fixed !!!!) /Joe > -----Original Message----- > From: Thomas Johnsson XA (LN/EAB) > Sent: den 3 februari 2005 17:28 > To: erlang-questions@REDACTED > Subject: RE: Concatenating atoms > > > .. And this might be a good time to suggest an alternative in > applications like these: > use integers/bignums instead of atoms. Like: > > string_to_integer([]) -> 0; > string_to_integer([C|S]) -> C bor (string_to_integer(S) bsl 8). > > integer_to_string(0) -> []; > integer_to_string(I) -> [I band 16#ff | integer_to_string(I bsr 8)]. > > 30> A = stringinteger:string_to_integer("hej hopp i lingonskogen!"). > 819731492177739986812987346725244519542754012099320112488 > 31> stringinteger:integer_to_string(A). > "hej hopp i lingonskogen!" > > > Hopefully bignums are "represented sensibly" ie in one chunk, > or at least > more compactly than strings ... are they? > > -- Thomas > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED] > Sent: den 3 februari 2005 16:57 > To: erlang-questions@REDACTED > Subject: RE: Concatenating atoms > > > > Joe wrote: > > > *Every* parser which accepts inputs from a communication > > channel suffers from this > > problem is the set of atoms that it can create is unbounded. > > > > This gives us a number of design choices. > > > > 1) Accept that I have incorrect implementation that > > will one day crash > > 2) Prove that the atom table cannot overflow because > > the alphabet is > > finite and will not overflow the atom table > > 3) Uses strings instead of atoms > > > This might be a good time to point out that xmerl > converts element and attribute names to atoms. > > I've seen complaints on the list that xmerl is slow. > All other things being equal, switching over to using > strings instead would slow it down considerably > (not that I've measured this). > > /Uffe > From nm@REDACTED Thu Feb 3 20:02:55 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Thu, 03 Feb 2005 23:02:55 +0400 Subject: style guide OR indentation :) Message-ID: <4202755F.4060306@web.am> Hello! Are there any style recommendations about erlang code indentations floating around ? :) Something like FreeBSD's man style (9). -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From mccratch@REDACTED Thu Feb 3 22:07:39 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Thu, 03 Feb 2005 22:07:39 +0100 Subject: Concatenating atoms In-Reply-To: References: Message-ID: <4202929B.4060706@gmx.net> Joe Armstrong (AL/EAB) wrote: >Neat - great idea > >I hadn't thought of that > >I'm not sure that bigints is a good idea though - it might cause internal >problems but binaries would be garbed and binary comparisons are presumably >faster than list comparisions. So the variable Abc on line 23 of my program >could be represented as {var,23,<<"abc">>} > >Yes - I will immediately change my XML parser to this representation :-) > >(and a potential compiler bug can be fixed !!!!) > > > from a theoretical view the speedup is unimportant (because it is only a constant speedup). The speedup given by using atoms is much better: O(1) instead of O(n) (if n is the length of the string/binary). The only way to achive a performance behaviour of atoms (as they are implemented currently in Erlang/OTP) is to use integers of a fixed size (let's they of the length of a machine word) or references or something like that. This would result in reinventing atom-tables or other mechanisms and implementing some sort of garbage collection (or some more complex representation that makes use of the built-in garbage collector for terms). I think the best solution would be, to solve this problem once. In my opinion this is done by extending/changing the runtime system. Well from a practical view it might be very unimportant, because comparing two or three machine words would be sufficient. But if one wants to use it for tokens in a compiler, this might not be the case. On the other hand looking at some of my code I hardly find many atoms which are sharing a common long prefix and have the same length (though don't know how atoms are compared, but I could think that first type and length is tested and then from left to right). I am just using Erlang for small unimportant private projects, so my experience is very limited (and programming was nothing more for me besides university). Maybe someone with experience (of bigger projects) may enlighten me? -- Matthias Kretschmer From valentin@REDACTED Thu Feb 3 22:28:22 2005 From: valentin@REDACTED (Valentin Micic) Date: Thu, 3 Feb 2005 23:28:22 +0200 Subject: Concatenating atoms References: <20050203103539.84937.qmail@web41902.mail.yahoo.com> Message-ID: <049001c50a37$4a0c0d30$0100a8c0@MONEYMAKER2> >Thomas wrote: >I think there are several reasons for > having an atom GC. The basic problem is, every time > you create an atom, you take one more step towards > rebooting your node. While the distance to the cliff > may be long (and may certainly be reached more quickly > by other means :-) there is currently no way to turn > back. > Isn't a situatuion that you're describing an anomaly rather than a rule? It is not so easy to find a system that needs more than 1,000,000 constants. > If you want to be sure never to create new atoms, you > need to be careful about: > > - your own code, of course Sure thing. As I've mentioned, the only reason I ever had a problem was because of my code. > - using third party utilities that can create new > atoms (e.g., file:consult and friends) or XMERL... granted. I normally put this kind of code on a separate run-time. So if I want to parse XML encoded L.N Tolstoy's WAR & PEACE it may crash without affecting the core (i.e. uranium fuel rods). > - creating new named ets or mnesia tables I don't know... that is a lot of named ets or mnesia tables. Usually, the reason why these "objects" are named is to be able to access them. if one alters the name with every new creation, it somehow defeats the purpose, right? > - registering new named processes I'd say, the same argument applies. Usual system has a reasonably few regitered processes. > - contacting new nodes Hmmm... streching it a bit? > - loading new modules (module names are atoms) > - loading new versions of old modules with new > exported function names (more atoms) Let's be serious. Why would you want to GC these things in a frist place? > - other people working on your system after you've > left You should not let them ;-). > I can appreciate that atom GC may be > difficult to implement well. But not having it still > seems like an unnecessary complication. > How about release_atom/1 BIF? Hmmm.... cancel that. What would happen if one releases an atom of the function that is currently executing? Same goes for GC. One would need to separate these atoms from that atoms. Is it worth it? Wouldn't it be easier to introduce a flag that may decrease/increase the size of atom table to some custom value, provided that that flag does not exist already. V. From benno@REDACTED Fri Feb 4 01:33:42 2005 From: benno@REDACTED (Benno Rice) Date: Fri, 04 Feb 2005 11:33:42 +1100 Subject: Erlang on FreeBSD/amd64 Message-ID: <4202C2E6.2000308@jeamland.net> Hi, I've recently been looking at using erlang for a project I'm working on but ran into a bit of a roadblock when I discovered that erlang hasn't been ported to FreeBSD/amd64 yet. I've tried building it and also generated some patches (attached) which should sort out some floating point exception issues (otherwise the build hangs in configure), but the build runs into some problems trying to compile erlang code with erlc. Errors I've seen are shown below along with some of the files they were seen in. I got the list by removing the named files from the build as I found them, so this may cause problems in and of itself and I wasn't able to proceed in the build eventually due to yeccparse being one of the affected files. As well as the three shown below, I've also seen erlc catch bus error signals. There appears to be some level of unrepeatability as can be seen by the fact that one of the files (cerl_to_icode.erl) saw two different types of error. Can anyone point me at a good place to start to track down and fix these problems? My main issue is one of not being at all familiar with the erlang/OTP codebase. I'm using the most recent FreeBSD port which includes a few other patches. These can be obtained from a FreeBSD installation or from: http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/erlang/files/ Many thanks, Benno. Crash type 1 (most common): erlc -W +debug_info -I../include -o../ebin application_controller.erl =ERROR REPORT==== 4-Feb-2005::10:57:39 === Error in process <0.22.0> with exit value: {{badrecord,epp},[{epp,scan_toks,2}]} ./application_controller.erl:none: internal error in parse_module; crash reason: {{badrecord,epp},[{epp,scan_toks,2}]} Crash type 2 (unfortunately I accidentally deleted the dump): erlc -W +debug_info +nowarn_shadow_vars -o../ebin cerl_to_icode.erl Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 1880844493888946480 bytes of memory (of type "heap_frag"). Crash type 3: erlc -W +debug_info +nowarn_shadow_vars -o../ebin hipe_icode_pp.erl gmake[3]: *** [../ebin/hipe_icode_pp.beam] Segmentation fault (core dumped) The files that have seen crash type 1 are: lib/kernel/src/application_controller.erl lib/parsetools/src/yeccparser.erl lib/asn1/src/asn1ct_check.erl lib/asn1/src/asn1rt_per.erl lib/hipe/cerl/cerl_to_icode.erl lib/hipe/cerl/cerl_cconv.erl lib/hipe/cerl/cerl_messagean.erl lib/hipe/cerl/erl_bif_types.erl lib/hipe/cerl/cerl_closurean.erl lib/hipe/icode/hipe_beam_to_icode.erl lib/hipe/icode/hipe_icode_primops.erl lib/hipe/icode/hipe_icode_type.erl The files that have seen crash type 2 are: lib/hipe/cerl/cerl_to_icode.erl The files that have seen crash type 3 are: lib/hipe/icode/hipe_icode_pp.erl -- Benno Rice benno@REDACTED http://jeamland.net/ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch-erts_configure.in URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch-erts_emulator_sys_unix_sys_float.c URL: From benno@REDACTED Fri Feb 4 02:06:43 2005 From: benno@REDACTED (Benno Rice) Date: Fri, 04 Feb 2005 12:06:43 +1100 Subject: Erlang on FreeBSD/amd64 In-Reply-To: <4202C2E6.2000308@jeamland.net> References: <4202C2E6.2000308@jeamland.net> Message-ID: <4202CAA3.2000103@jeamland.net> Also for reference I'm building this on FreeBSD/amd64 6.0-CURRENT. -- Benno Rice benno@REDACTED http://jeamland.net/ From ok@REDACTED Fri Feb 4 03:33:30 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 4 Feb 2005 15:33:30 +1300 (NZDT) Subject: Concatenating atoms Message-ID: <200502040233.j142XUvi255215@atlas.otago.ac.nz> Let me offer another perspective on atom GC. During the time that I worked on it, Quintus Prolog did not have an atom GC. The representation for atoms was a bunch of tag bits here and there saying "I am an atom" plus a 21-bit field which indexed an extensible array of packed strings (the names). This meant that QP could have a maximum of 2,097,152 atoms in any one image. But hey, our fancy new Sun 3/50 machines had a massive 4MB of memory, and we were sure to run out of other stuff before filling up the table... OK, so Sun 3/50 machines had virtual memory. So one day I wondered how long it would take to run out of atoms. That's when I discovered that our single global atom hash table was most unfriendly to VM; once we got past a certain number we could only create 6 atoms per second, doing nothing else but make atoms. (See, paging over the network _was_ a bad idea!) So we replaced the atom hash table with something that was *much* kinder to the VM, and never did fill up the atom table. But now I have 640 MB on my desktop UltraSPARC and 640MB on my G4 Mac. The atom table could fill up quite quickly. Parkinson's law of computer memory: no computer _ever_ has enough memory. There are two points to this anecdote: (a) A limit which you are *never* going to reach in practice this year will be ridiculously small in 10 years time. (b) Running into the limit isn't the only problem. Hanging on to lots of atoms you don't need any more can give you performance problems even if you aren't even close to the limit. Actually there's a third point: (c) Not having an atom GC can cost you customers. There were people who _would_ have used QP but who wanted to hook it up with gigantic databases and pump large numbers of atoms through our system. Those were sales we _didn't_ make. From casper2000a@REDACTED Fri Feb 4 05:49:36 2005 From: casper2000a@REDACTED (casper2000a@REDACTED) Date: Fri, 4 Feb 2005 10:49:36 +0600 Subject: How to debug a C Port driver? Message-ID: <1107492576.4202fee0a3a7c@www.omnibis.com> Hi All, How can I debug a C port driver? Can use "gdb" for that? I am developing a C port driver. It compiles and links well. When I checked the resulted .so file using ldd, if shows all the depended libraries. Also then I checked with the Linker (ld), it only shows the driver_* routines missing. I guess that means it's linked well. But when I load that through the Erlang Emulator, in the init routine, one of my Initialize function doesn't work (claInitilize). It complints that it couldn't load the library well. But it doesn't show enough information to identify what's going wrong. So I need to find a method to debug this module. Thanks in advance! Eranga --------------This mail sent through OmniBIS.com-------------- From erlang@REDACTED Fri Feb 4 08:55:58 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Fri, 4 Feb 2005 07:55:58 +0000 Subject: Parsing binaries (was Re: Concatenating atoms) In-Reply-To: <4202929B.4060706@gmx.net> References: <4202929B.4060706@gmx.net> Message-ID: <20050204075558.196266fb.erlang@manderp.freeserve.co.uk> Hi Matthias, hi Joe, If integers are desirable, why not use indexes into the binary which contains the original XML data? So, to use Joe's example to illustrate, the variable Abc on line 23 of the program could be represented as {var,Offset,Size} where Offset is the position of the first byte of "Abc" in XML_Binary, and Size in this case would be 3 (obtaining line numbers would be done by scanning the binary for newline chars, for error reports). I think I'm correct in saying that the following: <<_:Offset/binary,Chunk:Size/binary,_/binary>> = XML_Binary, Doesn't create a new binary Chunk, instead creates a reference into the existing XML_binary. A lexicon of tokens could be based on a list of {Offset,Size} tuples, and all matching tokens in a parse tree can refer to the first occurance of the token in XML_Binary. I'm currently using this technique to parse SIP and SDP. There's at least a x3 speed advantage when compiling with HiPE too! (Although Joe seems less concerned about that sort of detail :-) Pete. On Thu, 03 Feb 2005 22:07:39 +0100 Matthias Kretschmer wrote: > > Well from a practical view it might be very unimportant, because > comparing two or three machine words would be sufficient. But if one > wants to use it for tokens in a compiler, this might not be the case. On > the other hand looking at some of my code I hardly find many atoms which > are sharing a common long prefix and have the same length (though don't > know how atoms are compared, but I could think that first type and > length is tested and then from left to right). I am just using Erlang > for small unimportant private projects, so my experience is very limited > (and programming was nothing more for me besides university). Maybe > someone with experience (of bigger projects) may enlighten me? -- "The Tao of Programming flows far away and returns on the wind of morning." From bengt.kleberg@REDACTED Fri Feb 4 10:31:28 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 04 Feb 2005 10:31:28 +0100 Subject: style guide OR indentation :) In-Reply-To: <4202755F.4060306@web.am> References: <4202755F.4060306@web.am> Message-ID: <420340F0.9030208@ericsson.com> Gaspar Chilingarov wrote: > Hello! > > Are there any style recommendations about erlang code indentations > floating around ? :) 1 read the source. 2 look at the output from syntax_tools-1.2.tgz (as found on http://erlang.org/user.html#syntax_tools-1.2). 3 if you use emacs there is a erlang pretty printer available (i do not use emacs) 4 if you are really adventerous i have a stdin/stdout pretty printer built upon syntax_tools-1.2. bengt From kostis@REDACTED Fri Feb 4 10:49:54 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 4 Feb 2005 10:49:54 +0100 (MET) Subject: style guide OR indentation :) In-Reply-To: Mail from 'Bengt Kleberg ' dated: Fri, 04 Feb 2005 10:31:28 +0100 Message-ID: <200502040949.j149nsQc002077@spikklubban.it.uu.se> Bengt Kleberg wrote: > 1 read the source. > 2 look at the output from syntax_tools-1.2.tgz (as found on > http://erlang.org/user.html#syntax_tools-1.2). > 3 if you use emacs there is a erlang pretty printer available (i do not > use emacs) > 4 if you are really adventerous i have a stdin/stdout pretty printer > built upon syntax_tools-1.2. Since R10, the syntax_tools are part of the OTP system (look at lib/syntax_tools). Kostis. From thomasl_erlang@REDACTED Fri Feb 4 11:22:15 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 4 Feb 2005 02:22:15 -0800 (PST) Subject: Parsing binaries (was Re: Concatenating atoms) In-Reply-To: <20050204075558.196266fb.erlang@manderp.freeserve.co.uk> Message-ID: <20050204102216.90584.qmail@web41903.mail.yahoo.com> --- Peter-Henry Mander wrote: > Hi Matthias, hi Joe, > > If integers are desirable, why not use indexes into > the binary which > contains the original XML data? Excellent idea. This sounds a bit like what's done in "Look ma, no hashing, and no arrays neither", Cai and Paige, in Proc. POPL 1991. Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From thomasl_erlang@REDACTED Fri Feb 4 11:57:38 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 4 Feb 2005 02:57:38 -0800 (PST) Subject: Concatenating atoms In-Reply-To: <049001c50a37$4a0c0d30$0100a8c0@MONEYMAKER2> Message-ID: <20050204105738.69733.qmail@web41902.mail.yahoo.com> --- Valentin Micic wrote: > Isn't a situatuion that you're describing an anomaly > rather than a rule? It > is not so easy to find a system that needs more than > 1,000,000 constants. It depends (see also the end of this message :-). The difficulty is, it's not 1M (or whatever) atoms at a single time, but 1M over the history of the live node. > > If you want to be sure never to create new atoms, > you > > need to be careful about: ... > > - using third party utilities that can create new > > atoms (e.g., file:consult and friends) > or XMERL... granted. I normally put this kind of > code on a separate > run-time. So if I want to parse XML encoded L.N > Tolstoy's WAR & PEACE it may > crash without affecting the core (i.e. uranium fuel > rods). Good point. This is a useful technique for containing other resource disasters, e.g., running out of memory. (Per Bergqvist pointed that out to me :-) In this case, you also have to be careful about what atoms you send to the "uncontaminated" node. > > - creating new named ets or mnesia tables > I don't know... that is a lot of named ets or mnesia > tables. Well, the point is, it all adds up. Or might add up. > [ets tables, registered processes, etc deleted] > > - contacting new nodes > Hmmm... streching it a bit? Depends on your system. What if you have some crazy P2P scenario? What if you want to run for a really long time? > > - loading new modules (module names are atoms) > > - loading new versions of old modules with new > > exported function names (more atoms) > > Let's be serious. Why would you want to GC these > things in a frist place? If you load a module with a new export, you can do apply on it; that means you need a new atom in the atom table. Likewise for new modules. Sure, most of these examples (parsing apart) probably won't gobble up the atom table in a hurry. If you want to be SURE, you still have to think about it. But wouldn't it be better not to have to worry about the issue at all? > /.../ Is it worth it? Yeah, that's the key question ... In my opinion, it's an implementation flaw, and should (at least eventually) be fixed. To be fair, as mentioned before, a lot of systems seem to manage without it. > Wouldn't it be easier to introduce a flag that may > decrease/increase the > size of atom table to some custom value, provided > that that flag does not > exist already. In general, I'd say that only delays the inevitable :-) (I thought there was such a flag, but I can't seem to find it.) If you don't care (short-running program, or willing to reboot every now and then, or node restarted often enough for it not to practically matter, or whatever) or know/guarantee/require that you have a bounded "working set" of atoms over the lifetime of the node, then yes: that is enough. Otherwise, no. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 From thomasl_erlang@REDACTED Fri Feb 4 12:09:03 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 4 Feb 2005 03:09:03 -0800 (PST) Subject: Concatenating atoms In-Reply-To: Message-ID: <20050204110903.19834.qmail@web41905.mail.yahoo.com> --- "Thomas Johnsson XA (LN/EAB)" wrote: > .. And this might be a good time to suggest an > alternative in applications like these: > use integers/bignums instead of atoms. Like: Good point -- you could also use MD5 or something as an alternative, or even a simple (string -> int) function if the "atoms" are known beforehand. This technique probably works best if you don't need the Full Power (TM) of atoms (e.g., pretty printing, type testing, ...). If you do, you will end up reinventing the whole thing. Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From bengt.kleberg@REDACTED Fri Feb 4 12:50:52 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 04 Feb 2005 12:50:52 +0100 Subject: style guide OR indentation :) In-Reply-To: <200502040949.j149nsQc002077@spikklubban.it.uu.se> References: <200502040949.j149nsQc002077@spikklubban.it.uu.se> Message-ID: <4203619C.1070302@ericsson.com> Kostis Sagonas wrote: ...deleted > Since R10, the syntax_tools are part of the OTP system > (look at lib/syntax_tools). i think this is a great idea. would it be possible to find this documented somewhere? bengt From vlad_dumitrescu@REDACTED Fri Feb 4 13:31:47 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 4 Feb 2005 13:31:47 +0100 Subject: Concatenating atoms References: <20050204110903.19834.qmail@web41905.mail.yahoo.com> Message-ID: Hi, One trouble with the alternative solutions is IMHO that it's somewhat more verbose and less readable. What about proofreading the code for a compiler where all atoms denoting parse-tree contents are just numbers? I think that using <<"atom">> might be good enough for most practical uses (unless there are issues yet to be revealed), and I'd like to suggest a shorter notation, something like for example ~atom~. That's 4 chars shorter and a little easier to read, I think. regards, Vlad From richardc@REDACTED Fri Feb 4 13:54:51 2005 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 04 Feb 2005 13:54:51 +0100 Subject: style guide OR indentation :) In-Reply-To: <4203619C.1070302@ericsson.com> References: <200502040949.j149nsQc002077@spikklubban.it.uu.se> <4203619C.1070302@ericsson.com> Message-ID: <4203709B.10105@csd.uu.se> Bengt Kleberg wrote: >> Since R10, the syntax_tools are part of the OTP system >> (look at lib/syntax_tools). > > i think this is a great idea. would it be possible to find this > documented somewhere? Erlang/OTP R10B documentation -> Tool Applications -> syntax_tools: http://www.erlang.se/doc/doc-5.4.3/lib/syntax_tools-1.4.1/doc/html/index.html /Richard From kostis@REDACTED Fri Feb 4 14:18:15 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 4 Feb 2005 14:18:15 +0100 (MET) Subject: Proposed change to libraries Message-ID: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> We had an interesting discussion in the HiPE group today, so let me take a quick poll on the following issue. The Erlang/OTP documentation specifies that e.g. lists:map/2 is ------------------------------------------------------------------- map(Func, List1) -> List2 Types: Func = fun(A) -> B List1 = [A] List2 = [B] ------------------------------------------------------------------- However, currently this does NOT agree with its implementation. For example, one can issue the call: lists:map(gazonk, []) which will return []. Will it cause havoc if in a future Erlang version such calls result in a 'function_clause' error? I.e., change the implementation of map/2 (and similar functions) as if defined by: map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 []. Kostis From Chandrashekhar.Mullaparthi@REDACTED Fri Feb 4 14:31:28 2005 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 4 Feb 2005 13:31:28 -0000 Subject: Proposed change to libraries Message-ID: I'm in favour of aligning the code to the documentation :-) Chandru > -----Original Message----- > From: Kostis Sagonas [mailto:kostis@REDACTED] > Sent: 04 February 2005 13:18 > To: erlang-questions@REDACTED > Subject: Proposed change to libraries > > > We had an interesting discussion in the HiPE group today, so let > me take a quick poll on the following issue. > > The Erlang/OTP documentation specifies that e.g. lists:map/2 is > ------------------------------------------------------------------- > map(Func, List1) -> List2 > Types: > Func = fun(A) -> B > List1 = [A] > List2 = [B] > ------------------------------------------------------------------- > > However, currently this does NOT agree with its implementation. > For example, one can issue the call: > > lists:map(gazonk, []) > > which will return []. > > Will it cause havoc if in a future Erlang version such calls > result in a 'function_clause' error? > > I.e., change the implementation of map/2 (and similar functions) > as if defined by: > > map(F, [H|T]) -> > [F(H)|map(F, T)]; > map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 > []. > > > Kostis > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From sean.hinde@REDACTED Fri Feb 4 16:47:22 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 4 Feb 2005 15:47:22 +0000 Subject: Proposed change to libraries In-Reply-To: References: Message-ID: <0F1C7829-76C4-11D9-9DE5-000A95927CCE@mac.com> Seconded Sean On 4 Feb 2005, at 13:31, Chandrashekhar Mullaparthi wrote: > I'm in favour of aligning the code to the documentation :-) > > Chandru > >> -----Original Message----- >> From: Kostis Sagonas [mailto:kostis@REDACTED] >> Sent: 04 February 2005 13:18 >> To: erlang-questions@REDACTED >> Subject: Proposed change to libraries >> >> >> We had an interesting discussion in the HiPE group today, so let >> me take a quick poll on the following issue. >> >> The Erlang/OTP documentation specifies that e.g. lists:map/2 is >> ------------------------------------------------------------------- >> map(Func, List1) -> List2 >> Types: >> Func = fun(A) -> B >> List1 = [A] >> List2 = [B] >> ------------------------------------------------------------------- >> >> However, currently this does NOT agree with its implementation. >> For example, one can issue the call: >> >> lists:map(gazonk, []) >> >> which will return []. >> >> Will it cause havoc if in a future Erlang version such calls >> result in a 'function_clause' error? >> >> I.e., change the implementation of map/2 (and similar functions) >> as if defined by: >> >> map(F, [H|T]) -> >> [F(H)|map(F, T)]; >> map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 >> []. >> >> >> Kostis >> > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have > received > this email in error please notify the sender immediately and delete > this > email from your system without copying or disseminating it or placing > any > reliance upon its contents. We cannot accept liability for any > breaches of > confidence arising through use of email. Any opinions expressed in > this > email (including attachments) are those of the author and do not > necessarily > reflect our opinions. We will not accept responsibility for any > commitments > made by our employees outside the scope of our business. We do not > warrant > the accuracy or completeness of such information. > From klacke@REDACTED Fri Feb 4 15:50:19 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Fri, 4 Feb 2005 15:50:19 +0100 Subject: Proposed change to libraries In-Reply-To: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> References: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> Message-ID: <20050204145019.GA28387@hyber.org> On Fri, Feb 04, 2005 at 02:18:15PM +0100, Kostis Sagonas wrote: > For example, one can issue the call: > > lists:map(gazonk, []) > > which will return []. > Eshell V5.2.b1 (abort with ^G) 1> lists:map(gazonk, []) . [] Disgusting. It's almost as bad and surprising as: 2> length(self()). {-73, 3.14} /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From david.nospam.hopwood@REDACTED Fri Feb 4 18:18:07 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Fri, 04 Feb 2005 17:18:07 +0000 Subject: Parsing binaries (was Re: Concatenating atoms) In-Reply-To: <20050204102216.90584.qmail@web41903.mail.yahoo.com> References: <20050204102216.90584.qmail@web41903.mail.yahoo.com> Message-ID: <4203AE4F.8040903@blueyonder.co.uk> Thomas Lindgren wrote: > --- Peter-Henry Mander > wrote: >> >>If integers are desirable, why not use indexes into >>the binary which contains the original XML data? > > Excellent idea. This sounds a bit like what's done in > "Look ma, no hashing, and no arrays neither", Cai and > Paige, in Proc. POPL 1991. A later paper describing the same technique is on-line at . -- David Hopwood From vlad_dumitrescu@REDACTED Fri Feb 4 19:45:16 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 4 Feb 2005 19:45:16 +0100 Subject: Proposed change to libraries References: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> <20050204145019.GA28387@hyber.org> Message-ID: I agree too. > Disgusting. It's almost as bad and surprising as: > > 2> length(self()). > {-73, 3.14} Well, at least that's fixed: Eshell V5.4.3 (abort with ^G) (wolf@REDACTED)1> length(self()). ** exited: {badarg,[{erlang,length,[<0.37.0>]}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** regards, Vlad From mmillikan@REDACTED Fri Feb 4 21:42:10 2005 From: mmillikan@REDACTED (Mark Millikan) Date: Fri, 4 Feb 2005 15:42:10 -0500 Subject: BTT start problems on Mac OS X Message-ID: <4e6339f9db34594fd8bf89f5631423c1@vfa.com> I have downloaded the source snapshot of BTT 1. ./configure seems to like 'powerpc-apple-bsd' as machine type and completes 2. make local' completes with many warnings of unused variables 3. yaws -i works fine. [m17:~] markmill% yaws -i Erlang (BEAM) emulator version 5.4.3 [source] Eshell V5.4.3 (abort with ^G) 1> =INFO REPORT==== 4-Feb-2005::13:32:18 === Yaws: Using config file /Users/markmillikan/yaws.conf =INFO REPORT==== 4-Feb-2005::13:32:18 === Warning usage of deprecated auth users inside config file use .yaws_auth file instead =INFO REPORT==== 4-Feb-2005::13:32:18 === Warning usage of deprecated auth users inside config file use .yaws_auth file instead yaws:Add path "/Users/markmillikan/yaws/scripts/../examples/ebin" yaws:Add path "/Users/markmillikan/yaws/examples/ebin" yaws:Running with id="default" Running with debug checks turned on (slower server) Logging to directory "/Users/markmillikan/yaws_logs" =INFO REPORT==== 4-Feb-2005::13:32:18 === Yaws: Listening to 0.0.0.0:8000 for servers - http://m17.bos.vfa:8000:8000 under /Users/markmillikan/yaws/scripts/../www - http://localhost:8000:8000 under /tmp =INFO REPORT==== 4-Feb-2005::13:32:18 === Yaws: Listening to 0.0.0.0:4443 for servers - https://m17.bos.vfa:4443:4443 under /tmp 4. btt -i aborts with: [m17:~] markmill% btt -i Erlang (BEAM) emulator version 5.4.3 [source] Eshell V5.4.3 (abort with ^G) 1> {"init terminating in do_boot",{badarg,[{btt_yconf,ycall,1},{btt_yconf,get_gconf,0},{btt_yconf ,get_yawsconf,0},{btt_yaws,configure_yaws,0},{btt_yaws,start,0},{init,st art_it,1},{init,start_em,1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () 5. btt.conf is: # # Define where the Web server should be running # BTT_WWW_IP = 127.0.0.1 BTT_WWW_PORT = 8337 # # Directory where all the WWW stuff is located # BTT_DOCROOT = /Users/markmillikan/btt_local_install/www # # Directory where the Database is located # BTT_DB_DIR = /Users/markmillikan/btt_local_install/db # # Directory where the received mails are stored # BTT_MAIL_DIR = /Users/markmillikan/btt_local_install/mail # # Directory where the logfiles are stored # #BTT_LOG_DIR = /Users/markmillikan/btt_local_install/logs/btt BTT_LOG_DIR = /tmp # # Change the below if you want to use the command line interface. # BTT_ENABLE_CMD = no BTT_CMD_IP = 127.0.0.1 BTT_CMD_PORT = 9338 Any hints as to how to proceed? From valentin@REDACTED Fri Feb 4 22:06:32 2005 From: valentin@REDACTED (Valentin Micic) Date: Fri, 4 Feb 2005 23:06:32 +0200 Subject: Concatenating atoms References: <20050204105738.69733.qmail@web41902.mail.yahoo.com> Message-ID: <04b001c50afd$67a16040$0100a8c0@MONEYMAKER2> > If you don't care (short-running program, or willing > to reboot every now and then, or node restarted often > enough for it not to practically matter, or whatever) > or know/guarantee/require that you have a bounded > "working set" of atoms over the lifetime of the node, > then yes: that is enough. Otherwise, no. > We had an application that run for more than a year without reboot. Once we had a power failure, hence had to restart. It was a mission to start-up the system. As usual, documentation was minimalistic, nobody knew what was going on, left hand did not know what the right was doing... We did learn from it. It is good practise to restart any system, no matter how stable it might be. Keeps your operations guys happy ;-). The trick is not to lose any traffic over it. Nice chatting to you. V. From sean.hinde@REDACTED Fri Feb 4 23:07:03 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 4 Feb 2005 22:07:03 +0000 Subject: Concatenating atoms In-Reply-To: <04b001c50afd$67a16040$0100a8c0@MONEYMAKER2> References: <20050204105738.69733.qmail@web41902.mail.yahoo.com> <04b001c50afd$67a16040$0100a8c0@MONEYMAKER2> Message-ID: <19DA68B7-76F9-11D9-9DE5-000A95927CCE@mac.com> On 4 Feb 2005, at 21:06, Valentin Micic wrote: >> If you don't care (short-running program, or willing >> to reboot every now and then, or node restarted often >> enough for it not to practically matter, or whatever) >> or know/guarantee/require that you have a bounded >> "working set" of atoms over the lifetime of the node, >> then yes: that is enough. Otherwise, no. >> > > We had an application that run for more than a year without reboot. > Once we > had a power failure, hence had to restart. It was a mission to > start-up the > system. As usual, documentation was minimalistic, nobody knew what was > going > on, left hand did not know what the right was doing... We did learn > from it. > It is good practise to restart any system, no matter how stable it > might be. > Keeps your operations guys happy ;-). The trick is not to lose any > traffic > over it. Many of our systems run for more than a year between restarts. Operations know how to type bin/start so I'm not too concerned about the magnitude of the startup mission ;-) GC of atoms or equivalent would be nice to have - witness the huge recent effort to remove all dynamically generated atoms from yaws. It was trivial to launch a DoS attack against yaws until this was done. I don't know if any measurements were done before and after - anyone? Sean From matthias@REDACTED Sat Feb 5 18:07:45 2005 From: matthias@REDACTED (Matthias Lang) Date: Sat, 5 Feb 2005 18:07:45 +0100 Subject: ICMP Ping In-Reply-To: <2dda5cae050203072360bf131e@mail.gmail.com> References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> Message-ID: <16900.64865.919725.838555@antilipe.corelatus.se> leo lencioni writes: > > > 1) Can erlang generate and send an ICMP Echo request? klacke writes: > > An alternative could > > be to use the tun/tap driver found in jungerl, that could > > sureley be used to introduce raw IP packets on the network. > > To read the packet, you'd have to setup your routes i such > > a way so that return packets find their way up to userspace. A further alternative which may be of use is: http://www.snookles.com/erlang/edtk/edtk-1.0/examples/libnet/ it appears to have an example which sends ping packets. mml From luke@REDACTED Sat Feb 5 20:28:33 2005 From: luke@REDACTED (Luke Gorrie) Date: 05 Feb 2005 20:28:33 +0100 Subject: ICMP Ping References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > leo lencioni writes: > > > > > 1) Can erlang generate and send an ICMP Echo request? > > klacke writes: > > > An alternative could > > > be to use the tun/tap driver found in jungerl, that could > > > sureley be used to introduce raw IP packets on the network. > > > To read the packet, you'd have to setup your routes i such > > > a way so that return packets find their way up to userspace. > > A further alternative which may be of use is: > > http://www.snookles.com/erlang/edtk/edtk-1.0/examples/libnet/ > > it appears to have an example which sends ping packets. An even further alternative is the lib/psocket program in jungerl. That's a port program that opens a PF_PACKET socket to read/write ethernet frames on existing interfaces. Could perhaps be easily changed to use some IP-level raw socket interface, I dunno. -Luke From alexey@REDACTED Sat Feb 5 23:04:26 2005 From: alexey@REDACTED (Alexey Shchepin) Date: Sun, 06 Feb 2005 00:04:26 +0200 Subject: erlang resolver and resolv.conf Message-ID: <87wttmhded.fsf@alex.sevcom.net> Hi! >From lib/kernel/src/inet_config.erl: do_load_resolv({unix,Type}, longnames) -> %% The Etc variable enables us to run tests with other %% configuration files than the normal ones Etc = case os:getenv("ERL_INET_ETC_DIR") of false -> ?DEFAULT_ETC; _EtcDir -> _EtcDir end, load_resolv(filename:join(Etc,"resolv.conf"), resolv), ... Other branches of this function doesn't have loading of /etc/resolv.conf. I.e. resolv.conf is loaded on unixes only when erl is runned with -name option (not the second argument to do_load_resolv), and with short name or without any name reolv.conf is completely ignored. Can someone describe reasons of such behaviour? Thanks! From klacke@REDACTED Sat Feb 5 23:07:11 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Sat, 5 Feb 2005 23:07:11 +0100 Subject: mnesia + disc_only_copies Message-ID: <20050205220710.GA18363@hyber.org> Hi all, I'm having some problems with mnesia and disc_only_copies tables. The error is pretty easy to recreate and I get the same error in both R9C-0 and latest R10 I create a table, with disc_only_copies on two nodes as in: c() -> mnesia:create_table(a, [{attributes, record_info(fields,a)}, {disc_only_copies, [a@REDACTED, a@REDACTED]}]). I then populate the table with a fairly large amount of items, say 500.000 records. as: populate(0) -> ok; populate(I) -> mnesia:dirty_write(#a{key = I}), populate(I-1). the record "a", doesn't matter it can be any record. Anyway, when table is populated and I start/stop the different nodes, the table needs to be copied from one node to the other. I get: =ERROR REPORT==== 5-Feb-2005::23:23:09 === Got invalid data on distribution channel, offending packet is: <<112,131,104,3,97,2,67,5,103,67,245,0,0,0,101,0,0,0,0,3,131,104,2,103,67,71,0,0,0,122,0,0,0,0,1,104,2,67,183,108,0,0,0,8,104,3,97,13,98,0,2,34,88,109,0,0,16,0,0,0,9,144,18,52,86,120,0,0,2,98,131,104,6,100,0,1,97, ......... This is all done by dets:bchunk(), I've tried to find the error, but to no avail. Has anyone else had these problems, ??? Is _anybody_ using mnesia with large disc_only_copies tables ??? The bug appears to be fairly easy to reproduce, but ...well hard to debug. Before digging deep into the bug, I thought I should ask if anyone else has seen this ??? /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From valentin@REDACTED Sun Feb 6 07:52:39 2005 From: valentin@REDACTED (Valentin Micic) Date: Sun, 6 Feb 2005 08:52:39 +0200 Subject: mnesia + disc_only_copies References: <20050205220710.GA18363@hyber.org> Message-ID: <052f01c50c18$73461b90$0100a8c0@MONEYMAKER2> > =ERROR REPORT==== 5-Feb-2005::23:23:09 === > Got invalid data on distribution channel, offending packet is: > <<112,131,104,3,97,2,67,5,103,67,245,0,0,0,101,0,0,0,0,3,131,104,2,103,67,71 ,0,0,0,122,0,0,0,0,1,104,2,67,183,108,0,0,0,8,104,3,97,13,98,0,2,34,88,109,0 ,0,16,0,0,0,9,144,18,52,86,120,0,0,2,98,131,104,6,100,0,1,97, ......... MNESIA is soooo rich... I do not remember seeing the same error twice. Are both nodes on the same revision? V. PS Mr. Lundin, is it going to be ok if I give you a ring RE commercial license? From valentin@REDACTED Sun Feb 6 07:58:14 2005 From: valentin@REDACTED (Valentin Micic) Date: Sun, 6 Feb 2005 08:58:14 +0200 Subject: mnesia + disc_only_copies References: <20050205220710.GA18363@hyber.org> Message-ID: <053801c50c19$3b502130$0100a8c0@MONEYMAKER2> > I'm having some problems with mnesia and disc_only_copies tables. > The error is pretty easy to recreate and I get the same error in > both R9C-0 and latest R10 > On the second bite: I had similar problems on R9C-0. Try the whole thing on R9C-2. It appears to be much more stable. V. From ok@REDACTED Mon Feb 7 00:26:16 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 7 Feb 2005 12:26:16 +1300 (NZDT) Subject: Proposed change to libraries Message-ID: <200502062326.j16NQGgZ277733@atlas.otago.ac.nz> Kostis Sagonas wrote: For example, one can issue the call: lists:map(gazonk, []) which will return []. Anyone who relies on that deserves the trouble they will one day get. I"d taken it that the documentation was telling you what you could *rely* on while the code was subject to change without notice. I.e., change the implementation of map/2 (and similar functions) as if defined by: map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 []. Changing the code to that should permit more effective use of optional type checking (whatever happened to that, anyway?). It should also catch more unintentional errors at run time, which is surely a good thing. Scheme insists on the list argument of map being a proper list, and it seems to cause no trouble there. From casper2000a@REDACTED Mon Feb 7 04:51:21 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 7 Feb 2005 09:51:21 +0600 Subject: How to debug a C Port driver? In-Reply-To: <1107492576.4202fee0a3a7c@www.omnibis.com> Message-ID: Hi All, How can I debug a C port driver? Can use "gdb" for that? I am developing a C port driver. It compiles and links well. When I checked the resulted .so file using ldd, if shows all the depended libraries. Also then I checked with the Linker (ld), it only shows the driver_* routines missing. I guess that means it's linked well. But when I load that through the Erlang Emulator, in the init routine, one of my Initialize function doesn't work (claInitilize). It complints that it couldn't load the library well. But it doesn't show enough information to identify what's going wrong. So I need to find a method to debug this module. Thanks in advance! Eranga From peppe@REDACTED Mon Feb 7 09:25:02 2005 From: peppe@REDACTED (UAB L/K Peter Andersson) Date: Mon, 07 Feb 2005 09:25:02 +0100 Subject: erlang resolver and resolv.conf References: <87wttmhded.fsf@alex.sevcom.net> Message-ID: <420725DE.9D71D941@erix.ericsson.se> Hi Alexey, I think the comment beginning on line 65 explains it: %% Note: In shortnames (or non-distributed) mode we don't need to know %% our own domain name. In longnames mode we do and we can't rely on %% the user to provide it (by means of inetrc), so we need to look %% for it ourselves. Best regards, Peppe Alexey Shchepin wrote: > > Hi! > > >From lib/kernel/src/inet_config.erl: > > do_load_resolv({unix,Type}, longnames) -> > %% The Etc variable enables us to run tests with other > %% configuration files than the normal ones > Etc = case os:getenv("ERL_INET_ETC_DIR") of > false -> ?DEFAULT_ETC; > _EtcDir -> > _EtcDir > end, > load_resolv(filename:join(Etc,"resolv.conf"), resolv), > ... > > Other branches of this function doesn't have loading of /etc/resolv.conf. > I.e. resolv.conf is loaded on unixes only when erl is runned with -name option > (not the second argument to do_load_resolv), and with short name or without any > name reolv.conf is completely ignored. Can someone describe reasons of such > behaviour? > > Thanks! From joe.armstrong@REDACTED Mon Feb 7 11:12:26 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 7 Feb 2005 11:12:26 +0100 Subject: Efficiency (revised position) Message-ID: Hello, I have decided to revise my position on effieciency - since what I say seems to be deliberately misinterpreted :-) I have often said "program as inefficiently as possible" but this simple truth is often mis-interpreted. A more precise statement would be "You must program "as inefficiently as possible" in an "as efficient as possible manner" Writing clear programs should be like writing clear English. You should write them as clearly as possible because one day you might have to modify them, or some other person might want to re-use your code. If you don't write yout programs clearly then when you come to re-use them you will not understand them and you will have to re-write them.- Efficiency and clarity are very difficult to combine (so the first "as inefficiently as possible", means "as clearly as possible" - I'm just expressing it this way to encourage debate (though the irony seems to have been missed by a non-zero proportion of people who read this) Writing clear programs is like writing clear English, the same mental processes are involved. The best advice on writing clear English is, I think, to be found in the writings of George Orwell - In "Politics and the English Language" he writes: A scrupulous writer, in every sentence that he writes, will ask himself at least four questions, thus: 1. What am I trying to say? 2. What words will express it? 3. What image or idiom will make it clearer? 4. Is this image fresh enough to have an effect? And he will probably ask himself two more: 1. Could I put it more shortly? 2. Have I said anything that is avoidably ugly? Now my second point the "as efficient as possible manner" is really what Orwell says about ugliness - clear code that does not use the best and more efficient algorithm is just plain ugly. So what you must do is to programs as clearly as possible choosing the most efficient algorithms possible. What you should not do is to program unclear code with bizarre untested algorithms in the naive belief that they will be efficient. /Joe From kostis@REDACTED Mon Feb 7 11:22:55 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 7 Feb 2005 11:22:55 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from '"Richard A. O'Keefe" ' dated: Mon, 7 Feb 2005 12:26:16 +1300 (NZDT) Message-ID: <200502071022.j17AMtP4012748@spikklubban.it.uu.se> Richard A. O'Keefe wrote: > Changing the code to that should permit more effective use of optional > type checking This is exactly the reason why we want this change. > (whatever happened to that, anyway?). Oh, it's alive and kicking in the form of "Dialyzer". See: http://www.it.uu.se/research/group/hipe/dialyzer/ > Scheme insists on the list argument of map being a proper list, and it > seems to cause no trouble there. I am not sure I get this, because map naturally protects itself from inproper lists in its second argument. Can it be that you are mixing map with some other function like append? Kostis From joe.armstrong@REDACTED Mon Feb 7 11:26:44 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 7 Feb 2005 11:26:44 +0100 Subject: Parsing binaries (was Re: Concatenating atoms) Message-ID: > > Hi Matthias, hi Joe, > > If integers are desirable, why not use indexes into the binary which > contains the original XML data? Absolutly - this is a good idea - It just make the parseing a wee bit more complicated. (Actually you can use strings, - but don't tell anybody I said so - if you can guarantee that they are "pointer identical" (ie you build the strings in linear manner using a "pure dictionary type" library) > So, to use Joe's example to illustrate, the variable Abc on line 23 of > the program could be represented as {var,Offset,Size} where Offset is > the position of the first byte of "Abc" in XML_Binary, and > Size in this > case would be 3 (obtaining line numbers would be done by scanning the > binary for newline chars, for error reports). I think I'm correct in > saying that the following: > > <<_:Offset/binary,Chunk:Size/binary,_/binary>> = XML_Binary, > > Doesn't create a new binary Chunk, instead creates a > reference into the > existing XML_binary. > > A lexicon of tokens could be based on a list of {Offset,Size} tuples, > and all matching tokens in a parse tree can refer to the > first occurance > of the token in XML_Binary. > > I'm currently using this technique to parse SIP and SDP. There's at > least a x3 speed advantage when compiling with HiPE too! (Although Joe > seems less concerned about that sort of detail :-) > UUuuuuuuuuuuummmmmmmmmmm :-) /Joe > Pete. > > On Thu, 03 Feb 2005 22:07:39 +0100 > Matthias Kretschmer wrote: > > > > > Well from a practical view it might be very unimportant, because > > comparing two or three machine words would be sufficient. > But if one > > wants to use it for tokens in a compiler, this might not be > the case. On > > the other hand looking at some of my code I hardly find > many atoms which > > are sharing a common long prefix and have the same length > (though don't > > know how atoms are compared, but I could think that first type and > > length is tested and then from left to right). I am just > using Erlang > > for small unimportant private projects, so my experience is > very limited > > (and programming was nothing more for me besides university). Maybe > > someone with experience (of bigger projects) may enlighten me? > > > -- > "The Tao of Programming > flows far away > and returns > on the wind of morning." > > From bjorn@REDACTED Mon Feb 7 11:45:12 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2005 11:45:12 +0100 Subject: mnesia + disc_only_copies In-Reply-To: <20050205220710.GA18363@hyber.org> References: <20050205220710.GA18363@hyber.org> Message-ID: Unfortunately, we were unable to reproduce the problem on Solaris 8/Sparc. Which OS did you run on? /Bjorn klacke@REDACTED writes: > Hi all, > > I'm having some problems with mnesia and disc_only_copies tables. > The error is pretty easy to recreate and I get the same error in > both R9C-0 and latest R10 > > I create a table, with disc_only_copies on two nodes > as in: > > > c() -> > mnesia:create_table(a, > [{attributes, record_info(fields,a)}, > {disc_only_copies, [a@REDACTED, a@REDACTED]}]). > > > > I then populate the table with a fairly large amount of items, > say 500.000 records. > > as: > > > populate(0) -> > ok; > populate(I) -> > mnesia:dirty_write(#a{key = I}), > populate(I-1). > > > > the record "a", doesn't matter it can be any record. > > Anyway, when table is populated and I start/stop the > different nodes, the table needs to be copied from > one node to the other. > I get: > > =ERROR REPORT==== 5-Feb-2005::23:23:09 === > Got invalid data on distribution channel, offending packet is: > <<112,131,104,3,97,2,67,5,103,67,245,0,0,0,101,0,0,0,0,3,131,104,2,103,67,71,0,0,0,122,0,0,0,0,1,104,2,67,183,108,0,0,0,8,104,3,97,13,98,0,2,34,88,109,0,0,16,0,0,0,9,144,18,52,86,120,0,0,2,98,131,104,6,100,0,1,97, ......... > > > This is all done by dets:bchunk(), I've tried to find the error, > but to no avail. > > Has anyone else had these problems, ??? Is _anybody_ using mnesia > with large disc_only_copies tables ??? > > The bug appears to be fairly easy to reproduce, but ...well > hard to debug. Before digging deep into the bug, I thought I should > ask if anyone else has seen this ??? > > > /klacke > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Mon Feb 7 11:58:16 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2005 11:58:16 +0100 Subject: Proposed change to libraries In-Reply-To: References: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> <20050204145019.GA28387@hyber.org> Message-ID: AFAIK, length/1 has never been broken in that way. /Bj?rn "Vlad Dumitrescu" writes: > I agree too. > > > Disgusting. It's almost as bad and surprising as: > > 2> length(self()). > > {-73, 3.14} > > Well, at least that's fixed: > > Eshell V5.4.3 (abort with ^G) > (wolf@REDACTED)1> length(self()). > ** exited: {badarg,[{erlang,length,[<0.37.0>]}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > > regards, > Vlad > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Mon Feb 7 12:07:26 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2005 12:07:26 +0100 Subject: Proposed change to libraries In-Reply-To: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> References: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> Message-ID: Kostis Sagonas writes: [...] > > I.e., change the implementation of map/2 (and similar functions) > as if defined by: > > map(F, [H|T]) -> > [F(H)|map(F, T)]; > map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 > []. I have some good news and some bad news. :-) The good news is that we can change lists:map/2 and friends in R10B-4 to reject an F that is not a fun. That is merely a bug fix and does not break backward compatibility. The bad news is that F must be allowed to be a "tuple fun" too, to keep backward compatibility. Thus the revised code must look like this: map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 []; map({M,F}, []) when is_atom(M), is_atom(F) -> []. That should still give the Dialyzer more information about the type. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Mon Feb 7 13:07:43 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 7 Feb 2005 13:07:43 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from 'Bjorn Gustavsson ' dated: 07 Feb 2005 12:07:26 +0100 Message-ID: <200502071207.j17C7hAk022387@spikklubban.it.uu.se> Bjorn Gustvsson wrote: > I have some good news and some bad news. :-) > > The good news is that we can change lists:map/2 and friends in > R10B-4 to reject an F that is not a fun. That is merely a bug fix > and does not break backward compatibility. > > The bad news is that F must be allowed to be a "tuple fun" too, > to keep backward compatibility. > > Thus the revised code must look like this: > > map(F, [H|T]) -> > [F(H)|map(F, T)]; > map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 > []; > map({M,F}, []) when is_atom(M), is_atom(F) -> > []. I totally understand the argument for maintaining backwards compatibility, even though I do not fully agree with it, but if the decision is to add the extra clause, there is still something which is needed. Besides checking that M and F are atoms, there needs to be a check that the {M,F} is a valid fun object and its arity is 1 (note the is_fun_arity new guard that is required in the second clause -- I wrote it as a comment but it really needs to be introduced in the language for the type inference algorithm to infer that the F in the first and the second clause are of the same type). Kostis From mccratch@REDACTED Mon Feb 7 13:37:31 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Mon, 7 Feb 2005 13:37:31 +0100 Subject: Parsing binaries (was Re: Concatenating atoms) In-Reply-To: References: Message-ID: <20050207123731.GA11458@thrakhath.kilrathi.lcn> On 2005-02-07 at 11:26:44 (+0100), Joe Armstrong (AL/EAB) wrote: > > > > Hi Matthias, hi Joe, > > > > If integers are desirable, why not use indexes into the binary which > > contains the original XML data? > > Absolutly - this is a good idea - It just make the parseing a wee bit > more complicated. (Actually you can use strings, - but don't tell anybody I said so - > if you can guarantee that they are "pointer identical" (ie you build the strings > in linear manner using a "pure dictionary type" library) > > > > So, to use Joe's example to illustrate, the variable Abc on line 23 of > > the program could be represented as {var,Offset,Size} where Offset is > > the position of the first byte of "Abc" in XML_Binary, and > > Size in this > > case would be 3 (obtaining line numbers would be done by scanning the > > binary for newline chars, for error reports). I think I'm correct in > > saying that the following: > > > > <<_:Offset/binary,Chunk:Size/binary,_/binary>> = XML_Binary, > > > > Doesn't create a new binary Chunk, instead creates a > > reference into the > > existing XML_binary. > > > > A lexicon of tokens could be based on a list of {Offset,Size} tuples, > > and all matching tokens in a parse tree can refer to the > > first occurance > > of the token in XML_Binary. this sounds interesting. As long as only Offset and Size are compared the life is very good and fast. I think another technique instead of preserving the whole input (espacially if you parse big files you might not want to have the whole input in memory), build a dictionary mapping offsets (and sizes if required) to strings (or short binaries) and a trie representing the reverse map. If we can rely on some smart Erlang VM implementation, it would be enough to have the trie which represents the identical map. Then simply exchange each occurance of an string with the one found in the map. If we have a large file with only a small number of different identifiers, this should optimize the space requirements. In other words, using a simple compression algorithm. The number of keywords of language to parse should be fixed, so converting those to atoms for comparison should be any problem (at least all languages I know have a fixed set of keywords :)). Including such a trie into a scanner (or scanner generator generated scanner) shouldn't be a problem. One could even include some support in the parser generator or parser combinators to not have to use atoms for keywords, but I think that is overkill. The advantage of using the strings would be, that one does not have ot lookup the strings in binaries or dictionaries which should make it much easier to use them. On the other hand this needs some support from the runtime, that structures may be shared and then comparison will be really fast (but I think this is the way the current VM works and if not a change might at least be easier than adding an atom garbage collector :)). -- Matthias Kretschmer From ulf.wiger@REDACTED Mon Feb 7 14:46:53 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 7 Feb 2005 14:46:53 +0100 Subject: Proposed change to libraries Message-ID: Kostis wrote: > Besides checking that M and F are atoms, there needs to be a > check that the {M,F} is a valid fun object and its arity is 1 > (note the is_fun_arity new guard that is required in the second > clause -- I wrote it as a comment but it really needs to be > introduced in the language for the type inference > algorithm to infer that the F in the first and the second > clause are of the same type). Fine, but that should not be an inner loop check. BTW, can is_fun_arity() really be a guard function? With on-demand code loading, is_fun_arity can only say whether a given function has the right arity if it's already loaded - otherwise, it must fail - or the guard check potentially hang while the considerable side effect of loading the module into memory is executed. I assume that this will not be allowed. This would mean that lists:map/2 could fail even if the function {M,F} exists and has the right arity, which would seem to violate Joe's Principle of Least Astonishment. Given that {M,F} must point to an exported function, the BIF erlang:function_exported/3 seems to do pretty much what you're asking for, except for a few oddities: Eshell V5.4.3 (abort with ^G) 1> lists:map({erlang,abs},[-2,-1,0,1,2,3]). [2,1,0,1,2,3] 2> erlang:function_exported(erlang,abs,1). false 3> The documentation says the following: "erlang:function_exported(Module, Function, Arity) Returns true if the module Module is loaded and contains an exported function Function/Arity; otherwise false. Returns false for any BIF (functions implemented in C rather than in Erlang). This function is retained mainly for backwards compatibility. It is not clear why you really would want to use it." Note that this function is not allowed in guards. PS 4> erlang:function_exported(erlang,send_nosuspend,3). true 4> erlang:function_exported(erlang,send_nosuspend,3). true 5> erlang:function_exported(ets,insert,2). false 6> erlang:function_exported(ets,tab2list,1). true 7> erlang:function_exported(lists,append,2). true 8> erlang:function_exported(erlang,yield,0). true The rule of returning 'false' for BIFs pretty much makes this BIF unusable for practical purposes. In the examples above, it's not even enough to look into the source code to predict what this function will return. The Erlang source for erlang:yield() looks like this: yield() -> erlang:yield(). Go figure. (: /Uffe From alexey@REDACTED Mon Feb 7 14:58:53 2005 From: alexey@REDACTED (Alexey Shchepin) Date: Mon, 07 Feb 2005 15:58:53 +0200 Subject: erlang resolver and resolv.conf In-Reply-To: <420725DE.9D71D941@erix.ericsson.se> (UAB L.'s message of "Mon, 07 Feb 2005 09:25:02 +0100") References: <87wttmhded.fsf@alex.sevcom.net> <420725DE.9D71D941@erix.ericsson.se> Message-ID: <87r7jso4iq.fsf@ns.sevcom.net> Hello, Peter! On Mon, 07 Feb 2005 09:25:02 +0100, you said: UL> I think the comment beginning on line 65 explains it: UL> %% Note: In shortnames (or non-distributed) mode we don't need to know UL> %% our own domain name. In longnames mode we do and we can't rely on UL> %% the user to provide it (by means of inetrc), so we need to look UL> %% for it ourselves. But resolv.conf also contains a list of nameservers, and without reading it at least inet_res:getbyname doesn't work (always returns {error, timeout}): $ erl -name test Erlang (BEAM) emulator version 5.4 [source] [hipe] [threads:0] Eshell V5.4 (abort with ^G) (test@REDACTED)1> inet_res:getbyname("_xmpp-server._tcp.jabber.ru", srv). {ok,{hostent,"_xmpp-server._tcp.jabber.ru",[],srv,1,[{0,0,5269,"jabber.ru"}]}} $ erl -sname test Erlang (BEAM) emulator version 5.4 [source] [hipe] [threads:0] Eshell V5.4 (abort with ^G) (test@REDACTED)1> inet_res:getbyname("_xmpp-server._tcp.jabber.ru", srv). {error,timeout} From bjorn@REDACTED Mon Feb 7 14:56:50 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2005 14:56:50 +0100 Subject: Proposed change to libraries In-Reply-To: <200502071207.j17C7hAk022387@spikklubban.it.uu.se> References: <200502071207.j17C7hAk022387@spikklubban.it.uu.se> Message-ID: Kostis Sagonas writes: [..] > Besides checking that M and F are atoms, there needs to be a check that > the {M,F} is a valid fun object and its arity is 1 (note the is_fun_arity > new guard that is required in the second clause -- I wrote it as a comment > but it really needs to be introduced in the language for the type inference > algorithm to infer that the F in the first and the second clause are of > the same type). > Unfortunately, it is tricky to check that {M,F} is a valid fun. The module M might not even be loaded. It has been suggested earlier that we should add fun M:F/Arity to the language. Unfortunately, we didn't add it in R10B. We could add it in R11B. Regarding the arity test for a "real" fun, we could add the guard BIF is_function(F, Arity) in R11B. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Mon Feb 7 14:59:27 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 07 Feb 2005 14:59:27 +0100 Subject: Proposed change to libraries In-Reply-To: References: Message-ID: "Ulf Wiger \(AL/EAB\)" writes: [...] > BTW, can is_fun_arity() really be a guard function? Yes, it can if it only accepts "real" funs, not tuple funs. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From klacke@REDACTED Mon Feb 7 15:09:29 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Mon, 7 Feb 2005 15:09:29 +0100 Subject: mnesia + disc_only_copies In-Reply-To: References: <20050205220710.GA18363@hyber.org> Message-ID: <20050207140929.GA11206@hyber.org> On Mon, Feb 07, 2005 at 11:45:12AM +0100, Bjorn Gustavsson wrote: > Unfortunately, we were unable to reproduce the problem > on Solaris 8/Sparc. > > Which OS did you run on? > Linux, 2.6.{9,10} Oldstyle IDE disks, two machines, couldn't reproduce with two nodes on the same box. OTP = otp_src_R10B-2 (or R9C for that matter) Need at least large number of objects (300000 ??) or specific size of DAT file, (> 100 Meg) I'm not sure wether it's the size or the numobjects that trigger. Had the same (??) error show up as a coredump as well. SIGSEGV in the size() BIF. Need to get into a situation where the table is actually copied over the network. Files stored on local discs ofcourse. I've run with: -record(a, {key, v1 = zappo, v2 = {2,3,4}, v3 = "hooorayaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa", v4 = {1,"lll",[]}}). (Sorry about ugly indentation above ..) and: mnesia:create_schema([a@REDACTED, a@REDACTED]). and mnesia:create_table(a, [{attributes, record_info(fields,a)}, {disc_only_copies, [a@REDACTED,a@REDACTED]}]). and populate(0) -> ok; populate(I) -> mnesia:dirty_write(#a{key = I}), populate(I-1). and call populate(400000). Good hunting .. :-) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From klacke@REDACTED Mon Feb 7 15:14:28 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Mon, 7 Feb 2005 15:14:28 +0100 Subject: Proposed change to libraries In-Reply-To: References: <200502041318.j14DIFAJ000649@spikklubban.it.uu.se> <20050204145019.GA28387@hyber.org> Message-ID: <20050207141428.GC11206@hyber.org> On Mon, Feb 07, 2005 at 11:58:16AM +0100, Bjorn Gustavsson wrote: > AFAIK, length/1 has never been broken in that way. > Sorry about that, It was a bad joke. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From peppe@REDACTED Mon Feb 7 15:17:24 2005 From: peppe@REDACTED (UAB L/K Peter Andersson) Date: Mon, 07 Feb 2005 15:17:24 +0100 Subject: erlang resolver and resolv.conf References: <87wttmhded.fsf@alex.sevcom.net> <420725DE.9D71D941@erix.ericsson.se> <87r7jso4iq.fsf@ns.sevcom.net> Message-ID: <42077874.B1ED5019@erix.ericsson.se> The idea is that erlang will always use native lookup unless you specify otherwise explicitly. The fact that resolving does not work properly when you run erlang in shortname mode implies that networking is not properly configured in your os. Please read the ERTS User's Guide, chapter 7. Hopefully that will clearify things. /Peppe Alexey Shchepin wrote: > > Hello, Peter! > > On Mon, 07 Feb 2005 09:25:02 +0100, you said: > > UL> I think the comment beginning on line 65 explains it: > > UL> %% Note: In shortnames (or non-distributed) mode we don't need to know > UL> %% our own domain name. In longnames mode we do and we can't rely on > UL> %% the user to provide it (by means of inetrc), so we need to look > UL> %% for it ourselves. > > But resolv.conf also contains a list of nameservers, and without reading it at > least inet_res:getbyname doesn't work (always returns {error, timeout}): > > $ erl -name test > Erlang (BEAM) emulator version 5.4 [source] [hipe] [threads:0] > > Eshell V5.4 (abort with ^G) > (test@REDACTED)1> inet_res:getbyname("_xmpp-server._tcp.jabber.ru", srv). > {ok,{hostent,"_xmpp-server._tcp.jabber.ru",[],srv,1,[{0,0,5269,"jabber.ru"}]}} > > $ erl -sname test > Erlang (BEAM) emulator version 5.4 [source] [hipe] [threads:0] > > Eshell V5.4 (abort with ^G) > (test@REDACTED)1> inet_res:getbyname("_xmpp-server._tcp.jabber.ru", srv). > {error,timeout} From lencionil@REDACTED Mon Feb 7 16:25:52 2005 From: lencionil@REDACTED (leo lencioni) Date: Mon, 7 Feb 2005 12:25:52 -0300 Subject: ICMP Ping In-Reply-To: References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> Message-ID: <2dda5cae0502070725d423735@mail.gmail.com> Thanks to all, for your responses. I found another alternative to doing and ICMP ECHO PING. In the new Java 1.5 SDK, the InetAddress Object has a new method call isReachable (see http://java.sun.com/j2se/1.5.0/docs/api/java/net/InetAddress.html), that tries to execute a n ICMP ping. Sun documentation is not very clear if it will always execute an ICMP ECHO REQUEST in all cases. It appears that it is an implementation dependant thing So for my first try to this I will write a small java program that will execute a isReachable method . Communications between erlang and Java program will be based on standard tcp sockets. On Sat, 05 Feb 2005 11:54:56 -0800 (PST), Luke Gorrie wrote: > Matthias Lang writes: > > > leo lencioni writes: > > > > > > > 1) Can erlang generate and send an ICMP Echo request? > > > > klacke writes: > > > > An alternative could > > > > be to use the tun/tap driver found in jungerl, that could > > > > sureley be used to introduce raw IP packets on the network. > > > > To read the packet, you'd have to setup your routes i such > > > > a way so that return packets find their way up to userspace. > > > > A further alternative which may be of use is: > > > > http://www.snookles.com/erlang/edtk/edtk-1.0/examples/libnet/ > > > > it appears to have an example which sends ping packets. > > An even further alternative is the lib/psocket program in jungerl. > That's a port program that opens a PF_PACKET socket to read/write > ethernet frames on existing interfaces. Could perhaps be easily > changed to use some IP-level raw socket interface, I dunno. > > -Luke > > From luke@REDACTED Mon Feb 7 16:37:02 2005 From: luke@REDACTED (Luke Gorrie) Date: 07 Feb 2005 16:37:02 +0100 Subject: ICMP Ping In-Reply-To: <2dda5cae0502070725d423735@mail.gmail.com> References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> <2dda5cae0502070725d423735@mail.gmail.com> Message-ID: leo lencioni writes: > So for my first try to this I will write a small java program that > will execute a isReachable method . Communications between erlang and > Java program will be based on standard tcp sockets. Yikes! Maybe we took your question too literally. What is it you want to do and why, in high-level terms? NB: if you do decide to use a helper you could do it more lightweight than Java, e.g. on GNU: -module(test). -compile(export_all). reachable(Host) -> os:cmd("ping -c 1 "++Host++" &>/dev/null; echo $?") == "0\n". used like this: 1> test:reachable("localhost"). true 2> test:reachable("www.google.com"). true 3> test:reachable("1.2.3.4"). false From lencionil@REDACTED Mon Feb 7 18:32:41 2005 From: lencionil@REDACTED (leo lencioni) Date: Mon, 7 Feb 2005 14:32:41 -0300 Subject: ICMP Ping In-Reply-To: References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> <2dda5cae0502070725d423735@mail.gmail.com> Message-ID: <2dda5cae0502070932218538bc@mail.gmail.com> I am trying to write a very simple network monitoring tool. Not trying to replace any of the commercial products/open source, but as a nice example to try and learn about erlang features (concurrency and Mnesia) in a real scenario. Here are my requirements: - Approximately 200 tcp/ip hosts + routers/switches will be under control of the application. - I need to record UP/DOWN status for each device. The application will determine up status of a device if the device responds successfully to an ICMP ECHO. - Every host will be polled periodically every X minutes. The poll interval is a parameter for each host. - Result of every poll will be logged to mnesia database for report generation. - There will be an operator interface. Status of device will be shown via operator interface interface (I have not make a decision if interface will be GS/WEB/TEXT). The application must support multiple users. Each user will decide which parts of the network he wants to see. For each host the operator interface will show up/down status, if device down, time of the last successful ping. - Maintenance interface, for adding/modifying/deleting hosts and users. - Reports for doing monthly and daily availability calculations. I thinked about using your shell solution and parsing the result of the os/ping command. But I have some concerns about scalability, since I will have a great number of hosts to ping, and I thought that I can have some performance problems for having to start a shell for each ping command. Probably this is a case of premature optimization. Thats the reason of my original question and my idea of building some kind of ping server, with a number of worker threads doing the actual ping. Thanks for your time. From mccratch@REDACTED Mon Feb 7 19:24:36 2005 From: mccratch@REDACTED (Matthias Kretschmer) Date: Mon, 07 Feb 2005 19:24:36 +0100 Subject: Guard sequences, short circuit boolean operators Message-ID: <4207B264.3000607@gmx.net> Hello I just wonder why andalso and orelse aren't allowed in guard sequences. Even in the case of backward compatibility it makes no sense, they are just equal to the normal "and" and "or" (ignoring precedence rules ...) as far as I understand the reference manual correctly. I just want to know the reason for this ... - in my humble opinion it looks a bit weird using andalso in one place and being forced to use and in another place to have the same thing (or using a "," which I assume is something left from the days when Erlang was running in a Prolog system?). -- Cheers Matthias Kretschmer From klacke@REDACTED Mon Feb 7 19:55:22 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Mon, 7 Feb 2005 19:55:22 +0100 Subject: ICMP Ping In-Reply-To: <2dda5cae0502070932218538bc@mail.gmail.com> References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> <2dda5cae0502070725d423735@mail.gmail.com> <2dda5cae0502070932218538bc@mail.gmail.com> Message-ID: <20050207185522.GA12622@hyber.org> On Mon, Feb 07, 2005 at 02:32:41PM -0300, leo lencioni wrote: > > I thinked about using your shell solution and parsing the result of > the os/ping command. But I have some concerns about scalability, since > I will have a great number of hosts to ping, and I thought that I can > have some performance problems for having to start a shell for each > ping command. Sounds reasonable, I'd write an external portprogram that a) read/writes on stdout back and forth to erlang b) open RAW sockets to do the real ICMP packets Adds filedescriptors from a) and b) to the poll loop of the external program. That way getting scaleability and the ability to send the RAW packets exactly as you want to. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From kostis@REDACTED Mon Feb 7 20:38:58 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 7 Feb 2005 20:38:58 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from 'Bjorn Gustavsson ' dated: 07 Feb 2005 14:56:50 +0100 Message-ID: <200502071938.j17JcwOo006245@spikklubban.it.uu.se> Bj?rn Gustavsson wrote: > Unfortunately, it is tricky to check that {M,F} is a valid fun. > The module M might not even be loaded. This is true, but the above yet one more argument for finally deciding to discontinue support for the {M,F} fun notation. It ain't fun! Kostis From taavi@REDACTED Mon Feb 7 20:53:59 2005 From: taavi@REDACTED (Taavi Talvik) Date: Mon, 7 Feb 2005 21:53:59 +0200 Subject: ICMP Ping In-Reply-To: <2dda5cae0502070932218538bc@mail.gmail.com> References: <2dda5cae05020213161444d4dc@mail.gmail.com> <20050203101842.GA13089@hyber.org> <2dda5cae050203072360bf131e@mail.gmail.com> <16900.64865.919725.838555@antilipe.corelatus.se> <2dda5cae0502070725d423735@mail.gmail.com> <2dda5cae0502070932218538bc@mail.gmail.com> Message-ID: On Feb 7, 2005, at 7:32 PM, leo lencioni wrote: Look at http://home.uninet.ee/~taavi/files/erlang/ contains port driver for ICMP ping (freebsd ping program was used as start). best regards, taavi > I am trying to write a very simple network monitoring tool. Not trying > to replace any of the commercial products/open source, but as a nice > example to try and learn about erlang features (concurrency and > Mnesia) in a real scenario. > > Here are my requirements: > > - Approximately 200 tcp/ip hosts + routers/switches will be under > control of the application. > - I need to record UP/DOWN status for each device. The application > will determine up status of a device if the device responds > successfully to an ICMP ECHO. > - Every host will be polled periodically every X minutes. The poll > interval is a parameter for each host. > - Result of every poll will be logged to mnesia database for report > generation. > - There will be an operator interface. Status of device will be shown > via operator interface interface (I have not make a decision if > interface will be GS/WEB/TEXT). The application must support multiple > users. Each user will decide which parts of the network he wants to > see. For each host the operator interface will show up/down status, if > device down, time of the last successful ping. > - Maintenance interface, for adding/modifying/deleting hosts and users. > - Reports for doing monthly and daily availability calculations. > > I thinked about using your shell solution and parsing the result of > the os/ping command. But I have some concerns about scalability, since > I will have a great number of hosts to ping, and I thought that I can > have some performance problems for having to start a shell for each > ping command. Probably this is a case of premature optimization. Thats > the reason of my original question and my idea of building some kind > of ping server, with a number of worker threads doing the actual ping. > > Thanks for your time. From carsten@REDACTED Mon Feb 7 22:22:11 2005 From: carsten@REDACTED (Carsten Schultz) Date: Mon, 7 Feb 2005 22:22:11 +0100 Subject: Proposed change to libraries In-Reply-To: References: <200502071207.j17C7hAk022387@spikklubban.it.uu.se> Message-ID: <20050207212210.GA5012@penne.localnet> Hi! On Mon, Feb 07, 2005 at 02:56:50PM +0100, Bjorn Gustavsson wrote: > Unfortunately, it is tricky to check that {M,F} is a valid fun. The module > M might not even be loaded. I do not see this as a grave problem. It might be handled as if the programmer had written fun(X) -> M:F(X) end instead. > It has been suggested earlier that we should add > > fun M:F/Arity > > to the language. Or this :-) Take care, Carsten -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From tra@REDACTED Mon Feb 7 23:10:02 2005 From: tra@REDACTED (Tiago Rodrigues Antao) Date: Mon, 7 Feb 2005 22:10:02 +0000 Subject: Status of ODBC Message-ID: <200502072210.02267.tra@fct.unl.pt> Hi! I am trying to use the ODBC facility of Erlang. I have noticed from the code that its only supposed to work on Windows and Solaris (I am working on Linux). I changed the build script and compiled odbcserver. I was able to start it from within Erlang and to connect to a PostgreSQL server, but when I try to do an SQL query the server crashes. Does anyone tried to use odbcserver on Linux? With any luck? Thanks a lot for any help, Tiago From ok@REDACTED Tue Feb 8 01:42:30 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 8 Feb 2005 13:42:30 +1300 (NZDT) Subject: Proposed change to libraries Message-ID: <200502080042.j180gU0k289095@atlas.otago.ac.nz> I wrote: > Scheme insists on the list argument of map being a proper list, and it > seems to cause no trouble there. Kostis replied: I am not sure I get this, because map naturally protects itself from inproper lists in its second argument. It is not true that "map naturally protects itself. In Scheme, (define (map F L) (if (pair? L) (cons (F (car L)) (map F (cdr L))) '())) is the most obvious way to implement map. You have to go out of your way to explicitly check for an empty list. And that's my point: in a case where it would not just be _as_ easy to be "generous" but it would actually be _easier_ to be "generous", Scheme demands a proper list. Can it be that you are mixing map with some other function like append? No. append does *not* require its second argument to be a proper list in Scheme implementations. There is an interesting but obvious reason: - in cases where the only burden is one extra check "now that this argument isn't a pair, is it an empty list?", the check is done. - in cases where the burden would be traversing a list that would otherwise _not_ have been traversed, the check is not done. That is, checks are made that don't change the expression inside the big Oh. Not a bad rule for a library implementor. From ok@REDACTED Tue Feb 8 01:51:20 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 8 Feb 2005 13:51:20 +1300 (NZDT) Subject: Proposed change to libraries Message-ID: <200502080051.j180pKhg288631@atlas.otago.ac.nz> The bad news is that F must be allowed to be a "tuple fun" too, to keep backward compatibility. Thus the revised code must look like this: map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) when is_function(F) -> %% andalso is_fun_arity(F) == 1 []; map({M,F}, []) when is_atom(M), is_atom(F) -> []. That should still give the Dialyzer more information about the type. Everywhere we have an argument that should be a function but might not always be applied we are going to have the same problem. A fix that adds an extra clause is going to be a pain. We need is_applicable(F, N) - succeeds or returns true when N is a non-negative integer and F is such that F(T1,...,TN) would make sense - fails or returns false otherwise is_applicable(F) - succeeds or returns true when there exists an N such that is_applicable(F, N) would succeed or return true - fails or returns false otherwise Then map(F, [F|T]) -> [F(H)|map(F,T)]; map(F, []) when is_applicable(F, 2) -> []. From orbitz@REDACTED Tue Feb 8 03:08:06 2005 From: orbitz@REDACTED (orbitz) Date: Mon, 07 Feb 2005 21:08:06 -0500 Subject: Cycles Message-ID: <42081F06.5010703@ezabel.com> I'm trying to implement a protocol and one of the aspects of the protocol is the ability to transmit cyclic data. Erlang's nature seems to only allow tree-structures. Is there anything I can do to handle this? I could just error out on cycles and tell the client i can't accept this data, but it makes the protocol practically useless from there, and I'd rather not have the clients be forced to worry about "what if the server is implemented in erlang". Any suggestion are appreciated, thank you. From fritchie@REDACTED Tue Feb 8 06:58:23 2005 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 07 Feb 2005 23:58:23 -0600 Subject: How to debug a C Port driver? In-Reply-To: Message of "Mon, 07 Feb 2005 09:51:21 +0600." Message-ID: <200502080558.j185wOa1026459@snookles.snookles.com> >>>>> " " == Casper writes: > How can I debug a C port driver? Can use "gdb" for that? It's been quite a while since I've done it, but this is what memory tells me. 1. Run "erl" plus any extra flags. 2. Trigger loading of your shared library, using whatever function that eventually calls erl_ddll:load_driver(). 3. Use "ps" to find process ID # of the "beam" process. 4. Use gdb's "attach" command to attach to the beam PID. 5. Set breakpoints and/or watchpoints. 6. At the Erlang shell command line, call an Erlang function that will trigger your break/watch points. -Scott From casper2000a@REDACTED Tue Feb 8 07:14:57 2005 From: casper2000a@REDACTED (Casper) Date: Tue, 8 Feb 2005 12:14:57 +0600 Subject: How to debug a C Port driver? In-Reply-To: <200502080558.j185wOa1026459@snookles.snookles.com> Message-ID: Hi Scott, Thanks for your advice. It helped me to identify the problem. - Eranga -----Original Message----- From: Scott Lystig Fritchie [mailto:fritchie@REDACTED] Sent: Tuesday, February 08, 2005 11:58 AM To: Casper Cc: erlang-questions@REDACTED Subject: Re: How to debug a C Port driver? >>>>> " " == Casper writes: > How can I debug a C port driver? Can use "gdb" for that? It's been quite a while since I've done it, but this is what memory tells me. 1. Run "erl" plus any extra flags. 2. Trigger loading of your shared library, using whatever function that eventually calls erl_ddll:load_driver(). 3. Use "ps" to find process ID # of the "beam" process. 4. Use gdb's "attach" command to attach to the beam PID. 5. Set breakpoints and/or watchpoints. 6. At the Erlang shell command line, call an Erlang function that will trigger your break/watch points. -Scott From luke@REDACTED Tue Feb 8 08:08:43 2005 From: luke@REDACTED (Luke Gorrie) Date: 08 Feb 2005 08:08:43 +0100 Subject: Cycles References: <42081F06.5010703@ezabel.com> Message-ID: orbitz writes: > I'm trying to implement a protocol and one of the aspects of the > protocol is the ability to transmit cyclic data. Erlang's nature > seems to only allow tree-structures. Is there anything I can do to > handle this? You could take a look at the 'digraph' module in OTP. The basic trick is to use ETS. From raimo@REDACTED Tue Feb 8 08:30:15 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 08 Feb 2005 08:30:15 +0100 Subject: How to debug a C Port driver? References: , <200502080558.j185wOa1026459@snookles.snookles.com> Message-ID: Just at tiny hint: os:getpid() from the erlang shell gives you the ID # of the emulator process. fritchie@REDACTED (Scott Lystig Fritchie) writes: > >>>>> " " == Casper writes: > > > How can I debug a C port driver? Can use "gdb" for that? > > It's been quite a while since I've done it, but this is what memory > tells me. > > 1. Run "erl" plus any extra flags. > > 2. Trigger loading of your shared library, using whatever function > that eventually calls erl_ddll:load_driver(). > > 3. Use "ps" to find process ID # of the "beam" process. > > 4. Use gdb's "attach" command to attach to the beam PID. > > 5. Set breakpoints and/or watchpoints. > > 6. At the Erlang shell command line, call an Erlang function that will > trigger your break/watch points. > > -Scott -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ingela@REDACTED Tue Feb 8 09:27:55 2005 From: ingela@REDACTED (Ingela Anderton) Date: Tue, 8 Feb 2005 09:27:55 +0100 Subject: Status of ODBC References: <200502072210.02267.tra@fct.unl.pt> Message-ID: <16904.30731.569344.923938@gargle.gargle.HOWL> Tiago Rodrigues Antao wrote: > Hi! > > I am trying to use the ODBC facility of Erlang. I have noticed from the code > that its only supposed to work on Windows and Solaris (I am working on > Linux). It is not only supposed to work for Windows and Solaris. There might be some unfortunate naming that gave you this idea. But there is no technical reason why it should not work on Linux. On the other hand it is currently only tested and commercially supported for Windows and Solaris. > I changed the build script and compiled odbcserver. > I was able to start it from within Erlang and to connect to a PostgreSQL > server, but when I try to do an SQL query the server crashes. Without the crash report it is hard say anything! Probably it's not the srollable cursors problem with 2.x drivers as you managed to connect to the server. > Does anyone tried to use odbcserver on Linux? With any luck? I think there where some users who did, but I will let them speak for themselves. -- /Ingela - OTP team From bjorn@REDACTED Tue Feb 8 10:41:37 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Feb 2005 10:41:37 +0100 Subject: Guard sequences, short circuit boolean operators In-Reply-To: <4207B264.3000607@gmx.net> References: <4207B264.3000607@gmx.net> Message-ID: We hope to allow andalso/orelse in guards in R11B. /Bj?rn Matthias Kretschmer writes: > Hello > > I just wonder why andalso and orelse aren't allowed in guard > sequences. Even in the case of backward compatibility it makes no > sense, they are just equal to the normal "and" and "or" (ignoring > precedence rules ...) as far as I understand the reference manual > correctly. I just want to know the reason for this ... - in my humble > opinion it looks a bit weird using andalso in one place and being > forced to use and in another place to have the same thing (or using a > "," which I assume is something left from the days when Erlang was > running in a Prolog system?). > > -- > Cheers > Matthias Kretschmer > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Tue Feb 8 10:50:00 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Feb 2005 10:50:00 +0100 Subject: Proposed change to libraries In-Reply-To: <200502080051.j180pKhg288631@atlas.otago.ac.nz> References: <200502080051.j180pKhg288631@atlas.otago.ac.nz> Message-ID: Seems like good solution to me. It should be easy to implement. Kostis, would that solution work for Dialyzer? /Bj?rn "Richard A. O'Keefe" writes: [...] > We need > is_applicable(F, N) > - succeeds or returns true when N is a non-negative integer > and F is such that F(T1,...,TN) would make sense > - fails or returns false otherwise > is_applicable(F) > - succeeds or returns true when there exists an N such that > is_applicable(F, N) would succeed or return true > - fails or returns false otherwise > > Then > map(F, [F|T]) -> [F(H)|map(F,T)]; > map(F, []) when is_applicable(F, 2) -> []. > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Tue Feb 8 11:28:30 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 8 Feb 2005 11:28:30 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from 'Bjorn Gustavsson ' dated: 08 Feb 2005 10:50:00 +0100 Message-ID: <200502081028.j18ASUnh003507@spikklubban.it.uu.se> Bj?rn Gustavsson wrote: > Seems like good solution to me. It should be easy to implement. > > Kostis, would that solution work for Dialyzer? Yes, it will. However, apparently I am missing the obvious, because I do not see how this is easier (though I see that it is more elegant) to implement than what we were essentially discussing yesterday... The key question is: does "is_applicable({M,F}, 1)" always check that the M:F/1 is a valid fun (and succeeds accordingly) or not? > "Richard A. O'Keefe" writes: > [...] > > We need > > is_applicable(F, N) > > - succeeds or returns true when N is a non-negative integer > > and F is such that F(T1,...,TN) would make sense > > - fails or returns false otherwise > > is_applicable(F) > > - succeeds or returns true when there exists an N such that > > is_applicable(F, N) would succeed or return true > > - fails or returns false otherwise > > > > Then > > map(F, [F|T]) -> [F(H)|map(F,T)]; > > map(F, []) when is_applicable(F, 2) -> []. (I am assuming the "2" above is just a typo and should read "1" BTW). Kostis From bjorn@REDACTED Tue Feb 8 11:54:15 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 08 Feb 2005 11:54:15 +0100 Subject: Proposed change to libraries In-Reply-To: <200502081028.j18ASUnh003507@spikklubban.it.uu.se> References: <200502081028.j18ASUnh003507@spikklubban.it.uu.se> Message-ID: Kostis Sagonas writes: [...] > However, apparently I am missing the obvious, because I do not see > how this is easier (though I see that it is more elegant) to > implement than what we were essentially discussing yesterday... It is essentially the same, just packaged in a much more elegant way. > The key question is: does "is_applicable({M,F}, 1)" always check that > the M:F/1 is a valid fun (and succeeds accordingly) or not? > No. is_applicable/2 cannot still check whether M:F/A will be possible to apply or not. is_applicable/2 would have to assume that any tuple containing two atom elements is a valid tuple fun. But as I see two advantages using is_applicable/2: 1) When/if we'll finally be able to eliminate tuple funs, we can change is_applicable/2 to no longer accept tuple funs (as opposed to changing Erlang code in many places). 2) When Dialyzer sees is_applicable/2, it is a stronger type indication than just 'foo({M,F}) when is_atom(M), is_atom(F)' which need not be a tuple fun. At least it should be enough indication for Dialyzer to assume that F has the same type in both clauses of lists:map/2. That should allow Dialyzer to generate more warnings than it can today. If it would be of help to Dialyzer, we might be able to add is_applicable/2 even to R10B-4 (and start using it in library modules such as lists). On the other hand, I can give no definite time plan for when we'll be able to forbid tuple funs. Sorry. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From zoltan.peter.toth@REDACTED Tue Feb 8 12:57:36 2005 From: zoltan.peter.toth@REDACTED (Zoltan Peter Toth) Date: Tue, 08 Feb 2005 12:57:36 +0100 Subject: BIFs vs. reductions Message-ID: <4208A930.1080904@ericsson.com> Hi, Can someone tell me if BIFs always count as one Erlang reduction ? (returned from process_info) Is there an exact definition of what counts as a reduction ? Thanks, Zoltan From kostis@REDACTED Tue Feb 8 13:12:31 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 8 Feb 2005 13:12:31 +0100 (MET) Subject: Proposed change to libraries Message-ID: <200502081212.j18CCVHG022055@spikklubban.it.uu.se> Bjorn Gustavsson wrote: > > It is essentially the same, just packaged in a much more elegant way. Ok, at least now I know we are on the same wavelength. > > The key question is: does "is_applicable({M,F}, 1)" always check that > > the M:F/1 is a valid fun (and succeeds accordingly) or not? > > > > No. is_applicable/2 cannot still check whether M:F/A will be possible to > apply or not. is_applicable/2 would have to assume that any tuple containing > two atom elements is a valid tuple fun. > > But as I see two advantages using is_applicable/2: > > 1) When/if we'll finally be able to eliminate tuple funs, we can change > is_applicable/2 to no longer accept tuple funs (as opposed to changing > Erlang code in many places). > > 2) When Dialyzer sees is_applicable/2, it is a stronger type indication > than just 'foo({M,F}) when is_atom(M), is_atom(F)' which need not be > a tuple fun. At least it should be enough indication for Dialyzer to > assume that F has the same type in both clauses of lists:map/2. That > should allow Dialyzer to generate more warnings than it can today. > > If it would be of help to Dialyzer, we might be able to add is_applicable/2 > even to R10B-4 (and start using it in library modules such as lists). Sounds a reasonable plan. Since is_applicable/2 will, some fine day, be changed to only accept proper funs in its first argument and till then will only be doing crippled tests with tuple funs anyway, let me propose that we call this is_function/2 instead. So map/2 will read: map(F, [F|T]) -> [F(H)|map(F,T)]; map(F, []) when is_function(F,1) -> []. This is more consistent with the current is_function/1 guard (which is the is_applicable/1 which Richard O'Keefe has described). (Moreover, you can see the current implementation of is_function/1 as one where the tuple fun case is already gone! :-) Kostis From serge@REDACTED Tue Feb 8 17:01:37 2005 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 08 Feb 2005 11:01:37 -0500 Subject: Status of ODBC In-Reply-To: <200502072210.02267.tra@fct.unl.pt> References: <200502072210.02267.tra@fct.unl.pt> Message-ID: <4208E261.8000105@hq.idt.net> I've been using ODBC on Linux connecting to Oracle without problems: Erlang (BEAM) emulator version 5.4.3 [source] [hipe] [threads:0] Eshell V5.4.3 (abort with ^G) 1> application:start(odbc). ok 2> {ok, P} = odbc:connect("DSN=RouteDEV;UID=ROUTE", []). {ok,<0.37.0>} 3> odbc:sql_query(P, "select count(*) from dba_users"). {selected,["COUNT(*)"],[[49.0000]]} 4> os:type(). {unix,linux} 5> odbc:sql_query(P, "select * from dba_users"). {selected,["USERNAME", "USER_ID", "PASSWORD", "ACCOUNT_STATUS", "LOCK_DATE", "EXPIRY_DATE", "DEFAULT_TABLESPACE", "TEMPORARY_TABLESPACE", "CREATED", "PROFILE", "INITIAL_RSRC_CONSUMER_GROUP", "EXTERNAL_NAME"], [...]|...]} I am using: UnixODBC version 2.2.3 Easysoft's Oracle driver 1.1.0.0 Though, I've never tried to connect to PostgreSQL. Regards, Serge Tiago Rodrigues Antao wrote: > Hi! > > I am trying to use the ODBC facility of Erlang. I have noticed from the code > that its only supposed to work on Windows and Solaris (I am working on > Linux). I changed the build script and compiled odbcserver. > I was able to start it from within Erlang and to connect to a PostgreSQL > server, but when I try to do an SQL query the server crashes. > > Does anyone tried to use odbcserver on Linux? With any luck? > > Thanks a lot for any help, > Tiago From geoffw@REDACTED Tue Feb 8 20:56:27 2005 From: geoffw@REDACTED (Geoff White) Date: Tue, 08 Feb 2005 11:56:27 -0800 Subject: Erlang on "Cell" Architectures Message-ID: <4209196B.3040903@cybertribe.com> http://www.blachford.info/computer/Cells/Cell0.html Have any Erlangers out there evaluated or mused on the implications of Erlang on such an architecture? If so can you (are you allowed) to talk about it? IT seems like an architecture that is just ripe for Erlang (or a derivative language). From jabba@REDACTED Tue Feb 8 23:02:50 2005 From: jabba@REDACTED (Jani Launonen) Date: Wed, 9 Feb 2005 00:02:50 +0200 (EET) Subject: Erlang on "Cell" Architectures In-Reply-To: <4209196B.3040903@cybertribe.com> References: <4209196B.3040903@cybertribe.com> Message-ID: On Tue, 8 Feb 2005, Geoff White wrote: > http://www.blachford.info/computer/Cells/Cell0.html > > Have any Erlangers out there evaluated or mused on the implications of Erlang > on such an architecture? If so can you (are you allowed) to talk about it? > IT seems like an architecture that is just ripe for Erlang (or a derivative > language). Well, Cell seems to have a PowerPC core in it and the EVM runs on PPC. The memory architechture might require some tinkering, I'd guess. Perhaps the PPC core isn't that different from application perspective than usual PPC processors. The 8 vector processors might be different matter. I doubt if Erlang EVM could run on one of those (does they have suitable instruction set for general purpose computing?) --- certainly capability to process 4 x 32-bit floating point numbers isn't something that average Erlang application could exploit. I have just scanned through some Cell articles, so I might be missing some important points. The idea having an Erlang prosess per SPE (or APU) is a nice pipe dream, though :) However --- I've several years thought that VLIW processor might be quite good for interpreting EVM. I've tinkered about with Philips' TriMedia VLIW multimedia CPU (nowadays known as nexperia: http://www.semiconductors.philips.com/products/nexperia/ ) some years ago and although containing some special instructions and execution units geared to multimedia processing it is general purpose CPU. One thing that I think EVM could exploit in TriMedia is it's ability to calculate 3 branch targets at once. I'm under impression that interpreting is quite branch intensive task. The emulator guys could have different opinions, of course. They should know. I wonder if I still have access to TriMedia cycle accurate simulator in university's computers and how difficult EVM is to port... just a thought job. If you're interested, you could check slideshow about Erlang processor at http://www.erlang.se/euc/00/processor.ppt Unfortunately no news have been heard about Erlang processor's status for couple of years... :( If the Erlang processor model could be open sourced... :) Cheers, -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From ok@REDACTED Wed Feb 9 02:52:02 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 9 Feb 2005 14:52:02 +1300 (NZDT) Subject: Proposed change to libraries Message-ID: <200502090152.j191q2iU300355@atlas.otago.ac.nz> I proposed > > is_applicable(F, N) > > - succeeds or returns true when N is a non-negative integer > > and F is such that F(T1,...,TN) would make sense > > - fails or returns false otherwise > > is_applicable(F) > > - succeeds or returns true when there exists an N such that > > is_applicable(F, N) would succeed or return true > > - fails or returns false otherwise The words "would make sense" were very carefully chosen. Kostis Sagonas wrote: However, apparently I am missing the obvious, because I do not see how this is easier (though I see that it is more elegant) to implement than what we were essentially discussing yesterday... It isn't easier to IMPLEMENT but easier to USE. Remember the context. Someone else proposed map(F, [H|T]) -> [F(H) | map(F, T)]; map(F, []) when is_function(F) -> []; map({M,F}, []) when is_atom(M), is_atom(F) -> []. This is problematic in two ways. First, when the argument *is* a function it doesn't check as much as it easily could. (It doesn't check the arity.) Second, the extra clause to check for {M,F} is such a pain to add that it probably won't be done consistently throughout the libraries. is_applicable/[1,2] is meant to address both points: - if there is a required arity, that can be passed and used for a more precise test - it is *MUCH* easier to use than adding an extra clause. The key question is: does "is_applicable({M,F}, 1)" always check that the M:F/1 is a valid fun (and succeeds accordingly) or not? "would make sense" is not the same as "is currently defined". Like other guards, is_applicable/[1,2] is meant to be a *time-independent* test which can be checked by *local inspection* of the term in question. Consider this example: m:f(X) -> unload module X. lists:map({m,f}, [m]) At the time the call *starts*, m:f/1 *is* defined. By the time the call reaches [], m:f/1 is *not* defined any longer. If we had the stronger time-dependent non-local check we'd get a run-time error, for a call that actually made sense at the beginning and has in fact completed without any difficulty. Closures don't have that problem. Once a closure of arity 1, always a closure of arity 1. That doesn't actually mean they are safer: lists:map(fun (X) -> m:f(X) end, [m]) It makes sense to think of {m,f} as short-hand for "whichever of fun (X1) -> m:f(X1) end ... fun (X1,...,X99) -> m:f(X1,...,X999) end ... is actually required at the time of call." So it makes sense to treat it has having the same validity as the corresponding fun. (I am assuming the "2" above is just a typo and should read "1" BTW). No, it was a thinko: too much Prolog. It should read "1". From matthias@REDACTED Wed Feb 9 07:37:08 2005 From: matthias@REDACTED (Matthias Lang) Date: Wed, 9 Feb 2005 07:37:08 +0100 Subject: Erlang on "Cell" Architectures In-Reply-To: <4209196B.3040903@cybertribe.com> References: <4209196B.3040903@cybertribe.com> Message-ID: <16905.44948.984469.310181@antilipe.corelatus.se> Geoff White writes: > IT [cell] seems like an architecture that is just ripe for Erlang (or a > derivative language). I have three takes on this: Anecdotal: The work which seems most closely related is something I vaguely recall Dr Fergus O'Brien at RMIT talking about. He was (thinking about?) adapting Erlang for some massively parallel custom (?) machine. I don't know if that was a real machine or something that was going to be built and I never heard about it again. Cynical: So far, Cell is vapour. Before cell, "emotion engine" was going to radically change the world. At some point it was grid computing. Before that it was "blades". Before that, "network computing". Before that, Erlang-on-FPGA/ASIC. Before that, it was 2 and 4 way SMP PCs/servers. And before that, Erlang on massively parallel architectures. And, in the beginning, it was Amiga. ;-) Off-on-a-tangent: When you say "concurrent" in the context of programming languages, most people automatically think "a way to speed up software by exploiting parallel hardware." Often, the expectation is that the software will be parallelised automatically and in a very fine-grain way, e.g. that a loop will be unrolled 'across' multiple CPUs. But the primary benefit of concurrency in Erlang to me is "a simpler way to structure software in a domain where there is a lot of natural concurrency". I.e. I'm not writing concurrent code because I'm chasing a performance win. I'm writing concurrent code because it's simpler and has more desirable characteristics in the event of a fault. I'm not using concurrency because the underlying hardware allows parallel execution (it doesn't). My existing code won't gain anything by being run on today's garden-variety parallel hardware (e.g. 2-way SMP PCs, clusters or blades) on today's Erlang VM. I suspect the same holds for most Erlang software. Matt From erlang@REDACTED Wed Feb 9 08:57:38 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 9 Feb 2005 07:57:38 +0000 Subject: Erlang Processor [was: Erlang on "Cell" Architectures] In-Reply-To: References: <4209196B.3040903@cybertribe.com> Message-ID: <20050209075738.7905939a.erlang@manderp.freeserve.co.uk> Hi Gurus, The last news of the Processor I can find is in late 2001, in a message from Uffe which sounded upbeat. Uffe, what happened since then? Pete. http://www.erlang.org/ml-archive/erlang-questions/200110/msg00083.html On Wed, 9 Feb 2005 00:02:50 +0200 (EET) Jani Launonen wrote: > On Tue, 8 Feb 2005, Geoff White wrote: > [...] > > If you're interested, you could check slideshow about Erlang processor at > http://www.erlang.se/euc/00/processor.ppt Unfortunately no news have been > heard about Erlang processor's status for couple of years... :( > > If the Erlang processor model could be open sourced... :) > -- "The Tao of Programming flows far away and returns on the wind of morning." From thomasl_erlang@REDACTED Wed Feb 9 11:33:08 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 9 Feb 2005 02:33:08 -0800 (PST) Subject: Erlang on "Cell" Architectures In-Reply-To: <4209196B.3040903@cybertribe.com> Message-ID: <20050209103308.51770.qmail@web41908.mail.yahoo.com> --- Geoff White wrote: > Have any Erlangers out there evaluated or mused on > the implications of > Erlang > on such an architecture? If so can you (are you > allowed) to talk about it? > IT seems like an architecture that is just ripe for > Erlang (or a > derivative language). I only know of Cell what I've read in the news, and would say Erlang seems partly suitable. First, each cell CPU has a collection of asynchronous vector units. Programming those in Erlang seems unnecessary. (But hey, who knows?) Coordinating the cell CPUs may be a more suitable task. Cell seems to rely on low-level mechanisms for parallelism, so one might want to build a lightweight, naked metal RTOS implementation of Erlang to take advantage of those. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 From kostis@REDACTED Wed Feb 9 12:09:49 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 9 Feb 2005 12:09:49 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from '"Richard A. O'Keefe" ' dated: Wed, 9 Feb 2005 14:52:02 +1300 (NZDT) Message-ID: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> Let me throw another proposal to this thread. First let me enumerate the things we (all?) agree upon: 1. Something needs to be done in libraries to make them more consistent with their documentation and allow more effective type checking. 2. Tuples-as-funs need to be handled somehow but only for a transitional period (of currently unspecified length ;-). 3. The checks that will be performed for tuples-as-funs cannot be as strong as (at least some of us) would like them to be. 4. Some new built-in guards have to be introduced. If they handle tuples-as-funs, this handling will be taken out when their support is discontinued. 5. It is probably not a good idea to modify the semantics of existing guards (e.g. is_function/1) to also handle tuples-as-funs only to take these modifications away some fine day. So, here is an alternative proposal that satisfies the above constraints and allows us to do more effective type checking. Modify map/2 to look as follows: map({M,F}, L) -> map(fun(X) -> M:F(X) end, L); map(F, [H|T]) -> [F(H) | map(F, T)]; map(F, []) when is_function(F,1) -> []. and then is_function/2 only handles proper fun objects. Besides being much cleaner, I think, it also has the extra advantage that calls to map/2 with a tuple-as-fun also work when compiled in native code (which currently they do not). Then taking out support for tuples-as-funs is just a matter of removing the extra clause -- the semantics of all guards, current or new, remains unchanged. Kostis. From ulf.wiger@REDACTED Wed Feb 9 12:53:40 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 9 Feb 2005 12:53:40 +0100 Subject: Erlang Processor [was: Erlang on "Cell" Architectures] Message-ID: Well, the processor is still Almost Ready(tm). ;-) Not much has been done since then. /Uffe > -----Original Message----- > From: Peter-Henry Mander [mailto:erlang@REDACTED] > Sent: den 9 februari 2005 08:58 > To: erlang-questions@REDACTED > Cc: Ulf Wiger (AL/EAB) > Subject: Erlang Processor [was: Erlang on "Cell" Architectures] > > > Hi Gurus, > > The last news of the Processor I can find is in late 2001, in > a message > from Uffe which sounded upbeat. Uffe, what happened since then? > > Pete. > > http://www.erlang.org/ml-archive/erlang-questions/200110/msg00083.html From bjorn@REDACTED Wed Feb 9 14:55:12 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 09 Feb 2005 14:55:12 +0100 Subject: Proposed change to libraries In-Reply-To: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> References: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> Message-ID: Kostis Sagonas writes: [...] > > map({M,F}, L) -> map(fun(X) -> M:F(X) end, L); > map(F, [H|T]) -> [F(H) | map(F, T)]; > map(F, []) when is_function(F,1) -> []. > > and then is_function/2 only handles proper fun objects. Besides being > much cleaner, I think, it also has the extra advantage that calls to > map/2 with a tuple-as-fun also work when compiled in native code (which > currently they do not). Then taking out support for tuples-as-funs is > just a matter of removing the extra clause -- the semantics of all guards, > current or new, remains unchanged. OK. Sounds good. I can add the guard BIF is_function/2 to R10B-4. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Wed Feb 9 16:26:40 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 09 Feb 2005 16:26:40 +0100 Subject: online documentation for r10b Message-ID: <420A2BB0.8070500@ericsson.com> greetings, i have previously asked for clearification of some snmp user guide pages (or asked if i should file a bug report :-). no answer. here i go again. this time i wonder if the manual page for the mnesia module is correct when it says: ''dirty_delete_object(Tab, Record) This is the dirty equivalent of the mnesia:delete_object/3 function.'' i can not find delete_object/3. secondly, most of the dirty_*() functions has a return specification like: dirty_read(Tab, Key) -> ValueList | exit({aborted, Reason} since dirty_read/2 is not supposed to be used in a transaction i wonder if ''aborted'' is correct? bengt From bengt.kleberg@REDACTED Wed Feb 9 16:51:32 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 09 Feb 2005 16:51:32 +0100 Subject: online documentation for r10b In-Reply-To: References: <420A2BB0.8070500@ericsson.com> Message-ID: <420A3184.6070602@ericsson.com> Hakan Mattsson wrote: ...deleted > BK> > BK> i can not find delete_object/3. > > Where did you look? in the wrong place. i found it this time. thank you. bengt From hakan@REDACTED Wed Feb 9 16:41:45 2005 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 9 Feb 2005 16:41:45 +0100 (CET) Subject: online documentation for r10b In-Reply-To: <420A2BB0.8070500@ericsson.com> References: <420A2BB0.8070500@ericsson.com> Message-ID: On Wed, 9 Feb 2005, Bengt Kleberg wrote: BK> here i go again. this time i wonder if the manual page for the mnesia module BK> is correct when it says: BK> BK> ''dirty_delete_object(Tab, Record) Yes. BK> BK> This is the dirty equivalent of the mnesia:delete_object/3 function.'' BK> BK> i can not find delete_object/3. Where did you look? Try "erl -man mnesia" and search for delete_object. The description of delete_object/3 is located between delete_object/1 and delete_schema/1. BK> secondly, most of the dirty_*() functions has a return specification like: BK> BK> dirty_read(Tab, Key) -> ValueList | exit({aborted, Reason} BK> BK> since dirty_read/2 is not supposed to be used in a transaction i wonder if BK> ''aborted'' is correct? Yes. /H?kan From bfulg@REDACTED Wed Feb 9 20:08:26 2005 From: bfulg@REDACTED (Brent Fulgham) Date: Wed, 9 Feb 2005 11:08:26 -0800 (PST) Subject: Line Buffering in Erlang In-Reply-To: <20050209103308.51770.qmail@web41908.mail.yahoo.com> Message-ID: <20050209190826.65154.qmail@web81207.mail.yahoo.com> As an exercise in learning the Carbon API, I've written a console utility for Mac OS X that attempts to mimic the win32 graphical console. In debugging my GUI shell, I'm finding that certain short commands (e.g., just hitting the 'enter' key) does not cause the Erl process to respond as it does at the console -- for example, each time I hit enter on the console I get a new prompt: # erl 1> 1> 1> 1> 1 + 1. 2 2> I'm trying to figure out if stdio is being buffered by default. Does anyone know if the standard erl shell program uses buffering by default? Attempts to recompile with the linebuffering directive doesn't seem to make a difference. Thanks, -Brent From domi@REDACTED Wed Feb 9 21:37:09 2005 From: domi@REDACTED (Dominique de Waleffe) Date: Wed, 09 Feb 2005 21:37:09 +0100 Subject: Erlang on "Cell" Architectures In-Reply-To: <20050209103308.51770.qmail@web41908.mail.yahoo.com> References: <20050209103308.51770.qmail@web41908.mail.yahoo.com> Message-ID: <420A7475.5060900@dewaleffe.org> I have also been thinking that Erlang might be a very nice language to do the high level coordination. We would still need to invent the algorithms that work well on such a parallel/distributed architecture. > Thomas Lindgren wrote: > I only know of Cell what I've read in the news, and > would say Erlang seems partly suitable. I agree. > > First, each cell CPU has a collection of asynchronous > vector units. Programming those in Erlang seems > unnecessary. (But hey, who knows?) But then how would you program those? Assembly? When more documentation is available (*) it may be possible to devise a ?simple? DSL which can be easily transformed into instructions for those units. > Coordinating the cell CPUs may be a more suitable > task. Cell seems to rely on low-level mechanisms for > parallelism, so one might want to build a lightweight, > naked metal RTOS implementation of Erlang to take > advantage of those. Could it be possible to devise a way of sending RPC like messages (implemented via a some low level driver) to the cells that would execute the provided code, along with the provided data? Erlang would just be run on the main CPU, most surely compile the DSL for small bits of code into executable representation and coordinate the algorithms at the high level. That would be a fun project to do such a thing.... D. (*) if anyone knows about pointers to more literature on the cell, I'm interested... -- Dominique de Waleffe E-mail: ddw@REDACTED, domi@REDACTED IM-ICQ: 271788942 IM-MSN: domi@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3174 bytes Desc: S/MIME Cryptographic Signature URL: From carsten@REDACTED Wed Feb 9 22:44:02 2005 From: carsten@REDACTED (Carsten Schultz) Date: Wed, 9 Feb 2005 22:44:02 +0100 Subject: Proposed change to libraries In-Reply-To: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> References: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> Message-ID: <20050209214401.GB4867@penne.localnet> On Wed, Feb 09, 2005 at 12:09:49PM +0100, Kostis Sagonas wrote: > > map({M,F}, L) -> map(fun(X) -> M:F(X) end, L); > map(F, [H|T]) -> [F(H) | map(F, T)]; > map(F, []) when is_function(F,1) -> []. > How clever is the compiler? Will it be necessary to write map({M,F}, L) -> map_(fun(X) -> M:F(X) end, L); map(F, L) when is_function(F, 1) -> map_(F, L). map_(F, [H|T]) -> [F(H) | map_(F, T)]; map_(F, []) -> []. (possibly with additional guards in map_/2, if that makes the compiler/an analyzer happier) to avoid a performance penalty? Regards, Carsten -- Carsten Schultz (2:38, 33:47) http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From kostis@REDACTED Wed Feb 9 22:56:11 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 9 Feb 2005 22:56:11 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from 'Carsten Schultz ' dated: Wed, 9 Feb 2005 22:44:02 +0100 Message-ID: <200502092156.j19LuBvi028447@spikklubban.it.uu.se> Carsten Schultz wrote: > On Wed, Feb 09, 2005 at 12:09:49PM +0100, Kostis Sagonas wrote: > > > > map({M,F}, L) -> map(fun(X) -> M:F(X) end, L); > > map(F, [H|T]) -> [F(H) | map(F, T)]; > > map(F, []) when is_function(F,1) -> []. > > > > How clever is the compiler? Will it be necessary to write > > map({M,F}, L) -> map_(fun(X) -> M:F(X) end, L); > map(F, L) when is_function(F, 1) -> map_(F, L). > > map_(F, [H|T]) -> [F(H) | map_(F, T)]; > map_(F, []) -> []. > > (possibly with additional guards in map_/2, if that makes the > compiler/an analyzer happier) to avoid a performance penalty? Ever since I wrote my mail, I've been wondering whether someone would notice this -- very good that someone actually did! Indeed, to be sure, one has to write the program as written by Carsten above (currently, the Erlang compiler is not so clever to do it automatically, but we might work on this ;-) So this is how the library has to be modified. However, the good news is that the new type analysis that we are currently implementing does not need any extra guards in map_/2 to infer proper types. Kostis. From ok@REDACTED Thu Feb 10 00:18:13 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 10 Feb 2005 12:18:13 +1300 (NZDT) Subject: Erlang on "Cell" Architectures Message-ID: <200502092318.j19NID4J309372@atlas.otago.ac.nz> Matthias Lang wrote: Anecdotal: The work which seems most closely related is something I vaguely recall Dr Fergus O'Brien at RMIT talking about. He was (thinking about?) adapting Erlang for some massively parallel custom (?) machine. I don't know if that was a real machine or something that was going to be built and I never heard about it again. This was the Magnus project. I have some documentation about Magnus, which I don't think I'm allowed to quote. To be honest, I don't know how far anyone got in building an actual Magnus machine. But it was to be based around an interconnect that was certainly real and interesting. And the EC compiler was intended to be the Erlang compiler for Magnus, as well as for conventional UNIX systems. Ah, found something of Lawrie Brown's on the web I can quote: Magnus * a massively scaleable computing platform * separate parallel activities * message passing * non-blocking interconnect * implementation to use * DMA @ bus speed across switch * WDM passive optical switch * Erlang Lawrie Brown and Maurice Castro should know a lot about this. I've heard a few rumours; let's just say the problems RMIT ran into were financial and political rather than technical. Off-on-a-tangent: When you say "concurrent" in the context of programming languages, most people automatically think "a way to speed up software by exploiting parallel hardware." Often, the expectation is that the software will be parallelised automatically and in a very fine-grain way, e.g. that a loop will be unrolled 'across' multiple CPUs. Let's not forget that first and foremost, Cell is a *GAME* engine. It's meant for things like MPEG decoding, real-time ray tracing (maybe?), for the kinds of things the GPUs are good at. We're talking about fairly regular array or stream crunching here. It's more general than that, though. It has "Cray-style vector processor brought up to date" written all over it. People in the High Performance Fortran community have decades of experience building compilers for hardware not unlike this and writing applications to exploit it. My preferred programming language for taking advantage of a Cell would probably be ZPL, I just hope someone does a ZPL port. But the primary benefit of concurrency in Erlang to me is "a simpler way to structure software in a domain where there is a lot of natural concurrency". Right. An APU in a Cell is basically a SIMD machine. And Erlang is a MIMD language. Erlang on a Cell would get little direct benefit from the APUs. My existing code won't gain anything by being run on today's garden-variety parallel hardware (e.g. 2-way SMP PCs, clusters or blades) on today's Erlang VM. I suspect the same holds for most Erlang software. Don't overlook the possibility that the vector processing units could be useful for accelerating data base operations. There ought to be _some_ way to speed up ETS and parts of DETS using the APUs. Then there is the potential of doing compression and/or encryption in APUs at the same time as routing decisions are made on the PU. From ok@REDACTED Thu Feb 10 00:49:53 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 10 Feb 2005 12:49:53 +1300 (NZDT) Subject: Proposed change to libraries Message-ID: <200502092349.j19NnraA309773@atlas.otago.ac.nz> Kostis Sagonas wrote: First let me enumerate the things we (all?) agree upon: 1. Something needs to be done in libraries to make them more consistent with their documentation and allow more effective type checking. I disagree, in the sense that it is not *JUST* the libraries that come with Erlang/OTP. What I would like is something *easy* that people can do to their *own* code to make it better fit the intended types. The important difference here is that one's view of the scope of the problem affects one's judgement about how much extra effort it is tolerable to impose. If you think it is _just_ the libraries, and the libraries are "owned" by a small disciplined group of people, then even something fairly heavyweight could be tolerated and we could have confidence that the job would be completed. If, with me, you think that we *all* write code that would benefit from better checking, you want a solution that is very very easy to apply. Also, we need a new edition of the Erlang book and the style guides which explain the new recommended style. If the new style is not to drive people away in fits of contemptuous laughter, it again has to be a solution that is very very easy to apply. (Like Common Lisp adding ENDP so that you can "fix" a list iteration simply by changing (NULL x) to (ENDP x).) 2. Tuples-as-funs need to be handled somehow but only for a transitional period (of currently unspecified length ;-). If we agree on that, then there should be NOTHING in the code which explicitly tests for {M,F} tuples. 3. The checks that will be performed for tuples-as-funs cannot be as strong as (at least some of us) would like them to be. 4. Some new built-in guards have to be introduced. If they handle tuples-as-funs, this handling will be taken out when their support is discontinued. 5. It is probably not a good idea to modify the semantics of existing guards (e.g. is_function/1) to also handle tuples-as-funs only to take these modifications away some fine day. Agreed on those. So, here is an alternative proposal that satisfies the above constraints and allows us to do more effective type checking. Modify map/2 to look as follows: map({M,F}, L) -> map(fun(X) -> M:F(X) end, L); map(F, [H|T]) -> [F(H) | map(F, T)]; map(F, []) when is_function(F,1) -> []. Presumably this is a mistake for map({M,F}, L) when atom(M), atom(F) -> map1(fun(X) -> M:F(X) end, L); map(F, L) -> map1(F, L). map1(F, [H|T]) -> [F(H) | map1(F, T)]; map1(F, []) when is_function(F, 1) -> []. But that does NOT satisfy the above constraints. Not only does it not satisfy constraint 2, it jumps up and down on it and then spits on the bleeding corpse. It does exactly the same thing to my modified constraint 1: the solution must be very easy to apply. A solution which requires splitting existing functions into two and adding at least two more clauses is a heavyweight solution. The OTP team may be disciplined enough to do this, but most other people will say "I've been managing without type checking up to now, this is a huge amount of boring and error prone work that gives _me_ very little immediate benefit." The proposed change to library functions is (1) heavyweight. One function turns into two. Two new clauses are added. (More if there's more than one function argument.) (2) error prone. It's far too easy to write map (or map1) instead of map1 (or map). It's FAR too easy to forget to change _all_ the existing recursive calls to map. (3) a huge roadblock in the way of removing support for {M,F} pairs; every single function that has been modified in this style is another member of the resistance fighting against such a change. Remove it from the libraries, and it will still be there in some user code. (4) a *double* cost. All such functions have two be modified on two occasions. Now, in order to add the is_function/2 guard without removing support for {M,F} pairs. And later, to remove support for {M,F} pairs. Every single higher order function. Change to every line of every such function. On two separate occasions. Now if we adopt is_applicable/[1,2], we find (1) the change is lightweight; a guard is _added_ to base case clauses of higher-order functions but it's only a matter of inserting text, not altering any single text. No functions are split, no clauses added. (2) Not particularly error prone. The most likely error is forgetting to make the change. (3) A positive help when support for {M,F} pairs is removed. Just change is_applicable/[1,2] to be the same as is_function/[1,2] and that *one* alteration makes the change *everywhere*. (4) A *single* cost. The code is changed once. If it is decided to replace is_applicable/[1,2] by is_function/[1,2], that can be automated, but there really isn't any need to do that. and then is_function/2 only handles proper fun objects. Besides being much cleaner, I think, it also has the extra advantage that calls to map/2 with a tuple-as-fun also work when compiled in native code (which currently they do not). Ah. So this is really all about patching the source code to work around a bug in the compiler! Then taking out support for tuples-as-funs is just a matter of removing the extra clause -- the semantics of all guards, current or new, remains unchanged. Replacing one guard (is_applicable/2) by another (is_function/2) is easy to automate reliably. Removing the extra clauses is _not_ so easy to automate reliably. From laura@REDACTED Thu Feb 10 09:22:34 2005 From: laura@REDACTED (Laura M. Castro) Date: Thu, 10 Feb 2005 09:22:34 +0100 Subject: Status of ODBC In-Reply-To: <200502072210.02267.tra@fct.unl.pt> References: <200502072210.02267.tra@fct.unl.pt> Message-ID: <420B19CA.8090201@alfa21.com> Tiago Rodrigues Antao wrote: > Hi! > > I am trying to use the ODBC facility of Erlang. I have noticed from the code > that its only supposed to work on Windows and Solaris (I am working on > Linux). I changed the build script and compiled odbcserver. > I was able to start it from within Erlang and to connect to a PostgreSQL > server, but when I try to do an SQL query the server crashes. > > Does anyone tried to use odbcserver on Linux? With any luck? > > Thanks a lot for any help, > Tiago Hello Tiago, We're using Erlang ODBC facility, and it works indeed, but it requires a little bit of your patience ;-). Our particular scenario at the moment is the following: * Debian GNU/Linux O.S. * Erlang RC9-2 (*not* debian package) * UnixODBC 2.2.4-11 (debian package) * PostgreSQL 7.4.6-6 (debian package) In order to get the ODBC 2.0 erlang module compiled you may read this message: http://www.erlang.org/ml-archive/erlang-questions/200405/msg00288.html Regards, Laura Castro From thomasl_erlang@REDACTED Thu Feb 10 11:03:46 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 10 Feb 2005 02:03:46 -0800 (PST) Subject: Erlang on "Cell" Architectures In-Reply-To: <420A7475.5060900@dewaleffe.org> Message-ID: <20050210100346.80664.qmail@web41907.mail.yahoo.com> --- Dominique de Waleffe wrote: > But then how would you program those? Assembly? > When more documentation is available (*) it may be > possible to devise a > ?simple? DSL which can be easily transformed into > instructions for those > units. If we take the PS2 vector units as inspiration, then assembly or a DSL seems just about right for programming those. Erlang is not a very good fit :-) > Could it be possible to devise a way of sending RPC > like messages > (implemented via a some low level driver) to the > cells that would > execute the provided code, along with the provided > data? That would (probably) be where I would start. There are multiple levels: distributed Erlang between "main" processors, some nice way of feeding APUlets to the vector units, and/or some way of controlling the DMA unit. Another option, which I considered for some time for my dear old PS2, was to write a domain-specific language for the whole thing. In my case, an Erlang-inspired one, natch :-) Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 From bjorn@REDACTED Thu Feb 10 11:43:59 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 10 Feb 2005 11:43:59 +0100 Subject: Erlang/OTP-3 has been released Message-ID: Bug fix release : otp_src_R10B-3 Build from snapshot : 2005-02-10 This is a bug fix release 3 for the R10B release. You can download the full source distribution from http://www.erlang.org/download/otp_src_R10B-3.tar.gz http://www.erlang.org/download/otp_src_R10B-3.readme Note: To unpack the TAR archive you need a GNU TAR compatible program. For instance, on MacOS X you need to use the 'gnutar' command; you can't use the 'tar' command or StuffIt to unpack the sources. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R10B-3.exe The documentation at http://www.erlang.org will be updated. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R10B-3.tar.gz http://www.erlang.org/download/otp_doc_man_R10B-3.tar.gz For some OTP applications there are more detailed release notes in the HTML documentation. We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team --- otp -------------------------------------------------------------- OTP-5346 Linked in drivers in the crypto, and asn1 applications are now compiled with the -D_THREAD_SAFE and -D_REENTRANT switches on unix when the emulator has thread support enabled. Linked in drivers on MacOSX are not compiled with the undocumented -lbundle1.o switch anymore. Thanks to Sean Hinde who sent us a patch. The linked in driver in crypto, and the port program in ssl, now compile on OSF1. Minor Makefile improvements in runtime_tools. --- erts ------------------------------------------------------------- OTP-5234 Minor update of the internal documentation of the epmd protocol. The listen port of epmd has now been registered at IANA: http://www.iana.org/assignments/port-numbers OTP-5297 The function erlang:float/1 can now be used in match specifications and is recognized by dbg:fun2ms/1 and ets:fun2ms/1. This addition is part of the work to "harmonize" match specification guards with Erlang guards. OTP-5324 The register/2 BIF would return 'true' even if the second argument was not a pid for living process. Corrected to cause an exception. OTP-5340 In the 'bag' type of ets tables, elements having the same key were supposed to be ordered in insertion order. That was not the if a rehash occurred. OTP-5361 Fixed a bug in the hybrid heap in distributed send operations. OTP-5376 A BIF erlang:raise/3 has been added. See the manual for details. It is intended for internal system programming only and advanced error handling. OTP-5384 run_erl.c now works on Mac OS X and FreeBSD. OTP-5386 Mikael Pettersson (HiPE) corrected a few bugs in the emulator that caused problems when compiled with the experimental gcc-4.0.0. --- kernel ----------------------------------------------------------- OTP-5363 The application master for an application now terminates the application faster, which reduces the risk for timeouts in other parts of the system OTP-5376 A BIF erlang:raise/3 has been added. See the manual for details. It is intended for internal system programming only and advanced error handling. --- stdlib ----------------------------------------------------------- OTP-5276 The deprecated attribute is now checked by the linter. See xref(3) for a description of the deprecated attribute. OTP-5327 Several bugs in the Erlang shell have been fixed. OTP-5329 Some dead code reported by Dialyzer was eliminated. OTP-5335 The restricted shell will now indicate if the return value from a user predicate is on an incorrect form. OTP-5338 The linter could output invalid warnings about bit patterns in record initializations. This problem has been fixed. OTP-5341 ordsets:is_set(NoList), where NoList is any term except a list, would crash. For consistency with sets:is_set/1 and gb_sets:is_set/1, it now returns 'false'. --- compiler --------------------------------------------------------- OTP-5342 Given bit syntax construction in certain complex contexts involving a catch, the compiler would either crash or terminate due to failure in an internal consistency check. (Thanks to Fredrik Thulin.) Matches such as '<<103133:64/float>> = <<103133:64/float>>' used to fail. Now they succeed. Shadowing of variables in bit syntax matches in fun heads such as in 'L = 8, F = fun(<>) -> B end' was handled incorrectly by the compiler. The fun used to be compiled as if it was written 'fun(<<8:8,B:8>>)', while it should be compiled in the same way as 'fun(<>)'. A bug in the validation pass has been corrected. It sometimes occurred when the compiler optimized by reusing code for causing an exception when the reused code was called from within catch or try-catch statements. Then the validator refused to approve the code and complained about unknown_catch_try_state. Corrected a bug in the optimizer that would cause the compiler to crash. (Thanks to Peter-Henry Mander.) There a now warnings generated if a bit syntax construction will fail at run-time because of a type mismatch (e.g. <>). OTP-5371 Binary pattern mattern such as 't(<> = <)' used to silently fail at runtime (i.e. never match). The compiler now generates an error for any such patterns. --- parsetools ------------------------------------------------------- OTP-5369 A bug in the file parsetools/include/yeccpre.hrl caused yecc:parse_and_scan/1 to always report a parse failure when the lexer reported end-of-file. This problem has been fixed. --- hipe ------------------------------------------------------------- OTP-5385 A few bugs were corrected in the hipe application. --- runtime_tools ---------------------------------------------------- OTP-5329 A bug in 'dbg' when tracing to wrap trace files has been corrected. It failed to delete any already existing wrap trace files with the same names when starting a new wrap trace. (The bug was found by Dialyzer.) --- tools ------------------------------------------------------------ OTP-5071 The Xref analysis 'locals_not_used' could return too many functions. This problem has been fixed. OTP-5305 The cover tool could not always compile parse transformed modules. This problem has been fixed. --- sasl ------------------------------------------------------------- OTP-5287 A bug that made it impossible to call rb:show(N) (N being an integer) twice without getting an error has been fixed. --- gs, tv, appmon, debugger, pman, toolbar -------------------------- OTP-5381 The graphic applications now search for HTML documentation in the correct place. --- inets ------------------------------------------------------------ OTP-5188 The inets supervision tree has been reorganized to create a better balance between the inets services. Preferably they should not effect each other. The ftp service has also been included in the inets supervision tree, it was for reasons unknown, not included before. OTP-5189 The service concept in inets is now better documented. OTP-5249 The URI check that disables relative links that goes outside the server-root still missed a few cases, in spite of the improvement in OTP-5140. OTP-5261 The inets shutdown times have proven to be too short under some circumstances, as a heavy load, therefore they have been prolonged. OTP-5303 The http client pipelining implementation has been rewritten as the old implementation was too optimistic about when to pipeline. In the process of doing this also the error handling was improved, better clean up is performed when the request handling process terminates and better handling of the case that the httpc_manager process dies and is restarted. OTP-5304 Options for automatic redirection and pipelining is now available in the http client API. OTP-5309 Improved handling of status codes 30X and 50X. Fixed Bugs and Malfunctions: OTP-5368 When sending a request through a proxy the absolute URI must be used. Improvements and New Features: OTP-5331 Basic support for cookies was implemented. Later some more functions to inspect cookies may be added. OTP-5379 A top tftp supervisor was added in preparation for adding a tftp service in a future inets release. --- megaco ------------------------------------------------------------ OTP-5296 The error counter medGwyGatewayNumErrors not working. This counter is incremented by the megaco application when decode of a message fails. Due to the construction of the decoders, nothing beyond the error reason (in the text case, basically an unintelligible list of tokens) is returned. E.g. not the Mid needed to be able to deduce which MG (conn-handle), this message came from. This resulted in an increment of the "global" medGwyGatewayNumErrors counter instead of the connection specific. This has been fixed. In the text case by adding a mini decoder, that basically only decodes the message as far as the Mid (if the error is in or before the Mid, then this decoder also fails). OTP-5310 When the megaco:cancel/2 function is called, the megaco application is supposed to perform a cleanup. E.g. remove aut-dated request and reply records. For the reply-records this did not work, since it only removed those record which had the state field set to wait_for_ack, and not aborted! If the state had been set to aborted and not yet been removed (which normally happens when the reply_timer times out) when the disconnect and cancel functions where called, those records would never be removed. This means that if eventually a transaction was received which had the same transaction-id as the aborted reply, this whould just be ignored! OTP-5312 Incorrect definition of hexdig in the flex-scanner. OTP-5313 Various cleanup of the v2 text parser: 1) Removed unused Nonterminal and rule digitMapName. 2) Removed superflous transactionRequest rule's. (this was probably a leftover from RFC2885) Improvements and new features: OTP-5204 Implementation of the Megaco v2 corrigendum 1 (03/2004). This means in short: - The ModemDescriptor has been deprecated. If this descriptor is found in a received message it will be ignored (removed from the message). If an attempt is made to encode a message containing a ModemDescriptor, an error will be returned. If in the binary codec case, encoding-config contains native, then the ModemDescriptor will however be included in the message when encoding and also decoded. This means that it in this case it is up the user to never include the ModemDescriptor in a transmitted message and to ignore it, if received. - Addition of the EmergencyOffToken, which is used in the contextProperty. OTP-5220 Added receiving pending limit config property. This is the limit for the number of pending messages that is accepted before a request is considered "a lost cause". OTP-5236 Added support for preliminary version 3. Based on TD-33. See chapter Handling megaco versions on how to configure and use the preliminary version 3 (prev3a). OTP-5351 Added configure thread support. Fixed bugs and malfunctions: OTP-5352 When text encoding the ServiceChangeParm in v2, the serviceChangeInfo field was ignored. OTP-5353 When text parsing serviceChangeParm in v2, all of auditItem was put into the auditToken field of the AuditDescriptor (the serviceChangeInfo field of the ServiceChangeParm record). The indAudterminationAudit should go into the auditPropertyToken field. Incompatibilities: OTP-5220 The config property orig_pending_limit has been renamed to sent_pending_limit. --- mnesia ------------------------------------------------------------ Fixed Bugs and Malfunctions: OTP-5289 Reading bad backup files failed completly, now it just ignores the bad parts. OTP-5300 Disk tables could be loaded in wrong order at startup, changes made when a node was down could be missed. OTP-5328 A call to mnesia:add_table_copy could hang if the node which the table was copied from crashed. OTP-5358 Mnesia could crash during the start phase if a mnesia table was deleted by another node. Improvements and New Features: OTP-5347 Introduced a new env parameter pid_sort_order which should be set to r9b_plain on non unpatched R9B systems to be able to use mnesia on mixed systems with unpatched R9B nodes. This is a workaround for a specific upgrade problem when mixing certain emulators versions so it should not be used unless needed. --- snmp ------------------------------------------------------------ Improvements and new features: OTP-5286 [manager] Added possibility to monitor a registered user. See snmpm:register_user_monitor. OTP-5298 [agent] Improved symbolic store. Alias and Oids where stored with similar key's (seperated by types: atom() and lists() respectively). Also added new function: snmpa:which_aliasnames. OTP-5308 [agent] The agent local_db volatile storage method uses an ets-table which is private. This table has been made protected in order to make it easier to bedug and test the snmp agent. Reported Fixed Bugs and Malfunctions: OTP-5273 Misspelled deprecated function. Non-existent function snmp:is_constistent/1 was marked as depricated. Should have been snmp:is_consistent/1). OTP-5281 [agent] Unclear documentation for function snmpa:send_notification. The Recv argument (specifically the {M,F,A} variant). OTP-5299 [manager] It was never documented how the default user behaviour could be overriden (default user is the module snmpm_user_default). See application configuration or configuration params. OTP-5306 [manager] The server process contained a bug that caused it to crash, if it received an exit message from it's gct (GC timer) process and it's verbosity was log or higher. This also effects the application dowgrade. OTP-5307 [agent] The agent config file, target_addr.conf, was incorrectly described in the Target Address Definitions chapter of the User's Guide. The EngineId option was left out. OTP-5314 [manager] When a InformRequest is received, the manager sends a response message. This did not include the varbinds of the original message. See RFC 3416, chapter 4.2.7. OTP-5315 [manager] Erroneous function guards made it possible to update some agent info (that should be "static"). OTP-5364 [manager] Manager synchronous get-function with timeout erroneous. Results in a function clause. OTP-5365 Replace in decoder fun's of the "old style" fun format, {atom(), atom()}, with a proper fun, e.g. "fun the_function/1". OTP-5367 [manager] Register agent using the config file agents.conf failed due to incorrect function guard. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mats.cronqvist@REDACTED Thu Feb 10 12:33:51 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Thu, 10 Feb 2005 12:33:51 +0100 Subject: erlang-mode; $-bug In-Reply-To: References: <4209196B.3040903@cybertribe.com> Message-ID: <420B469F.3000503@ericsson.com> hello, erlang-mode doesn't do paren-matching correctly if there is a $-paren in a string); "{x=${abc}}" %% these parens don't match, according to erlang-mode problem is that ${ is seen as a char (which is right for erlang code); {${} %% these parens do match i think that behavior is wrong inside a string. anyone have a fix? mats From Zoltan.Peter.Toth@REDACTED Thu Feb 10 12:56:56 2005 From: Zoltan.Peter.Toth@REDACTED (Zoltan Peter Toth) Date: Thu, 10 Feb 2005 12:56:56 +0100 Subject: [Fwd: RE: BIFs vs. reductions] Message-ID: <420B4C08.6020208@ericsson.com> Hi, I post Erik's reply as it didn't seem to reach the list. Meanwhile I took a look at other BIFs, like ets:lookup/2 which seems to count as cca. 60 reductions, and length that is cca. 30, (28) _independently_ of the lists's actual length. Considering that processes are rescheduled after executing 1000 reductions (is it still so ?), does this mean that a process using some BIFs on very long lists can get much more real CPU time than another using short lists ? /Zoltan -------- Original Message -------- Subject: RE: BIFs vs. reductions Date: Tue, 8 Feb 2005 15:58:35 +0100 From: Erik Stenman To: Zolt?n P?ter T?th (IJ/ETH) CC: erlang-questions@REDACTED > Hi, > > Can someone tell me if BIFs always count as one Erlang reduction ? No, e.g. append counts as 20 no matter the length of the list! (At least it used to.) > (returned from process_info) > Is there an exact definition of what counts as a reduction ? No. Erik From mikael.karlsson@REDACTED Fri Feb 11 09:35:47 2005 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 11 Feb 2005 09:35:47 +0100 Subject: Status of ODBC In-Reply-To: <200502072210.02267.tra@fct.unl.pt> References: <200502072210.02267.tra@fct.unl.pt> Message-ID: <200502110935.47677.mikael.karlsson@creado.com> I was able to use the ODBC driver with MySQL on Linux a couple of OTP versions ago. What I recall was that I had to set the option scrollable_cursors to off when doing a connect for some reason. {scrollable_cursors, off} Regards Mikael m?ndag 07 februari 2005 23:10 skrev Tiago Rodrigues Antao: > Hi! > > I am trying to use the ODBC facility of Erlang. I have noticed from the > code that its only supposed to work on Windows and Solaris (I am working on > Linux). I changed the build script and compiled odbcserver. > I was able to start it from within Erlang and to connect to a PostgreSQL > server, but when I try to do an SQL query the server crashes. > > Does anyone tried to use odbcserver on Linux? With any luck? > > Thanks a lot for any help, > Tiago From tra@REDACTED Fri Feb 11 13:10:06 2005 From: tra@REDACTED (Tiago Rodrigues Antao) Date: Fri, 11 Feb 2005 12:10:06 +0000 Subject: Status of ODBC In-Reply-To: <16904.30731.569344.923938@gargle.gargle.HOWL> References: <200502072210.02267.tra@fct.unl.pt> <16904.30731.569344.923938@gargle.gargle.HOWL> Message-ID: <200502111210.06646.tra@fct.unl.pt> Hi! First I would like to thank everybody that answered. All the infrastructure was set up correctly (odbcserver, etc) I discovered that the problem was my poor Erlang knowledge, I was doing: Ref = odbc:connect("DSN=PostgreSQL;UID=XXX;PWD=XXX",[{scrollable_cursors, off}]). odbc:sql_query(Ref,"select * from t1"). The "Ref =" should have been "{ok, Ref} =" This was causing odbcserver to shutdown (not a crash, a normal exit). If nobody opposes I would like to document on the wiki my experience in putting ODBC to work on Linux/PostgreSQL (including most of the issues raised by all the people that answered my previous email). BTW, I will be making changes to odbcserver and the odbc module to include support for metadata, if anyone is interested in these changes, I will be more than happy to share them. Em Ter?a, 8 de Fevereiro de 2005 08:27, o Ingela Anderton escreveu: > Tiago Rodrigues Antao wrote: > > Hi! > > > > I am trying to use the ODBC facility of Erlang. I have noticed from the > > code that its only supposed to work on Windows and Solaris (I am working > > on Linux). > > It is not only supposed to work for Windows and Solaris. There might > be some unfortunate naming that gave you this idea. But there > is no technical reason why it should not work on Linux. > On the other hand it is currently only tested and commercially > supported for Windows and Solaris. > > > I changed the build script and compiled odbcserver. > > I was able to start it from within Erlang and to connect to a PostgreSQL > > server, but when I try to do an SQL query the server crashes. > > Without the crash report it is hard say anything! Probably it's not > the srollable cursors problem with 2.x drivers as you managed to > connect to the server. > > > Does anyone tried to use odbcserver on Linux? With any luck? > > I think there where some users who did, but I will let them speak for > themselves. From d.love@REDACTED Fri Feb 11 13:13:24 2005 From: d.love@REDACTED (Dave Love) Date: Fri, 11 Feb 2005 12:13:24 +0000 Subject: erlang-mode; $-bug In-Reply-To: <420B469F.3000503@ericsson.com> (Mats Cronqvist's message of "Thu, 10 Feb 2005 12:33:51 +0100") References: <4209196B.3040903@cybertribe.com> <420B469F.3000503@ericsson.com> Message-ID: Mats Cronqvist writes: > hello, > > erlang-mode doesn't do paren-matching correctly if there is a > $-paren in a string); > > "{x=${abc}}" %% these parens don't match, according to erlang-mode The behaviour of `"$"' is worse. > problem is that ${ is seen as a char (which is right for erlang code); > > {${} %% these parens do match Contrast `[$\{]', though. > i think that behavior is wrong inside a string. > > anyone have a fix? > > mats The syntax code of `$' is inappropriate. $ is actually similar to `?' in Emacs Lisp, but Erlang mode makes it `character quote' (shown by C-u C-x e). I'd suggest making it either `symbol' ("_") or perhaps `prefix' ("'") to improve sexp motion. Then to regain your balance you write `$\{' instead of `${'. [The proper way to do it, as documented somewhere, is: (defvar erlang-mode-syntax-table (let ((table (make-syntax-table))) ... (modify-syntax-entry ?$ "'" table) ... table)) and then have `erlang-mode' just do (set-syntax-table erlang-mode-syntax-table) ] From yerl@REDACTED Fri Feb 11 16:35:24 2005 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 11 Feb 2005 15:35:24 +0000 Subject: Status of ODBC Message-ID: Greate idea. It'll be very useful for many of us /yerl ----Message d'origine---- >De: Tiago Rodrigues Antao >A: ingela@REDACTED >Sujet: Re: Status of ODBC >Date: Fri, 11 Feb 2005 12:10:06 +0000 >Copie ?: erlang-questions@REDACTED > >Hi! > >First I would like to thank everybody that answered. > >All the infrastructure was set up correctly (odbcserver, etc) >I discovered that the problem was my poor Erlang knowledge, I was doing: >Ref = odbc:connect("DSN=PostgreSQL;UID=XXX;PWD=XXX",[{scrollable_cursors, >off}]). > >odbc:sql_query(Ref,"select * from t1"). > >The "Ref =" should have been "{ok, Ref} =" > >This was causing odbcserver to shutdown (not a crash, a normal exit). > >If nobody opposes I would like to document on the wiki my experience in >putting ODBC to work on Linux/PostgreSQL (including most of the issues raised >by all the people that answered my previous email). > >BTW, I will be making changes to odbcserver and the odbc module to include >support for metadata, if anyone is interested in these changes, I will be >more than happy to share them. > > > >Em Ter?a, 8 de Fevereiro de 2005 08:27, o Ingela Anderton escreveu: >> Tiago Rodrigues Antao wrote: >> > Hi! >> > >> > I am trying to use the ODBC facility of Erlang. I have noticed from the >> > code that its only supposed to work on Windows and Solaris (I am working >> > on Linux). >> >> It is not only supposed to work for Windows and Solaris. There might >> be some unfortunate naming that gave you this idea. But there >> is no technical reason why it should not work on Linux. >> On the other hand it is currently only tested and commercially >> supported for Windows and Solaris. >> >> > I changed the build script and compiled odbcserver. >> > I was able to start it from within Erlang and to connect to a PostgreSQL >> > server, but when I try to do an SQL query the server crashes. >> >> Without the crash report it is hard say anything! Probably it's not >> the srollable cursors problem with 2.x drivers as you managed to >> connect to the server. >> >> > Does anyone tried to use odbcserver on Linux? With any luck? >> >> I think there where some users who did, but I will let them speak for >> themselves. > > From ulf.wiger@REDACTED Fri Feb 11 15:42:04 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 11 Feb 2005 15:42:04 +0100 Subject: need help debugging otp app Message-ID: In http://www.erlang.org/ml-archive/erlang-questions/200501/msg00036.html, Gary Hodgson asked for help in understanding the following cryptic error message: --> erl -boot ./master -config ./sys -boot_var MYAPPS $DIR -sname n1 Error in process <0.1.0> with exit value: {badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]} {"init terminating in do_boot",{badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]}} init terminating in do_boot () Hopefully, he has found a way around it by now. (: The probable error is that the script contains a boot variable which wasn't set when starting the system. I ran into this problem myself just now. Looking at my own .script file, the following line: {path,["$CCV/ccviewer-R11A01/ebin"]}, introduced the "boot variable" $CCV. This has to be given a value at the erl command line: erl -boot .../ccviewer -config ..../sys -boot_var CCV ...../CCviewer/lib Erlang could be a little bit more helpful explaining what went wrong. Looking at the error message, one might guess that either there's another boot var besides MYAPPS in the script (ROOT is handled automatically), or $DIR is not set correctly Hope this helps. BTW, the bug in init.erl seems to be this: get_var_value(Var,[]) -> exit(list_to_atom(concat(["cannot expand \$", Var, " in bootfile"]))). Var is a binary, so concat/1 fails with badarg. With the attached patch (on OTP R10B-2), my own example now failed with the excellent error message: {"init terminating in do_boot",'cannot expand $CCV in bootfile'} Crash dump was written to: erl_crash.dump init terminating in do_boot (cannot expand $CCV in bootfile) which is much more helpful. Patching init.erl is a bit tricky -- you should go to $ERL_TOP and type 'make', since it is somehow linked into the BEAM runtime. /Uffe <> -------------- next part -------------- A non-text attachment was scrubbed... Name: init.erl.diff Type: application/octet-stream Size: 198 bytes Desc: init.erl.diff URL: From olivier@REDACTED Fri Feb 11 16:14:07 2005 From: olivier@REDACTED (olivier) Date: Fri, 11 Feb 2005 16:14:07 +0100 Subject: Mnesia with a dynamic nodes network Message-ID: <420CCBBF.2030707@dolphian.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I'm reading the Mnesia documentation and as far as i understand one must create the database schema on all the nodes before using it. My question is: how to deal with dynamic nodes ? I'd like to have for example a table replicated on 2 nodes, and at a later time add a third node, so that the table gets replicated on all three. Is that possible ? How would you do that ? Thanks, - -- Olivier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCDMu/pqVXaJzJYNIRAk7tAJ0eYbNZHJ31y8Q19jtjAybHtq3OOwCeKCc1 044sbBDXkKZNAEWcGCsYqN0= =+XF3 -----END PGP SIGNATURE----- From ulf.wiger@REDACTED Fri Feb 11 16:17:17 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 11 Feb 2005 16:17:17 +0100 Subject: consequence of not using risky_shell Message-ID: Not that I want to gripe too much about the change in the shell behaviour -- that it doesn't become available before the boot sequence is finished... (see http://www.erlang.org/ml-archive/erlang-questions/200412/msg00045.html and follow-ups) but the following situation was a bit annoying: =PROGRESS REPORT==== 11-Feb-2005::15:47:21 === application: mnesia started_at: nonode@REDACTED will wait for tables (time: {15,47,21}) User switch command --> l Unknown command --> h c [nn] - connect to job i [nn] - interrupt job k [nn] - kill job j - list all jobs s - start local shell r [node] - start remote shell q - quit erlang ? | h - this message --> s --> c User switch command --> j 1 {shell,start,[]} 2* {shell,start,[]} One application in my boot sequence called mnesia:wait_for_tables(Tabs, infinity). Some table doesn't load for some reason, and since the shell doesn't become available until after the completed boot sequence, I had a hard time debugging it. Eventually, I managed to re-install the system, reproduce the error and use rpc:call(...,mnesia,info,[]) from another erlang node. Using Ctrl-G and spawning a new shell doesn't help; the new shell will also hang. Also, starting a remote shell using Ctrl-G from another node fails in the same fashion. The problem? I had forgotten to call application:load(mnesia) before running my function that created a schema, started mnesia, and created the tables (or rather, the install() function should have done this too). As a result, the environment variable telling mnesia where to create the schema wasn't initialized, and the disc_only tables weren't created. It feels like some debugging aide is missing now that there is no shell prompt during boot. Perhaps one should be allowed to start a shell using Ctrl-G even though the main shell isn't finished? /Uffe From ulf.wiger@REDACTED Fri Feb 11 16:27:35 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 11 Feb 2005 16:27:35 +0100 Subject: Mnesia with a dynamic nodes network Message-ID: Look into the extra_db_nodes environment variable. Using this, you can have a few permanent nodes and let other nodes come and go as 'diskless nodes' (they will create a ram copy of the schema from the master nodes.) You can use the function add_table_copy() to add replicas even on the 'diskless' nodes. The simple way to do it is that e.g. two nodes are permanent, and all other nodes are started with the following in their sys.config: {mnesia, [{extra_db_nodes, [NodeA, NodeB]}]} Then, the dynamic nodes will contact the permanent nodes and get the schema. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of olivier > Sent: den 11 februari 2005 16:14 > To: erlang-questions@REDACTED > Subject: Mnesia with a dynamic nodes network > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Hello, > > I'm reading the Mnesia documentation and as far as i understand > one must create the database schema on all the nodes before using it. > > My question is: how to deal with dynamic nodes ? I'd like to have for > example a table replicated on 2 nodes, and at a later time add a third > node, so that the table gets replicated on all three. > > Is that possible ? How would you do that ? > > Thanks, > > - -- > Olivier > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.5 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFCDMu/pqVXaJzJYNIRAk7tAJ0eYbNZHJ31y8Q19jtjAybHtq3OOwCeKCc1 > 044sbBDXkKZNAEWcGCsYqN0= > =+XF3 > -----END PGP SIGNATURE----- > From kruegger@REDACTED Fri Feb 11 22:54:45 2005 From: kruegger@REDACTED (Stephen Han) Date: Fri, 11 Feb 2005 13:54:45 -0800 Subject: R10-C INETS-4.2 HTTP post method Message-ID: <86f1f535050211135472f05096@mail.gmail.com> Hi. Does anyone ever tried http:request with 'post' method? Since I install R10-C http client 'post' method is not working. There are bunch of message coming out but noteably at the beginning I got following message. > http:request(post, {"http://www.erlang.org", [], "application/xml", []}, [],[]). Of course, the sample URL is not valide but, I expect we should not get those error, either. ** dets: Bug was found when accessing table cookie_db, ** dets: operation was close and reply was {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}. ** exited: {{case_clause,{undefined,{error, {'EXIT', {{badmatch, {error, {badarg, [{erlang, '++', [0,"\r\n"]}, {http_request, key_value_str, 2}, {http_request, '-http_headers/1-fun-0-', 3}, {lists,foldl,3}, {http_request, http_headers|...}, {httpc_request|...}, {httpc_handler|...}, {...}]}}}, [{httpc_manager,start_handler,2}, {httpc_manager,handle_request,2}, {httpc_manager,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}}}}}, [{http,handle_request,5}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** regards, From mfroberg@REDACTED Sat Feb 12 09:08:32 2005 From: mfroberg@REDACTED (=?ISO-8859-1?Q?Magnus_Fr=F6berg?=) Date: Sat, 12 Feb 2005 09:08:32 +0100 Subject: consequence of not using risky_shell In-Reply-To: References: Message-ID: <420DB980.6040506@really.nortelnetworks.com> Hi well I didn't comment on the original "risky_shell" mail discussion but, uhh, removing the old shell behaviour really makes it a hard time debugging bad (maybe hanging) startup sequenses in especially highly distributed environments. I would recommend not making this flag an undocumented feature as it is really needed. Actually, I think the default behaviour should be the old in an interactive system at least. We'll always start our system nodes with this flag enabled! /Magnus Ulf Wiger (AL/EAB) wrote: > Not that I want to gripe too much about the change in the > shell behaviour -- that it doesn't become available before the > boot sequence is finished... > > (see http://www.erlang.org/ml-archive/erlang-questions/200412/msg00045.html and follow-ups) > > but the following situation was a bit annoying: > > > =PROGRESS REPORT==== 11-Feb-2005::15:47:21 === > application: mnesia > started_at: nonode@REDACTED > will wait for tables (time: {15,47,21}) > > User switch command > --> l > Unknown command > --> h > c [nn] - connect to job > i [nn] - interrupt job > k [nn] - kill job > j - list all jobs > s - start local shell > r [node] - start remote shell > q - quit erlang > ? | h - this message > --> s > --> c > > User switch command > --> j > 1 {shell,start,[]} > 2* {shell,start,[]} > > > One application in my boot sequence called mnesia:wait_for_tables(Tabs, infinity). Some table doesn't load for some reason, and since the shell doesn't become available until after the completed boot sequence, I had a hard time debugging it. Eventually, I managed to re-install the system, reproduce the error and use rpc:call(...,mnesia,info,[]) from another erlang node. > > Using Ctrl-G and spawning a new shell doesn't help; the new shell will also hang. Also, starting a remote shell using Ctrl-G from another node fails in the same fashion. > > The problem? I had forgotten to call application:load(mnesia) before running my function that created a schema, started mnesia, and created the tables (or rather, the install() function should have done this too). As a result, the environment variable telling mnesia where to create the schema wasn't initialized, and the disc_only tables weren't created. > > It feels like some debugging aide is missing now that there is no shell prompt during boot. Perhaps one should be allowed to start a shell using Ctrl-G even though the main shell isn't finished? > > /Uffe -- Magnus Fr?berg Tel: +46 (0)8 545 55 026 Alteon WebSystems AB Email: mfroberg@REDACTED Sveav?gen 151, P.O. Box 6701 WWW: http://www.alteonwebsystems.com SE-113 85 Stockholm, SWEDEN From micke@REDACTED Sat Feb 12 10:29:14 2005 From: micke@REDACTED (Michael Fogeborg) Date: Sat, 12 Feb 2005 10:29:14 +0100 Subject: Termite, a Lisp for distributed computing Message-ID: <6.2.1.2.0.20050212102820.0279d2d8@mail.online.no> " Termite is an experimental language/system that aims to blend the Erlang model of concurrency and distribution into Scheme. " http://www.iro.umontreal.ca/~boucherd/mslug/mslug-home-en.html From mickael.remond@REDACTED Sat Feb 12 15:48:08 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 12 Feb 2005 15:48:08 +0100 Subject: SSL socket and keepalive Message-ID: <420E1728.4000807@erlang-fr.org> Hello, Is it useless to enable TCP keepalive option for SSL connection ? It is not supported by Erlang ssl module, but I am not sure that it does not make sense ? What do you think about it ? -- Micka?l R?mond http://www.erlang-projects.org/ From klacke@REDACTED Sat Feb 12 16:48:26 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Sat, 12 Feb 2005 16:48:26 +0100 Subject: SSL socket and keepalive In-Reply-To: <420E1728.4000807@erlang-fr.org> References: <420E1728.4000807@erlang-fr.org> Message-ID: <20050212154826.GA23859@hyber.org> On Sat, Feb 12, 2005 at 03:48:08PM +0100, Mickael Remond wrote: > Hello, > > Is it useless to enable TCP keepalive option for SSL connection ? > It is not supported by Erlang ssl module, but I am not sure that it does > not make sense ? > > What do you think about it ? > It makes sence for SSL sockets as well. If it's not supported through the APIs, on Linux you can get it through: # echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time Actually, it especially makes sence for SSL session since the resources occupied (at the server side) for an SSL session are considerable, and you may want to free those resources in the case of crashed/rebooted/brutally-disconneced client. It could be argued that this belongs in the application, not in kernel. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From mickael.remond@REDACTED Sat Feb 12 17:03:37 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 12 Feb 2005 17:03:37 +0100 Subject: SSL socket and keepalive In-Reply-To: <20050212154826.GA23859@hyber.org> References: <420E1728.4000807@erlang-fr.org> <20050212154826.GA23859@hyber.org> Message-ID: <420E28D9.1070809@erlang-fr.org> klacke@REDACTED wrote: > It makes sence for SSL sockets as well. If it's not supported > through the APIs, on Linux you can get it through: > > # echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time This change the keepalive time but it looks like it should be enabled in the TCP connexion to activate it. gen_tcp offer a {keepalive, boolean} option but Erlang ssl module does not. Maybe this option is missing in the Erlang SSL implementation ? > Actually, it especially makes sence for SSL session since > the resources occupied (at the server side) for an SSL session > are considerable, and you may want to free those resources in the > case of crashed/rebooted/brutally-disconneced client. Ok. That what I thought. Keepalive in managed in the TCP layer, but you remark is very interesting because it means that I should lower the keepalive time if SSL is heavily use on my server. Thank you ! -- Micka?l R?mond http://www.erlang-projects.org/ From mickael.remond@REDACTED Sat Feb 12 19:03:08 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 12 Feb 2005 19:03:08 +0100 Subject: gen_tcp:send timeout continued: tcp_ip_abort_interval Message-ID: <420E44DC.4070604@erlang-fr.org> Hello, Regarding the discussion on gen_tcp:send that could block forever in some case: http://www.erlang.org/ml-archive/erlang-questions/200402/msg00259.html I found some TCP/IP options that seems to address the problem on Solaris: tcp_ip_abort_interval. On other implementations, this feature is said to be not tunable but might exist. Do you know if this abort feature for TCP/IP retransmission exist in other OS (Linux, Windows, BSD) ? Could the abort be handled by gen_tcp:send in Erlang ? -- Micka?l R?mond http://www.erlang-projects.org/ From erlang@REDACTED Sun Feb 13 06:42:01 2005 From: erlang@REDACTED (Michael McDaniel) Date: Sat, 12 Feb 2005 21:42:01 -0800 Subject: R10-C INETS-4.2 HTTP post method In-Reply-To: <86f1f535050211135472f05096@mail.gmail.com> References: <86f1f535050211135472f05096@mail.gmail.com> Message-ID: <20050213054200.GC21467@fangora.autosys.us> On Fri, Feb 11, 2005 at 01:54:45PM -0800, Stephen Han wrote: > Hi. > > Does anyone ever tried http:request with 'post' method? > > Since I install R10-C http client 'post' method is not working. > There are bunch of message coming out but noteably at the beginning I > got following message. > > > http:request(post, {"http://www.erlang.org", [], "application/xml", []}, [],[]). > > Of course, the sample URL is not valide but, I expect we should not > get those error, either. > > ** dets: Bug was found when accessing table cookie_db, > ** dets: operation was close and reply was > {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}. > ** exited: {{case_clause,{undefined,{error, > {'EXIT', > {{badmatch, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I also am seeing the dets error. $ uname -a Linux cougora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux $ erl Erlang (BEAM) emulator version 5.4.4 [source] [hipe] Eshell V5.4.4 (abort with ^G) 1> http:request(get,{"http://www.quickbots.com",[]},[],[]). =INFO REPORT==== 12-Feb-2005::21:23:00 === The inets application was not started. Has now been started as a temporary application. =ERROR REPORT==== 12-Feb-2005::21:23:00 === ** dets: Bug was found when accessing table cookie_db, ** dets: operation was close and reply was {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}. ** exited: {{case_clause,{undefined,{error, {'EXIT', {{badmatch, {error, etc. etc. etc. =ERROR REPORT==== 12-Feb-2005::21:23:00 === Error in process <0.30.0> with exit value: {{case_clause,{undefined,{error,{'EXIT',{{badmatch,{error,{undef,[{http_request,http_headers,[{http_request_h,undefined,"keep-alive",undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,... AND THEN I do (having found the ENOENT error using 'strace erl') # mkdir /usr/local/lib/erlang/lib/inets-4.2/priv/cookie_db # chmod go+w /usr/local/lib/erlang/lib/inets-4.2/priv/cookie_db $ erl Erlang (BEAM) emulator version 5.4.4 [source] [hipe] Eshell V5.4.4 (abort with ^G) 1> http:request(get,{"http://www.quickbots.com",[]},[],[]). =INFO REPORT==== 12-Feb-2005::21:20:10 === application: inets exited: {shutdown,{inets_app,start,[normal,[]]}} type: temporary ** exited: {{case_clause,{error,{shutdown,{inets_app,start,[normal,[]]}}}}, [{http,ensure_started,1}, {http,handle_request,5}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** =ERROR REPORT==== 12-Feb-2005::21:20:10 === Error in process <0.30.0> with exit value: {{case_clause,{error,{shutdown,{inets_app,start,[normal,[]]}}}},[{http,ensure_started,1},{http,handle_request,5},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} 2> q(). $ If I go to another machine on my network, and go through the proxy on the 'net connected machine, it works... $ uname -a Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux $ erl Erlang (BEAM) emulator version 5.4.4 [source] [hipe] Eshell V5.4.4 (abort with ^G) 1> application:start(inets). ok 2> http:set_options([{proxy, {{"cougora.autosys.us",3128}, ["localhost"]}}]). ok 3> http:request(get, {"http://www.quickbots.com/", 3> [ {"Referer", "http://www.erlang.org/"}, 3> {"Proxy-Connection", "keep-alive"}, 3> {"Keep-Alive", "300"}, 3> {"Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"}, 3> {"Accept-Encoding", "gzip,deflate"}, 3> {"Accept-Language", "en-us,en;q=0.5"}, 3> {"Accept", "image/png,*/*;q=0.5"}, 3> {"User-Agent", 3> "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927"}, 3> {"Host", "www.erlang.org"} ]}, 3> [], []). {ok,{{"HTTP/1.0",200,"OK"}, [{"date","Sun, 13 Feb 2005 05:36:50 GMT"}, {"via","1.0 cougora.autosys.us (squid/3.0-PRE3)"}, {"etag","\"15481-1ee2-da976100\""}, {"server","Apache"}, {"content-length","7906"}, {"content-type","text/html; charset=ISO-8859-1"}, {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"}, {"accept-ranges","bytes"}, {"x-cache","MISS from cougora.autosys.us"}, {"x-cache-lookup","HIT from cougora.autosys.us:3128"}, {"proxy-connection","keep-alive"}], " q(). =ERROR REPORT==== 12-Feb-2005::21:29:09 === ** dets: Bug was found when accessing table cookie_db, ** dets: operation was close and reply was {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}. Substituting inets-4.0.1 works in without proxying; proxying does not work. I have run out of ideas for awhile and also welcome any suggestions. Michael McDaniel Portland, Oregon, USA From peter@REDACTED Sun Feb 13 20:37:09 2005 From: peter@REDACTED (Peter H|gfeldt) Date: Sun, 13 Feb 2005 20:37:09 +0100 (MET) Subject: SSL socket and keepalive In-Reply-To: <420E28D9.1070809@erlang-fr.org> Message-ID: I have noted that the option KEEPALIVE should be added to SSL application (OTP-5400 in our internal ticket tracking system). /Peter On Sat, 12 Feb 2005, Mickael Remond wrote: > klacke@REDACTED wrote: > > It makes sence for SSL sockets as well. If it's not supported > > through the APIs, on Linux you can get it through: > > > > # echo 600 > /proc/sys/net/ipv4/tcp_keepalive_time > > This change the keepalive time but it looks like it should be enabled in > the TCP connexion to activate it. > gen_tcp offer a {keepalive, boolean} option but Erlang ssl module does not. > Maybe this option is missing in the Erlang SSL implementation ? > > > Actually, it especially makes sence for SSL session since > > the resources occupied (at the server side) for an SSL session > > are considerable, and you may want to free those resources in the > > case of crashed/rebooted/brutally-disconneced client. > > Ok. That what I thought. Keepalive in managed in the TCP layer, but you > remark is very interesting because it means that I should lower the > keepalive time if SSL is heavily use on my server. > > Thank you ! > > -- > Micka?l R?mond > http://www.erlang-projects.org/ > From mbj@REDACTED Mon Feb 14 09:12:01 2005 From: mbj@REDACTED (mbj@REDACTED) Date: Mon, 14 Feb 2005 09:12:01 +0100 (CET) Subject: No subject Message-ID: <20050214.091201.68134663.mbj@bluetail.com> Hi, I've found a bug in the compiler, same in R10B-2 and 3. Seems to work fine in R9. Run xx:y() and you'll get ** exited: {{badrecord,bar}, [{xx,x,1}, If e.g. the call to noop is removed it works fine. While trying to isolate this error into a small example module, I found another bug. Compiling zz.erl gives: zz: function x/1+25: Internal consistency check failed - please report this bug. Instruction: {get_tuple_element,{y,2},2,{x,0}} Error: {bad_type,{needed,{tuple_element,3}},{actual,{tuple,[2]}}}: I'm running on linux, normal erlang installation. /martin -------------- next part -------------- -module(zz). -compile(export_all). -record(bar, {status, vs = []}). y() -> x({foo, 1, []}). get_bar() -> #bar{status = 1}. x(Trans) -> {foo, Barno, _} = Trans, case get_bar() of Bar when Bar#bar.status /= 2 -> if 1 == 1 -> mnesia:dirty_delete({bar, Barno}), Vs = [1,2] ++ Bar#bar.vs, Bar33 = Bar#bar{status = 1}, Bar1 = Bar#bar{status = 3, vs = Vs}, [{payment, Barno}]; true -> Barno end; _ -> Trans end. -------------- next part -------------- -module(xx). -compile(export_all). -record(bar, {status}). y() -> x({foo, 1}). get_bar() -> #bar{status = 1}. x(Trans) -> {foo, Barno} = Trans, case get_bar() of Bar when Bar#bar.status == 1 -> noop(Bar), Bar33 = Bar#bar{status = 1}, {ok, Bar33, Barno}; _ -> Trans end. noop(_) -> ok. From ingela@REDACTED Mon Feb 14 13:10:50 2005 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 14 Feb 2005 13:10:50 +0100 Subject: R10-C INETS-4.2 HTTP post method References: <86f1f535050211135472f05096@mail.gmail.com> Message-ID: <16912.38218.240718.196807@gargle.gargle.HOWL> Stephen Han wrote: > Does anyone ever tried http:request with 'post' method? > > Since I install R10-C http client 'post' method is not working. > There are bunch of message coming out but noteably at the beginning I > got following message. > > > http:request(post, {"http://www.erlang.org", [], "application/xml", []}, [],[]). > > Of course, the sample URL is not valide but, I expect we should not > get those error, either. > > ** dets: Bug was found when accessing table cookie_db, > ** dets: operation was close and reply was > > ** {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,init_p,5}]}}. This is due to misunderstanding because of different behaviors of priv_dir in the test-server and in OTP. Alas in OTP priv_dir is not always writable for the application. So we will have to find some other solution for this. Proably we need to make it configurable. In the meantime a workaround would be change the path in http_cookie.erl, you would need to change "code:priv_dir(inets)" against some directory that is writable for you when you run erlang. > ** exited: {{case_clause,{undefined,{error, > {'EXIT', > {{badmatch, > {error, > {badarg, > [{erlang, > '++', > [0,"\r\n"]}, > [...] This is a bug. I will fix it. In the file httpc_request.erl in the internal function post_data/3 the line ContentLength = length(Body), should say: ContentLength = integer_to_list(length(Body)), I will try to find some time to make a better test coverage for the http-client, it was already on my list of things to do an apparently you found an area where it was lacking. -- /Ingela - OTP team From ulf.wiger@REDACTED Mon Feb 14 13:17:13 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 14 Feb 2005 13:17:13 +0100 Subject: R10-C INETS-4.2 HTTP post method Message-ID: The way we addressed similar problems in AXD 301 was to export a central function called usr_dir(), which pointed to an area on disk where it was OK for applications to write stuff. The rule was that each application needing to store stuff on disk should create a subdirectory under usr_dir(). (The subdirectory should be named after the application.) /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Ingela Anderton > Sent: den 14 februari 2005 13:11 > To: kruegger@REDACTED > Cc: erlang-questions@REDACTED > Subject: Re: R10-C INETS-4.2 HTTP post method > > > > > Stephen Han wrote: > > Does anyone ever tried http:request with 'post' method? > > > > Since I install R10-C http client 'post' method is not working. > > There are bunch of message coming out but noteably at the > beginning I > > got following message. > > > > > http:request(post, {"http://www.erlang.org", [], > "application/xml", []}, [],[]). > > > > Of course, the sample URL is not valide but, I expect we should not > > get those error, either. > > > > ** dets: Bug was found when accessing table cookie_db, > > ** dets: operation was close and reply was > > > > ** > {'EXIT',{{case_clause,{'EXIT',{{badmatch,{error,eacces}},[{det > s,perform_save,2},{dets,fclose,1},{dets,apply_op,4},{dets,do_a > pply_op,4},{proc_lib,init_p,5}]}}},[{dets,perform_save,2},{det > s,fclose,1},{dets,apply_op,4},{dets,do_apply_op,4},{proc_lib,i > nit_p,5}]}}. > This is due to misunderstanding because of different behaviors of > priv_dir in the test-server and in OTP. Alas in OTP priv_dir is not > always writable for the application. So we will have to find some > other solution for this. Proably we need to make it configurable. In > the meantime a workaround would be change the path in http_cookie.erl, > you would need to change "code:priv_dir(inets)" against > some directory that is writable for you when you run erlang. > > > > ** exited: {{case_clause,{undefined,{error, > > {'EXIT', > > {{badmatch, > > {error, > > {badarg, > > [{erlang, > > '++', > > > [0,"\r\n"]}, > > > [...] > This is a bug. I will fix it. > In the file httpc_request.erl in the internal function post_data/3 > the line > > ContentLength = length(Body), > > should say: > > ContentLength = integer_to_list(length(Body)), > > I will try to find some time to make a better test coverage for the > http-client, it was already on my list of things to do an apparently > you found an area where it was lacking. > > -- > /Ingela - OTP team > > > From ingela@REDACTED Mon Feb 14 13:16:35 2005 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 14 Feb 2005 13:16:35 +0100 Subject: R10-C INETS-4.2 HTTP post method References: <86f1f535050211135472f05096@mail.gmail.com> <20050213054200.GC21467@fangora.autosys.us> Message-ID: <16912.38563.676378.533653@gargle.gargle.HOWL> [...] > Substituting inets-4.0.1 works in without proxying; proxying does not work. >From the release notes of inets-4.2 Fixed Bugs and Malfunctions: OTP-5368 When sending a request through a proxy the absolute URI must be used. -- /Ingela - OTP team From bjorn@REDACTED Mon Feb 14 13:54:34 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Feb 2005 13:54:34 +0100 Subject: none In-Reply-To: <20050214.091201.68134663.mbj@bluetail.com> References: <20050214.091201.68134663.mbj@bluetail.com> Message-ID: Thanks! We'll try to fix the bugs for R10B-4. /Bjorn mbj@REDACTED writes: > Hi, > > I've found a bug in the compiler, same in R10B-2 and 3. Seems to work > fine in R9. > > Run xx:y() and you'll get > > ** exited: {{badrecord,bar}, > [{xx,x,1}, > > If e.g. the call to noop is removed it works fine. > > > While trying to isolate this error into a small example module, I > found another bug. Compiling zz.erl gives: > > zz: function x/1+25: > Internal consistency check failed - please report this bug. > Instruction: {get_tuple_element,{y,2},2,{x,0}} > Error: {bad_type,{needed,{tuple_element,3}},{actual,{tuple,[2]}}}: > > > > I'm running on linux, normal erlang installation. > > > > /martin > -module(zz). > -compile(export_all). > > -record(bar, {status, vs = []}). > > y() -> > x({foo, 1, []}). > > get_bar() -> > #bar{status = 1}. > > x(Trans) -> > {foo, Barno, _} = Trans, > case get_bar() of > Bar when Bar#bar.status /= 2 -> > if 1 == 1 -> > mnesia:dirty_delete({bar, Barno}), > Vs = [1,2] ++ Bar#bar.vs, > Bar33 = Bar#bar{status = 1}, > Bar1 = Bar#bar{status = 3, > vs = Vs}, > [{payment, Barno}]; > true -> > Barno > end; > _ -> > Trans > end. > > -module(xx). > -compile(export_all). > > -record(bar, {status}). > > y() -> > x({foo, 1}). > > get_bar() -> > #bar{status = 1}. > > x(Trans) -> > {foo, Barno} = Trans, > case get_bar() of > Bar when Bar#bar.status == 1 -> > noop(Bar), > Bar33 = Bar#bar{status = 1}, > {ok, Bar33, Barno}; > _ -> > Trans > end. > > noop(_) -> > ok. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From mbj@REDACTED Mon Feb 14 14:06:36 2005 From: mbj@REDACTED (mbj@REDACTED) Date: Mon, 14 Feb 2005 14:06:36 +0100 (CET) Subject: compiler bug In-Reply-To: <20050214.091201.68134663.mbj@bluetail.com> References: <20050214.091201.68134663.mbj@bluetail.com> Message-ID: <20050214.140636.58431330.mbj@bluetail.com> Hi, Here's another module with the same behaviour - just to show that this has nothing to do with records... Run: 1> xx2:y(). {nok,{bar,1}} If you remove the call to noop/1, you'll get ok. I'd say that this is a rather serious bug. /martin mbj@REDACTED wrote: > Hi, > > I've found a bug in the compiler, same in R10B-2 and 3. Seems to work > fine in R9. > > Run xx:y() and you'll get > > ** exited: {{badrecord,bar}, > [{xx,x,1}, > > If e.g. the call to noop is removed it works fine. > > > While trying to isolate this error into a small example module, I > found another bug. Compiling zz.erl gives: > > zz: function x/1+25: > Internal consistency check failed - please report this bug. > Instruction: {get_tuple_element,{y,2},2,{x,0}} > Error: {bad_type,{needed,{tuple_element,3}},{actual,{tuple,[2]}}}: > > > > I'm running on linux, normal erlang installation. > > > > /martin -------------- next part -------------- -module(xx2). -compile(export_all). -record(bar, {status}). y() -> x({foo, 1}). get_bar() -> {bar, 1}. x(Trans) -> {foo, Barno} = Trans, case get_bar() of Bar when element(2, Bar) == 1 -> noop(Bar), case Bar of {bar, _} -> ok; _ -> {nok, Bar} end; _ -> Trans end. noop(_) -> ok. From erlang-list@REDACTED Mon Feb 14 14:26:01 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 14 Feb 2005 14:26:01 +0100 Subject: Proposed change to libraries In-Reply-To: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> References: <200502091109.j19B9nKw000098@spikklubban.it.uu.se> Message-ID: <4210A6E9.9070106@dominicwilliams.net> Kostis Sagonas wrote: > First let me enumerate the things we (all?) agree upon: > > 1. Something needs to be done in libraries to make them more consistent > with their documentation and allow more effective type checking. Erlang is not a type-safe language, so it seems to me that the libraries are consistent with the documentation if they work as advertized, for advertized types. There is no implicit suggestion that they should refuse to work on other types. I see guards as a pattern matching tool (i.e. to provide a separate clause for separate types), not as a type checking tool. I practice test-driven development, so I am not interested in the compiler doing any type checking. What matters to me, as a programmer, is that Erlang allows me to write simple, economical code where I don't need to explicitly declare types or guarantee type safety. What the motivation is for having stricter type checking in Erlang? Thanks, Dominic Williams http://www.dominicwilliams.net ---- From mbj@REDACTED Mon Feb 14 15:06:08 2005 From: mbj@REDACTED (Martin Bjorklund) Date: Mon, 14 Feb 2005 15:06:08 +0100 (CET) Subject: consequence of not using risky_shell In-Reply-To: <420DB980.6040506@really.nortelnetworks.com> References: <420DB980.6040506@really.nortelnetworks.com> Message-ID: <20050214.150608.42794437.mbj@bluetail.com> Magnus Fr?berg wrote: > I would recommend not making this flag an undocumented feature > as it is really needed. > Actually, I think the default behaviour should be the old > in an interactive system at least. I agree 100%. > > (see http://www.erlang.org/ml-archive/erlang-questions/200412/msg00045.html and follow-ups) I read the original thread now (not then :( ) It isn't mentioned why the original behaviour was removed. I'm sure there's some better reason than that tracing can be difficult when processes are starting!!! It is of course extremely useful to get a shell as quickly as possible so you can inspect the starting system. The solution to the trace problem can't be to start the shell even later! Why not take this one more step and remove the shell completely b/c people might interfere with the system... Please make the old shell default, and introduce a new flag -safe_shell or something. /martin From erlang@REDACTED Mon Feb 14 17:09:30 2005 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 14 Feb 2005 08:09:30 -0800 Subject: R10-C INETS-4.2 HTTP post method In-Reply-To: <16912.38563.676378.533653@gargle.gargle.HOWL> References: <86f1f535050211135472f05096@mail.gmail.com> <20050213054200.GC21467@fangora.autosys.us> <16912.38563.676378.533653@gargle.gargle.HOWL> Message-ID: <20050214160930.GS21467@fangora.autosys.us> On Mon, Feb 14, 2005 at 01:16:35PM +0100, Ingela Anderton wrote: > > [...] > > Substituting inets-4.0.1 works in without proxying; proxying does not work. > > From the release notes of inets-4.2 > > Fixed Bugs and Malfunctions: > > OTP-5368 When sending a request through a proxy the absolute URI must > be used. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I do know that inets-4.2 proxying works great (I discovered the bug re proxying in inets-4.0.1 and it was one of the first things I tried after installing R10B-3). Apologies for not being clear with the original 'Substituting ...' comment (above). My point was that I had a workaround for the 'dets: ... cookie_db' problem by using the older inets-4.0.1, though I could not use proxy with the older, inets-4.0.1, version. It would appear that we now have a workaround for the 'dets: ... cookie_db' problem by changing the path in http_cookie.erl. thank you, ~Michael > > > -- > /Ingela - OTP team > > > From ulf.wiger@REDACTED Mon Feb 14 15:33:58 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 14 Feb 2005 15:33:58 +0100 Subject: consequence of not using risky_shell Message-ID: One of the purported problems, AFAIR, was that piping commands into a system while it was starting up was sometimes hazardous. This could be addressed with a function init:await_system_started() -> ok which could be first in the chain of commands being piped into the shell. Perhaps init:await_system_started(Timeout) could also be useful, but I'm not sure. /Uffe > -----Original Message----- > From: Martin Bjorklund [mailto:mbj@REDACTED] > Sent: den 14 februari 2005 15:06 > To: mfroberg@REDACTED > Cc: Ulf Wiger (AL/EAB); erlang-questions@REDACTED > Subject: Re: consequence of not using risky_shell > > > Magnus Fr?berg wrote: > > I would recommend not making this flag an undocumented feature > > as it is really needed. > > Actually, I think the default behaviour should be the old > > in an interactive system at least. > > I agree 100%. > > > > (see > http://www.erlang.org/ml-archive/erlang-questions/200412/msg00 045.html and follow-ups) I read the original thread now (not then :( ) It isn't mentioned why the original behaviour was removed. I'm sure there's some better reason than that tracing can be difficult when processes are starting!!! It is of course extremely useful to get a shell as quickly as possible so you can inspect the starting system. The solution to the trace problem can't be to start the shell even later! Why not take this one more step and remove the shell completely b/c people might interfere with the system... Please make the old shell default, and introduce a new flag -safe_shell or something. /martin From mickael.remond@REDACTED Mon Feb 14 17:17:29 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 14 Feb 2005 17:17:29 +0100 Subject: gen_tcp:send timeout continued: tcp_ip_abort_interval In-Reply-To: <420E44DC.4070604@erlang-fr.org> References: <420E44DC.4070604@erlang-fr.org> Message-ID: <4210CF19.7010004@erlang-fr.org> Mickael Remond wrote: > Hello, > > Regarding the discussion on gen_tcp:send that could block forever in > some case: > http://www.erlang.org/ml-archive/erlang-questions/200402/msg00259.html > > I found some TCP/IP options that seems to address the problem on > Solaris: tcp_ip_abort_interval. > > On other implementations, this feature is said to be not tunable but > might exist. > Do you know if this abort feature for TCP/IP retransmission exist in > other OS (Linux, Windows, BSD) ? > Could the abort be handled by gen_tcp:send in Erlang ? Hello again Do you know what is the current status of the {send_timeout, N} socket option in gen_tcp ? In this mail, some problems were reported when using this option: http://www.erlang.org/ml-archive/erlang-questions/200302/msg00157.html Does someone know if this is a good option to avoid hanged process during send if the connexion is silently broken with the client or server ? Is there still side effects ? Thank you ! -- Micka?l R?mond http://www.erlang-projects.org/ From kostis@REDACTED Mon Feb 14 18:38:35 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 14 Feb 2005 18:38:35 +0100 (MET) Subject: Proposed change to libraries In-Reply-To: Mail from 'Dominic Williams ' dated: Mon, 14 Feb 2005 14:26:01 +0100 Message-ID: <200502141738.j1EHcZuL022873@spikklubban.it.uu.se> Dominic Williams wrote: > Erlang is not a type-safe language, so it seems to me that the > libraries are consistent with the documentation if they work as > advertized, for advertized types. There is no implicit suggestion > that they should refuse to work on other types. Oh, but more often than not they do! Try: lists:map(gazonk, [1]). and you will get an exception. > I see guards as a pattern matching tool (i.e. to provide a separate > clause for separate types), not as a type checking tool. I practice > test-driven development, so I am not interested in the compiler > doing any type checking. What matters to me, as a programmer, is that > Erlang allows me to write simple, economical code where I don't need > to explicitly declare types or guarantee type safety. Let me assure you that whatever we do would not force you to change your favourite working habbits. Nobody will _require_ you to declare types. But you will not be able to write calls such as: lists:map(gazonk, []). and expect them not to throw an exception at *runtime*. > What the motivation is for having stricter type checking in Erlang? So that people who choose to do this, can. Best, Kostis From thomasl_erlang@REDACTED Mon Feb 14 19:50:58 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 14 Feb 2005 10:50:58 -0800 (PST) Subject: Proposed change to libraries In-Reply-To: <200502141738.j1EHcZuL022873@spikklubban.it.uu.se> Message-ID: <20050214185058.68369.qmail@web41904.mail.yahoo.com> --- Kostis Sagonas wrote: > Let me assure you that whatever we do would not > force you to change > your favourite working habbits. Nobody will > _require_ you to declare > types. But you will not be able to write calls such > as: > > lists:map(gazonk, []). > > and expect them not to throw an exception at > *runtime*. While changing lists:map itself may be innocuous, I think the principle of changing code to suit type checking may well stand some discussion. The deeper question, in my mind, is to what extent this sort of mandated extra checking will impact the whole of OTP in the long run. That is, if we go in this direction, where should we stop, and why? E.g., should we at some point in the future require/ensure that gb_trees functions get gb_tree inputs in the right places? Why or why not? etc etc. > > What the motivation is for having stricter type > checking in Erlang? > > So that people who choose to do this, can. Hm. That's not a very compelling argument in favour of changing it for everyone. Again, for lists:map this might not matter very much. After generalizing your argument to a larger scope, the issue seems less clear cut. Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From anders.nygren@REDACTED Tue Feb 15 01:59:40 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 14 Feb 2005 18:59:40 -0600 Subject: oserl and SMPP versions Message-ID: Hi I wonder if oserl supports SMPP 3.4. The documentation says "OSERL (open SMPP erlang library) comprises the entire specification of the recently released SMPP version 5.0 (February 20th, 2003). Moreover, every forward and backward compatibility guidelines were adopted at the design stage, what makes the resulting library easy to maintain and update to any future or previous version of the protocol." Which is a little unclear but sounds promising. /Anders Nygren From heinrich@REDACTED Tue Feb 15 07:33:16 2005 From: heinrich@REDACTED (Heinrich Venter) Date: Tue, 15 Feb 2005 08:33:16 +0200 Subject: oserl and SMPP versions Message-ID: Anders Oserl indeed supports SMPP 3.4 We have been using it in this mode for comercial projects. Just make sure what version of SMPP the SMSC you connet to requires. We had to change the default SMPP version before our SMSCs accepted our binds. This can be done in smpp_param. -define(INTERFACE_VERSION, ?STANDARD(interface_version, ?INTERFACE_VERSION_DOMAIN, ?SMPP_VERSION_3_4, undefined)). -]-[einrich Get LookForMe for business using CellFind http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313036343232343a33303639373a2d323a323138 This will take you to the Launchpad site for more info http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313036343232343a33303639373a2d323a333738 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 14964 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 620 bytes Desc: not available URL: From bjorn@REDACTED Tue Feb 15 09:20:34 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Feb 2005 09:20:34 +0100 Subject: Proposed change to libraries In-Reply-To: <200502141738.j1EHcZuL022873@spikklubban.it.uu.se> References: <200502141738.j1EHcZuL022873@spikklubban.it.uu.se> Message-ID: I agree. We have no intention to change Erlang into another language where you would have to declare your types. If your test suites are complete enough to catch all of your bugs, you don't have to use any other tools such as type checkers, cross-reference tools, or compiler warnings. My personal opinion is, however, that you can't have too many sharp tools to help you find bugs. We have extensive test suites for OTP. Still, we found bugs when we turned on warnings for unused variables. The new warnings in R10B also pointed out several bugs. Dialyzer has also pointed out several bugs, some of which would have been hard to find with a test suite. /Bjorn Kostis Sagonas writes: > Dominic Williams wrote: > > Erlang is not a type-safe language, so it seems to me that the > > libraries are consistent with the documentation if they work as > > advertized, for advertized types. There is no implicit suggestion > > that they should refuse to work on other types. > > Oh, but more often than not they do! Try: > > lists:map(gazonk, [1]). > > and you will get an exception. > > > I see guards as a pattern matching tool (i.e. to provide a separate > > clause for separate types), not as a type checking tool. I practice > > test-driven development, so I am not interested in the compiler > > doing any type checking. What matters to me, as a programmer, is that > > Erlang allows me to write simple, economical code where I don't need > > to explicitly declare types or guarantee type safety. > > Let me assure you that whatever we do would not force you to change > your favourite working habbits. Nobody will _require_ you to declare > types. But you will not be able to write calls such as: > > lists:map(gazonk, []). > > and expect them not to throw an exception at *runtime*. > > > What the motivation is for having stricter type checking in Erlang? > > So that people who choose to do this, can. > > Best, > Kostis > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From peppe@REDACTED Tue Feb 15 09:58:22 2005 From: peppe@REDACTED (UAB L/K Peter Andersson) Date: Tue, 15 Feb 2005 09:58:22 +0100 Subject: consequence of not using risky_shell References: <420DB980.6040506@really.nortelnetworks.com> Message-ID: <4211B9AE.CD6D8E20@erix.ericsson.se> Ok, we'll call the flag 'async_shell_start' or something like that and document it for the next release. We wish to keep the current default behaviour though. You should be able to evaluate shell commands without risking failure because you don't know if the system has finished booting yet. /Peppe Magnus Fr?berg wrote: > > Hi > > well I didn't comment on the original "risky_shell" mail > discussion but, uhh, removing the old shell behaviour really > makes it a hard time debugging bad (maybe hanging) startup > sequenses in especially highly distributed environments. > > I would recommend not making this flag an undocumented feature > as it is really needed. > Actually, I think the default behaviour should be the old > in an interactive system at least. > > We'll always start our system nodes with this flag enabled! > > /Magnus > > Ulf Wiger (AL/EAB) wrote: > > Not that I want to gripe too much about the change in the > > shell behaviour -- that it doesn't become available before the > > boot sequence is finished... > > > > (see http://www.erlang.org/ml-archive/erlang-questions/200412/msg00045.html and follow-ups) > > > > but the following situation was a bit annoying: > > > > > > =PROGRESS REPORT==== 11-Feb-2005::15:47:21 === > > application: mnesia > > started_at: nonode@REDACTED > > will wait for tables (time: {15,47,21}) > > > > User switch command > > --> l > > Unknown command > > --> h > > c [nn] - connect to job > > i [nn] - interrupt job > > k [nn] - kill job > > j - list all jobs > > s - start local shell > > r [node] - start remote shell > > q - quit erlang > > ? | h - this message > > --> s > > --> c > > > > User switch command > > --> j > > 1 {shell,start,[]} > > 2* {shell,start,[]} > > > > > > One application in my boot sequence called mnesia:wait_for_tables(Tabs, infinity). Some table doesn't load for some reason, and since the shell doesn't become available until after the completed boot sequence, I had a hard time debugging it. Eventually, I managed to re-install the system, reproduce the error and use rpc:call(...,mnesia,info,[]) from another erlang node. > > > > Using Ctrl-G and spawning a new shell doesn't help; the new shell will also hang. Also, starting a remote shell using Ctrl-G from another node fails in the same fashion. > > > > The problem? I had forgotten to call application:load(mnesia) before running my function that created a schema, started mnesia, and created the tables (or rather, the install() function should have done this too). As a result, the environment variable telling mnesia where to create the schema wasn't initialized, and the disc_only tables weren't created. > > > > It feels like some debugging aide is missing now that there is no shell prompt during boot. Perhaps one should be allowed to start a shell using Ctrl-G even though the main shell isn't finished? > > > > /Uffe > > -- > Magnus Fr?berg Tel: +46 (0)8 545 55 026 > Alteon WebSystems AB Email: mfroberg@REDACTED > Sveav?gen 151, P.O. Box 6701 WWW: http://www.alteonwebsystems.com > SE-113 85 Stockholm, SWEDEN From peppe@REDACTED Tue Feb 15 10:26:52 2005 From: peppe@REDACTED (UAB L/K Peter Andersson) Date: Tue, 15 Feb 2005 10:26:52 +0100 Subject: consequence of not using risky_shell References: Message-ID: <4211C05C.C5733DAF@erix.ericsson.se> I think it's a good idea that a new shell explicitly started from the JCL menu (local or remote) doesn't wait to be synchronized with init. We'll fix this for the next release. Thanks Uffe! /Peppe "Ulf Wiger (AL/EAB)" wrote: > > Not that I want to gripe too much about the change in the > shell behaviour -- that it doesn't become available before the > boot sequence is finished... > > (see http://www.erlang.org/ml-archive/erlang-questions/200412/msg00045.html and follow-ups) > > but the following situation was a bit annoying: > > =PROGRESS REPORT==== 11-Feb-2005::15:47:21 === > application: mnesia > started_at: nonode@REDACTED > will wait for tables (time: {15,47,21}) > > User switch command > --> l > Unknown command > --> h > c [nn] - connect to job > i [nn] - interrupt job > k [nn] - kill job > j - list all jobs > s - start local shell > r [node] - start remote shell > q - quit erlang > ? | h - this message > --> s > --> c > > User switch command > --> j > 1 {shell,start,[]} > 2* {shell,start,[]} > > One application in my boot sequence called mnesia:wait_for_tables(Tabs, infinity). Some table doesn't load for some reason, and since the shell doesn't become available until after the completed boot sequence, I had a hard time debugging it. Eventually, I managed to re-install the system, reproduce the error and use rpc:call(...,mnesia,info,[]) from another erlang node. > > Using Ctrl-G and spawning a new shell doesn't help; the new shell will also hang. Also, starting a remote shell using Ctrl-G from another node fails in the same fashion. > > The problem? I had forgotten to call application:load(mnesia) before running my function that created a schema, started mnesia, and created the tables (or rather, the install() function should have done this too). As a result, the environment variable telling mnesia where to create the schema wasn't initialized, and the disc_only tables weren't created. > > It feels like some debugging aide is missing now that there is no shell prompt during boot. Perhaps one should be allowed to start a shell using Ctrl-G even though the main shell isn't finished? > > /Uffe From mpquique@REDACTED Tue Feb 15 13:23:41 2005 From: mpquique@REDACTED (Enrique Marcote =?iso-8859-1?q?Pe=F1a?=) Date: Tue, 15 Feb 2005 13:23:41 +0100 Subject: oserl and SMPP versions In-Reply-To: References: Message-ID: <200502151323.41478.mpquique@udc.es> On Tuesday 15 February 2005 01:59, Anders Nygren wrote: > Hi > I wonder if oserl supports SMPP 3.4. > The documentation says > > "OSERL (open SMPP erlang library) comprises the entire specification > of the recently released SMPP version 5.0 (February 20th, 2003). > Moreover, every forward and backward compatibility guidelines were > adopted at the design stage, what makes the resulting library easy to > maintain and update to any future or previous version of the > protocol." > > Which is a little unclear but sounds promising. > > /Anders Nygren Hi Anders, OSERL does support SMPP 3.4, the backwards compatibility guidelines adopted made the compatibility with previous versions possible, in fact we are working against SMSCs running that exact version of SMPP. As Heinrich said, OSERL by default sets the interface_version to 0x50 (version 5.0). To change this, you may edit smpp_param.hrl and set the default value of this parameter to ?SMPP_VERSION_3_4, or instead of that, you may set the interface_version parameter to the appropriate value when binding: ParamList = [{system_id, "SYSTEMID"}, {password, "PASSWORD"}, {system_type, "SYSTEMTYPE"}, {interface_version, 16#34}, {addr_ton, 0}, {addr_npi, 0}, {address_range, "1234"}], gen_esme:bind_transceiver(SessionPid, ParamList) As a rule of thumb, OSERL sets the default value for every parameter to those defined in smpp_param.hrl, but only for those parameters the user doesn't explicitly set on the ParamList when issuing any particular SMPP operation. Those values defined by the user in the ParamList have higher priority than the default ones. You probably *won't need* to do so if you are working with a standard version of SMPP version 3.4, but just in case you need to adjust OSERL to a non-stantard SMPP implementation, you have to edit smpp_param.hrl and/or smpp_pdu.hrl to reflect your exact SMPP parameters and PDUs. I believe matching these hrls to the parameters and PDUs defined in any SMPP specification is pretty straightforward. Best regards, -- Quique http://www.nomasystems.com/~quique/ From Francesco.Cesarini@REDACTED Tue Feb 15 16:23:13 2005 From: Francesco.Cesarini@REDACTED (Francesco Cesarini) Date: Tue, 15 Feb 2005 15:23:13 -0000 Subject: Migration to Mnesia Local Content tables? Message-ID: <3D5E4EFE4053D311924F0008C791DC780BEB95A2@elg01mbx.t-mobile.co.uk> Hi Mnesia Gurus, Is there an undocumented function / shortcut which allows us to change a mnesia table to a local content one without taking down the system or recreating the schema? Could not find one in the documentation, nor did I find a trivial solution which did not involve manipulating the schema table. Thanks, Francesco NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Tue Feb 15 16:52:04 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Tue, 15 Feb 2005 16:52:04 +0100 Subject: standalone erlang Message-ID: <20050215155204.GA23340@hyber.org> Hi list, Instead of doing my research I just shamelessly ask the list for help since I'm in a hurry with the answer to these questions. A very nice opportunity has just emerged where I might be able to get erlang more into mainstream Nortel sw development ... maybe ... Anyway, 1. Where can I read anything about standalone erlang which is uptodate. 2. Hello world, how do I build it. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From luke@REDACTED Tue Feb 15 17:49:34 2005 From: luke@REDACTED (Luke Gorrie) Date: 15 Feb 2005 17:49:34 +0100 Subject: standalone erlang References: <20050215155204.GA23340@hyber.org> Message-ID: klacke@REDACTED writes: > A very nice opportunity has just emerged where I > might be able to get erlang more into mainstream > Nortel sw development ... maybe ... Just shout to mbj. He made an SAE RPM out of our tcpdump-analyser that we sent to other Nortel people. Even packaged up etk into a jar^Wlibrary file and it worked great. IIRC they only wanted a windows version. :-) From Lawrie.Brown@REDACTED Wed Feb 16 01:47:51 2005 From: Lawrie.Brown@REDACTED (Lawrie Brown) Date: Wed, 16 Feb 2005 11:47:51 +1100 Subject: Magnus and EC (was Re: Erlang on "Cell" Architectures) In-Reply-To: <200502092318.j19NID4J309372@atlas.otago.ac.nz> References: <200502092318.j19NID4J309372@atlas.otago.ac.nz> Message-ID: <20050216004751.GA25964@icarus.its.adfa.edu.au> On Thu, Feb 10, 2005 at 12:18:13PM +1300, Richard A. O'Keefe wrote: > Matthias Lang wrote: > The work which seems most closely related is something I vaguely > recall Dr Fergus O'Brien at RMIT talking about. He was (thinking > about?) adapting Erlang for some massively parallel custom (?) .... > This was the Magnus project. I have some documentation about Magnus, > which I don't think I'm allowed to quote. To be honest, I don't know What public info there is, is given in: Maurice Castro, SERC-0128: EC: An Erlang Compiler, Software Engineering Research Centre, RMIT, July 2001. which is available from: http://www.serc.rmit.edu.au/~ec/30docs.html > as well as for conventional UNIX systems. Ah, found something of Lawrie > Brown's on the web I can quote: Which is shamelessly stolen from the above ref :-) > Lawrie Brown and Maurice Castro should know a lot about this. > I've heard a few rumours; let's just say the problems RMIT ran into > were financial and political rather than technical. Umm yes. I actually don't know a great deal, but last I spoke with Fergus I believe patent licencing deals were still being negotiated, albeit very VERY slowly ... it may yet happen in the "fullness of time (tm)". It most certainly was not helped by RMIT's financial implosion and consequent loss of most of its research people and units (in practise if not in name)! As for EC, well it works, but no-where near as fast as I would like (which is testament to the great work put into the current Erlang runtime by all the gang). I have at least got a system which compiles most of the language (it being something of a moving target - we're some years behind :-) and perhaps more significantly, has a run-time which actually implements most of the BIFs (trust-me, thats no small feat, apart from being a moving target, the shear number of them makes this more like an O/S implementation!!!) so as a proof of concept that it is actaully possible to create an alternate Erlang implementation, I think its pretty significant. As a practical system though ... thats some way off. And of course from my research perspective, it demonstrated that it is indeed possible to implement the "Safe-Erlang" language extensions that I proposed. If anyone is interested, look at one of the EC site shadows: http://www.serc.rmit.edu.au/~ec/ http://www.cs.adfa.edu.au/~ec/ And by all means hassle me with questions about EC :-) Cheers Lawrie ------------------------------------ <*> ------------------------------------ Post: Dr Lawrie Brown, School of IT&EE, UNSW@REDACTED, Canberra 2600 Australia Phone: 02 6268 8816 Fax: 02 6268 8581 Web: http://www.unsw.adfa.edu.au/~lpb/ From klacke@REDACTED Wed Feb 16 10:21:49 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Wed, 16 Feb 2005 10:21:49 +0100 Subject: standalone erlang In-Reply-To: <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> References: <20050215155204.GA23340@hyber.org> <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> Message-ID: <20050216092148.GA3274@hyber.org> On Wed, Feb 16, 2005 at 08:39:52AM +0000, Peter-Henry Mander wrote: > Hi Luke, hi Klacke, > > I'm also interested in SAE with R10B-3. If you do have a procedure to > enable SAE in the latest release, please let me know. As Luke seems to > imply, it makes acceptance of Erlang applications soo-o-o-o-oo much > easier when I don't have to install Erlang on the target machines. > I spent some time on it yesterday, found a couple of old mails, one from Bjorn stating that it's completely unsupported and one from Sean stating that it worked just fine on R10-2 ! Tried to make in erts/boot/src which failed ... Anyone has any clues/instructions, I'd appreciate to know before _digging_ in to it. (I gather that Joe's old wiki pages are completely irrelevant ??) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From erlang@REDACTED Wed Feb 16 09:39:52 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 16 Feb 2005 08:39:52 +0000 Subject: standalone erlang In-Reply-To: References: <20050215155204.GA23340@hyber.org> Message-ID: <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> Hi Luke, hi Klacke, I'm also interested in SAE with R10B-3. If you do have a procedure to enable SAE in the latest release, please let me know. As Luke seems to imply, it makes acceptance of Erlang applications soo-o-o-o-oo much easier when I don't have to install Erlang on the target machines. Pete. On 15 Feb 2005 17:49:34 +0100 Luke Gorrie wrote: > klacke@REDACTED writes: > > > A very nice opportunity has just emerged where I > > might be able to get erlang more into mainstream > > Nortel sw development ... maybe ... > > Just shout to mbj. He made an SAE RPM out of our tcpdump-analyser that > we sent to other Nortel people. Even packaged up etk into a > jar^Wlibrary file and it worked great. > > IIRC they only wanted a windows version. :-) > -- "The Tao of Programming flows far away and returns on the wind of morning." From james.hague@REDACTED Wed Feb 16 15:26:21 2005 From: james.hague@REDACTED (James Hague) Date: Wed, 16 Feb 2005 08:26:21 -0600 Subject: standalone erlang In-Reply-To: References: <20050215155204.GA23340@hyber.org> Message-ID: > IIRC they only wanted a windows version. :-) I tell you, if SAE worked for Windows, I'd immediately begin using it for a whole bunch of utilities. As it stands, it's a big pain to give them to other people, so I end up writing 'em in Perl or whatnot (there are several tools for wrapping up Perl scripts into standalone programs). From joe.armstrong@REDACTED Wed Feb 16 16:22:49 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 16 Feb 2005 16:22:49 +0100 Subject: standalone erlang Message-ID: SAE has a long history. As far as I know it is currently broken. It has actually worked for windows (once) - and I had a pure Erlang program that could make a windows executable on any Erlang box. To do this I had to reverse engineer the Microsoft COFF format which took me two weeks and was painful :-( Unfortunately this has never made it to the main release and porting it to each new release so painful that I don't want to do this anymore. When I ran a series of experiments on planet lab I wanted to install Erlang on a few hundred nodes - to do this I made a minimal release - basically install OTP then run a shell script to remove all unnecessary sources, then retain only the beam code in stdlib, kernel and compiler and then make some scripts to pack/unpack and relocate everything. This is not "stand-alone" but does reduce the total number of files needed significantly. /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of James Hague > Sent: den 16 februari 2005 15:26 > To: Luke Gorrie > Cc: erlang-questions@REDACTED > Subject: Re: standalone erlang > > > > IIRC they only wanted a windows version. :-) > > I tell you, if SAE worked for Windows, I'd immediately begin using it > for a whole bunch of utilities. As it stands, it's a big pain to give > them to other people, so I end up writing 'em in Perl or whatnot > (there are several tools for wrapping up Perl scripts into standalone > programs). > From thomas.xa.johnsson@REDACTED Wed Feb 16 16:43:57 2005 From: thomas.xa.johnsson@REDACTED (Thomas Johnsson XA (LN/EAB)) Date: Wed, 16 Feb 2005 16:43:57 +0100 Subject: Sharing and append in EC (was RE: Magnus and EC) Message-ID: > What public info there is, is given in: > > Maurice Castro, SERC-0128: EC: An Erlang Compiler, Software > Engineering Research Centre, RMIT, July 2001. > > [..snip..] > And by all means hassle me with questions about EC :-) > > Cheers > Lawrie Ok, will do (:-) Section 6.3 in the above-mentioned document caught my eye; here it is described that a cons cell in the implementation is a triple, with pointers to (1) the head element, (2) the next cons cell, and (3) the last cons cell of the list (called the Tail). "Thus O(1) list append performance is assured only when the head of the first and the second lists are provided to append". Doesn't this cause disastrous side effects with shared values? Eg, like Prefix = "prefix", S1 = Prefix ++ "first", S2 = Prefix ++ "second", ... -- Thomas From Thomas.Herchenroeder@REDACTED Wed Feb 16 17:58:42 2005 From: Thomas.Herchenroeder@REDACTED (Thomas.Herchenroeder@REDACTED) Date: Wed, 16 Feb 2005 17:58:42 +0100 Subject: Erlang in Higher Education Message-ID: <76EEB38C72AE1D4EA2FE2753766EB51443ACFD@DAEMSG03.eur.ad.sag> Hi all! I'm considering going back to university for a year, and I'd love to program Erlang during this time. Is anybody on this list aware of a higher eduction program that makes use of Erlang? Something like an "MSc taught course" in informatics, telco, network system administration etc. The college or university should be in Europe, and the educational language should be English (sorry, I'm not capable of Swedish or French :). Any hints? =Thomas From vlad_dumitrescu@REDACTED Wed Feb 16 20:05:33 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 16 Feb 2005 20:05:33 +0100 Subject: standalone erlang References: Message-ID: ----- Original Message ----- From: "Joe Armstrong (AL/EAB)" > To do this I had to reverse engineer the Microsoft COFF format > which took me two weeks and was painful :-( Hi, May I ask why it is necessary to build executables? On any platform. Maybe I am missing the obvious, but wouldn't it be good enough to just be able to have the libraries packed in a more convenient way (i.e. as ear files)? I can't see any win in having them inside a DLL or EXE... best regards, Vlad From james.hague@REDACTED Wed Feb 16 20:39:19 2005 From: james.hague@REDACTED (James Hague) Date: Wed, 16 Feb 2005 13:39:19 -0600 Subject: standalone erlang In-Reply-To: References: Message-ID: >This is not "stand-alone" but does reduce >the total number of files needed significantly. The ideal here is: 1. Be able to give someone a single file. It can be an archive, like a zip, as long as the decompression in handled behind the scenes each time the program is run. 2. No writing to the registry or other global configuration files. From vlad_dumitrescu@REDACTED Wed Feb 16 21:18:28 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 16 Feb 2005 21:18:28 +0100 Subject: standalone erlang References: Message-ID: ----- Original Message ----- From: "James Hague" > 1. Be able to give someone a single file. It can be an archive, like > a zip, as long as the decompression in handled behind the scenes each > time the program is run. This can easily be done with an self-extracting archive. Just put (w)erl.exe and the .ear files inside, add also a .bat file that starts erl with all necessary arguments, configure the self-extracting archive to run that batch file when ran, and you're all set. No need to fiddle with MS specific formats or other things like that. regards, Vlad From vlad_dumitrescu@REDACTED Wed Feb 16 21:36:02 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 16 Feb 2005 21:36:02 +0100 Subject: standalone erlang References: Message-ID: To complete my own posting, there is a nice tool at http://www.info-zip.org/ that can be used to build self-extracting zip files, and it runs on most platforms too. /Vlad From james.hague@REDACTED Wed Feb 16 21:59:29 2005 From: james.hague@REDACTED (James Hague) Date: Wed, 16 Feb 2005 14:59:29 -0600 Subject: standalone erlang In-Reply-To: References: Message-ID: > This can easily be done with an self-extracting archive. Just put (w)erl.exe > and the .ear files inside, add also a .bat file that starts erl with all > necessary arguments, configure the self-extracting archive to run that batch > file when ran, and you're all set. But then you have all the decompressed files sitting around after you're done, which I don't want. Also, running the .bat file will bring up a console window. But you're right, it's a cheap way of making a faux installer. I'd still like to see a cleaner alternative. From vlad_dumitrescu@REDACTED Wed Feb 16 22:22:34 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 16 Feb 2005 22:22:34 +0100 Subject: standalone erlang References: Message-ID: > But then you have all the decompressed files sitting around after > you're done, which I don't want. "All" the files could be just very few: erl.exe, beam.dll (which might easily be compiled into one executable) and the libraries erlang.ear. The startup script could also clean up after itself. > Also, running the .bat file will bring up a console window. Yes, it might. There are ways to hide it. > But you're right, it's a cheap way of making a faux installer. I'd > still like to see a cleaner alternative. I also think it'd be cool. But the amount of work needed might be prohibitive. When Erlang will become as spread as Java, then the problem will dissapear because every sold PC will have Erlang installed :-) Hmmm, how do we sell the idea of "Erlang the Java killer" to Microsoft? It would have been easier before C# came... ;-) regards, Vlad From klacke@REDACTED Wed Feb 16 23:39:03 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Wed, 16 Feb 2005 23:39:03 +0100 Subject: standalone erlang In-Reply-To: References: <20050215155204.GA23340@hyber.org> <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> Message-ID: <20050216223903.GA7246@hyber.org> On Wed, Feb 16, 2005 at 08:06:03PM +0000, Sean Hinde wrote: > OK, this is what I did: > ..... Thanks Sean, /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From aho-erlang-questions@REDACTED Thu Feb 17 03:28:02 2005 From: aho-erlang-questions@REDACTED (Adrian Ho) Date: Thu, 17 Feb 2005 10:28:02 +0800 Subject: standalone erlang In-Reply-To: References: Message-ID: <20050217022802.GA28513@megapower.03s.net> On Wed, Feb 16, 2005 at 09:36:02PM +0100, Vlad Dumitrescu wrote: > To complete my own posting, there is a nice tool at > http://www.info-zip.org/ that can be used to build self-extracting zip > files, and it runs on most platforms too. The Tclkit model may be a better approach, though more difficult to implement. The keys there are: * a virtual file system (TclVFS) * a lightweight yet powerful database (Metakit) As a Tcl programmer who's now venturing into the Erlang realm, I've been bundling most of my previous work in Tclkits for end-user convenience. The only three down-sides I've seen are: * implementation effort (not sure how much it would take, but I suspect much code can be recycled from the Tclkit sources -- not sure about the legal aspects though) * executable size (but that's ameliorated with in-DB compression) * no general system support for loading DLLs from DB (the tclkit still has to extract the DLL to a file before loading) - Adrian From thomas.arts@REDACTED Thu Feb 17 08:35:54 2005 From: thomas.arts@REDACTED (Thomas Arts) Date: Thu, 17 Feb 2005 08:35:54 +0100 Subject: Erlang in Higher Education References: <76EEB38C72AE1D4EA2FE2753766EB51443ACFD@DAEMSG03.eur.ad.sag> Message-ID: <000c01c514c3$50177520$8b2f1081@ituniv525> Dear Thomas At the IT University of G?teborg (Sweden) we have an international bachelors and masters program. Both have a strong Erlang component in the program. There are also plenty of opportunities to specialize in Erlang related stuff and write a master thesis connected to hot Erlang research. Best regards Thomas --- Thomas Arts program manager Software Engineering and Management IT University of G?teborg Box 8718, 402 75 G?teborg, Sweden http://www.ituniv.se/ Tel +46 31 772 6031 Fax +46 31 772 4899 ----- Original Message ----- From: To: Sent: Wednesday, February 16, 2005 5:58 PM Subject: Erlang in Higher Education > Hi all! > > I'm considering going back to university for a year, and I'd love to > program Erlang during this time. > > Is anybody on this list aware of a higher eduction program that makes > use of Erlang? Something like an "MSc taught course" in informatics, > telco, network system administration etc. The college or university > should be in Europe, and the educational language should be English > (sorry, I'm not capable of Swedish or French :). > > Any hints? > > =Thomas > From sean.hinde@REDACTED Wed Feb 16 21:06:03 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 16 Feb 2005 20:06:03 +0000 Subject: standalone erlang In-Reply-To: <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> References: <20050215155204.GA23340@hyber.org> <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> Message-ID: OK, this is what I did: 1. Apply this patch to erts/emulator/Makefile.in to re-enable the SAE build 219c219 < all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) $(UNIX_ONLY_BUILDS) --- > all: generate erts_lib zlib $(BINDIR)/$(EMULATOR_EXECUTABLE) $(BINDIR)/$(EMULATOR_EXECUTABLE_SAE) $(UNIX_ONLY_BUILDS) 2. Run configure; make; make install as normal 3. cd to erts/boot/src and run make (after setting ERL_TOP) All the parts of sae are now built, but don't get installed automatically in the right places. beam_evm will be in $ERL_TOP/bin/powerpc-apple-darwin7.8.0, and this can be put anywhere - you need to distribute this with the apps elink, ecc, escript, ear, esh and friends are built in the erts/boot/src directory - they should be manually copied to where their links points to in the installation. erlang.ear is also in erts/boot/src and this also needs to be distributed with the apps. You will eventually need to manually edit the paths at the top of the elink etc executables to point to the location of beam_evm and the .ear files. For the minute they point to the installed ones (There is a tool to do this but I haven't quite got that far) A very minimal test program might look like this: -module(test). -export([start/1]). start(Args=[Bin,_|T]) -> erlang:display({"Args = ", T}), erlang:halt(). to compile and link do: ecc test.erl elink -t unix -d -o test -S test -m test.beam and run: ./test hello {"Args = ",[<<5 bytes>>]} I'll post my patch to the linker which allows for own ring0.erl another time Sean On 16 Feb 2005, at 08:39, Peter-Henry Mander wrote: > Hi Luke, hi Klacke, > > I'm also interested in SAE with R10B-3. If you do have a procedure to > enable SAE in the latest release, please let me know. As Luke seems to > imply, it makes acceptance of Erlang applications soo-o-o-o-oo much > easier when I don't have to install Erlang on the target machines. > > Pete. > > On 15 Feb 2005 17:49:34 +0100 > Luke Gorrie wrote: > >> klacke@REDACTED writes: >> >>> A very nice opportunity has just emerged where I >>> might be able to get erlang more into mainstream >>> Nortel sw development ... maybe ... >> >> Just shout to mbj. He made an SAE RPM out of our tcpdump-analyser that >> we sent to other Nortel people. Even packaged up etk into a >> jar^Wlibrary file and it worked great. >> >> IIRC they only wanted a windows version. :-) >> > > > -- > "The Tao of Programming > flows far away > and returns > on the wind of morning." From Thomas.Herchenroeder@REDACTED Thu Feb 17 10:24:29 2005 From: Thomas.Herchenroeder@REDACTED (Thomas.Herchenroeder@REDACTED) Date: Thu, 17 Feb 2005 10:24:29 +0100 Subject: Erlang in Higher Education Message-ID: <76EEB38C72AE1D4EA2FE2753766EB51443AD00@DAEMSG03.eur.ad.sag> Thanks for the responses so far. NB: The "picturization" of email addresses on the mailing list archive seems to be broken, at least in parts; see http://www.erlang.org/ml-archive/erlang-questions/200502/maillist.html http://www.erlang.org/ml-archive/erlang-questions/200502/msg00224.html =Thomas > -----Original Message----- > Sent: Wednesday, February 16, 2005 5:59 PM > Subject: Erlang in Higher Education > > > Hi all! > > I'm considering going back to university for a year, and I'd love to > program Erlang during this time. > > Is anybody on this list aware of a higher eduction program that makes > use of Erlang? Something like an "MSc taught course" in informatics, > telco, network system administration etc. The college or university > should be in Europe, and the educational language should be English > (sorry, I'm not capable of Swedish or French :). > > Any hints? > > =Thomas > From joe.armstrong@REDACTED Thu Feb 17 10:44:36 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Thu, 17 Feb 2005 10:44:36 +0100 Subject: standalone erlang Message-ID: The whole point of having a stand-alone thing is that you distribute ONE file I don't want that one file to explode into hundreds (or thousands) of files when I execute it I want it to *stay* one file. IMHO when you install a program on an OS you should move one file to the OS. When you remove the program you should remove ONE file. You should also <> obey the invarient - if you install something and then remove it the state of the system should be the same as it was before you installed it. (why almost? - the *only* allowed change might be changes in a log file saying that you'd installed uninstalled a program) If programs were distributed as single files and stayed that way then life would be a lot easier. As it is my disk gets cluttered with thousands of files and nobody knows which application owns them :-) This means that programs should include a self-modifying virtual system etc. If programs need to export things to other program they should do so with a well defined interface which does not leave a mess on my disk (mess = loads of files, registy entries etc.) Like the amazingly good tclkit /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Vlad Dumitrescu > Sent: den 16 februari 2005 21:36 > To: erlang-questions@REDACTED > Subject: Re: standalone erlang > > > To complete my own posting, there is a nice tool at > http://www.info-zip.org/ > that can be used to build self-extracting zip files, and it > runs on most > platforms too. > > /Vlad > From bengt.kleberg@REDACTED Thu Feb 17 10:53:57 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 17 Feb 2005 10:53:57 +0100 Subject: standalone erlang In-Reply-To: References: Message-ID: <421469B5.9050202@ericsson.com> Joe Armstrong (AL/EAB) wrote: > The whole point of having a stand-alone thing is that you distribute ONE file > > I don't want that one file to explode into hundreds (or thousands) of files when I execute it > I want it to *stay* one file. > > IMHO when you install a program on an OS you should move one file to the OS. When you > remove the program you should remove ONE file. distribute one file seems to be ok. but why insist upon one file after installation? imho, if all the thousand files are placed in one directory it looks like one file. and to remove the program it is sufficient to remove one directory. bengt From micke@REDACTED Thu Feb 17 11:57:43 2005 From: micke@REDACTED (Michael Fogeborg) Date: Thu, 17 Feb 2005 11:57:43 +0100 Subject: standalone erlang In-Reply-To: References: Message-ID: <6.2.1.2.0.20050217114631.0278ddf8@mail.online.no> Browsing through the sources last night I got the impression that the build process (i.e. building a SAE) could be done by only using the erlang-shell, since all code that is used in the process is erlang-code. ( Well, "Joe Armstrong" said in an earlier post that he did it using a "clean process"... ) So why is it that so much of the build is done using OS-dependent tools... ( except for historical reasons.. ? ) What am I missing ? E.g. must elink be packaged as an exe-file on windows in order to be used ? --- From aho-erlang-questions@REDACTED Thu Feb 17 13:17:16 2005 From: aho-erlang-questions@REDACTED (Adrian Ho) Date: Thu, 17 Feb 2005 20:17:16 +0800 Subject: standalone erlang In-Reply-To: <421469B5.9050202@ericsson.com> References: <421469B5.9050202@ericsson.com> Message-ID: <20050217121716.GA10790@megapower.03s.net> On Thu, Feb 17, 2005 at 10:53:57AM +0100, Bengt Kleberg wrote: > distribute one file seems to be ok. but why insist upon one file after > installation? > imho, if all the thousand files are placed in one directory it looks > like one file. and to remove the program it is sufficient to remove one > directory. I guess it really depends on your deployment environment (OS, HW, finicky users, etc.) and your business requirements. For instance, if the runtime environment in question had no filesystem, a standalone binary is pretty much your only choice. And if your customers aren't comfortable with your use of Erlang or any non-mainstream technology, a self-contained binary hides all the evidence. (I don't know about conditions in Europe, but around Asian parts, customers can get pretty nervous if they find out you're using some esoteric technology that even their in-house experts don't know diddly-squat about. Putting an exploded directory on their hard disks pretty much gives the game away.) Here's an example of why I would like to see a Tclkit-like deployment model in at least one implementation of Erlang. One project that I used it on was a multi-platform data visualization tool (Windows, Solaris and Linux) that was written by a third party. It started out as Joe's "thousand-file" scenario, which included the Tcl runtime+libs and several third-party libs (native code, pure Tcl, and everything in between). The original upgrade procedure was exactly what you described: Blow away the entire install directory, then unpack from an archive. Just as a lark, I decided to turn the entire directory into a starpack (ie. a single executable file containing the Tcl runtime and all the necessary application-specific stuff) and asked a couple of the end-users I dealt with regularly to "shake it down" and report any problems to me. My exact instructions to them were: "Just drop this file anywhere you want and run it." Not only were there zero problems, all three test binaries (for the different platforms) were quickly circulated round the organization to which I had contracted my services. From that point onwards, /nobody/ wanted to go back to the old application management method, and I was praised for having finally gotten rid of "all that trash". As a side benefit, everyone thought I'd recoded the entire application in C++ (it's a single binary, after all), and a recurring comment I got was "Hey, it runs faster now", even though I hadn't done a thing w.r.t. optimization. Whether the speedup was real or purely psychological, I'm not about to look this gift horse in the mouth. As I start looking at Erlang, and esp. at ejabberd, I'm thinking that it looks really cool, but I'm also wondering how I can get this in the customer's front door without them going "aw crap, back to the old days again?!" or "what the **** is Erlang, and why are you using it?" - Adrian From james.hague@REDACTED Thu Feb 17 15:47:34 2005 From: james.hague@REDACTED (James Hague) Date: Thu, 17 Feb 2005 08:47:34 -0600 Subject: standalone erlang In-Reply-To: <421469B5.9050202@ericsson.com> References: <421469B5.9050202@ericsson.com> Message-ID: > distribute one file seems to be ok. but why insist upon one file after > installation? > imho, if all the thousand files are placed in one directory it looks > like one file. and to remove the program it is sufficient to remove one > directory. It depends: Do you want there to be a difference between installation and just running the thing? Let's say I write a utility to parse through certain types of XML files. I want to give this utility to some people I work with. So I package it up and I give them a file. If they can just run the file from the command line--or double-click it or whatever--then that's great. It's exactly the same as if I had written a program in Perl or Python and used one of the available toolkits to roll the interpreter and script into a single executable. Now if they double click on the program and it unpacks itself into a folder in the current directory, then that's bad. It's a weird and silent behavior. Heck, why not just zip up the folder and give it to them in the first place? They they'll at least know that it has to be unzipped first. And if instead we throw up a prompt asking "Where do you want to unpack this?" then it's effectively an installer. Why doesn't it create a Start menu shortcut and uninstall information like other Windows installers do? A single executable is best. From bengt.kleberg@REDACTED Thu Feb 17 17:52:41 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 17 Feb 2005 17:52:41 +0100 Subject: standalone erlang In-Reply-To: References: <421469B5.9050202@ericsson.com> Message-ID: <4214CBD9.5030202@ericsson.com> James Hague wrote: ...deleted > It depends: Do you want there to be a difference between installation > and just running the thing? i think it is a trade off. i like things to be simple, but not only for the user, but also for the developer. the simplest thing for the user is a ''one file installation that is the executable''. if it is sufficiently simple for the developer to create such a beast, then i am all for it. however, if it is much simpler for the developer to have a selfextracting archive (that runs from the extracted directory if present), then i as a developer am willing to create the extra problem for the user. ...deleted > > Now if they double click on the program and it unpacks itself into a > folder in the current directory, then that's bad. It's a weird and > silent behavior. Heck, why not just zip up the folder and give it to > them in the first place? They they'll at least know that it has to be > unzipped first. And if instead we throw up a prompt asking "Where do > you want to unpack this?" then it's effectively an installer. Why > doesn't it create a Start menu shortcut and uninstall information like > other Windows installers do? yes it is bad, weird and silent. but simpler. i, and perhaps others, am willing to live with that amount of bad, weird and silent, provided the benefits are sufficient. if the selfextracting archive can run directly from the extracted directory (including directly after having extracted it the first time) then we are making things simpler for the user (compared to an extra installation step). if we can get rid of the whole installation by throwing the directory and archive, then it is simpler for the user than having an uninstalltion script. imho. > A single executable is best. you are correct. but i assume you know that worse is better :-) bengt From sean.hinde@REDACTED Thu Feb 17 18:02:53 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 17 Feb 2005 09:02:53 -0800 Subject: standalone erlang In-Reply-To: References: <20050215155204.GA23340@hyber.org> <20050216083952.0d9b955c.erlang@manderp.freeserve.co.uk> Message-ID: <16572807.1108659773424.JavaMail.sean.hinde@mac.com> Hi, On Thursday, February 17, 2005, at 01:13AM, Sean Hinde wrote: > >I'll post my patch to the linker which allows for own ring0.erl another >time > And here is the patch for the backdoor - exactly as originally written. The compiled ring0 must be called cli_ring0.beam and be located in the current directory. It should be quite straightforward to have this start up networking properly and whatever other services are required. In our case we just used prim_inet functions for the simple networking requirements of the app. --- otp_src_R10B-3/erts/boot/src/elink.erl Wed Oct 2 22:45:10 2002 +++ otp_src_R10B-1a/erts/boot/src/elink.erl Wed Dec 15 00:21:15 2004 @@ -102,9 +102,17 @@ mk_exec(dynamic, Os, Bin, Out, Start, Beams) -> {_StartMod, Dir, Bin1, _, BinSae} = binary_to_term(Bin), Extra = boot_tools:pack_beams(Beams), - B = term_to_binary({Start, Dir, Bin1, Extra, BinSae}, [compressed]), + BinSae1 = case file:read_file("cli_ring0.beam") of + {ok, Ring0_bin} -> + erlang:display(using_ring0), + Ring0_bin; + _ -> + erlang:display(using_normal), + BinSae + end, + B = term_to_binary({Start, Dir, Bin1, Extra, BinSae1}, [compressed]), EarDir = ear_dir(Dir), - boot_linker:link(Os, Out, [{"ERLANG_EARS", EarDir}], BinSae, B), + boot_linker:link(Os, Out, [{"ERLANG_EARS", EarDir}], BinSae1, B), true. ear_dir(Dir) -> <----------> The current cli_ring0.erl we are playing with is below - it starts an alternative shell environment: -module(cli_ring0). -export([start/1]). %% This is the first *ever* routine to get called. Taken from boot_tools.erl. Thanks Joe! start(Args=[Bin,_|T]) -> {StartMod, _Dir, Mods1, Mods2, _} = binary_to_term(Bin), Loaded = load_mods(Mods1) ++ load_mods(Mods2), erlang:display({code,handler,starting1}), boot_code_loader:startMeUp(), boot_code_loader:prim_loaded(Loaded), boot_code_loader:ensure_loaded(erl_open_port), boot_code_loader:ensure_loaded(user), %% tricky bit, this sets up a file system and IO user server %% up and running %% user:start(), %% G = whereis(user), %% group_leader(G, self()), %% io:format("IO is running ...\n"), file_server:start(), %% io:format("File server running ...\n"), erlang:display({"launching:",erlang:processes(), "with Args:",T,"~n"}), case (catch cli_user_drv:start()) of {'EXIT', _} -> erlang:halt(); R -> R end. load_mods([{Mod,Code}|T]) -> erlang:display({loading,Mod}), case erlang:load_module(Mod, Code) of {module,Mod} -> [Mod|load_mods(T)]; Other -> erlang:display({bad_module,Mod}), erlang:halt(-1) end; load_mods([]) -> []. <------------> Sean From ulf.wiger@REDACTED Thu Feb 17 19:06:22 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 17 Feb 2005 19:06:22 +0100 Subject: mnesia power index Message-ID: I thought I'd share a small hack I made to mnesia-4.2. The purpose of the hack was to make room for more flexible index functionality. You can now create an index in the following manner: mnesia:add_table_index(Tab, Pos :: integer() | atom()); mnesia:add_table_index(Tab, {{Pos,Tag}, M, F, Arg, IsOrdered}). Pos : integer() | atom() The attribute position or name, as with old-style indexes Tag : atom() A user-friendly tag; {Pos,Tag} uniquely identifies the index M : atom() Module name F : atom() Function name Arg : term() Extra argument IsOrdered : bool() true means an ordered index With the new syntax, you can have several indexes on a given attribute. A special case is if Pos == 1. Then the index works on the whole object. The index callback function is called like this: M:F(Data, Arg) -> [IndexValue]. Data is either the value of the given attribute, or the whole object, if Pos == 1. Multiple index values can be created for each object -- e.g. when breaking up a string into whole words. The old way works as before. You can also create both old and new indexes via the create_table/2 function. I've attached some modified mnesia files. In order to compile them, you need to make sure the compiler can locate mnesia.hrl (It's in mnesia-4.2/src/). It's 43K -- I hope the list server doesn't think that's too much. Functions like index_match_object() work only on old-style indexes, and you can not have an ordered index on a disc_only table, as dets doesn't support the ordered_set type. I've added the following functions. In the following, Index :: Pos | {Pos, Tag}; Pos :: atom() | integer(): - dirty_index_foldl(Fun,Acc,Tab,Index) - dirty_index_foldr(Fun,Acc,Tab,Index) - dirty_index_first(Tab, Index) - dirty_index_next(Tab, Index, Key) - dirty_index_prev(Tab, Index, Key) - dirty_index_last(Tab, Index) The first/next/last functions return {IndexValue, Objects} The fold[lr] functions call Fun({IndexValue, ObjKey, [Object]}, Acc) =:=:=:=:=:=:=:=:=:=:= So, what can you do with this? Well, lots. A few obvious uses are: - index on whole words - index on word stems (we'll try to demo this soon) - convert strings to lower case - index on attribute combinations (compound indexes) - perhaps even redo the snmp hook so that it doesn't have to be a special hack, requiring the primary key to be structured in a special way. Below are some examples. Please take it for a spin, and let me know what you think. Please note that I have no authority to put anything into mnesia, so if you like this stuff, you can help lobby for it. Regards, Uffe %%%%% First, a callback module with indexing functions: -module(test). -export([words/2, name/2]). -import(httpd_util, [to_lower/1]). words(Str, []) -> string:tokens(Str, " \t\n"); words(Str, locase) -> [to_lower(W) || W <- string:tokens(Str, " \t\n")]. name(Obj, [locase,FN,LN]) -> FirstName = element(FN, Obj), LastName = element(LN, Obj), [{to_lower(LastName), to_lower(FirstName)}]. %%%% Then, some shell interaction: =PROGRESS REPORT==== 17-Feb-2005::18:49:38 === application: mnesia started_at: nonode@REDACTED ok ** First, a simple index that splits a string into words: 3> mnesia:create_table(test,[{attributes,[key,ref,data]}]). {atomic,ok} 4> mnesia:add_table_index(test,{{data,words},test,words,[],true}). {atomic,ok} 5> mnesia:dirty_write({test,"uffe",ref1,"uffes words"}). ok 6> mnesia:dirty_write({test,"hans",ref1,"hanses words"}). ok 7> mnesia:dirty_write({test,"per",ref2,"pers word"}). ok 8> mnesia:dirty_index_read(test,"words",{data,words}). [{test,"hans",ref1,"hanses words"},{test,"uffe",ref1,"uffes words"}] 9> mnesia:dirty_index_read(test,"word",{data,words}). [{test,"per",ref2,"pers word"}] ** Just making sure that old indexes still work: 10> mnesia:add_table_index(test,ref). {atomic,ok} 11> mnesia:dirty_index_read(test,ref1,ref). [{test,"hans",ref1,"hanses words"},{test,"uffe",ref1,"uffes words"}] 12> mnesia:dirty_index_read(test,ref2,ref). [{test,"per",ref2,"pers word"}] ** Verifying that you can also delete indexes: 13> mnesia:del_table_index(test, {data,words}). {atomic,ok} 14> mnesia:del_table_index(test, ref). {atomic,ok} 15> 15> ** A bag table. These are tricky because you must filter ** out objects with the same key, but where the index fun ** doesn't produce a matching index value: 15> mnesia:create_table(testbag,[{type,bag},{attributes,[key,ref,data]}]). {atomic,ok} 16> mnesia:add_table_index(testbag,{{data,words},test,words,[],true}). {atomic,ok} 17> mnesia:dirty_write({testbag,uffe,ref1,"uffes words"}). ok 18> mnesia:dirty_write({testbag,hans,ref1,"hanses words"}). ok 19> mnesia:dirty_write({testbag,uffe,ref2,"pers word"}). ok 20> mnesia:dirty_index_read(testbag,"words",{data,words}). [{testbag,hans,ref1,"hanses words"},{testbag,uffe,ref1,"uffes words"}] 21> mnesia:dirty_index_read(testbag,"word",{data,words}). [{testbag,uffe,ref2,"pers word"}] 22> 22> ** Another small example, showing how to do case-insensitive ** index lookups, unordered index: 22> mnesia:create_table(test3,[{attributes,[key,data]}]). {atomic,ok} 23> mnesia:add_table_index(test3,{{data,words},test,words,locase,false}). {atomic,ok} 24> mnesia:dirty_write({test3,1,"The Quick Brown Fox"}). ok 25> mnesia:dirty_write({test3,2,"the quick brown fox"}). ok 26> mnesia:dirty_write({test3,3,"JUMPS OVER THE LAZY DOG"}). ok 27> mnesia:dirty_write({test3,4,"jumps over the lazy dog"}). ok 28> mnesia:dirty_index_read(test3,"fox",{data,words}). [{test3,2,"the quick brown fox"},{test3,1,"The Quick Brown Fox"}] 29> mnesia:dirty_index_read(test3,"the",{data,words}). [{test3,4,"jumps over the lazy dog"}, {test3,3,"JUMPS OVER THE LAZY DOG"}, {test3,2,"the quick brown fox"}, {test3,1,"The Quick Brown Fox"}] 30> mnesia:dirty_index_read(test3,"dog",{data,words}). [{test3,4,"jumps over the lazy dog"},{test3,3,"JUMPS OVER THE LAZY DOG"}] 31> 31> ** An example showing a compound case-insensitive, ordered index: 31> mnesia:create_table(test4,[{attributes,[key,firstname,lastname,data]}]). {atomic,ok} 32> mnesia:add_table_index(test4,{{1,name},test,name,[locase,3,4],true}). {atomic,ok} 33> mnesia:dirty_write({test4,1,"Ulf","Wiger","The Quick Brown Fox"}). ok 34> mnesia:dirty_write({test4,2,"Joe", "Armstrong","the quick brown fox"}). ok 35> mnesia:dirty_write({test4,3,"ulf", "wiger", "JUMPS OVER THE LAZY DOG"}). ok 36> mnesia:dirty_write({test4,4,"joe", "armstrong", "jumps over the lazy dog"}). ok 37> mnesia:dirty_index_read(test4,{"wiger","ulf"},{1,name}). [{test4,1,"Ulf","Wiger","The Quick Brown Fox"}, {test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}] 38> mnesia:dirty_index_read(test4,{"armstrong","joe"},{1,name}). [{test4,2,"Joe","Armstrong","the quick brown fox"}, {test4,4,"joe","armstrong","jumps over the lazy dog"}] ** Let's try the fold and iterator functions: 39> mnesia:dirty_index_foldr(fun({IdxKey,ObjKey,Objs} =X, Acc) -> [X|Acc] end, [], test4, {1,name}). [{{"armstrong","joe"},2,[{test4,2,"Joe","Armstrong","the quick brown fox"}]}, {{"armstrong","joe"}, 4, [{test4,4,"joe","armstrong","jumps over the lazy dog"}]}, {{"wiger","ulf"},1,[{test4,1,"Ulf","Wiger","The Quick Brown Fox"}]}, {{"wiger","ulf"},3,[{test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}]}] ** Oops! The following functions don't work right! 40> mnesia:dirty_index_first(test4,{1,name}). {{{"armstrong","joe"},2},[]} 41> mnesia:dirty_index_next(test4,{1,name},{{"armstrong","joe"},2}). {{{"armstrong","joe"},4},[]} ** They do work with old-style indexes, and should work with ** unordered indexes. I will fix this. 42> mnesia:add_table_index(test,ref). {atomic,ok} 43> mnesia:dirty_index_first(test,ref). {ref1,[{test,"hans",ref1,"hanses words"},{test,"uffe",ref1,"uffes words"}]} 44> mnesia:dirty_index_next(test,ref,ref1). {ref2,[{test,"per",ref2,"pers word"}]} 45> <> -------------- next part -------------- A non-text attachment was scrubbed... Name: mnesia_power_index.tgz Type: application/x-compressed Size: 43811 bytes Desc: mnesia_power_index.tgz URL: From ulf@REDACTED Thu Feb 17 21:14:00 2005 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 17 Feb 2005 21:14:00 +0100 Subject: mnesia power index In-Reply-To: References: Message-ID: Den 2005-02-17 19:06:22 skrev Ulf Wiger (AL/EAB) : > I thought I'd share a small hack I made to mnesia-4.2. > > The purpose of the hack was to make room for more > flexible index functionality. > > You can now create an index in the following manner: > > mnesia:add_table_index(Tab, Pos :: integer() | atom()); > mnesia:add_table_index(Tab, {{Pos,Tag}, M, F, Arg, IsOrdered}). > > Pos : integer() | atom() The attribute position or name, > as with old-style indexes > Tag : atom() A user-friendly tag; {Pos,Tag} > uniquely identifies the index > M : atom() Module name > F : atom() Function name > Arg : term() Extra argument > IsOrdered : bool() true means an ordered index > > With the new syntax, you can have several indexes on a given > attribute. A special case is if Pos == 1. Then the index works > on the whole object. > > The index callback function is called like this: > > M:F(Data, Arg) -> [IndexValue]. I should add a few comments: - If you use the new index functionality, and then try to start an unmodified mnesia-4.2 node on the same schema, mnesia will dump core. Perhaps this can be handled a bit better. - The index callbacks execute in the 'commit' phase, so there's no possibility to abort (this will cause mnesia to dump core). They simply have to work. Oh, and keep them side-effect free. /Uffe From anders.nygren@REDACTED Fri Feb 18 00:17:43 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 17 Feb 2005 17:17:43 -0600 Subject: xmerl and ISO-8859-1, ISO-Latin-1 Message-ID: I have been trying to use xmerl to read some xml files that start with Erlang (BEAM) emulator version 5.4 [source] [hipe] 3> xmerl_scan:file("xml-callejero.txt"). ** exited: {bad_character_code,"\r\n \r\n\r\n\r\nFord \r\n
Av. Universidad No. 1005 Esq. Jose Maria Rico
\r\nDel Valle \r\n52000900 \r\n03100 \r\n3726 \r\n
\r\n\r\nMayoreo paraFord, S.A. de C.V. \r\n
Municipio Libre No. 143 Int. 1
\r\nPortales \r\n56744463 \r\n03300 \r\n4861 \r\n
\r\n\r\nWalletin Crawford Dr. \r\n
Viaducto Miguel Aleman No. 228 Int. 201
\r\nEscandon \r\n55368525 \r\n11800 \r\n4871 \r\n
\r\n\r\nWalletin Crawford Dr. \r\n
Viaducto Miguel Aleman No. 228 Int. 201
\r\nEscandon \r\n55368789 \r\n11800 \r\n4871 \r\n
\r\n
\r\n\r\n \r\n0 \r\n5 \r\n\r\n
\r\n", 'iso-8859-8'} ** I dont know much about neither xml nor the finer details of character codes, but I have two questions 1, Is ISO-Latin-1 not supported? 2, Why does xmerl complains about 'iso-8859-8' when it is "ISO-8859-1" in the header? Can anyone shed some light on this, is it a bug or is it a feature I dont understand? /Anders Nygren From anders.nygren@REDACTED Fri Feb 18 01:26:36 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 17 Feb 2005 18:26:36 -0600 Subject: xmerl and ISO-8859-1, ISO-Latin-1 In-Reply-To: References: Message-ID: On Thu, 17 Feb 2005 17:17:43 -0600, Anders Nygren wrote: > I have been trying to use xmerl to read some xml files that start with > > > > Erlang (BEAM) emulator version 5.4 [source] [hipe] > > 3> xmerl_scan:file("xml-callejero.txt"). > > ** exited: {bad_character_code,"\r\n value=\"4\" /> \r\n\r\n lat=\"19.37835503\" id=\"153737\">\r\nFord > \r\n
Av. Universidad No. 1005 Esq. Jose Maria Rico
> \r\nDel Valle > \r\n52000900 \r\n03100 > \r\n3726 \r\n
\r\n long=\"-99.14178467\" lat=\"19.36811829\" > id=\"175048\">\r\nMayoreo paraFord, S.A. de C.V. > \r\n
Municipio Libre No. 143 Int. > 1
\r\nPortales > \r\n56744463 \r\n03300 > \r\n4861 \r\n
\r\n long=\"-99.17591095\" lat=\"19.39871407\" > id=\"202063\">\r\nWalletin Crawford Dr. > \r\n
Viaducto Miguel Aleman No. 228 Int. 201
> \r\nEscandon > \r\n55368525 \r\n11800 > \r\n4871 \r\n
\r\n long=\"-99.17591095\" lat=\"19.39871407\" > id=\"202064\">\r\nWalletin Crawford Dr. > \r\n
Viaducto Miguel Aleman No. 228 Int. 201
> \r\nEscandon > \r\n55368789 \r\n11800 > \r\n4871 > \r\n
\r\n
\r\n\r\n > \r\n0 \r\n5 > \r\n\r\n
\r\n", > 'iso-8859-8'} ** > > I dont know much about neither xml nor the finer details of character codes, > but I have two questions > 1, Is ISO-Latin-1 not supported? > 2, Why does xmerl complains about 'iso-8859-8' when it is "ISO-8859-1" in > the header? > > Can anyone shed some light on this, is it a bug or is it a feature I > dont understand? > > /Anders Nygren > Sorry, I made a mistake here, so forget about question 2. Its my testing that has confused me. But I still have the problem that it does not want to accept it. If I change to encoding="utf-8" it works. Anders Nygren From ok@REDACTED Fri Feb 18 03:37:38 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 18 Feb 2005 15:37:38 +1300 (NZDT) Subject: standalone erlang Message-ID: <200502180237.j1I2bcJO385468@atlas.otago.ac.nz> I note that on MacOS X applications are directories. For example, 'Squeak 3.6.1Beta5.app' is a directory containing about two dozen files (most in subdirectories). From the command line, I can detect this. But from the GUI, what you *see* is one thing; double click on it to look inside and you start the application. Even in a file list, it shows up as an "Application", not a "Folder". Even something like the standard 'TextEdit' utility turns out to be a directory containing a little over a thousand files in subdirectories. Why should I, as a Mac user, know or care about this? Answer: as a Mac user, I DON'T know and I DON'T care. From bill.mill@REDACTED Fri Feb 18 04:25:18 2005 From: bill.mill@REDACTED (Bill Mill) Date: Thu, 17 Feb 2005 22:25:18 -0500 Subject: Beginner OTP question Message-ID: <797fe3d405021719252b44fd13@mail.gmail.com> Hey everyone, all I want to do is get a very simple example of two erlang processes talking to each other. The only additional complication is that I want one of them to be a gen_server. I have written a minimal OTP gen_server that looks like: %%%%%%%%%%% myserver.erl %%%%%%%%%% -module(myserver). -behaviour(gen_server). -export([start/0, init/1, send/0, handle_call/3]). start() -> gen_server:start({global, myserver}, myserver, [], []). init(_Args) -> {ok, ""}. send() -> gen_server:call(myserver, send). handle_call(send, From, _State) -> io:format("send called from ~p", [From]), {reply, "Thanks for calling", ""}. %%%%%%%% end myserver.erl %%%%%%%%% and then started it like: %%%%%%%%%%%% /c/code/erlang/myserver$ erl -sname hello Erlang (BEAM) emulator version 5.4.3 [source] [hipe] Eshell V5.4.3 (abort with ^G) (hello@REDACTED)1> myserver:start(). {ok,<0.37.0>} %%%%%%%%%%%% How would I go about starting another process and getting it to communicate with this server? Here's what I expect to work, which obviously doesn't: %%%%%%%%%%%% /c/code/erlang/test$ erl -sname gbye Erlang (BEAM) emulator version 5.4.3 [source] [hipe] Eshell V5.4.3 (abort with ^G) (gbye@REDACTED)1> {myserver, myserver@REDACTED} ! send. send %%%%%%%%%%%% Am i missing something fundamental here? How could I get "gbye" to talk to "hello"? Is there something wrong with the server? Peace Bill Mill bill.mill at gmail.com From serge@REDACTED Fri Feb 18 04:53:38 2005 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 17 Feb 2005 22:53:38 -0500 Subject: Beginner OTP question In-Reply-To: <797fe3d405021719252b44fd13@mail.gmail.com> References: <797fe3d405021719252b44fd13@mail.gmail.com> Message-ID: <421566C2.2070007@hq.idt.net> Bill, You should call the myserver:send() method from another process. If you modify slightly the printing statement in your handle_call(send, ...) procedure like this: io:format("~p - send called from ~p", [self(), From]), it'll be more apparent that From is a different process from the one running gen_server. The important distinction of init/1 and handle_call/3 from start/0 and send/0 is that the first two are required callbacks of gen_server, whereas the last two are the interface functions to be used by another process. Regards, Serge Bill Mill wrote: > Hey everyone, all I want to do is get a very simple example of two > erlang processes talking to each other. The only additional > complication is that I want one of them to be a gen_server. > > I have written a minimal OTP gen_server that looks like: > > %%%%%%%%%%% myserver.erl %%%%%%%%%% > -module(myserver). > > -behaviour(gen_server). > > -export([start/0, init/1, send/0, handle_call/3]). > > start() -> > gen_server:start({global, myserver}, myserver, [], []). > > init(_Args) -> > {ok, ""}. > > send() -> > gen_server:call(myserver, send). > > handle_call(send, From, _State) -> > io:format("send called from ~p", [From]), > {reply, "Thanks for calling", ""}. > %%%%%%%% end myserver.erl %%%%%%%%% > > and then started it like: > > %%%%%%%%%%%% > /c/code/erlang/myserver$ erl -sname hello > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > (hello@REDACTED)1> myserver:start(). > {ok,<0.37.0>} > %%%%%%%%%%%% > > How would I go about starting another process and getting it to > communicate with this server? Here's what I expect to work, which > obviously doesn't: > > %%%%%%%%%%%% > /c/code/erlang/test$ erl -sname gbye > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > (gbye@REDACTED)1> {myserver, myserver@REDACTED} ! send. > send > %%%%%%%%%%%% > > Am i missing something fundamental here? How could I get "gbye" to > talk to "hello"? Is there something wrong with the server? > > Peace > Bill Mill > bill.mill at gmail.com From vances@REDACTED Fri Feb 18 06:18:51 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 18 Feb 2005 00:18:51 -0500 Subject: Beginner OTP question In-Reply-To: <797fe3d405021719252b44fd13@mail.gmail.com> References: <797fe3d405021719252b44fd13@mail.gmail.com> Message-ID: <20050218051851.GL55871@frogman.motivity.ca> Bill, } gen_server:start({global, myserver}, myserver, [], []). ^^^^^^^^^^^^^^^^^ Global is not the normal way to register a process, it uses the global module. This is an entirely different registry than what is used locally for the processes on a node. You could send to it, from either the local or remote nodes, with one of these: (gbye@REDACTED)1> global:send(myserver, "Hello there!"). (gbye@REDACTED)2> global:whereis_name(myserver) ! "Hello there!". Registering it with the global module does not also register it with the normal registry locally. (hello@REDACTED)1> global:register_name(myserver, self()). (hello@REDACTED)2> myserver ! "Hello there!". =ERROR REPORT==== 18-Feb-2005::05:03:11 === Error in process <0.45.0> on node 'hello@REDACTED' with exit value: {badarg,... The syntax you tried to use is actually how you address a process known to be registered locally at a remote node (correcting the syntax): (gbye@REDACTED)2> {myserver, 'hello@REDACTED'} ! send. Now this wasn't going to work anyway. In your gen_server you have a handle_call/3 callback function expecting a 'send'. The handle_call/3 callback is called when a client calls gen_server:call/2. So what you wanted to do was: (hello@REDACTED)3> gen_server:call({global, myserver}, send). If you had wanted to use a normal send instead of the synchronous call then you would use the handle_info/2 callback function as that is where it will be handled. You won't be able to reply though. } send() -> } gen_server:call(myserver, send). So change your interface function to; send() -> gen_server:call({global, myserver}, send). And you can use it as (assuming the server code is loaded): (gbye@REDACTED)3> myserver:send(). -Vance From ulf@REDACTED Fri Feb 18 06:43:32 2005 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 18 Feb 2005 06:43:32 +0100 Subject: Beginner OTP question In-Reply-To: <797fe3d405021719252b44fd13@mail.gmail.com> References: <797fe3d405021719252b44fd13@mail.gmail.com> Message-ID: Den 2005-02-18 04:25:18 skrev Bill Mill : > send() -> > gen_server:call(myserver, send). You may want to parameterize this function, if you want to be able to send a message to another instance of the gen_server than the one running locally, for example: send(Node) -> gen_server:call({myserver, Node}, send). > %%%%%%%%%%%% > /c/code/erlang/myserver$ erl -sname hello > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > (hello@REDACTED)1> myserver:start(). > {ok,<0.37.0>} > %%%%%%%%%%%% > > How would I go about starting another process and getting it to > communicate with this server? Here's what I expect to work, which > obviously doesn't: > > %%%%%%%%%%%% > /c/code/erlang/test$ erl -sname gbye > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > Eshell V5.4.3 (abort with ^G) > (gbye@REDACTED)1> {myserver, myserver@REDACTED} ! send. > send > %%%%%%%%%%%% The node names are visible within parentheses in the Erlang shell prompt. So to reach the processs myserver on the "hello" node, you would have to write: {myserver, hello@REDACTED} ! send. But in your program, the myserver process expected a gen_server call, and that has a special format which gen_server:call/2 knows about. A {myserver, hello@REDACTED} ! send would not be recognized by the server as a gen_server call message and would in fact crash your server (the gen_server module would dispatch the unknown message to the funcion myserver:handle_info(Msg, State), which doesn't exist.) Given the parameterized send(Node) function above, you would instead write: myserver:send(hello@REDACTED). Hope this helps you get started. Make sure to also look in the 'getting started' and 'examples' sections at erlang.org. /Uffe From fritchie@REDACTED Fri Feb 18 07:30:00 2005 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 18 Feb 2005 00:30:00 -0600 Subject: Beginner OTP question In-Reply-To: Message of "Thu, 17 Feb 2005 22:25:18 EST." <797fe3d405021719252b44fd13@mail.gmail.com> Message-ID: <200502180630.j1I6U0oA071350@snookles.snookles.com> Here's a unified diff for one way (of several) to fix things up. I removed the bits trying to use global naming service. --- myserver.erl Thu Feb 17 23:29:49 2005 +++ myserver2.erl Thu Feb 17 23:28:56 2005 @@ -2,16 +2,16 @@ -behaviour(gen_server). --export([start/0, init/1, send/0, handle_call/3]). +-export([start/0, init/1, send/1, handle_call/3]). start() -> - gen_server:start({global, myserver}, myserver, [], []). + gen_server:start({local, myserver}, myserver, [], []). init(_Args) -> {ok, ""}. -send() -> - gen_server:call(myserver, send). +send(ServerID) -> + gen_server:call(ServerID, send). handle_call(send, From, _State) -> io:format("send called from ~p", [From]), Then, over on the gbye node, use this function call: myserver:send({myserver, hello@REDACTED}). On the hello node, you can use: myserver:send(myserver). myserver:send({myserver, node()}). myserver:send({myserver, hello@REDACTED}). If you'd started the server on hello using: {ok, MyServerPid} = myserver:start(). Then this would work, too: myserver:send(MyServerPid). Using the list_to_pid() function is generally frowned upon. Joe Armstrong would say that it allows you to violate the principle of a process's "unforgeable name", namely its process ID number. If you're not using a local naming scheme (as shown above) or a global naming scheme, either of which maps a well-known name to a process ID, the only way you're supposed to know a process ID is if someone else tells you what it is. list_to_pid() allows you to circumvent it. One handy trick with the shell is using the history mechanism. Here, at command number 12, I started the server but forgot to save the pid. But I can easily get the real, honest-to-goodness pid after the fact. (a@REDACTED)12> myserver:start(). {ok,<0.56.0>} (a@REDACTED)13> {ok, MyServerPid} = v(12). {ok,<0.56.0>} (a@REDACTED)14> myserver:send(MyServerPid). send called from {<0.50.0>,#Ref<0.0.0.94>}"Thanks for calling" In practice, you need someone with a well-known name to act as an introducer to help break the ice.(*) Otherwise, you wouldn't be able to communicate with anyone: you wouldn't know any pids at all! If over on the gbye node you said: (gbye@REDACTED)13> register(a_local_name, self()). true ... then the shell over on the hello node can easily send messages to the shell on gbye. On the hello node, use: (hello@REDACTED)17> {a_local_name, gbye@REDACTED} ! {ice_breaker, MyServerPid}. {ice_breaker,<0.56.0>} That uses the "!" notation to send a simple message over to a_local_name over on gbye@REDACTED(**) That message is waiting in the shell process's mailbox over on the other node. You can fetch it by: (gbye@REDACTED)19> receive {ice_breaker, Pid} -> Pid end. <6348.56.0> And then you can use it to call your gen_server process without relying on the local name registration scheme. (gbye@REDACTED)20> myserver:send(Pid). "Thanks for calling" You can do this same message passing stuff between Erlang nodes running on different UNIX/Windows/Mac/whatever machines.(****) -Scott (*) The only other way would be some kind of side communication channel. For example, if you could write a pid to a file and then have some other process read the file to get that pid. (**) "!" is not used to call a function, like you'd tried to do. "!" is the Erlang primitive to send a message to another process. The gen_server:call() function ends up using this notation to send the message, but it hides some additional details from you. So does the gen_server code receiving side. When using gen_server, you usually don't need to know the details. (***) I dunno where this file lives on a Windows platform, sorry. (****) It's common to run into a problem with an Erlang security mechanism: there's a file called ".erlang.cookie" that's placed in your UNIX home directory(***). If your machines don't have a common home directory (e.g. via NFS), then you'll have to copy one machine's ".erlang.cookie" file over to the other machine, then restart both Erlang nodes. From erik.ej.reitsma@REDACTED Fri Feb 18 09:11:30 2005 From: erik.ej.reitsma@REDACTED (Erik Reitsma EJ (RY/ETM)) Date: Fri, 18 Feb 2005 09:11:30 +0100 Subject: xmerl and ISO-8859-1, ISO-Latin-1 Message-ID: <110BA8ACEE682C479D0B008B6BE4AEB10C13F7@esealmw107.eemea.ericsson.se> Hi Anders and all, I had the same problem. xmerl does not accept all aliases for encodings. I had the problem with iso-8859-1. I think that the "canonical" name would be iso_8859-1, and xmerl accepts that. But it should also accept aliases like ISO-8859-1 and my iso-8859-1. I have patched my xmerl by adding this to line 350 of ucs.erl I reported it to erlang-bugs@REDACTED but I have not received a reply to that. Regards, *Erik. > On Thu, 17 Feb 2005 17:17:43 -0600, Anders Nygren > wrote: > > I have been trying to use xmerl to read some xml files that > start with > > > > > > > > Erlang (BEAM) emulator version 5.4 [source] [hipe] > > > > 3> xmerl_scan:file("xml-callejero.txt"). > > > > ** exited: {bad_character_code,"\r\n From mats.cronqvist@REDACTED Fri Feb 18 09:19:16 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 18 Feb 2005 09:19:16 +0100 Subject: standalone erlang In-Reply-To: <4214CBD9.5030202@ericsson.com> References: <421469B5.9050202@ericsson.com> <4214CBD9.5030202@ericsson.com> Message-ID: <4215A504.7060208@ericsson.com> Bengt Kleberg wrote: > [...] then i as a developer am willing to create the extra problem > for the user. but if the user (when encountered with "the extra problem") says; "i will not use this"? i think the point is that you, the developer, cannot decide how much trouble is too much. it doesn't really matter how much easier it is for you if noone wants to use your code. mats From keymon@REDACTED Fri Feb 18 10:30:34 2005 From: keymon@REDACTED (=?iso-8859-1?q?H=E9ctor_Rivas_G=E1ndara?=) Date: Fri, 18 Feb 2005 10:30:34 +0100 Subject: A Pythonista's Impressions of Erlang In-Reply-To: References: <20050112142953.68607.qmail@web41904.mail.yahoo.com> <871xcpd53y.fsf@pingviini.kortex.jyu.fi> Message-ID: <200502181030.34846.keymon@wanadoo.es> El Jueves, 13 de Enero de 2005 13:37, Bjorn Gustavsson escribi?: > I have corrected the broken links. Other broken links are in jinterface documentation for R10, in the links to javadoc pages: http://www.erlang.se/doc/doc-5.4/lib/jinterface-1.3/doc/html/jinterface_users_guide.html#1.1 links points to .html.html files instead .html -- Greets From olivier.sambourg@REDACTED Fri Feb 18 10:34:04 2005 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Fri, 18 Feb 2005 10:34:04 +0100 Subject: Erlang mode for SubEthaEdit Message-ID: Hi everyone I thought it might interest some of you : I've made a (quick) erlang mode for SubEthaEdit (MacOS X app), using the erlang vim mode as a reference. It is available on the SEE website : http://www.codingmonkeys.de/subethaedit/modes.html It's not perfect (couple of bugs already identified) but better than nothing. Colors can be set manually, according to your tastes and needs (in SEE preferences). Hope it'll be useful for some of you ;) -- Olivier From bengt.kleberg@REDACTED Fri Feb 18 11:08:42 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 18 Feb 2005 11:08:42 +0100 Subject: standalone erlang In-Reply-To: <200502180237.j1I2bcJO385468@atlas.otago.ac.nz> References: <200502180237.j1I2bcJO385468@atlas.otago.ac.nz> Message-ID: <4215BEAA.1010701@ericsson.com> Richard A. O'Keefe wrote: > I note that on MacOS X applications are directories. this is an improvment of what i descibed as good enough. it is dependent upon help from the operating/window system. if all development tools allowed the creation of a single file delivery then it would not be needed. imho it is simpler to have the operating/window system hide application directories, than it is to have all development tools do the job. bengt From thomasl_erlang@REDACTED Fri Feb 18 11:11:57 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 18 Feb 2005 02:11:57 -0800 (PST) Subject: standalone erlang In-Reply-To: <4214CBD9.5030202@ericsson.com> Message-ID: <20050218101158.85222.qmail@web41907.mail.yahoo.com> --- Bengt Kleberg wrote: > i think it is a trade off. i like things to be > simple, but not only for > the user, but also for the developer. > the simplest thing for the user is a ''one file > installation that is the > executable''. > if it is sufficiently simple for the developer to > create such a beast, > then i am all for it. I think it depends. If your users are naive, or have a merely casual interest in your program, then a painless "single-binary" distribution might also save you from a lot of whining later, even if it requires more work up front. Often a good thing if you find yourself in that situation :-) (An installation which also can be cleanly uninstalled is, of course, appreciated by many. The Windows way seems to be not to go without a fight, though.) I would definitely agree that _requiring_ a messy procedure for delivering a system is less attractive. Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com From bengt.kleberg@REDACTED Fri Feb 18 11:18:12 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 18 Feb 2005 11:18:12 +0100 Subject: standalone erlang Message-ID: <4215C0E4.7090707@ericsson.com> Mats Cronqvist wrote: ...deleted > but if the user (when encountered with "the extra problem") says; "i will not use this"? i think the point is that you, the developer, cannot decide how much trouble is too much. just to be sure that we mean the same thing: can not decide how much trouble is too much _for the user_. > it doesn't really matter how much > easier it is for you if noone wants to use your code. this is true. a developer could write/test until the code is perfect and would not cause even a single user to abstain from using it. i do not do this :-) bengt From bertil@REDACTED Fri Feb 18 12:45:33 2005 From: bertil@REDACTED (Bertil Karlsson) Date: Fri, 18 Feb 2005 12:45:33 +0100 Subject: [Fwd: Re: xmerl and ISO-8859-1, ISO-Latin-1] Message-ID: <4215D55D.2050405@erix.ericsson.se> I sent this earlier, but it didn't receive the list. /Bertil -------------- next part -------------- An embedded message was scrubbed... From: Bertil Karlsson Subject: Re: xmerl and ISO-8859-1, ISO-Latin-1 Date: Fri, 18 Feb 2005 09:11:22 +0100 Size: 3477 URL: From ulf.wiger@REDACTED Fri Feb 18 13:02:35 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 18 Feb 2005 13:02:35 +0100 Subject: mnesia power index Message-ID: Ulf Wiger (AL/EAB) wrote: > ** Oops! The following functions don't work right! > > 40> mnesia:dirty_index_first(test4,{1,name}). > {{{"armstrong","joe"},2},[]} > 41> mnesia:dirty_index_next(test4,{1,name},{{"armstrong","joe"},2}). > {{{"armstrong","joe"},4},[]} > > ** They do work with old-style indexes, and should work with > ** unordered indexes. I will fix this. Now fixed. If anyone wants a patch, let me know. Alternating next and prev on a bag table yields very strange results - so using these functions on an unordered index (at least when stepping back and forth) can sometimes cause surprises. I will not attempt to fix this. 139> mnesia:dirty_index_first(test4,{1,name}). {{{"armstrong","joe"},4}, [{test4,2,"Joe","Armstrong","the quick brown fox"}, {test4,4,"joe","armstrong","jumps over the lazy dog"}]} 140> mnesia:dirty_index_last(test4,{1,name}). {{{"wiger","ulf"},3}, [{test4,1,"Ulf","Wiger","The Quick Brown Fox"}, {test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}]} 141> mnesia:dirty_index_next(test4,{1,name},element(1,v(139))). {{{"wiger","ulf"},3}, [{test4,1,"Ulf","Wiger","The Quick Brown Fox"}, {test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}]} 142> mnesia:dirty_index_next(test4,{1,name},element(1,v(141))). '$end_of_table' 143> mnesia:dirty_index_prev(test4,{1,name},element(1,v(140))). {{{"armstrong","joe"},4}, [{test4,2,"Joe","Armstrong","the quick brown fox"}, {test4,4,"joe","armstrong","jumps over the lazy dog"}]} 144> mnesia:dirty_index_prev(test4,{1,name},element(1,v(143))). '$end_of_table' > - The index callbacks execute in the 'commit' phase, so there's > no possibility to abort (this will cause mnesia to dump core). > They simply have to work. Oh, and keep them side-effect free. I decided to address this with a function: mnesia_index:test_index_fun(Tab, Index, Object) (The function returns whatever the indexing callback returns, or exits if the callback exits.) and also the sometimes more convenient function: mnesia_index:test_indexes(Tab, Object) -> ok (verifies that each index function returns a list of values for the given object.) By calling this within the transaction, you should get a transaction abort rather than a nasty crash during commit. I thought I'd build this into 'rdbms' if the functionality actually becomes incorporated into mnesia. Then, it will be transparent to users of 'rdbms'. BTW, the functions work for all index types, not just callbacks. /Uffe From vlad_dumitrescu@REDACTED Fri Feb 18 13:13:52 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 18 Feb 2005 13:13:52 +0100 Subject: standalone erlang References: <20050218101158.85222.qmail@web41907.mail.yahoo.com> Message-ID: ----- Original Message ----- From: "Thomas Lindgren" > I think it depends. If your users are naive, or have a > merely casual interest in your program, then a > painless "single-binary" distribution might also save > you from a lot of whining later, even if it requires > more work up front. Often a good thing if you find > yourself in that situation :-) There is also one downside for having such single-binary tools: what if there is one such a tool every day (maybe new versions of the same base tool), and the binaries are like 10-15MB big because the libraries have to be distributed every time? It may be a problem. I'd like to suggest another variant: in a LAN environment, the libraries might be made available via the network. Not for download, but for the code loader. regards, Vlad From vlad_dumitrescu@REDACTED Fri Feb 18 13:38:33 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 18 Feb 2005 13:38:33 +0100 Subject: standalone erlang References: Message-ID: ----- Original Message ----- From: "Joe Armstrong (AL/EAB)" > The whole point of having a stand-alone thing is that you distribute ONE file Oh, and there's another issue: how would you distribute drivers inside the same executable? Well, yes, the code can be packed as any other resource, but in order to make it loadable and runnable, I think most OSs would want it in a .dll or .so file. So you'll have to create some temporary files anyway. regards, Vlad From bill.mill@REDACTED Fri Feb 18 14:06:12 2005 From: bill.mill@REDACTED (Bill Mill) Date: Fri, 18 Feb 2005 08:06:12 -0500 Subject: Beginner OTP question In-Reply-To: References: <797fe3d405021719252b44fd13@mail.gmail.com> Message-ID: <797fe3d405021805061fb04c9@mail.gmail.com> On Fri, 18 Feb 2005 06:43:32 +0100, Ulf Wiger wrote: > Den 2005-02-18 04:25:18 skrev Bill Mill : > > > > send() -> > > gen_server:call(myserver, send). > > You may want to parameterize this function, if > you want to be able to send a message to another > instance of the gen_server than the one running > locally, for example: > > send(Node) -> > gen_server:call({myserver, Node}, send). > starting to make sense now... > > %%%%%%%%%%%% > > /c/code/erlang/myserver$ erl -sname hello > > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > > > Eshell V5.4.3 (abort with ^G) > > (hello@REDACTED)1> myserver:start(). > > {ok,<0.37.0>} > > %%%%%%%%%%%% > > > > How would I go about starting another process and getting it to > > communicate with this server? Here's what I expect to work, which > > obviously doesn't: > > > > %%%%%%%%%%%% > > /c/code/erlang/test$ erl -sname gbye > > Erlang (BEAM) emulator version 5.4.3 [source] [hipe] > > > > Eshell V5.4.3 (abort with ^G) > > (gbye@REDACTED)1> {myserver, myserver@REDACTED} ! send. > > send > > %%%%%%%%%%%% > > The node names are visible within parentheses in the > Erlang shell prompt. So to reach the processs myserver > on the "hello" node, you would have to write: > > {myserver, hello@REDACTED} ! send. > > But in your program, the myserver process expected > a gen_server call, and that has a special format > which gen_server:call/2 knows about. > I figured that it did, I just couldn't figure out what it was. Seeing that it's just a gen_server call is (I think, I can't test until after work) the key insight I was looking for. > A {myserver, hello@REDACTED} ! send would not be > recognized by the server as a gen_server call message > and would in fact crash your server (the gen_server > module would dispatch the unknown message to the > funcion myserver:handle_info(Msg, State), which doesn't > exist.) > > Given the parameterized send(Node) function above, > you would instead write: > > myserver:send(hello@REDACTED). > I probably tried about a thousand variations on this (without the parameterized send() function, obviously) before I settled on trying to send a signal with ! . > Hope this helps you get started. > Make sure to also look in the 'getting started' and > 'examples' sections at erlang.org. > I hope so too. As I said, can't test until after work, but I think I understand a lot more now. I don't like to ask questions, and I've probably read the 'getting started' section more times than anyone by now. That and the gen_server section of the OTP design principles page, I could probably recite in my sleep. It would have been really helpful to me if there had been a really simple OTP server example *that worked*. The one given in the gen_server section of the OTP design principles document isn't even vaguely close to compiling. Instead, I was left trying to distill how OTP worked from the httpd module. I plan to write up my really simple OTP server on my blog, so maybe it'll help others in a similar situation. Thanks a lot for the help. Peace Bill Mill bill.mill at gmail.com From bill.mill@REDACTED Fri Feb 18 14:21:51 2005 From: bill.mill@REDACTED (Bill Mill) Date: Fri, 18 Feb 2005 08:21:51 -0500 Subject: Beginner OTP question In-Reply-To: <200502180630.j1I6U0oA071350@snookles.snookles.com> References: <797fe3d405021719252b44fd13@mail.gmail.com> <200502180630.j1I6U0oA071350@snookles.snookles.com> Message-ID: <797fe3d405021805214e428c26@mail.gmail.com> On Fri, 18 Feb 2005 00:30:00 -0600, Scott Lystig Fritchie wrote: > Here's a unified diff for one way (of several) to fix things up. I > removed the bits trying to use global naming service. > > --- myserver.erl Thu Feb 17 23:29:49 2005 > +++ myserver2.erl Thu Feb 17 23:28:56 2005 > @@ -2,16 +2,16 @@ > > -behaviour(gen_server). > > --export([start/0, init/1, send/0, handle_call/3]). > +-export([start/0, init/1, send/1, handle_call/3]). > > start() -> > - gen_server:start({global, myserver}, myserver, [], []). > + gen_server:start({local, myserver}, myserver, [], []). Is the difference between global and local registration that local registration only occurs on the current node, while global registration occurs on every node in a distributed system? Is this documented anywhere else besides the global man page? The reference manual mentions it but doesn't (AFAICT) describe its use too well. > > init(_Args) -> > {ok, ""}. > > -send() -> > - gen_server:call(myserver, send). > +send(ServerID) -> > + gen_server:call(ServerID, send). > gotcha; Ulf got me understanding this a lot better > handle_call(send, From, _State) -> > io:format("send called from ~p", [From]), > > Then, over on the gbye node, use this function call: > > myserver:send({myserver, hello@REDACTED}). > beautiful. Like I told Ulf, this is the basic way that I was trying variations on before I gave up and tried ! . > On the hello node, you can use: > > myserver:send(myserver). > myserver:send({myserver, node()}). > myserver:send({myserver, hello@REDACTED}). > > If you'd started the server on hello using: > > {ok, MyServerPid} = myserver:start(). > > Then this would work, too: > > myserver:send(MyServerPid). > > Using the list_to_pid() function is generally frowned upon. Joe > Armstrong would say that it allows you to violate the principle of a > process's "unforgeable name", namely its process ID number. If you're > not using a local naming scheme (as shown above) or a global naming > scheme, either of which maps a well-known name to a process ID, the > only way you're supposed to know a process ID is if someone else tells > you what it is. list_to_pid() allows you to circumvent it. > > One handy trick with the shell is using the history mechanism. Here, > at command number 12, I started the server but forgot to save the > pid. But I can easily get the real, honest-to-goodness pid after the > fact. > > (a@REDACTED)12> myserver:start(). > {ok,<0.56.0>} > (a@REDACTED)13> {ok, MyServerPid} = v(12). > {ok,<0.56.0>} > (a@REDACTED)14> myserver:send(MyServerPid). > send called from {<0.50.0>,#Ref<0.0.0.94>}"Thanks for calling" > cool, thanks. > In practice, you need someone with a well-known name to act as an > introducer to help break the ice.(*) Otherwise, you wouldn't be able to > communicate with anyone: you wouldn't know any pids at all! > I was gonna cross that bridge when I got there : ) > If over on the gbye node you said: > > (gbye@REDACTED)13> register(a_local_name, self()). > true > > ... then the shell over on the hello node can easily send messages to > the shell on gbye. On the hello node, use: > > (hello@REDACTED)17> {a_local_name, gbye@REDACTED} ! {ice_breaker, MyServerPid}. > {ice_breaker,<0.56.0>} > > That uses the "!" notation to send a simple message over to > a_local_name over on gbye@REDACTED(**) > > That message is waiting in the shell process's mailbox over on the > other node. You can fetch it by: > > (gbye@REDACTED)19> receive {ice_breaker, Pid} -> Pid end. > <6348.56.0> > > And then you can use it to call your gen_server process without > relying on the local name registration scheme. > > (gbye@REDACTED)20> myserver:send(Pid). > "Thanks for calling" > I think I pretty well understood this from the 'getting started' section of the manual (although more understanding always helps). Where I was falling down was in how to communicate with the OTP gen_server. > You can do this same message passing stuff between Erlang nodes > running on different UNIX/Windows/Mac/whatever machines.(****) > > -Scott > > (*) The only other way would be some kind of side communication > channel. For example, if you could write a pid to a file and then > have some other process read the file to get that pid. > > (**) "!" is not used to call a function, like you'd tried to do. "!" > is the Erlang primitive to send a message to another process. > It would send an atom to the process. I was desperately trying things to make the gen_server listen to what I was sending it; one of my thoughts was that maybe it would dispatch a function based the name of an atom it received. > The gen_server:call() function ends up using this notation to > send the message, but it hides some additional details from you. So > does the gen_server code receiving side. When using gen_server, you > usually don't need to know the details. > > (***) I dunno where this file lives on a Windows platform, sorry. > > (****) It's common to run into a problem with an Erlang security > mechanism: there's a file called ".erlang.cookie" that's placed in > your UNIX home directory(***). If your machines don't have a common > home directory (e.g. via NFS), then you'll have to copy one machine's > ".erlang.cookie" file over to the other machine, then restart both > Erlang nodes. > I've got the cookie set up correctly. I had passed messages before, but couldn't understand how to make it work with gen_server. Peace Bill Mill bill.mill at gmail.com From thomasl_erlang@REDACTED Fri Feb 18 14:30:52 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 18 Feb 2005 05:30:52 -0800 (PST) Subject: standalone erlang In-Reply-To: Message-ID: <20050218133052.60078.qmail@web41905.mail.yahoo.com> --- Vlad Dumitrescu wrote: > I'd like to suggest another variant: in a LAN > environment, the libraries might > be made available via the network. Not for download, > but for the code loader. You can always try "erl -loader inet -hosts ...". (I hasten to say I never have :-) Though the problem with internet scale deployment would really be whether you can trust the code you are loading, as mentioned to me yesterday by someone who shall only be known as "Sean". Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 From vlad_dumitrescu@REDACTED Fri Feb 18 14:54:53 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 18 Feb 2005 14:54:53 +0100 Subject: standalone erlang References: <20050218133052.60078.qmail@web41905.mail.yahoo.com> Message-ID: ----- Original Message ----- From: "Thomas Lindgren" > Though the problem with internet scale deployment > would really be whether you can trust the code you are > loading, as mentioned to me yesterday by someone who > shall only be known as "Sean". Of course, that's why I said "In a LAN environment". But in practice, whether if someone hands you a huge executable, or a smaller one and some parts get downloaded at run-time - you still have to trust that person. Viruses can spread via floppy-disks too ;-) regards, Vlad From ulf.wiger@REDACTED Fri Feb 18 14:59:36 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 18 Feb 2005 14:59:36 +0100 Subject: trouble building OTP R10B-3 Message-ID: I have some difficulty building R10B-3 on my machine. Some of the trouble seems to be recent changes in our environment that I have not yet fully understood. But perhaps someone can shed some light on the following? The build command for erts/emulator/drivers/common/gzio.c looked like this in R10B-2 (I've added some line breaks.) It worked: gcc -g -O2 -I/home/etxuwig/OSE/otp_src_R10B-2_reg_mi/erts/sparc-sun-solaris2.8 -DHYBRID -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wa,-xarch=v8plusa -Ibeam -Isys/unix -Isys/common -Isparc-sun-solaris2.8 -Isparc-sun-solaris2.8/hybrid -Izlib -Ihipe -Idrivers/common -Idrivers/unix -c drivers/common/gzio.c -o /...r10b-2/erts/obj.hybrid.beam/sparc-sun-solaris2.8/gzio.o The build command for the same file (gzio.c was unchanged) in R10B-3 (same shell, same environment) looked like this, and did not go well: gcc -g -I/home/etxuwig/OSE/otp_src_R10B-3_reg_mi/erts/sparc-sun-solaris2.8 -DHYBRID -DHAVE_CONFIG_H -Wa,-xarch=v8plusa -Ibeam -Isys/unix -Isys/common -Isparc-sun-solaris2.8 -Isparc-sun-solaris2.8/hybrid -Izlib -Ihipe -I../include/internal -I../include/internal/sparc-sun-solaris2.8 -Idrivers/common -Idrivers/unix -c drivers/common/gzio.c -o /...r10b-3/erts/obj.hybrid.beam/sparc-sun-solaris2.8/gzio.o .beam/sparc-sun-solaris2.8/gzio.o drivers/common/gzio.c: In function `gz_open': drivers/common/gzio.c:162: conflicting types for `fread' /usr/include/iso/stdio_iso.h:206: previous declaration of `fread' drivers/common/gzio.c:162: warning: extern declaration of `fread' doesn't match global one drivers/common/gzio.c:164: warning: assignment from incompatible pointer type /Uffe From james.hague@REDACTED Fri Feb 18 15:40:57 2005 From: james.hague@REDACTED (James Hague) Date: Fri, 18 Feb 2005 08:40:57 -0600 Subject: standalone erlang In-Reply-To: References: <20050218101158.85222.qmail@web41907.mail.yahoo.com> Message-ID: On Fri, 18 Feb 2005 13:13:52 +0100, Vlad Dumitrescu wrote: > > There is also one downside for having such single-binary tools: what if there is > one such a tool every day (maybe new versions of the same base tool), and the > binaries are like 10-15MB big because the libraries have to be distributed every > time? It may be a problem. Yes, and I think single-binary tools only make sense for small to medium-sized utilities. You wouldn't want to distribute a huge application that way. But small to medium-sized utilities are oh so common and useful! From aho-erlang-questions@REDACTED Fri Feb 18 15:29:11 2005 From: aho-erlang-questions@REDACTED (Adrian Ho) Date: Fri, 18 Feb 2005 22:29:11 +0800 Subject: standalone erlang In-Reply-To: References: Message-ID: <20050218142909.GA18571@megapower.03s.net> On Fri, Feb 18, 2005 at 01:38:33PM +0100, Vlad Dumitrescu wrote: > ----- Original Message ----- > From: "Joe Armstrong (AL/EAB)" > > The whole point of having a stand-alone thing is that you distribute ONE file > > Oh, and there's another issue: how would you distribute drivers inside the same > executable? Well, yes, the code can be packed as any other resource, but in > order to make it loadable and runnable, I think most OSs would want it in a .dll > or .so file. So you'll have to create some temporary files anyway. Both the points you make aren't new: I specifically mentioned them in my original analysis of Tclkit. There are also obvious, though not universally-acceptable answers[*] for them, but I get the sense that this thread is straying from how-to-do-it to why-do-it, and that the SFE-is-a-horrible-idea camp is somewhat more vocal. 8-) As a newcomer to Erlang, I suspect my ability to add real value to this thread is almost at an end, though if anyone wishes to continue discussing how an good solid Erlang SFE model might work, I can contribute my experience from the Tclkit angle, both technical and end-user, as well as a fresh view on things. Those who are interested in a deeper understanding of the Tclkit model can start reading from the "Tclkit's Anatomy" section onwards and drill down from the "Anatomy of a starkit" link. [*] i.e. "size is hardly a major issue in most deployment environments" and "every single-file executable solution in existence has already solved the lack-of-OS-support-for-embedded-DLLs issue, we're not treading new ground here" - Adrian From thomasl_erlang@REDACTED Fri Feb 18 15:40:54 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 18 Feb 2005 06:40:54 -0800 (PST) Subject: standalone erlang In-Reply-To: Message-ID: <20050218144054.11923.qmail@web41902.mail.yahoo.com> --- Vlad Dumitrescu wrote: > But in practice, whether if someone hands you a huge > executable, or a smaller > one and some parts get downloaded at run-time - you > still have to trust that > person. Viruses can spread via floppy-disks too ;-) If you trust the provider, then "erl -loader" would seem to do what you want. (OK, maybe one should provide an HTTP-based loader protocol too to get through those pesky firewalls.) Best, Thomas __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com From james.hague@REDACTED Fri Feb 18 15:43:24 2005 From: james.hague@REDACTED (James Hague) Date: Fri, 18 Feb 2005 08:43:24 -0600 Subject: standalone erlang In-Reply-To: <4214CBD9.5030202@ericsson.com> References: <421469B5.9050202@ericsson.com> <4214CBD9.5030202@ericsson.com> Message-ID: On Thu, 17 Feb 2005 17:52:41 +0100, Bengt Kleberg wrote: > > A single executable is best. > > you are correct. > but i assume you know that worse is better :-) Oh, okay, so I should just use Perl for this sort of thing rather than Erlang? :-) From asynth@REDACTED Fri Feb 18 20:04:41 2005 From: asynth@REDACTED (James McCartney) Date: Fri, 18 Feb 2005 11:04:41 -0800 Subject: concatenating atoms Message-ID: <056ffaa0a25c6c2a06417b4ad04823b3@io.com> hi just joined the list. > Each (short) character takes 6 bits so in 64 bits we could pack > say 4 tag bits + 10 characters. huffman code them based on a universally known code table. atoms with codes shorter than 60 bits are short atoms. -- james mccartney From sean.hinde@REDACTED Fri Feb 18 20:47:36 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 18 Feb 2005 19:47:36 +0000 Subject: standalone erlang In-Reply-To: <20050218133052.60078.qmail@web41905.mail.yahoo.com> References: <20050218133052.60078.qmail@web41905.mail.yahoo.com> Message-ID: <078ce2c0641747a3ea65acb0d1860811@mac.com> On 18 Feb 2005, at 13:30, Thomas Lindgren wrote: > > --- Vlad Dumitrescu > wrote: > >> I'd like to suggest another variant: in a LAN >> environment, the libraries might >> be made available via the network. Not for download, >> but for the code loader. > > You can always try "erl -loader inet -hosts ...". > > (I hasten to say I never have :-) > > Though the problem with internet scale deployment > would really be whether you can trust the code you are > loading, as mentioned to me yesterday by someone who > shall only be known as "Sean". Well, Sean might also have said that this was a solution to a non-existing problem - no-one cares about typical application size downloads these days. Sean From garry@REDACTED Sat Feb 19 02:31:48 2005 From: garry@REDACTED (Garry Hodgson) Date: Fri, 18 Feb 2005 20:31:48 -0500 Subject: need help debugging otp app In-Reply-To: References: Message-ID: <2005021820311108776708@k2.sage.att.com> "Ulf Wiger (AL/EAB)" wrote: > > In http://www.erlang.org/ml-archive/erlang-questions/200501/msg00036.html, > Gary Hodgson asked for help in understanding the following cryptic error message: > > --> erl -boot ./master -config ./sys -boot_var MYAPPS $DIR -sname n1 Error in process <0.1.0> with exit value: {badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]} {"init terminating in do_boot",{badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]}} init terminating in do_boot () > > Hopefully, he has found a way around it by now. (: > > > The probable error is that the script contains a boot variable which wasn't set when starting the system. yes, i eventually figured that out. unfortunately, i got roadblocked trying to get OTP and pico (which our xmlrpc server was built on top of) to play nicely together, and i ran out of the limited time i had to spend in converting our old vanilla erlang app to OTP. it's a real shame, since i think OTP is a natural for the kind of things i need to do. but the learning curve is steep, most of the contrib tools don't use it, and i don't get much time to play with erlang. i got pretty close this time, getting my main stuff to build, install, and run, but without xmlrpc no one could talk to it, so i had to punt back to the old code. sigh. ---- Garry Hodgson, Technical Consultant, AT&T Labs Be happy for this moment. This moment is your life. From ulf@REDACTED Sat Feb 19 08:09:17 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 19 Feb 2005 08:09:17 +0100 Subject: need help debugging otp app In-Reply-To: <2005021820311108776708@k2.sage.att.com> References: <2005021820311108776708@k2.sage.att.com> Message-ID: Den 2005-02-19 02:31:48 skrev Garry Hodgson : > yes, i eventually figured that out. unfortunately, i got roadblocked > trying to get OTP and pico (which our xmlrpc server was built on topof) > to play nicely together, and i ran out of the limited time i had > to spend in converting our old vanilla erlang app to OTP. A pity. In CCviewer, there's an OTP:ified version of pico. I wonder if that could have been of any help...? /Uffe From valentin@REDACTED Sat Feb 19 10:12:02 2005 From: valentin@REDACTED (Valentin Micic) Date: Sat, 19 Feb 2005 11:12:02 +0200 Subject: mnesia power index -- What about fragmentation? References: Message-ID: <002701c51663$138c43a0$0100a8c0@MONEYMAKER2> Speaking of indexes... Am I wrong in saying that indexing for fragmented tables can be improoved? I did a brief test once (on R9) and notice that fragment number allocation for index table is the same as for key -- in other words, if KEY says that record goes to fragment number 5, the index is also going to be stored in the index fragment number 5. This causes a linear performance degradation -- more fragments one has, worse index-based lookup gets. Wouldn't it be better if index fragments are calculated based index value? Hmmm... this is too obvious. It must be that was doing something wrong? Was I? V. ----- Original Message ----- From: "Ulf Wiger (AL/EAB)" To: Sent: Friday, February 18, 2005 2:02 PM Subject: RE: mnesia power index Ulf Wiger (AL/EAB) wrote: > ** Oops! The following functions don't work right! > > 40> mnesia:dirty_index_first(test4,{1,name}). > {{{"armstrong","joe"},2},[]} > 41> mnesia:dirty_index_next(test4,{1,name},{{"armstrong","joe"},2}). > {{{"armstrong","joe"},4},[]} > > ** They do work with old-style indexes, and should work with > ** unordered indexes. I will fix this. Now fixed. If anyone wants a patch, let me know. Alternating next and prev on a bag table yields very strange results - so using these functions on an unordered index (at least when stepping back and forth) can sometimes cause surprises. I will not attempt to fix this. 139> mnesia:dirty_index_first(test4,{1,name}). {{{"armstrong","joe"},4}, [{test4,2,"Joe","Armstrong","the quick brown fox"}, {test4,4,"joe","armstrong","jumps over the lazy dog"}]} 140> mnesia:dirty_index_last(test4,{1,name}). {{{"wiger","ulf"},3}, [{test4,1,"Ulf","Wiger","The Quick Brown Fox"}, {test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}]} 141> mnesia:dirty_index_next(test4,{1,name},element(1,v(139))). {{{"wiger","ulf"},3}, [{test4,1,"Ulf","Wiger","The Quick Brown Fox"}, {test4,3,"ulf","wiger","JUMPS OVER THE LAZY DOG"}]} 142> mnesia:dirty_index_next(test4,{1,name},element(1,v(141))). '$end_of_table' 143> mnesia:dirty_index_prev(test4,{1,name},element(1,v(140))). {{{"armstrong","joe"},4}, [{test4,2,"Joe","Armstrong","the quick brown fox"}, {test4,4,"joe","armstrong","jumps over the lazy dog"}]} 144> mnesia:dirty_index_prev(test4,{1,name},element(1,v(143))). '$end_of_table' > - The index callbacks execute in the 'commit' phase, so there's > no possibility to abort (this will cause mnesia to dump core). > They simply have to work. Oh, and keep them side-effect free. I decided to address this with a function: mnesia_index:test_index_fun(Tab, Index, Object) (The function returns whatever the indexing callback returns, or exits if the callback exits.) and also the sometimes more convenient function: mnesia_index:test_indexes(Tab, Object) -> ok (verifies that each index function returns a list of values for the given object.) By calling this within the transaction, you should get a transaction abort rather than a nasty crash during commit. I thought I'd build this into 'rdbms' if the functionality actually becomes incorporated into mnesia. Then, it will be transparent to users of 'rdbms'. BTW, the functions work for all index types, not just callbacks. /Uffe From olivier.sambourg@REDACTED Sat Feb 19 17:20:52 2005 From: olivier.sambourg@REDACTED (Olivier) Date: Sat, 19 Feb 2005 17:20:52 +0100 Subject: Jabberlang Message-ID: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> Hi everyone I've been looking everywhere for the Jabberlang library (mentionned by Micka?l R?mond in "Messaging with Erlang and Jabber"), without luck... Is it available somewhere ? Thanks -- Olivier From ulf@REDACTED Sun Feb 20 18:06:31 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 20 Feb 2005 18:06:31 +0100 Subject: mnesia power index -- What about fragmentation? In-Reply-To: <002701c51663$138c43a0$0100a8c0@MONEYMAKER2> References: <002701c51663$138c43a0$0100a8c0@MONEYMAKER2> Message-ID: Den 2005-02-19 10:12:02 skrev Valentin Micic : > Speaking of indexes... > Am I wrong in saying that indexing for fragmented tables can > be improoved? I did a brief test once (on R9) and notice that > fragment number allocation for index table is the same as for > key -- in other words, if KEY says that record goes to fragment > number 5, the index is also going to be stored in the index > fragment number 5. This causes a linear performance degradation > -- more fragments one has, worse index-based lookup gets. > Wouldn't it be better if index fragments are calculated based > index value? Hmmm... this is too obvious. It must be that was > doing something wrong? Was I? I don't think you were doing anything wrong. Consider the source code in mnesia_frag.erl for index_read(): "index_read(ActivityId, Opaque, Tab, Key, Attr, LockKind) -> Match = [mnesia:index_read(ActivityId, Opaque, Frag, Key, Attr, LockKind) || Frag <- frag_names(Tab)], lists:append(Match)." This will result in an index lookup on each node where there's a fragment. In cases where the index lookup actually would result in fetches from each node, this is quite efficient, but for all other cases, it's suboptimal, I think. But when you consider failure situations, managing index tables any other way becomes a bit complex. One would perhaps want to have fragmented indexes where distribution is determined by a frag_hash callback, in a manner similar to what's done with the real objects, but then you may run into situations where a node housing index keys to another node suddenly goes down, and you end up with only parts of the table indexed. When I spent some time thinking about it (and I hadn't really given it any thought before you brought it up), I came to the conclusion that one may have to manage index tables as first-class tables, in order to get good cluster properties. Then, you could specify one fragmentation algorithm for the tables, and another for each index; and you could replicate index tables, so that you'd be protected from single node crashes. That would require quite a lot of rewriting in mnesia, though, and there would be a prize to pay in overhead for several functions on normal tables, I think. I'm sure H?kan and Dan have given this much more thought than I have. /Uffe From valentin@REDACTED Sun Feb 20 22:31:48 2005 From: valentin@REDACTED (Valentin Micic) Date: Sun, 20 Feb 2005 23:31:48 +0200 Subject: mnesia power index -- What about fragmentation? References: <002701c51663$138c43a0$0100a8c0@MONEYMAKER2> Message-ID: <002001c51793$9656f600$0100a8c0@MONEYMAKER2> From: "Ulf Wiger" >...I came to the conclusion that one may have to > manage index tables as first-class tables, Well, we end-up doing exactly that. It wasn't perfect, but then, nothing ever is. On a different note, I've been playing with menmosyne and as much as I liked it, I'm not so sure that it is intended for BIG databases. Actually, I've seen run-time crashed due to the bad/buggy query (it run out of memory). This is a bit concerning and preatty un-erlang like. Should one encourage usage of mnemosyne on a big databases? Oh, all of this is in R9. Hope that R10 brings improovements. V. From luke@REDACTED Mon Feb 21 00:05:56 2005 From: luke@REDACTED (Luke Gorrie) Date: 21 Feb 2005 00:05:56 +0100 Subject: jungerl update Message-ID: Howdy, Just a note that Jungerl wasn't building from scratch but I think I've fixed it now. You'd need to 'cvs update -d' and 'make' in the jungerl/ directory. I also added a few ChangeLogs for people who know about `C-x 4 a' and *cvs-commit*'s `C-c C-a' :-) -Luke From ulf@REDACTED Mon Feb 21 00:05:54 2005 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 21 Feb 2005 00:05:54 +0100 Subject: mnemosyne and BIG databases (Re: mnesia power index -- What about fragmentation?) In-Reply-To: <002001c51793$9656f600$0100a8c0@MONEYMAKER2> References: <002701c51663$138c43a0$0100a8c0@MONEYMAKER2> <002001c51793$9656f600$0100a8c0@MONEYMAKER2> Message-ID: Den 2005-02-20 22:31:48 skrev Valentin Micic : > On a different note, I've been playing with menmosyne and > as much as I liked it, I'm not so sure that it is intended > for BIG databases. Actually, I've seen run-time crashed > due to the bad/buggy query (it run out of memory). This > is a bit concerning and preatty un-erlang like. Should one > encourage usage of mnemosyne on a big databases? Oh, all > of this is in R9. Hope that R10 brings improovements. R10 fixes one bug in mnemosyne that had to do with queries on very big tables (some queries could loop forever). I don't know if this was the bug you ran into. The problem of doing joins on very large data sets is tricky to solve in Erlang, partly because of the way the garbage collector works (building large data structures on the process heap will cause a lot of memory overhead.) Mnemosyne was initially designed as a proof of concept, showing how one could use a declarative language and "set comprehension" syntax for database queries. As I understand it, mnemosyne also did some very clever query optimization, which made it clearly outperform e.g. Oracle on some very complex queries on large data sets. But already from the start, there was a slight mismatch in focus between mnesia and mnemosyne. Mnesia focused on RAM-based databases, where the need for "dirty" accesses was an important requirement. For most applications using OTP so far, mnesia has had desirable characteristics, while mnemosyne has been something of an odd beast. Partly for this reason, mnemosyne has never really received the attention it needed in order to become a really good product, IMO. In R10, OTP takes a clear step away from mnemosyne by stating that: "QLC (Query List Comprehensions) is another solution for queries to Mnesia, Ets and Dets tables which will be the recommended way to perform queries. QLC belongs to Stdlib and is described there. "It is not recommended to use Mnemosyne queries in performance critical applications." OTOH, on QLC, the manual states: "Support for faster join of two tables will be added not later than in R11. Depending on preferences and priorities some high level optimizations may be added in the future." My interpretation is that QLC can hardly be recommended for big databases either - at least not at this time. QLC might still be the best way to go for the future, since it is a more general approach than mnemosyne was. I'm not convinced that there won't be a price to pay for that generality down the line, esp. when it comes to handling complex queries on very large databases, but I'm not an expert on the subject. /Uffe From ulf@REDACTED Mon Feb 21 00:22:05 2005 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 21 Feb 2005 00:22:05 +0100 Subject: ets:select to ets Message-ID: When hacking the index functionality in Mnesia, I was reminded of an idea I had a while ago. When calling ets:select/2, it would sometimes be very useful to be able to direct the result to an ets table instead of the process heap. When post-processing of the result is needed, one either has to manage a large list on the process heap, or one creates a temporary ets table. In the latter case, copying the output of select() directly to an ets table would cut down on the copying, and also significantly reduce the GC issues. Perhaps the following functions from mnesia_index.erl can illustrate: realkeys(Tab, Pos, IxKey) -> Index = get_index_table(Tab, Pos), db_get(Index, IxKey). % a list on the form [{IxKey, RealKey1} , .... dirty_select(Tab, Spec, Pos) -> %% Assume that we are on the node where the replica is %% Returns the records without applying the match spec %% The actual filtering is handled by the caller IxKey = element(Pos, Spec), RealKeys = realkeys(Tab, Pos, IxKey), StorageType = val({Tab, storage_type}), lists:append([mnesia_lib:db_get(StorageType, Tab, Key) || {_,Key} <- RealKeys]). What happens is that dirty_select produces a list of lists (index values that each point to a list of objects.) In order to return a flat list, mnesia builds a (potentially large) list on the heap, and then calls lists:append/1 on it (which essentially flattens it.) In this case, I think it would be much more efficient to direct the results of the ets operations to a temporary ets table and then calling tab2list on it. /Uffe From thomasl_erlang@REDACTED Mon Feb 21 11:25:09 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 21 Feb 2005 02:25:09 -0800 (PST) Subject: mnemosyne and BIG databases (Re: mnesia power index -- What about fragmentation?) In-Reply-To: Message-ID: <20050221102509.30205.qmail@web41908.mail.yahoo.com> --- Ulf Wiger wrote: > As I > understand it, mnemosyne also did some very clever > query optimization, which made it clearly outperform > e.g. Oracle on some very complex queries on large > data sets. My impression from hearing about a colleague's mnemosyne woes (at Bluetail) was the opposite: that there was very little query optimization. In that case, straightforward queries over multiple tables were quite slow. (Mnemosyne was subsequently replaced by direct db operations when queries turned out to be embarrasingly expensive for larger datasets.) (An alternative explanation could be that, as so often with this sort of optimizations, you really have to write your programs/queries so that the optimizer recognizes them. Though I haven't really looked into mnemosyne to see whether that is the case.) > In R10, OTP takes a clear step away from mnemosyne > by stating that: > > "QLC (Query List Comprehensions) is another solution > for queries > to Mnesia, Ets and Dets tables which will be the > recommended way > to perform queries. QLC belongs to Stdlib and is > described there. A related question, to whoever it may concern: why were QLCs introduced? Why not fix mnemosyne instead? To the casual user (that is, me), they seem quite similar. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail From joe.armstrong@REDACTED Mon Feb 21 11:49:00 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 21 Feb 2005 11:49:00 +0100 Subject: standalone erlang Message-ID: > On 18 Feb 2005, at 13:30, Thomas Lindgren wrote: > > > > > --- Vlad Dumitrescu > > wrote: > > > >> I'd like to suggest another variant: in a LAN > >> environment, the libraries might > >> be made available via the network. Not for download, > >> but for the code loader. > > > > You can always try "erl -loader inet -hosts ...". > > > > (I hasten to say I never have :-) > > > > Though the problem with internet scale deployment > > would really be whether you can trust the code you are > > loading, as mentioned to me yesterday by someone who > > shall only be known as "Sean". But surely this is easily solved :-) Let's suppose "joe" was the origonal creater of a program. Joe compiles his public key into the distribution. Vlad downloads Joe's code. Vlad gets an update from somebody claiming to be joe it is signed with joe's private key. Vlad can now test that the update to the program and the origonal were signed with the same private key. Thus the update is at least as secure as the origonal. So if you trust the origonal you should also trust the update. The code for this is in the section marked RSA in http://www.erlang.org/examples/examples-2.0.html and the code to do this is in http://www.erlang.org/examples/examples-2.0.tgz /Joe > > Well, Sean might also have said that this was a solution to a > non-existing problem - no-one cares about typical application size > downloads these days. > > Sean > > From thomasl_erlang@REDACTED Mon Feb 21 12:15:48 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 21 Feb 2005 03:15:48 -0800 (PST) Subject: standalone erlang In-Reply-To: Message-ID: <20050221111548.40582.qmail@web41908.mail.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > But surely this is easily solved :-) > > Let's suppose "joe" was the origonal creater of a > program. > Joe compiles his public key into the distribution. /.../ Sure, issue a certificate, sign the modules, and package them up like your garden variety conscientous tar package. However, I don't believe this is supported in the actual Erlang distribution. E.g., the compiler does not generate an appropriate hash, systools and .rel/.app/... do not support it, and erl_prim_loader does not verify such signatures. But maybe someone could add it? Bytecode verification could also ensure that your code is not doing disreputable things. (Though Erlang has a lot of holes in that regard.) An even safer option is certifying the actual code (proof-carrying code); you don't even have to trust the word of the originator. I'm not sure PCC is mature enough yet, though. Best, Thomas __________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com From keymon@REDACTED Mon Feb 21 12:18:24 2005 From: keymon@REDACTED (=?iso-8859-1?q?H=E9ctor_Rivas_G=E1ndara?=) Date: Mon, 21 Feb 2005 12:18:24 +0100 Subject: Comunicate Erlang with other process Message-ID: <200502211218.24830.keymon@wanadoo.es> Hi, I need comunicate erlang with an external program. I can add plugins to external program, but I can't use it as a driver, it has his own main function and it will launch the erlang runtime using exec. The solution can be code an Erlang driver that will comunicate with the external program using IPC or other comunication system. This driver will forward all data from erlang to external process and viceversa. I think that this is a common problem, and I wonder if there is an implementation of such driver. -- Greets From hasse@REDACTED Mon Feb 21 15:00:58 2005 From: hasse@REDACTED (hasse@REDACTED) Date: Mon, 21 Feb 2005 15:00:58 +0100 Subject: mnemosyne and BIG databases (Re: mnesia power index -- What about fragmentation?) In-Reply-To: <20050221102509.30205.qmail@web41908.mail.yahoo.com> References: <20050221102509.30205.qmail@web41908.mail.yahoo.com> Message-ID: <16921.59802.474402.210971@gargle.gargle.HOWL> [Valentin Micic:] > On a different note, I've been playing with menmosyne and > as much as I liked it, I'm not so sure that it is intended > for BIG databases. Actually, I've seen run-time crashed > due to the bad/buggy query (it run out of memory). This > is a bit concerning and preatty un-erlang like. Should one > encourage usage of mnemosyne on a big databases? [Ulf Wiger:] > OTOH, on QLC, the manual states: > > "Support for faster join of two tables will be added not later > than in R11. Depending on preferences and priorities some high > level optimizations may be added in the future." > > My interpretation is that QLC can hardly be recommended for > big databases either - at least not at this time. QLC might > still be the best way to go for the future, since it is a > more general approach than mnemosyne was. [Thomas Lindgren:] > A related question, to whoever it may concern: why were QLCs > introduced? Why not fix mnemosyne instead? To the casual user (that > is, me), they seem quite similar. Given the poor performance experienced by customers (*) as well as the non-existing knowledge of Mnemosyne at OTP, product management came to the decision to either improve Mnemosyne significantly or replace it. It turned out to be easier to replace it: Mnemosyne creates lots of processes sending partial answers between them, which is quite slow and hard to change. The replacement (QLC) focuses on efficient access of RAM tables (ETS). Big databases is probably beyond the scope of QLC. The same goes for advanced query optimization. A more down-to-earth ambition is to provide the user with information about tables and let him decide the order of joins when several tables are involved. There are no plans right now to implement such functionality. In fact, since the existing functionality covers what (paying) customers use Mnemosyne for, further work on QLC has been given low priority. It is uncertain if the promise about fast join of two tables in R11 can be kept (currently QLC can do joins, but only very inefficiently using nested loops). To some extent it depends on the interest in QLC from paying customers. Best regards Hans Bolinder, Erlang/OTP (*) Some (paying) customers use Mnemosyne, but only for trivial tasks: their queries typically select data from one single table. Whenever performance has been important, it has so far been possible to rewrite the queries using match specifications and select statements. From dietmar@REDACTED Mon Feb 21 15:22:18 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Mon, 21 Feb 2005 15:22:18 +0100 Subject: SNMP-AgentX Message-ID: <4219EE9A.3050005@ast.dfs.de> Hi ! I have written a SNMP-Agent. Now I would like to know if if it is possible to connect an erlang-based Agent to an already existing System-Master-Agent mybe using AgentX ???? Regards Dietmar From gerd@REDACTED Mon Feb 21 15:58:45 2005 From: gerd@REDACTED (Gerd Flaig) Date: Mon, 21 Feb 2005 15:58:45 +0100 Subject: Jabberlang In-Reply-To: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> (olivier.sambourg@gmail.com's message of "Sat, 19 Feb 2005 17:20:52 +0100") References: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> Message-ID: Olivier writes: > I've been looking everywhere for the Jabberlang library (mentionned by > Micka?l R?mond in "Messaging with Erlang and Jabber"), without luck... > Is it available somewhere ? you may find what you're looking for in ejabberd. Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Brauerstra?e 48 D-76135 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From mickael.remond@REDACTED Mon Feb 21 16:22:06 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 21 Feb 2005 16:22:06 +0100 Subject: Jabberlang In-Reply-To: References: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> Message-ID: <4219FC9E.20603@erlang-fr.org> Gerd Flaig wrote: > Olivier writes: > > >>I've been looking everywhere for the Jabberlang library (mentionned by >>Micka?l R?mond in "Messaging with Erlang and Jabber"), without luck... >>Is it available somewhere ? > > > you may find what you're looking for in ejabberd. ejabberd is the server part. Jabberlang is a client library. Both are fullfilling different needs. Cheers, -- Micka?l R?mond http://www.erlang-projects.org/ From mickael.remond@REDACTED Mon Feb 21 16:21:17 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 21 Feb 2005 16:21:17 +0100 Subject: Jabberlang In-Reply-To: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> References: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> Message-ID: <4219FC6D.7000503@erlang-fr.org> Olivier wrote: > Hi everyone > > I've been looking everywhere for the Jabberlang library (mentionned by > Micka?l R?mond in "Messaging with Erlang and Jabber"), without luck... > Is it available somewhere ? Hello, Jabberlang is a client library that help building Jabber/XMPP client in Erlang. The code is still on my machine. I still need to work one hour or two to package it and publish it. I will do that as soon as possible, most likely during the next week-end. -- Micka?l R?mond http://www.erlang-projects.org/ From anders.nygren@REDACTED Mon Feb 21 17:05:27 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 21 Feb 2005 10:05:27 -0600 Subject: How to configure processes, (and applications) Message-ID: Hi I am pondering the question of how to best get configuration data to to processes and/or applications in an OTP based system. So far I have as a precondition that 1 - Useful default values are in the application resource file 2 - Installation specific values are in the sys.config file But my question is, "How do I best get the data into the processes that need it?" In my first OTP based system I had the processes do application:env/1 whenever they needed the data, but I am not very happy with this. Now I am considering having the main supervisor of the application read the configuration data and pass it in the start_link calls to the different processes. From anders.nygren@REDACTED Mon Feb 21 17:11:29 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 21 Feb 2005 10:11:29 -0600 Subject: How to configure processes, (and applications) Message-ID: Sorry, but it got sent before I was finished. Hi I am pondering the question of how to best get configuration data to processes and/or applications in an OTP based system. So far I have as a precondition that 1 - Useful default values are in the application resource file 2 - Installation specific values are in the sys.config file But my question is, "How do I best get the data into the processes that need it?" In my first OTP based system I had the processes do application:env/1 whenever they needed the data, but I am not very happy with this. Now I am considering having the main supervisor of the application read the configuration data and pass it in the start_link calls to the different processes. I believe that this will be better, easier to reuse, test before the entire system is developed and so on. So is this a good idea? How does the the big guys do it, (Ulf??) /Anders Nygren From olivier.sambourg@REDACTED Mon Feb 21 17:19:24 2005 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Mon, 21 Feb 2005 17:19:24 +0100 Subject: Jabberlang In-Reply-To: <4219FC6D.7000503@erlang-fr.org> References: <9e2d35093d6b4be418ef6d10d4d562e6@gmail.com> <4219FC6D.7000503@erlang-fr.org> Message-ID: Thank you very much :) I'm using XMPP as the communication protocol in a turn-based MMORPG game and I'm considering making the avatars lightweight XMPP clients (the other solution being having ejabberd sending erlang messages to the avatars via a custom module). Jabberlang would be perfect for that. Thanks again -- Olivier On Mon, 21 Feb 2005 16:21:17 +0100, Mickael Remond wrote: > Olivier wrote: > > Hi everyone > > > > I've been looking everywhere for the Jabberlang library (mentionned by > > Micka?l R?mond in "Messaging with Erlang and Jabber"), without luck... > > Is it available somewhere ? > > Hello, > > Jabberlang is a client library that help building Jabber/XMPP client in > Erlang. > The code is still on my machine. I still need to work one hour or two to > package it and publish it. > > I will do that as soon as possible, most likely during the next week-end. > > -- > Micka?l R?mond > http://www.erlang-projects.org/ > From vances@REDACTED Mon Feb 21 17:47:11 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 21 Feb 2005 11:47:11 -0500 Subject: How to configure processes, (and applications) In-Reply-To: References: Message-ID: <20050221164711.GW55871@frogman.motivity.ca> Anders, Argument passing is the Erlang way of doing things. So looking up application variables in the supervisor and passing them as arguments to the start functions of workers is better. What I tend to do though is look them up in the application callback module and pass them to the top level supervisor. When you have multiple instances of the same tree this saves more work. The thing to consider of course is when they will change. The application callback module can export config_change/3 which will be called after a code replacement if there are any changes to the configuration parameters. You also might want to change configurations parameters in runtime yourself with application:set_env/3. If you do so you will then need to propagate the change to the running processes somehow. If you had left the workers to look them up each time you wouldn't have to. -Vance On Mon, Feb 21, 2005 at 10:11:29AM -0600, Anders Nygren wrote: } } I am pondering the question of how to best get configuration data } to processes and/or applications in an OTP based system. From svg@REDACTED Mon Feb 21 18:35:59 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Mon, 21 Feb 2005 22:35:59 +0500 (YEKT) Subject: How to configure processes, (and applications) In-Reply-To: References: Message-ID: <20050221.223559.51283463.svg@surnet.ru> Good day, anders.nygren> In my first OTP based system I had the processes do application:env/1 anders.nygren> whenever they needed the data, but I am not very happy with this. anders.nygren> anders.nygren> Now I am considering having the main supervisor of the application anders.nygren> read the configuration data and pass it in the start_link calls to the anders.nygren> different processes. anders.nygren> anders.nygren> I believe that this will be better, easier to reuse, test before the entire anders.nygren> system is developed and so on. I also use the similar approach. My application usually looks like +------------------------+ | Application supervisor| +------------------------+ | | | | V V +--------------+ +----------------------+ |Config manager| | Subprocess supervisor| +--------------+ +----------------------+ ^ ... +----------------------------->Subprocesses Configuration loading is similar to INETs http-server: 0. Application supervisor starts 'Config' manager and 'Subprocess supervisor'. They are restarted and killed together(one_for_one policy). 1. Config manager loads configuration data from application environment or text file. 2. Bootstraps extracting information about subsystem configuration modules. 3. If config was in text file - parse it calling subsystems callbacks if exist, callbacks can add their own data. Config is processed in the usual top-down-left-right manner. Example: parse_config(Path=[login, authen], [User], UserContent, _) -> {{authen, login, User}, UserContent}; parse_config(Path=[authen], [], Content, _) -> Content; .... 4. Prepare config to store in the same manner: store_config({Key={authen, login, User}, UserInfo}, AllEntries) -> {Key, UserInfo ++ find_user_identity(User, AllEntries)}; ..... and store result configuration in desired backend (application env, ets/mnesia table). 5. Start subprocesses providing 'Config manager' and 'Subprocess supervisor' pids to callbacks: postload_config(Config, Sup) -> EventServer = ?server_spec {ok, _} = supervisor:start_child(Sup, EventServer), case config:gv_all(Config, event_handler) of [] -> ok; HlrTypes -> ok = lists:foreach(fun (T) -> ok = add_relay_handler(T) end, HlrTypes) end; IMHO this way is more verbose but more flexible than direct OTP one(but compatible). I can send you code if you want one. Best Regards, Vladimir Sekissov From anders.nygren@REDACTED Mon Feb 21 18:53:54 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 21 Feb 2005 11:53:54 -0600 Subject: How to configure processes, (and applications) In-Reply-To: <20050221.223559.51283463.svg@surnet.ru> References: <20050221.223559.51283463.svg@surnet.ru> Message-ID: On Mon, 21 Feb 2005 22:35:59 +0500 (YEKT), Vladimir Sekissov wrote: > Good day, SNIP > > IMHO this way is more verbose but more flexible than direct OTP > one(but compatible). > > I can send you code if you want one. > Hi I am not sure I completely understand what You are doing but please send some code as this looks interesting. Does Your method also support configuration changes while the system is running? /Anders From svg@REDACTED Mon Feb 21 19:36:04 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Mon, 21 Feb 2005 23:36:04 +0500 (YEKT) Subject: How to configure processes, (and applications) In-Reply-To: References: <20050221.223559.51283463.svg@surnet.ru> Message-ID: <20050221.233604.134116332.svg@surnet.ru> anders.nygren> I am not sure I completely understand what You are doing anders.nygren> but please send some code as this looks interesting. anders.nygren> anders.nygren> Does Your method also support configuration changes anders.nygren> while the system is running? I don't know how this process could be generalized but in any way it is ordinary OTP application, follow OTP rules and you can customize its behaviour accordong to your needs (for my current needs restarting the whole subsystem is enough). The code is in attachement. As example of usage you can look at tacacs/src/tac_app.erl tacacs/src/tac_conf.erl Example config file: tacacs/templates/tacacs.conf.stl You must make at top level to compile everything. You need GNU make >= 3.80 for this. If you want to use application environment instead of text file you can use {list, Config} as parameter instead of {file, Name}. To change backend to application environment from ets, modify the following property_server callbacks: bootstrap/2 new_config/1 delete_config/1 store_entry/1 handle_op/2 config_to_list/1 Best Regargs, Vladimir Sekissov -------------- next part -------------- A non-text attachment was scrubbed... Name: ws.tar.gz Type: application/octet-stream Size: 288491 bytes Desc: not available URL: From vances@REDACTED Mon Feb 21 21:31:09 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 21 Feb 2005 15:31:09 -0500 Subject: no more tagged returns Message-ID: <20050221203109.GY55871@frogman.motivity.ca> Today I discovered erlang:error/2 (apparently added in R10) which completes what is needed to write code which behaves in the way it really should when called with the wrong arguments. Nice. I like to write all API functions with as many clause guards as possible(*) to make most effect use of the error reports. Now I can write the clause guards in the server where the procedures are implemented. -Vance (*) The "fail fast" principle. -module(new_api). -behaviour(gen_server). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([foo_to_list/2]). foo_to_list(S, Arg) -> case gen_server:call(S, Arg) of {error, Reason} -> erlang:error(Reason, [S, Arg]); Result -> Result end. init(_) -> {ok, []}. handle_cast(_Event, State) -> {noreply, State}. handle_call(foo, _From, State) -> {reply, atom_to_list(foo), State}; handle_call(Atom, _From, State) when is_atom(Atom) -> {reply, {error, function_clause}, State}; handle_call(_Event, _From, State) -> {reply, {error, bardarg}, State}. handle_info(_Info, State) -> {noreply, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. From svg@REDACTED Mon Feb 21 21:56:20 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 22 Feb 2005 01:56:20 +0500 (YEKT) Subject: How to configure processes, (and applications) In-Reply-To: <20050221.233604.134116332.svg@surnet.ru> References: <20050221.223559.51283463.svg@surnet.ru> <20050221.233604.134116332.svg@surnet.ru> Message-ID: <20050222.015620.95819935.svg@surnet.ru> Oops, I'm awfully sorry for all subscribers. I've sent ~1Mb attachment to the mail-list. Best Regards, Vladimir Sekissov From erlang-list@REDACTED Tue Feb 22 00:36:57 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Tue, 22 Feb 2005 00:36:57 +0100 Subject: file_info.mtime and module_info Message-ID: <421A7099.8040406@dominicwilliams.net> Hello, Am I right in thinking that the file_info.mtime returned by file:read_file_info/1 uses local time, whereas module_info(compile) uses GMT? If so, any ideas on how reliably to compare the modification time of a source file with the time when it was compiled and loaded? Cheers, Dominic Williams http://www.dominicwilliams.net From svg@REDACTED Tue Feb 22 01:03:05 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 22 Feb 2005 05:03:05 +0500 (YEKT) Subject: file_info.mtime and module_info In-Reply-To: <421A7099.8040406@dominicwilliams.net> References: <421A7099.8040406@dominicwilliams.net> Message-ID: <20050222.050305.58441730.svg@surnet.ru> You can compare directly compile time of loaded module and BEAM file one: http://www.erlang.org/ml-archive/erlang-questions/200411/msg00068.html Best Regards, Vladimir Sekissov erlang-list> Hello, erlang-list> erlang-list> Am I right in thinking that the file_info.mtime returned by erlang-list> file:read_file_info/1 uses local time, whereas erlang-list> module_info(compile) uses GMT? erlang-list> erlang-list> If so, any ideas on how reliably to compare the modification erlang-list> time of a source file with the time when it was compiled and erlang-list> loaded? erlang-list> erlang-list> Cheers, erlang-list> erlang-list> Dominic Williams erlang-list> http://www.dominicwilliams.net erlang-list> erlang-list> From raimo@REDACTED Tue Feb 22 08:43:31 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 22 Feb 2005 08:43:31 +0100 Subject: no more tagged returns References: <20050221203109.GY55871@frogman.motivity.ca> Message-ID: erlang:error/1,2 is new and useful for exactly what you described, but erlang:fault/1,2 has been around quite a while, and it is exactly the same. erlang:error/1,2 was introduced along with try..of..catch..after..end just to get a name on erlang:fault/1,2 that harmonized with the class of the exception it raises. This will match for any term (in R10B): Term = try erlang:Class(Term) catch Class:Term -> Term end, for Class = error | throw | exit vances@REDACTED (Vance Shipley) writes: > Today I discovered erlang:error/2 (apparently added in R10) which > completes what is needed to write code which behaves in the way it > really should when called with the wrong arguments. Nice. > > I like to write all API functions with as many clause guards as > possible(*) to make most effect use of the error reports. Now I > can write the clause guards in the server where the procedures are > implemented. > > -Vance > > (*) The "fail fast" principle. > > > -module(new_api). > -behaviour(gen_server). > -export([init/1, handle_call/3, handle_cast/2, handle_info/2, > terminate/2, code_change/3]). > -export([foo_to_list/2]). > > > foo_to_list(S, Arg) -> > case gen_server:call(S, Arg) of > {error, Reason} -> > erlang:error(Reason, [S, Arg]); > Result -> > Result > end. > > init(_) -> > {ok, []}. > > handle_cast(_Event, State) -> > {noreply, State}. > > handle_call(foo, _From, State) -> > {reply, atom_to_list(foo), State}; > handle_call(Atom, _From, State) when is_atom(Atom) -> > {reply, {error, function_clause}, State}; > handle_call(_Event, _From, State) -> > {reply, {error, bardarg}, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > terminate(_Reason, _State) -> > ok. > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From jabba@REDACTED Tue Feb 22 09:36:50 2005 From: jabba@REDACTED (Jani Launonen) Date: Tue, 22 Feb 2005 10:36:50 +0200 (EET) Subject: Erlang on AIX - any recent experiences? Message-ID: Hello everyone! After working for a week in a new work place, I've already started propagating Erlang for this and that. My boss seems interested in Erlang and I'm probably allowed to use Erlang in a teaching stint at local polytechnic. Concurrent and distributed systems are more easily explained with Erlang than starting to fight with some other languages(TM). Although it remains to be seen how the recursion and friends will be understood. By the way --- am I allowed to use Getting Started With Erlang -pages ( http://www.erlang.se/doc/doc-5.4.3/doc/getting_started/part_frame.html) as a basis for Erlang teaching? We have a quite big customer that is interested in reliable systems and it just might be possible to do something there with Erlang. Just might. Apparently the first thing to prove is to show Erlang working on AIX. I searched this list but there were no recent comments about Erlang on AIX. As far as I understand Erlang/OTP should compile on just any unix without problems. I don't have any AIX machines at my use right now so any recent experiences from the trenches would be most valuable for me. Any hints or experiences teaching Erlang are also appreciated. -+-+-+- Jani Launonen Student. . . . . . . . . .University of Oulu, Dept. of El. & Inf. Eng. "Life is what happens to you while you're busy making future plans." - Alfred E. Neuman From enano@REDACTED Tue Feb 22 09:42:30 2005 From: enano@REDACTED (Miguel Barreiro) Date: Tue, 22 Feb 2005 09:42:30 +0100 (CET) Subject: Erlang on AIX - any recent experiences? In-Reply-To: References: Message-ID: > Apparently the first thing to prove is to show Erlang working on AIX. I > searched this list but there were no recent comments about Erlang on AIX. As > far as I understand Erlang/OTP should compile on just any unix without > problems. I don't have any AIX machines at my use right now so any recent > experiences from the trenches would be most valuable for me. I'm not running Erlang on recent AIX releases, but it should be in fact simpler than on older versions: AIX 5.1 and above has lost a lot of mist, smoke and black magic. Regards, Miguel From csanto@REDACTED Tue Feb 22 10:45:26 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 22 Feb 2005 10:45:26 +0100 Subject: Atom pollution Message-ID: <421AFF36.8050009@diit.unict.it> Dear all, I've read that atoms are not garbage collected. But suppose I use the following code: a(String) -> b(list_to_atom(String)). b(hello) -> ... b(ciao) -> ... b(bonjour) -> ... String can be "hello", "ciao" or "bonjour". What happens each time a/1 is called? Is a new atom created each time or there is a sort of "atom hash"? Regards, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From raimo@REDACTED Tue Feb 22 11:26:01 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 22 Feb 2005 11:26:01 +0100 Subject: Atom pollution References: <421AFF36.8050009@diit.unict.it> Message-ID: There is an "atom hash", or rather there cannot be two atoms with the same text representation, so when a new atom is created it is first checked if it exists then it need not be created. csanto@REDACTED (Corrado Santoro) writes: > Dear all, > > I've read that atoms are not garbage collected. But suppose I use the > following code: > > a(String) -> b(list_to_atom(String)). > > b(hello) -> ... > b(ciao) -> ... > b(bonjour) -> ... > > > String can be "hello", "ciao" or "bonjour". > > What happens each time a/1 is called? Is a new atom created each time > or there is a sort of "atom hash"? > > Regards, > --Corrado > > -- > ====================================================== > Eng. Corrado Santoro, Ph.D. > > University of Catania - Engineering Faculty > Department of Computer Science and > Telecommunications Engineering > Viale A. Doria, 6 - 95125 CATANIA (ITALY) > > Tel: +39 095 7382380 Fax: +39 095 7382397 > +39 095 7382365 > +39 095 7382364 > > EMail: csanto@REDACTED > Personal Home Page: > http://www.diit.unict.it/users/csanto > > NUXI Home Page: > http://nuxi.iit.unict.it > ====================================================== > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From sean.hinde@REDACTED Tue Feb 22 11:22:08 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 22 Feb 2005 10:22:08 +0000 Subject: How to configure processes, (and applications) In-Reply-To: References: Message-ID: <6602eca430d7185d5d50d6abdce17242@mac.com> On 21 Feb 2005, at 16:11, Anders Nygren wrote: > Sorry, > but it got sent before I was finished. > > Hi > I am pondering the question of how to best get configuration data > to processes and/or applications in an OTP based system. > > So far I have as a precondition that > 1 - Useful default values are in the application resource file > 2 - Installation specific values are in the sys.config file > > But my question is, "How do I best get the data into the processes > that need it?" Most of our apps use a simple mechanism where the supervisor reads the config and passes it into the start_link function. It works well. We have moved away from using sys.config for our own apps (i.e. stuff where we can influence this - not inets, kernel and friends) and now have a well known config directory location which holds a file called app_name.conf for any application which needs config data. This is normally something which can be read with file:consult/1. This allows us to have a single standard sys.config for all new systems which makes multiple configs easier to manage, and crucially a restart is not needed to re-read the config. Changing config on the fly is done by exporting config change functions for each gen_server and putting code to handle this in the call callbacks. We also have a persistent storage for config data modelled along the same api as application:get_env etc. Applications are free to use that instead of or as well as config files. I'm a big fan of K.I.S.S! Sean From joe.armstrong@REDACTED Tue Feb 22 11:33:52 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 22 Feb 2005 11:33:52 +0100 Subject: Atom pollution Message-ID: > I've read that atoms are not garbage collected. But suppose I use the > following code: > > a(String) -> b(list_to_atom(String)). > > b(hello) -> ... > b(ciao) -> ... > b(bonjour) -> ... > > > String can be "hello", "ciao" or "bonjour". > > What happens each time a/1 is called? Is a new atom created > each time or > there is a sort of "atom hash"? There is an atom hash table - so a new atom is created the first time you call list-to_atom, thereafter a pointer to the atom is returned. Note that the atom hash table is finite and is not garbage collected. Although it is finite it is "pretty big" (TM) so this fact might not worry you. <> /Joe > > Regards, > --Corrado > > -- > ====================================================== > Eng. Corrado Santoro, Ph.D. > > University of Catania - Engineering Faculty > Department of Computer Science and > Telecommunications Engineering > Viale A. Doria, 6 - 95125 CATANIA (ITALY) > > Tel: +39 095 7382380 Fax: +39 095 7382397 > +39 095 7382365 > +39 095 7382364 > > EMail: csanto@REDACTED > Personal Home Page: > http://www.diit.unict.it/users/csanto > > NUXI Home Page: > http://nuxi.iit.unict.it > ====================================================== > > From zoltan.peter.toth@REDACTED Tue Feb 22 11:49:22 2005 From: zoltan.peter.toth@REDACTED (Zoltan Peter Toth) Date: Tue, 22 Feb 2005 11:49:22 +0100 Subject: Atom pollution In-Reply-To: References: Message-ID: <421B0E32.6040606@ericsson.com> Hi, > <> Cheers, /Zoltan From ulf.wiger@REDACTED Tue Feb 22 13:01:15 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 22 Feb 2005 13:01:15 +0100 Subject: Atom pollution Message-ID: As a general principle, you should make sure that your atom-producing functions operate on a finite set of possible atoms. In other words, if String in your example is something that is received from the outside, you have an infinite set of possible atoms, which is not good. Then, I would try to re-write the code as: a("hello") -> b(hello); a("ciao") -> b(ciao); a("bonjour") -> b(bonjour). - if at all possible. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Corrado Santoro > Sent: den 22 februari 2005 10:45 > To: erlang-questions@REDACTED > Subject: Atom pollution > > > Dear all, > > I've read that atoms are not garbage collected. But suppose I use the > following code: > > a(String) -> b(list_to_atom(String)). > > b(hello) -> ... > b(ciao) -> ... > b(bonjour) -> ... > > > String can be "hello", "ciao" or "bonjour". > > What happens each time a/1 is called? Is a new atom created > each time or > there is a sort of "atom hash"? > > Regards, > --Corrado > > -- > ====================================================== > Eng. Corrado Santoro, Ph.D. > > University of Catania - Engineering Faculty > Department of Computer Science and > Telecommunications Engineering > Viale A. Doria, 6 - 95125 CATANIA (ITALY) > > Tel: +39 095 7382380 Fax: +39 095 7382397 > +39 095 7382365 > +39 095 7382364 > > EMail: csanto@REDACTED > Personal Home Page: > http://www.diit.unict.it/users/csanto > > NUXI Home Page: > http://nuxi.iit.unict.it > ====================================================== > > From thomasl_erlang@REDACTED Tue Feb 22 13:45:51 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 22 Feb 2005 04:45:51 -0800 (PST) Subject: Atom pollution In-Reply-To: Message-ID: <20050222124552.61462.qmail@web41901.mail.yahoo.com> --- "Ulf Wiger (AL/EAB)" wrote: > /.../ you have an infinite > set of possible atoms, which is not good. Quite. That might result in an atom bomb. Best, Thomas __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo From luke@REDACTED Tue Feb 22 20:39:56 2005 From: luke@REDACTED (Luke Gorrie) Date: 22 Feb 2005 20:39:56 +0100 Subject: Proposed change to libraries References: <200502071207.j17C7hAk022387@spikklubban.it.uu.se> Message-ID: Bjorn Gustavsson writes: > Unfortunately, it is tricky to check that {M,F} is a valid fun. The module > M might not even be loaded. > > It has been suggested earlier that we should add > > fun M:F/Arity > > to the language. Unfortunately, we didn't add it in R10B. We could add > it in R11B. I think it would be nice if this prints as something like: #Fun so that you can easily see where it's pointing. I also wonder if people are using {M,F}-funs without fixed arity. toy example: callback(Values, Callback = {M,F}) when list(Values) -> apply(M, F, Values). Cheers, Luke From erlang@REDACTED Wed Feb 23 02:34:05 2005 From: erlang@REDACTED (Michael McDaniel) Date: Tue, 22 Feb 2005 17:34:05 -0800 Subject: inets ssl proxy Message-ID: <20050223013404.GM14094@fangora.autosys.us> Should the following work, or am I doing something wrong? -module(hd). -export([hd/3]). hd(Proxy, Port, URL) -> application:start(inets) , application:start(ssl) , http:set_options( [ {proxy, {{Proxy,Port}, ["localhost"]} } ] ) , http:request(get, {URL, [ {"Version", "HTTP/1.0"}, {"Referer", URL}, {"Host", "www.myhost.org"} ]}, [], []). $ uname -a Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux $ erl Erlang (BEAM) emulator version 5.4.4 [source] [hipe] Eshell V5.4.4 (abort with ^G) 1> c:c(hd). {ok,hd} 2> hd:hd("my.proxy.org",3128,"https://test.xquad.com"). {error,esslerrssl} 3> hd:hd("my.proxy.org",3128,"http://www.quickbots.com"). {ok,{{"HTTP/1.0",200,"OK"}, [{"date","Wed, 23 Feb 2005 01:34:04 GMT"}, {"via","1.0 cougora.autosys.us (squid/3.0-PRE3)"}, {"etag","\"15481-1ee2-da976100\""}, {"server","Apache"}, {"content-length","7906"}, {"content-type","text/html; charset=ISO-8859-1"}, {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"}, {"accept-ranges","bytes"}, {"x-cache","MISS from cougora.autosys.us"}, {"x-cache-lookup","HIT from cougora.autosys.us:3128"}, {"proxy-connection","keep-alive"}], "\r\n\r\n\r\n halt(). $ The problem appears to be (looking at a trace) that the initial packets being sent by hd:hd("my.proxy.org",3128,"https://test.xquad.com"). to my.proxy.org is all encrypted, rather than being a request that the proxy server can read, so the proxy server passes back the error INVALID REQUEST. As you can see, the http:// request works great via proxy. thank you, ~Michael From fredrik.linder@REDACTED Wed Feb 23 09:20:56 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 23 Feb 2005 09:20:56 +0100 Subject: Proposed change to libraries Message-ID: Yes, it is used in (older parts of) our software at CellPoint. /Fredrik > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Luke Gorrie > Sent: den 22 februari 2005 20:40 > To: erlang-questions@REDACTED > Subject: Re: Proposed change to libraries > > > Bjorn Gustavsson writes: > > > Unfortunately, it is tricky to check that {M,F} is a valid > fun. The module > > M might not even be loaded. > > > > It has been suggested earlier that we should add > > > > fun M:F/Arity > > > > to the language. Unfortunately, we didn't add it in R10B. > We could add > > it in R11B. > > I think it would be nice if this prints as something like: > > #Fun > > so that you can easily see where it's pointing. > > I also wonder if people are using {M,F}-funs without fixed arity. > toy example: > > callback(Values, Callback = {M,F}) when list(Values) -> > apply(M, F, Values). > > Cheers, > Luke > > > From luke@REDACTED Wed Feb 23 09:30:54 2005 From: luke@REDACTED (Luke Gorrie) Date: 23 Feb 2005 09:30:54 +0100 Subject: Proposed change to libraries In-Reply-To: References: Message-ID: "Fredrik Linder" writes: > Yes, it is used in (older parts of) our software at CellPoint. [...] > > callback(Values, Callback = {M,F}) when list(Values) -> > > apply(M, F, Values). but if I had thought a bit harder I'd have realised that this is just an apply/3 and not really related to the tuple-function business. That would have to be something like CB = {mod,fun}, if ... -> CB(); ... -> CB(Arg) end which looks a bit more exotic. -Luke From fredrik.linder@REDACTED Wed Feb 23 09:56:58 2005 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 23 Feb 2005 09:56:58 +0100 Subject: Proposed change to libraries Message-ID: > From: Luke Gorrie > > "Fredrik Linder" writes: > > > Yes, it is used in (older parts of) our software at CellPoint. > > [...] > > > > callback(Values, Callback = {M,F}) when list(Values) -> > > > apply(M, F, Values). > > but if I had thought a bit harder I'd have realised that this is just > an apply/3 and not really related to the tuple-function business. > That would have to be something like > > CB = {mod,fun}, > if ... -> CB(); > ... -> CB(Arg) > end > > which looks a bit more exotic. Well, I did the same mistake. But the reply is the same - it is in use (but I'd change it to the fun M:F/A syntax as soon as it's there). /Fredrik From ingela@REDACTED Wed Feb 23 15:54:50 2005 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 23 Feb 2005 15:54:50 +0100 Subject: inets ssl proxy References: <20050223013404.GM14094@fangora.autosys.us> Message-ID: <16924.39226.611947.37660@gargle.gargle.HOWL> You need to specify some ssl options! Something like: SSLOptions = [{certfile, CertFile}, {keyfile, CertFile}], http:request(get, {URL, []}, [{ssl, SSLOptions}], []), Michael McDaniel wrote: > Should the following work, or am I doing something wrong? > > -module(hd). > -export([hd/3]). > > > hd(Proxy, Port, URL) -> > application:start(inets) , > application:start(ssl) , > > http:set_options( [ {proxy, {{Proxy,Port}, ["localhost"]} } ] ) , > > http:request(get, > {URL, [ {"Version", "HTTP/1.0"}, {"Referer", URL}, > {"Host", "www.myhost.org"} ]}, [], []). > > $ uname -a > Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux > $ erl > Erlang (BEAM) emulator version 5.4.4 [source] [hipe] > > Eshell V5.4.4 (abort with ^G) > 1> c:c(hd). > {ok,hd} > 2> hd:hd("my.proxy.org",3128,"https://test.xquad.com"). > {error,esslerrssl} > 3> hd:hd("my.proxy.org",3128,"http://www.quickbots.com"). > {ok,{{"HTTP/1.0",200,"OK"}, > [{"date","Wed, 23 Feb 2005 01:34:04 GMT"}, > {"via","1.0 cougora.autosys.us (squid/3.0-PRE3)"}, > {"etag","\"15481-1ee2-da976100\""}, > {"server","Apache"}, > {"content-length","7906"}, > {"content-type","text/html; charset=ISO-8859-1"}, > {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"}, > {"accept-ranges","bytes"}, > {"x-cache","MISS from cougora.autosys.us"}, > {"x-cache-lookup","HIT from cougora.autosys.us:3128"}, > {"proxy-connection","keep-alive"}], > "\r\n\r\n\r\n 4> halt(). > $ > > The problem appears to be (looking at a trace) that the initial packets being sent by > hd:hd("my.proxy.org",3128,"https://test.xquad.com"). > to my.proxy.org is all encrypted, rather than being a request that the proxy server > can read, so the proxy server passes back the error INVALID REQUEST. As you can see, > the http:// request works great via proxy. > > > thank you, > > ~Michael -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team Cellular/Mobile: +46 70 636 78 68 From heinrich@REDACTED Wed Feb 23 16:30:45 2005 From: heinrich@REDACTED (Heinrich Venter) Date: Wed, 23 Feb 2005 17:30:45 +0200 Subject: snmp_generic badmatch [Was: connection snmp and mnesia...badmatch] Message-ID: Hi I have a problem related to the error reported on using a mnesia table with snmp. I am trying to use a volatile table instead of mnesia, but I get the following error when I do a snmpwalk on the OID ** User error: Invalid return value {'EXIT',{{badmatch,false},[{snmp_generic,table_info,1},{snmpa_local_db,t able_func,4},{snmpa_agent,get_next_values_all_rows,6},{snmpa_agent,get_n ext_table,4},{snmpa_agent,next_loop_varbinds,5},{snmpa_agent,process_pdu ,4},{snmpa_agent,handle_pdu,7},{snmpa_agent,handle_info,2},{gen_server,h andle_msg,6}]}} from {snmp_generic,table_func,[{connectionTable,volatile}]} (get_next) As far as I can tell, the value of false comes from the snmpa_general_db:read function that can not find some key in the internal store (which should be ets in my case) Here is what I am trying to do: Have a process that gathers statistics on my running application. This process must then put the gathered stats into the volatile internal store tables. The generic snmp access functions must then tretrieve the info from the snmp table. I create a new table with snmpa_local_db:table_create({connectionTable, volatile}). I have a function caled update that executes once a minute update () -> Rows = function_that_gets_all_rows(), lists:foldl ( fun(R,RowIndex) -> snmpa_local_db:table_create_row({connectionTable,volatile}, [RowIndex], R), RowIndex+1 end, 1, Rows ), receive after 60000 -> update() end. I can check this table with snmpa_local_db:print(connectionTable) and all the entries are there. Somehow I am missing some connecting bit. My funcs file has a line {smerlyConnectionTable ,{snmp_generic, table_func, [{connectionTable, volatile}]} }. And my MIB defines smerlyConnectionTable Any help here would be appreciated. -]-[einrich SMS "poem" and a category (wild, friendship, love, sorry, funny) to 36444 http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313038363630303a33303639373a2d323a333831 This will take you to the Launchpad site for more info http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313038363630303a33303639373a2d323a333738 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 620 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 12369 bytes Desc: not available URL: From anders.nygren@REDACTED Wed Feb 23 16:58:58 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 23 Feb 2005 09:58:58 -0600 Subject: Escaping special characters is http request Message-ID: Hi For an application I am working on I have to download some data using http. I dont have a lot of http programming experience so please excuse me if I got the terminology wrong. I am looking for a library function to escape special characters in strings to put in cgi queries. Like this, http:/server/path?par1=string1&par2=string2 /Anders Nygren From tty@REDACTED Wed Feb 23 22:38:22 2005 From: tty@REDACTED (tty@REDACTED) Date: Wed, 23 Feb 2005 16:38:22 -0500 Subject: xmerl_xpath:string error Message-ID: Hello, I am using xmerl from R10B-3 and might have encounted an error. Basically if I have two xmlElements nested together xmerl_path does not travers down the first element. The included xpath_err.erl file is the Erlang code which demonstrates this. The result of running the code is shown below. ======================= 1> xpath_err:ok_test(). >From xmerl_xpath:string/2 E=[{xmlElement,responseStatus, responseStatus, [], {xmlNamespace,[],[]}, [{'RESPONSE',1}], 1, [{xmlAttribute,status,[],[],[],[],1,[],"1",false}], [], [], "/home/tee/local/erlang/lib/xmerl-0.20/doc/examples", undeclared}] ok 2> xpath_err:err_test(). >From xmerl_xpath:string/2 E=[] ok ======================== Regards Tee Teoh tty@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: xpath_err.erl Type: application/octet-stream Size: 951 bytes Desc: not available URL: From erlang@REDACTED Thu Feb 24 06:37:43 2005 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 23 Feb 2005 21:37:43 -0800 Subject: XML over HTTP Message-ID: <20050224053743.GB14094@fangora.autosys.us> This question is kind of to Sean Hinde in reference to this past message: http://www.erlang.org/ml-archive/erlang-questions/200101/msg00050.html where Sean said, among other things, "XML over HTTP - this is what we chose. The Java side sends Erlang a HTTP POST containing some XML with the data. Erlang responds with an XML result." QUESTION: Is there any code publicly available that demonstrates this? thank you to anyone with information, ~Michael From erlang@REDACTED Thu Feb 24 06:41:29 2005 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 23 Feb 2005 21:41:29 -0800 Subject: inets ssl proxy In-Reply-To: <16924.39226.611947.37660@gargle.gargle.HOWL> References: <20050223013404.GM14094@fangora.autosys.us> <16924.39226.611947.37660@gargle.gargle.HOWL> Message-ID: <20050224054129.GC14094@fangora.autosys.us> Thank you, Ingela. I will keep trying ssl options to try to get it working. Maybe I have some other problem also - I'll keep trying. >From my direct-connect machine, without using proxy, I do not need to set any ssl options at all and it works fine. Although, now as I think of it, my direct-connect machine is using R10B-3 with inets-4.0.1 and my proxy machine is all R10B-3 (inets-4.2). ~Michael On Wed, Feb 23, 2005 at 03:54:50PM +0100, Ingela Anderton wrote: > > You need to specify some ssl options! Something like: > > SSLOptions = [{certfile, CertFile}, {keyfile, CertFile}], > http:request(get, {URL, []}, [{ssl, SSLOptions}], []), > > Michael McDaniel wrote: > > Should the following work, or am I doing something wrong? > > > > -module(hd). > > -export([hd/3]). > > > > > > hd(Proxy, Port, URL) -> > > application:start(inets) , > > application:start(ssl) , > > > > http:set_options( [ {proxy, {{Proxy,Port}, ["localhost"]} } ] ) , > > > > http:request(get, > > {URL, [ {"Version", "HTTP/1.0"}, {"Referer", URL}, > > {"Host", "www.myhost.org"} ]}, [], []). > > > > $ uname -a > > Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux > > $ erl > > Erlang (BEAM) emulator version 5.4.4 [source] [hipe] > > > > Eshell V5.4.4 (abort with ^G) > > 1> c:c(hd). > > {ok,hd} > > 2> hd:hd("my.proxy.org",3128,"https://test.xquad.com"). > > {error,esslerrssl} > > 3> hd:hd("my.proxy.org",3128,"http://www.quickbots.com"). > > {ok,{{"HTTP/1.0",200,"OK"}, > > [{"date","Wed, 23 Feb 2005 01:34:04 GMT"}, > > {"via","1.0 cougora.autosys.us (squid/3.0-PRE3)"}, > > {"etag","\"15481-1ee2-da976100\""}, > > {"server","Apache"}, > > {"content-length","7906"}, > > {"content-type","text/html; charset=ISO-8859-1"}, > > {"last-modified","Wed, 15 Jan 2003 21:45:08 GMT"}, > > {"accept-ranges","bytes"}, > > {"x-cache","MISS from cougora.autosys.us"}, > > {"x-cache-lookup","HIT from cougora.autosys.us:3128"}, > > {"proxy-connection","keep-alive"}], > > "\r\n\r\n\r\n > 4> halt(). > > $ > > > > The problem appears to be (looking at a trace) that the initial packets being sent by > > hd:hd("my.proxy.org",3128,"https://test.xquad.com"). > > to my.proxy.org is all encrypted, rather than being a request that the proxy server > > can read, so the proxy server passes back the error INVALID REQUEST. As you can see, > > the http:// request works great via proxy. > > > > > > thank you, > > > > ~Michael > > -- > /m.v.h Ingela > > //The highway of life is always under construction. // > > |\ _,,,--,,_ ,) > /,`.-'`' -, ;-;;' > |,4- ) )-,_ ) /\ > '---''(_/--' (_/-' > > Ericsson AB - OTP team > > Cellular/Mobile: +46 70 636 78 68 > > > > From adam.aquilon@REDACTED Thu Feb 24 10:07:44 2005 From: adam.aquilon@REDACTED (Adam Aquilon) Date: Thu, 24 Feb 2005 10:07:44 +0100 Subject: Restoring single-host Mnesia backup on another host? (Best practices?) Message-ID: <421D9960.2070103@home.se> Hi all! I'm wondering if it is possible to do a mnesia:backup/1 on one host (schema with multiple nodes), transfer that file to another host (different hostname,IP) and restore it there? Background: We have a simple system running as 3-4 nodes on a single linux host. Some tables are shared among the nodes, others are local. We do periodic backups of the data in all tables by calling mnesia:backup/1 from a cron job. We'd like to have another host as a standby machine in case the first one has some kind of problem. (Note: The erlang software must not be running on the standby machine.) It would be nice to be able to propagate the backup files to the standby machine on a regular basis, and then, if the live machine fails, be able to just startup the system on the standby machine, load the backup and continue running! Does Mnesia have the ability to replace, ignore or bypass hostnames in its housekeeping information? Or is there an easy way of doing this kind of thing in a restore filter of some kind? Maybe some other solution to the general problem? (The preferred solution would be to use Mnesia in distributed mode between the two hosts, but that won't work in our case.) I realize that replacing host-specific stuff in the table *contents* would be very tricky, but we'll handle that specific problem ourselves. /Adam Aquilon From ulf.wiger@REDACTED Thu Feb 24 10:34:39 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 24 Feb 2005 10:34:39 +0100 Subject: Restoring single-host Mnesia backup on another host? (Best practices?) Message-ID: Yes, look at mnesia:traverse_backup() See http://www.erlang.se/doc/doc-5.4.3/lib/mnesia-4.2/doc/html/Mnesia_chap7.html#6.9 where you also have an code example doing backup traversal. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Adam Aquilon > Sent: den 24 februari 2005 10:08 > To: erlang-questions@REDACTED > Subject: Restoring single-host Mnesia backup on another host? (Best > practices?) > > > Hi all! > > I'm wondering if it is possible to do a mnesia:backup/1 on one > host (schema with multiple nodes), transfer that file to another > host (different hostname,IP) and restore it there? > > > Background: > > We have a simple system running as 3-4 nodes on a single linux host. > Some tables are shared among the nodes, others are local. > We do periodic backups of the data in all tables by calling > mnesia:backup/1 from a cron job. > > We'd like to have another host as a standby machine in case the first > one has some kind of problem. (Note: The erlang software must not > be running on the standby machine.) > > It would be nice to be able to propagate the backup files to > the standby > machine on a regular basis, and then, if the live machine > fails, be able > to just startup the system on the standby machine, load the backup and > continue running! > > Does Mnesia have the ability to replace, ignore or bypass hostnames in > its housekeeping information? > > Or is there an easy way of doing this kind of thing in a > restore filter > of some kind? > > Maybe some other solution to the general problem? > (The preferred solution would be to use Mnesia in distributed mode > between the two hosts, but that won't work in our case.) > > I realize that replacing host-specific stuff in the table *contents* > would be very tricky, but we'll handle that specific problem > ourselves. > > > /Adam Aquilon > > > From sebastian@REDACTED Thu Feb 24 14:46:41 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Thu, 24 Feb 2005 11:46:41 -0200 Subject: Generating HTML from Erlang Message-ID: <015701c51a77$45d5d840$3000a8c0@Inswitch261> Hi list, I'm writing a web application with Erlang. I would like to separate application logic from user interface (html), so I'm using a controller module for the former and esps for the latter. I have an old version of esp.beam; does anybody know if there are new versions? I would also like to pass records to the esp, as I think this could be a flexible approach (I can retrieve data from the database as records and show them on the esp, and use names and not positions to retrieve the columns). Does anybody know if there is a way to work with records from an esp? If esps are discontinued or no longer supported, what other approach would you suggest (other than generating html programatically)? Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastian@REDACTED Thu Feb 24 20:17:30 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Thu, 24 Feb 2005 17:17:30 -0200 Subject: ISO8583 support in Erlang Message-ID: <026101c51aa5$7d2240d0$3000a8c0@Inswitch261> Hi all, does anybody know of a library to handle ISO8583 messages? Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Thu Feb 24 20:13:40 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 24 Feb 2005 19:13:40 +0000 Subject: XML over HTTP In-Reply-To: <20050224053743.GB14094@fangora.autosys.us> References: <20050224053743.GB14094@fangora.autosys.us> Message-ID: <2dc890fd0fe6f0bc8f34be9af47b3e5d@mac.com> On 24 Feb 2005, at 05:37, Michael McDaniel wrote: > This question is kind of to Sean Hinde in reference to this past > message: > > http://www.erlang.org/ml-archive/erlang-questions/200101/msg00050.html > > where Sean said, among other things, > "XML over HTTP - this is what we chose. The Java side sends Erlang a > HTTP > POST containing some XML with the data. Erlang responds with an XML > result." > > QUESTION: Is there any code publicly available that demonstrates this? This was a pretty simple erlang program - just a callback from inets. The snippet below from a real system is not complete but should show the general principle. I've no idea what the Java side looked like - it was done by some enterprise integration team. Imagining it was more than enough. Sean %% Callback from inets - specified in httpd.conf getRingtoneCategories(Env, Data) -> count:inc({melody_idc, web_wap, get_cate}), case catch get_ringtone_categories(Env, Data) of {ok, XML} -> count:inc({melody_idc, web_wap, get_cate_ok}), XML; {error, Reason} -> count:inc({melody_idc, web_wap, get_cate_err}), xml_error(Reason); {'EXIT', Reason} -> count:inc({melody_idc, web_wap, get_cate_exit}), xml_error("Unrecoverable Error") end. get_ringtone_categories(Env, Data) -> TVL = httpd:parse_query(Data), Operator = case lists:keysearch("filter_operator", 1, TVL) of {value, {_, Op}} -> list_to_atom(Op); false -> throw({error, "Missing Operator filter"}) end, Genres = do_rpc(?melody_node, melody_ringtone, list_genres_for_web, [Operator], ?timeout), {ok, ["Content-Type: text/xml\r\n\r\n", "", "", lists:map(fun({G, Qty}) -> ["\r\n" "",esc(G),"\r\n" "",integer_to_list(Qty),"\r\n" "\r\n"] end, Genres), "\r\n"]}. From sebastian@REDACTED Fri Feb 25 12:16:57 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 25 Feb 2005 09:16:57 -0200 Subject: Sessions in httpd Message-ID: <003901c51b2b$85c45f30$3000a8c0@Inswitch261> Hi, does httpd support sessions? Where can I find the corresponding documentation? Thanks, Sebastian- -------------- next part -------------- An HTML attachment was scrubbed... URL: From keymon@REDACTED Fri Feb 25 17:13:31 2005 From: keymon@REDACTED (=?iso-8859-1?q?H=E9ctor_Rivas_G=E1ndara?=) Date: Fri, 25 Feb 2005 17:13:31 +0100 Subject: erl_errno variable in EI library Message-ID: <200502251713.31549.keymon@wanadoo.es> Hi, I'm using EI library in a multithreaded enviroment: I have one thread to send data and other to receive. Somewhere says that EI is thread safe. I have a problem sometimes using ei_x_receive_tmo() function. This functon sometimes returns ERL_ERROR but erl_errno == 0. I don't known what does that mean. I'm actuIly ignoring the error using a while loop. -- Saludos ;) Keymon ... Insumiso se pasa el DOOM sin disparar un solo tiro From mats.cronqvist@REDACTED Fri Feb 25 17:23:13 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Fri, 25 Feb 2005 17:23:13 +0100 Subject: binary constructor In-Reply-To: References: <20050221203109.GY55871@frogman.motivity.ca> Message-ID: <421F50F1.8080709@ericsson.com> so i read this in the reference manual (http://www.erlang.se/doc/doc-5.4/doc/reference_manual/part_frame.html); <> Ei = Value | Value:Size | Value/TypeSpecifierList | Value:Size/TypeSpecifierList used in a binary construction, Value is an expression which should evaluate to an integer, float or string. If the expression is something else than a single literal or variable, it should be enclosed in parenthesis. this leads me to believe i should be able to do this; A = "123", <>. alas, i get a badarg. can somone please point out my mistake? mats From kostis@REDACTED Fri Feb 25 17:35:30 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 25 Feb 2005 17:35:30 +0100 (MET) Subject: binary constructor In-Reply-To: Mail from 'Mats Cronqvist ' dated: Fri, 25 Feb 2005 17:23:13 +0100 Message-ID: <200502251635.j1PGZU5r025567@spikklubban.it.uu.se> > so i read this in the reference manual > (http://www.erlang.se/doc/doc-5.4/doc/reference_manual/part_frame.html); > > <> > > Ei = Value | > Value:Size | > Value/TypeSpecifierList | > Value:Size/TypeSpecifierList > > used in a binary construction, Value is an expression which should > evaluate to an integer, float or string. Congratulations, you've found a typo in the manual! The above line should read "evaluate to an integer, float or binary". Kostis From sebastian@REDACTED Fri Feb 25 17:55:54 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Fri, 25 Feb 2005 14:55:54 -0200 Subject: binary constructor References: <20050221203109.GY55871@frogman.motivity.ca> <421F50F1.8080709@ericsson.com> Message-ID: <00e401c51b5a$e3218ac0$3000a8c0@Inswitch261> Hi Mats, I'm not sure if this is the correct way to do it, but it works. Try list_to_binary("123"). And to decode it Binary=list_to_binary("123"), <> = Binary, binary_to_list(Bin). If there's a better way to do it, I would like to know it too. Sebastian- ----- Original Message ----- From: "Mats Cronqvist" To: Sent: Friday, February 25, 2005 2:23 PM Subject: binary constructor > so i read this in the reference manual > (http://www.erlang.se/doc/doc-5.4/doc/reference_manual/part_frame.html); > > <> > > Ei = Value | > Value:Size | > Value/TypeSpecifierList | > Value:Size/TypeSpecifierList > > used in a binary construction, Value is an expression which should evaluate to > an integer, float or string. If the expression is something else than a single > literal or variable, it should be enclosed in parenthesis. > > > this leads me to believe i should be able to do this; > > A = "123", > <>. > > alas, i get a badarg. > can somone please point out my mistake? > > mats > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Fri Feb 25 19:18:51 2005 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 25 Feb 2005 19:18:51 +0100 Subject: binary constructor In-Reply-To: <421F50F1.8080709@ericsson.com> References: <20050221203109.GY55871@frogman.motivity.ca> <421F50F1.8080709@ericsson.com> Message-ID: <421F6C0B.9070304@csd.uu.se> Mats Cronqvist wrote: > "...used in a binary construction, Value is an expression which should > evaluate to an integer, float or string. If the expression is something > else than a single literal or variable, it should be enclosed in > parenthesis." > > this leads me to believe i should be able to do this; > > A = "123", > <>. > > alas, i get a badarg. > can somone please point out my mistake? The manual also states the following, a couple of lines below: "Note that, for example, using a string literal as in <<"abc">> is syntactic sugar for <<$a,$b,$c>>." Unfortunately, that's all it is - syntactic sugar for a sequence of integers (bytes, actually; Erlang uses iso8859-1). The previous statement that the expression "should evaluate to ... or string" is false; it may not evaluate to a string (list of integers) at runtime. The suggestion by S. Bello that the string value is first explicitly converted to a binary is probably the best that can be done in the general case, but it depends on the context, i.e., what you want to include with the string A in the binary. For example, there is no point in doing: A = list_to_binary(As), B = list_to_binary(Bs), Bin = <> (creating 2 temporary binaries) since you can simply do Bin = list_to_binary([As,Bs]) if you're just concatenating bytes. (The deep list passed to list_to_binary can also contain binaries.) /Richard From luna@REDACTED Fri Feb 25 19:20:52 2005 From: luna@REDACTED (Daniel Luna) Date: Fri, 25 Feb 2005 19:20:52 +0100 (CET) Subject: binary constructor In-Reply-To: <200502251635.j1PGZU5r025567@spikklubban.it.uu.se> References: <200502251635.j1PGZU5r025567@spikklubban.it.uu.se> Message-ID: On Fri, 25 Feb 2005, Kostis Sagonas wrote: > > so i read this in the reference manual > > (http://www.erlang.se/doc/doc-5.4/doc/reference_manual/part_frame.html); > > > > <> > > > > Ei = Value | > > Value:Size | > > Value/TypeSpecifierList | > > Value:Size/TypeSpecifierList > > > > used in a binary construction, Value is an expression which should > > evaluate to an integer, float or string. > > Congratulations, you've found a typo in the manual! The above line should > read "evaluate to an integer, float or binary". Well only sort of a bug. <<"string">> works. So if the string is a constant known at compile time you can use this form. /Luna -- Daniel Luna | Top reasons that I have a beard: luna@REDACTED | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From klacke@REDACTED Fri Feb 25 21:10:03 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Fri, 25 Feb 2005 21:10:03 +0100 Subject: Sessions in httpd In-Reply-To: <003901c51b2b$85c45f30$3000a8c0@Inswitch261> References: <003901c51b2b$85c45f30$3000a8c0@Inswitch261> Message-ID: <20050225201002.GA22693@hyber.org> On Fri, Feb 25, 2005 at 09:16:57AM -0200, Sebastian Bello wrote: > Hi, > > does httpd support sessions? Where can I find the corresponding documentation? at http://yaws.hyber.org :-) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From hal@REDACTED Fri Feb 25 22:01:38 2005 From: hal@REDACTED (Hal Snyder) Date: Fri, 25 Feb 2005 15:01:38 -0600 Subject: How to configure processes, (and applications) In-Reply-To: (Anders Nygren's message of "Mon, 21 Feb 2005 11:53:54 -0600") References: <20050221.223559.51283463.svg@surnet.ru> Message-ID: <873bvk2w25.fsf@ghidra.vail> Anders Nygren writes: > On Mon, 21 Feb 2005 22:35:59 +0500 (YEKT), Vladimir Sekissov > wrote: >> Good day, > > SNIP > >> >> IMHO this way is more verbose but more flexible than direct OTP >> one(but compatible). >> >> I can send you code if you want one. >> > Hi > I am not sure I completely understand what You are doing > but please send some code as this looks interesting. > > Does Your method also support configuration changes > while the system is running? On a telephony platform we regularly have the following requirements: - change config without restarting servers/nodes/processes - change persists when things are restarted - change is picked up when systems are replaced or added Specifying configuration in config files or command line commits you to real-time edits in the above cases. So, is there a way to store things in a distributed, non-volatile, scalable database (which is read-mostly, if you want to take advantage of that property) in Erlang/OTP? Answer is yes, there is: mnesia. There are bootstrap issues making sure OTP nodes all find each other and sync up properly. See extra_db_nodes posting to this list, e.g.: http://www.erlang.org/ml-archive/erlang-questions/200502/msg00176.html Also with any replicated database, you will go nuts with partition-and-reconnect unless you consider the requirements of the situation and system topology during design. From rich.neswold@REDACTED Sun Feb 27 04:34:39 2005 From: rich.neswold@REDACTED (Rich Neswold) Date: Sat, 26 Feb 2005 21:34:39 -0600 Subject: Adding non-erlang modules to releases Message-ID: <14cf844b05022619347fc191d4@mail.gmail.com> Hello, I've search through the vast amounts of Erlang documentation, but couldn't find an answer to this problem. Maybe someone on the list can help. I've put together a small Erlang application. I've set up the .app files and .rel file to build the boot script. The problem is that my application requires a port driver that I wrote and I don't know how to include the driver in any of the .app/.rel files. When I start my application with the -boot option, it appears to load and start everything, but fails when my app calls erl_ddll:load_driver (because the .so file wasn't put in the proper spot -- and I don't know what the "proper spot" is, since the documentation gets a little sparse when it comes to including port drivers in a release.) If anyone has solved this problem, I'd love to hear of the solution. (I also plan on going one step further and building the release tar file, so any hints on how to include my .so file would be even more appreciated!) -- Rich AIM : rnezzy ICQ : 174908475 From orbitz@REDACTED Sun Feb 27 07:49:08 2005 From: orbitz@REDACTED (orbitz) Date: Sun, 27 Feb 2005 01:49:08 -0500 Subject: Streaming Input Message-ID: <42216D64.9050103@ezabel.com> I am working with a protocol where the size of the following block is told to me so I can just convert the next N bytes to, say, a string. The problem is though, I'm trying to write this so it handles a stream properly, so in the binary I have could be all N bytes that I need, or something less than N. So at first I tried: extract_string(Tail, 0, Res) -> {ok, {string, Res}, Tail}; extract_string(<>, Length, Res) -> extract_string(Tail, Length - 1, lists:append(Res, [H])); extract_string(<<>>, Length, Res) -> case dispatch_message() of {decode, _, Data} -> extract_string(Data, Length, Res) end. When the binary is empty but I still need more data it waits for more. I don't know if this is the proper idiom (it seems gross to me but I am unsure of how to do it otherwise). This is incredibly slow though. With a long string that I need to extract it takes a lot of CPU and far too long. So I decided to do: extract_string(Data, Length, _) -> <> = Data, {ok, {string, binary_to_list(String)}, Tail}. In terms of CPU and time this is much much better, but if I don't have all N bytes it won't work. Any suggestions? From sean.hinde@REDACTED Sun Feb 27 12:14:52 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Sun, 27 Feb 2005 11:14:52 +0000 Subject: Adding non-erlang modules to releases In-Reply-To: <14cf844b05022619347fc191d4@mail.gmail.com> References: <14cf844b05022619347fc191d4@mail.gmail.com> Message-ID: <437bf7a26e789702a3ebed272d21e7d8@mac.com> On 27 Feb 2005, at 03:34, Rich Neswold wrote: > Hello, > > I've search through the vast amounts of Erlang documentation, but > couldn't find an answer to this problem. Maybe someone on the list can > help. > > I've put together a small Erlang application. I've set up the .app > files and .rel file to build the boot script. The problem is that my > application requires a port driver that I wrote and I don't know how > to include the driver in any of the .app/.rel files. When I start my > application with the -boot option, it appears to load and start > everything, but fails when my app calls erl_ddll:load_driver (because > the .so file wasn't put in the proper spot -- and I don't know what > the "proper spot" is, since the documentation gets a little sparse > when it comes to including port drivers in a release.) > > If anyone has solved this problem, I'd love to hear of the solution. > (I also plan on going one step further and building the release tar > file, so any hints on how to include my .so file would be even more > appreciated!) The common solution to this is to put the .so file in the priv subdirectory of the app that uses it. systools and friends have an option to include priv directories in the build. code:priv_dir(app). wil then give you the location of your .so file at runtime. Sean From klacke@REDACTED Sun Feb 27 15:44:21 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Sun, 27 Feb 2005 15:44:21 +0100 Subject: Adding non-erlang modules to releases In-Reply-To: <14cf844b05022619347fc191d4@mail.gmail.com> References: <14cf844b05022619347fc191d4@mail.gmail.com> Message-ID: <20050227144420.GA29571@hyber.org> On Sat, Feb 26, 2005 at 09:34:39PM -0600, Rich Neswold wrote: > everything, but fails when my app calls erl_ddll:load_driver (because > the .so file wasn't put in the proper spot -- and I don't know what > the "proper spot" is, since the documentation gets a little sparse > when it comes to including port drivers in a release.) I typically put .so file in the priv dir of the application Thus Makefile in myapp/c_src/Makefile produce driver .so files and excetuables in ../priv and the erlang code can do: Driver = file_name:join([code:privdir(myapp), "driver.so"]), erl_ddll:load_driver(Driver), open_port({spawn, "driver},[]) /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From klacke@REDACTED Sun Feb 27 15:46:09 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Sun, 27 Feb 2005 15:46:09 +0100 Subject: Adding non-erlang modules to releases In-Reply-To: <14cf844b05022619347fc191d4@mail.gmail.com> References: <14cf844b05022619347fc191d4@mail.gmail.com> Message-ID: <20050227144609.GB29571@hyber.org> On Sat, Feb 26, 2005 at 09:34:39PM -0600, Rich Neswold wrote: > everything, but fails when my app calls erl_ddll:load_driver (because > the .so file wasn't put in the proper spot -- and I don't know what > the "proper spot" is, since the documentation gets a little sparse > when it comes to including port drivers in a release.) An alternative if the infrastrcture for code:privdir() isn't in place is: erl_ddll:load_driver(filename:dirname(code:which(?MODULE)) ++ "/../priv/", "driver"), P = open_port({spawn, "driver"},[]), /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From tobbe@REDACTED Sun Feb 27 16:04:08 2005 From: tobbe@REDACTED (=?ISO-8859-1?Q?Torbj=F6rn_T=F6rnkvist?=) Date: Sun, 27 Feb 2005 16:04:08 +0100 Subject: www.trapexit.org Message-ID: <4221E168.4050305@nortel.com> Hello Erlang friends, We are pleased to announce a new Web site, www.trapexit.o rg Over the years we have had plenty of discussions on how to best promote Erlang. As an answer to this we have created a Web Site where we hope to be able to gather as much useful info as possible. The intention is not to replace erlang.org, but rather to complement it by create a living site for the Erlang community. Right now it contains: + A Discussion forum, using phpBB, where we have bridged the Erlang mailing lists into the forums. + A document store where you can upload HowTo-documentation. + An on-line man-page browser. + Browse access to a Jungerl repository which is updated daily. + An experimental chat area (written in Erlang and Javascript) + Links to other Erlang information. We are also working on a RSS aggregator for collecting Erlang blogs information (if there are any such blogs... ?) Note that this is only a start, we plan to maintain and extend the site (forever...) if there seem to be enough interest from the Erlang community. (and don't hesitate to send us tips or suggestions on how to improve the site) Cheers, Tobbe and Jocke (Ps. I hope you didn't get this mail twice, I've had a subscription problem because of a changed email address.) From mikael.karlsson@REDACTED Sun Feb 27 17:24:12 2005 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sun, 27 Feb 2005 17:24:12 +0100 Subject: How to configure processes, (and applications) In-Reply-To: <20050222.015620.95819935.svg@surnet.ru> References: <20050221.223559.51283463.svg@surnet.ru> <20050221.233604.134116332.svg@surnet.ru> <20050222.015620.95819935.svg@surnet.ru> Message-ID: <200502271724.12195.mikael.karlsson@creado.com> Actually your attachement looks pretty cool, could you elaborate on what it does, the documentation seems to be much in the code :-) Best Regards Mikael m?ndag 21 februari 2005 21:56 skrev Vladimir Sekissov: > Oops, > > I'm awfully sorry for all subscribers. > I've sent ~1Mb attachment to the mail-list. > > Best Regards, > Vladimir Sekissov From luke@REDACTED Sun Feb 27 18:05:00 2005 From: luke@REDACTED (Luke Gorrie) Date: 27 Feb 2005 18:05:00 +0100 Subject: www.trapexit.org References: <4221E168.4050305@nortel.com> Message-ID: Torbj?rn T?rnkvist writes: > + An experimental chat area (written in Erlang and Javascript) So why aren't you connected to it? :-) I predict that either lots of people will join this chat area right now and it'll be a big hit forever, or else everyone waits a bit and then join/leave at different times and think nobody uses it :-) -Luke "killed the Wiki forever by taking it offline for a few months" Gorrie From mikael.karlsson@REDACTED Sun Feb 27 18:46:06 2005 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Sun, 27 Feb 2005 18:46:06 +0100 Subject: www.trapexit.org In-Reply-To: <4221E168.4050305@nortel.com> References: <4221E168.4050305@nortel.com> Message-ID: <200502271846.06454.mikael.karlsson@creado.com> Great initiative, but how do you relate to the already existing erlang-projects.org site? Cheers Mikael s?ndag 27 februari 2005 16:04 skrev Torbj?rn T?rnkvist: > Hello Erlang friends, > > We are pleased to announce a new Web site, www.trapexit.o > rg > > Over the years we have had plenty of discussions on how to best > promote Erlang. As an answer to this we have created a Web Site > where we hope to be able to gather as much useful info as possible. > The intention is not to replace erlang.org, but rather to complement > it by create a living site for the Erlang community. > > Right now it contains: > > + A Discussion forum, using phpBB, where we have bridged > the Erlang mailing lists into the forums. > + A document store where you can upload HowTo-documentation. > + An on-line man-page browser. > + Browse access to a Jungerl repository which is updated daily. > + An experimental chat area (written in Erlang and Javascript) > + Links to other Erlang information. > > We are also working on a RSS aggregator for collecting Erlang blogs > information (if there are any such blogs... ?) > > Note that this is only a start, we plan to maintain and extend the site > (forever...) if there seem to be enough interest from the Erlang community. > (and don't hesitate to send us tips or suggestions on how to improve the > site) > > Cheers, Tobbe and Jocke > (Ps. I hope you didn't get this mail twice, I've had a subscription > problem because of a changed email address.) From sean.hinde@REDACTED Sun Feb 27 19:04:31 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Sun, 27 Feb 2005 18:04:31 +0000 Subject: www.trapexit.org In-Reply-To: <4221E168.4050305@nortel.com> References: <4221E168.4050305@nortel.com> Message-ID: <6ede14f9a9f556c6fe68d02755b8e5d2@mac.com> On 27 Feb 2005, at 15:04, Torbj?rn T?rnkvist wrote: > Hello Erlang friends, > > We are pleased to announce a new Web site, www.trapexit.o > rg > > Over the years we have had plenty of discussions on how to best > promote Erlang. As an answer to this we have created a Web Site > where we hope to be able to gather as much useful info as possible. > The intention is not to replace erlang.org, but rather to complement > it by create a living site for the Erlang community. Congratulations guys. This is a beautiful piece of work. Really fantastic. Small nit - I can't get the forum pages to appear in Safari at all - I guess that Safari is getting confused by an extra CR at the end of the first of the chunked encoding chunks - after the text: "noone will know ;)" I haven't actually gone through and counted the bytes to see for sure, but this looks a little odd - it is certainly where Safari gives up decoding the page. It might also be worth having a general discussion topic in the forum in addition to the mailing list bridge. Great stuff! Sean From matthias@REDACTED Sun Feb 27 20:00:12 2005 From: matthias@REDACTED (Matthias Lang) Date: Sun, 27 Feb 2005 20:00:12 +0100 Subject: why the parentheses after typenames? Message-ID: <16930.6332.96785.360904@beladrome.corelatus.se> Hi, something I've wondered a few times. In the documentation, types are often denoted by putting parentheses after names, e.g. len(String) -> Length Types: String = string() Length = integer() what's behind this? Is there an explanation somewhere? Another example: (from erlang:nodes/0) ArgList = [ArgAtom] I'm guessing "[ArgAtom]" means "a list of ArgAtom which may be empty". But how do I express the return type consisting of a list with exactly one element? Does all this come from one of the earlier type checkers? Matthias From kostis@REDACTED Sun Feb 27 20:26:41 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 27 Feb 2005 20:26:41 +0100 (MET) Subject: why the parentheses after typenames? In-Reply-To: Mail from 'Matthias Lang ' dated: Sun, 27 Feb 2005 20:00:12 +0100 Message-ID: <200502271926.j1RJQfnR019330@spikklubban.it.uu.se> Matthias Lang asked: > > something I've wondered a few times. In the documentation, types are > often denoted by putting parentheses after names, e.g. > > len(String) -> Length > > Types: > String = string() > Length = integer() > > what's behind this? Is there an explanation somewhere? I am assuming this is so that the type integer() is distinguishable from the atom 'integer'. Kostis From pascal.brisset@REDACTED Sun Feb 27 20:33:31 2005 From: pascal.brisset@REDACTED (Pascal Brisset) Date: Sun, 27 Feb 2005 20:33:31 +0100 Subject: why the parentheses after typenames? In-Reply-To: <16930.6332.96785.360904@beladrome.corelatus.se> References: <16930.6332.96785.360904@beladrome.corelatus.se> Message-ID: <20050227193239.95B0E29B51B@postfix4-1.free.fr> Matthias Lang writes: > something I've wondered a few times. In the documentation, types are > often denoted by putting parentheses after names, e.g. This is consistent with the notation for parametric types, e.g. queue:in(T, queue(T)) -> queue(T). lists:map(fun(A)->B, list(A)) -> list(B). "string()" is a named type with no type parameters. "string" is the type of the atom 'string'. > I'm guessing "[ArgAtom]" means "a list of ArgAtom which may be > empty". Yes, [T] is syntactic sugar for list(T). > But how do I express the return type consisting of a list with > exactly one element? Very few practical typecheckers can deal with lists of a specific length. Keywords : dependent types, coq, cayenne. -- Pascal From luke@REDACTED Sun Feb 27 20:46:43 2005 From: luke@REDACTED (Luke Gorrie) Date: 27 Feb 2005 20:46:43 +0100 Subject: www.trapexit.org References: <4221E168.4050305@nortel.com> <6ede14f9a9f556c6fe68d02755b8e5d2@mac.com> Message-ID: Sean Hinde writes: > Small nit - I can't get the forum pages to appear in Safari at all - I > guess that Safari is getting confused by an extra CR at the end of the > first of the chunked encoding chunks - after the text: I also get a blank on the forum using Firefox 1.0 through Squid. Was Forums the place to create an account or is it somewhere else? I want a new one with a shorter name like everyone else has :-) From hakan.stenholm@REDACTED Mon Feb 28 00:05:11 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 28 Feb 2005 00:05:11 +0100 Subject: Streaming Input In-Reply-To: <42216D64.9050103@ezabel.com> References: <42216D64.9050103@ezabel.com> Message-ID: <42225227.2060304@mbox304.swipnet.se> orbitz wrote: > I am working with a protocol where the size of the following block is > told to me so I can just convert the next N bytes to, say, a string. > The problem is though, I'm trying to write this so it handles a stream > properly, so in the binary I have could be all N bytes that I need, or > something less than N. So at first I tried: > > extract_string(Tail, 0, Res) -> > {ok, {string, Res}, Tail}; > extract_string(<>, Length, Res) -> > extract_string(Tail, Length - 1, lists:append(Res, [H])); > extract_string(<<>>, Length, Res) -> > case dispatch_message() of > {decode, _, Data} -> > extract_string(Data, Length, Res) > end. extract_string(Tail, 0, Res) -> {ok, {string, lists:reverse(Res)}, Tail}; %% when done reverse list back to intended order extract_string(<>, Length, Res) -> extract_string(Tail, Length - 1, [H | Res]); %% turn O(N) operation into O(1) op. extract_string(<<>>, Length, Res) -> case dispatch_message() of {decode, _, Data} -> extract_string(Data, Length, Res) end. This version will be much faster than the original version, because appending elements to the end of a list is a O(N) operation which is done N times (O(N2)) - instead append to front of list (O(1) operation) and reverse the list when your done with accumulating the (Res) list (O(N)). > > When the binary is empty but I still need more data it waits for > more. I don't know if this is the proper idiom (it seems gross to me > but I am unsure of how to do it otherwise). This is incredibly slow > though. With a long string that I need to extract it takes a lot of > CPU and far too long. So I decided to do: > > extract_string(Data, Length, _) -> > <> = Data, > {ok, {string, binary_to_list(String)}, Tail}. You probably want something like this: extract_string(Data, Length, _) -> DataLength = size(Data), %% get length of Data L = case DataLength >= Length of true -> Length; false -> DataLength end, <> = Data, {ok, {string, binary_to_list(String)}, Tail}. This should be able to extract as much data as possible in a single binary access - this should be slightly faster than my pervious extract_string/3 update above. > > In terms of CPU and time this is much much better, but if I don't have > all N bytes it won't work. Any suggestions? > From hakan.stenholm@REDACTED Mon Feb 28 00:29:31 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 28 Feb 2005 00:29:31 +0100 Subject: Streaming Input In-Reply-To: <422200B0.3050300@ezabel.com> References: <42216D64.9050103@ezabel.com> <4221CC7A.4080000@mbox304.swipnet.se> <422200B0.3050300@ezabel.com> Message-ID: <422257DB.9050301@mbox304.swipnet.se> orbitz wrote: > Thank you for your quick and insightful reply. I have one other > question. the portion of my code where I check to see if the data is > empty but I'm not done extracting the string so I wait for more data, > is this how things are commonly handled? A common erlang way is to spawn a gen_server (process) to handle incoming data in a non-blocking manner. Depending on your application you may then simply wait for a complete data block to arrive which should simplify the parsing. > I have several things like extract_string, extract_integer, > extract_list etc, for dealing with the different datatypes of my > format, and all of them require this little peice of code. it seems as > though I should have some sort of central place where this is done and > dispatched back to the function. One way you could write a general purpose extract function would be to supply a function as a argument: extract(Data, Length, _, Fun) -> DataLength = size(Data), L = case DataLength >= Length of true -> Length; false -> DataLength end, <> = Data, {ok, Fun(BinData), Tail}. %% apply function Fun to BinData This may possibly be parameterized with a type: extract(Data, Length, _, Fun, Type) -> DataLength = size(Data), L = case DataLength >= Length of true -> Length; false -> DataLength end, <> = Data, {ok, {Type, Fun(BinData, Type)}, Tail}. %% supply type data e.g. string | integer | ... In your case, you may also simply do: extract(Data, Length, _, Type) -> DataLength = size(Data), L = case DataLength >= Length of true -> Length; false -> DataLength end, <> = Data, {ok, {Type, convert(BinData, Type)}, Tail}. and supply a convert function with several clauses: convert(Bin, list) -> ... ; convert(Bin, integer) -> ... ; . . . convert(Bin, string) -> ... . > > Thankyou, > > H?kan Stenholm wrote: > >> orbitz wrote: >> >>> I am working with a protocol where the size of the following block >>> is told to me so I can just convert the next N bytes to, say, a >>> string. The problem is though, I'm trying to write this so it >>> handles a stream properly, so in the binary I have could be all N >>> bytes that I need, or something less than N. So at first I tried: >>> >>> extract_string(Tail, 0, Res) -> >>> {ok, {string, Res}, Tail}; >>> extract_string(<>, Length, Res) -> >>> extract_string(Tail, Length - 1, lists:append(Res, [H])); >>> extract_string(<<>>, Length, Res) -> >>> case dispatch_message() of >>> {decode, _, Data} -> >>> extract_string(Data, Length, Res) >>> end. >> >> >> >> extract_string(Tail, 0, Res) -> >> {ok, {string, lists:reverse(Res)}, Tail}; %% when done >> reverse list back to intended order >> extract_string(<>, Length, Res) -> >> extract_string(Tail, Length - 1, [H | Res]); %% turn O(N) >> operation into O(1) op. >> extract_string(<<>>, Length, Res) -> >> case dispatch_message() of >> {decode, _, Data} -> >> extract_string(Data, Length, Res) >> end. >> >> This version will be much faster than the original version, because >> appending elements to the end of a list is a O(N) operation which is >> done N times (O(N^2)) - instead append to front of list (O(1) >> operation) and reverse the list when your done with accumulating the >> (Res) list (O(N)). >> >>> >>> When the binary is empty but I still need more data it waits for >>> more. I don't know if this is the proper idiom (it seems gross to >>> me but I am unsure of how to do it otherwise). This is incredibly >>> slow though. With a long string that I need to extract it takes a >>> lot of CPU and far too long. So I decided to do: >>> >>> extract_string(Data, Length, _) -> >>> <> = Data, >>> {ok, {string, binary_to_list(String)}, Tail}. >> >> >> >> You probably want something like this: >> >> extract_string(Data, Length, _) -> >> DataLength = size(Data), %% get length of Data >> L = case DataLength >= Length of true -> Length; >> false -> DataLength >> end, >> <> = Data, >> {ok, {string, binary_to_list(String)}, Tail}. >> >> This should be able to extract as much data as possible in a single >> binary access - this should be slightly faster than my pervious >> extract_string/3 update above. >> >>> >>> In terms of CPU and time this is much much better, but if I don't >>> have all N bytes it won't work. Any suggestions? >>> >> >> >> >> > > From rich.neswold@REDACTED Mon Feb 28 03:59:39 2005 From: rich.neswold@REDACTED (Rich Neswold) Date: Sun, 27 Feb 2005 20:59:39 -0600 Subject: Adding non-erlang modules to releases In-Reply-To: <437bf7a26e789702a3ebed272d21e7d8@mac.com> References: <14cf844b05022619347fc191d4@mail.gmail.com> <437bf7a26e789702a3ebed272d21e7d8@mac.com> Message-ID: <14cf844b05022718593e710a8a@mail.gmail.com> On Sun, 27 Feb 2005 11:14:52 +0000, Sean Hinde wrote: > The common solution to this is to put the .so file in the priv > subdirectory of the app that uses it. systools and friends have an > option to include priv directories in the build. Thanks for all your replies. I'll try the priv directory solution... -- Rich AIM : rnezzy ICQ : 174908475 From heinrich@REDACTED Mon Feb 28 07:16:23 2005 From: heinrich@REDACTED (Heinrich Venter) Date: Mon, 28 Feb 2005 08:16:23 +0200 Subject: snmp_generic badmatch Message-ID: Some more info on the badmatch I am getting. The snmp_generic:table_info that causes the bad match calls the snmpa_symbolic_store:table_info which eventually calls snmpa_general_db:read. BUT, that function returns false (for not finding the given table in the ets table referenced from snmpa_symbolic_store). I am not familiar enough with the innards of application snmp to know if this is an error, or if I am using snmpa_local_db the wrong way. It looks like snmp_local_db does not reference the same ets table as snmpa_general_db. Is it possible that I have to register the tables created through snmpa_local_db with snmpa_general_db? Any ideas? -]-[einrich SMS "poem" and a category (wild, friendship, love, sorry, funny) to 36444 http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313039333539323a33303639373a2d323a333831 This will take you to the Launchpad site for more info http://asp1.rocketseed.com/RocketSeed/mail/433a32353a313039333539323a33303639373a2d323a333738 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 620 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MTk2LjMwLjc5LjE1NQ== Type: image/gif Size: 12369 bytes Desc: not available URL: From raimo@REDACTED Mon Feb 28 09:53:29 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 28 Feb 2005 09:53:29 +0100 Subject: Streaming Input References: <42216D64.9050103@ezabel.com> Message-ID: Try to collect binaries until their total size is enough. Then split the last binary in the right position, and depending on if your application can accept your string being a list of binaries (an I/O list, it can e.g be sent to a port with no problem) or not, convert the collected binaries into a binary (list_to_binary on the list of binaries) if you need a binary, or convert the collected binaries into lists one at the time and append them together (a bit expensive but far less expensive than taking one byte at the time). The major slowdown in your example one is not that you take one byte at the time, it is that you create a new binary for the tail for every recursion. If you would keep the original binary and the current offset you could use <<_:Offset/binary, Byte, _Tail/binary>> in the matching and just increment Offset for the next recursion. orbitz@REDACTED (orbitz) writes: > I am working with a protocol where the size of the following block is > told to me so I can just convert the next N bytes to, say, a string. > The problem is though, I'm trying to write this so it handles a stream > properly, so in the binary I have could be all N bytes that I need, or > something less than N. So at first I tried: > > extract_string(Tail, 0, Res) -> > {ok, {string, Res}, Tail}; > extract_string(<>, Length, Res) -> > extract_string(Tail, Length - 1, lists:append(Res, [H])); > extract_string(<<>>, Length, Res) -> > case dispatch_message() of > {decode, _, Data} -> > extract_string(Data, Length, Res) > end. > > When the binary is empty but I still need more data it waits for more. > I don't know if this is the proper idiom (it seems gross to me but I > am unsure of how to do it otherwise). This is incredibly slow though. > With a long string that I need to extract it takes a lot of CPU and > far too long. So I decided to do: > > extract_string(Data, Length, _) -> > <> = Data, > {ok, {string, binary_to_list(String)}, Tail}. > > In terms of CPU and time this is much much better, but if I don't have > all N bytes it won't work. Any suggestions? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From bengt.kleberg@REDACTED Mon Feb 28 10:06:13 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 28 Feb 2005 10:06:13 +0100 Subject: www.trapexit.org In-Reply-To: <4221E168.4050305@nortel.com> References: <4221E168.4050305@nortel.com> Message-ID: <4222DF05.4040700@ericsson.com> Torbj?rn T?rnkvist wrote: > Hello Erlang friends, > > We are pleased to announce a new Web site, www.trapexit.o > rg when trying to reach www.trapexit.org from the domain uab.ericsson.se i get: Network Error (tcp_error) A communication error occurred: "No route to host" is that just me? (ie, does everybody else from that domain also get the error?) bengt From mickael.remond@REDACTED Mon Feb 28 10:10:45 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 28 Feb 2005 10:10:45 +0100 Subject: Erlang and Kernel Poll Message-ID: <4222E015.8050403@erlang-fr.org> Hello, I was wondering what was the status of the Kernel Poll support feature in Erlang. I have seen that this feature is fully supported under FreeBSD with the +K flag. What is the status under Linux ? Can the Erlang VM use the 2.6 epoll features ? Thank you ! -- Micka?l R?mond http://www.erlang-projects.org/ From tobbe@REDACTED Mon Feb 28 11:10:19 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 28 Feb 2005 11:10:19 +0100 Subject: www.trapexit.org In-Reply-To: <4222D7A9.8010202@ericsson.com> References: <4221E168.4050305@nortel.com> <4222D7A9.8010202@ericsson.com> Message-ID: <4222EE0B.2060901@nortelnetworks.com> Zoltan Peter Toth wrote: > Hi, > > I'd like to take a look but the site just doesn't answer... > Have you guys disabled access for evil Ericsson-people ? :)))))))))))) > > Cheers, > Zoltan > Amazing, less than 24h after the announce, the Power Supply broke. I've just switched the Power Supply, so give it another try. Sorry, Tobbe (Ps. At the moment it is an old battered box 433 Mz with only 16 GB disc...) From tobbe@REDACTED Mon Feb 28 11:24:26 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Mon, 28 Feb 2005 11:24:26 +0100 Subject: www.trapexit.org In-Reply-To: References: <4221E168.4050305@nortel.com> <6ede14f9a9f556c6fe68d02755b8e5d2@mac.com> Message-ID: <4222F15A.9020400@nortelnetworks.com> Luke Gorrie wrote: >Sean Hinde writes: > > > >>Small nit - I can't get the forum pages to appear in Safari at all - I >>guess that Safari is getting confused by an extra CR at the end of the >>first of the chunked encoding chunks - after the text: >> >> > >I also get a blank on the forum using Firefox 1.0 through Squid. > >Was Forums the place to create an account or is it somewhere else? >I want a new one with a shorter name like everyone else has :-) > > > > Ok, we are using the Yaws as a revproxy in front of an Apache running the forum. That part of the Yaws code is somewhat experimental and obviously not bug free. Instead you can try and reach the forums directly at: http://forums.trapexit.org:81/phpBB/ And yes, the forum is where you can create an account. Cheers, Tobbe From joe.armstrong@REDACTED Mon Feb 28 10:25:26 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Mon, 28 Feb 2005 10:25:26 +0100 Subject: Streaming Input Message-ID: use binaries - that's what they are for First write something like this: extract(BinIn, Need, BinAcc) -> Got = size(BinIn), if Got > Need -> {Before, After} = split_binary(BinIn, Need), Result = concat_binary([BinAcc, Before]), {done, Result, After}; Got == Need -> Result = concat_binary([BinAcc,BinIn]), {done, Result, <<>>}; Got < Need -> BinAcc1 = concat_binary([BinAcc, BinIn]), {more, Need - Got, BinAcc1} end. here in extract(BinIn, Need, BinAcc) More and Sofar are binaries Need is the required block length if size(BinIn) > Need we split the block into two chunks and return {done, Bin, After} Bin = is the data you need otherwise {more, Need-Got, BinAcc} BinAcc is a binary accumulator containing all the data received so far. Then just arrange so code to call this Cheers /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of orbitz > Sent: den 27 februari 2005 07:49 > To: erlang-questions@REDACTED > Subject: Streaming Input > > > I am working with a protocol where the size of the following block is > told to me so I can just convert the next N bytes to, say, a string. > The problem is though, I'm trying to write this so it handles > a stream > properly, so in the binary I have could be all N bytes that I > need, or > something less than N. So at first I tried: > > extract_string(Tail, 0, Res) -> > {ok, {string, Res}, Tail}; > extract_string(<>, Length, Res) -> > extract_string(Tail, Length - 1, lists:append(Res, [H])); > extract_string(<<>>, Length, Res) -> > case dispatch_message() of > {decode, _, Data} -> > extract_string(Data, Length, Res) > end. > > When the binary is empty but I still need more data it waits > for more. > I don't know if this is the proper idiom (it seems gross to > me but I am > unsure of how to do it otherwise). This is incredibly slow though. > With a long string that I need to extract it takes a lot of > CPU and far > too long. So I decided to do: > > extract_string(Data, Length, _) -> > <> = Data, > {ok, {string, binary_to_list(String)}, Tail}. > > In terms of CPU and time this is much much better, but if I > don't have > all N bytes it won't work. Any suggestions? > From csanto@REDACTED Mon Feb 28 10:32:09 2005 From: csanto@REDACTED (Corrado Santoro) Date: Mon, 28 Feb 2005 10:32:09 +0100 Subject: Forcing socket close in http Message-ID: <4222E519.1000405@diit.unict.it> Hello, I'm using the http client in inets and I'm sending synchronous requests. It seems that the client does not close the socket after terminating a transaction, but I need such a closing. Is there anyone that could help me? Cheers, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382380 Fax: +39 095 7382397 +39 095 7382365 +39 095 7382364 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From mats.cronqvist@REDACTED Mon Feb 28 11:36:25 2005 From: mats.cronqvist@REDACTED (Mats Cronqvist) Date: Mon, 28 Feb 2005 11:36:25 +0100 Subject: binary constructor In-Reply-To: <421F6C0B.9070304@csd.uu.se> References: <20050221203109.GY55871@frogman.motivity.ca> <421F50F1.8080709@ericsson.com> <421F6C0B.9070304@csd.uu.se> Message-ID: <4222F429.1010904@ericsson.com> Richard Carlsson wrote: >[...] > For example, there is no point in doing: > > A = list_to_binary(As), > B = list_to_binary(Bs), > Bin = <> > > (creating 2 temporary binaries) since you can simply do > > Bin = list_to_binary([As,Bs]) > > if you're just concatenating bytes. well, according to timer:tc/3; <> is (marginally) faster than; list_to_binary([As,Bs]) mats From sebastian@REDACTED Mon Feb 28 12:30:46 2005 From: sebastian@REDACTED (Sebastian Bello) Date: Mon, 28 Feb 2005 09:30:46 -0200 Subject: Fw: Sessions in httpd Message-ID: <009301c51d88$f2ea3440$3000a8c0@Inswitch261> Ok, I'll take a look at it. Sebastian- ----- Original Message ----- From: To: "Sebastian Bello" Cc: Sent: Friday, February 25, 2005 6:10 PM Subject: Re: Sessions in httpd > On Fri, Feb 25, 2005 at 09:16:57AM -0200, Sebastian Bello wrote: > > Hi, > > > > does httpd support sessions? Where can I find the corresponding documentation? > > > at http://yaws.hyber.org :-) > > /klacke > > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > From richardc@REDACTED Mon Feb 28 12:37:19 2005 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 28 Feb 2005 12:37:19 +0100 Subject: binary constructor In-Reply-To: <4222F429.1010904@ericsson.com> References: <20050221203109.GY55871@frogman.motivity.ca> <421F50F1.8080709@ericsson.com> <421F6C0B.9070304@csd.uu.se> <4222F429.1010904@ericsson.com> Message-ID: <4223026F.4070300@csd.uu.se> Mats Cronqvist wrote: > well, according to timer:tc/3; > > <> > > is (marginally) faster than; > > list_to_binary([As,Bs]) Bizarre! I can't see how that is possible, except perhaps for lists of length =< 4. The first version needs to traverse the data twice to form the final binary. /Richard From jocke@REDACTED Mon Feb 28 16:40:59 2005 From: jocke@REDACTED (jocke) Date: Mon, 28 Feb 2005 16:40:59 +0100 Subject: www.trapexit.org References: Message-ID: <20050228154059.856BD46959@bang.trapexit.org> FYI: The yaws revproxy is now disabled, i.e. you do not need to bother with an alternative port anymore. Squid and Safari users should be OK now as well. /JockeMod ?r mannens fr?msta egenskap. _________________________________________________________ Sent using Mail2Forum (http://m2f.sourceforge.net) From anders.nygren@REDACTED Mon Feb 28 17:23:45 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Mon, 28 Feb 2005 10:23:45 -0600 Subject: tv not showing ets table Message-ID: Hi I create two ets tables with ets:new(workers,[named_table,set,protected]), ets:new(queue,[named_table,ordered_set,protected]), tv only shows worker as default. If I change options to show system tables the table queue is shown, with my process as the owner. So why does tv think that the table queue is a system table? /Anders Nygren From orbitz@REDACTED Mon Feb 28 22:55:29 2005 From: orbitz@REDACTED (orbitz) Date: Mon, 28 Feb 2005 16:55:29 -0500 Subject: Streaming Input In-Reply-To: References: Message-ID: <42239351.30702@ezabel.com> I'm not sure that'll work in my situation necessarily. In this protocol, only some objects have a size specification, and others don't. And the ones that don't can be variable size. It uses prefix/suffix to say when decoding should start and end. Also I don't know how much I need until I've identified what type it is and started extracting it, and since sometimes are variable in size and the protocol uses a suffix to tell me when to stop decoding that type I can't figure out how much I need. Perhaps my original idea of figuring out what type it is then sending to a special extract function for that type is no good? It seems simpler that way since I don't need to keep track of state, but more prone to issues since I need to go back to this waiting function every time I run out of data but haven't finished decoding my object. Thanks Joe Armstrong (AL/EAB) wrote: > use binaries - that's what they are for > > First write something like this: > > extract(BinIn, Need, BinAcc) -> > Got = size(BinIn), > if > Got > Need -> > {Before, After} = split_binary(BinIn, Need), > Result = concat_binary([BinAcc, Before]), > {done, Result, After}; > Got == Need -> > Result = concat_binary([BinAcc,BinIn]), > {done, Result, <<>>}; > Got < Need -> > BinAcc1 = concat_binary([BinAcc, BinIn]), > {more, Need - Got, BinAcc1} > end. > > > > here > > in extract(BinIn, Need, BinAcc) > More and Sofar are binaries > Need is the required block length > > if size(BinIn) > Need we split the block into two chunks > and return {done, Bin, After} Bin = is the data you need > otherwise {more, Need-Got, BinAcc} > > BinAcc is a binary accumulator containing all the data received so far. > > Then just arrange so code to call this > > Cheers > > /Joe > > > > > > > >>-----Original Message----- >>From: owner-erlang-questions@REDACTED >>[mailto:owner-erlang-questions@REDACTED]On Behalf Of orbitz >>Sent: den 27 februari 2005 07:49 >>To: erlang-questions@REDACTED >>Subject: Streaming Input >> >> >>I am working with a protocol where the size of the following block is >>told to me so I can just convert the next N bytes to, say, a string. >>The problem is though, I'm trying to write this so it handles >>a stream >>properly, so in the binary I have could be all N bytes that I >>need, or >>something less than N. So at first I tried: >> >>extract_string(Tail, 0, Res) -> >> {ok, {string, Res}, Tail}; >>extract_string(<>, Length, Res) -> >> extract_string(Tail, Length - 1, lists:append(Res, [H])); >>extract_string(<<>>, Length, Res) -> >> case dispatch_message() of >> {decode, _, Data} -> >> extract_string(Data, Length, Res) >> end. >> >>When the binary is empty but I still need more data it waits >>for more. >>I don't know if this is the proper idiom (it seems gross to >>me but I am >>unsure of how to do it otherwise). This is incredibly slow though. >>With a long string that I need to extract it takes a lot of >>CPU and far >>too long. So I decided to do: >> >>extract_string(Data, Length, _) -> >> <> = Data, >> {ok, {string, binary_to_list(String)}, Tail}. >> >>In terms of CPU and time this is much much better, but if I >>don't have >>all N bytes it won't work. Any suggestions? >> >> >> > > > > > From luke@REDACTED Mon Feb 28 23:13:42 2005 From: luke@REDACTED (Luke Gorrie) Date: 28 Feb 2005 23:13:42 +0100 Subject: Calling internal functions - foo::bar() ? Message-ID: Hi, I have an Erlang feature request: I'd like to be able to call unexported functions of modules from the Erlang shell. For example, if I have a module like: -module(foo). -export([a/0]). a() -> a. b() -> b. Then I would like to be able to do this /just/ in the Erlang shell: 1> foo::b(). b This is intended to /avoid/ seedy bad-software-engineering hacks. The reasons are: Today many people use export_all so that they have a convenient way to test internal functions in the shell. This has the unfortunate side-effect of letting real modules call not-explicitly-exported functions, and that in turn means that export-lists can go stale because you don't notice when they're wrong. To remove 'export_all' is dangerous and it requires you to retest your program. (What if you were "accidentally" calling unexported functions while testing before?). This sucks because typically the time you want to remove export_all is when you've just finished testing and you notice it in 'cvs diff' before checkin -- i.e. exactly when you don't want to make any changes. If you do make the effort to correct your export lists and remove your export_all's at some point then later you'll be tempted to put them back in while hacking and debugging new versions of your libraries. Personally I think that if I had foo::bar() in the shell then I wouldn't use export_all anymore. Today I use it in most of my modules. Thoughts? We have discussed this before in [1]. My memory is that Erik Stenman posted a followup in which he warmed to the idea and implemented it as a parse-transform, but maybe it's just my mind rewriting history so that people agree with me. In either case I'd prefer to have this in the compiler proper instead of a parse transform. They have this in Common Lisp and it is used for good as well as evil. I don't argue that we should add it to the whole language, I think it'd be enough that it works in the shell. [1]: http://www.erlang.org/ml-archive/erlang-questions/200209/msg00164.html P.S., who can beat this? $ find . -name "*.erl" | wc -l 813 $ find . -name "*.erl" | xargs grep '^-compile(export_all)' | wc -l 323 $ echo $[ 323 * 100 / 813 ] 39 From sean.hinde@REDACTED Mon Feb 28 23:48:07 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 28 Feb 2005 22:48:07 +0000 Subject: Calling internal functions - foo::bar() ? In-Reply-To: References: Message-ID: <4e91fe19d152a02d466fb1a975c742f9@mac.com> On 28 Feb 2005, at 22:13, Luke Gorrie wrote: > Hi, > > I have an Erlang feature request: I'd like to be able to call > unexported functions of modules from the Erlang shell. > > For example, if I have a module like: > > -module(foo). > -export([a/0]). > a() -> a. > b() -> b. > > Then I would like to be able to do this /just/ in the Erlang shell: > > 1> foo::b(). > b > > This is intended to /avoid/ seedy bad-software-engineering hacks. Seconded. > P.S., who can beat this? > > $ find . -name "*.erl" | wc -l > 813 > > $ find . -name "*.erl" | xargs grep '^-compile(export_all)' | wc -l > 323 > $ echo $[ 323 * 100 / 813 ] > 39 $ find . -name "*.erl" | wc -l 857 $ find . -name "*.erl" | xargs grep '^-compile(export_all)' | wc -l 175 $ echo $[175 * 100 / 857] 20 I'm shocked. Sean